@tanstack/db-ivm 0.1.5 → 0.1.6
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/cjs/operators/tap.cjs +2 -4
- package/dist/cjs/operators/tap.cjs.map +1 -1
- package/dist/cjs/operators/tap.d.cts +5 -5
- package/dist/esm/operators/tap.d.ts +5 -5
- package/dist/esm/operators/tap.js +2 -4
- package/dist/esm/operators/tap.js.map +1 -1
- package/package.json +1 -1
- package/src/operators/tap.ts +8 -10
|
@@ -17,10 +17,8 @@ class TapOperator extends graph.LinearUnaryOperator {
|
|
|
17
17
|
__privateSet(this, _f, f);
|
|
18
18
|
}
|
|
19
19
|
inner(collection) {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
return data;
|
|
23
|
-
});
|
|
20
|
+
__privateGet(this, _f).call(this, collection);
|
|
21
|
+
return collection;
|
|
24
22
|
}
|
|
25
23
|
}
|
|
26
24
|
_f = new WeakMap();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tap.cjs","sources":["../../../src/operators/tap.ts"],"sourcesContent":["import { DifferenceStreamWriter, LinearUnaryOperator } from \"../graph.js\"\nimport { StreamBuilder } from \"../d2.js\"\nimport type { IStreamBuilder, PipedOperator } from \"../types.js\"\nimport type { DifferenceStreamReader } from \"../graph.js\"\nimport type { MultiSet } from \"../multiset.js\"\n\n/**\n * Operator that applies a function to each
|
|
1
|
+
{"version":3,"file":"tap.cjs","sources":["../../../src/operators/tap.ts"],"sourcesContent":["import { DifferenceStreamWriter, LinearUnaryOperator } from \"../graph.js\"\nimport { StreamBuilder } from \"../d2.js\"\nimport type { IStreamBuilder, PipedOperator } from \"../types.js\"\nimport type { DifferenceStreamReader } from \"../graph.js\"\nimport type { MultiSet } from \"../multiset.js\"\n\n/**\n * Operator that applies a function to each multi-set in the input stream\n */\nexport class TapOperator<T> extends LinearUnaryOperator<T, T> {\n #f: (data: MultiSet<T>) => void\n\n constructor(\n id: number,\n inputA: DifferenceStreamReader<T>,\n output: DifferenceStreamWriter<T>,\n f: (data: MultiSet<T>) => void\n ) {\n super(id, inputA, output)\n this.#f = f\n }\n\n inner(collection: MultiSet<T>): MultiSet<T> {\n this.#f(collection)\n return collection\n }\n}\n\n/**\n * Invokes a function for each multi-set in the input stream.\n * This operator doesn't modify the stream and is used to perform side effects.\n * @param f - The function to invoke on each multi-set\n * @returns The input stream\n */\nexport function tap<T>(f: (data: MultiSet<T>) => void): PipedOperator<T, T> {\n return (stream: IStreamBuilder<T>): IStreamBuilder<T> => {\n const output = new StreamBuilder<T>(\n stream.graph,\n new DifferenceStreamWriter<T>()\n )\n const operator = new TapOperator<T>(\n stream.graph.getNextOperatorId(),\n stream.connectReader(),\n output.writer,\n f\n )\n stream.graph.addOperator(operator)\n stream.graph.addStream(output.connectReader())\n return output\n }\n}\n"],"names":["LinearUnaryOperator","StreamBuilder","DifferenceStreamWriter"],"mappings":";;;;;;;;;;;;AASO,MAAM,oBAAuBA,MAAAA,oBAA0B;AAAA,EAG5D,YACE,IACA,QACA,QACA,GACA;AACA,UAAM,IAAI,QAAQ,MAAM;AAR1B;AASE,uBAAK,IAAK;AAAA,EACZ;AAAA,EAEA,MAAM,YAAsC;AAC1C,uBAAK,IAAL,WAAQ;AACR,WAAO;AAAA,EACT;AACF;AAhBE;AAwBK,SAAS,IAAO,GAAqD;AAC1E,SAAO,CAAC,WAAiD;AACvD,UAAM,SAAS,IAAIC,GAAAA;AAAAA,MACjB,OAAO;AAAA,MACP,IAAIC,MAAAA,uBAAA;AAAA,IAA0B;AAEhC,UAAM,WAAW,IAAI;AAAA,MACnB,OAAO,MAAM,kBAAA;AAAA,MACb,OAAO,cAAA;AAAA,MACP,OAAO;AAAA,MACP;AAAA,IAAA;AAEF,WAAO,MAAM,YAAY,QAAQ;AACjC,WAAO,MAAM,UAAU,OAAO,cAAA,CAAe;AAC7C,WAAO;AAAA,EACT;AACF;;;"}
|
|
@@ -2,17 +2,17 @@ import { DifferenceStreamWriter, LinearUnaryOperator, DifferenceStreamReader } f
|
|
|
2
2
|
import { PipedOperator } from '../types.js';
|
|
3
3
|
import { MultiSet } from '../multiset.js';
|
|
4
4
|
/**
|
|
5
|
-
* Operator that applies a function to each
|
|
5
|
+
* Operator that applies a function to each multi-set in the input stream
|
|
6
6
|
*/
|
|
7
7
|
export declare class TapOperator<T> extends LinearUnaryOperator<T, T> {
|
|
8
8
|
#private;
|
|
9
|
-
constructor(id: number, inputA: DifferenceStreamReader<T>, output: DifferenceStreamWriter<T>, f: (data: T) => void);
|
|
9
|
+
constructor(id: number, inputA: DifferenceStreamReader<T>, output: DifferenceStreamWriter<T>, f: (data: MultiSet<T>) => void);
|
|
10
10
|
inner(collection: MultiSet<T>): MultiSet<T>;
|
|
11
11
|
}
|
|
12
12
|
/**
|
|
13
|
-
* Invokes a function for each
|
|
13
|
+
* Invokes a function for each multi-set in the input stream.
|
|
14
14
|
* This operator doesn't modify the stream and is used to perform side effects.
|
|
15
|
-
* @param f - The function to invoke on each
|
|
15
|
+
* @param f - The function to invoke on each multi-set
|
|
16
16
|
* @returns The input stream
|
|
17
17
|
*/
|
|
18
|
-
export declare function tap<T>(f: (data: T) => void): PipedOperator<T, T>;
|
|
18
|
+
export declare function tap<T>(f: (data: MultiSet<T>) => void): PipedOperator<T, T>;
|
|
@@ -2,17 +2,17 @@ import { DifferenceStreamWriter, LinearUnaryOperator, DifferenceStreamReader } f
|
|
|
2
2
|
import { PipedOperator } from '../types.js';
|
|
3
3
|
import { MultiSet } from '../multiset.js';
|
|
4
4
|
/**
|
|
5
|
-
* Operator that applies a function to each
|
|
5
|
+
* Operator that applies a function to each multi-set in the input stream
|
|
6
6
|
*/
|
|
7
7
|
export declare class TapOperator<T> extends LinearUnaryOperator<T, T> {
|
|
8
8
|
#private;
|
|
9
|
-
constructor(id: number, inputA: DifferenceStreamReader<T>, output: DifferenceStreamWriter<T>, f: (data: T) => void);
|
|
9
|
+
constructor(id: number, inputA: DifferenceStreamReader<T>, output: DifferenceStreamWriter<T>, f: (data: MultiSet<T>) => void);
|
|
10
10
|
inner(collection: MultiSet<T>): MultiSet<T>;
|
|
11
11
|
}
|
|
12
12
|
/**
|
|
13
|
-
* Invokes a function for each
|
|
13
|
+
* Invokes a function for each multi-set in the input stream.
|
|
14
14
|
* This operator doesn't modify the stream and is used to perform side effects.
|
|
15
|
-
* @param f - The function to invoke on each
|
|
15
|
+
* @param f - The function to invoke on each multi-set
|
|
16
16
|
* @returns The input stream
|
|
17
17
|
*/
|
|
18
|
-
export declare function tap<T>(f: (data: T) => void): PipedOperator<T, T>;
|
|
18
|
+
export declare function tap<T>(f: (data: MultiSet<T>) => void): PipedOperator<T, T>;
|
|
@@ -15,10 +15,8 @@ class TapOperator extends LinearUnaryOperator {
|
|
|
15
15
|
__privateSet(this, _f, f);
|
|
16
16
|
}
|
|
17
17
|
inner(collection) {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
return data;
|
|
21
|
-
});
|
|
18
|
+
__privateGet(this, _f).call(this, collection);
|
|
19
|
+
return collection;
|
|
22
20
|
}
|
|
23
21
|
}
|
|
24
22
|
_f = new WeakMap();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tap.js","sources":["../../../src/operators/tap.ts"],"sourcesContent":["import { DifferenceStreamWriter, LinearUnaryOperator } from \"../graph.js\"\nimport { StreamBuilder } from \"../d2.js\"\nimport type { IStreamBuilder, PipedOperator } from \"../types.js\"\nimport type { DifferenceStreamReader } from \"../graph.js\"\nimport type { MultiSet } from \"../multiset.js\"\n\n/**\n * Operator that applies a function to each
|
|
1
|
+
{"version":3,"file":"tap.js","sources":["../../../src/operators/tap.ts"],"sourcesContent":["import { DifferenceStreamWriter, LinearUnaryOperator } from \"../graph.js\"\nimport { StreamBuilder } from \"../d2.js\"\nimport type { IStreamBuilder, PipedOperator } from \"../types.js\"\nimport type { DifferenceStreamReader } from \"../graph.js\"\nimport type { MultiSet } from \"../multiset.js\"\n\n/**\n * Operator that applies a function to each multi-set in the input stream\n */\nexport class TapOperator<T> extends LinearUnaryOperator<T, T> {\n #f: (data: MultiSet<T>) => void\n\n constructor(\n id: number,\n inputA: DifferenceStreamReader<T>,\n output: DifferenceStreamWriter<T>,\n f: (data: MultiSet<T>) => void\n ) {\n super(id, inputA, output)\n this.#f = f\n }\n\n inner(collection: MultiSet<T>): MultiSet<T> {\n this.#f(collection)\n return collection\n }\n}\n\n/**\n * Invokes a function for each multi-set in the input stream.\n * This operator doesn't modify the stream and is used to perform side effects.\n * @param f - The function to invoke on each multi-set\n * @returns The input stream\n */\nexport function tap<T>(f: (data: MultiSet<T>) => void): PipedOperator<T, T> {\n return (stream: IStreamBuilder<T>): IStreamBuilder<T> => {\n const output = new StreamBuilder<T>(\n stream.graph,\n new DifferenceStreamWriter<T>()\n )\n const operator = new TapOperator<T>(\n stream.graph.getNextOperatorId(),\n stream.connectReader(),\n output.writer,\n f\n )\n stream.graph.addOperator(operator)\n stream.graph.addStream(output.connectReader())\n return output\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;AASO,MAAM,oBAAuB,oBAA0B;AAAA,EAG5D,YACE,IACA,QACA,QACA,GACA;AACA,UAAM,IAAI,QAAQ,MAAM;AAR1B;AASE,uBAAK,IAAK;AAAA,EACZ;AAAA,EAEA,MAAM,YAAsC;AAC1C,uBAAK,IAAL,WAAQ;AACR,WAAO;AAAA,EACT;AACF;AAhBE;AAwBK,SAAS,IAAO,GAAqD;AAC1E,SAAO,CAAC,WAAiD;AACvD,UAAM,SAAS,IAAI;AAAA,MACjB,OAAO;AAAA,MACP,IAAI,uBAAA;AAAA,IAA0B;AAEhC,UAAM,WAAW,IAAI;AAAA,MACnB,OAAO,MAAM,kBAAA;AAAA,MACb,OAAO,cAAA;AAAA,MACP,OAAO;AAAA,MACP;AAAA,IAAA;AAEF,WAAO,MAAM,YAAY,QAAQ;AACjC,WAAO,MAAM,UAAU,OAAO,cAAA,CAAe;AAC7C,WAAO;AAAA,EACT;AACF;"}
|
package/package.json
CHANGED
package/src/operators/tap.ts
CHANGED
|
@@ -5,36 +5,34 @@ import type { DifferenceStreamReader } from "../graph.js"
|
|
|
5
5
|
import type { MultiSet } from "../multiset.js"
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
|
-
* Operator that applies a function to each
|
|
8
|
+
* Operator that applies a function to each multi-set in the input stream
|
|
9
9
|
*/
|
|
10
10
|
export class TapOperator<T> extends LinearUnaryOperator<T, T> {
|
|
11
|
-
#f: (data: T) => void
|
|
11
|
+
#f: (data: MultiSet<T>) => void
|
|
12
12
|
|
|
13
13
|
constructor(
|
|
14
14
|
id: number,
|
|
15
15
|
inputA: DifferenceStreamReader<T>,
|
|
16
16
|
output: DifferenceStreamWriter<T>,
|
|
17
|
-
f: (data: T) => void
|
|
17
|
+
f: (data: MultiSet<T>) => void
|
|
18
18
|
) {
|
|
19
19
|
super(id, inputA, output)
|
|
20
20
|
this.#f = f
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
inner(collection: MultiSet<T>): MultiSet<T> {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
return data
|
|
27
|
-
})
|
|
24
|
+
this.#f(collection)
|
|
25
|
+
return collection
|
|
28
26
|
}
|
|
29
27
|
}
|
|
30
28
|
|
|
31
29
|
/**
|
|
32
|
-
* Invokes a function for each
|
|
30
|
+
* Invokes a function for each multi-set in the input stream.
|
|
33
31
|
* This operator doesn't modify the stream and is used to perform side effects.
|
|
34
|
-
* @param f - The function to invoke on each
|
|
32
|
+
* @param f - The function to invoke on each multi-set
|
|
35
33
|
* @returns The input stream
|
|
36
34
|
*/
|
|
37
|
-
export function tap<T>(f: (data: T) => void): PipedOperator<T, T> {
|
|
35
|
+
export function tap<T>(f: (data: MultiSet<T>) => void): PipedOperator<T, T> {
|
|
38
36
|
return (stream: IStreamBuilder<T>): IStreamBuilder<T> => {
|
|
39
37
|
const output = new StreamBuilder<T>(
|
|
40
38
|
stream.graph,
|