@w6w/embed 0.2.11 → 0.2.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +22 -5
- package/dist/ConfirmModal-Pv2-A_3U.js +186 -0
- package/dist/ConfirmModal-Pv2-A_3U.js.map +1 -0
- package/dist/{CreateFunctionModal-D6CQLpa_.js → CreateFunctionModal-DScxp_LN.js} +2 -2
- package/dist/{CreateFunctionModal-D6CQLpa_.js.map → CreateFunctionModal-DScxp_LN.js.map} +1 -1
- package/dist/{DocumentFormModal-YauVdolr.js → DocumentFormModal-Br4s8wmi.js} +3 -3
- package/dist/{DocumentFormModal-YauVdolr.js.map → DocumentFormModal-Br4s8wmi.js.map} +1 -1
- package/dist/ImportSpecModal-Cpzp8ndt.js +251 -0
- package/dist/ImportSpecModal-Cpzp8ndt.js.map +1 -0
- package/dist/{ModelRoutesManager-BGESQahw.js → ModelRoutesManager-1Ac5wcas.js} +3 -3
- package/dist/{ModelRoutesManager-BGESQahw.js.map → ModelRoutesManager-1Ac5wcas.js.map} +1 -1
- package/dist/WorkflowEditor-CmhXHRxi.js +1109 -0
- package/dist/WorkflowEditor-CmhXHRxi.js.map +1 -0
- package/dist/apps-ItBvnWX3.js +92 -0
- package/dist/apps-ItBvnWX3.js.map +1 -0
- package/dist/chrome/DangerZone.d.ts +4 -3
- package/dist/chrome/ExecutionProfileHeader.d.ts +3 -3
- package/dist/chrome/JsonToggle.d.ts +29 -20
- package/dist/chrome/Modal.d.ts +3 -1
- package/dist/chrome/RightRail.d.ts +6 -1
- package/dist/chrome/VersionHistoryModal.d.ts +2 -0
- package/dist/chrome/index.d.ts +1 -0
- package/dist/chrome/workspace.d.ts +32 -1
- package/dist/{coerce-input-DttlcSdO.js → coerce-input-DFJ4n_wc.js} +68 -69
- package/dist/coerce-input-DFJ4n_wc.js.map +1 -0
- package/dist/{connections-D7cgXhDS.js → connections-CzsCyIxY.js} +10 -10
- package/dist/{connections-D7cgXhDS.js.map → connections-CzsCyIxY.js.map} +1 -1
- package/dist/{credentials-DaQU3Ca_.js → credentials-Cn92LGhJ.js} +4 -4
- package/dist/{credentials-DaQU3Ca_.js.map → credentials-Cn92LGhJ.js.map} +1 -1
- package/dist/data-stores-UeQvwVCa.js +170 -0
- package/dist/data-stores-UeQvwVCa.js.map +1 -0
- package/dist/document-sources-DNmBojx6.js +169 -0
- package/dist/document-sources-DNmBojx6.js.map +1 -0
- package/dist/draft/use-workflow-draft.d.ts +2 -0
- package/dist/draft.mjs +2 -2
- package/dist/editor/PublishTooltip.d.ts +7 -0
- package/dist/editor/SetupIncompleteBanner.d.ts +12 -0
- package/dist/editor/StartingStateModal.d.ts +14 -0
- package/dist/editor/WorkflowSettingsModal.d.ts +6 -1
- package/dist/editor/WorkflowVariablesEditor.d.ts +6 -0
- package/dist/editor/definition.d.ts +4 -0
- package/dist/editor/json-apply.d.ts +29 -0
- package/dist/editor/step-problems-feed.d.ts +5 -0
- package/dist/editor/types.d.ts +2 -2
- package/dist/editor-apps-DkkC7wOQ.js +152 -0
- package/dist/editor-apps-DkkC7wOQ.js.map +1 -0
- package/dist/editor-tools-BR27RGto.js +1683 -0
- package/dist/editor-tools-BR27RGto.js.map +1 -0
- package/dist/editor.mjs +1 -1
- package/dist/editors.mjs +536 -478
- package/dist/editors.mjs.map +1 -1
- package/dist/forms.mjs +3 -3
- package/dist/{rail-settings-XYGToh00.js → import-bindings-EUtxZ9Ti.js} +90 -24
- package/dist/import-bindings-EUtxZ9Ti.js.map +1 -0
- package/dist/index.mjs +138 -108
- package/dist/index.mjs.map +1 -1
- package/dist/lib/binding-problems.d.ts +5 -1
- package/dist/lib/history-query.d.ts +45 -0
- package/dist/lib/import-bindings.d.ts +89 -0
- package/dist/lib/index.d.ts +3 -0
- package/dist/lib/rail-settings.d.ts +1 -1
- package/dist/lib/setup-incomplete.d.ts +22 -0
- package/dist/lib/starting-data.d.ts +31 -0
- package/dist/lib/state-panel.d.ts +29 -0
- package/dist/lib/target-fields.d.ts +3 -15
- package/dist/lib/workflow-live-run.d.ts +84 -6
- package/dist/lib/workflow-validity.d.ts +64 -16
- package/dist/lib/workflow-variables.d.ts +1 -1
- package/dist/lib/workflow-version.d.ts +2 -0
- package/dist/lib.mjs +87 -72
- package/dist/lists/DataStoreList.d.ts +17 -0
- package/dist/lists/DataStoreView.d.ts +19 -0
- package/dist/lists/Logs.d.ts +19 -0
- package/dist/lists.d.ts +6 -0
- package/dist/lists.mjs +1255 -816
- package/dist/lists.mjs.map +1 -1
- package/dist/rail/ConnectionsTool.d.ts +2 -0
- package/dist/rail/HistoryTool.d.ts +2 -0
- package/dist/rail/StartingStateTool.d.ts +2 -0
- package/dist/rail/settings-sections.d.ts +4 -1
- package/dist/rail.mjs +1 -1
- package/dist/repos/connections.d.ts +1 -0
- package/dist/repos/constants.d.ts +12 -0
- package/dist/repos/data-stores.d.ts +84 -0
- package/dist/repos/history.d.ts +9 -0
- package/dist/repos/index.d.ts +2 -0
- package/dist/repos/spec-export.d.ts +3 -3
- package/dist/repos/spec-import.d.ts +30 -1
- package/dist/repos/step-tests.d.ts +2 -0
- package/dist/repos/webhook-listen.d.ts +35 -0
- package/dist/repos/workflows.d.ts +105 -2
- package/dist/repos.mjs +370 -328
- package/dist/repos.mjs.map +1 -1
- package/dist/setup-incomplete-BHs3Lpfy.js +199 -0
- package/dist/setup-incomplete-BHs3Lpfy.js.map +1 -0
- package/dist/{spec-export-CBbloO_n.js → spec-export-DGy5ijps.js} +72 -59
- package/dist/spec-export-DGy5ijps.js.map +1 -0
- package/dist/spec-import-SWOonsNr.js +116 -0
- package/dist/spec-import-SWOonsNr.js.map +1 -0
- package/dist/{step-tests-CivICmTq.js → step-tests-B4E4W3ly.js} +8 -7
- package/dist/step-tests-B4E4W3ly.js.map +1 -0
- package/dist/{use-callable-draft-DsALnSfF.js → use-callable-draft-DCauHt5o.js} +2 -2
- package/dist/{use-callable-draft-DsALnSfF.js.map → use-callable-draft-DCauHt5o.js.map} +1 -1
- package/dist/use-workflow-draft-l3P5KZzw.js +338 -0
- package/dist/use-workflow-draft-l3P5KZzw.js.map +1 -0
- package/dist/workflows-BZN4Hyz1.js +623 -0
- package/dist/workflows-BZN4Hyz1.js.map +1 -0
- package/package.json +4 -3
- package/src/styles.css +153 -1
- package/dist/ConfirmModal-BE-SdX-O.js +0 -185
- package/dist/ConfirmModal-BE-SdX-O.js.map +0 -1
- package/dist/ImportSpecModal-B7qd1Km2.js +0 -136
- package/dist/ImportSpecModal-B7qd1Km2.js.map +0 -1
- package/dist/WorkflowEditor-CwvmAGp2.js +0 -925
- package/dist/WorkflowEditor-CwvmAGp2.js.map +0 -1
- package/dist/apps-CboASBKr.js +0 -77
- package/dist/apps-CboASBKr.js.map +0 -1
- package/dist/coerce-input-DttlcSdO.js.map +0 -1
- package/dist/document-sources-UCwe8x77.js +0 -91
- package/dist/document-sources-UCwe8x77.js.map +0 -1
- package/dist/editor-apps-BUZWld-m.js +0 -95
- package/dist/editor-apps-BUZWld-m.js.map +0 -1
- package/dist/editor-tools-B_Lfx3kw.js +0 -1279
- package/dist/editor-tools-B_Lfx3kw.js.map +0 -1
- package/dist/rail-settings-XYGToh00.js.map +0 -1
- package/dist/spec-export-CBbloO_n.js.map +0 -1
- package/dist/spec-import-CW6R_Wk1.js +0 -469
- package/dist/spec-import-CW6R_Wk1.js.map +0 -1
- package/dist/step-tests-CivICmTq.js.map +0 -1
- package/dist/trigger-preview-DKxfjzUY.js +0 -145
- package/dist/trigger-preview-DKxfjzUY.js.map +0 -1
- package/dist/use-workflow-draft-DzAyUeA6.js +0 -316
- package/dist/use-workflow-draft-DzAyUeA6.js.map +0 -1
|
@@ -0,0 +1,623 @@
|
|
|
1
|
+
import { useQueryClient as y, useMutation as w, useQuery as g } from "@tanstack/react-query";
|
|
2
|
+
import { isTerminalRunStatus as I, path as h } from "@w6w/sdk";
|
|
3
|
+
import { u as l } from "./client-context-CX61Bgw-.js";
|
|
4
|
+
import { foldStateLog as O } from "@w6w/expr";
|
|
5
|
+
function C(t) {
|
|
6
|
+
return (t == null ? void 0 : t.nodes) ?? (t == null ? void 0 : t.steps) ?? void 0;
|
|
7
|
+
}
|
|
8
|
+
const v = "Node failed without reporting a reason.", K = "Run failed without reporting a reason.";
|
|
9
|
+
function A(t) {
|
|
10
|
+
return t === void 0 || !I(t);
|
|
11
|
+
}
|
|
12
|
+
function M(t, e) {
|
|
13
|
+
return e || t === void 0 ? !1 : !I(t);
|
|
14
|
+
}
|
|
15
|
+
const mt = [0, 1500];
|
|
16
|
+
function St(t, e, n) {
|
|
17
|
+
return t !== void 0 && I(t) && e === n;
|
|
18
|
+
}
|
|
19
|
+
function kt(t, e) {
|
|
20
|
+
return M(t, e) ? t === "queued" ? "Queued…" : "Running…" : "Run";
|
|
21
|
+
}
|
|
22
|
+
function qt(t) {
|
|
23
|
+
return t === "run_not_cancelable" ? "reconcile" : "surface";
|
|
24
|
+
}
|
|
25
|
+
function P(t, e) {
|
|
26
|
+
if (!t) return [];
|
|
27
|
+
const n = e ? Q(e) : void 0;
|
|
28
|
+
return Object.entries(t).map(([o, r]) => ({
|
|
29
|
+
...T(o, r),
|
|
30
|
+
...$(r),
|
|
31
|
+
...(n == null ? void 0 : n.get(o)) ?? {}
|
|
32
|
+
}));
|
|
33
|
+
}
|
|
34
|
+
function Q(t) {
|
|
35
|
+
const e = [...t].sort((r, i) => r.seq - i.seq), n = /* @__PURE__ */ new Map();
|
|
36
|
+
for (const r of e) {
|
|
37
|
+
if (r.nodeId === null || r.nodeId === void 0) continue;
|
|
38
|
+
const i = { path: r.path };
|
|
39
|
+
r.item !== void 0 && (i.item = r.item), r.old !== void 0 && (i.old = r.old), r.new !== void 0 && (i.new = r.new), r.warning !== void 0 && (i.warning = r.warning);
|
|
40
|
+
const a = n.get(r.nodeId) ?? { writes: [], lastSeq: r.seq };
|
|
41
|
+
a.writes.push(i), a.lastSeq = r.seq, n.set(r.nodeId, a);
|
|
42
|
+
}
|
|
43
|
+
const o = /* @__PURE__ */ new Map();
|
|
44
|
+
for (const [r, { writes: i, lastSeq: a }] of n)
|
|
45
|
+
o.set(r, { stateWrites: i, stateAfter: O(e, a) });
|
|
46
|
+
return o;
|
|
47
|
+
}
|
|
48
|
+
const U = /* @__PURE__ */ new Set([
|
|
49
|
+
"not_on_path",
|
|
50
|
+
"condition",
|
|
51
|
+
"stopped",
|
|
52
|
+
"disabled"
|
|
53
|
+
]);
|
|
54
|
+
function T(t, e) {
|
|
55
|
+
return {
|
|
56
|
+
id: t,
|
|
57
|
+
status: e.status,
|
|
58
|
+
...e.status === "skipped" && U.has(e.skipReason) ? { skipReason: e.skipReason } : {},
|
|
59
|
+
startedAt: e.startedAt,
|
|
60
|
+
finishedAt: e.finishedAt,
|
|
61
|
+
input: e.input,
|
|
62
|
+
output: e.output,
|
|
63
|
+
...Array.isArray(e.logs) && e.logs.length ? { logs: e.logs.filter((n) => typeof n == "string") } : {},
|
|
64
|
+
...e.meta !== void 0 && e.meta !== null ? { meta: e.meta } : {},
|
|
65
|
+
...D(e)
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
const W = /* @__PURE__ */ new Set(["succeeded", "failed", "running"]);
|
|
69
|
+
function $(t) {
|
|
70
|
+
if (!t || !Array.isArray(t.iterations)) return {};
|
|
71
|
+
const e = t.iterations.filter((o) => o !== null && typeof o == "object").map((o) => {
|
|
72
|
+
var u;
|
|
73
|
+
const r = o.nodes !== null && typeof o.nodes == "object" ? o.nodes : {}, i = Object.entries(r).map(([s, d]) => T(s, d)), a = typeof o.failedNodeId == "string" && o.failedNodeId !== "" ? o.failedNodeId : (u = i.find((s) => s.status === "failed")) == null ? void 0 : u.id, c = W.has(o.status) ? o.status : i.some((s) => s.status === "failed") ? "failed" : i.some((s) => s.status === "running") ? "running" : "succeeded";
|
|
74
|
+
return {
|
|
75
|
+
index: o.index,
|
|
76
|
+
status: c,
|
|
77
|
+
...a !== void 0 ? { failedNodeId: a } : {},
|
|
78
|
+
steps: i
|
|
79
|
+
};
|
|
80
|
+
}).sort((o, r) => o.index - r.index), n = (o) => typeof o == "number" && Number.isFinite(o);
|
|
81
|
+
return {
|
|
82
|
+
iterations: e,
|
|
83
|
+
...n(t.iterationsTotal) ? { iterationsTotal: t.iterationsTotal } : {},
|
|
84
|
+
...n(t.iterationsFailed) ? { iterationsFailed: t.iterationsFailed } : {},
|
|
85
|
+
...typeof t.iterationsTruncated == "boolean" ? { iterationsTruncated: t.iterationsTruncated } : {}
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
function D(t) {
|
|
89
|
+
const e = b(t.error);
|
|
90
|
+
return e ? { error: e } : t.status === "failed" ? { error: { message: v } } : {};
|
|
91
|
+
}
|
|
92
|
+
function b(t) {
|
|
93
|
+
if (t != null) {
|
|
94
|
+
if (typeof t == "string" && t !== "") return { message: t };
|
|
95
|
+
if (typeof t == "object") {
|
|
96
|
+
const e = t, n = typeof e.code == "string" ? e.code : void 0, o = typeof e.message == "string" && e.message !== "" ? e.message : n || L(t);
|
|
97
|
+
return {
|
|
98
|
+
...n !== void 0 ? { code: n } : {},
|
|
99
|
+
message: o || "Unknown error.",
|
|
100
|
+
...typeof e.phase == "string" ? { phase: e.phase } : {},
|
|
101
|
+
...typeof e.retryable == "boolean" ? { retryable: e.retryable } : {}
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
return { message: String(t) || "Unknown error." };
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
function L(t) {
|
|
108
|
+
try {
|
|
109
|
+
return JSON.stringify(t) ?? "";
|
|
110
|
+
} catch {
|
|
111
|
+
return "";
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
function vt(t, e) {
|
|
115
|
+
if (!t) return {};
|
|
116
|
+
const n = new Set(e.filter((s) => s.error !== void 0).map((s) => s.id)), o = new Set(
|
|
117
|
+
e.filter((s) => s.error !== void 0 && s.error.message !== v).map((s) => s.id)
|
|
118
|
+
), r = (t.stepErrors ?? []).map((s) => ({ e: s, id: s.nodeId ?? s.stepId ?? "" })).filter(({ id: s }) => !o.has(s)).map(({ e: s, id: d }) => ({
|
|
119
|
+
stepId: d,
|
|
120
|
+
error: b(s.error) ?? { message: v }
|
|
121
|
+
})), i = b(t.error), a = (s) => i !== void 0 && (s == null ? void 0 : s.message) === i.message && (s == null ? void 0 : s.code) === i.code;
|
|
122
|
+
let u = e.some((s) => a(s.error)) || r.some((s) => a(s.error)) ? void 0 : i;
|
|
123
|
+
return !u && t.status === "failed" && n.size === 0 && r.length === 0 && (u = { message: K }), {
|
|
124
|
+
...u ? { runError: u } : {},
|
|
125
|
+
...r.length > 0 ? { stepErrors: r } : {}
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
function j(t) {
|
|
129
|
+
var n;
|
|
130
|
+
const e = (n = t == null ? void 0 : t[t.length - 1]) == null ? void 0 : n.with;
|
|
131
|
+
if (!(e === null || typeof e != "object" || Array.isArray(e)))
|
|
132
|
+
return e;
|
|
133
|
+
}
|
|
134
|
+
async function bt(t, e, n) {
|
|
135
|
+
var o;
|
|
136
|
+
if (t) {
|
|
137
|
+
if (n)
|
|
138
|
+
try {
|
|
139
|
+
const r = (o = await n()) == null ? void 0 : o.find((i) => i.nodeId === t);
|
|
140
|
+
if (r) {
|
|
141
|
+
const i = r.input;
|
|
142
|
+
return i === null || typeof i != "object" || Array.isArray(i) ? void 0 : Object.keys(i).length > 0 ? i : void 0;
|
|
143
|
+
}
|
|
144
|
+
} catch {
|
|
145
|
+
}
|
|
146
|
+
try {
|
|
147
|
+
return j(await e(t));
|
|
148
|
+
} catch {
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
function Rt(t, e, n) {
|
|
154
|
+
const o = t.find((i) => {
|
|
155
|
+
var a;
|
|
156
|
+
return !!((a = i.uses) != null && a.app) && e(i.uses.app);
|
|
157
|
+
});
|
|
158
|
+
if (o) return { id: o.id, manual: !0 };
|
|
159
|
+
const r = t.find(
|
|
160
|
+
(i) => {
|
|
161
|
+
var a;
|
|
162
|
+
return !!((a = i.uses) != null && a.app) && n({ app: i.uses.app, ...i.uses.trigger === !0 ? { trigger: !0 } : {} });
|
|
163
|
+
}
|
|
164
|
+
);
|
|
165
|
+
return r ? { id: r.id, manual: !1 } : void 0;
|
|
166
|
+
}
|
|
167
|
+
const x = /* @__PURE__ */ new Set(["succeeded", "failed", "canceled"]);
|
|
168
|
+
function G(t) {
|
|
169
|
+
return new Promise((e) => setTimeout(e, t));
|
|
170
|
+
}
|
|
171
|
+
async function N(t, e = G) {
|
|
172
|
+
for (let n = 0; n < 600; n++) {
|
|
173
|
+
const o = await t();
|
|
174
|
+
if (x.has(o.status)) return o;
|
|
175
|
+
await e(500);
|
|
176
|
+
}
|
|
177
|
+
return t();
|
|
178
|
+
}
|
|
179
|
+
const H = {
|
|
180
|
+
status: "",
|
|
181
|
+
kind: "",
|
|
182
|
+
from: "",
|
|
183
|
+
to: "",
|
|
184
|
+
q: "",
|
|
185
|
+
offset: 0
|
|
186
|
+
}, F = 25, Y = /* @__PURE__ */ new Set([
|
|
187
|
+
"queued",
|
|
188
|
+
"running",
|
|
189
|
+
"succeeded",
|
|
190
|
+
"failed",
|
|
191
|
+
"canceled"
|
|
192
|
+
]), B = /* @__PURE__ */ new Set(["function", "endpoint", "workflow"]), J = /^\d{4}-\d{2}-\d{2}$/;
|
|
193
|
+
function m(t) {
|
|
194
|
+
if (!J.test(t)) return !1;
|
|
195
|
+
const { y: e, m: n, d: o } = R(t), r = new Date(e, n - 1, o);
|
|
196
|
+
return r.getFullYear() === e && r.getMonth() === n - 1 && r.getDate() === o;
|
|
197
|
+
}
|
|
198
|
+
function R(t) {
|
|
199
|
+
const [e, n, o] = t.split("-").map(Number);
|
|
200
|
+
return { y: e, m: n, d: o };
|
|
201
|
+
}
|
|
202
|
+
function It(t) {
|
|
203
|
+
const e = new URLSearchParams(t), n = e.get("status") ?? "", o = e.get("kind") ?? "", r = e.get("from") ?? "", i = e.get("to") ?? "", a = e.get("q") ?? "", c = e.get("offset");
|
|
204
|
+
let u = 0;
|
|
205
|
+
if (c !== null) {
|
|
206
|
+
const s = Number(c);
|
|
207
|
+
Number.isInteger(s) && s >= 0 && (u = s);
|
|
208
|
+
}
|
|
209
|
+
return {
|
|
210
|
+
status: Y.has(n) ? n : "",
|
|
211
|
+
kind: B.has(o) ? o : "",
|
|
212
|
+
from: m(r) ? r : "",
|
|
213
|
+
to: m(i) ? i : "",
|
|
214
|
+
q: a,
|
|
215
|
+
offset: u
|
|
216
|
+
};
|
|
217
|
+
}
|
|
218
|
+
function At(t) {
|
|
219
|
+
const e = new URLSearchParams();
|
|
220
|
+
t.status !== "" && e.set("status", t.status), t.kind !== "" && e.set("kind", t.kind), t.from !== "" && e.set("from", t.from), t.to !== "" && e.set("to", t.to), t.q !== "" && e.set("q", t.q), t.offset > 0 && e.set("offset", String(t.offset));
|
|
221
|
+
const n = e.toString();
|
|
222
|
+
return n === "" ? "" : `?${n}`;
|
|
223
|
+
}
|
|
224
|
+
function _(t, e, n) {
|
|
225
|
+
const o = {};
|
|
226
|
+
if ("project" in t ? (o.project = t.project, e.kind !== "" && (o.kind = e.kind)) : o.callable = t.callable, e.status !== "" && (o.status = e.status), e.from !== "" && m(e.from)) {
|
|
227
|
+
const { y: i, m: a, d: c } = R(e.from);
|
|
228
|
+
o.from = new Date(i, a - 1, c).toISOString();
|
|
229
|
+
}
|
|
230
|
+
if (e.to !== "" && m(e.to)) {
|
|
231
|
+
const { y: i, m: a, d: c } = R(e.to);
|
|
232
|
+
o.to = new Date(i, a - 1, c + 1).toISOString();
|
|
233
|
+
}
|
|
234
|
+
const r = e.q.trim();
|
|
235
|
+
return r !== "" && (o.q = r), n.paged && (o.limit = String(n.limit ?? F), e.offset > 0 && (o.offset = String(e.offset))), o;
|
|
236
|
+
}
|
|
237
|
+
const E = {
|
|
238
|
+
root: ["history"],
|
|
239
|
+
list(t, e, n) {
|
|
240
|
+
return ["history", "list", t, e, n];
|
|
241
|
+
},
|
|
242
|
+
stats(t, e) {
|
|
243
|
+
return ["history", "stats", t, e];
|
|
244
|
+
},
|
|
245
|
+
exists(t) {
|
|
246
|
+
return ["history", "exists", t];
|
|
247
|
+
},
|
|
248
|
+
detail(t, e) {
|
|
249
|
+
return ["history", "detail", t, e];
|
|
250
|
+
}
|
|
251
|
+
};
|
|
252
|
+
function V(t, e, n, o = F) {
|
|
253
|
+
return t.request({
|
|
254
|
+
method: "GET",
|
|
255
|
+
path: "/history",
|
|
256
|
+
query: _(e, n, { paged: !0, limit: o })
|
|
257
|
+
}).then((r) => r.body);
|
|
258
|
+
}
|
|
259
|
+
function Et(t, e, n) {
|
|
260
|
+
return t.request({
|
|
261
|
+
method: "GET",
|
|
262
|
+
path: "/history/stats",
|
|
263
|
+
query: _(e, n, { paged: !1 })
|
|
264
|
+
}).then((o) => o.body.stats);
|
|
265
|
+
}
|
|
266
|
+
async function z(t, e) {
|
|
267
|
+
var a, c, u;
|
|
268
|
+
const n = /* @__PURE__ */ new Map();
|
|
269
|
+
let o;
|
|
270
|
+
try {
|
|
271
|
+
const { workflow: s } = await t.console.workflows.get(e);
|
|
272
|
+
o = Array.isArray(s.nodes) ? s.nodes : [];
|
|
273
|
+
} catch {
|
|
274
|
+
return n;
|
|
275
|
+
}
|
|
276
|
+
for (const s of o) {
|
|
277
|
+
const d = (a = s.uses) == null ? void 0 : a.app, f = (c = s.uses) == null ? void 0 : c.action;
|
|
278
|
+
typeof s.id != "string" || typeof d != "string" || typeof f != "string" || n.set(s.id, { app: d, action: f, ...((u = s.uses) == null ? void 0 : u.trigger) === !0 ? { trigger: !0 } : {} });
|
|
279
|
+
}
|
|
280
|
+
const r = [...new Set([...n.values()].map((s) => s.app))].filter(
|
|
281
|
+
(s) => !s.startsWith("@w6w/")
|
|
282
|
+
), i = await Promise.all(
|
|
283
|
+
r.map(async (s) => {
|
|
284
|
+
const d = [...n.values()].some((p) => p.app === s && p.trigger), [f, k] = await Promise.all([
|
|
285
|
+
t.console.apps.get(s).catch(() => null),
|
|
286
|
+
d ? t.console.apps.getTriggers(s).catch(() => []) : Promise.resolve([])
|
|
287
|
+
]), q = /* @__PURE__ */ new Map();
|
|
288
|
+
for (const p of (f == null ? void 0 : f.actions) ?? []) q.set(`a:${p.key}`, p.title);
|
|
289
|
+
for (const p of k) q.set(`t:${p.key}`, p.title);
|
|
290
|
+
return { app: s, displayName: f == null ? void 0 : f.app.displayName, titles: q };
|
|
291
|
+
})
|
|
292
|
+
);
|
|
293
|
+
for (const s of n.values()) {
|
|
294
|
+
const d = i.find((k) => k.app === s.app);
|
|
295
|
+
if (!d) continue;
|
|
296
|
+
d.displayName && (s.appName = d.displayName);
|
|
297
|
+
const f = d.titles.get(`${s.trigger ? "t" : "a"}:${s.action}`);
|
|
298
|
+
f && (s.actionName = f);
|
|
299
|
+
}
|
|
300
|
+
return n;
|
|
301
|
+
}
|
|
302
|
+
async function Tt(t, e) {
|
|
303
|
+
if (e.kind === "workflow") {
|
|
304
|
+
const [r, i] = await Promise.all([
|
|
305
|
+
t.console.workflows.getRun(e.id),
|
|
306
|
+
z(t, e.callableId)
|
|
307
|
+
]), a = r;
|
|
308
|
+
return {
|
|
309
|
+
id: e.id,
|
|
310
|
+
kind: "workflow",
|
|
311
|
+
callableName: e.callableName,
|
|
312
|
+
status: r.status,
|
|
313
|
+
startedAt: e.startedAt,
|
|
314
|
+
finishedAt: e.finishedAt,
|
|
315
|
+
durationMs: e.durationMs,
|
|
316
|
+
input: a.input ?? a.event ?? r.variables,
|
|
317
|
+
output: r.output,
|
|
318
|
+
error: r.error,
|
|
319
|
+
rerunOf: e.rerunOf ?? null,
|
|
320
|
+
steps: P(C(r)).map((c) => {
|
|
321
|
+
const u = i.get(c.id);
|
|
322
|
+
return u ? { ...c, node: u } : c;
|
|
323
|
+
})
|
|
324
|
+
};
|
|
325
|
+
}
|
|
326
|
+
const o = (await t.request({
|
|
327
|
+
method: "GET",
|
|
328
|
+
path: `/invocations/${encodeURIComponent(e.id)}`
|
|
329
|
+
})).body.invocation;
|
|
330
|
+
return {
|
|
331
|
+
id: e.id,
|
|
332
|
+
kind: e.kind,
|
|
333
|
+
callableName: e.callableName,
|
|
334
|
+
status: o.status,
|
|
335
|
+
startedAt: o.startedAt,
|
|
336
|
+
finishedAt: o.finishedAt,
|
|
337
|
+
durationMs: o.durationMs,
|
|
338
|
+
input: o.input,
|
|
339
|
+
output: o.output,
|
|
340
|
+
error: o.error,
|
|
341
|
+
rerunOf: e.rerunOf ?? null
|
|
342
|
+
};
|
|
343
|
+
}
|
|
344
|
+
function Z(t) {
|
|
345
|
+
const e = t == null ? void 0 : t.raw, n = e == null ? void 0 : e.invocationId;
|
|
346
|
+
return typeof n == "string" ? n : void 0;
|
|
347
|
+
}
|
|
348
|
+
function X(t) {
|
|
349
|
+
return t !== null && typeof t == "object" && !Array.isArray(t) ? t : {};
|
|
350
|
+
}
|
|
351
|
+
async function tt(t, e, n) {
|
|
352
|
+
const o = encodeURIComponent(e.callableId);
|
|
353
|
+
if (e.kind === "workflow") {
|
|
354
|
+
const u = (await t.request({
|
|
355
|
+
method: "POST",
|
|
356
|
+
path: `/runs/${encodeURIComponent(e.id)}/rerun`,
|
|
357
|
+
body: { allowUnpublished: !0 }
|
|
358
|
+
})).body.runId;
|
|
359
|
+
return await N(() => t.console.workflows.getRun(u), n), u;
|
|
360
|
+
}
|
|
361
|
+
const r = await t.request({
|
|
362
|
+
method: "GET",
|
|
363
|
+
path: `/invocations/${encodeURIComponent(e.id)}`
|
|
364
|
+
}), i = X(r.body.invocation.input), a = e.kind === "function" ? { inputs: i, allowUnpublished: !0, rerunOf: e.id } : { input: i, allowUnpublished: !0, rerunOf: e.id };
|
|
365
|
+
try {
|
|
366
|
+
const u = (await t.request({
|
|
367
|
+
method: "POST",
|
|
368
|
+
path: `/${e.kind === "function" ? "functions" : "endpoints"}/${o}/invoke`,
|
|
369
|
+
body: a
|
|
370
|
+
})).body.invocationId;
|
|
371
|
+
if (typeof u != "string") throw new Error("The server did not return an invocation id.");
|
|
372
|
+
return u;
|
|
373
|
+
} catch (c) {
|
|
374
|
+
const u = Z(c);
|
|
375
|
+
if (u === void 0) throw c;
|
|
376
|
+
return u;
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
async function Nt(t, e, n = {}) {
|
|
380
|
+
const o = await tt(t, e, n.sleep);
|
|
381
|
+
return et(t, e.callableId, o);
|
|
382
|
+
}
|
|
383
|
+
async function et(t, e, n) {
|
|
384
|
+
return (await V(
|
|
385
|
+
t,
|
|
386
|
+
{ callable: e },
|
|
387
|
+
{ ...H, q: n },
|
|
388
|
+
1
|
|
389
|
+
)).executions.find((r) => r.id === n) ?? null;
|
|
390
|
+
}
|
|
391
|
+
const nt = (t) => ["workflows", t];
|
|
392
|
+
function ot(t, e) {
|
|
393
|
+
return t.workflows.list({ project: e });
|
|
394
|
+
}
|
|
395
|
+
function Ft(t, e = !0) {
|
|
396
|
+
const n = l();
|
|
397
|
+
return g({
|
|
398
|
+
queryKey: nt(t),
|
|
399
|
+
queryFn: () => ot(n, t),
|
|
400
|
+
enabled: e
|
|
401
|
+
});
|
|
402
|
+
}
|
|
403
|
+
const rt = (t) => ["workflow", t];
|
|
404
|
+
function st(t, e) {
|
|
405
|
+
return t.workflows.get(e);
|
|
406
|
+
}
|
|
407
|
+
function _t(t, e = !0) {
|
|
408
|
+
const n = l();
|
|
409
|
+
return g({
|
|
410
|
+
queryKey: rt(t),
|
|
411
|
+
queryFn: () => st(n, t),
|
|
412
|
+
enabled: e
|
|
413
|
+
});
|
|
414
|
+
}
|
|
415
|
+
function Ot(t) {
|
|
416
|
+
const e = l(), n = y();
|
|
417
|
+
return w({
|
|
418
|
+
mutationFn: (o) => t ? e.console.workflows.upsert(o, { project: t }) : Promise.reject(new Error("No project selected yet.")),
|
|
419
|
+
onSuccess: () => n.invalidateQueries({ queryKey: ["workflows"] })
|
|
420
|
+
});
|
|
421
|
+
}
|
|
422
|
+
function Ct(t) {
|
|
423
|
+
const e = l(), n = y();
|
|
424
|
+
return w({
|
|
425
|
+
mutationFn: (o) => t ? e.console.workflows.upsert(o.definition, {
|
|
426
|
+
project: t,
|
|
427
|
+
ifUnmodifiedSince: o.ifUnmodifiedSince
|
|
428
|
+
}) : Promise.reject(new Error("No project selected yet.")),
|
|
429
|
+
onSuccess: () => n.invalidateQueries({ queryKey: ["workflows"] })
|
|
430
|
+
});
|
|
431
|
+
}
|
|
432
|
+
function Kt() {
|
|
433
|
+
const t = l(), e = y();
|
|
434
|
+
return w({
|
|
435
|
+
mutationFn: (n) => t.workflows.archive(n),
|
|
436
|
+
onSuccess: () => e.invalidateQueries({ queryKey: ["workflows"] })
|
|
437
|
+
});
|
|
438
|
+
}
|
|
439
|
+
function Mt() {
|
|
440
|
+
const t = l(), e = y();
|
|
441
|
+
return w({
|
|
442
|
+
mutationFn: (n) => t.workflows.delete(n),
|
|
443
|
+
onSuccess: () => e.invalidateQueries({ queryKey: ["workflows"] })
|
|
444
|
+
});
|
|
445
|
+
}
|
|
446
|
+
const S = (t) => ["runs", t];
|
|
447
|
+
function Pt(t) {
|
|
448
|
+
const e = l();
|
|
449
|
+
return g({
|
|
450
|
+
queryKey: S(t),
|
|
451
|
+
queryFn: () => e.console.workflows.listRuns(t)
|
|
452
|
+
});
|
|
453
|
+
}
|
|
454
|
+
function it(t, e, n, o) {
|
|
455
|
+
return t.workflows.run(e, { variables: n, input: o, allowUnpublished: !0 }).then((r) => N(() => t.console.workflows.getRun(r.runId)));
|
|
456
|
+
}
|
|
457
|
+
function Qt() {
|
|
458
|
+
const t = l(), e = y();
|
|
459
|
+
return w({
|
|
460
|
+
mutationFn: (n) => it(t, n.id, n.variables, n.input),
|
|
461
|
+
onSuccess: (n, o) => e.invalidateQueries({ queryKey: S(o.id) }),
|
|
462
|
+
onSettled: () => e.invalidateQueries({ queryKey: E.root })
|
|
463
|
+
});
|
|
464
|
+
}
|
|
465
|
+
function Ut(t, e, n, o) {
|
|
466
|
+
return t.workflows.run(e, { variables: n, input: o, wait: !0 });
|
|
467
|
+
}
|
|
468
|
+
function at(t, e, n, o) {
|
|
469
|
+
return t.workflows.run(e, { variables: n, input: o, allowUnpublished: !0 }).then((r) => ({ runId: r.runId }));
|
|
470
|
+
}
|
|
471
|
+
async function ut(t, e, n, o) {
|
|
472
|
+
return { runId: (await t.request({
|
|
473
|
+
method: "POST",
|
|
474
|
+
path: h`/workflows/${e}/nodes/${n}/run`,
|
|
475
|
+
body: {
|
|
476
|
+
continue: !0,
|
|
477
|
+
stopAt: o.stopAt,
|
|
478
|
+
...o.nodes ? { state: { nodes: o.nodes } } : {},
|
|
479
|
+
...o.input ? { input: o.input } : {}
|
|
480
|
+
}
|
|
481
|
+
})).body.runId };
|
|
482
|
+
}
|
|
483
|
+
function Wt(t, e) {
|
|
484
|
+
return t.request({
|
|
485
|
+
method: "GET",
|
|
486
|
+
path: h`/workflows/${e}/node-samples`
|
|
487
|
+
}).then((n) => n.body.nodeSamples ?? []);
|
|
488
|
+
}
|
|
489
|
+
function $t(t, e) {
|
|
490
|
+
return t.request({
|
|
491
|
+
method: "GET",
|
|
492
|
+
path: h`/workflows/${e}/test-inputs`
|
|
493
|
+
}).then((n) => n.body.testInputs ?? []);
|
|
494
|
+
}
|
|
495
|
+
function Dt(t, e, n, o) {
|
|
496
|
+
return t.request({
|
|
497
|
+
method: "PUT",
|
|
498
|
+
path: h`/workflows/${e}/nodes/${n}/test-input`,
|
|
499
|
+
body: { input: o }
|
|
500
|
+
}).then(() => {
|
|
501
|
+
});
|
|
502
|
+
}
|
|
503
|
+
function Lt() {
|
|
504
|
+
const t = l(), e = y();
|
|
505
|
+
return w({
|
|
506
|
+
mutationFn: (n) => ut(t, n.id, n.nodeId, n.body),
|
|
507
|
+
onSuccess: (n, o) => e.invalidateQueries({ queryKey: S(o.id) }),
|
|
508
|
+
onSettled: () => e.invalidateQueries({ queryKey: E.root })
|
|
509
|
+
});
|
|
510
|
+
}
|
|
511
|
+
function jt() {
|
|
512
|
+
const t = l(), e = y();
|
|
513
|
+
return w({
|
|
514
|
+
mutationFn: (n) => at(t, n.id, n.variables, n.input),
|
|
515
|
+
onSuccess: (n, o) => e.invalidateQueries({ queryKey: S(o.id) }),
|
|
516
|
+
onSettled: () => e.invalidateQueries({ queryKey: E.root })
|
|
517
|
+
});
|
|
518
|
+
}
|
|
519
|
+
function ct(t, e) {
|
|
520
|
+
return t.workflows.cancel(e);
|
|
521
|
+
}
|
|
522
|
+
function xt() {
|
|
523
|
+
const t = l();
|
|
524
|
+
return w({
|
|
525
|
+
mutationFn: (e) => ct(t, e)
|
|
526
|
+
});
|
|
527
|
+
}
|
|
528
|
+
function dt(t, e) {
|
|
529
|
+
return t.console.workflows.getRun(e);
|
|
530
|
+
}
|
|
531
|
+
const lt = (t) => ["run", t];
|
|
532
|
+
function Gt(t) {
|
|
533
|
+
const e = l();
|
|
534
|
+
return g({
|
|
535
|
+
queryKey: lt(t ?? ""),
|
|
536
|
+
queryFn: () => dt(e, t),
|
|
537
|
+
enabled: t != null,
|
|
538
|
+
refetchInterval: (n) => {
|
|
539
|
+
var o;
|
|
540
|
+
return A((o = n.state.data) == null ? void 0 : o.status) ? 500 : !1;
|
|
541
|
+
}
|
|
542
|
+
});
|
|
543
|
+
}
|
|
544
|
+
function ft(t, e) {
|
|
545
|
+
return t.request({
|
|
546
|
+
method: "GET",
|
|
547
|
+
path: h`/runs/${e}/state-writes`
|
|
548
|
+
}).then((n) => ({ writes: n.body.writes ?? [], truncated: n.body.truncated === !0 }));
|
|
549
|
+
}
|
|
550
|
+
function pt(t, e) {
|
|
551
|
+
return ["run", t, "state-writes", A(e) ? "live" : "final"];
|
|
552
|
+
}
|
|
553
|
+
function Ht(t, e) {
|
|
554
|
+
const n = l(), o = A(e);
|
|
555
|
+
return g({
|
|
556
|
+
queryKey: pt(t ?? "", e),
|
|
557
|
+
queryFn: () => ft(n, t),
|
|
558
|
+
enabled: t != null,
|
|
559
|
+
refetchInterval: o ? 500 : !1,
|
|
560
|
+
retry: !1
|
|
561
|
+
});
|
|
562
|
+
}
|
|
563
|
+
export {
|
|
564
|
+
jt as $,
|
|
565
|
+
vt as A,
|
|
566
|
+
C as B,
|
|
567
|
+
lt as C,
|
|
568
|
+
pt as D,
|
|
569
|
+
H as E,
|
|
570
|
+
it as F,
|
|
571
|
+
Ut as G,
|
|
572
|
+
F as H,
|
|
573
|
+
S as I,
|
|
574
|
+
Dt as J,
|
|
575
|
+
A as K,
|
|
576
|
+
ut as L,
|
|
577
|
+
at as M,
|
|
578
|
+
St as N,
|
|
579
|
+
b as O,
|
|
580
|
+
Kt as P,
|
|
581
|
+
xt as Q,
|
|
582
|
+
K as R,
|
|
583
|
+
v as S,
|
|
584
|
+
Ot as T,
|
|
585
|
+
Mt as U,
|
|
586
|
+
Gt as V,
|
|
587
|
+
Lt as W,
|
|
588
|
+
Ht as X,
|
|
589
|
+
Qt as Y,
|
|
590
|
+
Pt as Z,
|
|
591
|
+
Ct as _,
|
|
592
|
+
mt as a,
|
|
593
|
+
_t as a0,
|
|
594
|
+
Ft as a1,
|
|
595
|
+
rt as a2,
|
|
596
|
+
nt as a3,
|
|
597
|
+
qt as b,
|
|
598
|
+
ct as c,
|
|
599
|
+
z as d,
|
|
600
|
+
At as e,
|
|
601
|
+
It as f,
|
|
602
|
+
et as g,
|
|
603
|
+
Tt as h,
|
|
604
|
+
V as i,
|
|
605
|
+
Et as j,
|
|
606
|
+
dt as k,
|
|
607
|
+
ft as l,
|
|
608
|
+
st as m,
|
|
609
|
+
Rt as n,
|
|
610
|
+
E as o,
|
|
611
|
+
_ as p,
|
|
612
|
+
M as q,
|
|
613
|
+
j as r,
|
|
614
|
+
Wt as s,
|
|
615
|
+
$t as t,
|
|
616
|
+
ot as u,
|
|
617
|
+
P as v,
|
|
618
|
+
N as w,
|
|
619
|
+
Nt as x,
|
|
620
|
+
bt as y,
|
|
621
|
+
kt as z
|
|
622
|
+
};
|
|
623
|
+
//# sourceMappingURL=workflows-BZN4Hyz1.js.map
|