@workflow/web 5.0.0-beta.13 → 5.0.0-beta.15
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/build/client/assets/{highlighted-body-B3W2YXNL-B8ZRlnzz.js → highlighted-body-B3W2YXNL-BQ1pmB9V.js} +1 -1
- package/build/client/assets/{home-1yC3MOjQ.js → home-DmsdVk2U.js} +2 -2
- package/build/client/assets/{manifest-9f37c22f.js → manifest-67209c1f.js} +1 -1
- package/build/client/assets/{mermaid-3ZIDBTTL-BDM4-x6u.js → mermaid-3ZIDBTTL-BMWEihLr.js} +177 -154
- package/build/client/assets/{mermaid-3ZIDBTTL-DKxHcEOp.css → mermaid-3ZIDBTTL-CVTQRy2j.css} +1 -1
- package/build/client/assets/{root-C5RLIKj5.js → root-BABNjrUh.js} +1 -1
- package/build/client/assets/{run-detail-DM1PDAnQ.js → run-detail-9xQOGhVk.js} +53 -15
- package/build/client/assets/server-build-Ik-p0gUh.css +1 -0
- package/build/client/assets/{workflow-graph-viewer-C8H50hkM.js → workflow-graph-viewer-fgQ2XQ5R.js} +1 -1
- package/build/server/assets/{app-eXXkzWLS.js → app-DM9e_6xn.js} +1 -1
- package/build/server/assets/{highlighted-body-B3W2YXNL-DMxq-VLe.js → highlighted-body-B3W2YXNL-tYGHwGrY.js} +2 -2
- package/build/server/assets/index-8Fb8OEQ2.js +95 -0
- package/build/server/assets/index-B8YoYr9f.js +1117 -0
- package/build/server/assets/{mermaid-3ZIDBTTL-DNPNsNRF.js → mermaid-3ZIDBTTL-EN1JYLRP.js} +2 -2
- package/build/server/assets/{server-build-CSP1Aknr.js → server-build-CZXlov2m.js} +852 -1317
- package/build/server/assets/{token-DOrkjd5O.js → token-CDoC3gHn.js} +2 -2
- package/build/server/assets/{token-util-Hv7wRzsW.js → token-util-C02bLOPS.js} +2 -2
- package/build/server/index.js +1 -1
- package/package.json +5 -5
- package/build/client/assets/server-build-CNnlgxpd.css +0 -1
- package/build/server/assets/index-BjEgWhxl.js +0 -89
|
@@ -14,7 +14,7 @@ var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "
|
|
|
14
14
|
var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
|
|
15
15
|
var __superGet = (cls, obj, key) => __reflectGet(__getProtoOf(cls), key, obj);
|
|
16
16
|
var _a2, _b, _c, _d, _listeners, _onabort, _reader, _root, _hasMagic, _uflag, _parts, _parent, _parentIndex, _negs, _filledNegs, _options, _toString, _emptyExt, _AST_instances, fillNegs_fn, _AST_static, parseAST_fn, canAdoptWithSpace_fn, canAdopt_fn, canAdoptType_fn, adoptWithSpace_fn, adopt_fn, canUsurpType_fn, canUsurp_fn, usurp_fn, flatten_fn, partsToRegExp_fn, parseGlob_fn, _Minimatch_instances, matchGlobstar_fn, matchGlobStarBodySections_fn, matchOne_fn, _worldPromise, _Run_instances, lazyWorldPromise_get, _encryptionKeyPromise, _resilientStart, getEncryptionKey_fn, getEncryptionKeyLazily_fn, pollReturnValue_fn;
|
|
17
|
-
import { a as requireReact, S as ServerRouter, c as createReadableStreamFromReadable, r as reactExports, g as getDefaultExportFromCjs, R as React, b as ReactExports, w as withComponentProps, d as withErrorBoundaryProps, M as Meta, L as Links, e as ScrollRestoration, f as Scripts, O as Outlet, u as useNavigate, h as useSearchParams, i as Link$1, j as useRouteError, k as isRouteErrorResponse, l as useLocation, m as useParams } from "./app-
|
|
17
|
+
import { a as requireReact, S as ServerRouter, c as createReadableStreamFromReadable, r as reactExports, g as getDefaultExportFromCjs, R as React, b as ReactExports, w as withComponentProps, d as withErrorBoundaryProps, M as Meta, L as Links, e as ScrollRestoration, f as Scripts, O as Outlet, u as useNavigate, h as useSearchParams, i as Link$1, j as useRouteError, k as isRouteErrorResponse, l as useLocation, m as useParams } from "./app-DM9e_6xn.js";
|
|
18
18
|
import require$$0$4, { PassThrough } from "node:stream";
|
|
19
19
|
import require$$0 from "util";
|
|
20
20
|
import require$$1 from "crypto";
|
|
@@ -24066,10 +24066,10 @@ const computePosition$1 = async (reference, floating, config2) => {
|
|
|
24066
24066
|
const {
|
|
24067
24067
|
placement = "bottom",
|
|
24068
24068
|
strategy = "absolute",
|
|
24069
|
-
middleware
|
|
24069
|
+
middleware = [],
|
|
24070
24070
|
platform: platform2
|
|
24071
24071
|
} = config2;
|
|
24072
|
-
const validMiddleware =
|
|
24072
|
+
const validMiddleware = middleware.filter(Boolean);
|
|
24073
24073
|
const rtl = await (platform2.isRTL == null ? void 0 : platform2.isRTL(floating));
|
|
24074
24074
|
let rects = await platform2.getElementRects({
|
|
24075
24075
|
reference,
|
|
@@ -25551,7 +25551,7 @@ function useFloating(options) {
|
|
|
25551
25551
|
const {
|
|
25552
25552
|
placement = "bottom",
|
|
25553
25553
|
strategy = "absolute",
|
|
25554
|
-
middleware
|
|
25554
|
+
middleware = [],
|
|
25555
25555
|
platform: platform2,
|
|
25556
25556
|
elements: {
|
|
25557
25557
|
reference: externalReference,
|
|
@@ -25569,9 +25569,9 @@ function useFloating(options) {
|
|
|
25569
25569
|
middlewareData: {},
|
|
25570
25570
|
isPositioned: false
|
|
25571
25571
|
});
|
|
25572
|
-
const [latestMiddleware, setLatestMiddleware] = reactExports.useState(
|
|
25573
|
-
if (!deepEqual(latestMiddleware,
|
|
25574
|
-
setLatestMiddleware(
|
|
25572
|
+
const [latestMiddleware, setLatestMiddleware] = reactExports.useState(middleware);
|
|
25573
|
+
if (!deepEqual(latestMiddleware, middleware)) {
|
|
25574
|
+
setLatestMiddleware(middleware);
|
|
25575
25575
|
}
|
|
25576
25576
|
const [_reference, _setReference] = reactExports.useState(null);
|
|
25577
25577
|
const [_floating, _setFloating] = reactExports.useState(null);
|
|
@@ -30734,6 +30734,41 @@ function formatDuration(ms2, compact = false) {
|
|
|
30734
30734
|
parts.push(`${seconds}s`);
|
|
30735
30735
|
return parts.join(" ");
|
|
30736
30736
|
}
|
|
30737
|
+
const preciseSecondsFormatter = new Intl.NumberFormat(void 0, {
|
|
30738
|
+
minimumFractionDigits: 2,
|
|
30739
|
+
maximumFractionDigits: 2
|
|
30740
|
+
});
|
|
30741
|
+
function formatDurationPrecise(ms2) {
|
|
30742
|
+
if (ms2 === 0) {
|
|
30743
|
+
return "0s";
|
|
30744
|
+
}
|
|
30745
|
+
if (ms2 < MS_IN_SECOND) {
|
|
30746
|
+
const roundedMs = Math.round(ms2);
|
|
30747
|
+
if (roundedMs < MS_IN_SECOND) {
|
|
30748
|
+
return `${roundedMs}ms`;
|
|
30749
|
+
}
|
|
30750
|
+
}
|
|
30751
|
+
const normalizedMs = Math.round(ms2 / 10) * 10;
|
|
30752
|
+
if (normalizedMs < MS_IN_MINUTE) {
|
|
30753
|
+
return `${preciseSecondsFormatter.format(normalizedMs / MS_IN_SECOND)}s`;
|
|
30754
|
+
}
|
|
30755
|
+
const days = Math.floor(normalizedMs / MS_IN_DAY);
|
|
30756
|
+
const hours = Math.floor(normalizedMs % MS_IN_DAY / MS_IN_HOUR);
|
|
30757
|
+
const minutes = Math.floor(normalizedMs % MS_IN_HOUR / MS_IN_MINUTE);
|
|
30758
|
+
const seconds = normalizedMs % MS_IN_MINUTE / MS_IN_SECOND;
|
|
30759
|
+
const parts = [];
|
|
30760
|
+
if (days > 0) {
|
|
30761
|
+
parts.push(`${days}d`);
|
|
30762
|
+
}
|
|
30763
|
+
if (hours > 0) {
|
|
30764
|
+
parts.push(`${hours}h`);
|
|
30765
|
+
}
|
|
30766
|
+
if (minutes > 0) {
|
|
30767
|
+
parts.push(`${minutes}m`);
|
|
30768
|
+
}
|
|
30769
|
+
parts.push(`${preciseSecondsFormatter.format(seconds)}s`);
|
|
30770
|
+
return parts.join(" ");
|
|
30771
|
+
}
|
|
30737
30772
|
function isDoStreamStep(stepName) {
|
|
30738
30773
|
return stepName.endsWith("//doStreamStep");
|
|
30739
30774
|
}
|
|
@@ -48597,10 +48632,11 @@ const RESERVED_ATTRIBUTE_KEY_PREFIX = "$";
|
|
|
48597
48632
|
const ATTRIBUTE_KEY_MAX_LENGTH = 256;
|
|
48598
48633
|
const ATTRIBUTE_VALUE_MAX_BYTES = 256;
|
|
48599
48634
|
const ATTRIBUTE_MAX_PER_RUN = 64;
|
|
48600
|
-
object$1({
|
|
48635
|
+
const AttributeChangeSchema = object$1({
|
|
48601
48636
|
key: string$3(),
|
|
48602
48637
|
value: union([string$3(), _null()])
|
|
48603
48638
|
});
|
|
48639
|
+
const AttributeChangesSchema = array$1(AttributeChangeSchema);
|
|
48604
48640
|
class AttributeValidationError extends Error {
|
|
48605
48641
|
constructor(message2) {
|
|
48606
48642
|
super(message2);
|
|
@@ -48725,6 +48761,8 @@ const EventTypeSchema = _enum([
|
|
|
48725
48761
|
"run_completed",
|
|
48726
48762
|
"run_failed",
|
|
48727
48763
|
"run_cancelled",
|
|
48764
|
+
// Run attribute events
|
|
48765
|
+
"attr_set",
|
|
48728
48766
|
// Step lifecycle events
|
|
48729
48767
|
"step_created",
|
|
48730
48768
|
"step_completed",
|
|
@@ -48840,13 +48878,34 @@ const WaitCompletedEventSchema = BaseEventSchema.extend({
|
|
|
48840
48878
|
resumeAt: date$2().optional()
|
|
48841
48879
|
}).optional()
|
|
48842
48880
|
});
|
|
48881
|
+
const AttributeWriterSchema = discriminatedUnion("type", [
|
|
48882
|
+
object$1({
|
|
48883
|
+
type: literal("workflow")
|
|
48884
|
+
}),
|
|
48885
|
+
object$1({
|
|
48886
|
+
type: literal("step"),
|
|
48887
|
+
stepId: string$3(),
|
|
48888
|
+
attempt: number$3()
|
|
48889
|
+
})
|
|
48890
|
+
]);
|
|
48891
|
+
const AttrSetEventSchema = BaseEventSchema.extend({
|
|
48892
|
+
eventType: literal("attr_set"),
|
|
48893
|
+
correlationId: string$3().optional(),
|
|
48894
|
+
eventData: object$1({
|
|
48895
|
+
changes: AttributeChangesSchema,
|
|
48896
|
+
writer: AttributeWriterSchema,
|
|
48897
|
+
allowReservedAttributes: literal(true).optional()
|
|
48898
|
+
})
|
|
48899
|
+
});
|
|
48843
48900
|
const RunCreatedEventSchema = BaseEventSchema.extend({
|
|
48844
48901
|
eventType: literal("run_created"),
|
|
48845
48902
|
eventData: object$1({
|
|
48846
48903
|
deploymentId: string$3(),
|
|
48847
48904
|
workflowName: string$3(),
|
|
48848
48905
|
input: SerializedDataSchema,
|
|
48849
|
-
executionContext: record(string$3(), any()).optional()
|
|
48906
|
+
executionContext: record(string$3(), any()).optional(),
|
|
48907
|
+
attributes: record(string$3(), string$3()).optional(),
|
|
48908
|
+
allowReservedAttributes: literal(true).optional()
|
|
48850
48909
|
})
|
|
48851
48910
|
});
|
|
48852
48911
|
const RunStartedEventSchema = BaseEventSchema.extend({
|
|
@@ -48855,7 +48914,9 @@ const RunStartedEventSchema = BaseEventSchema.extend({
|
|
|
48855
48914
|
input: SerializedDataSchema.optional(),
|
|
48856
48915
|
deploymentId: string$3().optional(),
|
|
48857
48916
|
workflowName: string$3().optional(),
|
|
48858
|
-
executionContext: record(string$3(), any()).optional()
|
|
48917
|
+
executionContext: record(string$3(), any()).optional(),
|
|
48918
|
+
attributes: record(string$3(), string$3()).optional(),
|
|
48919
|
+
allowReservedAttributes: literal(true).optional()
|
|
48859
48920
|
}).optional()
|
|
48860
48921
|
});
|
|
48861
48922
|
const RunCompletedEventSchema = BaseEventSchema.extend({
|
|
@@ -48887,6 +48948,7 @@ discriminatedUnion("eventType", [
|
|
|
48887
48948
|
RunCompletedEventSchema,
|
|
48888
48949
|
RunFailedEventSchema,
|
|
48889
48950
|
RunCancelledEventSchema,
|
|
48951
|
+
AttrSetEventSchema,
|
|
48890
48952
|
// Step lifecycle events
|
|
48891
48953
|
StepCreatedEventSchema,
|
|
48892
48954
|
StepCompletedEventSchema,
|
|
@@ -48908,6 +48970,7 @@ const AllEventsSchema = discriminatedUnion("eventType", [
|
|
|
48908
48970
|
RunCompletedEventSchema,
|
|
48909
48971
|
RunFailedEventSchema,
|
|
48910
48972
|
RunCancelledEventSchema,
|
|
48973
|
+
AttrSetEventSchema,
|
|
48911
48974
|
// Step lifecycle events
|
|
48912
48975
|
StepCreatedEventSchema,
|
|
48913
48976
|
StepCompletedEventSchema,
|
|
@@ -48944,11 +49007,30 @@ const HookSchema = object$1({
|
|
|
48944
49007
|
isWebhook: boolean$3().optional(),
|
|
48945
49008
|
isSystem: boolean$3().optional()
|
|
48946
49009
|
});
|
|
48947
|
-
const QueuePrefix =
|
|
48948
|
-
|
|
48949
|
-
|
|
48950
|
-
|
|
48951
|
-
|
|
49010
|
+
const QueuePrefix = string$3().regex(/^__(?:[a-z][a-z0-9]*_)?wkf_(?:workflow|step)_$/, "Must match __wkf_{workflow|step}_ or __{namespace}_wkf_{workflow|step}_");
|
|
49011
|
+
const ValidQueueName = string$3().regex(/^__(?:[a-z][a-z0-9]*_)?wkf_(?:workflow|step)_.+$/, "Must be a valid queue name with a recognized prefix");
|
|
49012
|
+
const QueueNamespace = string$3().regex(/^[a-z][a-z0-9]*$/, "Must be lowercase alphanumeric, starting with a letter");
|
|
49013
|
+
function resolveQueueNamespace(namespace2) {
|
|
49014
|
+
return namespace2 ?? process.env.WORKFLOW_QUEUE_NAMESPACE ?? void 0;
|
|
49015
|
+
}
|
|
49016
|
+
function getQueueTopicPrefix(kind, namespace2) {
|
|
49017
|
+
if (namespace2 !== void 0) {
|
|
49018
|
+
QueueNamespace.parse(namespace2);
|
|
49019
|
+
return `__${namespace2}_wkf_${kind}_`;
|
|
49020
|
+
}
|
|
49021
|
+
return `__wkf_${kind}_`;
|
|
49022
|
+
}
|
|
49023
|
+
function parseQueueName(name2) {
|
|
49024
|
+
const match2 = name2.match(/^(__(?:[a-z][a-z0-9]*_)?wkf_(workflow|step)_)(.+)$/);
|
|
49025
|
+
if (!match2) {
|
|
49026
|
+
throw new Error(`Invalid queue name: ${name2}`);
|
|
49027
|
+
}
|
|
49028
|
+
return {
|
|
49029
|
+
prefix: QueuePrefix.parse(match2[1]),
|
|
49030
|
+
kind: match2[2],
|
|
49031
|
+
id: match2[3]
|
|
49032
|
+
};
|
|
49033
|
+
}
|
|
48952
49034
|
const MessageId = string$3().brand().describe("A stored queue message ID");
|
|
48953
49035
|
const TraceCarrierSchema = record(string$3(), string$3());
|
|
48954
49036
|
const RunInputSchema = object$1({
|
|
@@ -48956,7 +49038,9 @@ const RunInputSchema = object$1({
|
|
|
48956
49038
|
deploymentId: string$3(),
|
|
48957
49039
|
workflowName: string$3(),
|
|
48958
49040
|
specVersion: number$3(),
|
|
48959
|
-
executionContext: record(string$3(), any()).optional()
|
|
49041
|
+
executionContext: record(string$3(), any()).optional(),
|
|
49042
|
+
/** Initial plaintext run attributes, for resilient run creation. */
|
|
49043
|
+
attributes: record(string$3(), string$3()).optional()
|
|
48960
49044
|
});
|
|
48961
49045
|
const WorkflowInvokePayloadSchema = object$1({
|
|
48962
49046
|
runId: string$3(),
|
|
@@ -49151,7 +49235,8 @@ object$1({
|
|
|
49151
49235
|
const SPEC_VERSION_LEGACY = 1;
|
|
49152
49236
|
const SPEC_VERSION_SUPPORTS_EVENT_SOURCING = 2;
|
|
49153
49237
|
const SPEC_VERSION_SUPPORTS_CBOR_QUEUE_TRANSPORT = 3;
|
|
49154
|
-
const
|
|
49238
|
+
const SPEC_VERSION_SUPPORTS_ATTRIBUTES = 4;
|
|
49239
|
+
const SPEC_VERSION_CURRENT = SPEC_VERSION_SUPPORTS_ATTRIBUTES;
|
|
49155
49240
|
function isLegacySpecVersion(v2) {
|
|
49156
49241
|
return v2 === void 0 || v2 === null || v2 <= SPEC_VERSION_LEGACY;
|
|
49157
49242
|
}
|
|
@@ -78252,17 +78337,17 @@ function trough() {
|
|
|
78252
78337
|
return pipeline;
|
|
78253
78338
|
}
|
|
78254
78339
|
}
|
|
78255
|
-
function wrap(
|
|
78340
|
+
function wrap(middleware, callback) {
|
|
78256
78341
|
let called;
|
|
78257
78342
|
return wrapped;
|
|
78258
78343
|
function wrapped(...parameters) {
|
|
78259
|
-
const fnExpectsCallback =
|
|
78344
|
+
const fnExpectsCallback = middleware.length > parameters.length;
|
|
78260
78345
|
let result;
|
|
78261
78346
|
if (fnExpectsCallback) {
|
|
78262
78347
|
parameters.push(done);
|
|
78263
78348
|
}
|
|
78264
78349
|
try {
|
|
78265
|
-
result =
|
|
78350
|
+
result = middleware.apply(this, parameters);
|
|
78266
78351
|
} catch (error2) {
|
|
78267
78352
|
const exception = (
|
|
78268
78353
|
/** @type {Error} */
|
|
@@ -80651,7 +80736,7 @@ var tn = f("block", "before:content-[counter(line)]", "before:inline-block", "be
|
|
|
80651
80736
|
var et = ({ className: e, language: t, style: o, isIncomplete: n, ...s2 }) => jsxRuntimeExports.jsx("div", { className: f("my-4 flex w-full flex-col gap-2 rounded-xl border border-border bg-sidebar p-2", e), "data-incomplete": n || void 0, "data-language": t, "data-streamdown": "code-block", style: { contentVisibility: "auto", containIntrinsicSize: "auto 200px", ...o }, ...s2 });
|
|
80652
80737
|
var Se = reactExports.createContext({ code: "" }), de = () => reactExports.useContext(Se);
|
|
80653
80738
|
var ot = ({ language: e }) => jsxRuntimeExports.jsx("div", { className: "flex h-8 items-center text-muted-foreground text-xs", "data-language": e, "data-streamdown": "code-block-header", children: jsxRuntimeExports.jsx("span", { className: "ml-1 font-mono lowercase", children: e }) });
|
|
80654
|
-
var cn$1 = /\n+$/, dn = reactExports.lazy(() => import("./highlighted-body-B3W2YXNL-
|
|
80739
|
+
var cn$1 = /\n+$/, dn = reactExports.lazy(() => import("./highlighted-body-B3W2YXNL-tYGHwGrY.js").then((e) => ({ default: e.HighlightedCodeBlockBody }))), rt = ({ code: e, language: t, className: o, children: n, isIncomplete: s2 = false, ...r2 }) => {
|
|
80655
80740
|
let i = reactExports.useMemo(() => e.replace(cn$1, ""), [e]), c = reactExports.useMemo(() => ({ bg: "transparent", fg: "inherit", tokens: i.split(`
|
|
80656
80741
|
`).map((a2) => [{ content: a2, color: "inherit", bgColor: "transparent", htmlStyle: {}, offset: 0 }]) }), [i]);
|
|
80657
80742
|
return jsxRuntimeExports.jsx(Se.Provider, { value: { code: e }, children: jsxRuntimeExports.jsxs(et, { isIncomplete: s2, language: t, children: [jsxRuntimeExports.jsx(ot, { language: t }), n ? jsxRuntimeExports.jsx("div", { className: "pointer-events-none sticky top-2 z-10 -mt-10 flex h-8 items-center justify-end", children: jsxRuntimeExports.jsx("div", { className: "pointer-events-auto flex shrink-0 items-center gap-2 rounded-md border border-sidebar bg-sidebar/80 px-1.5 py-1 supports-[backdrop-filter]:bg-sidebar/70 supports-[backdrop-filter]:backdrop-blur", "data-streamdown": "code-block-actions", children: n }) }) : null, jsxRuntimeExports.jsx(reactExports.Suspense, { fallback: jsxRuntimeExports.jsx(Qe, { className: o, language: t, result: c, ...r2 }), children: jsxRuntimeExports.jsx(dn, { className: o, code: i, language: t, raw: c, ...r2 }) })] }) });
|
|
@@ -80973,7 +81058,7 @@ var Dt = ({ children: e, className: t, onDownload: o, onError: n }) => {
|
|
|
80973
81058
|
}, []), jsxRuntimeExports.jsxs("div", { className: "relative", ref: i, children: [jsxRuntimeExports.jsx("button", { className: f("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50", t), disabled: c, onClick: () => r2(!s2), title: "Download table", type: "button", children: e != null ? e : jsxRuntimeExports.jsx(Z, { size: 14 }) }), s2 ? jsxRuntimeExports.jsxs("div", { className: "absolute top-full right-0 z-10 mt-1 min-w-[120px] overflow-hidden rounded-md border border-border bg-background shadow-lg", children: [jsxRuntimeExports.jsx("button", { className: "w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40", onClick: () => a2("csv"), title: "Download table as CSV", type: "button", children: "CSV" }), jsxRuntimeExports.jsx("button", { className: "w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40", onClick: () => a2("markdown"), title: "Download table as Markdown", type: "button", children: "Markdown" })] }) : null] });
|
|
80974
81059
|
};
|
|
80975
81060
|
var Vt = ({ children: e, className: t, showControls: o, ...n }) => jsxRuntimeExports.jsxs("div", { className: "my-4 flex flex-col gap-2 rounded-lg border border-border bg-sidebar p-2", "data-streamdown": "table-wrapper", children: [o ? jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-end gap-1", children: [jsxRuntimeExports.jsx(Ht, {}), jsxRuntimeExports.jsx(Dt, {})] }) : null, jsxRuntimeExports.jsx("div", { className: "border-collapse overflow-x-auto overscroll-y-auto rounded-md border border-border bg-background", children: jsxRuntimeExports.jsx("table", { className: f("w-full divide-y divide-border", t), "data-streamdown": "table", ...n, children: e }) })] });
|
|
80976
|
-
var Jn = reactExports.lazy(() => import("./mermaid-3ZIDBTTL-
|
|
81061
|
+
var Jn = reactExports.lazy(() => import("./mermaid-3ZIDBTTL-EN1JYLRP.js").then((e) => ({ default: e.Mermaid }))), Kn = /language-([^\s]+)/;
|
|
80977
81062
|
function ke(e, t) {
|
|
80978
81063
|
if (!(e != null && e.position || t != null && t.position)) return true;
|
|
80979
81064
|
if (!(e != null && e.position && (t != null && t.position))) return false;
|
|
@@ -81667,6 +81752,7 @@ const attributeOrder = [
|
|
|
81667
81752
|
"eventData",
|
|
81668
81753
|
"input",
|
|
81669
81754
|
"output",
|
|
81755
|
+
"attributes",
|
|
81670
81756
|
"resumeAt"
|
|
81671
81757
|
];
|
|
81672
81758
|
const sortByAttributeOrder = (a2, b2) => {
|
|
@@ -81685,6 +81771,7 @@ const attributeDisplayNames = {
|
|
|
81685
81771
|
runId: "Run ID",
|
|
81686
81772
|
token: "Token",
|
|
81687
81773
|
eventType: "Event Type",
|
|
81774
|
+
errorCode: "Error Code",
|
|
81688
81775
|
correlationId: "Correlation ID",
|
|
81689
81776
|
deploymentId: "Deployment ID",
|
|
81690
81777
|
specVersion: "Spec Version",
|
|
@@ -81783,12 +81870,12 @@ const attributeToDisplayFn = {
|
|
|
81783
81870
|
environment: (_value) => null,
|
|
81784
81871
|
executionContext: (_value) => null,
|
|
81785
81872
|
// Attributes MVP — string-string metadata attached to the run.
|
|
81786
|
-
// Rendered
|
|
81787
|
-
// hasDisplayContent gate
|
|
81873
|
+
// Rendered in its own collapsible DetailCard; if empty/missing, hidden
|
|
81874
|
+
// by the hasDisplayContent gate.
|
|
81788
81875
|
attributes: (value) => {
|
|
81789
81876
|
if (!hasDisplayContent(value))
|
|
81790
81877
|
return null;
|
|
81791
|
-
return JsonBlock(value);
|
|
81878
|
+
return jsxRuntimeExports.jsx(DetailCard, { summary: "Attributes", children: JsonBlock(value) });
|
|
81792
81879
|
},
|
|
81793
81880
|
// Dates — wrapped with TimestampTooltip showing UTC/local + relative time
|
|
81794
81881
|
createdAt: timestampWithTooltipOrNull,
|
|
@@ -81879,12 +81966,14 @@ const resolvableAttributes = [
|
|
|
81879
81966
|
"output",
|
|
81880
81967
|
"error",
|
|
81881
81968
|
"metadata",
|
|
81969
|
+
"attributes",
|
|
81882
81970
|
"eventData"
|
|
81883
81971
|
];
|
|
81884
81972
|
const selfHeaderedAttributes = /* @__PURE__ */ new Set([
|
|
81885
81973
|
"input",
|
|
81886
81974
|
"output",
|
|
81887
81975
|
"error",
|
|
81976
|
+
"attributes",
|
|
81888
81977
|
"eventData"
|
|
81889
81978
|
]);
|
|
81890
81979
|
const ExpiredDataMessage = () => jsxRuntimeExports.jsx("div", { className: "text-copy-12 rounded-md border p-4 my-2", style: {
|
|
@@ -82113,13 +82202,13 @@ function EventDataBlock({ eventType, data }) {
|
|
|
82113
82202
|
}
|
|
82114
82203
|
return jsxRuntimeExports.jsx(CopyableDataBlock, { data });
|
|
82115
82204
|
}
|
|
82116
|
-
function EventsList({ events: events2, isLoading = false, error: error2, onLoadEventData, encryptionKey }) {
|
|
82205
|
+
function EventsList({ events: events2, isLoading = false, error: error2, onLoadEventData, onStreamClick, onRunClick, encryptionKey }) {
|
|
82117
82206
|
const sortedEvents2 = reactExports.useMemo(() => [...events2].sort((a2, b2) => new Date(a2.createdAt).getTime() - new Date(b2.createdAt).getTime()), [events2]);
|
|
82118
82207
|
const hasEvents = sortedEvents2.length > 0 && !error2;
|
|
82119
82208
|
if (!hasEvents && !isLoading) {
|
|
82120
82209
|
return jsxRuntimeExports.jsx(DetailCard, { summary: "Events", disabled: true });
|
|
82121
82210
|
}
|
|
82122
|
-
return jsxRuntimeExports.jsx(DetailCard, { summary: "Events", contentClassName: "mb-0", defaultOpen: true, children: isLoading ? jsxRuntimeExports.jsx("div", { className: "flex flex-col -mx-4", children: [0, 1, 2].map((i) => jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between gap-3 bg-background-200 px-4 py-2", children: [jsxRuntimeExports.jsx(Skeleton$2, { className: "h-4 w-32 rounded" }), jsxRuntimeExports.jsx(Skeleton$2, { className: "h-3 w-16 rounded" })] }, i)) }) : jsxRuntimeExports.jsx("div", { className: "flex flex-col -mx-4", children: sortedEvents2.map((event) => jsxRuntimeExports.jsx(EventItem, { event, onLoadEventData, encryptionKey }, event.eventId)) }) });
|
|
82211
|
+
return jsxRuntimeExports.jsx(RunClickContext.Provider, { value: onRunClick, children: jsxRuntimeExports.jsx(StreamClickContext.Provider, { value: onStreamClick, children: jsxRuntimeExports.jsx(DetailCard, { summary: "Events", contentClassName: "mb-0", defaultOpen: true, children: isLoading ? jsxRuntimeExports.jsx("div", { className: "flex flex-col -mx-4", children: [0, 1, 2].map((i) => jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between gap-3 bg-background-200 px-4 py-2", children: [jsxRuntimeExports.jsx(Skeleton$2, { className: "h-4 w-32 rounded" }), jsxRuntimeExports.jsx(Skeleton$2, { className: "h-3 w-16 rounded" })] }, i)) }) : jsxRuntimeExports.jsx("div", { className: "flex flex-col -mx-4", children: sortedEvents2.map((event) => jsxRuntimeExports.jsx(EventItem, { event, onLoadEventData, encryptionKey }, event.eventId)) }) }) }) });
|
|
82123
82212
|
}
|
|
82124
82213
|
const SidebarDataContext = reactExports.createContext(null);
|
|
82125
82214
|
SidebarDataContext.displayName = "SidebarDataContext";
|
|
@@ -82136,6 +82225,39 @@ function useSidebarData() {
|
|
|
82136
82225
|
function useSidebarDataOptional() {
|
|
82137
82226
|
return reactExports.useContext(SidebarDataContext);
|
|
82138
82227
|
}
|
|
82228
|
+
const hasField = (value, key) => key in value;
|
|
82229
|
+
function spanDetailMatchesSelection(detail, resource, resourceId) {
|
|
82230
|
+
if (!detail || typeof detail !== "object" || !resource || !resourceId) {
|
|
82231
|
+
return false;
|
|
82232
|
+
}
|
|
82233
|
+
switch (resource) {
|
|
82234
|
+
case "step":
|
|
82235
|
+
return hasField(detail, "stepId") && detail.stepId === resourceId;
|
|
82236
|
+
case "hook":
|
|
82237
|
+
return hasField(detail, "hookId") && detail.hookId === resourceId;
|
|
82238
|
+
case "sleep":
|
|
82239
|
+
return hasField(detail, "waitId") && detail.waitId === resourceId;
|
|
82240
|
+
case "run":
|
|
82241
|
+
return hasField(detail, "runId") && !("stepId" in detail) && !("hookId" in detail) && !("waitId" in detail) && detail.runId === resourceId;
|
|
82242
|
+
default:
|
|
82243
|
+
return false;
|
|
82244
|
+
}
|
|
82245
|
+
}
|
|
82246
|
+
function mergeSpanDetail(spanData, detail) {
|
|
82247
|
+
if (!detail || typeof detail !== "object") {
|
|
82248
|
+
return spanData;
|
|
82249
|
+
}
|
|
82250
|
+
if (!spanData || typeof spanData !== "object") {
|
|
82251
|
+
return detail;
|
|
82252
|
+
}
|
|
82253
|
+
const merged = { ...detail };
|
|
82254
|
+
for (const [key, value] of Object.entries(spanData)) {
|
|
82255
|
+
if (value !== void 0) {
|
|
82256
|
+
merged[key] = value;
|
|
82257
|
+
}
|
|
82258
|
+
}
|
|
82259
|
+
return merged;
|
|
82260
|
+
}
|
|
82139
82261
|
function isStep(data) {
|
|
82140
82262
|
return data !== null && typeof data === "object" && "stepId" in data;
|
|
82141
82263
|
}
|
|
@@ -82225,17 +82347,18 @@ function EntityDetailPanel({ run: run2, onStreamClick, onRunClick, spanDetailDat
|
|
|
82225
82347
|
]);
|
|
82226
82348
|
const error2 = spanDetailError ?? void 0;
|
|
82227
82349
|
const loading = spanDetailLoading ?? false;
|
|
82350
|
+
const matchedSpanDetailData = reactExports.useMemo(() => spanDetailMatchesSelection(spanDetailData, resource, resourceId) ? spanDetailData : null, [spanDetailData, resource, resourceId]);
|
|
82228
82351
|
const hookToken = reactExports.useMemo(() => {
|
|
82229
82352
|
if (resource !== "hook" || !resourceId)
|
|
82230
82353
|
return void 0;
|
|
82231
|
-
if (isHook(
|
|
82232
|
-
return
|
|
82354
|
+
if (isHook(matchedSpanDetailData) && matchedSpanDetailData.token) {
|
|
82355
|
+
return matchedSpanDetailData.token;
|
|
82233
82356
|
}
|
|
82234
82357
|
if (isHook(data) && data.token) {
|
|
82235
82358
|
return data.token;
|
|
82236
82359
|
}
|
|
82237
82360
|
return void 0;
|
|
82238
|
-
}, [resource, resourceId,
|
|
82361
|
+
}, [resource, resourceId, matchedSpanDetailData, data]);
|
|
82239
82362
|
reactExports.useEffect(() => {
|
|
82240
82363
|
if (error2 && selectedSpan && resource) {
|
|
82241
82364
|
toast2.error(`Failed to load ${resource} details`, {
|
|
@@ -82290,7 +82413,7 @@ function EntityDetailPanel({ run: run2, onStreamClick, onRunClick, spanDetailDat
|
|
|
82290
82413
|
}
|
|
82291
82414
|
try {
|
|
82292
82415
|
setResolvingHook(true);
|
|
82293
|
-
const candidate =
|
|
82416
|
+
const candidate = matchedSpanDetailData ?? data;
|
|
82294
82417
|
const hook = isHook(candidate) ? candidate : void 0;
|
|
82295
82418
|
await onResolveHook(hookToken, payload, hook);
|
|
82296
82419
|
toast2.success("Hook resolved", {
|
|
@@ -82308,8 +82431,8 @@ function EntityDetailPanel({ run: run2, onStreamClick, onRunClick, spanDetailDat
|
|
|
82308
82431
|
} finally {
|
|
82309
82432
|
setResolvingHook(false);
|
|
82310
82433
|
}
|
|
82311
|
-
}, [onResolveHook, hookToken, resolvingHook,
|
|
82312
|
-
const displayData =
|
|
82434
|
+
}, [onResolveHook, hookToken, resolvingHook, matchedSpanDetailData, data]);
|
|
82435
|
+
const displayData = reactExports.useMemo(() => mergeSpanDetail(data, matchedSpanDetailData), [data, matchedSpanDetailData]);
|
|
82313
82436
|
const moduleSpecifier = reactExports.useMemo(() => {
|
|
82314
82437
|
const displayRecord = displayData;
|
|
82315
82438
|
const displayStepName = displayRecord.stepName;
|
|
@@ -82338,7 +82461,7 @@ function EntityDetailPanel({ run: run2, onStreamClick, onRunClick, spanDetailDat
|
|
|
82338
82461
|
}, children: [jsxRuntimeExports.jsx(Zap, { className: "h-4 w-4" }), stoppingSleep ? "Waking up..." : "Wake Up Sleep"] }), resource === "hook" && canResolveHook && jsxRuntimeExports.jsxs("button", { type: "button", onClick: () => setShowResolveHookModal(true), disabled: resolvingHook, className: clsx("flex items-center justify-center gap-2 rounded-md px-3 py-2 text-sm font-medium", "disabled:opacity-50 disabled:cursor-not-allowed transition-colors", resolvingHook ? "opacity-50 cursor-not-allowed" : "cursor-pointer"), style: {
|
|
82339
82462
|
background: "var(--ds-gray-1000)",
|
|
82340
82463
|
color: "var(--ds-background-100)"
|
|
82341
|
-
}, children: [jsxRuntimeExports.jsx(Send, { className: "h-4 w-4" }), "Resolve Hook"] })] })] }), jsxRuntimeExports.jsx(AttributePanel, { data: displayData, moduleSpecifier, expiredAt: run2.expiredAt, isLoading: loading, error: error2 ?? void 0, onStreamClick, onRunClick, onDecrypt, isDecrypting, resource }), resource !== "run" && rawEvents && jsxRuntimeExports.jsx(EventsList, { events: rawEvents, onLoadEventData, encryptionKey })] }) }), jsxRuntimeExports.jsx(ResolveHookModal, { isOpen: showResolveHookModal, onClose: () => setShowResolveHookModal(false), onSubmit: handleResolveHook, isSubmitting: resolvingHook })] });
|
|
82464
|
+
}, children: [jsxRuntimeExports.jsx(Send, { className: "h-4 w-4" }), "Resolve Hook"] })] })] }), jsxRuntimeExports.jsx(AttributePanel, { data: displayData, moduleSpecifier, expiredAt: run2.expiredAt, isLoading: loading, error: error2 ?? void 0, onStreamClick, onRunClick, onDecrypt, isDecrypting, resource }), resource !== "run" && rawEvents && jsxRuntimeExports.jsx(EventsList, { events: rawEvents, onLoadEventData, onStreamClick, onRunClick, encryptionKey })] }) }), jsxRuntimeExports.jsx(ResolveHookModal, { isOpen: showResolveHookModal, onClose: () => setShowResolveHookModal(false), onSubmit: handleResolveHook, isSubmitting: resolvingHook })] });
|
|
82342
82465
|
}
|
|
82343
82466
|
const MAP_HEIGHT = 56;
|
|
82344
82467
|
const TIMELINE_PADDING = 8;
|
|
@@ -82503,7 +82626,7 @@ const eventFailed = "_eventFailed_1fmf2_1432";
|
|
|
82503
82626
|
const eventRetrying = "_eventRetrying_1fmf2_1441";
|
|
82504
82627
|
const eventHook = "_eventHook_1fmf2_1450";
|
|
82505
82628
|
const eventDefault = "_eventDefault_1fmf2_1459";
|
|
82506
|
-
const styles$
|
|
82629
|
+
const styles$2 = {
|
|
82507
82630
|
traceNode,
|
|
82508
82631
|
childRow,
|
|
82509
82632
|
spanNode,
|
|
@@ -82973,15 +83096,15 @@ const SEGMENT_LABELS = {
|
|
|
82973
83096
|
function SegmentLayer({ segments, spanDuration: spanDuration2 }) {
|
|
82974
83097
|
if (segments.length === 0)
|
|
82975
83098
|
return null;
|
|
82976
|
-
return jsxRuntimeExports.jsx("div", { className: styles$
|
|
82977
|
-
const className = styles$
|
|
83099
|
+
return jsxRuntimeExports.jsx("div", { className: styles$2.segmentLayer, children: segments.map((seg, i) => {
|
|
83100
|
+
const className = styles$2[SEGMENT_CLASS_MAP[seg.status]];
|
|
82978
83101
|
const segDuration = (seg.endFraction - seg.startFraction) * spanDuration2;
|
|
82979
83102
|
const label = SEGMENT_LABELS[seg.status];
|
|
82980
83103
|
const style2 = {
|
|
82981
83104
|
left: `${seg.startFraction * 100}%`,
|
|
82982
83105
|
width: `${(seg.endFraction - seg.startFraction) * 100}%`
|
|
82983
83106
|
};
|
|
82984
|
-
return jsxRuntimeExports.jsx("div", { className: `${styles$
|
|
83107
|
+
return jsxRuntimeExports.jsx("div", { className: `${styles$2.segment} ${String(className)}`, style: style2, title: label ? `${label} ${formatDuration(segDuration)}` : formatDuration(segDuration) }, `seg-${seg.status}-${String(i)}`);
|
|
82985
83108
|
}) });
|
|
82986
83109
|
}
|
|
82987
83110
|
function getSegmentTags(segments, spanDuration2) {
|
|
@@ -83010,7 +83133,7 @@ function TextContent({ node: node2, layout, durationMs, segmentTags }) {
|
|
|
83010
83133
|
return null;
|
|
83011
83134
|
}
|
|
83012
83135
|
const showTags = segmentTags && segmentTags.length > 0 && (layout.isHovered || layout.width > 200);
|
|
83013
|
-
return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsxs("span", { className: styles$
|
|
83136
|
+
return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsxs("span", { className: styles$2.spanName, children: [node2.label || node2.span.name, showTags ? segmentTags.map((tag, i) => jsxRuntimeExports.jsxs("span", { className: styles$2.segmentTag, children: [" · ", tag.label, " ", tag.duration] }, i)) : null] }), layout.isHuge ? jsxRuntimeExports.jsx("span", { className: styles$2.spanSpacer }) : null, layout.isHovered || layout.width > 128 ? jsxRuntimeExports.jsx("span", { className: styles$2.spanDuration, children: duration2 }) : null] });
|
|
83014
83137
|
}
|
|
83015
83138
|
function DefaultContent({ node: node2, layout }) {
|
|
83016
83139
|
return jsxRuntimeExports.jsx(TextContent, { node: node2, layout });
|
|
@@ -83133,8 +83256,8 @@ function getSpanLayout(resourceType, node2, root2, scale, scrollSnapshotRef) {
|
|
|
83133
83256
|
}
|
|
83134
83257
|
const getSpanColorClassName = (node2) => {
|
|
83135
83258
|
if (node2.isVercel)
|
|
83136
|
-
return String(styles$
|
|
83137
|
-
return String(styles$
|
|
83259
|
+
return String(styles$2.colorVercel);
|
|
83260
|
+
return String(styles$2[`color${node2.resourceIndex % 5}`]);
|
|
83138
83261
|
};
|
|
83139
83262
|
function getTerminalTimestamp(resourceType, node2) {
|
|
83140
83263
|
const events2 = node2.events;
|
|
@@ -83277,7 +83400,7 @@ const SpanComponent = reactExports.memo(function SpanComponent2({ node: node2, r
|
|
|
83277
83400
|
return () => cancelAnimationFrame(rafId);
|
|
83278
83401
|
}, [isLive, canonicalStartTime, scale]);
|
|
83279
83402
|
const renderNode = segmentNode;
|
|
83280
|
-
return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx("button", { "aria-label": `${span.name} - ${duration2}`, className: clsx(styles$
|
|
83403
|
+
return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx("button", { "aria-label": `${span.name} - ${duration2}`, className: clsx(styles$2.spanNode, layout.isHuge && styles$2.huge, layout.isSmall && styles$2.small, layout.isExpanded && styles$2.xHover, node2.isHighlighted ? styles$2.colorHighlight : getSpanColorClassName(node2), node2.isHighlighted === false && styles$2.unlit, customClassName, hasSegments2 && styles$2.hasSegments), "data-span-id": span.spanId, "data-start-time": segmentNode.startTime - root2.startTime, "data-right-side": layout.isNearRightSide, "data-selected": node2.isSelected ? "" : void 0, ref, style: getSpanStyle(layout, segmentNode, root2, scale), type: "button", children: jsxRuntimeExports.jsx(SpanContent, { durationMs, resourceType, node: renderNode, layout }) }), segmentNode.events && !layout.isSmall ? segmentNode.events.map((x2) => jsxRuntimeExports.jsx(SpanEventComponent, { customSpanEventClassNameFunc, event: x2, node: segmentNode, root: root2, scale, asBoundary: isWorkflowSpan }, x2.key)) : null] });
|
|
83281
83404
|
});
|
|
83282
83405
|
const BOUNDARY_LABELS = {
|
|
83283
83406
|
step_started: "Started",
|
|
@@ -83335,17 +83458,17 @@ const SpanEventComponent = reactExports.memo(function SpanEventComponent2({ even
|
|
|
83335
83458
|
const isLeftAligned = node2.duration <= 0 || (event.timestamp - node2.startTime) / node2.duration < 0.5;
|
|
83336
83459
|
const customClassName = customSpanEventClassNameFunc ? customSpanEventClassNameFunc(event) : "";
|
|
83337
83460
|
return jsxRuntimeExports.jsxs("div", { title: phaseDuration ? `${displayLabel} ${timestamp}
|
|
83338
|
-
${phaseLabel} ${phaseDuration}` : `${displayLabel} ${timestamp}`, className: clsx(styles$
|
|
83461
|
+
${phaseLabel} ${phaseDuration}` : `${displayLabel} ${timestamp}`, className: clsx(styles$2.spanNodeEvent, customClassName, asBoundary && styles$2.boundaryMarker, node2.isHighlighted ? styles$2.colorHighlight : getSpanColorClassName(node2), node2.isHighlighted === false && styles$2.unlit), "data-hovered": event.isHovered, ref, style: {
|
|
83339
83462
|
left,
|
|
83340
83463
|
top
|
|
83341
|
-
}, children: [jsxRuntimeExports.jsx("div", { className: clsx(styles$
|
|
83464
|
+
}, children: [jsxRuntimeExports.jsx("div", { className: clsx(styles$2.hoverInfo, isLeftAligned ? styles$2.alignStart : styles$2.alignEnd), children: asBoundary ? jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx("span", { className: styles$2.eventName, children: displayLabel }), jsxRuntimeExports.jsx("span", { className: styles$2.eventTimestamp, children: timestamp }), phaseDuration ? jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx("span", { className: styles$2.eventName, children: phaseLabel }), jsxRuntimeExports.jsx("span", { className: styles$2.eventTimestamp, children: phaseDuration })] }) : null] }) : jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx("span", { className: styles$2.eventName, children: name2 }), jsxRuntimeExports.jsx("span", { className: styles$2.eventTimestamp, children: timestamp })] }) }), asBoundary ? jsxRuntimeExports.jsx("div", { className: styles$2.boundaryLine }) : jsxRuntimeExports.jsx("div", { className: styles$2.eventDiamond })] });
|
|
83342
83465
|
});
|
|
83343
83466
|
const colorTokenMap = {
|
|
83344
83467
|
"gray-700": "var(--ds-gray-700)",
|
|
83345
83468
|
"gray-900": "var(--ds-gray-900)"
|
|
83346
83469
|
};
|
|
83347
83470
|
function IconChevronDown({ size: size2 = 16 }) {
|
|
83348
|
-
return jsxRuntimeExports.jsxs("svg", { width: size2, height: size2, viewBox: "0 0 24 24", fill: "none", "aria-hidden": true, className: styles$
|
|
83471
|
+
return jsxRuntimeExports.jsxs("svg", { width: size2, height: size2, viewBox: "0 0 24 24", fill: "none", "aria-hidden": true, className: styles$2.detailHeadingIcon, children: [jsxRuntimeExports.jsx("title", { children: "Chevron Down" }), jsxRuntimeExports.jsx("path", { d: "M6 9l6 6 6-6", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" })] });
|
|
83349
83472
|
}
|
|
83350
83473
|
function IconExternalSmall({ size: size2 = 16, color: color5 = "gray-900" }) {
|
|
83351
83474
|
const style2 = { color: colorTokenMap[color5] || color5 };
|
|
@@ -83360,7 +83483,7 @@ function Link(props) {
|
|
|
83360
83483
|
return jsxRuntimeExports.jsx("a", { className, href, ...rest, children: children2 });
|
|
83361
83484
|
}
|
|
83362
83485
|
function Skeleton$1({ width, height, rounded }) {
|
|
83363
|
-
return jsxRuntimeExports.jsx("span", { className: clsx(styles$
|
|
83486
|
+
return jsxRuntimeExports.jsx("span", { className: clsx(styles$2.skeleton, rounded && styles$2.skeletonRounded), style: { width, height }, "aria-hidden": true });
|
|
83364
83487
|
}
|
|
83365
83488
|
const EXPANDED_STORAGE_KEY_PREFIX = "vc-trace-span-exp:";
|
|
83366
83489
|
function DetailGroup({ name: name2, className = "", children: children2 }) {
|
|
@@ -83376,7 +83499,7 @@ function DetailGroup({ name: name2, className = "", children: children2 }) {
|
|
|
83376
83499
|
return willBeExpanded;
|
|
83377
83500
|
});
|
|
83378
83501
|
}, [name2]);
|
|
83379
|
-
return jsxRuntimeExports.jsxs("div", { className: clsx(styles$
|
|
83502
|
+
return jsxRuntimeExports.jsxs("div", { className: clsx(styles$2.detailGroup, isExpanded ? styles$2.expanded : styles$2.collapsed, className), children: [jsxRuntimeExports.jsxs("button", { className: styles$2.detailHeading, onClick: toggleExpanded, type: "button", children: [jsxRuntimeExports.jsx("span", { children: name2 }), jsxRuntimeExports.jsx(IconChevronDown, {})] }), isExpanded ? children2 : null] });
|
|
83380
83503
|
}
|
|
83381
83504
|
reactExports.memo(function EntrySpanLinks({ getQuickLinks, span }) {
|
|
83382
83505
|
const links = getQuickLinks(span);
|
|
@@ -83400,7 +83523,7 @@ function usePromise(promise2) {
|
|
|
83400
83523
|
}
|
|
83401
83524
|
function EntrySpanLink({ name: name2, link: linkPromise }) {
|
|
83402
83525
|
const link2 = usePromise(linkPromise);
|
|
83403
|
-
return jsxRuntimeExports.jsxs(Link, { as: link2 ? void 0 : "span", className: clsx(styles$
|
|
83526
|
+
return jsxRuntimeExports.jsxs(Link, { as: link2 ? void 0 : "span", className: clsx(styles$2.spanDetailPanelAttribute, styles$2.spanDetailPanelQuickLink), href: (link2 == null ? void 0 : link2.href) || "", children: [jsxRuntimeExports.jsx("span", { className: styles$2.spanDetailPanelAttributeKey, children: name2 }), jsxRuntimeExports.jsx("span", { className: clsx(styles$2.spanDetailPanelAttributeValue, styles$2.spanDetailPanelQuickLinkLabel), children: link2 ? jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [link2.label, link2.icon || jsxRuntimeExports.jsx(IconExternalSmall, { color: "gray-900" })] }) : jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx(Skeleton$1, { height: 18, width: 32 + name2.length * 8 }), jsxRuntimeExports.jsx(Skeleton$1, { height: 18, rounded: true, width: 18 })] }) })] });
|
|
83404
83527
|
}
|
|
83405
83528
|
function useImmediateStyle(ref) {
|
|
83406
83529
|
const styleRef = reactExports.useRef({});
|
|
@@ -83559,10 +83682,10 @@ reactExports.memo(function MiniMap({ timelineRef, rows, scale }) {
|
|
|
83559
83682
|
$timeline.removeEventListener("scroll", onScroll);
|
|
83560
83683
|
};
|
|
83561
83684
|
}, [timelineRef, thumbRatio, setThumbStyle]);
|
|
83562
|
-
return jsxRuntimeExports.jsxs("div", { className: styles$
|
|
83685
|
+
return jsxRuntimeExports.jsxs("div", { className: styles$2.mapContainer, ref: containerRef, style: {
|
|
83563
83686
|
width: thumbWidth > 0 ? mapWidth : "100%",
|
|
83564
83687
|
height: MAP_HEIGHT
|
|
83565
|
-
}, children: [jsxRuntimeExports.jsx("canvas", { className: styles$
|
|
83688
|
+
}, children: [jsxRuntimeExports.jsx("canvas", { className: styles$2.mapCanvas, height: MAP_HEIGHT * dpi, ref: canvasRef, style: { width: mapWidth, height: MAP_HEIGHT }, width: mapWidth * dpi }), jsxRuntimeExports.jsx("div", { className: styles$2.mapThumb, ref: thumbRef, style: {
|
|
83566
83689
|
transform: thumbStyle.transform,
|
|
83567
83690
|
width: thumbWidth > 0 ? thumbWidth : `calc(100% - ${TIMELINE_PADDING * 2}px)`,
|
|
83568
83691
|
top: 2,
|
|
@@ -84087,15 +84210,22 @@ function computeSleepSegmentsFromSpan(_startMs, duration2, _events) {
|
|
|
84087
84210
|
return [];
|
|
84088
84211
|
return [{ startFraction: 0, endFraction: 1, status: "sleeping" }];
|
|
84089
84212
|
}
|
|
84213
|
+
function runSegmentStatus(runStatus) {
|
|
84214
|
+
if (runStatus === "failed")
|
|
84215
|
+
return "failed";
|
|
84216
|
+
if (runStatus === "running" || runStatus === "pending")
|
|
84217
|
+
return "running";
|
|
84218
|
+
return "completed";
|
|
84219
|
+
}
|
|
84090
84220
|
function computeRunSegmentsFromSpan(startMs, duration2, activeStartMs, events2, attributes) {
|
|
84091
84221
|
const segments = [];
|
|
84092
84222
|
if (duration2 <= 0)
|
|
84093
84223
|
return segments;
|
|
84094
84224
|
const sorted = [...events2].map((e) => ({ name: e.name, time: getHighResInMs(e.timestamp) })).sort((a2, b2) => a2.time - b2.time);
|
|
84225
|
+
const runData = attributes == null ? void 0 : attributes.data;
|
|
84226
|
+
const runStatus = runData == null ? void 0 : runData.status;
|
|
84095
84227
|
const hasRunCreated = sorted.some((e) => e.name === "run_created");
|
|
84096
84228
|
if (!hasRunCreated) {
|
|
84097
|
-
const runData = attributes == null ? void 0 : attributes.data;
|
|
84098
|
-
const runStatus = runData == null ? void 0 : runData.status;
|
|
84099
84229
|
return computeV1RunSegments(startMs, duration2, activeStartMs, runStatus);
|
|
84100
84230
|
}
|
|
84101
84231
|
const failedEvent = sorted.find((e) => e.name === "run_failed");
|
|
@@ -84114,7 +84244,7 @@ function computeRunSegmentsFromSpan(startMs, duration2, activeStartMs, events2,
|
|
|
84114
84244
|
segments.push({
|
|
84115
84245
|
startFraction: cursor,
|
|
84116
84246
|
endFraction: 1,
|
|
84117
|
-
status: failedEvent ? "failed" :
|
|
84247
|
+
status: failedEvent ? "failed" : runSegmentStatus(runStatus)
|
|
84118
84248
|
});
|
|
84119
84249
|
return segments;
|
|
84120
84250
|
}
|
|
@@ -84135,7 +84265,7 @@ function computeV1RunSegments(startMs, duration2, activeStartMs, runStatus) {
|
|
|
84135
84265
|
segments.push({
|
|
84136
84266
|
startFraction: cursor,
|
|
84137
84267
|
endFraction: 1,
|
|
84138
|
-
status: runStatus
|
|
84268
|
+
status: runSegmentStatus(runStatus)
|
|
84139
84269
|
});
|
|
84140
84270
|
return segments;
|
|
84141
84271
|
}
|
|
@@ -84228,7 +84358,7 @@ const EventRow = ({ span, isSelected, isDimmed, onSelectSpan }) => {
|
|
|
84228
84358
|
const workflowStatus = (_a3 = span.attributes.data) == null ? void 0 : _a3.status;
|
|
84229
84359
|
const isErrored = span.status.code === 2 || workflowStatus === "failed";
|
|
84230
84360
|
const { icon: Icon2, className: tagClassName } = getEventStyle(span.resource, isErrored);
|
|
84231
|
-
return jsxRuntimeExports.jsx("li", { className: cn$4("relative overflow-clip group transition-opacity", ROW_HEIGHT_CLASS, isDimmed && "opacity-35"), role: "treeitem", "aria-selected": isSelected, "aria-expanded": isSelected, "aria-level": 1, onClick: () => onSelectSpan(span.spanId), children: jsxRuntimeExports.jsx("div", { className: "h-full hover:bg-gray-100 group-aria-selected:bg-gray-100 group-aria-selected:hover:bg-gray-200", children: jsxRuntimeExports.jsxs("div", { className: "flex h-full min-w-0 items-center pl-4 pr-2", children: [jsxRuntimeExports.jsxs("div", { className: "flex min-w-0 flex-1 items-center gap-2", children: [jsxRuntimeExports.jsx("span", { className: cn$4("shrink-0", tagClassName), children: jsxRuntimeExports.jsx(Icon2, { className: "w-4 h-4" }) }), jsxRuntimeExports.jsx("span", { className: "min-w-0 text-label-14", children: jsxRuntimeExports.jsx(MiddleTruncate, { value: span.name }) })] }), jsxRuntimeExports.jsx("div", { className: "ml-2 shrink-0", children: jsxRuntimeExports.jsx("span", { className: "text-label-14 text-gray-900 tabular-nums", children:
|
|
84361
|
+
return jsxRuntimeExports.jsx("li", { className: cn$4("relative overflow-clip group transition-opacity", ROW_HEIGHT_CLASS, isDimmed && "opacity-35"), role: "treeitem", "aria-selected": isSelected, "aria-expanded": isSelected, "aria-level": 1, onClick: () => onSelectSpan(span.spanId), children: jsxRuntimeExports.jsx("div", { className: "h-full hover:bg-gray-100 group-aria-selected:bg-gray-100 group-aria-selected:hover:bg-gray-200", children: jsxRuntimeExports.jsxs("div", { className: "flex h-full min-w-0 items-center pl-4 pr-2", children: [jsxRuntimeExports.jsxs("div", { className: "flex min-w-0 flex-1 items-center gap-2", children: [jsxRuntimeExports.jsx("span", { className: cn$4("shrink-0", tagClassName), children: jsxRuntimeExports.jsx(Icon2, { className: "w-4 h-4" }) }), jsxRuntimeExports.jsx("span", { className: "min-w-0 text-label-14", children: jsxRuntimeExports.jsx(MiddleTruncate, { value: span.name }) })] }), jsxRuntimeExports.jsx("div", { className: "ml-2 shrink-0", children: jsxRuntimeExports.jsx("span", { className: "text-label-14 text-gray-900 tabular-nums", children: formatDurationPrecise(durationMs) }) })] }) }) });
|
|
84232
84362
|
};
|
|
84233
84363
|
const EventList = ({ spans, activeSpanId, searchResult, onSelectSpan }) => {
|
|
84234
84364
|
const listRef = reactExports.useRef(null);
|
|
@@ -84335,6 +84465,10 @@ function SplitPane({ children: children2, className, defaultStartWidth = DEFAULT
|
|
|
84335
84465
|
}
|
|
84336
84466
|
return jsxRuntimeExports.jsxs("div", { ref: setContainerRef, className: cn$4("grid h-full min-h-0 content-start overflow-x-hidden overflow-y-auto", isDragging && "select-none", className), style: { gridTemplateColumns: colTemplate, height: "100%" }, children: [start2, gutter, end] });
|
|
84337
84467
|
}
|
|
84468
|
+
const runningStripes = "_runningStripes_62ud0_1";
|
|
84469
|
+
const styles$1 = {
|
|
84470
|
+
runningStripes
|
|
84471
|
+
};
|
|
84338
84472
|
const TINY_BAR_BOX_SIZE_PX = 24;
|
|
84339
84473
|
const TINY_BAR_WIDTH_PX = 4;
|
|
84340
84474
|
const TIMELINE_PADDING_PX = 16;
|
|
@@ -84343,6 +84477,7 @@ const SEGMENT_CLASSES = {
|
|
|
84343
84477
|
retrying: "bg-gray-400 border border-gray-500",
|
|
84344
84478
|
waiting: "bg-gray-400 border border-gray-500",
|
|
84345
84479
|
running: "bg-blue-200 border border-blue-500",
|
|
84480
|
+
completed: "bg-blue-200 border border-blue-500",
|
|
84346
84481
|
failed: "bg-red-200 border border-red-500",
|
|
84347
84482
|
succeeded: "bg-green-200 border border-green-500",
|
|
84348
84483
|
sleeping: "bg-gray-400 border border-gray-500",
|
|
@@ -84352,6 +84487,13 @@ const TIMELINE_INSET_STYLE = {
|
|
|
84352
84487
|
left: TIMELINE_PADDING_PX,
|
|
84353
84488
|
right: TIMELINE_PADDING_PX
|
|
84354
84489
|
};
|
|
84490
|
+
const ACTIVE_SEGMENT_STATUSES = /* @__PURE__ */ new Set([
|
|
84491
|
+
"running",
|
|
84492
|
+
"received"
|
|
84493
|
+
]);
|
|
84494
|
+
function RunningStripes() {
|
|
84495
|
+
return jsxRuntimeExports.jsx("div", { "aria-hidden": true, className: styles$1.runningStripes });
|
|
84496
|
+
}
|
|
84355
84497
|
function computeBarGeometry(startMs, endMs, viewStart, viewEnd, containerWidth) {
|
|
84356
84498
|
const viewDuration = viewEnd - viewStart;
|
|
84357
84499
|
const visibleStartMs = Math.max(startMs, viewStart);
|
|
@@ -84424,21 +84566,27 @@ function BoundaryArrow({ direction }) {
|
|
|
84424
84566
|
function PlainBar({ bg: bg2, border, label }) {
|
|
84425
84567
|
return jsxRuntimeExports.jsx("div", { className: "relative h-6 w-full min-w-1 rounded-[0.25rem] border", style: { background: bg2, borderColor: border }, children: label ? jsxRuntimeExports.jsx(DurationLabel, { label }) : null });
|
|
84426
84568
|
}
|
|
84569
|
+
function LeadInConnector({ leftPct, widthPct, label }) {
|
|
84570
|
+
return jsxRuntimeExports.jsxs("div", { className: "absolute top-1/2 h-6 -translate-y-1/2", style: {
|
|
84571
|
+
left: `calc(${leftPct}% + 0.5px)`,
|
|
84572
|
+
width: `calc(${widthPct}% - 1px)`
|
|
84573
|
+
}, children: [jsxRuntimeExports.jsx("div", { className: "absolute left-0 top-1/2 h-4 w-px -translate-y-1/2 bg-gray-500" }), jsxRuntimeExports.jsx("div", { className: "absolute inset-x-0 top-1/2 h-px -translate-y-1/2 bg-gray-500" }), label ? jsxRuntimeExports.jsx(DurationLabel, { label }) : null] });
|
|
84574
|
+
}
|
|
84427
84575
|
function SegmentBar({ segments }) {
|
|
84428
84576
|
return jsxRuntimeExports.jsx("div", { className: "relative h-6 w-full", children: segments.map((seg, i) => {
|
|
84429
|
-
|
|
84577
|
+
if (seg.status === "queued") {
|
|
84578
|
+
const leadInLabel = formatDurationPrecise(seg.fullDurationMs);
|
|
84579
|
+
const showLeadInLabel = seg.pixelWidth >= Math.max(40, leadInLabel.length * 6 + 12);
|
|
84580
|
+
return jsxRuntimeExports.jsx(LeadInConnector, { leftPct: seg.leftPct, widthPct: seg.widthPct, label: showLeadInLabel ? leadInLabel : null }, i);
|
|
84581
|
+
}
|
|
84582
|
+
const label = formatDurationPrecise(seg.fullDurationMs);
|
|
84430
84583
|
const showLabel = seg.pixelWidth >= Math.max(40, label.length * 6 + 12);
|
|
84431
|
-
|
|
84432
|
-
const overrideBg = isNarrowQueued ? "var(--ds-gray-400)" : void 0;
|
|
84433
|
-
const overrideBorder = isNarrowQueued ? "var(--ds-gray-500)" : void 0;
|
|
84434
|
-
return jsxRuntimeExports.jsx("div", { className: cn$4("absolute h-full rounded-[0.25rem]", SEGMENT_CLASSES[seg.status]), style: {
|
|
84584
|
+
return jsxRuntimeExports.jsxs("div", { className: cn$4("absolute h-full overflow-hidden rounded-[0.25rem]", SEGMENT_CLASSES[seg.status]), style: {
|
|
84435
84585
|
// 1px gap between adjacent segments, distributed equally.
|
|
84436
84586
|
left: `calc(${seg.leftPct}% + 0.5px)`,
|
|
84437
84587
|
width: `calc(${seg.widthPct}% - 1px)`,
|
|
84438
|
-
minWidth: 1
|
|
84439
|
-
|
|
84440
|
-
borderColor: overrideBorder
|
|
84441
|
-
}, children: showLabel ? jsxRuntimeExports.jsx(DurationLabel, { label }) : null }, i);
|
|
84588
|
+
minWidth: 1
|
|
84589
|
+
}, children: [ACTIVE_SEGMENT_STATUSES.has(seg.status) ? jsxRuntimeExports.jsx(RunningStripes, {}) : null, showLabel ? jsxRuntimeExports.jsx(DurationLabel, { label }) : null] }, i);
|
|
84442
84590
|
}) });
|
|
84443
84591
|
}
|
|
84444
84592
|
const TimelineBar = reactExports.memo(function TimelineBar2({ span, viewStart, viewDuration, containerWidth, isSelected, isDimmed, onSelect }) {
|
|
@@ -84454,7 +84602,7 @@ const TimelineBar = reactExports.memo(function TimelineBar2({ span, viewStart, v
|
|
|
84454
84602
|
const colors = getResourceColor(span.resource);
|
|
84455
84603
|
const fallbackBg = isErrored ? colors.errorBg ?? "var(--ds-red-200)" : colors.bg;
|
|
84456
84604
|
const fallbackBorder = isErrored ? colors.errorBorder ?? "var(--ds-red-500)" : colors.border;
|
|
84457
|
-
const totalLabel =
|
|
84605
|
+
const totalLabel = formatDurationPrecise(totalDurationMs);
|
|
84458
84606
|
const showTotalLabel = geometry.visiblePixelWidth >= Math.max(40, totalLabel.length * 6 + 12);
|
|
84459
84607
|
const handleClick = reactExports.useCallback(() => {
|
|
84460
84608
|
onSelect(span.spanId);
|
|
@@ -88434,6 +88582,7 @@ class WorkflowSuspension extends Error {
|
|
|
88434
88582
|
let stepCount = 0;
|
|
88435
88583
|
let hookCount = 0;
|
|
88436
88584
|
let waitCount = 0;
|
|
88585
|
+
let attributeCount = 0;
|
|
88437
88586
|
let hookDisposedCount = 0;
|
|
88438
88587
|
let abortCount = 0;
|
|
88439
88588
|
for (const item of steps) {
|
|
@@ -88448,6 +88597,8 @@ class WorkflowSuspension extends Error {
|
|
|
88448
88597
|
hookCount++;
|
|
88449
88598
|
} else if (item.type === "wait")
|
|
88450
88599
|
waitCount++;
|
|
88600
|
+
else if (item.type === "attribute")
|
|
88601
|
+
attributeCount++;
|
|
88451
88602
|
}
|
|
88452
88603
|
const parts = [];
|
|
88453
88604
|
if (stepCount > 0) {
|
|
@@ -88459,12 +88610,15 @@ class WorkflowSuspension extends Error {
|
|
|
88459
88610
|
if (waitCount > 0) {
|
|
88460
88611
|
parts.push(`${waitCount} ${pluralize("wait", "waits", waitCount)}`);
|
|
88461
88612
|
}
|
|
88613
|
+
if (attributeCount > 0) {
|
|
88614
|
+
parts.push(`${attributeCount} ${pluralize("attribute write", "attribute writes", attributeCount)}`);
|
|
88615
|
+
}
|
|
88462
88616
|
if (hookDisposedCount > 0) {
|
|
88463
88617
|
parts.push(`${hookDisposedCount} hook ${pluralize("disposal", "disposals", hookDisposedCount)}`);
|
|
88464
88618
|
}
|
|
88465
|
-
const totalCount = stepCount + hookCount + waitCount + hookDisposedCount;
|
|
88619
|
+
const totalCount = stepCount + hookCount + waitCount + attributeCount + hookDisposedCount;
|
|
88466
88620
|
const hasOrHave = pluralize("has", "have", totalCount);
|
|
88467
|
-
const typeCount = (stepCount > 0 ? 1 : 0) + (hookCount > 0 ? 1 : 0) + (waitCount > 0 ? 1 : 0) + (hookDisposedCount > 0 ? 1 : 0);
|
|
88621
|
+
const typeCount = (stepCount > 0 ? 1 : 0) + (hookCount > 0 ? 1 : 0) + (waitCount > 0 ? 1 : 0) + (attributeCount > 0 ? 1 : 0) + (hookDisposedCount > 0 ? 1 : 0);
|
|
88468
88622
|
let action2;
|
|
88469
88623
|
if (typeCount > 1) {
|
|
88470
88624
|
action2 = "processed";
|
|
@@ -88474,6 +88628,8 @@ class WorkflowSuspension extends Error {
|
|
|
88474
88628
|
action2 = "created";
|
|
88475
88629
|
} else if (waitCount > 0) {
|
|
88476
88630
|
action2 = "created";
|
|
88631
|
+
} else if (attributeCount > 0) {
|
|
88632
|
+
action2 = "written";
|
|
88477
88633
|
} else if (hookDisposedCount > 0) {
|
|
88478
88634
|
action2 = "processed";
|
|
88479
88635
|
} else {
|
|
@@ -88486,6 +88642,7 @@ class WorkflowSuspension extends Error {
|
|
|
88486
88642
|
__publicField(this, "stepCount");
|
|
88487
88643
|
__publicField(this, "hookCount");
|
|
88488
88644
|
__publicField(this, "waitCount");
|
|
88645
|
+
__publicField(this, "attributeCount");
|
|
88489
88646
|
__publicField(this, "hookDisposedCount");
|
|
88490
88647
|
__publicField(this, "abortCount");
|
|
88491
88648
|
this.name = "WorkflowSuspension";
|
|
@@ -88494,6 +88651,7 @@ class WorkflowSuspension extends Error {
|
|
|
88494
88651
|
this.stepCount = stepCount;
|
|
88495
88652
|
this.hookCount = hookCount;
|
|
88496
88653
|
this.waitCount = waitCount;
|
|
88654
|
+
this.attributeCount = attributeCount;
|
|
88497
88655
|
this.hookDisposedCount = hookDisposedCount;
|
|
88498
88656
|
this.abortCount = abortCount;
|
|
88499
88657
|
}
|
|
@@ -88887,7 +89045,7 @@ const encryption = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePr
|
|
|
88887
89045
|
encrypt: encrypt$1,
|
|
88888
89046
|
importKey
|
|
88889
89047
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
88890
|
-
const version$1 = "5.0.0-beta.
|
|
89048
|
+
const version$1 = "5.0.0-beta.15";
|
|
88891
89049
|
const WorldCacheKey = Symbol.for("@workflow/world//cache");
|
|
88892
89050
|
const WorldCachePromiseKey = Symbol.for("@workflow/world//cachePromise");
|
|
88893
89051
|
const GetWorldFnKey$1 = Symbol.for("@workflow/world//getWorldFn");
|
|
@@ -88908,11 +89066,12 @@ async function getWorldLazy() {
|
|
|
88908
89066
|
}
|
|
88909
89067
|
const DEFAULT_HEALTH_CHECK_TIMEOUT = 3e4;
|
|
88910
89068
|
const SAFE_WORKFLOW_NAME_PATTERN = /^[a-zA-Z0-9_\-./@]+$/;
|
|
88911
|
-
function getWorkflowQueueName(workflowName) {
|
|
89069
|
+
function getWorkflowQueueName(workflowName, namespace2) {
|
|
88912
89070
|
if (!SAFE_WORKFLOW_NAME_PATTERN.test(workflowName)) {
|
|
88913
89071
|
throw new Error(`Invalid workflow name "${workflowName}": must only contain alphanumeric characters, underscores, hyphens, dots, forward slashes, or at signs`);
|
|
88914
89072
|
}
|
|
88915
|
-
|
|
89073
|
+
const prefix = getQueueTopicPrefix("workflow", resolveQueueNamespace(namespace2));
|
|
89074
|
+
return `${prefix}${workflowName}`;
|
|
88916
89075
|
}
|
|
88917
89076
|
const generateId = monotonicFactory();
|
|
88918
89077
|
function getHealthCheckStreamName(correlationId) {
|
|
@@ -88979,7 +89138,7 @@ async function healthCheck(world, endpoint, options) {
|
|
|
88979
89138
|
const timeout2 = (options == null ? void 0 : options.timeout) ?? DEFAULT_HEALTH_CHECK_TIMEOUT;
|
|
88980
89139
|
const correlationId = generateId();
|
|
88981
89140
|
const streamName = getHealthCheckStreamName(correlationId);
|
|
88982
|
-
const queueName = endpoint
|
|
89141
|
+
const queueName = `${getQueueTopicPrefix(endpoint, resolveQueueNamespace(options == null ? void 0 : options.namespace))}health_check`;
|
|
88983
89142
|
const startTime = Date.now();
|
|
88984
89143
|
try {
|
|
88985
89144
|
await world.queue(queueName, { __healthCheck: true, correlationId }, {
|
|
@@ -89224,6 +89383,7 @@ const WORKFLOW_DESERIALIZE = Symbol.for("workflow-deserialize");
|
|
|
89224
89383
|
const STABLE_ULID = Symbol.for("WORKFLOW_STABLE_ULID");
|
|
89225
89384
|
const STREAM_NAME_SYMBOL = Symbol.for("WORKFLOW_STREAM_NAME");
|
|
89226
89385
|
const STREAM_TYPE_SYMBOL = Symbol.for("WORKFLOW_STREAM_TYPE");
|
|
89386
|
+
const STREAM_FRAMING_SYMBOL = Symbol.for("WORKFLOW_STREAM_FRAMING");
|
|
89227
89387
|
const STREAM_SERVER_RUN_ID_SYMBOL = Symbol.for("WORKFLOW_STREAM_SERVER_RUN_ID");
|
|
89228
89388
|
const STREAM_SERVER_DEPLOYMENT_ID_SYMBOL = Symbol.for("WORKFLOW_STREAM_SERVER_DEPLOYMENT_ID");
|
|
89229
89389
|
const BODY_INIT_SYMBOL = Symbol.for("BODY_INIT");
|
|
@@ -89922,1098 +90082,6 @@ function deserialize(data, options) {
|
|
|
89922
90082
|
}
|
|
89923
90083
|
const CONTEXT_STORAGE_SYMBOL = Symbol.for("WORKFLOW_STEP_CONTEXT_STORAGE");
|
|
89924
90084
|
const contextStorage = globalThis[CONTEXT_STORAGE_SYMBOL] ?? (globalThis[CONTEXT_STORAGE_SYMBOL] = new AsyncLocalStorage());
|
|
89925
|
-
var headers$1;
|
|
89926
|
-
var hasRequiredHeaders$1;
|
|
89927
|
-
function requireHeaders$1() {
|
|
89928
|
-
if (hasRequiredHeaders$1) return headers$1;
|
|
89929
|
-
hasRequiredHeaders$1 = 1;
|
|
89930
|
-
var __defProp3 = Object.defineProperty;
|
|
89931
|
-
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
89932
|
-
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
89933
|
-
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
89934
|
-
var __export2 = (target2, all2) => {
|
|
89935
|
-
for (var name2 in all2)
|
|
89936
|
-
__defProp3(target2, name2, { get: all2[name2], enumerable: true });
|
|
89937
|
-
};
|
|
89938
|
-
var __copyProps2 = (to2, from, except, desc) => {
|
|
89939
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
89940
|
-
for (let key of __getOwnPropNames2(from))
|
|
89941
|
-
if (!__hasOwnProp2.call(to2, key) && key !== except)
|
|
89942
|
-
__defProp3(to2, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
89943
|
-
}
|
|
89944
|
-
return to2;
|
|
89945
|
-
};
|
|
89946
|
-
var __toCommonJS = (mod) => __copyProps2(__defProp3({}, "__esModule", { value: true }), mod);
|
|
89947
|
-
var headers_exports = {};
|
|
89948
|
-
__export2(headers_exports, {
|
|
89949
|
-
CITY_HEADER_NAME: () => CITY_HEADER_NAME,
|
|
89950
|
-
COUNTRY_HEADER_NAME: () => COUNTRY_HEADER_NAME,
|
|
89951
|
-
EMOJI_FLAG_UNICODE_STARTING_POSITION: () => EMOJI_FLAG_UNICODE_STARTING_POSITION,
|
|
89952
|
-
IP_HEADER_NAME: () => IP_HEADER_NAME,
|
|
89953
|
-
LATITUDE_HEADER_NAME: () => LATITUDE_HEADER_NAME,
|
|
89954
|
-
LONGITUDE_HEADER_NAME: () => LONGITUDE_HEADER_NAME,
|
|
89955
|
-
POSTAL_CODE_HEADER_NAME: () => POSTAL_CODE_HEADER_NAME,
|
|
89956
|
-
REGION_HEADER_NAME: () => REGION_HEADER_NAME,
|
|
89957
|
-
REQUEST_ID_HEADER_NAME: () => REQUEST_ID_HEADER_NAME,
|
|
89958
|
-
geolocation: () => geolocation,
|
|
89959
|
-
ipAddress: () => ipAddress
|
|
89960
|
-
});
|
|
89961
|
-
headers$1 = __toCommonJS(headers_exports);
|
|
89962
|
-
const CITY_HEADER_NAME = "x-vercel-ip-city";
|
|
89963
|
-
const COUNTRY_HEADER_NAME = "x-vercel-ip-country";
|
|
89964
|
-
const IP_HEADER_NAME = "x-real-ip";
|
|
89965
|
-
const LATITUDE_HEADER_NAME = "x-vercel-ip-latitude";
|
|
89966
|
-
const LONGITUDE_HEADER_NAME = "x-vercel-ip-longitude";
|
|
89967
|
-
const REGION_HEADER_NAME = "x-vercel-ip-country-region";
|
|
89968
|
-
const POSTAL_CODE_HEADER_NAME = "x-vercel-ip-postal-code";
|
|
89969
|
-
const REQUEST_ID_HEADER_NAME = "x-vercel-id";
|
|
89970
|
-
const EMOJI_FLAG_UNICODE_STARTING_POSITION = 127397;
|
|
89971
|
-
function getHeader2(headers2, key) {
|
|
89972
|
-
return headers2.get(key) ?? void 0;
|
|
89973
|
-
}
|
|
89974
|
-
function getHeaderWithDecode(request2, key) {
|
|
89975
|
-
const header = getHeader2(request2.headers, key);
|
|
89976
|
-
return header ? decodeURIComponent(header) : void 0;
|
|
89977
|
-
}
|
|
89978
|
-
function getFlag(countryCode) {
|
|
89979
|
-
const regex = new RegExp("^[A-Z]{2}$").test(countryCode);
|
|
89980
|
-
if (!countryCode || !regex)
|
|
89981
|
-
return void 0;
|
|
89982
|
-
return String.fromCodePoint(
|
|
89983
|
-
...countryCode.split("").map((char) => EMOJI_FLAG_UNICODE_STARTING_POSITION + char.charCodeAt(0))
|
|
89984
|
-
);
|
|
89985
|
-
}
|
|
89986
|
-
function ipAddress(input) {
|
|
89987
|
-
const headers2 = "headers" in input ? input.headers : input;
|
|
89988
|
-
return getHeader2(headers2, IP_HEADER_NAME);
|
|
89989
|
-
}
|
|
89990
|
-
function getRegionFromRequestId(requestId) {
|
|
89991
|
-
if (!requestId) {
|
|
89992
|
-
return "dev1";
|
|
89993
|
-
}
|
|
89994
|
-
return requestId.split(":")[0];
|
|
89995
|
-
}
|
|
89996
|
-
function geolocation(request2) {
|
|
89997
|
-
return {
|
|
89998
|
-
// city name may be encoded to support multi-byte characters
|
|
89999
|
-
city: getHeaderWithDecode(request2, CITY_HEADER_NAME),
|
|
90000
|
-
country: getHeader2(request2.headers, COUNTRY_HEADER_NAME),
|
|
90001
|
-
flag: getFlag(getHeader2(request2.headers, COUNTRY_HEADER_NAME)),
|
|
90002
|
-
countryRegion: getHeader2(request2.headers, REGION_HEADER_NAME),
|
|
90003
|
-
region: getRegionFromRequestId(
|
|
90004
|
-
getHeader2(request2.headers, REQUEST_ID_HEADER_NAME)
|
|
90005
|
-
),
|
|
90006
|
-
latitude: getHeader2(request2.headers, LATITUDE_HEADER_NAME),
|
|
90007
|
-
longitude: getHeader2(request2.headers, LONGITUDE_HEADER_NAME),
|
|
90008
|
-
postalCode: getHeader2(request2.headers, POSTAL_CODE_HEADER_NAME)
|
|
90009
|
-
};
|
|
90010
|
-
}
|
|
90011
|
-
return headers$1;
|
|
90012
|
-
}
|
|
90013
|
-
var getEnv_1;
|
|
90014
|
-
var hasRequiredGetEnv;
|
|
90015
|
-
function requireGetEnv() {
|
|
90016
|
-
if (hasRequiredGetEnv) return getEnv_1;
|
|
90017
|
-
hasRequiredGetEnv = 1;
|
|
90018
|
-
var __defProp3 = Object.defineProperty;
|
|
90019
|
-
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
90020
|
-
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
90021
|
-
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
90022
|
-
var __export2 = (target2, all2) => {
|
|
90023
|
-
for (var name2 in all2)
|
|
90024
|
-
__defProp3(target2, name2, { get: all2[name2], enumerable: true });
|
|
90025
|
-
};
|
|
90026
|
-
var __copyProps2 = (to2, from, except, desc) => {
|
|
90027
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
90028
|
-
for (let key of __getOwnPropNames2(from))
|
|
90029
|
-
if (!__hasOwnProp2.call(to2, key) && key !== except)
|
|
90030
|
-
__defProp3(to2, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
90031
|
-
}
|
|
90032
|
-
return to2;
|
|
90033
|
-
};
|
|
90034
|
-
var __toCommonJS = (mod) => __copyProps2(__defProp3({}, "__esModule", { value: true }), mod);
|
|
90035
|
-
var get_env_exports = {};
|
|
90036
|
-
__export2(get_env_exports, {
|
|
90037
|
-
getEnv: () => getEnv
|
|
90038
|
-
});
|
|
90039
|
-
getEnv_1 = __toCommonJS(get_env_exports);
|
|
90040
|
-
const getEnv = (env2 = process.env) => ({
|
|
90041
|
-
/**
|
|
90042
|
-
* An indicator to show that System Environment Variables have been exposed to your project's Deployments.
|
|
90043
|
-
* @example "1"
|
|
90044
|
-
*/
|
|
90045
|
-
VERCEL: get2(env2, "VERCEL"),
|
|
90046
|
-
/**
|
|
90047
|
-
* An indicator that the code is running in a Continuous Integration environment.
|
|
90048
|
-
* @example "1"
|
|
90049
|
-
*/
|
|
90050
|
-
CI: get2(env2, "CI"),
|
|
90051
|
-
/**
|
|
90052
|
-
* The Environment that the app is deployed and running on.
|
|
90053
|
-
* @example "production"
|
|
90054
|
-
*/
|
|
90055
|
-
VERCEL_ENV: get2(env2, "VERCEL_ENV"),
|
|
90056
|
-
/**
|
|
90057
|
-
* The domain name of the generated deployment URL. The value does not include the protocol scheme https://.
|
|
90058
|
-
* NOTE: This Variable cannot be used in conjunction with Standard Deployment Protection.
|
|
90059
|
-
* @example "*.vercel.app"
|
|
90060
|
-
*/
|
|
90061
|
-
VERCEL_URL: get2(env2, "VERCEL_URL"),
|
|
90062
|
-
/**
|
|
90063
|
-
* The domain name of the generated Git branch URL. The value does not include the protocol scheme https://.
|
|
90064
|
-
* @example "*-git-*.vercel.app"
|
|
90065
|
-
*/
|
|
90066
|
-
VERCEL_BRANCH_URL: get2(env2, "VERCEL_BRANCH_URL"),
|
|
90067
|
-
/**
|
|
90068
|
-
* A production domain name of the project. This is useful to reliably generate links that point to production such as OG-image URLs.
|
|
90069
|
-
* The value does not include the protocol scheme https://.
|
|
90070
|
-
* @example "myproject.vercel.app"
|
|
90071
|
-
*/
|
|
90072
|
-
VERCEL_PROJECT_PRODUCTION_URL: get2(env2, "VERCEL_PROJECT_PRODUCTION_URL"),
|
|
90073
|
-
/**
|
|
90074
|
-
* The ID of the Region where the app is running.
|
|
90075
|
-
*
|
|
90076
|
-
* Possible values:
|
|
90077
|
-
* - arn1 (Stockholm, Sweden)
|
|
90078
|
-
* - bom1 (Mumbai, India)
|
|
90079
|
-
* - cdg1 (Paris, France)
|
|
90080
|
-
* - cle1 (Cleveland, USA)
|
|
90081
|
-
* - cpt1 (Cape Town, South Africa)
|
|
90082
|
-
* - dub1 (Dublin, Ireland)
|
|
90083
|
-
* - fra1 (Frankfurt, Germany)
|
|
90084
|
-
* - gru1 (São Paulo, Brazil)
|
|
90085
|
-
* - hkg1 (Hong Kong)
|
|
90086
|
-
* - hnd1 (Tokyo, Japan)
|
|
90087
|
-
* - iad1 (Washington, D.C., USA)
|
|
90088
|
-
* - icn1 (Seoul, South Korea)
|
|
90089
|
-
* - kix1 (Osaka, Japan)
|
|
90090
|
-
* - lhr1 (London, United Kingdom)
|
|
90091
|
-
* - pdx1 (Portland, USA)
|
|
90092
|
-
* - sfo1 (San Francisco, USA)
|
|
90093
|
-
* - sin1 (Singapore)
|
|
90094
|
-
* - syd1 (Sydney, Australia)
|
|
90095
|
-
* - dev1 (Development Region)
|
|
90096
|
-
*
|
|
90097
|
-
* @example "iad1"
|
|
90098
|
-
*/
|
|
90099
|
-
VERCEL_REGION: get2(env2, "VERCEL_REGION"),
|
|
90100
|
-
/**
|
|
90101
|
-
* The unique identifier for the deployment, which can be used to implement Skew Protection.
|
|
90102
|
-
* @example "dpl_7Gw5ZMBpQA8h9GF832KGp7nwbuh3"
|
|
90103
|
-
*/
|
|
90104
|
-
VERCEL_DEPLOYMENT_ID: get2(env2, "VERCEL_DEPLOYMENT_ID"),
|
|
90105
|
-
/**
|
|
90106
|
-
* When Skew Protection is enabled in Project Settings, this value is set to 1.
|
|
90107
|
-
* @example "1"
|
|
90108
|
-
*/
|
|
90109
|
-
VERCEL_SKEW_PROTECTION_ENABLED: get2(env2, "VERCEL_SKEW_PROTECTION_ENABLED"),
|
|
90110
|
-
/**
|
|
90111
|
-
* The Protection Bypass for Automation value, if the secret has been generated in the project's Deployment Protection settings.
|
|
90112
|
-
*/
|
|
90113
|
-
VERCEL_AUTOMATION_BYPASS_SECRET: get2(env2, "VERCEL_AUTOMATION_BYPASS_SECRET"),
|
|
90114
|
-
/**
|
|
90115
|
-
* The Git Provider the deployment is triggered from.
|
|
90116
|
-
* @example "github"
|
|
90117
|
-
*/
|
|
90118
|
-
VERCEL_GIT_PROVIDER: get2(env2, "VERCEL_GIT_PROVIDER"),
|
|
90119
|
-
/**
|
|
90120
|
-
* The origin repository the deployment is triggered from.
|
|
90121
|
-
* @example "my-site"
|
|
90122
|
-
*/
|
|
90123
|
-
VERCEL_GIT_REPO_SLUG: get2(env2, "VERCEL_GIT_REPO_SLUG"),
|
|
90124
|
-
/**
|
|
90125
|
-
* The account that owns the repository the deployment is triggered from.
|
|
90126
|
-
* @example "acme"
|
|
90127
|
-
*/
|
|
90128
|
-
VERCEL_GIT_REPO_OWNER: get2(env2, "VERCEL_GIT_REPO_OWNER"),
|
|
90129
|
-
/**
|
|
90130
|
-
* The ID of the repository the deployment is triggered from.
|
|
90131
|
-
* @example "117716146"
|
|
90132
|
-
*/
|
|
90133
|
-
VERCEL_GIT_REPO_ID: get2(env2, "VERCEL_GIT_REPO_ID"),
|
|
90134
|
-
/**
|
|
90135
|
-
* The git branch of the commit the deployment was triggered by.
|
|
90136
|
-
* @example "improve-about-page"
|
|
90137
|
-
*/
|
|
90138
|
-
VERCEL_GIT_COMMIT_REF: get2(env2, "VERCEL_GIT_COMMIT_REF"),
|
|
90139
|
-
/**
|
|
90140
|
-
* The git SHA of the commit the deployment was triggered by.
|
|
90141
|
-
* @example "fa1eade47b73733d6312d5abfad33ce9e4068081"
|
|
90142
|
-
*/
|
|
90143
|
-
VERCEL_GIT_COMMIT_SHA: get2(env2, "VERCEL_GIT_COMMIT_SHA"),
|
|
90144
|
-
/**
|
|
90145
|
-
* The message attached to the commit the deployment was triggered by.
|
|
90146
|
-
* @example "Update about page"
|
|
90147
|
-
*/
|
|
90148
|
-
VERCEL_GIT_COMMIT_MESSAGE: get2(env2, "VERCEL_GIT_COMMIT_MESSAGE"),
|
|
90149
|
-
/**
|
|
90150
|
-
* The username attached to the author of the commit that the project was deployed by.
|
|
90151
|
-
* @example "johndoe"
|
|
90152
|
-
*/
|
|
90153
|
-
VERCEL_GIT_COMMIT_AUTHOR_LOGIN: get2(env2, "VERCEL_GIT_COMMIT_AUTHOR_LOGIN"),
|
|
90154
|
-
/**
|
|
90155
|
-
* The name attached to the author of the commit that the project was deployed by.
|
|
90156
|
-
* @example "John Doe"
|
|
90157
|
-
*/
|
|
90158
|
-
VERCEL_GIT_COMMIT_AUTHOR_NAME: get2(env2, "VERCEL_GIT_COMMIT_AUTHOR_NAME"),
|
|
90159
|
-
/**
|
|
90160
|
-
* The git SHA of the last successful deployment for the project and branch.
|
|
90161
|
-
* NOTE: This Variable is only exposed when an Ignored Build Step is provided.
|
|
90162
|
-
* @example "fa1eade47b73733d6312d5abfad33ce9e4068080"
|
|
90163
|
-
*/
|
|
90164
|
-
VERCEL_GIT_PREVIOUS_SHA: get2(env2, "VERCEL_GIT_PREVIOUS_SHA"),
|
|
90165
|
-
/**
|
|
90166
|
-
* The pull request id the deployment was triggered by. If a deployment is created on a branch before a pull request is made, this value will be an empty string.
|
|
90167
|
-
* @example "23"
|
|
90168
|
-
*/
|
|
90169
|
-
VERCEL_GIT_PULL_REQUEST_ID: get2(env2, "VERCEL_GIT_PULL_REQUEST_ID")
|
|
90170
|
-
});
|
|
90171
|
-
const get2 = (env2, key) => {
|
|
90172
|
-
const value = env2[key];
|
|
90173
|
-
return value === "" ? void 0 : value;
|
|
90174
|
-
};
|
|
90175
|
-
return getEnv_1;
|
|
90176
|
-
}
|
|
90177
|
-
var getContext_1$1;
|
|
90178
|
-
var hasRequiredGetContext$1;
|
|
90179
|
-
function requireGetContext$1() {
|
|
90180
|
-
if (hasRequiredGetContext$1) return getContext_1$1;
|
|
90181
|
-
hasRequiredGetContext$1 = 1;
|
|
90182
|
-
var __defProp3 = Object.defineProperty;
|
|
90183
|
-
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
90184
|
-
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
90185
|
-
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
90186
|
-
var __export2 = (target2, all2) => {
|
|
90187
|
-
for (var name2 in all2)
|
|
90188
|
-
__defProp3(target2, name2, { get: all2[name2], enumerable: true });
|
|
90189
|
-
};
|
|
90190
|
-
var __copyProps2 = (to2, from, except, desc) => {
|
|
90191
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
90192
|
-
for (let key of __getOwnPropNames2(from))
|
|
90193
|
-
if (!__hasOwnProp2.call(to2, key) && key !== except)
|
|
90194
|
-
__defProp3(to2, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
90195
|
-
}
|
|
90196
|
-
return to2;
|
|
90197
|
-
};
|
|
90198
|
-
var __toCommonJS = (mod) => __copyProps2(__defProp3({}, "__esModule", { value: true }), mod);
|
|
90199
|
-
var get_context_exports = {};
|
|
90200
|
-
__export2(get_context_exports, {
|
|
90201
|
-
SYMBOL_FOR_REQ_CONTEXT: () => SYMBOL_FOR_REQ_CONTEXT,
|
|
90202
|
-
getContext: () => getContext
|
|
90203
|
-
});
|
|
90204
|
-
getContext_1$1 = __toCommonJS(get_context_exports);
|
|
90205
|
-
const SYMBOL_FOR_REQ_CONTEXT = Symbol.for("@vercel/request-context");
|
|
90206
|
-
function getContext() {
|
|
90207
|
-
var _a3, _b2;
|
|
90208
|
-
const fromSymbol = globalThis;
|
|
90209
|
-
return ((_b2 = (_a3 = fromSymbol[SYMBOL_FOR_REQ_CONTEXT]) == null ? void 0 : _a3.get) == null ? void 0 : _b2.call(_a3)) ?? {};
|
|
90210
|
-
}
|
|
90211
|
-
return getContext_1$1;
|
|
90212
|
-
}
|
|
90213
|
-
var waitUntil_1;
|
|
90214
|
-
var hasRequiredWaitUntil;
|
|
90215
|
-
function requireWaitUntil() {
|
|
90216
|
-
if (hasRequiredWaitUntil) return waitUntil_1;
|
|
90217
|
-
hasRequiredWaitUntil = 1;
|
|
90218
|
-
var __defProp3 = Object.defineProperty;
|
|
90219
|
-
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
90220
|
-
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
90221
|
-
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
90222
|
-
var __export2 = (target2, all2) => {
|
|
90223
|
-
for (var name2 in all2)
|
|
90224
|
-
__defProp3(target2, name2, { get: all2[name2], enumerable: true });
|
|
90225
|
-
};
|
|
90226
|
-
var __copyProps2 = (to2, from, except, desc) => {
|
|
90227
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
90228
|
-
for (let key of __getOwnPropNames2(from))
|
|
90229
|
-
if (!__hasOwnProp2.call(to2, key) && key !== except)
|
|
90230
|
-
__defProp3(to2, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
90231
|
-
}
|
|
90232
|
-
return to2;
|
|
90233
|
-
};
|
|
90234
|
-
var __toCommonJS = (mod) => __copyProps2(__defProp3({}, "__esModule", { value: true }), mod);
|
|
90235
|
-
var wait_until_exports = {};
|
|
90236
|
-
__export2(wait_until_exports, {
|
|
90237
|
-
waitUntil: () => waitUntil
|
|
90238
|
-
});
|
|
90239
|
-
waitUntil_1 = __toCommonJS(wait_until_exports);
|
|
90240
|
-
var import_get_context = requireGetContext$1();
|
|
90241
|
-
const waitUntil = (promise2) => {
|
|
90242
|
-
var _a3, _b2;
|
|
90243
|
-
if (promise2 === null || typeof promise2 !== "object" || typeof promise2.then !== "function") {
|
|
90244
|
-
throw new TypeError(
|
|
90245
|
-
`waitUntil can only be called with a Promise, got ${typeof promise2}`
|
|
90246
|
-
);
|
|
90247
|
-
}
|
|
90248
|
-
return (_b2 = (_a3 = (0, import_get_context.getContext)()).waitUntil) == null ? void 0 : _b2.call(_a3, promise2);
|
|
90249
|
-
};
|
|
90250
|
-
return waitUntil_1;
|
|
90251
|
-
}
|
|
90252
|
-
var middleware;
|
|
90253
|
-
var hasRequiredMiddleware;
|
|
90254
|
-
function requireMiddleware() {
|
|
90255
|
-
if (hasRequiredMiddleware) return middleware;
|
|
90256
|
-
hasRequiredMiddleware = 1;
|
|
90257
|
-
var __defProp3 = Object.defineProperty;
|
|
90258
|
-
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
90259
|
-
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
90260
|
-
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
90261
|
-
var __export2 = (target2, all2) => {
|
|
90262
|
-
for (var name2 in all2)
|
|
90263
|
-
__defProp3(target2, name2, { get: all2[name2], enumerable: true });
|
|
90264
|
-
};
|
|
90265
|
-
var __copyProps2 = (to2, from, except, desc) => {
|
|
90266
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
90267
|
-
for (let key of __getOwnPropNames2(from))
|
|
90268
|
-
if (!__hasOwnProp2.call(to2, key) && key !== except)
|
|
90269
|
-
__defProp3(to2, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
90270
|
-
}
|
|
90271
|
-
return to2;
|
|
90272
|
-
};
|
|
90273
|
-
var __toCommonJS = (mod) => __copyProps2(__defProp3({}, "__esModule", { value: true }), mod);
|
|
90274
|
-
var middleware_exports = {};
|
|
90275
|
-
__export2(middleware_exports, {
|
|
90276
|
-
next: () => next2,
|
|
90277
|
-
rewrite: () => rewrite
|
|
90278
|
-
});
|
|
90279
|
-
middleware = __toCommonJS(middleware_exports);
|
|
90280
|
-
function handleMiddlewareField(init2, headers2) {
|
|
90281
|
-
var _a3;
|
|
90282
|
-
if ((_a3 = init2 == null ? void 0 : init2.request) == null ? void 0 : _a3.headers) {
|
|
90283
|
-
if (!(init2.request.headers instanceof Headers)) {
|
|
90284
|
-
throw new Error("request.headers must be an instance of Headers");
|
|
90285
|
-
}
|
|
90286
|
-
const keys2 = [];
|
|
90287
|
-
for (const [key, value] of init2.request.headers) {
|
|
90288
|
-
headers2.set("x-middleware-request-" + key, value);
|
|
90289
|
-
keys2.push(key);
|
|
90290
|
-
}
|
|
90291
|
-
headers2.set("x-middleware-override-headers", keys2.join(","));
|
|
90292
|
-
}
|
|
90293
|
-
}
|
|
90294
|
-
function rewrite(destination, init2) {
|
|
90295
|
-
const headers2 = new Headers((init2 == null ? void 0 : init2.headers) ?? {});
|
|
90296
|
-
headers2.set("x-middleware-rewrite", String(destination));
|
|
90297
|
-
handleMiddlewareField(init2, headers2);
|
|
90298
|
-
return new Response(null, {
|
|
90299
|
-
...init2,
|
|
90300
|
-
headers: headers2
|
|
90301
|
-
});
|
|
90302
|
-
}
|
|
90303
|
-
function next2(init2) {
|
|
90304
|
-
const headers2 = new Headers((init2 == null ? void 0 : init2.headers) ?? {});
|
|
90305
|
-
headers2.set("x-middleware-next", "1");
|
|
90306
|
-
handleMiddlewareField(init2, headers2);
|
|
90307
|
-
return new Response(null, {
|
|
90308
|
-
...init2,
|
|
90309
|
-
headers: headers2
|
|
90310
|
-
});
|
|
90311
|
-
}
|
|
90312
|
-
return middleware;
|
|
90313
|
-
}
|
|
90314
|
-
var inMemoryCache;
|
|
90315
|
-
var hasRequiredInMemoryCache;
|
|
90316
|
-
function requireInMemoryCache() {
|
|
90317
|
-
if (hasRequiredInMemoryCache) return inMemoryCache;
|
|
90318
|
-
hasRequiredInMemoryCache = 1;
|
|
90319
|
-
var __defProp3 = Object.defineProperty;
|
|
90320
|
-
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
90321
|
-
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
90322
|
-
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
90323
|
-
var __export2 = (target2, all2) => {
|
|
90324
|
-
for (var name2 in all2)
|
|
90325
|
-
__defProp3(target2, name2, { get: all2[name2], enumerable: true });
|
|
90326
|
-
};
|
|
90327
|
-
var __copyProps2 = (to2, from, except, desc) => {
|
|
90328
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
90329
|
-
for (let key of __getOwnPropNames2(from))
|
|
90330
|
-
if (!__hasOwnProp2.call(to2, key) && key !== except)
|
|
90331
|
-
__defProp3(to2, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
90332
|
-
}
|
|
90333
|
-
return to2;
|
|
90334
|
-
};
|
|
90335
|
-
var __toCommonJS = (mod) => __copyProps2(__defProp3({}, "__esModule", { value: true }), mod);
|
|
90336
|
-
var in_memory_cache_exports = {};
|
|
90337
|
-
__export2(in_memory_cache_exports, {
|
|
90338
|
-
InMemoryCache: () => InMemoryCache
|
|
90339
|
-
});
|
|
90340
|
-
inMemoryCache = __toCommonJS(in_memory_cache_exports);
|
|
90341
|
-
class InMemoryCache {
|
|
90342
|
-
constructor() {
|
|
90343
|
-
this.cache = {};
|
|
90344
|
-
}
|
|
90345
|
-
async get(key) {
|
|
90346
|
-
const entry2 = this.cache[key];
|
|
90347
|
-
if (entry2) {
|
|
90348
|
-
if (entry2.ttl && entry2.lastModified + entry2.ttl * 1e3 < Date.now()) {
|
|
90349
|
-
await this.delete(key);
|
|
90350
|
-
return null;
|
|
90351
|
-
}
|
|
90352
|
-
return JSON.parse(entry2.value);
|
|
90353
|
-
}
|
|
90354
|
-
return null;
|
|
90355
|
-
}
|
|
90356
|
-
async set(key, value, options) {
|
|
90357
|
-
const serialized = JSON.stringify(value ?? null);
|
|
90358
|
-
this.cache[key] = {
|
|
90359
|
-
value: serialized,
|
|
90360
|
-
lastModified: Date.now(),
|
|
90361
|
-
ttl: options == null ? void 0 : options.ttl,
|
|
90362
|
-
tags: new Set((options == null ? void 0 : options.tags) || [])
|
|
90363
|
-
};
|
|
90364
|
-
}
|
|
90365
|
-
async delete(key) {
|
|
90366
|
-
delete this.cache[key];
|
|
90367
|
-
}
|
|
90368
|
-
async expireTag(tag) {
|
|
90369
|
-
const tags = Array.isArray(tag) ? tag : [tag];
|
|
90370
|
-
for (const key in this.cache) {
|
|
90371
|
-
if (Object.prototype.hasOwnProperty.call(this.cache, key)) {
|
|
90372
|
-
const entry2 = this.cache[key];
|
|
90373
|
-
if (tags.some((t) => entry2.tags.has(t))) {
|
|
90374
|
-
delete this.cache[key];
|
|
90375
|
-
}
|
|
90376
|
-
}
|
|
90377
|
-
}
|
|
90378
|
-
}
|
|
90379
|
-
}
|
|
90380
|
-
return inMemoryCache;
|
|
90381
|
-
}
|
|
90382
|
-
var buildClient;
|
|
90383
|
-
var hasRequiredBuildClient;
|
|
90384
|
-
function requireBuildClient() {
|
|
90385
|
-
if (hasRequiredBuildClient) return buildClient;
|
|
90386
|
-
hasRequiredBuildClient = 1;
|
|
90387
|
-
var __defProp3 = Object.defineProperty;
|
|
90388
|
-
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
90389
|
-
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
90390
|
-
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
90391
|
-
var __export2 = (target2, all2) => {
|
|
90392
|
-
for (var name2 in all2)
|
|
90393
|
-
__defProp3(target2, name2, { get: all2[name2], enumerable: true });
|
|
90394
|
-
};
|
|
90395
|
-
var __copyProps2 = (to2, from, except, desc) => {
|
|
90396
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
90397
|
-
for (let key of __getOwnPropNames2(from))
|
|
90398
|
-
if (!__hasOwnProp2.call(to2, key) && key !== except)
|
|
90399
|
-
__defProp3(to2, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
90400
|
-
}
|
|
90401
|
-
return to2;
|
|
90402
|
-
};
|
|
90403
|
-
var __toCommonJS = (mod) => __copyProps2(__defProp3({}, "__esModule", { value: true }), mod);
|
|
90404
|
-
var build_client_exports = {};
|
|
90405
|
-
__export2(build_client_exports, {
|
|
90406
|
-
BuildCache: () => BuildCache
|
|
90407
|
-
});
|
|
90408
|
-
buildClient = __toCommonJS(build_client_exports);
|
|
90409
|
-
var import_index = requireCache$3();
|
|
90410
|
-
class BuildCache {
|
|
90411
|
-
constructor({
|
|
90412
|
-
endpoint,
|
|
90413
|
-
headers: headers2,
|
|
90414
|
-
onError,
|
|
90415
|
-
timeout: timeout2 = 500
|
|
90416
|
-
}) {
|
|
90417
|
-
this.get = async (key) => {
|
|
90418
|
-
var _a3, _b2, _c2, _d2;
|
|
90419
|
-
const controller = new AbortController();
|
|
90420
|
-
const timeoutId = setTimeout(() => controller.abort(), this.timeout);
|
|
90421
|
-
try {
|
|
90422
|
-
const res = await fetch(`${this.endpoint}${key}`, {
|
|
90423
|
-
headers: this.headers,
|
|
90424
|
-
method: "GET",
|
|
90425
|
-
signal: controller.signal
|
|
90426
|
-
});
|
|
90427
|
-
if (res.status === 404) {
|
|
90428
|
-
clearTimeout(timeoutId);
|
|
90429
|
-
return null;
|
|
90430
|
-
}
|
|
90431
|
-
if (res.status === 200) {
|
|
90432
|
-
const cacheState = res.headers.get(
|
|
90433
|
-
import_index.HEADERS_VERCEL_CACHE_STATE
|
|
90434
|
-
);
|
|
90435
|
-
if (cacheState !== import_index.PkgCacheState.Fresh) {
|
|
90436
|
-
(_b2 = (_a3 = res.body) == null ? void 0 : _a3.cancel) == null ? void 0 : _b2.call(_a3);
|
|
90437
|
-
clearTimeout(timeoutId);
|
|
90438
|
-
return null;
|
|
90439
|
-
}
|
|
90440
|
-
const result = await res.json();
|
|
90441
|
-
clearTimeout(timeoutId);
|
|
90442
|
-
return result;
|
|
90443
|
-
} else {
|
|
90444
|
-
clearTimeout(timeoutId);
|
|
90445
|
-
throw new Error(`Failed to get cache: ${res.statusText}`);
|
|
90446
|
-
}
|
|
90447
|
-
} catch (error2) {
|
|
90448
|
-
clearTimeout(timeoutId);
|
|
90449
|
-
if (error2.name === "AbortError") {
|
|
90450
|
-
const timeoutError = new Error(
|
|
90451
|
-
`Cache request timed out after ${this.timeout}ms`
|
|
90452
|
-
);
|
|
90453
|
-
timeoutError.stack = error2.stack;
|
|
90454
|
-
(_c2 = this.onError) == null ? void 0 : _c2.call(this, timeoutError);
|
|
90455
|
-
} else {
|
|
90456
|
-
(_d2 = this.onError) == null ? void 0 : _d2.call(this, error2);
|
|
90457
|
-
}
|
|
90458
|
-
return null;
|
|
90459
|
-
}
|
|
90460
|
-
};
|
|
90461
|
-
this.set = async (key, value, options) => {
|
|
90462
|
-
var _a3, _b2;
|
|
90463
|
-
const controller = new AbortController();
|
|
90464
|
-
const timeoutId = setTimeout(() => controller.abort(), this.timeout);
|
|
90465
|
-
try {
|
|
90466
|
-
const optionalHeaders = {};
|
|
90467
|
-
if (options == null ? void 0 : options.ttl) {
|
|
90468
|
-
optionalHeaders[import_index.HEADERS_VERCEL_REVALIDATE] = options.ttl.toString();
|
|
90469
|
-
}
|
|
90470
|
-
if ((options == null ? void 0 : options.tags) && options.tags.length > 0) {
|
|
90471
|
-
optionalHeaders[import_index.HEADERS_VERCEL_CACHE_TAGS] = options.tags.join(",");
|
|
90472
|
-
}
|
|
90473
|
-
if (options == null ? void 0 : options.name) {
|
|
90474
|
-
optionalHeaders[import_index.HEADERS_VERCEL_CACHE_ITEM_NAME] = options.name;
|
|
90475
|
-
}
|
|
90476
|
-
const res = await fetch(`${this.endpoint}${key}`, {
|
|
90477
|
-
method: "POST",
|
|
90478
|
-
headers: {
|
|
90479
|
-
...this.headers,
|
|
90480
|
-
...optionalHeaders
|
|
90481
|
-
},
|
|
90482
|
-
body: JSON.stringify(value),
|
|
90483
|
-
signal: controller.signal
|
|
90484
|
-
});
|
|
90485
|
-
clearTimeout(timeoutId);
|
|
90486
|
-
if (res.status !== 200) {
|
|
90487
|
-
throw new Error(`Failed to set cache: ${res.status} ${res.statusText}`);
|
|
90488
|
-
}
|
|
90489
|
-
} catch (error2) {
|
|
90490
|
-
clearTimeout(timeoutId);
|
|
90491
|
-
if (error2.name === "AbortError") {
|
|
90492
|
-
const timeoutError = new Error(
|
|
90493
|
-
`Cache request timed out after ${this.timeout}ms`
|
|
90494
|
-
);
|
|
90495
|
-
timeoutError.stack = error2.stack;
|
|
90496
|
-
(_a3 = this.onError) == null ? void 0 : _a3.call(this, timeoutError);
|
|
90497
|
-
} else {
|
|
90498
|
-
(_b2 = this.onError) == null ? void 0 : _b2.call(this, error2);
|
|
90499
|
-
}
|
|
90500
|
-
}
|
|
90501
|
-
};
|
|
90502
|
-
this.delete = async (key) => {
|
|
90503
|
-
var _a3, _b2;
|
|
90504
|
-
const controller = new AbortController();
|
|
90505
|
-
const timeoutId = setTimeout(() => controller.abort(), this.timeout);
|
|
90506
|
-
try {
|
|
90507
|
-
const res = await fetch(`${this.endpoint}${key}`, {
|
|
90508
|
-
method: "DELETE",
|
|
90509
|
-
headers: this.headers,
|
|
90510
|
-
signal: controller.signal
|
|
90511
|
-
});
|
|
90512
|
-
clearTimeout(timeoutId);
|
|
90513
|
-
if (res.status !== 200) {
|
|
90514
|
-
throw new Error(`Failed to delete cache: ${res.statusText}`);
|
|
90515
|
-
}
|
|
90516
|
-
} catch (error2) {
|
|
90517
|
-
clearTimeout(timeoutId);
|
|
90518
|
-
if (error2.name === "AbortError") {
|
|
90519
|
-
const timeoutError = new Error(
|
|
90520
|
-
`Cache request timed out after ${this.timeout}ms`
|
|
90521
|
-
);
|
|
90522
|
-
timeoutError.stack = error2.stack;
|
|
90523
|
-
(_a3 = this.onError) == null ? void 0 : _a3.call(this, timeoutError);
|
|
90524
|
-
} else {
|
|
90525
|
-
(_b2 = this.onError) == null ? void 0 : _b2.call(this, error2);
|
|
90526
|
-
}
|
|
90527
|
-
}
|
|
90528
|
-
};
|
|
90529
|
-
this.expireTag = async (tag) => {
|
|
90530
|
-
var _a3, _b2;
|
|
90531
|
-
const controller = new AbortController();
|
|
90532
|
-
const timeoutId = setTimeout(() => controller.abort(), this.timeout);
|
|
90533
|
-
try {
|
|
90534
|
-
if (Array.isArray(tag)) {
|
|
90535
|
-
tag = tag.join(",");
|
|
90536
|
-
}
|
|
90537
|
-
const res = await fetch(`${this.endpoint}revalidate?tags=${tag}`, {
|
|
90538
|
-
method: "POST",
|
|
90539
|
-
headers: this.headers,
|
|
90540
|
-
signal: controller.signal
|
|
90541
|
-
});
|
|
90542
|
-
clearTimeout(timeoutId);
|
|
90543
|
-
if (res.status !== 200) {
|
|
90544
|
-
throw new Error(`Failed to revalidate tag: ${res.statusText}`);
|
|
90545
|
-
}
|
|
90546
|
-
} catch (error2) {
|
|
90547
|
-
clearTimeout(timeoutId);
|
|
90548
|
-
if (error2.name === "AbortError") {
|
|
90549
|
-
const timeoutError = new Error(
|
|
90550
|
-
`Cache request timed out after ${this.timeout}ms`
|
|
90551
|
-
);
|
|
90552
|
-
timeoutError.stack = error2.stack;
|
|
90553
|
-
(_a3 = this.onError) == null ? void 0 : _a3.call(this, timeoutError);
|
|
90554
|
-
} else {
|
|
90555
|
-
(_b2 = this.onError) == null ? void 0 : _b2.call(this, error2);
|
|
90556
|
-
}
|
|
90557
|
-
}
|
|
90558
|
-
};
|
|
90559
|
-
this.endpoint = endpoint;
|
|
90560
|
-
this.headers = headers2;
|
|
90561
|
-
this.onError = onError;
|
|
90562
|
-
this.timeout = timeout2;
|
|
90563
|
-
}
|
|
90564
|
-
}
|
|
90565
|
-
return buildClient;
|
|
90566
|
-
}
|
|
90567
|
-
var cache$3;
|
|
90568
|
-
var hasRequiredCache$3;
|
|
90569
|
-
function requireCache$3() {
|
|
90570
|
-
if (hasRequiredCache$3) return cache$3;
|
|
90571
|
-
hasRequiredCache$3 = 1;
|
|
90572
|
-
var __defProp3 = Object.defineProperty;
|
|
90573
|
-
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
90574
|
-
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
90575
|
-
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
90576
|
-
var __export2 = (target2, all2) => {
|
|
90577
|
-
for (var name2 in all2)
|
|
90578
|
-
__defProp3(target2, name2, { get: all2[name2], enumerable: true });
|
|
90579
|
-
};
|
|
90580
|
-
var __copyProps2 = (to2, from, except, desc) => {
|
|
90581
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
90582
|
-
for (let key of __getOwnPropNames2(from))
|
|
90583
|
-
if (!__hasOwnProp2.call(to2, key) && key !== except)
|
|
90584
|
-
__defProp3(to2, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
90585
|
-
}
|
|
90586
|
-
return to2;
|
|
90587
|
-
};
|
|
90588
|
-
var __toCommonJS = (mod) => __copyProps2(__defProp3({}, "__esModule", { value: true }), mod);
|
|
90589
|
-
var cache_exports = {};
|
|
90590
|
-
__export2(cache_exports, {
|
|
90591
|
-
HEADERS_VERCEL_CACHE_ITEM_NAME: () => HEADERS_VERCEL_CACHE_ITEM_NAME,
|
|
90592
|
-
HEADERS_VERCEL_CACHE_STATE: () => HEADERS_VERCEL_CACHE_STATE,
|
|
90593
|
-
HEADERS_VERCEL_CACHE_TAGS: () => HEADERS_VERCEL_CACHE_TAGS,
|
|
90594
|
-
HEADERS_VERCEL_REVALIDATE: () => HEADERS_VERCEL_REVALIDATE,
|
|
90595
|
-
PkgCacheState: () => PkgCacheState,
|
|
90596
|
-
getCache: () => getCache
|
|
90597
|
-
});
|
|
90598
|
-
cache$3 = __toCommonJS(cache_exports);
|
|
90599
|
-
var import_get_context = requireGetContext$1();
|
|
90600
|
-
var import_in_memory_cache = requireInMemoryCache();
|
|
90601
|
-
var import_build_client = requireBuildClient();
|
|
90602
|
-
const defaultKeyHashFunction = (key) => {
|
|
90603
|
-
let hash2 = 5381;
|
|
90604
|
-
for (let i = 0; i < key.length; i++) {
|
|
90605
|
-
hash2 = hash2 * 33 ^ key.charCodeAt(i);
|
|
90606
|
-
}
|
|
90607
|
-
return (hash2 >>> 0).toString(16);
|
|
90608
|
-
};
|
|
90609
|
-
const defaultNamespaceSeparator = "$";
|
|
90610
|
-
let inMemoryCacheInstance = null;
|
|
90611
|
-
let buildCacheInstance = null;
|
|
90612
|
-
const getCache = (cacheOptions) => {
|
|
90613
|
-
const resolveCache = () => {
|
|
90614
|
-
let cache2;
|
|
90615
|
-
if ((0, import_get_context.getContext)().cache) {
|
|
90616
|
-
cache2 = (0, import_get_context.getContext)().cache;
|
|
90617
|
-
} else {
|
|
90618
|
-
cache2 = getCacheImplementation(
|
|
90619
|
-
process.env.SUSPENSE_CACHE_DEBUG === "true"
|
|
90620
|
-
);
|
|
90621
|
-
}
|
|
90622
|
-
return cache2;
|
|
90623
|
-
};
|
|
90624
|
-
return wrapWithKeyTransformation(
|
|
90625
|
-
resolveCache,
|
|
90626
|
-
createKeyTransformer(cacheOptions)
|
|
90627
|
-
);
|
|
90628
|
-
};
|
|
90629
|
-
function createKeyTransformer(cacheOptions) {
|
|
90630
|
-
const hashFunction = (cacheOptions == null ? void 0 : cacheOptions.keyHashFunction) || defaultKeyHashFunction;
|
|
90631
|
-
return (key) => {
|
|
90632
|
-
if (!(cacheOptions == null ? void 0 : cacheOptions.namespace))
|
|
90633
|
-
return hashFunction(key);
|
|
90634
|
-
const separator = cacheOptions.namespaceSeparator || defaultNamespaceSeparator;
|
|
90635
|
-
return `${cacheOptions.namespace}${separator}${hashFunction(key)}`;
|
|
90636
|
-
};
|
|
90637
|
-
}
|
|
90638
|
-
function wrapWithKeyTransformation(resolveCache, makeKey) {
|
|
90639
|
-
return {
|
|
90640
|
-
get: (key) => {
|
|
90641
|
-
return resolveCache().get(makeKey(key));
|
|
90642
|
-
},
|
|
90643
|
-
set: (key, value, options) => {
|
|
90644
|
-
return resolveCache().set(makeKey(key), value, options);
|
|
90645
|
-
},
|
|
90646
|
-
delete: (key) => {
|
|
90647
|
-
return resolveCache().delete(makeKey(key));
|
|
90648
|
-
},
|
|
90649
|
-
expireTag: (tag) => {
|
|
90650
|
-
return resolveCache().expireTag(tag);
|
|
90651
|
-
}
|
|
90652
|
-
};
|
|
90653
|
-
}
|
|
90654
|
-
let warnedCacheUnavailable = false;
|
|
90655
|
-
function getCacheImplementation(debug) {
|
|
90656
|
-
if (!inMemoryCacheInstance) {
|
|
90657
|
-
inMemoryCacheInstance = new import_in_memory_cache.InMemoryCache();
|
|
90658
|
-
}
|
|
90659
|
-
if (process.env.RUNTIME_CACHE_DISABLE_BUILD_CACHE === "true") {
|
|
90660
|
-
debug && console.log("Using InMemoryCache as build cache is disabled");
|
|
90661
|
-
return inMemoryCacheInstance;
|
|
90662
|
-
}
|
|
90663
|
-
const { RUNTIME_CACHE_ENDPOINT, RUNTIME_CACHE_HEADERS } = process.env;
|
|
90664
|
-
if (debug) {
|
|
90665
|
-
console.log("Runtime cache environment variables:", {
|
|
90666
|
-
RUNTIME_CACHE_ENDPOINT,
|
|
90667
|
-
RUNTIME_CACHE_HEADERS
|
|
90668
|
-
});
|
|
90669
|
-
}
|
|
90670
|
-
if (!RUNTIME_CACHE_ENDPOINT || !RUNTIME_CACHE_HEADERS) {
|
|
90671
|
-
if (!warnedCacheUnavailable) {
|
|
90672
|
-
console.warn(
|
|
90673
|
-
"Runtime Cache unavailable in this environment. Falling back to in-memory cache."
|
|
90674
|
-
);
|
|
90675
|
-
warnedCacheUnavailable = true;
|
|
90676
|
-
}
|
|
90677
|
-
return inMemoryCacheInstance;
|
|
90678
|
-
}
|
|
90679
|
-
if (!buildCacheInstance) {
|
|
90680
|
-
let parsedHeaders = {};
|
|
90681
|
-
try {
|
|
90682
|
-
parsedHeaders = JSON.parse(RUNTIME_CACHE_HEADERS);
|
|
90683
|
-
} catch (e) {
|
|
90684
|
-
console.error("Failed to parse RUNTIME_CACHE_HEADERS:", e);
|
|
90685
|
-
return inMemoryCacheInstance;
|
|
90686
|
-
}
|
|
90687
|
-
let timeout2 = 500;
|
|
90688
|
-
if (process.env.RUNTIME_CACHE_TIMEOUT) {
|
|
90689
|
-
const parsed = parseInt(process.env.RUNTIME_CACHE_TIMEOUT, 10);
|
|
90690
|
-
if (!isNaN(parsed) && parsed > 0) {
|
|
90691
|
-
timeout2 = parsed;
|
|
90692
|
-
} else {
|
|
90693
|
-
console.warn(
|
|
90694
|
-
`Invalid RUNTIME_CACHE_TIMEOUT value: "${process.env.RUNTIME_CACHE_TIMEOUT}". Using default: ${timeout2}ms`
|
|
90695
|
-
);
|
|
90696
|
-
}
|
|
90697
|
-
}
|
|
90698
|
-
buildCacheInstance = new import_build_client.BuildCache({
|
|
90699
|
-
endpoint: RUNTIME_CACHE_ENDPOINT,
|
|
90700
|
-
headers: parsedHeaders,
|
|
90701
|
-
onError: (error2) => console.error(error2),
|
|
90702
|
-
timeout: timeout2
|
|
90703
|
-
});
|
|
90704
|
-
}
|
|
90705
|
-
return buildCacheInstance;
|
|
90706
|
-
}
|
|
90707
|
-
var PkgCacheState = /* @__PURE__ */ ((PkgCacheState2) => {
|
|
90708
|
-
PkgCacheState2["Fresh"] = "fresh";
|
|
90709
|
-
PkgCacheState2["Stale"] = "stale";
|
|
90710
|
-
PkgCacheState2["Expired"] = "expired";
|
|
90711
|
-
PkgCacheState2["NotFound"] = "notFound";
|
|
90712
|
-
PkgCacheState2["Error"] = "error";
|
|
90713
|
-
return PkgCacheState2;
|
|
90714
|
-
})(PkgCacheState || {});
|
|
90715
|
-
const HEADERS_VERCEL_CACHE_STATE = "x-vercel-cache-state";
|
|
90716
|
-
const HEADERS_VERCEL_REVALIDATE = "x-vercel-revalidate";
|
|
90717
|
-
const HEADERS_VERCEL_CACHE_TAGS = "x-vercel-cache-tags";
|
|
90718
|
-
const HEADERS_VERCEL_CACHE_ITEM_NAME = "x-vercel-cache-item-name";
|
|
90719
|
-
return cache$3;
|
|
90720
|
-
}
|
|
90721
|
-
var dbConnections;
|
|
90722
|
-
var hasRequiredDbConnections;
|
|
90723
|
-
function requireDbConnections() {
|
|
90724
|
-
if (hasRequiredDbConnections) return dbConnections;
|
|
90725
|
-
hasRequiredDbConnections = 1;
|
|
90726
|
-
var __defProp3 = Object.defineProperty;
|
|
90727
|
-
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
90728
|
-
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
90729
|
-
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
90730
|
-
var __export2 = (target2, all2) => {
|
|
90731
|
-
for (var name2 in all2)
|
|
90732
|
-
__defProp3(target2, name2, { get: all2[name2], enumerable: true });
|
|
90733
|
-
};
|
|
90734
|
-
var __copyProps2 = (to2, from, except, desc) => {
|
|
90735
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
90736
|
-
for (let key of __getOwnPropNames2(from))
|
|
90737
|
-
if (!__hasOwnProp2.call(to2, key) && key !== except)
|
|
90738
|
-
__defProp3(to2, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
90739
|
-
}
|
|
90740
|
-
return to2;
|
|
90741
|
-
};
|
|
90742
|
-
var __toCommonJS = (mod) => __copyProps2(__defProp3({}, "__esModule", { value: true }), mod);
|
|
90743
|
-
var db_connections_exports = {};
|
|
90744
|
-
__export2(db_connections_exports, {
|
|
90745
|
-
attachDatabasePool: () => attachDatabasePool,
|
|
90746
|
-
experimental_attachDatabasePool: () => experimental_attachDatabasePool
|
|
90747
|
-
});
|
|
90748
|
-
dbConnections = __toCommonJS(db_connections_exports);
|
|
90749
|
-
var import_get_context = requireGetContext$1();
|
|
90750
|
-
const DEBUG = !!process.env.DEBUG;
|
|
90751
|
-
function getIdleTimeout(dbPool) {
|
|
90752
|
-
if ("options" in dbPool && dbPool.options) {
|
|
90753
|
-
if ("idleTimeoutMillis" in dbPool.options) {
|
|
90754
|
-
return typeof dbPool.options.idleTimeoutMillis === "number" ? dbPool.options.idleTimeoutMillis : 1e4;
|
|
90755
|
-
}
|
|
90756
|
-
if ("maxIdleTimeMS" in dbPool.options) {
|
|
90757
|
-
return typeof dbPool.options.maxIdleTimeMS === "number" ? dbPool.options.maxIdleTimeMS : 0;
|
|
90758
|
-
}
|
|
90759
|
-
if ("status" in dbPool) {
|
|
90760
|
-
return 5e3;
|
|
90761
|
-
}
|
|
90762
|
-
if ("connect" in dbPool && "execute" in dbPool) {
|
|
90763
|
-
return 3e4;
|
|
90764
|
-
}
|
|
90765
|
-
}
|
|
90766
|
-
if ("config" in dbPool && dbPool.config) {
|
|
90767
|
-
if ("connectionConfig" in dbPool.config && dbPool.config.connectionConfig) {
|
|
90768
|
-
return dbPool.config.connectionConfig.idleTimeout || 6e4;
|
|
90769
|
-
}
|
|
90770
|
-
if ("idleTimeout" in dbPool.config) {
|
|
90771
|
-
return typeof dbPool.config.idleTimeout === "number" ? dbPool.config.idleTimeout : 6e4;
|
|
90772
|
-
}
|
|
90773
|
-
}
|
|
90774
|
-
if ("poolTimeout" in dbPool) {
|
|
90775
|
-
return typeof dbPool.poolTimeout === "number" ? dbPool.poolTimeout : 6e4;
|
|
90776
|
-
}
|
|
90777
|
-
if ("idleTimeout" in dbPool) {
|
|
90778
|
-
return typeof dbPool.idleTimeout === "number" ? dbPool.idleTimeout : 0;
|
|
90779
|
-
}
|
|
90780
|
-
return 1e4;
|
|
90781
|
-
}
|
|
90782
|
-
let idleTimeout = null;
|
|
90783
|
-
let idleTimeoutResolve = () => {
|
|
90784
|
-
};
|
|
90785
|
-
const bootTime = Date.now();
|
|
90786
|
-
const maximumDuration = 15 * 60 * 1e3 - 1e3;
|
|
90787
|
-
function waitUntilIdleTimeout(dbPool) {
|
|
90788
|
-
if (!process.env.VERCEL_URL || // This is not set during builds where we don't need to wait for idle connections using the mechanism
|
|
90789
|
-
!process.env.VERCEL_REGION) {
|
|
90790
|
-
return;
|
|
90791
|
-
}
|
|
90792
|
-
if (idleTimeout) {
|
|
90793
|
-
clearTimeout(idleTimeout);
|
|
90794
|
-
idleTimeoutResolve();
|
|
90795
|
-
}
|
|
90796
|
-
const promise2 = new Promise((resolve2) => {
|
|
90797
|
-
idleTimeoutResolve = resolve2;
|
|
90798
|
-
});
|
|
90799
|
-
const waitTime = Math.min(
|
|
90800
|
-
getIdleTimeout(dbPool) + 100,
|
|
90801
|
-
Math.max(100, maximumDuration - (Date.now() - bootTime))
|
|
90802
|
-
);
|
|
90803
|
-
idleTimeout = setTimeout(() => {
|
|
90804
|
-
idleTimeoutResolve == null ? void 0 : idleTimeoutResolve();
|
|
90805
|
-
if (DEBUG) {
|
|
90806
|
-
console.log("Database pool idle timeout reached. Releasing connections.");
|
|
90807
|
-
}
|
|
90808
|
-
}, waitTime);
|
|
90809
|
-
const requestContext = (0, import_get_context.getContext)();
|
|
90810
|
-
if (requestContext == null ? void 0 : requestContext.waitUntil) {
|
|
90811
|
-
requestContext.waitUntil(promise2);
|
|
90812
|
-
} else {
|
|
90813
|
-
console.warn("Pool release event triggered outside of request scope.");
|
|
90814
|
-
}
|
|
90815
|
-
}
|
|
90816
|
-
function attachDatabasePool(dbPool) {
|
|
90817
|
-
if (idleTimeout) {
|
|
90818
|
-
idleTimeoutResolve == null ? void 0 : idleTimeoutResolve();
|
|
90819
|
-
clearTimeout(idleTimeout);
|
|
90820
|
-
}
|
|
90821
|
-
if ("on" in dbPool && dbPool.on && "options" in dbPool && "idleTimeoutMillis" in dbPool.options) {
|
|
90822
|
-
const pgPool = dbPool;
|
|
90823
|
-
pgPool.on("release", () => {
|
|
90824
|
-
if (DEBUG) {
|
|
90825
|
-
console.log("Client released from pool");
|
|
90826
|
-
}
|
|
90827
|
-
waitUntilIdleTimeout(dbPool);
|
|
90828
|
-
});
|
|
90829
|
-
return;
|
|
90830
|
-
} else if ("on" in dbPool && dbPool.on && "config" in dbPool && dbPool.config && "connectionConfig" in dbPool.config) {
|
|
90831
|
-
const mysqlPool = dbPool;
|
|
90832
|
-
mysqlPool.on("release", () => {
|
|
90833
|
-
if (DEBUG) {
|
|
90834
|
-
console.log("MySQL client released from pool");
|
|
90835
|
-
}
|
|
90836
|
-
waitUntilIdleTimeout(dbPool);
|
|
90837
|
-
});
|
|
90838
|
-
return;
|
|
90839
|
-
} else if ("on" in dbPool && dbPool.on && "config" in dbPool && dbPool.config && "idleTimeout" in dbPool.config) {
|
|
90840
|
-
const mysql2Pool = dbPool;
|
|
90841
|
-
mysql2Pool.on("release", () => {
|
|
90842
|
-
if (DEBUG) {
|
|
90843
|
-
console.log("MySQL2/MariaDB client released from pool");
|
|
90844
|
-
}
|
|
90845
|
-
waitUntilIdleTimeout(dbPool);
|
|
90846
|
-
});
|
|
90847
|
-
return;
|
|
90848
|
-
}
|
|
90849
|
-
if ("on" in dbPool && dbPool.on && "options" in dbPool && dbPool.options && "maxIdleTimeMS" in dbPool.options) {
|
|
90850
|
-
const mongoPool = dbPool;
|
|
90851
|
-
mongoPool.on("connectionCheckedOut", () => {
|
|
90852
|
-
if (DEBUG) {
|
|
90853
|
-
console.log("MongoDB connection checked out");
|
|
90854
|
-
}
|
|
90855
|
-
waitUntilIdleTimeout(dbPool);
|
|
90856
|
-
});
|
|
90857
|
-
return;
|
|
90858
|
-
}
|
|
90859
|
-
if ("on" in dbPool && dbPool.on && "options" in dbPool && dbPool.options && "socket" in dbPool.options) {
|
|
90860
|
-
const redisPool = dbPool;
|
|
90861
|
-
redisPool.on("end", () => {
|
|
90862
|
-
if (DEBUG) {
|
|
90863
|
-
console.log("Redis connection ended");
|
|
90864
|
-
}
|
|
90865
|
-
waitUntilIdleTimeout(dbPool);
|
|
90866
|
-
});
|
|
90867
|
-
return;
|
|
90868
|
-
}
|
|
90869
|
-
throw new Error("Unsupported database pool type");
|
|
90870
|
-
}
|
|
90871
|
-
const experimental_attachDatabasePool = attachDatabasePool;
|
|
90872
|
-
return dbConnections;
|
|
90873
|
-
}
|
|
90874
|
-
var purge;
|
|
90875
|
-
var hasRequiredPurge;
|
|
90876
|
-
function requirePurge() {
|
|
90877
|
-
if (hasRequiredPurge) return purge;
|
|
90878
|
-
hasRequiredPurge = 1;
|
|
90879
|
-
var __defProp3 = Object.defineProperty;
|
|
90880
|
-
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
90881
|
-
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
90882
|
-
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
90883
|
-
var __export2 = (target2, all2) => {
|
|
90884
|
-
for (var name2 in all2)
|
|
90885
|
-
__defProp3(target2, name2, { get: all2[name2], enumerable: true });
|
|
90886
|
-
};
|
|
90887
|
-
var __copyProps2 = (to2, from, except, desc) => {
|
|
90888
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
90889
|
-
for (let key of __getOwnPropNames2(from))
|
|
90890
|
-
if (!__hasOwnProp2.call(to2, key) && key !== except)
|
|
90891
|
-
__defProp3(to2, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
90892
|
-
}
|
|
90893
|
-
return to2;
|
|
90894
|
-
};
|
|
90895
|
-
var __toCommonJS = (mod) => __copyProps2(__defProp3({}, "__esModule", { value: true }), mod);
|
|
90896
|
-
var purge_exports = {};
|
|
90897
|
-
__export2(purge_exports, {
|
|
90898
|
-
dangerouslyDeleteBySrcImage: () => dangerouslyDeleteBySrcImage,
|
|
90899
|
-
dangerouslyDeleteByTag: () => dangerouslyDeleteByTag,
|
|
90900
|
-
invalidateBySrcImage: () => invalidateBySrcImage,
|
|
90901
|
-
invalidateByTag: () => invalidateByTag
|
|
90902
|
-
});
|
|
90903
|
-
purge = __toCommonJS(purge_exports);
|
|
90904
|
-
var import_get_context = requireGetContext$1();
|
|
90905
|
-
const invalidateByTag = (tag) => {
|
|
90906
|
-
const api2 = (0, import_get_context.getContext)().purge;
|
|
90907
|
-
if (api2) {
|
|
90908
|
-
return api2.invalidateByTag(tag);
|
|
90909
|
-
}
|
|
90910
|
-
return Promise.resolve();
|
|
90911
|
-
};
|
|
90912
|
-
const dangerouslyDeleteByTag = (tag, options) => {
|
|
90913
|
-
const api2 = (0, import_get_context.getContext)().purge;
|
|
90914
|
-
if (api2) {
|
|
90915
|
-
return api2.dangerouslyDeleteByTag(tag, options);
|
|
90916
|
-
}
|
|
90917
|
-
return Promise.resolve();
|
|
90918
|
-
};
|
|
90919
|
-
const invalidateBySrcImage = (src2) => {
|
|
90920
|
-
const api2 = (0, import_get_context.getContext)().purge;
|
|
90921
|
-
return api2 ? api2.invalidateBySrcImage(src2) : Promise.resolve();
|
|
90922
|
-
};
|
|
90923
|
-
const dangerouslyDeleteBySrcImage = (src2, options) => {
|
|
90924
|
-
const api2 = (0, import_get_context.getContext)().purge;
|
|
90925
|
-
return api2 ? api2.dangerouslyDeleteBySrcImage(src2, options) : Promise.resolve();
|
|
90926
|
-
};
|
|
90927
|
-
return purge;
|
|
90928
|
-
}
|
|
90929
|
-
var addcachetag;
|
|
90930
|
-
var hasRequiredAddcachetag;
|
|
90931
|
-
function requireAddcachetag() {
|
|
90932
|
-
if (hasRequiredAddcachetag) return addcachetag;
|
|
90933
|
-
hasRequiredAddcachetag = 1;
|
|
90934
|
-
var __defProp3 = Object.defineProperty;
|
|
90935
|
-
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
90936
|
-
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
90937
|
-
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
90938
|
-
var __export2 = (target2, all2) => {
|
|
90939
|
-
for (var name2 in all2)
|
|
90940
|
-
__defProp3(target2, name2, { get: all2[name2], enumerable: true });
|
|
90941
|
-
};
|
|
90942
|
-
var __copyProps2 = (to2, from, except, desc) => {
|
|
90943
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
90944
|
-
for (let key of __getOwnPropNames2(from))
|
|
90945
|
-
if (!__hasOwnProp2.call(to2, key) && key !== except)
|
|
90946
|
-
__defProp3(to2, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
90947
|
-
}
|
|
90948
|
-
return to2;
|
|
90949
|
-
};
|
|
90950
|
-
var __toCommonJS = (mod) => __copyProps2(__defProp3({}, "__esModule", { value: true }), mod);
|
|
90951
|
-
var addcachetag_exports = {};
|
|
90952
|
-
__export2(addcachetag_exports, {
|
|
90953
|
-
addCacheTag: () => addCacheTag
|
|
90954
|
-
});
|
|
90955
|
-
addcachetag = __toCommonJS(addcachetag_exports);
|
|
90956
|
-
var import_get_context = requireGetContext$1();
|
|
90957
|
-
const addCacheTag = (tag) => {
|
|
90958
|
-
const addCacheTag2 = (0, import_get_context.getContext)().addCacheTag;
|
|
90959
|
-
if (addCacheTag2) {
|
|
90960
|
-
return addCacheTag2(tag);
|
|
90961
|
-
}
|
|
90962
|
-
return Promise.resolve();
|
|
90963
|
-
};
|
|
90964
|
-
return addcachetag;
|
|
90965
|
-
}
|
|
90966
|
-
var functions;
|
|
90967
|
-
var hasRequiredFunctions;
|
|
90968
|
-
function requireFunctions() {
|
|
90969
|
-
if (hasRequiredFunctions) return functions;
|
|
90970
|
-
hasRequiredFunctions = 1;
|
|
90971
|
-
var __defProp3 = Object.defineProperty;
|
|
90972
|
-
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
90973
|
-
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
90974
|
-
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
90975
|
-
var __export2 = (target2, all2) => {
|
|
90976
|
-
for (var name2 in all2)
|
|
90977
|
-
__defProp3(target2, name2, { get: all2[name2], enumerable: true });
|
|
90978
|
-
};
|
|
90979
|
-
var __copyProps2 = (to2, from, except, desc) => {
|
|
90980
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
90981
|
-
for (let key of __getOwnPropNames2(from))
|
|
90982
|
-
if (!__hasOwnProp2.call(to2, key) && key !== except)
|
|
90983
|
-
__defProp3(to2, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
90984
|
-
}
|
|
90985
|
-
return to2;
|
|
90986
|
-
};
|
|
90987
|
-
var __toCommonJS = (mod) => __copyProps2(__defProp3({}, "__esModule", { value: true }), mod);
|
|
90988
|
-
var src_exports = {};
|
|
90989
|
-
__export2(src_exports, {
|
|
90990
|
-
addCacheTag: () => import_addcachetag.addCacheTag,
|
|
90991
|
-
attachDatabasePool: () => import_db_connections.attachDatabasePool,
|
|
90992
|
-
dangerouslyDeleteBySrcImage: () => import_purge.dangerouslyDeleteBySrcImage,
|
|
90993
|
-
dangerouslyDeleteByTag: () => import_purge.dangerouslyDeleteByTag,
|
|
90994
|
-
experimental_attachDatabasePool: () => import_db_connections.experimental_attachDatabasePool,
|
|
90995
|
-
geolocation: () => import_headers.geolocation,
|
|
90996
|
-
getCache: () => import_cache.getCache,
|
|
90997
|
-
getEnv: () => import_get_env.getEnv,
|
|
90998
|
-
invalidateBySrcImage: () => import_purge.invalidateBySrcImage,
|
|
90999
|
-
invalidateByTag: () => import_purge.invalidateByTag,
|
|
91000
|
-
ipAddress: () => import_headers.ipAddress,
|
|
91001
|
-
next: () => import_middleware.next,
|
|
91002
|
-
rewrite: () => import_middleware.rewrite,
|
|
91003
|
-
waitUntil: () => import_wait_until.waitUntil
|
|
91004
|
-
});
|
|
91005
|
-
functions = __toCommonJS(src_exports);
|
|
91006
|
-
var import_headers = requireHeaders$1();
|
|
91007
|
-
var import_get_env = requireGetEnv();
|
|
91008
|
-
var import_wait_until = requireWaitUntil();
|
|
91009
|
-
var import_middleware = requireMiddleware();
|
|
91010
|
-
var import_cache = requireCache$3();
|
|
91011
|
-
var import_db_connections = requireDbConnections();
|
|
91012
|
-
var import_purge = requirePurge();
|
|
91013
|
-
var import_addcachetag = requireAddcachetag();
|
|
91014
|
-
return functions;
|
|
91015
|
-
}
|
|
91016
|
-
var functionsExports = requireFunctions();
|
|
91017
90085
|
function getWorkflowRunStreamId(runId, namespace2) {
|
|
91018
90086
|
const streamId = `${runId.replace("wrun_", "strm_")}_user`;
|
|
91019
90087
|
if (!namespace2) {
|
|
@@ -91025,12 +90093,6 @@ function getWorkflowRunStreamId(runId, namespace2) {
|
|
|
91025
90093
|
function getAbortStreamId(id2) {
|
|
91026
90094
|
return `strm_${id2}_system_abort`;
|
|
91027
90095
|
}
|
|
91028
|
-
async function waitedUntil(fn2) {
|
|
91029
|
-
const result = fn2();
|
|
91030
|
-
functionsExports.waitUntil(result.catch(() => {
|
|
91031
|
-
}));
|
|
91032
|
-
return result;
|
|
91033
|
-
}
|
|
91034
90096
|
var EventConsumerResult;
|
|
91035
90097
|
(function(EventConsumerResult2) {
|
|
91036
90098
|
EventConsumerResult2[EventConsumerResult2["Consumed"] = 0] = "Consumed";
|
|
@@ -91232,6 +90294,55 @@ function getDeserializeStream(revivers, cryptoKey) {
|
|
|
91232
90294
|
});
|
|
91233
90295
|
return stream;
|
|
91234
90296
|
}
|
|
90297
|
+
const MAX_FRAME_SIZE = 1e8;
|
|
90298
|
+
function getByteFramingStream() {
|
|
90299
|
+
return new TransformStream({
|
|
90300
|
+
transform(chunk, controller) {
|
|
90301
|
+
if (chunk.length === 0)
|
|
90302
|
+
return;
|
|
90303
|
+
if (chunk.length > MAX_FRAME_SIZE) {
|
|
90304
|
+
controller.error(new WorkflowRuntimeError(`Byte-stream chunk of ${chunk.length} bytes exceeds the maximum framed chunk size (${MAX_FRAME_SIZE}). Split the data into smaller chunks before writing.`, { slug: "serialization-failed" }));
|
|
90305
|
+
return;
|
|
90306
|
+
}
|
|
90307
|
+
const frame2 = new Uint8Array(FRAME_HEADER_SIZE$1 + chunk.length);
|
|
90308
|
+
new DataView(frame2.buffer).setUint32(0, chunk.length, false);
|
|
90309
|
+
frame2.set(chunk, FRAME_HEADER_SIZE$1);
|
|
90310
|
+
controller.enqueue(frame2);
|
|
90311
|
+
}
|
|
90312
|
+
});
|
|
90313
|
+
}
|
|
90314
|
+
function getByteUnframingStream() {
|
|
90315
|
+
let buffer2 = new Uint8Array(0);
|
|
90316
|
+
function appendToBuffer(data) {
|
|
90317
|
+
const next2 = new Uint8Array(buffer2.length + data.length);
|
|
90318
|
+
next2.set(buffer2, 0);
|
|
90319
|
+
next2.set(data, buffer2.length);
|
|
90320
|
+
buffer2 = next2;
|
|
90321
|
+
}
|
|
90322
|
+
return new TransformStream({
|
|
90323
|
+
transform(chunk, controller) {
|
|
90324
|
+
if (chunk.length > 0)
|
|
90325
|
+
appendToBuffer(chunk);
|
|
90326
|
+
while (buffer2.length >= FRAME_HEADER_SIZE$1) {
|
|
90327
|
+
const frameLength = new DataView(buffer2.buffer, buffer2.byteOffset, buffer2.byteLength).getUint32(0, false);
|
|
90328
|
+
if (frameLength > MAX_FRAME_SIZE) {
|
|
90329
|
+
controller.error(new WorkflowRuntimeError(`Byte-stream frame length ${frameLength} exceeds maximum (${MAX_FRAME_SIZE}). This usually means a non-framed byte stream is being read as framed.`, { slug: "serialization-failed" }));
|
|
90330
|
+
return;
|
|
90331
|
+
}
|
|
90332
|
+
const total = FRAME_HEADER_SIZE$1 + frameLength;
|
|
90333
|
+
if (buffer2.length < total)
|
|
90334
|
+
break;
|
|
90335
|
+
controller.enqueue(buffer2.slice(FRAME_HEADER_SIZE$1, total));
|
|
90336
|
+
buffer2 = buffer2.slice(total);
|
|
90337
|
+
}
|
|
90338
|
+
},
|
|
90339
|
+
flush(controller) {
|
|
90340
|
+
if (buffer2.length > 0) {
|
|
90341
|
+
controller.error(new WorkflowRuntimeError(`Byte-stream ended with ${buffer2.length} bytes of incomplete frame data. The stream was truncated mid-frame.`, { slug: "serialization-failed" }));
|
|
90342
|
+
}
|
|
90343
|
+
}
|
|
90344
|
+
});
|
|
90345
|
+
}
|
|
91235
90346
|
class WorkflowServerReadableStream extends ReadableStream {
|
|
91236
90347
|
constructor(runId, name2, startIndex) {
|
|
91237
90348
|
if (typeof name2 !== "string" || name2.length === 0) {
|
|
@@ -91271,6 +90382,107 @@ class WorkflowServerReadableStream extends ReadableStream {
|
|
|
91271
90382
|
}
|
|
91272
90383
|
}
|
|
91273
90384
|
_reader = new WeakMap();
|
|
90385
|
+
const FRAMED_STREAM_MAX_RECONNECTS = 50;
|
|
90386
|
+
const FRAMED_STREAM_MAX_TOTAL_RECONNECTS = 1e3;
|
|
90387
|
+
function createReconnectingFramedStream(runId, name2, startIndex) {
|
|
90388
|
+
const reconnectSupported = startIndex === void 0 || startIndex >= 0;
|
|
90389
|
+
let currentStartIndex = startIndex ?? 0;
|
|
90390
|
+
let consumedFrames = 0;
|
|
90391
|
+
let reconnectCount = 0;
|
|
90392
|
+
let totalReconnectCount = 0;
|
|
90393
|
+
let reader;
|
|
90394
|
+
let buffer2 = new Uint8Array(0);
|
|
90395
|
+
async function connect2() {
|
|
90396
|
+
const world = await getWorldLazy();
|
|
90397
|
+
const effectiveStartIndex = reconnectSupported ? currentStartIndex + consumedFrames : startIndex;
|
|
90398
|
+
const stream = await world.streams.get(runId, name2, effectiveStartIndex);
|
|
90399
|
+
reader = stream.getReader();
|
|
90400
|
+
}
|
|
90401
|
+
async function reconnect() {
|
|
90402
|
+
reconnectCount++;
|
|
90403
|
+
totalReconnectCount++;
|
|
90404
|
+
if (reconnectCount > FRAMED_STREAM_MAX_RECONNECTS) {
|
|
90405
|
+
throw new Error(`Stream "${name2}" exceeded maximum reconnection attempts (${FRAMED_STREAM_MAX_RECONNECTS})`);
|
|
90406
|
+
}
|
|
90407
|
+
if (totalReconnectCount > FRAMED_STREAM_MAX_TOTAL_RECONNECTS) {
|
|
90408
|
+
throw new Error(`Stream "${name2}" exceeded maximum total reconnection attempts (${FRAMED_STREAM_MAX_TOTAL_RECONNECTS})`);
|
|
90409
|
+
}
|
|
90410
|
+
if (reader) {
|
|
90411
|
+
await reader.cancel().catch(() => {
|
|
90412
|
+
});
|
|
90413
|
+
reader = void 0;
|
|
90414
|
+
}
|
|
90415
|
+
currentStartIndex += consumedFrames;
|
|
90416
|
+
consumedFrames = 0;
|
|
90417
|
+
buffer2 = new Uint8Array(0);
|
|
90418
|
+
await connect2();
|
|
90419
|
+
}
|
|
90420
|
+
return new ReadableStream({
|
|
90421
|
+
pull: async (controller) => {
|
|
90422
|
+
for (; ; ) {
|
|
90423
|
+
if (!reader) {
|
|
90424
|
+
try {
|
|
90425
|
+
await connect2();
|
|
90426
|
+
} catch (err) {
|
|
90427
|
+
controller.error(err);
|
|
90428
|
+
return;
|
|
90429
|
+
}
|
|
90430
|
+
}
|
|
90431
|
+
let result;
|
|
90432
|
+
try {
|
|
90433
|
+
result = await reader.read();
|
|
90434
|
+
} catch (err) {
|
|
90435
|
+
if (!reconnectSupported) {
|
|
90436
|
+
controller.error(err);
|
|
90437
|
+
return;
|
|
90438
|
+
}
|
|
90439
|
+
try {
|
|
90440
|
+
await reconnect();
|
|
90441
|
+
} catch (reconnectErr) {
|
|
90442
|
+
controller.error(reconnectErr);
|
|
90443
|
+
return;
|
|
90444
|
+
}
|
|
90445
|
+
continue;
|
|
90446
|
+
}
|
|
90447
|
+
if (result.done || !result.value) {
|
|
90448
|
+
reader = void 0;
|
|
90449
|
+
controller.close();
|
|
90450
|
+
return;
|
|
90451
|
+
}
|
|
90452
|
+
const incoming = result.value;
|
|
90453
|
+
if (incoming.length > 0) {
|
|
90454
|
+
const combined = new Uint8Array(buffer2.length + incoming.length);
|
|
90455
|
+
combined.set(buffer2, 0);
|
|
90456
|
+
combined.set(incoming, buffer2.length);
|
|
90457
|
+
buffer2 = combined;
|
|
90458
|
+
}
|
|
90459
|
+
let emitted = false;
|
|
90460
|
+
while (buffer2.length >= FRAME_HEADER_SIZE$1) {
|
|
90461
|
+
const frameLength = new DataView(buffer2.buffer, buffer2.byteOffset, buffer2.byteLength).getUint32(0, false);
|
|
90462
|
+
const total = FRAME_HEADER_SIZE$1 + frameLength;
|
|
90463
|
+
if (buffer2.length < total)
|
|
90464
|
+
break;
|
|
90465
|
+
controller.enqueue(buffer2.slice(0, total));
|
|
90466
|
+
buffer2 = buffer2.slice(total);
|
|
90467
|
+
consumedFrames++;
|
|
90468
|
+
emitted = true;
|
|
90469
|
+
}
|
|
90470
|
+
if (emitted) {
|
|
90471
|
+
reconnectCount = 0;
|
|
90472
|
+
return;
|
|
90473
|
+
}
|
|
90474
|
+
}
|
|
90475
|
+
},
|
|
90476
|
+
cancel: async () => {
|
|
90477
|
+
if (reader) {
|
|
90478
|
+
await reader.cancel().catch((err) => {
|
|
90479
|
+
console.warn("Error closing ReadableStream reader:", err);
|
|
90480
|
+
});
|
|
90481
|
+
reader = void 0;
|
|
90482
|
+
}
|
|
90483
|
+
}
|
|
90484
|
+
});
|
|
90485
|
+
}
|
|
91274
90486
|
const STREAM_FLUSH_INTERVAL_MS = 10;
|
|
91275
90487
|
class WorkflowServerWritableStream extends WritableStream {
|
|
91276
90488
|
constructor(runId, name2) {
|
|
@@ -91456,7 +90668,7 @@ function attachAbortListenerOnce(signal, streamName, runId, cryptoKey, ops) {
|
|
|
91456
90668
|
})());
|
|
91457
90669
|
}, { once: true });
|
|
91458
90670
|
}
|
|
91459
|
-
function getExternalReducers(global2 = globalThis, ops, runId, cryptoKey) {
|
|
90671
|
+
function getExternalReducers(global2 = globalThis, ops, runId, cryptoKey, framedByteStreams = false) {
|
|
91460
90672
|
return {
|
|
91461
90673
|
...getAllBaseReducers(global2),
|
|
91462
90674
|
ReadableStream: (value) => {
|
|
@@ -91472,13 +90684,19 @@ function getExternalReducers(global2 = globalThis, ops, runId, cryptoKey) {
|
|
|
91472
90684
|
const type = getStreamType(value);
|
|
91473
90685
|
const writable = new WorkflowServerWritableStream(runId, name2);
|
|
91474
90686
|
if (type === "bytes") {
|
|
91475
|
-
|
|
90687
|
+
if (framedByteStreams) {
|
|
90688
|
+
ops.push(value.pipeThrough(getByteFramingStream()).pipeTo(writable));
|
|
90689
|
+
} else {
|
|
90690
|
+
ops.push(value.pipeTo(writable));
|
|
90691
|
+
}
|
|
91476
90692
|
} else {
|
|
91477
|
-
ops.push(value.pipeThrough(getSerializeStream(getExternalReducers(global2, ops, runId, cryptoKey), cryptoKey)).pipeTo(writable));
|
|
90693
|
+
ops.push(value.pipeThrough(getSerializeStream(getExternalReducers(global2, ops, runId, cryptoKey, framedByteStreams), cryptoKey)).pipeTo(writable));
|
|
91478
90694
|
}
|
|
91479
90695
|
const s2 = { name: name2 };
|
|
91480
90696
|
if (type)
|
|
91481
90697
|
s2.type = type;
|
|
90698
|
+
if (type === "bytes" && framedByteStreams)
|
|
90699
|
+
s2.framing = "framed-v1";
|
|
91482
90700
|
return s2;
|
|
91483
90701
|
},
|
|
91484
90702
|
WritableStream: (value) => {
|
|
@@ -91535,6 +90753,9 @@ function getWorkflowReducers(global2 = globalThis) {
|
|
|
91535
90753
|
const type = value[STREAM_TYPE_SYMBOL];
|
|
91536
90754
|
if (type)
|
|
91537
90755
|
s2.type = type;
|
|
90756
|
+
const framing = value[STREAM_FRAMING_SYMBOL];
|
|
90757
|
+
if (framing)
|
|
90758
|
+
s2.framing = framing;
|
|
91538
90759
|
return s2;
|
|
91539
90760
|
},
|
|
91540
90761
|
WritableStream: (value) => {
|
|
@@ -91579,7 +90800,7 @@ function getWorkflowReducers(global2 = globalThis) {
|
|
|
91579
90800
|
}
|
|
91580
90801
|
};
|
|
91581
90802
|
}
|
|
91582
|
-
function getStepReducers(global2 = globalThis, ops, runId, cryptoKey) {
|
|
90803
|
+
function getStepReducers(global2 = globalThis, ops, runId, cryptoKey, framedByteStreams = false) {
|
|
91583
90804
|
return {
|
|
91584
90805
|
...getAllBaseReducers(global2),
|
|
91585
90806
|
ReadableStream: (value) => {
|
|
@@ -91592,20 +90813,28 @@ function getStepReducers(global2 = globalThis, ops, runId, cryptoKey) {
|
|
|
91592
90813
|
}
|
|
91593
90814
|
let name2 = value[STREAM_NAME_SYMBOL];
|
|
91594
90815
|
let type = value[STREAM_TYPE_SYMBOL];
|
|
90816
|
+
let framing = value[STREAM_FRAMING_SYMBOL];
|
|
91595
90817
|
if (!name2) {
|
|
91596
90818
|
const streamId = (global2[STABLE_ULID] || defaultUlid)();
|
|
91597
90819
|
name2 = `strm_${streamId}`;
|
|
91598
90820
|
type = getStreamType(value);
|
|
90821
|
+
framing = type === "bytes" && framedByteStreams ? "framed-v1" : framing;
|
|
91599
90822
|
const writable = new WorkflowServerWritableStream(runId, name2);
|
|
91600
90823
|
if (type === "bytes") {
|
|
91601
|
-
|
|
90824
|
+
if (framing === "framed-v1") {
|
|
90825
|
+
ops.push(value.pipeThrough(getByteFramingStream()).pipeTo(writable));
|
|
90826
|
+
} else {
|
|
90827
|
+
ops.push(value.pipeTo(writable));
|
|
90828
|
+
}
|
|
91602
90829
|
} else {
|
|
91603
|
-
ops.push(value.pipeThrough(getSerializeStream(getStepReducers(global2, ops, runId, cryptoKey), cryptoKey)).pipeTo(writable));
|
|
90830
|
+
ops.push(value.pipeThrough(getSerializeStream(getStepReducers(global2, ops, runId, cryptoKey, framedByteStreams), cryptoKey)).pipeTo(writable));
|
|
91604
90831
|
}
|
|
91605
90832
|
}
|
|
91606
90833
|
const s2 = { name: name2 };
|
|
91607
90834
|
if (type)
|
|
91608
90835
|
s2.type = type;
|
|
90836
|
+
if (framing)
|
|
90837
|
+
s2.framing = framing;
|
|
91609
90838
|
return s2;
|
|
91610
90839
|
},
|
|
91611
90840
|
WritableStream: (value) => {
|
|
@@ -91806,16 +91035,17 @@ function getExternalRevivers(global2 = globalThis, ops, runId, cryptoKey) {
|
|
|
91806
91035
|
const response2 = new global2.Response(bodyInit);
|
|
91807
91036
|
return response2.body;
|
|
91808
91037
|
}
|
|
91809
|
-
const readable2 = new WorkflowServerReadableStream(runId, value.name, value.startIndex);
|
|
91810
91038
|
if (value.type === "bytes") {
|
|
91039
|
+
const readable2 = new WorkflowServerReadableStream(runId, value.name, value.startIndex);
|
|
91811
91040
|
const state = createFlushableState();
|
|
91812
91041
|
ops.push(state.promise);
|
|
91813
|
-
const { readable: userReadable, writable } = new global2.TransformStream();
|
|
91042
|
+
const { readable: userReadable, writable } = value.framing === "framed-v1" ? getByteUnframingStream() : new global2.TransformStream();
|
|
91814
91043
|
flushablePipe(readable2, writable, state).catch(() => {
|
|
91815
91044
|
});
|
|
91816
91045
|
pollReadableLock(userReadable, state);
|
|
91817
91046
|
return userReadable;
|
|
91818
91047
|
} else {
|
|
91048
|
+
const readable2 = createReconnectingFramedStream(runId, value.name, value.startIndex);
|
|
91819
91049
|
const transform2 = getDeserializeStream(getExternalRevivers(global2, ops, runId, cryptoKey), cryptoKey);
|
|
91820
91050
|
const state = createFlushableState();
|
|
91821
91051
|
ops.push(state.promise);
|
|
@@ -91903,6 +91133,15 @@ function getWorkflowRevivers(global2 = globalThis) {
|
|
|
91903
91133
|
[STREAM_TYPE_SYMBOL]: {
|
|
91904
91134
|
value: value.type,
|
|
91905
91135
|
writable: false
|
|
91136
|
+
},
|
|
91137
|
+
// Carry the wire-framing decision through the workflow VM so
|
|
91138
|
+
// that when the handle is later passed to a step (which reads
|
|
91139
|
+
// the actual bytes from the server) we know whether to unframe.
|
|
91140
|
+
// Defaults to undefined for streams whose serialized ref didn't
|
|
91141
|
+
// carry the field — those are treated as legacy raw bytes.
|
|
91142
|
+
[STREAM_FRAMING_SYMBOL]: {
|
|
91143
|
+
value: value.framing,
|
|
91144
|
+
writable: false
|
|
91906
91145
|
}
|
|
91907
91146
|
});
|
|
91908
91147
|
},
|
|
@@ -92064,7 +91303,7 @@ function getStepRevivers(global2 = globalThis, ops, runId, cryptoKey, deployment
|
|
|
92064
91303
|
if (value.type === "bytes") {
|
|
92065
91304
|
const state = createFlushableState();
|
|
92066
91305
|
ops.push(state.promise);
|
|
92067
|
-
const { readable: userReadable, writable } = new global2.TransformStream();
|
|
91306
|
+
const { readable: userReadable, writable } = value.framing === "framed-v1" ? getByteUnframingStream() : new global2.TransformStream();
|
|
92068
91307
|
flushablePipe(readable2, writable, state).catch(() => {
|
|
92069
91308
|
});
|
|
92070
91309
|
pollReadableLock(userReadable, state);
|
|
@@ -92113,15 +91352,15 @@ function getStepRevivers(global2 = globalThis, ops, runId, cryptoKey, deployment
|
|
|
92113
91352
|
async function maybeDecrypt(data, key) {
|
|
92114
91353
|
return decrypt(data, key);
|
|
92115
91354
|
}
|
|
92116
|
-
async function dehydrateWorkflowArguments(value, runId, key, ops = [], global2 = globalThis, v1Compat = false) {
|
|
91355
|
+
async function dehydrateWorkflowArguments(value, runId, key, ops = [], global2 = globalThis, v1Compat = false, framedByteStreams = false) {
|
|
92117
91356
|
if (v1Compat) {
|
|
92118
|
-
const str = stringify$2(value, getExternalReducers(global2, ops, runId, key));
|
|
91357
|
+
const str = stringify$2(value, getExternalReducers(global2, ops, runId, key, framedByteStreams));
|
|
92119
91358
|
return revive(str);
|
|
92120
91359
|
}
|
|
92121
91360
|
try {
|
|
92122
91361
|
return await serialize$1(value, key, {
|
|
92123
91362
|
global: global2,
|
|
92124
|
-
extraReducers: getStreamAndRequestReducers(getExternalReducers(global2, ops, runId, key))
|
|
91363
|
+
extraReducers: getStreamAndRequestReducers(getExternalReducers(global2, ops, runId, key, framedByteStreams))
|
|
92125
91364
|
});
|
|
92126
91365
|
} catch (error2) {
|
|
92127
91366
|
const cause = unwrapSerializationCause(error2);
|
|
@@ -92172,15 +91411,15 @@ async function hydrateStepArguments(value, runId, key, ops = [], global2 = globa
|
|
|
92172
91411
|
}
|
|
92173
91412
|
});
|
|
92174
91413
|
}
|
|
92175
|
-
async function dehydrateStepReturnValue(value, runId, key, ops = [], global2 = globalThis, v1Compat = false) {
|
|
91414
|
+
async function dehydrateStepReturnValue(value, runId, key, ops = [], global2 = globalThis, v1Compat = false, framedByteStreams = false) {
|
|
92176
91415
|
if (v1Compat) {
|
|
92177
|
-
const str = stringify$2(value, getStepReducers(global2, ops, runId, key));
|
|
91416
|
+
const str = stringify$2(value, getStepReducers(global2, ops, runId, key, framedByteStreams));
|
|
92178
91417
|
return revive(str);
|
|
92179
91418
|
}
|
|
92180
91419
|
try {
|
|
92181
91420
|
return await serialize(value, key, {
|
|
92182
91421
|
global: global2,
|
|
92183
|
-
extraReducers: getStreamAndRequestReducers(getStepReducers(global2, ops, runId, key))
|
|
91422
|
+
extraReducers: getStreamAndRequestReducers(getStepReducers(global2, ops, runId, key, framedByteStreams))
|
|
92184
91423
|
});
|
|
92185
91424
|
} catch (error2) {
|
|
92186
91425
|
const cause = unwrapSerializationCause(error2);
|
|
@@ -118490,13 +117729,11 @@ function isDetachedArrayBufferQueueError(error2) {
|
|
|
118490
117729
|
return false;
|
|
118491
117730
|
}
|
|
118492
117731
|
function getQueueRoute(queueName) {
|
|
118493
|
-
|
|
118494
|
-
|
|
118495
|
-
|
|
118496
|
-
|
|
118497
|
-
|
|
118498
|
-
}
|
|
118499
|
-
throw new Error("Unknown queue name prefix");
|
|
117732
|
+
const { kind, prefix } = parseQueueName(queueName);
|
|
117733
|
+
return {
|
|
117734
|
+
pathname: kind === "workflow" ? "flow" : "step",
|
|
117735
|
+
prefix
|
|
117736
|
+
};
|
|
118500
117737
|
}
|
|
118501
117738
|
function createQueue$2(config2) {
|
|
118502
117739
|
const httpAgent = new undiciExports.Agent({
|
|
@@ -118507,6 +117744,8 @@ function createQueue$2(config2) {
|
|
|
118507
117744
|
const transport = new TypedJsonTransport();
|
|
118508
117745
|
const generateId2 = monotonicFactory();
|
|
118509
117746
|
const semaphore = new libExports.Sema(WORKFLOW_LOCAL_QUEUE_CONCURRENCY);
|
|
117747
|
+
const closeController = new AbortController();
|
|
117748
|
+
const closeSignal = closeController.signal;
|
|
118510
117749
|
const inflightMessages = /* @__PURE__ */ new Map();
|
|
118511
117750
|
const directHandlers = /* @__PURE__ */ new Map();
|
|
118512
117751
|
const queue = async (queueName, message2, opts) => {
|
|
@@ -118531,6 +117770,10 @@ function createQueue$2(config2) {
|
|
|
118531
117770
|
});
|
|
118532
117771
|
}
|
|
118533
117772
|
(async () => {
|
|
117773
|
+
if ((opts == null ? void 0 : opts.delaySeconds) && opts.delaySeconds > 0) {
|
|
117774
|
+
const delayMs = Math.min(opts.delaySeconds * 1e3, MAX_SAFE_TIMEOUT_MS);
|
|
117775
|
+
await setTimeout$1(delayMs, void 0, { signal: closeSignal });
|
|
117776
|
+
}
|
|
118534
117777
|
const token = semaphore.tryAcquire();
|
|
118535
117778
|
if (!token) {
|
|
118536
117779
|
console.warn(`[world-local]: concurrency limit (${WORKFLOW_LOCAL_QUEUE_CONCURRENCY}) reached, waiting for queue to free up`);
|
|
@@ -118572,7 +117815,9 @@ function createQueue$2(config2) {
|
|
|
118572
117815
|
if (Number.isFinite(timeoutSeconds) && timeoutSeconds >= 0) {
|
|
118573
117816
|
if (timeoutSeconds > 0) {
|
|
118574
117817
|
const timeoutMs = Math.min(timeoutSeconds * 1e3, MAX_SAFE_TIMEOUT_MS);
|
|
118575
|
-
await setTimeout$1(timeoutMs
|
|
117818
|
+
await setTimeout$1(timeoutMs, void 0, {
|
|
117819
|
+
signal: closeSignal
|
|
117820
|
+
});
|
|
118576
117821
|
}
|
|
118577
117822
|
continue;
|
|
118578
117823
|
}
|
|
@@ -118587,7 +117832,7 @@ function createQueue$2(config2) {
|
|
|
118587
117832
|
...stepId && { stepId },
|
|
118588
117833
|
handlerError: text2
|
|
118589
117834
|
});
|
|
118590
|
-
await setTimeout$1(5e3);
|
|
117835
|
+
await setTimeout$1(5e3, void 0, { signal: closeSignal });
|
|
118591
117836
|
}
|
|
118592
117837
|
console.error(`[world-local] Queue message exhausted safety limit (${MAX_LOCAL_SAFETY_LIMIT} attempts)`, {
|
|
118593
117838
|
queueName,
|
|
@@ -118667,6 +117912,9 @@ function createQueue$2(config2) {
|
|
|
118667
117912
|
directHandlers.set(prefix, handler);
|
|
118668
117913
|
},
|
|
118669
117914
|
async close() {
|
|
117915
|
+
if (closeSignal.aborted)
|
|
117916
|
+
return;
|
|
117917
|
+
closeController.abort();
|
|
118670
117918
|
await httpAgent.close();
|
|
118671
117919
|
}
|
|
118672
117920
|
};
|
|
@@ -118674,6 +117922,10 @@ function createQueue$2(config2) {
|
|
|
118674
117922
|
function hashToken(token) {
|
|
118675
117923
|
return createHash("sha256").update(token).digest("hex");
|
|
118676
117924
|
}
|
|
117925
|
+
function hookRecoveryMarkerPath(basedir, token, runId, hookId) {
|
|
117926
|
+
const key = createHash("sha256").update(`${token}\0${runId}\0${hookId}`).digest("hex");
|
|
117927
|
+
return path$3.join(basedir, "hooks", "tokens", `${key}.recovery.json`);
|
|
117928
|
+
}
|
|
118677
117929
|
const monotonicUlid$1 = monotonicFactory(() => Math.random());
|
|
118678
117930
|
const getObjectCreatedAt = (idPrefix) => (filename) => {
|
|
118679
117931
|
const cleanName = stripTag(filename.replace(/\.json$/, "")) + ".json";
|
|
@@ -118785,6 +118037,7 @@ async function deleteAllHooksForRun(basedir, runId) {
|
|
|
118785
118037
|
if (hook && hook.runId === runId) {
|
|
118786
118038
|
const constraintPath = path$3.join(hooksDir, "tokens", `${hashToken(hook.token)}.json`);
|
|
118787
118039
|
await deleteJSON(constraintPath);
|
|
118040
|
+
await deleteJSON(hookRecoveryMarkerPath(basedir, hook.token, hook.runId, hook.hookId));
|
|
118788
118041
|
await deleteJSON(hookPath);
|
|
118789
118042
|
}
|
|
118790
118043
|
}
|
|
@@ -118936,9 +118189,27 @@ function createRunsStorage(basedir, tag) {
|
|
|
118936
118189
|
}
|
|
118937
118190
|
};
|
|
118938
118191
|
}
|
|
118939
|
-
const stepLocks = /* @__PURE__ */ new Map();
|
|
118940
118192
|
const HookTokenClaimSchema = object$1({
|
|
118941
|
-
|
|
118193
|
+
// The token-claim writer below has always persisted `hookId`, but
|
|
118194
|
+
// this read schema previously omitted it, which is the bug fixed
|
|
118195
|
+
// by https://github.com/vercel/workflow/issues/2283. `optional()`
|
|
118196
|
+
// is defensive: any claim file that somehow lacks the field still
|
|
118197
|
+
// parses (yielding `undefined`) and falls through to the cross-
|
|
118198
|
+
// hook conflict branch, matching pre-fix behavior.
|
|
118199
|
+
hookId: string$3().optional(),
|
|
118200
|
+
runId: string$3(),
|
|
118201
|
+
// `eventId` is the canonical hook_created event ID the claiming
|
|
118202
|
+
// worker committed to publishing. Persisting it here turns the
|
|
118203
|
+
// claim file into a durable convergence key for cross-worker /
|
|
118204
|
+
// cross-process retries (see comment on the hook_created branch).
|
|
118205
|
+
// `optional()` for backward compatibility: a legacy claim file
|
|
118206
|
+
// written before this field existed falls through to the recovery-
|
|
118207
|
+
// marker upgrade path, which atomically pins a canonical eventId
|
|
118208
|
+
// via a sidecar marker (also a `writeExclusive`).
|
|
118209
|
+
eventId: string$3().optional()
|
|
118210
|
+
});
|
|
118211
|
+
const HookRecoveryMarkerSchema = object$1({
|
|
118212
|
+
eventId: string$3()
|
|
118942
118213
|
});
|
|
118943
118214
|
async function readHookTokenClaim(constraintPath) {
|
|
118944
118215
|
try {
|
|
@@ -118950,8 +118221,70 @@ async function readHookTokenClaim(constraintPath) {
|
|
|
118950
118221
|
throw error2;
|
|
118951
118222
|
}
|
|
118952
118223
|
}
|
|
118953
|
-
function
|
|
118954
|
-
|
|
118224
|
+
async function readHookRecoveryMarker(markerPath) {
|
|
118225
|
+
try {
|
|
118226
|
+
return await readJSON(markerPath, HookRecoveryMarkerSchema);
|
|
118227
|
+
} catch (error2) {
|
|
118228
|
+
if (error2 instanceof SyntaxError || error2 instanceof ZodError) {
|
|
118229
|
+
return null;
|
|
118230
|
+
}
|
|
118231
|
+
throw error2;
|
|
118232
|
+
}
|
|
118233
|
+
}
|
|
118234
|
+
async function findExistingHookCreatedEventId(basedir, runId, correlationId) {
|
|
118235
|
+
var _a3;
|
|
118236
|
+
const result = await paginatedFileSystemQuery({
|
|
118237
|
+
directory: path$3.join(basedir, "events"),
|
|
118238
|
+
schema: EventSchema,
|
|
118239
|
+
filePrefix: `${runId}-`,
|
|
118240
|
+
filter: (event) => event.eventType === "hook_created" && event.correlationId === correlationId,
|
|
118241
|
+
limit: 1,
|
|
118242
|
+
getCreatedAt: getObjectCreatedAt("evnt"),
|
|
118243
|
+
getId: (event) => event.eventId
|
|
118244
|
+
});
|
|
118245
|
+
return ((_a3 = result.data[0]) == null ? void 0 : _a3.eventId) ?? null;
|
|
118246
|
+
}
|
|
118247
|
+
async function repairHookEntityFromPersistedEvent(basedir, runId, hookId, persistedEventId, tag) {
|
|
118248
|
+
const compositeKey = `${runId}-${persistedEventId}`;
|
|
118249
|
+
const persistedEvent = await readJSONWithFallback(basedir, "events", compositeKey, EventSchema, tag);
|
|
118250
|
+
if (!persistedEvent || persistedEvent.eventType !== "hook_created" || persistedEvent.correlationId !== hookId) {
|
|
118251
|
+
return;
|
|
118252
|
+
}
|
|
118253
|
+
const existingHook = await readJSONWithFallback(basedir, "hooks", hookId, HookSchema, tag);
|
|
118254
|
+
if (existingHook) {
|
|
118255
|
+
return;
|
|
118256
|
+
}
|
|
118257
|
+
const eventData = persistedEvent.eventData ?? {};
|
|
118258
|
+
if (typeof eventData.token !== "string") {
|
|
118259
|
+
return;
|
|
118260
|
+
}
|
|
118261
|
+
const hook = {
|
|
118262
|
+
runId,
|
|
118263
|
+
hookId,
|
|
118264
|
+
token: eventData.token,
|
|
118265
|
+
metadata: eventData.metadata,
|
|
118266
|
+
ownerId: "local-owner",
|
|
118267
|
+
projectId: "local-project",
|
|
118268
|
+
environment: "local",
|
|
118269
|
+
createdAt: persistedEvent.createdAt,
|
|
118270
|
+
specVersion: persistedEvent.specVersion,
|
|
118271
|
+
isWebhook: eventData.isWebhook ?? false,
|
|
118272
|
+
isSystem: eventData.isSystem ?? false
|
|
118273
|
+
};
|
|
118274
|
+
await writeExclusive(taggedPath(basedir, "hooks", hookId, tag), JSON.stringify(hook, jsonReplacer, 2));
|
|
118275
|
+
}
|
|
118276
|
+
async function pinCanonicalEventIdForLegacyClaim(basedir, token, runId, hookId, candidateEventId) {
|
|
118277
|
+
const markerPath = hookRecoveryMarkerPath(basedir, token, runId, hookId);
|
|
118278
|
+
const markerContent = JSON.stringify({ eventId: candidateEventId });
|
|
118279
|
+
const won = await writeExclusive(markerPath, markerContent);
|
|
118280
|
+
if (won) {
|
|
118281
|
+
return candidateEventId;
|
|
118282
|
+
}
|
|
118283
|
+
const existing = await readHookRecoveryMarker(markerPath);
|
|
118284
|
+
return (existing == null ? void 0 : existing.eventId) ?? null;
|
|
118285
|
+
}
|
|
118286
|
+
function withInProcessLock(locks, key, fn2) {
|
|
118287
|
+
const prev = locks.get(key);
|
|
118955
118288
|
const taskBox = {};
|
|
118956
118289
|
const task = (async () => {
|
|
118957
118290
|
if (prev) {
|
|
@@ -118960,13 +118293,13 @@ function withStepLock(key, fn2) {
|
|
|
118960
118293
|
try {
|
|
118961
118294
|
return await fn2();
|
|
118962
118295
|
} finally {
|
|
118963
|
-
if (
|
|
118964
|
-
|
|
118296
|
+
if (locks.get(key) === taskBox.task) {
|
|
118297
|
+
locks.delete(key);
|
|
118965
118298
|
}
|
|
118966
118299
|
}
|
|
118967
118300
|
})();
|
|
118968
118301
|
taskBox.task = task;
|
|
118969
|
-
|
|
118302
|
+
locks.set(key, task);
|
|
118970
118303
|
return task;
|
|
118971
118304
|
}
|
|
118972
118305
|
async function deleteAllWaitsForRun(basedir, runId) {
|
|
@@ -118993,6 +118326,8 @@ async function writeRunUnderLifecycleLock(basedir, runId, tag, proposed) {
|
|
|
118993
118326
|
});
|
|
118994
118327
|
}
|
|
118995
118328
|
function createEventsStorage(basedir, tag) {
|
|
118329
|
+
const stepLocks = /* @__PURE__ */ new Map();
|
|
118330
|
+
const hookLocks = /* @__PURE__ */ new Map();
|
|
118996
118331
|
return {
|
|
118997
118332
|
async create(runId, data, params) {
|
|
118998
118333
|
if (runId != null && runId !== "") {
|
|
@@ -119004,11 +118339,15 @@ function createEventsStorage(basedir, tag) {
|
|
|
119004
118339
|
const isStepEvent2 = data.eventType === "step_created" || data.eventType === "step_started" || data.eventType === "step_completed" || data.eventType === "step_failed" || data.eventType === "step_retrying";
|
|
119005
118340
|
if (isStepEvent2 && runId && data.correlationId) {
|
|
119006
118341
|
const lockKey = tag ? `${runId}-${data.correlationId}.${tag}` : `${runId}-${data.correlationId}`;
|
|
119007
|
-
return
|
|
118342
|
+
return withInProcessLock(stepLocks, lockKey, () => createImpl());
|
|
118343
|
+
}
|
|
118344
|
+
if (data.eventType === "hook_created" && runId && data.correlationId) {
|
|
118345
|
+
const lockKey = tag ? `${runId}-${data.correlationId}.hook.${tag}` : `${runId}-${data.correlationId}.hook`;
|
|
118346
|
+
return withInProcessLock(hookLocks, lockKey, () => createImpl());
|
|
119008
118347
|
}
|
|
119009
118348
|
return createImpl();
|
|
119010
118349
|
async function createImpl() {
|
|
119011
|
-
|
|
118350
|
+
let eventId = `evnt_${monotonicUlid$1()}`;
|
|
119012
118351
|
const now2 = /* @__PURE__ */ new Date();
|
|
119013
118352
|
let effectiveRunId;
|
|
119014
118353
|
if (data.eventType === "run_created" && (!runId || runId === "")) {
|
|
@@ -119034,6 +118373,9 @@ function createEventsStorage(basedir, tag) {
|
|
|
119034
118373
|
if (data.eventType === "run_started" && !currentRun && "eventData" in data && data.eventData) {
|
|
119035
118374
|
const runInputData = data.eventData;
|
|
119036
118375
|
if (runInputData.deploymentId && runInputData.workflowName && runInputData.input !== void 0) {
|
|
118376
|
+
validateAttributeChanges(Object.entries(runInputData.attributes ?? {}).map(([key, value]) => ({ key, value })), {
|
|
118377
|
+
allowReservedAttributes: runInputData.allowReservedAttributes === true
|
|
118378
|
+
});
|
|
119037
118379
|
const createdRun = {
|
|
119038
118380
|
runId: effectiveRunId,
|
|
119039
118381
|
deploymentId: runInputData.deploymentId,
|
|
@@ -119046,7 +118388,7 @@ function createEventsStorage(basedir, tag) {
|
|
|
119046
118388
|
error: void 0,
|
|
119047
118389
|
startedAt: void 0,
|
|
119048
118390
|
completedAt: void 0,
|
|
119049
|
-
attributes: {},
|
|
118391
|
+
attributes: runInputData.attributes ?? {},
|
|
119050
118392
|
createdAt: now2,
|
|
119051
118393
|
updatedAt: now2
|
|
119052
118394
|
};
|
|
@@ -119064,7 +118406,9 @@ function createEventsStorage(basedir, tag) {
|
|
|
119064
118406
|
deploymentId: runInputData.deploymentId,
|
|
119065
118407
|
workflowName: runInputData.workflowName,
|
|
119066
118408
|
input: runInputData.input,
|
|
119067
|
-
executionContext: runInputData.executionContext
|
|
118409
|
+
executionContext: runInputData.executionContext,
|
|
118410
|
+
attributes: runInputData.attributes,
|
|
118411
|
+
allowReservedAttributes: runInputData.allowReservedAttributes
|
|
119068
118412
|
}
|
|
119069
118413
|
};
|
|
119070
118414
|
const createdCompositeKey = `${effectiveRunId}-${runCreatedEventId}`;
|
|
@@ -119079,6 +118423,9 @@ function createEventsStorage(basedir, tag) {
|
|
|
119079
118423
|
if (data.eventType === "run_failed" && !currentRun) {
|
|
119080
118424
|
throw new WorkflowRunNotFoundError(effectiveRunId);
|
|
119081
118425
|
}
|
|
118426
|
+
if (data.eventType === "attr_set" && !currentRun) {
|
|
118427
|
+
throw new WorkflowRunNotFoundError(effectiveRunId);
|
|
118428
|
+
}
|
|
119082
118429
|
if (currentRun) {
|
|
119083
118430
|
if (requiresNewerWorld(currentRun.specVersion)) {
|
|
119084
118431
|
throw new RunNotSupportedError(currentRun.specVersion, SPEC_VERSION_CURRENT);
|
|
@@ -119118,6 +118465,9 @@ function createEventsStorage(basedir, tag) {
|
|
|
119118
118465
|
if (data.eventType === "step_created" || data.eventType === "hook_created" || data.eventType === "wait_created") {
|
|
119119
118466
|
throw new EntityConflictError(`Cannot create new entities on run in terminal state "${currentRun.status}"`);
|
|
119120
118467
|
}
|
|
118468
|
+
if (data.eventType === "attr_set") {
|
|
118469
|
+
throw new EntityConflictError(`Cannot set attributes on run in terminal state "${currentRun.status}"`);
|
|
118470
|
+
}
|
|
119121
118471
|
}
|
|
119122
118472
|
let validatedStep = null;
|
|
119123
118473
|
const stepEvents = [
|
|
@@ -119148,7 +118498,7 @@ function createEventsStorage(basedir, tag) {
|
|
|
119148
118498
|
throw new HookNotFoundError(data.correlationId);
|
|
119149
118499
|
}
|
|
119150
118500
|
}
|
|
119151
|
-
|
|
118501
|
+
let event = {
|
|
119152
118502
|
...data,
|
|
119153
118503
|
runId: effectiveRunId,
|
|
119154
118504
|
eventId,
|
|
@@ -119162,8 +118512,15 @@ function createEventsStorage(basedir, tag) {
|
|
|
119162
118512
|
let step;
|
|
119163
118513
|
let hook;
|
|
119164
118514
|
let wait;
|
|
118515
|
+
let hookEntityWriteOptions;
|
|
119165
118516
|
if (data.eventType === "run_created" && "eventData" in data) {
|
|
119166
118517
|
const runData = data.eventData;
|
|
118518
|
+
validateAttributeChanges(Object.entries(runData.attributes ?? {}).map(([key, value]) => ({
|
|
118519
|
+
key,
|
|
118520
|
+
value
|
|
118521
|
+
})), {
|
|
118522
|
+
allowReservedAttributes: runData.allowReservedAttributes === true
|
|
118523
|
+
});
|
|
119167
118524
|
run2 = {
|
|
119168
118525
|
runId: effectiveRunId,
|
|
119169
118526
|
deploymentId: runData.deploymentId,
|
|
@@ -119177,7 +118534,7 @@ function createEventsStorage(basedir, tag) {
|
|
|
119177
118534
|
error: void 0,
|
|
119178
118535
|
startedAt: void 0,
|
|
119179
118536
|
completedAt: void 0,
|
|
119180
|
-
attributes: {},
|
|
118537
|
+
attributes: runData.attributes ?? {},
|
|
119181
118538
|
createdAt: now2,
|
|
119182
118539
|
updatedAt: now2
|
|
119183
118540
|
};
|
|
@@ -119284,6 +118641,32 @@ function createEventsStorage(basedir, tag) {
|
|
|
119284
118641
|
deleteAllWaitsForRun(basedir, effectiveRunId)
|
|
119285
118642
|
]);
|
|
119286
118643
|
}
|
|
118644
|
+
} else if (data.eventType === "attr_set" && currentRun) {
|
|
118645
|
+
run2 = await withRunFileLock(effectiveRunId, async () => {
|
|
118646
|
+
const fresh = await readJSON(taggedPath(basedir, "runs", effectiveRunId, tag), WorkflowRunSchema);
|
|
118647
|
+
if (!fresh) {
|
|
118648
|
+
throw new WorkflowRunNotFoundError(effectiveRunId);
|
|
118649
|
+
}
|
|
118650
|
+
validateAttributeChanges(data.eventData.changes, {
|
|
118651
|
+
existingKeys: Object.keys(fresh.attributes),
|
|
118652
|
+
allowReservedAttributes: data.eventData.allowReservedAttributes === true
|
|
118653
|
+
});
|
|
118654
|
+
if (data.correlationId && data.eventData.writer.type === "workflow") {
|
|
118655
|
+
const attrLockName = tag ? `${effectiveRunId}-${data.correlationId}.created.${tag}` : `${effectiveRunId}-${data.correlationId}.created`;
|
|
118656
|
+
const attrLockPath = resolveWithinBase(basedir, ".locks", "attributes", attrLockName);
|
|
118657
|
+
const attrClaimed = await writeExclusive(attrLockPath, "");
|
|
118658
|
+
if (!attrClaimed) {
|
|
118659
|
+
throw new EntityConflictError(`Attribute event "${data.correlationId}" already exists`);
|
|
118660
|
+
}
|
|
118661
|
+
}
|
|
118662
|
+
const next2 = {
|
|
118663
|
+
...fresh,
|
|
118664
|
+
attributes: applyAttributeChanges(fresh.attributes, data.eventData.changes),
|
|
118665
|
+
updatedAt: now2
|
|
118666
|
+
};
|
|
118667
|
+
await writeJSON(taggedPath(basedir, "runs", effectiveRunId, tag), next2, { overwrite: true });
|
|
118668
|
+
return next2;
|
|
118669
|
+
});
|
|
119287
118670
|
} else if (
|
|
119288
118671
|
// Step lifecycle events
|
|
119289
118672
|
data.eventType === "step_created" && "eventData" in data
|
|
@@ -119398,32 +118781,62 @@ function createEventsStorage(basedir, tag) {
|
|
|
119398
118781
|
const tokenClaimed = await writeExclusive(constraintPath, JSON.stringify({
|
|
119399
118782
|
token: hookData.token,
|
|
119400
118783
|
hookId: data.correlationId,
|
|
119401
|
-
runId: effectiveRunId
|
|
118784
|
+
runId: effectiveRunId,
|
|
118785
|
+
eventId
|
|
119402
118786
|
}));
|
|
118787
|
+
let writeHookEntityWithOverwrite = false;
|
|
119403
118788
|
if (!tokenClaimed) {
|
|
119404
118789
|
const existingClaim = await readHookTokenClaim(constraintPath);
|
|
119405
|
-
|
|
119406
|
-
|
|
119407
|
-
|
|
119408
|
-
|
|
119409
|
-
|
|
119410
|
-
|
|
119411
|
-
|
|
119412
|
-
|
|
119413
|
-
|
|
119414
|
-
|
|
119415
|
-
|
|
119416
|
-
|
|
119417
|
-
|
|
119418
|
-
|
|
119419
|
-
|
|
119420
|
-
|
|
119421
|
-
|
|
119422
|
-
|
|
119423
|
-
|
|
119424
|
-
|
|
119425
|
-
|
|
119426
|
-
|
|
118790
|
+
if ((existingClaim == null ? void 0 : existingClaim.runId) === effectiveRunId && existingClaim.hookId === data.correlationId) {
|
|
118791
|
+
let canonicalEventId;
|
|
118792
|
+
if (existingClaim.eventId) {
|
|
118793
|
+
canonicalEventId = existingClaim.eventId;
|
|
118794
|
+
} else {
|
|
118795
|
+
const alreadyPublishedEventId = await findExistingHookCreatedEventId(basedir, effectiveRunId, data.correlationId);
|
|
118796
|
+
if (alreadyPublishedEventId !== null) {
|
|
118797
|
+
await repairHookEntityFromPersistedEvent(basedir, effectiveRunId, data.correlationId, alreadyPublishedEventId, tag);
|
|
118798
|
+
throw new EntityConflictError(`Hook "${data.correlationId}" already created`);
|
|
118799
|
+
}
|
|
118800
|
+
const pinned = await pinCanonicalEventIdForLegacyClaim(basedir, hookData.token, effectiveRunId, data.correlationId, eventId);
|
|
118801
|
+
if (pinned === null) {
|
|
118802
|
+
throw new EntityConflictError(`Hook "${data.correlationId}" already created`);
|
|
118803
|
+
}
|
|
118804
|
+
canonicalEventId = pinned;
|
|
118805
|
+
}
|
|
118806
|
+
eventId = canonicalEventId;
|
|
118807
|
+
const canonicalCreatedAt = ulidToDate(eventId.replace(/^evnt_/, "")) ?? now2;
|
|
118808
|
+
event = {
|
|
118809
|
+
...data,
|
|
118810
|
+
runId: effectiveRunId,
|
|
118811
|
+
eventId,
|
|
118812
|
+
createdAt: canonicalCreatedAt,
|
|
118813
|
+
specVersion: effectiveSpecVersion
|
|
118814
|
+
};
|
|
118815
|
+
writeHookEntityWithOverwrite = true;
|
|
118816
|
+
} else {
|
|
118817
|
+
const conflictEvent = {
|
|
118818
|
+
eventType: "hook_conflict",
|
|
118819
|
+
correlationId: data.correlationId,
|
|
118820
|
+
eventData: {
|
|
118821
|
+
token: hookData.token,
|
|
118822
|
+
...existingClaim ? { conflictingRunId: existingClaim.runId } : {}
|
|
118823
|
+
},
|
|
118824
|
+
runId: effectiveRunId,
|
|
118825
|
+
eventId,
|
|
118826
|
+
createdAt: now2,
|
|
118827
|
+
specVersion: effectiveSpecVersion
|
|
118828
|
+
};
|
|
118829
|
+
const compositeKey2 = `${effectiveRunId}-${eventId}`;
|
|
118830
|
+
await writeJSON(taggedPath(basedir, "events", compositeKey2, tag), conflictEvent);
|
|
118831
|
+
const resolveData2 = (params == null ? void 0 : params.resolveData) ?? DEFAULT_RESOLVE_DATA_OPTION$1;
|
|
118832
|
+
const filteredEvent2 = stripEventDataRefs(conflictEvent, resolveData2);
|
|
118833
|
+
return {
|
|
118834
|
+
event: filteredEvent2,
|
|
118835
|
+
run: run2,
|
|
118836
|
+
step,
|
|
118837
|
+
hook: void 0
|
|
118838
|
+
};
|
|
118839
|
+
}
|
|
119427
118840
|
}
|
|
119428
118841
|
hook = {
|
|
119429
118842
|
runId: effectiveRunId,
|
|
@@ -119433,13 +118846,16 @@ function createEventsStorage(basedir, tag) {
|
|
|
119433
118846
|
ownerId: "local-owner",
|
|
119434
118847
|
projectId: "local-project",
|
|
119435
118848
|
environment: "local",
|
|
119436
|
-
createdAt
|
|
118849
|
+
// Use the (possibly canonical) event's createdAt so two
|
|
118850
|
+
// workers writing the same hook entity produce byte-
|
|
118851
|
+
// identical content during convergence.
|
|
118852
|
+
createdAt: event.createdAt,
|
|
119437
118853
|
// Propagate specVersion from the event to the hook entity
|
|
119438
118854
|
specVersion: effectiveSpecVersion,
|
|
119439
118855
|
isWebhook: hookData.isWebhook ?? false,
|
|
119440
118856
|
isSystem: hookData.isSystem ?? false
|
|
119441
118857
|
};
|
|
119442
|
-
|
|
118858
|
+
hookEntityWriteOptions = writeHookEntityWithOverwrite ? { overwrite: true } : void 0;
|
|
119443
118859
|
} else if (data.eventType === "hook_disposed") {
|
|
119444
118860
|
const hookLockName = tag ? `${data.correlationId}.disposed.${tag}` : `${data.correlationId}.disposed`;
|
|
119445
118861
|
const lockPath = resolveWithinBase(basedir, ".locks", "hooks", hookLockName);
|
|
@@ -119452,6 +118868,7 @@ function createEventsStorage(basedir, tag) {
|
|
|
119452
118868
|
if (existingHook) {
|
|
119453
118869
|
const disposedConstraintPath = path$3.join(basedir, "hooks", "tokens", `${hashToken(existingHook.token)}.json`);
|
|
119454
118870
|
await deleteJSON(disposedConstraintPath);
|
|
118871
|
+
await deleteJSON(hookRecoveryMarkerPath(basedir, existingHook.token, existingHook.runId, existingHook.hookId));
|
|
119455
118872
|
}
|
|
119456
118873
|
await deleteJSON(hookPath);
|
|
119457
118874
|
} else if (data.eventType === "wait_created" && "eventData" in data) {
|
|
@@ -119497,7 +118914,16 @@ function createEventsStorage(basedir, tag) {
|
|
|
119497
118914
|
await writeJSON(taggedPath(basedir, "waits", waitCompositeKey, tag), wait, { overwrite: true });
|
|
119498
118915
|
}
|
|
119499
118916
|
const compositeKey = `${effectiveRunId}-${eventId}`;
|
|
119500
|
-
await
|
|
118917
|
+
const eventPublished = await writeExclusive(taggedPath(basedir, "events", compositeKey, tag), JSON.stringify(event, jsonReplacer, 2));
|
|
118918
|
+
if (!eventPublished) {
|
|
118919
|
+
if (data.eventType === "hook_created" && data.correlationId) {
|
|
118920
|
+
await repairHookEntityFromPersistedEvent(basedir, effectiveRunId, data.correlationId, eventId, tag);
|
|
118921
|
+
}
|
|
118922
|
+
throw new EntityConflictError(`Event "${eventId}" already exists for run "${effectiveRunId}"`);
|
|
118923
|
+
}
|
|
118924
|
+
if (hook && data.eventType === "hook_created") {
|
|
118925
|
+
await writeJSON(taggedPath(basedir, "hooks", hook.hookId, tag), hook, hookEntityWriteOptions);
|
|
118926
|
+
}
|
|
119501
118927
|
const resolveData = (params == null ? void 0 : params.resolveData) ?? DEFAULT_RESOLVE_DATA_OPTION$1;
|
|
119502
118928
|
const filteredEvent = stripEventDataRefs(event, resolveData);
|
|
119503
118929
|
let events2;
|
|
@@ -120059,11 +119485,12 @@ function createLocalWorld(args) {
|
|
|
120059
119485
|
const basedir = mergedConfig.dataDir;
|
|
120060
119486
|
const hooksDir = path$3.join(basedir, "hooks");
|
|
120061
119487
|
const taggedHookFiles = await listTaggedFiles(hooksDir, tag);
|
|
120062
|
-
const { HookSchema: HookSchema2 } = await import("./index-
|
|
119488
|
+
const { HookSchema: HookSchema2 } = await import("./index-8Fb8OEQ2.js");
|
|
120063
119489
|
await Promise.all(taggedHookFiles.map(async (hookFile) => {
|
|
120064
119490
|
const hook = await readJSON(path$3.join(hooksDir, hookFile), HookSchema2);
|
|
120065
119491
|
if (hook == null ? void 0 : hook.token) {
|
|
120066
119492
|
await deleteJSON(path$3.join(hooksDir, "tokens", `${hashToken(hook.token)}.json`));
|
|
119493
|
+
await deleteJSON(hookRecoveryMarkerPath(basedir, hook.token, hook.runId, hook.hookId));
|
|
120067
119494
|
}
|
|
120068
119495
|
}));
|
|
120069
119496
|
const entityDirs = [
|
|
@@ -120211,8 +119638,8 @@ function requireGetVercelOidcToken() {
|
|
|
120211
119638
|
}
|
|
120212
119639
|
try {
|
|
120213
119640
|
const [{ getTokenPayload, isExpired }, { refreshToken }] = await Promise.all([
|
|
120214
|
-
await import("./token-util-
|
|
120215
|
-
await import("./token-
|
|
119641
|
+
await import("./token-util-C02bLOPS.js").then((n) => n.t),
|
|
119642
|
+
await import("./token-CDoC3gHn.js").then((n) => n.t)
|
|
120216
119643
|
]);
|
|
120217
119644
|
if (!token || isExpired(getTokenPayload(token), options == null ? void 0 : options.expirationBufferMs)) {
|
|
120218
119645
|
await refreshToken(options);
|
|
@@ -121605,7 +121032,7 @@ function expand_(str, max2, isTop) {
|
|
|
121605
121032
|
const x2 = numeric(n[0]);
|
|
121606
121033
|
const y2 = numeric(n[1]);
|
|
121607
121034
|
const width = Math.max(n[0].length, n[1].length);
|
|
121608
|
-
let incr = n.length === 3 && n[2] !== void 0 ? Math.
|
|
121035
|
+
let incr = n.length === 3 && n[2] !== void 0 ? Math.abs(numeric(n[2])) : 1;
|
|
121609
121036
|
let test = lte;
|
|
121610
121037
|
const reverse = y2 < x2;
|
|
121611
121038
|
if (reverse) {
|
|
@@ -121614,7 +121041,7 @@ function expand_(str, max2, isTop) {
|
|
|
121614
121041
|
}
|
|
121615
121042
|
const pad = n.some(isPadded);
|
|
121616
121043
|
N2 = [];
|
|
121617
|
-
for (let i = x2; test(i, y2)
|
|
121044
|
+
for (let i = x2; test(i, y2); i += incr) {
|
|
121618
121045
|
let c;
|
|
121619
121046
|
if (isAlphaSequence) {
|
|
121620
121047
|
c = String.fromCharCode(i);
|
|
@@ -121772,9 +121199,9 @@ const parseClass = (glob, position2) => {
|
|
|
121772
121199
|
};
|
|
121773
121200
|
const unescape$1 = (s2, { windowsPathsNoEscape = false, magicalBraces = true } = {}) => {
|
|
121774
121201
|
if (magicalBraces) {
|
|
121775
|
-
return windowsPathsNoEscape ? s2.replace(/\[([
|
|
121202
|
+
return windowsPathsNoEscape ? s2.replace(/\[([^\/\\])\]/g, "$1") : s2.replace(/((?!\\).|^)\[([^\/\\])\]/g, "$1$2").replace(/\\([^\/])/g, "$1");
|
|
121776
121203
|
}
|
|
121777
|
-
return windowsPathsNoEscape ? s2.replace(/\[([
|
|
121204
|
+
return windowsPathsNoEscape ? s2.replace(/\[([^\/\\{}])\]/g, "$1") : s2.replace(/((?!\\).|^)\[([^\/\\{}])\]/g, "$1$2").replace(/\\([^\/{}])/g, "$1");
|
|
121778
121205
|
};
|
|
121779
121206
|
var _a;
|
|
121780
121207
|
const types = /* @__PURE__ */ new Set(["!", "?", "+", "*", "@"]);
|
|
@@ -121895,7 +121322,13 @@ class AST {
|
|
|
121895
121322
|
}
|
|
121896
121323
|
// reconstructs the pattern
|
|
121897
121324
|
toString() {
|
|
121898
|
-
|
|
121325
|
+
if (__privateGet(this, _toString) !== void 0)
|
|
121326
|
+
return __privateGet(this, _toString);
|
|
121327
|
+
if (!this.type) {
|
|
121328
|
+
return __privateSet(this, _toString, __privateGet(this, _parts).map((p2) => String(p2)).join(""));
|
|
121329
|
+
} else {
|
|
121330
|
+
return __privateSet(this, _toString, this.type + "(" + __privateGet(this, _parts).map((p2) => String(p2)).join("|") + ")");
|
|
121331
|
+
}
|
|
121899
121332
|
}
|
|
121900
121333
|
push(...parts) {
|
|
121901
121334
|
for (const p2 of parts) {
|
|
@@ -122457,7 +121890,7 @@ const minimatch = (p2, pattern2, options = {}) => {
|
|
|
122457
121890
|
}
|
|
122458
121891
|
return new Minimatch(pattern2, options).match(p2);
|
|
122459
121892
|
};
|
|
122460
|
-
const starDotExtRE = /^\*+([
|
|
121893
|
+
const starDotExtRE = /^\*+([^+@!?\*\[\(]*)$/;
|
|
122461
121894
|
const starDotExtTest = (ext2) => (f2) => !f2.startsWith(".") && f2.endsWith(ext2);
|
|
122462
121895
|
const starDotExtTestDot = (ext2) => (f2) => f2.endsWith(ext2);
|
|
122463
121896
|
const starDotExtTestNocase = (ext2) => {
|
|
@@ -122476,7 +121909,7 @@ const dotStarTest = (f2) => f2 !== "." && f2 !== ".." && f2.startsWith(".");
|
|
|
122476
121909
|
const starRE = /^\*+$/;
|
|
122477
121910
|
const starTest = (f2) => f2.length !== 0 && !f2.startsWith(".");
|
|
122478
121911
|
const starTestDot = (f2) => f2.length !== 0 && f2 !== "." && f2 !== "..";
|
|
122479
|
-
const qmarksRE = /^\?+([
|
|
121912
|
+
const qmarksRE = /^\?+([^+@!?\*\[\(]*)?$/;
|
|
122480
121913
|
const qmarksTestNocase = ([$0, ext2 = ""]) => {
|
|
122481
121914
|
const noext = qmarksTestNoExt([$0]);
|
|
122482
121915
|
if (!ext2)
|
|
@@ -122696,10 +122129,10 @@ class Minimatch {
|
|
|
122696
122129
|
// of patterns that we have to process.
|
|
122697
122130
|
preprocess(globParts) {
|
|
122698
122131
|
if (this.options.noglobstar) {
|
|
122699
|
-
for (
|
|
122700
|
-
for (let j2 = 0; j2 <
|
|
122701
|
-
if (
|
|
122702
|
-
|
|
122132
|
+
for (let i = 0; i < globParts.length; i++) {
|
|
122133
|
+
for (let j2 = 0; j2 < globParts[i].length; j2++) {
|
|
122134
|
+
if (globParts[i][j2] === "**") {
|
|
122135
|
+
globParts[i][j2] = "*";
|
|
122703
122136
|
}
|
|
122704
122137
|
}
|
|
122705
122138
|
}
|
|
@@ -122777,7 +122210,7 @@ class Minimatch {
|
|
|
122777
122210
|
let dd = 0;
|
|
122778
122211
|
while (-1 !== (dd = parts.indexOf("..", dd + 1))) {
|
|
122779
122212
|
const p2 = parts[dd - 1];
|
|
122780
|
-
if (p2 && p2 !== "." && p2 !== ".." && p2 !== "**"
|
|
122213
|
+
if (p2 && p2 !== "." && p2 !== ".." && p2 !== "**") {
|
|
122781
122214
|
didSomething = true;
|
|
122782
122215
|
parts.splice(dd - 1, 2);
|
|
122783
122216
|
dd -= 2;
|
|
@@ -123058,7 +122491,7 @@ class Minimatch {
|
|
|
123058
122491
|
re2 = "^(?!" + re2 + ").+$";
|
|
123059
122492
|
try {
|
|
123060
122493
|
this.regexp = new RegExp(re2, [...flags].join(""));
|
|
123061
|
-
} catch {
|
|
122494
|
+
} catch (ex) {
|
|
123062
122495
|
this.regexp = false;
|
|
123063
122496
|
}
|
|
123064
122497
|
return this.regexp;
|
|
@@ -123066,7 +122499,7 @@ class Minimatch {
|
|
|
123066
122499
|
slashSplit(p2) {
|
|
123067
122500
|
if (this.preserveMultipleSlashes) {
|
|
123068
122501
|
return p2.split("/");
|
|
123069
|
-
} else if (this.isWindows && /^\/\/[
|
|
122502
|
+
} else if (this.isWindows && /^\/\/[^\/]+/.test(p2)) {
|
|
123070
122503
|
return ["", ...p2.split(/\/+/)];
|
|
123071
122504
|
} else {
|
|
123072
122505
|
return p2.split(/\/+/);
|
|
@@ -123097,7 +122530,8 @@ class Minimatch {
|
|
|
123097
122530
|
filename = ff[i];
|
|
123098
122531
|
}
|
|
123099
122532
|
}
|
|
123100
|
-
for (
|
|
122533
|
+
for (let i = 0; i < set2.length; i++) {
|
|
122534
|
+
const pattern2 = set2[i];
|
|
123101
122535
|
let file2 = ff;
|
|
123102
122536
|
if (options.matchBase && pattern2.length === 1) {
|
|
123103
122537
|
file2 = [filename];
|
|
@@ -125402,7 +124836,7 @@ var QueueClient = class {
|
|
|
125402
124836
|
setApi(this, new ApiClient({ ...options, region }));
|
|
125403
124837
|
}
|
|
125404
124838
|
};
|
|
125405
|
-
const version = "5.0.0-beta.
|
|
124839
|
+
const version = "5.0.0-beta.14";
|
|
125406
124840
|
const HTTP_DEBUG_ENABLED = typeof process !== "undefined" && typeof process.env.DEBUG === "string" && (process.env.DEBUG.includes("workflow:") || process.env.DEBUG === "*");
|
|
125407
124841
|
function httpLog(method, endpoint, response2, ms2) {
|
|
125408
124842
|
if (HTTP_DEBUG_ENABLED) {
|
|
@@ -126789,7 +126223,11 @@ function createVercelWorld(config2) {
|
|
|
126789
126223
|
var _a3, _b2;
|
|
126790
126224
|
const projectId = ((_a3 = config2 == null ? void 0 : config2.projectConfig) == null ? void 0 : _a3.projectId) || process.env.VERCEL_PROJECT_ID;
|
|
126791
126225
|
return {
|
|
126792
|
-
|
|
126226
|
+
// Spec v4: the workflow-server materializes native `attr_set` events
|
|
126227
|
+
// and accepts initial run attributes on creation. New runs are stamped
|
|
126228
|
+
// with this version; the server must be at least this version (it
|
|
126229
|
+
// rejects runs newer than its own SPEC_VERSION_CURRENT).
|
|
126230
|
+
specVersion: SPEC_VERSION_SUPPORTS_ATTRIBUTES,
|
|
126793
126231
|
// On Vercel the platform fails the function invocation when the
|
|
126794
126232
|
// process exits non-zero, and VQS redelivers the queue message via a
|
|
126795
126233
|
// fresh invocation. The core runtime uses this to decide whether
|
|
@@ -126885,6 +126323,28 @@ const getWorld = async () => {
|
|
|
126885
126323
|
};
|
|
126886
126324
|
const GetWorldFnKey = Symbol.for("@workflow/world//getWorldFn");
|
|
126887
126325
|
globalThis[GetWorldFnKey] ?? (globalThis[GetWorldFnKey] = getWorld);
|
|
126326
|
+
function waitUntil(promise2) {
|
|
126327
|
+
void import("./index-B8YoYr9f.js").then((n) => n.i).then(({ waitUntil: waitUntil2 }) => {
|
|
126328
|
+
waitUntil2(promise2);
|
|
126329
|
+
});
|
|
126330
|
+
}
|
|
126331
|
+
function safeWaitUntil(promise2, onError) {
|
|
126332
|
+
waitUntil(promise2.catch((err) => {
|
|
126333
|
+
const isAbortError = (err == null ? void 0 : err.name) === "AbortError" || (err == null ? void 0 : err.name) === "ResponseAborted";
|
|
126334
|
+
if (!isAbortError) {
|
|
126335
|
+
try {
|
|
126336
|
+
onError(err);
|
|
126337
|
+
} catch {
|
|
126338
|
+
}
|
|
126339
|
+
}
|
|
126340
|
+
}));
|
|
126341
|
+
}
|
|
126342
|
+
async function waitedUntil(fn2) {
|
|
126343
|
+
const result = fn2();
|
|
126344
|
+
waitUntil(result.catch(() => {
|
|
126345
|
+
}));
|
|
126346
|
+
return result;
|
|
126347
|
+
}
|
|
126888
126348
|
var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
126889
126349
|
var intToChar = new Uint8Array(64);
|
|
126890
126350
|
var charToInt = new Uint8Array(128);
|
|
@@ -129510,12 +128970,16 @@ const FORMAT_VERSION_TABLE = [
|
|
|
129510
128970
|
// { format: SerializationFormat.CBOR, minVersion: '5.x.y' },
|
|
129511
128971
|
// { format: SerializationFormat.ENCRYPTED_V2, minVersion: '5.x.y' },
|
|
129512
128972
|
];
|
|
128973
|
+
const CAPABILITY_VERSION_TABLE = [{ capability: "framedByteStreams", minVersion: "5.0.0-beta.15" }];
|
|
129513
128974
|
const BASELINE_FORMATS = /* @__PURE__ */ new Set([
|
|
129514
128975
|
SerializationFormat.DEVALUE_V1
|
|
129515
128976
|
]);
|
|
129516
128977
|
function getRunCapabilities(workflowCoreVersion) {
|
|
129517
128978
|
if (!workflowCoreVersion || !semver.valid(workflowCoreVersion)) {
|
|
129518
|
-
return {
|
|
128979
|
+
return {
|
|
128980
|
+
supportedFormats: BASELINE_FORMATS,
|
|
128981
|
+
framedByteStreams: false
|
|
128982
|
+
};
|
|
129519
128983
|
}
|
|
129520
128984
|
const formats = new Set(BASELINE_FORMATS);
|
|
129521
128985
|
for (const { format: format2, minVersion } of FORMAT_VERSION_TABLE) {
|
|
@@ -129523,7 +128987,16 @@ function getRunCapabilities(workflowCoreVersion) {
|
|
|
129523
128987
|
formats.add(format2);
|
|
129524
128988
|
}
|
|
129525
128989
|
}
|
|
129526
|
-
|
|
128990
|
+
const result = {
|
|
128991
|
+
supportedFormats: formats,
|
|
128992
|
+
framedByteStreams: false
|
|
128993
|
+
};
|
|
128994
|
+
for (const { capability, minVersion } of CAPABILITY_VERSION_TABLE) {
|
|
128995
|
+
if (semver.gte(workflowCoreVersion, minVersion)) {
|
|
128996
|
+
result[capability] = true;
|
|
128997
|
+
}
|
|
128998
|
+
}
|
|
128999
|
+
return result;
|
|
129527
129000
|
}
|
|
129528
129001
|
async function getHookByTokenWithKey(token) {
|
|
129529
129002
|
var _a3;
|
|
@@ -129571,17 +129044,22 @@ async function resumeHook$2(tokenOrHook, payload, encryptionKeyOverride) {
|
|
|
129571
129044
|
...WorkflowRunId(hook.runId)
|
|
129572
129045
|
});
|
|
129573
129046
|
const rawVersion = (_b2 = workflowRun.executionContext) == null ? void 0 : _b2.workflowCoreVersion;
|
|
129574
|
-
const
|
|
129575
|
-
if (!supportedFormats.has(SerializationFormat.ENCRYPTED)) {
|
|
129047
|
+
const capabilities = getRunCapabilities(typeof rawVersion === "string" ? rawVersion : void 0);
|
|
129048
|
+
if (!capabilities.supportedFormats.has(SerializationFormat.ENCRYPTED)) {
|
|
129576
129049
|
encryptionKey = void 0;
|
|
129577
129050
|
}
|
|
129578
129051
|
const ops = [];
|
|
129579
129052
|
const v1Compat = isLegacySpecVersion(hook.specVersion);
|
|
129580
|
-
const dehydratedPayload = await dehydrateStepReturnValue(payload, hook.runId, encryptionKey, ops, globalThis, v1Compat);
|
|
129581
|
-
|
|
129582
|
-
if (err
|
|
129583
|
-
|
|
129584
|
-
|
|
129053
|
+
const dehydratedPayload = await dehydrateStepReturnValue(payload, hook.runId, encryptionKey, ops, globalThis, v1Compat, capabilities.framedByteStreams);
|
|
129054
|
+
safeWaitUntil(Promise.all(ops), (err) => {
|
|
129055
|
+
if (err === void 0)
|
|
129056
|
+
return;
|
|
129057
|
+
runtimeLogger.warn("Background flush of hook payload ops failed", {
|
|
129058
|
+
workflowRunId: hook.runId,
|
|
129059
|
+
hookId: hook.hookId,
|
|
129060
|
+
error: err instanceof Error ? err.message : String(err)
|
|
129061
|
+
});
|
|
129062
|
+
});
|
|
129585
129063
|
await world.events.create(hook.runId, {
|
|
129586
129064
|
eventType: "hook_received",
|
|
129587
129065
|
specVersion: SPEC_VERSION_CURRENT,
|
|
@@ -129662,6 +129140,28 @@ const resumeHook$3 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.define
|
|
|
129662
129140
|
resumeHook: resumeHook$2,
|
|
129663
129141
|
resumeWebhook
|
|
129664
129142
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
129143
|
+
function normalizeAttributeChanges(attrs, options = {}) {
|
|
129144
|
+
if (attrs === null || typeof attrs !== "object" || Array.isArray(attrs)) {
|
|
129145
|
+
throw new FatalError(`experimental_setAttributes requires a plain object, got ${attrs === null ? "null" : Array.isArray(attrs) ? "array" : typeof attrs}`);
|
|
129146
|
+
}
|
|
129147
|
+
const changes = Object.entries(attrs).map(([key, value]) => ({
|
|
129148
|
+
key,
|
|
129149
|
+
value: value === void 0 ? null : value
|
|
129150
|
+
}));
|
|
129151
|
+
if (changes.length === 0)
|
|
129152
|
+
return changes;
|
|
129153
|
+
const allowReservedAttributes = options.allowReservedAttributes === true;
|
|
129154
|
+
try {
|
|
129155
|
+
validateAttributeChanges(changes, { allowReservedAttributes });
|
|
129156
|
+
} catch (err) {
|
|
129157
|
+
if (err instanceof AttributeValidationError) {
|
|
129158
|
+
throw new FatalError(err.message);
|
|
129159
|
+
}
|
|
129160
|
+
throw err;
|
|
129161
|
+
}
|
|
129162
|
+
return changes;
|
|
129163
|
+
}
|
|
129164
|
+
const CROSS_DEPLOYMENT_CAPABILITY_PROBE_TIMEOUT_MS = 2e3;
|
|
129665
129165
|
const ulid = monotonicFactory();
|
|
129666
129166
|
async function start$1(workflow, argsOrOptions, options) {
|
|
129667
129167
|
"use step";
|
|
@@ -129671,7 +129171,7 @@ async function start$1(workflow, argsOrOptions, options) {
|
|
|
129671
129171
|
throw new WorkflowRuntimeError(`'start' received an invalid workflow function. Ensure the Workflow SDK is configured correctly and the function includes a 'use workflow' directive.`, { slug: "start-invalid-workflow-function" });
|
|
129672
129172
|
}
|
|
129673
129173
|
return trace$2(`workflow.start ${workflowName}`, async (span) => {
|
|
129674
|
-
var _a3;
|
|
129174
|
+
var _a3, _b2;
|
|
129675
129175
|
span == null ? void 0 : span.setAttributes({
|
|
129676
129176
|
...WorkflowName(workflowName),
|
|
129677
129177
|
...WorkflowOperation("start")
|
|
@@ -129687,24 +129187,50 @@ async function start$1(workflow, argsOrOptions, options) {
|
|
|
129687
129187
|
...WorkflowArgumentsCount(args.length)
|
|
129688
129188
|
});
|
|
129689
129189
|
const world = (opts == null ? void 0 : opts.world) ?? await getWorldLazy();
|
|
129690
|
-
|
|
129190
|
+
const currentDeploymentId = await world.getDeploymentId();
|
|
129191
|
+
let deploymentId = opts.deploymentId ?? currentDeploymentId;
|
|
129691
129192
|
if (deploymentId === "latest") {
|
|
129692
129193
|
if (!world.resolveLatestDeploymentId) {
|
|
129693
129194
|
throw new WorkflowRuntimeError("deploymentId 'latest' requires a World that implements resolveLatestDeploymentId()");
|
|
129694
129195
|
}
|
|
129695
129196
|
deploymentId = await world.resolveLatestDeploymentId();
|
|
129696
129197
|
}
|
|
129198
|
+
let framedByteStreams;
|
|
129199
|
+
if (deploymentId === currentDeploymentId) {
|
|
129200
|
+
framedByteStreams = true;
|
|
129201
|
+
} else if (typeof ((_a3 = world.streams) == null ? void 0 : _a3.get) !== "function") {
|
|
129202
|
+
framedByteStreams = false;
|
|
129203
|
+
} else {
|
|
129204
|
+
const probe = await healthCheck(world, "workflow", {
|
|
129205
|
+
deploymentId,
|
|
129206
|
+
timeout: CROSS_DEPLOYMENT_CAPABILITY_PROBE_TIMEOUT_MS
|
|
129207
|
+
}).catch(() => void 0);
|
|
129208
|
+
framedByteStreams = getRunCapabilities(probe == null ? void 0 : probe.workflowCoreVersion).framedByteStreams;
|
|
129209
|
+
}
|
|
129697
129210
|
const ops = [];
|
|
129698
129211
|
const runId = `wrun_${ulid()}`;
|
|
129699
129212
|
const traceCarrier = await serializeTraceCarrier();
|
|
129700
129213
|
const specVersion = opts.specVersion ?? world.specVersion ?? SPEC_VERSION_SUPPORTS_EVENT_SOURCING;
|
|
129701
129214
|
const v1Compat = isLegacySpecVersion(specVersion);
|
|
129702
|
-
|
|
129215
|
+
let attributes;
|
|
129216
|
+
if (opts.attributes && Object.keys(opts.attributes).length > 0) {
|
|
129217
|
+
if (specVersion < SPEC_VERSION_SUPPORTS_ATTRIBUTES) {
|
|
129218
|
+
throw new WorkflowRuntimeError("Initial workflow attributes require a World that supports spec version 4 or later.");
|
|
129219
|
+
}
|
|
129220
|
+
for (const [key, value] of Object.entries(opts.attributes)) {
|
|
129221
|
+
if (typeof value !== "string") {
|
|
129222
|
+
throw new WorkflowRuntimeError(`Initial workflow attribute ${JSON.stringify(key)} must be a string value.`);
|
|
129223
|
+
}
|
|
129224
|
+
}
|
|
129225
|
+
const changes = normalizeAttributeChanges(opts.attributes);
|
|
129226
|
+
attributes = Object.fromEntries(changes.map(({ key, value }) => [key, value]));
|
|
129227
|
+
}
|
|
129228
|
+
const rawKey = await ((_b2 = world.getEncryptionKeyForRun) == null ? void 0 : _b2.call(world, runId, {
|
|
129703
129229
|
...opts,
|
|
129704
129230
|
deploymentId
|
|
129705
129231
|
}));
|
|
129706
129232
|
const encryptionKey = rawKey ? await importKey(rawKey) : void 0;
|
|
129707
|
-
const workflowArguments = await dehydrateWorkflowArguments(args, runId, encryptionKey, ops, globalThis, v1Compat);
|
|
129233
|
+
const workflowArguments = await dehydrateWorkflowArguments(args, runId, encryptionKey, ops, globalThis, v1Compat, framedByteStreams);
|
|
129708
129234
|
const executionContext = {
|
|
129709
129235
|
traceCarrier,
|
|
129710
129236
|
workflowCoreVersion: version$1,
|
|
@@ -129718,7 +129244,8 @@ async function start$1(workflow, argsOrOptions, options) {
|
|
|
129718
129244
|
deploymentId,
|
|
129719
129245
|
workflowName,
|
|
129720
129246
|
input: workflowArguments,
|
|
129721
|
-
executionContext
|
|
129247
|
+
executionContext,
|
|
129248
|
+
...attributes ? { attributes } : {}
|
|
129722
129249
|
}
|
|
129723
129250
|
}, { v1Compat }),
|
|
129724
129251
|
world.queue(getWorkflowQueueName(workflowName), {
|
|
@@ -129730,7 +129257,8 @@ async function start$1(workflow, argsOrOptions, options) {
|
|
|
129730
129257
|
deploymentId,
|
|
129731
129258
|
workflowName,
|
|
129732
129259
|
specVersion,
|
|
129733
|
-
executionContext
|
|
129260
|
+
executionContext,
|
|
129261
|
+
...attributes ? { attributes } : {}
|
|
129734
129262
|
}
|
|
129735
129263
|
} : {}
|
|
129736
129264
|
}, {
|
|
@@ -129760,11 +129288,12 @@ async function start$1(workflow, argsOrOptions, options) {
|
|
|
129760
129288
|
throw new WorkflowRuntimeError(`Server returned different runId than requested: expected ${runId}, got ${result.run.runId}`);
|
|
129761
129289
|
}
|
|
129762
129290
|
}
|
|
129763
|
-
|
|
129764
|
-
|
|
129765
|
-
|
|
129766
|
-
|
|
129767
|
-
|
|
129291
|
+
safeWaitUntil(Promise.all(ops), (err) => {
|
|
129292
|
+
runtimeLogger.warn("Background flush of workflow argument streams failed", {
|
|
129293
|
+
workflowRunId: runId,
|
|
129294
|
+
error: err instanceof Error ? err.message : String(err)
|
|
129295
|
+
});
|
|
129296
|
+
});
|
|
129768
129297
|
span == null ? void 0 : span.setAttributes({
|
|
129769
129298
|
...WorkflowRunId(runId),
|
|
129770
129299
|
...DeploymentId(deploymentId),
|
|
@@ -132884,9 +132413,9 @@ function useMergeRefs(refs, defaultValue) {
|
|
|
132884
132413
|
function ItoI(a2) {
|
|
132885
132414
|
return a2;
|
|
132886
132415
|
}
|
|
132887
|
-
function innerCreateMedium(defaults2,
|
|
132888
|
-
if (
|
|
132889
|
-
|
|
132416
|
+
function innerCreateMedium(defaults2, middleware) {
|
|
132417
|
+
if (middleware === void 0) {
|
|
132418
|
+
middleware = ItoI;
|
|
132890
132419
|
}
|
|
132891
132420
|
var buffer2 = [];
|
|
132892
132421
|
var assigned = false;
|
|
@@ -132901,7 +132430,7 @@ function innerCreateMedium(defaults2, middleware2) {
|
|
|
132901
132430
|
return defaults2;
|
|
132902
132431
|
},
|
|
132903
132432
|
useMedium: function(data) {
|
|
132904
|
-
var item =
|
|
132433
|
+
var item = middleware(data, assigned);
|
|
132905
132434
|
buffer2.push(item);
|
|
132906
132435
|
return function() {
|
|
132907
132436
|
buffer2 = buffer2.filter(function(x2) {
|
|
@@ -147013,8 +146542,8 @@ function BatchProvider({ children: children2 }) {
|
|
|
147013
146542
|
items: next2,
|
|
147014
146543
|
lookup: nodeLookup
|
|
147015
146544
|
});
|
|
147016
|
-
for (const
|
|
147017
|
-
changes =
|
|
146545
|
+
for (const middleware of onNodesChangeMiddlewareMap.values()) {
|
|
146546
|
+
changes = middleware(changes);
|
|
147018
146547
|
}
|
|
147019
146548
|
if (hasDefaultNodes) {
|
|
147020
146549
|
setNodes(next2);
|
|
@@ -148967,8 +148496,8 @@ const createStore = ({ nodes, edges, defaultNodes, defaultEdges, width, height,
|
|
|
148967
148496
|
const parentExpandChanges = handleExpandParent(parentExpandChildren, nodeLookup, parentLookup, nodeOrigin2);
|
|
148968
148497
|
changes.push(...parentExpandChanges);
|
|
148969
148498
|
}
|
|
148970
|
-
for (const
|
|
148971
|
-
changes =
|
|
148499
|
+
for (const middleware of onNodesChangeMiddlewareMap.values()) {
|
|
148500
|
+
changes = middleware(changes);
|
|
148972
148501
|
}
|
|
148973
148502
|
triggerNodeChanges(changes);
|
|
148974
148503
|
},
|
|
@@ -153462,7 +152991,7 @@ const route4 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProper
|
|
|
153462
152991
|
__proto__: null,
|
|
153463
152992
|
loader
|
|
153464
152993
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
153465
|
-
const serverManifest = { "entry": { "module": "/assets/entry.client-DOJDY_4b.js", "imports": ["/assets/index-BXZSIDEp.js"], "css": [] }, "routes": { "root": { "id": "root", "parentId": void 0, "path": "", "index": void 0, "caseSensitive": void 0, "hasAction": true, "hasLoader": true, "hasClientAction": false, "hasClientLoader": false, "hasClientMiddleware": false, "hasDefaultExport": true, "hasErrorBoundary": true, "module": "/assets/root-
|
|
152994
|
+
const serverManifest = { "entry": { "module": "/assets/entry.client-DOJDY_4b.js", "imports": ["/assets/index-BXZSIDEp.js"], "css": [] }, "routes": { "root": { "id": "root", "parentId": void 0, "path": "", "index": void 0, "caseSensitive": void 0, "hasAction": true, "hasLoader": true, "hasClientAction": false, "hasClientLoader": false, "hasClientMiddleware": false, "hasDefaultExport": true, "hasErrorBoundary": true, "module": "/assets/root-BABNjrUh.js", "imports": ["/assets/index-BXZSIDEp.js", "/assets/mermaid-3ZIDBTTL-BMWEihLr.js"], "css": ["/assets/root-Bqr5evzw.css", "/assets/mermaid-3ZIDBTTL-CVTQRy2j.css"], "clientActionModule": void 0, "clientLoaderModule": void 0, "clientMiddlewareModule": void 0, "hydrateFallbackModule": void 0 }, "routes/home": { "id": "routes/home", "parentId": "root", "path": void 0, "index": true, "caseSensitive": void 0, "hasAction": false, "hasLoader": false, "hasClientAction": false, "hasClientLoader": false, "hasClientMiddleware": false, "hasDefaultExport": true, "hasErrorBoundary": false, "module": "/assets/home-DmsdVk2U.js", "imports": ["/assets/index-BXZSIDEp.js", "/assets/workflow-graph-viewer-fgQ2XQ5R.js", "/assets/mermaid-3ZIDBTTL-BMWEihLr.js", "/assets/index-B6-SzLmT.js"], "css": ["/assets/workflow-graph-viewer-DnlNuQQH.css", "/assets/mermaid-3ZIDBTTL-CVTQRy2j.css"], "clientActionModule": void 0, "clientLoaderModule": void 0, "clientMiddlewareModule": void 0, "hydrateFallbackModule": void 0 }, "routes/run-detail": { "id": "routes/run-detail", "parentId": "root", "path": "run/:runId", "index": void 0, "caseSensitive": void 0, "hasAction": false, "hasLoader": false, "hasClientAction": false, "hasClientLoader": false, "hasClientMiddleware": false, "hasDefaultExport": true, "hasErrorBoundary": false, "module": "/assets/run-detail-9xQOGhVk.js", "imports": ["/assets/index-BXZSIDEp.js", "/assets/workflow-graph-viewer-fgQ2XQ5R.js", "/assets/mermaid-3ZIDBTTL-BMWEihLr.js", "/assets/encryption-g14N5vQl.js", "/assets/index-B6-SzLmT.js"], "css": ["/assets/workflow-graph-viewer-DnlNuQQH.css", "/assets/mermaid-3ZIDBTTL-CVTQRy2j.css"], "clientActionModule": void 0, "clientLoaderModule": void 0, "clientMiddlewareModule": void 0, "hydrateFallbackModule": void 0 }, "routes/api.rpc": { "id": "routes/api.rpc", "parentId": "root", "path": "api/rpc", "index": void 0, "caseSensitive": void 0, "hasAction": true, "hasLoader": true, "hasClientAction": false, "hasClientLoader": false, "hasClientMiddleware": false, "hasDefaultExport": false, "hasErrorBoundary": false, "module": "/assets/api.rpc-l0sNRNKZ.js", "imports": [], "css": [], "clientActionModule": void 0, "clientLoaderModule": void 0, "clientMiddlewareModule": void 0, "hydrateFallbackModule": void 0 }, "routes/api.stream.$streamId": { "id": "routes/api.stream.$streamId", "parentId": "root", "path": "api/stream/:streamId", "index": void 0, "caseSensitive": void 0, "hasAction": false, "hasLoader": true, "hasClientAction": false, "hasClientLoader": false, "hasClientMiddleware": false, "hasDefaultExport": false, "hasErrorBoundary": false, "module": "/assets/api.stream._streamId-l0sNRNKZ.js", "imports": [], "css": [], "clientActionModule": void 0, "clientLoaderModule": void 0, "clientMiddlewareModule": void 0, "hydrateFallbackModule": void 0 } }, "url": "/assets/manifest-67209c1f.js", "version": "67209c1f", "sri": void 0 };
|
|
153466
152995
|
const assetsBuildDirectory = "build/client";
|
|
153467
152996
|
const basename = "/";
|
|
153468
152997
|
const future = { "unstable_optimizeDeps": false, "unstable_subResourceIntegrity": false, "unstable_trailingSlashAwareDataRequests": false, "unstable_previewServerPrerendering": false, "v8_middleware": false, "v8_splitRouteModules": false, "v8_viteEnvironmentApi": false };
|
|
@@ -153531,56 +153060,62 @@ const serverBuild = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineP
|
|
|
153531
153060
|
ssr
|
|
153532
153061
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
153533
153062
|
export {
|
|
153063
|
+
jsxRuntimeExports as $,
|
|
153534
153064
|
ATTRIBUTE_KEY_MAX_LENGTH as A,
|
|
153535
153065
|
BaseEventSchema as B,
|
|
153536
|
-
|
|
153066
|
+
isLegacySpecVersion as C,
|
|
153537
153067
|
DEFAULT_TIMESTAMP_THRESHOLD_FUTURE_MS as D,
|
|
153538
153068
|
EVENT_DATA_REF_FIELDS as E,
|
|
153539
|
-
|
|
153540
|
-
|
|
153069
|
+
parseQueueName as F,
|
|
153070
|
+
reenqueueActiveRuns as G,
|
|
153541
153071
|
HookSchema as H,
|
|
153542
|
-
|
|
153543
|
-
|
|
153544
|
-
|
|
153072
|
+
requiresNewerWorld as I,
|
|
153073
|
+
resolveQueueNamespace as J,
|
|
153074
|
+
stripEventDataRefs as K,
|
|
153545
153075
|
LegacySerializedDataSchemaV1 as L,
|
|
153546
153076
|
MessageId as M,
|
|
153547
153077
|
Nt as N,
|
|
153548
|
-
|
|
153078
|
+
ulidToDate as O,
|
|
153549
153079
|
PaginatedResponseSchema as P,
|
|
153550
153080
|
QueuePayloadSchema as Q,
|
|
153551
153081
|
RESERVED_ATTRIBUTE_KEY_PREFIX as R,
|
|
153552
153082
|
SPEC_VERSION_CURRENT as S,
|
|
153553
|
-
|
|
153554
|
-
|
|
153083
|
+
validateAttributeChanges as T,
|
|
153084
|
+
validateAttributeKey as U,
|
|
153555
153085
|
ValidQueueName as V,
|
|
153556
153086
|
WaitSchema as W,
|
|
153557
|
-
|
|
153558
|
-
|
|
153559
|
-
|
|
153087
|
+
validateAttributeValue as X,
|
|
153088
|
+
validateUlidTimestamp as Y,
|
|
153089
|
+
R as Z,
|
|
153090
|
+
Ks as _,
|
|
153560
153091
|
ATTRIBUTE_MAX_PER_RUN as a,
|
|
153092
|
+
Qe as a0,
|
|
153093
|
+
requireTokenUtil as a1,
|
|
153094
|
+
requireTokenError as a2,
|
|
153095
|
+
serverBuild as a3,
|
|
153561
153096
|
ATTRIBUTE_VALUE_MAX_BYTES as b,
|
|
153562
|
-
|
|
153563
|
-
|
|
153564
|
-
|
|
153565
|
-
|
|
153566
|
-
|
|
153567
|
-
|
|
153568
|
-
|
|
153569
|
-
|
|
153570
|
-
|
|
153571
|
-
|
|
153572
|
-
|
|
153573
|
-
|
|
153574
|
-
|
|
153575
|
-
|
|
153576
|
-
|
|
153577
|
-
|
|
153578
|
-
|
|
153579
|
-
|
|
153580
|
-
|
|
153581
|
-
|
|
153582
|
-
|
|
153583
|
-
|
|
153584
|
-
|
|
153585
|
-
|
|
153097
|
+
AttributeChangeSchema as c,
|
|
153098
|
+
AttributeChangesSchema as d,
|
|
153099
|
+
AttributeValidationError as e,
|
|
153100
|
+
DEFAULT_TIMESTAMP_THRESHOLD_PAST_MS as f,
|
|
153101
|
+
EventSchema as g,
|
|
153102
|
+
EventTypeSchema as h,
|
|
153103
|
+
HealthCheckPayloadSchema as i,
|
|
153104
|
+
QueuePrefix as j,
|
|
153105
|
+
RunInputSchema as k,
|
|
153106
|
+
SPEC_VERSION_LEGACY as l,
|
|
153107
|
+
SPEC_VERSION_SUPPORTS_ATTRIBUTES as m,
|
|
153108
|
+
SPEC_VERSION_SUPPORTS_CBOR_QUEUE_TRANSPORT as n,
|
|
153109
|
+
SPEC_VERSION_SUPPORTS_EVENT_SOURCING as o,
|
|
153110
|
+
SerializedDataSchema as p,
|
|
153111
|
+
StepInvokePayloadSchema as q,
|
|
153112
|
+
StepSchema as r,
|
|
153113
|
+
StepStatusSchema as s,
|
|
153114
|
+
WaitStatusSchema as t,
|
|
153115
|
+
WorkflowInvokePayloadSchema as u,
|
|
153116
|
+
WorkflowRunBaseSchema as v,
|
|
153117
|
+
WorkflowRunSchema as w,
|
|
153118
|
+
WorkflowRunStatusSchema as x,
|
|
153119
|
+
applyAttributeChanges as y,
|
|
153120
|
+
getQueueTopicPrefix as z
|
|
153586
153121
|
};
|