@naturalcycles/nodejs-lib 15.27.0 → 15.27.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.
|
@@ -69,7 +69,7 @@ export declare class Pipeline<T> {
|
|
|
69
69
|
* Not type safe! Prefer using singular `transform()` multiple times for type safety.
|
|
70
70
|
*/
|
|
71
71
|
transformMany<TO>(transforms: Transform[]): Pipeline<TO>;
|
|
72
|
-
fork(fn: (pipeline: Pipeline<T>) =>
|
|
72
|
+
fork(fn: (pipeline: Pipeline<T>) => Promise<void>, opt?: TransformOptions): this;
|
|
73
73
|
/**
|
|
74
74
|
* Utility method just to conveniently type-cast the current Pipeline type.
|
|
75
75
|
* No runtime effect.
|
|
@@ -7,4 +7,4 @@ import type { TransformOptions, TransformTyped } from '../stream.model.js';
|
|
|
7
7
|
*
|
|
8
8
|
* @experimental
|
|
9
9
|
*/
|
|
10
|
-
export declare function transformFork<T>(fn: (pipeline: Pipeline<T>) =>
|
|
10
|
+
export declare function transformFork<T>(fn: (pipeline: Pipeline<T>) => Promise<void>, opt?: TransformOptions): TransformTyped<T, T>;
|
|
@@ -24,8 +24,7 @@ export function transformFork(fn, opt = {}) {
|
|
|
24
24
|
lock = undefined;
|
|
25
25
|
lockCopy.resolve();
|
|
26
26
|
});
|
|
27
|
-
|
|
28
|
-
void p.run().then(() => {
|
|
27
|
+
void fn(Pipeline.from(fork)).then(() => {
|
|
29
28
|
logger.log('TransformFork: done');
|
|
30
29
|
});
|
|
31
30
|
return new Transform({
|
package/package.json
CHANGED
package/src/stream/pipeline.ts
CHANGED
|
@@ -235,7 +235,7 @@ export class Pipeline<T> {
|
|
|
235
235
|
return this as any
|
|
236
236
|
}
|
|
237
237
|
|
|
238
|
-
fork(fn: (pipeline: Pipeline<T>) =>
|
|
238
|
+
fork(fn: (pipeline: Pipeline<T>) => Promise<void>, opt?: TransformOptions): this {
|
|
239
239
|
this.transforms.push(transformFork(fn, opt))
|
|
240
240
|
return this
|
|
241
241
|
}
|
|
@@ -13,7 +13,7 @@ import type { TransformOptions, TransformTyped } from '../stream.model.js'
|
|
|
13
13
|
* @experimental
|
|
14
14
|
*/
|
|
15
15
|
export function transformFork<T>(
|
|
16
|
-
fn: (pipeline: Pipeline<T>) =>
|
|
16
|
+
fn: (pipeline: Pipeline<T>) => Promise<void>,
|
|
17
17
|
opt: TransformOptions = {},
|
|
18
18
|
): TransformTyped<T, T> {
|
|
19
19
|
const { objectMode = true, highWaterMark } = opt
|
|
@@ -31,8 +31,7 @@ export function transformFork<T>(
|
|
|
31
31
|
lockCopy.resolve()
|
|
32
32
|
})
|
|
33
33
|
|
|
34
|
-
|
|
35
|
-
void p.run().then(() => {
|
|
34
|
+
void fn(Pipeline.from<T>(fork)).then(() => {
|
|
36
35
|
logger.log('TransformFork: done')
|
|
37
36
|
})
|
|
38
37
|
|