@diagonal-hq/cli 0.42.3 → 0.42.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 +3 -3
- package/dist/check-data.json +1 -1
- package/dist/{cli-assets-cli-WEGERBBR.mjs → cli-assets-cli-LXLBKDDH.mjs} +1 -1
- package/dist/{cli-check-data-YU3CH43A.mjs → cli-check-data-VZ52XV3R.mjs} +1 -1
- package/dist/{cli-chunk-TDGR3ENO.mjs → cli-chunk-4A3XCNXP.mjs} +2 -1
- package/dist/cli.mjs +12 -5
- package/dist/index.d.ts +17 -6
- package/package.json +4 -4
|
@@ -25,6 +25,7 @@ var WORKFLOWS_USAGE = "Usage: diagonal workflows [--json]";
|
|
|
25
25
|
var RUN_USAGE = "Usage: diagonal run <path> [--input '<json object>'] [--json]";
|
|
26
26
|
var LOGS_USAGE = "Usage: diagonal logs [path | execution id] [--status <success|error|exception|started|pending>] [--limit <1-100>] [--json]";
|
|
27
27
|
var SUCCESS = "execution.success";
|
|
28
|
+
var PENDING = "execution.pending";
|
|
28
29
|
var UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
29
30
|
var STATUSES = ["success", "error", "exception", "started", "pending"];
|
|
30
31
|
function credentials(env, stderr) {
|
|
@@ -205,7 +206,7 @@ ${RUN_USAGE}
|
|
|
205
206
|
if (body === null) {
|
|
206
207
|
return 1;
|
|
207
208
|
}
|
|
208
|
-
const succeeded = body.status === SUCCESS;
|
|
209
|
+
const succeeded = body.status === SUCCESS || body.status === PENDING;
|
|
209
210
|
if (parsed.json) {
|
|
210
211
|
stdout.write(`${JSON.stringify(body, null, 2)}
|
|
211
212
|
`);
|
package/dist/cli.mjs
CHANGED
|
@@ -96,7 +96,7 @@ import {
|
|
|
96
96
|
takesAssetReference,
|
|
97
97
|
writeAssetCatalog,
|
|
98
98
|
writeAssetEntry
|
|
99
|
-
} from "./cli-chunk-
|
|
99
|
+
} from "./cli-chunk-4A3XCNXP.mjs";
|
|
100
100
|
import {
|
|
101
101
|
ASSETS_EXPORT,
|
|
102
102
|
GENERATED_ASSETS_MODULE,
|
|
@@ -9175,6 +9175,7 @@ var HTTP_METHODS = ["GET", "POST", "PUT", "PATCH", "DELETE"];
|
|
|
9175
9175
|
var RECORD_EVENTS = ["created", "updated", "deleted", "restored", "saved"];
|
|
9176
9176
|
var LIFECYCLE_HOOKS = ["creating", "updating", "saving", "deleting", "restoring"];
|
|
9177
9177
|
var WORKFLOW_EVENTS = ["execution.success", "execution.error", "execution.exception"];
|
|
9178
|
+
var EXECUTION_MODES = ["sync", "async"];
|
|
9178
9179
|
function isWorkflowConfigPath(path) {
|
|
9179
9180
|
return WORKFLOW_PATH.test(path) && !path.endsWith(".test.ts") && !path.endsWith(".d.ts");
|
|
9180
9181
|
}
|
|
@@ -9393,6 +9394,12 @@ function optionsOf2(changes, properties, references2) {
|
|
|
9393
9394
|
}
|
|
9394
9395
|
options.authorizer = changes.authorizer;
|
|
9395
9396
|
}
|
|
9397
|
+
if (changes.execution_mode !== void 0) {
|
|
9398
|
+
if (changes.execution_mode !== null && !EXECUTION_MODES.includes(changes.execution_mode)) {
|
|
9399
|
+
throw new SourceError(`"execution_mode" must be 'sync', 'async', or null.`);
|
|
9400
|
+
}
|
|
9401
|
+
options.executionMode = changes.execution_mode;
|
|
9402
|
+
}
|
|
9396
9403
|
return options;
|
|
9397
9404
|
}
|
|
9398
9405
|
function routeEdits(source, properties, changes) {
|
|
@@ -9471,7 +9478,7 @@ function writeWorkflowConfigFile(path, source, changes, resources = []) {
|
|
|
9471
9478
|
// scripts/lib/runtime-build/source-adapters/workflow-config.mjs
|
|
9472
9479
|
var workflowConfigAdapter = Object.freeze({
|
|
9473
9480
|
contextFields: ["resources", "resource_slugs"],
|
|
9474
|
-
writeFields: ["name", "slug", "description", "trigger", "route", "run_as", "authorizer"],
|
|
9481
|
+
writeFields: ["name", "slug", "description", "trigger", "route", "run_as", "authorizer", "execution_mode"],
|
|
9475
9482
|
accepts: isWorkflowConfigPath,
|
|
9476
9483
|
identity: (data) => data.uid,
|
|
9477
9484
|
read({ path, source }) {
|
|
@@ -10914,7 +10921,7 @@ async function checkSources() {
|
|
|
10914
10921
|
if (existsSync4(DATA_FILE) && existsSync4(SDK_FILE)) {
|
|
10915
10922
|
return { dataFile: DATA_FILE, sdkFile: SDK_FILE };
|
|
10916
10923
|
}
|
|
10917
|
-
const { checkData, scriptSdk } = await import("./cli-check-data-
|
|
10924
|
+
const { checkData, scriptSdk } = await import("./cli-check-data-VZ52XV3R.mjs");
|
|
10918
10925
|
return { data: checkData(), sdk: scriptSdk() };
|
|
10919
10926
|
}
|
|
10920
10927
|
function isScriptTestPath(path) {
|
|
@@ -11020,9 +11027,9 @@ async function main(argv, io) {
|
|
|
11020
11027
|
case "assets": {
|
|
11021
11028
|
const [subcommand, ...assetArgs] = args;
|
|
11022
11029
|
if (subcommand === "upload")
|
|
11023
|
-
return (await import("./cli-assets-cli-
|
|
11030
|
+
return (await import("./cli-assets-cli-LXLBKDDH.mjs")).uploadAsset(assetArgs, io);
|
|
11024
11031
|
if (subcommand === "list")
|
|
11025
|
-
return (await import("./cli-assets-cli-
|
|
11032
|
+
return (await import("./cli-assets-cli-LXLBKDDH.mjs")).listAssets(assetArgs, io);
|
|
11026
11033
|
io.stderr.write(`${ASSETS_UPLOAD_USAGE}
|
|
11027
11034
|
${ASSETS_LIST_USAGE}
|
|
11028
11035
|
`);
|
package/dist/index.d.ts
CHANGED
|
@@ -1083,6 +1083,15 @@ type WorkflowLabel =
|
|
|
1083
1083
|
/** A migration config takes this type too, but the build refuses its `slug`: a migration's file name is its identity. */
|
|
1084
1084
|
type ConfigBase = UidOption & SlugOption & WorkflowLabel & { description?: string | null };
|
|
1085
1085
|
|
|
1086
|
+
/**
|
|
1087
|
+
* How a manual or request workflow runs. `'sync'` (the default) runs the
|
|
1088
|
+
* workflow while the caller waits for its output, with a 55-second time limit.
|
|
1089
|
+
* `'async'` puts the run in the queue and answers at once without the output.
|
|
1090
|
+
* The other triggers always run in the background, and a record lifecycle
|
|
1091
|
+
* workflow always runs inside the record write.
|
|
1092
|
+
*/
|
|
1093
|
+
type ExecutionModeOption = { executionMode?: 'sync' | 'async' };
|
|
1094
|
+
|
|
1086
1095
|
/**
|
|
1087
1096
|
* The config of a `workflows/<name>.ts` or migration file: the first argument of
|
|
1088
1097
|
* `export default defineWorkflow(config, handler)` from `@diagonal/workflow`, which adds the
|
|
@@ -1092,16 +1101,18 @@ type ConfigBase = UidOption & SlugOption & WorkflowLabel & { description?: strin
|
|
|
1092
1101
|
* as the caller (`'session'`) by default.
|
|
1093
1102
|
*/
|
|
1094
1103
|
export type WorkflowConfig =
|
|
1095
|
-
| (ConfigBase &
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1104
|
+
| (ConfigBase &
|
|
1105
|
+
ExecutionModeOption & {
|
|
1106
|
+
trigger: RequestTrigger;
|
|
1107
|
+
runAs?: WorkflowRunAs;
|
|
1108
|
+
authorizer?: 'authenticated';
|
|
1109
|
+
})
|
|
1100
1110
|
| (ConfigBase & {
|
|
1101
1111
|
trigger: RecordEventTrigger | RecordScheduleTrigger | ScheduledTrigger | WorkflowEventTrigger;
|
|
1102
1112
|
runAs: Exclude<WorkflowRunAs, 'session'>;
|
|
1103
1113
|
})
|
|
1104
|
-
| (ConfigBase &
|
|
1114
|
+
| (ConfigBase &
|
|
1115
|
+
ExecutionModeOption & { trigger: ManualTrigger; runAs?: Exclude<WorkflowRunAs, 'session'> })
|
|
1105
1116
|
| (ConfigBase & { trigger: RecordLifecycleTrigger });
|
|
1106
1117
|
|
|
1107
1118
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@diagonal-hq/cli",
|
|
3
|
-
"version": "0.42.
|
|
3
|
+
"version": "0.42.4",
|
|
4
4
|
"description": "The diagonal CLI and the configuration helpers for file-based Diagonal workspaces.",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
6
|
"repository": {
|
|
@@ -51,8 +51,8 @@
|
|
|
51
51
|
"bun": "1.4.4"
|
|
52
52
|
},
|
|
53
53
|
"optionalDependencies": {
|
|
54
|
-
"@diagonal-hq/workflow-script-compiler-darwin-arm64": "0.1.0-
|
|
55
|
-
"@diagonal-hq/workflow-script-compiler-linux-x64": "0.1.0-
|
|
56
|
-
"@diagonal-hq/workflow-script-compiler-linux-arm64": "0.1.0-
|
|
54
|
+
"@diagonal-hq/workflow-script-compiler-darwin-arm64": "0.1.0-h1dd92aff7825",
|
|
55
|
+
"@diagonal-hq/workflow-script-compiler-linux-x64": "0.1.0-h1dd92aff7825",
|
|
56
|
+
"@diagonal-hq/workflow-script-compiler-linux-arm64": "0.1.0-h1dd92aff7825"
|
|
57
57
|
}
|
|
58
58
|
}
|