@workflow/world-testing 5.0.0-beta.29 → 5.0.0-beta.30
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.
|
@@ -16500,7 +16500,7 @@ var init_serialization = __esm({
|
|
|
16500
16500
|
});
|
|
16501
16501
|
|
|
16502
16502
|
// ../world/dist/events.js
|
|
16503
|
-
var EventTypeSchema, TerminalRunEventTypeSchema, TERMINAL_RUN_EVENT_TYPES, BaseEventSchema, stepLatencyTelemetryFields, StepCompletedEventSchema, StepFailedEventSchema, StepRetryingEventSchema, StepStartedEventSchema, StepCreatedEventSchema, HookCreatedEventSchema, HookReceivedEventSchema, HookDisposedEventSchema, HookConflictEventSchema, WaitCreatedEventSchema, WaitCompletedEventSchema, AttributeWriterSchema, AttrSetEventSchema, RunCreatedEventSchema, RunStartedEventSchema, RunCompletedEventSchema, RunFailedEventSchema, RunCancelledEventSchema, CreateEventSchema, AllEventsSchema, EventSchema;
|
|
16503
|
+
var EventTypeSchema, RunEventTypeSchema, RUN_EVENT_TYPES, TerminalRunEventTypeSchema, TERMINAL_RUN_EVENT_TYPES, StepEventTypeSchema, STEP_EVENT_TYPES, TerminalStepEventTypeSchema, TERMINAL_STEP_EVENT_TYPES, HookLifecycleEventTypeSchema, HOOK_LIFECYCLE_EVENT_TYPES, HookEventRequiringExistenceTypeSchema, HOOK_EVENTS_REQUIRING_EXISTENCE, WaitEventTypeSchema, WAIT_EVENT_TYPES, ChildEntityCreationEventTypeSchema, CHILD_ENTITY_CREATION_EVENT_TYPES, EVENT_DATA_PAYLOAD_FIELD_BY_EVENT_TYPE, EVENT_DATA_REF_FIELDS, BaseEventSchema, stepLatencyTelemetryFields, StepCompletedEventSchema, StepFailedEventSchema, StepRetryingEventSchema, StepStartedEventSchema, StepCreatedEventSchema, HookCreatedEventSchema, HookReceivedEventSchema, HookDisposedEventSchema, HookConflictEventSchema, WaitCreatedEventSchema, WaitCompletedEventSchema, AttributeWriterSchema, AttrSetEventSchema, RunCreatedEventSchema, RunStartedEventSchema, RunCompletedEventSchema, RunFailedEventSchema, RunCancelledEventSchema, CreateEventSchema, AllEventsSchema, EventSchema;
|
|
16504
16504
|
var init_events = __esm({
|
|
16505
16505
|
"../world/dist/events.js"() {
|
|
16506
16506
|
"use strict";
|
|
@@ -16531,12 +16531,74 @@ var init_events = __esm({
|
|
|
16531
16531
|
"wait_created",
|
|
16532
16532
|
"wait_completed"
|
|
16533
16533
|
]);
|
|
16534
|
+
RunEventTypeSchema = EventTypeSchema.extract([
|
|
16535
|
+
"run_created",
|
|
16536
|
+
"run_started",
|
|
16537
|
+
"run_completed",
|
|
16538
|
+
"run_failed",
|
|
16539
|
+
"run_cancelled"
|
|
16540
|
+
]);
|
|
16541
|
+
RUN_EVENT_TYPES = RunEventTypeSchema.options;
|
|
16534
16542
|
TerminalRunEventTypeSchema = EventTypeSchema.extract([
|
|
16535
16543
|
"run_completed",
|
|
16536
16544
|
"run_failed",
|
|
16537
16545
|
"run_cancelled"
|
|
16538
16546
|
]);
|
|
16539
16547
|
TERMINAL_RUN_EVENT_TYPES = TerminalRunEventTypeSchema.options;
|
|
16548
|
+
StepEventTypeSchema = EventTypeSchema.extract([
|
|
16549
|
+
"step_created",
|
|
16550
|
+
"step_completed",
|
|
16551
|
+
"step_failed",
|
|
16552
|
+
"step_retrying",
|
|
16553
|
+
"step_started"
|
|
16554
|
+
]);
|
|
16555
|
+
STEP_EVENT_TYPES = StepEventTypeSchema.options;
|
|
16556
|
+
TerminalStepEventTypeSchema = EventTypeSchema.extract([
|
|
16557
|
+
"step_completed",
|
|
16558
|
+
"step_failed"
|
|
16559
|
+
]);
|
|
16560
|
+
TERMINAL_STEP_EVENT_TYPES = TerminalStepEventTypeSchema.options;
|
|
16561
|
+
HookLifecycleEventTypeSchema = EventTypeSchema.extract([
|
|
16562
|
+
"hook_created",
|
|
16563
|
+
"hook_received",
|
|
16564
|
+
"hook_disposed"
|
|
16565
|
+
]);
|
|
16566
|
+
HOOK_LIFECYCLE_EVENT_TYPES = HookLifecycleEventTypeSchema.options;
|
|
16567
|
+
HookEventRequiringExistenceTypeSchema = EventTypeSchema.extract([
|
|
16568
|
+
"hook_disposed",
|
|
16569
|
+
"hook_received"
|
|
16570
|
+
]);
|
|
16571
|
+
HOOK_EVENTS_REQUIRING_EXISTENCE = HookEventRequiringExistenceTypeSchema.options;
|
|
16572
|
+
WaitEventTypeSchema = EventTypeSchema.extract([
|
|
16573
|
+
"wait_created",
|
|
16574
|
+
"wait_completed"
|
|
16575
|
+
]);
|
|
16576
|
+
WAIT_EVENT_TYPES = WaitEventTypeSchema.options;
|
|
16577
|
+
ChildEntityCreationEventTypeSchema = EventTypeSchema.extract([
|
|
16578
|
+
"step_created",
|
|
16579
|
+
"hook_created",
|
|
16580
|
+
"wait_created"
|
|
16581
|
+
]);
|
|
16582
|
+
CHILD_ENTITY_CREATION_EVENT_TYPES = ChildEntityCreationEventTypeSchema.options;
|
|
16583
|
+
EVENT_DATA_PAYLOAD_FIELD_BY_EVENT_TYPE = {
|
|
16584
|
+
run_created: "input",
|
|
16585
|
+
run_started: "input",
|
|
16586
|
+
run_completed: "output",
|
|
16587
|
+
run_failed: "error",
|
|
16588
|
+
step_created: "input",
|
|
16589
|
+
step_started: "input",
|
|
16590
|
+
step_completed: "result",
|
|
16591
|
+
step_failed: "error",
|
|
16592
|
+
step_retrying: "error",
|
|
16593
|
+
hook_created: "metadata",
|
|
16594
|
+
hook_received: "payload"
|
|
16595
|
+
};
|
|
16596
|
+
EVENT_DATA_REF_FIELDS = Object.fromEntries(Object.entries(EVENT_DATA_PAYLOAD_FIELD_BY_EVENT_TYPE).map(([eventType, field]) => [
|
|
16597
|
+
eventType,
|
|
16598
|
+
[
|
|
16599
|
+
field
|
|
16600
|
+
]
|
|
16601
|
+
]));
|
|
16540
16602
|
BaseEventSchema = external_exports.object({
|
|
16541
16603
|
eventType: EventTypeSchema,
|
|
16542
16604
|
correlationId: external_exports.string().optional(),
|
|
@@ -16553,6 +16615,10 @@ var init_events = __esm({
|
|
|
16553
16615
|
// two steps ran back-to-back (the previous event-log entry is a
|
|
16554
16616
|
// step_completed/step_failed).
|
|
16555
16617
|
stso: external_exports.number().optional(),
|
|
16618
|
+
// Progress counters taken when the STSO gap began. Only present alongside
|
|
16619
|
+
// stso.
|
|
16620
|
+
stepCount: external_exports.number().int().positive().optional(),
|
|
16621
|
+
eventCount: external_exports.number().int().positive().optional(),
|
|
16556
16622
|
// Names of the runtime's optional startup-latency optimizations that were
|
|
16557
16623
|
// active for this measurement (e.g. 'turbo', 'lazyStepStart',
|
|
16558
16624
|
// 'optimisticStart'), so latency metrics can be segmented by them.
|
|
@@ -16604,7 +16670,20 @@ var init_events = __esm({
|
|
|
16604
16670
|
workflowName: external_exports.string().optional(),
|
|
16605
16671
|
// Lazy-start: the dehydrated step input, present only when this
|
|
16606
16672
|
// step_started is also responsible for creating the step.
|
|
16607
|
-
input: SerializedDataSchema.optional()
|
|
16673
|
+
input: SerializedDataSchema.optional(),
|
|
16674
|
+
// Inline step ownership: the queue message ID of the invocation whose
|
|
16675
|
+
// handler is executing this step's body inline. Stamped on the lazy
|
|
16676
|
+
// step_started (and re-stamped on an owner-recovery bare start) so
|
|
16677
|
+
// that a wake replay can tell "this attempt is in flight in a live
|
|
16678
|
+
// invocation" apart from "this attempt died with its process" — the
|
|
16679
|
+
// owner's queue message doubles as the liveness lease (a crash means
|
|
16680
|
+
// the queue redelivers that same messageId, which is allowed to
|
|
16681
|
+
// re-execute). Ownership derives from the step's LATEST step_started:
|
|
16682
|
+
// an unstamped bare start (a retry attempt driven by a queued step
|
|
16683
|
+
// message) clears it. Absent on eager steps and from older runtimes.
|
|
16684
|
+
// Requires the queue's messageId to be stable across redeliveries of
|
|
16685
|
+
// one message (see the Queue.createQueueHandler meta contract).
|
|
16686
|
+
ownerMessageId: external_exports.string().optional()
|
|
16608
16687
|
}).optional()
|
|
16609
16688
|
});
|
|
16610
16689
|
StepCreatedEventSchema = BaseEventSchema.extend({
|
|
@@ -17464,12 +17543,16 @@ var init_node = __esm({
|
|
|
17464
17543
|
});
|
|
17465
17544
|
|
|
17466
17545
|
// ../world/dist/ulid.js
|
|
17467
|
-
var UlidSchema, DEFAULT_TIMESTAMP_THRESHOLD_PAST_MS, DEFAULT_TIMESTAMP_THRESHOLD_FUTURE_MS;
|
|
17546
|
+
var UlidSchema, workflowRunIdSchema, DEFAULT_TIMESTAMP_THRESHOLD_PAST_MS, DEFAULT_TIMESTAMP_THRESHOLD_FUTURE_MS;
|
|
17468
17547
|
var init_ulid = __esm({
|
|
17469
17548
|
"../world/dist/ulid.js"() {
|
|
17470
17549
|
"use strict";
|
|
17471
17550
|
init_zod();
|
|
17472
17551
|
UlidSchema = external_exports.string().ulid();
|
|
17552
|
+
workflowRunIdSchema = external_exports.templateLiteral([
|
|
17553
|
+
"wrun_",
|
|
17554
|
+
external_exports.ulid()
|
|
17555
|
+
]);
|
|
17473
17556
|
DEFAULT_TIMESTAMP_THRESHOLD_PAST_MS = 24 * 60 * 60 * 1e3;
|
|
17474
17557
|
DEFAULT_TIMESTAMP_THRESHOLD_FUTURE_MS = 5 * 60 * 1e3;
|
|
17475
17558
|
}
|
|
@@ -19711,7 +19794,7 @@ function SemanticConvention(...names) {
|
|
|
19711
19794
|
value
|
|
19712
19795
|
]));
|
|
19713
19796
|
}
|
|
19714
|
-
var WorkflowName, WorkflowOperation, WorkflowRunId, WorkflowRunStatus, WorkflowStartedAt, WorkflowEventsCount, WorkflowArgumentsCount, WorkflowResultType, WorkflowTracePropagated, WorkflowTraceMode, WorkflowTurbo, WorkflowErrorName, WorkflowErrorMessage, WorkflowErrorCode, WorkflowStepsCreated, WorkflowHooksCreated, WorkflowWaitsCreated, WorkflowRouteType, WorkflowRouteHandlerCached, WorkflowRouteInvocationCount, WorkflowRouteEntrypointAgeMs, WorkflowRouteModuleBodyInitMs, StepName, StepId, StepAttempt, StepStatus, StepMaxRetries, StepTracePropagated, StepTtfsMs, StepStsoMs, StepLatencyOptimizations, StepSkipped, StepSkipReason, StepArgumentsCount, StepResultType, StepErrorName, StepErrorMessage, StepFatalError, StepRetryExhausted, StepRetryTimeoutSeconds, StepRetryWillRetry, MessagingSystem, MessagingDestinationName, MessagingMessageId, MessagingOperationType, QueueOverheadMs, DeploymentId, HookToken, HookId, HookFound, WebhookHandlersTriggered, WorkflowSuspensionState, WorkflowSuspensionHookCount, WorkflowSuspensionStepCount, WorkflowSuspensionWaitCount, HttpRequestMethod, HttpRoute, UrlFull, ServerAddress, ServerPort, HttpResponseStatusCode, ErrorType, WorldParseFormat, WorkflowEventsPagesLoaded, QueueDeserializeTimeMs, QueueExecutionTimeMs, QueueSerializeTimeMs, SerializationOperation, SerializationCompressed, SerializationCodec, SerializationUncompressedBytes, SerializationStoredBytes, SerializationCompressionRatio, PeerService, RpcSystem, RpcService, RpcMethod, ErrorRetryable, ErrorCategory;
|
|
19797
|
+
var WorkflowName, WorkflowOperation, WorkflowRunId, WorkflowRunStatus, WorkflowStartedAt, WorkflowEventsCount, WorkflowArgumentsCount, WorkflowResultType, WorkflowTracePropagated, WorkflowTraceMode, WorkflowTurbo, WorkflowErrorName, WorkflowErrorMessage, WorkflowErrorCode, WorkflowStepsCreated, WorkflowHooksCreated, WorkflowWaitsCreated, WorkflowOwnedRecoverySteps, WorkflowBackstopWakesArmed, WorkflowRouteType, WorkflowRouteHandlerCached, WorkflowRouteInvocationCount, WorkflowRouteEntrypointAgeMs, WorkflowRouteModuleBodyInitMs, StepName, StepId, StepAttempt, StepStatus, StepMaxRetries, StepTracePropagated, StepTtfsMs, StepStsoMs, StepLatencyOptimizations, StepSkipped, StepSkipReason, StepArgumentsCount, StepResultType, StepErrorName, StepErrorMessage, StepFatalError, StepRetryExhausted, StepRetryTimeoutSeconds, StepRetryWillRetry, MessagingSystem, MessagingDestinationName, MessagingMessageId, MessagingOperationType, QueueOverheadMs, DeploymentId, HookToken, HookId, HookFound, WebhookHandlersTriggered, WorkflowSuspensionState, WorkflowSuspensionHookCount, WorkflowSuspensionStepCount, WorkflowSuspensionWaitCount, HttpRequestMethod, HttpRoute, UrlFull, ServerAddress, ServerPort, HttpResponseStatusCode, ErrorType, WorldParseFormat, WorkflowEventsPagesLoaded, QueueDeserializeTimeMs, QueueExecutionTimeMs, QueueSerializeTimeMs, SerializationOperation, SerializationCompressed, SerializationCodec, SerializationUncompressedBytes, SerializationStoredBytes, SerializationCompressionRatio, PeerService, RpcSystem, RpcService, RpcMethod, ErrorRetryable, ErrorCategory;
|
|
19715
19798
|
var init_semantic_conventions = __esm({
|
|
19716
19799
|
"../core/dist/telemetry/semantic-conventions.js"() {
|
|
19717
19800
|
"use strict";
|
|
@@ -19733,6 +19816,8 @@ var init_semantic_conventions = __esm({
|
|
|
19733
19816
|
WorkflowStepsCreated = SemanticConvention("workflow.steps.created");
|
|
19734
19817
|
WorkflowHooksCreated = SemanticConvention("workflow.hooks.created");
|
|
19735
19818
|
WorkflowWaitsCreated = SemanticConvention("workflow.waits.created");
|
|
19819
|
+
WorkflowOwnedRecoverySteps = SemanticConvention("workflow.inline_ownership.owned_recovery_steps");
|
|
19820
|
+
WorkflowBackstopWakesArmed = SemanticConvention("workflow.inline_ownership.backstop_wakes_armed");
|
|
19736
19821
|
WorkflowRouteType = SemanticConvention("workflow.route.type");
|
|
19737
19822
|
WorkflowRouteHandlerCached = SemanticConvention("workflow.route.handler_cached");
|
|
19738
19823
|
WorkflowRouteInvocationCount = SemanticConvention("workflow.route.invocation_count");
|
|
@@ -21821,6 +21906,14 @@ async function trace(spanName, ...args) {
|
|
|
21821
21906
|
}
|
|
21822
21907
|
});
|
|
21823
21908
|
}
|
|
21909
|
+
async function recordElapsedSpan(spanName, startEpochMs, opts) {
|
|
21910
|
+
const tracer = await Tracer.value;
|
|
21911
|
+
if (!tracer) return;
|
|
21912
|
+
tracer.startSpan(spanName, {
|
|
21913
|
+
...opts,
|
|
21914
|
+
startTime: startEpochMs
|
|
21915
|
+
}).end();
|
|
21916
|
+
}
|
|
21824
21917
|
function applyWorkflowSuspensionToSpan(error48, otel, span) {
|
|
21825
21918
|
if (!error48 || !WorkflowSuspension.is(error48)) {
|
|
21826
21919
|
return;
|
|
@@ -21846,6 +21939,9 @@ async function getSpanContextForTraceCarrier(carrier) {
|
|
|
21846
21939
|
async function getActiveSpan() {
|
|
21847
21940
|
return await withOtel((otel) => otel.trace.getActiveSpan());
|
|
21848
21941
|
}
|
|
21942
|
+
async function getSpanKind(field) {
|
|
21943
|
+
return withOtel((x) => x.SpanKind[field]);
|
|
21944
|
+
}
|
|
21849
21945
|
async function withOtel(fn) {
|
|
21850
21946
|
const otel = await OtelApi.value;
|
|
21851
21947
|
if (!otel) return void 0;
|
|
@@ -21887,9 +21983,11 @@ var init_telemetry = __esm({
|
|
|
21887
21983
|
return api.trace.getTracer("workflow");
|
|
21888
21984
|
});
|
|
21889
21985
|
__name(trace, "trace");
|
|
21986
|
+
__name(recordElapsedSpan, "recordElapsedSpan");
|
|
21890
21987
|
__name(applyWorkflowSuspensionToSpan, "applyWorkflowSuspensionToSpan");
|
|
21891
21988
|
__name(getSpanContextForTraceCarrier, "getSpanContextForTraceCarrier");
|
|
21892
21989
|
__name(getActiveSpan, "getActiveSpan");
|
|
21990
|
+
__name(getSpanKind, "getSpanKind");
|
|
21893
21991
|
__name(withOtel, "withOtel");
|
|
21894
21992
|
__name(linkToTraceCarrier, "linkToTraceCarrier");
|
|
21895
21993
|
}
|
|
@@ -24275,7 +24373,7 @@ var version2;
|
|
|
24275
24373
|
var init_version = __esm({
|
|
24276
24374
|
"../core/dist/version.js"() {
|
|
24277
24375
|
"use strict";
|
|
24278
|
-
version2 = "5.0.0-beta.
|
|
24376
|
+
version2 = "5.0.0-beta.30";
|
|
24279
24377
|
}
|
|
24280
24378
|
});
|
|
24281
24379
|
|
|
@@ -24293,6 +24391,15 @@ function getHealthCheckStreamName(correlationId) {
|
|
|
24293
24391
|
function generateHealthCheckRunId(correlationId) {
|
|
24294
24392
|
return `wrun_hc_${correlationId}`;
|
|
24295
24393
|
}
|
|
24394
|
+
function withDeadline(promise2, ms2) {
|
|
24395
|
+
let timer;
|
|
24396
|
+
return Promise.race([
|
|
24397
|
+
promise2,
|
|
24398
|
+
new Promise((_, reject) => {
|
|
24399
|
+
timer = setTimeout(() => reject(new Error(`Operation timed out after ${ms2}ms`)), ms2);
|
|
24400
|
+
})
|
|
24401
|
+
]).finally(() => clearTimeout(timer));
|
|
24402
|
+
}
|
|
24296
24403
|
async function readStreamWithTimeout(reader, readTimeout) {
|
|
24297
24404
|
const chunks = [];
|
|
24298
24405
|
let done = false;
|
|
@@ -24372,7 +24479,8 @@ async function healthCheck(world, endpoint, options) {
|
|
|
24372
24479
|
});
|
|
24373
24480
|
while (Date.now() - startTime < timeout) {
|
|
24374
24481
|
try {
|
|
24375
|
-
const
|
|
24482
|
+
const remainingMs = timeout - (Date.now() - startTime);
|
|
24483
|
+
const stream = await withDeadline(world.streams.get(generateHealthCheckRunId(correlationId), streamName), remainingMs);
|
|
24376
24484
|
const reader = stream.getReader();
|
|
24377
24485
|
const { chunks, timedOut } = await readStreamWithTimeout(reader, HEALTH_CHECK_READ_TIMEOUT);
|
|
24378
24486
|
if (timedOut) {
|
|
@@ -24427,6 +24535,7 @@ var init_helpers = __esm({
|
|
|
24427
24535
|
__name(generateHealthCheckRunId, "generateHealthCheckRunId");
|
|
24428
24536
|
HEALTH_CHECK_POLL_INTERVAL = 100;
|
|
24429
24537
|
HEALTH_CHECK_READ_TIMEOUT = 500;
|
|
24538
|
+
__name(withDeadline, "withDeadline");
|
|
24430
24539
|
__name(readStreamWithTimeout, "readStreamWithTimeout");
|
|
24431
24540
|
__name(parseHealthCheckResponse, "parseHealthCheckResponse");
|
|
24432
24541
|
__name(healthCheck, "healthCheck");
|
|
@@ -25986,6 +26095,22 @@ function getByteUnframingStream() {
|
|
|
25986
26095
|
}
|
|
25987
26096
|
});
|
|
25988
26097
|
}
|
|
26098
|
+
function recordReadTimeToFirstChunk(startEpochMs, runId, name, startIndex) {
|
|
26099
|
+
void (async () => {
|
|
26100
|
+
await recordElapsedSpan("workflow.stream.read", startEpochMs, {
|
|
26101
|
+
kind: await getSpanKind("CLIENT"),
|
|
26102
|
+
attributes: {
|
|
26103
|
+
"workflow.run.id": runId,
|
|
26104
|
+
"workflow.stream.name": name,
|
|
26105
|
+
"workflow.stream.operation": "read",
|
|
26106
|
+
"workflow.stream.read.ttfc_ms": Date.now() - startEpochMs,
|
|
26107
|
+
...typeof startIndex === "number" ? {
|
|
26108
|
+
"workflow.stream.start_index": startIndex
|
|
26109
|
+
} : {}
|
|
26110
|
+
}
|
|
26111
|
+
});
|
|
26112
|
+
})();
|
|
26113
|
+
}
|
|
25989
26114
|
function createReconnectingFramedStream(runId, name, startIndex) {
|
|
25990
26115
|
const reconnectSupported = startIndex === void 0 || startIndex >= 0;
|
|
25991
26116
|
let currentStartIndex = startIndex ?? 0;
|
|
@@ -26957,6 +27082,7 @@ var init_serialization2 = __esm({
|
|
|
26957
27082
|
MAX_FRAME_SIZE = 1e8;
|
|
26958
27083
|
__name(getByteFramingStream, "getByteFramingStream");
|
|
26959
27084
|
__name(getByteUnframingStream, "getByteUnframingStream");
|
|
27085
|
+
__name(recordReadTimeToFirstChunk, "recordReadTimeToFirstChunk");
|
|
26960
27086
|
WorkflowServerReadableStream = class extends ReadableStream {
|
|
26961
27087
|
static {
|
|
26962
27088
|
__name(this, "WorkflowServerReadableStream");
|
|
@@ -26966,12 +27092,15 @@ var init_serialization2 = __esm({
|
|
|
26966
27092
|
if (typeof name !== "string" || name.length === 0) {
|
|
26967
27093
|
throw new WorkflowRuntimeError(`"name" is required, got "${name}"`);
|
|
26968
27094
|
}
|
|
27095
|
+
let readStart;
|
|
27096
|
+
let firstChunkReported = false;
|
|
26969
27097
|
super({
|
|
26970
27098
|
// @ts-expect-error Not sure why TypeScript is complaining about this
|
|
26971
27099
|
type: "bytes",
|
|
26972
27100
|
pull: /* @__PURE__ */ __name(async (controller) => {
|
|
26973
27101
|
let reader = this.#reader;
|
|
26974
27102
|
if (!reader) {
|
|
27103
|
+
if (readStart === void 0) readStart = Date.now();
|
|
26975
27104
|
const world = await getWorldLazy();
|
|
26976
27105
|
const stream = await world.streams.get(runId, name, startIndex);
|
|
26977
27106
|
reader = this.#reader = stream.getReader();
|
|
@@ -26985,6 +27114,10 @@ var init_serialization2 = __esm({
|
|
|
26985
27114
|
this.#reader = void 0;
|
|
26986
27115
|
controller.close();
|
|
26987
27116
|
} else {
|
|
27117
|
+
if (!firstChunkReported && result.value.byteLength > 0 && readStart !== void 0) {
|
|
27118
|
+
firstChunkReported = true;
|
|
27119
|
+
recordReadTimeToFirstChunk(readStart, runId, name, startIndex);
|
|
27120
|
+
}
|
|
26988
27121
|
controller.enqueue(result.value);
|
|
26989
27122
|
}
|
|
26990
27123
|
}, "pull"),
|
|
@@ -27405,7 +27538,8 @@ async function start(workflow, argsOrOptions, options) {
|
|
|
27405
27538
|
} else {
|
|
27406
27539
|
const probe = await healthCheck(world, "workflow", {
|
|
27407
27540
|
deploymentId,
|
|
27408
|
-
timeout: CROSS_DEPLOYMENT_CAPABILITY_PROBE_TIMEOUT_MS
|
|
27541
|
+
timeout: CROSS_DEPLOYMENT_CAPABILITY_PROBE_TIMEOUT_MS,
|
|
27542
|
+
namespace: opts.namespace
|
|
27409
27543
|
}).catch(() => void 0);
|
|
27410
27544
|
const capabilities = getRunCapabilities(probe?.workflowCoreVersion);
|
|
27411
27545
|
framedByteStreams = capabilities.framedByteStreams;
|
|
@@ -27441,6 +27575,9 @@ async function start(workflow, argsOrOptions, options) {
|
|
|
27441
27575
|
allowReservedAttributes: true
|
|
27442
27576
|
} : {}
|
|
27443
27577
|
} : {};
|
|
27578
|
+
if (opts.replayedFromRunId !== void 0 && !workflowRunIdSchema.safeParse(opts.replayedFromRunId).success) {
|
|
27579
|
+
throw new WorkflowRuntimeError(`replayedFromRunId must be a run ID (wrun_<ulid>); received ${JSON.stringify(String(opts.replayedFromRunId).slice(0, 64))}.`);
|
|
27580
|
+
}
|
|
27444
27581
|
const rawKey = await world.getEncryptionKeyForRun?.(runId, {
|
|
27445
27582
|
...opts,
|
|
27446
27583
|
deploymentId
|
|
@@ -27453,7 +27590,10 @@ async function start(workflow, argsOrOptions, options) {
|
|
|
27453
27590
|
workflowCoreVersion: version2,
|
|
27454
27591
|
features: {
|
|
27455
27592
|
encryption: !!encryptionKey
|
|
27456
|
-
}
|
|
27593
|
+
},
|
|
27594
|
+
...opts.replayedFromRunId ? {
|
|
27595
|
+
replayedFromRunId: opts.replayedFromRunId
|
|
27596
|
+
} : {}
|
|
27457
27597
|
};
|
|
27458
27598
|
const [runCreatedResult, queueResult] = await Promise.allSettled([
|
|
27459
27599
|
world.events.create(runId, {
|
|
@@ -27469,7 +27609,7 @@ async function start(workflow, argsOrOptions, options) {
|
|
|
27469
27609
|
}, {
|
|
27470
27610
|
v1Compat
|
|
27471
27611
|
}),
|
|
27472
|
-
world.queue(getWorkflowQueueName(workflowName), {
|
|
27612
|
+
world.queue(getWorkflowQueueName(workflowName, opts.namespace), {
|
|
27473
27613
|
runId,
|
|
27474
27614
|
traceCarrier,
|
|
27475
27615
|
...specVersion >= SPEC_VERSION_SUPPORTS_CBOR_QUEUE_TRANSPORT ? {
|
|
@@ -27538,7 +27678,7 @@ __name(start, "start");
|
|
|
27538
27678
|
value: "start",
|
|
27539
27679
|
configurable: true
|
|
27540
27680
|
});
|
|
27541
|
-
})(start, "step//@workflow/core/runtime/start@5.0.0-beta.
|
|
27681
|
+
})(start, "step//@workflow/core/runtime/start@5.0.0-beta.30//start");
|
|
27542
27682
|
|
|
27543
27683
|
// ../core/dist/runtime/runs.js
|
|
27544
27684
|
async function wakeUpRun(world, runId, options) {
|
|
@@ -27599,7 +27739,7 @@ async function wakeUpRun(world, runId, options) {
|
|
|
27599
27739
|
}
|
|
27600
27740
|
}
|
|
27601
27741
|
if (stoppedCount > 0) {
|
|
27602
|
-
await world.queue(getWorkflowQueueName(run2.workflowName), {
|
|
27742
|
+
await world.queue(getWorkflowQueueName(run2.workflowName, options?.namespace), {
|
|
27603
27743
|
runId
|
|
27604
27744
|
}, {
|
|
27605
27745
|
deploymentId: run2.deploymentId,
|
|
@@ -27874,7 +28014,7 @@ var Run = class _Run {
|
|
|
27874
28014
|
value: "wakeUp",
|
|
27875
28015
|
configurable: true
|
|
27876
28016
|
});
|
|
27877
|
-
})(Run.prototype["wakeUp"], "step//@workflow/core/runtime/run@5.0.0-beta.
|
|
28017
|
+
})(Run.prototype["wakeUp"], "step//@workflow/core/runtime/run@5.0.0-beta.30//Run#wakeUp");
|
|
27878
28018
|
(function(__wf_fn, __wf_id) {
|
|
27879
28019
|
var __wf_sym = /* @__PURE__ */ Symbol.for("@workflow/core//registeredSteps"), __wf_reg = globalThis[__wf_sym] || (globalThis[__wf_sym] = /* @__PURE__ */ new Map());
|
|
27880
28020
|
__wf_reg.set(__wf_id, __wf_fn);
|
|
@@ -27883,7 +28023,7 @@ var Run = class _Run {
|
|
|
27883
28023
|
value: "cancel",
|
|
27884
28024
|
configurable: true
|
|
27885
28025
|
});
|
|
27886
|
-
})(Run.prototype["cancel"], "step//@workflow/core/runtime/run@5.0.0-beta.
|
|
28026
|
+
})(Run.prototype["cancel"], "step//@workflow/core/runtime/run@5.0.0-beta.30//Run#cancel");
|
|
27887
28027
|
(function(__wf_fn, __wf_id) {
|
|
27888
28028
|
var __wf_sym = /* @__PURE__ */ Symbol.for("@workflow/core//registeredSteps"), __wf_reg = globalThis[__wf_sym] || (globalThis[__wf_sym] = /* @__PURE__ */ new Map());
|
|
27889
28029
|
__wf_reg.set(__wf_id, __wf_fn);
|
|
@@ -27892,7 +28032,7 @@ var Run = class _Run {
|
|
|
27892
28032
|
value: "getReadable",
|
|
27893
28033
|
configurable: true
|
|
27894
28034
|
});
|
|
27895
|
-
})(Run.prototype["getReadable"], "step//@workflow/core/runtime/run@5.0.0-beta.
|
|
28035
|
+
})(Run.prototype["getReadable"], "step//@workflow/core/runtime/run@5.0.0-beta.30//Run#getReadable");
|
|
27896
28036
|
(function(__wf_fn, __wf_id) {
|
|
27897
28037
|
var __wf_sym = /* @__PURE__ */ Symbol.for("@workflow/core//registeredSteps"), __wf_reg = globalThis[__wf_sym] || (globalThis[__wf_sym] = /* @__PURE__ */ new Map());
|
|
27898
28038
|
__wf_reg.set(__wf_id, __wf_fn);
|
|
@@ -27901,7 +28041,7 @@ var Run = class _Run {
|
|
|
27901
28041
|
value: "exists",
|
|
27902
28042
|
configurable: true
|
|
27903
28043
|
});
|
|
27904
|
-
})(Object.getOwnPropertyDescriptor(Run.prototype, "exists").get, "step//@workflow/core/runtime/run@5.0.0-beta.
|
|
28044
|
+
})(Object.getOwnPropertyDescriptor(Run.prototype, "exists").get, "step//@workflow/core/runtime/run@5.0.0-beta.30//Run#exists");
|
|
27905
28045
|
(function(__wf_fn, __wf_id) {
|
|
27906
28046
|
var __wf_sym = /* @__PURE__ */ Symbol.for("@workflow/core//registeredSteps"), __wf_reg = globalThis[__wf_sym] || (globalThis[__wf_sym] = /* @__PURE__ */ new Map());
|
|
27907
28047
|
__wf_reg.set(__wf_id, __wf_fn);
|
|
@@ -27910,7 +28050,7 @@ var Run = class _Run {
|
|
|
27910
28050
|
value: "status",
|
|
27911
28051
|
configurable: true
|
|
27912
28052
|
});
|
|
27913
|
-
})(Object.getOwnPropertyDescriptor(Run.prototype, "status").get, "step//@workflow/core/runtime/run@5.0.0-beta.
|
|
28053
|
+
})(Object.getOwnPropertyDescriptor(Run.prototype, "status").get, "step//@workflow/core/runtime/run@5.0.0-beta.30//Run#status");
|
|
27914
28054
|
(function(__wf_fn, __wf_id) {
|
|
27915
28055
|
var __wf_sym = /* @__PURE__ */ Symbol.for("@workflow/core//registeredSteps"), __wf_reg = globalThis[__wf_sym] || (globalThis[__wf_sym] = /* @__PURE__ */ new Map());
|
|
27916
28056
|
__wf_reg.set(__wf_id, __wf_fn);
|
|
@@ -27919,7 +28059,7 @@ var Run = class _Run {
|
|
|
27919
28059
|
value: "returnValue",
|
|
27920
28060
|
configurable: true
|
|
27921
28061
|
});
|
|
27922
|
-
})(Object.getOwnPropertyDescriptor(Run.prototype, "returnValue").get, "step//@workflow/core/runtime/run@5.0.0-beta.
|
|
28062
|
+
})(Object.getOwnPropertyDescriptor(Run.prototype, "returnValue").get, "step//@workflow/core/runtime/run@5.0.0-beta.30//Run#returnValue");
|
|
27923
28063
|
(function(__wf_fn, __wf_id) {
|
|
27924
28064
|
var __wf_sym = /* @__PURE__ */ Symbol.for("@workflow/core//registeredSteps"), __wf_reg = globalThis[__wf_sym] || (globalThis[__wf_sym] = /* @__PURE__ */ new Map());
|
|
27925
28065
|
__wf_reg.set(__wf_id, __wf_fn);
|
|
@@ -27928,7 +28068,7 @@ var Run = class _Run {
|
|
|
27928
28068
|
value: "workflowName",
|
|
27929
28069
|
configurable: true
|
|
27930
28070
|
});
|
|
27931
|
-
})(Object.getOwnPropertyDescriptor(Run.prototype, "workflowName").get, "step//@workflow/core/runtime/run@5.0.0-beta.
|
|
28071
|
+
})(Object.getOwnPropertyDescriptor(Run.prototype, "workflowName").get, "step//@workflow/core/runtime/run@5.0.0-beta.30//Run#workflowName");
|
|
27932
28072
|
(function(__wf_fn, __wf_id) {
|
|
27933
28073
|
var __wf_sym = /* @__PURE__ */ Symbol.for("@workflow/core//registeredSteps"), __wf_reg = globalThis[__wf_sym] || (globalThis[__wf_sym] = /* @__PURE__ */ new Map());
|
|
27934
28074
|
__wf_reg.set(__wf_id, __wf_fn);
|
|
@@ -27937,7 +28077,7 @@ var Run = class _Run {
|
|
|
27937
28077
|
value: "createdAt",
|
|
27938
28078
|
configurable: true
|
|
27939
28079
|
});
|
|
27940
|
-
})(Object.getOwnPropertyDescriptor(Run.prototype, "createdAt").get, "step//@workflow/core/runtime/run@5.0.0-beta.
|
|
28080
|
+
})(Object.getOwnPropertyDescriptor(Run.prototype, "createdAt").get, "step//@workflow/core/runtime/run@5.0.0-beta.30//Run#createdAt");
|
|
27941
28081
|
(function(__wf_fn, __wf_id) {
|
|
27942
28082
|
var __wf_sym = /* @__PURE__ */ Symbol.for("@workflow/core//registeredSteps"), __wf_reg = globalThis[__wf_sym] || (globalThis[__wf_sym] = /* @__PURE__ */ new Map());
|
|
27943
28083
|
__wf_reg.set(__wf_id, __wf_fn);
|
|
@@ -27946,7 +28086,7 @@ var Run = class _Run {
|
|
|
27946
28086
|
value: "startedAt",
|
|
27947
28087
|
configurable: true
|
|
27948
28088
|
});
|
|
27949
|
-
})(Object.getOwnPropertyDescriptor(Run.prototype, "startedAt").get, "step//@workflow/core/runtime/run@5.0.0-beta.
|
|
28089
|
+
})(Object.getOwnPropertyDescriptor(Run.prototype, "startedAt").get, "step//@workflow/core/runtime/run@5.0.0-beta.30//Run#startedAt");
|
|
27950
28090
|
(function(__wf_fn, __wf_id) {
|
|
27951
28091
|
var __wf_sym = /* @__PURE__ */ Symbol.for("@workflow/core//registeredSteps"), __wf_reg = globalThis[__wf_sym] || (globalThis[__wf_sym] = /* @__PURE__ */ new Map());
|
|
27952
28092
|
__wf_reg.set(__wf_id, __wf_fn);
|
|
@@ -27955,7 +28095,7 @@ var Run = class _Run {
|
|
|
27955
28095
|
value: "completedAt",
|
|
27956
28096
|
configurable: true
|
|
27957
28097
|
});
|
|
27958
|
-
})(Object.getOwnPropertyDescriptor(Run.prototype, "completedAt").get, "step//@workflow/core/runtime/run@5.0.0-beta.
|
|
28098
|
+
})(Object.getOwnPropertyDescriptor(Run.prototype, "completedAt").get, "step//@workflow/core/runtime/run@5.0.0-beta.30//Run#completedAt");
|
|
27959
28099
|
(function(__wf_cls, __wf_id) {
|
|
27960
28100
|
var __wf_sym = /* @__PURE__ */ Symbol.for("workflow-class-registry"), __wf_reg = globalThis[__wf_sym] || (globalThis[__wf_sym] = /* @__PURE__ */ new Map());
|
|
27961
28101
|
__wf_reg.set(__wf_id, __wf_cls);
|
|
@@ -27965,7 +28105,7 @@ var Run = class _Run {
|
|
|
27965
28105
|
enumerable: false,
|
|
27966
28106
|
configurable: false
|
|
27967
28107
|
});
|
|
27968
|
-
})(Run, "class//@workflow/core/runtime/run@5.0.0-beta.
|
|
28108
|
+
})(Run, "class//@workflow/core/runtime/run@5.0.0-beta.30//Run");
|
|
27969
28109
|
|
|
27970
28110
|
// ../workflow/dist/stdlib.js
|
|
27971
28111
|
async function fetch2(...args) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@workflow/world-testing",
|
|
3
|
-
"version": "5.0.0-beta.
|
|
3
|
+
"version": "5.0.0-beta.30",
|
|
4
4
|
"description": "Testing utilities and World implementation for Workflow SDK",
|
|
5
5
|
"main": "dist/src/index.mjs",
|
|
6
6
|
"files": [
|
|
@@ -21,12 +21,12 @@
|
|
|
21
21
|
"hono": "4.12.25",
|
|
22
22
|
"jsonlines": "0.1.1",
|
|
23
23
|
"zod": "~4.3.6",
|
|
24
|
-
"@workflow/cli": "5.0.0-beta.
|
|
25
|
-
"@workflow/core": "5.0.0-beta.
|
|
24
|
+
"@workflow/cli": "5.0.0-beta.30",
|
|
25
|
+
"@workflow/core": "5.0.0-beta.30",
|
|
26
26
|
"@workflow/utils": "5.0.0-beta.6",
|
|
27
|
-
"@workflow/world": "5.0.0-beta.
|
|
28
|
-
"@workflow/world-local": "5.0.0-beta.
|
|
29
|
-
"workflow": "5.0.0-beta.
|
|
27
|
+
"@workflow/world": "5.0.0-beta.18",
|
|
28
|
+
"@workflow/world-local": "5.0.0-beta.26",
|
|
29
|
+
"workflow": "5.0.0-beta.30"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@types/jsonlines": "0.1.5",
|