@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
package/dist/serialization.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
import {
|
|
1
|
+
import { createFlushableState, type FlushableStreamState } from './flushable-stream.js';
|
|
2
|
+
import { compress, decompress } from './serialization/compression.js';
|
|
3
|
+
import { aesKeyOf, decrypt, deriveRunPayloadKeys, type EncryptionKeyParam, encrypt, isRunPayloadKeys, isSealTarget, type PayloadKey, type RunPayloadKeys, runPayloadKeys, type SealTarget, sealTo } from './serialization/encryption.js';
|
|
3
4
|
import { decodeFormatPrefix, encodeWithFormatPrefix, isEncrypted, peekFormatPrefix } from './serialization/format.js';
|
|
5
|
+
import { type GuestCodeStats } from './serialization/hardened.js';
|
|
4
6
|
import { type FormatPrefix, isFormatPrefix, SerializationFormat } from './serialization/types.js';
|
|
5
|
-
export { SerializationFormat, type FormatPrefix, isFormatPrefix, encodeWithFormatPrefix, decodeFormatPrefix, peekFormatPrefix, isEncrypted, encrypt, decrypt, type EncryptionKeyParam, };
|
|
7
|
+
export { SerializationFormat, type FormatPrefix, isFormatPrefix, encodeWithFormatPrefix, decodeFormatPrefix, peekFormatPrefix, isEncrypted, encrypt, decrypt, compress, decompress, type EncryptionKeyParam, type PayloadKey, type RunPayloadKeys, type SealTarget, sealTo, runPayloadKeys, deriveRunPayloadKeys, isSealTarget, isRunPayloadKeys, aesKeyOf, };
|
|
6
8
|
export type SerializationFormatType = (typeof SerializationFormat)[keyof typeof SerializationFormat];
|
|
7
9
|
/**
|
|
8
10
|
* Detect if a readable stream is a byte stream.
|
|
@@ -13,31 +15,122 @@ export type SerializationFormatType = (typeof SerializationFormat)[keyof typeof
|
|
|
13
15
|
export declare function getStreamType(stream: ReadableStream): 'bytes' | undefined;
|
|
14
16
|
export declare function getSerializeStream(reducers: Partial<Reducers>, cryptoKey: EncryptionKeyParam): TransformStream<any, Uint8Array>;
|
|
15
17
|
export declare function getDeserializeStream(revivers: Partial<Revivers>, cryptoKey: EncryptionKeyParam): TransformStream<Uint8Array, any>;
|
|
18
|
+
/**
|
|
19
|
+
* Wraps each chunk of a byte stream in a 4-byte big-endian length
|
|
20
|
+
* prefix. Used by the producer side of a framed byte-stream pipe.
|
|
21
|
+
*
|
|
22
|
+
* Empty chunks (length 0) are dropped: the resulting `[0x00 0x00 0x00 0x00]`
|
|
23
|
+
* frame would be ambiguous with the legacy "looks framed" detection in
|
|
24
|
+
* `getDeserializeStream`, and it carries no information.
|
|
25
|
+
*
|
|
26
|
+
* Load-bearing invariant: each user chunk becomes exactly one frame, and
|
|
27
|
+
* each frame is enqueued as exactly one transport chunk (the downstream
|
|
28
|
+
* writable performs one wire write per chunk, preserving boundaries). The
|
|
29
|
+
* server therefore stores one frame per chunk index, which is what allows
|
|
30
|
+
* a future reconnecting reader to resume a framed byte stream at
|
|
31
|
+
* `startIndex + consumedFrames`, the same arithmetic
|
|
32
|
+
* `createReconnectingFramedStream` relies on for object streams. Do not
|
|
33
|
+
* coalesce or split frames here without revisiting that resume logic.
|
|
34
|
+
*/
|
|
35
|
+
export declare function getByteFramingStream(): TransformStream<Uint8Array, Uint8Array>;
|
|
36
|
+
/**
|
|
37
|
+
* Unwraps length-prefixed byte-stream frames back into the original user
|
|
38
|
+
* chunks. Used by the consumer side of a framed byte-stream pipe.
|
|
39
|
+
*
|
|
40
|
+
* Buffers across read boundaries, since the transport may split a single
|
|
41
|
+
* frame across multiple reads (header in one chunk, payload in another)
|
|
42
|
+
* or coalesce multiple frames into a single read. The transform emits
|
|
43
|
+
* whole user chunks regardless of transport chunking.
|
|
44
|
+
*
|
|
45
|
+
* Errors the stream if the length header advertises a frame larger than
|
|
46
|
+
* `MAX_FRAME_SIZE` bytes, since that almost certainly indicates a
|
|
47
|
+
* misframed wire (e.g. a raw byte stream being fed through this transform
|
|
48
|
+
* by mistake) and we don't want to allocate an enormous buffer.
|
|
49
|
+
*/
|
|
50
|
+
export declare function getByteUnframingStream(): TransformStream<Uint8Array, Uint8Array>;
|
|
16
51
|
export declare class WorkflowServerReadableStream extends ReadableStream<Uint8Array> {
|
|
17
52
|
#private;
|
|
18
53
|
constructor(runId: string, name: string, startIndex?: number);
|
|
19
54
|
}
|
|
55
|
+
/**
|
|
56
|
+
* Maximum consecutive reconnect attempts for a single framed stream session.
|
|
57
|
+
* The counter resets to zero whenever a reconnect makes forward progress (a
|
|
58
|
+
* frame is delivered), so this bounds *consecutive* failures, not the lifetime
|
|
59
|
+
* total: a long-lived serverless stream may legitimately reconnect far more
|
|
60
|
+
* than this many times as long as each reconnect keeps delivering data. We only
|
|
61
|
+
* give up after this many reconnects in a row produce nothing.
|
|
62
|
+
*/
|
|
63
|
+
export declare const FRAMED_STREAM_MAX_RECONNECTS = 50;
|
|
64
|
+
/**
|
|
65
|
+
* Absolute backstop on total reconnects for a single session, independent of
|
|
66
|
+
* progress. The consecutive cap above resets on forward progress, which is
|
|
67
|
+
* correct for a well-behaved backend that honors `startIndex`. But if a World's
|
|
68
|
+
* `streams.get` ever ignored `startIndex` and re-delivered earlier chunks,
|
|
69
|
+
* "progress" would be reported every reconnect and the consecutive cap would
|
|
70
|
+
* never trip, turning a bounded failure into an unbounded reconnect loop. This
|
|
71
|
+
* hard ceiling guarantees the loop always terminates. It is set high enough
|
|
72
|
+
* (hours of streaming at realistic per-session timeouts) to never interfere
|
|
73
|
+
* with legitimate long-lived streams.
|
|
74
|
+
*/
|
|
75
|
+
export declare const FRAMED_STREAM_MAX_TOTAL_RECONNECTS = 1000;
|
|
76
|
+
/**
|
|
77
|
+
* Wraps the length-prefix-framed byte stream from `world.streams.get` with
|
|
78
|
+
* transparent auto-reconnect.
|
|
79
|
+
*
|
|
80
|
+
* Every fully-decoded outer frame corresponds to exactly one server-side
|
|
81
|
+
* chunk (the serialize transform enqueues one frame per workflow write, and
|
|
82
|
+
* the writable buffers one frame per chunk when multi-writing). The wrapper
|
|
83
|
+
* counts completed frames and, on upstream error, reopens the connection
|
|
84
|
+
* with `startIndex = resolvedStartIndex + consumedFrames`. Partial-frame
|
|
85
|
+
* bytes buffered before the cut are discarded; the server will resend the
|
|
86
|
+
* in-flight chunk in full from the new startIndex.
|
|
87
|
+
*
|
|
88
|
+
* A clean upstream close (EOF with no error) is NOT trusted as completion
|
|
89
|
+
* on its own: some transport paths normalize a mid-stream abort into a
|
|
90
|
+
* graceful end (observed in production on Vercel response streaming, where
|
|
91
|
+
* the server's max-duration abort arrives at the client as a clean EOF).
|
|
92
|
+
* On EOF the wrapper verifies against the stream's authoritative metadata
|
|
93
|
+
* (`streams.getInfo`) that the stream is complete AND that every chunk up to
|
|
94
|
+
* `done` was delivered; otherwise it reconnects from the next chunk exactly
|
|
95
|
+
* like an errored connection. If the metadata read itself fails, the EOF is
|
|
96
|
+
* trusted (legacy behavior) rather than failing a read that may well be
|
|
97
|
+
* complete.
|
|
98
|
+
*
|
|
99
|
+
* Negative `startIndex` values (last-N semantics) skip the reconnect
|
|
100
|
+
* machinery because we cannot compute an absolute resume position without
|
|
101
|
+
* a tail-index lookup; the returned stream behaves as a single-shot read.
|
|
102
|
+
*/
|
|
103
|
+
export declare function createReconnectingFramedStream(runId: string, name: string, startIndex?: number, prefetchEncryptionKey?: () => Promise<PayloadKey | undefined>): ReadableStream<Uint8Array>;
|
|
20
104
|
export declare class WorkflowServerWritableStream extends WritableStream<Uint8Array> {
|
|
21
|
-
|
|
105
|
+
/**
|
|
106
|
+
* @param runReadyBarrier Turbo mode only: a promise that resolves once the
|
|
107
|
+
* backgrounded `run_started` has landed. When the step body runs
|
|
108
|
+
* optimistically (before `run_started` is durable), the first chunk write to
|
|
109
|
+
* a brand-new stream would otherwise reach the World before the run exists
|
|
110
|
+
* and be rejected as run-not-found. Awaiting this once before the first
|
|
111
|
+
* flush/close orders the write after the run's creation. `undefined` outside
|
|
112
|
+
* turbo and on the await path, where the run was already durable.
|
|
113
|
+
*/
|
|
114
|
+
constructor(runId: string, name: string, runReadyBarrier?: Promise<unknown>);
|
|
22
115
|
}
|
|
23
|
-
export type { Reducers, Revivers, SerializableSpecial, } from './serialization/types.js';
|
|
24
|
-
import type { Reducers, Revivers } from './serialization/types.js';
|
|
116
|
+
export type { ByteStreamFraming, Reducers, Revivers, SerializableSpecial, } from './serialization/types.js';
|
|
117
|
+
import type { ByteStreamFraming, Reducers, Revivers } from './serialization/types.js';
|
|
25
118
|
/**
|
|
26
119
|
* Reducers for serialization boundary from the client side, passing arguments
|
|
27
120
|
* to the workflow handler.
|
|
28
121
|
*
|
|
29
122
|
* @param global
|
|
30
123
|
* @param ops
|
|
124
|
+
* @param runId
|
|
125
|
+
* @param cryptoKey
|
|
126
|
+
* @param framedByteStreams - When `true`, byte streams (`type: 'bytes'`)
|
|
127
|
+
* are wrapped in length-prefixed frames on the wire so the consumer
|
|
128
|
+
* can reconnect on transient errors. Should match the target run's
|
|
129
|
+
* capability: see `getRunCapabilities` in `capabilities.ts`. Defaults
|
|
130
|
+
* to `false` for backwards compatibility with older runs.
|
|
31
131
|
* @returns
|
|
32
132
|
*/
|
|
33
|
-
export declare function getExternalReducers(global: Record<string, any> | undefined, ops: Promise<void>[], runId: string, cryptoKey: EncryptionKeyParam): Partial<Reducers>;
|
|
34
|
-
/**
|
|
35
|
-
* Reducers for serialization boundary from within the workflow execution
|
|
36
|
-
* environment, passing return value to the client side and into step arguments.
|
|
37
|
-
*
|
|
38
|
-
* @param global
|
|
39
|
-
* @returns
|
|
40
|
-
*/
|
|
133
|
+
export declare function getExternalReducers(global: Record<string, any> | undefined, ops: Promise<void>[], runId: string, cryptoKey: EncryptionKeyParam, framedByteStreams?: boolean, runReadyBarrier?: Promise<unknown>, readbackOps?: Promise<void>[]): Partial<Reducers>;
|
|
41
134
|
export declare function getWorkflowReducers(global?: Record<string, any>): Partial<Reducers>;
|
|
42
135
|
/**
|
|
43
136
|
* Cancel dangling abort-stream readers on any AbortController instances found
|
|
@@ -83,6 +176,13 @@ export declare function getCommonRevivers(global?: Record<string, any>): {
|
|
|
83
176
|
cause?: unknown;
|
|
84
177
|
}) => any) | undefined;
|
|
85
178
|
Headers?: ((value: [string, string][]) => any) | undefined;
|
|
179
|
+
HookConflictError?: ((value: {
|
|
180
|
+
message: string;
|
|
181
|
+
stack?: string;
|
|
182
|
+
cause?: unknown;
|
|
183
|
+
token: string;
|
|
184
|
+
conflictingRunId?: string;
|
|
185
|
+
}) => any) | undefined;
|
|
86
186
|
Int8Array?: ((value: string) => any) | undefined;
|
|
87
187
|
Int16Array?: ((value: string) => any) | undefined;
|
|
88
188
|
Int32Array?: ((value: string) => any) | undefined;
|
|
@@ -96,6 +196,7 @@ export declare function getCommonRevivers(global?: Record<string, any>): {
|
|
|
96
196
|
name: string;
|
|
97
197
|
type?: "bytes";
|
|
98
198
|
startIndex?: number;
|
|
199
|
+
framing?: ByteStreamFraming;
|
|
99
200
|
} | {
|
|
100
201
|
bodyInit: any;
|
|
101
202
|
}) => any) | undefined;
|
|
@@ -114,6 +215,19 @@ export declare function getCommonRevivers(global?: Record<string, any>): {
|
|
|
114
215
|
cause?: unknown;
|
|
115
216
|
retryAfter: number;
|
|
116
217
|
}) => any) | undefined;
|
|
218
|
+
RuntimeDecryptionError?: ((value: {
|
|
219
|
+
message: string;
|
|
220
|
+
stack?: string;
|
|
221
|
+
cause?: unknown;
|
|
222
|
+
context?: import("@workflow/errors").RuntimeDecryptionErrorContext;
|
|
223
|
+
}) => any) | undefined;
|
|
224
|
+
StreamError?: ((value: {
|
|
225
|
+
message: string;
|
|
226
|
+
stack?: string;
|
|
227
|
+
cause?: unknown;
|
|
228
|
+
status?: number;
|
|
229
|
+
url?: string;
|
|
230
|
+
}) => any) | undefined;
|
|
117
231
|
Request?: ((value: {
|
|
118
232
|
method: string;
|
|
119
233
|
url: string;
|
|
@@ -178,6 +292,9 @@ export declare function getCommonRevivers(global?: Record<string, any>): {
|
|
|
178
292
|
}) => any) | undefined;
|
|
179
293
|
WritableStream?: ((value: {
|
|
180
294
|
name: string;
|
|
295
|
+
runId?: string;
|
|
296
|
+
deploymentId?: string;
|
|
297
|
+
encryptionPublicKey?: string;
|
|
181
298
|
}) => any) | undefined;
|
|
182
299
|
AbortController?: ((value: {
|
|
183
300
|
streamName: string;
|
|
@@ -192,6 +309,42 @@ export declare function getCommonRevivers(global?: Record<string, any>): {
|
|
|
192
309
|
reason?: unknown;
|
|
193
310
|
}) => any) | undefined;
|
|
194
311
|
};
|
|
312
|
+
/**
|
|
313
|
+
* Resolves the owner's encryption key, preferring its public key, then its
|
|
314
|
+
* deployment, and finally its run record.
|
|
315
|
+
* @internal
|
|
316
|
+
*/
|
|
317
|
+
export declare function getForwardedWritableEncryptionKey(runId: string, deploymentId: string | undefined, encryptionPublicKey: string | undefined): Promise<PayloadKey | undefined>;
|
|
318
|
+
/** Tags a forwarded writable with its owner's metadata. @internal */
|
|
319
|
+
export declare function tagForwardedWritableTarget(writable: WritableStream, { deploymentId, encryptionPublicKey, }: {
|
|
320
|
+
deploymentId?: string;
|
|
321
|
+
encryptionPublicKey?: string;
|
|
322
|
+
}): void;
|
|
323
|
+
/** Creates and tags a forwarded writable targeting the owner run. @internal */
|
|
324
|
+
export declare function createForwardedWritable<W = any>({ global, ops, runId, name, key, deploymentId, encryptionPublicKey, runReadyBarrier, }: {
|
|
325
|
+
global: Record<string, any>;
|
|
326
|
+
ops: Promise<any>[];
|
|
327
|
+
runId: string;
|
|
328
|
+
name: string;
|
|
329
|
+
key: EncryptionKeyParam;
|
|
330
|
+
deploymentId?: string;
|
|
331
|
+
encryptionPublicKey?: string;
|
|
332
|
+
runReadyBarrier?: Promise<unknown>;
|
|
333
|
+
}): WritableStream<W>;
|
|
334
|
+
/**
|
|
335
|
+
* Create a run's object readable without dispatching its stream GET or
|
|
336
|
+
* encryption-key lookup until the caller reads it. The external reviver starts
|
|
337
|
+
* its background pipe immediately, so this boundary belongs here—next to the
|
|
338
|
+
* source/transform assembly—rather than in `Run`.
|
|
339
|
+
*
|
|
340
|
+
* @internal
|
|
341
|
+
*/
|
|
342
|
+
export declare function getRunReadableStream<T>(global: Record<string, any>, ops: Promise<void>[], runId: string, name: string, startIndex: number | undefined, cryptoKey: EncryptionKeyParam): ReadableStream<T>;
|
|
343
|
+
/** Options for externally revived object streams. @internal */
|
|
344
|
+
type ExternalReviverOptions = {
|
|
345
|
+
/** Receives completion state when a wrapper owns the public readable. */
|
|
346
|
+
onReadableState?: (state: ReturnType<typeof createFlushableState>) => void;
|
|
347
|
+
};
|
|
195
348
|
/**
|
|
196
349
|
* Revivers for deserialization boundary from the client side,
|
|
197
350
|
* receiving the return value from the workflow handler.
|
|
@@ -200,7 +353,7 @@ export declare function getCommonRevivers(global?: Record<string, any>): {
|
|
|
200
353
|
* @param ops
|
|
201
354
|
* @param runId
|
|
202
355
|
*/
|
|
203
|
-
export declare function getExternalRevivers(global: Record<string, any> | undefined, ops: Promise<void>[], runId: string, cryptoKey: EncryptionKeyParam): Partial<Revivers>;
|
|
356
|
+
export declare function getExternalRevivers(global: Record<string, any> | undefined, ops: Promise<void>[], runId: string, cryptoKey: EncryptionKeyParam, options?: ExternalReviverOptions): Partial<Revivers>;
|
|
204
357
|
/**
|
|
205
358
|
* Revivers for deserialization boundary from within the workflow execution
|
|
206
359
|
* environment, receiving arguments from the client side, and return values
|
|
@@ -216,50 +369,123 @@ export declare function getWorkflowRevivers(global?: Record<string, any>): Parti
|
|
|
216
369
|
*
|
|
217
370
|
* @deprecated Use `encrypt` from `./serialization/encryption.js` instead.
|
|
218
371
|
*/
|
|
219
|
-
export declare function maybeEncrypt(data: Uint8Array, key:
|
|
372
|
+
export declare function maybeEncrypt(data: Uint8Array, key: PayloadKey | undefined): Promise<Uint8Array>;
|
|
220
373
|
/**
|
|
221
374
|
* Decrypt data if it has the 'encr' prefix.
|
|
222
375
|
*
|
|
223
376
|
* @deprecated Use `decrypt` from `./serialization/encryption.js` instead.
|
|
224
377
|
*/
|
|
225
|
-
export declare function maybeDecrypt(data: Uint8Array | unknown, key:
|
|
378
|
+
export declare function maybeDecrypt(data: Uint8Array | unknown, key: PayloadKey | undefined): Promise<Uint8Array | unknown>;
|
|
379
|
+
/**
|
|
380
|
+
* Replay hydration has two stages:
|
|
381
|
+
*
|
|
382
|
+
* 1. Host-side preparation decrypts and decompresses persisted data. That work
|
|
383
|
+
* is independent of a workflow VM and can be cached across replay VMs.
|
|
384
|
+
* 2. Deserialization revives the prepared representation against the current
|
|
385
|
+
* VM's globals. It must run again for every VM to produce fresh object graphs
|
|
386
|
+
* and correctly scoped Workflow objects.
|
|
387
|
+
*
|
|
388
|
+
* `data` is the boundary between those stages. For current-format payloads it
|
|
389
|
+
* is still format-prefixed serialized bytes, not a live JavaScript value.
|
|
390
|
+
*/
|
|
391
|
+
export interface PreparedReplayPayload {
|
|
392
|
+
readonly data: unknown;
|
|
393
|
+
}
|
|
394
|
+
/**
|
|
395
|
+
* Swappable implementation of the host-side preparation stage. Supporting
|
|
396
|
+
* both direct and promised results lets a future synchronous Node decryptor use
|
|
397
|
+
* the same cache contract as today's asynchronous Web Crypto implementation.
|
|
398
|
+
*/
|
|
399
|
+
export type ReplayPayloadPreparer = (value: unknown, key: PayloadKey | undefined) => PreparedReplayPayload | Promise<PreparedReplayPayload>;
|
|
400
|
+
/**
|
|
401
|
+
* Decrypt and decompress persisted data without parsing it into JavaScript.
|
|
402
|
+
* Legacy non-binary values pass through unchanged for their consumer to revive.
|
|
403
|
+
*/
|
|
404
|
+
export declare const prepareReplayPayload: ReplayPayloadPreparer;
|
|
405
|
+
/**
|
|
406
|
+
* Parse a prepared workflow argument or successful step/hook payload using the
|
|
407
|
+
* current workflow VM's globals and revivers. Each call intentionally creates
|
|
408
|
+
* a fresh object graph so mutations cannot leak across replay iterations.
|
|
409
|
+
*/
|
|
410
|
+
export declare function deserializePreparedReplayPayload(prepared: PreparedReplayPayload, global?: Record<string, any>, extraRevivers?: Record<string, (value: any) => any>): any;
|
|
411
|
+
/**
|
|
412
|
+
* Parse a prepared step error using the current workflow VM's class revivers.
|
|
413
|
+
* This preserves thrown-value identity without sharing objects between VMs.
|
|
414
|
+
*/
|
|
415
|
+
export declare function deserializePreparedStepError(prepared: PreparedReplayPayload, global?: Record<string, any>, extraRevivers?: Record<string, (value: any) => any>): unknown;
|
|
226
416
|
/**
|
|
227
417
|
* Called from the `start()` function to serialize the workflow arguments
|
|
228
418
|
* into a format that can be saved to the database and then hydrated from
|
|
229
419
|
* within the workflow execution environment.
|
|
420
|
+
*
|
|
421
|
+
* @param value - The value to serialize
|
|
422
|
+
* @param runId - The workflow run ID (required for encryption context)
|
|
423
|
+
* @param key - Encryption key (undefined to skip encryption)
|
|
424
|
+
* @param ops - Promise array for stream operations
|
|
425
|
+
* @param global - Global object for serialization context
|
|
426
|
+
* @param v1Compat - Enable legacy v1 compatibility mode
|
|
427
|
+
* @param framedByteStreams - Whether the target run can decode wire-framed
|
|
428
|
+
* byte streams. Should match the target deployment's capability: see
|
|
429
|
+
* `getRunCapabilities` in `capabilities.ts`. Defaults to `false` for
|
|
430
|
+
* backwards compatibility with older runs.
|
|
431
|
+
* @returns The dehydrated value as binary data (Uint8Array) with format prefix
|
|
230
432
|
*/
|
|
231
|
-
export declare function dehydrateWorkflowArguments(value: unknown, runId: string, key:
|
|
433
|
+
export declare function dehydrateWorkflowArguments(value: unknown, runId: string, key: PayloadKey | undefined, ops?: Promise<void>[], global?: Record<string, any>, v1Compat?: boolean, framedByteStreams?: boolean, compression?: boolean, readbackOps?: Promise<void>[]): Promise<Uint8Array | unknown>;
|
|
232
434
|
/**
|
|
233
435
|
* Called from workflow execution environment to hydrate the workflow
|
|
234
|
-
* arguments from the database at the start of workflow execution.
|
|
436
|
+
* arguments from the database at the start of workflow execution. A prepared
|
|
437
|
+
* payload skips host-side decrypt/decompress but always performs VM revival.
|
|
235
438
|
*/
|
|
236
|
-
export declare function hydrateWorkflowArguments(value: Uint8Array | unknown, _runId: string, key:
|
|
439
|
+
export declare function hydrateWorkflowArguments(value: Uint8Array | unknown, _runId: string, key: PayloadKey | undefined, global?: Record<string, any>, extraRevivers?: Record<string, (value: any) => any>, prepared?: PreparedReplayPayload): Promise<any>;
|
|
237
440
|
/**
|
|
238
441
|
* Dehydrate workflow return value for storage.
|
|
239
442
|
*/
|
|
240
|
-
export declare function dehydrateWorkflowReturnValue(value: unknown, _runId: string, key:
|
|
443
|
+
export declare function dehydrateWorkflowReturnValue(value: unknown, _runId: string, key: PayloadKey | undefined, global?: Record<string, any>, v1Compat?: boolean, compression?: boolean,
|
|
444
|
+
/**
|
|
445
|
+
* Optional sink receiving the first five samples and exact total count of
|
|
446
|
+
* workflow-code executions serialization could not avoid. The diagnostics
|
|
447
|
+
* are emitted as span attributes either way, so omitting this loses nothing
|
|
448
|
+
* observability-wise. The retained-VM gate in runtime/suspension-handler.ts
|
|
449
|
+
* passes one for step-input dehydration.
|
|
450
|
+
*/
|
|
451
|
+
guestCodeStatsOut?: GuestCodeStats): Promise<Uint8Array | unknown>;
|
|
241
452
|
/**
|
|
242
453
|
* Called from the client side to hydrate the workflow return value
|
|
243
454
|
* of a completed workflow run.
|
|
244
455
|
*/
|
|
245
|
-
export declare function hydrateWorkflowReturnValue(value: Uint8Array | unknown, runId: string, key:
|
|
456
|
+
export declare function hydrateWorkflowReturnValue(value: Uint8Array | unknown, runId: string, key: PayloadKey | undefined, ops?: Promise<void>[], global?: Record<string, any>, extraRevivers?: Record<string, (value: any) => any>): Promise<any>;
|
|
246
457
|
/**
|
|
247
458
|
* Called from the workflow handler when a step is being created.
|
|
248
459
|
* Dehydrates values from within the workflow execution environment.
|
|
249
460
|
*/
|
|
250
|
-
export declare function dehydrateStepArguments(value: unknown, _runId: string, key:
|
|
461
|
+
export declare function dehydrateStepArguments(value: unknown, _runId: string, key: PayloadKey | undefined, global?: Record<string, any>, v1Compat?: boolean, compression?: boolean,
|
|
462
|
+
/** See `dehydrateWorkflowReturnValue`. */
|
|
463
|
+
guestCodeStatsOut?: GuestCodeStats): Promise<Uint8Array | unknown>;
|
|
251
464
|
/**
|
|
252
|
-
* Called from the step
|
|
465
|
+
* Called from the step executor to hydrate the arguments of a step
|
|
253
466
|
* from the database at the start of the step execution.
|
|
254
467
|
*/
|
|
255
|
-
export declare function hydrateStepArguments(value: Uint8Array | unknown, runId: string, key:
|
|
468
|
+
export declare function hydrateStepArguments(value: Uint8Array | unknown, runId: string, key: PayloadKey | undefined, ops?: Promise<any>[], global?: Record<string, any>, extraRevivers?: Record<string, (value: any) => any>, deploymentId?: string, streamStates?: FlushableStreamState[]): Promise<any>;
|
|
256
469
|
/**
|
|
257
|
-
* Called from the step
|
|
258
|
-
* Dehydrates values from within the step execution environment
|
|
470
|
+
* Called from the step executor when a step has completed.
|
|
471
|
+
* Dehydrates values from within the step execution environment
|
|
472
|
+
* into a format that can be saved to the database.
|
|
473
|
+
*
|
|
474
|
+
* @param value - The value to serialize
|
|
475
|
+
* @param runId - Run ID for encryption context
|
|
476
|
+
* @param key - Encryption key (undefined to skip encryption)
|
|
477
|
+
* @param ops - Promise array for stream operations
|
|
478
|
+
* @param global - Global object for serialization context
|
|
479
|
+
* @param v1Compat - Enable legacy v1 compatibility mode
|
|
480
|
+
* @param framedByteStreams - Whether the target run can decode wire-framed
|
|
481
|
+
* byte streams. Should match the target deployment's capability: see
|
|
482
|
+
* `getRunCapabilities` in `capabilities.ts`. Defaults to `false` for
|
|
483
|
+
* backwards compatibility with older runs.
|
|
484
|
+
* @returns The dehydrated value as binary data (Uint8Array) with format prefix
|
|
259
485
|
*/
|
|
260
|
-
export declare function dehydrateStepReturnValue(value: unknown, runId: string, key:
|
|
486
|
+
export declare function dehydrateStepReturnValue(value: unknown, runId: string, key: PayloadKey | undefined, ops?: Promise<any>[], global?: Record<string, any>, v1Compat?: boolean, framedByteStreams?: boolean, compression?: boolean, runReadyBarrier?: Promise<unknown>, readbackOps?: Promise<void>[]): Promise<Uint8Array | unknown>;
|
|
261
487
|
/**
|
|
262
|
-
* Called from the step
|
|
488
|
+
* Called from the step executor when a step throws. Dehydrates the thrown
|
|
263
489
|
* value from within the step execution environment into a format that can
|
|
264
490
|
* be saved to the database in a `step_failed` or `step_retrying` event.
|
|
265
491
|
*
|
|
@@ -274,7 +500,7 @@ export declare function dehydrateStepReturnValue(value: unknown, runId: string,
|
|
|
274
500
|
* @param global - Global object for serialization context
|
|
275
501
|
* @returns The dehydrated value as binary data (Uint8Array) with format prefix
|
|
276
502
|
*/
|
|
277
|
-
export declare function dehydrateStepError(value: unknown, runId: string, key:
|
|
503
|
+
export declare function dehydrateStepError(value: unknown, runId: string, key: PayloadKey | undefined, ops?: Promise<any>[], global?: Record<string, any>, compression?: boolean): Promise<Uint8Array>;
|
|
278
504
|
/**
|
|
279
505
|
* Called from the workflow handler when replaying the event log of a
|
|
280
506
|
* `step_failed` or `step_retrying` event. Hydrates the thrown value from
|
|
@@ -285,9 +511,10 @@ export declare function dehydrateStepError(value: unknown, runId: string, key: C
|
|
|
285
511
|
* @param key - Encryption key (undefined to skip decryption)
|
|
286
512
|
* @param global - Global object for deserialization context
|
|
287
513
|
* @param extraRevivers - Additional revivers for custom types
|
|
514
|
+
* @param prepared - Optional cached decrypt/decompress result
|
|
288
515
|
* @returns The hydrated thrown value, ready to reject the step promise
|
|
289
516
|
*/
|
|
290
|
-
export declare function hydrateStepError(value: Uint8Array | unknown, _runId: string, key:
|
|
517
|
+
export declare function hydrateStepError(value: Uint8Array | unknown, _runId: string, key: PayloadKey | undefined, global?: Record<string, any>, extraRevivers?: Record<string, (value: any) => any>, prepared?: PreparedReplayPayload): Promise<unknown>;
|
|
291
518
|
/**
|
|
292
519
|
* Called from the workflow handler when the workflow itself throws.
|
|
293
520
|
* Dehydrates the thrown value from within the workflow execution environment
|
|
@@ -299,7 +526,7 @@ export declare function hydrateStepError(value: Uint8Array | unknown, _runId: st
|
|
|
299
526
|
* @param global - Global object for serialization context
|
|
300
527
|
* @returns The dehydrated value as binary data (Uint8Array) with format prefix
|
|
301
528
|
*/
|
|
302
|
-
export declare function dehydrateRunError(value: unknown, _runId: string, key:
|
|
529
|
+
export declare function dehydrateRunError(value: unknown, _runId: string, key: PayloadKey | undefined, global?: Record<string, any>, compression?: boolean): Promise<Uint8Array>;
|
|
303
530
|
/**
|
|
304
531
|
* Called from the client side (or observability tools) to hydrate the run
|
|
305
532
|
* error value of a failed workflow run.
|
|
@@ -312,7 +539,7 @@ export declare function dehydrateRunError(value: unknown, _runId: string, key: C
|
|
|
312
539
|
* @param extraRevivers - Additional revivers for custom types
|
|
313
540
|
* @returns The hydrated thrown value, ready to be consumed by the client
|
|
314
541
|
*/
|
|
315
|
-
export declare function hydrateRunError(value: Uint8Array | unknown, runId: string, key:
|
|
542
|
+
export declare function hydrateRunError(value: Uint8Array | unknown, runId: string, key: PayloadKey | undefined, ops?: Promise<void>[], global?: Record<string, any>, extraRevivers?: Record<string, (value: any) => any>): Promise<unknown>;
|
|
316
543
|
/**
|
|
317
544
|
* Called from the workflow handler when replaying the event log of a `step_completed` event.
|
|
318
545
|
* Hydrates the return value of a step from the database.
|
|
@@ -322,8 +549,9 @@ export declare function hydrateRunError(value: Uint8Array | unknown, runId: stri
|
|
|
322
549
|
* @param key - Encryption key (undefined to skip decryption)
|
|
323
550
|
* @param global - Global object for deserialization context
|
|
324
551
|
* @param extraRevivers - Additional revivers for custom types
|
|
552
|
+
* @param prepared - Optional cached decrypt/decompress result
|
|
325
553
|
* Called from the workflow handler when replaying the event log
|
|
326
554
|
* of a `step_completed` event.
|
|
327
555
|
*/
|
|
328
|
-
export declare function hydrateStepReturnValue(value: Uint8Array | unknown, _runId: string, key:
|
|
556
|
+
export declare function hydrateStepReturnValue(value: Uint8Array | unknown, _runId: string, key: PayloadKey | undefined, global?: Record<string, any>, extraRevivers?: Record<string, (value: any) => any>, prepared?: PreparedReplayPayload): Promise<any>;
|
|
329
557
|
//# sourceMappingURL=serialization.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serialization.d.ts","sourceRoot":"","sources":["../src/serialization.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"serialization.d.ts","sourceRoot":"","sources":["../src/serialization.ts"],"names":[],"mappings":"AAaA,OAAO,EACL,oBAAoB,EACpB,KAAK,oBAAoB,EAS1B,MAAM,uBAAuB,CAAC;AAgB/B,OAAO,EAEL,QAAQ,EACR,UAAU,EACX,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACL,QAAQ,EACR,OAAO,EACP,oBAAoB,EACpB,KAAK,kBAAkB,EACvB,OAAO,EACP,gBAAgB,EAChB,YAAY,EACZ,KAAK,UAAU,EACf,KAAK,cAAc,EAEnB,cAAc,EACd,KAAK,UAAU,EACf,MAAM,EACP,MAAM,+BAA+B,CAAC;AAKvC,OAAO,EACL,kBAAkB,EAClB,sBAAsB,EACtB,WAAW,EACX,gBAAgB,EACjB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,KAAK,cAAc,EAGpB,MAAM,6BAA6B,CAAC;AAerC,OAAO,EACL,KAAK,YAAY,EACjB,cAAc,EACd,mBAAmB,EACpB,MAAM,0BAA0B,CAAC;AA0BlC,OAAO,EACL,mBAAmB,EACnB,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