@comunica/mediator-combine-union
Advanced tools
Comparing version 3.2.4-alpha.47.0 to 3.3.0
@@ -1,2 +0,2 @@ | ||
import type { Actor, IAction, IActorOutput, IActorTest, IMediatorArgs, TestResult } from '@comunica/core'; | ||
import type { Actor, IAction, IActorOutput, IActorTest, IMediatorArgs } from '@comunica/core'; | ||
import { Mediator } from '@comunica/core'; | ||
@@ -8,16 +8,16 @@ /** | ||
*/ | ||
export declare class MediatorCombineUnion<A extends Actor<I, T, O, TS>, I extends IAction, T extends IActorTest, O extends IActorOutput, TS = undefined> extends Mediator<A, I, T, O, TS> implements IMediatorCombineUnionArgs<A, I, T, O, TS> { | ||
readonly filterFailures: boolean | undefined; | ||
export declare class MediatorCombineUnion<A extends Actor<I, T, O>, I extends IAction, T extends IActorTest, O extends IActorOutput> extends Mediator<A, I, T, O> implements IMediatorCombineUnionArgs<A, I, T, O> { | ||
readonly filterErrors: boolean | undefined; | ||
readonly field: string; | ||
readonly combiner: (results: O[]) => O; | ||
constructor(args: IMediatorCombineUnionArgs<A, I, T, O, TS>); | ||
constructor(args: IMediatorCombineUnionArgs<A, I, T, O>); | ||
mediate(action: I): Promise<O>; | ||
protected mediateWith(): Promise<TestResult<any, TS>>; | ||
protected mediateWith(): Promise<A>; | ||
protected createCombiner(): (results: O[]) => O; | ||
} | ||
export interface IMediatorCombineUnionArgs<A extends Actor<I, T, O, TS>, I extends IAction, T extends IActorTest, O extends IActorOutput, TS = undefined> extends IMediatorArgs<A, I, T, O, TS> { | ||
export interface IMediatorCombineUnionArgs<A extends Actor<I, T, O>, I extends IAction, T extends IActorTest, O extends IActorOutput> extends IMediatorArgs<A, I, T, O> { | ||
/** | ||
* If actors that throw test errors should be ignored | ||
*/ | ||
filterFailures?: boolean; | ||
filterErrors?: boolean; | ||
/** | ||
@@ -24,0 +24,0 @@ * The field name of the test result field over which must be mediated. |
@@ -23,23 +23,19 @@ "use strict"; | ||
} | ||
if (this.filterFailures) { | ||
if (this.filterErrors) { | ||
const _testResults = []; | ||
for (const result of testResults) { | ||
const reply = await result.reply; | ||
if (reply.isPassed()) { | ||
try { | ||
await result.reply; | ||
_testResults.push(result); | ||
} | ||
catch { | ||
// Ignore errors | ||
} | ||
} | ||
testResults = _testResults; | ||
} | ||
// Delegate reply errors. | ||
const sideDatas = []; | ||
await Promise.all(testResults.map(async ({ reply }, i) => { | ||
const awaited = (await reply); | ||
const value = awaited.getOrThrow(); | ||
sideDatas[i] = awaited.getSideData(); | ||
return value; | ||
})); | ||
// Delegate test errors. | ||
await Promise.all(testResults.map(({ reply }) => reply)); | ||
// Run action on all actors. | ||
const results = await Promise.all(testResults | ||
.map((result, i) => result.actor.runObservable(action, sideDatas[i]))); | ||
const results = await Promise.all(testResults.map(result => result.actor.runObservable(action))); | ||
// Return the combined results. | ||
@@ -46,0 +42,0 @@ return this.combiner(results); |
{ | ||
"name": "@comunica/mediator-combine-union", | ||
"version": "3.2.4-alpha.47.0", | ||
"version": "3.3.0", | ||
"description": "A combine-union mediator", | ||
"lsd:module": true, | ||
"license": "MIT", | ||
"funding": { | ||
"type": "opencollective", | ||
"url": "https://opencollective.com/comunica-association" | ||
}, | ||
"homepage": "https://comunica.dev/", | ||
@@ -42,5 +38,5 @@ "repository": { | ||
"dependencies": { | ||
"@comunica/core": "3.2.4-alpha.47.0" | ||
"@comunica/core": "^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
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
26644
104
+ 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