@lde/pipeline 0.28.6 → 0.28.7
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.
- package/dist/pipeline.d.ts.map +1 -1
- package/dist/pipeline.js +19 -8
- package/package.json +1 -1
package/dist/pipeline.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pipeline.d.ts","sourceRoot":"","sources":["../src/pipeline.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAEjD,OAAO,EACL,KAAK,oBAAoB,EAE1B,MAAM,4BAA4B,CAAC;AAQpC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AACpE,OAAO,KAAK,EAEV,gBAAgB,EACjB,MAAM,uBAAuB,CAAC;AAE/B,wDAAwD;AACxD,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,gDAAgD;IAChD,gBAAgB,CAAC,EAAE,aAAa,CAAC;CAClC;AAED,MAAM,WAAW,eAAe;IAC9B,eAAe,EAAE,eAAe,CAAC;IACjC,MAAM,EAAE,KAAK,EAAE,CAAC;IAChB,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAC3B,OAAO,CAAC,EAAE,cAAc,EAAE,CAAC;IAC3B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,oBAAoB,CAAC,EAAE,oBAAoB,CAAC;IAC5C,QAAQ,CAAC,EAAE;QACT,mBAAmB,EAAE,mBAAmB,CAAC;QACzC,SAAS,EAAE,MAAM,CAAC;KACnB,CAAC;IACF,QAAQ,CAAC,EAAE,gBAAgB,CAAC;CAC7B;
|
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,oBAAoB,CAAuB;IAC5D,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAA8B;IACxD,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAmB;gBAEjC,OAAO,EAAE,eAAe;IAgC9B,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;YAoBZ,cAAc;IAkE5B;;;OAGG;YACW,QAAQ;IA6CtB,2EAA2E;YAC7D,eAAe;YAcf,QAAQ;YAmDP,SAAS;CAczB"}
|
package/dist/pipeline.js
CHANGED
|
@@ -7,26 +7,37 @@ import { NetworkError, SparqlProbeResult, } from './distribution/probe.js';
|
|
|
7
7
|
import { NotSupported } from './sparql/executor.js';
|
|
8
8
|
/**
|
|
9
9
|
* Split an async iterable into `count` branches that can be consumed
|
|
10
|
-
* independently. Backpressure is enforced by the slowest consumer
|
|
10
|
+
* independently. Backpressure is enforced by the slowest consumer –
|
|
11
11
|
* the source only advances once every branch has consumed the current item.
|
|
12
12
|
*/
|
|
13
13
|
function tee(source, count) {
|
|
14
14
|
const iterator = source[Symbol.asyncIterator]();
|
|
15
15
|
let current;
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
const consumed = new Array(count).fill(false);
|
|
17
|
+
const waiting = [];
|
|
18
|
+
function advance(branch) {
|
|
19
|
+
// First branch to request a new round fetches from the source.
|
|
20
|
+
if (!current || consumed.every(Boolean)) {
|
|
21
|
+
consumed.fill(false);
|
|
20
22
|
current = iterator.next();
|
|
21
23
|
}
|
|
22
|
-
consumed
|
|
24
|
+
// This branch already consumed the current item – wait for the next round.
|
|
25
|
+
if (consumed[branch]) {
|
|
26
|
+
return new Promise(resolve => waiting.push(resolve)).then(() => advance(branch));
|
|
27
|
+
}
|
|
28
|
+
consumed[branch] = true;
|
|
29
|
+
// All branches consumed – wake up any that are waiting for the next round.
|
|
30
|
+
if (consumed.every(Boolean)) {
|
|
31
|
+
for (const resolve of waiting.splice(0))
|
|
32
|
+
resolve();
|
|
33
|
+
}
|
|
23
34
|
return current;
|
|
24
35
|
}
|
|
25
|
-
return Array.from({ length: count }, () => ({
|
|
36
|
+
return Array.from({ length: count }, (_, index) => ({
|
|
26
37
|
[Symbol.asyncIterator]() {
|
|
27
38
|
return {
|
|
28
39
|
async next() {
|
|
29
|
-
return advance();
|
|
40
|
+
return advance(index);
|
|
30
41
|
},
|
|
31
42
|
};
|
|
32
43
|
},
|