@supacloud/cli 0.91.0 → 0.93.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js
CHANGED
|
@@ -10499,12 +10499,9 @@ function parseApplicationDeployPlan(value) {
|
|
|
10499
10499
|
var closed3 = { additionalProperties: false };
|
|
10500
10500
|
var sha256 = ApplicationReleaseIdSchema;
|
|
10501
10501
|
var nullableActivation = Union([ApplicationActivationIdSchema, Null()]);
|
|
10502
|
-
var
|
|
10502
|
+
var ApplicationDeployWebReleaseSchema = _Object_({
|
|
10503
10503
|
deployment_id: String2({ pattern: "^[A-Za-z0-9_-]{1,128}$" }),
|
|
10504
|
-
release_id: sha256
|
|
10505
|
-
expected_active_release_id: String2({ minLength: 1 }),
|
|
10506
|
-
expected_activation_id: String2({ minLength: 1 }),
|
|
10507
|
-
mutation_id: ApplicationActivationIdSchema
|
|
10504
|
+
release_id: sha256
|
|
10508
10505
|
}, closed3);
|
|
10509
10506
|
var ApplicationDeployRequestSchema = _Object_({
|
|
10510
10507
|
mutation_id: ApplicationActivationIdSchema,
|
|
@@ -10513,7 +10510,7 @@ var ApplicationDeployRequestSchema = _Object_({
|
|
|
10513
10510
|
configuration_write: Optional(ApplicationConfigurationWriteSchema),
|
|
10514
10511
|
expected_plan_sha256: Optional(sha256),
|
|
10515
10512
|
approved_migration_digest: Optional(sha256),
|
|
10516
|
-
|
|
10513
|
+
web_release: Optional(ApplicationDeployWebReleaseSchema)
|
|
10517
10514
|
}, closed3);
|
|
10518
10515
|
var ApplicationBackendReceiptSchema = _Object_({
|
|
10519
10516
|
schema: Literal("supacloud.application-backend-receipt.v1"),
|
|
@@ -10572,7 +10569,7 @@ function parseApplicationDeployResult(value, expected) {
|
|
|
10572
10569
|
if (expected) {
|
|
10573
10570
|
const { request } = expected;
|
|
10574
10571
|
const configurationId = request.configuration_id ?? request.configuration_write?.configuration_id;
|
|
10575
|
-
if (value.project_ref !== expected.project_ref || value.application_id !== expected.application_id || value.environment_id !== expected.environment_id || value.release_id !== request.release_id || value.mutation_id !== request.mutation_id || configurationId !== undefined && value.configuration_id !== configurationId || request.configuration_write !== undefined && value.configuration_id !== request.configuration_write.configuration_id || request.expected_plan_sha256 !== undefined && value.plan_sha256 !== request.expected_plan_sha256 || Boolean(value.web) !== Boolean(request.
|
|
10572
|
+
if (value.project_ref !== expected.project_ref || value.application_id !== expected.application_id || value.environment_id !== expected.environment_id || value.release_id !== request.release_id || value.mutation_id !== request.mutation_id || configurationId !== undefined && value.configuration_id !== configurationId || request.configuration_write !== undefined && value.configuration_id !== request.configuration_write.configuration_id || request.expected_plan_sha256 !== undefined && value.plan_sha256 !== request.expected_plan_sha256 || Boolean(value.web) !== Boolean(request.web_release) || request.web_release !== undefined && (value.web?.deployment_id !== request.web_release.deployment_id || value.web.release_id !== request.web_release.release_id)) {
|
|
10576
10573
|
throw new Error("Application deploy receipt does not match request");
|
|
10577
10574
|
}
|
|
10578
10575
|
}
|
|
@@ -16355,6 +16352,60 @@ async function uploadFrontendRelease(http, projectRef, deploymentId, archivePath
|
|
|
16355
16352
|
}
|
|
16356
16353
|
return toolResponse({ project_ref: projectRef, deployment_id: deploymentId, release: verified });
|
|
16357
16354
|
}
|
|
16355
|
+
async function uploadProjectWebRelease(http, projectRef, environmentId, deploymentId, archivePath) {
|
|
16356
|
+
const endpoint = `/v1/projects/${encodeURIComponent(projectRef)}/environments/${encodeURIComponent(environmentId)}/deployments/web-release?deployment_id=${encodeURIComponent(deploymentId)}`;
|
|
16357
|
+
const archive = await verifiedArchive(archivePath);
|
|
16358
|
+
const successPayload = (value) => {
|
|
16359
|
+
const release = value ? releaseRecord(value.release) : null;
|
|
16360
|
+
if (!value || value.ok !== true || value.project_ref !== projectRef || value.environment_id !== environmentId || value.deployment_id !== deploymentId || value.release_id !== archive.sha256 || release?.release_id !== archive.sha256 || release.tree_sha256.length !== 64)
|
|
16361
|
+
return null;
|
|
16362
|
+
return toolResponse({
|
|
16363
|
+
project_ref: projectRef,
|
|
16364
|
+
environment_id: environmentId,
|
|
16365
|
+
deployment_id: deploymentId,
|
|
16366
|
+
release_id: archive.sha256,
|
|
16367
|
+
release
|
|
16368
|
+
});
|
|
16369
|
+
};
|
|
16370
|
+
try {
|
|
16371
|
+
const response = await http.postBinary(endpoint, {
|
|
16372
|
+
stream: archiveStream(archive),
|
|
16373
|
+
byteLength: archive.sizeBytes
|
|
16374
|
+
}, {
|
|
16375
|
+
contentType: FRONTEND_ARCHIVE_CONTENT_TYPE,
|
|
16376
|
+
contentLength: archive.sizeBytes,
|
|
16377
|
+
contentSha256: archive.sha256,
|
|
16378
|
+
maxJsonBytes: RESPONSE_MAX_BYTES,
|
|
16379
|
+
timeoutMs: UPLOAD_REQUEST_TIMEOUT_MS,
|
|
16380
|
+
responseTimeoutMs: MUTATION_RESPONSE_TIMEOUT_MS
|
|
16381
|
+
});
|
|
16382
|
+
const value = response.data && typeof response.data === "object" && !Array.isArray(response.data) ? response.data : null;
|
|
16383
|
+
if (response.ok && response.status === 201) {
|
|
16384
|
+
const success = successPayload(value);
|
|
16385
|
+
if (success)
|
|
16386
|
+
return success;
|
|
16387
|
+
}
|
|
16388
|
+
if (response.transportError || response.responseReadError || response.status >= 500 || response.status === 202) {
|
|
16389
|
+
const readback = await getFrontendRelease(http, projectRef, deploymentId, archive.sha256);
|
|
16390
|
+
if (!readback.isError) {
|
|
16391
|
+
const readbackValue = JSON.parse(readback.content[0]?.text ?? "{}");
|
|
16392
|
+
const release = readbackValue.release;
|
|
16393
|
+
if (release && typeof release === "object" && !Array.isArray(release) && release.release_id === archive.sha256) {
|
|
16394
|
+
return toolResponse({
|
|
16395
|
+
project_ref: projectRef,
|
|
16396
|
+
environment_id: environmentId,
|
|
16397
|
+
deployment_id: deploymentId,
|
|
16398
|
+
release_id: archive.sha256,
|
|
16399
|
+
release
|
|
16400
|
+
});
|
|
16401
|
+
}
|
|
16402
|
+
}
|
|
16403
|
+
}
|
|
16404
|
+
return releaseFailure("frontend.upload_project_web_release", response.status >= 400 && response.status < 500 && !response.transportError ? "HTTP_ERROR" : "OUTCOME_UNKNOWN", response.status);
|
|
16405
|
+
} finally {
|
|
16406
|
+
await archive.handle.close();
|
|
16407
|
+
}
|
|
16408
|
+
}
|
|
16358
16409
|
async function uploadFrontendSource(http, projectRef, deploymentId, archivePath) {
|
|
16359
16410
|
const endpoint = `${deploymentEndpoint(projectRef, deploymentId)}/deploy/upload`;
|
|
16360
16411
|
const archive = await verifiedArchive(archivePath);
|
|
@@ -16912,7 +16963,7 @@ var ApplicationRollbackSnapshotSchema2 = ApplicationRollbackSnapshotSchema;
|
|
|
16912
16963
|
var ApplicationActivationHistoryCursorSchema2 = ApplicationActivationHistoryCursorSchema;
|
|
16913
16964
|
var ApplicationPromotionPlanSchema2 = ApplicationPromotionPlanSchema;
|
|
16914
16965
|
var ApplicationDeployRequestSchema2 = ApplicationDeployRequestSchema;
|
|
16915
|
-
var
|
|
16966
|
+
var ApplicationDeployWebReleaseSchema2 = ApplicationDeployWebReleaseSchema;
|
|
16916
16967
|
|
|
16917
16968
|
// src/shared/mutation-protocol.ts
|
|
16918
16969
|
import { createHash as createHash6 } from "node:crypto";
|
|
@@ -17730,7 +17781,7 @@ var APPLICATION_TOOL_SCHEMA = {
|
|
|
17730
17781
|
configuration_path: optional(String2(), "[put_configuration] Local configuration write JSON including revision and expected revision"),
|
|
17731
17782
|
configuration_write: optional(Unknown(), "[deploy_application] Parsed immutable configuration write"),
|
|
17732
17783
|
manifest_path: optional(String2(), "[upload_release] Local delivery.manifest.json"),
|
|
17733
|
-
|
|
17784
|
+
web_release: optional(ApplicationDeployWebReleaseSchema2, "[deploy_application] Immutable staged Web release uploaded by the deploy profile"),
|
|
17734
17785
|
release_id: optional(ApplicationReleaseIdSchema2, "[get_release/get_deploy_plan/deploy_release/activate_release/reconcile_activation/rollback_release] Immutable application release ID; platform selects previous for default rollback"),
|
|
17735
17786
|
source_ref: optional(String2({ pattern: "^[A-Za-z0-9_-]{1,20}$" }), "[get_release_transfer_plan/transfer_release] Source project ref"),
|
|
17736
17787
|
source_release_id: optional(ApplicationReleaseIdSchema2, "[get_release_transfer_plan/transfer_release] Source immutable release ID"),
|
|
@@ -18109,7 +18160,7 @@ function registerApplicationTools(server, http) {
|
|
|
18109
18160
|
...configurationId === undefined ? {} : { configuration_id: configurationId },
|
|
18110
18161
|
...configurationWrite === undefined ? {} : { configuration_write: configurationWrite },
|
|
18111
18162
|
...typeof args["approved_migration_digest"] === "string" ? { approved_migration_digest: args["approved_migration_digest"] } : {},
|
|
18112
|
-
...args["
|
|
18163
|
+
...args["web_release"] === undefined ? {} : { web_release: args["web_release"] }
|
|
18113
18164
|
};
|
|
18114
18165
|
if (!Check2(ApplicationDeployRequestSchema2, body)) {
|
|
18115
18166
|
throw new Error("Invalid application deploy request");
|
|
@@ -24587,7 +24638,7 @@ var REMOTE_APP_DESCRIPTIONS = {
|
|
|
24587
24638
|
source_environment_id: "[promote-plan/diff/promote] Source environment ID",
|
|
24588
24639
|
mutation_id: "[promote-status/promote-reconcile] Stable promotion mutation ID",
|
|
24589
24640
|
approved_migration_digest: "[promote] Exact reviewed migration execution-plan digest",
|
|
24590
|
-
|
|
24641
|
+
web_release: "[release] Immutable staged Web release uploaded by the deploy profile",
|
|
24591
24642
|
branch_ref: "[preview-plan] Preview branch identity",
|
|
24592
24643
|
branch_name: "[preview/preview-create] Human-readable preview branch name",
|
|
24593
24644
|
data_mode: "[preview-plan/preview/preview-create] schema_only or full_clone",
|
|
@@ -25630,10 +25681,13 @@ async function runAppRelease(request, options, delegate) {
|
|
|
25630
25681
|
mutation_id: activationId,
|
|
25631
25682
|
...configurationId === undefined ? {} : { configuration_id: configurationId },
|
|
25632
25683
|
...configurationWrite === undefined ? {} : { configuration_write: configurationWrite },
|
|
25633
|
-
...request.
|
|
25684
|
+
...request.web_release === undefined ? {} : { web_release: request.web_release }
|
|
25634
25685
|
};
|
|
25635
25686
|
validateToolArguments(APPLICATION_TOOL_SCHEMA, deployArgs);
|
|
25636
|
-
|
|
25687
|
+
if (!options.projectDeployment) {
|
|
25688
|
+
throw new Error("Application release requires the unified project deployment handler");
|
|
25689
|
+
}
|
|
25690
|
+
const deployed = await options.projectDeployment(deployArgs);
|
|
25637
25691
|
const deployReceipt = resultObject(deployed);
|
|
25638
25692
|
const resolvedConfigurationId = typeof deployReceipt?.configuration_id === "string" ? deployReceipt.configuration_id : undefined;
|
|
25639
25693
|
if (resolvedConfigurationId !== undefined) {
|
|
@@ -28502,7 +28556,7 @@ function payload(response) {
|
|
|
28502
28556
|
throw new Error("Deployment operation returned an invalid response");
|
|
28503
28557
|
return parsed;
|
|
28504
28558
|
}
|
|
28505
|
-
async function stageApplicationWebRelease(http, projectRef, configRoot, skipBuild, json, environmentVariables) {
|
|
28559
|
+
async function stageApplicationWebRelease(http, projectRef, environmentId, configRoot, skipBuild, json, environmentVariables) {
|
|
28506
28560
|
const target = selectFrontendTarget(configRoot, await readDeployConfig(configRoot));
|
|
28507
28561
|
if (!target)
|
|
28508
28562
|
return null;
|
|
@@ -28522,59 +28576,29 @@ async function stageApplicationWebRelease(http, projectRef, configRoot, skipBuil
|
|
|
28522
28576
|
const remoteOutput = selected.outputDirectory && selected.outputDirectory !== "." ? selected.outputDirectory : "";
|
|
28523
28577
|
const outputDirectory = resolveInsideProject(projectDirectory, configuredOutput || remoteOutput || defaultOutputDirectory(selected.framework));
|
|
28524
28578
|
const build = createBuildEnvironment(target.config.buildEnv, environmentVariables);
|
|
28525
|
-
const report = phaseReporter(json);
|
|
28526
|
-
report("web", `${target.name} (${selected.id})`);
|
|
28527
28579
|
assertBuildEnvironment(build, skipBuild);
|
|
28528
28580
|
if (!skipBuild) {
|
|
28529
|
-
report("build", buildCommand);
|
|
28530
28581
|
await runBuild(buildCommand, projectDirectory, build.env, json);
|
|
28531
|
-
} else {
|
|
28532
|
-
report("build", "skipped");
|
|
28533
28582
|
}
|
|
28534
|
-
report("package", relative10(projectDirectory, outputDirectory) || ".");
|
|
28535
28583
|
const archive = await createFrontendArchive(outputDirectory);
|
|
28536
28584
|
try {
|
|
28537
|
-
const
|
|
28538
|
-
const activeReleaseId = typeof authority.active_release_id === "string" ? authority.active_release_id : null;
|
|
28539
|
-
const activeActivationId = typeof authority.active_activation_id === "string" ? authority.active_activation_id : null;
|
|
28540
|
-
const current = Array.isArray(authority.releases) ? record4(authority.releases[0]) : null;
|
|
28541
|
-
if (archive.sha256 === activeReleaseId && archive.treeSha256 !== current?.tree_sha256) {
|
|
28542
|
-
throw new Error("Active Web release tree does not match the local archive");
|
|
28543
|
-
}
|
|
28544
|
-
if (archive.treeSha256 === current?.tree_sha256) {
|
|
28545
|
-
report("done", "Web already current");
|
|
28546
|
-
return {};
|
|
28547
|
-
}
|
|
28548
|
-
report("upload", `${archive.fileCount} files`);
|
|
28549
|
-
const uploaded = payload(await uploadFrontendRelease(http, projectRef, selected.id, archive.archivePath));
|
|
28585
|
+
const uploaded = payload(await uploadProjectWebRelease(http, projectRef, environmentId, selected.id, archive.archivePath));
|
|
28550
28586
|
const release = record4(uploaded.release);
|
|
28551
28587
|
const releaseId = requiredString(release?.release_id, "release.release_id");
|
|
28552
28588
|
if (releaseId !== archive.sha256)
|
|
28553
28589
|
throw new Error("Uploaded Web release identity does not match the local archive");
|
|
28554
28590
|
if (release?.tree_sha256 !== archive.treeSha256)
|
|
28555
28591
|
throw new Error("Uploaded Web release tree does not match the local build");
|
|
28556
|
-
report("done", releaseId.slice(0, 12));
|
|
28557
28592
|
return {
|
|
28558
28593
|
request: {
|
|
28559
28594
|
deployment_id: selected.id,
|
|
28560
|
-
release_id: releaseId
|
|
28561
|
-
expected_active_release_id: activeReleaseId ?? "absent",
|
|
28562
|
-
expected_activation_id: activeActivationId ?? "absent",
|
|
28563
|
-
mutation_id: crypto.randomUUID()
|
|
28595
|
+
release_id: releaseId
|
|
28564
28596
|
}
|
|
28565
28597
|
};
|
|
28566
28598
|
} finally {
|
|
28567
28599
|
await archive.cleanup();
|
|
28568
28600
|
}
|
|
28569
28601
|
}
|
|
28570
|
-
function phaseReporter(json) {
|
|
28571
|
-
const started = performance.now();
|
|
28572
|
-
return (phase, detail) => {
|
|
28573
|
-
if (!json)
|
|
28574
|
-
console.error(` ${phase.padEnd(10)} ${detail}`);
|
|
28575
|
-
return Math.round(performance.now() - started);
|
|
28576
|
-
};
|
|
28577
|
-
}
|
|
28578
28602
|
function deployResponse(result, json) {
|
|
28579
28603
|
if (json)
|
|
28580
28604
|
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
@@ -28583,8 +28607,7 @@ function deployResponse(result, json) {
|
|
|
28583
28607
|
result.url ? `URL: ${String(result.url)}` : null,
|
|
28584
28608
|
result.release_id ? `Release: ${String(result.release_id)}` : null,
|
|
28585
28609
|
result.active_version ? `Active version: ${String(result.active_version)}` : null,
|
|
28586
|
-
result.file_count ? `Files: ${String(result.file_count)}` : null
|
|
28587
|
-
`Duration: ${(Number(result.duration_ms) / 1000).toFixed(1)}s`
|
|
28610
|
+
result.file_count ? `Files: ${String(result.file_count)}` : null
|
|
28588
28611
|
].filter((line) => Boolean(line));
|
|
28589
28612
|
return { content: [{ type: "text", text: lines.join(`
|
|
28590
28613
|
`) }] };
|
|
@@ -28629,7 +28652,7 @@ function registerDeployTools(server, http, options = {}) {
|
|
|
28629
28652
|
if (configurationPath && configurationId) {
|
|
28630
28653
|
throw new Error("Application profile must set only one of SUPACLOUD_APPLICATION_CONFIGURATION_PATH or SUPACLOUD_APPLICATION_CONFIGURATION_ID");
|
|
28631
28654
|
}
|
|
28632
|
-
const stagedWeb = await stageApplicationWebRelease(http, projectRef, configRoot, args.skip_build === true, args.json === true, options.environmentVariables);
|
|
28655
|
+
const stagedWeb = await stageApplicationWebRelease(http, projectRef, environmentId, configRoot, args.skip_build === true, args.json === true, options.environmentVariables);
|
|
28633
28656
|
const result = await options.applicationRelease({
|
|
28634
28657
|
action: "release",
|
|
28635
28658
|
ref: projectRef,
|
|
@@ -28640,7 +28663,7 @@ function registerDeployTools(server, http, options = {}) {
|
|
|
28640
28663
|
...configurationId ? { configuration_id: configurationId } : {},
|
|
28641
28664
|
...application.manifestPath ? { manifest_path: application.manifestPath } : {},
|
|
28642
28665
|
...args.skip_build === true ? { skip_build: true } : {},
|
|
28643
|
-
...stagedWeb?.request === undefined ? {} : {
|
|
28666
|
+
...stagedWeb?.request === undefined ? {} : { web_release: stagedWeb.request },
|
|
28644
28667
|
...args.json === true ? { format: "json", json: true } : {}
|
|
28645
28668
|
});
|
|
28646
28669
|
return result;
|
|
@@ -28656,8 +28679,6 @@ function registerDeployTools(server, http, options = {}) {
|
|
|
28656
28679
|
}
|
|
28657
28680
|
const requestedId = String(args.id || target.config.id || "").trim() || undefined;
|
|
28658
28681
|
const build = createBuildEnvironment(target.config.buildEnv, options.environmentVariables);
|
|
28659
|
-
const report = phaseReporter(args.json === true);
|
|
28660
|
-
report("inspect", `${target.name} (${projectRef})`);
|
|
28661
28682
|
if (target.config.type === "edge_function") {
|
|
28662
28683
|
if (args.diff === true)
|
|
28663
28684
|
throw new Error("Function release diffs require an immutable function release manifest");
|
|
@@ -28702,12 +28723,8 @@ function registerDeployTools(server, http, options = {}) {
|
|
|
28702
28723
|
}
|
|
28703
28724
|
assertBuildEnvironment(build, args.skip_build === true);
|
|
28704
28725
|
if (args.skip_build !== true) {
|
|
28705
|
-
report("build", buildCommand);
|
|
28706
28726
|
await runBuild(buildCommand, projectDirectory, build.env, args.json === true);
|
|
28707
|
-
} else {
|
|
28708
|
-
report("build", "skipped");
|
|
28709
28727
|
}
|
|
28710
|
-
report("deploy", `edge function ${slug}`);
|
|
28711
28728
|
const deployed = await options.edgeFunctionDeploy({
|
|
28712
28729
|
action: "deploy_bundle",
|
|
28713
28730
|
ref: projectRef,
|
|
@@ -28724,7 +28741,6 @@ function registerDeployTools(server, http, options = {}) {
|
|
|
28724
28741
|
return deployed;
|
|
28725
28742
|
const deployedText = deployed.content.find((chunk) => chunk.type === "text")?.text;
|
|
28726
28743
|
const deployedPayload = deployedText ? record4(JSON.parse(deployedText)) : null;
|
|
28727
|
-
const durationMs = report("done", slug);
|
|
28728
28744
|
return deployResponse({
|
|
28729
28745
|
ok: true,
|
|
28730
28746
|
unchanged: false,
|
|
@@ -28733,8 +28749,7 @@ function registerDeployTools(server, http, options = {}) {
|
|
|
28733
28749
|
project_ref: projectRef,
|
|
28734
28750
|
slug,
|
|
28735
28751
|
active_version: deployedPayload?.active_version,
|
|
28736
|
-
activation_id: deployedPayload?.activation_id
|
|
28737
|
-
duration_ms: durationMs
|
|
28752
|
+
activation_id: deployedPayload?.activation_id
|
|
28738
28753
|
}, args.json === true);
|
|
28739
28754
|
}
|
|
28740
28755
|
const listResponse = await http.get(`/v1/projects/${encodeURIComponent(projectRef)}/frontend/deployments`);
|
|
@@ -28760,12 +28775,8 @@ function registerDeployTools(server, http, options = {}) {
|
|
|
28760
28775
|
}
|
|
28761
28776
|
assertBuildEnvironment(build, args.skip_build === true);
|
|
28762
28777
|
if (args.skip_build !== true) {
|
|
28763
|
-
report("build", buildCommand);
|
|
28764
28778
|
await runBuild(buildCommand, projectDirectory, build.env, args.json === true);
|
|
28765
|
-
} else {
|
|
28766
|
-
report("build", "skipped");
|
|
28767
28779
|
}
|
|
28768
|
-
report("package", relative10(projectDirectory, outputDirectory) || ".");
|
|
28769
28780
|
const archive = await createFrontendArchive(outputDirectory);
|
|
28770
28781
|
try {
|
|
28771
28782
|
const inventory = payload(await readFrontendReleaseAuthority(http, projectRef, selected.id));
|
|
@@ -28777,7 +28788,6 @@ function registerDeployTools(server, http, options = {}) {
|
|
|
28777
28788
|
}
|
|
28778
28789
|
const unchanged = archive.treeSha256 === current?.tree_sha256;
|
|
28779
28790
|
if (args.plan === true || args.diff === true) {
|
|
28780
|
-
const durationMs = report("done", unchanged ? "unchanged plan" : "release diff ready");
|
|
28781
28791
|
return { content: [{ type: "text", text: JSON.stringify({
|
|
28782
28792
|
schema: "supacloud.frontend-deploy-plan.v1",
|
|
28783
28793
|
ok: true,
|
|
@@ -28800,12 +28810,10 @@ function registerDeployTools(server, http, options = {}) {
|
|
|
28800
28810
|
actions: unchanged ? [] : ["upload_release", "activate_release"],
|
|
28801
28811
|
file_count: archive.fileCount,
|
|
28802
28812
|
source_bytes: archive.sourceBytes,
|
|
28803
|
-
archive_bytes: archive.archiveBytes
|
|
28804
|
-
duration_ms: durationMs
|
|
28813
|
+
archive_bytes: archive.archiveBytes
|
|
28805
28814
|
}, null, 2) }] };
|
|
28806
28815
|
}
|
|
28807
28816
|
if (unchanged) {
|
|
28808
|
-
const durationMs = report("done", "already current");
|
|
28809
28817
|
return deployResponse({
|
|
28810
28818
|
ok: true,
|
|
28811
28819
|
unchanged: true,
|
|
@@ -28815,11 +28823,9 @@ function registerDeployTools(server, http, options = {}) {
|
|
|
28815
28823
|
tree_sha256: archive.treeSha256,
|
|
28816
28824
|
url: selected.deploymentUrl,
|
|
28817
28825
|
file_count: archive.fileCount,
|
|
28818
|
-
source_bytes: archive.sourceBytes
|
|
28819
|
-
duration_ms: durationMs
|
|
28826
|
+
source_bytes: archive.sourceBytes
|
|
28820
28827
|
}, args.json === true);
|
|
28821
28828
|
}
|
|
28822
|
-
report("upload", `${archive.fileCount} files`);
|
|
28823
28829
|
const uploaded = payload(await uploadFrontendRelease(http, projectRef, selected.id, archive.archivePath));
|
|
28824
28830
|
const release = record4(uploaded.release);
|
|
28825
28831
|
const releaseId = requiredString(release?.release_id, "release.release_id");
|
|
@@ -28827,7 +28833,6 @@ function registerDeployTools(server, http, options = {}) {
|
|
|
28827
28833
|
throw new Error("Uploaded release identity does not match the local archive");
|
|
28828
28834
|
if (release?.tree_sha256 !== archive.treeSha256)
|
|
28829
28835
|
throw new Error("Uploaded release tree does not match the local build");
|
|
28830
|
-
report("activate", releaseId.slice(0, 12));
|
|
28831
28836
|
const mutationId = crypto.randomUUID();
|
|
28832
28837
|
const activationResponse = await activateFrontendRelease(http, {
|
|
28833
28838
|
projectRef,
|
|
@@ -28856,7 +28861,6 @@ function registerDeployTools(server, http, options = {}) {
|
|
|
28856
28861
|
const activated = payload(activationResponse);
|
|
28857
28862
|
const finalResponse = await http.get(`/v1/projects/${encodeURIComponent(projectRef)}/frontend/deployments/${encodeURIComponent(selected.id)}`);
|
|
28858
28863
|
const finalDeployment = finalResponse.ok ? frontendDeployment(finalResponse.data) : selected;
|
|
28859
|
-
const durationMs = report("done", finalDeployment.deploymentUrl || selected.id);
|
|
28860
28864
|
return deployResponse({
|
|
28861
28865
|
ok: true,
|
|
28862
28866
|
unchanged: false,
|
|
@@ -28868,8 +28872,7 @@ function registerDeployTools(server, http, options = {}) {
|
|
|
28868
28872
|
previous_activation_id: activeActivationId,
|
|
28869
28873
|
url: finalDeployment.deploymentUrl,
|
|
28870
28874
|
file_count: archive.fileCount,
|
|
28871
|
-
source_bytes: archive.sourceBytes
|
|
28872
|
-
duration_ms: durationMs
|
|
28875
|
+
source_bytes: archive.sourceBytes
|
|
28873
28876
|
}, args.json === true);
|
|
28874
28877
|
} finally {
|
|
28875
28878
|
await archive.cleanup();
|
|
@@ -29504,7 +29507,7 @@ async function runProjectDeployment(http, args) {
|
|
|
29504
29507
|
...args.configuration_write === undefined ? {} : { configuration_write: args.configuration_write },
|
|
29505
29508
|
...args.expected_plan_sha256 === undefined ? {} : { expected_plan_sha256: args.expected_plan_sha256 },
|
|
29506
29509
|
...args.approved_migration_digest === undefined ? {} : { approved_migration_digest: args.approved_migration_digest },
|
|
29507
|
-
...args.
|
|
29510
|
+
...args.web_release === undefined ? {} : { web_release: args.web_release }
|
|
29508
29511
|
};
|
|
29509
29512
|
if (!Check2(scopeSchema, scope) || !Check2(ApplicationDeployRequestSchema, request) || request.configuration_id !== undefined && request.configuration_write !== undefined && request.configuration_id !== request.configuration_write.configuration_id) {
|
|
29510
29513
|
return releaseControlFailure(operation, "INVALID_RESPONSE", null);
|
|
@@ -29558,7 +29561,7 @@ async function runProjectDeployment(http, args) {
|
|
|
29558
29561
|
// package.json
|
|
29559
29562
|
var package_default = {
|
|
29560
29563
|
name: "@supacloud/cli",
|
|
29561
|
-
version: "0.
|
|
29564
|
+
version: "0.93.0",
|
|
29562
29565
|
description: "Project-scoped CLI for SupaCloud users",
|
|
29563
29566
|
type: "module",
|
|
29564
29567
|
main: "./dist/index.js",
|
|
@@ -29611,13 +29614,13 @@ var package_default = {
|
|
|
29611
29614
|
},
|
|
29612
29615
|
dependencies: {
|
|
29613
29616
|
"@supacloud/compiler": "^0.44.1",
|
|
29614
|
-
"@supacloud/delivery": "0.
|
|
29617
|
+
"@supacloud/delivery": "0.16.0",
|
|
29615
29618
|
"@supacloud/db": "0.16.1",
|
|
29616
29619
|
typebox: "1.3.36"
|
|
29617
29620
|
},
|
|
29618
29621
|
overrides: {
|
|
29619
29622
|
"@supacloud/contracts": "0.8.1",
|
|
29620
|
-
"@supacloud/delivery": "0.
|
|
29623
|
+
"@supacloud/delivery": "0.16.0",
|
|
29621
29624
|
"@graphql-tools/utils": "^12.0.3"
|
|
29622
29625
|
},
|
|
29623
29626
|
devDependencies: {
|
|
@@ -55,7 +55,7 @@ export interface AppToolArguments {
|
|
|
55
55
|
source_environment_id?: string;
|
|
56
56
|
mutation_id?: string;
|
|
57
57
|
approved_migration_digest?: string;
|
|
58
|
-
|
|
58
|
+
web_release?: ApplicationDeployRequest["web_release"];
|
|
59
59
|
branch_ref?: string;
|
|
60
60
|
branch_name?: string;
|
|
61
61
|
data_mode?: "schema_only" | "full_clone";
|
|
@@ -171,12 +171,9 @@ export declare const ApplicationDeployRequestSchema: import("typebox").TObject<{
|
|
|
171
171
|
}>>;
|
|
172
172
|
expected_plan_sha256: import("typebox").TOptional<import("typebox").TString>;
|
|
173
173
|
approved_migration_digest: import("typebox").TOptional<import("typebox").TString>;
|
|
174
|
-
|
|
174
|
+
web_release: import("typebox").TOptional<import("typebox").TObject<{
|
|
175
175
|
deployment_id: import("typebox").TString;
|
|
176
176
|
release_id: import("typebox").TString;
|
|
177
|
-
expected_active_release_id: import("typebox").TString;
|
|
178
|
-
expected_activation_id: import("typebox").TString;
|
|
179
|
-
mutation_id: import("typebox").TString;
|
|
180
177
|
}>>;
|
|
181
178
|
}>;
|
|
182
179
|
export declare const ApplicationDeployResultSchema: import("typebox").TObject<{
|
|
@@ -216,10 +213,7 @@ export declare const ApplicationDeployResultSchema: import("typebox").TObject<{
|
|
|
216
213
|
replayed: import("typebox").TBoolean;
|
|
217
214
|
}>>;
|
|
218
215
|
}>;
|
|
219
|
-
export declare const
|
|
216
|
+
export declare const ApplicationDeployWebReleaseSchema: import("typebox").TObject<{
|
|
220
217
|
deployment_id: import("typebox").TString;
|
|
221
218
|
release_id: import("typebox").TString;
|
|
222
|
-
expected_active_release_id: import("typebox").TString;
|
|
223
|
-
expected_activation_id: import("typebox").TString;
|
|
224
|
-
mutation_id: import("typebox").TString;
|
|
225
219
|
}>;
|
|
@@ -19,12 +19,9 @@ export declare const APPLICATION_TOOL_SCHEMA: {
|
|
|
19
19
|
configuration_path: Type.TOptional<Type.TString>;
|
|
20
20
|
configuration_write: Type.TOptional<Type.TUnknown>;
|
|
21
21
|
manifest_path: Type.TOptional<Type.TString>;
|
|
22
|
-
|
|
22
|
+
web_release: Type.TOptional<Type.TObject<{
|
|
23
23
|
deployment_id: Type.TString;
|
|
24
24
|
release_id: Type.TString;
|
|
25
|
-
expected_active_release_id: Type.TString;
|
|
26
|
-
expected_activation_id: Type.TString;
|
|
27
|
-
mutation_id: Type.TString;
|
|
28
25
|
}>>;
|
|
29
26
|
release_id: Type.TOptional<Type.TString>;
|
|
30
27
|
source_ref: Type.TOptional<Type.TString>;
|
|
@@ -42,6 +42,7 @@ export interface FrontendReleaseRecord {
|
|
|
42
42
|
export declare function listFrontendReleases(http: FrontendReleaseHttp, projectRef: string, deploymentId: string, cursor?: string, limit?: number): Promise<ToolResponse>;
|
|
43
43
|
export declare function getFrontendRelease(http: FrontendReleaseHttp, projectRef: string, deploymentId: string, releaseId: string): Promise<ToolResponse>;
|
|
44
44
|
export declare function uploadFrontendRelease(http: FrontendReleaseHttp, projectRef: string, deploymentId: string, archivePath: string): Promise<ToolResponse>;
|
|
45
|
+
export declare function uploadProjectWebRelease(http: FrontendReleaseHttp, projectRef: string, environmentId: string, deploymentId: string, archivePath: string): Promise<ToolResponse>;
|
|
45
46
|
export declare function uploadFrontendSource(http: FrontendReleaseHttp, projectRef: string, deploymentId: string, archivePath: string): Promise<ToolResponse>;
|
|
46
47
|
export declare function getActiveFrontendRelease(http: FrontendReleaseHttp, projectRef: string, deploymentId: string): Promise<ToolResponse>;
|
|
47
48
|
export declare function readFrontendReleaseAuthority(http: FrontendReleaseHttp, projectRef: string, deploymentId: string): Promise<ToolResponse>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@supacloud/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.93.0",
|
|
4
4
|
"description": "Project-scoped CLI for SupaCloud users",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -53,13 +53,13 @@
|
|
|
53
53
|
},
|
|
54
54
|
"dependencies": {
|
|
55
55
|
"@supacloud/compiler": "^0.44.1",
|
|
56
|
-
"@supacloud/delivery": "0.
|
|
56
|
+
"@supacloud/delivery": "0.16.0",
|
|
57
57
|
"@supacloud/db": "0.16.1",
|
|
58
58
|
"typebox": "1.3.36"
|
|
59
59
|
},
|
|
60
60
|
"overrides": {
|
|
61
61
|
"@supacloud/contracts": "0.8.1",
|
|
62
|
-
"@supacloud/delivery": "0.
|
|
62
|
+
"@supacloud/delivery": "0.16.0",
|
|
63
63
|
"@graphql-tools/utils": "^12.0.3"
|
|
64
64
|
},
|
|
65
65
|
"devDependencies": {
|