@supacloud/admin 0.27.1 → 0.28.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.
Files changed (2) hide show
  1. package/dist/index.js +67 -34
  2. package/package.json +5 -5
package/dist/index.js CHANGED
@@ -30122,6 +30122,8 @@ function decodedSchema(inputSchema, outputSchema, decode, options) {
30122
30122
  return result;
30123
30123
  }
30124
30124
  function schemaEnumValues(schema) {
30125
+ if (!schema)
30126
+ return [];
30125
30127
  const view = schema;
30126
30128
  if (Array.isArray(view.enum)) {
30127
30129
  return view.enum.filter((value) => typeof value === "string" || typeof value === "number").map((value) => String(value));
@@ -30149,12 +30151,33 @@ function schemaProperties(schema) {
30149
30151
  }
30150
30152
  return schema;
30151
30153
  }
30154
+ var DEPLOYMENT_UPGRADE = "DEPLOYMENT_UPGRADE_REQUIRED: Legacy deployment is no longer supported. Upgrade with `npm install -g @supacloud/cli@latest`, bind application.id and application.environmentId in supacloud.json (or SUPACLOUD_APPLICATION_ID and SUPACLOUD_ENV), then run `supacloud deploy`. SupaCloud owns deployment planning and activation; do not retry with legacy commands.";
30155
+ var removedFrontendActions = new Set([
30156
+ "deploy_git",
30157
+ "deploy_upload",
30158
+ "redeploy",
30159
+ "upload_release",
30160
+ "activate_release"
30161
+ ]);
30162
+ var removedDeployFlags = ["target", "id", "build_command", "output_dir", "plan", "diff", "dry_run"];
30163
+ function assertCurrentDeploymentInput(tool, input) {
30164
+ if (!input || typeof input !== "object" || Array.isArray(input))
30165
+ return;
30166
+ const args = input;
30167
+ if (tool === "frontend" && typeof args["action"] === "string" && removedFrontendActions.has(args["action"])) {
30168
+ throw new Error(DEPLOYMENT_UPGRADE);
30169
+ }
30170
+ if (tool === "deploy" && removedDeployFlags.some((flag) => Object.hasOwn(args, flag))) {
30171
+ throw new Error(`${DEPLOYMENT_UPGRADE} Put build settings in the frontend configuration. For read-only review use \`supacloud app deploy-plan\`.`);
30172
+ }
30173
+ }
30152
30174
  var resultSchema = _Object_({
30153
30175
  content: _Array_(_Object_({ type: Literal("text"), text: String2() })),
30154
30176
  isError: Optional(Boolean2())
30155
30177
  });
30156
30178
  function registerTool(server, name, description, schema, callback) {
30157
30179
  server.tool(name, description, schema, async (input) => {
30180
+ assertCurrentDeploymentInput(name, input);
30158
30181
  const args = parseToolArguments(schema, input);
30159
30182
  const result = await callback(args);
30160
30183
  if (!Check2(resultSchema, result))
@@ -43282,6 +43305,28 @@ function decodedSchema2(inputSchema, outputSchema, decode, options) {
43282
43305
  return result;
43283
43306
  }
43284
43307
 
43308
+ // ../cli/src/shared/deployment-upgrade.ts
43309
+ var DEPLOYMENT_UPGRADE2 = "DEPLOYMENT_UPGRADE_REQUIRED: Legacy deployment is no longer supported. Upgrade with `npm install -g @supacloud/cli@latest`, bind application.id and application.environmentId in supacloud.json (or SUPACLOUD_APPLICATION_ID and SUPACLOUD_ENV), then run `supacloud deploy`. SupaCloud owns deployment planning and activation; do not retry with legacy commands.";
43310
+ var removedFrontendActions2 = new Set([
43311
+ "deploy_git",
43312
+ "deploy_upload",
43313
+ "redeploy",
43314
+ "upload_release",
43315
+ "activate_release"
43316
+ ]);
43317
+ var removedDeployFlags2 = ["target", "id", "build_command", "output_dir", "plan", "diff", "dry_run"];
43318
+ function assertCurrentDeploymentInput2(tool, input) {
43319
+ if (!input || typeof input !== "object" || Array.isArray(input))
43320
+ return;
43321
+ const args = input;
43322
+ if (tool === "frontend" && typeof args["action"] === "string" && removedFrontendActions2.has(args["action"])) {
43323
+ throw new Error(DEPLOYMENT_UPGRADE2);
43324
+ }
43325
+ if (tool === "deploy" && removedDeployFlags2.some((flag) => Object.hasOwn(args, flag))) {
43326
+ throw new Error(`${DEPLOYMENT_UPGRADE2} Put build settings in the frontend configuration. For read-only review use \`supacloud app deploy-plan\`.`);
43327
+ }
43328
+ }
43329
+
43285
43330
  // ../cli/src/shared/tool-server.ts
43286
43331
  var resultSchema2 = _Object_2({
43287
43332
  content: _Array_2(_Object_2({ type: Literal2("text"), text: String4() })),
@@ -43289,6 +43334,7 @@ var resultSchema2 = _Object_2({
43289
43334
  });
43290
43335
  function registerTool2(server, name, description, schema, callback) {
43291
43336
  server.tool(name, description, schema, async (input) => {
43337
+ assertCurrentDeploymentInput2(name, input);
43292
43338
  const args = parseToolArguments2(schema, input);
43293
43339
  const result = await callback(args);
43294
43340
  if (!Check4(resultSchema2, result))
@@ -43989,9 +44035,6 @@ async function activeReleaseReadback(http, identity) {
43989
44035
  if (inventory.active_release_id !== identity.releaseId || inventory.active_activation_id !== identity.mutationId) {
43990
44036
  return { release: null, status: 200 };
43991
44037
  }
43992
- if (snapshot.exactReadback) {
43993
- return { release: inventory.releases[0] ?? null, status: 200 };
43994
- }
43995
44038
  const releaseRead = await http.get(releasePath(identity.projectRef, identity.deploymentId, identity.releaseId), { maxJsonBytes: RESPONSE_MAX_BYTES });
43996
44039
  const release = releaseRead.ok ? releaseEnvelope(releaseRead.data, {
43997
44040
  projectRef: identity.projectRef,
@@ -44009,35 +44052,26 @@ async function readActiveFrontendRelease(http, projectRef, deploymentId) {
44009
44052
  if (inventory.next_cursor !== null || inventory.releases.length !== (inventory.active_release_id === null ? 0 : 1) || inventory.releases[0] && inventory.releases[0].release_id !== inventory.active_release_id) {
44010
44053
  return { failure: releaseReadFailure("frontend.get_active_release", response), status: response.status };
44011
44054
  }
44012
- return { inventory, exactReadback: false };
44055
+ return { inventory };
44013
44056
  }
44014
- if (response.ok || response.status !== 404) {
44015
- return { failure: releaseReadFailure("frontend.get_active_release", response), status: response.status };
44016
- }
44017
- const historyResponse = await http.get(`${releaseEndpoint(projectRef, deploymentId)}?limit=1`, {
44018
- maxJsonBytes: RESPONSE_MAX_BYTES
44019
- });
44020
- const history = historyResponse.ok && historyResponse.status === 200 ? releaseInventory(historyResponse.data, { projectRef, deploymentId }) : null;
44021
- if (!history || history.releases.length > 1) {
44057
+ if (response.status === 404) {
44022
44058
  return {
44023
- failure: releaseReadFailure("frontend.get_active_release", historyResponse),
44024
- status: historyResponse.status
44025
- };
44026
- }
44027
- if (history.active_release_id === null) {
44028
- return { inventory: { ...history, releases: [], next_cursor: null }, exactReadback: false };
44029
- }
44030
- const exactResponse = await http.get(releasePath(projectRef, deploymentId, history.active_release_id), {
44031
- maxJsonBytes: RESPONSE_MAX_BYTES
44032
- });
44033
- const release = exactResponse.ok && exactResponse.status === 200 ? releaseEnvelope(exactResponse.data, { projectRef, deploymentId, releaseId: history.active_release_id }) : null;
44034
- if (!release) {
44035
- return {
44036
- failure: releaseReadFailure("frontend.get_active_release", exactResponse),
44037
- status: exactResponse.status
44059
+ failure: {
44060
+ isError: true,
44061
+ content: [{ type: "text", text: JSON.stringify({
44062
+ ok: false,
44063
+ operation: "frontend.get_active_release",
44064
+ error: {
44065
+ code: "DEPLOYMENT_UPGRADE_REQUIRED",
44066
+ http_status: 404,
44067
+ message: `${DEPLOYMENT_UPGRADE2} Check that the deployment exists and upgrade the server if this endpoint is unavailable.`
44068
+ }
44069
+ }) }]
44070
+ },
44071
+ status: response.status
44038
44072
  };
44039
44073
  }
44040
- return { inventory: { ...history, releases: [release], next_cursor: null }, exactReadback: true };
44074
+ return { failure: releaseReadFailure("frontend.get_active_release", response), status: response.status };
44041
44075
  }
44042
44076
  async function getActiveFrontendRelease(http, projectRef, deploymentId) {
44043
44077
  const snapshot = await readActiveFrontendRelease(http, projectRef, deploymentId);
@@ -44138,7 +44172,6 @@ async function readPreviousFrontendRelease(http, projectRef, deploymentId) {
44138
44172
  releases: [],
44139
44173
  next_cursor: null
44140
44174
  },
44141
- exactReadback: false,
44142
44175
  ...previous ? { previousRelease: previous } : {}
44143
44176
  };
44144
44177
  }
@@ -44288,7 +44321,7 @@ Actions: list_releases, get_active_release, get_release, upload_release, activat
44288
44321
  // package.json
44289
44322
  var package_default = {
44290
44323
  name: "@supacloud/admin",
44291
- version: "0.27.1",
44324
+ version: "0.28.0",
44292
44325
  description: "Platform administration CLI for SupaCloud operators",
44293
44326
  type: "module",
44294
44327
  main: "./dist/index.js",
@@ -44323,9 +44356,9 @@ var package_default = {
44323
44356
  directory: "packages/admin"
44324
44357
  },
44325
44358
  dependencies: {
44326
- "@supacloud/delivery": "0.14.1",
44359
+ "@supacloud/delivery": "0.16.0",
44327
44360
  typebox: "1.3.36",
44328
- "@supacloud/cli": "0.88.0",
44361
+ "@supacloud/cli": "0.94.0",
44329
44362
  ssh2: "^1.17.0"
44330
44363
  },
44331
44364
  devDependencies: {
@@ -44335,8 +44368,8 @@ var package_default = {
44335
44368
  },
44336
44369
  overrides: {
44337
44370
  "@supacloud/contracts": "0.8.1",
44338
- "@supacloud/db": "0.16.1",
44339
- "@supacloud/delivery": "0.14.1",
44371
+ "@supacloud/db": "0.16.2",
44372
+ "@supacloud/delivery": "0.16.0",
44340
44373
  "@graphql-tools/utils": "^12.0.3"
44341
44374
  }
44342
44375
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@supacloud/admin",
3
- "version": "0.27.1",
3
+ "version": "0.28.0",
4
4
  "description": "Platform administration CLI for SupaCloud operators",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -35,9 +35,9 @@
35
35
  "directory": "packages/admin"
36
36
  },
37
37
  "dependencies": {
38
- "@supacloud/delivery": "0.14.1",
38
+ "@supacloud/delivery": "0.16.0",
39
39
  "typebox": "1.3.36",
40
- "@supacloud/cli": "0.88.0",
40
+ "@supacloud/cli": "0.94.0",
41
41
  "ssh2": "^1.17.0"
42
42
  },
43
43
  "devDependencies": {
@@ -47,8 +47,8 @@
47
47
  },
48
48
  "overrides": {
49
49
  "@supacloud/contracts": "0.8.1",
50
- "@supacloud/db": "0.16.1",
51
- "@supacloud/delivery": "0.14.1",
50
+ "@supacloud/db": "0.16.2",
51
+ "@supacloud/delivery": "0.16.0",
52
52
  "@graphql-tools/utils": "^12.0.3"
53
53
  }
54
54
  }