@powerhousedao/workflow 6.2.3-dev.83 → 6.2.3-dev.85
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 +3 -1
- package/dist/browser/{BlockSelector-DHVzUGjW.js → BlockSelector-BKAJwJ4Y.js} +77 -8
- package/dist/browser/BlockSelector-BKAJwJ4Y.js.map +1 -0
- package/dist/browser/{PieceMarkdown-U6OUTwRi.js → PieceMarkdown-DSdZd-Jc.js} +34 -8
- package/dist/browser/PieceMarkdown-DSdZd-Jc.js.map +1 -0
- package/dist/browser/{connection-form-D2qAEHsl.js → connection-form-DltdMa8F.js} +3 -3
- package/dist/browser/{connection-form-D2qAEHsl.js.map → connection-form-DltdMa8F.js.map} +1 -1
- package/dist/browser/{data-tree-BOuPR-2J.js → data-tree-DAw8e0j8.js} +25 -12
- package/dist/browser/data-tree-DAw8e0j8.js.map +1 -0
- package/dist/browser/document-models/index.js +2 -2
- package/dist/browser/document-models/workflow/index.js +2 -2
- package/dist/browser/{document-models-DSK5cn8B.js → document-models-C2SAP1SX.js} +2 -2
- package/dist/browser/{document-models-DSK5cn8B.js.map → document-models-C2SAP1SX.js.map} +1 -1
- package/dist/{node/editor-C_eWGGi8.mjs → browser/editor--J61vLSC.js} +630 -72
- package/dist/browser/editor--J61vLSC.js.map +1 -0
- package/dist/browser/{editor-0XPrGeLT.js → editor-CZLe6CAF.js} +5 -5
- package/dist/browser/{editor-0XPrGeLT.js.map → editor-CZLe6CAF.js.map} +1 -1
- package/dist/browser/{editor--59WtNaj.js → editor-Dl6lzxkM.js} +158 -2676
- package/dist/browser/editor-Dl6lzxkM.js.map +1 -0
- package/dist/browser/editors/connection-editor/module.js +1 -1
- package/dist/browser/editors/runtime/index.js +1 -1
- package/dist/browser/editors/workflow-editor/module.js +1 -1
- package/dist/browser/editors/workflow-studio/module.js +1 -1
- package/dist/browser/index.js +3 -3
- package/dist/browser/{module-eOpxJVIl.js → module-mFCt9WHJ.js} +2 -2
- package/dist/browser/module-mFCt9WHJ.js.map +1 -0
- package/dist/browser/reactor/index.js +2 -2
- package/dist/browser/{runtime-queries-LAcyniYz.js → runtime-queries-D81Ghpok.js} +105 -4
- package/dist/browser/runtime-queries-D81Ghpok.js.map +1 -0
- package/dist/browser/trigger-text-BSVi5oGZ.js +3045 -0
- package/dist/browser/trigger-text-BSVi5oGZ.js.map +1 -0
- package/dist/browser/{upgrade-manifests-CLYUPqBs.js → upgrade-manifests-C2Qa6myy.js} +2 -2
- package/dist/browser/{upgrade-manifests-CLYUPqBs.js.map → upgrade-manifests-C2Qa6myy.js.map} +1 -1
- package/dist/browser/{workflow-Cn1UP-eJ.js → workflow-BFdnSGRD.js} +2 -2
- package/dist/browser/{workflow-Cn1UP-eJ.js.map → workflow-BFdnSGRD.js.map} +1 -1
- package/dist/node/{BlockSelector-D2UAnFpN.mjs → BlockSelector-Bcb5NJ_X.mjs} +77 -8
- package/dist/node/BlockSelector-Bcb5NJ_X.mjs.map +1 -0
- package/dist/node/{PieceMarkdown-DwpCBISY.mjs → PieceMarkdown-CUSdTMH4.mjs} +34 -8
- package/dist/node/{PieceMarkdown-DwpCBISY.mjs.map → PieceMarkdown-CUSdTMH4.mjs.map} +1 -1
- package/dist/node/{connection-form-Btmejfyn.mjs → connection-form-DF5418sz.mjs} +3 -3
- package/dist/node/{connection-form-Btmejfyn.mjs.map → connection-form-DF5418sz.mjs.map} +1 -1
- package/dist/node/{data-tree-rZiK2Ev-.mjs → data-tree-CebWVI_P.mjs} +25 -12
- package/dist/node/{data-tree-rZiK2Ev-.mjs.map → data-tree-CebWVI_P.mjs.map} +1 -1
- package/dist/node/document-models/index.mjs +2 -2
- package/dist/node/document-models/workflow/index.mjs +2 -2
- package/dist/{browser/editor-BD-5ClkW.js → node/editor-BmRWQvRs.mjs} +629 -72
- package/dist/node/editor-BmRWQvRs.mjs.map +1 -0
- package/dist/node/{editor-ChJMxbeM.mjs → editor-J0op3mM7.mjs} +5 -5
- package/dist/node/{editor-ChJMxbeM.mjs.map → editor-J0op3mM7.mjs.map} +1 -1
- package/dist/node/{editor-U6trS0QO.mjs → editor-UzRtZp-A.mjs} +276 -2793
- package/dist/node/editor-UzRtZp-A.mjs.map +1 -0
- package/dist/node/editors/connection-editor/module.mjs +1 -1
- package/dist/node/editors/runtime/index.mjs +1 -1
- package/dist/node/editors/workflow-editor/module.mjs +1 -1
- package/dist/node/editors/workflow-studio/module.mjs +1 -1
- package/dist/node/index.mjs +3 -3
- package/dist/node/{module-D9Zx5Zow.mjs → module-CuTg45ct.mjs} +2 -2
- package/dist/{browser/module-eOpxJVIl.js.map → node/module-CuTg45ct.mjs.map} +1 -1
- package/dist/node/pieces/ai/descriptor.json +1 -1
- package/dist/node/pieces/ai/package.json +1 -1
- package/dist/node/pieces/reactor/descriptor.json +1 -1
- package/dist/node/pieces/reactor/package.json +1 -1
- package/dist/node/{runtime-queries-CmrHBPRw.mjs → runtime-queries-VXJsWno5.mjs} +263 -7
- package/dist/node/runtime-queries-VXJsWno5.mjs.map +1 -0
- package/dist/node/trigger-text-BvEzEani.mjs +3045 -0
- package/dist/node/trigger-text-BvEzEani.mjs.map +1 -0
- package/dist/node/{upgrade-manifests-C4akaA_X.mjs → upgrade-manifests-BA5OaR4H.mjs} +2 -2
- package/dist/node/{upgrade-manifests-C4akaA_X.mjs.map → upgrade-manifests-BA5OaR4H.mjs.map} +1 -1
- package/dist/node/{workflow-DqF9VsBQ.mjs → workflow-BgURVzdc.mjs} +2 -2
- package/dist/node/{workflow-DqF9VsBQ.mjs.map → workflow-BgURVzdc.mjs.map} +1 -1
- package/dist/powerhouse.manifest.json +2 -2
- package/dist/style.css +1 -1
- package/dist/types/document-models/workflow/v1/gen/schema/types.d.ts +1 -1
- package/dist/types/document-models/workflow/v1/gen/schema/types.d.ts.map +1 -1
- package/dist/types/editors/shared/controls.d.ts.map +1 -1
- package/dist/types/editors/shared/data-tree.d.ts.map +1 -1
- package/dist/types/editors/shared/icons.d.ts +1 -0
- package/dist/types/editors/shared/icons.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/editor.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/runtime-client.d.ts +39 -0
- package/dist/types/editors/workflow-editor/runtime-client.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/runtime-context.d.ts +10 -1
- package/dist/types/editors/workflow-editor/runtime-context.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/runtime-queries.d.ts +21 -1
- package/dist/types/editors/workflow-editor/runtime-queries.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/ui/BlockSelector.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/ui/PieceMarkdown.d.ts +2 -1
- package/dist/types/editors/workflow-editor/ui/PieceMarkdown.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/ui/PropertyForm.d.ts +4 -0
- package/dist/types/editors/workflow-editor/ui/PropertyForm.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/ui/block-meta.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/ui/blocks.d.ts +4 -0
- package/dist/types/editors/workflow-editor/ui/blocks.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/ui/manual-inputs.d.ts +7 -0
- package/dist/types/editors/workflow-editor/ui/manual-inputs.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/ui/manual-inputs.test.d.ts +2 -0
- package/dist/types/editors/workflow-editor/ui/manual-inputs.test.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/ui/query-keys.d.ts +9 -0
- package/dist/types/editors/workflow-editor/ui/query-keys.d.ts.map +1 -1
- package/dist/types/editors/workflow-studio/components/RunDialog.d.ts +7 -0
- package/dist/types/editors/workflow-studio/components/RunDialog.d.ts.map +1 -0
- package/dist/types/editors/workflow-studio/components/RunsTable.d.ts.map +1 -1
- package/dist/types/editors/workflow-studio/components/RunsView.d.ts +3 -1
- package/dist/types/editors/workflow-studio/components/RunsView.d.ts.map +1 -1
- package/dist/types/editors/workflow-studio/components/Sidebar.d.ts +3 -0
- package/dist/types/editors/workflow-studio/components/Sidebar.d.ts.map +1 -1
- package/dist/types/editors/workflow-studio/components/Waitpoints.d.ts +49 -0
- package/dist/types/editors/workflow-studio/components/Waitpoints.d.ts.map +1 -0
- package/dist/types/editors/workflow-studio/components/WorkflowBoard.d.ts +3 -0
- package/dist/types/editors/workflow-studio/components/WorkflowBoard.d.ts.map +1 -1
- package/dist/types/editors/workflow-studio/components/WorkflowStudio.d.ts.map +1 -1
- package/dist/types/editors/workflow-studio/components/run-dialog.test.d.ts +2 -0
- package/dist/types/editors/workflow-studio/components/run-dialog.test.d.ts.map +1 -0
- package/dist/types/editors/workflow-studio/components/run-format.d.ts +2 -1
- package/dist/types/editors/workflow-studio/components/run-format.d.ts.map +1 -1
- package/dist/types/editors/workflow-studio/components/waitpoints-view.test.d.ts +2 -0
- package/dist/types/editors/workflow-studio/components/waitpoints-view.test.d.ts.map +1 -0
- package/dist/types/editors/workflow-studio/components/waitpoints.test.d.ts +2 -0
- package/dist/types/editors/workflow-studio/components/waitpoints.test.d.ts.map +1 -0
- package/dist/types/test/graphql-server.d.ts +9 -0
- package/dist/types/test/graphql-server.d.ts.map +1 -0
- package/dist/types/test/ui/manual-inputs.spec.d.ts +2 -0
- package/dist/types/test/ui/manual-inputs.spec.d.ts.map +1 -0
- package/dist/types/test/waitpoint-record.d.ts +3 -0
- package/dist/types/test/waitpoint-record.d.ts.map +1 -0
- package/dist/workflow.css +2 -0
- package/package.json +9 -9
- package/dist/browser/BlockSelector-DHVzUGjW.js.map +0 -1
- package/dist/browser/PieceMarkdown-U6OUTwRi.js.map +0 -1
- package/dist/browser/data-tree-BOuPR-2J.js.map +0 -1
- package/dist/browser/editor--59WtNaj.js.map +0 -1
- package/dist/browser/editor-BD-5ClkW.js.map +0 -1
- package/dist/browser/runtime-queries-LAcyniYz.js.map +0 -1
- package/dist/browser/trigger-text-Co-dn9x-.js +0 -513
- package/dist/browser/trigger-text-Co-dn9x-.js.map +0 -1
- package/dist/node/BlockSelector-D2UAnFpN.mjs.map +0 -1
- package/dist/node/editor-C_eWGGi8.mjs.map +0 -1
- package/dist/node/editor-U6trS0QO.mjs.map +0 -1
- package/dist/node/module-D9Zx5Zow.mjs.map +0 -1
- package/dist/node/runtime-queries-CmrHBPRw.mjs.map +0 -1
- package/dist/node/trigger-text-CAiRCG2X.mjs +0 -512
- package/dist/node/trigger-text-CAiRCG2X.mjs.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@powerhousedao/piece-ai",
|
|
3
|
-
"version": "6.2.3-dev.
|
|
3
|
+
"version": "6.2.3-dev.85",
|
|
4
4
|
"displayName": "AI",
|
|
5
5
|
"logoUrl": "data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20114%20114%22%3E%3Cpath%20fill%3D%22%23161616%22%20fill-rule%3D%22evenodd%22%20d%3D%22M15.2%200H98.8C107.195%200%20114%206.805%20114%2015.2V98.8C114%20107.195%20107.195%20114%2098.8%20114H15.2C6.805%20114%200%20107.195%200%2098.8V15.2C0%206.805%206.805%200%2015.2%200ZM25.5%2082L42%2032H53L69.5%2082H58.5L55%2071H40L36.5%2082ZM43%2061H52L47.5%2046.5ZM77.5%2032H88.5V82H77.5Z%22%2F%3E%3C%2Fsvg%3E",
|
|
6
6
|
"actions": {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@powerhousedao/piece-ai",
|
|
3
|
-
"version": "6.2.3-dev.
|
|
3
|
+
"version": "6.2.3-dev.85",
|
|
4
4
|
"description": "Call AI models from OpenAI, Anthropic, Google or TypeSafe, or any OpenAI-compatible server such as Ollama, vLLM or OpenRouter.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "index.mjs",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@powerhousedao/piece-reactor",
|
|
3
|
-
"version": "6.2.3-dev.
|
|
3
|
+
"version": "6.2.3-dev.85",
|
|
4
4
|
"displayName": "Powerhouse Reactor",
|
|
5
5
|
"logoUrl": "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMTQgMTE0IiBmaWxsPSJub25lIj48cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZmlsbD0iIzE2MTYxNiIgZD0iTTcxLjI5MTkgMEwyNC4zNDE1IDM4Ljg3NzJDMTcuNDU0OCA0NC41Nzk4IDE2Ljk1MzkgNTQuOTY1OSAyMy4yNiA2MS4zMDQ3TDM5LjUwMjggNzcuNjMxOEM0NC4yNjg0IDgyLjQyMjEgNDUuMjk5NiA4OS43ODM0IDQyLjAzMzUgOTUuNjk4OEwzMS45MjkgMTE0SDE1LjJDNi44MDUyNyAxMTQgMCAxMDcuMTk1IDAgOTguOFYxNS4yQzAgNi44MDUyNyA2LjgwNTI3IDAgMTUuMiAwSDcxLjI5MTlaTTgwLjExMSAwTDcxLjM0MTIgMTUuOTc1OEM2OC4xMDc4IDIxLjg2NiA2OS4xMjU1IDI5LjE4MDQgNzMuODQ0MSAzMy45NjQxTDkxLjA3NTEgNTEuNDMzMUM5Ny4zNjc0IDU3LjgxMjQgOTYuODA0NCA2OC4yMjI3IDg5Ljg2MDcgNzMuODg2MUw0MC42NzgyIDExNEg5OC44QzEwNy4xOTUgMTE0IDExNCAxMDcuMTk1IDExNCA5OC44VjE1LjJDMTE0IDYuODA1MjcgMTA3LjE5NSAwIDk4LjggMEg4MC4xMTFaIi8+PC9zdmc+",
|
|
6
6
|
"actions": {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@powerhousedao/piece-reactor",
|
|
3
|
-
"version": "6.2.3-dev.
|
|
3
|
+
"version": "6.2.3-dev.85",
|
|
4
4
|
"description": "Read and write Powerhouse documents on the reactor this workflow runs in: create documents, dispatch actions, read state, schemas and indexes, and fire on document events.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "index.mjs",
|
|
@@ -33,7 +33,7 @@ var ScheduleConfigError = class extends Error {
|
|
|
33
33
|
}
|
|
34
34
|
};
|
|
35
35
|
const CRON_FIELD = /^[\d*?A-Za-z]+(?:[-/][\dA-Za-z]+)*(?:,[\d*?A-Za-z]+(?:[-/][\dA-Za-z]+)*)*$/;
|
|
36
|
-
function isRecord(value) {
|
|
36
|
+
function isRecord$1(value) {
|
|
37
37
|
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
38
38
|
}
|
|
39
39
|
function parseTimezone(value) {
|
|
@@ -67,7 +67,7 @@ function parseInterval(record) {
|
|
|
67
67
|
};
|
|
68
68
|
}
|
|
69
69
|
function parseScheduleConfig(config) {
|
|
70
|
-
if (!isRecord(config)) throw new ScheduleConfigError("the config must be an object");
|
|
70
|
+
if (!isRecord$1(config)) throw new ScheduleConfigError("the config must be an object");
|
|
71
71
|
const timezone = parseTimezone(config.timezone);
|
|
72
72
|
if (config.mode === "cron") return {
|
|
73
73
|
mode: "cron",
|
|
@@ -102,9 +102,13 @@ const BRANCH_PORTS = [
|
|
|
102
102
|
"false",
|
|
103
103
|
ERROR_PORT
|
|
104
104
|
];
|
|
105
|
+
const STOP_PORTS = [ERROR_PORT];
|
|
105
106
|
function knownPorts(block) {
|
|
106
107
|
if (block.kind === "trigger") return TRIGGER_PORTS;
|
|
107
|
-
|
|
108
|
+
if (block.pieceName !== "@powerhousedao/piece-core") return PIECE_ACTION_PORTS;
|
|
109
|
+
if (block.name === "branch") return BRANCH_PORTS;
|
|
110
|
+
if (block.name === "stop") return STOP_PORTS;
|
|
111
|
+
return PIECE_ACTION_PORTS;
|
|
108
112
|
}
|
|
109
113
|
const DOCUMENT_REF_KEY = "$documentRef";
|
|
110
114
|
const MAX_DEPTH = 64;
|
|
@@ -155,6 +159,157 @@ function expandDocumentRefs(value, expand) {
|
|
|
155
159
|
};
|
|
156
160
|
}, 0, /* @__PURE__ */ new WeakSet());
|
|
157
161
|
}
|
|
162
|
+
const MANUAL_INPUT_TYPES = [
|
|
163
|
+
"text",
|
|
164
|
+
"text_area",
|
|
165
|
+
"number",
|
|
166
|
+
"toggle",
|
|
167
|
+
"date",
|
|
168
|
+
"dropdown",
|
|
169
|
+
"json"
|
|
170
|
+
];
|
|
171
|
+
var ManualPayloadError = class extends Error {
|
|
172
|
+
fields;
|
|
173
|
+
constructor(fields) {
|
|
174
|
+
super(`Manual trigger payload: ${fields.map((entry) => entry.field ? `"${entry.field}" ${entry.message}` : entry.message).join("; ")}`);
|
|
175
|
+
this.name = "ManualPayloadError";
|
|
176
|
+
this.fields = fields;
|
|
177
|
+
}
|
|
178
|
+
};
|
|
179
|
+
function isRecord(value) {
|
|
180
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
181
|
+
}
|
|
182
|
+
const text = (value) => typeof value === "string" && value.trim() !== "" ? value.trim() : void 0;
|
|
183
|
+
function defaultText(value) {
|
|
184
|
+
if (value === void 0 || value === null || value === "") return void 0;
|
|
185
|
+
if (typeof value === "string") return value;
|
|
186
|
+
if (typeof value === "object") return JSON.stringify(value);
|
|
187
|
+
return String(value);
|
|
188
|
+
}
|
|
189
|
+
function parseManualOptions(value) {
|
|
190
|
+
const entries = Array.isArray(value) ? value.map(optionEntry) : typeof value === "string" ? value.split(/\r?\n/).map(optionLine) : [];
|
|
191
|
+
const byValue = /* @__PURE__ */ new Map();
|
|
192
|
+
for (const entry of entries) if (entry && !byValue.has(entry.value)) byValue.set(entry.value, entry);
|
|
193
|
+
return [...byValue.values()];
|
|
194
|
+
}
|
|
195
|
+
function optionLine(line) {
|
|
196
|
+
const at = line.indexOf(" = ");
|
|
197
|
+
const value = (at < 0 ? line : line.slice(at + 3)).trim();
|
|
198
|
+
if (value === "") return void 0;
|
|
199
|
+
const label = at < 0 ? value : line.slice(0, at).trim();
|
|
200
|
+
return {
|
|
201
|
+
label: label === "" ? value : label,
|
|
202
|
+
value
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
function optionEntry(entry) {
|
|
206
|
+
if (!isRecord(entry)) return optionLine(String(entry));
|
|
207
|
+
const value = defaultText(entry.value)?.trim();
|
|
208
|
+
if (!value) return void 0;
|
|
209
|
+
return {
|
|
210
|
+
label: text(entry.label) ?? value,
|
|
211
|
+
value
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
function parseManualInputs(config) {
|
|
215
|
+
const rows = isRecord(config) ? config.inputs : void 0;
|
|
216
|
+
if (!Array.isArray(rows)) return [];
|
|
217
|
+
const byName = /* @__PURE__ */ new Map();
|
|
218
|
+
for (const row of rows) {
|
|
219
|
+
if (!isRecord(row)) continue;
|
|
220
|
+
const name = text(row.name);
|
|
221
|
+
const type = row.type;
|
|
222
|
+
if (!name || !MANUAL_INPUT_TYPES.includes(type)) continue;
|
|
223
|
+
const description = text(row.description);
|
|
224
|
+
const defaultValue = defaultText(row.defaultValue);
|
|
225
|
+
byName.delete(name);
|
|
226
|
+
byName.set(name, {
|
|
227
|
+
name,
|
|
228
|
+
displayName: text(row.displayName) ?? name,
|
|
229
|
+
type,
|
|
230
|
+
required: row.required === true,
|
|
231
|
+
...description ? { description } : {},
|
|
232
|
+
...defaultValue !== void 0 ? { defaultValue } : {},
|
|
233
|
+
...type === "dropdown" ? { options: parseManualOptions(row.options) } : {}
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
return [...byName.values()];
|
|
237
|
+
}
|
|
238
|
+
const ISO_DATE = /^\d{4}-\d{2}-\d{2}(?:[T ][\d:.]+(?:Z|[+-]\d{2}:?\d{2})?)?$/;
|
|
239
|
+
function coerceManualValue(input, raw) {
|
|
240
|
+
switch (input.type) {
|
|
241
|
+
case "text":
|
|
242
|
+
case "text_area":
|
|
243
|
+
if (typeof raw === "string") return { value: raw };
|
|
244
|
+
if (typeof raw === "number" || typeof raw === "boolean") return { value: String(raw) };
|
|
245
|
+
return { error: "must be text" };
|
|
246
|
+
case "number": {
|
|
247
|
+
if (typeof raw === "number" && Number.isFinite(raw)) return { value: raw };
|
|
248
|
+
const parsed = typeof raw === "string" && raw.trim() !== "" ? Number(raw) : NaN;
|
|
249
|
+
return Number.isFinite(parsed) ? { value: parsed } : { error: "must be a number" };
|
|
250
|
+
}
|
|
251
|
+
case "toggle":
|
|
252
|
+
if (typeof raw === "boolean") return { value: raw };
|
|
253
|
+
if (typeof raw === "string" && /^(true|false)$/i.test(raw.trim())) return { value: raw.trim().toLowerCase() === "true" };
|
|
254
|
+
return { error: "must be true or false" };
|
|
255
|
+
case "date": {
|
|
256
|
+
const value = typeof raw === "string" ? raw.trim() : "";
|
|
257
|
+
const time = ISO_DATE.test(value) ? Date.parse(value) : NaN;
|
|
258
|
+
return Number.isNaN(time) ? { error: "must be an ISO 8601 date" } : { value: new Date(time).toISOString() };
|
|
259
|
+
}
|
|
260
|
+
case "dropdown": {
|
|
261
|
+
const value = typeof raw === "string" || typeof raw === "number" ? String(raw) : "";
|
|
262
|
+
const values = (input.options ?? []).map((option) => option.value);
|
|
263
|
+
if (values.length === 0 ? value !== "" : values.includes(value)) return { value };
|
|
264
|
+
return values.length > 0 ? { error: `must be one of ${values.map((v) => `"${v}"`).join(", ")}` } : { error: "must be text" };
|
|
265
|
+
}
|
|
266
|
+
case "json": return { value: raw };
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
function manualDefault(input) {
|
|
270
|
+
if (input.defaultValue === void 0) return void 0;
|
|
271
|
+
if (input.type === "json") try {
|
|
272
|
+
return JSON.parse(input.defaultValue);
|
|
273
|
+
} catch {
|
|
274
|
+
return input.defaultValue;
|
|
275
|
+
}
|
|
276
|
+
if (input.type === "dropdown") {
|
|
277
|
+
const options = input.options ?? [];
|
|
278
|
+
const match = options.find((option) => option.value === input.defaultValue) ?? options.find((option) => option.label === input.defaultValue);
|
|
279
|
+
if (match) return match.value;
|
|
280
|
+
}
|
|
281
|
+
const coerced = coerceManualValue(input, input.defaultValue);
|
|
282
|
+
return "value" in coerced ? coerced.value : void 0;
|
|
283
|
+
}
|
|
284
|
+
const isMissing = (value) => value === void 0 || value === null || value === "";
|
|
285
|
+
function coerceManualPayload(inputs, payload) {
|
|
286
|
+
if (payload !== void 0 && payload !== null && !isRecord(payload)) throw new ManualPayloadError([{
|
|
287
|
+
field: "",
|
|
288
|
+
message: "must be a JSON object"
|
|
289
|
+
}]);
|
|
290
|
+
const next = { ...payload };
|
|
291
|
+
const errors = [];
|
|
292
|
+
for (const input of inputs) {
|
|
293
|
+
let raw = next[input.name];
|
|
294
|
+
if (isMissing(raw)) raw = manualDefault(input);
|
|
295
|
+
if (isMissing(raw)) {
|
|
296
|
+
delete next[input.name];
|
|
297
|
+
if (input.required) errors.push({
|
|
298
|
+
field: input.name,
|
|
299
|
+
message: "is required"
|
|
300
|
+
});
|
|
301
|
+
continue;
|
|
302
|
+
}
|
|
303
|
+
const coerced = coerceManualValue(input, raw);
|
|
304
|
+
if ("error" in coerced) errors.push({
|
|
305
|
+
field: input.name,
|
|
306
|
+
message: coerced.error
|
|
307
|
+
});
|
|
308
|
+
else next[input.name] = coerced.value;
|
|
309
|
+
}
|
|
310
|
+
if (errors.length > 0) throw new ManualPayloadError(errors);
|
|
311
|
+
return next;
|
|
312
|
+
}
|
|
158
313
|
//#endregion
|
|
159
314
|
//#region editors/workflow-editor/ui/blocks.ts
|
|
160
315
|
const CORE_PIECE = CORE_PIECE_NAME;
|
|
@@ -169,6 +324,10 @@ const SCHEDULE_TRIGGER = core("trigger", "schedule");
|
|
|
169
324
|
const WEBHOOK_TRIGGER = core("trigger", "webhook");
|
|
170
325
|
const BRANCH_BLOCK = core("action", "branch");
|
|
171
326
|
const ASSERT_BLOCK = core("action", "assert");
|
|
327
|
+
const DELAY_BLOCK = core("action", "delay");
|
|
328
|
+
const APPROVAL_BLOCK = core("action", "approval");
|
|
329
|
+
const STOP_BLOCK = core("action", "stop");
|
|
330
|
+
const WAIT_FOR_WEBHOOK_BLOCK = core("action", "waitForWebhook");
|
|
172
331
|
function sameBlock(a, b) {
|
|
173
332
|
return Boolean(a && b && blockKey(a) === blockKey(b));
|
|
174
333
|
}
|
|
@@ -293,6 +452,46 @@ const STEP_PRESETS = [
|
|
|
293
452
|
allowValues: []
|
|
294
453
|
}
|
|
295
454
|
},
|
|
455
|
+
{
|
|
456
|
+
label: "Delay",
|
|
457
|
+
block: DELAY_BLOCK,
|
|
458
|
+
group: "core",
|
|
459
|
+
description: "Waits for a while, or until a date, then carries on.",
|
|
460
|
+
defaultConfig: {
|
|
461
|
+
mode: "for",
|
|
462
|
+
amount: 5,
|
|
463
|
+
unit: "minutes"
|
|
464
|
+
}
|
|
465
|
+
},
|
|
466
|
+
{
|
|
467
|
+
label: "Request approval",
|
|
468
|
+
block: APPROVAL_BLOCK,
|
|
469
|
+
group: "core",
|
|
470
|
+
description: "Waits until someone approves or rejects the run.",
|
|
471
|
+
defaultConfig: {
|
|
472
|
+
title: "",
|
|
473
|
+
approveLabel: "Approve",
|
|
474
|
+
rejectLabel: "Reject",
|
|
475
|
+
reasonRequiredOn: "none"
|
|
476
|
+
}
|
|
477
|
+
},
|
|
478
|
+
{
|
|
479
|
+
label: "Respond and wait for webhook",
|
|
480
|
+
block: WAIT_FOR_WEBHOOK_BLOCK,
|
|
481
|
+
group: "core",
|
|
482
|
+
description: "Answers the caller with a resume URL, then waits until it is called.",
|
|
483
|
+
defaultConfig: {
|
|
484
|
+
responseType: "json",
|
|
485
|
+
includeResumeUrl: true
|
|
486
|
+
}
|
|
487
|
+
},
|
|
488
|
+
{
|
|
489
|
+
label: "Stop run",
|
|
490
|
+
block: STOP_BLOCK,
|
|
491
|
+
group: "core",
|
|
492
|
+
description: "Ends the run successfully, optionally answering the caller.",
|
|
493
|
+
defaultConfig: { responseType: "json" }
|
|
494
|
+
},
|
|
296
495
|
{
|
|
297
496
|
label: "Create document",
|
|
298
497
|
block: reactor("action", "document-create"),
|
|
@@ -617,11 +816,15 @@ async function blockResolutions(t, workflowId) {
|
|
|
617
816
|
}
|
|
618
817
|
}`, { workflowId })).workflowRuntime.blockResolutions;
|
|
619
818
|
}
|
|
819
|
+
const WAITPOINT_FIELDS = `id runId workflowId stepId stepKey stepPath pieceName
|
|
820
|
+
blockName type kind status createdAt resumeAt expiresAt resolvedAt decidedBy
|
|
821
|
+
approval { title body approveLabel rejectLabel reasonRequiredOn approvers }`;
|
|
620
822
|
const RUN_ROW_FIELDS = `id workflowId workflowName workflowVersion triggerKind
|
|
621
823
|
triggerPayload status error errorName startedAt endedAt rerunOf warningNotes`;
|
|
622
824
|
const STEP_ROW_FIELDS = "stepId stepKey pieceName blockName status port error errorName startedAt endedAt";
|
|
623
825
|
const RUN_FIELDS = `${RUN_ROW_FIELDS} steps { ${STEP_ROW_FIELDS} input output }`;
|
|
624
826
|
const RUN_LIST_FIELDS = `${RUN_ROW_FIELDS} steps { ${STEP_ROW_FIELDS} }`;
|
|
827
|
+
const RUN_DETAIL_FIELDS = `${RUN_FIELDS} waitpoints { ${WAITPOINT_FIELDS} }`;
|
|
625
828
|
function scopeVariables(scope, limit) {
|
|
626
829
|
return {
|
|
627
830
|
workflowId: scope.workflowId ?? null,
|
|
@@ -652,7 +855,33 @@ async function fetchRunsPage(t, scope = {}, cursor = null) {
|
|
|
652
855
|
})).workflowRuntime.runsPage;
|
|
653
856
|
}
|
|
654
857
|
async function fetchRun(t, runId) {
|
|
655
|
-
return (await t.gql(`query Run($id: String!) { workflowRuntime { run(id: $id) { ${
|
|
858
|
+
return (await t.gql(`query Run($id: String!) { workflowRuntime { run(id: $id) { ${RUN_DETAIL_FIELDS} } } }`, { id: runId })).workflowRuntime.run;
|
|
859
|
+
}
|
|
860
|
+
async function fetchWaitingRuns(t, scope = {}) {
|
|
861
|
+
return (await t.gql(`query WaitingRuns($driveId: String, $workflowId: String, $first: Int) {
|
|
862
|
+
workflowRuntime {
|
|
863
|
+
waitingRuns(driveId: $driveId, workflowId: $workflowId, first: $first) {
|
|
864
|
+
${RUN_LIST_FIELDS} waitpoints { ${WAITPOINT_FIELDS} }
|
|
865
|
+
}
|
|
866
|
+
}
|
|
867
|
+
}`, {
|
|
868
|
+
driveId: scope.driveId ?? null,
|
|
869
|
+
workflowId: scope.workflowId ?? null,
|
|
870
|
+
first: scope.first ?? null
|
|
871
|
+
})).workflowRuntime.waitingRuns;
|
|
872
|
+
}
|
|
873
|
+
async function resolveWaitpoint(t, waitpointId, approved, reason) {
|
|
874
|
+
return (await t.gql(`mutation ResolveWaitpoint($waitpointId: String!, $approved: Boolean!, $reason: String) {
|
|
875
|
+
workflowRuntime {
|
|
876
|
+
resolveWaitpoint(waitpointId: $waitpointId, approved: $approved, reason: $reason) {
|
|
877
|
+
${WAITPOINT_FIELDS}
|
|
878
|
+
}
|
|
879
|
+
}
|
|
880
|
+
}`, {
|
|
881
|
+
waitpointId,
|
|
882
|
+
approved,
|
|
883
|
+
reason: reason ?? null
|
|
884
|
+
})).workflowRuntime.resolveWaitpoint;
|
|
656
885
|
}
|
|
657
886
|
async function fireWorkflow(t, workflowId, payload) {
|
|
658
887
|
return (await t.gql(`mutation Fire($workflowId: String!, $payload: Unknown) {
|
|
@@ -667,6 +896,11 @@ async function rerunRun(t, runId) {
|
|
|
667
896
|
workflowRuntime { rerun(runId: $runId) { runId status error } }
|
|
668
897
|
}`, { runId })).workflowRuntime.rerun;
|
|
669
898
|
}
|
|
899
|
+
async function cancelRun(t, runId) {
|
|
900
|
+
return (await t.gql(`mutation CancelRun($runId: String!) {
|
|
901
|
+
workflowRuntime { cancelRun(runId: $runId) { runId status error } }
|
|
902
|
+
}`, { runId })).workflowRuntime.cancelRun;
|
|
903
|
+
}
|
|
670
904
|
async function loadBlockOptions(t, block, propName, input, connectionId, searchValue, reactorConnectionId) {
|
|
671
905
|
return (await t.gql(`query Options($block: BlockInput!, $propName: String!, $input: Unknown, $connectionId: String, $searchValue: String, $reactorConnectionId: String) {
|
|
672
906
|
workflowRuntime { blockOptions(block: $block, propName: $propName, input: $input, connectionId: $connectionId, searchValue: $searchValue, reactorConnectionId: $reactorConnectionId) }
|
|
@@ -706,8 +940,11 @@ const operations = {
|
|
|
706
940
|
fetchRuns,
|
|
707
941
|
fetchRunsPage,
|
|
708
942
|
fetchRun,
|
|
943
|
+
fetchWaitingRuns,
|
|
709
944
|
fireWorkflow,
|
|
710
945
|
rerunRun,
|
|
946
|
+
resolveWaitpoint,
|
|
947
|
+
cancelRun,
|
|
711
948
|
loadBlockOptions
|
|
712
949
|
};
|
|
713
950
|
function createRuntimeClient(url, options = {}) {
|
|
@@ -2513,6 +2750,16 @@ const runtimeKeys = {
|
|
|
2513
2750
|
limit: runsScope.limit ?? null
|
|
2514
2751
|
}
|
|
2515
2752
|
],
|
|
2753
|
+
waitingRuns: (scope, waiting) => [
|
|
2754
|
+
scope,
|
|
2755
|
+
"runs",
|
|
2756
|
+
"waiting",
|
|
2757
|
+
{
|
|
2758
|
+
driveId: waiting.driveId ?? null,
|
|
2759
|
+
workflowId: waiting.workflowId ?? null,
|
|
2760
|
+
first: waiting.first ?? null
|
|
2761
|
+
}
|
|
2762
|
+
],
|
|
2516
2763
|
run: (scope, runId) => [
|
|
2517
2764
|
scope,
|
|
2518
2765
|
"run",
|
|
@@ -2618,7 +2865,16 @@ function runsOfPages(pages) {
|
|
|
2618
2865
|
return true;
|
|
2619
2866
|
});
|
|
2620
2867
|
}
|
|
2621
|
-
const
|
|
2868
|
+
const waitingRunsQuery = (client, scope) => queryOptions({
|
|
2869
|
+
queryKey: runtimeKeys.waitingRuns(client.url, scope),
|
|
2870
|
+
queryFn: () => client.fetchWaitingRuns(scope),
|
|
2871
|
+
staleTime: 0
|
|
2872
|
+
});
|
|
2873
|
+
const FINISHED = /* @__PURE__ */ new Set([
|
|
2874
|
+
"SUCCEEDED",
|
|
2875
|
+
"FAILED",
|
|
2876
|
+
"CANCELLED"
|
|
2877
|
+
]);
|
|
2622
2878
|
const runQuery = (client, runId) => queryOptions({
|
|
2623
2879
|
queryKey: runtimeKeys.run(client.url, runId),
|
|
2624
2880
|
queryFn: () => client.fetchRun(runId),
|
|
@@ -2630,6 +2886,6 @@ const secretStatQuery = (client, ref) => queryOptions({
|
|
|
2630
2886
|
staleTime: 0
|
|
2631
2887
|
});
|
|
2632
2888
|
//#endregion
|
|
2633
|
-
export {
|
|
2889
|
+
export { DELAY_BLOCK as $, isValidTimeout as A, timeoutManager as B, hasPreviousPage as C, flowPorts as Ct, pendingThenable as D, parseManualInputs as Dt, notifyManager as E, manualDefault as Et, resolveEnabled as F, fetchRun as G, DEFAULT_RUNTIME_URL as H, resolveStaleTime as I, isSyncingError as J, fetchRuns as K, shallowEqualObjects as L, noop as M, replaceData as N, focusManager as O, parseScheduleConfig as Ot, replaceEqualDeep as P, CORE_PIECE as Q, shouldThrowError as R, hasNextPage as S, expandDocumentRefs as St, fetchState as T, knownPorts as Tt, RuntimeRequestError as U, Subscribable as V, createRuntimeClient as W, ASSERT_BLOCK as X, APPROVAL_BLOCK as Y, BRANCH_BLOCK as Z, queryKind as _, ManualPayloadError as _t, pieceActionsQuery as a, TRIGGER_PRESETS as at, realRuns as b, coerceManualPayload as bt, runQuery as c, isCoreBlock as ct, secretStatQuery as d, stepBlock as dt, MANUAL_TRIGGER as et, stepOutputTreeQuery as f, stepFields as ft, blockRefKey as g, DOCUMENT_REF_KEY as gt, SHARED_STALE_MS as h, CORE_PIECE_NAME as ht, outputTreeQuery as i, STOP_BLOCK as it, keepPreviousData as j, isServer as k, scheduleConfigIssue as kt, runsOfPages as l, pinBlock as lt, RESOLVER_STALE_MS as m, triggerFields as mt, catalogQuery as n, SCHEDULE_TRIGGER as nt, pieceTriggersQuery as o, WAIT_FOR_WEBHOOK_BLOCK as ot, waitingRunsQuery as p, triggerBlock as pt, fetchRunsPage as q, createRuntimeQueryClient as r, STEP_PRESETS as rt, runPagesQuery as s, WEBHOOK_TRIGGER as st, blockFormQuery as t, REACTOR_PIECE as tt, runsQuery as u, sameBlock as ut, runtimeKeys as v, NEXT_PORT as vt, infiniteQueryBehavior as w, isDocumentRefMarker as wt, QueryClient as x, documentRefsIn as xt, TEST_TRIGGER_KIND as y, checkTriggerStrategy as yt, timeUntilStale as z };
|
|
2634
2890
|
|
|
2635
|
-
//# sourceMappingURL=runtime-queries-
|
|
2891
|
+
//# sourceMappingURL=runtime-queries-VXJsWno5.mjs.map
|