@lotics/cli 0.52.1 → 0.53.0
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.
|
@@ -123,6 +123,18 @@ function inputDeclToTsType(decl) {
|
|
|
123
123
|
return "{ start: string; end: string }";
|
|
124
124
|
case "file":
|
|
125
125
|
return "string";
|
|
126
|
+
case "object": {
|
|
127
|
+
const fields = decl.fields !== null && typeof decl.fields === "object"
|
|
128
|
+
? decl.fields
|
|
129
|
+
: {};
|
|
130
|
+
return inputsToType(fields);
|
|
131
|
+
}
|
|
132
|
+
case "array": {
|
|
133
|
+
const items = decl.items !== null && typeof decl.items === "object"
|
|
134
|
+
? decl.items
|
|
135
|
+
: null;
|
|
136
|
+
return items ? `ReadonlyArray<${inputDeclToTsType(items)}>` : "ReadonlyArray<unknown>";
|
|
137
|
+
}
|
|
126
138
|
case "json":
|
|
127
139
|
return "unknown";
|
|
128
140
|
default:
|
|
@@ -32,6 +32,32 @@ describe("generateAppWorkflowsDts", () => {
|
|
|
32
32
|
// No declared inputs → untyped callable in AppWorkflows.
|
|
33
33
|
expect(dts).toContain("computeQuote: Record<string, unknown>;");
|
|
34
34
|
});
|
|
35
|
+
it("types an array-of-objects INPUT as ReadonlyArray<{…}>", () => {
|
|
36
|
+
const dts = generateAppWorkflowsDts({
|
|
37
|
+
importLines: {
|
|
38
|
+
workflow_id: "wfl_4",
|
|
39
|
+
inputs: {
|
|
40
|
+
lines: {
|
|
41
|
+
type: "array",
|
|
42
|
+
items: {
|
|
43
|
+
type: "object",
|
|
44
|
+
fields: {
|
|
45
|
+
sku: { type: "text" },
|
|
46
|
+
qty: { type: "number" },
|
|
47
|
+
note: { type: "text", required: false },
|
|
48
|
+
ref: { type: "record_link", table_id: "tbl_x" },
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
});
|
|
55
|
+
expect(dts).toContain("lines: ReadonlyArray<{");
|
|
56
|
+
expect(dts).toContain("sku: string;");
|
|
57
|
+
expect(dts).toContain("qty: number;");
|
|
58
|
+
expect(dts).toContain("note?: string;");
|
|
59
|
+
expect(dts).toContain("ref: string;");
|
|
60
|
+
});
|
|
35
61
|
it("maps record_link/select outputs the same way as inputs", () => {
|
|
36
62
|
const dts = generateAppWorkflowsDts({
|
|
37
63
|
lookup: {
|
package/dist/src/cli.js
CHANGED
|
@@ -31439,6 +31439,14 @@ function inputDeclToTsType(decl) {
|
|
|
31439
31439
|
return "{ start: string; end: string }";
|
|
31440
31440
|
case "file":
|
|
31441
31441
|
return "string";
|
|
31442
|
+
case "object": {
|
|
31443
|
+
const fields = decl.fields !== null && typeof decl.fields === "object" ? decl.fields : {};
|
|
31444
|
+
return inputsToType(fields);
|
|
31445
|
+
}
|
|
31446
|
+
case "array": {
|
|
31447
|
+
const items = decl.items !== null && typeof decl.items === "object" ? decl.items : null;
|
|
31448
|
+
return items ? `ReadonlyArray<${inputDeclToTsType(items)}>` : "ReadonlyArray<unknown>";
|
|
31449
|
+
}
|
|
31442
31450
|
case "json":
|
|
31443
31451
|
return "unknown";
|
|
31444
31452
|
default:
|