run402-mcp 2.17.0 → 2.19.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "run402-mcp",
3
- "version": "2.17.0",
3
+ "version": "2.19.0",
4
4
  "description": "MCP server for Run402 — AI-native Postgres databases with REST API, auth, storage, and row-level security. Pay with x402 USDC micropayments.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -19,7 +19,7 @@
19
19
  * behavior; this file is the implementation.
20
20
  */
21
21
  import type { Client } from "../kernel.js";
22
- import type { ApplyOptions, ActiveReleaseInventory, DeployEvent, DeployEventsResponse, DeployListOptions, DeployListResponse, DeployOperation, DeployResult, DeployResolveOptions, DeployResolveResponse, OperationSnapshot, PlanResponse, ReleaseDiffOptions, ReleaseInventory, ReleaseInventoryByIdOptions, ReleaseInventoryOptions, ReleaseSpec, ReleaseToReleaseDiff, StartOptions } from "./deploy.types.js";
22
+ import type { ApplyOptions, ActiveReleaseInventory, DeployEvent, DeployEventsResponse, DeployListOptions, DeployListResponse, DeployOperation, DeployResult, DeployResolveOptions, DeployResolveResponse, OperationSnapshot, PlanResponse, PromoteOptions, PromoteResult, ReleaseDiffOptions, ReleaseInventory, ReleaseInventoryByIdOptions, ReleaseInventoryOptions, ReleaseSpec, ReleaseToReleaseDiff, StartOptions } from "./deploy.types.js";
23
23
  export declare class Deploy {
24
24
  private readonly client;
25
25
  constructor(client: Client);
@@ -82,6 +82,35 @@ export declare class Deploy {
82
82
  onEvent?: (event: DeployEvent) => void;
83
83
  project?: string;
84
84
  }): Promise<DeployResult>;
85
+ /**
86
+ * Promote an existing release to be the project's current live release —
87
+ * a pointer swap on `internal.projects.live_release_id` without re-running
88
+ * the apply pipeline. Designed for operator recovery from a destructive
89
+ * apply ("oops on a real project ID"). The prior release's bytes,
90
+ * functions, and migrations remain persisted; this just routes traffic
91
+ * back to them.
92
+ *
93
+ * Surfaces structured warnings via the result envelope:
94
+ *
95
+ * - `MIGRATIONS_NOT_REVERSIBLE` (requires_confirmation: true) when the
96
+ * target release predates migrations applied since. The migrations
97
+ * remain applied; the new live release runs against the current
98
+ * schema. Ack via `opts.allowWarningCodes`.
99
+ *
100
+ * - `FUNCTION_VERSION_MISMATCH` (informational) when overlapping
101
+ * function names have different code_hashes. The Lambda code is
102
+ * whatever's currently $LATEST.
103
+ *
104
+ * Rejected cases:
105
+ * - `PROMOTE_TARGET_NOT_FOUND` — releaseId doesn't exist
106
+ * - `PROMOTE_PROJECT_MISMATCH` — releaseId belongs to a different project
107
+ * - `PROMOTE_RELEASE_NOT_READY` — release status isn't promotable
108
+ * - `PROMOTE_NO_OP` — releaseId IS already the project's current live
109
+ * - `PROMOTE_WARNING_REQUIRES_ACK` — at least one blocking warning unacked
110
+ *
111
+ * Capability: unified-deploy (v1.58+, release-promote).
112
+ */
113
+ promote(project: string, releaseId: string, opts?: PromoteOptions): Promise<PromoteResult>;
85
114
  /**
86
115
  * Snapshot a deploy operation. The endpoint requires `apikey` auth, so
87
116
  * pass the project that owns the operation. (When omitted, the request
@@ -1 +1 @@
1
- {"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../../src/namespaces/deploy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAiB3C,OAAO,KAAK,EACV,YAAY,EACZ,sBAAsB,EAQtB,WAAW,EACX,oBAAoB,EAEpB,iBAAiB,EACjB,kBAAkB,EAClB,eAAe,EACf,YAAY,EACZ,oBAAoB,EACpB,qBAAqB,EAarB,iBAAiB,EAGjB,YAAY,EACZ,kBAAkB,EAClB,gBAAgB,EAChB,2BAA2B,EAC3B,uBAAuB,EACvB,WAAW,EACX,oBAAoB,EACpB,YAAY,EAEb,MAAM,mBAAmB,CAAC;AAqE3B,qBAAa,MAAM;IACL,OAAO,CAAC,QAAQ,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H,MAAM,WAAW,UAAU;IACzB,IAAI,OAAO,CAAC,UAAU,CAAC,CAAC;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;iEAG6D;IAC7D,KAAK,CAAC,EAAE,SAAS,GAAG,OAAO,GAAG,OAAO,CAAC;CACvC"}
@@ -197,6 +197,73 @@ export class Deploy {
197
197
  }
198
198
  return await pollSnapshotUntilReady(this.client, snapshot, {}, [], emit, opts.project);
199
199
  }
200
+ /**
201
+ * Promote an existing release to be the project's current live release —
202
+ * a pointer swap on `internal.projects.live_release_id` without re-running
203
+ * the apply pipeline. Designed for operator recovery from a destructive
204
+ * apply ("oops on a real project ID"). The prior release's bytes,
205
+ * functions, and migrations remain persisted; this just routes traffic
206
+ * back to them.
207
+ *
208
+ * Surfaces structured warnings via the result envelope:
209
+ *
210
+ * - `MIGRATIONS_NOT_REVERSIBLE` (requires_confirmation: true) when the
211
+ * target release predates migrations applied since. The migrations
212
+ * remain applied; the new live release runs against the current
213
+ * schema. Ack via `opts.allowWarningCodes`.
214
+ *
215
+ * - `FUNCTION_VERSION_MISMATCH` (informational) when overlapping
216
+ * function names have different code_hashes. The Lambda code is
217
+ * whatever's currently $LATEST.
218
+ *
219
+ * Rejected cases:
220
+ * - `PROMOTE_TARGET_NOT_FOUND` — releaseId doesn't exist
221
+ * - `PROMOTE_PROJECT_MISMATCH` — releaseId belongs to a different project
222
+ * - `PROMOTE_RELEASE_NOT_READY` — release status isn't promotable
223
+ * - `PROMOTE_NO_OP` — releaseId IS already the project's current live
224
+ * - `PROMOTE_WARNING_REQUIRES_ACK` — at least one blocking warning unacked
225
+ *
226
+ * Capability: unified-deploy (v1.58+, release-promote).
227
+ */
228
+ async promote(project, releaseId, opts = {}) {
229
+ if (!project || typeof project !== "string") {
230
+ throw new Run402DeployError(`Invalid project id: "${String(project)}"`, {
231
+ code: "BAD_REQUEST",
232
+ retryable: false,
233
+ context: "promoting release",
234
+ });
235
+ }
236
+ if (!releaseId || !releaseId.startsWith("rel_")) {
237
+ throw new Run402DeployError(`Invalid release id: "${releaseId}"`, {
238
+ code: "BAD_REQUEST",
239
+ retryable: false,
240
+ context: "promoting release",
241
+ });
242
+ }
243
+ // Note: `allowWarnings: true` is implemented client-side by enumerating
244
+ // every known blocking warning code, since the gateway expects a precise
245
+ // list per warning code (no wildcard accept). v1.58 has exactly one
246
+ // blocking promote warning (MIGRATIONS_NOT_REVERSIBLE); if more land,
247
+ // expand this list.
248
+ const ALL_BLOCKING_PROMOTE_WARNINGS = ["MIGRATIONS_NOT_REVERSIBLE"];
249
+ const allowCodes = opts.allowWarnings === true
250
+ ? ALL_BLOCKING_PROMOTE_WARNINGS
251
+ : (opts.allowWarningCodes ?? []);
252
+ try {
253
+ return await this.client.request(`/apply/v1/releases/${encodeURIComponent(releaseId)}/promote`, {
254
+ method: "POST",
255
+ context: "promoting release",
256
+ headers: { "content-type": "application/json" },
257
+ body: {
258
+ project,
259
+ allow_warning_codes: allowCodes,
260
+ },
261
+ });
262
+ }
263
+ catch (err) {
264
+ throw translateDeployError(err, "promote", null, releaseId);
265
+ }
266
+ }
200
267
  /**
201
268
  * Snapshot a deploy operation. The endpoint requires `apikey` auth, so
202
269
  * pass the project that owns the operation. (When omitted, the request
@@ -1484,6 +1551,7 @@ const FUNCTION_SPEC_FIELDS = new Set([
1484
1551
  "schedule",
1485
1552
  "requireAuth",
1486
1553
  "requireRole",
1554
+ "class",
1487
1555
  ]);
1488
1556
  const FUNCTION_CONFIG_FIELDS = new Set(["timeoutSeconds", "memoryMb"]);
1489
1557
  const SITE_SPEC_FIELDS = new Set(["replace", "patch", "public_paths"]);
@@ -2382,6 +2450,8 @@ async function normalizeFunction(fn, remember) {
2382
2450
  out.requireAuth = fn.requireAuth;
2383
2451
  if (fn.requireRole !== undefined)
2384
2452
  out.requireRole = fn.requireRole;
2453
+ if (fn.class !== undefined)
2454
+ out.class = fn.class;
2385
2455
  if (fn.source !== undefined) {
2386
2456
  const resolved = await resolveContent(fn.source, "function source");
2387
2457
  out.source = remember(resolved);