@comunica/actor-query-operation-ask 2.4.0 → 2.5.1-alpha.32.0

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 bindings = bus_query_operation_1.ActorQueryOperation.getSafeBindings(output);
19
- const execute = () => new Promise((resolve, reject) => {
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"]}
@@ -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.4.0",
3
+ "version": "2.5.1-alpha.32.0",
4
4
  "description": "A ask query-operation actor",
5
5
  "lsd:module": true,
6
6
  "main": "lib/index.js",
@@ -28,12 +28,13 @@
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.4.0",
35
- "@comunica/core": "^2.4.0",
36
- "@comunica/types": "^2.4.0",
35
+ "@comunica/bus-query-operation": "2.5.1-alpha.32.0",
36
+ "@comunica/core": "2.5.1-alpha.32.0",
37
+ "@comunica/types": "2.5.1-alpha.32.0",
37
38
  "sparqlalgebrajs": "^4.0.0"
38
39
  },
39
40
  "scripts": {
@@ -41,5 +42,5 @@
41
42
  "build:ts": "node \"../../node_modules/typescript/bin/tsc\"",
42
43
  "build:components": "componentsjs-generator"
43
44
  },
44
- "gitHead": "cb5a1560c9ab9ebaf3335888a1411a7e1654de1e"
45
+ "gitHead": "3f04fbcb28737ec68227d694c127236ecf46235d"
45
46
  }