@comunica/actor-query-operation-ask 2.4.0 → 2.5.1
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.
|
@@ -15,19 +15,8 @@ class ActorQueryOperationAsk extends bus_query_operation_1.ActorQueryOperationTy
|
|
|
15
15
|
async runOperation(operation, context) {
|
|
16
16
|
// Call other query operations like this:
|
|
17
17
|
const output = await this.mediatorQueryOperation.mediate({ operation: operation.input, context });
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
// Resolve to true if we find one element, and close immediately
|
|
21
|
-
bindings.bindingsStream.once('data', () => {
|
|
22
|
-
resolve(true);
|
|
23
|
-
bindings.bindingsStream.close();
|
|
24
|
-
});
|
|
25
|
-
// If we reach the end of the stream without finding anything, resolve to false
|
|
26
|
-
bindings.bindingsStream.on('end', () => resolve(false));
|
|
27
|
-
// Reject if an error occurs in the stream
|
|
28
|
-
bindings.bindingsStream.on('error', reject);
|
|
29
|
-
});
|
|
30
|
-
return { type: 'boolean', execute };
|
|
18
|
+
const { bindingsStream } = bus_query_operation_1.ActorQueryOperation.getSafeBindings(output);
|
|
19
|
+
return { type: 'boolean', execute: async () => (await bindingsStream.take(1).toArray()).length === 1 };
|
|
31
20
|
}
|
|
32
21
|
}
|
|
33
22
|
exports.ActorQueryOperationAsk = ActorQueryOperationAsk;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ActorQueryOperationAsk.js","sourceRoot":"","sources":["ActorQueryOperationAsk.ts"],"names":[],"mappings":";;;AACA,uEAAsG;AAStG;;GAEG;AACH,MAAa,sBAAuB,SAAQ,sDAA6C;IACvF,YAAmB,IAA2C;QAC5D,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IACrB,CAAC;IAEM,KAAK,CAAC,aAAa,CAAC,SAAsB,EAAE,OAAuB;QACxE,OAAO,IAAI,CAAC;IACd,CAAC;IAEM,KAAK,CAAC,YAAY,CAAC,SAAsB,EAAE,OAAuB;QACvE,yCAAyC;QACzC,MAAM,MAAM,GAA0B,MAAM,IAAI,CAAC,sBAAsB,CAAC,OAAO,CAC7E,EAAE,SAAS,EAAE,SAAS,CAAC,KAAK,EAAE,OAAO,EAAE,CACxC,CAAC;QACF,MAAM,EAAE,cAAc,EAAE,GAAkC,yCAAmB,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC;QACtG,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,IAAG,EAAE,CAAC,CAAC,MAAM,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;IACxG,CAAC;CACF;AAjBD,wDAiBC","sourcesContent":["import type { IActorQueryOperationTypedMediatedArgs } from '@comunica/bus-query-operation';\nimport { ActorQueryOperation, ActorQueryOperationTypedMediated } from '@comunica/bus-query-operation';\nimport type { IActorTest } from '@comunica/core';\nimport type {\n IActionContext,\n IQueryOperationResult,\n IQueryOperationResultBindings,\n} from '@comunica/types';\nimport type { Algebra } from 'sparqlalgebrajs';\n\n/**\n * A comunica Ask Query Operation Actor.\n */\nexport class ActorQueryOperationAsk extends ActorQueryOperationTypedMediated<Algebra.Ask> {\n public constructor(args: IActorQueryOperationTypedMediatedArgs) {\n super(args, 'ask');\n }\n\n public async testOperation(operation: Algebra.Ask, context: IActionContext): Promise<IActorTest> {\n return true;\n }\n\n public async runOperation(operation: Algebra.Ask, context: IActionContext): Promise<IQueryOperationResult> {\n // Call other query operations like this:\n const output: IQueryOperationResult = await this.mediatorQueryOperation.mediate(\n { operation: operation.input, context },\n );\n const { bindingsStream }: IQueryOperationResultBindings = ActorQueryOperation.getSafeBindings(output);\n return { type: 'boolean', execute: async() => (await bindingsStream.take(1).toArray()).length === 1 };\n }\n}\n"]}
|
package/lib/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2DAAyC","sourcesContent":["export * from './ActorQueryOperationAsk';\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@comunica/actor-query-operation-ask",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.5.1",
|
|
4
4
|
"description": "A ask query-operation actor",
|
|
5
5
|
"lsd:module": true,
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -28,18 +28,19 @@
|
|
|
28
28
|
"files": [
|
|
29
29
|
"components",
|
|
30
30
|
"lib/**/*.d.ts",
|
|
31
|
-
"lib/**/*.js"
|
|
31
|
+
"lib/**/*.js",
|
|
32
|
+
"lib/**/*.js.map"
|
|
32
33
|
],
|
|
33
34
|
"dependencies": {
|
|
34
|
-
"@comunica/bus-query-operation": "^2.
|
|
35
|
-
"@comunica/core": "^2.
|
|
36
|
-
"@comunica/types": "^2.
|
|
37
|
-
"sparqlalgebrajs": "^4.0.
|
|
35
|
+
"@comunica/bus-query-operation": "^2.5.1",
|
|
36
|
+
"@comunica/core": "^2.5.1",
|
|
37
|
+
"@comunica/types": "^2.5.1",
|
|
38
|
+
"sparqlalgebrajs": "^4.0.5"
|
|
38
39
|
},
|
|
39
40
|
"scripts": {
|
|
40
41
|
"build": "npm run build:ts && npm run build:components",
|
|
41
42
|
"build:ts": "node \"../../node_modules/typescript/bin/tsc\"",
|
|
42
43
|
"build:components": "componentsjs-generator"
|
|
43
44
|
},
|
|
44
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "d64e87fad4a616224c210c2d22b38f6f9b00e1ea"
|
|
45
46
|
}
|