@supacloud/admin 0.27.0 → 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 +79 -40
  2. package/package.json +7 -7
package/dist/index.js CHANGED
@@ -29206,7 +29206,7 @@ function FromObject10(context, type, value) {
29206
29206
  return value;
29207
29207
  const additionalProperties = GetAdditionalProperties(type);
29208
29208
  for (const key of Keys(value)) {
29209
- if (HasPropertyKey(type.properties, key)) {
29209
+ if (HasPropertyKey(type.properties, key) && IsSchema(type.properties[key])) {
29210
29210
  value[key] = FromType19(context, type.properties[key], value[key]);
29211
29211
  continue;
29212
29212
  }
@@ -29291,6 +29291,9 @@ function FromProperties4(properties) {
29291
29291
  result[key] = FromType20(properties[key]);
29292
29292
  return result;
29293
29293
  }
29294
+ function FromRecordKey(type) {
29295
+ return String2({ pattern: RecordPattern(type) });
29296
+ }
29294
29297
  function FromPriorityTypes(types) {
29295
29298
  return FromTypes6(Priority(types));
29296
29299
  }
@@ -29298,7 +29301,7 @@ function FromTypes6(types) {
29298
29301
  return types.map((type) => FromType20(type));
29299
29302
  }
29300
29303
  function FromType20(type) {
29301
- const next = IsArray2(type) ? _Array_(FromType20(type.items), ArrayOptions(type)) : IsIntersect(type) ? Intersect(FromTypes6(type.allOf)) : IsUnion(type) ? Union(FromPriorityTypes(type.anyOf)) : IsObject2(type) ? _Object_(FromProperties4(type.properties)) : IsRecord(type) ? Record(RecordKey(type), FromType20(RecordValue(type))) : IsTuple(type) ? Tuple(FromTypes6(type.items)) : type;
29304
+ const next = IsArray2(type) ? _Array_(FromType20(type.items), ArrayOptions(type)) : IsIntersect(type) ? Intersect(FromTypes6(type.allOf)) : IsUnion(type) ? Union(FromPriorityTypes(type.anyOf)) : IsObject2(type) ? _Object_(FromProperties4(type.properties)) : IsRecord(type) ? Record(FromRecordKey(type), FromType20(RecordValue(type))) : IsTuple(type) ? Tuple(FromTypes6(type.items)) : type;
29302
29305
  return Modifiers(type, next);
29303
29306
  }
29304
29307
  function UnionPrioritySort(type) {
@@ -30119,6 +30122,8 @@ function decodedSchema(inputSchema, outputSchema, decode, options) {
30119
30122
  return result;
30120
30123
  }
30121
30124
  function schemaEnumValues(schema) {
30125
+ if (!schema)
30126
+ return [];
30122
30127
  const view = schema;
30123
30128
  if (Array.isArray(view.enum)) {
30124
30129
  return view.enum.filter((value) => typeof value === "string" || typeof value === "number").map((value) => String(value));
@@ -30146,12 +30151,33 @@ function schemaProperties(schema) {
30146
30151
  }
30147
30152
  return schema;
30148
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
+ }
30149
30174
  var resultSchema = _Object_({
30150
30175
  content: _Array_(_Object_({ type: Literal("text"), text: String2() })),
30151
30176
  isError: Optional(Boolean2())
30152
30177
  });
30153
30178
  function registerTool(server, name, description, schema, callback) {
30154
30179
  server.tool(name, description, schema, async (input) => {
30180
+ assertCurrentDeploymentInput(name, input);
30155
30181
  const args = parseToolArguments(schema, input);
30156
30182
  const result = await callback(args);
30157
30183
  if (!Check2(resultSchema, result))
@@ -42363,7 +42389,7 @@ function FromObject25(context, type, value) {
42363
42389
  return value;
42364
42390
  const additionalProperties = GetAdditionalProperties2(type);
42365
42391
  for (const key of Keys2(value)) {
42366
- if (HasPropertyKey2(type.properties, key)) {
42392
+ if (HasPropertyKey2(type.properties, key) && IsSchema3(type.properties[key])) {
42367
42393
  value[key] = FromType44(context, type.properties[key], value[key]);
42368
42394
  continue;
42369
42395
  }
@@ -42448,6 +42474,9 @@ function FromProperties9(properties) {
42448
42474
  result[key] = FromType45(properties[key]);
42449
42475
  return result;
42450
42476
  }
42477
+ function FromRecordKey2(type) {
42478
+ return String4({ pattern: RecordPattern2(type) });
42479
+ }
42451
42480
  function FromPriorityTypes2(types) {
42452
42481
  return FromTypes12(Priority2(types));
42453
42482
  }
@@ -42455,7 +42484,7 @@ function FromTypes12(types) {
42455
42484
  return types.map((type) => FromType45(type));
42456
42485
  }
42457
42486
  function FromType45(type) {
42458
- const next = IsArray4(type) ? _Array_2(FromType45(type.items), ArrayOptions2(type)) : IsIntersect2(type) ? Intersect2(FromTypes12(type.allOf)) : IsUnion2(type) ? Union2(FromPriorityTypes2(type.anyOf)) : IsObject4(type) ? _Object_2(FromProperties9(type.properties)) : IsRecord2(type) ? Record2(RecordKey2(type), FromType45(RecordValue2(type))) : IsTuple2(type) ? Tuple2(FromTypes12(type.items)) : type;
42487
+ const next = IsArray4(type) ? _Array_2(FromType45(type.items), ArrayOptions2(type)) : IsIntersect2(type) ? Intersect2(FromTypes12(type.allOf)) : IsUnion2(type) ? Union2(FromPriorityTypes2(type.anyOf)) : IsObject4(type) ? _Object_2(FromProperties9(type.properties)) : IsRecord2(type) ? Record2(FromRecordKey2(type), FromType45(RecordValue2(type))) : IsTuple2(type) ? Tuple2(FromTypes12(type.items)) : type;
42459
42488
  return Modifiers2(type, next);
42460
42489
  }
42461
42490
  function UnionPrioritySort2(type) {
@@ -43276,6 +43305,28 @@ function decodedSchema2(inputSchema, outputSchema, decode, options) {
43276
43305
  return result;
43277
43306
  }
43278
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
+
43279
43330
  // ../cli/src/shared/tool-server.ts
43280
43331
  var resultSchema2 = _Object_2({
43281
43332
  content: _Array_2(_Object_2({ type: Literal2("text"), text: String4() })),
@@ -43283,6 +43334,7 @@ var resultSchema2 = _Object_2({
43283
43334
  });
43284
43335
  function registerTool2(server, name, description, schema, callback) {
43285
43336
  server.tool(name, description, schema, async (input) => {
43337
+ assertCurrentDeploymentInput2(name, input);
43286
43338
  const args = parseToolArguments2(schema, input);
43287
43339
  const result = await callback(args);
43288
43340
  if (!Check4(resultSchema2, result))
@@ -43983,9 +44035,6 @@ async function activeReleaseReadback(http, identity) {
43983
44035
  if (inventory.active_release_id !== identity.releaseId || inventory.active_activation_id !== identity.mutationId) {
43984
44036
  return { release: null, status: 200 };
43985
44037
  }
43986
- if (snapshot.exactReadback) {
43987
- return { release: inventory.releases[0] ?? null, status: 200 };
43988
- }
43989
44038
  const releaseRead = await http.get(releasePath(identity.projectRef, identity.deploymentId, identity.releaseId), { maxJsonBytes: RESPONSE_MAX_BYTES });
43990
44039
  const release = releaseRead.ok ? releaseEnvelope(releaseRead.data, {
43991
44040
  projectRef: identity.projectRef,
@@ -44003,35 +44052,26 @@ async function readActiveFrontendRelease(http, projectRef, deploymentId) {
44003
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) {
44004
44053
  return { failure: releaseReadFailure("frontend.get_active_release", response), status: response.status };
44005
44054
  }
44006
- return { inventory, exactReadback: false };
44007
- }
44008
- if (response.ok || response.status !== 404) {
44009
- return { failure: releaseReadFailure("frontend.get_active_release", response), status: response.status };
44010
- }
44011
- const historyResponse = await http.get(`${releaseEndpoint(projectRef, deploymentId)}?limit=1`, {
44012
- maxJsonBytes: RESPONSE_MAX_BYTES
44013
- });
44014
- const history = historyResponse.ok && historyResponse.status === 200 ? releaseInventory(historyResponse.data, { projectRef, deploymentId }) : null;
44015
- if (!history || history.releases.length > 1) {
44016
- return {
44017
- failure: releaseReadFailure("frontend.get_active_release", historyResponse),
44018
- status: historyResponse.status
44019
- };
44055
+ return { inventory };
44020
44056
  }
44021
- if (history.active_release_id === null) {
44022
- return { inventory: { ...history, releases: [], next_cursor: null }, exactReadback: false };
44023
- }
44024
- const exactResponse = await http.get(releasePath(projectRef, deploymentId, history.active_release_id), {
44025
- maxJsonBytes: RESPONSE_MAX_BYTES
44026
- });
44027
- const release = exactResponse.ok && exactResponse.status === 200 ? releaseEnvelope(exactResponse.data, { projectRef, deploymentId, releaseId: history.active_release_id }) : null;
44028
- if (!release) {
44057
+ if (response.status === 404) {
44029
44058
  return {
44030
- failure: releaseReadFailure("frontend.get_active_release", exactResponse),
44031
- 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
44032
44072
  };
44033
44073
  }
44034
- return { inventory: { ...history, releases: [release], next_cursor: null }, exactReadback: true };
44074
+ return { failure: releaseReadFailure("frontend.get_active_release", response), status: response.status };
44035
44075
  }
44036
44076
  async function getActiveFrontendRelease(http, projectRef, deploymentId) {
44037
44077
  const snapshot = await readActiveFrontendRelease(http, projectRef, deploymentId);
@@ -44132,7 +44172,6 @@ async function readPreviousFrontendRelease(http, projectRef, deploymentId) {
44132
44172
  releases: [],
44133
44173
  next_cursor: null
44134
44174
  },
44135
- exactReadback: false,
44136
44175
  ...previous ? { previousRelease: previous } : {}
44137
44176
  };
44138
44177
  }
@@ -44282,7 +44321,7 @@ Actions: list_releases, get_active_release, get_release, upload_release, activat
44282
44321
  // package.json
44283
44322
  var package_default = {
44284
44323
  name: "@supacloud/admin",
44285
- version: "0.27.0",
44324
+ version: "0.28.0",
44286
44325
  description: "Platform administration CLI for SupaCloud operators",
44287
44326
  type: "module",
44288
44327
  main: "./dist/index.js",
@@ -44317,9 +44356,9 @@ var package_default = {
44317
44356
  directory: "packages/admin"
44318
44357
  },
44319
44358
  dependencies: {
44320
- "@supacloud/delivery": "0.12.0",
44321
- typebox: "1.3.34",
44322
- "@supacloud/cli": "0.83.0",
44359
+ "@supacloud/delivery": "0.16.0",
44360
+ typebox: "1.3.36",
44361
+ "@supacloud/cli": "0.94.0",
44323
44362
  ssh2: "^1.17.0"
44324
44363
  },
44325
44364
  devDependencies: {
@@ -44328,9 +44367,9 @@ var package_default = {
44328
44367
  typescript: "^7.0.2"
44329
44368
  },
44330
44369
  overrides: {
44331
- "@supacloud/contracts": "0.8.0",
44332
- "@supacloud/db": "0.16.0",
44333
- "@supacloud/delivery": "0.12.0",
44370
+ "@supacloud/contracts": "0.8.1",
44371
+ "@supacloud/db": "0.16.2",
44372
+ "@supacloud/delivery": "0.16.0",
44334
44373
  "@graphql-tools/utils": "^12.0.3"
44335
44374
  }
44336
44375
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@supacloud/admin",
3
- "version": "0.27.0",
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.12.0",
39
- "typebox": "1.3.34",
40
- "@supacloud/cli": "0.83.0",
38
+ "@supacloud/delivery": "0.16.0",
39
+ "typebox": "1.3.36",
40
+ "@supacloud/cli": "0.94.0",
41
41
  "ssh2": "^1.17.0"
42
42
  },
43
43
  "devDependencies": {
@@ -46,9 +46,9 @@
46
46
  "typescript": "^7.0.2"
47
47
  },
48
48
  "overrides": {
49
- "@supacloud/contracts": "0.8.0",
50
- "@supacloud/db": "0.16.0",
51
- "@supacloud/delivery": "0.12.0",
49
+ "@supacloud/contracts": "0.8.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
  }