@comunica/actor-abstract-mediatyped
Advanced tools
Comparing version 3.2.4-alpha.47.0 to 3.3.0
@@ -1,2 +0,2 @@ | ||
import type { IAction, IActorArgs, IActorOutput, IActorTest, Mediate, TestResult } from '@comunica/core'; | ||
import type { IAction, IActorArgs, IActorOutput, IActorTest, Mediate } 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>, undefined> { | ||
export declare abstract class ActorAbstractMediaTyped<HI, HT, HO> extends Actor<IActionAbstractMediaTyped<HI>, IActorTestAbstractMediaTyped<HT>, IActorOutputAbstractMediaTyped<HO>> { | ||
constructor(args: IActorArgsMediaTyped<HI, HT, HO>); | ||
run(action: IActionAbstractMediaTyped<HI>): Promise<IActorOutputAbstractMediaTyped<HO>>; | ||
test(action: IActionAbstractMediaTyped<HI>): Promise<TestResult<IActorTestAbstractMediaTyped<HT>>>; | ||
test(action: IActionAbstractMediaTyped<HI>): Promise<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<TestResult<HT>>; | ||
abstract testHandle(action: HI, mediaType: string | undefined, context: IActionContext): Promise<HT>; | ||
/** | ||
@@ -46,3 +46,3 @@ * Run the given handle action on this actor. | ||
*/ | ||
abstract testMediaType(context: IActionContext): Promise<TestResult<boolean>>; | ||
abstract testMediaType(context: IActionContext): Promise<boolean>; | ||
/** | ||
@@ -61,3 +61,3 @@ * Get the media type of this given actor. | ||
*/ | ||
abstract testMediaTypeFormats(context: IActionContext): Promise<TestResult<boolean>>; | ||
abstract testMediaTypeFormats(context: IActionContext): Promise<boolean>; | ||
/** | ||
@@ -64,0 +64,0 @@ * Get the media type formats of this given actor. |
@@ -36,14 +36,11 @@ "use strict"; | ||
const typedAction = action; | ||
return (await this.testHandle(typedAction.handle, typedAction.handleMediaType, action.context)) | ||
.map(handle => ({ handle })); | ||
return { handle: await this.testHandle(typedAction.handle, typedAction.handleMediaType, action.context) }; | ||
} | ||
if ('mediaTypes' in action) { | ||
return (await this.testMediaType(action.context)) | ||
.map(mediaTypes => ({ mediaTypes })); | ||
return { mediaTypes: await this.testMediaType(action.context) }; | ||
} | ||
if ('mediaTypeFormats' in action) { | ||
return (await this.testMediaTypeFormats(action.context)) | ||
.map(mediaTypeFormats => ({ mediaTypeFormats })); | ||
return { mediaTypeFormats: await this.testMediaTypeFormats(action.context) }; | ||
} | ||
return (0, core_1.failTest)('Either a handle, mediaTypes or mediaTypeFormats action needs to be provided'); | ||
throw new Error('Either a handle, mediaTypes or mediaTypeFormats action needs to be provided'); | ||
} | ||
@@ -50,0 +47,0 @@ } |
@@ -1,2 +0,1 @@ | ||
import type { TestResult } from '@comunica/core'; | ||
import type { IActionContext } from '@comunica/types'; | ||
@@ -10,3 +9,3 @@ import type { IActorArgsMediaTyped } from './ActorAbstractMediaTyped'; | ||
constructor(args: IActorArgsMediaTypedFixed<HI, HT, HO>); | ||
testHandle(action: HI, mediaType: string | undefined, context: IActionContext): Promise<TestResult<HT>>; | ||
testHandle(action: HI, mediaType: string | undefined, context: IActionContext): Promise<HT>; | ||
/** | ||
@@ -19,6 +18,6 @@ * Check to see if this actor can handle the given action. | ||
*/ | ||
abstract testHandleChecked(action: HI, context: IActionContext): Promise<TestResult<HT>>; | ||
testMediaType(_context: IActionContext): Promise<TestResult<boolean>>; | ||
abstract testHandleChecked(action: HI, context: IActionContext): Promise<HT>; | ||
testMediaType(_context: IActionContext): Promise<boolean>; | ||
getMediaTypes(_context: IActionContext): Promise<Record<string, number>>; | ||
testMediaTypeFormats(_context: IActionContext): Promise<TestResult<boolean>>; | ||
testMediaTypeFormats(_context: IActionContext): Promise<boolean>; | ||
getMediaTypeFormats(_context: IActionContext): Promise<Record<string, string>>; | ||
@@ -25,0 +24,0 @@ } |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.ActorAbstractMediaTypedFixed = void 0; | ||
const core_1 = require("@comunica/core"); | ||
const ActorAbstractMediaTyped_1 = require("./ActorAbstractMediaTyped"); | ||
@@ -20,3 +19,3 @@ class ActorAbstractMediaTypedFixed extends ActorAbstractMediaTyped_1.ActorAbstractMediaTyped { | ||
if (!mediaType || !(mediaType in this.mediaTypePriorities)) { | ||
return (0, core_1.failTest)(`Unrecognized media type: ${mediaType}`); | ||
throw new Error(`Unrecognized media type: ${mediaType}`); | ||
} | ||
@@ -26,3 +25,3 @@ return await this.testHandleChecked(action, context); | ||
async testMediaType(_context) { | ||
return (0, core_1.passTestVoid)(); | ||
return true; | ||
} | ||
@@ -33,3 +32,3 @@ async getMediaTypes(_context) { | ||
async testMediaTypeFormats(_context) { | ||
return (0, core_1.passTestVoid)(); | ||
return true; | ||
} | ||
@@ -36,0 +35,0 @@ async getMediaTypeFormats(_context) { |
{ | ||
"name": "@comunica/actor-abstract-mediatyped", | ||
"version": "3.2.4-alpha.47.0", | ||
"version": "3.3.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/", | ||
@@ -44,6 +40,6 @@ "repository": { | ||
"dependencies": { | ||
"@comunica/core": "3.2.4-alpha.47.0", | ||
"@comunica/types": "3.2.4-alpha.47.0" | ||
"@comunica/core": "^3.3.0", | ||
"@comunica/types": "^3.3.0" | ||
}, | ||
"gitHead": "85bd4c5cf07dfc293ebbc3a1416b70e2db8bfc48" | ||
"gitHead": "02bde397d206f1f5a523643a6a604c89e792e2f9" | ||
} |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
0
68296
286
+ Added@comunica/core@3.3.0(transitive)
+ Added@comunica/types@3.3.0(transitive)
- Removed@comunica/core@3.2.4-alpha.47.0(transitive)
- Removed@comunica/types@3.2.4-alpha.47.0(transitive)
- Removedlru-cache@10.4.3(transitive)
Updated@comunica/core@^3.3.0
Updated@comunica/types@^3.3.0