@supacloud/cli 0.24.0 → 0.25.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/README.md +16 -0
- package/dist/index.js +17 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -113,6 +113,22 @@ logical-backup and PostgREST lifecycle capabilities. It requires the Management
|
|
|
113
113
|
API context above; it does not promote an application `service_role` key to
|
|
114
114
|
Management authority.
|
|
115
115
|
|
|
116
|
+
Project pause and restore are explicit lifecycle commands. A logical backup
|
|
117
|
+
restore requires an operator to pause the selected project first and then use
|
|
118
|
+
`project get` to confirm that its status is `paused`. `project restore` resumes
|
|
119
|
+
the paused project lifecycle when its database exists; if the database is
|
|
120
|
+
missing, the platform begins project re-provisioning instead. It does not
|
|
121
|
+
restore a database backup and is never invoked automatically by the CLI.
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
supacloud-cli project pause --ref abc123
|
|
125
|
+
supacloud-cli release logical_backup_restore --ref abc123 \
|
|
126
|
+
--backup_id logical-full_abc123_<backup-id-suffix> \
|
|
127
|
+
--expected_sha256 <64-lowercase-hex> \
|
|
128
|
+
--restore_confirmation RESTORE_PROJECT:abc123:logical-full_abc123_<backup-id-suffix>:<64-lowercase-hex>
|
|
129
|
+
supacloud-cli project restore --ref abc123
|
|
130
|
+
```
|
|
131
|
+
|
|
116
132
|
```bash
|
|
117
133
|
supacloud-cli release logical_backup_list --ref abc123
|
|
118
134
|
supacloud-cli release logical_backup_create --ref abc123
|
package/dist/index.js
CHANGED
|
@@ -6459,7 +6459,7 @@ function resolveSupaCloudContext(env = process.env, cwd = process.cwd(), selecti
|
|
|
6459
6459
|
var ACTION_POLICY = {
|
|
6460
6460
|
project: {
|
|
6461
6461
|
read: ["get", "health", "logs", "api_keys", "settings", "tasks", "task_detail", "task_stats", "dlq", "background_settings"],
|
|
6462
|
-
write: ["task_cancel", "task_retry", "update_background_settings"]
|
|
6462
|
+
write: ["pause", "restore", "task_cancel", "task_retry", "update_background_settings"]
|
|
6463
6463
|
},
|
|
6464
6464
|
database: {
|
|
6465
6465
|
read: ["list_tables", "describe_columns", "list_indexes", "list_constraints", "list_extensions", "rls_status", "rls_policies", "list_auth_users", "get_auth_user", "connections", "stats", "slow_queries", "list_migrations", "migration_inventory", "project_url", "generate_types"],
|
|
@@ -10098,6 +10098,7 @@ var formatTaskStats = (data) => {
|
|
|
10098
10098
|
`);
|
|
10099
10099
|
};
|
|
10100
10100
|
var ok = (res) => res.ok ? JSON.stringify(res.data, null, 2) : `❌ Failed (${res.status}): ${JSON.stringify(res.data)}`;
|
|
10101
|
+
var simple = (res, msg) => res.ok ? `✅ ${msg}` : `❌ Failed (${res.status})`;
|
|
10101
10102
|
function buildProjectLogsPath(ref, logType) {
|
|
10102
10103
|
const params = new URLSearchParams({ limit: "200" });
|
|
10103
10104
|
if (logType && logType !== "all") {
|
|
@@ -10114,9 +10115,11 @@ function resolveRef(refFromArgs, defaultRef) {
|
|
|
10114
10115
|
function registerUserProjectCliTools(server, http, options = {}) {
|
|
10115
10116
|
const { projectRef } = options;
|
|
10116
10117
|
server.tool("project", `Project-scoped inspection and developer operations.
|
|
10117
|
-
Actions: get, health, logs, api_keys, settings, tasks, task_detail, task_cancel, task_retry, task_stats, dlq, background_settings, update_background_settings`, {
|
|
10118
|
+
Actions: get, pause, restore, health, logs, api_keys, settings, tasks, task_detail, task_cancel, task_retry, task_stats, dlq, background_settings, update_background_settings`, {
|
|
10118
10119
|
action: withDescription(stringEnum([
|
|
10119
10120
|
"get",
|
|
10121
|
+
"pause",
|
|
10122
|
+
"restore",
|
|
10120
10123
|
"health",
|
|
10121
10124
|
"logs",
|
|
10122
10125
|
"api_keys",
|
|
@@ -10144,6 +10147,12 @@ Actions: get, health, logs, api_keys, settings, tasks, task_detail, task_cancel,
|
|
|
10144
10147
|
return projectReadResponse(projectGetRead(await http.get(`/v1/projects/${resolvedRef}`, {
|
|
10145
10148
|
maxResponseBytes: PROJECT_READ_RESPONSE_MAX_BYTES
|
|
10146
10149
|
}), resolvedRef));
|
|
10150
|
+
case "pause":
|
|
10151
|
+
text = simple(await http.post(`/v1/projects/${resolvedRef}/pause`), `Project ${resolvedRef} paused`);
|
|
10152
|
+
break;
|
|
10153
|
+
case "restore":
|
|
10154
|
+
text = simple(await http.post(`/v1/projects/${resolvedRef}/restore`), `Project ${resolvedRef} restored`);
|
|
10155
|
+
break;
|
|
10147
10156
|
case "health":
|
|
10148
10157
|
text = ok(await http.get(`/v1/projects/${resolvedRef}/health`));
|
|
10149
10158
|
break;
|
|
@@ -10540,7 +10549,7 @@ var redirectStatus = Type.Optional(Type.Union([
|
|
|
10540
10549
|
Type.Literal(308)
|
|
10541
10550
|
]));
|
|
10542
10551
|
var ok2 = (res) => res.ok ? JSON.stringify(res.data, null, 2) : `❌ Failed (${res.status}): ${JSON.stringify(res.data)}`;
|
|
10543
|
-
var
|
|
10552
|
+
var simple2 = (res, msg) => res.ok ? `✅ ${msg}` : `❌ Failed (${res.status}): ${JSON.stringify(res.data)}`;
|
|
10544
10553
|
function registerGatewayTools(server, http, options = {}) {
|
|
10545
10554
|
const { projectRef } = options;
|
|
10546
10555
|
server.tool("gateway", `Gateway / Caddy 配置(通过 JSON Admin API 注入)。要求 admin 权限。
|
|
@@ -10802,11 +10811,11 @@ Actions: routes, upsert_route, update_route, delete_route, config, get_certifica
|
|
|
10802
10811
|
break;
|
|
10803
10812
|
case "set_custom_hostname": {
|
|
10804
10813
|
need("custom_hostname", custom_hostname);
|
|
10805
|
-
text =
|
|
10814
|
+
text = simple2(await http.post(`/v1/projects/${projectRefValue}/custom-hostname`, { custom_hostname }), `Custom hostname ${custom_hostname} requested`);
|
|
10806
10815
|
break;
|
|
10807
10816
|
}
|
|
10808
10817
|
case "delete_custom_hostname":
|
|
10809
|
-
text =
|
|
10818
|
+
text = simple2(await http.delete(`/v1/projects/${projectRefValue}/custom-hostname`), "Custom hostname removed");
|
|
10810
10819
|
break;
|
|
10811
10820
|
case "verify_custom_hostname":
|
|
10812
10821
|
text = ok2(await http.post(`/v1/projects/${projectRefValue}/custom-hostname/verify`));
|
|
@@ -12450,7 +12459,7 @@ function registerReleaseTools(server, http, options = {}) {
|
|
|
12450
12459
|
// package.json
|
|
12451
12460
|
var package_default = {
|
|
12452
12461
|
name: "@supacloud/cli",
|
|
12453
|
-
version: "0.
|
|
12462
|
+
version: "0.25.0",
|
|
12454
12463
|
description: "Project-scoped CLI for SupaCloud users",
|
|
12455
12464
|
type: "module",
|
|
12456
12465
|
main: "./dist/index.js",
|
|
@@ -12494,6 +12503,8 @@ var commandName = "supacloud-cli";
|
|
|
12494
12503
|
var preferredCommand = commandName;
|
|
12495
12504
|
var projectActionSchema = stringEnum([
|
|
12496
12505
|
"get",
|
|
12506
|
+
"pause",
|
|
12507
|
+
"restore",
|
|
12497
12508
|
"health",
|
|
12498
12509
|
"logs",
|
|
12499
12510
|
"api_keys",
|