@fluidgrids/cli 2026.1021.1 → 2026.1028.2
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 +157 -5
- package/dist/auth/device-login.d.ts +31 -0
- package/dist/auth/device-login.d.ts.map +1 -0
- package/dist/auth/device-login.js +75 -0
- package/dist/auth/device-login.js.map +1 -0
- package/dist/auth/token-auth.d.ts +49 -0
- package/dist/auth/token-auth.d.ts.map +1 -0
- package/dist/auth/token-auth.js +279 -0
- package/dist/auth/token-auth.js.map +1 -0
- package/dist/cli.d.ts +4 -5
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +18 -32
- package/dist/cli.js.map +1 -1
- package/dist/code-first/api.d.ts +357 -0
- package/dist/code-first/api.d.ts.map +1 -0
- package/dist/code-first/api.js +288 -0
- package/dist/code-first/api.js.map +1 -0
- package/dist/code-first/code-upload.d.ts +52 -0
- package/dist/code-first/code-upload.d.ts.map +1 -0
- package/dist/code-first/code-upload.js +161 -0
- package/dist/code-first/code-upload.js.map +1 -0
- package/dist/code-first/commands/codegen.d.ts +20 -0
- package/dist/code-first/commands/codegen.d.ts.map +1 -0
- package/dist/code-first/commands/codegen.js +50 -0
- package/dist/code-first/commands/codegen.js.map +1 -0
- package/dist/code-first/commands/diff.d.ts +28 -0
- package/dist/code-first/commands/diff.d.ts.map +1 -0
- package/dist/code-first/commands/diff.js +73 -0
- package/dist/code-first/commands/diff.js.map +1 -0
- package/dist/code-first/commands/hotfix.d.ts +54 -0
- package/dist/code-first/commands/hotfix.d.ts.map +1 -0
- package/dist/code-first/commands/hotfix.js +225 -0
- package/dist/code-first/commands/hotfix.js.map +1 -0
- package/dist/code-first/commands/import.d.ts +40 -0
- package/dist/code-first/commands/import.d.ts.map +1 -0
- package/dist/code-first/commands/import.js +235 -0
- package/dist/code-first/commands/import.js.map +1 -0
- package/dist/code-first/commands/init.d.ts +33 -0
- package/dist/code-first/commands/init.d.ts.map +1 -0
- package/dist/code-first/commands/init.js +177 -0
- package/dist/code-first/commands/init.js.map +1 -0
- package/dist/code-first/commands/interface.d.ts +12 -0
- package/dist/code-first/commands/interface.d.ts.map +1 -0
- package/dist/code-first/commands/interface.js +21 -0
- package/dist/code-first/commands/interface.js.map +1 -0
- package/dist/code-first/commands/pull.d.ts +63 -0
- package/dist/code-first/commands/pull.d.ts.map +1 -0
- package/dist/code-first/commands/pull.js +266 -0
- package/dist/code-first/commands/pull.js.map +1 -0
- package/dist/code-first/commands/push.d.ts +97 -0
- package/dist/code-first/commands/push.d.ts.map +1 -0
- package/dist/code-first/commands/push.js +313 -0
- package/dist/code-first/commands/push.js.map +1 -0
- package/dist/code-first/commands/replay.d.ts +44 -0
- package/dist/code-first/commands/replay.d.ts.map +1 -0
- package/dist/code-first/commands/replay.js +238 -0
- package/dist/code-first/commands/replay.js.map +1 -0
- package/dist/code-first/commands/runs.d.ts +94 -0
- package/dist/code-first/commands/runs.d.ts.map +1 -0
- package/dist/code-first/commands/runs.js +304 -0
- package/dist/code-first/commands/runs.js.map +1 -0
- package/dist/code-first/commands/validate.d.ts +38 -0
- package/dist/code-first/commands/validate.d.ts.map +1 -0
- package/dist/code-first/commands/validate.js +140 -0
- package/dist/code-first/commands/validate.js.map +1 -0
- package/dist/code-first/commands/versions.d.ts +14 -0
- package/dist/code-first/commands/versions.d.ts.map +1 -0
- package/dist/code-first/commands/versions.js +30 -0
- package/dist/code-first/commands/versions.js.map +1 -0
- package/dist/code-first/connections.d.ts +55 -0
- package/dist/code-first/connections.d.ts.map +1 -0
- package/dist/code-first/connections.js +180 -0
- package/dist/code-first/connections.js.map +1 -0
- package/dist/code-first/durable-operations.d.ts +42 -0
- package/dist/code-first/durable-operations.d.ts.map +1 -0
- package/dist/code-first/durable-operations.js +136 -0
- package/dist/code-first/durable-operations.js.map +1 -0
- package/dist/code-first/history.d.ts +30 -0
- package/dist/code-first/history.d.ts.map +1 -0
- package/dist/code-first/history.js +139 -0
- package/dist/code-first/history.js.map +1 -0
- package/dist/code-first/imports.d.ts +22 -0
- package/dist/code-first/imports.d.ts.map +1 -0
- package/dist/code-first/imports.js +67 -0
- package/dist/code-first/imports.js.map +1 -0
- package/dist/code-first/index.d.ts +17 -0
- package/dist/code-first/index.d.ts.map +1 -0
- package/dist/code-first/index.js +35 -0
- package/dist/code-first/index.js.map +1 -0
- package/dist/code-first/lowering.d.ts +81 -0
- package/dist/code-first/lowering.d.ts.map +1 -0
- package/dist/code-first/lowering.js +225 -0
- package/dist/code-first/lowering.js.map +1 -0
- package/dist/code-first/operations.d.ts +57 -0
- package/dist/code-first/operations.d.ts.map +1 -0
- package/dist/code-first/operations.js +167 -0
- package/dist/code-first/operations.js.map +1 -0
- package/dist/code-first/presigned.d.ts +21 -0
- package/dist/code-first/presigned.d.ts.map +1 -0
- package/dist/code-first/presigned.js +85 -0
- package/dist/code-first/presigned.js.map +1 -0
- package/dist/code-first/project.d.ts +123 -0
- package/dist/code-first/project.d.ts.map +1 -0
- package/dist/code-first/project.js +301 -0
- package/dist/code-first/project.js.map +1 -0
- package/dist/code-first/python.d.ts +81 -0
- package/dist/code-first/python.d.ts.map +1 -0
- package/dist/code-first/python.js +249 -0
- package/dist/code-first/python.js.map +1 -0
- package/dist/code-first/register.d.ts +27 -0
- package/dist/code-first/register.d.ts.map +1 -0
- package/dist/code-first/register.js +270 -0
- package/dist/code-first/register.js.map +1 -0
- package/dist/code-first/remote.d.ts +58 -0
- package/dist/code-first/remote.d.ts.map +1 -0
- package/dist/code-first/remote.js +126 -0
- package/dist/code-first/remote.js.map +1 -0
- package/dist/code-first/replay.d.ts +36 -0
- package/dist/code-first/replay.d.ts.map +1 -0
- package/dist/code-first/replay.js +52 -0
- package/dist/code-first/replay.js.map +1 -0
- package/dist/code-first/shared.d.ts +51 -0
- package/dist/code-first/shared.d.ts.map +1 -0
- package/dist/code-first/shared.js +93 -0
- package/dist/code-first/shared.js.map +1 -0
- package/dist/modules.d.ts +4 -0
- package/dist/modules.d.ts.map +1 -1
- package/dist/modules.js +6 -0
- package/dist/modules.js.map +1 -1
- package/dist/program.d.ts +20 -0
- package/dist/program.d.ts.map +1 -0
- package/dist/program.js +43 -0
- package/dist/program.js.map +1 -0
- package/package.json +3 -1
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Typed calls behind the code-first commands. Every call goes to the workspace
|
|
3
|
+
* gateway through the CLI context's GraphQL client, so device-code logins and
|
|
4
|
+
* token mode (`FLUIDGRIDS_TOKEN`) behave the same.
|
|
5
|
+
*/
|
|
6
|
+
import { CliAuthError, CliUserError } from '@burdenoff/cli-sdk/core';
|
|
7
|
+
import { CF_CREATE_WORKFLOW_VERSION, CF_EXPORT_WORKFLOW, CF_IMPORT_WORKFLOW, CF_LIST_CONNECTIONS, CF_LIST_NODE_MANIFESTS, CF_LIST_WORKFLOW_KEYS, CF_VALIDATE_WORKFLOW_DEFINITION, CF_WORKFLOW_INTERFACE, CF_WORKFLOW_VERSION_DIFF, CF_WORKFLOW_VERSIONS, renderedExportDocument, } from './operations.js';
|
|
8
|
+
import { CF_DESCRIBE_RUN, CF_LIST_RUNS, CF_PREPARE_WORKFLOW_CODE_UPLOAD, CF_REPLACE_WORKFLOW_VERSION_CODE, CF_SIGNAL_WORKFLOW_RUN, CF_START_WORKFLOW, CF_TERMINATE_WORKFLOW_RUN, CF_TRIGGER_WORKFLOW, CF_WORKFLOW_CODE_BUNDLE, CF_WORKFLOW_CODE_REPLACE, CF_WORKFLOW_RUN_HISTORY, CF_WORKFLOW_RUN_STACK_TRACE, } from './durable-operations.js';
|
|
9
|
+
/** Rows fetched per page when listing; a page of the maximum is followed by the next one. */
|
|
10
|
+
export const PAGE_SIZE = 100;
|
|
11
|
+
/** Upper bound on pages, so a server that always reports `hasMore` cannot loop forever. */
|
|
12
|
+
export const MAX_PAGES = 200;
|
|
13
|
+
/** Code-unit order, independent of the locale. */
|
|
14
|
+
export function compareText(a, b) {
|
|
15
|
+
return a < b ? -1 : a > b ? 1 : 0;
|
|
16
|
+
}
|
|
17
|
+
function isRecord(value) {
|
|
18
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
19
|
+
}
|
|
20
|
+
/** A registry row as a node manifest; rows whose operations blob is not usable are skipped. */
|
|
21
|
+
export function manifestFromConfig(row) {
|
|
22
|
+
const operations = row.operations;
|
|
23
|
+
const usable = Array.isArray(operations) || (isRecord(operations) && Array.isArray(operations['operations']));
|
|
24
|
+
if (!usable)
|
|
25
|
+
return null;
|
|
26
|
+
const manifest = {
|
|
27
|
+
nodeType: row.nodeType,
|
|
28
|
+
nodeVersion: row.nodeVersion,
|
|
29
|
+
name: row.name,
|
|
30
|
+
kind: row.kind,
|
|
31
|
+
// Checked above to be one of the two shapes NodeManifest.operations allows.
|
|
32
|
+
operations: operations,
|
|
33
|
+
};
|
|
34
|
+
if (isRecord(operations)) {
|
|
35
|
+
if (operations['outputHandles'] !== undefined)
|
|
36
|
+
manifest.outputHandles = operations['outputHandles'];
|
|
37
|
+
if (operations['inputHandles'] !== undefined)
|
|
38
|
+
manifest.inputHandles = operations['inputHandles'];
|
|
39
|
+
}
|
|
40
|
+
return manifest;
|
|
41
|
+
}
|
|
42
|
+
/** A presigned PUT from the service; `headers` must be a string map. */
|
|
43
|
+
export function parsePresignedPut(value, what) {
|
|
44
|
+
if (!isRecord(value) ||
|
|
45
|
+
typeof value['url'] !== 'string' ||
|
|
46
|
+
typeof value['method'] !== 'string' ||
|
|
47
|
+
typeof value['expiresAt'] !== 'string' ||
|
|
48
|
+
typeof value['alreadyStored'] !== 'boolean') {
|
|
49
|
+
throw new CliUserError(`The service returned a malformed ${what} upload.`);
|
|
50
|
+
}
|
|
51
|
+
const headers = {};
|
|
52
|
+
const raw = value['headers'];
|
|
53
|
+
if (raw !== null && raw !== undefined) {
|
|
54
|
+
if (!isRecord(raw)) {
|
|
55
|
+
throw new CliUserError(`The service returned malformed ${what} upload headers.`);
|
|
56
|
+
}
|
|
57
|
+
for (const [name, header] of Object.entries(raw)) {
|
|
58
|
+
if (typeof header !== 'string') {
|
|
59
|
+
throw new CliUserError(`The ${what} upload header ${name} is not a string.`);
|
|
60
|
+
}
|
|
61
|
+
Object.defineProperty(headers, name, {
|
|
62
|
+
value: header,
|
|
63
|
+
enumerable: true,
|
|
64
|
+
writable: true,
|
|
65
|
+
configurable: true,
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
return {
|
|
70
|
+
url: value['url'],
|
|
71
|
+
method: value['method'],
|
|
72
|
+
headers,
|
|
73
|
+
expiresAt: value['expiresAt'],
|
|
74
|
+
alreadyStored: value['alreadyStored'],
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
export function createCodeFirstApi(ctx) {
|
|
78
|
+
async function request(document, variables) {
|
|
79
|
+
if (!ctx.auth.isAuthenticated()) {
|
|
80
|
+
throw new CliAuthError('Authentication required.', {
|
|
81
|
+
hint: `Run \`${ctx.productName} auth login\` or set FLUIDGRIDS_TOKEN.`,
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
return ctx.gql.workspace.request(document, variables);
|
|
85
|
+
}
|
|
86
|
+
async function paginate(fetchPage) {
|
|
87
|
+
const all = [];
|
|
88
|
+
for (let page = 0; page < MAX_PAGES; page++) {
|
|
89
|
+
// The next offset is the number of rows so far, so a server that caps the
|
|
90
|
+
// page below PAGE_SIZE skips nothing.
|
|
91
|
+
const { rows, hasMore } = await fetchPage(all.length);
|
|
92
|
+
all.push(...rows);
|
|
93
|
+
if (!hasMore || rows.length === 0)
|
|
94
|
+
return all;
|
|
95
|
+
}
|
|
96
|
+
throw new CliUserError(`The listing did not end after ${MAX_PAGES} pages of ${PAGE_SIZE}; refusing to continue.`);
|
|
97
|
+
}
|
|
98
|
+
return {
|
|
99
|
+
async exportWorkflow(workflowKey, version) {
|
|
100
|
+
const data = await request(CF_EXPORT_WORKFLOW, {
|
|
101
|
+
workflowKey,
|
|
102
|
+
version: version ?? null,
|
|
103
|
+
});
|
|
104
|
+
return data.exportWorkflow;
|
|
105
|
+
},
|
|
106
|
+
async exportRendered(workflowKey, format, options) {
|
|
107
|
+
const data = await request(renderedExportDocument(format), {
|
|
108
|
+
workflowKey,
|
|
109
|
+
version: options.version ?? null,
|
|
110
|
+
connectionNameMap: options.connectionNameMap ?? null,
|
|
111
|
+
includeLayout: true,
|
|
112
|
+
includePinnedData: options.includePinnedData ?? false,
|
|
113
|
+
});
|
|
114
|
+
return data.exportWorkflow;
|
|
115
|
+
},
|
|
116
|
+
async workflowVersions(workflowKey) {
|
|
117
|
+
const data = await request(CF_WORKFLOW_VERSIONS, {
|
|
118
|
+
workflowKey,
|
|
119
|
+
});
|
|
120
|
+
return data.workflowVersions;
|
|
121
|
+
},
|
|
122
|
+
async listWorkflowKeys() {
|
|
123
|
+
const rows = await paginate(async (offset) => {
|
|
124
|
+
const data = await request(CF_LIST_WORKFLOW_KEYS, {
|
|
125
|
+
input: { latestOnly: true, limit: PAGE_SIZE, offset },
|
|
126
|
+
});
|
|
127
|
+
return {
|
|
128
|
+
rows: data.workflowDefinitions.items,
|
|
129
|
+
hasMore: data.workflowDefinitions.hasMore,
|
|
130
|
+
};
|
|
131
|
+
});
|
|
132
|
+
return [...new Set(rows.map((row) => row.workflowKey))].sort();
|
|
133
|
+
},
|
|
134
|
+
async createWorkflowVersion(workflowKey, input) {
|
|
135
|
+
const data = await request(CF_CREATE_WORKFLOW_VERSION, { workflowKey, input });
|
|
136
|
+
const result = data.createWorkflowVersion;
|
|
137
|
+
if (!result.success || !result.workflow) {
|
|
138
|
+
throw new CliUserError(`Creating a version of ${workflowKey} failed: ${result.message ?? 'no reason given'}`);
|
|
139
|
+
}
|
|
140
|
+
return result.workflow;
|
|
141
|
+
},
|
|
142
|
+
async importWorkflow(input) {
|
|
143
|
+
const data = await request(CF_IMPORT_WORKFLOW, { input });
|
|
144
|
+
const result = data.importWorkflow;
|
|
145
|
+
if (!result.success || !result.workflow) {
|
|
146
|
+
const reasons = [
|
|
147
|
+
...result.validation.errors,
|
|
148
|
+
...result.validation.missingNodes.map((node) => `node ${node.nodeId} uses ${node.nodeType}${node.nodeVersion ? `@${node.nodeVersion}` : ''}, which is not installed`),
|
|
149
|
+
];
|
|
150
|
+
throw new CliUserError(`Creating ${input.workflowKey ?? input.name} failed: ${result.message ?? 'no reason given'}`, reasons.length > 0 ? { hint: reasons.join('\n') } : undefined);
|
|
151
|
+
}
|
|
152
|
+
return result.workflow;
|
|
153
|
+
},
|
|
154
|
+
async workflowVersionDiff(workflowKey, fromVersion, toVersion) {
|
|
155
|
+
const data = await request(CF_WORKFLOW_VERSION_DIFF, {
|
|
156
|
+
workflowKey,
|
|
157
|
+
fromVersion,
|
|
158
|
+
toVersion,
|
|
159
|
+
});
|
|
160
|
+
return data.workflowVersionDiff;
|
|
161
|
+
},
|
|
162
|
+
async validateDefinition(definitionJson, strict) {
|
|
163
|
+
const data = await request(CF_VALIDATE_WORKFLOW_DEFINITION, { definitionJson, strict });
|
|
164
|
+
return data.validateWorkflowDefinition;
|
|
165
|
+
},
|
|
166
|
+
async workflowInterface(workflowKey, version) {
|
|
167
|
+
const data = await request(CF_WORKFLOW_INTERFACE, {
|
|
168
|
+
workflowKey,
|
|
169
|
+
version: version ?? null,
|
|
170
|
+
});
|
|
171
|
+
return data.workflowInterface;
|
|
172
|
+
},
|
|
173
|
+
async nodeManifests() {
|
|
174
|
+
const rows = await paginate(async (offset) => {
|
|
175
|
+
const data = await request(CF_LIST_NODE_MANIFESTS, {
|
|
176
|
+
status: 'AVAILABLE',
|
|
177
|
+
pagination: { limit: PAGE_SIZE, offset },
|
|
178
|
+
});
|
|
179
|
+
return {
|
|
180
|
+
rows: data.nodeEndpointConfigs.configs,
|
|
181
|
+
hasMore: data.nodeEndpointConfigs.pagination?.hasMore ?? false,
|
|
182
|
+
};
|
|
183
|
+
});
|
|
184
|
+
return rows
|
|
185
|
+
.map(manifestFromConfig)
|
|
186
|
+
.filter((manifest) => manifest !== null)
|
|
187
|
+
.sort((a, b) => compareText(`${a.nodeType}\u0000${String(a.nodeVersion)}`, `${b.nodeType}\u0000${String(b.nodeVersion)}`));
|
|
188
|
+
},
|
|
189
|
+
async connections() {
|
|
190
|
+
const rows = await paginate(async (offset) => {
|
|
191
|
+
const data = await request(CF_LIST_CONNECTIONS, { pagination: { limit: PAGE_SIZE, offset } });
|
|
192
|
+
return { rows: data.getConnections.items, hasMore: data.getConnections.hasMore };
|
|
193
|
+
});
|
|
194
|
+
return rows.map((row) => ({
|
|
195
|
+
id: row.id,
|
|
196
|
+
name: row.name,
|
|
197
|
+
providerKey: row.provider?.key ?? null,
|
|
198
|
+
}));
|
|
199
|
+
},
|
|
200
|
+
async prepareCodeUpload(input) {
|
|
201
|
+
const data = await request(CF_PREPARE_WORKFLOW_CODE_UPLOAD, { input });
|
|
202
|
+
const ticket = data.prepareWorkflowCodeUpload;
|
|
203
|
+
return {
|
|
204
|
+
uploadId: ticket.uploadId,
|
|
205
|
+
bundle: parsePresignedPut(ticket.bundle, 'bundle'),
|
|
206
|
+
source: ticket.source === null || ticket.source === undefined
|
|
207
|
+
? null
|
|
208
|
+
: parsePresignedPut(ticket.source, 'source'),
|
|
209
|
+
};
|
|
210
|
+
},
|
|
211
|
+
async replaceVersionCode(workflowKey, version, codeBundle, verifyReplay) {
|
|
212
|
+
const data = await request(CF_REPLACE_WORKFLOW_VERSION_CODE, { workflowKey, version, codeBundle, verifyReplay });
|
|
213
|
+
return data.replaceWorkflowVersionCode;
|
|
214
|
+
},
|
|
215
|
+
async codeReplace(id) {
|
|
216
|
+
const data = await request(CF_WORKFLOW_CODE_REPLACE, { id });
|
|
217
|
+
return data.workflowCodeReplace;
|
|
218
|
+
},
|
|
219
|
+
async codeBundle(workflowKey, version) {
|
|
220
|
+
const data = await request(CF_WORKFLOW_CODE_BUNDLE, { workflowKey, version });
|
|
221
|
+
return data.workflowCodeBundle;
|
|
222
|
+
},
|
|
223
|
+
async startWorkflow(input) {
|
|
224
|
+
const data = await request(CF_START_WORKFLOW, {
|
|
225
|
+
input,
|
|
226
|
+
});
|
|
227
|
+
return data.startWorkflow;
|
|
228
|
+
},
|
|
229
|
+
async describeRun(runId) {
|
|
230
|
+
const data = await request(CF_DESCRIBE_RUN, {
|
|
231
|
+
id: runId,
|
|
232
|
+
});
|
|
233
|
+
if (!data.workflowRun)
|
|
234
|
+
throw new CliUserError(`Run ${runId} not found (NOT_FOUND)`);
|
|
235
|
+
return data.workflowRun;
|
|
236
|
+
},
|
|
237
|
+
async runHistoryPage(runId, after, limit) {
|
|
238
|
+
const data = await request(CF_WORKFLOW_RUN_HISTORY, {
|
|
239
|
+
runId,
|
|
240
|
+
after,
|
|
241
|
+
limit,
|
|
242
|
+
});
|
|
243
|
+
return data.workflowRunHistory;
|
|
244
|
+
},
|
|
245
|
+
async signalRun(input) {
|
|
246
|
+
const data = await request(CF_SIGNAL_WORKFLOW_RUN, {
|
|
247
|
+
runId: input.runId,
|
|
248
|
+
name: input.name,
|
|
249
|
+
payload: input.payload ?? null,
|
|
250
|
+
idempotencyKey: input.idempotencyKey ?? null,
|
|
251
|
+
});
|
|
252
|
+
return data.signalWorkflowRun;
|
|
253
|
+
},
|
|
254
|
+
async terminateRun(runId, reason) {
|
|
255
|
+
const data = await request(CF_TERMINATE_WORKFLOW_RUN, { runId, reason: reason ?? null });
|
|
256
|
+
return data.terminateWorkflowRun;
|
|
257
|
+
},
|
|
258
|
+
async runStackTrace(runId, enhanced) {
|
|
259
|
+
const data = await request(CF_WORKFLOW_RUN_STACK_TRACE, { runId, enhanced });
|
|
260
|
+
return data.workflowRunStackTrace;
|
|
261
|
+
},
|
|
262
|
+
async listRuns(workflowKey, limit) {
|
|
263
|
+
if (limit <= 0)
|
|
264
|
+
return [];
|
|
265
|
+
const rows = [];
|
|
266
|
+
for (let page = 0; page < MAX_PAGES && rows.length < limit; page++) {
|
|
267
|
+
const data = await request(CF_LIST_RUNS, {
|
|
268
|
+
input: {
|
|
269
|
+
workflowKey,
|
|
270
|
+
limit: Math.min(PAGE_SIZE, limit - rows.length),
|
|
271
|
+
offset: rows.length,
|
|
272
|
+
},
|
|
273
|
+
});
|
|
274
|
+
rows.push(...data.workflowRuns.items);
|
|
275
|
+
if (!data.workflowRuns.hasMore || data.workflowRuns.items.length === 0)
|
|
276
|
+
break;
|
|
277
|
+
}
|
|
278
|
+
return rows.slice(0, limit);
|
|
279
|
+
},
|
|
280
|
+
async triggerWorkflow(input) {
|
|
281
|
+
const data = await request(CF_TRIGGER_WORKFLOW, {
|
|
282
|
+
input,
|
|
283
|
+
});
|
|
284
|
+
return data.triggerWorkflow;
|
|
285
|
+
},
|
|
286
|
+
};
|
|
287
|
+
}
|
|
288
|
+
//# sourceMappingURL=api.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.js","sourceRoot":"","sources":["../../src/code-first/api.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,YAAY,EAAE,YAAY,EAAmB,MAAM,yBAAyB,CAAC;AAGtF,OAAO,EACL,0BAA0B,EAC1B,kBAAkB,EAClB,kBAAkB,EAClB,mBAAmB,EACnB,sBAAsB,EACtB,qBAAqB,EACrB,+BAA+B,EAC/B,qBAAqB,EACrB,wBAAwB,EACxB,oBAAoB,EACpB,sBAAsB,GAEvB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,eAAe,EACf,YAAY,EACZ,+BAA+B,EAC/B,gCAAgC,EAChC,sBAAsB,EACtB,iBAAiB,EACjB,yBAAyB,EACzB,mBAAmB,EACnB,uBAAuB,EACvB,wBAAwB,EACxB,uBAAuB,EACvB,2BAA2B,GAC5B,MAAM,yBAAyB,CAAC;AAuTjC,6FAA6F;AAC7F,MAAM,CAAC,MAAM,SAAS,GAAG,GAAG,CAAC;AAC7B,2FAA2F;AAC3F,MAAM,CAAC,MAAM,SAAS,GAAG,GAAG,CAAC;AAsE7B,kDAAkD;AAClD,MAAM,UAAU,WAAW,CAAC,CAAS,EAAE,CAAS;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AAK,EAAE,IAAI,EAAE,EAAE,CAAC;gBACnE,MAAM,IAAI,GAAG,MAAM,OAAO,CAEvB,YAAY,EAAE;oBACf,KAAK,EAAE;wBACL,WAAW;wBACX,KAAK,EAAE,IAAI,CAAC,GAAG,CAAC,SAAS,EAAE,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC;wBAC/C,MAAM,EAAE,IAAI,CAAC,MAAM;qBACpB;iBACF,CAAC,CAAC;gBACH,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;gBACtC,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,OAAO,IAAI,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC;oBAAE,MAAM;YAChF,CAAC;YACD,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;QAC9B,CAAC;QAED,KAAK,CAAC,eAAe,CAAC,KAAmB;YACvC,MAAM,IAAI,GAAG,MAAM,OAAO,CAAqC,mBAAmB,EAAE;gBAClF,KAAK;aACN,CAAC,CAAC;YACH,OAAO,IAAI,CAAC,eAAe,CAAC;QAC9B,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Uploading a code bundle (durable functions, Phase B; C-S3, DB11, DB12):
|
|
3
|
+
*
|
|
4
|
+
* 1. The bundle `lower()` built is one ES module whose `buildId` is
|
|
5
|
+
* `sha256:<hex>` of its bytes. The source archive is `packSources` of the
|
|
6
|
+
* files it was built from, the project's lockfile and the vendored pure-ESM
|
|
7
|
+
* packages, so the service can rebuild the same bytes.
|
|
8
|
+
* 2. `prepareWorkflowCodeUpload` checks the caps and the
|
|
9
|
+
* `fluidgrids.code-bundles.bytes` quota and returns presigned PUTs: the
|
|
10
|
+
* bundle to its content-addressed key (skipped when `alreadyStored`), the
|
|
11
|
+
* source to an upload staging key.
|
|
12
|
+
* 3. The version is created with `codeBundle: { uploadId, … }`; the service
|
|
13
|
+
* verifies the checksum, scans the source for secrets and links the bundle.
|
|
14
|
+
*
|
|
15
|
+
* One bundle serves every workflow version of a push. Each version needs its
|
|
16
|
+
* own upload ticket (the ticket binds a workflow key and is consumed by the
|
|
17
|
+
* version), but only the first PUT of the bundle transfers it.
|
|
18
|
+
*/
|
|
19
|
+
import type { CodeBundleInput } from './api.js';
|
|
20
|
+
import type { LocalWorkflow, LoweredProject } from './lowering.js';
|
|
21
|
+
import type { Project } from './project.js';
|
|
22
|
+
import { type CommandEnv } from './shared.js';
|
|
23
|
+
/** Largest source archive the service accepts, as uploaded (spec 01 §5). */
|
|
24
|
+
export declare const MAX_SOURCE_ARCHIVE_BYTES: number;
|
|
25
|
+
/** Lockfiles recorded in the source archive, first match wins. */
|
|
26
|
+
export declare const LOCKFILES: readonly string[];
|
|
27
|
+
export interface PreparedBundle {
|
|
28
|
+
buildId: string;
|
|
29
|
+
sourceHash: string;
|
|
30
|
+
sdkVersion: string;
|
|
31
|
+
bundle: Uint8Array;
|
|
32
|
+
archive: Uint8Array;
|
|
33
|
+
}
|
|
34
|
+
export interface BundleUpload {
|
|
35
|
+
uploadId: string;
|
|
36
|
+
/** False when the service already stored this bundle (no bytes sent). */
|
|
37
|
+
bundleSent: boolean;
|
|
38
|
+
sourceSent: boolean;
|
|
39
|
+
}
|
|
40
|
+
/** The bundle and source archive of a lowered TypeScript project, size-checked. */
|
|
41
|
+
export declare function prepareBundle(project: Project, lowered: LoweredProject): PreparedBundle;
|
|
42
|
+
/** Get an upload ticket for `workflowKey` and send what the service does not have yet. */
|
|
43
|
+
export declare function uploadBundle(env: CommandEnv, prepared: PreparedBundle, workflowKey: string): Promise<BundleUpload>;
|
|
44
|
+
/**
|
|
45
|
+
* The `code` block of a workflow that the prepared bundle serves. Refuses a
|
|
46
|
+
* workflow that runs no code or records another build; `push` calls it for
|
|
47
|
+
* every version it will write before it writes the first one.
|
|
48
|
+
*/
|
|
49
|
+
export declare function bundleCodeBlock(workflow: LocalWorkflow, prepared: PreparedBundle): Record<string, unknown>;
|
|
50
|
+
/** `CodeBundleInput` for one workflow's version, from its definition's `code` block. */
|
|
51
|
+
export declare function codeBundleInput(uploadId: string, workflow: LocalWorkflow, prepared: PreparedBundle): CodeBundleInput;
|
|
52
|
+
//# sourceMappingURL=code-upload.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"code-upload.d.ts","sourceRoot":"","sources":["../../src/code-first/code-upload.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAQH,OAAO,KAAK,EAAE,eAAe,EAAgB,MAAM,UAAU,CAAC;AAC9D,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAGnE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAiB,KAAK,UAAU,EAAE,MAAM,aAAa,CAAC;AAE7D,4EAA4E;AAC5E,eAAO,MAAM,wBAAwB,QAAmB,CAAC;AAKzD,kEAAkE;AAClE,eAAO,MAAM,SAAS,EAAE,SAAS,MAAM,EAKtC,CAAC;AASF,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,UAAU,CAAC;IACnB,OAAO,EAAE,UAAU,CAAC;CACrB;AAED,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,yEAAyE;IACzE,UAAU,EAAE,OAAO,CAAC;IACpB,UAAU,EAAE,OAAO,CAAC;CACrB;AAUD,mFAAmF;AACnF,wBAAgB,aAAa,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,cAAc,GAAG,cAAc,CAqCvF;AAqCD,0FAA0F;AAC1F,wBAAsB,YAAY,CAChC,GAAG,EAAE,UAAU,EACf,QAAQ,EAAE,cAAc,EACxB,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,YAAY,CAAC,CAmBvB;AAMD;;;;GAIG;AACH,wBAAgB,eAAe,CAC7B,QAAQ,EAAE,aAAa,EACvB,QAAQ,EAAE,cAAc,GACvB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAWzB;AAED,wFAAwF;AACxF,wBAAgB,eAAe,CAC7B,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,aAAa,EACvB,QAAQ,EAAE,cAAc,GACvB,eAAe,CAWjB"}
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Uploading a code bundle (durable functions, Phase B; C-S3, DB11, DB12):
|
|
3
|
+
*
|
|
4
|
+
* 1. The bundle `lower()` built is one ES module whose `buildId` is
|
|
5
|
+
* `sha256:<hex>` of its bytes. The source archive is `packSources` of the
|
|
6
|
+
* files it was built from, the project's lockfile and the vendored pure-ESM
|
|
7
|
+
* packages, so the service can rebuild the same bytes.
|
|
8
|
+
* 2. `prepareWorkflowCodeUpload` checks the caps and the
|
|
9
|
+
* `fluidgrids.code-bundles.bytes` quota and returns presigned PUTs: the
|
|
10
|
+
* bundle to its content-addressed key (skipped when `alreadyStored`), the
|
|
11
|
+
* source to an upload staging key.
|
|
12
|
+
* 3. The version is created with `codeBundle: { uploadId, … }`; the service
|
|
13
|
+
* verifies the checksum, scans the source for secrets and links the bundle.
|
|
14
|
+
*
|
|
15
|
+
* One bundle serves every workflow version of a push. Each version needs its
|
|
16
|
+
* own upload ticket (the ticket binds a workflow key and is consumed by the
|
|
17
|
+
* version), but only the first PUT of the bundle transfers it.
|
|
18
|
+
*/
|
|
19
|
+
import { CliUserError } from '@burdenoff/cli-sdk/core';
|
|
20
|
+
import { SDK_VERSION } from '@fluidgrids/workflows';
|
|
21
|
+
import { packSources } from '@fluidgrids/workflows/roundtrip';
|
|
22
|
+
import { existsSync, readFileSync } from 'fs';
|
|
23
|
+
import { join } from 'path';
|
|
24
|
+
import { MAX_BUNDLE_BYTES } from './lowering.js';
|
|
25
|
+
import { presignedUrl, readCapped, storageErrorSummary } from './presigned.js';
|
|
26
|
+
import { describeError } from './shared.js';
|
|
27
|
+
/** Largest source archive the service accepts, as uploaded (spec 01 §5). */
|
|
28
|
+
export const MAX_SOURCE_ARCHIVE_BYTES = 32 * 1024 * 1024;
|
|
29
|
+
/** Most of an upload error body read to find its error code. */
|
|
30
|
+
const ERROR_BODY_BYTES = 64 * 1024;
|
|
31
|
+
/** Lockfiles recorded in the source archive, first match wins. */
|
|
32
|
+
export const LOCKFILES = [
|
|
33
|
+
'bun.lock',
|
|
34
|
+
'package-lock.json',
|
|
35
|
+
'pnpm-lock.yaml',
|
|
36
|
+
'yarn.lock',
|
|
37
|
+
];
|
|
38
|
+
/**
|
|
39
|
+
* Headers the HTTP client computes itself. The presigned URL signs
|
|
40
|
+
* `content-length`; the client sends the same value because it sends exactly
|
|
41
|
+
* the body the length was declared for.
|
|
42
|
+
*/
|
|
43
|
+
const CLIENT_HEADERS = new Set(['content-length', 'host']);
|
|
44
|
+
function lockText(root) {
|
|
45
|
+
for (const name of LOCKFILES) {
|
|
46
|
+
const path = join(root, name);
|
|
47
|
+
if (existsSync(path))
|
|
48
|
+
return readFileSync(path, 'utf8');
|
|
49
|
+
}
|
|
50
|
+
return undefined;
|
|
51
|
+
}
|
|
52
|
+
/** The bundle and source archive of a lowered TypeScript project, size-checked. */
|
|
53
|
+
export function prepareBundle(project, lowered) {
|
|
54
|
+
if (!lowered.bundle || !lowered.buildId || !lowered.sourceHash || !lowered.sourceFiles) {
|
|
55
|
+
throw new CliUserError('This project has no code bundle to upload.', {
|
|
56
|
+
hint: 'Durable functions are TypeScript `workflow()` exports (Python ones arrive in Phase C).',
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
const bundle = new TextEncoder().encode(lowered.bundle);
|
|
60
|
+
if (bundle.byteLength > MAX_BUNDLE_BYTES) {
|
|
61
|
+
throw new CliUserError(`The code bundle is ${bundle.byteLength} bytes; the limit is ${MAX_BUNDLE_BYTES}.`);
|
|
62
|
+
}
|
|
63
|
+
const archiveInput = { files: lowered.sourceFiles };
|
|
64
|
+
const lock = lockText(project.root);
|
|
65
|
+
if (lock !== undefined)
|
|
66
|
+
archiveInput.lock = lock;
|
|
67
|
+
if (lowered.vendored) {
|
|
68
|
+
archiveInput.vendored = Object.fromEntries(Object.entries(lowered.vendored).map(([name, pkg]) => [
|
|
69
|
+
name,
|
|
70
|
+
{ version: pkg.version, files: { ...pkg.files } },
|
|
71
|
+
]));
|
|
72
|
+
}
|
|
73
|
+
const archive = packSources(archiveInput);
|
|
74
|
+
if (archive.byteLength > MAX_SOURCE_ARCHIVE_BYTES) {
|
|
75
|
+
throw new CliUserError(`The source archive is ${archive.byteLength} bytes; the limit is ${MAX_SOURCE_ARCHIVE_BYTES}.`, { hint: 'Vendored dependencies count toward it; drop unused `dependencies`.' });
|
|
76
|
+
}
|
|
77
|
+
return {
|
|
78
|
+
buildId: lowered.buildId,
|
|
79
|
+
sourceHash: lowered.sourceHash,
|
|
80
|
+
sdkVersion: SDK_VERSION,
|
|
81
|
+
bundle,
|
|
82
|
+
archive,
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
async function put(env, target, body, what) {
|
|
86
|
+
if (target.method.toUpperCase() !== 'PUT') {
|
|
87
|
+
throw new CliUserError(`The service asked for a ${target.method} ${what} upload; expected PUT.`);
|
|
88
|
+
}
|
|
89
|
+
presignedUrl(target.url, `${what} upload`);
|
|
90
|
+
const headers = Object.fromEntries(Object.entries(target.headers).filter(([name]) => !CLIENT_HEADERS.has(name.toLowerCase())));
|
|
91
|
+
let response;
|
|
92
|
+
try {
|
|
93
|
+
response = await env.fetch(target.url, { method: 'PUT', headers, body });
|
|
94
|
+
}
|
|
95
|
+
catch (error) {
|
|
96
|
+
// The URL carries a signature; it is never printed.
|
|
97
|
+
throw new CliUserError(`Uploading the ${what} failed: ${describeError(error)}`);
|
|
98
|
+
}
|
|
99
|
+
if (!response.ok) {
|
|
100
|
+
// Only the error code and message: an S3 error body echoes the access key
|
|
101
|
+
// id, the string to sign and the signature of the presigned request.
|
|
102
|
+
const body = await readCapped(response, ERROR_BODY_BYTES, () => new Error('too large'))
|
|
103
|
+
.then((bytes) => new TextDecoder().decode(bytes))
|
|
104
|
+
.catch(() => '');
|
|
105
|
+
const summary = storageErrorSummary(body);
|
|
106
|
+
throw new CliUserError(`Uploading the ${what} failed with HTTP ${response.status}${summary ? ` (${summary})` : ''}.`);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
/** Get an upload ticket for `workflowKey` and send what the service does not have yet. */
|
|
110
|
+
export async function uploadBundle(env, prepared, workflowKey) {
|
|
111
|
+
const ticket = await env.api.prepareCodeUpload({
|
|
112
|
+
workflowKey,
|
|
113
|
+
buildId: prepared.buildId,
|
|
114
|
+
bundleBytes: prepared.bundle.byteLength,
|
|
115
|
+
sourceHash: prepared.sourceHash,
|
|
116
|
+
sourceBytes: prepared.archive.byteLength,
|
|
117
|
+
});
|
|
118
|
+
let bundleSent = false;
|
|
119
|
+
if (!ticket.bundle.alreadyStored) {
|
|
120
|
+
await put(env, ticket.bundle, prepared.bundle, 'code bundle');
|
|
121
|
+
bundleSent = true;
|
|
122
|
+
}
|
|
123
|
+
let sourceSent = false;
|
|
124
|
+
if (ticket.source && !ticket.source.alreadyStored) {
|
|
125
|
+
await put(env, ticket.source, prepared.archive, 'source archive');
|
|
126
|
+
sourceSent = true;
|
|
127
|
+
}
|
|
128
|
+
return { uploadId: ticket.uploadId, bundleSent, sourceSent };
|
|
129
|
+
}
|
|
130
|
+
function isRecord(value) {
|
|
131
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* The `code` block of a workflow that the prepared bundle serves. Refuses a
|
|
135
|
+
* workflow that runs no code or records another build; `push` calls it for
|
|
136
|
+
* every version it will write before it writes the first one.
|
|
137
|
+
*/
|
|
138
|
+
export function bundleCodeBlock(workflow, prepared) {
|
|
139
|
+
const code = workflow.definition['code'];
|
|
140
|
+
if (!isRecord(code)) {
|
|
141
|
+
throw new CliUserError(`${workflow.key} does not run code; it needs no bundle.`);
|
|
142
|
+
}
|
|
143
|
+
if (code['buildId'] !== prepared.buildId) {
|
|
144
|
+
throw new CliUserError(`${workflow.key} records buildId ${String(code['buildId'])}, but the bundle is ${prepared.buildId}.`);
|
|
145
|
+
}
|
|
146
|
+
return code;
|
|
147
|
+
}
|
|
148
|
+
/** `CodeBundleInput` for one workflow's version, from its definition's `code` block. */
|
|
149
|
+
export function codeBundleInput(uploadId, workflow, prepared) {
|
|
150
|
+
const code = bundleCodeBlock(workflow, prepared);
|
|
151
|
+
return {
|
|
152
|
+
uploadId,
|
|
153
|
+
buildId: prepared.buildId,
|
|
154
|
+
language: typeof code['language'] === 'string' ? code['language'] : 'typescript',
|
|
155
|
+
sdkVersion: prepared.sdkVersion,
|
|
156
|
+
entry: workflow.path,
|
|
157
|
+
exports: code['exports'] ?? { workflows: {} },
|
|
158
|
+
determinism: typeof code['determinism'] === 'string' ? code['determinism'] : 'isolate',
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
//# sourceMappingURL=code-upload.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"code-upload.js","sourceRoot":"","sources":["../../src/code-first/code-upload.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAsB,MAAM,iCAAiC,CAAC;AAClF,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAC9C,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAI5B,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAC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 -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `fluidgrids codegen [--lang ts|py]`: regenerate `.fluidgrids/nodes.ts|py`
|
|
3
|
+
* from the workspace's node registry and record the snapshot in `lock.json`.
|
|
4
|
+
*/
|
|
5
|
+
import type { NodeManifest } from '@fluidgrids/workflows/ir';
|
|
6
|
+
import { type Project, type ProjectLanguage } from '../project.js';
|
|
7
|
+
import { type CommandEnv, type ProjectOptions } from '../shared.js';
|
|
8
|
+
export interface CodegenResult {
|
|
9
|
+
path: string;
|
|
10
|
+
language: ProjectLanguage;
|
|
11
|
+
registrySnapshot: string;
|
|
12
|
+
nodeTypes: number;
|
|
13
|
+
changed: boolean;
|
|
14
|
+
}
|
|
15
|
+
/** Write the clients for `manifests` and update the lock (in memory and on disk). */
|
|
16
|
+
export declare function writeNodeClients(project: Project, manifests: readonly NodeManifest[], language: ProjectLanguage): Promise<CodegenResult>;
|
|
17
|
+
export declare function runCodegen(env: CommandEnv, options: ProjectOptions & {
|
|
18
|
+
lang?: string;
|
|
19
|
+
}): Promise<CodegenResult>;
|
|
20
|
+
//# sourceMappingURL=codegen.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codegen.d.ts","sourceRoot":"","sources":["../../../src/code-first/commands/codegen.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAE7D,OAAO,EAML,KAAK,OAAO,EACZ,KAAK,eAAe,EACrB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAqB,KAAK,UAAU,EAAE,KAAK,cAAc,EAAE,MAAM,cAAc,CAAC;AAEvF,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,eAAe,CAAC;IAC1B,gBAAgB,EAAE,MAAM,CAAC;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,qFAAqF;AACrF,wBAAsB,gBAAgB,CACpC,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,SAAS,YAAY,EAAE,EAClC,QAAQ,EAAE,eAAe,GACxB,OAAO,CAAC,aAAa,CAAC,CAqBxB;AAED,wBAAsB,UAAU,CAC9B,GAAG,EAAE,UAAU,EACf,OAAO,EAAE,cAAc,GAAG;IAAE,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,GAC1C,OAAO,CAAC,aAAa,CAAC,CAmBxB"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `fluidgrids codegen [--lang ts|py]`: regenerate `.fluidgrids/nodes.ts|py`
|
|
3
|
+
* from the workspace's node registry and record the snapshot in `lock.json`.
|
|
4
|
+
*/
|
|
5
|
+
import { generateNodeClients } from '@fluidgrids/workflows/codegen';
|
|
6
|
+
import { assertProjectWorkspace, loadProject, PROJECT_LANGUAGES, writeLock, writeProjectFile, } from '../project.js';
|
|
7
|
+
import { emit, parseChoice } from '../shared.js';
|
|
8
|
+
/** Write the clients for `manifests` and update the lock (in memory and on disk). */
|
|
9
|
+
export async function writeNodeClients(project, manifests, language) {
|
|
10
|
+
const generated = await generateNodeClients(manifests, language);
|
|
11
|
+
const previous = project.lock.registrySnapshot;
|
|
12
|
+
writeProjectFile(project.root, generated.path, generated.content);
|
|
13
|
+
const external = manifests.filter((manifest) => !manifest.nodeType.startsWith('internal:'));
|
|
14
|
+
project.lock.registrySnapshot = generated.registrySnapshot;
|
|
15
|
+
project.lock.nodes = external
|
|
16
|
+
.map((manifest) => ({ nodeType: manifest.nodeType, nodeVersion: manifest.nodeVersion ?? null }))
|
|
17
|
+
.sort((a, b) => {
|
|
18
|
+
const left = `${a.nodeType}\u0000${a.nodeVersion ?? ''}`;
|
|
19
|
+
const right = `${b.nodeType}\u0000${b.nodeVersion ?? ''}`;
|
|
20
|
+
return left < right ? -1 : left > right ? 1 : 0;
|
|
21
|
+
});
|
|
22
|
+
writeLock(project);
|
|
23
|
+
return {
|
|
24
|
+
path: generated.path,
|
|
25
|
+
language,
|
|
26
|
+
registrySnapshot: generated.registrySnapshot,
|
|
27
|
+
nodeTypes: new Set(external.map((manifest) => manifest.nodeType)).size,
|
|
28
|
+
changed: previous !== generated.registrySnapshot,
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
export async function runCodegen(env, options) {
|
|
32
|
+
const project = loadProject(options.project, env.cwd());
|
|
33
|
+
assertProjectWorkspace(env, project);
|
|
34
|
+
const language = parseChoice(options.lang, '--lang', PROJECT_LANGUAGES) ?? project.config.language;
|
|
35
|
+
const manifests = await env.api.nodeManifests();
|
|
36
|
+
const result = await writeNodeClients(project, manifests, language);
|
|
37
|
+
emit(env, options, result, {
|
|
38
|
+
headers: ['File', 'Node types', 'Registry snapshot', 'Changed'],
|
|
39
|
+
rows: [
|
|
40
|
+
[
|
|
41
|
+
result.path,
|
|
42
|
+
String(result.nodeTypes),
|
|
43
|
+
result.registrySnapshot,
|
|
44
|
+
result.changed ? 'yes' : 'no',
|
|
45
|
+
],
|
|
46
|
+
],
|
|
47
|
+
});
|
|
48
|
+
return result;
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=codegen.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codegen.js","sourceRoot":"","sources":["../../../src/code-first/commands/codegen.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AAGpE,OAAO,EACL,sBAAsB,EACtB,WAAW,EACX,iBAAiB,EACjB,SAAS,EACT,gBAAgB,GAGjB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,IAAI,EAAE,WAAW,EAAwC,MAAM,cAAc,CAAC;AAUvF,qFAAqF;AACrF,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,OAAgB,EAChB,SAAkC,EAClC,QAAyB;IAEzB,MAAM,SAAS,GAAG,MAAM,mBAAmB,CA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AAQ,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI;QACtE,OAAO,EAAE,QAAQ,KAAK,SAAS,CAAC,gBAAgB;KACjD,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,UAAU,CAC9B,GAAe,EACf,OAA2C;IAE3C,MAAM,OAAO,GAAG,WAAW,CAAC,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC;IACxD,sBAAsB,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;IACrC,MAAM,QAAQ,GACZ,WAAW,CAAC,OAAO,CAAC,IAAI,EAAE,QAAQ,EAAE,iBAAiB,CAAC,IAAI,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC;IACpF,MAAM,SAAS,GAAG,MAAM,GAAG,CAAC,GAAG,CAAC,aAAa,EAAE,CAAC;IAChD,MAAM,MAAM,GAAG,MAAM,gBAAgB,CAAC,OAAO,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC;IACpE,IAAI,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE;QACzB,OAAO,EAAE,CAAC,MAAM,EAAE,YAAY,EAAE,mBAAmB,EAAE,SAAS,CAAC;QAC/D,IAAI,EAAE;YACJ;gBACE,MAAM,CAAC,IAAI;gBACX,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC;gBACxB,MAAM,CAAC,gBAAgB;gBACvB,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI;aAC9B;SACF;KACF,CAAC,CAAC;IACH,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `fluidgrids diff [key…] [--against latest|active|<version>]`: the IR diff of
|
|
3
|
+
* the local workflows against a stored version (spec 07 §7). Both sides are
|
|
4
|
+
* compared after normalisation, without `authoring`, with the stored pinned
|
|
5
|
+
* data carried over exactly as `push` would.
|
|
6
|
+
*/
|
|
7
|
+
import { type CommandEnv, type ProjectOptions } from '../shared.js';
|
|
8
|
+
export interface DiffOptions extends ProjectOptions {
|
|
9
|
+
against?: string;
|
|
10
|
+
exitCode?: boolean;
|
|
11
|
+
}
|
|
12
|
+
export interface DiffItem {
|
|
13
|
+
key: string;
|
|
14
|
+
against: string | null;
|
|
15
|
+
status: 'same' | 'changed' | 'new';
|
|
16
|
+
changes: Array<{
|
|
17
|
+
kind: string;
|
|
18
|
+
path: string;
|
|
19
|
+
before?: unknown;
|
|
20
|
+
after?: unknown;
|
|
21
|
+
}>;
|
|
22
|
+
}
|
|
23
|
+
export interface DiffResult {
|
|
24
|
+
against: string;
|
|
25
|
+
workflows: DiffItem[];
|
|
26
|
+
}
|
|
27
|
+
export declare function runDiff(env: CommandEnv, keys: readonly string[], options: DiffOptions): Promise<DiffResult>;
|
|
28
|
+
//# sourceMappingURL=diff.d.ts.map
|