@comunica/actor-query-operation-wrap-stream 4.5.0 → 5.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "@context": [
3
- "https://linkedsoftwaredependencies.org/bundles/npm/@comunica/actor-query-operation-wrap-stream/^4.0.0/components/context.jsonld",
4
- "https://linkedsoftwaredependencies.org/bundles/npm/@comunica/core/^4.0.0/components/context.jsonld",
5
- "https://linkedsoftwaredependencies.org/bundles/npm/@comunica/bus-query-operation/^4.0.0/components/context.jsonld"
3
+ "https://linkedsoftwaredependencies.org/bundles/npm/@comunica/actor-query-operation-wrap-stream/^5.0.0/components/context.jsonld",
4
+ "https://linkedsoftwaredependencies.org/bundles/npm/@comunica/core/^5.0.0/components/context.jsonld",
5
+ "https://linkedsoftwaredependencies.org/bundles/npm/@comunica/bus-query-operation/^5.0.0/components/context.jsonld"
6
6
  ],
7
7
  "@id": "npmd:@comunica/actor-query-operation-wrap-stream",
8
8
  "components": [
@@ -45,37 +45,37 @@
45
45
  "genericTypeInstances": [
46
46
  {
47
47
  "@type": "ParameterRangeGenericTypeReference",
48
- "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_I"
48
+ "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^5.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_I"
49
49
  },
50
50
  {
51
51
  "@type": "ParameterRangeGenericTypeReference",
52
- "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_T"
52
+ "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^5.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_T"
53
53
  },
54
54
  {
55
55
  "@type": "ParameterRangeGenericTypeReference",
56
- "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_O"
56
+ "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^5.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_O"
57
57
  },
58
58
  {
59
59
  "@type": "ParameterRangeGenericTypeReference",
60
- "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_TS"
60
+ "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^5.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_TS"
61
61
  }
62
62
  ]
63
63
  },
64
64
  {
65
65
  "@type": "ParameterRangeGenericTypeReference",
66
- "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_I"
66
+ "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^5.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_I"
67
67
  },
68
68
  {
69
69
  "@type": "ParameterRangeGenericTypeReference",
70
- "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_T"
70
+ "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^5.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_T"
71
71
  },
72
72
  {
73
73
  "@type": "ParameterRangeGenericTypeReference",
74
- "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_O"
74
+ "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^5.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_O"
75
75
  },
76
76
  {
77
77
  "@type": "ParameterRangeGenericTypeReference",
78
- "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_TS"
78
+ "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^5.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_TS"
79
79
  }
80
80
  ]
81
81
  },
@@ -112,19 +112,19 @@
112
112
  "genericTypeInstances": [
113
113
  {
114
114
  "@type": "ParameterRangeGenericTypeReference",
115
- "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_I"
115
+ "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^5.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_I"
116
116
  },
117
117
  {
118
118
  "@type": "ParameterRangeGenericTypeReference",
119
- "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_T"
119
+ "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^5.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_T"
120
120
  },
121
121
  {
122
122
  "@type": "ParameterRangeGenericTypeReference",
123
- "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_O"
123
+ "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^5.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_O"
124
124
  },
125
125
  {
126
126
  "@type": "ParameterRangeGenericTypeReference",
127
- "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_TS"
127
+ "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^5.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_TS"
128
128
  }
129
129
  ]
130
130
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "@context": [
3
- "https://linkedsoftwaredependencies.org/bundles/npm/@comunica/actor-query-operation-wrap-stream/^4.0.0/components/context.jsonld"
3
+ "https://linkedsoftwaredependencies.org/bundles/npm/@comunica/actor-query-operation-wrap-stream/^5.0.0/components/context.jsonld"
4
4
  ],
5
5
  "@id": "npmd:@comunica/actor-query-operation-wrap-stream",
6
6
  "@type": "Module",
@@ -3,7 +3,7 @@
3
3
  "https://linkedsoftwaredependencies.org/bundles/npm/componentsjs/^6.0.0/components/context.jsonld",
4
4
  {
5
5
  "npmd": "https://linkedsoftwaredependencies.org/bundles/npm/",
6
- "caqows": "npmd:@comunica/actor-query-operation-wrap-stream/^4.0.0/",
6
+ "caqows": "npmd:@comunica/actor-query-operation-wrap-stream/^5.0.0/",
7
7
  "ActorQueryOperationWrapStream": {
8
8
  "@id": "caqows:components/ActorQueryOperationWrapStream.jsonld#ActorQueryOperationWrapStream",
9
9
  "@prefix": true,
@@ -4,7 +4,7 @@ import { ActorQueryOperation } from '@comunica/bus-query-operation';
4
4
  import { ActionContextKey } from '@comunica/core';
5
5
  import type { TestResult, IActorTest } from '@comunica/core';
6
6
  import type { IActionContext, IQueryOperationResult } from '@comunica/types';
7
- import type { Algebra } from 'sparqlalgebrajs';
7
+ import type { Algebra } from '@comunica/utils-algebra';
8
8
  /**
9
9
  * A comunica Wrap Stream Query Operation Actor.
10
10
  */
@@ -35,4 +35,4 @@ export interface IActorQueryOperationWrapStreamArgs extends IActorQueryOperation
35
35
  /**
36
36
  * Key that that stores the last executed operation
37
37
  */
38
- export declare const KEY_CONTEXT_WRAPPED_QUERY_OPERATION: ActionContextKey<Algebra.Operation>;
38
+ export declare const KEY_CONTEXT_WRAPPED_QUERY_OPERATION: ActionContextKey<Algebra.BaseOperation>;
@@ -7,8 +7,12 @@ const core_1 = require("@comunica/core");
7
7
  * A comunica Wrap Stream Query Operation Actor.
8
8
  */
9
9
  class ActorQueryOperationWrapStream extends bus_query_operation_1.ActorQueryOperation {
10
+ mediatorIteratorTransform;
11
+ mediatorQueryOperation;
10
12
  constructor(args) {
11
13
  super(args);
14
+ this.mediatorIteratorTransform = args.mediatorIteratorTransform;
15
+ this.mediatorQueryOperation = args.mediatorQueryOperation;
12
16
  }
13
17
  async test(action) {
14
18
  if (action.context.get(exports.KEY_CONTEXT_WRAPPED_QUERY_OPERATION) === action.operation) {
@@ -1 +1 @@
1
- {"version":3,"file":"ActorQueryOperationWrapStream.js","sourceRoot":"","sources":["ActorQueryOperationWrapStream.ts"],"names":[],"mappings":";;;AAMA,uEAAoE;AACpE,yCAAsE;AAOtE;;GAEG;AACH,MAAa,6BAA8B,SAAQ,yCAAmB;IAIpE,YAAmB,IAAwC;QACzD,KAAK,CAAC,IAAI,CAAC,CAAC;IACd,CAAC;IAEM,KAAK,CAAC,IAAI,CAAC,MAA6B;QAC7C,IAAI,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,2CAAmC,CAAC,KAAK,MAAM,CAAC,SAAS,EAAE,CAAC;YACjF,OAAO,IAAA,eAAQ,EAAC,4CAA4C,CAAC,CAAC;QAChE,CAAC;QACD,mDAAmD;QACnD,OAAO,IAAA,eAAQ,EAAC,EAAE,YAAY,EAAE,MAAM,CAAC,iBAAiB,EAAE,CAAC,CAAC;IAC9D,CAAC;IAEM,KAAK,CAAC,GAAG,CAAC,MAA6B;QAC5C,kGAAkG;QAClG,0DAA0D;QAC1D,MAAM,CAAC,OAAO,GAAG,IAAI,CAAC,iBAAiB,CAAC,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC;QAC1E,MAAM,MAAM,GAA0B,MAAM,IAAI,CAAC,s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G,CAAC,2CAAmC,EAAE,SAAS,CAAC,CAAC;IACrE,CAAC;CACF;AAtED,sEAsEC;AAaD;;GAEG;AACU,QAAA,mCAAmC,GAAG,IAAI,uBAAgB,CACrE,yCAAyC,CAC1C,CAAC","sourcesContent":["import type { MediatorIteratorTransform } from '@comunica/bus-iterator-transform';\nimport type {\n IActionQueryOperation,\n IActorQueryOperationArgs,\n MediatorQueryOperation,\n} from '@comunica/bus-query-operation';\nimport { ActorQueryOperation } from '@comunica/bus-query-operation';\nimport { ActionContextKey, failTest, passTest } from '@comunica/core';\nimport type { TestResult, IActorTest } from '@comunica/core';\nimport type { IActionContext, IQueryOperationResult, MetadataBindings, MetadataQuads } from '@comunica/types';\nimport type * as RDF from '@rdfjs/types';\nimport type { AsyncIterator } from 'asynciterator';\nimport type { Algebra } from 'sparqlalgebrajs';\n\n/**\n * A comunica Wrap Stream Query Operation Actor.\n */\nexport class ActorQueryOperationWrapStream extends ActorQueryOperation {\n public readonly mediatorIteratorTransform: MediatorIteratorTransform;\n public readonly mediatorQueryOperation: MediatorQueryOperation;\n\n public constructor(args: IActorQueryOperationWrapStreamArgs) {\n super(args);\n }\n\n public async test(action: IActionQueryOperation): Promise<TestResult<IActorTest>> {\n if (action.context.get(KEY_CONTEXT_WRAPPED_QUERY_OPERATION) === action.operation) {\n return failTest('Unable to wrap query source multiple times');\n }\n // Ensure this is always run if not already wrapped\n return passTest({ httpRequests: Number.NEGATIVE_INFINITY });\n }\n\n public async run(action: IActionQueryOperation): Promise<IQueryOperationResult> {\n // Prevent infinite recursion. In consequent query operation calls this key should be set to false\n // To allow the operation to wrap ALL query operation runs\n action.context = this.setContextWrapped(action.operation, action.context);\n const output: IQueryOperationResult = await this.mediatorQueryOperation.mediate(action);\n switch (output.type) {\n case 'bindings': {\n const bindingIteratorTransformed = await this.mediatorIteratorTransform.mediate(\n {\n type: 'bindings',\n operation: action.operation.type,\n stream: output.bindingsStream,\n metadata: output.metadata,\n originalAction: action,\n context: action.context,\n },\n );\n output.bindingsStream =\n <AsyncIterator<RDF.Bindings>> bindingIteratorTransformed.stream;\n output.metadata =\n <() => Promise<MetadataBindings>> bindingIteratorTransformed.metadata;\n break;\n }\n case 'quads': {\n const iteratorTransformed = await this.mediatorIteratorTransform.mediate(\n {\n type: 'quads',\n operation: action.operation.type,\n stream: output.quadStream,\n metadata: output.metadata,\n context: action.context,\n originalAction: action,\n },\n );\n output.quadStream = <AsyncIterator<RDF.Quad>> iteratorTransformed.stream;\n output.metadata = <() => Promise<MetadataQuads>> iteratorTransformed.metadata;\n break;\n }\n default: {\n break;\n }\n }\n return output;\n }\n\n /**\n * Sets KEY_CONTEXT_WRAPPED_QUERY_OPERATION to the operation being executed.\n * @param operation The query operation.\n * @param context The current action context.\n * @returns A new action context with the operation marked as wrapped.\n */\n public setContextWrapped(operation: Algebra.Operation, context: IActionContext): IActionContext {\n return context.set(KEY_CONTEXT_WRAPPED_QUERY_OPERATION, operation);\n }\n}\n\nexport interface IActorQueryOperationWrapStreamArgs extends IActorQueryOperationArgs {\n /**\n * Mediator that runs all transforms defined by user over the output stream of the query operation\n */\n mediatorIteratorTransform: MediatorIteratorTransform;\n /**\n * Mediator that runs the next query operation\n */\n mediatorQueryOperation: MediatorQueryOperation;\n}\n\n/**\n * Key that that stores the last executed operation\n */\nexport const KEY_CONTEXT_WRAPPED_QUERY_OPERATION = new ActionContextKey<Algebra.Operation>(\n '@comunica/actor-query-operation:wrapped',\n);\n"]}
1
+ {"version":3,"file":"ActorQueryOperationWrapStream.js","sourceRoot":"","sources":["ActorQueryOperationWrapStream.ts"],"names":[],"mappings":";;;AAMA,uEAAoE;AACpE,yCAAsE;AAOtE;;GAEG;AACH,MAAa,6BAA8B,SAAQ,yCAAmB;IACpD,yBAAyB,CAA4B;IACrD,sBAAsB,CAAyB;IAE/D,YAAmB,IAAwC;QACzD,KAAK,CAAC,IAAI,CAAC,CAAC;QACZ,IAAI,CAAC,yBAAyB,GAAG,IAAI,CAAC,yBAAyB,CAA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mBAAmB,GAAG,MAAM,IAAI,CAAC,yBAAyB,CAAC,OAAO,CACtE;oBACE,IAAI,EAAE,OAAO;oBACb,SAAS,EAAE,MAAM,CAAC,SAAS,CAAC,IAAI;oBAChC,MAAM,EAAE,MAAM,CAAC,UAAU;oBACzB,QAAQ,EAAE,MAAM,CAAC,QAAQ;oBACzB,OAAO,EAAE,MAAM,CAAC,OAAO;oBACvB,cAAc,EAAE,MAAM;iBACvB,CACF,CAAC;gBACF,MAAM,CAAC,UAAU,GAA6B,mBAAmB,CAAC,MAAM,CAAC;gBACzE,MAAM,CAAC,QAAQ,GAAkC,mBAAmB,CAAC,QAAQ,CAAC;gBAC9E,MAAM;YACR,CAAC;YACD,OAAO,CAAC,CAAC,CAAC;gBACR,MAAM;YACR,CAAC;QACH,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;IAED;;;;;OAKG;IACI,iBAAiB,CAAC,SAA4B,EAAE,OAAuB;QAC5E,OAAO,OAAO,CAAC,GAAG,CAAC,2CAAmC,EAAE,SAAS,CAAC,CAAC;IACrE,CAAC;CACF;AAxED,sEAwEC;AAaD;;GAEG;AACU,QAAA,mCAAmC,GAAG,IAAI,uBAAgB,CACrE,yCAAyC,CAC1C,CAAC","sourcesContent":["import type { MediatorIteratorTransform } from '@comunica/bus-iterator-transform';\nimport type {\n IActionQueryOperation,\n IActorQueryOperationArgs,\n MediatorQueryOperation,\n} from '@comunica/bus-query-operation';\nimport { ActorQueryOperation } from '@comunica/bus-query-operation';\nimport { ActionContextKey, failTest, passTest } from '@comunica/core';\nimport type { TestResult, IActorTest } from '@comunica/core';\nimport type { IActionContext, IQueryOperationResult, MetadataBindings, MetadataQuads } from '@comunica/types';\nimport type { Algebra } from '@comunica/utils-algebra';\nimport type * as RDF from '@rdfjs/types';\nimport type { AsyncIterator } from 'asynciterator';\n\n/**\n * A comunica Wrap Stream Query Operation Actor.\n */\nexport class ActorQueryOperationWrapStream extends ActorQueryOperation {\n public readonly mediatorIteratorTransform: MediatorIteratorTransform;\n public readonly mediatorQueryOperation: MediatorQueryOperation;\n\n public constructor(args: IActorQueryOperationWrapStreamArgs) {\n super(args);\n this.mediatorIteratorTransform = args.mediatorIteratorTransform;\n this.mediatorQueryOperation = args.mediatorQueryOperation;\n }\n\n public async test(action: IActionQueryOperation): Promise<TestResult<IActorTest>> {\n if (action.context.get(KEY_CONTEXT_WRAPPED_QUERY_OPERATION) === action.operation) {\n return failTest('Unable to wrap query source multiple times');\n }\n // Ensure this is always run if not already wrapped\n return passTest({ httpRequests: Number.NEGATIVE_INFINITY });\n }\n\n public async run(action: IActionQueryOperation): Promise<IQueryOperationResult> {\n // Prevent infinite recursion. In consequent query operation calls this key should be set to false\n // To allow the operation to wrap ALL query operation runs\n action.context = this.setContextWrapped(action.operation, action.context);\n const output: IQueryOperationResult = await this.mediatorQueryOperation.mediate(action);\n switch (output.type) {\n case 'bindings': {\n const bindingIteratorTransformed = await this.mediatorIteratorTransform.mediate(\n {\n type: 'bindings',\n operation: action.operation.type,\n stream: output.bindingsStream,\n metadata: output.metadata,\n originalAction: action,\n context: action.context,\n },\n );\n output.bindingsStream =\n <AsyncIterator<RDF.Bindings>> bindingIteratorTransformed.stream;\n output.metadata =\n <() => Promise<MetadataBindings>> bindingIteratorTransformed.metadata;\n break;\n }\n case 'quads': {\n const iteratorTransformed = await this.mediatorIteratorTransform.mediate(\n {\n type: 'quads',\n operation: action.operation.type,\n stream: output.quadStream,\n metadata: output.metadata,\n context: action.context,\n originalAction: action,\n },\n );\n output.quadStream = <AsyncIterator<RDF.Quad>> iteratorTransformed.stream;\n output.metadata = <() => Promise<MetadataQuads>> iteratorTransformed.metadata;\n break;\n }\n default: {\n break;\n }\n }\n return output;\n }\n\n /**\n * Sets KEY_CONTEXT_WRAPPED_QUERY_OPERATION to the operation being executed.\n * @param operation The query operation.\n * @param context The current action context.\n * @returns A new action context with the operation marked as wrapped.\n */\n public setContextWrapped(operation: Algebra.Operation, context: IActionContext): IActionContext {\n return context.set(KEY_CONTEXT_WRAPPED_QUERY_OPERATION, operation);\n }\n}\n\nexport interface IActorQueryOperationWrapStreamArgs extends IActorQueryOperationArgs {\n /**\n * Mediator that runs all transforms defined by user over the output stream of the query operation\n */\n mediatorIteratorTransform: MediatorIteratorTransform;\n /**\n * Mediator that runs the next query operation\n */\n mediatorQueryOperation: MediatorQueryOperation;\n}\n\n/**\n * Key that that stores the last executed operation\n */\nexport const KEY_CONTEXT_WRAPPED_QUERY_OPERATION = new ActionContextKey<Algebra.Operation>(\n '@comunica/actor-query-operation:wrapped',\n);\n"]}
package/lib/index.d.ts CHANGED
File without changes
package/lib/index.js CHANGED
File without changes
package/lib/index.js.map CHANGED
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@comunica/actor-query-operation-wrap-stream",
3
- "version": "4.5.0",
3
+ "version": "5.0.2",
4
4
  "description": "A wrap-stream query-operation actor",
5
5
  "lsd:module": true,
6
6
  "license": "MIT",
@@ -41,11 +41,11 @@
41
41
  "build:components": "componentsjs-generator"
42
42
  },
43
43
  "dependencies": {
44
- "@comunica/bus-iterator-transform": "^4.5.0",
45
- "@comunica/bus-query-operation": "^4.5.0",
46
- "@comunica/core": "^4.5.0",
47
- "@comunica/types": "^4.5.0",
48
- "sparqlalgebrajs": "^5.0.2"
44
+ "@comunica/bus-iterator-transform": "^5.0.2",
45
+ "@comunica/bus-query-operation": "^5.0.2",
46
+ "@comunica/core": "^5.0.2",
47
+ "@comunica/types": "^5.0.0",
48
+ "@comunica/utils-algebra": "^5.0.0"
49
49
  },
50
- "gitHead": "2bcd98c387a021fc5c08d375793c205ca3d1bf0d"
50
+ "gitHead": "3b29f914010fd2fc56682a0ceff962ef6ff24f32"
51
51
  }