@brickkit/cli 0.12.0 → 0.13.0
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/dashboard-dist/{api-reference-B-bZRtNV.js → api-reference-mT9VNcPb.js} +69 -69
- package/dashboard-dist/app.js +12 -13
- package/dashboard-dist/{client-BJJtVSVr.js → client-CwATkLJa.js} +1 -1
- package/dashboard-dist/{core-Z7NJFk0K.js → core-BEUWp6B5.js} +1 -1
- package/dashboard-dist/docs-BRrtyxDB.js +4 -0
- package/dashboard-dist/kit.js +1 -1
- package/dashboard-dist/popover-Bj9x-88h.js +1 -0
- package/dist/bin.js +154 -217
- package/dist/bin.js.map +1 -1
- package/dist/build.js +463 -0
- package/dist/build.js.map +1 -0
- package/dist/client-contract-file.js +356 -1
- package/dist/client-contract-file.js.map +1 -0
- package/dist/compiler.d.ts +12 -2
- package/dist/compiler2.js +12 -5
- package/dist/compiler2.js.map +1 -1
- package/dist/config.d.ts +3 -0
- package/dist/config.js +1 -250
- package/dist/config2.d.ts +122 -0
- package/dist/config2.js +207 -0
- package/dist/config2.js.map +1 -0
- package/dist/dashboard-extension.d.ts +3 -0
- package/dist/{dev-telemetry-store.js → dashboard-host.js} +1533 -1574
- package/dist/dashboard-host.js.map +1 -0
- package/dist/dashboard-protocol.js +189 -0
- package/dist/dashboard-protocol.js.map +1 -0
- package/dist/dashboard.d.ts +4 -1
- package/dist/definitions.js +33 -0
- package/dist/definitions.js.map +1 -0
- package/dist/dev-application.js +34 -0
- package/dist/dev-application.js.map +1 -0
- package/dist/dev-protocol.js +21 -0
- package/dist/dev-protocol.js.map +1 -0
- package/dist/dev-reporter.js +2 -1
- package/dist/dev-reporter.js.map +1 -1
- package/dist/dev-telemetry.js +5 -20
- package/dist/dev-telemetry.js.map +1 -1
- package/dist/dev-worker.js +79 -19
- package/dist/dev-worker.js.map +1 -1
- package/dist/index.d.ts +15 -74
- package/dist/index.js +12 -5
- package/dist/index.js.map +1 -0
- package/dist/lint/oxlint.js +5 -3
- package/dist/lint/oxlint.js.map +1 -1
- package/dist/own-module.js +7 -0
- package/dist/own-module.js.map +1 -0
- package/dist/plugin.d.ts +6 -5
- package/dist/plugin.js +5 -39
- package/dist/plugin.js.map +1 -1
- package/dist/production-dashboard.d.ts +2 -0
- package/dist/production-dashboard.js +51 -0
- package/dist/production-dashboard.js.map +1 -0
- package/dist/production-dashboard2.d.ts +34 -0
- package/dist/{presets.js → project.js} +104 -106
- package/dist/project.js.map +1 -0
- package/dist/serve.d.ts +24 -0
- package/dist/serve.js +1 -0
- package/dist/serve2.js +49 -0
- package/dist/serve2.js.map +1 -0
- package/dist/vite.js +26 -47
- package/dist/vite.js.map +1 -1
- package/dist/workflows.d.ts +2 -2
- package/dist/workflows2.js +59 -37
- package/dist/workflows2.js.map +1 -1
- package/inspector-dist/client/assets/app-CeSwVsRm.css +2 -0
- package/inspector-dist/client/assets/{highlighted-body-B3W2YXNL-DYVdwGy2.js → highlighted-body-B3W2YXNL-CfRnuITN.js} +1 -1
- package/inspector-dist/client/assets/{home-CyjkvtII.js → home-hwPlkNhv.js} +1529 -378
- package/inspector-dist/client/assets/manifest-0e76e9ac.js +1 -0
- package/inspector-dist/client/assets/mermaid-3ZIDBTTL-ZDR2PNY_.js +1 -0
- package/inspector-dist/client/assets/root-ChBNTZd2.css +2 -0
- package/inspector-dist/client/assets/{root-DX9wtogx.js → root-SLeEf-sT.js} +17 -29
- package/inspector-dist/client/assets/{run-detail-C69EJGql.js → run-detail-DYbVkIFH.js} +398 -76
- package/inspector-dist/client/assets/{tabs-B6B88IjT.js → tabs-CaJisoyb.js} +189 -2130
- package/inspector-dist/client/assets/{zstd-browser-decoder-ByUgcY9H.js → zstd-browser-decoder-D94wmfAU.js} +1 -1
- package/inspector-dist/server/assets/{app-WoDoT62X.js → app-DGlfWVUI.js} +69783 -70608
- package/inspector-dist/server/assets/{chunk-RLXIAIE6-CbvDIAEa.js → chunk-RLXIAIE6-F0SJZlei.js} +4 -6
- package/inspector-dist/server/assets/{dist-qR-969AD.js → dist-BCbwm6jl.js} +2 -4
- package/inspector-dist/server/assets/{dist-CQnQcIJg.js → dist-CG2aVufI.js} +0 -2
- package/inspector-dist/server/assets/{dist-BRxZSWUN.js → dist-Ce0I2PUv.js} +2 -5
- package/inspector-dist/server/assets/{dist-DqRd9pyS.js → dist-DY0UlahA.js} +0 -2
- package/inspector-dist/server/assets/{encryption-_PuklZNX.js → encryption-DdQgC8Rk.js} +2 -4
- package/inspector-dist/server/assets/{event-metadata-BVakQJ_y.js → event-metadata-n7E4zEmT.js} +0 -2
- package/inspector-dist/server/assets/{functions-CImcpqNl.js → functions-CNVQtbgg.js} +2 -4
- package/inspector-dist/server/assets/{global-singleton-CPirHxFh.js → global-singleton-D8sIN5du.js} +0 -2
- package/inspector-dist/server/assets/{highlighted-body-B3W2YXNL-fPMB_t7F.js → highlighted-body-B3W2YXNL-CWRzMxYD.js} +2 -4
- package/inspector-dist/server/assets/mermaid-3ZIDBTTL-D0v0ngVr.js +1 -0
- package/inspector-dist/server/assets/{parse-D9Vvgzt9.js → parse-Begau9cA.js} +0 -2
- package/inspector-dist/server/assets/{rolldown-runtime-CLg409Sh.js → rolldown-runtime-C1I3wEg2.js} +1 -2
- package/inspector-dist/server/assets/{serialization-format-DDtsVTU1.js → serialization-format-BbuGfHog.js} +6 -8
- package/inspector-dist/server/assets/{token-BW4GdQZh.js → token-BgMmJNP5.js} +2 -4
- package/inspector-dist/server/assets/{token-D6FXdkJT.js → token-BrUX0bxz.js} +2 -4
- package/inspector-dist/server/assets/{token-util-BoNmi-wE.js → token-util-DZN32qmT.js} +1 -3
- package/inspector-dist/server/assets/{wrapper-wiqsGXcE.js → wrapper-CIC3w0oC.js} +1 -3
- package/inspector-dist/server/assets/{ws-transport-DV7oG4mL.js → ws-transport-CxTYB11n.js} +24094 -24096
- package/inspector-dist/server/assets/{zstd-browser-decoder-Cswf0KO6.js → zstd-browser-decoder-D7bCXbGg.js} +2 -4
- package/inspector-dist/server/index.js +1 -3
- package/package.json +12 -2
- package/dashboard-dist/docs-Dpfc0wJb.js +0 -4
- package/dashboard-dist/popover-BzejBolB.js +0 -1
- package/dist/app-entry.js +0 -1
- package/dist/app-entry2.js +0 -18
- package/dist/app-entry2.js.map +0 -1
- package/dist/client-contract-file2.js +0 -33
- package/dist/client-contract-file2.js.map +0 -1
- package/dist/client-contract.js +0 -1
- package/dist/client-contract2.js +0 -296
- package/dist/client-contract2.js.map +0 -1
- package/dist/config.js.map +0 -1
- package/dist/dev-telemetry-store.js.map +0 -1
- package/dist/emit.d.ts +0 -5
- package/dist/presets.js.map +0 -1
- package/dist/runner.js +0 -519
- package/dist/runner.js.map +0 -1
- package/inspector-dist/client/assets/app-CCzpuUz_.css +0 -2
- package/inspector-dist/client/assets/manifest-ba30b52d.js +0 -1
- package/inspector-dist/client/assets/mermaid-3ZIDBTTL-Dy6IVqPy.js +0 -1
- package/inspector-dist/client/assets/root-8BMab1lL.css +0 -2
- package/inspector-dist/client/assets/world-config-context-C3BqXPIv.js +0 -30
- package/inspector-dist/server/assets/mermaid-3ZIDBTTL-bADXySE3.js +0 -3
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/highlighted-body-B3W2YXNL-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/highlighted-body-B3W2YXNL-CfRnuITN.js","assets/jsx-runtime-CPEah4WQ.js"])))=>i.map(i=>d[i]);
|
|
2
2
|
import { F as require_react, I as __commonJSMin, L as __exportAll, P as require_react_dom, R as __toESM, t as require_jsx_runtime } from "./jsx-runtime-CPEah4WQ.js";
|
|
3
3
|
import { _ as useFloating, a as Portal$1, d as flip, f as hide$2, g as size, h as shift, i as Content2, l as Trigger, m as offset, n as toast, o as Provider, p as limitShift, r as Arrow2, s as Root3, u as arrow, v as autoUpdate } from "./dist-BK8w6xOr.js";
|
|
4
4
|
// ../../node_modules/.bun/@workflow+utils@5.0.2/node_modules/@workflow/utils/dist/parse-name.js
|
|
@@ -3835,7 +3835,7 @@ var getDefaultConfig = () => {
|
|
|
3835
3835
|
* @param baseConfig Config where other config will be merged into. This object will be mutated.
|
|
3836
3836
|
* @param configExtension Partial config to merge into the `baseConfig`.
|
|
3837
3837
|
*/
|
|
3838
|
-
var mergeConfigs
|
|
3838
|
+
var mergeConfigs = (baseConfig, { cacheSize, prefix, experimentalParseClassName, extend = {}, override = {} }) => {
|
|
3839
3839
|
overrideProperty(baseConfig, "cacheSize", cacheSize);
|
|
3840
3840
|
overrideProperty(baseConfig, "prefix", prefix);
|
|
3841
3841
|
overrideProperty(baseConfig, "experimentalParseClassName", experimentalParseClassName);
|
|
@@ -3864,7 +3864,7 @@ var mergeArrayProperties = (baseObject, mergeObject, key) => {
|
|
|
3864
3864
|
const mergeValue = mergeObject[key];
|
|
3865
3865
|
if (mergeValue !== void 0) baseObject[key] = baseObject[key] ? baseObject[key].concat(mergeValue) : mergeValue;
|
|
3866
3866
|
};
|
|
3867
|
-
var extendTailwindMerge = (configExtension, ...createConfig) => typeof configExtension === "function" ? createTailwindMerge(getDefaultConfig, configExtension, ...createConfig) : createTailwindMerge(() => mergeConfigs
|
|
3867
|
+
var extendTailwindMerge = (configExtension, ...createConfig) => typeof configExtension === "function" ? createTailwindMerge(getDefaultConfig, configExtension, ...createConfig) : createTailwindMerge(() => mergeConfigs(getDefaultConfig(), configExtension), ...createConfig);
|
|
3868
3868
|
var twMerge = /*#__PURE__*/ createTailwindMerge(getDefaultConfig);
|
|
3869
3869
|
// ../../node_modules/.bun/@workflow+web-shared@5.0.7+ef45aacb3ed76560/node_modules/@workflow/web-shared/dist/lib/cn.js
|
|
3870
3870
|
var import_jsx_runtime = require_jsx_runtime();
|
|
@@ -17086,7 +17086,6 @@ var RetryableError = class extends Error {
|
|
|
17086
17086
|
return isError(value) && value.name === "RetryableError";
|
|
17087
17087
|
}
|
|
17088
17088
|
};
|
|
17089
|
-
var VERCEL_403_ERROR_MESSAGE = "Your current vercel account does not have access to this resource. Use `vercel login` or `vercel switch` to ensure you are linked to the right account.";
|
|
17090
17089
|
var FATAL_ERROR_KEY = Symbol.for("@workflow/errors//FatalError");
|
|
17091
17090
|
var RETRYABLE_ERROR_KEY = Symbol.for("@workflow/errors//RetryableError");
|
|
17092
17091
|
var HOOK_CONFLICT_ERROR_KEY = Symbol.for("@workflow/errors//HookConflictError");
|
|
@@ -18609,7 +18608,7 @@ async function hydrateResourceIOAsync(resource, key) {
|
|
|
18609
18608
|
};
|
|
18610
18609
|
}, void 0);
|
|
18611
18610
|
const { ensureZstdDecoderRegistered } = await __vitePreload(async () => {
|
|
18612
|
-
const { ensureZstdDecoderRegistered } = await import("./zstd-browser-decoder-
|
|
18611
|
+
const { ensureZstdDecoderRegistered } = await import("./zstd-browser-decoder-D94wmfAU.js");
|
|
18613
18612
|
return { ensureZstdDecoderRegistered };
|
|
18614
18613
|
}, []);
|
|
18615
18614
|
ensureZstdDecoderRegistered();
|
|
@@ -19009,7 +19008,7 @@ function cancelMeasurement(key) {
|
|
|
19009
19008
|
}
|
|
19010
19009
|
}
|
|
19011
19010
|
// ../../node_modules/.bun/@workflow+web-shared@5.0.7+ef45aacb3ed76560/node_modules/@workflow/web-shared/dist/components/trace-viewer/components/middle-truncate/use-middle-truncate.js
|
|
19012
|
-
var useIsomorphicLayoutEffect$
|
|
19011
|
+
var useIsomorphicLayoutEffect$1 = typeof window === "undefined" ? import_react.useEffect : import_react.useLayoutEffect;
|
|
19013
19012
|
function createFullState(value, graphemes) {
|
|
19014
19013
|
return {
|
|
19015
19014
|
displayText: value,
|
|
@@ -19117,7 +19116,7 @@ function useMiddleTruncate(value) {
|
|
|
19117
19116
|
updateState,
|
|
19118
19117
|
value
|
|
19119
19118
|
]);
|
|
19120
|
-
useIsomorphicLayoutEffect$
|
|
19119
|
+
useIsomorphicLayoutEffect$1(() => {
|
|
19121
19120
|
const measurement = readMeasurement();
|
|
19122
19121
|
if (measurement) recalculate(measurement);
|
|
19123
19122
|
}, [readMeasurement, recalculate]);
|
|
@@ -24537,7 +24536,7 @@ var serializer = (strict, json, $, _) => {
|
|
|
24537
24536
|
* like JSON stringify would behave. Symbol and Function will be discarded.
|
|
24538
24537
|
* @returns {Record[]}
|
|
24539
24538
|
*/
|
|
24540
|
-
var serialize$
|
|
24539
|
+
var serialize$2 = (value, { json, lossy } = {}) => {
|
|
24541
24540
|
const _ = [];
|
|
24542
24541
|
return serializer(!(json || lossy), !!json, /* @__PURE__ */ new Map(), _)(value), _;
|
|
24543
24542
|
};
|
|
@@ -24555,7 +24554,7 @@ var serialize$3 = (value, { json, lossy } = {}) => {
|
|
|
24555
24554
|
*/
|
|
24556
24555
|
var esm_default = typeof structuredClone === "function" ?
|
|
24557
24556
|
/* c8 ignore start */
|
|
24558
|
-
(any, options) => options && ("json" in options || "lossy" in options) ? deserialize(serialize$
|
|
24557
|
+
(any, options) => options && ("json" in options || "lossy" in options) ? deserialize(serialize$2(any, options)) : structuredClone(any) : (any, options) => deserialize(serialize$2(any, options));
|
|
24559
24558
|
// ../../node_modules/.bun/property-information@7.2.0/node_modules/property-information/lib/util/schema.js
|
|
24560
24559
|
/**
|
|
24561
24560
|
* @import {Schema as SchemaType, Space} from 'property-information'
|
|
@@ -24614,7 +24613,7 @@ function merge(definitions, space) {
|
|
|
24614
24613
|
* Value that can be used to look up the properly cased property on a
|
|
24615
24614
|
* `Schema`.
|
|
24616
24615
|
*/
|
|
24617
|
-
function normalize$
|
|
24616
|
+
function normalize$1(value) {
|
|
24618
24617
|
return value.toLowerCase();
|
|
24619
24618
|
}
|
|
24620
24619
|
// ../../node_modules/.bun/property-information@7.2.0/node_modules/property-information/lib/util/info.js
|
|
@@ -24757,8 +24756,8 @@ function create(definition) {
|
|
|
24757
24756
|
const info = new DefinedInfo(property, definition.transform(definition.attributes || {}, property), value, definition.space);
|
|
24758
24757
|
if (definition.mustUseProperty && definition.mustUseProperty.includes(property)) info.mustUseProperty = true;
|
|
24759
24758
|
properties[property] = info;
|
|
24760
|
-
normals[normalize$
|
|
24761
|
-
normals[normalize$
|
|
24759
|
+
normals[normalize$1(property)] = property;
|
|
24760
|
+
normals[normalize$1(info.attribute)] = property;
|
|
24762
24761
|
}
|
|
24763
24762
|
return new Schema(properties, normals, definition.space);
|
|
24764
24763
|
}
|
|
@@ -25830,7 +25829,7 @@ var valid = /^data[-\w.:]+$/i;
|
|
|
25830
25829
|
* Info.
|
|
25831
25830
|
*/
|
|
25832
25831
|
function find(schema, value) {
|
|
25833
|
-
const normal = normalize$
|
|
25832
|
+
const normal = normalize$1(value);
|
|
25834
25833
|
let property = value;
|
|
25835
25834
|
let Type = Info;
|
|
25836
25835
|
if (normal in schema.normal) return schema.property[schema.normal[normal]];
|
|
@@ -26261,7 +26260,7 @@ function addChild(nodes, value) {
|
|
|
26261
26260
|
function parsePrimitive(info, name, value) {
|
|
26262
26261
|
if (typeof value === "string") {
|
|
26263
26262
|
if (info.number && value && !Number.isNaN(Number(value))) return Number(value);
|
|
26264
|
-
if ((info.boolean || info.overloadedBoolean) && (value === "" || normalize$
|
|
26263
|
+
if ((info.boolean || info.overloadedBoolean) && (value === "" || normalize$1(value) === normalize$1(name))) return true;
|
|
26265
26264
|
}
|
|
26266
26265
|
return value;
|
|
26267
26266
|
}
|
|
@@ -36353,7 +36352,7 @@ function markdownTable(table, options) {
|
|
|
36353
36352
|
let columnIndex = -1;
|
|
36354
36353
|
if (table[rowIndex].length > mostCellsPerRow) mostCellsPerRow = table[rowIndex].length;
|
|
36355
36354
|
while (++columnIndex < table[rowIndex].length) {
|
|
36356
|
-
const cell = serialize$
|
|
36355
|
+
const cell = serialize$1(table[rowIndex][columnIndex]);
|
|
36357
36356
|
if (settings.alignDelimiters !== false) {
|
|
36358
36357
|
const size = stringLength(cell);
|
|
36359
36358
|
sizes[columnIndex] = size;
|
|
@@ -36444,7 +36443,7 @@ function markdownTable(table, options) {
|
|
|
36444
36443
|
* @returns {string}
|
|
36445
36444
|
* Result.
|
|
36446
36445
|
*/
|
|
36447
|
-
function serialize$
|
|
36446
|
+
function serialize$1(value) {
|
|
36448
36447
|
return value === null || value === void 0 ? "" : String(value);
|
|
36449
36448
|
}
|
|
36450
36449
|
/**
|
|
@@ -37454,7 +37453,7 @@ function phrasing(parent, state, info) {
|
|
|
37454
37453
|
results[results.length - 1] = previous.replace(/(\r?\n|\r)$/, " ");
|
|
37455
37454
|
before = " ";
|
|
37456
37455
|
tracker = state.createTracker(info);
|
|
37457
|
-
tracker.move(serialize
|
|
37456
|
+
tracker.move(serialize(results, info.before, info.after));
|
|
37458
37457
|
}
|
|
37459
37458
|
/** @type {(Handle & {attention?: Attention | undefined}) | undefined} */
|
|
37460
37459
|
const handle = state.handle.handlers[child.type];
|
|
@@ -37503,7 +37502,7 @@ function attentionItem(node, attention, state, tracker) {
|
|
|
37503
37502
|
before: sequence,
|
|
37504
37503
|
after: sequence
|
|
37505
37504
|
});
|
|
37506
|
-
tracker.move(serialize
|
|
37505
|
+
tracker.move(serialize(children, sequence, sequence));
|
|
37507
37506
|
tracker.move(sequence);
|
|
37508
37507
|
exit();
|
|
37509
37508
|
return {
|
|
@@ -37587,7 +37586,7 @@ function render(items, chosen, before, after) {
|
|
|
37587
37586
|
* @returns {string}
|
|
37588
37587
|
* Serialized markdown.
|
|
37589
37588
|
*/
|
|
37590
|
-
function serialize
|
|
37589
|
+
function serialize(items, before, after) {
|
|
37591
37590
|
/** @type {Map<AttentionResult, string>} */
|
|
37592
37591
|
let chosen = /* @__PURE__ */ new Map();
|
|
37593
37592
|
const initial = render(items, chosen, before, after);
|
|
@@ -37632,7 +37631,7 @@ emphasis$1.peek = peek$1;
|
|
|
37632
37631
|
*/
|
|
37633
37632
|
function emphasis$1(node, _, state, info) {
|
|
37634
37633
|
const exit = state.enter("phrasing");
|
|
37635
|
-
const value = serialize
|
|
37634
|
+
const value = serialize([attentionItem(node, attention$2, state, state.createTracker(info))], info.before, info.after);
|
|
37636
37635
|
exit();
|
|
37637
37636
|
return value;
|
|
37638
37637
|
}
|
|
@@ -38497,7 +38496,7 @@ strong$1.peek = peek;
|
|
|
38497
38496
|
*/
|
|
38498
38497
|
function strong$1(node, _, state, info) {
|
|
38499
38498
|
const exit = state.enter("phrasing");
|
|
38500
|
-
const value = serialize
|
|
38499
|
+
const value = serialize([attentionItem(node, attention$1, state, state.createTracker(info))], info.before, info.after);
|
|
38501
38500
|
exit();
|
|
38502
38501
|
return value;
|
|
38503
38502
|
}
|
|
@@ -52143,7 +52142,7 @@ function strong(state, node) {
|
|
|
52143
52142
|
* @returns {Element}
|
|
52144
52143
|
* hast node.
|
|
52145
52144
|
*/
|
|
52146
|
-
function table
|
|
52145
|
+
function table(state, node) {
|
|
52147
52146
|
const rows = state.all(node);
|
|
52148
52147
|
const firstRow = rows.shift();
|
|
52149
52148
|
/** @type {Array<Element>} */
|
|
@@ -52404,7 +52403,7 @@ var handlers = {
|
|
|
52404
52403
|
paragraph,
|
|
52405
52404
|
root,
|
|
52406
52405
|
strong,
|
|
52407
|
-
table
|
|
52406
|
+
table,
|
|
52408
52407
|
tableCell,
|
|
52409
52408
|
tableRow,
|
|
52410
52409
|
text,
|
|
@@ -53682,7 +53681,7 @@ function join(...segments) {
|
|
|
53682
53681
|
assertPath$1(segments[index]);
|
|
53683
53682
|
if (segments[index]) joined = joined === void 0 ? segments[index] : joined + "/" + segments[index];
|
|
53684
53683
|
}
|
|
53685
|
-
return joined === void 0 ? "." : normalize
|
|
53684
|
+
return joined === void 0 ? "." : normalize(joined);
|
|
53686
53685
|
}
|
|
53687
53686
|
/**
|
|
53688
53687
|
* Normalize a basic file path.
|
|
@@ -53692,7 +53691,7 @@ function join(...segments) {
|
|
|
53692
53691
|
* @returns {string}
|
|
53693
53692
|
* File path.
|
|
53694
53693
|
*/
|
|
53695
|
-
function normalize
|
|
53694
|
+
function normalize(path) {
|
|
53696
53695
|
assertPath$1(path);
|
|
53697
53696
|
const absolute = path.codePointAt(0) === 47;
|
|
53698
53697
|
let value = normalizeString(path, !absolute);
|
|
@@ -57251,7 +57250,7 @@ var ot = ({ language: e }) => (0, import_jsx_runtime.jsx)("div", {
|
|
|
57251
57250
|
})
|
|
57252
57251
|
});
|
|
57253
57252
|
var cn$1 = /\n+$/;
|
|
57254
|
-
var dn = (0, import_react.lazy)(() => __vitePreload(() => import("./highlighted-body-B3W2YXNL-
|
|
57253
|
+
var dn = (0, import_react.lazy)(() => __vitePreload(() => import("./highlighted-body-B3W2YXNL-CfRnuITN.js").then((e) => ({ default: e.HighlightedCodeBlockBody })), __vite__mapDeps([0,1])));
|
|
57255
57254
|
var rt = ({ code: e, language: t, className: o, children: n, isIncomplete: s = false, ...r }) => {
|
|
57256
57255
|
let i = (0, import_react.useMemo)(() => e.replace(cn$1, ""), [e]), c = (0, import_react.useMemo)(() => ({
|
|
57257
57256
|
bg: "transparent",
|
|
@@ -58392,7 +58391,7 @@ var Vt = ({ children: e, className: t, showControls: o, ...n }) => (0, import_js
|
|
|
58392
58391
|
})
|
|
58393
58392
|
})]
|
|
58394
58393
|
});
|
|
58395
|
-
var Jn = (0, import_react.lazy)(() => __vitePreload(() => import("./mermaid-3ZIDBTTL-
|
|
58394
|
+
var Jn = (0, import_react.lazy)(() => __vitePreload(() => import("./mermaid-3ZIDBTTL-ZDR2PNY_.js").then((e) => ({ default: e.Mermaid })), []));
|
|
58396
58395
|
var Kn = /language-([^\s]+)/;
|
|
58397
58396
|
function ke(e, t) {
|
|
58398
58397
|
if (!(e != null && e.position || t != null && t.position)) return true;
|
|
@@ -60248,7 +60247,7 @@ function useIntersectionObserver(elementRef, { threshold = 0, rootRef, rootMargi
|
|
|
60248
60247
|
* if the sentinel is still in view once a page finishes loading, the next
|
|
60249
60248
|
* page is requested automatically.
|
|
60250
60249
|
*/
|
|
60251
|
-
function useLoadMoreOnScroll
|
|
60250
|
+
function useLoadMoreOnScroll(loadMore, { hasMore, isLoadingMore, rootRef, rootMargin = "400px" }) {
|
|
60252
60251
|
const sentinelRef = (0, import_react.useRef)(null);
|
|
60253
60252
|
const entry = useIntersectionObserver(sentinelRef, {
|
|
60254
60253
|
rootRef,
|
|
@@ -66443,7 +66442,7 @@ function TraceViewerContent({ trace, onLoadMore, hasMore, isLoadingMore }) {
|
|
|
66443
66442
|
const searchResult = (0, import_react.useMemo)(() => searchSpans(trace.spans, deferredSearchQuery), [trace.spans, deferredSearchQuery]);
|
|
66444
66443
|
const root = (0, import_react.useMemo)(() => computeRootBounds(trace.spans), [trace.spans]);
|
|
66445
66444
|
const scrollContainerRef = (0, import_react.useRef)(null);
|
|
66446
|
-
const loadMoreSentinelRef = useLoadMoreOnScroll
|
|
66445
|
+
const loadMoreSentinelRef = useLoadMoreOnScroll((0, import_react.useCallback)(() => {
|
|
66447
66446
|
onLoadMore?.();
|
|
66448
66447
|
}, [onLoadMore]), {
|
|
66449
66448
|
hasMore: Boolean(onLoadMore && hasMore),
|
|
@@ -66909,7 +66908,7 @@ function analyzeEvents(events) {
|
|
|
66909
66908
|
function cn(...inputs) {
|
|
66910
66909
|
return twMerge(clsx(inputs));
|
|
66911
66910
|
}
|
|
66912
|
-
var LIVE_UPDATE_INTERVAL_MS
|
|
66911
|
+
var LIVE_UPDATE_INTERVAL_MS = 5e3;
|
|
66913
66912
|
/**
|
|
66914
66913
|
* Returns a formatted pagination display string
|
|
66915
66914
|
* @param currentPage - The current page number
|
|
@@ -67163,7 +67162,7 @@ function useControllableState({ prop, defaultProp, onChange = /* @__PURE__ */ __
|
|
|
67163
67162
|
const isControlled = prop !== void 0;
|
|
67164
67163
|
return [isControlled ? prop : uncontrolledProp, import_react.useCallback((nextValue) => {
|
|
67165
67164
|
if (isControlled) {
|
|
67166
|
-
const value2 = isFunction
|
|
67165
|
+
const value2 = isFunction(nextValue) ? nextValue(prop) : nextValue;
|
|
67167
67166
|
if (value2 !== prop) onChangeRef.current?.(value2);
|
|
67168
67167
|
} else setUncontrolledProp(nextValue);
|
|
67169
67168
|
}, [
|
|
@@ -67194,10 +67193,10 @@ function useUncontrolledState({ defaultProp, onChange }) {
|
|
|
67194
67193
|
];
|
|
67195
67194
|
}
|
|
67196
67195
|
__name$18(useUncontrolledState, "useUncontrolledState");
|
|
67197
|
-
function isFunction
|
|
67196
|
+
function isFunction(value) {
|
|
67198
67197
|
return typeof value === "function";
|
|
67199
67198
|
}
|
|
67200
|
-
__name$18(isFunction
|
|
67199
|
+
__name$18(isFunction, "isFunction");
|
|
67201
67200
|
var SYNC_STATE = Symbol("RADIX:SYNC_STATE");
|
|
67202
67201
|
function useControllableStateReducer(reducer, userArgs, initialArg, init) {
|
|
67203
67202
|
const { prop: controlledState, defaultProp, onChange: onChangeProp, caller } = userArgs;
|
|
@@ -67268,7 +67267,7 @@ function createSlot(ownerName) {
|
|
|
67268
67267
|
hasSlottable = true;
|
|
67269
67268
|
const slottable = maybeSlottable;
|
|
67270
67269
|
let child = "child" in slottable.props ? slottable.props.child : slottable.props.children;
|
|
67271
|
-
while (isLazyComponent(child) && typeof use
|
|
67270
|
+
while (isLazyComponent(child) && typeof use === "function") child = use(child._payload);
|
|
67272
67271
|
slottableElement = getSlottableElementFromSlottable(slottable, child);
|
|
67273
67272
|
newChildren.push(slottableElement?.props?.children);
|
|
67274
67273
|
} else newChildren.push(maybeSlottable);
|
|
@@ -67346,16 +67345,16 @@ function isSlottable(child) {
|
|
|
67346
67345
|
__name$17(isSlottable, "isSlottable");
|
|
67347
67346
|
var REACT_LAZY_TYPE = Symbol.for("react.lazy");
|
|
67348
67347
|
function isLazyComponent(element) {
|
|
67349
|
-
return element != null && typeof element === "object" && "$$typeof" in element && element.$$typeof === REACT_LAZY_TYPE && "_payload" in element && isPromiseLike
|
|
67348
|
+
return element != null && typeof element === "object" && "$$typeof" in element && element.$$typeof === REACT_LAZY_TYPE && "_payload" in element && isPromiseLike(element._payload);
|
|
67350
67349
|
}
|
|
67351
67350
|
__name$17(isLazyComponent, "isLazyComponent");
|
|
67352
|
-
function isPromiseLike
|
|
67351
|
+
function isPromiseLike(value) {
|
|
67353
67352
|
return typeof value === "object" && value !== null && "then" in value;
|
|
67354
67353
|
}
|
|
67355
|
-
__name$17(isPromiseLike
|
|
67354
|
+
__name$17(isPromiseLike, "isPromiseLike");
|
|
67356
67355
|
function useUnwrappedLazy(value) {
|
|
67357
67356
|
let unwrapped = value;
|
|
67358
|
-
while (isLazyComponent(unwrapped) && typeof use
|
|
67357
|
+
while (isLazyComponent(unwrapped) && typeof use === "function") unwrapped = use(unwrapped._payload);
|
|
67359
67358
|
return unwrapped;
|
|
67360
67359
|
}
|
|
67361
67360
|
__name$17(useUnwrappedLazy, "useUnwrappedLazy");
|
|
@@ -67374,7 +67373,7 @@ var createSlotError = /* @__PURE__ */ __name$17((ownerName) => {
|
|
|
67374
67373
|
var createSlottableError = /* @__PURE__ */ __name$17((ownerName) => {
|
|
67375
67374
|
return `${ownerName} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`;
|
|
67376
67375
|
}, "createSlottableError");
|
|
67377
|
-
var use
|
|
67376
|
+
var use = import_react[" use ".trim().toString()];
|
|
67378
67377
|
// ../../node_modules/.bun/@radix-ui+react-primitive@2.2.0+a68cb332b68cb125/node_modules/@radix-ui/react-primitive/dist/index.mjs
|
|
67379
67378
|
var __defProp$16 = Object.defineProperty;
|
|
67380
67379
|
var __name$16 = (target, value) => __defProp$16(target, "name", {
|
|
@@ -69484,7 +69483,7 @@ function useCallbackRef(initialValue, callback) {
|
|
|
69484
69483
|
return ref.facade;
|
|
69485
69484
|
}
|
|
69486
69485
|
// ../../node_modules/.bun/use-callback-ref@1.3.3+340ca8aed1dead99/node_modules/use-callback-ref/dist/es2015/useMergeRef.js
|
|
69487
|
-
var useIsomorphicLayoutEffect
|
|
69486
|
+
var useIsomorphicLayoutEffect = typeof window !== "undefined" ? import_react.useLayoutEffect : import_react.useEffect;
|
|
69488
69487
|
var currentValues = /* @__PURE__ */ new WeakMap();
|
|
69489
69488
|
/**
|
|
69490
69489
|
* Merges two or more refs together providing a single interface to set their value
|
|
@@ -69506,7 +69505,7 @@ function useMergeRefs(refs, defaultValue) {
|
|
|
69506
69505
|
return assignRef(ref, newValue);
|
|
69507
69506
|
});
|
|
69508
69507
|
});
|
|
69509
|
-
useIsomorphicLayoutEffect
|
|
69508
|
+
useIsomorphicLayoutEffect(function() {
|
|
69510
69509
|
var oldValue = currentValues.get(callbackRef);
|
|
69511
69510
|
if (oldValue) {
|
|
69512
69511
|
var prevRefs_1 = new Set(oldValue);
|
|
@@ -71048,6 +71047,114 @@ var DropdownMenuShortcut = ({ className, ...props }) => {
|
|
|
71048
71047
|
});
|
|
71049
71048
|
};
|
|
71050
71049
|
DropdownMenuShortcut.displayName = "DropdownMenuShortcut";
|
|
71050
|
+
// app/components/display-utils/copyable-text.tsx
|
|
71051
|
+
function CopyableText({ text, children, className, overlay }) {
|
|
71052
|
+
const [copied, setCopied] = (0, import_react.useState)(false);
|
|
71053
|
+
const handleCopy = async (e) => {
|
|
71054
|
+
e.stopPropagation();
|
|
71055
|
+
try {
|
|
71056
|
+
await navigator.clipboard.writeText(text);
|
|
71057
|
+
setCopied(true);
|
|
71058
|
+
setTimeout(() => setCopied(false), 2e3);
|
|
71059
|
+
} catch (err) {
|
|
71060
|
+
console.error("Failed to copy text:", err);
|
|
71061
|
+
}
|
|
71062
|
+
};
|
|
71063
|
+
if (overlay) return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
|
|
71064
|
+
className: cn("relative group/copy inline-block", className),
|
|
71065
|
+
children: [children, /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Tooltip, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(TooltipTrigger, {
|
|
71066
|
+
asChild: true,
|
|
71067
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
|
|
71068
|
+
type: "button",
|
|
71069
|
+
onClick: handleCopy,
|
|
71070
|
+
className: "absolute right-0 top-1/2 -translate-y-1/2 opacity-0 group-hover/copy:opacity-100 transition-opacity bg-background/80 backdrop-blur-sm p-1 rounded",
|
|
71071
|
+
"aria-label": "Copy to clipboard",
|
|
71072
|
+
children: copied ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Check, { className: "h-3 w-3 text-muted-foreground" }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Copy, { className: "h-3 w-3 text-muted-foreground hover:text-foreground" })
|
|
71073
|
+
})
|
|
71074
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TooltipContent, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: copied ? "Copied!" : "Copy to clipboard" }) })] })]
|
|
71075
|
+
});
|
|
71076
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
71077
|
+
className: cn("flex items-center gap-2 group", className),
|
|
71078
|
+
children: [children, /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Tooltip, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(TooltipTrigger, {
|
|
71079
|
+
asChild: true,
|
|
71080
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
|
|
71081
|
+
type: "button",
|
|
71082
|
+
onClick: handleCopy,
|
|
71083
|
+
className: "opacity-0 group-hover:opacity-100 transition-opacity",
|
|
71084
|
+
"aria-label": "Copy to clipboard",
|
|
71085
|
+
children: copied ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Check, { className: "h-3 w-3 text-green-600" }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Copy, { className: "h-3 w-3 text-muted-foreground hover:text-foreground" })
|
|
71086
|
+
})
|
|
71087
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TooltipContent, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: copied ? "Copied!" : "Copy to clipboard" }) })] })]
|
|
71088
|
+
});
|
|
71089
|
+
}
|
|
71090
|
+
// app/lib/client/workflow-errors.ts
|
|
71091
|
+
/**
|
|
71092
|
+
* Error instance for API and server-side errors.
|
|
71093
|
+
* `error.message` will be a user-facing error message, to be displayed in UI.
|
|
71094
|
+
* `error.cause` will be a developer-facing error message, to be displayed in logs.
|
|
71095
|
+
*
|
|
71096
|
+
* If the error originates from an HTTP request made from a server action,
|
|
71097
|
+
* these fields will be populated:
|
|
71098
|
+
* - `error.request` will be a JSON-serializable object representing the request made.
|
|
71099
|
+
* - `error.layer` will be 'API'
|
|
71100
|
+
*
|
|
71101
|
+
* If the error originates from inside the server action, or there's an error with
|
|
71102
|
+
* calling the server action, these fields will be populated:
|
|
71103
|
+
* - `error.layer` will be 'server'
|
|
71104
|
+
*/
|
|
71105
|
+
var WorkflowWebAPIError = class extends Error {
|
|
71106
|
+
request;
|
|
71107
|
+
layer;
|
|
71108
|
+
constructor(message, options) {
|
|
71109
|
+
super(message, { cause: options?.cause });
|
|
71110
|
+
this.name = "WorkflowWebAPIError";
|
|
71111
|
+
this.request = options?.request;
|
|
71112
|
+
this.layer = options?.layer;
|
|
71113
|
+
if (options?.cause instanceof Error) this.stack = `${this.stack}\nCaused by: ${options.cause.stack}`;
|
|
71114
|
+
}
|
|
71115
|
+
};
|
|
71116
|
+
function createWorkflowAPIError(serverError) {
|
|
71117
|
+
return new WorkflowWebAPIError(serverError.message, {
|
|
71118
|
+
cause: serverError.cause,
|
|
71119
|
+
request: serverError.request,
|
|
71120
|
+
layer: serverError.layer
|
|
71121
|
+
});
|
|
71122
|
+
}
|
|
71123
|
+
var getErrorMessage = (error) => error instanceof Error ? error.message : "An error occurred";
|
|
71124
|
+
async function unwrapServerActionResult(promise) {
|
|
71125
|
+
let result;
|
|
71126
|
+
try {
|
|
71127
|
+
result = await promise;
|
|
71128
|
+
} catch (error) {
|
|
71129
|
+
result = {
|
|
71130
|
+
success: false,
|
|
71131
|
+
error
|
|
71132
|
+
};
|
|
71133
|
+
}
|
|
71134
|
+
if (!result.success) {
|
|
71135
|
+
if (!result.error) return {
|
|
71136
|
+
error: new WorkflowWebAPIError("Unknown error occurred", { layer: "client" }),
|
|
71137
|
+
result: null
|
|
71138
|
+
};
|
|
71139
|
+
return {
|
|
71140
|
+
error: createWorkflowAPIError(result.error),
|
|
71141
|
+
result: null
|
|
71142
|
+
};
|
|
71143
|
+
}
|
|
71144
|
+
return {
|
|
71145
|
+
error: null,
|
|
71146
|
+
result: result.data
|
|
71147
|
+
};
|
|
71148
|
+
}
|
|
71149
|
+
/**
|
|
71150
|
+
* Unwraps a server action result, throwing WorkflowWebAPIError on failure.
|
|
71151
|
+
* Use for simple action wrappers where you just want the result or an exception.
|
|
71152
|
+
*/
|
|
71153
|
+
async function unwrapOrThrow(promise) {
|
|
71154
|
+
const { error, result } = await unwrapServerActionResult(promise);
|
|
71155
|
+
if (error) throw error;
|
|
71156
|
+
return result;
|
|
71157
|
+
}
|
|
71051
71158
|
// ../../node_modules/.bun/cbor-x@1.6.9/node_modules/cbor-x/decode.js
|
|
71052
71159
|
var decoder;
|
|
71053
71160
|
try {
|
|
@@ -73064,19 +73171,26 @@ defaultEncoder.encodeAsIterable;
|
|
|
73064
73171
|
defaultEncoder.encodeAsAsyncIterable;
|
|
73065
73172
|
var { NEVER, ALWAYS, DECIMAL_ROUND, DECIMAL_FIT } = FLOAT32_OPTIONS;
|
|
73066
73173
|
var THROW_ON_ITERABLE = 2048;
|
|
73067
|
-
// app/lib/
|
|
73174
|
+
// app/lib/types.ts
|
|
73175
|
+
/** The API routes, relative to the base path (see routes.ts). */
|
|
73176
|
+
var API_PATHS = {
|
|
73177
|
+
rpc: "api/rpc",
|
|
73178
|
+
stream: "api/stream/"
|
|
73179
|
+
};
|
|
73180
|
+
/** Stream response headers: the cursor for the next request, and "true" once the stream is closed. */
|
|
73181
|
+
var STREAM_CURSOR_HEADER = "X-Stream-Cursor";
|
|
73182
|
+
var STREAM_DONE_HEADER = "X-Stream-Done";
|
|
73183
|
+
// app/lib/rpc-client.ts
|
|
73068
73184
|
/**
|
|
73069
|
-
*
|
|
73070
|
-
*
|
|
73071
|
-
*
|
|
73185
|
+
* RPC client for calling the server's `rpcMethods` via the /api/rpc resource route.
|
|
73186
|
+
*
|
|
73187
|
+
* Uses CBOR encoding for both requests and responses to preserve
|
|
73188
|
+
* Uint8Array values (binary serialized data) across the wire.
|
|
73189
|
+
* Client-side code is responsible for hydrating/deserializing the data.
|
|
73072
73190
|
*/
|
|
73073
|
-
|
|
73074
|
-
if (typeof window === "undefined") return "";
|
|
73075
|
-
return window.__WORKFLOW_BASENAME__ ?? "";
|
|
73076
|
-
}
|
|
73077
|
-
// app/lib/rpc-client.ts
|
|
73191
|
+
/** Calls a server RPC method; type-checked against the server's own signature. */
|
|
73078
73192
|
async function rpc(method, params) {
|
|
73079
|
-
const res = await fetch(
|
|
73193
|
+
const res = await fetch(`/workflows/${API_PATHS.rpc}`, {
|
|
73080
73194
|
method: "POST",
|
|
73081
73195
|
headers: {
|
|
73082
73196
|
"Content-Type": "application/cbor",
|
|
@@ -73084,2068 +73198,16 @@ async function rpc(method, params) {
|
|
|
73084
73198
|
},
|
|
73085
73199
|
body: new Uint8Array(encode({
|
|
73086
73200
|
method,
|
|
73087
|
-
params
|
|
73201
|
+
params
|
|
73088
73202
|
}))
|
|
73089
73203
|
});
|
|
73090
|
-
|
|
73091
|
-
|
|
73092
|
-
|
|
73093
|
-
const errorBody = decode(new Uint8Array(buffer));
|
|
73094
|
-
if (errorBody?.error?.message) throw new Error(errorBody.error.message);
|
|
73095
|
-
} catch (decodeErr) {
|
|
73096
|
-
if (decodeErr instanceof Error && decodeErr.message !== `RPC call ${method} failed`) throw decodeErr;
|
|
73097
|
-
}
|
|
73098
|
-
throw new Error(`RPC call ${method} failed: ${res.status} ${res.statusText}`);
|
|
73099
|
-
}
|
|
73100
|
-
const buffer = await res.arrayBuffer();
|
|
73101
|
-
return decode(new Uint8Array(buffer));
|
|
73102
|
-
}
|
|
73103
|
-
async function fetchRuns(worldEnv, params) {
|
|
73104
|
-
return rpc("fetchRuns", {
|
|
73105
|
-
worldEnv,
|
|
73106
|
-
params
|
|
73107
|
-
});
|
|
73108
|
-
}
|
|
73109
|
-
async function fetchRun(worldEnv, runId, resolveData = "all") {
|
|
73110
|
-
return rpc("fetchRun", {
|
|
73111
|
-
worldEnv,
|
|
73112
|
-
runId,
|
|
73113
|
-
resolveData
|
|
73114
|
-
});
|
|
73115
|
-
}
|
|
73116
|
-
async function fetchStep(worldEnv, runId, stepId, resolveData = "all") {
|
|
73117
|
-
return rpc("fetchStep", {
|
|
73118
|
-
worldEnv,
|
|
73119
|
-
runId,
|
|
73120
|
-
stepId,
|
|
73121
|
-
resolveData
|
|
73122
|
-
});
|
|
73123
|
-
}
|
|
73124
|
-
async function fetchEvents(worldEnv, runId, params) {
|
|
73125
|
-
return rpc("fetchEvents", {
|
|
73126
|
-
worldEnv,
|
|
73127
|
-
runId,
|
|
73128
|
-
params
|
|
73129
|
-
});
|
|
73130
|
-
}
|
|
73131
|
-
async function fetchEvent(worldEnv, runId, eventId, resolveData = "all") {
|
|
73132
|
-
return rpc("fetchEvent", {
|
|
73133
|
-
worldEnv,
|
|
73134
|
-
runId,
|
|
73135
|
-
eventId,
|
|
73136
|
-
resolveData
|
|
73137
|
-
});
|
|
73138
|
-
}
|
|
73139
|
-
async function fetchEventsByCorrelationId(worldEnv, correlationId, params) {
|
|
73140
|
-
return rpc("fetchEventsByCorrelationId", {
|
|
73141
|
-
worldEnv,
|
|
73142
|
-
correlationId,
|
|
73143
|
-
params
|
|
73144
|
-
});
|
|
73145
|
-
}
|
|
73146
|
-
async function fetchHooks(worldEnv, params) {
|
|
73147
|
-
return rpc("fetchHooks", {
|
|
73148
|
-
worldEnv,
|
|
73149
|
-
params
|
|
73150
|
-
});
|
|
73151
|
-
}
|
|
73152
|
-
async function fetchHookToken$1(worldEnv, runId, hookId) {
|
|
73153
|
-
return rpc("fetchHookToken", {
|
|
73154
|
-
worldEnv,
|
|
73155
|
-
runId,
|
|
73156
|
-
hookId
|
|
73157
|
-
});
|
|
73158
|
-
}
|
|
73159
|
-
async function fetchHook(worldEnv, hookId, resolveData = "all") {
|
|
73160
|
-
return rpc("fetchHook", {
|
|
73161
|
-
worldEnv,
|
|
73162
|
-
hookId,
|
|
73163
|
-
resolveData
|
|
73164
|
-
});
|
|
73165
|
-
}
|
|
73166
|
-
async function cancelRun$1(worldEnv, runId) {
|
|
73167
|
-
return rpc("cancelRun", {
|
|
73168
|
-
worldEnv,
|
|
73169
|
-
runId
|
|
73170
|
-
});
|
|
73171
|
-
}
|
|
73172
|
-
async function bulkCancelRuns$1(worldEnv, runIds) {
|
|
73173
|
-
return rpc("bulkCancelRuns", {
|
|
73174
|
-
worldEnv,
|
|
73175
|
-
runIds
|
|
73176
|
-
});
|
|
73177
|
-
}
|
|
73178
|
-
async function recreateRun$1(worldEnv, runId, deploymentId) {
|
|
73179
|
-
return rpc("recreateRun", {
|
|
73180
|
-
worldEnv,
|
|
73181
|
-
runId,
|
|
73182
|
-
deploymentId
|
|
73183
|
-
});
|
|
73184
|
-
}
|
|
73185
|
-
async function reenqueueRun$1(worldEnv, runId) {
|
|
73186
|
-
return rpc("reenqueueRun", {
|
|
73187
|
-
worldEnv,
|
|
73188
|
-
runId
|
|
73189
|
-
});
|
|
73190
|
-
}
|
|
73191
|
-
async function wakeUpRun$1(worldEnv, runId, options) {
|
|
73192
|
-
return rpc("wakeUpRun", {
|
|
73193
|
-
worldEnv,
|
|
73194
|
-
runId,
|
|
73195
|
-
options
|
|
73196
|
-
});
|
|
73197
|
-
}
|
|
73198
|
-
async function resumeHook$1(worldEnv, token, payload) {
|
|
73199
|
-
return rpc("resumeHook", {
|
|
73200
|
-
worldEnv,
|
|
73201
|
-
token,
|
|
73202
|
-
payload
|
|
73203
|
-
});
|
|
73204
|
-
}
|
|
73205
|
-
async function fetchStreams(worldEnv, runId) {
|
|
73206
|
-
return rpc("fetchStreams", {
|
|
73207
|
-
worldEnv,
|
|
73208
|
-
runId
|
|
73209
|
-
});
|
|
73210
|
-
}
|
|
73211
|
-
async function getEncryptionKeyForRun(worldEnv, runId) {
|
|
73212
|
-
return rpc("getEncryptionKeyForRun", {
|
|
73213
|
-
worldEnv,
|
|
73214
|
-
runId
|
|
73215
|
-
});
|
|
73216
|
-
}
|
|
73217
|
-
// ../../node_modules/.bun/use-sync-external-store@1.7.0+4bcfe187168658ad/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.js
|
|
73218
|
-
/**
|
|
73219
|
-
* @license React
|
|
73220
|
-
* use-sync-external-store-shim.production.js
|
|
73221
|
-
*
|
|
73222
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
73223
|
-
*
|
|
73224
|
-
* This source code is licensed under the MIT license found in the
|
|
73225
|
-
* LICENSE file in the root directory of this source tree.
|
|
73226
|
-
*/
|
|
73227
|
-
var require_use_sync_external_store_shim_production = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
73228
|
-
var React = require_react();
|
|
73229
|
-
function is(x, y) {
|
|
73230
|
-
return x === y && (0 !== x || 1 / x === 1 / y) || x !== x && y !== y;
|
|
73231
|
-
}
|
|
73232
|
-
var objectIs = "function" === typeof Object.is ? Object.is : is;
|
|
73233
|
-
var useState = React.useState;
|
|
73234
|
-
var useEffect = React.useEffect;
|
|
73235
|
-
var useLayoutEffect = React.useLayoutEffect;
|
|
73236
|
-
var useDebugValue = React.useDebugValue;
|
|
73237
|
-
function useSyncExternalStore$2(subscribe, getSnapshot) {
|
|
73238
|
-
var value = getSnapshot(), _useState = useState({ inst: {
|
|
73239
|
-
value,
|
|
73240
|
-
getSnapshot
|
|
73241
|
-
} }), inst = _useState[0].inst, forceUpdate = _useState[1];
|
|
73242
|
-
useLayoutEffect(function() {
|
|
73243
|
-
inst.value = value;
|
|
73244
|
-
inst.getSnapshot = getSnapshot;
|
|
73245
|
-
checkIfSnapshotChanged(inst) && forceUpdate({ inst });
|
|
73246
|
-
}, [
|
|
73247
|
-
subscribe,
|
|
73248
|
-
value,
|
|
73249
|
-
getSnapshot
|
|
73250
|
-
]);
|
|
73251
|
-
useEffect(function() {
|
|
73252
|
-
checkIfSnapshotChanged(inst) && forceUpdate({ inst });
|
|
73253
|
-
return subscribe(function() {
|
|
73254
|
-
checkIfSnapshotChanged(inst) && forceUpdate({ inst });
|
|
73255
|
-
});
|
|
73256
|
-
}, [subscribe]);
|
|
73257
|
-
useDebugValue(value);
|
|
73258
|
-
return value;
|
|
73259
|
-
}
|
|
73260
|
-
function checkIfSnapshotChanged(inst) {
|
|
73261
|
-
var latestGetSnapshot = inst.getSnapshot;
|
|
73262
|
-
inst = inst.value;
|
|
73263
|
-
try {
|
|
73264
|
-
var nextValue = latestGetSnapshot();
|
|
73265
|
-
return !objectIs(inst, nextValue);
|
|
73266
|
-
} catch (error) {
|
|
73267
|
-
return !0;
|
|
73268
|
-
}
|
|
73269
|
-
}
|
|
73270
|
-
function useSyncExternalStore$1(subscribe, getSnapshot) {
|
|
73271
|
-
return getSnapshot();
|
|
73272
|
-
}
|
|
73273
|
-
var shim = "undefined" === typeof window || "undefined" === typeof window.document || "undefined" === typeof window.document.createElement ? useSyncExternalStore$1 : useSyncExternalStore$2;
|
|
73274
|
-
exports.useSyncExternalStore = void 0 !== React.useSyncExternalStore ? React.useSyncExternalStore : shim;
|
|
73275
|
-
}));
|
|
73276
|
-
// ../../node_modules/.bun/dequal@2.0.3/node_modules/dequal/lite/index.mjs
|
|
73277
|
-
var import_shim = (/* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
73278
|
-
module.exports = require_use_sync_external_store_shim_production();
|
|
73279
|
-
})))();
|
|
73280
|
-
var has = Object.prototype.hasOwnProperty;
|
|
73281
|
-
function dequal(foo, bar) {
|
|
73282
|
-
var ctor, len;
|
|
73283
|
-
if (foo === bar) return true;
|
|
73284
|
-
if (foo && bar && (ctor = foo.constructor) === bar.constructor) {
|
|
73285
|
-
if (ctor === Date) return foo.getTime() === bar.getTime();
|
|
73286
|
-
if (ctor === RegExp) return foo.toString() === bar.toString();
|
|
73287
|
-
if (ctor === Array) {
|
|
73288
|
-
if ((len = foo.length) === bar.length) while (len-- && dequal(foo[len], bar[len]));
|
|
73289
|
-
return len === -1;
|
|
73290
|
-
}
|
|
73291
|
-
if (!ctor || typeof foo === "object") {
|
|
73292
|
-
len = 0;
|
|
73293
|
-
for (ctor in foo) {
|
|
73294
|
-
if (has.call(foo, ctor) && ++len && !has.call(bar, ctor)) return false;
|
|
73295
|
-
if (!(ctor in bar) || !dequal(foo[ctor], bar[ctor])) return false;
|
|
73296
|
-
}
|
|
73297
|
-
return Object.keys(bar).length === len;
|
|
73298
|
-
}
|
|
73299
|
-
}
|
|
73300
|
-
return foo !== foo && bar !== bar;
|
|
73301
|
-
}
|
|
73302
|
-
var SWRGlobalState = /* @__PURE__ */ new WeakMap();
|
|
73303
|
-
var noop = () => {};
|
|
73304
|
-
var OBJECT = Object;
|
|
73305
|
-
var isUndefined = (v) => v === void 0;
|
|
73306
|
-
var isFunction = (v) => typeof v == "function";
|
|
73307
|
-
var mergeObjects = (a, b) => ({
|
|
73308
|
-
...a,
|
|
73309
|
-
...b
|
|
73310
|
-
});
|
|
73311
|
-
var isPromiseLike = (x) => isFunction(x.then);
|
|
73312
|
-
var EMPTY_CACHE = {};
|
|
73313
|
-
var INITIAL_CACHE = {};
|
|
73314
|
-
var STR_UNDEFINED = "undefined";
|
|
73315
|
-
var isWindowDefined = typeof window != STR_UNDEFINED;
|
|
73316
|
-
var isDocumentDefined = typeof document != STR_UNDEFINED;
|
|
73317
|
-
var isLegacyDeno = isWindowDefined && "Deno" in window;
|
|
73318
|
-
var hasRequestAnimationFrame = () => isWindowDefined && typeof window["requestAnimationFrame"] != STR_UNDEFINED;
|
|
73319
|
-
var createCacheHelper = (cache, key) => {
|
|
73320
|
-
const state = SWRGlobalState.get(cache);
|
|
73321
|
-
return [
|
|
73322
|
-
() => !isUndefined(key) && cache.get(key) || EMPTY_CACHE,
|
|
73323
|
-
(info) => {
|
|
73324
|
-
if (!isUndefined(key)) {
|
|
73325
|
-
const prev = cache.get(key);
|
|
73326
|
-
if (!(key in INITIAL_CACHE)) INITIAL_CACHE[key] = prev;
|
|
73327
|
-
state[5](key, mergeObjects(prev, info), prev || EMPTY_CACHE);
|
|
73328
|
-
}
|
|
73329
|
-
},
|
|
73330
|
-
state[6],
|
|
73331
|
-
() => {
|
|
73332
|
-
if (!isUndefined(key)) {
|
|
73333
|
-
if (key in INITIAL_CACHE) return INITIAL_CACHE[key];
|
|
73334
|
-
}
|
|
73335
|
-
return !isUndefined(key) && cache.get(key) || EMPTY_CACHE;
|
|
73336
|
-
}
|
|
73337
|
-
];
|
|
73338
|
-
};
|
|
73339
|
-
/**
|
|
73340
|
-
* Due to the bug https://bugs.chromium.org/p/chromium/issues/detail?id=678075,
|
|
73341
|
-
* it's not reliable to detect if the browser is currently online or offline
|
|
73342
|
-
* based on `navigator.onLine`.
|
|
73343
|
-
* As a workaround, we always assume it's online on the first load, and change
|
|
73344
|
-
* the status upon `online` or `offline` events.
|
|
73345
|
-
*/ var online = true;
|
|
73346
|
-
var isOnline = () => online;
|
|
73347
|
-
var [onWindowEvent, offWindowEvent] = isWindowDefined && window.addEventListener ? [window.addEventListener.bind(window), window.removeEventListener.bind(window)] : [noop, noop];
|
|
73348
|
-
var isVisible = () => {
|
|
73349
|
-
const visibilityState = isDocumentDefined && document.visibilityState;
|
|
73350
|
-
return isUndefined(visibilityState) || visibilityState !== "hidden";
|
|
73351
|
-
};
|
|
73352
|
-
var initFocus = (callback) => {
|
|
73353
|
-
if (isDocumentDefined) document.addEventListener("visibilitychange", callback);
|
|
73354
|
-
onWindowEvent("focus", callback);
|
|
73355
|
-
return () => {
|
|
73356
|
-
if (isDocumentDefined) document.removeEventListener("visibilitychange", callback);
|
|
73357
|
-
offWindowEvent("focus", callback);
|
|
73358
|
-
};
|
|
73359
|
-
};
|
|
73360
|
-
var initReconnect = (callback) => {
|
|
73361
|
-
const onOnline = () => {
|
|
73362
|
-
online = true;
|
|
73363
|
-
callback();
|
|
73364
|
-
};
|
|
73365
|
-
const onOffline = () => {
|
|
73366
|
-
online = false;
|
|
73367
|
-
};
|
|
73368
|
-
onWindowEvent("online", onOnline);
|
|
73369
|
-
onWindowEvent("offline", onOffline);
|
|
73370
|
-
return () => {
|
|
73371
|
-
offWindowEvent("online", onOnline);
|
|
73372
|
-
offWindowEvent("offline", onOffline);
|
|
73373
|
-
};
|
|
73374
|
-
};
|
|
73375
|
-
var preset = {
|
|
73376
|
-
isOnline,
|
|
73377
|
-
isVisible
|
|
73378
|
-
};
|
|
73379
|
-
var defaultConfigOptions = {
|
|
73380
|
-
initFocus,
|
|
73381
|
-
initReconnect
|
|
73382
|
-
};
|
|
73383
|
-
var IS_REACT_LEGACY = !import_react.useId;
|
|
73384
|
-
var IS_SERVER = !isWindowDefined || isLegacyDeno;
|
|
73385
|
-
var rAF = (f) => hasRequestAnimationFrame() ? window["requestAnimationFrame"](f) : setTimeout(f, 1);
|
|
73386
|
-
var useIsomorphicLayoutEffect = IS_SERVER ? import_react.useEffect : import_react.useLayoutEffect;
|
|
73387
|
-
var navigatorConnection = typeof navigator !== "undefined" && navigator.connection;
|
|
73388
|
-
var slowConnection = !IS_SERVER && navigatorConnection && (["slow-2g", "2g"].includes(navigatorConnection.effectiveType) || navigatorConnection.saveData);
|
|
73389
|
-
var table = /* @__PURE__ */ new WeakMap();
|
|
73390
|
-
var getTypeName = (value) => OBJECT.prototype.toString.call(value);
|
|
73391
|
-
var isObjectTypeName = (typeName, type) => typeName === `[object ${type}]`;
|
|
73392
|
-
var counter = 0;
|
|
73393
|
-
var stableHash = (arg) => {
|
|
73394
|
-
const type = typeof arg;
|
|
73395
|
-
const typeName = getTypeName(arg);
|
|
73396
|
-
const isDate = isObjectTypeName(typeName, "Date");
|
|
73397
|
-
const isRegex = isObjectTypeName(typeName, "RegExp");
|
|
73398
|
-
const isPlainObject = isObjectTypeName(typeName, "Object");
|
|
73399
|
-
let result;
|
|
73400
|
-
let index;
|
|
73401
|
-
if (OBJECT(arg) === arg && !isDate && !isRegex) {
|
|
73402
|
-
result = table.get(arg);
|
|
73403
|
-
if (result) return result;
|
|
73404
|
-
result = ++counter + "~";
|
|
73405
|
-
table.set(arg, result);
|
|
73406
|
-
if (Array.isArray(arg)) {
|
|
73407
|
-
result = "@";
|
|
73408
|
-
for (index = 0; index < arg.length; index++) result += stableHash(arg[index]) + ",";
|
|
73409
|
-
table.set(arg, result);
|
|
73410
|
-
}
|
|
73411
|
-
if (isPlainObject) {
|
|
73412
|
-
result = "#";
|
|
73413
|
-
const keys = OBJECT.keys(arg).sort();
|
|
73414
|
-
while (!isUndefined(index = keys.pop())) if (!isUndefined(arg[index])) result += index + ":" + stableHash(arg[index]) + ",";
|
|
73415
|
-
table.set(arg, result);
|
|
73416
|
-
}
|
|
73417
|
-
} else result = isDate ? arg.toJSON() : type == "symbol" ? arg.toString() : type == "string" ? JSON.stringify(arg) : "" + arg;
|
|
73418
|
-
return result;
|
|
73419
|
-
};
|
|
73420
|
-
var serialize = (key) => {
|
|
73421
|
-
if (isFunction(key)) try {
|
|
73422
|
-
key = key();
|
|
73423
|
-
} catch (err) {
|
|
73424
|
-
key = "";
|
|
73425
|
-
}
|
|
73426
|
-
const args = key;
|
|
73427
|
-
key = typeof key == "string" ? key : (Array.isArray(key) ? key.length : key) ? stableHash(key) : "";
|
|
73428
|
-
return [key, args];
|
|
73429
|
-
};
|
|
73430
|
-
var __timestamp = 0;
|
|
73431
|
-
var getTimestamp = () => ++__timestamp;
|
|
73432
|
-
async function internalMutate(...args) {
|
|
73433
|
-
const [cache, _key, _data, _opts] = args;
|
|
73434
|
-
const options = mergeObjects({
|
|
73435
|
-
populateCache: true,
|
|
73436
|
-
throwOnError: true
|
|
73437
|
-
}, typeof _opts === "boolean" ? { revalidate: _opts } : _opts || {});
|
|
73438
|
-
let populateCache = options.populateCache;
|
|
73439
|
-
const rollbackOnErrorOption = options.rollbackOnError;
|
|
73440
|
-
let optimisticData = options.optimisticData;
|
|
73441
|
-
const rollbackOnError = (error) => {
|
|
73442
|
-
return typeof rollbackOnErrorOption === "function" ? rollbackOnErrorOption(error) : rollbackOnErrorOption !== false;
|
|
73443
|
-
};
|
|
73444
|
-
const throwOnError = options.throwOnError;
|
|
73445
|
-
if (isFunction(_key)) {
|
|
73446
|
-
const keyFilter = _key;
|
|
73447
|
-
const matchedKeys = [];
|
|
73448
|
-
const it = cache.keys();
|
|
73449
|
-
for (const key of it) if (!/^\$(inf|sub)\$/.test(key) && keyFilter(cache.get(key)._k)) matchedKeys.push(key);
|
|
73450
|
-
return Promise.all(matchedKeys.map(mutateByKey));
|
|
73451
|
-
}
|
|
73452
|
-
return mutateByKey(_key);
|
|
73453
|
-
async function mutateByKey(_k) {
|
|
73454
|
-
const [key] = serialize(_k);
|
|
73455
|
-
if (!key) return;
|
|
73456
|
-
const [get, set] = createCacheHelper(cache, key);
|
|
73457
|
-
const [EVENT_REVALIDATORS, MUTATION, FETCH, PRELOAD] = SWRGlobalState.get(cache);
|
|
73458
|
-
const startRevalidate = () => {
|
|
73459
|
-
const revalidators = EVENT_REVALIDATORS[key];
|
|
73460
|
-
if (isFunction(options.revalidate) ? options.revalidate(get().data, _k) : options.revalidate !== false) {
|
|
73461
|
-
delete FETCH[key];
|
|
73462
|
-
delete PRELOAD[key];
|
|
73463
|
-
if (revalidators && revalidators[0]) return revalidators[0](2).then(() => get().data);
|
|
73464
|
-
}
|
|
73465
|
-
return get().data;
|
|
73466
|
-
};
|
|
73467
|
-
if (args.length < 3) return startRevalidate();
|
|
73468
|
-
let data = _data;
|
|
73469
|
-
let error;
|
|
73470
|
-
let isError = false;
|
|
73471
|
-
const beforeMutationTs = getTimestamp();
|
|
73472
|
-
MUTATION[key] = [beforeMutationTs, 0];
|
|
73473
|
-
const hasOptimisticData = !isUndefined(optimisticData);
|
|
73474
|
-
const state = get();
|
|
73475
|
-
const displayedData = state.data;
|
|
73476
|
-
const currentData = state._c;
|
|
73477
|
-
const committedData = isUndefined(currentData) ? displayedData : currentData;
|
|
73478
|
-
if (hasOptimisticData) {
|
|
73479
|
-
optimisticData = isFunction(optimisticData) ? optimisticData(committedData, displayedData) : optimisticData;
|
|
73480
|
-
set({
|
|
73481
|
-
data: optimisticData,
|
|
73482
|
-
_c: committedData
|
|
73483
|
-
});
|
|
73484
|
-
}
|
|
73485
|
-
if (isFunction(data)) try {
|
|
73486
|
-
data = data(committedData);
|
|
73487
|
-
} catch (err) {
|
|
73488
|
-
error = err;
|
|
73489
|
-
isError = true;
|
|
73490
|
-
}
|
|
73491
|
-
if (data && isPromiseLike(data)) {
|
|
73492
|
-
data = await data.catch((err) => {
|
|
73493
|
-
error = err;
|
|
73494
|
-
isError = true;
|
|
73495
|
-
});
|
|
73496
|
-
if (beforeMutationTs !== MUTATION[key][0]) {
|
|
73497
|
-
if (isError) throw error;
|
|
73498
|
-
return data;
|
|
73499
|
-
} else if (isError && hasOptimisticData && rollbackOnError(error)) {
|
|
73500
|
-
populateCache = true;
|
|
73501
|
-
set({
|
|
73502
|
-
data: committedData,
|
|
73503
|
-
_c: void 0
|
|
73504
|
-
});
|
|
73505
|
-
}
|
|
73506
|
-
}
|
|
73507
|
-
if (populateCache) {
|
|
73508
|
-
if (!isError) {
|
|
73509
|
-
if (isFunction(populateCache)) set({
|
|
73510
|
-
data: populateCache(data, committedData),
|
|
73511
|
-
error: void 0,
|
|
73512
|
-
_c: void 0
|
|
73513
|
-
});
|
|
73514
|
-
else set({
|
|
73515
|
-
data,
|
|
73516
|
-
error: void 0,
|
|
73517
|
-
_c: void 0
|
|
73518
|
-
});
|
|
73519
|
-
}
|
|
73520
|
-
}
|
|
73521
|
-
MUTATION[key][1] = getTimestamp();
|
|
73522
|
-
Promise.resolve(startRevalidate()).then(() => {
|
|
73523
|
-
set({ _c: void 0 });
|
|
73524
|
-
});
|
|
73525
|
-
if (isError) {
|
|
73526
|
-
if (throwOnError) throw error;
|
|
73527
|
-
return;
|
|
73528
|
-
}
|
|
73529
|
-
return data;
|
|
73530
|
-
}
|
|
73531
|
-
}
|
|
73532
|
-
var revalidateAllKeys = (revalidators, type) => {
|
|
73533
|
-
for (const key in revalidators) if (revalidators[key][0]) revalidators[key][0](type);
|
|
73534
|
-
};
|
|
73535
|
-
var initCache = (provider, options) => {
|
|
73536
|
-
if (!SWRGlobalState.has(provider)) {
|
|
73537
|
-
const opts = mergeObjects(defaultConfigOptions, options);
|
|
73538
|
-
const EVENT_REVALIDATORS = Object.create(null);
|
|
73539
|
-
const mutate = internalMutate.bind(void 0, provider);
|
|
73540
|
-
let unmount = noop;
|
|
73541
|
-
const subscriptions = Object.create(null);
|
|
73542
|
-
const subscribe = (key, callback) => {
|
|
73543
|
-
const subs = subscriptions[key] || [];
|
|
73544
|
-
subscriptions[key] = subs;
|
|
73545
|
-
subs.push(callback);
|
|
73546
|
-
return () => {
|
|
73547
|
-
const index = subs.indexOf(callback);
|
|
73548
|
-
if (index >= 0) {
|
|
73549
|
-
subs[index] = subs[subs.length - 1];
|
|
73550
|
-
subs.pop();
|
|
73551
|
-
}
|
|
73552
|
-
};
|
|
73553
|
-
};
|
|
73554
|
-
const setter = (key, value, prev) => {
|
|
73555
|
-
provider.set(key, value);
|
|
73556
|
-
const subs = subscriptions[key];
|
|
73557
|
-
if (subs) for (const fn of subs) fn(value, prev);
|
|
73558
|
-
};
|
|
73559
|
-
const unload = (unloadOptions) => {
|
|
73560
|
-
const state = SWRGlobalState.get(provider);
|
|
73561
|
-
const [, MUTATION, FETCH, PRELOAD] = state;
|
|
73562
|
-
const ts = getTimestamp();
|
|
73563
|
-
state[8]++;
|
|
73564
|
-
for (const key in FETCH) delete FETCH[key];
|
|
73565
|
-
for (const key in PRELOAD) delete PRELOAD[key];
|
|
73566
|
-
for (const key in MUTATION) MUTATION[key] = [ts, ts];
|
|
73567
|
-
const emptyState = {};
|
|
73568
|
-
for (const key of [...provider.keys()]) {
|
|
73569
|
-
const prev = provider.get(key);
|
|
73570
|
-
provider.delete(key);
|
|
73571
|
-
const subs = subscriptions[key];
|
|
73572
|
-
if (subs) for (const fn of subs) fn(emptyState, prev);
|
|
73573
|
-
}
|
|
73574
|
-
const revalidate = !unloadOptions || unloadOptions.revalidate !== false;
|
|
73575
|
-
for (const key in EVENT_REVALIDATORS) {
|
|
73576
|
-
const revalidators = EVENT_REVALIDATORS[key];
|
|
73577
|
-
for (let i = 0; i < revalidators.length; i++) revalidators[i](4, { revalidate: revalidate && !i });
|
|
73578
|
-
}
|
|
73579
|
-
};
|
|
73580
|
-
const initProvider = () => {
|
|
73581
|
-
if (!SWRGlobalState.has(provider)) {
|
|
73582
|
-
SWRGlobalState.set(provider, [
|
|
73583
|
-
EVENT_REVALIDATORS,
|
|
73584
|
-
Object.create(null),
|
|
73585
|
-
Object.create(null),
|
|
73586
|
-
Object.create(null),
|
|
73587
|
-
mutate,
|
|
73588
|
-
setter,
|
|
73589
|
-
subscribe,
|
|
73590
|
-
unload,
|
|
73591
|
-
0
|
|
73592
|
-
]);
|
|
73593
|
-
if (!IS_SERVER) {
|
|
73594
|
-
const releaseFocus = opts.initFocus(setTimeout.bind(void 0, revalidateAllKeys.bind(void 0, EVENT_REVALIDATORS, 0)));
|
|
73595
|
-
const releaseReconnect = opts.initReconnect(setTimeout.bind(void 0, revalidateAllKeys.bind(void 0, EVENT_REVALIDATORS, 1)));
|
|
73596
|
-
unmount = () => {
|
|
73597
|
-
releaseFocus && releaseFocus();
|
|
73598
|
-
releaseReconnect && releaseReconnect();
|
|
73599
|
-
SWRGlobalState.delete(provider);
|
|
73600
|
-
};
|
|
73601
|
-
}
|
|
73602
|
-
}
|
|
73603
|
-
};
|
|
73604
|
-
initProvider();
|
|
73605
|
-
return [
|
|
73606
|
-
provider,
|
|
73607
|
-
mutate,
|
|
73608
|
-
initProvider,
|
|
73609
|
-
unmount,
|
|
73610
|
-
unload
|
|
73611
|
-
];
|
|
73612
|
-
}
|
|
73613
|
-
const state = SWRGlobalState.get(provider);
|
|
73614
|
-
return [
|
|
73615
|
-
provider,
|
|
73616
|
-
state[4],
|
|
73617
|
-
void 0,
|
|
73618
|
-
void 0,
|
|
73619
|
-
state[7]
|
|
73620
|
-
];
|
|
73621
|
-
};
|
|
73622
|
-
var onErrorRetry = (_, __, config, revalidate, opts) => {
|
|
73623
|
-
const maxRetryCount = config.errorRetryCount;
|
|
73624
|
-
const currentRetryCount = opts.retryCount;
|
|
73625
|
-
const timeout = ~~((Math.random() + .5) * (1 << (currentRetryCount < 8 ? currentRetryCount : 8))) * config.errorRetryInterval;
|
|
73626
|
-
if (!isUndefined(maxRetryCount) && currentRetryCount > maxRetryCount) return;
|
|
73627
|
-
setTimeout(revalidate, timeout, opts);
|
|
73628
|
-
};
|
|
73629
|
-
var compare = dequal;
|
|
73630
|
-
var [cache, mutate, , , unload] = initCache(/* @__PURE__ */ new Map());
|
|
73631
|
-
var defaultConfig = mergeObjects({
|
|
73632
|
-
onLoadingSlow: noop,
|
|
73633
|
-
onSuccess: noop,
|
|
73634
|
-
onError: noop,
|
|
73635
|
-
onErrorRetry,
|
|
73636
|
-
onDiscarded: noop,
|
|
73637
|
-
revalidateOnFocus: true,
|
|
73638
|
-
revalidateOnReconnect: true,
|
|
73639
|
-
revalidateIfStale: true,
|
|
73640
|
-
shouldRetryOnError: true,
|
|
73641
|
-
errorRetryInterval: slowConnection ? 1e4 : 5e3,
|
|
73642
|
-
focusThrottleInterval: 5e3,
|
|
73643
|
-
dedupingInterval: 2e3,
|
|
73644
|
-
loadingTimeout: slowConnection ? 5e3 : 3e3,
|
|
73645
|
-
compare,
|
|
73646
|
-
isPaused: () => false,
|
|
73647
|
-
cache,
|
|
73648
|
-
mutate,
|
|
73649
|
-
unload,
|
|
73650
|
-
fallback: {}
|
|
73651
|
-
}, preset);
|
|
73652
|
-
var mergeConfigs = (a, b) => {
|
|
73653
|
-
const v = mergeObjects(a, b);
|
|
73654
|
-
if (b) {
|
|
73655
|
-
const { use: u1, fallback: f1, cacheData: c1 } = a;
|
|
73656
|
-
const { use: u2, fallback: f2, cacheData: c2 } = b;
|
|
73657
|
-
if (u1 && u2) v.use = u1.concat(u2);
|
|
73658
|
-
if (f1 && f2) v.fallback = mergeObjects(f1, f2);
|
|
73659
|
-
if (c1 && c2) v.cacheData = mergeObjects(c1, c2);
|
|
73660
|
-
}
|
|
73661
|
-
return v;
|
|
73662
|
-
};
|
|
73663
|
-
var SWRConfigContext = (0, import_react.createContext)({});
|
|
73664
|
-
var SWRConfig$1 = (props) => {
|
|
73665
|
-
const { value } = props;
|
|
73666
|
-
const parentConfig = (0, import_react.useContext)(SWRConfigContext);
|
|
73667
|
-
const isFunctionalConfig = isFunction(value);
|
|
73668
|
-
const config = (0, import_react.useMemo)(() => isFunctionalConfig ? value(parentConfig) : value, [
|
|
73669
|
-
isFunctionalConfig,
|
|
73670
|
-
parentConfig,
|
|
73671
|
-
value
|
|
73672
|
-
]);
|
|
73673
|
-
const extendedConfig = (0, import_react.useMemo)(() => isFunctionalConfig ? config : mergeConfigs(parentConfig, config), [
|
|
73674
|
-
isFunctionalConfig,
|
|
73675
|
-
parentConfig,
|
|
73676
|
-
config
|
|
73677
|
-
]);
|
|
73678
|
-
const provider = config && config.provider;
|
|
73679
|
-
const cacheContextRef = (0, import_react.useRef)(void 0);
|
|
73680
|
-
if (provider && !cacheContextRef.current) cacheContextRef.current = initCache(provider(extendedConfig.cache || cache), config);
|
|
73681
|
-
const cacheContext = cacheContextRef.current;
|
|
73682
|
-
if (cacheContext) {
|
|
73683
|
-
extendedConfig.cache = cacheContext[0];
|
|
73684
|
-
extendedConfig.mutate = cacheContext[1];
|
|
73685
|
-
extendedConfig.unload = cacheContext[4];
|
|
73686
|
-
}
|
|
73687
|
-
useIsomorphicLayoutEffect(() => {
|
|
73688
|
-
if (cacheContext) {
|
|
73689
|
-
cacheContext[2] && cacheContext[2]();
|
|
73690
|
-
return cacheContext[3];
|
|
73691
|
-
}
|
|
73692
|
-
}, []);
|
|
73693
|
-
return (0, import_react.createElement)(SWRConfigContext.Provider, mergeObjects(props, { value: extendedConfig }));
|
|
73694
|
-
};
|
|
73695
|
-
// ../../node_modules/.bun/swr@2.5.1+4bcfe187168658ad/node_modules/swr/dist/_internal/constants.mjs
|
|
73696
|
-
var INFINITE_PREFIX = "$inf$";
|
|
73697
|
-
// ../../node_modules/.bun/swr@2.5.1+4bcfe187168658ad/node_modules/swr/dist/_internal/index.mjs
|
|
73698
|
-
var enableDevtools = isWindowDefined && window.__SWR_DEVTOOLS_USE__;
|
|
73699
|
-
var use$1 = enableDevtools ? window.__SWR_DEVTOOLS_USE__ : [];
|
|
73700
|
-
var setupDevTools = () => {
|
|
73701
|
-
if (enableDevtools) window.__SWR_DEVTOOLS_REACT__ = import_react.default;
|
|
73702
|
-
};
|
|
73703
|
-
var normalize = (args) => {
|
|
73704
|
-
return isFunction(args[1]) ? [
|
|
73705
|
-
args[0],
|
|
73706
|
-
args[1],
|
|
73707
|
-
args[2] || {}
|
|
73708
|
-
] : [
|
|
73709
|
-
args[0],
|
|
73710
|
-
null,
|
|
73711
|
-
(args[1] === null ? args[2] : args[1]) || {}
|
|
73712
|
-
];
|
|
73713
|
-
};
|
|
73714
|
-
var useSWRConfig = () => {
|
|
73715
|
-
const parentConfig = (0, import_react.useContext)(SWRConfigContext);
|
|
73716
|
-
return (0, import_react.useMemo)(() => mergeObjects(defaultConfig, parentConfig), [parentConfig]);
|
|
73717
|
-
};
|
|
73718
|
-
var middleware = (useSWRNext) => (key_, fetcher_, config) => {
|
|
73719
|
-
return useSWRNext(key_, fetcher_ && ((...args) => {
|
|
73720
|
-
const [key] = serialize(key_);
|
|
73721
|
-
const [, , , PRELOAD] = SWRGlobalState.get(cache);
|
|
73722
|
-
if (key.startsWith("$inf$")) return fetcher_(...args);
|
|
73723
|
-
const req = PRELOAD[key];
|
|
73724
|
-
if (isUndefined(req)) return fetcher_(...args);
|
|
73725
|
-
delete PRELOAD[key];
|
|
73726
|
-
return req;
|
|
73727
|
-
}), config);
|
|
73728
|
-
};
|
|
73729
|
-
var BUILT_IN_MIDDLEWARE = use$1.concat(middleware);
|
|
73730
|
-
var withArgs = (hook) => {
|
|
73731
|
-
return function useSWRArgs(...args) {
|
|
73732
|
-
const fallbackConfig = useSWRConfig();
|
|
73733
|
-
const [key, fn, _config] = normalize(args);
|
|
73734
|
-
const config = mergeConfigs(fallbackConfig, _config);
|
|
73735
|
-
let next = hook;
|
|
73736
|
-
const { use } = config;
|
|
73737
|
-
const middleware = (use || []).concat(BUILT_IN_MIDDLEWARE);
|
|
73738
|
-
for (let i = middleware.length; i--;) next = middleware[i](next);
|
|
73739
|
-
return next(key, fn || config.fetcher || null, config);
|
|
73740
|
-
};
|
|
73741
|
-
};
|
|
73742
|
-
var subscribeCallback = (key, callbacks, callback) => {
|
|
73743
|
-
const keyedRevalidators = callbacks[key] || (callbacks[key] = []);
|
|
73744
|
-
keyedRevalidators.push(callback);
|
|
73745
|
-
return () => {
|
|
73746
|
-
const index = keyedRevalidators.indexOf(callback);
|
|
73747
|
-
if (index >= 0) {
|
|
73748
|
-
keyedRevalidators[index] = keyedRevalidators[keyedRevalidators.length - 1];
|
|
73749
|
-
keyedRevalidators.pop();
|
|
73750
|
-
}
|
|
73751
|
-
};
|
|
73752
|
-
};
|
|
73753
|
-
var withMiddleware = (useSWR, middleware) => {
|
|
73754
|
-
return (...args) => {
|
|
73755
|
-
const [key, fn, config] = normalize(args);
|
|
73756
|
-
const uses = (config.use || []).concat(middleware);
|
|
73757
|
-
return useSWR(key, fn, {
|
|
73758
|
-
...config,
|
|
73759
|
-
use: uses
|
|
73760
|
-
});
|
|
73761
|
-
};
|
|
73762
|
-
};
|
|
73763
|
-
setupDevTools();
|
|
73764
|
-
// ../../node_modules/.bun/swr@2.5.1+4bcfe187168658ad/node_modules/swr/dist/use-swr-emll9s78.mjs
|
|
73765
|
-
var use = import_react.use || ((thenable) => {
|
|
73766
|
-
switch (thenable.status) {
|
|
73767
|
-
case "pending": throw thenable;
|
|
73768
|
-
case "fulfilled": return thenable.value;
|
|
73769
|
-
case "rejected": throw thenable.reason;
|
|
73770
|
-
default:
|
|
73771
|
-
thenable.status = "pending";
|
|
73772
|
-
thenable.then((v) => {
|
|
73773
|
-
thenable.status = "fulfilled";
|
|
73774
|
-
thenable.value = v;
|
|
73775
|
-
}, (e) => {
|
|
73776
|
-
thenable.status = "rejected";
|
|
73777
|
-
thenable.reason = e;
|
|
73778
|
-
});
|
|
73779
|
-
throw thenable;
|
|
73780
|
-
}
|
|
73781
|
-
});
|
|
73782
|
-
var WITH_DEDUPE = { dedupe: true };
|
|
73783
|
-
var isCacheDataConsumed = (consumedCacheData, cacheData, key) => {
|
|
73784
|
-
var _consumedCacheData_get;
|
|
73785
|
-
return cacheData ? ((_consumedCacheData_get = consumedCacheData.get(cacheData)) == null ? void 0 : _consumedCacheData_get.has(key)) === true : false;
|
|
73786
|
-
};
|
|
73787
|
-
var markCacheDataConsumed = (consumedCacheData, cacheData, key) => {
|
|
73788
|
-
if (!cacheData) return;
|
|
73789
|
-
let consumedKeys = consumedCacheData.get(cacheData);
|
|
73790
|
-
if (!consumedKeys) {
|
|
73791
|
-
consumedKeys = /* @__PURE__ */ new Set();
|
|
73792
|
-
consumedCacheData.set(cacheData, consumedKeys);
|
|
73793
|
-
}
|
|
73794
|
-
consumedKeys.add(key);
|
|
73795
|
-
};
|
|
73796
|
-
var commitCacheData = ({ value, getCacheData, canCommit, setCache }) => {
|
|
73797
|
-
const commit = (state) => {
|
|
73798
|
-
if (canCommit() && isUndefined(getCacheData())) setCache(state);
|
|
73799
|
-
};
|
|
73800
|
-
Promise.resolve(value).then((data) => {
|
|
73801
|
-
commit({
|
|
73802
|
-
data,
|
|
73803
|
-
error: void 0
|
|
73804
|
-
});
|
|
73805
|
-
}, (error) => {
|
|
73806
|
-
commit({ error });
|
|
73807
|
-
});
|
|
73808
|
-
};
|
|
73809
|
-
var resolvedUndef = Promise.resolve(void 0);
|
|
73810
|
-
resolvedUndef.status = "fulfilled";
|
|
73811
|
-
resolvedUndef.value = void 0;
|
|
73812
|
-
var sub = () => noop;
|
|
73813
|
-
/**
|
|
73814
|
-
* The core implementation of the useSWR hook.
|
|
73815
|
-
*
|
|
73816
|
-
* This is the main handler function that implements all SWR functionality including
|
|
73817
|
-
* data fetching, caching, revalidation, error handling, and state management.
|
|
73818
|
-
* It manages the complete lifecycle of SWR requests from initialization through
|
|
73819
|
-
* cleanup.
|
|
73820
|
-
*
|
|
73821
|
-
* Key responsibilities:
|
|
73822
|
-
* - Key serialization and normalization
|
|
73823
|
-
* - Cache state management and synchronization
|
|
73824
|
-
* - Automatic and manual revalidation
|
|
73825
|
-
* - Error handling and retry logic
|
|
73826
|
-
* - Suspense integration
|
|
73827
|
-
* - Loading state management
|
|
73828
|
-
* - Effect cleanup and memory management
|
|
73829
|
-
*
|
|
73830
|
-
* @template Data - The type of data returned by the fetcher
|
|
73831
|
-
* @template Error - The type of error that can be thrown
|
|
73832
|
-
*
|
|
73833
|
-
* @param _key - The SWR key (string, array, object, function, or falsy)
|
|
73834
|
-
* @param fetcher - The fetcher function to retrieve data, or null to disable fetching
|
|
73835
|
-
* @param config - Complete SWR configuration object with both public and internal options
|
|
73836
|
-
*
|
|
73837
|
-
* @returns SWRResponse object containing data, error, mutate function, and loading states
|
|
73838
|
-
*
|
|
73839
|
-
* @internal This is the internal implementation. Use `useSWR` instead.
|
|
73840
|
-
*/ var useSWRHandler = (_key, fetcher, config) => {
|
|
73841
|
-
const { cache, compare, suspense, fallbackData, revalidateOnMount, revalidateIfStale, refreshInterval, refreshWhenHidden, refreshWhenOffline, keepPreviousData, strictServerPrefetchWarning } = config;
|
|
73842
|
-
const [EVENT_REVALIDATORS, MUTATION, FETCH, PRELOAD] = SWRGlobalState.get(cache);
|
|
73843
|
-
const [key, fnArg] = serialize(_key);
|
|
73844
|
-
const initialMountedRef = (0, import_react.useRef)(false);
|
|
73845
|
-
const unmountedRef = (0, import_react.useRef)(false);
|
|
73846
|
-
const keyRef = (0, import_react.useRef)(key);
|
|
73847
|
-
const fetcherRef = (0, import_react.useRef)(fetcher);
|
|
73848
|
-
const configRef = (0, import_react.useRef)(config);
|
|
73849
|
-
const getConfig = () => configRef.current;
|
|
73850
|
-
const isActive = () => getConfig().isVisible() && getConfig().isOnline();
|
|
73851
|
-
const [getCache, setCache, subscribeCache, getInitialCache] = createCacheHelper(cache, key);
|
|
73852
|
-
const stateDependencies = (0, import_react.useRef)({}).current;
|
|
73853
|
-
const fallback = isUndefined(fallbackData) ? isUndefined(config.fallback) ? void 0 : config.fallback[key] : fallbackData;
|
|
73854
|
-
const serverCacheData = config.cacheData;
|
|
73855
|
-
const configCacheData = !key ? void 0 : serverCacheData == null ? void 0 : serverCacheData[key];
|
|
73856
|
-
const req = key ? PRELOAD[key] : void 0;
|
|
73857
|
-
const hasCacheData = isUndefined(req) && !isUndefined(configCacheData);
|
|
73858
|
-
const preloadedData = hasCacheData ? configCacheData : req;
|
|
73859
|
-
const isEqual = (prev, current) => {
|
|
73860
|
-
for (const _ in stateDependencies) {
|
|
73861
|
-
const t = _;
|
|
73862
|
-
if (t === "data") {
|
|
73863
|
-
if (!compare(prev[t], current[t])) {
|
|
73864
|
-
if (!isUndefined(prev[t])) return false;
|
|
73865
|
-
if (!compare(returnedData, current[t])) return false;
|
|
73866
|
-
}
|
|
73867
|
-
} else if (current[t] !== prev[t]) return false;
|
|
73868
|
-
}
|
|
73869
|
-
return true;
|
|
73870
|
-
};
|
|
73871
|
-
const isInitialMount = !initialMountedRef.current;
|
|
73872
|
-
const getSnapshot = (0, import_react.useMemo)(() => {
|
|
73873
|
-
const cachedData = getCache();
|
|
73874
|
-
const initialData = getInitialCache();
|
|
73875
|
-
const getSelectedCache = (state) => {
|
|
73876
|
-
const snapshot = mergeObjects(state);
|
|
73877
|
-
delete snapshot._k;
|
|
73878
|
-
if (!(() => {
|
|
73879
|
-
if (!key) return false;
|
|
73880
|
-
if (!fetcher) return false;
|
|
73881
|
-
if (getConfig().isPaused()) return false;
|
|
73882
|
-
if (isInitialMount && !isUndefined(revalidateOnMount)) return revalidateOnMount;
|
|
73883
|
-
const data = !isUndefined(fallback) ? fallback : snapshot.data;
|
|
73884
|
-
if (suspense && hasCacheData && isUndefined(data)) return false;
|
|
73885
|
-
if (suspense) return isUndefined(data) || revalidateIfStale;
|
|
73886
|
-
return isUndefined(data) || revalidateIfStale;
|
|
73887
|
-
})()) return snapshot;
|
|
73888
|
-
return {
|
|
73889
|
-
isValidating: true,
|
|
73890
|
-
isLoading: true,
|
|
73891
|
-
...snapshot
|
|
73892
|
-
};
|
|
73893
|
-
};
|
|
73894
|
-
const clientSnapshot = getSelectedCache(cachedData);
|
|
73895
|
-
const serverSnapshot = cachedData === initialData ? clientSnapshot : getSelectedCache(initialData);
|
|
73896
|
-
let memorizedSnapshot = clientSnapshot;
|
|
73897
|
-
return [() => {
|
|
73898
|
-
const newSnapshot = getSelectedCache(getCache());
|
|
73899
|
-
if (isEqual(newSnapshot, memorizedSnapshot)) {
|
|
73900
|
-
memorizedSnapshot.data = newSnapshot.data;
|
|
73901
|
-
memorizedSnapshot.isLoading = newSnapshot.isLoading;
|
|
73902
|
-
memorizedSnapshot.isValidating = newSnapshot.isValidating;
|
|
73903
|
-
memorizedSnapshot.error = newSnapshot.error;
|
|
73904
|
-
return memorizedSnapshot;
|
|
73905
|
-
} else {
|
|
73906
|
-
memorizedSnapshot = newSnapshot;
|
|
73907
|
-
return newSnapshot;
|
|
73908
|
-
}
|
|
73909
|
-
}, () => serverSnapshot];
|
|
73910
|
-
}, [cache, key]);
|
|
73911
|
-
const cached = (0, import_shim.useSyncExternalStore)((0, import_react.useCallback)((callback) => subscribeCache(key, (current, prev) => {
|
|
73912
|
-
if (!isEqual(prev, current)) callback();
|
|
73913
|
-
}), [cache, key]), getSnapshot[0], getSnapshot[1]);
|
|
73914
|
-
const hasRevalidator = EVENT_REVALIDATORS[key] && EVENT_REVALIDATORS[key].length > 0;
|
|
73915
|
-
const cachedData = cached.data;
|
|
73916
|
-
let data = isUndefined(cachedData) ? fallback && isPromiseLike(fallback) ? use(fallback) : fallback : cachedData;
|
|
73917
|
-
const error = cached.error;
|
|
73918
|
-
const laggyDataRef = (0, import_react.useRef)(data);
|
|
73919
|
-
const consumedCacheDataRef = (0, import_react.useRef)(void 0);
|
|
73920
|
-
let consumedCacheData = consumedCacheDataRef.current;
|
|
73921
|
-
if (!consumedCacheData) {
|
|
73922
|
-
consumedCacheData = /* @__PURE__ */ new WeakMap();
|
|
73923
|
-
consumedCacheDataRef.current = consumedCacheData;
|
|
73924
|
-
}
|
|
73925
|
-
const preloadCacheRef = (0, import_react.useRef)(null);
|
|
73926
|
-
let returnedData = keepPreviousData ? isUndefined(cachedData) ? isUndefined(laggyDataRef.current) ? data : laggyDataRef.current : cachedData : data;
|
|
73927
|
-
const hasKeyButNoData = key && isUndefined(data);
|
|
73928
|
-
const hydrationRef = (0, import_react.useRef)(null);
|
|
73929
|
-
!IS_SERVER && (0, import_shim.useSyncExternalStore)(sub, () => {
|
|
73930
|
-
hydrationRef.current = false;
|
|
73931
|
-
return hydrationRef;
|
|
73932
|
-
}, () => {
|
|
73933
|
-
hydrationRef.current = true;
|
|
73934
|
-
return hydrationRef;
|
|
73935
|
-
});
|
|
73936
|
-
const isHydration = hydrationRef.current;
|
|
73937
|
-
if (strictServerPrefetchWarning && isHydration && !suspense && hasKeyButNoData) console.warn(`Missing pre-initiated data for serialized key "${key}" during server-side rendering. Data fetching should be initiated on the server and provided to SWR via fallback data. You can set "strictServerPrefetchWarning: false" to disable this warning.`);
|
|
73938
|
-
const shouldDoInitialRevalidation = (() => {
|
|
73939
|
-
if (!key || !fetcher) return false;
|
|
73940
|
-
if (getConfig().isPaused()) return false;
|
|
73941
|
-
if (hasRevalidator && !isUndefined(error)) return false;
|
|
73942
|
-
if (isInitialMount && !isUndefined(revalidateOnMount)) return revalidateOnMount;
|
|
73943
|
-
if (suspense && hasCacheData && hasKeyButNoData) return false;
|
|
73944
|
-
if (suspense) return isUndefined(data) ? false : revalidateIfStale;
|
|
73945
|
-
return isUndefined(data) || revalidateIfStale;
|
|
73946
|
-
})();
|
|
73947
|
-
const defaultValidatingState = isInitialMount && shouldDoInitialRevalidation;
|
|
73948
|
-
const isValidating = isUndefined(cached.isValidating) ? defaultValidatingState : cached.isValidating;
|
|
73949
|
-
const isLoading = isUndefined(cached.isLoading) ? defaultValidatingState : cached.isLoading;
|
|
73950
|
-
const revalidate = (0, import_react.useCallback)(async (revalidateOpts) => {
|
|
73951
|
-
const currentFetcher = fetcherRef.current;
|
|
73952
|
-
if (!key || !currentFetcher || unmountedRef.current || getConfig().isPaused()) return false;
|
|
73953
|
-
let newData;
|
|
73954
|
-
let startAt;
|
|
73955
|
-
let loading = true;
|
|
73956
|
-
const opts = revalidateOpts || {};
|
|
73957
|
-
const shouldStartNewRequest = !FETCH[key] || !opts.dedupe;
|
|
73958
|
-
const shouldUseRSCPreload = hasCacheData && !isCacheDataConsumed(consumedCacheData, serverCacheData, key) && !isUndefined(preloadedData) && isUndefined(getCache().data);
|
|
73959
|
-
const callbackSafeguard = () => {
|
|
73960
|
-
if (IS_REACT_LEGACY) return !unmountedRef.current && key === keyRef.current && initialMountedRef.current;
|
|
73961
|
-
return key === keyRef.current;
|
|
73962
|
-
};
|
|
73963
|
-
const finalState = {
|
|
73964
|
-
isValidating: false,
|
|
73965
|
-
isLoading: false
|
|
73966
|
-
};
|
|
73967
|
-
const finishRequestAndUpdateState = () => {
|
|
73968
|
-
setCache(finalState);
|
|
73969
|
-
};
|
|
73970
|
-
const cleanupState = () => {
|
|
73971
|
-
const requestInfo = FETCH[key];
|
|
73972
|
-
if (requestInfo && requestInfo[1] === startAt) delete FETCH[key];
|
|
73973
|
-
};
|
|
73974
|
-
const initialState = { isValidating: true };
|
|
73975
|
-
if (isUndefined(getCache().data)) initialState.isLoading = true;
|
|
73976
|
-
try {
|
|
73977
|
-
if (shouldStartNewRequest) {
|
|
73978
|
-
setCache(initialState);
|
|
73979
|
-
if (config.loadingTimeout && isUndefined(getCache().data)) setTimeout(() => {
|
|
73980
|
-
if (loading && callbackSafeguard()) getConfig().onLoadingSlow(key, config);
|
|
73981
|
-
}, config.loadingTimeout);
|
|
73982
|
-
if (shouldUseRSCPreload) markCacheDataConsumed(consumedCacheData, serverCacheData, key);
|
|
73983
|
-
FETCH[key] = [shouldUseRSCPreload ? preloadedData : currentFetcher(fnArg), getTimestamp()];
|
|
73984
|
-
if (shouldUseRSCPreload && PRELOAD[key]) delete PRELOAD[key];
|
|
73985
|
-
}
|
|
73986
|
-
[newData, startAt] = FETCH[key];
|
|
73987
|
-
newData = await newData;
|
|
73988
|
-
if (shouldStartNewRequest) setTimeout(cleanupState, config.dedupingInterval);
|
|
73989
|
-
if (!FETCH[key] || FETCH[key][1] !== startAt) {
|
|
73990
|
-
if (shouldStartNewRequest) {
|
|
73991
|
-
if (callbackSafeguard()) getConfig().onDiscarded(key);
|
|
73992
|
-
}
|
|
73993
|
-
return false;
|
|
73994
|
-
}
|
|
73995
|
-
finalState.error = void 0;
|
|
73996
|
-
const mutationInfo = MUTATION[key];
|
|
73997
|
-
if (!isUndefined(mutationInfo) && (startAt <= mutationInfo[0] || startAt <= mutationInfo[1] || mutationInfo[1] === 0)) {
|
|
73998
|
-
finishRequestAndUpdateState();
|
|
73999
|
-
if (shouldStartNewRequest) {
|
|
74000
|
-
if (callbackSafeguard()) getConfig().onDiscarded(key);
|
|
74001
|
-
}
|
|
74002
|
-
return false;
|
|
74003
|
-
}
|
|
74004
|
-
const cacheData = getCache().data;
|
|
74005
|
-
finalState.data = compare(cacheData, newData) ? cacheData : newData;
|
|
74006
|
-
if (shouldStartNewRequest) {
|
|
74007
|
-
if (callbackSafeguard()) getConfig().onSuccess(newData, key, config);
|
|
74008
|
-
}
|
|
74009
|
-
} catch (err) {
|
|
74010
|
-
cleanupState();
|
|
74011
|
-
const currentConfig = getConfig();
|
|
74012
|
-
const { shouldRetryOnError } = currentConfig;
|
|
74013
|
-
if (!currentConfig.isPaused()) {
|
|
74014
|
-
finalState.error = err;
|
|
74015
|
-
if (shouldStartNewRequest && callbackSafeguard()) {
|
|
74016
|
-
currentConfig.onError(err, key, currentConfig);
|
|
74017
|
-
if (shouldRetryOnError === true || isFunction(shouldRetryOnError) && shouldRetryOnError(err)) {
|
|
74018
|
-
if (!getConfig().revalidateOnFocus || !getConfig().revalidateOnReconnect || isActive()) currentConfig.onErrorRetry(err, key, currentConfig, (_opts) => {
|
|
74019
|
-
const revalidators = EVENT_REVALIDATORS[key];
|
|
74020
|
-
if (revalidators && revalidators[0]) revalidators[0](3, _opts);
|
|
74021
|
-
}, {
|
|
74022
|
-
retryCount: (opts.retryCount || 0) + 1,
|
|
74023
|
-
dedupe: true
|
|
74024
|
-
});
|
|
74025
|
-
}
|
|
74026
|
-
}
|
|
74027
|
-
}
|
|
74028
|
-
}
|
|
74029
|
-
loading = false;
|
|
74030
|
-
finishRequestAndUpdateState();
|
|
74031
|
-
return true;
|
|
74032
|
-
}, [key, cache]);
|
|
74033
|
-
const boundMutate = (0, import_react.useCallback)((...args) => {
|
|
74034
|
-
return internalMutate(cache, keyRef.current, ...args);
|
|
74035
|
-
}, []);
|
|
74036
|
-
useIsomorphicLayoutEffect(() => {
|
|
74037
|
-
const preloaded = preloadCacheRef.current;
|
|
74038
|
-
if (!preloaded) return;
|
|
74039
|
-
preloadCacheRef.current = null;
|
|
74040
|
-
markCacheDataConsumed(consumedCacheData, preloaded.cacheData, preloaded.key);
|
|
74041
|
-
if (isUndefined(getCache().data)) setCache({
|
|
74042
|
-
data: preloaded.data,
|
|
74043
|
-
error: void 0,
|
|
74044
|
-
_k: preloaded._k
|
|
74045
|
-
});
|
|
74046
|
-
if (PRELOAD[preloaded.key]) delete PRELOAD[preloaded.key];
|
|
74047
|
-
});
|
|
74048
|
-
useIsomorphicLayoutEffect(() => {
|
|
74049
|
-
fetcherRef.current = fetcher;
|
|
74050
|
-
configRef.current = config;
|
|
74051
|
-
if (!isUndefined(cachedData)) laggyDataRef.current = cachedData;
|
|
74052
|
-
});
|
|
74053
|
-
useIsomorphicLayoutEffect(() => {
|
|
74054
|
-
if (fetcher || !hasCacheData || isUndefined(preloadedData) || isCacheDataConsumed(consumedCacheData, serverCacheData, key) || !isUndefined(getCache().data)) return;
|
|
74055
|
-
markCacheDataConsumed(consumedCacheData, serverCacheData, key);
|
|
74056
|
-
const mutation = MUTATION[key];
|
|
74057
|
-
commitCacheData({
|
|
74058
|
-
value: preloadedData,
|
|
74059
|
-
getCacheData: () => getCache().data,
|
|
74060
|
-
canCommit: () => !unmountedRef.current && key === keyRef.current && MUTATION[key] === mutation,
|
|
74061
|
-
setCache: (state) => setCache({
|
|
74062
|
-
...state,
|
|
74063
|
-
_k: fnArg
|
|
74064
|
-
})
|
|
74065
|
-
});
|
|
74066
|
-
});
|
|
74067
|
-
useIsomorphicLayoutEffect(() => {
|
|
74068
|
-
if (!key) return;
|
|
74069
|
-
const softRevalidate = revalidate.bind(void 0, WITH_DEDUPE);
|
|
74070
|
-
let nextFocusRevalidatedAt = 0;
|
|
74071
|
-
if (getConfig().revalidateOnFocus) nextFocusRevalidatedAt = Date.now() + getConfig().focusThrottleInterval;
|
|
74072
|
-
const onRevalidate = (type, opts = {}) => {
|
|
74073
|
-
if (type == 0) {
|
|
74074
|
-
const now = Date.now();
|
|
74075
|
-
if (getConfig().revalidateOnFocus && now > nextFocusRevalidatedAt && isActive()) {
|
|
74076
|
-
nextFocusRevalidatedAt = now + getConfig().focusThrottleInterval;
|
|
74077
|
-
softRevalidate();
|
|
74078
|
-
}
|
|
74079
|
-
} else if (type == 1) {
|
|
74080
|
-
if (getConfig().revalidateOnReconnect && isActive()) softRevalidate();
|
|
74081
|
-
} else if (type == 2) return revalidate();
|
|
74082
|
-
else if (type == 3) return revalidate(opts);
|
|
74083
|
-
else if (type == 4) {
|
|
74084
|
-
laggyDataRef.current = void 0;
|
|
74085
|
-
if (opts.revalidate) return revalidate();
|
|
74086
|
-
}
|
|
74087
|
-
};
|
|
74088
|
-
const unsubEvents = subscribeCallback(key, EVENT_REVALIDATORS, onRevalidate);
|
|
74089
|
-
unmountedRef.current = false;
|
|
74090
|
-
keyRef.current = key;
|
|
74091
|
-
initialMountedRef.current = true;
|
|
74092
|
-
setCache({ _k: fnArg });
|
|
74093
|
-
if (shouldDoInitialRevalidation) {
|
|
74094
|
-
if (!FETCH[key]) {
|
|
74095
|
-
if (isUndefined(data) || IS_SERVER) softRevalidate();
|
|
74096
|
-
else rAF(softRevalidate);
|
|
74097
|
-
}
|
|
74098
|
-
}
|
|
74099
|
-
return () => {
|
|
74100
|
-
unmountedRef.current = true;
|
|
74101
|
-
unsubEvents();
|
|
74102
|
-
};
|
|
74103
|
-
}, [key]);
|
|
74104
|
-
useIsomorphicLayoutEffect(() => {
|
|
74105
|
-
let timer;
|
|
74106
|
-
function next() {
|
|
74107
|
-
const interval = isFunction(refreshInterval) ? refreshInterval(getCache().data) : refreshInterval;
|
|
74108
|
-
if (interval && timer !== -1) timer = setTimeout(execute, interval);
|
|
74109
|
-
}
|
|
74110
|
-
function execute() {
|
|
74111
|
-
if (!getCache().error && (refreshWhenHidden || getConfig().isVisible()) && (refreshWhenOffline || getConfig().isOnline())) revalidate(WITH_DEDUPE).then(next);
|
|
74112
|
-
else next();
|
|
74113
|
-
}
|
|
74114
|
-
next();
|
|
74115
|
-
return () => {
|
|
74116
|
-
if (timer) {
|
|
74117
|
-
clearTimeout(timer);
|
|
74118
|
-
timer = -1;
|
|
74119
|
-
}
|
|
74120
|
-
};
|
|
74121
|
-
}, [
|
|
74122
|
-
refreshInterval,
|
|
74123
|
-
refreshWhenHidden,
|
|
74124
|
-
refreshWhenOffline,
|
|
74125
|
-
key
|
|
74126
|
-
]);
|
|
74127
|
-
(0, import_react.useDebugValue)(returnedData);
|
|
74128
|
-
if (suspense) {
|
|
74129
|
-
if (!IS_REACT_LEGACY && IS_SERVER && hasKeyButNoData && isUndefined(preloadedData)) throw new Error("Fallback data is required when using Suspense in SSR.");
|
|
74130
|
-
if (hasKeyButNoData) {
|
|
74131
|
-
fetcherRef.current = fetcher;
|
|
74132
|
-
configRef.current = config;
|
|
74133
|
-
unmountedRef.current = false;
|
|
74134
|
-
}
|
|
74135
|
-
const shouldConsumePreload = !isUndefined(preloadedData) && hasKeyButNoData;
|
|
74136
|
-
let preloadData = void 0;
|
|
74137
|
-
if (shouldConsumePreload && hasCacheData) {
|
|
74138
|
-
preloadData = preloadedData && isPromiseLike(preloadedData) ? use(preloadedData) : preloadedData;
|
|
74139
|
-
data = preloadData;
|
|
74140
|
-
returnedData = preloadData;
|
|
74141
|
-
if (!IS_SERVER) preloadCacheRef.current = {
|
|
74142
|
-
data: preloadData,
|
|
74143
|
-
_k: fnArg,
|
|
74144
|
-
key,
|
|
74145
|
-
cacheData: serverCacheData
|
|
74146
|
-
};
|
|
74147
|
-
} else use(shouldConsumePreload ? boundMutate(preloadedData) : resolvedUndef);
|
|
74148
|
-
if (!isUndefined(error) && hasKeyButNoData) throw error;
|
|
74149
|
-
const revalidation = hasKeyButNoData && isUndefined(preloadData) ? revalidate(WITH_DEDUPE) : resolvedUndef;
|
|
74150
|
-
if (!isUndefined(returnedData) && hasKeyButNoData) {
|
|
74151
|
-
revalidation.status = "fulfilled";
|
|
74152
|
-
revalidation.value = true;
|
|
74153
|
-
}
|
|
74154
|
-
use(revalidation);
|
|
74155
|
-
}
|
|
74156
|
-
return {
|
|
74157
|
-
mutate: boundMutate,
|
|
74158
|
-
get data() {
|
|
74159
|
-
stateDependencies.data = true;
|
|
74160
|
-
return returnedData;
|
|
74161
|
-
},
|
|
74162
|
-
get error() {
|
|
74163
|
-
stateDependencies.error = true;
|
|
74164
|
-
return error;
|
|
74165
|
-
},
|
|
74166
|
-
get isValidating() {
|
|
74167
|
-
stateDependencies.isValidating = true;
|
|
74168
|
-
return isValidating;
|
|
74169
|
-
},
|
|
74170
|
-
get isLoading() {
|
|
74171
|
-
stateDependencies.isLoading = true;
|
|
74172
|
-
return isLoading;
|
|
74173
|
-
}
|
|
74174
|
-
};
|
|
74175
|
-
};
|
|
74176
|
-
OBJECT.defineProperty(SWRConfig$1, "defaultValue", { value: defaultConfig });
|
|
74177
|
-
/**
|
|
74178
|
-
* A hook to fetch data.
|
|
74179
|
-
*
|
|
74180
|
-
* @see {@link https://swr.vercel.app}
|
|
74181
|
-
*
|
|
74182
|
-
* @example
|
|
74183
|
-
* ```jsx
|
|
74184
|
-
* import useSWR from 'swr'
|
|
74185
|
-
* function Profile() {
|
|
74186
|
-
* const { data, error, isLoading } = useSWR('/api/user', fetcher)
|
|
74187
|
-
* if (error) return <div>failed to load</div>
|
|
74188
|
-
* if (isLoading) return <div>loading...</div>
|
|
74189
|
-
* return <div>hello {data.name}!</div>
|
|
74190
|
-
* }
|
|
74191
|
-
* ```
|
|
74192
|
-
*/ var useSWR = withArgs(useSWRHandler);
|
|
74193
|
-
// ../../node_modules/.bun/swr@2.5.1+4bcfe187168658ad/node_modules/swr/dist/infinite/index.mjs
|
|
74194
|
-
var getFirstPageKey = (getKey) => {
|
|
74195
|
-
return serialize(getKey ? getKey(0, null) : null)[0];
|
|
74196
|
-
};
|
|
74197
|
-
var EMPTY_PROMISE = Promise.resolve();
|
|
74198
|
-
var infinite = (useSWRNext) => (getKey, fn, config) => {
|
|
74199
|
-
const didMountRef = (0, import_react.useRef)(false);
|
|
74200
|
-
const { cache: cache$1, initialSize = 1, revalidateAll = false, persistSize = false, revalidateFirstPage = true, revalidateOnMount = false, parallel = false } = config;
|
|
74201
|
-
const [, , , PRELOAD] = SWRGlobalState.get(cache);
|
|
74202
|
-
let infiniteKey;
|
|
74203
|
-
try {
|
|
74204
|
-
infiniteKey = getFirstPageKey(getKey);
|
|
74205
|
-
if (infiniteKey) infiniteKey = INFINITE_PREFIX + infiniteKey;
|
|
74206
|
-
} catch (err) {}
|
|
74207
|
-
const [get, set, subscribeCache] = createCacheHelper(cache$1, infiniteKey);
|
|
74208
|
-
const getSnapshot = (0, import_react.useCallback)(() => {
|
|
74209
|
-
return isUndefined(get()._l) ? initialSize : get()._l;
|
|
74210
|
-
}, [
|
|
74211
|
-
cache$1,
|
|
74212
|
-
infiniteKey,
|
|
74213
|
-
initialSize
|
|
74214
|
-
]);
|
|
74215
|
-
(0, import_shim.useSyncExternalStore)((0, import_react.useCallback)((callback) => {
|
|
74216
|
-
if (infiniteKey) return subscribeCache(infiniteKey, () => {
|
|
74217
|
-
callback();
|
|
74218
|
-
});
|
|
74219
|
-
return () => {};
|
|
74220
|
-
}, [cache$1, infiniteKey]), getSnapshot, getSnapshot);
|
|
74221
|
-
const resolvePageSize = (0, import_react.useCallback)(() => {
|
|
74222
|
-
const cachedPageSize = get()._l;
|
|
74223
|
-
return isUndefined(cachedPageSize) ? initialSize : cachedPageSize;
|
|
74224
|
-
}, [infiniteKey, initialSize]);
|
|
74225
|
-
const lastPageSizeRef = (0, import_react.useRef)(resolvePageSize());
|
|
74226
|
-
useIsomorphicLayoutEffect(() => {
|
|
74227
|
-
if (!didMountRef.current) {
|
|
74228
|
-
didMountRef.current = true;
|
|
74229
|
-
return;
|
|
74230
|
-
}
|
|
74231
|
-
if (infiniteKey) set({ _l: persistSize ? lastPageSizeRef.current : resolvePageSize() });
|
|
74232
|
-
}, [infiniteKey, cache$1]);
|
|
74233
|
-
const shouldRevalidateOnMount = revalidateOnMount && !didMountRef.current;
|
|
74234
|
-
const swr = useSWRNext(infiniteKey, async (key) => {
|
|
74235
|
-
const forceRevalidateAll = get()._i;
|
|
74236
|
-
const shouldRevalidatePage = get()._r;
|
|
74237
|
-
const state = SWRGlobalState.get(cache$1);
|
|
74238
|
-
const unloadGeneration = state[8];
|
|
74239
|
-
const unloadedDuringRequest = () => state[8] !== unloadGeneration;
|
|
74240
|
-
set({ _r: void 0 });
|
|
74241
|
-
const data = [];
|
|
74242
|
-
const pageSize = resolvePageSize();
|
|
74243
|
-
const [getCache] = createCacheHelper(cache$1, key);
|
|
74244
|
-
const cacheData = getCache().data;
|
|
74245
|
-
const revalidators = [];
|
|
74246
|
-
let previousPageData = null;
|
|
74247
|
-
for (let i = 0; i < pageSize; ++i) {
|
|
74248
|
-
const [pageKey, pageArg] = serialize(getKey(i, parallel ? null : previousPageData));
|
|
74249
|
-
if (!pageKey) break;
|
|
74250
|
-
const [getSWRCache, setSWRCache] = createCacheHelper(cache$1, pageKey);
|
|
74251
|
-
let pageData = getSWRCache().data;
|
|
74252
|
-
const shouldFetchPage = revalidateAll || forceRevalidateAll || isUndefined(pageData) || revalidateFirstPage && !i && !isUndefined(cacheData) || shouldRevalidateOnMount || cacheData && !isUndefined(cacheData[i]) && !config.compare(cacheData[i], pageData);
|
|
74253
|
-
if (fn && (typeof shouldRevalidatePage === "function" ? shouldRevalidatePage(pageData, pageArg) : shouldFetchPage)) {
|
|
74254
|
-
const revalidate = async () => {
|
|
74255
|
-
if (!(pageKey in PRELOAD)) pageData = await fn(pageArg);
|
|
74256
|
-
else {
|
|
74257
|
-
const req = PRELOAD[pageKey];
|
|
74258
|
-
delete PRELOAD[pageKey];
|
|
74259
|
-
pageData = await req;
|
|
74260
|
-
}
|
|
74261
|
-
if (!unloadedDuringRequest()) setSWRCache({
|
|
74262
|
-
data: pageData,
|
|
74263
|
-
_k: pageArg
|
|
74264
|
-
});
|
|
74265
|
-
data[i] = pageData;
|
|
74266
|
-
};
|
|
74267
|
-
if (parallel) revalidators.push(revalidate);
|
|
74268
|
-
else await revalidate();
|
|
74269
|
-
} else data[i] = pageData;
|
|
74270
|
-
if (!parallel) previousPageData = pageData;
|
|
74271
|
-
}
|
|
74272
|
-
if (parallel) await Promise.all(revalidators.map((r) => r()));
|
|
74273
|
-
if (!unloadedDuringRequest()) set({ _i: void 0 });
|
|
74274
|
-
return data;
|
|
74275
|
-
}, config);
|
|
74276
|
-
const mutate = (0, import_react.useCallback)(function(data, opts) {
|
|
74277
|
-
const options = typeof opts === "boolean" ? { revalidate: opts } : opts || {};
|
|
74278
|
-
const shouldRevalidate = options.revalidate !== false;
|
|
74279
|
-
if (!infiniteKey) return EMPTY_PROMISE;
|
|
74280
|
-
if (shouldRevalidate) {
|
|
74281
|
-
if (!isUndefined(data)) set({
|
|
74282
|
-
_i: false,
|
|
74283
|
-
_r: options.revalidate
|
|
74284
|
-
});
|
|
74285
|
-
else set({
|
|
74286
|
-
_i: true,
|
|
74287
|
-
_r: options.revalidate
|
|
74288
|
-
});
|
|
74289
|
-
}
|
|
74290
|
-
return arguments.length ? swr.mutate(data, {
|
|
74291
|
-
...options,
|
|
74292
|
-
revalidate: shouldRevalidate
|
|
74293
|
-
}) : swr.mutate();
|
|
74294
|
-
}, [infiniteKey, cache$1]);
|
|
74295
|
-
const setSize = (0, import_react.useCallback)((arg) => {
|
|
74296
|
-
if (!infiniteKey) return EMPTY_PROMISE;
|
|
74297
|
-
const [, changeSize] = createCacheHelper(cache$1, infiniteKey);
|
|
74298
|
-
let size;
|
|
74299
|
-
if (isFunction(arg)) size = arg(resolvePageSize());
|
|
74300
|
-
else if (typeof arg == "number") size = arg;
|
|
74301
|
-
if (typeof size != "number") return EMPTY_PROMISE;
|
|
74302
|
-
changeSize({ _l: size });
|
|
74303
|
-
lastPageSizeRef.current = size;
|
|
74304
|
-
const data = [];
|
|
74305
|
-
const [getInfiniteCache] = createCacheHelper(cache$1, infiniteKey);
|
|
74306
|
-
let previousPageData = null;
|
|
74307
|
-
for (let i = 0; i < size; ++i) {
|
|
74308
|
-
const [pageKey] = serialize(getKey(i, previousPageData));
|
|
74309
|
-
const [getCache] = createCacheHelper(cache$1, pageKey);
|
|
74310
|
-
const pageData = pageKey ? getCache().data : void 0;
|
|
74311
|
-
if (isUndefined(pageData)) return mutate(getInfiniteCache().data);
|
|
74312
|
-
data.push(pageData);
|
|
74313
|
-
previousPageData = pageData;
|
|
74314
|
-
}
|
|
74315
|
-
return mutate(data);
|
|
74316
|
-
}, [
|
|
74317
|
-
infiniteKey,
|
|
74318
|
-
cache$1,
|
|
74319
|
-
mutate,
|
|
74320
|
-
resolvePageSize
|
|
74321
|
-
]);
|
|
74322
|
-
return {
|
|
74323
|
-
size: resolvePageSize(),
|
|
74324
|
-
setSize,
|
|
74325
|
-
mutate,
|
|
74326
|
-
get data() {
|
|
74327
|
-
return swr.data;
|
|
74328
|
-
},
|
|
74329
|
-
get error() {
|
|
74330
|
-
return swr.error;
|
|
74331
|
-
},
|
|
74332
|
-
get isValidating() {
|
|
74333
|
-
return swr.isValidating;
|
|
74334
|
-
},
|
|
74335
|
-
get isLoading() {
|
|
74336
|
-
return swr.isLoading;
|
|
74337
|
-
}
|
|
74338
|
-
};
|
|
74339
|
-
};
|
|
74340
|
-
var useSWRInfinite = withMiddleware(useSWR, infinite);
|
|
74341
|
-
// app/lib/client/workflow-errors.ts
|
|
74342
|
-
var OBSERVABILITY_UPGRADE_REQUIRED_CODE = "observability-upgrade-required";
|
|
74343
|
-
var OBSERVABILITY_UPGRADE_REQUIRED_MESSAGE = "This workflow observability data is outside your current plan window. Upgrade Observability Plus to view up to 30 days of workflow data.";
|
|
74344
|
-
var OBSERVABILITY_UPGRADE_REQUIRED_TITLE = "Upgrade Observability Plus";
|
|
74345
|
-
/**
|
|
74346
|
-
* Error instance for API and server-side errors.
|
|
74347
|
-
* `error.message` will be a user-facing error message, to be displayed in UI.
|
|
74348
|
-
* `error.cause` will be a developer-facing error message, to be displayed in logs.
|
|
74349
|
-
*
|
|
74350
|
-
* If the error originates from an HTTP request made from a server action,
|
|
74351
|
-
* these fields will be populated:
|
|
74352
|
-
* - `error.request` will be a JSON-serializable object representing the request made.
|
|
74353
|
-
* - `error.layer` will be 'API'
|
|
74354
|
-
*
|
|
74355
|
-
* If the error originates from inside the server action, or there's an error with
|
|
74356
|
-
* calling the server action, these fields will be populated:
|
|
74357
|
-
* - `error.layer` will be 'server'
|
|
74358
|
-
*/
|
|
74359
|
-
var WorkflowWebAPIError = class extends Error {
|
|
74360
|
-
request;
|
|
74361
|
-
layer;
|
|
74362
|
-
constructor(message, options) {
|
|
74363
|
-
super(message, { cause: options?.cause });
|
|
74364
|
-
this.name = "WorkflowWebAPIError";
|
|
74365
|
-
this.request = options?.request;
|
|
74366
|
-
this.layer = options?.layer;
|
|
74367
|
-
if (options?.cause instanceof Error) this.stack = `${this.stack}\nCaused by: ${options.cause.stack}`;
|
|
74368
|
-
}
|
|
74369
|
-
};
|
|
74370
|
-
/**
|
|
74371
|
-
* Helper to convert ServerActionError to WorkflowWebAPIError
|
|
74372
|
-
*/
|
|
74373
|
-
function createWorkflowAPIError(serverError) {
|
|
74374
|
-
return new WorkflowWebAPIError(serverError.message, {
|
|
74375
|
-
cause: serverError.cause,
|
|
74376
|
-
request: serverError.request,
|
|
74377
|
-
layer: serverError.layer
|
|
74378
|
-
});
|
|
74379
|
-
}
|
|
74380
|
-
function isObservabilityUpgradeRequired(error) {
|
|
74381
|
-
return error instanceof WorkflowWebAPIError && error.request?.status === 402 && error.request?.code === OBSERVABILITY_UPGRADE_REQUIRED_CODE;
|
|
74382
|
-
}
|
|
74383
|
-
function getErrorTitle(error, fallback) {
|
|
74384
|
-
if (isObservabilityUpgradeRequired(error)) return OBSERVABILITY_UPGRADE_REQUIRED_TITLE;
|
|
74385
|
-
return fallback;
|
|
74386
|
-
}
|
|
74387
|
-
/**
|
|
74388
|
-
* Gets a user-facing error message from an error object.
|
|
74389
|
-
* Handles both WorkflowWebAPIError and regular Error instances.
|
|
74390
|
-
*/
|
|
74391
|
-
var getErrorMessage = (error) => {
|
|
74392
|
-
if (isObservabilityUpgradeRequired(error)) return OBSERVABILITY_UPGRADE_REQUIRED_MESSAGE;
|
|
74393
|
-
if ("layer" in error && error.layer) {
|
|
74394
|
-
if (error instanceof WorkflowWebAPIError) {
|
|
74395
|
-
if (error.request?.status === 403) return VERCEL_403_ERROR_MESSAGE;
|
|
74396
|
-
}
|
|
74397
|
-
return error.message;
|
|
74398
|
-
}
|
|
74399
|
-
return error instanceof Error ? error.message : "An error occurred";
|
|
74400
|
-
};
|
|
74401
|
-
/**
|
|
74402
|
-
* Helper to handle server action results and throw WorkflowWebAPIError on failure
|
|
74403
|
-
*/
|
|
74404
|
-
async function unwrapServerActionResult(promise) {
|
|
74405
|
-
let result;
|
|
73204
|
+
const buffer = new Uint8Array(await res.arrayBuffer());
|
|
73205
|
+
if (res.ok) return decode(buffer);
|
|
73206
|
+
let message;
|
|
74406
73207
|
try {
|
|
74407
|
-
|
|
74408
|
-
} catch
|
|
74409
|
-
|
|
74410
|
-
success: false,
|
|
74411
|
-
error
|
|
74412
|
-
};
|
|
74413
|
-
}
|
|
74414
|
-
if (!result.success) {
|
|
74415
|
-
if (!result.error) return {
|
|
74416
|
-
error: new WorkflowWebAPIError("Unknown error occurred", { layer: "client" }),
|
|
74417
|
-
result: null
|
|
74418
|
-
};
|
|
74419
|
-
return {
|
|
74420
|
-
error: createWorkflowAPIError(result.error),
|
|
74421
|
-
result: null
|
|
74422
|
-
};
|
|
74423
|
-
}
|
|
74424
|
-
return {
|
|
74425
|
-
error: null,
|
|
74426
|
-
result: result.data
|
|
74427
|
-
};
|
|
74428
|
-
}
|
|
74429
|
-
/**
|
|
74430
|
-
* Unwraps a server action result, throwing WorkflowWebAPIError on failure.
|
|
74431
|
-
* Use for simple action wrappers where you just want the result or an exception.
|
|
74432
|
-
*/
|
|
74433
|
-
async function unwrapOrThrow(promise) {
|
|
74434
|
-
const { error, result } = await unwrapServerActionResult(promise);
|
|
74435
|
-
if (error) throw error;
|
|
74436
|
-
return result;
|
|
74437
|
-
}
|
|
74438
|
-
// app/lib/client/hooks/use-infinite-list.ts
|
|
74439
|
-
/**
|
|
74440
|
-
* Cursor-based infinite list backed by SWR's global cache.
|
|
74441
|
-
*
|
|
74442
|
-
* Pages are keyed by `[cacheKey, cursor]`, so switching tabs (unmount +
|
|
74443
|
-
* remount) restores previously fetched pages instantly instead of refetching.
|
|
74444
|
-
* Revalidation is deliberately conservative — analytics list queries can be
|
|
74445
|
-
* expensive (ClickHouse) — so cached pages are NOT refetched on remount or
|
|
74446
|
-
* when loading further pages (`revalidateFirstPage: false`,
|
|
74447
|
-
* `revalidateIfStale: false`). Freshness comes from explicit `reload()`/
|
|
74448
|
-
* `refresh()` calls (the Refresh button and the tab-visibility auto-reload).
|
|
74449
|
-
*
|
|
74450
|
-
* Rows are deduped by `getItemKey` when pages are flattened, so cursor drift
|
|
74451
|
-
* on live data cannot produce duplicate rows.
|
|
74452
|
-
*/
|
|
74453
|
-
function useInfiniteList(cacheKey, fetchFn, getItemKey) {
|
|
74454
|
-
const { data: pages, error, isLoading, isValidating, size, setSize, mutate } = useSWRInfinite((0, import_react.useCallback)((_index, prev) => {
|
|
74455
|
-
if (prev && (!prev.hasMore || !prev.cursor)) return null;
|
|
74456
|
-
return [cacheKey, prev?.cursor ?? null];
|
|
74457
|
-
}, [cacheKey]), ([, cursor]) => fetchFn(cursor ?? void 0), {
|
|
74458
|
-
revalidateFirstPage: false,
|
|
74459
|
-
revalidateIfStale: false,
|
|
74460
|
-
revalidateOnFocus: false,
|
|
74461
|
-
keepPreviousData: true
|
|
74462
|
-
});
|
|
74463
|
-
const items = (0, import_react.useMemo)(() => {
|
|
74464
|
-
if (!pages) return [];
|
|
74465
|
-
const seen = /* @__PURE__ */ new Set();
|
|
74466
|
-
const result = [];
|
|
74467
|
-
for (const page of pages) for (const item of page.data) {
|
|
74468
|
-
const key = getItemKey(item);
|
|
74469
|
-
if (seen.has(key)) continue;
|
|
74470
|
-
seen.add(key);
|
|
74471
|
-
result.push(item);
|
|
74472
|
-
}
|
|
74473
|
-
return result;
|
|
74474
|
-
}, [pages, getItemKey]);
|
|
74475
|
-
const lastPage = pages?.[pages.length - 1];
|
|
74476
|
-
const hasMore = Boolean(lastPage?.hasMore && lastPage?.cursor);
|
|
74477
|
-
const isLoadingMore = size > 0 && Boolean(pages) && pages.length < size;
|
|
74478
|
-
const loadMore = (0, import_react.useCallback)(() => {
|
|
74479
|
-
if (isValidating || !hasMore) return;
|
|
74480
|
-
setSize((s) => s + 1);
|
|
74481
|
-
}, [
|
|
74482
|
-
isValidating,
|
|
74483
|
-
hasMore,
|
|
74484
|
-
setSize
|
|
74485
|
-
]);
|
|
74486
|
-
const reload = (0, import_react.useCallback)(() => {
|
|
74487
|
-
setSize(1);
|
|
74488
|
-
mutate();
|
|
74489
|
-
}, [setSize, mutate]);
|
|
74490
|
-
return {
|
|
74491
|
-
items,
|
|
74492
|
-
error: error ? error instanceof Error ? error : new WorkflowWebAPIError(String(error), { layer: "client" }) : null,
|
|
74493
|
-
isLoading,
|
|
74494
|
-
isLoadingMore,
|
|
74495
|
-
hasMore,
|
|
74496
|
-
loadMore,
|
|
74497
|
-
reload,
|
|
74498
|
-
refresh: reload,
|
|
74499
|
-
pageInfo: pages?.[0]?.pageInfo
|
|
74500
|
-
};
|
|
74501
|
-
}
|
|
74502
|
-
/**
|
|
74503
|
-
* Infinite-scrolling list of workflow runs.
|
|
74504
|
-
*
|
|
74505
|
-
* Pages are larger than the old prev/next views (25 rows) since rows
|
|
74506
|
-
* accumulate; with the ClickHouse-backed analytics read path this keeps the
|
|
74507
|
-
* number of round-trips low while scrolling.
|
|
74508
|
-
*/
|
|
74509
|
-
function useWorkflowRunsInfinite(env, params) {
|
|
74510
|
-
const { workflowName, status, limit = 25, sortOrder = "desc", startTime, endTime } = params;
|
|
74511
|
-
return useInfiniteList(`workflow-runs:${workflowName ?? ""}:${status ?? ""}:${sortOrder}:${limit}:${startTime ?? ""}:${endTime ?? ""}`, (0, import_react.useCallback)((cursor) => unwrapOrThrow(fetchRuns(env, {
|
|
74512
|
-
cursor,
|
|
74513
|
-
sortOrder,
|
|
74514
|
-
limit,
|
|
74515
|
-
workflowName,
|
|
74516
|
-
status,
|
|
74517
|
-
startTime,
|
|
74518
|
-
endTime
|
|
74519
|
-
})), [
|
|
74520
|
-
env,
|
|
74521
|
-
workflowName,
|
|
74522
|
-
limit,
|
|
74523
|
-
sortOrder,
|
|
74524
|
-
status,
|
|
74525
|
-
startTime,
|
|
74526
|
-
endTime
|
|
74527
|
-
]), (0, import_react.useCallback)((run) => run.runId, []));
|
|
74528
|
-
}
|
|
74529
|
-
// app/lib/client/hooks/use-load-more-on-scroll.ts
|
|
74530
|
-
/**
|
|
74531
|
-
* Fires `loadMore` when a sentinel element scrolls into view.
|
|
74532
|
-
*
|
|
74533
|
-
* Attach the returned ref to an empty element placed after the list. The
|
|
74534
|
-
* observer only fires while `hasMore && !isLoadingMore`, and `loadMore` is
|
|
74535
|
-
* held in a ref so its identity changing does not re-create the observer.
|
|
74536
|
-
*
|
|
74537
|
-
* Pass the scrollable container as `root` when the list scrolls inside a
|
|
74538
|
-
* fixed-height element (rather than the viewport) so `rootMargin` prefetching
|
|
74539
|
-
* is measured against the container edge.
|
|
74540
|
-
*/
|
|
74541
|
-
function useLoadMoreOnScroll(loadMore, { hasMore, isLoadingMore, root = null, rootMargin = "400px" }) {
|
|
74542
|
-
const sentinelRef = (0, import_react.useRef)(null);
|
|
74543
|
-
const loadMoreRef = (0, import_react.useRef)(loadMore);
|
|
74544
|
-
(0, import_react.useEffect)(() => {
|
|
74545
|
-
loadMoreRef.current = loadMore;
|
|
74546
|
-
}, [loadMore]);
|
|
74547
|
-
(0, import_react.useEffect)(() => {
|
|
74548
|
-
const sentinel = sentinelRef.current;
|
|
74549
|
-
if (!sentinel || !hasMore || isLoadingMore) return;
|
|
74550
|
-
const observer = new IntersectionObserver((entries) => {
|
|
74551
|
-
for (const entry of entries) if (entry.isIntersecting) {
|
|
74552
|
-
loadMoreRef.current();
|
|
74553
|
-
break;
|
|
74554
|
-
}
|
|
74555
|
-
}, {
|
|
74556
|
-
root,
|
|
74557
|
-
rootMargin,
|
|
74558
|
-
threshold: 0
|
|
74559
|
-
});
|
|
74560
|
-
observer.observe(sentinel);
|
|
74561
|
-
return () => observer.disconnect();
|
|
74562
|
-
}, [
|
|
74563
|
-
hasMore,
|
|
74564
|
-
isLoadingMore,
|
|
74565
|
-
root,
|
|
74566
|
-
rootMargin
|
|
74567
|
-
]);
|
|
74568
|
-
return sentinelRef;
|
|
74569
|
-
}
|
|
74570
|
-
// app/lib/client/hooks/use-paginated-list.ts
|
|
74571
|
-
/**
|
|
74572
|
-
* Generic hook for cursor-based paginated lists with caching and navigation.
|
|
74573
|
-
* Callers should memoize `fetchFn` with useCallback to control when data is refetched.
|
|
74574
|
-
*/
|
|
74575
|
-
function usePaginatedList(fetchFn) {
|
|
74576
|
-
const [cursor, setCursor] = (0, import_react.useState)(void 0);
|
|
74577
|
-
const [hasMore, setHasMore] = (0, import_react.useState)(false);
|
|
74578
|
-
const [currentPage, setCurrentPage] = (0, import_react.useState)(0);
|
|
74579
|
-
const [pageHistory, setPageHistory] = (0, import_react.useState)([void 0]);
|
|
74580
|
-
const [maxPagesVisited, setMaxPagesVisited] = (0, import_react.useState)(1);
|
|
74581
|
-
const [allPageResults, setAllPageResults] = (0, import_react.useState)(/* @__PURE__ */ new Map([[0, {
|
|
74582
|
-
data: null,
|
|
74583
|
-
isLoading: false,
|
|
74584
|
-
error: null
|
|
74585
|
-
}]]));
|
|
74586
|
-
const pageCache = (0, import_react.useRef)(/* @__PURE__ */ new Map());
|
|
74587
|
-
const fetchPage = (0, import_react.useCallback)(async (pageIndex, pageCursor, force = false) => {
|
|
74588
|
-
const cacheKey = pageCursor ?? "initial";
|
|
74589
|
-
setAllPageResults((prev) => {
|
|
74590
|
-
const newMap = new Map(prev);
|
|
74591
|
-
newMap.set(pageIndex, {
|
|
74592
|
-
data: prev.get(pageIndex)?.data ?? null,
|
|
74593
|
-
isLoading: true,
|
|
74594
|
-
error: null
|
|
74595
|
-
});
|
|
74596
|
-
return newMap;
|
|
74597
|
-
});
|
|
74598
|
-
if (!force && pageCache.current.has(cacheKey)) {
|
|
74599
|
-
const cached = pageCache.current.get(cacheKey);
|
|
74600
|
-
if (cached) {
|
|
74601
|
-
setAllPageResults((prev) => {
|
|
74602
|
-
const newMap = new Map(prev);
|
|
74603
|
-
newMap.set(pageIndex, {
|
|
74604
|
-
data: cached.data,
|
|
74605
|
-
isLoading: false,
|
|
74606
|
-
error: null,
|
|
74607
|
-
pageInfo: cached.pageInfo
|
|
74608
|
-
});
|
|
74609
|
-
return newMap;
|
|
74610
|
-
});
|
|
74611
|
-
setCursor(cached.cursor);
|
|
74612
|
-
setHasMore(cached.hasMore);
|
|
74613
|
-
return;
|
|
74614
|
-
}
|
|
74615
|
-
}
|
|
74616
|
-
try {
|
|
74617
|
-
const result = await fetchFn(pageCursor);
|
|
74618
|
-
pageCache.current.set(cacheKey, {
|
|
74619
|
-
data: result.data,
|
|
74620
|
-
cursor: result.cursor,
|
|
74621
|
-
hasMore: result.hasMore,
|
|
74622
|
-
pageInfo: result.pageInfo
|
|
74623
|
-
});
|
|
74624
|
-
setAllPageResults((prev) => {
|
|
74625
|
-
const newMap = new Map(prev);
|
|
74626
|
-
newMap.set(pageIndex, {
|
|
74627
|
-
data: result.data,
|
|
74628
|
-
isLoading: false,
|
|
74629
|
-
error: null,
|
|
74630
|
-
pageInfo: result.pageInfo
|
|
74631
|
-
});
|
|
74632
|
-
return newMap;
|
|
74633
|
-
});
|
|
74634
|
-
setCursor(result.cursor);
|
|
74635
|
-
setHasMore(result.hasMore);
|
|
74636
|
-
} catch (err) {
|
|
74637
|
-
const error = err instanceof Error ? err : new WorkflowWebAPIError(String(err), { layer: "client" });
|
|
74638
|
-
setAllPageResults((prev) => {
|
|
74639
|
-
const newMap = new Map(prev);
|
|
74640
|
-
newMap.set(pageIndex, {
|
|
74641
|
-
data: prev.get(pageIndex)?.data ?? null,
|
|
74642
|
-
isLoading: false,
|
|
74643
|
-
error
|
|
74644
|
-
});
|
|
74645
|
-
return newMap;
|
|
74646
|
-
});
|
|
74647
|
-
}
|
|
74648
|
-
}, [fetchFn]);
|
|
74649
|
-
(0, import_react.useEffect)(() => {
|
|
74650
|
-
fetchPage(0, void 0, true);
|
|
74651
|
-
}, [fetchPage]);
|
|
74652
|
-
const nextPage = (0, import_react.useCallback)(() => {
|
|
74653
|
-
if (hasMore && cursor) {
|
|
74654
|
-
const newPage = currentPage + 1;
|
|
74655
|
-
setPageHistory((prev) => [...prev, cursor]);
|
|
74656
|
-
setCurrentPage(newPage);
|
|
74657
|
-
setMaxPagesVisited((prev) => Math.max(prev, newPage + 1));
|
|
74658
|
-
if (!allPageResults.has(newPage)) setAllPageResults((prev) => {
|
|
74659
|
-
const newMap = new Map(prev);
|
|
74660
|
-
newMap.set(newPage, {
|
|
74661
|
-
data: null,
|
|
74662
|
-
isLoading: true,
|
|
74663
|
-
error: null
|
|
74664
|
-
});
|
|
74665
|
-
return newMap;
|
|
74666
|
-
});
|
|
74667
|
-
fetchPage(newPage, cursor);
|
|
74668
|
-
}
|
|
74669
|
-
}, [
|
|
74670
|
-
hasMore,
|
|
74671
|
-
cursor,
|
|
74672
|
-
fetchPage,
|
|
74673
|
-
currentPage,
|
|
74674
|
-
allPageResults
|
|
74675
|
-
]);
|
|
74676
|
-
const previousPage = (0, import_react.useCallback)(() => {
|
|
74677
|
-
if (currentPage > 0) {
|
|
74678
|
-
const newPage = currentPage - 1;
|
|
74679
|
-
const prevCursor = pageHistory[newPage];
|
|
74680
|
-
setCurrentPage(newPage);
|
|
74681
|
-
fetchPage(newPage, prevCursor);
|
|
74682
|
-
}
|
|
74683
|
-
}, [
|
|
74684
|
-
currentPage,
|
|
74685
|
-
pageHistory,
|
|
74686
|
-
fetchPage
|
|
74687
|
-
]);
|
|
74688
|
-
const reload = (0, import_react.useCallback)(() => {
|
|
74689
|
-
pageCache.current.clear();
|
|
74690
|
-
setAllPageResults(/* @__PURE__ */ new Map([[0, {
|
|
74691
|
-
data: null,
|
|
74692
|
-
isLoading: true,
|
|
74693
|
-
error: null
|
|
74694
|
-
}]]));
|
|
74695
|
-
setCurrentPage(0);
|
|
74696
|
-
setPageHistory([void 0]);
|
|
74697
|
-
setMaxPagesVisited(1);
|
|
74698
|
-
fetchPage(0, void 0, true);
|
|
74699
|
-
}, [fetchPage]);
|
|
74700
|
-
const refresh = (0, import_react.useCallback)(() => {
|
|
74701
|
-
const currentCursor = pageHistory[currentPage];
|
|
74702
|
-
const cacheKey = currentCursor ?? "initial";
|
|
74703
|
-
pageCache.current.delete(cacheKey);
|
|
74704
|
-
fetchPage(currentPage, currentCursor, true);
|
|
74705
|
-
}, [
|
|
74706
|
-
fetchPage,
|
|
74707
|
-
currentPage,
|
|
74708
|
-
pageHistory
|
|
74709
|
-
]);
|
|
74710
|
-
const currentPageResult = allPageResults.get(currentPage) ?? {
|
|
74711
|
-
data: null,
|
|
74712
|
-
isLoading: true,
|
|
74713
|
-
error: null
|
|
74714
|
-
};
|
|
74715
|
-
const globalError = Array.from(allPageResults.values()).find((p) => p.error)?.error ?? null;
|
|
74716
|
-
const globalLoading = Array.from(allPageResults.values()).some((p) => p.isLoading);
|
|
74717
|
-
const totalPages = hasMore ? currentPage + 2 : currentPage + 1;
|
|
74718
|
-
const currentPageNumber = currentPage + 1;
|
|
74719
|
-
const pageInfo = getPaginationDisplay(currentPageNumber, maxPagesVisited, currentPageNumber === maxPagesVisited && hasMore);
|
|
74720
|
-
return {
|
|
74721
|
-
data: currentPageResult,
|
|
74722
|
-
allData: Array.from(allPageResults.values()),
|
|
74723
|
-
error: globalError,
|
|
74724
|
-
isLoading: globalLoading,
|
|
74725
|
-
currentPage,
|
|
74726
|
-
totalPages,
|
|
74727
|
-
nextPage,
|
|
74728
|
-
previousPage,
|
|
74729
|
-
hasNextPage: hasMore,
|
|
74730
|
-
hasPreviousPage: currentPage > 0,
|
|
74731
|
-
reload,
|
|
74732
|
-
refresh,
|
|
74733
|
-
pageInfo,
|
|
74734
|
-
analyticsPageInfo: currentPageResult.pageInfo
|
|
74735
|
-
};
|
|
74736
|
-
}
|
|
74737
|
-
/**
|
|
74738
|
-
* Returns a list of hooks with pagination control
|
|
74739
|
-
*/
|
|
74740
|
-
function useWorkflowHooks(env, params) {
|
|
74741
|
-
const { runId, limit = 10, sortOrder = "desc" } = params;
|
|
74742
|
-
return usePaginatedList((0, import_react.useCallback)((cursor) => unwrapOrThrow(fetchHooks(env, {
|
|
74743
|
-
runId,
|
|
74744
|
-
cursor,
|
|
74745
|
-
sortOrder,
|
|
74746
|
-
limit
|
|
74747
|
-
})), [
|
|
74748
|
-
env,
|
|
74749
|
-
runId,
|
|
74750
|
-
limit,
|
|
74751
|
-
sortOrder
|
|
74752
|
-
]));
|
|
74753
|
-
}
|
|
74754
|
-
// app/lib/client/hooks/use-resource-data.ts
|
|
74755
|
-
async function fetchResourceWithCorrelationId(env, resource, resourceId, options = {}) {
|
|
74756
|
-
const resolveData = options.resolveData ?? "all";
|
|
74757
|
-
let resourceData;
|
|
74758
|
-
let correlationId;
|
|
74759
|
-
if (resource === "run") {
|
|
74760
|
-
resourceData = await unwrapOrThrow(fetchRun(env, resourceId, resolveData));
|
|
74761
|
-
correlationId = resourceData.runId;
|
|
74762
|
-
} else if (resource === "step") {
|
|
74763
|
-
const { runId } = options;
|
|
74764
|
-
if (!runId) throw new WorkflowWebAPIError("runId is required for step resource", { layer: "client" });
|
|
74765
|
-
resourceData = await unwrapOrThrow(fetchStep(env, runId, resourceId, resolveData));
|
|
74766
|
-
correlationId = resourceData.stepId;
|
|
74767
|
-
} else if (resource === "hook") {
|
|
74768
|
-
resourceData = await unwrapOrThrow(fetchHook(env, resourceId, resolveData));
|
|
74769
|
-
correlationId = resourceData.hookId;
|
|
74770
|
-
} else throw new WorkflowWebAPIError(`Unknown resource type: ${resource}`, { layer: "client" });
|
|
74771
|
-
return {
|
|
74772
|
-
data: resourceData,
|
|
74773
|
-
correlationId
|
|
74774
|
-
};
|
|
74775
|
-
}
|
|
74776
|
-
async function fetchSpanDetailResource(env, selection, options = {}) {
|
|
74777
|
-
const { resource, resourceId, runId } = selection;
|
|
74778
|
-
const { encryptionKey } = options;
|
|
74779
|
-
const hydrate = async (value) => hydrateResourceIOAsync(value, encryptionKey);
|
|
74780
|
-
if (resource === "hook") return hydrate(await unwrapOrThrow(fetchHook(env, resourceId, "all")));
|
|
74781
|
-
if (resource === "sleep") {
|
|
74782
|
-
if (!runId) throw new WorkflowWebAPIError("runId is required for loading sleep details", { layer: "client" });
|
|
74783
|
-
const result = await unwrapOrThrow(fetchEvents(env, runId, {
|
|
74784
|
-
sortOrder: "asc",
|
|
74785
|
-
limit: 1e3,
|
|
74786
|
-
withData: true
|
|
74787
|
-
}));
|
|
74788
|
-
const data = waitEventsToWaitEntity(await Promise.all(result.data.filter((e) => e.correlationId === resourceId).map(hydrate)));
|
|
74789
|
-
if (data === null) throw new WorkflowWebAPIError(`Failed to load ${resource} details: missing required event data`, { layer: "client" });
|
|
74790
|
-
return data;
|
|
74791
|
-
}
|
|
74792
|
-
const { data } = await fetchResourceWithCorrelationId(env, resource, resourceId, { runId });
|
|
74793
|
-
return hydrate(data);
|
|
74794
|
-
}
|
|
74795
|
-
// app/lib/client/workflow-primitives.ts
|
|
74796
|
-
/**
|
|
74797
|
-
* Merges two arrays by a unique ID key, with later items overriding earlier ones.
|
|
74798
|
-
*/
|
|
74799
|
-
function mergeById(prev, next, idKey) {
|
|
74800
|
-
const combined = [...prev, ...next];
|
|
74801
|
-
const uniqueById = new Map(combined.map((item) => [item[idKey], item]));
|
|
74802
|
-
return Array.from(uniqueById.values());
|
|
74803
|
-
}
|
|
74804
|
-
/**
|
|
74805
|
-
* Polls a paginated resource for new items, merging them into existing state.
|
|
74806
|
-
* Returns true if new items were found.
|
|
74807
|
-
*
|
|
74808
|
-
* @param cursorStrategy - 'always': advance cursor whenever one is returned.
|
|
74809
|
-
* 'onHasMore': only advance when hasMore is true (re-fetches existing items to catch status updates).
|
|
74810
|
-
* @param transform - Optional transform applied to each new item before merging (e.g. hydrateResourceIO).
|
|
74811
|
-
*/
|
|
74812
|
-
async function pollResource(opts) {
|
|
74813
|
-
const { fetchFn, setItems, setCursor, setError, idKey, cursorStrategy = "always", transform } = opts;
|
|
74814
|
-
const { error, result } = await fetchFn();
|
|
74815
|
-
if (error) {
|
|
74816
|
-
setError(error);
|
|
74817
|
-
return false;
|
|
74818
|
-
}
|
|
74819
|
-
if (result.data.length > 0) {
|
|
74820
|
-
const newData = transform ? result.data.map(transform) : result.data;
|
|
74821
|
-
setItems((prev) => mergeById(prev, newData, idKey));
|
|
74822
|
-
if (cursorStrategy === "onHasMore" ? !!(result.cursor && result.hasMore) : !!result.cursor) setCursor(result.cursor);
|
|
74823
|
-
return true;
|
|
74824
|
-
}
|
|
74825
|
-
return false;
|
|
74826
|
-
}
|
|
74827
|
-
// app/lib/client/hooks/use-trace-viewer.ts
|
|
74828
|
-
var LIVE_POLL_LIMIT = 100;
|
|
74829
|
-
var INITIAL_PAGE_SIZE = 500;
|
|
74830
|
-
var LOAD_MORE_PAGE_SIZE = 100;
|
|
74831
|
-
var LIVE_UPDATE_INTERVAL_MS = 5e3;
|
|
74832
|
-
var AUTO_LOAD_MAX_EVENTS = 500;
|
|
74833
|
-
/**
|
|
74834
|
-
* Returns (and keeps up-to-date) the Run and Events for a workflow run.
|
|
74835
|
-
* The trace viewer builds spans entirely from events — Steps and Hooks
|
|
74836
|
-
* are fetched on-demand by the detail sidebar, not here.
|
|
74837
|
-
*/
|
|
74838
|
-
function useWorkflowTraceViewerData(env, runId, options = {}) {
|
|
74839
|
-
const { live = false } = options;
|
|
74840
|
-
const [run, setRun] = (0, import_react.useState)(null);
|
|
74841
|
-
const [events, setEvents] = (0, import_react.useState)([]);
|
|
74842
|
-
const [loading, setLoading] = (0, import_react.useState)(true);
|
|
74843
|
-
const [error, setError] = (0, import_react.useState)(null);
|
|
74844
|
-
const [eventsCursor, setEventsCursor] = (0, import_react.useState)();
|
|
74845
|
-
const [eventsHasMore, setEventsHasMore] = (0, import_react.useState)(false);
|
|
74846
|
-
const [isLoadingMoreTraceData, setIsLoadingMoreTraceData] = (0, import_react.useState)(false);
|
|
74847
|
-
const [hasEncryptedData, setHasEncryptedData] = (0, import_react.useState)(false);
|
|
74848
|
-
const isFetchingRef = (0, import_react.useRef)(false);
|
|
74849
|
-
const mountedRef = (0, import_react.useRef)(true);
|
|
74850
|
-
const [initialLoadCompleted, setInitialLoadCompleted] = (0, import_react.useState)(false);
|
|
74851
|
-
const fetchAllData = (0, import_react.useCallback)(async () => {
|
|
74852
|
-
if (isFetchingRef.current) return;
|
|
74853
|
-
isFetchingRef.current = true;
|
|
74854
|
-
setLoading(true);
|
|
74855
|
-
setError(null);
|
|
74856
|
-
const [runResult, eventsResult] = await Promise.all([unwrapServerActionResult(fetchRun(env, runId, "none")), unwrapServerActionResult(fetchEvents(env, runId, {
|
|
74857
|
-
sortOrder: "asc",
|
|
74858
|
-
limit: INITIAL_PAGE_SIZE,
|
|
74859
|
-
withData: false
|
|
74860
|
-
}))]);
|
|
74861
|
-
if (runResult.error) setError(runResult.error);
|
|
74862
|
-
else setRun(hydrateResourceIO(runResult.result));
|
|
74863
|
-
const initialEvents = eventsResult.error ? [] : eventsResult.result.data.map(hydrateResourceIO);
|
|
74864
|
-
setEvents(mergeById([], initialEvents, "eventId"));
|
|
74865
|
-
setEventsCursor(eventsResult.error || !eventsResult.result.hasMore ? void 0 : eventsResult.result.cursor);
|
|
74866
|
-
setEventsHasMore(Boolean(!eventsResult.error && eventsResult.result.hasMore));
|
|
74867
|
-
setLoading(false);
|
|
74868
|
-
setInitialLoadCompleted(true);
|
|
74869
|
-
isFetchingRef.current = false;
|
|
74870
|
-
if (!runResult.error && eventsResult.error) setError(eventsResult.error);
|
|
74871
|
-
if (!runResult.error) {
|
|
74872
|
-
const ctx = runResult.result.executionContext;
|
|
74873
|
-
if (ctx?.features && ctx.features.encryption) setHasEncryptedData(true);
|
|
74874
|
-
else unwrapServerActionResult(fetchEvents(env, runId, {
|
|
74875
|
-
sortOrder: "asc",
|
|
74876
|
-
limit: 1,
|
|
74877
|
-
withData: true
|
|
74878
|
-
})).then((probeResult) => {
|
|
74879
|
-
if (mountedRef.current && !probeResult.error && probeResult.result.data.some((e) => hasEncryptedFields(hydrateResourceIO(e)))) setHasEncryptedData(true);
|
|
74880
|
-
}).catch(() => {});
|
|
74881
|
-
}
|
|
74882
|
-
}, [env, runId]);
|
|
74883
|
-
const loadMoreTraceData = (0, import_react.useCallback)(async () => {
|
|
74884
|
-
if (isFetchingRef.current || !initialLoadCompleted || isLoadingMoreTraceData || !eventsHasMore) return;
|
|
74885
|
-
setIsLoadingMoreTraceData(true);
|
|
74886
|
-
try {
|
|
74887
|
-
const nextEventsResult = await unwrapServerActionResult(fetchEvents(env, runId, {
|
|
74888
|
-
cursor: eventsCursor,
|
|
74889
|
-
sortOrder: "asc",
|
|
74890
|
-
limit: LOAD_MORE_PAGE_SIZE,
|
|
74891
|
-
withData: false
|
|
74892
|
-
}));
|
|
74893
|
-
if (nextEventsResult.error) setError(nextEventsResult.error);
|
|
74894
|
-
else {
|
|
74895
|
-
const nextEvents = nextEventsResult.result.data.map(hydrateResourceIO);
|
|
74896
|
-
if (nextEvents.length > 0) setEvents((prev) => mergeById(prev, nextEvents, "eventId"));
|
|
74897
|
-
setEventsHasMore(Boolean(nextEventsResult.result.hasMore));
|
|
74898
|
-
setEventsCursor(nextEventsResult.result.hasMore ? nextEventsResult.result.cursor : void 0);
|
|
74899
|
-
}
|
|
74900
|
-
} finally {
|
|
74901
|
-
setIsLoadingMoreTraceData(false);
|
|
74902
|
-
}
|
|
74903
|
-
}, [
|
|
74904
|
-
env,
|
|
74905
|
-
runId,
|
|
74906
|
-
initialLoadCompleted,
|
|
74907
|
-
isLoadingMoreTraceData,
|
|
74908
|
-
eventsHasMore,
|
|
74909
|
-
eventsCursor
|
|
74910
|
-
]);
|
|
74911
|
-
(0, import_react.useEffect)(() => {
|
|
74912
|
-
if (events.length >= AUTO_LOAD_MAX_EVENTS) return;
|
|
74913
|
-
loadMoreTraceData();
|
|
74914
|
-
}, [events.length, loadMoreTraceData]);
|
|
74915
|
-
const pollRun = (0, import_react.useCallback)(async () => {
|
|
74916
|
-
if (run?.completedAt) return false;
|
|
74917
|
-
const { error, result } = await unwrapServerActionResult(fetchRun(env, runId, "none"));
|
|
74918
|
-
if (error) {
|
|
74919
|
-
setError(error);
|
|
74920
|
-
return false;
|
|
74921
|
-
}
|
|
74922
|
-
setError(null);
|
|
74923
|
-
setRun(hydrateResourceIO(result));
|
|
74924
|
-
return true;
|
|
74925
|
-
}, [
|
|
74926
|
-
env,
|
|
74927
|
-
runId,
|
|
74928
|
-
run?.completedAt
|
|
74929
|
-
]);
|
|
74930
|
-
const pollEvents = (0, import_react.useCallback)(() => pollResource({
|
|
74931
|
-
fetchFn: () => unwrapServerActionResult(fetchEvents(env, runId, {
|
|
74932
|
-
cursor: eventsCursor,
|
|
74933
|
-
sortOrder: "asc",
|
|
74934
|
-
limit: LIVE_POLL_LIMIT,
|
|
74935
|
-
withData: false
|
|
74936
|
-
})),
|
|
74937
|
-
setItems: setEvents,
|
|
74938
|
-
setCursor: setEventsCursor,
|
|
74939
|
-
setError,
|
|
74940
|
-
idKey: "eventId",
|
|
74941
|
-
transform: hydrateResourceIO
|
|
74942
|
-
}), [
|
|
74943
|
-
env,
|
|
74944
|
-
runId,
|
|
74945
|
-
eventsCursor
|
|
74946
|
-
]);
|
|
74947
|
-
const update = (0, import_react.useCallback)(async () => {
|
|
74948
|
-
if (isFetchingRef.current || !initialLoadCompleted) return { foundNewItems: false };
|
|
74949
|
-
let foundNewItems = false;
|
|
74950
|
-
try {
|
|
74951
|
-
const [_, eventsUpdated] = await Promise.all([pollRun(), pollEvents()]);
|
|
74952
|
-
foundNewItems = eventsUpdated;
|
|
74953
|
-
} catch (err) {
|
|
74954
|
-
console.error("Update error:", err);
|
|
74955
|
-
}
|
|
74956
|
-
return { foundNewItems };
|
|
74957
|
-
}, [
|
|
74958
|
-
pollEvents,
|
|
74959
|
-
initialLoadCompleted,
|
|
74960
|
-
pollRun
|
|
74961
|
-
]);
|
|
74962
|
-
(0, import_react.useEffect)(() => {
|
|
74963
|
-
fetchAllData();
|
|
74964
|
-
}, [fetchAllData]);
|
|
74965
|
-
(0, import_react.useEffect)(() => {
|
|
74966
|
-
mountedRef.current = true;
|
|
74967
|
-
return () => {
|
|
74968
|
-
mountedRef.current = false;
|
|
74969
|
-
};
|
|
74970
|
-
}, []);
|
|
74971
|
-
(0, import_react.useEffect)(() => {
|
|
74972
|
-
if (!live || !initialLoadCompleted || run?.completedAt) return;
|
|
74973
|
-
const interval = setInterval(() => {
|
|
74974
|
-
update();
|
|
74975
|
-
}, LIVE_UPDATE_INTERVAL_MS);
|
|
74976
|
-
return () => {
|
|
74977
|
-
clearInterval(interval);
|
|
74978
|
-
};
|
|
74979
|
-
}, [
|
|
74980
|
-
live,
|
|
74981
|
-
initialLoadCompleted,
|
|
74982
|
-
update,
|
|
74983
|
-
run?.completedAt
|
|
74984
|
-
]);
|
|
74985
|
-
return {
|
|
74986
|
-
run: run ?? {},
|
|
74987
|
-
events,
|
|
74988
|
-
loading,
|
|
74989
|
-
error,
|
|
74990
|
-
update,
|
|
74991
|
-
loadMoreTraceData,
|
|
74992
|
-
hasMoreTraceData: eventsHasMore,
|
|
74993
|
-
isLoadingMoreTraceData,
|
|
74994
|
-
hasEncryptedData
|
|
74995
|
-
};
|
|
74996
|
-
}
|
|
74997
|
-
// app/lib/client/workflow-streams.ts
|
|
74998
|
-
function isServerActionError(value) {
|
|
74999
|
-
return typeof value === "object" && value !== null && "message" in value && "layer" in value && "cause" in value && "request" in value;
|
|
75000
|
-
}
|
|
75001
|
-
async function readStream(_env, streamId, runId, signal, cursor) {
|
|
75002
|
-
try {
|
|
75003
|
-
const params = new URLSearchParams({ runId });
|
|
75004
|
-
if (cursor) params.set("cursor", cursor);
|
|
75005
|
-
const url = `${apiBase()}/api/stream/${encodeURIComponent(streamId)}?${params.toString()}`;
|
|
75006
|
-
const response = await fetch(url, { signal });
|
|
75007
|
-
if (!response.ok) {
|
|
75008
|
-
const errorData = await response.json().catch(() => null);
|
|
75009
|
-
if (errorData && isServerActionError(errorData)) throw new WorkflowWebAPIError(errorData.message, {
|
|
75010
|
-
layer: "client",
|
|
75011
|
-
cause: errorData.cause,
|
|
75012
|
-
request: errorData.request
|
|
75013
|
-
});
|
|
75014
|
-
throw new WorkflowWebAPIError(`Failed to read stream: ${response.status}`, { layer: "client" });
|
|
75015
|
-
}
|
|
75016
|
-
if (!response.body) throw new WorkflowWebAPIError("Failed to read stream: no body", { layer: "client" });
|
|
75017
|
-
const responseCursor = response.headers.get("X-Stream-Cursor");
|
|
75018
|
-
const streamDone = response.headers.get("X-Stream-Done") === "true";
|
|
75019
|
-
return {
|
|
75020
|
-
body: response.body,
|
|
75021
|
-
cursor: responseCursor,
|
|
75022
|
-
done: streamDone
|
|
75023
|
-
};
|
|
75024
|
-
} catch (error) {
|
|
75025
|
-
if (error instanceof WorkflowWebAPIError) throw error;
|
|
75026
|
-
throw new WorkflowWebAPIError("Failed to read stream", {
|
|
75027
|
-
layer: "client",
|
|
75028
|
-
cause: error
|
|
75029
|
-
});
|
|
75030
|
-
}
|
|
75031
|
-
}
|
|
75032
|
-
/** List all stream IDs for a run */
|
|
75033
|
-
async function listStreams(env, runId) {
|
|
75034
|
-
return unwrapOrThrow(fetchStreams(env, runId));
|
|
75035
|
-
}
|
|
75036
|
-
// app/lib/client/hooks/use-workflow-streams.ts
|
|
75037
|
-
var STREAMS_REFRESH_INTERVAL_MS = 1e4;
|
|
75038
|
-
/**
|
|
75039
|
-
* Hook to fetch and manage stream list for a run
|
|
75040
|
-
*/
|
|
75041
|
-
function useWorkflowStreams(env, runId, refreshInterval = STREAMS_REFRESH_INTERVAL_MS) {
|
|
75042
|
-
const [streams, setStreams] = (0, import_react.useState)([]);
|
|
75043
|
-
const [loading, setLoading] = (0, import_react.useState)(true);
|
|
75044
|
-
const [error, setError] = (0, import_react.useState)(null);
|
|
75045
|
-
const hasFetchedRef = (0, import_react.useRef)(false);
|
|
75046
|
-
const fetchData = (0, import_react.useCallback)(async () => {
|
|
75047
|
-
if (!hasFetchedRef.current) setLoading(true);
|
|
75048
|
-
setError(null);
|
|
75049
|
-
try {
|
|
75050
|
-
const result = await listStreams(env, runId);
|
|
75051
|
-
setStreams(result);
|
|
75052
|
-
} catch (err) {
|
|
75053
|
-
setError(err instanceof Error ? err : new Error(String(err)));
|
|
75054
|
-
} finally {
|
|
75055
|
-
hasFetchedRef.current = true;
|
|
75056
|
-
setLoading(false);
|
|
75057
|
-
}
|
|
75058
|
-
}, [env, runId]);
|
|
75059
|
-
(0, import_react.useEffect)(() => {
|
|
75060
|
-
hasFetchedRef.current = false;
|
|
75061
|
-
fetchData();
|
|
75062
|
-
}, [fetchData]);
|
|
75063
|
-
(0, import_react.useEffect)(() => {
|
|
75064
|
-
if (!refreshInterval || refreshInterval <= 0) return;
|
|
75065
|
-
const interval = setInterval(fetchData, refreshInterval);
|
|
75066
|
-
return () => clearInterval(interval);
|
|
75067
|
-
}, [refreshInterval, fetchData]);
|
|
75068
|
-
return {
|
|
75069
|
-
streams,
|
|
75070
|
-
loading,
|
|
75071
|
-
error,
|
|
75072
|
-
refresh: fetchData
|
|
75073
|
-
};
|
|
75074
|
-
}
|
|
75075
|
-
// app/lib/client/workflow-actions.ts
|
|
75076
|
-
/** Cancel a workflow run */
|
|
75077
|
-
async function cancelRun(env, runId) {
|
|
75078
|
-
await unwrapOrThrow(cancelRun$1(env, runId));
|
|
75079
|
-
}
|
|
75080
|
-
/** Bulk-cancel workflow runs in a single operation. */
|
|
75081
|
-
async function bulkCancelRuns(env, runIds) {
|
|
75082
|
-
return unwrapOrThrow(bulkCancelRuns$1(env, runIds));
|
|
75083
|
-
}
|
|
75084
|
-
/** Start a new workflow run */
|
|
75085
|
-
async function recreateRun(env, runId) {
|
|
75086
|
-
return unwrapOrThrow(recreateRun$1(env, runId));
|
|
75087
|
-
}
|
|
75088
|
-
/** Wake up a workflow run by re-enqueuing it */
|
|
75089
|
-
async function reenqueueRun(env, runId) {
|
|
75090
|
-
await unwrapOrThrow(reenqueueRun$1(env, runId));
|
|
75091
|
-
}
|
|
75092
|
-
/** Wake up a workflow run by interrupting any pending sleep() calls */
|
|
75093
|
-
async function wakeUpRun(env, runId, options) {
|
|
75094
|
-
return unwrapOrThrow(wakeUpRun$1(env, runId, options));
|
|
75095
|
-
}
|
|
75096
|
-
/** Resume a hook by sending a JSON payload */
|
|
75097
|
-
async function resumeHook(env, token, payload) {
|
|
75098
|
-
return unwrapOrThrow(resumeHook$1(env, token, payload));
|
|
75099
|
-
}
|
|
75100
|
-
/**
|
|
75101
|
-
* Fetch a single hook's secret token on demand.
|
|
75102
|
-
*
|
|
75103
|
-
* Used by the hooks list, where rows are metadata-only: the token is fetched
|
|
75104
|
-
* one hook at a time when the user reveals/copies it or resumes the hook.
|
|
75105
|
-
*/
|
|
75106
|
-
async function fetchHookToken(env, runId, hookId) {
|
|
75107
|
-
const { token } = await unwrapOrThrow(fetchHookToken$1(env, runId, hookId));
|
|
75108
|
-
return token;
|
|
75109
|
-
}
|
|
75110
|
-
// app/components/display-utils/copyable-text.tsx
|
|
75111
|
-
function CopyableText({ text, children, className, overlay }) {
|
|
75112
|
-
const [copied, setCopied] = (0, import_react.useState)(false);
|
|
75113
|
-
const handleCopy = async (e) => {
|
|
75114
|
-
e.stopPropagation();
|
|
75115
|
-
try {
|
|
75116
|
-
await navigator.clipboard.writeText(text);
|
|
75117
|
-
setCopied(true);
|
|
75118
|
-
setTimeout(() => setCopied(false), 2e3);
|
|
75119
|
-
} catch (err) {
|
|
75120
|
-
console.error("Failed to copy text:", err);
|
|
75121
|
-
}
|
|
75122
|
-
};
|
|
75123
|
-
if (overlay) return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
|
|
75124
|
-
className: cn("relative group/copy inline-block", className),
|
|
75125
|
-
children: [children, /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Tooltip, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(TooltipTrigger, {
|
|
75126
|
-
asChild: true,
|
|
75127
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
|
|
75128
|
-
type: "button",
|
|
75129
|
-
onClick: handleCopy,
|
|
75130
|
-
className: "absolute right-0 top-1/2 -translate-y-1/2 opacity-0 group-hover/copy:opacity-100 transition-opacity bg-background/80 backdrop-blur-sm p-1 rounded",
|
|
75131
|
-
"aria-label": "Copy to clipboard",
|
|
75132
|
-
children: copied ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Check, { className: "h-3 w-3 text-muted-foreground" }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Copy, { className: "h-3 w-3 text-muted-foreground hover:text-foreground" })
|
|
75133
|
-
})
|
|
75134
|
-
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TooltipContent, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: copied ? "Copied!" : "Copy to clipboard" }) })] })]
|
|
75135
|
-
});
|
|
75136
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
75137
|
-
className: cn("flex items-center gap-2 group", className),
|
|
75138
|
-
children: [children, /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Tooltip, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(TooltipTrigger, {
|
|
75139
|
-
asChild: true,
|
|
75140
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
|
|
75141
|
-
type: "button",
|
|
75142
|
-
onClick: handleCopy,
|
|
75143
|
-
className: "opacity-0 group-hover:opacity-100 transition-opacity",
|
|
75144
|
-
"aria-label": "Copy to clipboard",
|
|
75145
|
-
children: copied ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Check, { className: "h-3 w-3 text-green-600" }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Copy, { className: "h-3 w-3 text-muted-foreground hover:text-foreground" })
|
|
75146
|
-
})
|
|
75147
|
-
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TooltipContent, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: copied ? "Copied!" : "Copy to clipboard" }) })] })]
|
|
75148
|
-
});
|
|
73208
|
+
message = decode(buffer)?.error?.message;
|
|
73209
|
+
} catch {}
|
|
73210
|
+
throw new Error(message ?? `RPC call ${method} failed: ${res.status} ${res.statusText}`);
|
|
75149
73211
|
}
|
|
75150
73212
|
// app/components/display-utils/relative-time.tsx
|
|
75151
73213
|
function RelativeTime({ date, className = "", type = "relative" }) {
|
|
@@ -75183,13 +73245,16 @@ function Skeleton({ className, ...props }) {
|
|
|
75183
73245
|
});
|
|
75184
73246
|
}
|
|
75185
73247
|
// app/lib/status-colors.ts
|
|
73248
|
+
/** One color per status, for the status badge and the status filter. */
|
|
73249
|
+
var STATUS_COLORS = {
|
|
73250
|
+
pending: "bg-gray-500",
|
|
73251
|
+
running: "bg-geist-warning",
|
|
73252
|
+
completed: "bg-geist-cyan",
|
|
73253
|
+
failed: "bg-geist-error",
|
|
73254
|
+
cancelled: "bg-gray-500"
|
|
73255
|
+
};
|
|
75186
73256
|
function getStatusColorClass(status) {
|
|
75187
|
-
|
|
75188
|
-
case "running": return "bg-geist-warning";
|
|
75189
|
-
case "completed": return "bg-geist-cyan";
|
|
75190
|
-
case "failed": return "bg-geist-error";
|
|
75191
|
-
default: return "bg-gray-500";
|
|
75192
|
-
}
|
|
73257
|
+
return STATUS_COLORS[status] ?? "bg-gray-500";
|
|
75193
73258
|
}
|
|
75194
73259
|
// app/components/display-utils/status-badge.tsx
|
|
75195
73260
|
/** Extract the error code from an unknown error value (StructuredError shape). */
|
|
@@ -75272,7 +73337,7 @@ function ErrorCodeBadge({ content, errorCode }) {
|
|
|
75272
73337
|
})] });
|
|
75273
73338
|
}
|
|
75274
73339
|
// app/components/run-actions.tsx
|
|
75275
|
-
function useRunActions({
|
|
73340
|
+
function useRunActions({ runId, runStatus, events, replayDisabledReason, callbacks }) {
|
|
75276
73341
|
const [rerunning, setRerunning] = (0, import_react.useState)(false);
|
|
75277
73342
|
const [reenqueuing, setReenqueuing] = (0, import_react.useState)(false);
|
|
75278
73343
|
const [wakingUp, setWakingUp] = (0, import_react.useState)(false);
|
|
@@ -75287,7 +73352,7 @@ function useRunActions({ env, runId, runStatus, events, replayDisabledReason, ca
|
|
|
75287
73352
|
if (rerunning || replayDisabledReason) return null;
|
|
75288
73353
|
try {
|
|
75289
73354
|
setRerunning(true);
|
|
75290
|
-
const newRunId = await recreateRun
|
|
73355
|
+
const newRunId = await unwrapOrThrow(rpc("recreateRun", { runId }));
|
|
75291
73356
|
toast.success("New run started", { description: `Run ID: ${newRunId}` });
|
|
75292
73357
|
callbacks?.onSuccess?.();
|
|
75293
73358
|
callbacks?.onNavigateToRun?.(newRunId);
|
|
@@ -75299,7 +73364,6 @@ function useRunActions({ env, runId, runStatus, events, replayDisabledReason, ca
|
|
|
75299
73364
|
setRerunning(false);
|
|
75300
73365
|
}
|
|
75301
73366
|
}, [
|
|
75302
|
-
env,
|
|
75303
73367
|
runId,
|
|
75304
73368
|
rerunning,
|
|
75305
73369
|
replayDisabledReason,
|
|
@@ -75309,7 +73373,7 @@ function useRunActions({ env, runId, runStatus, events, replayDisabledReason, ca
|
|
|
75309
73373
|
if (reenqueuing) return;
|
|
75310
73374
|
try {
|
|
75311
73375
|
setReenqueuing(true);
|
|
75312
|
-
await reenqueueRun
|
|
73376
|
+
await unwrapOrThrow(rpc("reenqueueRun", { runId }));
|
|
75313
73377
|
toast.success("Run re-enqueued", { description: "The workflow orchestration layer has been re-enqueued." });
|
|
75314
73378
|
callbacks?.onSuccess?.();
|
|
75315
73379
|
} catch (err) {
|
|
@@ -75318,7 +73382,6 @@ function useRunActions({ env, runId, runStatus, events, replayDisabledReason, ca
|
|
|
75318
73382
|
setReenqueuing(false);
|
|
75319
73383
|
}
|
|
75320
73384
|
}, [
|
|
75321
|
-
env,
|
|
75322
73385
|
runId,
|
|
75323
73386
|
reenqueuing,
|
|
75324
73387
|
callbacks
|
|
@@ -75327,7 +73390,7 @@ function useRunActions({ env, runId, runStatus, events, replayDisabledReason, ca
|
|
|
75327
73390
|
if (wakingUp) return;
|
|
75328
73391
|
try {
|
|
75329
73392
|
setWakingUp(true);
|
|
75330
|
-
const result = await wakeUpRun
|
|
73393
|
+
const result = await unwrapOrThrow(rpc("wakeUpRun", { runId }));
|
|
75331
73394
|
if (result.stoppedCount > 0) toast.success("Active sleeps cancelled", { description: `Cancelled ${result.stoppedCount} active sleep${result.stoppedCount > 1 ? "s" : ""} and resumed the run.` });
|
|
75332
73395
|
else toast.info("No active sleeps", { description: "There were no active sleep calls to cancel." });
|
|
75333
73396
|
callbacks?.onSuccess?.();
|
|
@@ -75337,7 +73400,6 @@ function useRunActions({ env, runId, runStatus, events, replayDisabledReason, ca
|
|
|
75337
73400
|
setWakingUp(false);
|
|
75338
73401
|
}
|
|
75339
73402
|
}, [
|
|
75340
|
-
env,
|
|
75341
73403
|
runId,
|
|
75342
73404
|
wakingUp,
|
|
75343
73405
|
callbacks
|
|
@@ -75350,7 +73412,7 @@ function useRunActions({ env, runId, runStatus, events, replayDisabledReason, ca
|
|
|
75350
73412
|
}
|
|
75351
73413
|
try {
|
|
75352
73414
|
setCancelling(true);
|
|
75353
|
-
await cancelRun
|
|
73415
|
+
await unwrapOrThrow(rpc("cancelRun", { runId }));
|
|
75354
73416
|
toast.success("Run cancelled");
|
|
75355
73417
|
callbacks?.onSuccess?.();
|
|
75356
73418
|
} catch (err) {
|
|
@@ -75359,7 +73421,6 @@ function useRunActions({ env, runId, runStatus, events, replayDisabledReason, ca
|
|
|
75359
73421
|
setCancelling(false);
|
|
75360
73422
|
}
|
|
75361
73423
|
}, [
|
|
75362
|
-
env,
|
|
75363
73424
|
runId,
|
|
75364
73425
|
runStatus,
|
|
75365
73426
|
cancelling,
|
|
@@ -75378,9 +73439,8 @@ function CancelSleepsTooltipContent({ hasPendingSleeps }) {
|
|
|
75378
73439
|
function ReenqueueTooltipContent() {
|
|
75379
73440
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: "Re-enqueue the workflow orchestration layer. Use this if the workflow appears stuck with no active steps. This is a no-op for healthy workflows." });
|
|
75380
73441
|
}
|
|
75381
|
-
function RunActionsDropdownItems({
|
|
73442
|
+
function RunActionsDropdownItems({ runId, runStatus, events, eventsLoading, callbacks, replayDisabledReason, stopPropagation = false }) {
|
|
75382
73443
|
const { rerunning, reenqueuing, wakingUp, cancelling, hasPendingSleeps, handleReplay, handleReenqueue, handleWakeUp, handleCancel } = useRunActions({
|
|
75383
|
-
env,
|
|
75384
73444
|
runId,
|
|
75385
73445
|
runStatus,
|
|
75386
73446
|
events,
|
|
@@ -75447,9 +73507,8 @@ function RunActionsDropdownItems({ env, runId, runStatus, events, eventsLoading,
|
|
|
75447
73507
|
})
|
|
75448
73508
|
] });
|
|
75449
73509
|
}
|
|
75450
|
-
function RunActionsButtons({
|
|
73510
|
+
function RunActionsButtons({ runId, runStatus, events, eventsLoading, loading, callbacks, replayDisabledReason, onCancelClick, onRerunClick }) {
|
|
75451
73511
|
const { reenqueuing, wakingUp, hasPendingSleeps, handleReenqueue, handleWakeUp } = useRunActions({
|
|
75452
|
-
env,
|
|
75453
73512
|
runId,
|
|
75454
73513
|
runStatus,
|
|
75455
73514
|
events,
|
|
@@ -75689,4 +73748,4 @@ function TabsContent({ className, ...props }) {
|
|
|
75689
73748
|
...props
|
|
75690
73749
|
});
|
|
75691
73750
|
}
|
|
75692
|
-
export {
|
|
73751
|
+
export { LIVE_UPDATE_INTERVAL_MS as $, PopperContent as A, deriveRunPayloadKeys as At, useCallbackRef$1 as B, ChevronRight as Bt, DropdownMenuTrigger as C, hydrateResourceIO as Ct, Portal as D, registerZstdDecoder as Dt, Presence as E, isEncryptedData as Et, FocusScopeBranchProvider as F, Ellipsis as Ft, useControllableState as G, createCollection as H, Check as Ht, useFocusScopeBranchRegistry as I, Copy as It, useComposedRefs as J, useLayoutEffect2 as K, useFocusGuards as L, CircleX as Lt, useSize as M, Zap as Mt, useId as N, X$3 as Nt, Popper as O, __vitePreload as Ot, FocusScope as P, Lock as Pt, AlertTitle as Q, DismissableLayer as R, CircleAlert as Rt, DropdownMenuItem as S, hasEncryptedFields as St, hideOthers as T, hydrateData as Tt, Primitive as U, createLucideIcon as Ut, useDirection as V, ChevronDown as Vt, createSlot as W, parseWorkflowName as Wt, Alert as X, composeEventHandlers as Y, AlertDescription as Z, unwrapOrThrow as _, DecryptButton as _t, RunActionsButtons as a, StreamViewerSkeleton as at, DropdownMenu as b, Slot$1 as bt, STATUS_COLORS as c, Qe as ct, rpc as d, ResolveHookDropdownItem as dt, cn as et, API_PATHS as f, useHookActions as ft, getErrorMessage as g, TooltipTrigger as gt, WorkflowWebAPIError as h, TooltipContent as ht, TabsTrigger as i, StreamViewer as it, createPopperScope as j, ErrorBoundary as jt, PopperAnchor as k, decrypt as kt, Skeleton as l, R as lt, STREAM_DONE_HEADER as m, Tooltip as mt, TabsContent as n, TraceViewer as nt, RunActionsDropdownItems as o, Ks as ot, STREAM_CURSOR_HEADER as p, EventListView as pt, createContextScope as q, TabsList as r, waitEventsToWaitEntity as rt, StatusBadge as s, Nt as st, Tabs as t, getPaginationDisplay as tt, RelativeTime as u, HookResolveModalWrapper as ut, unwrapServerActionResult as v, Button as vt, ReactRemoveScroll as w, hydrateResourceIOAsync as wt, DropdownMenuContent as x, getWebRevivers as xt, CopyableText as y, buttonVariants as yt, useDismissableLayerSurface as z, ChevronUp as zt };
|