@workflow/core 5.0.0-beta.3 → 5.0.0-beta.31
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/attribute-changes.d.ts +7 -0
- package/dist/attribute-changes.d.ts.map +1 -0
- package/dist/attribute-changes.js +25 -0
- package/dist/capabilities.d.ts +22 -1
- package/dist/capabilities.d.ts.map +1 -1
- package/dist/capabilities.js +41 -4
- package/dist/capture-stack.d.ts +16 -0
- package/dist/capture-stack.d.ts.map +1 -0
- package/dist/capture-stack.js +21 -0
- 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 +26 -3
- package/dist/classify-error.d.ts.map +1 -1
- package/dist/classify-error.js +103 -6
- package/dist/context-errors.d.ts +27 -0
- package/dist/context-errors.d.ts.map +1 -0
- package/dist/context-errors.js +101 -0
- package/dist/context-violation-error.d.ts +97 -0
- package/dist/context-violation-error.d.ts.map +1 -0
- package/dist/context-violation-error.js +147 -0
- package/dist/create-hook.d.ts +42 -3
- package/dist/create-hook.d.ts.map +1 -1
- package/dist/create-hook.js +4 -3
- package/dist/define-hook.d.ts.map +1 -1
- package/dist/define-hook.js +20 -5
- package/dist/describe-error.d.ts +70 -0
- package/dist/describe-error.d.ts.map +1 -0
- package/dist/describe-error.js +165 -0
- package/dist/encryption.d.ts +22 -1
- package/dist/encryption.d.ts.map +1 -1
- package/dist/encryption.js +72 -27
- package/dist/events-consumer.d.ts +25 -1
- package/dist/events-consumer.d.ts.map +1 -1
- package/dist/events-consumer.js +95 -16
- package/dist/flushable-stream.d.ts +10 -10
- package/dist/flushable-stream.d.ts.map +1 -1
- package/dist/flushable-stream.js +26 -15
- package/dist/global.d.ts +35 -1
- package/dist/global.d.ts.map +1 -1
- package/dist/global.js +21 -3
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/log-format.d.ts +25 -0
- package/dist/log-format.d.ts.map +1 -0
- package/dist/log-format.js +250 -0
- package/dist/logger.d.ts +29 -30
- package/dist/logger.d.ts.map +1 -1
- package/dist/logger.js +82 -32
- package/dist/private.d.ts +107 -2
- package/dist/private.d.ts.map +1 -1
- package/dist/private.js +80 -3
- package/dist/runtime/constants.d.ts +189 -0
- package/dist/runtime/constants.d.ts.map +1 -1
- package/dist/runtime/constants.js +310 -15
- package/dist/runtime/get-port-lazy.d.ts +25 -0
- package/dist/runtime/get-port-lazy.d.ts.map +1 -0
- package/dist/runtime/get-port-lazy.js +92 -0
- package/dist/runtime/get-world-lazy.d.ts +23 -0
- package/dist/runtime/get-world-lazy.d.ts.map +1 -0
- package/dist/runtime/get-world-lazy.js +46 -0
- package/dist/runtime/helpers.d.ts +57 -6
- package/dist/runtime/helpers.d.ts.map +1 -1
- package/dist/runtime/helpers.js +169 -32
- package/dist/runtime/replay-budget.d.ts +98 -0
- package/dist/runtime/replay-budget.d.ts.map +1 -0
- package/dist/runtime/replay-budget.js +192 -0
- package/dist/runtime/resume-hook.d.ts.map +1 -1
- package/dist/runtime/resume-hook.js +39 -23
- package/dist/runtime/run-id-time.d.ts +10 -0
- package/dist/runtime/run-id-time.d.ts.map +1 -0
- package/dist/runtime/run-id-time.js +31 -0
- package/dist/runtime/run.d.ts +6 -2
- package/dist/runtime/run.d.ts.map +1 -1
- package/dist/runtime/run.js +52 -10
- package/dist/runtime/runs.d.ts +36 -2
- package/dist/runtime/runs.d.ts.map +1 -1
- package/dist/runtime/runs.js +18 -7
- package/dist/runtime/start.d.ts +58 -1
- package/dist/runtime/start.d.ts.map +1 -1
- package/dist/runtime/start.js +160 -46
- package/dist/runtime/step-executor.d.ts +131 -0
- package/dist/runtime/step-executor.d.ts.map +1 -0
- package/dist/runtime/step-executor.js +818 -0
- package/dist/runtime/step-handler.d.ts.map +1 -1
- package/dist/runtime/step-handler.js +718 -557
- package/dist/runtime/step-latency.d.ts +131 -0
- package/dist/runtime/step-latency.d.ts.map +1 -0
- package/dist/runtime/step-latency.js +155 -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 +69 -0
- package/dist/runtime/suspension-handler.d.ts +81 -7
- package/dist/runtime/suspension-handler.d.ts.map +1 -1
- package/dist/runtime/suspension-handler.js +355 -137
- package/dist/runtime/wait-continuation.d.ts +84 -0
- package/dist/runtime/wait-continuation.d.ts.map +1 -0
- package/dist/runtime/wait-continuation.js +105 -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 +5 -0
- package/dist/runtime/world-compatibility.d.ts.map +1 -0
- package/dist/runtime/world-compatibility.js +12 -0
- package/dist/runtime/world-init.d.ts +50 -0
- package/dist/runtime/world-init.d.ts.map +1 -0
- package/dist/runtime/world-init.js +50 -0
- package/dist/runtime/world-target.d.ts +11 -0
- package/dist/runtime/world-target.d.ts.map +1 -0
- package/dist/runtime/world-target.js +15 -0
- package/dist/runtime/world.d.ts +21 -9
- package/dist/runtime/world.d.ts.map +1 -1
- package/dist/runtime/world.js +58 -83
- package/dist/runtime.d.ts +15 -10
- package/dist/runtime.d.ts.map +1 -1
- package/dist/runtime.js +1757 -326
- package/dist/schemas.d.ts +1 -1
- package/dist/schemas.d.ts.map +1 -1
- package/dist/schemas.js +1 -1
- package/dist/serialization/client.d.ts +17 -0
- package/dist/serialization/client.d.ts.map +1 -0
- package/dist/serialization/client.js +48 -0
- package/dist/serialization/codec-devalue.d.ts +14 -0
- package/dist/serialization/codec-devalue.d.ts.map +1 -0
- package/dist/serialization/codec-devalue.js +98 -0
- package/dist/serialization/codec.d.ts +106 -0
- package/dist/serialization/codec.d.ts.map +1 -0
- package/dist/serialization/codec.js +17 -0
- package/dist/serialization/compression.d.ts +104 -0
- package/dist/serialization/compression.d.ts.map +1 -0
- package/dist/serialization/compression.js +260 -0
- package/dist/serialization/encryption.d.ts +33 -0
- package/dist/serialization/encryption.d.ts.map +1 -0
- package/dist/serialization/encryption.js +70 -0
- package/dist/serialization/errors.d.ts +34 -0
- package/dist/serialization/errors.d.ts.map +1 -0
- package/dist/serialization/errors.js +59 -0
- package/dist/serialization/format.d.ts +60 -0
- package/dist/serialization/format.d.ts.map +1 -0
- package/dist/serialization/format.js +97 -0
- package/dist/serialization/index.d.ts +19 -0
- package/dist/serialization/index.d.ts.map +1 -0
- package/dist/serialization/index.js +22 -0
- package/dist/serialization/reducers/class.d.ts +11 -0
- package/dist/serialization/reducers/class.d.ts.map +1 -0
- package/dist/serialization/reducers/class.js +68 -0
- package/dist/serialization/reducers/common.d.ts +16 -0
- package/dist/serialization/reducers/common.d.ts.map +1 -0
- package/dist/serialization/reducers/common.js +417 -0
- package/dist/serialization/reducers/step-function.d.ts +35 -0
- package/dist/serialization/reducers/step-function.d.ts.map +1 -0
- package/dist/serialization/reducers/step-function.js +88 -0
- package/dist/serialization/step.d.ts +17 -0
- package/dist/serialization/step.d.ts.map +1 -0
- package/dist/serialization/step.js +48 -0
- package/dist/serialization/types.d.ts +253 -0
- package/dist/serialization/types.d.ts.map +1 -0
- package/dist/serialization/types.js +25 -0
- package/dist/serialization/workflow.d.ts +29 -0
- package/dist/serialization/workflow.d.ts.map +1 -0
- package/dist/serialization/workflow.js +54 -0
- package/dist/serialization-format.d.ts +16 -0
- package/dist/serialization-format.d.ts.map +1 -1
- package/dist/serialization-format.js +213 -50
- package/dist/serialization.d.ts +322 -214
- package/dist/serialization.d.ts.map +1 -1
- package/dist/serialization.js +1575 -664
- package/dist/set-attributes.d.ts +18 -0
- package/dist/set-attributes.d.ts.map +1 -0
- package/dist/set-attributes.js +61 -0
- package/dist/sleep.d.ts.map +1 -1
- package/dist/sleep.js +3 -2
- package/dist/source-map.d.ts +5 -0
- package/dist/source-map.d.ts.map +1 -1
- package/dist/source-map.js +102 -10
- package/dist/step/context-storage.d.ts +53 -0
- package/dist/step/context-storage.d.ts.map +1 -1
- package/dist/step/context-storage.js +1 -1
- package/dist/step/get-closure-vars.d.ts.map +1 -1
- package/dist/step/get-closure-vars.js +3 -2
- package/dist/step/get-step-metadata.d.ts.map +1 -1
- package/dist/step/get-step-metadata.js +3 -2
- package/dist/step/get-workflow-metadata.d.ts.map +1 -1
- package/dist/step/get-workflow-metadata.js +3 -2
- package/dist/step/writable-stream.d.ts.map +1 -1
- package/dist/step/writable-stream.js +58 -6
- package/dist/step-hydration-cache.d.ts +148 -0
- package/dist/step-hydration-cache.d.ts.map +1 -0
- package/dist/step-hydration-cache.js +171 -0
- package/dist/step.d.ts.map +1 -1
- package/dist/step.js +144 -25
- package/dist/symbols.d.ts +28 -0
- package/dist/symbols.d.ts.map +1 -1
- package/dist/symbols.js +29 -1
- package/dist/telemetry/semantic-conventions.d.ts +98 -2
- package/dist/telemetry/semantic-conventions.d.ts.map +1 -1
- package/dist/telemetry/semantic-conventions.js +66 -1
- package/dist/telemetry.d.ts +68 -0
- package/dist/telemetry.d.ts.map +1 -1
- package/dist/telemetry.js +106 -4
- 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 +16 -6
- package/dist/util.d.ts.map +1 -1
- package/dist/util.js +25 -16
- 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 +3 -2
- package/dist/vm/script-cache.d.ts +28 -0
- package/dist/vm/script-cache.d.ts.map +1 -0
- package/dist/vm/script-cache.js +140 -0
- package/dist/workflow/abort-controller.d.ts +65 -0
- package/dist/workflow/abort-controller.d.ts.map +1 -0
- package/dist/workflow/abort-controller.js +277 -0
- 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 +48 -0
- package/dist/workflow/create-hook.d.ts.map +1 -1
- package/dist/workflow/create-hook.js +25 -3
- package/dist/workflow/define-hook.d.ts +1 -1
- package/dist/workflow/define-hook.d.ts.map +1 -1
- package/dist/workflow/define-hook.js +8 -4
- package/dist/workflow/get-workflow-metadata.d.ts.map +1 -1
- package/dist/workflow/get-workflow-metadata.js +14 -3
- package/dist/workflow/hook.d.ts.map +1 -1
- package/dist/workflow/hook.js +207 -33
- package/dist/workflow/index.d.ts +1 -0
- package/dist/workflow/index.d.ts.map +1 -1
- package/dist/workflow/index.js +5 -3
- package/dist/workflow/set-attributes.d.ts +77 -0
- package/dist/workflow/set-attributes.d.ts.map +1 -0
- package/dist/workflow/set-attributes.js +65 -0
- package/dist/workflow/sleep.d.ts.map +1 -1
- package/dist/workflow/sleep.js +45 -8
- package/dist/workflow/world-init-stub.d.ts +15 -0
- package/dist/workflow/world-init-stub.d.ts.map +1 -0
- package/dist/workflow/world-init-stub.js +15 -0
- package/dist/workflow.d.ts +17 -1
- package/dist/workflow.d.ts.map +1 -1
- package/dist/workflow.js +190 -56
- package/docs/api-reference/create-hook.mdx +38 -0
- package/docs/api-reference/create-webhook.mdx +1 -0
- package/docs/api-reference/fetch.mdx +5 -0
- package/docs/api-reference/index.mdx +3 -0
- package/docs/api-reference/set-attributes.mdx +65 -0
- package/docs/foundations/cancellation.mdx +459 -0
- package/docs/foundations/errors-and-retries.mdx +7 -3
- package/docs/foundations/hooks.mdx +29 -0
- package/docs/foundations/idempotency.mdx +236 -11
- package/docs/foundations/index.mdx +1 -23
- package/docs/foundations/meta.json +3 -1
- package/docs/foundations/serialization.mdx +77 -41
- package/docs/foundations/starting-workflows.mdx +5 -1
- package/docs/foundations/streaming.mdx +14 -23
- package/docs/foundations/versioning.mdx +263 -0
- package/docs/how-it-works/cancellation.mdx +287 -0
- package/docs/how-it-works/code-transform.mdx +2 -2
- package/docs/how-it-works/encryption.mdx +2 -2
- package/docs/how-it-works/event-sourcing.mdx +2 -2
- package/docs/how-it-works/meta.json +2 -1
- package/package.json +32 -11
package/dist/serialization.d.ts
CHANGED
|
@@ -1,211 +1,303 @@
|
|
|
1
1
|
import { type CryptoKey } from './encryption.js';
|
|
2
|
+
import { compress, decompress } from './serialization/compression.js';
|
|
3
|
+
import { decrypt, type EncryptionKeyParam, encrypt } from './serialization/encryption.js';
|
|
4
|
+
import { decodeFormatPrefix, encodeWithFormatPrefix, isEncrypted, peekFormatPrefix } from './serialization/format.js';
|
|
5
|
+
import { type FormatPrefix, isFormatPrefix, SerializationFormat } from './serialization/types.js';
|
|
6
|
+
export { SerializationFormat, type FormatPrefix, isFormatPrefix, encodeWithFormatPrefix, decodeFormatPrefix, peekFormatPrefix, isEncrypted, encrypt, decrypt, compress, decompress, type EncryptionKeyParam, };
|
|
7
|
+
export type SerializationFormatType = (typeof SerializationFormat)[keyof typeof SerializationFormat];
|
|
2
8
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
9
|
+
* Detect if a readable stream is a byte stream.
|
|
10
|
+
*
|
|
11
|
+
* @param stream
|
|
12
|
+
* @returns `"bytes"` if the stream is a byte stream, `undefined` otherwise
|
|
7
13
|
*/
|
|
8
|
-
export
|
|
14
|
+
export declare function getStreamType(stream: ReadableStream): 'bytes' | undefined;
|
|
15
|
+
export declare function getSerializeStream(reducers: Partial<Reducers>, cryptoKey: EncryptionKeyParam): TransformStream<any, Uint8Array>;
|
|
16
|
+
export declare function getDeserializeStream(revivers: Partial<Revivers>, cryptoKey: EncryptionKeyParam): TransformStream<Uint8Array, any>;
|
|
9
17
|
/**
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
18
|
+
* Wraps each chunk of a byte stream in a 4-byte big-endian length
|
|
19
|
+
* prefix. Used by the producer side of a framed byte-stream pipe.
|
|
20
|
+
*
|
|
21
|
+
* Empty chunks (length 0) are dropped — the resulting `[0x00 0x00 0x00 0x00]`
|
|
22
|
+
* frame would be ambiguous with the legacy "looks framed" detection in
|
|
23
|
+
* `getDeserializeStream`, and it carries no information.
|
|
24
|
+
*
|
|
25
|
+
* Load-bearing invariant: each user chunk becomes exactly one frame, and
|
|
26
|
+
* each frame is enqueued as exactly one transport chunk (the downstream
|
|
27
|
+
* writable performs one wire write per chunk, preserving boundaries). The
|
|
28
|
+
* server therefore stores one frame per chunk index, which is what allows
|
|
29
|
+
* a future reconnecting reader to resume a framed byte stream at
|
|
30
|
+
* `startIndex + consumedFrames` — the same arithmetic
|
|
31
|
+
* `createReconnectingFramedStream` relies on for object streams. Do not
|
|
32
|
+
* coalesce or split frames here without revisiting that resume logic.
|
|
13
33
|
*/
|
|
14
|
-
export declare
|
|
15
|
-
/** devalue stringify/parse with TextEncoder/TextDecoder */
|
|
16
|
-
readonly DEVALUE_V1: "devl";
|
|
17
|
-
/** Encrypted payload (inner payload has its own format prefix) */
|
|
18
|
-
readonly ENCRYPTED: "encr";
|
|
19
|
-
};
|
|
20
|
-
export type SerializationFormatType = (typeof SerializationFormat)[keyof typeof SerializationFormat];
|
|
34
|
+
export declare function getByteFramingStream(): TransformStream<Uint8Array, Uint8Array>;
|
|
21
35
|
/**
|
|
22
|
-
*
|
|
36
|
+
* Unwraps length-prefixed byte-stream frames back into the original user
|
|
37
|
+
* chunks. Used by the consumer side of a framed byte-stream pipe.
|
|
38
|
+
*
|
|
39
|
+
* Buffers across read boundaries — the transport may split a single
|
|
40
|
+
* frame across multiple reads (header in one chunk, payload in another)
|
|
41
|
+
* or coalesce multiple frames into a single read. The transform emits
|
|
42
|
+
* whole user chunks regardless of transport chunking.
|
|
23
43
|
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
44
|
+
* Errors the stream if the length header advertises a frame larger than
|
|
45
|
+
* `MAX_FRAME_SIZE` bytes, since that almost certainly indicates a
|
|
46
|
+
* misframed wire (e.g. a raw byte stream being fed through this transform
|
|
47
|
+
* by mistake) and we don't want to allocate an enormous buffer.
|
|
27
48
|
*/
|
|
28
|
-
export declare function
|
|
49
|
+
export declare function getByteUnframingStream(): TransformStream<Uint8Array, Uint8Array>;
|
|
50
|
+
export declare class WorkflowServerReadableStream extends ReadableStream<Uint8Array> {
|
|
51
|
+
#private;
|
|
52
|
+
constructor(runId: string, name: string, startIndex?: number);
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Maximum consecutive reconnect attempts for a single framed stream session.
|
|
56
|
+
* The counter resets to zero whenever a reconnect makes forward progress (a
|
|
57
|
+
* frame is delivered), so this bounds *consecutive* failures, not the lifetime
|
|
58
|
+
* total — a long-lived serverless stream may legitimately reconnect far more
|
|
59
|
+
* than this many times as long as each reconnect keeps delivering data. We only
|
|
60
|
+
* give up after this many reconnects in a row produce nothing.
|
|
61
|
+
*/
|
|
62
|
+
export declare const FRAMED_STREAM_MAX_RECONNECTS = 50;
|
|
63
|
+
/**
|
|
64
|
+
* Absolute backstop on total reconnects for a single session, independent of
|
|
65
|
+
* progress. The consecutive cap above resets on forward progress, which is
|
|
66
|
+
* correct for a well-behaved backend that honors `startIndex`. But if a World's
|
|
67
|
+
* `streams.get` ever ignored `startIndex` and re-delivered earlier chunks,
|
|
68
|
+
* "progress" would be reported every reconnect and the consecutive cap would
|
|
69
|
+
* never trip — turning a bounded failure into an unbounded reconnect loop. This
|
|
70
|
+
* hard ceiling guarantees the loop always terminates. It is set high enough
|
|
71
|
+
* (hours of streaming at realistic per-session timeouts) to never interfere
|
|
72
|
+
* with legitimate long-lived streams.
|
|
73
|
+
*/
|
|
74
|
+
export declare const FRAMED_STREAM_MAX_TOTAL_RECONNECTS = 1000;
|
|
29
75
|
/**
|
|
30
|
-
*
|
|
31
|
-
*
|
|
76
|
+
* Wraps the length-prefix-framed byte stream from `world.streams.get` with
|
|
77
|
+
* transparent auto-reconnect.
|
|
78
|
+
*
|
|
79
|
+
* Every fully-decoded outer frame corresponds to exactly one server-side
|
|
80
|
+
* chunk (the serialize transform enqueues one frame per workflow write, and
|
|
81
|
+
* the writable buffers one frame per chunk when multi-writing). The wrapper
|
|
82
|
+
* counts completed frames and, on upstream error, reopens the connection
|
|
83
|
+
* with `startIndex = resolvedStartIndex + consumedFrames`. Partial-frame
|
|
84
|
+
* bytes buffered before the cut are discarded — the server will resend the
|
|
85
|
+
* in-flight chunk in full from the new startIndex.
|
|
86
|
+
*
|
|
87
|
+
* A clean upstream close (EOF with no error) signals the stream is truly
|
|
88
|
+
* done; we close the wrapper and do not reconnect.
|
|
32
89
|
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
90
|
+
* Negative `startIndex` values (last-N semantics) skip the reconnect
|
|
91
|
+
* machinery because we cannot compute an absolute resume position without
|
|
92
|
+
* a tail-index lookup — the returned stream behaves as a single-shot read.
|
|
35
93
|
*/
|
|
36
|
-
export declare function
|
|
94
|
+
export declare function createReconnectingFramedStream(runId: string, name: string, startIndex?: number): ReadableStream<Uint8Array>;
|
|
95
|
+
export declare class WorkflowServerWritableStream extends WritableStream<Uint8Array> {
|
|
96
|
+
/**
|
|
97
|
+
* @param runReadyBarrier Turbo mode only: a promise that resolves once the
|
|
98
|
+
* backgrounded `run_started` has landed. When the step body runs
|
|
99
|
+
* optimistically (before `run_started` is durable), the first chunk write to
|
|
100
|
+
* a brand-new stream would otherwise reach the World before the run exists
|
|
101
|
+
* and be rejected as run-not-found. Awaiting this once before the first
|
|
102
|
+
* flush/close orders the write after the run's creation. `undefined` outside
|
|
103
|
+
* turbo and on the await path, where the run was already durable.
|
|
104
|
+
*/
|
|
105
|
+
constructor(runId: string, name: string, runReadyBarrier?: Promise<unknown>);
|
|
106
|
+
}
|
|
107
|
+
export type { ByteStreamFraming, Reducers, Revivers, SerializableSpecial, } from './serialization/types.js';
|
|
108
|
+
import type { ByteStreamFraming, Reducers, Revivers } from './serialization/types.js';
|
|
37
109
|
/**
|
|
38
|
-
*
|
|
110
|
+
* Reducers for serialization boundary from the client side, passing arguments
|
|
111
|
+
* to the workflow handler.
|
|
39
112
|
*
|
|
40
|
-
* @param
|
|
41
|
-
* @
|
|
113
|
+
* @param global
|
|
114
|
+
* @param ops
|
|
115
|
+
* @param runId
|
|
116
|
+
* @param cryptoKey
|
|
117
|
+
* @param framedByteStreams - When `true`, byte streams (`type: 'bytes'`)
|
|
118
|
+
* are wrapped in length-prefixed frames on the wire so the consumer
|
|
119
|
+
* can reconnect on transient errors. Should match the target run's
|
|
120
|
+
* capability — see `getRunCapabilities` in `capabilities.ts`. Defaults
|
|
121
|
+
* to `false` for backwards compatibility with older runs.
|
|
122
|
+
* @returns
|
|
42
123
|
*/
|
|
43
|
-
export declare function
|
|
124
|
+
export declare function getExternalReducers(global: Record<string, any> | undefined, ops: Promise<void>[], runId: string, cryptoKey: EncryptionKeyParam, framedByteStreams?: boolean, runReadyBarrier?: Promise<unknown>): Partial<Reducers>;
|
|
44
125
|
/**
|
|
45
|
-
*
|
|
126
|
+
* Reducers for serialization boundary from within the workflow execution
|
|
127
|
+
* environment, passing return value to the client side and into step arguments.
|
|
46
128
|
*
|
|
47
|
-
* @param
|
|
48
|
-
* @returns
|
|
49
|
-
* @throws Error if the data is too short or has an unknown format
|
|
129
|
+
* @param global
|
|
130
|
+
* @returns
|
|
50
131
|
*/
|
|
51
|
-
export declare function
|
|
52
|
-
format: SerializationFormatType;
|
|
53
|
-
payload: Uint8Array;
|
|
54
|
-
};
|
|
132
|
+
export declare function getWorkflowReducers(global?: Record<string, any>): Partial<Reducers>;
|
|
55
133
|
/**
|
|
56
|
-
*
|
|
134
|
+
* Cancel dangling abort-stream readers on any AbortController instances found
|
|
135
|
+
* in the hydrated step arguments. Called after the step function returns
|
|
136
|
+
* (success or failure) to prevent reader promises from keeping the serverless
|
|
137
|
+
* function alive indefinitely.
|
|
138
|
+
*/
|
|
139
|
+
export declare function cancelAbortReaders(...values: unknown[]): void;
|
|
140
|
+
/**
|
|
141
|
+
* Base revivers shared across all serialization boundaries.
|
|
142
|
+
* Composes: class + common revivers from the modular modules.
|
|
57
143
|
*
|
|
58
|
-
*
|
|
59
|
-
* @returns `"bytes"` if the stream is a byte stream, `undefined` otherwise
|
|
144
|
+
* This is exported because serialization-format.ts and other files reference it.
|
|
60
145
|
*/
|
|
61
|
-
export declare function
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
export declare class WorkflowServerWritableStream extends WritableStream<Uint8Array> {
|
|
69
|
-
constructor(runId: string, name: string);
|
|
70
|
-
}
|
|
71
|
-
export interface SerializableSpecial {
|
|
72
|
-
ArrayBuffer: string;
|
|
73
|
-
BigInt: string;
|
|
74
|
-
BigInt64Array: string;
|
|
75
|
-
BigUint64Array: string;
|
|
76
|
-
Date: string;
|
|
77
|
-
DOMException: {
|
|
146
|
+
export declare function getCommonRevivers(global?: Record<string, any>): {
|
|
147
|
+
ArrayBuffer?: ((value: string) => any) | undefined;
|
|
148
|
+
BigInt?: ((value: string) => any) | undefined;
|
|
149
|
+
BigInt64Array?: ((value: string) => any) | undefined;
|
|
150
|
+
BigUint64Array?: ((value: string) => any) | undefined;
|
|
151
|
+
Date?: ((value: string) => any) | undefined;
|
|
152
|
+
DOMException?: ((value: {
|
|
78
153
|
message: string;
|
|
79
154
|
name: string;
|
|
80
155
|
stack?: string;
|
|
81
156
|
cause?: unknown;
|
|
82
|
-
};
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
ReadableStream: {
|
|
157
|
+
}) => any) | undefined;
|
|
158
|
+
FatalError?: ((value: {
|
|
159
|
+
message: string;
|
|
160
|
+
stack?: string;
|
|
161
|
+
cause?: unknown;
|
|
162
|
+
}) => any) | undefined;
|
|
163
|
+
Float32Array?: ((value: string) => any) | undefined;
|
|
164
|
+
Float64Array?: ((value: string) => any) | undefined;
|
|
165
|
+
Error?: ((value: {
|
|
92
166
|
name: string;
|
|
93
|
-
|
|
167
|
+
message: string;
|
|
168
|
+
stack?: string;
|
|
169
|
+
cause?: unknown;
|
|
170
|
+
}) => any) | undefined;
|
|
171
|
+
EvalError?: ((value: {
|
|
172
|
+
message: string;
|
|
173
|
+
stack?: string;
|
|
174
|
+
cause?: unknown;
|
|
175
|
+
}) => any) | undefined;
|
|
176
|
+
Headers?: ((value: [string, string][]) => any) | undefined;
|
|
177
|
+
HookConflictError?: ((value: {
|
|
178
|
+
message: string;
|
|
179
|
+
stack?: string;
|
|
180
|
+
cause?: unknown;
|
|
181
|
+
token: string;
|
|
182
|
+
conflictingRunId?: string;
|
|
183
|
+
}) => any) | undefined;
|
|
184
|
+
Int8Array?: ((value: string) => any) | undefined;
|
|
185
|
+
Int16Array?: ((value: string) => any) | undefined;
|
|
186
|
+
Int32Array?: ((value: string) => any) | undefined;
|
|
187
|
+
Map?: ((value: [any, any][]) => any) | undefined;
|
|
188
|
+
RangeError?: ((value: {
|
|
189
|
+
message: string;
|
|
190
|
+
stack?: string;
|
|
191
|
+
cause?: unknown;
|
|
192
|
+
}) => any) | undefined;
|
|
193
|
+
ReadableStream?: ((value: {
|
|
194
|
+
name: string;
|
|
195
|
+
type?: "bytes";
|
|
94
196
|
startIndex?: number;
|
|
197
|
+
framing?: ByteStreamFraming;
|
|
95
198
|
} | {
|
|
96
199
|
bodyInit: any;
|
|
97
|
-
};
|
|
98
|
-
|
|
200
|
+
}) => any) | undefined;
|
|
201
|
+
ReferenceError?: ((value: {
|
|
202
|
+
message: string;
|
|
203
|
+
stack?: string;
|
|
204
|
+
cause?: unknown;
|
|
205
|
+
}) => any) | undefined;
|
|
206
|
+
RegExp?: ((value: {
|
|
99
207
|
source: string;
|
|
100
208
|
flags: string;
|
|
101
|
-
};
|
|
102
|
-
|
|
209
|
+
}) => any) | undefined;
|
|
210
|
+
RetryableError?: ((value: {
|
|
211
|
+
message: string;
|
|
212
|
+
stack?: string;
|
|
213
|
+
cause?: unknown;
|
|
214
|
+
retryAfter: number;
|
|
215
|
+
}) => any) | undefined;
|
|
216
|
+
RuntimeDecryptionError?: ((value: {
|
|
217
|
+
message: string;
|
|
218
|
+
stack?: string;
|
|
219
|
+
cause?: unknown;
|
|
220
|
+
context?: import("@workflow/errors").RuntimeDecryptionErrorContext;
|
|
221
|
+
}) => any) | undefined;
|
|
222
|
+
Request?: ((value: {
|
|
103
223
|
method: string;
|
|
104
224
|
url: string;
|
|
105
225
|
headers: Headers;
|
|
106
|
-
body: Request[
|
|
107
|
-
duplex: Request[
|
|
226
|
+
body: Request["body"];
|
|
227
|
+
duplex: Request["duplex"];
|
|
108
228
|
responseWritable?: WritableStream<Response>;
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
229
|
+
signal?: AbortSignal;
|
|
230
|
+
}) => any) | undefined;
|
|
231
|
+
Response?: ((value: {
|
|
232
|
+
type: Response["type"];
|
|
112
233
|
url: string;
|
|
113
234
|
status: number;
|
|
114
235
|
statusText: string;
|
|
115
236
|
headers: Headers;
|
|
116
|
-
body: Response[
|
|
237
|
+
body: Response["body"];
|
|
117
238
|
redirected: boolean;
|
|
118
|
-
};
|
|
119
|
-
Class: {
|
|
239
|
+
}) => any) | undefined;
|
|
240
|
+
Class?: ((value: {
|
|
120
241
|
classId: string;
|
|
121
|
-
};
|
|
122
|
-
|
|
123
|
-
* Custom serialized class instance.
|
|
124
|
-
* The class must have a `classId` property and be registered for deserialization.
|
|
125
|
-
*/
|
|
126
|
-
Instance: {
|
|
242
|
+
}) => any) | undefined;
|
|
243
|
+
Instance?: ((value: {
|
|
127
244
|
classId: string;
|
|
128
245
|
data: unknown;
|
|
129
|
-
};
|
|
130
|
-
Set: any[];
|
|
131
|
-
|
|
246
|
+
}) => any) | undefined;
|
|
247
|
+
Set?: ((value: any[]) => any) | undefined;
|
|
248
|
+
SyntaxError?: ((value: {
|
|
249
|
+
message: string;
|
|
250
|
+
stack?: string;
|
|
251
|
+
cause?: unknown;
|
|
252
|
+
}) => any) | undefined;
|
|
253
|
+
StepFunction?: ((value: {
|
|
132
254
|
stepId: string;
|
|
133
255
|
closureVars?: Record<string, any>;
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
256
|
+
boundThis?: unknown;
|
|
257
|
+
boundArgs?: unknown[];
|
|
258
|
+
}) => any) | undefined;
|
|
259
|
+
TypeError?: ((value: {
|
|
260
|
+
message: string;
|
|
261
|
+
stack?: string;
|
|
262
|
+
cause?: unknown;
|
|
263
|
+
}) => any) | undefined;
|
|
264
|
+
URIError?: ((value: {
|
|
265
|
+
message: string;
|
|
266
|
+
stack?: string;
|
|
267
|
+
cause?: unknown;
|
|
268
|
+
}) => any) | undefined;
|
|
269
|
+
URL?: ((value: string) => any) | undefined;
|
|
270
|
+
WorkflowFunction?: ((value: {
|
|
137
271
|
workflowId: string;
|
|
138
|
-
};
|
|
139
|
-
URLSearchParams: string;
|
|
140
|
-
Uint8Array: string;
|
|
141
|
-
Uint8ClampedArray: string;
|
|
142
|
-
Uint16Array: string;
|
|
143
|
-
Uint32Array: string;
|
|
144
|
-
|
|
145
|
-
name: string;
|
|
146
|
-
};
|
|
147
|
-
}
|
|
148
|
-
type Reducers = {
|
|
149
|
-
[K in keyof SerializableSpecial]: (value: any) => SerializableSpecial[K] | false;
|
|
150
|
-
};
|
|
151
|
-
type Revivers = {
|
|
152
|
-
[K in keyof SerializableSpecial]: (value: SerializableSpecial[K]) => any;
|
|
153
|
-
};
|
|
154
|
-
/**
|
|
155
|
-
* Reducers for serialization boundary from the client side, passing arguments
|
|
156
|
-
* to the workflow handler.
|
|
157
|
-
*
|
|
158
|
-
* @param global
|
|
159
|
-
* @param ops
|
|
160
|
-
* @returns
|
|
161
|
-
*/
|
|
162
|
-
export declare function getExternalReducers(global: Record<string, any> | undefined, ops: Promise<void>[], runId: string, cryptoKey: EncryptionKeyParam): Reducers;
|
|
163
|
-
/**
|
|
164
|
-
* Reducers for serialization boundary from within the workflow execution
|
|
165
|
-
* environment, passing return value to the client side and into step arguments.
|
|
166
|
-
*
|
|
167
|
-
* @param global
|
|
168
|
-
* @returns
|
|
169
|
-
*/
|
|
170
|
-
export declare function getWorkflowReducers(global?: Record<string, any>): Reducers;
|
|
171
|
-
export declare function getCommonRevivers(global?: Record<string, any>): {
|
|
172
|
-
readonly ArrayBuffer: (value: string) => any;
|
|
173
|
-
readonly BigInt: (value: string) => any;
|
|
174
|
-
readonly BigInt64Array: (value: string) => any;
|
|
175
|
-
readonly BigUint64Array: (value: string) => any;
|
|
176
|
-
readonly Date: (value: string) => any;
|
|
177
|
-
readonly DOMException: (value: {
|
|
272
|
+
}) => any) | undefined;
|
|
273
|
+
URLSearchParams?: ((value: string) => any) | undefined;
|
|
274
|
+
Uint8Array?: ((value: string) => any) | undefined;
|
|
275
|
+
Uint8ClampedArray?: ((value: string) => any) | undefined;
|
|
276
|
+
Uint16Array?: ((value: string) => any) | undefined;
|
|
277
|
+
Uint32Array?: ((value: string) => any) | undefined;
|
|
278
|
+
AggregateError?: ((value: {
|
|
178
279
|
message: string;
|
|
179
|
-
name: string;
|
|
180
280
|
stack?: string;
|
|
181
281
|
cause?: unknown;
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
}) => any;
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
}) => any;
|
|
202
|
-
readonly Set: (value: any[]) => any;
|
|
203
|
-
readonly URL: (value: string) => any;
|
|
204
|
-
readonly URLSearchParams: (value: string) => any;
|
|
205
|
-
readonly Uint8Array: (value: string) => any;
|
|
206
|
-
readonly Uint8ClampedArray: (value: string) => any;
|
|
207
|
-
readonly Uint16Array: (value: string) => any;
|
|
208
|
-
readonly Uint32Array: (value: string) => any;
|
|
282
|
+
errors: unknown[];
|
|
283
|
+
}) => any) | undefined;
|
|
284
|
+
WritableStream?: ((value: {
|
|
285
|
+
name: string;
|
|
286
|
+
runId?: string;
|
|
287
|
+
deploymentId?: string;
|
|
288
|
+
}) => any) | undefined;
|
|
289
|
+
AbortController?: ((value: {
|
|
290
|
+
streamName: string;
|
|
291
|
+
hookToken: string;
|
|
292
|
+
aborted: boolean;
|
|
293
|
+
reason?: unknown;
|
|
294
|
+
}) => any) | undefined;
|
|
295
|
+
AbortSignal?: ((value: {
|
|
296
|
+
streamName: string;
|
|
297
|
+
hookToken: string;
|
|
298
|
+
aborted: boolean;
|
|
299
|
+
reason?: unknown;
|
|
300
|
+
}) => any) | undefined;
|
|
209
301
|
};
|
|
210
302
|
/**
|
|
211
303
|
* Revivers for deserialization boundary from the client side,
|
|
@@ -215,7 +307,7 @@ export declare function getCommonRevivers(global?: Record<string, any>): {
|
|
|
215
307
|
* @param ops
|
|
216
308
|
* @param runId
|
|
217
309
|
*/
|
|
218
|
-
export declare function getExternalRevivers(global: Record<string, any> | undefined, ops: Promise<void>[], runId: string, cryptoKey: EncryptionKeyParam): Revivers
|
|
310
|
+
export declare function getExternalRevivers(global: Record<string, any> | undefined, ops: Promise<void>[], runId: string, cryptoKey: EncryptionKeyParam): Partial<Revivers>;
|
|
219
311
|
/**
|
|
220
312
|
* Revivers for deserialization boundary from within the workflow execution
|
|
221
313
|
* environment, receiving arguments from the client side, and return values
|
|
@@ -224,27 +316,18 @@ export declare function getExternalRevivers(global: Record<string, any> | undefi
|
|
|
224
316
|
* @param global
|
|
225
317
|
* @returns
|
|
226
318
|
*/
|
|
227
|
-
export declare function getWorkflowRevivers(global?: Record<string, any>): Revivers
|
|
319
|
+
export declare function getWorkflowRevivers(global?: Record<string, any>): Partial<Revivers>;
|
|
228
320
|
/**
|
|
229
321
|
* Encrypt data if the world supports encryption.
|
|
230
322
|
* Returns original data if encryption is not available.
|
|
231
323
|
*
|
|
232
|
-
* @
|
|
233
|
-
* @param key - Encryption key (undefined to skip encryption)
|
|
234
|
-
* @param context - Encryption context with runId
|
|
235
|
-
* @returns Encrypted data if encryption available, original data otherwise
|
|
324
|
+
* @deprecated Use `encrypt` from `./serialization/encryption.js` instead.
|
|
236
325
|
*/
|
|
237
326
|
export declare function maybeEncrypt(data: Uint8Array, key: CryptoKey | undefined): Promise<Uint8Array>;
|
|
238
327
|
/**
|
|
239
328
|
* Decrypt data if it has the 'encr' prefix.
|
|
240
329
|
*
|
|
241
|
-
* @
|
|
242
|
-
* @param key - Encryption key (undefined if no key available)
|
|
243
|
-
* @returns Decrypted data if encrypted, original data otherwise
|
|
244
|
-
* @throws {WorkflowRuntimeError} If the data is encrypted but no key is
|
|
245
|
-
* available. Callers (e.g., `Run.pollReturnValue()`, `hydrateStepReturnValue`)
|
|
246
|
-
* should be aware this can surface as a rejected promise during key rotation
|
|
247
|
-
* or misconfiguration scenarios.
|
|
330
|
+
* @deprecated Use `decrypt` from `./serialization/encryption.js` instead.
|
|
248
331
|
*/
|
|
249
332
|
export declare function maybeDecrypt(data: Uint8Array | unknown, key: CryptoKey | undefined): Promise<Uint8Array | unknown>;
|
|
250
333
|
/**
|
|
@@ -258,61 +341,100 @@ export declare function maybeDecrypt(data: Uint8Array | unknown, key: CryptoKey
|
|
|
258
341
|
* @param ops - Promise array for stream operations
|
|
259
342
|
* @param global - Global object for serialization context
|
|
260
343
|
* @param v1Compat - Enable legacy v1 compatibility mode
|
|
344
|
+
* @param framedByteStreams - Whether the target run can decode wire-framed
|
|
345
|
+
* byte streams. Should match the target deployment's capability — see
|
|
346
|
+
* `getRunCapabilities` in `capabilities.ts`. Defaults to `false` for
|
|
347
|
+
* backwards compatibility with older runs.
|
|
261
348
|
* @returns The dehydrated value as binary data (Uint8Array) with format prefix
|
|
262
349
|
*/
|
|
263
|
-
export declare function dehydrateWorkflowArguments(value: unknown, runId: string, key: CryptoKey | undefined, ops?: Promise<void>[], global?: Record<string, any>, v1Compat?: boolean): Promise<Uint8Array | unknown>;
|
|
350
|
+
export declare function dehydrateWorkflowArguments(value: unknown, runId: string, key: CryptoKey | undefined, ops?: Promise<void>[], global?: Record<string, any>, v1Compat?: boolean, framedByteStreams?: boolean, compression?: boolean): Promise<Uint8Array | unknown>;
|
|
264
351
|
/**
|
|
265
352
|
* Called from workflow execution environment to hydrate the workflow
|
|
266
353
|
* arguments from the database at the start of workflow execution.
|
|
267
|
-
*
|
|
268
|
-
* @param value - Binary serialized data (Uint8Array) with format prefix
|
|
269
|
-
* @param _runId - Workflow run ID (reserved for future decryption context; decryption is currently driven solely by the provided key)
|
|
270
|
-
* @param key - Encryption key (undefined to skip decryption)
|
|
271
|
-
* @param global - Global object for deserialization context
|
|
272
|
-
* @param extraRevivers - Additional revivers for custom types
|
|
273
|
-
* @returns The hydrated value
|
|
274
354
|
*/
|
|
275
355
|
export declare function hydrateWorkflowArguments(value: Uint8Array | unknown, _runId: string, key: CryptoKey | undefined, global?: Record<string, any>, extraRevivers?: Record<string, (value: any) => any>): Promise<any>;
|
|
276
356
|
/**
|
|
277
357
|
* Dehydrate workflow return value for storage.
|
|
358
|
+
*/
|
|
359
|
+
export declare function dehydrateWorkflowReturnValue(value: unknown, _runId: string, key: CryptoKey | undefined, global?: Record<string, any>, v1Compat?: boolean, compression?: boolean): Promise<Uint8Array | unknown>;
|
|
360
|
+
/**
|
|
361
|
+
* Called from the client side to hydrate the workflow return value
|
|
362
|
+
* of a completed workflow run.
|
|
363
|
+
*/
|
|
364
|
+
export declare function hydrateWorkflowReturnValue(value: Uint8Array | unknown, runId: string, key: CryptoKey | undefined, ops?: Promise<void>[], global?: Record<string, any>, extraRevivers?: Record<string, (value: any) => any>): Promise<any>;
|
|
365
|
+
/**
|
|
366
|
+
* Called from the workflow handler when a step is being created.
|
|
367
|
+
* Dehydrates values from within the workflow execution environment.
|
|
368
|
+
*/
|
|
369
|
+
export declare function dehydrateStepArguments(value: unknown, _runId: string, key: CryptoKey | undefined, global?: Record<string, any>, v1Compat?: boolean, compression?: boolean): Promise<Uint8Array | unknown>;
|
|
370
|
+
/**
|
|
371
|
+
* Called from the step handler to hydrate the arguments of a step
|
|
372
|
+
* from the database at the start of the step execution.
|
|
373
|
+
*/
|
|
374
|
+
export declare function hydrateStepArguments(value: Uint8Array | unknown, runId: string, key: CryptoKey | undefined, ops?: Promise<any>[], global?: Record<string, any>, extraRevivers?: Record<string, (value: any) => any>, deploymentId?: string): Promise<any>;
|
|
375
|
+
/**
|
|
376
|
+
* Called from the step handler when a step has completed.
|
|
377
|
+
* Dehydrates values from within the step execution environment
|
|
378
|
+
* into a format that can be saved to the database.
|
|
278
379
|
*
|
|
279
380
|
* @param value - The value to serialize
|
|
280
381
|
* @param runId - Run ID for encryption context
|
|
281
382
|
* @param key - Encryption key (undefined to skip encryption)
|
|
383
|
+
* @param ops - Promise array for stream operations
|
|
282
384
|
* @param global - Global object for serialization context
|
|
385
|
+
* @param v1Compat - Enable legacy v1 compatibility mode
|
|
386
|
+
* @param framedByteStreams - Whether the target run can decode wire-framed
|
|
387
|
+
* byte streams. Should match the target deployment's capability — see
|
|
388
|
+
* `getRunCapabilities` in `capabilities.ts`. Defaults to `false` for
|
|
389
|
+
* backwards compatibility with older runs.
|
|
283
390
|
* @returns The dehydrated value as binary data (Uint8Array) with format prefix
|
|
284
391
|
*/
|
|
285
|
-
export declare function
|
|
392
|
+
export declare function dehydrateStepReturnValue(value: unknown, runId: string, key: CryptoKey | undefined, ops?: Promise<any>[], global?: Record<string, any>, v1Compat?: boolean, framedByteStreams?: boolean, compression?: boolean, runReadyBarrier?: Promise<unknown>): Promise<Uint8Array | unknown>;
|
|
286
393
|
/**
|
|
287
|
-
* Called from the
|
|
288
|
-
* the
|
|
289
|
-
*
|
|
394
|
+
* Called from the step handler when a step throws. Dehydrates the thrown
|
|
395
|
+
* value from within the step execution environment into a format that can
|
|
396
|
+
* be saved to the database in a `step_failed` or `step_retrying` event.
|
|
397
|
+
*
|
|
398
|
+
* Any JavaScript value can be thrown (strings, numbers, objects, Errors,
|
|
399
|
+
* Error subclasses), so the same serialization pipeline used for step
|
|
400
|
+
* arguments and return values is applied here.
|
|
401
|
+
*
|
|
402
|
+
* @param value - The thrown value to serialize (can be any type)
|
|
403
|
+
* @param runId - Run ID for encryption context
|
|
404
|
+
* @param key - Encryption key (undefined to skip encryption)
|
|
405
|
+
* @param ops - Promise array for stream operations
|
|
406
|
+
* @param global - Global object for serialization context
|
|
407
|
+
* @returns The dehydrated value as binary data (Uint8Array) with format prefix
|
|
408
|
+
*/
|
|
409
|
+
export declare function dehydrateStepError(value: unknown, runId: string, key: CryptoKey | undefined, ops?: Promise<any>[], global?: Record<string, any>, compression?: boolean): Promise<Uint8Array>;
|
|
410
|
+
/**
|
|
411
|
+
* Called from the workflow handler when replaying the event log of a
|
|
412
|
+
* `step_failed` or `step_retrying` event. Hydrates the thrown value from
|
|
413
|
+
* the database so the workflow can see the original thrown value.
|
|
290
414
|
*
|
|
291
415
|
* @param value - Binary serialized data (Uint8Array) with format prefix
|
|
292
416
|
* @param runId - Run ID for decryption context
|
|
293
417
|
* @param key - Encryption key (undefined to skip decryption)
|
|
294
|
-
* @param ops - Promise array for stream operations
|
|
295
418
|
* @param global - Global object for deserialization context
|
|
296
419
|
* @param extraRevivers - Additional revivers for custom types
|
|
297
|
-
* @returns The hydrated
|
|
420
|
+
* @returns The hydrated thrown value, ready to reject the step promise
|
|
298
421
|
*/
|
|
299
|
-
export declare function
|
|
422
|
+
export declare function hydrateStepError(value: Uint8Array | unknown, _runId: string, key: CryptoKey | undefined, global?: Record<string, any>, extraRevivers?: Record<string, (value: any) => any>): Promise<unknown>;
|
|
300
423
|
/**
|
|
301
|
-
* Called from the workflow handler when
|
|
302
|
-
* Dehydrates
|
|
303
|
-
* into a format that can be saved to the database.
|
|
424
|
+
* Called from the workflow handler when the workflow itself throws.
|
|
425
|
+
* Dehydrates the thrown value from within the workflow execution environment
|
|
426
|
+
* into a format that can be saved to the database in a `run_failed` event.
|
|
304
427
|
*
|
|
305
|
-
* @param value - The value to serialize
|
|
428
|
+
* @param value - The thrown value to serialize (can be any type)
|
|
306
429
|
* @param runId - Run ID for encryption context
|
|
307
430
|
* @param key - Encryption key (undefined to skip encryption)
|
|
308
431
|
* @param global - Global object for serialization context
|
|
309
|
-
* @param v1Compat - Enable legacy v1 compatibility mode
|
|
310
432
|
* @returns The dehydrated value as binary data (Uint8Array) with format prefix
|
|
311
433
|
*/
|
|
312
|
-
export declare function
|
|
434
|
+
export declare function dehydrateRunError(value: unknown, _runId: string, key: CryptoKey | undefined, global?: Record<string, any>, compression?: boolean): Promise<Uint8Array>;
|
|
313
435
|
/**
|
|
314
|
-
* Called from the
|
|
315
|
-
*
|
|
436
|
+
* Called from the client side (or observability tools) to hydrate the run
|
|
437
|
+
* error value of a failed workflow run.
|
|
316
438
|
*
|
|
317
439
|
* @param value - Binary serialized data (Uint8Array) with format prefix
|
|
318
440
|
* @param runId - Run ID for decryption context
|
|
@@ -320,23 +442,9 @@ export declare function dehydrateStepArguments(value: unknown, _runId: string, k
|
|
|
320
442
|
* @param ops - Promise array for stream operations
|
|
321
443
|
* @param global - Global object for deserialization context
|
|
322
444
|
* @param extraRevivers - Additional revivers for custom types
|
|
323
|
-
* @returns The hydrated value, ready to be consumed by the
|
|
324
|
-
*/
|
|
325
|
-
export declare function hydrateStepArguments(value: Uint8Array | unknown, runId: string, key: CryptoKey | undefined, ops?: Promise<any>[], global?: Record<string, any>, extraRevivers?: Record<string, (value: any) => any>): Promise<any>;
|
|
326
|
-
/**
|
|
327
|
-
* Called from the step handler when a step has completed.
|
|
328
|
-
* Dehydrates values from within the step execution environment
|
|
329
|
-
* into a format that can be saved to the database.
|
|
330
|
-
*
|
|
331
|
-
* @param value - The value to serialize
|
|
332
|
-
* @param runId - Run ID for encryption context
|
|
333
|
-
* @param key - Encryption key (undefined to skip encryption)
|
|
334
|
-
* @param ops - Promise array for stream operations
|
|
335
|
-
* @param global - Global object for serialization context
|
|
336
|
-
* @param v1Compat - Enable legacy v1 compatibility mode
|
|
337
|
-
* @returns The dehydrated value as binary data (Uint8Array) with format prefix
|
|
445
|
+
* @returns The hydrated thrown value, ready to be consumed by the client
|
|
338
446
|
*/
|
|
339
|
-
export declare function
|
|
447
|
+
export declare function hydrateRunError(value: Uint8Array | unknown, runId: string, key: CryptoKey | undefined, ops?: Promise<void>[], global?: Record<string, any>, extraRevivers?: Record<string, (value: any) => any>): Promise<unknown>;
|
|
340
448
|
/**
|
|
341
449
|
* Called from the workflow handler when replaying the event log of a `step_completed` event.
|
|
342
450
|
* Hydrates the return value of a step from the database.
|
|
@@ -346,8 +454,8 @@ export declare function dehydrateStepReturnValue(value: unknown, runId: string,
|
|
|
346
454
|
* @param key - Encryption key (undefined to skip decryption)
|
|
347
455
|
* @param global - Global object for deserialization context
|
|
348
456
|
* @param extraRevivers - Additional revivers for custom types
|
|
349
|
-
*
|
|
457
|
+
* Called from the workflow handler when replaying the event log
|
|
458
|
+
* of a `step_completed` event.
|
|
350
459
|
*/
|
|
351
460
|
export declare function hydrateStepReturnValue(value: Uint8Array | unknown, _runId: string, key: CryptoKey | undefined, global?: Record<string, any>, extraRevivers?: Record<string, (value: any) => any>): Promise<any>;
|
|
352
|
-
export {};
|
|
353
461
|
//# sourceMappingURL=serialization.d.ts.map
|