@dxos/pipeline 0.0.0 → 0.11.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.
- package/dist/lib/index.mjs +174 -0
- package/dist/lib/index.mjs.map +1 -0
- package/dist/lib/testing.mjs +125 -0
- package/dist/lib/testing.mjs.map +1 -0
- package/dist/types/src/Pipeline.d.ts +10 -0
- package/dist/types/src/Pipeline.d.ts.map +1 -1
- package/dist/types/src/Progress.d.ts +17 -0
- package/dist/types/src/Progress.d.ts.map +1 -0
- package/dist/types/src/ProgressReporter.d.ts +19 -0
- package/dist/types/src/ProgressReporter.d.ts.map +1 -0
- package/dist/types/src/Stage.d.ts +12 -0
- package/dist/types/src/Stage.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +2 -0
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/testing/benchmark.d.ts +40 -0
- package/dist/types/src/testing/benchmark.d.ts.map +1 -0
- package/dist/types/src/testing/benchmark.test.d.ts +2 -0
- package/dist/types/src/testing/benchmark.test.d.ts.map +1 -0
- package/dist/types/src/testing/index.d.ts +3 -0
- package/dist/types/src/testing/index.d.ts.map +1 -1
- package/dist/types/src/testing/instrument.d.ts +18 -0
- package/dist/types/src/testing/instrument.d.ts.map +1 -0
- package/dist/types/src/testing/metrics.d.ts +33 -0
- package/dist/types/src/testing/metrics.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +17 -13
- package/src/Pipeline.test.ts +74 -1
- package/src/Pipeline.ts +46 -0
- package/src/Progress.ts +25 -0
- package/src/ProgressReporter.ts +59 -0
- package/src/Stage.ts +28 -0
- package/src/index.ts +2 -0
- package/src/testing/benchmark.test.ts +103 -0
- package/src/testing/benchmark.ts +113 -0
- package/src/testing/index.ts +3 -0
- package/src/testing/instrument.ts +57 -0
- package/src/testing/metrics.ts +68 -0
- package/dist/lib/neutral/chunk-J5LGTIGS.mjs +0 -10
- package/dist/lib/neutral/chunk-J5LGTIGS.mjs.map +0 -7
- package/dist/lib/neutral/index.mjs +0 -67
- package/dist/lib/neutral/index.mjs.map +0 -7
- package/dist/lib/neutral/meta.json +0 -1
- package/dist/lib/neutral/testing/index.mjs +0 -18
- package/dist/lib/neutral/testing/index.mjs.map +0 -7
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2026 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Context from 'effect/Context';
|
|
6
|
+
import * as Duration from 'effect/Duration';
|
|
7
|
+
import * as Effect from 'effect/Effect';
|
|
8
|
+
import * as Layer from 'effect/Layer';
|
|
9
|
+
|
|
10
|
+
/** A single reported metric: a running number (counter/sum) or a label. */
|
|
11
|
+
export type MetricValue = number | string;
|
|
12
|
+
|
|
13
|
+
/** A flat name → value map, as merged into a benchmark row. */
|
|
14
|
+
export type MetricsSnapshot = Record<string, MetricValue>;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Metrics sink a benchmark run writes to. Stages opt in to emit domain metrics (`inc`/`record`/
|
|
18
|
+
* `time`); the {@link instrument} wrapper writes per-stage counters through the same service. One
|
|
19
|
+
* instance per benchmark variant, provided at the edge via {@link Metrics.layer}.
|
|
20
|
+
*/
|
|
21
|
+
export interface MetricsApi {
|
|
22
|
+
/** Add `by` (default 1) to a numeric counter. */
|
|
23
|
+
readonly inc: (name: string, by?: number) => Effect.Effect<void>;
|
|
24
|
+
/** Set a value (last write wins) — for labels or gauges. */
|
|
25
|
+
readonly record: (name: string, value: MetricValue) => Effect.Effect<void>;
|
|
26
|
+
/** Time an effect: adds its duration (ms) to `${name}.ms` and increments `${name}.count`. */
|
|
27
|
+
readonly time: <A, E, R>(name: string, effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>;
|
|
28
|
+
/** Current values. */
|
|
29
|
+
readonly snapshot: Effect.Effect<MetricsSnapshot>;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export class Metrics extends Context.Tag('@dxos/pipeline/testing/Metrics')<Metrics, MetricsApi>() {
|
|
33
|
+
/** A fresh, in-memory metrics instance. */
|
|
34
|
+
static layer: Layer.Layer<Metrics> = Layer.sync(Metrics, () => makeMetrics());
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/** Construct a standalone metrics sink (also usable directly in tests). */
|
|
38
|
+
export const makeMetrics = (): MetricsApi => {
|
|
39
|
+
const values = new Map<string, MetricValue>();
|
|
40
|
+
const addNumber = (name: string, by: number) => {
|
|
41
|
+
const current = values.get(name);
|
|
42
|
+
// A name used as both a string label (record) and a counter (inc/time) is a caller bug; fail
|
|
43
|
+
// loudly rather than silently discarding the label and counting from zero.
|
|
44
|
+
if (typeof current === 'string') {
|
|
45
|
+
throw new Error(`Metric '${name}' already holds a string label; cannot increment it.`);
|
|
46
|
+
}
|
|
47
|
+
values.set(name, (current ?? 0) + by);
|
|
48
|
+
};
|
|
49
|
+
const api: MetricsApi = {
|
|
50
|
+
inc: (name, by = 1) => Effect.sync(() => addNumber(name, by)),
|
|
51
|
+
record: (name, value) => Effect.sync(() => void values.set(name, value)),
|
|
52
|
+
time: (name, effect) =>
|
|
53
|
+
Effect.timed(effect).pipe(
|
|
54
|
+
Effect.map(([duration, result]) => {
|
|
55
|
+
addNumber(`${name}.ms`, Duration.toMillis(duration));
|
|
56
|
+
addNumber(`${name}.count`, 1);
|
|
57
|
+
return result;
|
|
58
|
+
}),
|
|
59
|
+
),
|
|
60
|
+
snapshot: Effect.sync(() => Object.fromEntries(values)),
|
|
61
|
+
};
|
|
62
|
+
return api;
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
/** Read the ambient {@link Metrics} service and apply `f` to it. */
|
|
66
|
+
export const useMetrics = <A, E, R>(
|
|
67
|
+
f: (metrics: MetricsApi) => Effect.Effect<A, E, R>,
|
|
68
|
+
): Effect.Effect<A, E, R | Metrics> => Effect.flatMap(Metrics, f);
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
__export
|
|
3
|
-
} from "./chunk-J5LGTIGS.mjs";
|
|
4
|
-
|
|
5
|
-
// src/Pipeline.ts
|
|
6
|
-
var Pipeline_exports = {};
|
|
7
|
-
__export(Pipeline_exports, {
|
|
8
|
-
run: () => run
|
|
9
|
-
});
|
|
10
|
-
import * as Function from "effect/Function";
|
|
11
|
-
import * as Stream2 from "effect/Stream";
|
|
12
|
-
|
|
13
|
-
// src/Stage.ts
|
|
14
|
-
var Stage_exports = {};
|
|
15
|
-
__export(Stage_exports, {
|
|
16
|
-
DEFAULT_BUFFER_SIZE: () => DEFAULT_BUFFER_SIZE,
|
|
17
|
-
filter: () => filter2,
|
|
18
|
-
map: () => map,
|
|
19
|
-
window: () => window
|
|
20
|
-
});
|
|
21
|
-
import * as Effect from "effect/Effect";
|
|
22
|
-
import * as Stream from "effect/Stream";
|
|
23
|
-
var DEFAULT_BUFFER_SIZE = 16;
|
|
24
|
-
var withBuffer = (options) => (stream) => options.overflow ? Stream.buffer(stream, {
|
|
25
|
-
capacity: options.bufferSize ?? DEFAULT_BUFFER_SIZE,
|
|
26
|
-
strategy: options.overflow
|
|
27
|
-
}) : stream;
|
|
28
|
-
var map = (id, fn, options = {}) => (self) => self.pipe(
|
|
29
|
-
withBuffer(options),
|
|
30
|
-
// The overflow buffer sits *before* `mapEffect`: while a run is in flight it absorbs new
|
|
31
|
-
// input, so `sliding` coalesces to the latest queued item (latest-wins) and `dropping` sheds
|
|
32
|
-
// new arrivals. A buffer after `mapEffect` would bound outputs, not in-flight input, leaving
|
|
33
|
-
// overflow inert.
|
|
34
|
-
Stream.mapEffect((item) => fn(item).pipe(Effect.withSpan(id)), {
|
|
35
|
-
concurrency: options.concurrency ?? 1
|
|
36
|
-
}),
|
|
37
|
-
Stream.filter((item) => item !== void 0)
|
|
38
|
-
);
|
|
39
|
-
var window = (id, size, fn, options = {}) => {
|
|
40
|
-
if (!Number.isInteger(size) || size < 1) {
|
|
41
|
-
throw new RangeError(`Stage.window size must be a positive integer: ${size}`);
|
|
42
|
-
}
|
|
43
|
-
return (self) => self.pipe(Stream.mapAccum([], (buffer3, item) => {
|
|
44
|
-
const next = [
|
|
45
|
-
...buffer3,
|
|
46
|
-
item
|
|
47
|
-
].slice(-size);
|
|
48
|
-
return [
|
|
49
|
-
next,
|
|
50
|
-
next
|
|
51
|
-
];
|
|
52
|
-
}), Stream.mapEffect((buffer3) => fn(buffer3).pipe(Effect.withSpan(id)), {
|
|
53
|
-
concurrency: 1
|
|
54
|
-
}), withBuffer(options), Stream.filter((item) => item !== void 0));
|
|
55
|
-
};
|
|
56
|
-
var filter2 = (id, pred) => (self) => self.pipe(Stream.filter(pred));
|
|
57
|
-
|
|
58
|
-
// src/Pipeline.ts
|
|
59
|
-
var run = Function.dual(2, (source, options) => source.pipe(Stream2.buffer({
|
|
60
|
-
capacity: options.bufferSize ?? DEFAULT_BUFFER_SIZE,
|
|
61
|
-
strategy: options.overflow ?? "suspend"
|
|
62
|
-
}), Stream2.runForEach(options.sink)));
|
|
63
|
-
export {
|
|
64
|
-
Pipeline_exports as Pipeline,
|
|
65
|
-
Stage_exports as Stage
|
|
66
|
-
};
|
|
67
|
-
//# sourceMappingURL=index.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/Pipeline.ts", "../../../src/Stage.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2026 DXOS.org\n//\n\n// @import-as-namespace\n\nimport * as Effect from 'effect/Effect';\nimport * as Function from 'effect/Function';\nimport * as Stream from 'effect/Stream';\n\nimport * as Stage from './Stage';\n\n/**\n * Terminal commit for a pipeline: applies a stage's output value. Keeps stages pure — they emit\n * typed `Out` descriptions and the sink performs the side effect (in-memory capture in tests, a\n * database write in production).\n */\nexport type Sink<Out, E = never, R = never> = (out: Out) => Effect.Effect<void, E, R>;\n\nexport type RunOptions<Out, E = never, R = never> = {\n /** Terminal commit for the final stage output. */\n readonly sink: Sink<Out, E, R>;\n /** Pipeline-level overflow policy. Defaults to `suspend` (back pressure, never drop). */\n readonly overflow?: Stage.Overflow;\n /** Pipeline-level bounded-buffer capacity. */\n readonly bufferSize?: number;\n};\n\n/**\n * Drain a composed stream to a sink: apply the pipeline-level overflow buffer and run to\n * completion. Cancellation is structural — interrupting the returned effect interrupts the stream\n * and all in-flight stage work; there are no daemon fibers to leak. Compose with `pipe`, chaining\n * `Stage` transforms ahead of it: `pipe(source, Stage.map(...), Stage.window(...), Pipeline.run({\n * sink }))`. Mirrors `Stream.runForEach`'s own shape: the sink's `E`/`R` (bound once, from `options`)\n * are kept independent of — and unioned with — the piped-in stream's own `E`/`R`, so the incoming\n * stream's generics aren't forced to unify with the sink's at the call site.\n */\nexport const run: {\n <Out, E2, R2>(\n options: RunOptions<Out, E2, R2>,\n ): <E, R>(source: Stream.Stream<Out, E, R>) => Effect.Effect<void, E2 | E, R2 | R>;\n <Out, E, R, E2, R2>(\n source: Stream.Stream<Out, E, R>,\n options: RunOptions<Out, E2, R2>,\n ): Effect.Effect<void, E2 | E, R2 | R>;\n} = Function.dual(2, (source: Stream.Stream<any, any, any>, options: RunOptions<any, any, any>) =>\n source.pipe(\n Stream.buffer({\n capacity: options.bufferSize ?? Stage.DEFAULT_BUFFER_SIZE,\n strategy: options.overflow ?? 'suspend',\n }),\n Stream.runForEach(options.sink),\n ),\n);\n", "//\n// Copyright 2026 DXOS.org\n//\n\n// @import-as-namespace\n\nimport * as Effect from 'effect/Effect';\nimport * as Stream from 'effect/Stream';\n\n/**\n * Overflow policy applied when a consumer cannot keep pace, mapped onto `Stream.buffer` strategies.\n * - `suspend`: back pressure — never drop (default; correct for email/document processing).\n * - `sliding`: drop the oldest buffered item, keep the latest (correct for live transcription).\n * - `dropping`: drop the newest item when the buffer is full.\n */\nexport type Overflow = 'suspend' | 'sliding' | 'dropping';\n\n/** Default bounded-buffer capacity for both pipeline-level and per-stage buffering. */\nexport const DEFAULT_BUFFER_SIZE = 16;\n\n/**\n * A pipeline stage: a pipeable `Stream → Stream` transform, the same shape `Stream.mapEffect` /\n * `Stream.filter` already have — generic over the *input* stream's own error/requirements (`E0`/\n * `R0`) and unioning in the stage's own `E`/`R`, so stages compose in a `pipe` chain the same way\n * Effect's own Stream operators do. Authors build stages with {@link map} / {@link window} /\n * {@link filter}; shared dependencies flow through `R`, provided once at the edge via\n * `Effect.provide`.\n */\nexport type Stage<In, Out, E = never, R = never> = <E0 = never, R0 = never>(\n self: Stream.Stream<In, E0, R0>,\n) => Stream.Stream<Out, E0 | E, R0 | R>;\n\n/** Options shared by buffering stage constructors. */\ntype BufferOptions = {\n /**\n * Per-stage overflow override; when set, a bounded buffer is inserted at the stage's async\n * boundary. For {@link map} the buffer sits *before* `mapEffect`, so under load it sheds/coalesces\n * in-flight input (`sliding` keeps the latest queued item — true latest-wins — `dropping` drops\n * new arrivals while a run is in flight). For {@link window} it sits after windowing (a window\n * must see every item), bounding output rate.\n */\n readonly overflow?: Overflow;\n /** Buffer capacity for the per-stage override. */\n readonly bufferSize?: number;\n};\n\nexport type MapOptions = BufferOptions & {\n /** In-flight parallelism. Defaults to 1 (ordered + back-pressured); higher values may reorder. */\n readonly concurrency?: number;\n};\n\nexport type WindowOptions = BufferOptions;\n\n// A per-stage buffer is inserted only when an overflow override is requested; otherwise the stage\n// stays a pure transform and relies on the pipeline-level buffer.\nconst withBuffer =\n (options: BufferOptions) =>\n <A, E, R>(stream: Stream.Stream<A, E, R>): Stream.Stream<A, E, R> =>\n options.overflow\n ? Stream.buffer(stream, { capacity: options.bufferSize ?? DEFAULT_BUFFER_SIZE, strategy: options.overflow })\n : stream;\n\n/**\n * 1:1 async transform. `fn` may return `undefined` to no-op for an item; the value is dropped\n * before it reaches the next stage, so the returned stage's `Out` excludes `undefined`.\n * `concurrency` defaults to 1 (ordered). `id` labels the per-item span for tracing.\n *\n * `Out`/`E`/`R` always infer from `fn`'s result; `In` only infers when the stage is composed inline\n * in a `pipe` (pinned by the upstream stream). Built as a standalone value, pin `In` by annotating\n * the callback parameter (`(item: T) => …`) or the binding (`const s: Stage<…> = …`). The four type\n * parameters are intentionally all-or-nothing: passing a partial list (e.g. `map<In, Out>(…)`) is a\n * compile error rather than silently forcing `E`/`R` to `never` and rejecting a service-using `fn`.\n */\nexport const map =\n <In, Out, E, R>(\n id: string,\n fn: (item: In) => Effect.Effect<Out, E, R>,\n options: MapOptions = {},\n ): Stage<In, Exclude<Out, undefined>, E, R> =>\n <E0, R0>(self: Stream.Stream<In, E0, R0>) =>\n self.pipe(\n withBuffer(options),\n // The overflow buffer sits *before* `mapEffect`: while a run is in flight it absorbs new\n // input, so `sliding` coalesces to the latest queued item (latest-wins) and `dropping` sheds\n // new arrivals. A buffer after `mapEffect` would bound outputs, not in-flight input, leaving\n // overflow inert.\n Stream.mapEffect((item) => fn(item).pipe(Effect.withSpan(id)), { concurrency: options.concurrency ?? 1 }),\n Stream.filter((item): item is Exclude<Out, undefined> => item !== undefined),\n );\n\n/**\n * Sliding-window transform: invokes `fn` once per incoming item with a fixed-size rolling view of\n * the last `size` items. The window is bounded by `size`, so memory does not grow with stream\n * length; it composes with (and is distinct from) the overflow buffer, which bounds rate mismatch.\n * `fn` may return `undefined` to no-op, narrowing `Out` the same way {@link map} does. Type\n * parameters follow {@link map}: `Out`/`E`/`R` infer from `fn`, `In` is pinned inline by the\n * upstream or (standalone) by annotating the callback parameter or the binding, and a partial type\n * argument list is a compile error.\n */\nexport const window = <In, Out, E, R>(\n id: string,\n size: number,\n fn: (window: readonly In[]) => Effect.Effect<Out, E, R>,\n options: WindowOptions = {},\n): Stage<In, Exclude<Out, undefined>, E, R> => {\n // A window must retain at least one item; a non-positive size makes `.slice(-size)` degenerate\n // (`slice(-0)` returns the whole array, growing unbounded).\n if (!Number.isInteger(size) || size < 1) {\n throw new RangeError(`Stage.window size must be a positive integer: ${size}`);\n }\n\n return <E0, R0>(self: Stream.Stream<In, E0, R0>) =>\n self.pipe(\n Stream.mapAccum([] as readonly In[], (buffer, item) => {\n const next = [...buffer, item].slice(-size);\n return [next, next];\n }),\n Stream.mapEffect((buffer) => fn(buffer).pipe(Effect.withSpan(id)), { concurrency: 1 }),\n withBuffer(options),\n Stream.filter((item): item is Exclude<Out, undefined> => item !== undefined),\n );\n};\n\n/** Drop items that do not match `pred`. */\nexport const filter =\n <In>(id: string, pred: (item: In) => boolean): Stage<In, In> =>\n <E0, R0>(self: Stream.Stream<In, E0, R0>) =>\n self.pipe(Stream.filter(pred));\n"],
|
|
5
|
-
"mappings": ";;;;;AAAA;;;;AAOA,YAAYA,cAAc;AAC1B,YAAYC,aAAY;;;ACRxB;;;gBAAAC;EAAA;;;AAMA,YAAYC,YAAY;AACxB,YAAYC,YAAY;AAWjB,IAAMC,sBAAsB;AAqCnC,IAAMC,aACJ,CAACC,YACD,CAAUC,WACRD,QAAQE,WACGC,cAAOF,QAAQ;EAAEG,UAAUJ,QAAQK,cAAcP;EAAqBQ,UAAUN,QAAQE;AAAS,CAAA,IACxGD;AAaD,IAAMM,MACX,CACEC,IACAC,IACAT,UAAsB,CAAC,MAEzB,CAASU,SACPA,KAAKC;EACHZ,WAAWC,OAAAA;;;;;EAKJY,iBAAU,CAACC,SAASJ,GAAGI,IAAAA,EAAMF,KAAYG,gBAASN,EAAAA,CAAAA,GAAM;IAAEO,aAAaf,QAAQe,eAAe;EAAE,CAAA;EAChGpB,cAAO,CAACkB,SAA0CA,SAASG,MAAAA;AAAAA;AAYjE,IAAMC,SAAS,CACpBT,IACAU,MACAT,IACAT,UAAyB,CAAC,MAAC;AAI3B,MAAI,CAACmB,OAAOC,UAAUF,IAAAA,KAASA,OAAO,GAAG;AACvC,UAAM,IAAIG,WAAW,iDAAiDH,IAAAA,EAAM;EAC9E;AAEA,SAAO,CAASR,SACdA,KAAKC,KACIW,gBAAS,CAAA,GAAqB,CAACnB,SAAQU,SAAAA;AAC5C,UAAMU,OAAO;SAAIpB;MAAQU;MAAMW,MAAM,CAACN,IAAAA;AACtC,WAAO;MAACK;MAAMA;;EAChB,CAAA,GACOX,iBAAU,CAACT,YAAWM,GAAGN,OAAAA,EAAQQ,KAAYG,gBAASN,EAAAA,CAAAA,GAAM;IAAEO,aAAa;EAAE,CAAA,GACpFhB,WAAWC,OAAAA,GACJL,cAAO,CAACkB,SAA0CA,SAASG,MAAAA,CAAAA;AAExE;AAGO,IAAMrB,UACX,CAAKa,IAAYiB,SACjB,CAASf,SACPA,KAAKC,KAAYhB,cAAO8B,IAAAA,CAAAA;;;AD1FrB,IAAMC,MAQAC,cAAK,GAAG,CAACC,QAAsCC,YAC1DD,OAAOE,KACEC,eAAO;EACZC,UAAUH,QAAQI,cAAoBC;EACtCC,UAAUN,QAAQO,YAAY;AAChC,CAAA,GACOC,mBAAWR,QAAQS,IAAI,CAAA,CAAA;",
|
|
6
|
-
"names": ["Function", "Stream", "filter", "Effect", "Stream", "DEFAULT_BUFFER_SIZE", "withBuffer", "options", "stream", "overflow", "buffer", "capacity", "bufferSize", "strategy", "map", "id", "fn", "self", "pipe", "mapEffect", "item", "withSpan", "concurrency", "undefined", "window", "size", "Number", "isInteger", "RangeError", "mapAccum", "next", "slice", "pred", "run", "dual", "source", "options", "pipe", "buffer", "capacity", "bufferSize", "DEFAULT_BUFFER_SIZE", "strategy", "overflow", "runForEach", "sink"]
|
|
7
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"inputs":{"src/Stage.ts":{"bytes":14069,"imports":[{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"effect/Stream","kind":"import-statement","external":true}],"format":"esm"},"src/Pipeline.ts":{"bytes":4930,"imports":[{"path":"effect/Function","kind":"import-statement","external":true},{"path":"effect/Stream","kind":"import-statement","external":true},{"path":"src/Stage.ts","kind":"import-statement","original":"./Stage"}],"format":"esm"},"src/index.ts":{"bytes":574,"imports":[{"path":"src/Pipeline.ts","kind":"import-statement","original":"./Pipeline"},{"path":"src/Stage.ts","kind":"import-statement","original":"./Stage"}],"format":"esm"},"src/testing/capture.ts":{"bytes":1482,"imports":[{"path":"effect/Effect","kind":"import-statement","external":true}],"format":"esm"},"src/testing/index.ts":{"bytes":375,"imports":[{"path":"src/testing/capture.ts","kind":"import-statement","original":"./capture"}],"format":"esm"}},"outputs":{"dist/lib/neutral/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":10277},"dist/lib/neutral/index.mjs":{"imports":[{"path":"dist/lib/neutral/chunk-J5LGTIGS.mjs","kind":"import-statement"},{"path":"effect/Function","kind":"import-statement","external":true},{"path":"effect/Stream","kind":"import-statement","external":true},{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"effect/Stream","kind":"import-statement","external":true}],"exports":["Pipeline","Stage"],"entryPoint":"src/index.ts","inputs":{"src/Pipeline.ts":{"bytesInOutput":378},"src/Stage.ts":{"bytesInOutput":1609},"src/index.ts":{"bytesInOutput":0}},"bytes":2199},"dist/lib/neutral/testing/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":885},"dist/lib/neutral/testing/index.mjs":{"imports":[{"path":"dist/lib/neutral/chunk-J5LGTIGS.mjs","kind":"import-statement"},{"path":"effect/Effect","kind":"import-statement","external":true}],"exports":["captureSink"],"entryPoint":"src/testing/index.ts","inputs":{"src/testing/capture.ts":{"bytesInOutput":197},"src/testing/index.ts":{"bytesInOutput":0}},"bytes":317},"dist/lib/neutral/chunk-J5LGTIGS.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"dist/lib/neutral/chunk-J5LGTIGS.mjs":{"imports":[],"exports":["__export"],"inputs":{},"bytes":235}}}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import "../chunk-J5LGTIGS.mjs";
|
|
2
|
-
|
|
3
|
-
// src/testing/capture.ts
|
|
4
|
-
import * as Effect from "effect/Effect";
|
|
5
|
-
var captureSink = () => {
|
|
6
|
-
const items = [];
|
|
7
|
-
const sink = (out) => Effect.sync(() => {
|
|
8
|
-
items.push(out);
|
|
9
|
-
});
|
|
10
|
-
return {
|
|
11
|
-
sink,
|
|
12
|
-
items
|
|
13
|
-
};
|
|
14
|
-
};
|
|
15
|
-
export {
|
|
16
|
-
captureSink
|
|
17
|
-
};
|
|
18
|
-
//# sourceMappingURL=index.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../src/testing/capture.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2026 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\n\nimport * as Pipeline from '../Pipeline';\n\n/** In-memory sink capturing every emitted value for assertions. */\nexport type CaptureSink<Out> = {\n readonly sink: Pipeline.Sink<Out>;\n readonly items: Out[];\n};\n\nexport const captureSink = <Out>(): CaptureSink<Out> => {\n const items: Out[] = [];\n const sink: Pipeline.Sink<Out> = (out) =>\n Effect.sync(() => {\n items.push(out);\n });\n return { sink, items };\n};\n"],
|
|
5
|
-
"mappings": ";;;AAIA,YAAYA,YAAY;AAUjB,IAAMC,cAAc,MAAA;AACzB,QAAMC,QAAe,CAAA;AACrB,QAAMC,OAA2B,CAACC,QACzBC,YAAK,MAAA;AACVH,UAAMI,KAAKF,GAAAA;EACb,CAAA;AACF,SAAO;IAAED;IAAMD;EAAM;AACvB;",
|
|
6
|
-
"names": ["Effect", "captureSink", "items", "sink", "out", "sync", "push"]
|
|
7
|
-
}
|