@fluidgrids/cli 2026.1113.3 → 2026.1113.4
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 +11 -0
- package/dist/cli.js +45 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -227,8 +227,19 @@ fluidgrids test --replay histories/ # the project tests, then ever
|
|
|
227
227
|
fluidgrids push --hotfix v3 --replay-sample 20 # replace the code of v3 (replay-verified by the service)
|
|
228
228
|
fluidgrids versions list approvals # versions with the bundle each one runs
|
|
229
229
|
fluidgrids run lead-enrichment --wait # trigger a canvas workflow from its trigger node
|
|
230
|
+
fluidgrids run lead-enrichment --workflow-id customer-7 --id-conflict use-existing --delay 5m
|
|
230
231
|
```
|
|
231
232
|
|
|
233
|
+
- **Canvas start options.** `fluidgrids run` takes `--workflow-id`,
|
|
234
|
+
`--id-conflict` (fail, use-existing or terminate-existing) and `--delay`
|
|
235
|
+
(spec `code-first` 11 §2.1 and §2.23; they need `fluidgrids.durable-parity`,
|
|
236
|
+
and a delay is for PRODUCTION runs only). `terminate-existing` ends the open
|
|
237
|
+
run of the workflow id first: it is sent as `triggerWorkflowTerminateExisting`,
|
|
238
|
+
which needs the workflow-run delete permission, and the CLI asks for
|
|
239
|
+
confirmation unless `--force` is given. Without these flags, the trigger
|
|
240
|
+
node's own `workflowId`, `idConflictPolicy` and `startDelay` (if it sets
|
|
241
|
+
them) apply.
|
|
242
|
+
|
|
232
243
|
- **Push.** The bundle is one ES module built with the pinned esbuild, so its
|
|
233
244
|
`buildId` (`sha256` of the bytes) is the one the service computes for the same
|
|
234
245
|
files. `push` asks `prepareWorkflowCodeUpload` for presigned uploads, sends the
|
package/dist/cli.js
CHANGED
|
@@ -928,6 +928,10 @@ var PRESIGNED_PUT_FIELDS = "url method headers expiresAt alreadyStored", CF_PREP
|
|
|
928
928
|
mutation FluidgridsCodeTriggerWorkflow($input: TriggerWorkflowInput!) {
|
|
929
929
|
triggerWorkflow(input: $input) { runId status workflowKey version triggerNodeId }
|
|
930
930
|
}
|
|
931
|
+
`, CF_TRIGGER_WORKFLOW_TERMINATE_EXISTING = `
|
|
932
|
+
mutation FluidgridsCodeTriggerWorkflowTerminateExisting($input: TriggerWorkflowInput!) {
|
|
933
|
+
triggerWorkflowTerminateExisting(input: $input) { runId status workflowKey version triggerNodeId }
|
|
934
|
+
}
|
|
931
935
|
`;
|
|
932
936
|
var init_durable_operations = __esm(() => {
|
|
933
937
|
CF_PREPARE_WORKFLOW_CODE_UPLOAD = `
|
|
@@ -1450,6 +1454,10 @@ function createCodeFirstApi(ctx) {
|
|
|
1450
1454
|
return rows.slice(0, limit);
|
|
1451
1455
|
},
|
|
1452
1456
|
async triggerWorkflow(input) {
|
|
1457
|
+
if (input.idConflictPolicy === "TERMINATE_EXISTING") {
|
|
1458
|
+
const data = await request(CF_TRIGGER_WORKFLOW_TERMINATE_EXISTING, { input });
|
|
1459
|
+
return data.triggerWorkflowTerminateExisting;
|
|
1460
|
+
}
|
|
1453
1461
|
const data = await request(CF_TRIGGER_WORKFLOW, {
|
|
1454
1462
|
input
|
|
1455
1463
|
});
|
|
@@ -5944,6 +5952,29 @@ async function runCount(env, options) {
|
|
|
5944
5952
|
}, details);
|
|
5945
5953
|
return counted;
|
|
5946
5954
|
}
|
|
5955
|
+
function canvasStartFields(options) {
|
|
5956
|
+
const fields = {};
|
|
5957
|
+
if (options.workflowId !== undefined) {
|
|
5958
|
+
if (options.workflowId.trim() === "")
|
|
5959
|
+
throw new CliUserError31("--workflow-id cannot be empty.");
|
|
5960
|
+
fields.workflowId = options.workflowId;
|
|
5961
|
+
}
|
|
5962
|
+
const conflict = parseIdConflict(options.idConflict);
|
|
5963
|
+
if (conflict) {
|
|
5964
|
+
if (conflict !== "FAIL" && fields.workflowId === undefined) {
|
|
5965
|
+
throw new CliUserError31(`--id-conflict ${options.idConflict ?? ""} needs --workflow-id.`);
|
|
5966
|
+
}
|
|
5967
|
+
fields.idConflictPolicy = conflict;
|
|
5968
|
+
}
|
|
5969
|
+
const delay = parseDuration(options.delay, "--delay");
|
|
5970
|
+
if (delay) {
|
|
5971
|
+
if (options.test) {
|
|
5972
|
+
throw new CliUserError31("--delay applies to PRODUCTION runs only; drop --test or --delay.");
|
|
5973
|
+
}
|
|
5974
|
+
fields.startDelay = delay;
|
|
5975
|
+
}
|
|
5976
|
+
return fields;
|
|
5977
|
+
}
|
|
5947
5978
|
function triggerNodeIds(definition) {
|
|
5948
5979
|
if (!isRecord16(definition) || !isRecord16(definition["data"]))
|
|
5949
5980
|
return [];
|
|
@@ -5976,12 +6007,24 @@ async function runRun(env, workflowKey, options) {
|
|
|
5976
6007
|
if (input !== undefined && !isRecord16(input)) {
|
|
5977
6008
|
throw new CliUserError31("--input must be a JSON object for a trigger.");
|
|
5978
6009
|
}
|
|
6010
|
+
const startFields = canvasStartFields(options);
|
|
6011
|
+
if (startFields.idConflictPolicy === "TERMINATE_EXISTING" && !options.force) {
|
|
6012
|
+
const question = `Terminate the open run of workflow id ${startFields.workflowId ?? ""} of ${workflowKey} (if any) and start a new one?`;
|
|
6013
|
+
if (!env.interactive()) {
|
|
6014
|
+
throw new CliUserError31("--id-conflict terminate-existing needs confirmation.", {
|
|
6015
|
+
hint: "Pass --force to terminate the open run without a prompt."
|
|
6016
|
+
});
|
|
6017
|
+
}
|
|
6018
|
+
if (!await confirm(question))
|
|
6019
|
+
throw new CliUserError31("Aborted: nothing was changed.");
|
|
6020
|
+
}
|
|
5979
6021
|
const trigger = await env.api.triggerWorkflow({
|
|
5980
6022
|
workflowKey,
|
|
5981
6023
|
version: target.version,
|
|
5982
6024
|
triggerNodeId,
|
|
5983
6025
|
...input !== undefined ? { triggerData: input } : {},
|
|
5984
|
-
...options.test ? { mode: "TEST" } : {}
|
|
6026
|
+
...options.test ? { mode: "TEST" } : {},
|
|
6027
|
+
...startFields
|
|
5985
6028
|
});
|
|
5986
6029
|
const result = { trigger };
|
|
5987
6030
|
if (options.wait) {
|
|
@@ -10653,7 +10696,7 @@ function registerDurable(program, env) {
|
|
|
10653
10696
|
await Promise.resolve().then(() => init_replay2());
|
|
10654
10697
|
await runTest(env, codeFirst);
|
|
10655
10698
|
});
|
|
10656
|
-
program.command("run <workflowKey>").description("Trigger a workflow from its version's trigger node, optionally waiting for the result").option("--wf-version <version>", "Version (default: the active version, else the newest)").option("--trigger-node <id>", "Trigger node (default: the only one)").option("-i, --input <json>", "Trigger data (a JSON object)").option("--test", "Run in TEST mode instead of PRODUCTION").option("--wait", "Wait for the run to finish").option(...WAIT_OPTIONS.timeout).option(...WAIT_OPTIONS.poll).option(...OUTPUT_OPTION).action(async (workflowKey, options, command) => {
|
|
10699
|
+
program.command("run <workflowKey>").description("Trigger a workflow from its version's trigger node, optionally waiting for the result").option("--wf-version <version>", "Version (default: the active version, else the newest)").option("--trigger-node <id>", "Trigger node (default: the only one)").option("-i, --input <json>", "Trigger data (a JSON object)").option("--test", "Run in TEST mode instead of PRODUCTION").option("--workflow-id <id>", "Workflow id: unique among the open runs of the key").option("--id-conflict <policy>", "When an open run has the workflow id: fail, use-existing or terminate-existing").option("--delay <duration>", "Start delay (ms, or 1.5s, 5m, 2h, 2w, PT2H; at most 30 days; not with --test)").option("--force", "With --id-conflict terminate-existing: skip the confirmation prompt").option("--wait", "Wait for the run to finish").option(...WAIT_OPTIONS.timeout).option(...WAIT_OPTIONS.poll).option(...OUTPUT_OPTION).action(async (workflowKey, options, command) => {
|
|
10657
10700
|
await Promise.resolve().then(() => init_runs());
|
|
10658
10701
|
await runRun(env, workflowKey, withGlobalFormat(options, command));
|
|
10659
10702
|
});
|
package/package.json
CHANGED