@fluidgrids/cli 2026.1107.1 → 2026.1109.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/README.md +98 -6
- package/dist/cli.js +9705 -33
- package/package.json +42 -35
- package/dist/auth/device-login.d.ts +0 -31
- package/dist/auth/device-login.d.ts.map +0 -1
- package/dist/auth/device-login.js +0 -75
- package/dist/auth/device-login.js.map +0 -1
- package/dist/auth/token-auth.d.ts +0 -49
- package/dist/auth/token-auth.d.ts.map +0 -1
- package/dist/auth/token-auth.js +0 -279
- package/dist/auth/token-auth.js.map +0 -1
- package/dist/cli.d.ts +0 -10
- package/dist/cli.d.ts.map +0 -1
- package/dist/cli.js.map +0 -1
- package/dist/code-first/api.d.ts +0 -601
- package/dist/code-first/api.d.ts.map +0 -1
- package/dist/code-first/api.js +0 -432
- package/dist/code-first/api.js.map +0 -1
- package/dist/code-first/code-upload.d.ts +0 -53
- package/dist/code-first/code-upload.d.ts.map +0 -1
- package/dist/code-first/code-upload.js +0 -165
- package/dist/code-first/code-upload.js.map +0 -1
- package/dist/code-first/commands/codegen.d.ts +0 -20
- package/dist/code-first/commands/codegen.d.ts.map +0 -1
- package/dist/code-first/commands/codegen.js +0 -50
- package/dist/code-first/commands/codegen.js.map +0 -1
- package/dist/code-first/commands/diff.d.ts +0 -28
- package/dist/code-first/commands/diff.d.ts.map +0 -1
- package/dist/code-first/commands/diff.js +0 -73
- package/dist/code-first/commands/diff.js.map +0 -1
- package/dist/code-first/commands/hotfix.d.ts +0 -54
- package/dist/code-first/commands/hotfix.d.ts.map +0 -1
- package/dist/code-first/commands/hotfix.js +0 -225
- package/dist/code-first/commands/hotfix.js.map +0 -1
- package/dist/code-first/commands/import.d.ts +0 -40
- package/dist/code-first/commands/import.d.ts.map +0 -1
- package/dist/code-first/commands/import.js +0 -235
- package/dist/code-first/commands/import.js.map +0 -1
- package/dist/code-first/commands/init.d.ts +0 -33
- package/dist/code-first/commands/init.d.ts.map +0 -1
- package/dist/code-first/commands/init.js +0 -177
- package/dist/code-first/commands/init.js.map +0 -1
- package/dist/code-first/commands/interface.d.ts +0 -12
- package/dist/code-first/commands/interface.d.ts.map +0 -1
- package/dist/code-first/commands/interface.js +0 -21
- package/dist/code-first/commands/interface.js.map +0 -1
- package/dist/code-first/commands/pull.d.ts +0 -63
- package/dist/code-first/commands/pull.d.ts.map +0 -1
- package/dist/code-first/commands/pull.js +0 -266
- package/dist/code-first/commands/pull.js.map +0 -1
- package/dist/code-first/commands/push.d.ts +0 -97
- package/dist/code-first/commands/push.d.ts.map +0 -1
- package/dist/code-first/commands/push.js +0 -313
- package/dist/code-first/commands/push.js.map +0 -1
- package/dist/code-first/commands/replay.d.ts +0 -44
- package/dist/code-first/commands/replay.d.ts.map +0 -1
- package/dist/code-first/commands/replay.js +0 -238
- package/dist/code-first/commands/replay.js.map +0 -1
- package/dist/code-first/commands/runs.d.ts +0 -160
- package/dist/code-first/commands/runs.d.ts.map +0 -1
- package/dist/code-first/commands/runs.js +0 -565
- package/dist/code-first/commands/runs.js.map +0 -1
- package/dist/code-first/commands/suite.d.ts +0 -57
- package/dist/code-first/commands/suite.d.ts.map +0 -1
- package/dist/code-first/commands/suite.js +0 -197
- package/dist/code-first/commands/suite.js.map +0 -1
- package/dist/code-first/commands/validate.d.ts +0 -38
- package/dist/code-first/commands/validate.d.ts.map +0 -1
- package/dist/code-first/commands/validate.js +0 -140
- package/dist/code-first/commands/validate.js.map +0 -1
- package/dist/code-first/commands/versions.d.ts +0 -63
- package/dist/code-first/commands/versions.d.ts.map +0 -1
- package/dist/code-first/commands/versions.js +0 -204
- package/dist/code-first/commands/versions.js.map +0 -1
- package/dist/code-first/connections.d.ts +0 -55
- package/dist/code-first/connections.d.ts.map +0 -1
- package/dist/code-first/connections.js +0 -180
- package/dist/code-first/connections.js.map +0 -1
- package/dist/code-first/durable-operations.d.ts +0 -41
- package/dist/code-first/durable-operations.d.ts.map +0 -1
- package/dist/code-first/durable-operations.js +0 -135
- package/dist/code-first/durable-operations.js.map +0 -1
- package/dist/code-first/history.d.ts +0 -30
- package/dist/code-first/history.d.ts.map +0 -1
- package/dist/code-first/history.js +0 -139
- package/dist/code-first/history.js.map +0 -1
- package/dist/code-first/imports.d.ts +0 -22
- package/dist/code-first/imports.d.ts.map +0 -1
- package/dist/code-first/imports.js +0 -67
- package/dist/code-first/imports.js.map +0 -1
- package/dist/code-first/index.d.ts +0 -18
- package/dist/code-first/index.d.ts.map +0 -1
- package/dist/code-first/index.js +0 -36
- package/dist/code-first/index.js.map +0 -1
- package/dist/code-first/junit.d.ts +0 -24
- package/dist/code-first/junit.d.ts.map +0 -1
- package/dist/code-first/junit.js +0 -163
- package/dist/code-first/junit.js.map +0 -1
- package/dist/code-first/lowering.d.ts +0 -94
- package/dist/code-first/lowering.d.ts.map +0 -1
- package/dist/code-first/lowering.js +0 -248
- package/dist/code-first/lowering.js.map +0 -1
- package/dist/code-first/operations.d.ts +0 -55
- package/dist/code-first/operations.d.ts.map +0 -1
- package/dist/code-first/operations.js +0 -165
- package/dist/code-first/operations.js.map +0 -1
- package/dist/code-first/parity-operations.d.ts +0 -44
- package/dist/code-first/parity-operations.d.ts.map +0 -1
- package/dist/code-first/parity-operations.js +0 -211
- package/dist/code-first/parity-operations.js.map +0 -1
- package/dist/code-first/parity.d.ts +0 -83
- package/dist/code-first/parity.d.ts.map +0 -1
- package/dist/code-first/parity.js +0 -301
- package/dist/code-first/parity.js.map +0 -1
- package/dist/code-first/presigned.d.ts +0 -21
- package/dist/code-first/presigned.d.ts.map +0 -1
- package/dist/code-first/presigned.js +0 -85
- package/dist/code-first/presigned.js.map +0 -1
- package/dist/code-first/project.d.ts +0 -123
- package/dist/code-first/project.d.ts.map +0 -1
- package/dist/code-first/project.js +0 -301
- package/dist/code-first/project.js.map +0 -1
- package/dist/code-first/python.d.ts +0 -81
- package/dist/code-first/python.d.ts.map +0 -1
- package/dist/code-first/python.js +0 -249
- package/dist/code-first/python.js.map +0 -1
- package/dist/code-first/redact.d.ts +0 -31
- package/dist/code-first/redact.d.ts.map +0 -1
- package/dist/code-first/redact.js +0 -159
- package/dist/code-first/redact.js.map +0 -1
- package/dist/code-first/register.d.ts +0 -35
- package/dist/code-first/register.d.ts.map +0 -1
- package/dist/code-first/register.js +0 -415
- package/dist/code-first/register.js.map +0 -1
- package/dist/code-first/remote.d.ts +0 -58
- package/dist/code-first/remote.d.ts.map +0 -1
- package/dist/code-first/remote.js +0 -126
- package/dist/code-first/remote.js.map +0 -1
- package/dist/code-first/replay.d.ts +0 -36
- package/dist/code-first/replay.d.ts.map +0 -1
- package/dist/code-first/replay.js +0 -52
- package/dist/code-first/replay.js.map +0 -1
- package/dist/code-first/shared.d.ts +0 -53
- package/dist/code-first/shared.d.ts.map +0 -1
- package/dist/code-first/shared.js +0 -94
- package/dist/code-first/shared.js.map +0 -1
- package/dist/code-first/test-suite-operations.d.ts +0 -16
- package/dist/code-first/test-suite-operations.d.ts.map +0 -1
- package/dist/code-first/test-suite-operations.js +0 -44
- package/dist/code-first/test-suite-operations.js.map +0 -1
- package/dist/modules.d.ts +0 -15
- package/dist/modules.d.ts.map +0 -1
- package/dist/modules.js +0 -61
- package/dist/modules.js.map +0 -1
- package/dist/product-defaults.d.ts +0 -11
- package/dist/product-defaults.d.ts.map +0 -1
- package/dist/product-defaults.js +0 -25
- package/dist/product-defaults.js.map +0 -1
- package/dist/program.d.ts +0 -20
- package/dist/program.d.ts.map +0 -1
- package/dist/program.js +0 -44
- package/dist/program.js.map +0 -1
|
@@ -1,165 +0,0 @@
|
|
|
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, plus the bundle's
|
|
8
|
-
* source map (C-SOURCEMAP, SDK R2) for source-mapped stack traces.
|
|
9
|
-
* 2. `prepareWorkflowCodeUpload` checks the caps and the
|
|
10
|
-
* `fluidgrids.code-bundles.bytes` quota and returns presigned PUTs: the
|
|
11
|
-
* bundle to its content-addressed key (skipped when `alreadyStored`), the
|
|
12
|
-
* source to an upload staging key.
|
|
13
|
-
* 3. The version is created with `codeBundle: { uploadId, … }`; the service
|
|
14
|
-
* verifies the checksum, scans the source for secrets and links the bundle.
|
|
15
|
-
*
|
|
16
|
-
* One bundle serves every workflow version of a push. Each version needs its
|
|
17
|
-
* own upload ticket (the ticket binds a workflow key and is consumed by the
|
|
18
|
-
* version), but only the first PUT of the bundle transfers it.
|
|
19
|
-
*/
|
|
20
|
-
import { CliUserError } from '@burdenoff/cli-sdk/core';
|
|
21
|
-
import { SDK_VERSION } from '@fluidgrids/workflows';
|
|
22
|
-
import { packSources } from '@fluidgrids/workflows/roundtrip';
|
|
23
|
-
import { existsSync, readFileSync } from 'fs';
|
|
24
|
-
import { join } from 'path';
|
|
25
|
-
import { MAX_BUNDLE_BYTES } from './lowering.js';
|
|
26
|
-
import { presignedUrl, readCapped, storageErrorSummary } from './presigned.js';
|
|
27
|
-
import { describeError } from './shared.js';
|
|
28
|
-
/** Largest source archive the service accepts, as uploaded (spec 01 §5). */
|
|
29
|
-
export const MAX_SOURCE_ARCHIVE_BYTES = 32 * 1024 * 1024;
|
|
30
|
-
/** Most of an upload error body read to find its error code. */
|
|
31
|
-
const ERROR_BODY_BYTES = 64 * 1024;
|
|
32
|
-
/** Lockfiles recorded in the source archive, first match wins. */
|
|
33
|
-
export const LOCKFILES = [
|
|
34
|
-
'bun.lock',
|
|
35
|
-
'package-lock.json',
|
|
36
|
-
'pnpm-lock.yaml',
|
|
37
|
-
'yarn.lock',
|
|
38
|
-
];
|
|
39
|
-
/**
|
|
40
|
-
* Headers the HTTP client computes itself. The presigned URL signs
|
|
41
|
-
* `content-length`; the client sends the same value because it sends exactly
|
|
42
|
-
* the body the length was declared for.
|
|
43
|
-
*/
|
|
44
|
-
const CLIENT_HEADERS = new Set(['content-length', 'host']);
|
|
45
|
-
function lockText(root) {
|
|
46
|
-
for (const name of LOCKFILES) {
|
|
47
|
-
const path = join(root, name);
|
|
48
|
-
if (existsSync(path))
|
|
49
|
-
return readFileSync(path, 'utf8');
|
|
50
|
-
}
|
|
51
|
-
return undefined;
|
|
52
|
-
}
|
|
53
|
-
/** The bundle and source archive of a lowered TypeScript project, size-checked. */
|
|
54
|
-
export function prepareBundle(project, lowered) {
|
|
55
|
-
if (!lowered.bundle || !lowered.buildId || !lowered.sourceHash || !lowered.sourceFiles) {
|
|
56
|
-
throw new CliUserError('This project has no code bundle to upload.', {
|
|
57
|
-
hint: 'Durable functions are TypeScript `workflow()` exports (Python ones arrive in Phase C).',
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
const bundle = new TextEncoder().encode(lowered.bundle);
|
|
61
|
-
if (bundle.byteLength > MAX_BUNDLE_BYTES) {
|
|
62
|
-
throw new CliUserError(`The code bundle is ${bundle.byteLength} bytes; the limit is ${MAX_BUNDLE_BYTES}.`);
|
|
63
|
-
}
|
|
64
|
-
const archiveInput = { files: lowered.sourceFiles };
|
|
65
|
-
const lock = lockText(project.root);
|
|
66
|
-
if (lock !== undefined)
|
|
67
|
-
archiveInput.lock = lock;
|
|
68
|
-
if (lowered.vendored) {
|
|
69
|
-
archiveInput.vendored = Object.fromEntries(Object.entries(lowered.vendored).map(([name, pkg]) => [
|
|
70
|
-
name,
|
|
71
|
-
{ version: pkg.version, files: { ...pkg.files } },
|
|
72
|
-
]));
|
|
73
|
-
}
|
|
74
|
-
// C-SOURCEMAP: the service maps stack-trace locations through it.
|
|
75
|
-
if (lowered.map !== undefined)
|
|
76
|
-
archiveInput.map = lowered.map;
|
|
77
|
-
const archive = packSources(archiveInput);
|
|
78
|
-
if (archive.byteLength > MAX_SOURCE_ARCHIVE_BYTES) {
|
|
79
|
-
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`.' });
|
|
80
|
-
}
|
|
81
|
-
return {
|
|
82
|
-
buildId: lowered.buildId,
|
|
83
|
-
sourceHash: lowered.sourceHash,
|
|
84
|
-
sdkVersion: SDK_VERSION,
|
|
85
|
-
bundle,
|
|
86
|
-
archive,
|
|
87
|
-
};
|
|
88
|
-
}
|
|
89
|
-
async function put(env, target, body, what) {
|
|
90
|
-
if (target.method.toUpperCase() !== 'PUT') {
|
|
91
|
-
throw new CliUserError(`The service asked for a ${target.method} ${what} upload; expected PUT.`);
|
|
92
|
-
}
|
|
93
|
-
presignedUrl(target.url, `${what} upload`);
|
|
94
|
-
const headers = Object.fromEntries(Object.entries(target.headers).filter(([name]) => !CLIENT_HEADERS.has(name.toLowerCase())));
|
|
95
|
-
let response;
|
|
96
|
-
try {
|
|
97
|
-
response = await env.fetch(target.url, { method: 'PUT', headers, body });
|
|
98
|
-
}
|
|
99
|
-
catch (error) {
|
|
100
|
-
// The URL carries a signature; it is never printed.
|
|
101
|
-
throw new CliUserError(`Uploading the ${what} failed: ${describeError(error)}`);
|
|
102
|
-
}
|
|
103
|
-
if (!response.ok) {
|
|
104
|
-
// Only the error code and message: an S3 error body echoes the access key
|
|
105
|
-
// id, the string to sign and the signature of the presigned request.
|
|
106
|
-
const body = await readCapped(response, ERROR_BODY_BYTES, () => new Error('too large'))
|
|
107
|
-
.then((bytes) => new TextDecoder().decode(bytes))
|
|
108
|
-
.catch(() => '');
|
|
109
|
-
const summary = storageErrorSummary(body);
|
|
110
|
-
throw new CliUserError(`Uploading the ${what} failed with HTTP ${response.status}${summary ? ` (${summary})` : ''}.`);
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
/** Get an upload ticket for `workflowKey` and send what the service does not have yet. */
|
|
114
|
-
export async function uploadBundle(env, prepared, workflowKey) {
|
|
115
|
-
const ticket = await env.api.prepareCodeUpload({
|
|
116
|
-
workflowKey,
|
|
117
|
-
buildId: prepared.buildId,
|
|
118
|
-
bundleBytes: prepared.bundle.byteLength,
|
|
119
|
-
sourceHash: prepared.sourceHash,
|
|
120
|
-
sourceBytes: prepared.archive.byteLength,
|
|
121
|
-
});
|
|
122
|
-
let bundleSent = false;
|
|
123
|
-
if (!ticket.bundle.alreadyStored) {
|
|
124
|
-
await put(env, ticket.bundle, prepared.bundle, 'code bundle');
|
|
125
|
-
bundleSent = true;
|
|
126
|
-
}
|
|
127
|
-
let sourceSent = false;
|
|
128
|
-
if (ticket.source && !ticket.source.alreadyStored) {
|
|
129
|
-
await put(env, ticket.source, prepared.archive, 'source archive');
|
|
130
|
-
sourceSent = true;
|
|
131
|
-
}
|
|
132
|
-
return { uploadId: ticket.uploadId, bundleSent, sourceSent };
|
|
133
|
-
}
|
|
134
|
-
function isRecord(value) {
|
|
135
|
-
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
136
|
-
}
|
|
137
|
-
/**
|
|
138
|
-
* The `code` block of a workflow that the prepared bundle serves. Refuses a
|
|
139
|
-
* workflow that runs no code or records another build; `push` calls it for
|
|
140
|
-
* every version it will write before it writes the first one.
|
|
141
|
-
*/
|
|
142
|
-
export function bundleCodeBlock(workflow, prepared) {
|
|
143
|
-
const code = workflow.definition['code'];
|
|
144
|
-
if (!isRecord(code)) {
|
|
145
|
-
throw new CliUserError(`${workflow.key} does not run code; it needs no bundle.`);
|
|
146
|
-
}
|
|
147
|
-
if (code['buildId'] !== prepared.buildId) {
|
|
148
|
-
throw new CliUserError(`${workflow.key} records buildId ${String(code['buildId'])}, but the bundle is ${prepared.buildId}.`);
|
|
149
|
-
}
|
|
150
|
-
return code;
|
|
151
|
-
}
|
|
152
|
-
/** `CodeBundleInput` for one workflow's version, from its definition's `code` block. */
|
|
153
|
-
export function codeBundleInput(uploadId, workflow, prepared) {
|
|
154
|
-
const code = bundleCodeBlock(workflow, prepared);
|
|
155
|
-
return {
|
|
156
|
-
uploadId,
|
|
157
|
-
buildId: prepared.buildId,
|
|
158
|
-
language: typeof code['language'] === 'string' ? code['language'] : 'typescript',
|
|
159
|
-
sdkVersion: prepared.sdkVersion,
|
|
160
|
-
entry: workflow.path,
|
|
161
|
-
exports: code['exports'] ?? { workflows: {} },
|
|
162
|
-
determinism: typeof code['determinism'] === 'string' ? code['determinism'] : 'isolate',
|
|
163
|
-
};
|
|
164
|
-
}
|
|
165
|
-
//# sourceMappingURL=code-upload.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"code-upload.js","sourceRoot":"","sources":["../../src/code-first/code-upload.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;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;AACjD,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAE/E,OAAO,EAAE,aAAa,EAAmB,MAAM,aAAa,CAAC;AAE7D,4EAA4E;AAC5E,MAAM,CAAC,MAAM,wBAAwB,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC;AAEzD,gEAAgE;AAChE,MAAM,gBAAgB,GAAG,EAAE,GAAG,IAAI,CAAC;AAEnC,kEAAkE;AAClE,MAAM,CAAC,MAAM,SAAS,GAAsB;IAC1C,UAAU;IACV,mBAAmB;IACnB,gBAAgB;IAChB,WAAW;CACZ,CAAC;AAEF;;;;GAIG;AACH,MAAM,cAAc,GAAG,IAAI,GAAG,CAAC,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KAAK,QAAQ,CAAC,OAAO,EAAE,CAAC;QACzC,MAAM,IAAI,YAAY,CACpB,GAAG,QAAQ,CAAC,GAAG,oBAAoB,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,uBAAuB,QAAQ,CAAC,OAAO,GAAG,CACrG,CAAC;IACJ,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,wFAAwF;AACxF,MAAM,UAAU,eAAe,CAC7B,QAAgB,EAChB,QAAuB,EACvB,QAAwB;IAExB,MAAM,IAAI,GAAG,eAAe,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;IACjD,OAAO;QACL,QAAQ;QACR,OAAO,EAAE,QAAQ,CAAC,OAAO;QACzB,QAAQ,EAAE,OAAO,IAAI,CAAC,UAAU,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,YAAY;QAChF,UAAU,EAAE,QAAQ,CAAC,UAAU;QAC/B,KAAK,EAAE,QAAQ,CAAC,IAAI;QACpB,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,SAAS,EAAE,EAAE,EAAE;QAC7C,WAAW,EAAE,OAAO,IAAI,CAAC,aAAa,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,SAAS;KACvF,CAAC;AACJ,CAAC"}
|
|
@@ -1,20 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1,50 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;IACjE,MAAM,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,gBAAgB,CAAC;IAC/C,gBAAgB,CAAC,OAAO,CAAC,IAAI,EAAE,SAAS,CAAC,IAAI,EAAE,SAAS,CAAC,OAAO,CAAC,CAAC;IAClE,MAAM,QAAQ,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,CAA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B,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"}
|
|
@@ -1,28 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"diff.d.ts","sourceRoot":"","sources":["../../../src/code-first/commands/diff.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAcH,OAAO,EAA0B,KAAK,UAAU,EAAE,KAAK,cAAc,EAAE,MAAM,cAAc,CAAC;AAE5F,MAAM,WAAW,WAAY,SAAQ,cAAc;IACjD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,QAAQ;IACvB,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,KAAK,CAAC;IACnC,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,OAAO,CAAC;QAAC,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC,CAAC;CACnF;AAED,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,QAAQ,EAAE,CAAC;CACvB;AAED,wBAAsB,OAAO,CAC3B,GAAG,EAAE,UAAU,EACf,IAAI,EAAE,SAAS,MAAM,EAAE,EACvB,OAAO,EAAE,WAAW,GACnB,OAAO,CAAC,UAAU,CAAC,CA6ErB"}
|
|
@@ -1,73 +0,0 @@
|
|
|
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 { CliUserError } from '@burdenoff/cli-sdk/core';
|
|
8
|
-
import { diffDefinitions } from '@fluidgrids/workflows/ir';
|
|
9
|
-
import { explainUnresolved } from '../connections.js';
|
|
10
|
-
import { lowerProject } from '../lowering.js';
|
|
11
|
-
import { assertProjectWorkspace, loadProject } from '../project.js';
|
|
12
|
-
import { comparableRemote, outgoingDefinition, projectConnectionIndex, RemoteWorkflows, } from '../remote.js';
|
|
13
|
-
import { emit, requireKnownKeys } from '../shared.js';
|
|
14
|
-
export async function runDiff(env, keys, options) {
|
|
15
|
-
const project = loadProject(options.project, env.cwd());
|
|
16
|
-
assertProjectWorkspace(env, project);
|
|
17
|
-
const against = options.against ?? 'latest';
|
|
18
|
-
const latest = new RemoteWorkflows(env.api, 'latest');
|
|
19
|
-
const remote = against === 'latest' ? latest : new RemoteWorkflows(env.api, against);
|
|
20
|
-
const index = await projectConnectionIndex(env.api, project, keys, latest);
|
|
21
|
-
const lowered = await lowerProject(project, {
|
|
22
|
-
connections: (name) => (Object.hasOwn(index.refs, name) ? index.refs[name] : undefined),
|
|
23
|
-
connectionNames: Object.keys(index.refs),
|
|
24
|
-
explainUnresolved: (names) => explainUnresolved(names, index),
|
|
25
|
-
});
|
|
26
|
-
requireKnownKeys(keys, lowered.workflows.map((workflow) => workflow.key));
|
|
27
|
-
const selected = keys.length > 0
|
|
28
|
-
? lowered.workflows.filter((workflow) => keys.includes(workflow.key))
|
|
29
|
-
: lowered.workflows;
|
|
30
|
-
const items = [];
|
|
31
|
-
for (const workflow of selected) {
|
|
32
|
-
const stored = await remote.get(workflow.key);
|
|
33
|
-
if (!stored.export) {
|
|
34
|
-
items.push({ key: workflow.key, against: null, status: 'new', changes: [] });
|
|
35
|
-
continue;
|
|
36
|
-
}
|
|
37
|
-
const base = comparableRemote(stored.export.definitionJson, workflow.key);
|
|
38
|
-
const changes = diffDefinitions(base, outgoingDefinition(workflow.definition, base)).map((change) => ({
|
|
39
|
-
kind: change.kind,
|
|
40
|
-
path: change.path,
|
|
41
|
-
...(change.before !== undefined ? { before: change.before } : {}),
|
|
42
|
-
...(change.after !== undefined ? { after: change.after } : {}),
|
|
43
|
-
}));
|
|
44
|
-
items.push({
|
|
45
|
-
key: workflow.key,
|
|
46
|
-
against: stored.export.version,
|
|
47
|
-
status: changes.length === 0 ? 'same' : 'changed',
|
|
48
|
-
changes,
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
const result = { against, workflows: items };
|
|
52
|
-
const details = [...lowered.warnings];
|
|
53
|
-
details.push(...items.flatMap((item) => item.changes.map((change) => {
|
|
54
|
-
const values = change.kind === 'changed'
|
|
55
|
-
? `: ${JSON.stringify(change.before)} -> ${JSON.stringify(change.after)}`
|
|
56
|
-
: '';
|
|
57
|
-
return `${item.key}: ${change.kind} ${change.path}${values}`;
|
|
58
|
-
})));
|
|
59
|
-
emit(env, options, result, {
|
|
60
|
-
headers: ['Workflow', 'Against', 'Status', 'Changes'],
|
|
61
|
-
rows: items.map((item) => [
|
|
62
|
-
item.key,
|
|
63
|
-
item.against ?? '-',
|
|
64
|
-
item.status,
|
|
65
|
-
String(item.changes.length),
|
|
66
|
-
]),
|
|
67
|
-
}, details);
|
|
68
|
-
if (options.exitCode && items.some((item) => item.status !== 'same')) {
|
|
69
|
-
throw new CliUserError('The local workflows differ from the workspace.', { exitCode: 1 });
|
|
70
|
-
}
|
|
71
|
-
return result;
|
|
72
|
-
}
|
|
73
|
-
//# sourceMappingURL=diff.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"diff.js","sourceRoot":"","sources":["../../../src/code-first/commands/diff.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,YAAY,EAAE,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,IAAI,GAAG,MAAM,EAAE,CAAC;IAC/D,CAAC,CAAC,CACH,CACF,CAAC;IACF,IAAI,CACF,GAAG,EACH,OAAO,EACP,MAAM,EACN;QACE,OAAO,EAAE,CAAC,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,CAAC;QACrD,IAAI,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC;YACxB,IAAI,CAAC,GAAG;YACR,IAAI,CAAC,OAAO,IAAI,GAAG;YACnB,IAAI,CAAC,MAAM;YACX,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC;SAC5B,CAAC;KACH,EACD,OAAO,CACR,CAAC;IACF,IAAI,OAAO,CAAC,QAAQ,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,KAAK,MAAM,CAAC,EAAE,CAAC;QACrE,MAAM,IAAI,YAAY,CAAC,gDAAgD,EAAE,EAAE,QAAQ,EAAE,CAAC,EAAE,CAAC,CAAC;IAC5F,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `fluidgrids push --hotfix <version> [key]`: replace the code bundle of an
|
|
3
|
-
* existing version (spec 06 §2, decision DB10) instead of creating a version.
|
|
4
|
-
*
|
|
5
|
-
* 1. The local lowering of the workflow must equal the stored version except
|
|
6
|
-
* for its code: a hotfix fixes code, it never changes the graph, the
|
|
7
|
-
* exported functions or their interfaces.
|
|
8
|
-
* 2. `--replay-sample N` first replays the N most recent durable runs of that
|
|
9
|
-
* version locally in the QuickJS isolate, and refuses on a violation. It
|
|
10
|
-
* scans the newest runs of the key up to a bound, warns when it found fewer
|
|
11
|
-
* than N and refuses when it found none.
|
|
12
|
-
* 3. The bundle is uploaded as for a push, `replaceWorkflowVersionCode` starts
|
|
13
|
-
* the service's job, and the CLI polls `workflowCodeReplace` until the job
|
|
14
|
-
* ends REPLACED or REJECTED (the service replays up to 50 open and 50
|
|
15
|
-
* completed runs; `--no-verify-replay` skips that and is audited). The
|
|
16
|
-
* result is emitted before a REJECTED job or a timeout exits non-zero.
|
|
17
|
-
*/
|
|
18
|
-
import type { CodeReplaceResult } from '../api.js';
|
|
19
|
-
import { type ReplayOutcome } from '../replay.js';
|
|
20
|
-
import { type CommandEnv } from '../shared.js';
|
|
21
|
-
import { type PushOptions } from './push.js';
|
|
22
|
-
/** Poll interval of the replacement job. */
|
|
23
|
-
export declare const HOTFIX_POLL_MS = 2000;
|
|
24
|
-
/** Default wait for the replacement job (the service replays up to 100 runs). */
|
|
25
|
-
export declare const HOTFIX_DEFAULT_TIMEOUT_MS: number;
|
|
26
|
-
export interface HotfixResult {
|
|
27
|
-
key: string;
|
|
28
|
-
version: string;
|
|
29
|
-
buildId: string;
|
|
30
|
-
previousBuildId: string;
|
|
31
|
-
status: CodeReplaceResult['status'];
|
|
32
|
-
/** True when `--timeout` passed before the job ended; `status` is its last state. */
|
|
33
|
-
timedOut: boolean;
|
|
34
|
-
jobId: string;
|
|
35
|
-
verifiedRuns: number;
|
|
36
|
-
bundleUploaded: boolean;
|
|
37
|
-
verifyReplay: boolean;
|
|
38
|
-
/** What `--replay-sample` found and replayed; null without it. */
|
|
39
|
-
replaySample: ReplaySample | null;
|
|
40
|
-
localReplays: Array<Omit<ReplayOutcome, 'result'>>;
|
|
41
|
-
violations: CodeReplaceResult['violations'];
|
|
42
|
-
}
|
|
43
|
-
/** Runs of the key scanned for a `--replay-sample` (newest first). */
|
|
44
|
-
export declare const HOTFIX_SAMPLE_SCAN_LIMIT = 500;
|
|
45
|
-
/** What `--replay-sample` replayed. */
|
|
46
|
-
export interface ReplaySample {
|
|
47
|
-
requested: number;
|
|
48
|
-
/** Durable runs of the version found among the newest runs of the key. */
|
|
49
|
-
found: number;
|
|
50
|
-
/** Runs of the key that were scanned. */
|
|
51
|
-
scanned: number;
|
|
52
|
-
}
|
|
53
|
-
export declare function runHotfix(env: CommandEnv, keys: readonly string[], options: PushOptions): Promise<HotfixResult>;
|
|
54
|
-
//# sourceMappingURL=hotfix.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"hotfix.d.ts","sourceRoot":"","sources":["../../../src/code-first/commands/hotfix.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAKH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAMnD,OAAO,EAAmC,KAAK,aAAa,EAAE,MAAM,cAAc,CAAC;AACnF,OAAO,EAA0B,KAAK,UAAU,EAAE,MAAM,cAAc,CAAC;AACvE,OAAO,EAAkB,KAAK,WAAW,EAAE,MAAM,WAAW,CAAC;AAE7D,4CAA4C;AAC5C,eAAO,MAAM,cAAc,OAAQ,CAAC;AACpC,iFAAiF;AACjF,eAAO,MAAM,yBAAyB,QAAc,CAAC;AAErD,MAAM,WAAW,YAAY;IAC3B,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,eAAe,EAAE,MAAM,CAAC;IACxB,MAAM,EAAE,iBAAiB,CAAC,QAAQ,CAAC,CAAC;IACpC,qFAAqF;IACrF,QAAQ,EAAE,OAAO,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,OAAO,CAAC;IACxB,YAAY,EAAE,OAAO,CAAC;IACtB,kEAAkE;IAClE,YAAY,EAAE,YAAY,GAAG,IAAI,CAAC;IAClC,YAAY,EAAE,KAAK,CAAC,IAAI,CAAC,aAAa,EAAE,QAAQ,CAAC,CAAC,CAAC;IACnD,UAAU,EAAE,iBAAiB,CAAC,YAAY,CAAC,CAAC;CAC7C;AAuDD,sEAAsE;AACtE,eAAO,MAAM,wBAAwB,MAAM,CAAC;AAE5C,uCAAuC;AACvC,MAAM,WAAW,YAA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