@supacloud/cli 0.131.0 → 0.132.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 +50 -10
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -24818,6 +24818,19 @@ function rejectActionSpecificFlags(action, args) {
|
|
|
24818
24818
|
throw new Error(`'--bundle-dir' is not supported for '${action}'`);
|
|
24819
24819
|
}
|
|
24820
24820
|
}
|
|
24821
|
+
function databaseSecretName(action, value, projectApi) {
|
|
24822
|
+
if (action !== "deploy" && (value !== undefined || projectApi !== undefined)) {
|
|
24823
|
+
const flag = value !== undefined ? "--database-secret" : "--project-api";
|
|
24824
|
+
throw new Error(`'${flag}' is not supported for '${action}'`);
|
|
24825
|
+
}
|
|
24826
|
+
if (value === undefined) {
|
|
24827
|
+
if (projectApi !== undefined)
|
|
24828
|
+
throw new Error("'--project-api' requires '--database-secret'");
|
|
24829
|
+
} else if (typeof value !== "string" || value.length > 64 || !/^APP_[A-Z][A-Z0-9_]*_DATABASE_URL$/u.test(value)) {
|
|
24830
|
+
throw new Error("'--database-secret' expects an APP_*_DATABASE_URL secret name (max 64 characters), not a connection string");
|
|
24831
|
+
}
|
|
24832
|
+
return value;
|
|
24833
|
+
}
|
|
24821
24834
|
function resolveEntrypoint(pathArg) {
|
|
24822
24835
|
const resolved = resolve8(pathArg);
|
|
24823
24836
|
const stat = statSync4(resolved);
|
|
@@ -25175,6 +25188,26 @@ async function readFunctionIdentity(http, projectRef, slug) {
|
|
|
25175
25188
|
const identity = projectedFunctionIdentity(response.data, projectRef, slug);
|
|
25176
25189
|
return identity ? { content: [{ type: "text", text: JSON.stringify(identity, null, 2) }] } : releaseControlFailure("edge_functions.get_config", "INVALID_RESPONSE", response.status);
|
|
25177
25190
|
}
|
|
25191
|
+
async function databaseDeployCapabilities(http, target, secret, projectApi, base) {
|
|
25192
|
+
if (base === undefined && target.expectedActiveVersion !== "absent") {
|
|
25193
|
+
const response = await http.get(`${edgeFunctionResourcePath(target.projectRef, target.slug)}/config`, { maxJsonBytes: 128 * 1024 });
|
|
25194
|
+
const current = response.ok && projectedFunctionIdentity(response.data, target.projectRef, target.slug);
|
|
25195
|
+
if (!current)
|
|
25196
|
+
throw new Error("Could not read the current Function configuration for '--database-secret'");
|
|
25197
|
+
if (current.active_version !== target.expectedActiveVersion || current.activation_id !== target.expectedActivationId) {
|
|
25198
|
+
throw new Error("Function activation changed. Run 'edge_functions list' before deploying again.");
|
|
25199
|
+
}
|
|
25200
|
+
base = current.capabilities;
|
|
25201
|
+
}
|
|
25202
|
+
const { secrets = [], outbound_hosts, bindings, background } = base ?? {};
|
|
25203
|
+
const selectedBindings = projectApi === true ? [...new Set([...bindings ?? ["pgredis"], "project_api"])] : projectApi === false ? bindings?.filter((name) => name !== "project_api") : bindings;
|
|
25204
|
+
return {
|
|
25205
|
+
secrets: [...new Set([...secrets, secret])],
|
|
25206
|
+
...outbound_hosts === undefined ? {} : { outbound_hosts },
|
|
25207
|
+
...selectedBindings === undefined ? {} : { bindings: selectedBindings },
|
|
25208
|
+
...background === undefined ? {} : { background }
|
|
25209
|
+
};
|
|
25210
|
+
}
|
|
25178
25211
|
async function updateFunctionConfiguration(http, request) {
|
|
25179
25212
|
const response = await http.patchReleaseMutation(`${edgeFunctionResourcePath(request.projectRef, request.slug)}/config`, { ...request.config, expected_activation_id: request.expectedActivationId });
|
|
25180
25213
|
if (!response.ok)
|
|
@@ -25313,6 +25346,8 @@ Actions: list, get_config, deploy, deploy_bundle, deploy_manifest, config, sourc
|
|
|
25313
25346
|
path: optional(String2(), "[deploy/check] Source path; [scaffold] optional target directory"),
|
|
25314
25347
|
"prebundled-path": optional(String2(), "[deploy] Prebuilt runtime bundle to upload without rebuilding; requires expected-sha256"),
|
|
25315
25348
|
"expected-sha256": optional(String2({ pattern: SHA256_HEX_PATTERN.source, minLength: 64, maxLength: 64 }), "[deploy] Required lowercase SHA-256 of the exact prebundled-path bytes"),
|
|
25349
|
+
"database-secret": optional(String2(), "[deploy] Bind an APP_*_DATABASE_URL project secret by name"),
|
|
25350
|
+
"project-api": optional(Boolean2(), "[deploy] With database-secret, explicitly grant or revoke project API access (includes the service-role key)"),
|
|
25316
25351
|
output: optional(String2(), "[source] Write source to this local file instead of stdout; the file must not already exist"),
|
|
25317
25352
|
files: optional(functionFilesSchema, "[deploy_bundle] File map as a JSON object: { 'index.ts': '...', '_shared/x.ts': '...' }"),
|
|
25318
25353
|
"bundle-dir": optional(String2(), "[deploy_bundle] Local self-contained UTF-8 bundle directory; excludes node_modules, .git, AppleDouble, symlinks, and special files"),
|
|
@@ -25342,6 +25377,7 @@ Actions: list, get_config, deploy, deploy_bundle, deploy_manifest, config, sourc
|
|
|
25342
25377
|
};
|
|
25343
25378
|
}
|
|
25344
25379
|
validateFunctionAot(args);
|
|
25380
|
+
const databaseSecret = databaseSecretName(args.action, args["database-secret"], args["project-api"]);
|
|
25345
25381
|
if (args.action === "activate")
|
|
25346
25382
|
return activateFunctionVersion(http, args, options.readOnly);
|
|
25347
25383
|
if (args.action === "deploy_manifest")
|
|
@@ -25445,6 +25481,13 @@ ${checkRes.err}`;
|
|
|
25445
25481
|
case "deploy":
|
|
25446
25482
|
need("ref", ref);
|
|
25447
25483
|
need("slug", slug);
|
|
25484
|
+
need("expected-active-version", expectedActiveVersion);
|
|
25485
|
+
need("expected-activation-id", expectedActivationId);
|
|
25486
|
+
const target = { projectRef: ref, slug, expectedActiveVersion, expectedActivationId };
|
|
25487
|
+
const deployConfig = functionConfig();
|
|
25488
|
+
if (databaseSecret !== undefined) {
|
|
25489
|
+
deployConfig.capabilities = await databaseDeployCapabilities(http, target, databaseSecret, args["project-api"], capabilities);
|
|
25490
|
+
}
|
|
25448
25491
|
const deployCode = await preparedDeployCode(args);
|
|
25449
25492
|
if (!deployCode.prebundled) {
|
|
25450
25493
|
const deployCheck = await checkSyntax(deployCode.code);
|
|
@@ -25459,15 +25502,12 @@ ${deployCheck.err}`;
|
|
|
25459
25502
|
...deployCode.prebundled ? { prebundled: true, expected_sha256: deployCode.expectedSha256 } : { minify },
|
|
25460
25503
|
expected_active_version: expectedActiveVersion,
|
|
25461
25504
|
expected_activation_id: expectedActivationId,
|
|
25462
|
-
...
|
|
25505
|
+
...deployConfig
|
|
25463
25506
|
}, { timeoutMs: EDGE_FUNCTION_DEPLOY_TIMEOUT_MS });
|
|
25464
25507
|
return functionMutationResponse({
|
|
25465
25508
|
operation: "edge_functions.deploy",
|
|
25466
|
-
|
|
25467
|
-
|
|
25468
|
-
expectedActiveVersion,
|
|
25469
|
-
expectedActivationId,
|
|
25470
|
-
config: functionConfig()
|
|
25509
|
+
...target,
|
|
25510
|
+
config: deployConfig
|
|
25471
25511
|
}, deploymentResponse);
|
|
25472
25512
|
case "deploy_bundle":
|
|
25473
25513
|
need("ref", ref);
|
|
@@ -30193,7 +30233,7 @@ var starter_metadata_default = {
|
|
|
30193
30233
|
generatedBy: "supacloud/starter-metadata-v1",
|
|
30194
30234
|
packages: {
|
|
30195
30235
|
compiler: {
|
|
30196
|
-
version: "0.
|
|
30236
|
+
version: "0.70.0"
|
|
30197
30237
|
},
|
|
30198
30238
|
app: {
|
|
30199
30239
|
version: "0.41.0",
|
|
@@ -45134,7 +45174,7 @@ async function runProjectDeployment(http, args) {
|
|
|
45134
45174
|
// package.json
|
|
45135
45175
|
var package_default = {
|
|
45136
45176
|
name: "@supacloud/cli",
|
|
45137
|
-
version: "0.
|
|
45177
|
+
version: "0.132.0",
|
|
45138
45178
|
description: "Project-scoped CLI for SupaCloud users",
|
|
45139
45179
|
type: "module",
|
|
45140
45180
|
main: "./dist/index.js",
|
|
@@ -45186,7 +45226,7 @@ var package_default = {
|
|
|
45186
45226
|
directory: "packages/cli"
|
|
45187
45227
|
},
|
|
45188
45228
|
dependencies: {
|
|
45189
|
-
"@supacloud/compiler": "^0.
|
|
45229
|
+
"@supacloud/compiler": "^0.70.0",
|
|
45190
45230
|
"@supacloud/delivery": "0.30.1",
|
|
45191
45231
|
"@supacloud/db": "0.29.0",
|
|
45192
45232
|
typebox: "1.4.3"
|
|
@@ -45195,7 +45235,7 @@ var package_default = {
|
|
|
45195
45235
|
"@supacloud/contracts": "0.17.0",
|
|
45196
45236
|
"@supacloud/delivery": "0.30.1",
|
|
45197
45237
|
"@graphql-tools/utils": "^12.0.4",
|
|
45198
|
-
"@supacloud/compiler": "^0.
|
|
45238
|
+
"@supacloud/compiler": "^0.70.0",
|
|
45199
45239
|
"@supacloud/db": "0.29.0",
|
|
45200
45240
|
"deepmerge-ts": "8.0.2",
|
|
45201
45241
|
prisma: "6.19.3"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@supacloud/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.132.0",
|
|
4
4
|
"description": "Project-scoped CLI for SupaCloud users",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"directory": "packages/cli"
|
|
53
53
|
},
|
|
54
54
|
"dependencies": {
|
|
55
|
-
"@supacloud/compiler": "^0.
|
|
55
|
+
"@supacloud/compiler": "^0.70.0",
|
|
56
56
|
"@supacloud/delivery": "0.30.1",
|
|
57
57
|
"@supacloud/db": "0.29.0",
|
|
58
58
|
"typebox": "1.4.3"
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"@supacloud/contracts": "0.17.0",
|
|
62
62
|
"@supacloud/delivery": "0.30.1",
|
|
63
63
|
"@graphql-tools/utils": "^12.0.4",
|
|
64
|
-
"@supacloud/compiler": "^0.
|
|
64
|
+
"@supacloud/compiler": "^0.70.0",
|
|
65
65
|
"@supacloud/db": "0.29.0",
|
|
66
66
|
"deepmerge-ts": "8.0.2",
|
|
67
67
|
"prisma": "6.19.3"
|