@run402/sdk 1.48.0 → 1.50.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 (49) hide show
  1. package/core-dist/config.d.ts +8 -0
  2. package/core-dist/config.js +10 -0
  3. package/core-dist/wallet-auth.d.ts +15 -0
  4. package/core-dist/wallet-auth.js +62 -0
  5. package/core-dist/wallet.d.ts +10 -0
  6. package/core-dist/wallet.js +25 -0
  7. package/dist/errors.d.ts +41 -0
  8. package/dist/errors.d.ts.map +1 -1
  9. package/dist/errors.js +23 -0
  10. package/dist/errors.js.map +1 -1
  11. package/dist/index.d.ts +24 -1
  12. package/dist/index.d.ts.map +1 -1
  13. package/dist/index.js +24 -1
  14. package/dist/index.js.map +1 -1
  15. package/dist/namespaces/apps.d.ts +14 -0
  16. package/dist/namespaces/apps.d.ts.map +1 -1
  17. package/dist/namespaces/apps.js +162 -19
  18. package/dist/namespaces/apps.js.map +1 -1
  19. package/dist/namespaces/deploy.d.ts +116 -0
  20. package/dist/namespaces/deploy.d.ts.map +1 -0
  21. package/dist/namespaces/deploy.js +1127 -0
  22. package/dist/namespaces/deploy.js.map +1 -0
  23. package/dist/namespaces/deploy.types.d.ts +430 -0
  24. package/dist/namespaces/deploy.types.d.ts.map +1 -0
  25. package/dist/namespaces/deploy.types.js +11 -0
  26. package/dist/namespaces/deploy.types.js.map +1 -0
  27. package/dist/namespaces/functions.d.ts +11 -3
  28. package/dist/namespaces/functions.d.ts.map +1 -1
  29. package/dist/namespaces/functions.js +11 -3
  30. package/dist/namespaces/functions.js.map +1 -1
  31. package/dist/namespaces/functions.types.d.ts +21 -4
  32. package/dist/namespaces/functions.types.d.ts.map +1 -1
  33. package/dist/node/canonicalize.d.ts +12 -5
  34. package/dist/node/canonicalize.d.ts.map +1 -1
  35. package/dist/node/canonicalize.js +12 -5
  36. package/dist/node/canonicalize.js.map +1 -1
  37. package/dist/node/files.d.ts +38 -0
  38. package/dist/node/files.d.ts.map +1 -0
  39. package/dist/node/files.js +88 -0
  40. package/dist/node/files.js.map +1 -0
  41. package/dist/node/index.d.ts +5 -3
  42. package/dist/node/index.d.ts.map +1 -1
  43. package/dist/node/index.js +2 -1
  44. package/dist/node/index.js.map +1 -1
  45. package/dist/node/sites-node.d.ts +34 -107
  46. package/dist/node/sites-node.d.ts.map +1 -1
  47. package/dist/node/sites-node.js +84 -353
  48. package/dist/node/sites-node.js.map +1 -1
  49. package/package.json +1 -1
@@ -1,4 +1,12 @@
1
1
  export declare function getApiBase(): string;
2
+ /**
3
+ * API base for the deploy-v2 routes. Defaults to the same value as
4
+ * `getApiBase()`. Set `RUN402_DEPLOY_API_BASE` to point only deploy traffic
5
+ * elsewhere — useful when running deploy-v2 against a staging gateway while
6
+ * the rest of the SDK still talks to production. In normal use callers
7
+ * should not need this override.
8
+ */
9
+ export declare function getDeployApiBase(): string;
2
10
  export declare function getConfigDir(): string;
3
11
  export declare function getKeystorePath(): string;
4
12
  export declare function getAllowancePath(): string;
@@ -4,6 +4,16 @@ import { existsSync, renameSync, mkdirSync } from "node:fs";
4
4
  export function getApiBase() {
5
5
  return process.env.RUN402_API_BASE || "https://api.run402.com";
6
6
  }
7
+ /**
8
+ * API base for the deploy-v2 routes. Defaults to the same value as
9
+ * `getApiBase()`. Set `RUN402_DEPLOY_API_BASE` to point only deploy traffic
10
+ * elsewhere — useful when running deploy-v2 against a staging gateway while
11
+ * the rest of the SDK still talks to production. In normal use callers
12
+ * should not need this override.
13
+ */
14
+ export function getDeployApiBase() {
15
+ return process.env.RUN402_DEPLOY_API_BASE || getApiBase();
16
+ }
7
17
  export function getConfigDir() {
8
18
  return process.env.RUN402_CONFIG_DIR || join(homedir(), ".config", "run402");
9
19
  }
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Wallet auth helper — generates EIP-191 signature headers for Run402 API.
3
+ * Uses @noble/curves (lighter than viem) for signing.
4
+ */
5
+ export interface WalletAuthHeaders {
6
+ "X-Run402-Wallet": string;
7
+ "X-Run402-Signature": string;
8
+ "X-Run402-Timestamp": string;
9
+ }
10
+ /**
11
+ * Get wallet auth headers for the Run402 API.
12
+ * Returns null if no wallet is configured.
13
+ */
14
+ export declare function getWalletAuthHeaders(walletPath?: string): WalletAuthHeaders | null;
15
+ //# sourceMappingURL=wallet-auth.d.ts.map
@@ -0,0 +1,62 @@
1
+ /**
2
+ * Wallet auth helper — generates EIP-191 signature headers for Run402 API.
3
+ * Uses @noble/curves (lighter than viem) for signing.
4
+ */
5
+ import { secp256k1 } from "@noble/curves/secp256k1.js";
6
+ import { keccak_256 } from "@noble/hashes/sha3.js";
7
+ import { bytesToHex } from "@noble/hashes/utils.js";
8
+ import { readWallet } from "./wallet.js";
9
+ /**
10
+ * EIP-191 personal_sign: sign a message with the wallet's private key.
11
+ */
12
+ function personalSign(privateKeyHex, address, message) {
13
+ const msgBytes = new TextEncoder().encode(message);
14
+ const prefix = new TextEncoder().encode(`\x19Ethereum Signed Message:\n${msgBytes.length}`);
15
+ const prefixed = new Uint8Array(prefix.length + msgBytes.length);
16
+ prefixed.set(prefix);
17
+ prefixed.set(msgBytes, prefix.length);
18
+ const hash = keccak_256(prefixed);
19
+ const pkHex = privateKeyHex.startsWith("0x")
20
+ ? privateKeyHex.slice(2)
21
+ : privateKeyHex;
22
+ const pkBytes = Uint8Array.from(Buffer.from(pkHex, "hex"));
23
+ const rawSig = secp256k1.sign(hash, pkBytes);
24
+ const sig = secp256k1.Signature.fromBytes(rawSig);
25
+ // Determine recovery bit by trying both and matching the address
26
+ let recovery = 0;
27
+ for (const v of [0, 1]) {
28
+ try {
29
+ const recovered = sig.addRecoveryBit(v).recoverPublicKey(hash);
30
+ const pubBytes = recovered.toBytes(false).slice(1); // uncompressed, drop 04 prefix
31
+ const addrBytes = keccak_256(pubBytes).slice(-20);
32
+ if ("0x" + bytesToHex(addrBytes) === address.toLowerCase()) {
33
+ recovery = v;
34
+ break;
35
+ }
36
+ }
37
+ catch {
38
+ continue;
39
+ }
40
+ }
41
+ const r = sig.r.toString(16).padStart(64, "0");
42
+ const s = sig.s.toString(16).padStart(64, "0");
43
+ const vHex = (recovery + 27).toString(16).padStart(2, "0");
44
+ return "0x" + r + s + vHex;
45
+ }
46
+ /**
47
+ * Get wallet auth headers for the Run402 API.
48
+ * Returns null if no wallet is configured.
49
+ */
50
+ export function getWalletAuthHeaders(walletPath) {
51
+ const wallet = readWallet(walletPath);
52
+ if (!wallet || !wallet.address || !wallet.privateKey)
53
+ return null;
54
+ const timestamp = Math.floor(Date.now() / 1000).toString();
55
+ const signature = personalSign(wallet.privateKey, wallet.address, `run402:${timestamp}`);
56
+ return {
57
+ "X-Run402-Wallet": wallet.address,
58
+ "X-Run402-Signature": signature,
59
+ "X-Run402-Timestamp": timestamp,
60
+ };
61
+ }
62
+ //# sourceMappingURL=wallet-auth.js.map
@@ -0,0 +1,10 @@
1
+ export interface WalletData {
2
+ address: string;
3
+ privateKey: string;
4
+ created?: string;
5
+ funded?: boolean;
6
+ lastFaucet?: string;
7
+ }
8
+ export declare function readWallet(path?: string): WalletData | null;
9
+ export declare function saveWallet(data: WalletData, path?: string): void;
10
+ //# sourceMappingURL=wallet.d.ts.map
@@ -0,0 +1,25 @@
1
+ import { readFileSync, writeFileSync, mkdirSync, existsSync, chmodSync, renameSync } from "node:fs";
2
+ import { dirname, join } from "node:path";
3
+ import { randomBytes } from "node:crypto";
4
+ import { getWalletPath } from "./config.js";
5
+ export function readWallet(path) {
6
+ const p = path ?? getWalletPath();
7
+ if (!existsSync(p))
8
+ return null;
9
+ try {
10
+ return JSON.parse(readFileSync(p, "utf-8"));
11
+ }
12
+ catch {
13
+ return null;
14
+ }
15
+ }
16
+ export function saveWallet(data, path) {
17
+ const p = path ?? getWalletPath();
18
+ const dir = dirname(p);
19
+ mkdirSync(dir, { recursive: true });
20
+ const tmp = join(dir, `.wallet.${randomBytes(4).toString("hex")}.tmp`);
21
+ writeFileSync(tmp, JSON.stringify(data, null, 2), { mode: 0o600 });
22
+ renameSync(tmp, p);
23
+ chmodSync(p, 0o600);
24
+ }
25
+ //# sourceMappingURL=wallet.js.map
package/dist/errors.d.ts CHANGED
@@ -36,4 +36,45 @@ export declare class LocalError extends Run402Error {
36
36
  readonly cause?: unknown;
37
37
  constructor(message: string, context: string, cause?: unknown);
38
38
  }
39
+ /**
40
+ * Deploy-state-machine failure surfaced from the v2 deploy flow. Carries the
41
+ * structured error envelope the gateway returns alongside the operation
42
+ * snapshot — phase, resource, retryability, and an optional remediation hint.
43
+ *
44
+ * The `code` enumerates the gateway's deploy error codes; consumers may
45
+ * switch on it to decide whether to retry, prompt the user for payment, ask
46
+ * for a fix, or escalate. Unknown codes from a newer gateway pass through
47
+ * verbatim — callers should treat unrecognized values as opaque.
48
+ */
49
+ export type Run402DeployErrorCode = "MIGRATION_FAILED" | "MIGRATION_CHECKSUM_MISMATCH" | "MIGRATION_SQL_NOT_FOUND" | "BASE_RELEASE_CONFLICT" | "PAYMENT_REQUIRED" | "SUBDOMAIN_MULTI_NOT_SUPPORTED" | "SCHEMA_SETTLE_TIMEOUT" | "ACTIVATION_FAILED" | "STORAGE_UNAVAILABLE" | "SITE_STAGE_FAILED" | "FUNCTION_BUILD_FAILED" | "CONTENT_UPLOAD_FAILED" | "INVALID_SPEC" | "OPERATION_NOT_FOUND" | "PLAN_NOT_FOUND" | "NOT_RESUMABLE" | "INVALID_STATE" | "RESUME_FAILED" | "INTERNAL_ERROR" | "PROJECT_NOT_FOUND" | (string & {});
50
+ export interface Run402DeployErrorFix {
51
+ action: string;
52
+ path?: string;
53
+ [key: string]: unknown;
54
+ }
55
+ export declare class Run402DeployError extends Run402Error {
56
+ readonly code: Run402DeployErrorCode;
57
+ readonly phase: string | null;
58
+ readonly resource: string | null;
59
+ readonly retryable: boolean;
60
+ readonly operationId: string | null;
61
+ readonly planId: string | null;
62
+ readonly fix: Run402DeployErrorFix | null;
63
+ readonly logs: string[] | null;
64
+ readonly rolledBack: boolean;
65
+ constructor(message: string, init: {
66
+ code: Run402DeployErrorCode;
67
+ phase?: string | null;
68
+ resource?: string | null;
69
+ retryable?: boolean;
70
+ operationId?: string | null;
71
+ planId?: string | null;
72
+ fix?: Run402DeployErrorFix | null;
73
+ logs?: string[] | null;
74
+ rolledBack?: boolean;
75
+ status?: number | null;
76
+ body?: unknown;
77
+ context: string;
78
+ });
79
+ }
39
80
  //# sourceMappingURL=errors.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,8BAAsB,WAAY,SAAQ,KAAK;IAC7C,iFAAiF;IACjF,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,+DAA+D;IAC/D,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,2FAA2F;IAC3F,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;gBAEb,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM;CAOnF;AAED,oGAAoG;AACpG,qBAAa,eAAgB,SAAQ,WAAW;CAAG;AAEnD,qGAAqG;AACrG,qBAAa,eAAgB,SAAQ,WAAW;IAC9C,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;gBACf,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,GAAE,MAAM,GAAG,IAAW,EAAE,IAAI,GAAE,OAAc;CAInG;AAED,4FAA4F;AAC5F,qBAAa,YAAa,SAAQ,WAAW;CAAG;AAEhD,wDAAwD;AACxD,qBAAa,QAAS,SAAQ,WAAW;CAAG;AAE5C,iGAAiG;AACjG,qBAAa,YAAa,SAAQ,WAAW;IAC3C,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;gBACZ,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM;CAI7D;AAED,iGAA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C;QACtB,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QACzB,SAAS,CAAC,EAAE,OAAO,CAAC;QACpB,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QAC5B,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QACvB,GAAG,CAAC,EAAE,oBAAoB,GAAG,IAAI,CAAC;QAClC,IAAI,CAAC,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;QACvB,UAAU,CAAC,EAAE,OAAO,CAAC;QACrB,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QACvB,IAAI,CAAC,EAAE,OAAO,CAAC;QACf,OAAO,EAAE,MAAM,CAAC;KACjB;CAaJ"}
package/dist/errors.js CHANGED
@@ -52,4 +52,27 @@ export class LocalError extends Run402Error {
52
52
  this.cause = cause;
53
53
  }
54
54
  }
55
+ export class Run402DeployError extends Run402Error {
56
+ code;
57
+ phase;
58
+ resource;
59
+ retryable;
60
+ operationId;
61
+ planId;
62
+ fix;
63
+ logs;
64
+ rolledBack;
65
+ constructor(message, init) {
66
+ super(message, init.status ?? null, init.body ?? null, init.context);
67
+ this.code = init.code;
68
+ this.phase = init.phase ?? null;
69
+ this.resource = init.resource ?? null;
70
+ this.retryable = init.retryable ?? false;
71
+ this.operationId = init.operationId ?? null;
72
+ this.planId = init.planId ?? null;
73
+ this.fix = init.fix ?? null;
74
+ this.logs = init.logs ?? null;
75
+ this.rolledBack = init.rolledBack ?? false;
76
+ }
77
+ }
55
78
  //# sourceMappingURL=errors.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,OAAgB,WAAY,SAAQ,KAAK;IAC7C,iFAAiF;IACxE,MAAM,CAAgB;IAC/B,+DAA+D;IACtD,IAAI,CAAU;IACvB,2FAA2F;IAClF,OAAO,CAAS;IAEzB,YAAY,OAAe,EAAE,MAAqB,E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UAAU,IAAI,KAAK,CAAC;IAC7C,CAAC;CACF"}
package/dist/index.d.ts CHANGED
@@ -24,6 +24,8 @@ import { Apps } from "./namespaces/apps.js";
24
24
  import { Email } from "./namespaces/email.js";
25
25
  import { Contracts } from "./namespaces/contracts.js";
26
26
  import { Admin } from "./namespaces/admin.js";
27
+ import { Deploy } from "./namespaces/deploy.js";
28
+ import type { ContentSource, FileSet } from "./namespaces/deploy.types.js";
27
29
  export interface Run402Options {
28
30
  /** API base URL, e.g. `https://api.run402.com`. */
29
31
  apiBase: string;
@@ -55,14 +57,35 @@ export declare class Run402 {
55
57
  readonly email: Email;
56
58
  readonly contracts: Contracts;
57
59
  readonly admin: Admin;
60
+ readonly deploy: Deploy;
58
61
  constructor(opts: Run402Options);
59
62
  }
63
+ /**
64
+ * Build a `FileSet` from a path-keyed record of byte sources. A passthrough
65
+ * convenience: the SDK can consume the same shape whether you call this or
66
+ * pass the literal directly. Useful for IDE autocomplete on the
67
+ * `ContentSource` union and for keeping deploy specs declarative.
68
+ *
69
+ * @example
70
+ * await r.deploy.apply({
71
+ * project,
72
+ * site: { replace: files({
73
+ * "index.html": "<h1>hi</h1>",
74
+ * "logo.png": logoBytes,
75
+ * "data.json": new Blob([JSON.stringify(d)], { type: "application/json" }),
76
+ * })},
77
+ * });
78
+ */
79
+ export declare function files(record: Record<string, ContentSource>): FileSet;
60
80
  /**
61
81
  * Factory wrapper equivalent to `new Run402(opts)`. Reads better in code-mode
62
82
  * sandbox examples: `const r = run402({ ... })`.
63
83
  */
64
84
  export declare function run402(opts: Run402Options): Run402;
65
- export { Run402Error, PaymentRequired, ProjectNotFound, Unauthorized, ApiError, NetworkError, LocalError, } from "./errors.js";
85
+ export { Run402Error, PaymentRequired, ProjectNotFound, Unauthorized, ApiError, NetworkError, LocalError, Run402DeployError, } from "./errors.js";
86
+ export type { Run402DeployErrorCode, Run402DeployErrorFix, } from "./errors.js";
66
87
  export type { CredentialsProvider, ProjectKeys } from "./credentials.js";
67
88
  export type { RequestOptions, Client } from "./kernel.js";
89
+ export { Deploy } from "./namespaces/deploy.js";
90
+ export type { ApplyOptions, CommitResponse, CommitStatus, ContentRef, ContentSource, DatabaseSpec, DeployDiff, DeployEvent, DeployOperation, DeployResult, ExposeManifest, FileSet, FsFileSource, FunctionSpec, FunctionsSpec, MigrationSpec, MissingContent, OperationSnapshot, OperationStatus, PaymentRequiredHint, PlanRequest, PlanResponse, ReleaseSpec, RouteSpec, SecretsSpec, SiteSpec, SmokeCheck, StartOptions, SubdomainsSpec, } from "./namespaces/deploy.types.js";
68
91
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACpD,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAClD,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAClD,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAAE,EAAE,EAAE,MAAM,oBAAoB,CAAC;AACxC,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAC7D,OAAO,EAAE,OAAO,EAAE,M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,EAAE,SAAS,CAAC;IAC9B,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;gBAEZ,IAAI,EAAE,aAAa;CA2BhC;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,KAAK,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,GAAG,OAAO,CAEpE;AAED;;;GAGG;AACH,wBAAgB,MAAM,CAAC,IAAI,EAAE,aAAa,GAAG,MAAM,CAElD;AAED,OAAO,EACL,WAAW,EACX,eAAe,EACf,eAAe,EACf,YAAY,EACZ,QAAQ,EACR,YAAY,EACZ,UAAU,EACV,iBAAiB,GAClB,MAAM,aAAa,CAAC;AACrB,YAAY,EACV,qBAAqB,EACrB,oBAAoB,GACrB,MAAM,aAAa,CAAC;AACrB,YAAY,EAAE,mBAAmB,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACzE,YAAY,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAC1D,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAChD,YAAY,EACV,YAAY,EACZ,cAAc,EACd,YAAY,EACZ,UAAU,EACV,aAAa,EACb,YAAY,EACZ,UAAU,EACV,WAAW,EACX,eAAe,EACf,YAAY,EACZ,cAAc,EACd,OAAO,EACP,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,aAAa,EACb,cAAc,EACd,iBAAiB,EACjB,eAAe,EACf,mBAAmB,EACnB,WAAW,EACX,YAAY,EACZ,WAAW,EACX,SAAS,EACT,WAAW,EACX,QAAQ,EACR,UAAU,EACV,YAAY,EACZ,cAAc,GACf,MAAM,8BAA8B,CAAC"}
package/dist/index.js CHANGED
@@ -24,6 +24,7 @@ import { Apps } from "./namespaces/apps.js";
24
24
  import { Email } from "./namespaces/email.js";
25
25
  import { Contracts } from "./namespaces/contracts.js";
26
26
  import { Admin } from "./namespaces/admin.js";
27
+ import { Deploy } from "./namespaces/deploy.js";
27
28
  export class Run402 {
28
29
  projects;
29
30
  blobs;
@@ -43,6 +44,7 @@ export class Run402 {
43
44
  email;
44
45
  contracts;
45
46
  admin;
47
+ deploy;
46
48
  constructor(opts) {
47
49
  const kernel = {
48
50
  apiBase: opts.apiBase,
@@ -68,8 +70,28 @@ export class Run402 {
68
70
  this.email = new Email(client);
69
71
  this.contracts = new Contracts(client);
70
72
  this.admin = new Admin(client);
73
+ this.deploy = new Deploy(client);
71
74
  }
72
75
  }
76
+ /**
77
+ * Build a `FileSet` from a path-keyed record of byte sources. A passthrough
78
+ * convenience: the SDK can consume the same shape whether you call this or
79
+ * pass the literal directly. Useful for IDE autocomplete on the
80
+ * `ContentSource` union and for keeping deploy specs declarative.
81
+ *
82
+ * @example
83
+ * await r.deploy.apply({
84
+ * project,
85
+ * site: { replace: files({
86
+ * "index.html": "<h1>hi</h1>",
87
+ * "logo.png": logoBytes,
88
+ * "data.json": new Blob([JSON.stringify(d)], { type: "application/json" }),
89
+ * })},
90
+ * });
91
+ */
92
+ export function files(record) {
93
+ return record;
94
+ }
73
95
  /**
74
96
  * Factory wrapper equivalent to `new Run402(opts)`. Reads better in code-mode
75
97
  * sandbox examples: `const r = run402({ ... })`.
@@ -77,5 +99,6 @@ export class Run402 {
77
99
  export function run402(opts) {
78
100
  return new Run402(opts);
79
101
  }
80
- export { Run402Error, PaymentRequired, ProjectNotFound, Unauthorized, ApiError, NetworkError, LocalError, } from "./errors.js";
102
+ export { Run402Error, PaymentRequired, ProjectNotFound, Unauthorized, ApiError, NetworkError, LocalError, Run402DeployError, } from "./errors.js";
103
+ export { Deploy } from "./namespaces/deploy.js";
81
104
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,WAAW,EAAkC,MAAM,aAAa,CAAC;AAE1E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mB;IACxC,OAAO,IAAI,MAAM,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC;AAED,OAAO,EACL,WAAW,EACX,eAAe,EACf,eAAe,EACf,YAAY,EACZ,QAAQ,EACR,YAAY,EACZ,UAAU,EACV,iBAAiB,GAClB,MAAM,aAAa,CAAC;AAOrB,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC"}
@@ -135,6 +135,20 @@ export declare class Apps {
135
135
  * secrets, deploys functions, deploys a static site, and claims a
136
136
  * subdomain. Payment flows through x402 when the project lease needs
137
137
  * renewal.
138
+ *
139
+ * **As of v1.34, this method is a thin compatibility shim over
140
+ * {@link Deploy.apply}.** It translates the legacy bundle options into a
141
+ * v2 {@link ReleaseSpec} and delegates to `r.deploy.apply` — bytes ride
142
+ * through CAS, never inline. The method's input shape and return shape
143
+ * remain unchanged for existing callers.
144
+ *
145
+ * Migrations get a deterministic id `bundle_legacy_<sha256(sql)[0:16]>`.
146
+ * Re-shipping identical SQL is a registry noop on the v2 path; this is
147
+ * the only behavior change vs. v1's blind re-execution and is safe for
148
+ * idempotent migrations (the documented agent norm).
149
+ *
150
+ * `inherit: true` is silently ignored with a one-time deprecation warning;
151
+ * patch semantics on `r.deploy.apply` replace it.
138
152
  */
139
153
  bundleDeploy(projectId: string, opts?: BundleDeployOptions): Promise<BundleDeployResult>;
140
154
  /** Browse public forkable apps. Optional `tags` filter is OR-combined. */
@@ -1 +1 @@
1
- {"version":3,"file":"apps.d.ts","sourceRoot":"","sources":["../../src/namespaces/apps.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAE3C,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACrE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,WAAW,CAAC;IACtB,MAAM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Ac,GAAG,OAAO,CAAC,aAAa,CAAC;IAyBxD,mDAAmD;IAC7C,OAAO,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,GAAE,iBAAsB,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAqBzF,gDAAgD;IAC1C,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAalE,yFAAyF;IACnF,aAAa,CACjB,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,oBAAoB,GACzB,OAAO,CAAC,IAAI,CAAC;IAqBhB,kCAAkC;IAC5B,aAAa,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAcxE,+DAA+D;IACzD,MAAM,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC;CAMrD"}
@@ -3,6 +3,7 @@
3
3
  * version publishing.
4
4
  */
5
5
  import { ProjectNotFound } from "../errors.js";
6
+ import { Deploy } from "./deploy.js";
6
7
  export class Apps {
7
8
  client;
8
9
  constructor(client) {
@@ -13,31 +14,31 @@ export class Apps {
13
14
  * secrets, deploys functions, deploys a static site, and claims a
14
15
  * subdomain. Payment flows through x402 when the project lease needs
15
16
  * renewal.
17
+ *
18
+ * **As of v1.34, this method is a thin compatibility shim over
19
+ * {@link Deploy.apply}.** It translates the legacy bundle options into a
20
+ * v2 {@link ReleaseSpec} and delegates to `r.deploy.apply` — bytes ride
21
+ * through CAS, never inline. The method's input shape and return shape
22
+ * remain unchanged for existing callers.
23
+ *
24
+ * Migrations get a deterministic id `bundle_legacy_<sha256(sql)[0:16]>`.
25
+ * Re-shipping identical SQL is a registry noop on the v2 path; this is
26
+ * the only behavior change vs. v1's blind re-execution and is safe for
27
+ * idempotent migrations (the documented agent norm).
28
+ *
29
+ * `inherit: true` is silently ignored with a one-time deprecation warning;
30
+ * patch semantics on `r.deploy.apply` replace it.
16
31
  */
17
32
  async bundleDeploy(projectId, opts = {}) {
18
33
  const project = await this.client.getProject(projectId);
19
34
  if (!project)
20
35
  throw new ProjectNotFound(projectId, "deploying bundle");
21
- const body = { project_id: projectId };
22
- if (opts.migrations !== undefined)
23
- body.migrations = opts.migrations;
24
- if (opts.rls !== undefined)
25
- body.rls = opts.rls;
26
- if (opts.secrets !== undefined)
27
- body.secrets = opts.secrets;
28
- if (opts.functions !== undefined)
29
- body.functions = opts.functions;
30
- if (opts.files !== undefined)
31
- body.files = opts.files;
32
- if (opts.subdomain !== undefined)
33
- body.subdomain = opts.subdomain;
34
36
  if (opts.inherit)
35
- body.inherit = true;
36
- return this.client.request("/deploy/v1", {
37
- method: "POST",
38
- body,
39
- context: "deploying bundle",
40
- });
37
+ warnInheritOnce();
38
+ const spec = await translateBundleToReleaseSpec(projectId, opts);
39
+ const deploy = new Deploy(this.client);
40
+ const result = await deploy.apply(spec);
41
+ return reshapeAsBundleResult(projectId, result);
41
42
  }
42
43
  /** Browse public forkable apps. Optional `tags` filter is OR-combined. */
43
44
  async browse(tags) {
@@ -147,4 +148,146 @@ export class Apps {
147
148
  });
148
149
  }
149
150
  }
151
+ // ─── bundleDeploy compat shim helpers ────────────────────────────────────────
152
+ let inheritWarned = false;
153
+ function warnInheritOnce() {
154
+ if (inheritWarned)
155
+ return;
156
+ inheritWarned = true;
157
+ // eslint-disable-next-line no-console
158
+ console.warn("[run402] bundleDeploy: `inherit: true` is deprecated. The v2 deploy primitive uses explicit replace/patch semantics; pass `r.deploy.apply({ ..., site: { patch: { put: {...} } } })` for partial updates. The flag will be ignored.");
159
+ }
160
+ async function translateBundleToReleaseSpec(projectId, opts) {
161
+ const spec = { project: projectId };
162
+ // database (migrations + expose translation)
163
+ if (opts.migrations !== undefined || opts.rls !== undefined) {
164
+ spec.database = {};
165
+ if (opts.migrations !== undefined && opts.migrations.trim().length > 0) {
166
+ const sqlBytes = new TextEncoder().encode(opts.migrations);
167
+ const fullSha = await sha256Hex(sqlBytes);
168
+ const id = `bundle_legacy_${fullSha.slice(0, 16)}`;
169
+ spec.database.migrations = [
170
+ {
171
+ id,
172
+ checksum: fullSha,
173
+ sql: opts.migrations,
174
+ },
175
+ ];
176
+ }
177
+ if (opts.rls !== undefined) {
178
+ spec.database.expose = translateRlsToExpose(opts.rls);
179
+ }
180
+ }
181
+ // secrets — array → set object
182
+ if (opts.secrets !== undefined && opts.secrets.length > 0) {
183
+ const set = {};
184
+ for (const { key, value } of opts.secrets)
185
+ set[key] = { value };
186
+ spec.secrets = { set };
187
+ }
188
+ // functions — array → replace map
189
+ if (opts.functions !== undefined && opts.functions.length > 0) {
190
+ const replace = {};
191
+ for (const fn of opts.functions) {
192
+ const f = {
193
+ runtime: "node22",
194
+ source: fn.code,
195
+ };
196
+ if (fn.config)
197
+ f.config = mapFunctionConfig(fn.config);
198
+ if (fn.schedule !== undefined)
199
+ f.schedule = fn.schedule ?? null;
200
+ replace[fn.name] = f;
201
+ }
202
+ spec.functions = { replace };
203
+ }
204
+ // files — base64-decoded inline bytes → site.replace FileSet
205
+ if (opts.files !== undefined && opts.files.length > 0) {
206
+ const fileMap = {};
207
+ for (const f of opts.files) {
208
+ fileMap[f.file] = decodeSiteFile(f);
209
+ }
210
+ spec.site = { replace: fileMap };
211
+ }
212
+ // subdomain string → subdomains.set [string]
213
+ if (opts.subdomain !== undefined && opts.subdomain.length > 0) {
214
+ spec.subdomains = { set: [opts.subdomain] };
215
+ }
216
+ return spec;
217
+ }
218
+ function decodeSiteFile(f) {
219
+ if (f.encoding === "base64") {
220
+ const bytes = base64ToBytes(f.data);
221
+ return { data: bytes };
222
+ }
223
+ return f.data;
224
+ }
225
+ function base64ToBytes(b64) {
226
+ if (typeof Buffer !== "undefined") {
227
+ const buf = Buffer.from(b64, "base64");
228
+ return new Uint8Array(buf.buffer, buf.byteOffset, buf.byteLength);
229
+ }
230
+ const bin = atob(b64);
231
+ const out = new Uint8Array(bin.length);
232
+ for (let i = 0; i < bin.length; i++)
233
+ out[i] = bin.charCodeAt(i);
234
+ return out;
235
+ }
236
+ function mapFunctionConfig(cfg) {
237
+ const out = {};
238
+ if (typeof cfg.timeout === "number")
239
+ out.timeoutSeconds = cfg.timeout;
240
+ if (typeof cfg.memory === "number")
241
+ out.memoryMb = cfg.memory;
242
+ return out;
243
+ }
244
+ function translateRlsToExpose(rls) {
245
+ const tables = rls.tables.map((t) => {
246
+ const out = {
247
+ name: t.table,
248
+ expose: true,
249
+ policy: rls.template,
250
+ };
251
+ if (t.owner_column)
252
+ out.owner_column = t.owner_column;
253
+ if (rls.template === "public_read_write_UNRESTRICTED" &&
254
+ rls.i_understand_this_is_unrestricted) {
255
+ out.i_understand_this_is_unrestricted = true;
256
+ }
257
+ return out;
258
+ });
259
+ return {
260
+ version: "1",
261
+ tables: tables,
262
+ views: [],
263
+ rpcs: [],
264
+ };
265
+ }
266
+ function reshapeAsBundleResult(projectId, result) {
267
+ const urls = result.urls ?? {};
268
+ const out = { project_id: projectId };
269
+ if (urls.site)
270
+ out.site_url = urls.site;
271
+ if (urls.deployment_id)
272
+ out.deployment_id = urls.deployment_id;
273
+ if (urls.subdomain)
274
+ out.subdomain_url = urls.subdomain;
275
+ if (urls.functions) {
276
+ try {
277
+ const parsed = JSON.parse(urls.functions);
278
+ if (Array.isArray(parsed))
279
+ out.functions = parsed;
280
+ }
281
+ catch {
282
+ /* not a structured payload — skip */
283
+ }
284
+ }
285
+ return out;
286
+ }
287
+ async function sha256Hex(bytes) {
288
+ const buf = await crypto.subtle.digest("SHA-256", bytes);
289
+ return Array.from(new Uint8Array(buf))
290
+ .map((b) => b.toString(16).padStart(2, "0"))
291
+ .join("");
292
+ }
150
293
  //# sourceMappingURL=apps.js.map