@workflow/core 5.0.0-beta.5 → 5.0.0-beta.51
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/README.md +5 -0
- package/dist/attribute-changes.d.ts +5 -0
- package/dist/attribute-changes.d.ts.map +1 -0
- package/dist/attribute-changes.js +25 -0
- package/dist/capabilities.d.ts +35 -2
- package/dist/capabilities.d.ts.map +1 -1
- package/dist/capabilities.js +74 -5
- package/dist/capture-stack.d.ts +1 -1
- package/dist/capture-stack.js +2 -2
- package/dist/class-serialization.d.ts +32 -0
- package/dist/class-serialization.d.ts.map +1 -1
- package/dist/class-serialization.js +37 -1
- package/dist/classify-error.d.ts +19 -3
- package/dist/classify-error.d.ts.map +1 -1
- package/dist/classify-error.js +98 -6
- package/dist/context-violation-error.d.ts +5 -5
- package/dist/context-violation-error.d.ts.map +1 -1
- package/dist/context-violation-error.js +8 -6
- package/dist/create-hook.d.ts +72 -7
- package/dist/create-hook.d.ts.map +1 -1
- package/dist/create-hook.js +1 -1
- package/dist/define-hook.js +2 -2
- package/dist/describe-error.d.ts +7 -7
- package/dist/describe-error.d.ts.map +1 -1
- package/dist/describe-error.js +97 -12
- package/dist/encryption.d.ts +38 -4
- package/dist/encryption.d.ts.map +1 -1
- package/dist/encryption.js +96 -14
- package/dist/events-consumer.d.ts +297 -0
- package/dist/events-consumer.d.ts.map +1 -1
- package/dist/events-consumer.js +673 -42
- package/dist/flushable-stream.d.ts +97 -1
- package/dist/flushable-stream.d.ts.map +1 -1
- package/dist/flushable-stream.js +291 -11
- package/dist/global.d.ts +36 -2
- package/dist/global.d.ts.map +1 -1
- package/dist/global.js +21 -6
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -2
- package/dist/log-format.d.ts +2 -2
- package/dist/log-format.js +19 -12
- package/dist/logger.d.ts +1 -0
- package/dist/logger.d.ts.map +1 -1
- package/dist/logger.js +10 -6
- package/dist/private.d.ts +226 -9
- package/dist/private.d.ts.map +1 -1
- package/dist/private.js +626 -7
- package/dist/replay-divergence.d.ts +25 -0
- package/dist/replay-divergence.d.ts.map +1 -0
- package/dist/replay-divergence.js +61 -0
- package/dist/replay-payload-cache.d.ts +64 -0
- package/dist/replay-payload-cache.d.ts.map +1 -0
- package/dist/replay-payload-cache.js +158 -0
- package/dist/runtime/compute-instance.d.ts +13 -0
- package/dist/runtime/compute-instance.d.ts.map +1 -0
- package/dist/runtime/compute-instance.js +14 -0
- package/dist/runtime/constants.d.ts +315 -0
- package/dist/runtime/constants.d.ts.map +1 -1
- package/dist/runtime/constants.js +502 -16
- package/dist/runtime/count-step-started-events.d.ts +52 -0
- package/dist/runtime/count-step-started-events.d.ts.map +1 -0
- package/dist/runtime/count-step-started-events.js +72 -0
- package/dist/runtime/deployment-guard.d.ts +99 -0
- package/dist/runtime/deployment-guard.d.ts.map +1 -0
- package/dist/runtime/deployment-guard.js +154 -0
- package/dist/runtime/get-port-lazy.d.ts +15 -0
- package/dist/runtime/get-port-lazy.d.ts.map +1 -1
- package/dist/runtime/get-port-lazy.js +75 -6
- package/dist/runtime/get-world-lazy.d.ts +5 -14
- package/dist/runtime/get-world-lazy.d.ts.map +1 -1
- package/dist/runtime/get-world-lazy.js +19 -29
- package/dist/runtime/helpers.d.ts +415 -29
- package/dist/runtime/helpers.d.ts.map +1 -1
- package/dist/runtime/helpers.js +686 -57
- package/dist/runtime/quickjs-assets.generated.d.ts +14 -0
- package/dist/runtime/quickjs-assets.generated.d.ts.map +1 -0
- package/dist/runtime/quickjs-assets.generated.js +30 -0
- package/dist/runtime/quickjs-entrypoint.d.ts +158 -0
- package/dist/runtime/quickjs-entrypoint.d.ts.map +1 -0
- package/dist/runtime/quickjs-entrypoint.js +1863 -0
- package/dist/runtime/quickjs-log-view.d.ts +129 -0
- package/dist/runtime/quickjs-log-view.d.ts.map +1 -0
- package/dist/runtime/quickjs-log-view.js +229 -0
- package/dist/runtime/quickjs-runtime.d.ts +244 -0
- package/dist/runtime/quickjs-runtime.d.ts.map +1 -0
- package/dist/runtime/quickjs-runtime.js +2427 -0
- package/dist/runtime/quickjs-serde.d.ts +107 -0
- package/dist/runtime/quickjs-serde.d.ts.map +1 -0
- package/dist/runtime/quickjs-serde.js +2159 -0
- package/dist/runtime/replay-budget.d.ts +97 -0
- package/dist/runtime/replay-budget.d.ts.map +1 -0
- package/dist/runtime/replay-budget.js +139 -0
- package/dist/runtime/replay-recovery-reporter.d.ts +36 -0
- package/dist/runtime/replay-recovery-reporter.d.ts.map +1 -0
- package/dist/runtime/replay-recovery-reporter.js +64 -0
- package/dist/runtime/resume-hook.d.ts +91 -8
- package/dist/runtime/resume-hook.d.ts.map +1 -1
- package/dist/runtime/resume-hook.js +512 -89
- package/dist/runtime/resume-latency.d.ts +150 -0
- package/dist/runtime/resume-latency.d.ts.map +1 -0
- package/dist/runtime/resume-latency.js +155 -0
- package/dist/runtime/run-id-time.d.ts +19 -0
- package/dist/runtime/run-id-time.d.ts.map +1 -0
- package/dist/runtime/run-id-time.js +42 -0
- package/dist/runtime/run.d.ts +72 -7
- package/dist/runtime/run.d.ts.map +1 -1
- package/dist/runtime/run.js +280 -53
- package/dist/runtime/runs.d.ts +54 -3
- package/dist/runtime/runs.d.ts.map +1 -1
- package/dist/runtime/runs.js +126 -16
- package/dist/runtime/start.d.ts +101 -2
- package/dist/runtime/start.d.ts.map +1 -1
- package/dist/runtime/start.js +352 -61
- package/dist/runtime/step-executor.d.ts +186 -5
- package/dist/runtime/step-executor.d.ts.map +1 -1
- package/dist/runtime/step-executor.js +768 -130
- package/dist/runtime/step-latency.d.ts +220 -0
- package/dist/runtime/step-latency.d.ts.map +1 -0
- package/dist/runtime/step-latency.js +215 -0
- package/dist/runtime/step-ownership.d.ts +72 -0
- package/dist/runtime/step-ownership.d.ts.map +1 -0
- package/dist/runtime/step-ownership.js +114 -0
- package/dist/runtime/step-single-flight.d.ts +12 -0
- package/dist/runtime/step-single-flight.d.ts.map +1 -0
- package/dist/runtime/step-single-flight.js +75 -0
- package/dist/runtime/suspension-handler.d.ts +247 -7
- package/dist/runtime/suspension-handler.d.ts.map +1 -1
- package/dist/runtime/suspension-handler.js +1304 -125
- package/dist/runtime/unserializable-step.d.ts +34 -0
- package/dist/runtime/unserializable-step.d.ts.map +1 -0
- package/dist/runtime/unserializable-step.js +52 -0
- package/dist/runtime/vm-mode.d.ts +44 -0
- package/dist/runtime/vm-mode.d.ts.map +1 -0
- package/dist/runtime/vm-mode.js +62 -0
- package/dist/runtime/vm-serde-bundle.generated.d.ts +14 -0
- package/dist/runtime/vm-serde-bundle.generated.d.ts.map +1 -0
- package/dist/runtime/vm-serde-bundle.generated.js +16 -0
- package/dist/runtime/wait-continuation.d.ts +106 -0
- package/dist/runtime/wait-continuation.d.ts.map +1 -0
- package/dist/runtime/wait-continuation.js +136 -0
- package/dist/runtime/wait-until.d.ts +18 -0
- package/dist/runtime/wait-until.d.ts.map +1 -0
- package/dist/runtime/wait-until.js +42 -0
- package/dist/runtime/world-compatibility.d.ts +32 -0
- package/dist/runtime/world-compatibility.d.ts.map +1 -0
- package/dist/runtime/world-compatibility.js +44 -0
- package/dist/runtime/world-init.d.ts +17 -42
- package/dist/runtime/world-init.d.ts.map +1 -1
- package/dist/runtime/world-init.js +18 -43
- package/dist/runtime/world.d.ts +14 -2
- package/dist/runtime/world.d.ts.map +1 -1
- package/dist/runtime/world.js +75 -19
- package/dist/runtime.d.ts +10 -6
- package/dist/runtime.d.ts.map +1 -1
- package/dist/runtime.js +3911 -489
- package/dist/sealed-box.d.ts +167 -0
- package/dist/sealed-box.d.ts.map +1 -0
- package/dist/sealed-box.js +571 -0
- package/dist/serialization/client.d.ts +3 -3
- package/dist/serialization/client.d.ts.map +1 -1
- package/dist/serialization/client.js +8 -4
- package/dist/serialization/codec-devalue-vm.d.ts +16 -0
- package/dist/serialization/codec-devalue-vm.d.ts.map +1 -0
- package/dist/serialization/codec-devalue-vm.js +148 -0
- package/dist/serialization/codec-devalue.d.ts +1 -1
- package/dist/serialization/codec-devalue.d.ts.map +1 -1
- package/dist/serialization/codec-devalue.js +24 -6
- package/dist/serialization/codec.d.ts +37 -2
- package/dist/serialization/codec.d.ts.map +1 -1
- package/dist/serialization/codec.js +2 -2
- package/dist/serialization/compression.d.ts +105 -0
- package/dist/serialization/compression.d.ts.map +1 -0
- package/dist/serialization/compression.js +261 -0
- package/dist/serialization/encryption.d.ts +119 -17
- package/dist/serialization/encryption.d.ts.map +1 -1
- package/dist/serialization/encryption.js +152 -17
- package/dist/serialization/errors.d.ts +13 -0
- package/dist/serialization/errors.d.ts.map +1 -1
- package/dist/serialization/errors.js +20 -2
- package/dist/serialization/format.d.ts +6 -6
- package/dist/serialization/format.js +7 -7
- package/dist/serialization/hardened.d.ts +156 -0
- package/dist/serialization/hardened.d.ts.map +1 -0
- package/dist/serialization/hardened.js +538 -0
- package/dist/serialization/index.d.ts +10 -8
- package/dist/serialization/index.d.ts.map +1 -1
- package/dist/serialization/index.js +10 -8
- package/dist/serialization/reducers/class-vm.d.ts +20 -0
- package/dist/serialization/reducers/class-vm.d.ts.map +1 -0
- package/dist/serialization/reducers/class-vm.js +77 -0
- package/dist/serialization/reducers/class.d.ts.map +1 -1
- package/dist/serialization/reducers/class.js +11 -6
- package/dist/serialization/reducers/common-vm.d.ts +15 -0
- package/dist/serialization/reducers/common-vm.d.ts.map +1 -0
- package/dist/serialization/reducers/common-vm.js +616 -0
- package/dist/serialization/reducers/common.d.ts +1 -1
- package/dist/serialization/reducers/common.d.ts.map +1 -1
- package/dist/serialization/reducers/common.js +202 -62
- package/dist/serialization/reducers/step-function-vm.d.ts +44 -0
- package/dist/serialization/reducers/step-function-vm.d.ts.map +1 -0
- package/dist/serialization/reducers/step-function-vm.js +97 -0
- package/dist/serialization/reducers/step-function.d.ts.map +1 -1
- package/dist/serialization/reducers/step-function.js +25 -9
- package/dist/serialization/step.d.ts +4 -4
- package/dist/serialization/step.d.ts.map +1 -1
- package/dist/serialization/step.js +9 -5
- package/dist/serialization/types.d.ts +80 -1
- package/dist/serialization/types.d.ts.map +1 -1
- package/dist/serialization/types.js +15 -1
- package/dist/serialization/workflow-vm.d.ts +29 -0
- package/dist/serialization/workflow-vm.d.ts.map +1 -0
- package/dist/serialization/workflow-vm.js +74 -0
- package/dist/serialization-format.d.ts +64 -8
- package/dist/serialization-format.d.ts.map +1 -1
- package/dist/serialization-format.js +225 -73
- package/dist/serialization.d.ts +262 -34
- package/dist/serialization.d.ts.map +1 -1
- package/dist/serialization.js +1885 -277
- package/dist/set-attributes.d.ts +13 -0
- package/dist/set-attributes.d.ts.map +1 -0
- package/dist/set-attributes.js +60 -0
- package/dist/source-map.d.ts +25 -0
- package/dist/source-map.d.ts.map +1 -1
- package/dist/source-map.js +154 -10
- package/dist/step/context-storage.d.ts +63 -2
- package/dist/step/context-storage.d.ts.map +1 -1
- package/dist/step/context-storage.js +7 -5
- package/dist/step/writable-stream.d.ts +3 -3
- package/dist/step/writable-stream.d.ts.map +1 -1
- package/dist/step/writable-stream.js +80 -13
- package/dist/step.d.ts.map +1 -1
- package/dist/step.js +148 -27
- package/dist/symbols.d.ts +50 -0
- package/dist/symbols.d.ts.map +1 -1
- package/dist/symbols.js +51 -1
- package/dist/telemetry/semantic-conventions.d.ts +433 -2
- package/dist/telemetry/semantic-conventions.d.ts.map +1 -1
- package/dist/telemetry/semantic-conventions.js +319 -3
- package/dist/telemetry.d.ts +91 -0
- package/dist/telemetry.d.ts.map +1 -1
- package/dist/telemetry.js +244 -17
- package/dist/test-support/orchestrator-context.d.ts +25 -0
- package/dist/test-support/orchestrator-context.d.ts.map +1 -0
- package/dist/test-support/orchestrator-context.js +107 -0
- package/dist/types.d.ts +6 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +23 -1
- package/dist/util.d.ts +0 -5
- package/dist/util.d.ts.map +1 -1
- package/dist/util.js +1 -15
- package/dist/version.d.ts +1 -1
- package/dist/version.d.ts.map +1 -1
- package/dist/version.js +2 -2
- package/dist/vm/index.d.ts.map +1 -1
- package/dist/vm/index.js +84 -14
- package/dist/vm/script-cache.d.ts +26 -0
- package/dist/vm/script-cache.d.ts.map +1 -0
- package/dist/vm/script-cache.js +131 -0
- package/dist/vm/uint8array-base64.js +1 -1
- package/dist/workflow/abort-controller.d.ts +2 -2
- package/dist/workflow/abort-controller.d.ts.map +1 -1
- package/dist/workflow/abort-controller.js +88 -21
- package/dist/workflow/attribute-dispatcher.d.ts +6 -0
- package/dist/workflow/attribute-dispatcher.d.ts.map +1 -0
- package/dist/workflow/attribute-dispatcher.js +45 -0
- package/dist/workflow/create-hook.d.ts.map +1 -1
- package/dist/workflow/create-hook.js +24 -3
- package/dist/workflow/get-workflow-metadata.js +2 -2
- package/dist/workflow/hook.d.ts.map +1 -1
- package/dist/workflow/hook.js +304 -47
- package/dist/workflow/index.d.ts +1 -0
- package/dist/workflow/index.d.ts.map +1 -1
- package/dist/workflow/index.js +2 -1
- package/dist/workflow/set-attributes.d.ts +68 -0
- package/dist/workflow/set-attributes.d.ts.map +1 -0
- package/dist/workflow/set-attributes.js +60 -0
- package/dist/workflow/sleep.d.ts.map +1 -1
- package/dist/workflow/sleep.js +58 -12
- package/dist/workflow/world-init-stub.d.ts +3 -3
- package/dist/workflow/world-init-stub.js +4 -4
- package/dist/workflow.d.ts +95 -3
- package/dist/workflow.d.ts.map +1 -1
- package/dist/workflow.js +900 -561
- package/docs/api-reference/create-hook.mdx +89 -10
- package/docs/api-reference/create-webhook.mdx +16 -15
- package/docs/api-reference/define-hook.mdx +35 -33
- package/docs/api-reference/fatal-error.mdx +30 -8
- package/docs/api-reference/fetch.mdx +14 -10
- package/docs/api-reference/get-step-metadata.mdx +2 -2
- package/docs/api-reference/get-workflow-metadata.mdx +3 -3
- package/docs/api-reference/get-writable.mdx +7 -7
- package/docs/api-reference/index.mdx +4 -1
- package/docs/api-reference/retryable-error.mdx +1 -1
- package/docs/api-reference/set-attributes.mdx +61 -0
- package/docs/api-reference/sleep.mdx +4 -4
- package/docs/foundations/cancellation.mdx +31 -32
- package/docs/foundations/errors-and-retries.mdx +42 -11
- package/docs/foundations/hooks.mdx +64 -35
- package/docs/foundations/idempotency.mdx +244 -12
- package/docs/foundations/index.mdx +1 -23
- package/docs/foundations/meta.json +2 -1
- package/docs/foundations/serialization.mdx +21 -22
- package/docs/foundations/starting-workflows.mdx +106 -30
- package/docs/foundations/streaming.mdx +108 -60
- package/docs/foundations/versioning.mdx +263 -0
- package/docs/foundations/workflows-and-steps.mdx +9 -9
- package/docs/how-it-works/cancellation.mdx +63 -63
- package/docs/how-it-works/code-transform.mdx +83 -67
- package/docs/how-it-works/encryption.mdx +30 -26
- package/docs/how-it-works/event-sourcing.mdx +125 -34
- package/docs/how-it-works/framework-integrations.mdx +96 -337
- package/docs/how-it-works/understanding-directives.mdx +22 -22
- package/package.json +24 -15
- package/dist/runtime/step-handler.d.ts +0 -2
- package/dist/runtime/step-handler.d.ts.map +0 -1
- package/dist/runtime/step-handler.js +0 -776
|
@@ -1,4 +1,51 @@
|
|
|
1
1
|
import { type PromiseWithResolvers } from '@workflow/utils';
|
|
2
|
+
/**
|
|
3
|
+
* A durability barrier a sink may expose under {@link STREAM_DRAIN_SYMBOL}:
|
|
4
|
+
* resolves once every chunk the sink has accepted is durably written, rejects
|
|
5
|
+
* if any server write failed. See `WorkflowServerWritableStream`.
|
|
6
|
+
*/
|
|
7
|
+
type DrainBarrier = () => Promise<void>;
|
|
8
|
+
/**
|
|
9
|
+
* Flow-control knob: upper bound on chunks read-but-not-yet-durably-written
|
|
10
|
+
* while coalescing. Once this many chunks are outstanding the producer stops
|
|
11
|
+
* reading until the consumer drains a batch, so a fast producer paired with a
|
|
12
|
+
* slow server can't grow the in-memory queue without bound. Override:
|
|
13
|
+
* `WORKFLOW_STREAM_MAX_INFLIGHT_CHUNKS`.
|
|
14
|
+
*
|
|
15
|
+
* This is deliberately distinct from the per-request batch caps below: this
|
|
16
|
+
* bounds how much is *buffered*, those bound how much goes out in one
|
|
17
|
+
* `writeMulti`. Raising this must never let a single request exceed a wire
|
|
18
|
+
* limit, since batch sizing enforces that independently.
|
|
19
|
+
*/
|
|
20
|
+
export declare const MAX_INFLIGHT_CHUNKS = 1000;
|
|
21
|
+
export declare const getMaxInflightChunks: () => number;
|
|
22
|
+
/**
|
|
23
|
+
* Wire limit: maximum number of chunks in a single coalesced `writeMulti`.
|
|
24
|
+
* The server enforces a per-multi-write chunk cap (1,000 today); a batch is
|
|
25
|
+
* split at this bound so it can never be rejected wholesale, independently of
|
|
26
|
+
* the backpressure knob above. Override: `WORKFLOW_STREAM_MAX_CHUNKS_PER_BATCH`.
|
|
27
|
+
*/
|
|
28
|
+
export declare const MAX_CHUNKS_PER_BATCH = 1000;
|
|
29
|
+
export declare const getMaxChunksPerBatch: () => number;
|
|
30
|
+
/**
|
|
31
|
+
* Wire limit: maximum cumulative bytes in a single coalesced `writeMulti`.
|
|
32
|
+
* Chunk *count* alone is not enough: 1,000 small chunks are ~100KB but 1,000
|
|
33
|
+
* file-sized chunks can be hundreds of MB, which platform request-body limits
|
|
34
|
+
* reject long before the count cap matters. A batch is split once adding the
|
|
35
|
+
* next chunk would exceed this (a single chunk larger than the cap still goes
|
|
36
|
+
* out alone). Default 1 MiB. Override: `WORKFLOW_STREAM_MAX_BYTES_PER_BATCH`.
|
|
37
|
+
*/
|
|
38
|
+
export declare const MAX_BYTES_PER_BATCH: number;
|
|
39
|
+
export declare const getMaxBytesPerBatch: () => number;
|
|
40
|
+
/**
|
|
41
|
+
* Buffer bound (bytes) for the server writable's group-commit buffer, the
|
|
42
|
+
* byte-denominated counterpart of {@link MAX_INFLIGHT_CHUNKS}. `write()`
|
|
43
|
+
* blocks once this much data is buffered-but-not-durable, so a fast producer
|
|
44
|
+
* of large chunks can't grow client memory without bound. Default 8 MiB
|
|
45
|
+
* (eight request-sized groups). Override: `WORKFLOW_STREAM_MAX_BUFFERED_BYTES`.
|
|
46
|
+
*/
|
|
47
|
+
export declare const MAX_BUFFERED_BYTES: number;
|
|
48
|
+
export declare const getMaxBufferedBytes: () => number;
|
|
2
49
|
/**
|
|
3
50
|
* Polling interval (in ms) for lock release detection.
|
|
4
51
|
*
|
|
@@ -12,7 +59,7 @@ import { type PromiseWithResolvers } from '@workflow/utils';
|
|
|
12
59
|
* after each step body returns, so a coarser interval (the previous 100ms)
|
|
13
60
|
* adds visible per-step latency to streaming workflows. With a uniformly
|
|
14
61
|
* distributed offset between step return and the next tick, the expected
|
|
15
|
-
* wait is half the interval
|
|
62
|
+
* wait is half the interval, so 10ms means ~5ms average wait per step
|
|
16
63
|
* instead of ~50ms. The per-tick work is `writable.locked` plus a
|
|
17
64
|
* `getWriter()`/`releaseLock()` probe, both microsecond-scale; 10× more
|
|
18
65
|
* ticks during a stream's lifetime is not measurable in practice.
|
|
@@ -35,6 +82,30 @@ export declare const LOCK_POLL_INTERVAL_MS = 10;
|
|
|
35
82
|
export interface FlushableStreamState extends PromiseWithResolvers<void> {
|
|
36
83
|
/** Number of write operations currently in flight to the server */
|
|
37
84
|
pendingOps: number;
|
|
85
|
+
/** Frames emitted by this pipe's producer. */
|
|
86
|
+
producedFrames: number;
|
|
87
|
+
/** Produced frames accepted by this pipe's sink. */
|
|
88
|
+
acceptedFrames: number;
|
|
89
|
+
/** Terminal pipe error, retained for snapshots registered after failure. */
|
|
90
|
+
pipeError?: unknown;
|
|
91
|
+
/**
|
|
92
|
+
* If the user-facing writable is unlocked, enqueue an ordered checkpoint and
|
|
93
|
+
* durably drain every write ahead of it. Returns false while a writer remains
|
|
94
|
+
* locked, so lock-held streams never block step completion.
|
|
95
|
+
*/
|
|
96
|
+
settleReleasedWrites?: () => Promise<boolean>;
|
|
97
|
+
/** Whether release settlement waits for explicit step-end arming. */
|
|
98
|
+
deferReleaseSettlement?: boolean;
|
|
99
|
+
/** Whether step-end processing has armed released-writer settlement. */
|
|
100
|
+
releaseSettlementArmed?: boolean;
|
|
101
|
+
/** Whether the user-facing writable has begun a normal close. */
|
|
102
|
+
userWritableClosing?: boolean;
|
|
103
|
+
/** Step-end snapshot waiters blocked until their target reaches the sink. */
|
|
104
|
+
frameWaiters: Array<{
|
|
105
|
+
target: number;
|
|
106
|
+
resolve: () => void;
|
|
107
|
+
reject: (error: unknown) => void;
|
|
108
|
+
}>;
|
|
38
109
|
/** Whether the `done` promise has been resolved */
|
|
39
110
|
doneResolved: boolean;
|
|
40
111
|
/** Whether the underlying stream has actually closed/errored */
|
|
@@ -43,8 +114,32 @@ export interface FlushableStreamState extends PromiseWithResolvers<void> {
|
|
|
43
114
|
writablePollingInterval?: ReturnType<typeof setInterval>;
|
|
44
115
|
/** Interval ID for readable lock polling (if active) */
|
|
45
116
|
readablePollingInterval?: ReturnType<typeof setInterval>;
|
|
117
|
+
/**
|
|
118
|
+
* Durability barrier of the pipe's sink, when it acks writes on buffer
|
|
119
|
+
* entry (see {@link STREAM_DRAIN_SYMBOL}). Lock-release completion awaits
|
|
120
|
+
* this before resolving so `pendingOps === 0` (fast, buffered acks) can't
|
|
121
|
+
* complete a step while data is still client-side.
|
|
122
|
+
*/
|
|
123
|
+
drainBarrier?: DrainBarrier;
|
|
46
124
|
}
|
|
47
125
|
export declare function createFlushableState(): FlushableStreamState;
|
|
126
|
+
/**
|
|
127
|
+
* Capture a step-end producer watermark, wait until the pipe has handed every
|
|
128
|
+
* frame through that watermark to its sink, then await the sink's durability
|
|
129
|
+
* barrier. Unlike {@link FlushableStreamState.promise}, this never waits for a
|
|
130
|
+
* user writer lock to be released.
|
|
131
|
+
*/
|
|
132
|
+
export declare function drainFlushableSnapshot(state: FlushableStreamState): Promise<void>;
|
|
133
|
+
/**
|
|
134
|
+
* Mark byte-stream chunks at the producer side of a flushable pipe. Serialized
|
|
135
|
+
* streams should instead use `getSerializeStream`'s synchronous output hook.
|
|
136
|
+
*/
|
|
137
|
+
/**
|
|
138
|
+
* Wrap the user-facing producer boundary of a flushable writable. A completed
|
|
139
|
+
* write through this handle has a sequence number before step-end snapshots,
|
|
140
|
+
* while the original writable remains the input to the serialization pipe.
|
|
141
|
+
*/
|
|
142
|
+
export declare function trackFlushableWritable<T>(writable: WritableStream<T>, state: FlushableStreamState, WritableStreamConstructor?: typeof WritableStream): WritableStream<T>;
|
|
48
143
|
/**
|
|
49
144
|
* Polls a WritableStream to check if the user has released their lock.
|
|
50
145
|
* Resolves the done promise when lock is released and no pending ops remain.
|
|
@@ -79,4 +174,5 @@ export declare function pollReadableLock(readable: ReadableStream, state: Flusha
|
|
|
79
174
|
* @returns Promise that resolves when stream ends (not when done promise resolves)
|
|
80
175
|
*/
|
|
81
176
|
export declare function flushablePipe(source: ReadableStream, sink: WritableStream, state: FlushableStreamState): Promise<void>;
|
|
177
|
+
export {};
|
|
82
178
|
//# sourceMappingURL=flushable-stream.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flushable-stream.d.ts","sourceRoot":"","sources":["../src/flushable-stream.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,oBAAoB,EAAiB,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"flushable-stream.d.ts","sourceRoot":"","sources":["../src/flushable-stream.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,oBAAoB,EAAiB,MAAM,iBAAiB,CAAC;AAI3E;;;;GAIG;AACH,KAAK,YAAY,GAAG,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;AAExC;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,mBAAmB,OAAO,CAAC;AAExC,eAAO,MAAM,oBAAoB,QAAO,MAIpC,CAAC;AAEL;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,OAAO,CAAC;AAEzC,eAAO,MAAM,oBAAoB,QAAO,MAIpC,CAAC;AAEL;;;;;;;GAOG;AACH,eAAO,MAAM,mBAAmB,QAAc,CAAC;AAE/C,eAAO,MAAM,mBAAmB,QAAO,MAInC,CAAC;AAEL;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,QAAkB,CAAC;A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