@supacloud/admin 0.8.0 → 0.8.2
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 +1 -1
- package/dist/index.js +47 -26
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -29,7 +29,7 @@ npx @supacloud/admin status
|
|
|
29
29
|
npx @supacloud/admin ssh ping
|
|
30
30
|
npx @supacloud/admin ssh versions
|
|
31
31
|
npx @supacloud/admin ssh diagnose
|
|
32
|
-
npx @supacloud/admin project create --name my-app
|
|
32
|
+
npx @supacloud/admin project create --name my-app --domain example.com
|
|
33
33
|
npx @supacloud/admin project list
|
|
34
34
|
```
|
|
35
35
|
|
package/dist/index.js
CHANGED
|
@@ -25302,6 +25302,11 @@ async function removePartialUpload(sftp, partialPath, uploadError) {
|
|
|
25302
25302
|
}
|
|
25303
25303
|
|
|
25304
25304
|
// src/shared/cli.ts
|
|
25305
|
+
function cliToolResultIsError(toolResult) {
|
|
25306
|
+
if (toolResult.isError === true)
|
|
25307
|
+
return true;
|
|
25308
|
+
return toolResult.content?.some((chunk) => chunk.type === "text" && chunk.text?.trimStart().startsWith("❌") === true) ?? false;
|
|
25309
|
+
}
|
|
25305
25310
|
function coerceCliValue(value) {
|
|
25306
25311
|
if (value === "true")
|
|
25307
25312
|
return true;
|
|
@@ -25430,7 +25435,7 @@ async function runCli(cliTools, args, options = {}) {
|
|
|
25430
25435
|
} else {
|
|
25431
25436
|
console.log(JSON.stringify(result, null, 2));
|
|
25432
25437
|
}
|
|
25433
|
-
process.exit(result
|
|
25438
|
+
process.exit(cliToolResultIsError(result) ? 1 : 0);
|
|
25434
25439
|
} catch (error) {
|
|
25435
25440
|
const message = formatCliError(error);
|
|
25436
25441
|
console.error(`❌ Error: ${message}`);
|
|
@@ -28736,19 +28741,49 @@ function registerAdminProjectCliTools(server, http) {
|
|
|
28736
28741
|
name: optional(Type.String(), "[create] Project name"),
|
|
28737
28742
|
region: optional(Type.String(), "[create] Region (default: local)"),
|
|
28738
28743
|
organization_id: optional(Type.String(), "[create] Organization ID"),
|
|
28744
|
+
domain: optional(Type.String(), "[create] Base custom domain"),
|
|
28745
|
+
api_domain: optional(Type.String(), "[create] Explicit API domain"),
|
|
28746
|
+
auth_domain: optional(Type.String(), "[create] Explicit Auth/OIDC domain"),
|
|
28747
|
+
studio_domain: optional(Type.String(), "[create] Explicit Studio domain"),
|
|
28739
28748
|
settings: optional(Type.Record(Type.String(), Type.Unknown()), "[update_settings] Config fields to update"),
|
|
28740
28749
|
log_type: optional(stringEnum(["all", "auth", "database", "api"]), "[logs] Filter by service")
|
|
28741
|
-
}, async ({
|
|
28750
|
+
}, async ({
|
|
28751
|
+
action,
|
|
28752
|
+
ref,
|
|
28753
|
+
name,
|
|
28754
|
+
region,
|
|
28755
|
+
organization_id,
|
|
28756
|
+
domain,
|
|
28757
|
+
api_domain,
|
|
28758
|
+
auth_domain,
|
|
28759
|
+
studio_domain,
|
|
28760
|
+
settings,
|
|
28761
|
+
log_type
|
|
28762
|
+
}) => {
|
|
28742
28763
|
let text;
|
|
28743
28764
|
switch (action) {
|
|
28744
28765
|
case "list":
|
|
28745
28766
|
text = ok(await http.get("/v1/projects"));
|
|
28746
28767
|
break;
|
|
28747
|
-
case "create":
|
|
28768
|
+
case "create": {
|
|
28748
28769
|
if (!name)
|
|
28749
28770
|
throw new Error("'name' is required for create");
|
|
28750
|
-
|
|
28771
|
+
const createRequest = {
|
|
28772
|
+
name,
|
|
28773
|
+
region: region || "local",
|
|
28774
|
+
organization_id
|
|
28775
|
+
};
|
|
28776
|
+
if (domain)
|
|
28777
|
+
createRequest.domain = domain;
|
|
28778
|
+
if (api_domain)
|
|
28779
|
+
createRequest.api_domain = api_domain;
|
|
28780
|
+
if (auth_domain)
|
|
28781
|
+
createRequest.auth_domain = auth_domain;
|
|
28782
|
+
if (studio_domain)
|
|
28783
|
+
createRequest.studio_domain = studio_domain;
|
|
28784
|
+
text = ok(await http.post("/v1/projects", createRequest));
|
|
28751
28785
|
break;
|
|
28786
|
+
}
|
|
28752
28787
|
case "get":
|
|
28753
28788
|
text = ok(await http.get(`/v1/projects/${resolveRef(ref)}`));
|
|
28754
28789
|
break;
|
|
@@ -29137,7 +29172,7 @@ Actions: routes, upsert_route, update_route, delete_route, config, get_certifica
|
|
|
29137
29172
|
// package.json
|
|
29138
29173
|
var package_default = {
|
|
29139
29174
|
name: "@supacloud/admin",
|
|
29140
|
-
version: "0.8.
|
|
29175
|
+
version: "0.8.2",
|
|
29141
29176
|
description: "Platform administration CLI for SupaCloud operators",
|
|
29142
29177
|
type: "module",
|
|
29143
29178
|
main: "./dist/index.js",
|
|
@@ -29178,21 +29213,6 @@ var package_default = {
|
|
|
29178
29213
|
};
|
|
29179
29214
|
|
|
29180
29215
|
// src/index.ts
|
|
29181
|
-
var adminProjectActionSchema = stringEnum([
|
|
29182
|
-
"list",
|
|
29183
|
-
"create",
|
|
29184
|
-
"get",
|
|
29185
|
-
"delete",
|
|
29186
|
-
"pause",
|
|
29187
|
-
"restore",
|
|
29188
|
-
"restart",
|
|
29189
|
-
"settings",
|
|
29190
|
-
"update_settings",
|
|
29191
|
-
"api_keys",
|
|
29192
|
-
"health",
|
|
29193
|
-
"logs",
|
|
29194
|
-
"tasks"
|
|
29195
|
-
]);
|
|
29196
29216
|
var platformActionSchema = stringEnum([
|
|
29197
29217
|
"metrics",
|
|
29198
29218
|
"list_backups",
|
|
@@ -29264,7 +29284,7 @@ EXAMPLES
|
|
|
29264
29284
|
supacloud-admin ssh ping
|
|
29265
29285
|
supacloud-admin ssh versions
|
|
29266
29286
|
supacloud-admin ssh install --public_domain api.example.com --studio_domain studio.example.com
|
|
29267
|
-
supacloud-admin project create --name my-app
|
|
29287
|
+
supacloud-admin project create --name my-app --domain example.com
|
|
29268
29288
|
supacloud-admin project list
|
|
29269
29289
|
supacloud-admin platform metrics
|
|
29270
29290
|
supacloud-admin gateway routes --ref abc123
|
|
@@ -29296,8 +29316,9 @@ function createAdminTools(context = resolveSupaCloudContext()) {
|
|
|
29296
29316
|
}
|
|
29297
29317
|
};
|
|
29298
29318
|
const registerAdminHelp = () => {
|
|
29319
|
+
const projectHelpTool = captureTools((server) => registerAdminProjectCliTools(server, {})).project;
|
|
29299
29320
|
tools.project = {
|
|
29300
|
-
schema:
|
|
29321
|
+
schema: projectHelpTool.schema,
|
|
29301
29322
|
callback: async () => ({
|
|
29302
29323
|
isError: true,
|
|
29303
29324
|
content: [
|
|
@@ -29444,11 +29465,11 @@ async function main() {
|
|
|
29444
29465
|
console.log(chunk.text);
|
|
29445
29466
|
}
|
|
29446
29467
|
}
|
|
29447
|
-
|
|
29448
|
-
|
|
29449
|
-
return;
|
|
29468
|
+
} else {
|
|
29469
|
+
console.log(JSON.stringify(result, null, 2));
|
|
29450
29470
|
}
|
|
29451
|
-
|
|
29471
|
+
if (cliToolResultIsError(result))
|
|
29472
|
+
process.exitCode = 1;
|
|
29452
29473
|
return;
|
|
29453
29474
|
}
|
|
29454
29475
|
await runCli(cliTools, args, { commandName: "supacloud-admin" });
|