@clickraft/cli 0.7.0 → 0.7.1
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/CHANGELOG.md +3 -5
- package/dist/cli.js +24 -11
- package/dist/cli.js.map +1 -1
- package/dist/index.js +24 -11
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2902,16 +2902,17 @@ async function listTokens(options) {
|
|
|
2902
2902
|
// src/schemas/workflows.ts
|
|
2903
2903
|
import { z as z12 } from "zod";
|
|
2904
2904
|
var WorkflowDeclaredParamSchema = z12.object({
|
|
2905
|
+
name: z12.string(),
|
|
2905
2906
|
type: z12.string(),
|
|
2906
2907
|
required: z12.boolean().optional(),
|
|
2907
|
-
|
|
2908
|
-
description: z12.
|
|
2909
|
-
}).
|
|
2908
|
+
defaultValue: z12.unknown().optional(),
|
|
2909
|
+
description: z12.unknown().optional()
|
|
2910
|
+
}).passthrough();
|
|
2910
2911
|
var WorkflowSummarySchema = z12.object({
|
|
2911
2912
|
id: z12.string().uuid(),
|
|
2912
2913
|
name: z12.string(),
|
|
2913
2914
|
tags: z12.array(z12.string()),
|
|
2914
|
-
declared_params: z12.
|
|
2915
|
+
declared_params: z12.array(WorkflowDeclaredParamSchema).nullable().default([]),
|
|
2915
2916
|
canvas_rev: z12.number().int().nonnegative(),
|
|
2916
2917
|
updated_at: z12.string()
|
|
2917
2918
|
}).strict();
|
|
@@ -2924,7 +2925,7 @@ var WorkflowDetailSchema = z12.object({
|
|
|
2924
2925
|
name: z12.string(),
|
|
2925
2926
|
description: z12.string().nullable(),
|
|
2926
2927
|
tags: z12.array(z12.string()),
|
|
2927
|
-
declared_params: z12.
|
|
2928
|
+
declared_params: z12.array(WorkflowDeclaredParamSchema).nullable().default([]),
|
|
2928
2929
|
canvas_rev: z12.number().int().nonnegative(),
|
|
2929
2930
|
nodes: z12.array(z12.unknown()),
|
|
2930
2931
|
edges: z12.array(z12.unknown()),
|
|
@@ -2936,7 +2937,7 @@ var WorkflowCreateResponseSchema = z12.object({
|
|
|
2936
2937
|
name: z12.string(),
|
|
2937
2938
|
description: z12.string().nullable(),
|
|
2938
2939
|
tags: z12.array(z12.string()),
|
|
2939
|
-
declared_params: z12.
|
|
2940
|
+
declared_params: z12.array(WorkflowDeclaredParamSchema).nullable().default([]),
|
|
2940
2941
|
canvas_rev: z12.number().int().nonnegative(),
|
|
2941
2942
|
created_at: z12.string(),
|
|
2942
2943
|
updated_at: z12.string()
|
|
@@ -3013,12 +3014,24 @@ async function patchWorkflow(client, opts) {
|
|
|
3013
3014
|
}
|
|
3014
3015
|
|
|
3015
3016
|
// src/commands/workflow/create.ts
|
|
3017
|
+
function toParamArray(input) {
|
|
3018
|
+
if (Array.isArray(input)) return input;
|
|
3019
|
+
return Object.entries(input).map(([key, val]) => {
|
|
3020
|
+
const def = typeof val === "object" && val !== null ? val : {};
|
|
3021
|
+
if (def.name !== void 0 && def.name !== key) {
|
|
3022
|
+
throw new ArgError(
|
|
3023
|
+
`declared_params key '${key}' conflicts with inner name '${String(def.name)}'.`
|
|
3024
|
+
);
|
|
3025
|
+
}
|
|
3026
|
+
return { name: key, ...def };
|
|
3027
|
+
});
|
|
3028
|
+
}
|
|
3016
3029
|
async function createWorkflow(opts) {
|
|
3017
3030
|
const client = opts.client ?? await buildWorkflowClient(opts);
|
|
3018
3031
|
const body = { name: opts.name };
|
|
3019
3032
|
if (opts.description !== void 0) body.description = opts.description;
|
|
3020
3033
|
if (opts.tags !== void 0 && opts.tags.length > 0) body.tags = opts.tags;
|
|
3021
|
-
if (opts.declaredParams !== void 0) body.declared_params = opts.declaredParams;
|
|
3034
|
+
if (opts.declaredParams !== void 0) body.declared_params = toParamArray(opts.declaredParams);
|
|
3022
3035
|
return client.request({
|
|
3023
3036
|
method: "POST",
|
|
3024
3037
|
path: "/workflows",
|
|
@@ -3554,13 +3567,13 @@ function renderWorkflowDetail(detail, out) {
|
|
|
3554
3567
|
}
|
|
3555
3568
|
const params = detail.declared_params;
|
|
3556
3569
|
lines.push("", "Declared parameters:");
|
|
3557
|
-
if (!params ||
|
|
3570
|
+
if (!params || params.length === 0) {
|
|
3558
3571
|
lines.push(" (none)");
|
|
3559
3572
|
} else {
|
|
3560
|
-
for (const
|
|
3573
|
+
for (const p of params) {
|
|
3561
3574
|
const req = p.required ? "required" : "optional";
|
|
3562
3575
|
const desc = p.description ? `: ${p.description}` : "";
|
|
3563
|
-
lines.push(` - ${name} (${p.type}, ${req})${desc}`);
|
|
3576
|
+
lines.push(` - ${p.name} (${p.type}, ${req})${desc}`);
|
|
3564
3577
|
}
|
|
3565
3578
|
}
|
|
3566
3579
|
out.write(lines.join("\n") + "\n");
|
|
@@ -4688,7 +4701,7 @@ async function runWorkflowCreate(argv, ctx, rc) {
|
|
|
4688
4701
|
name = name ?? (typeof obj.name === "string" ? obj.name : void 0);
|
|
4689
4702
|
description = description ?? (typeof obj.description === "string" ? obj.description : void 0);
|
|
4690
4703
|
if (!tags && Array.isArray(obj.tags)) tags = obj.tags;
|
|
4691
|
-
if (obj.declared_params && typeof obj.declared_params === "object") {
|
|
4704
|
+
if (obj.declared_params != null && typeof obj.declared_params === "object") {
|
|
4692
4705
|
declaredParams = obj.declared_params;
|
|
4693
4706
|
}
|
|
4694
4707
|
}
|