@supacloud/cli 0.119.1 → 0.120.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/dist/index.js
CHANGED
|
@@ -9368,7 +9368,7 @@ var ACTION_POLICY = {
|
|
|
9368
9368
|
init: { local: ["init"] },
|
|
9369
9369
|
env: { local: ["list", "check"] },
|
|
9370
9370
|
app: {
|
|
9371
|
-
local: ["init", "generate", "dev", "watch", "verify-plan", "compile", "check", "graph", "explain", "export-tools", "context", "doctor", "fix", "plan", "build"],
|
|
9371
|
+
local: ["init", "generate", "dev", "watch", "verify-plan", "compile", "check", "graph", "explain", "export-tools", "context", "lens", "doctor", "fix", "plan", "build"],
|
|
9372
9372
|
read: ["status", "evidence", "logs", "transfer-plan", "promote-plan", "rollback-plan", "history", "deploy-plan", "diff", "promote-status", "preview-plan", "previews", "preview-list", "preview-status"],
|
|
9373
9373
|
write: ["release", "upload", "configure", "transfer", "promote", "promote-reconcile", "deploy", "rollback", "reconcile", "retire", "preview", "preview-create", "preview-reconcile", "preview-cleanup"]
|
|
9374
9374
|
},
|
|
@@ -9537,6 +9537,7 @@ var RELEASE_MUTATION_RESPONSE_TIMEOUT = 5000;
|
|
|
9537
9537
|
var RELEASE_MUTATION_RESPONSE_MAX_BYTES = 64 * 1024;
|
|
9538
9538
|
var MAX_RETRIES = 2;
|
|
9539
9539
|
var RETRY_BASE_DELAY = 500;
|
|
9540
|
+
var MAX_RETRY_AFTER_MS = 5 * 60000;
|
|
9540
9541
|
function validatedGetResponseLimit(options) {
|
|
9541
9542
|
const maxBytes = options.maxResponseBytes;
|
|
9542
9543
|
if (maxBytes === undefined)
|
|
@@ -9579,6 +9580,21 @@ function isRetryableError(error) {
|
|
|
9579
9580
|
const networkError = error;
|
|
9580
9581
|
return networkError.name === "AbortError" || networkError.code === "ECONNREFUSED" || networkError.code === "ECONNRESET";
|
|
9581
9582
|
}
|
|
9583
|
+
function retryAfterDelayMs(value) {
|
|
9584
|
+
const normalized = value?.trim() ?? "";
|
|
9585
|
+
if (/^\d+$/.test(normalized)) {
|
|
9586
|
+
const seconds = Number(normalized);
|
|
9587
|
+
if (Number.isSafeInteger(seconds))
|
|
9588
|
+
return Math.min(MAX_RETRY_AFTER_MS, seconds * 1000);
|
|
9589
|
+
}
|
|
9590
|
+
const retryAt = Date.parse(normalized);
|
|
9591
|
+
if (!Number.isNaN(retryAt))
|
|
9592
|
+
return Math.min(MAX_RETRY_AFTER_MS, Math.max(0, retryAt - Date.now()));
|
|
9593
|
+
return RETRY_BASE_DELAY;
|
|
9594
|
+
}
|
|
9595
|
+
function waitForRetry(delayMs) {
|
|
9596
|
+
return new Promise((resolve) => setTimeout(resolve, delayMs));
|
|
9597
|
+
}
|
|
9582
9598
|
function transportFailure(error) {
|
|
9583
9599
|
const networkError = error instanceof Error ? error : null;
|
|
9584
9600
|
const code = networkError?.name === "AbortError" ? "TIMEOUT" : networkError?.code === "ECONNRESET" ? "CONNECTION_RESET" : "NETWORK_ERROR";
|
|
@@ -9611,21 +9627,31 @@ async function fetchWithTimeout(url, options, timeoutMs = DEFAULT_TIMEOUT, insec
|
|
|
9611
9627
|
clearTimeout(timeout);
|
|
9612
9628
|
}
|
|
9613
9629
|
}
|
|
9614
|
-
async function fetchWithRetry(url, options, timeoutMs = DEFAULT_TIMEOUT, insecureTls = false) {
|
|
9615
|
-
const
|
|
9630
|
+
async function fetchWithRetry(url, options, timeoutMs = DEFAULT_TIMEOUT, insecureTls = false, retryOptions = {}) {
|
|
9631
|
+
const retryOnRateLimit = retryOptions.retryOnRateLimit === true;
|
|
9632
|
+
const retryableMethod = isRetryableMethod(options.method);
|
|
9633
|
+
const retries = retryableMethod || retryOnRateLimit ? MAX_RETRIES : 0;
|
|
9616
9634
|
for (let attempt = 0;attempt <= retries; attempt++) {
|
|
9617
9635
|
try {
|
|
9618
9636
|
const res = await fetchWithTimeout(url, options, timeoutMs, insecureTls);
|
|
9619
|
-
if (res.status
|
|
9637
|
+
if (res.status === 429 && retryOnRateLimit && attempt < retries) {
|
|
9638
|
+
const delay = retryAfterDelayMs(res.headers.get("retry-after"));
|
|
9639
|
+
res.body?.cancel().catch(() => {
|
|
9640
|
+
return;
|
|
9641
|
+
});
|
|
9642
|
+
await waitForRetry(delay);
|
|
9643
|
+
continue;
|
|
9644
|
+
}
|
|
9645
|
+
if (retryableMethod && res.status >= 500 && res.status < 600 && attempt < retries) {
|
|
9620
9646
|
const delay = RETRY_BASE_DELAY * Math.pow(2, attempt);
|
|
9621
|
-
await
|
|
9647
|
+
await waitForRetry(delay);
|
|
9622
9648
|
continue;
|
|
9623
9649
|
}
|
|
9624
9650
|
return res;
|
|
9625
9651
|
} catch (error) {
|
|
9626
|
-
if (attempt < retries && isRetryableError(error)) {
|
|
9652
|
+
if (retryableMethod && attempt < retries && isRetryableError(error)) {
|
|
9627
9653
|
const delay = RETRY_BASE_DELAY * Math.pow(2, attempt);
|
|
9628
|
-
await
|
|
9654
|
+
await waitForRetry(delay);
|
|
9629
9655
|
continue;
|
|
9630
9656
|
}
|
|
9631
9657
|
throw error;
|
|
@@ -9776,14 +9802,14 @@ class HttpTransport {
|
|
|
9776
9802
|
...this.apiKey ? { apikey: this.apiKey } : {}
|
|
9777
9803
|
};
|
|
9778
9804
|
}
|
|
9779
|
-
async mutationWithResponseReader(method, path, serializedBody, responseReader, timeoutMs = DEFAULT_TIMEOUT) {
|
|
9805
|
+
async mutationWithResponseReader(method, path, serializedBody, responseReader, timeoutMs = DEFAULT_TIMEOUT, retryOnRateLimit = false) {
|
|
9780
9806
|
try {
|
|
9781
9807
|
const request = {
|
|
9782
9808
|
method,
|
|
9783
9809
|
headers: this.headers(),
|
|
9784
9810
|
...serializedBody === undefined ? {} : { body: serializedBody }
|
|
9785
9811
|
};
|
|
9786
|
-
const response = await fetchWithRetry(`${this.baseUrl}${path}`, request, timeoutMs, this.insecureTls);
|
|
9812
|
+
const response = await fetchWithRetry(`${this.baseUrl}${path}`, request, timeoutMs, this.insecureTls, { retryOnRateLimit });
|
|
9787
9813
|
const responseBody = await responseReader(response);
|
|
9788
9814
|
return responseBody.ok ? { ok: response.ok, status: response.status, data: responseBody.parsedJson } : responseReadFailure(response.status);
|
|
9789
9815
|
} catch (error) {
|
|
@@ -9850,7 +9876,7 @@ class HttpTransport {
|
|
|
9850
9876
|
}
|
|
9851
9877
|
async postReleaseMutation(path, body, options) {
|
|
9852
9878
|
const timeoutMs = validatedPostTimeout(options);
|
|
9853
|
-
return this.mutationWithResponseReader("POST", path, serializedRequestBody(body), releaseMutationResponseJson, timeoutMs);
|
|
9879
|
+
return this.mutationWithResponseReader("POST", path, serializedRequestBody(body), releaseMutationResponseJson, timeoutMs, options?.retryOnRateLimit === true);
|
|
9854
9880
|
}
|
|
9855
9881
|
async postBinary(path, body, options) {
|
|
9856
9882
|
if (options.contentType !== FRONTEND_ARCHIVE_CONTENT_TYPE) {
|
|
@@ -13437,7 +13463,7 @@ ${riskReport}`
|
|
|
13437
13463
|
skipped.push(file);
|
|
13438
13464
|
continue;
|
|
13439
13465
|
}
|
|
13440
|
-
const r = await managementHttp().postReleaseMutation(`/v1/projects/${ref}/database/migrations`, { name, sql, version });
|
|
13466
|
+
const r = await managementHttp().postReleaseMutation(`/v1/projects/${ref}/database/migrations`, { name, sql, version }, { retryOnRateLimit: true });
|
|
13441
13467
|
if (r.ok && r.status === 200 && confirmedMigrationReceipt(r.data, { name, version, sql })) {
|
|
13442
13468
|
applied.push(file);
|
|
13443
13469
|
} else if (isAlreadyAppliedMigrationResponse(r, { name, version, sql })) {
|
|
@@ -22099,6 +22125,8 @@ import {
|
|
|
22099
22125
|
planDeliveryProject,
|
|
22100
22126
|
resolveSupacloudConfig,
|
|
22101
22127
|
readExecutionMetadata,
|
|
22128
|
+
createProjectSemanticSnapshot,
|
|
22129
|
+
createSemanticLens,
|
|
22102
22130
|
watchProject
|
|
22103
22131
|
} from "@supacloud/compiler";
|
|
22104
22132
|
|
|
@@ -22225,7 +22253,7 @@ var starter_metadata_default = {
|
|
|
22225
22253
|
generatedBy: "supacloud/starter-metadata-v1",
|
|
22226
22254
|
packages: {
|
|
22227
22255
|
compiler: {
|
|
22228
|
-
version: "0.
|
|
22256
|
+
version: "0.62.0"
|
|
22229
22257
|
},
|
|
22230
22258
|
app: {
|
|
22231
22259
|
version: "0.39.1",
|
|
@@ -22243,7 +22271,7 @@ var starter_metadata_default = {
|
|
|
22243
22271
|
version: "0.16.1"
|
|
22244
22272
|
},
|
|
22245
22273
|
db: {
|
|
22246
|
-
version: "0.24.
|
|
22274
|
+
version: "0.24.1",
|
|
22247
22275
|
dependencies: {
|
|
22248
22276
|
"@zenstackhq/orm": "3.10.0",
|
|
22249
22277
|
"@zenstackhq/schema": "3.10.0",
|
|
@@ -28888,6 +28916,7 @@ function formatModuleContextPack(pack) {
|
|
|
28888
28916
|
` external tokens: ${pack.externalTokens.join(", ") || "-"}`,
|
|
28889
28917
|
` imports: ${pack.relatedModules.imports.join(", ") || "-"}`,
|
|
28890
28918
|
` imported by: ${pack.relatedModules.importedBy.join(", ") || "-"}`,
|
|
28919
|
+
` semantic hash: ${pack.semantic.hash}`,
|
|
28891
28920
|
...pack.graphql ? [
|
|
28892
28921
|
` graphql schema: ${pack.graphql.schema}`,
|
|
28893
28922
|
` graphql queries: ${pack.graphql.operations.map((operation) => operation.name).join(", ") || "-"}`
|
|
@@ -28943,6 +28972,7 @@ async function runContext(args) {
|
|
|
28943
28972
|
].join(`
|
|
28944
28973
|
`));
|
|
28945
28974
|
}
|
|
28975
|
+
const semantic = await createProjectSemanticSnapshot(result.graph, root, outDir);
|
|
28946
28976
|
const project = {
|
|
28947
28977
|
version: 1,
|
|
28948
28978
|
root,
|
|
@@ -28951,6 +28981,12 @@ async function runContext(args) {
|
|
|
28951
28981
|
modules: result.graph.modules,
|
|
28952
28982
|
externalTokens: result.graph.externalTokens,
|
|
28953
28983
|
diagnostics: result.diagnostics,
|
|
28984
|
+
semantic: {
|
|
28985
|
+
version: 1,
|
|
28986
|
+
hash: semantic.semanticHash,
|
|
28987
|
+
sourceHash: semantic.sourceHash,
|
|
28988
|
+
nodeCount: semantic.nodes.length
|
|
28989
|
+
},
|
|
28954
28990
|
allowedDependencies: await readAllowedDependencies(root),
|
|
28955
28991
|
commands: {
|
|
28956
28992
|
check: "supacloud app check",
|
|
@@ -28975,6 +29011,8 @@ async function runContext(args) {
|
|
|
28975
29011
|
`CONTEXT ${root}`,
|
|
28976
29012
|
` config: ${configFile ?? "(none)"}`,
|
|
28977
29013
|
` generated: ${outDir}`,
|
|
29014
|
+
` semantic hash: ${project.semantic.hash}`,
|
|
29015
|
+
` source hash: ${project.semantic.sourceHash}`,
|
|
28978
29016
|
` modules: ${project.modules.map((module) => module.name).join(", ") || "-"}`,
|
|
28979
29017
|
` external tokens: ${project.externalTokens.join(", ") || "-"}`,
|
|
28980
29018
|
` dependencies: ${project.allowedDependencies.dependencies.join(", ") || "-"}`,
|
|
@@ -28985,6 +29023,32 @@ async function runContext(args) {
|
|
|
28985
29023
|
].join(`
|
|
28986
29024
|
`));
|
|
28987
29025
|
}
|
|
29026
|
+
async function runLens(args) {
|
|
29027
|
+
const { root, sourceDir, outDir, result } = await projectCompileConfig(args);
|
|
29028
|
+
const graph = { ...result.graph, diagnostics: result.diagnostics };
|
|
29029
|
+
const target = args.target?.trim();
|
|
29030
|
+
const snapshot = await createProjectSemanticSnapshot(result.graph, root, outDir);
|
|
29031
|
+
const lens = createSemanticLens(graph, target, { snapshot, detail: args.detail === true });
|
|
29032
|
+
const context = target ? createContextPack(graph, lens.subject ?? target, snapshot) : undefined;
|
|
29033
|
+
const output = {
|
|
29034
|
+
version: 1,
|
|
29035
|
+
root,
|
|
29036
|
+
sourceRoot: sourceDir,
|
|
29037
|
+
generatedDir: outDir,
|
|
29038
|
+
...lens,
|
|
29039
|
+
...context ? { context } : {},
|
|
29040
|
+
diagnostics: result.diagnostics
|
|
29041
|
+
};
|
|
29042
|
+
if (args.format === "json")
|
|
29043
|
+
return textResult(JSON.stringify(output, null, 2), lens.conflicts.some((conflict) => conflict.severity === "error"));
|
|
29044
|
+
const lines = [`LENS ${context?.subject ?? "application"}`, ` semantic hash: ${lens.snapshot.semanticHash}`, ` source hash: ${lens.snapshot.sourceHash}`];
|
|
29045
|
+
for (const item of lens.nodes)
|
|
29046
|
+
lines.push(` ${item.kind} ${item.id} ${item.hash}`);
|
|
29047
|
+
for (const conflict of lens.conflicts)
|
|
29048
|
+
lines.push(` ${conflict.severity.toUpperCase()} ${conflict.code}: ${conflict.message}`);
|
|
29049
|
+
return textResult(lines.join(`
|
|
29050
|
+
`), lens.conflicts.some((conflict) => conflict.severity === "error"));
|
|
29051
|
+
}
|
|
28988
29052
|
function doctorFixPlan(doctor) {
|
|
28989
29053
|
return createDiagnosticRepairPlan(doctor.diagnostics ?? []).map((repair, index) => ({
|
|
28990
29054
|
...repair,
|
|
@@ -30164,6 +30228,8 @@ async function runAppTool(request, options = {}) {
|
|
|
30164
30228
|
return runExportTools(request);
|
|
30165
30229
|
case "context":
|
|
30166
30230
|
return runContext(request);
|
|
30231
|
+
case "lens":
|
|
30232
|
+
return runLens(request);
|
|
30167
30233
|
case "doctor":
|
|
30168
30234
|
return runDoctor(request);
|
|
30169
30235
|
case "fix":
|
|
@@ -30187,6 +30253,7 @@ function registerAppTools(server, options = {}) {
|
|
|
30187
30253
|
"explain",
|
|
30188
30254
|
"export-tools",
|
|
30189
30255
|
"context",
|
|
30256
|
+
"lens",
|
|
30190
30257
|
"doctor",
|
|
30191
30258
|
"fix",
|
|
30192
30259
|
"plan",
|
|
@@ -30243,7 +30310,8 @@ function registerAppTools(server, options = {}) {
|
|
|
30243
30310
|
once: optional(Boolean2(), "[dev] Validate and report once without watching"),
|
|
30244
30311
|
watch: optional(Boolean2(), "[dev] Watch for changes (default: true; --once disables)"),
|
|
30245
30312
|
database_url: optional(String2(), "[dev] Explicit loopback integration URL; watch/once only inspect its shape"),
|
|
30246
|
-
target: optional(String2(), "[explain/context/verify-plan] Provider class name / token name / command name / job name / module name"),
|
|
30313
|
+
target: optional(String2(), "[explain/context/lens/verify-plan] Provider class name / token name / command name / job name / module name"),
|
|
30314
|
+
detail: optional(Boolean2(), "[lens] Include the per-node value payload (larger output)"),
|
|
30247
30315
|
events: optional(String2(), "[context] Project-relative execution metadata JSON or generated JSON-lines file"),
|
|
30248
30316
|
request_id: optional(String2(), "[context] Opaque request ID or Workflow run ID selected from --events"),
|
|
30249
30317
|
fix: optional(String2(), "[fix] Path to a DiagnosticFix JSON file produced by `doctor --format json`"),
|
|
@@ -34301,7 +34369,7 @@ async function runProjectDeployment(http, args) {
|
|
|
34301
34369
|
// package.json
|
|
34302
34370
|
var package_default = {
|
|
34303
34371
|
name: "@supacloud/cli",
|
|
34304
|
-
version: "0.
|
|
34372
|
+
version: "0.120.1",
|
|
34305
34373
|
description: "Project-scoped CLI for SupaCloud users",
|
|
34306
34374
|
type: "module",
|
|
34307
34375
|
main: "./dist/index.js",
|
|
@@ -34353,17 +34421,17 @@ var package_default = {
|
|
|
34353
34421
|
directory: "packages/cli"
|
|
34354
34422
|
},
|
|
34355
34423
|
dependencies: {
|
|
34356
|
-
"@supacloud/compiler": "^0.
|
|
34424
|
+
"@supacloud/compiler": "^0.62.0",
|
|
34357
34425
|
"@supacloud/delivery": "0.26.0",
|
|
34358
|
-
"@supacloud/db": "0.24.
|
|
34426
|
+
"@supacloud/db": "0.24.1",
|
|
34359
34427
|
typebox: "1.4.3"
|
|
34360
34428
|
},
|
|
34361
34429
|
overrides: {
|
|
34362
34430
|
"@supacloud/contracts": "0.16.1",
|
|
34363
34431
|
"@supacloud/delivery": "0.26.0",
|
|
34364
34432
|
"@graphql-tools/utils": "^12.0.4",
|
|
34365
|
-
"@supacloud/compiler": "^0.
|
|
34366
|
-
"@supacloud/db": "0.24.
|
|
34433
|
+
"@supacloud/compiler": "^0.62.0",
|
|
34434
|
+
"@supacloud/db": "0.24.1",
|
|
34367
34435
|
"deepmerge-ts": "8.0.2",
|
|
34368
34436
|
prisma: "6.19.3"
|
|
34369
34437
|
},
|
|
@@ -39,7 +39,7 @@ export interface AppToolOptions {
|
|
|
39
39
|
onDevProgress?: (result: ToolResult) => void;
|
|
40
40
|
}
|
|
41
41
|
export interface AppToolArguments {
|
|
42
|
-
action: "init" | "generate" | "dev" | "watch" | "verify-plan" | "compile" | "check" | "graph" | "explain" | "export-tools" | "context" | "doctor" | "fix" | "plan" | "build" | "release" | "promote" | keyof typeof REMOTE_APP_ACTIONS;
|
|
42
|
+
action: "init" | "generate" | "dev" | "watch" | "verify-plan" | "compile" | "check" | "graph" | "explain" | "export-tools" | "context" | "lens" | "doctor" | "fix" | "plan" | "build" | "release" | "promote" | keyof typeof REMOTE_APP_ACTIONS;
|
|
43
43
|
ref?: string;
|
|
44
44
|
id?: string;
|
|
45
45
|
environment_id?: string;
|
|
@@ -86,6 +86,7 @@ export interface AppToolArguments {
|
|
|
86
86
|
strict?: boolean;
|
|
87
87
|
format?: "text" | "json";
|
|
88
88
|
target?: string;
|
|
89
|
+
detail?: boolean;
|
|
89
90
|
fix?: string;
|
|
90
91
|
from_doctor?: string;
|
|
91
92
|
fix_index?: number;
|
|
@@ -33,6 +33,8 @@ export interface HttpPostOptions {
|
|
|
33
33
|
}
|
|
34
34
|
export interface HttpReleaseMutationOptions {
|
|
35
35
|
timeoutMs?: number;
|
|
36
|
+
/** Retry rate-limited requests only when the mutation is idempotent by contract. */
|
|
37
|
+
retryOnRateLimit?: boolean;
|
|
36
38
|
}
|
|
37
39
|
export interface HttpBinaryPostOptions {
|
|
38
40
|
contentType: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@supacloud/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.120.1",
|
|
4
4
|
"description": "Project-scoped CLI for SupaCloud users",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -52,17 +52,17 @@
|
|
|
52
52
|
"directory": "packages/cli"
|
|
53
53
|
},
|
|
54
54
|
"dependencies": {
|
|
55
|
-
"@supacloud/compiler": "^0.
|
|
55
|
+
"@supacloud/compiler": "^0.62.0",
|
|
56
56
|
"@supacloud/delivery": "0.26.0",
|
|
57
|
-
"@supacloud/db": "0.24.
|
|
57
|
+
"@supacloud/db": "0.24.1",
|
|
58
58
|
"typebox": "1.4.3"
|
|
59
59
|
},
|
|
60
60
|
"overrides": {
|
|
61
61
|
"@supacloud/contracts": "0.16.1",
|
|
62
62
|
"@supacloud/delivery": "0.26.0",
|
|
63
63
|
"@graphql-tools/utils": "^12.0.4",
|
|
64
|
-
"@supacloud/compiler": "^0.
|
|
65
|
-
"@supacloud/db": "0.24.
|
|
64
|
+
"@supacloud/compiler": "^0.62.0",
|
|
65
|
+
"@supacloud/db": "0.24.1",
|
|
66
66
|
"deepmerge-ts": "8.0.2",
|
|
67
67
|
"prisma": "6.19.3"
|
|
68
68
|
},
|