Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@comunica/actor-abstract-mediatyped

Package Overview
Dependencies
Maintainers
5
Versions
97
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@comunica/actor-abstract-mediatyped - npm Package Compare versions

Comparing version 3.2.1 to 3.2.4-alpha.47.0

12

lib/ActorAbstractMediaTyped.d.ts

@@ -1,2 +0,2 @@

import type { IAction, IActorArgs, IActorOutput, IActorTest, Mediate } from '@comunica/core';
import type { IAction, IActorArgs, IActorOutput, IActorTest, Mediate, TestResult } from '@comunica/core';
import { Actor } from '@comunica/core';

@@ -15,6 +15,6 @@ import type { IActionContext } from '@comunica/types';

*/
export declare abstract class ActorAbstractMediaTyped<HI, HT, HO> extends Actor<IActionAbstractMediaTyped<HI>, IActorTestAbstractMediaTyped<HT>, IActorOutputAbstractMediaTyped<HO>> {
export declare abstract class ActorAbstractMediaTyped<HI, HT, HO> extends Actor<IActionAbstractMediaTyped<HI>, IActorTestAbstractMediaTyped<HT>, IActorOutputAbstractMediaTyped<HO>, undefined> {
constructor(args: IActorArgsMediaTyped<HI, HT, HO>);
run(action: IActionAbstractMediaTyped<HI>): Promise<IActorOutputAbstractMediaTyped<HO>>;
test(action: IActionAbstractMediaTyped<HI>): Promise<IActorTestAbstractMediaTyped<HT>>;
test(action: IActionAbstractMediaTyped<HI>): Promise<TestResult<IActorTestAbstractMediaTyped<HT>>>;
/**

@@ -29,3 +29,3 @@ * Check if this actor can run the given handle action,

*/
abstract testHandle(action: HI, mediaType: string | undefined, context: IActionContext): Promise<HT>;
abstract testHandle(action: HI, mediaType: string | undefined, context: IActionContext): Promise<TestResult<HT>>;
/**

@@ -46,3 +46,3 @@ * Run the given handle action on this actor.

*/
abstract testMediaType(context: IActionContext): Promise<boolean>;
abstract testMediaType(context: IActionContext): Promise<TestResult<boolean>>;
/**

@@ -61,3 +61,3 @@ * Get the media type of this given actor.

*/
abstract testMediaTypeFormats(context: IActionContext): Promise<boolean>;
abstract testMediaTypeFormats(context: IActionContext): Promise<TestResult<boolean>>;
/**

@@ -64,0 +64,0 @@ * Get the media type formats of this given actor.

@@ -36,11 +36,14 @@ "use strict";

const typedAction = action;
return { handle: await this.testHandle(typedAction.handle, typedAction.handleMediaType, action.context) };
return (await this.testHandle(typedAction.handle, typedAction.handleMediaType, action.context))
.map(handle => ({ handle }));
}
if ('mediaTypes' in action) {
return { mediaTypes: await this.testMediaType(action.context) };
return (await this.testMediaType(action.context))
.map(mediaTypes => ({ mediaTypes }));
}
if ('mediaTypeFormats' in action) {
return { mediaTypeFormats: await this.testMediaTypeFormats(action.context) };
return (await this.testMediaTypeFormats(action.context))
.map(mediaTypeFormats => ({ mediaTypeFormats }));
}
throw new Error('Either a handle, mediaTypes or mediaTypeFormats action needs to be provided');
return (0, core_1.failTest)('Either a handle, mediaTypes or mediaTypeFormats action needs to be provided');
}

@@ -47,0 +50,0 @@ }

@@ -0,1 +1,2 @@

import type { TestResult } from '@comunica/core';
import type { IActionContext } from '@comunica/types';

@@ -9,3 +10,3 @@ import type { IActorArgsMediaTyped } from './ActorAbstractMediaTyped';

constructor(args: IActorArgsMediaTypedFixed<HI, HT, HO>);
testHandle(action: HI, mediaType: string | undefined, context: IActionContext): Promise<HT>;
testHandle(action: HI, mediaType: string | undefined, context: IActionContext): Promise<TestResult<HT>>;
/**

@@ -18,6 +19,6 @@ * Check to see if this actor can handle the given action.

*/
abstract testHandleChecked(action: HI, context: IActionContext): Promise<HT>;
testMediaType(_context: IActionContext): Promise<boolean>;
abstract testHandleChecked(action: HI, context: IActionContext): Promise<TestResult<HT>>;
testMediaType(_context: IActionContext): Promise<TestResult<boolean>>;
getMediaTypes(_context: IActionContext): Promise<Record<string, number>>;
testMediaTypeFormats(_context: IActionContext): Promise<boolean>;
testMediaTypeFormats(_context: IActionContext): Promise<TestResult<boolean>>;
getMediaTypeFormats(_context: IActionContext): Promise<Record<string, string>>;

@@ -24,0 +25,0 @@ }

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ActorAbstractMediaTypedFixed = void 0;
const core_1 = require("@comunica/core");
const ActorAbstractMediaTyped_1 = require("./ActorAbstractMediaTyped");

@@ -19,3 +20,3 @@ class ActorAbstractMediaTypedFixed extends ActorAbstractMediaTyped_1.ActorAbstractMediaTyped {

if (!mediaType || !(mediaType in this.mediaTypePriorities)) {
throw new Error(`Unrecognized media type: ${mediaType}`);
return (0, core_1.failTest)(`Unrecognized media type: ${mediaType}`);
}

@@ -25,3 +26,3 @@ return await this.testHandleChecked(action, context);

async testMediaType(_context) {
return true;
return (0, core_1.passTestVoid)();
}

@@ -32,3 +33,3 @@ async getMediaTypes(_context) {

async testMediaTypeFormats(_context) {
return true;
return (0, core_1.passTestVoid)();
}

@@ -35,0 +36,0 @@ async getMediaTypeFormats(_context) {

{
"name": "@comunica/actor-abstract-mediatyped",
"version": "3.2.1",
"version": "3.2.4-alpha.47.0",
"description": "An abstract actor for handling mediatypes",
"lsd:module": true,
"license": "MIT",
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/comunica-association"
},
"homepage": "https://comunica.dev/",

@@ -40,6 +44,6 @@ "repository": {

"dependencies": {
"@comunica/core": "^3.2.1",
"@comunica/types": "^3.2.1"
"@comunica/core": "3.2.4-alpha.47.0",
"@comunica/types": "3.2.4-alpha.47.0"
},
"gitHead": "f558377c3cefbd1606c51ede80440b862e7dda4f"
"gitHead": "85bd4c5cf07dfc293ebbc3a1416b70e2db8bfc48"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc