run402 1.54.3 → 1.55.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 (40) hide show
  1. package/README.md +28 -0
  2. package/cli.mjs +7 -0
  3. package/core-dist/allowance-auth.js +42 -22
  4. package/lib/argparse.mjs +41 -0
  5. package/lib/ci.mjs +395 -0
  6. package/lib/deploy-v2.mjs +152 -6
  7. package/lib/functions.mjs +3 -20
  8. package/lib/projects.mjs +5 -3
  9. package/lib/sdk.mjs +2 -2
  10. package/lib/secrets.mjs +2 -0
  11. package/lib/subdomains.mjs +20 -4
  12. package/package.json +1 -1
  13. package/sdk/core-dist/allowance-auth.js +42 -22
  14. package/sdk/dist/ci-credentials.d.ts +22 -0
  15. package/sdk/dist/ci-credentials.d.ts.map +1 -0
  16. package/sdk/dist/ci-credentials.js +103 -0
  17. package/sdk/dist/ci-credentials.js.map +1 -0
  18. package/sdk/dist/index.d.ts +6 -0
  19. package/sdk/dist/index.d.ts.map +1 -1
  20. package/sdk/dist/index.js +5 -0
  21. package/sdk/dist/index.js.map +1 -1
  22. package/sdk/dist/namespaces/ci.d.ts +21 -0
  23. package/sdk/dist/namespaces/ci.d.ts.map +1 -0
  24. package/sdk/dist/namespaces/ci.js +253 -0
  25. package/sdk/dist/namespaces/ci.js.map +1 -0
  26. package/sdk/dist/namespaces/ci.types.d.ts +91 -0
  27. package/sdk/dist/namespaces/ci.types.d.ts.map +1 -0
  28. package/sdk/dist/namespaces/ci.types.js +8 -0
  29. package/sdk/dist/namespaces/ci.types.js.map +1 -0
  30. package/sdk/dist/namespaces/deploy.d.ts.map +1 -1
  31. package/sdk/dist/namespaces/deploy.js +45 -21
  32. package/sdk/dist/namespaces/deploy.js.map +1 -1
  33. package/sdk/dist/node/ci.d.ts +12 -0
  34. package/sdk/dist/node/ci.d.ts.map +1 -0
  35. package/sdk/dist/node/ci.js +30 -0
  36. package/sdk/dist/node/ci.js.map +1 -0
  37. package/sdk/dist/node/index.d.ts +7 -2
  38. package/sdk/dist/node/index.d.ts.map +1 -1
  39. package/sdk/dist/node/index.js +3 -2
  40. package/sdk/dist/node/index.js.map +1 -1
package/lib/deploy-v2.mjs CHANGED
@@ -25,9 +25,10 @@
25
25
 
26
26
  import { readFileSync } from "node:fs";
27
27
  import { resolve, dirname, isAbsolute, join } from "node:path";
28
+ import { githubActionsCredentials } from "#sdk/node";
28
29
  import { getSdk } from "./sdk.mjs";
29
30
  import { reportSdkError, fail } from "./sdk-errors.mjs";
30
- import { allowanceAuthHeaders, resolveProjectId } from "./config.mjs";
31
+ import { API, allowanceAuthHeaders, getActiveProjectId, resolveProjectId } from "./config.mjs";
31
32
 
32
33
  const APPLY_HELP = `run402 deploy apply — Unified deploy primitive (v1.34+)
33
34
 
@@ -166,6 +167,43 @@ async function applyCmd(args) {
166
167
  });
167
168
  }
168
169
 
170
+ // GH-232: Reject empty specs client-side. Without this guard,
171
+ // `run402 deploy apply --spec '{}'` (and `--manifest <empty>`) would silently
172
+ // send an empty ReleaseSpec to /deploy/v2/plans with no signal that nothing
173
+ // was deployed. This mirrors the GH-185 guard already in place for the
174
+ // legacy `run402 deploy --manifest` path.
175
+ //
176
+ // `deploy apply` is v2-only — only meaningful keys are the v2 ReleaseSpec
177
+ // shape (database, site, functions, secrets, subdomains, domains).
178
+ // For object-typed sections the "container is non-empty" check isn't enough
179
+ // — `site:{replace:{}}` has one key but ships nothing. We recurse one level
180
+ // so any object whose own values are all empty containers is still empty.
181
+ const meaningful = ["database", "site", "functions", "secrets", "subdomains", "domains"];
182
+ function hasContent(v) {
183
+ if (v == null) return false;
184
+ if (Array.isArray(v)) return v.length > 0;
185
+ if (typeof v === "object") {
186
+ const keys = Object.keys(v);
187
+ if (keys.length === 0) return false;
188
+ return keys.some((k) => hasContent(v[k]));
189
+ }
190
+ if (typeof v === "string") return v.length > 0;
191
+ return true;
192
+ }
193
+ const hasMeaningfulContent = spec && typeof spec === "object" && !Array.isArray(spec) && meaningful.some((key) => hasContent(spec[key]));
194
+ if (!hasMeaningfulContent) {
195
+ fail({
196
+ code: "MANIFEST_EMPTY",
197
+ message: `Manifest contains no deployable sections. Expected at least one of: ${meaningful.join(", ")}`,
198
+ hint: "Did you mean to write a 'site.replace' or 'database.migrations' block? See https://run402.com/schemas/manifest.v1.json",
199
+ details: {
200
+ field: opts.manifest ? "manifest" : opts.spec ? "spec" : "stdin",
201
+ ...(opts.manifest ? { path: resolve(opts.manifest) } : {}),
202
+ meaningful_keys: meaningful,
203
+ },
204
+ });
205
+ }
206
+
169
207
  if (opts.manifest) resolveFileDataPaths(spec, dirname(resolve(opts.manifest)));
170
208
 
171
209
  if (opts.project && spec.project_id && spec.project_id !== opts.project) {
@@ -176,7 +214,10 @@ async function applyCmd(args) {
176
214
  });
177
215
  }
178
216
  if (opts.project) spec.project_id = opts.project;
179
- if (!spec.project_id) spec.project_id = resolveProjectId(null);
217
+ const useGithubActionsOidc = hasGithubActionsOidcEnv();
218
+ if (!spec.project_id) {
219
+ spec.project_id = useGithubActionsOidc ? resolveCiProjectId() : resolveProjectId(null);
220
+ }
180
221
 
181
222
  // Translate { project_id, ... } envelope → ReleaseSpec ({ project, ... })
182
223
  // The SDK ReleaseSpec uses `project` rather than `project_id`; both shapes
@@ -185,18 +226,123 @@ async function applyCmd(args) {
185
226
  const releaseSpec = mapManifestToReleaseSpec(spec);
186
227
  const idempotencyKey = spec.idempotency_key;
187
228
 
188
- // Preserve the aggressive early exit when no allowance is configured.
189
- allowanceAuthHeaders("/deploy/v2/plans");
229
+ let sdkOpts;
230
+ if (useGithubActionsOidc) {
231
+ sdkOpts = {
232
+ credentials: githubActionsCredentials({ projectId: spec.project_id, apiBase: API }),
233
+ disablePaidFetch: true,
234
+ };
235
+ } else {
236
+ // Preserve the aggressive early exit when no allowance is configured.
237
+ allowanceAuthHeaders("/deploy/v2/plans");
238
+ }
190
239
 
191
240
  try {
192
- const result = await getSdk().deploy.apply(releaseSpec, {
241
+ const result = await getSdk(sdkOpts).deploy.apply(releaseSpec, {
193
242
  onEvent: makeStderrEventWriter(opts.quiet),
194
243
  idempotencyKey,
195
244
  });
196
245
  console.log(JSON.stringify({ status: "ok", ...result }, null, 2));
197
246
  } catch (err) {
198
- reportSdkError(err);
247
+ reportDeployApplyError(err, useGithubActionsOidc);
248
+ }
249
+ }
250
+
251
+ function hasGithubActionsOidcEnv(env = process.env) {
252
+ return env.GITHUB_ACTIONS === "true" &&
253
+ Boolean(env.ACTIONS_ID_TOKEN_REQUEST_URL) &&
254
+ Boolean(env.ACTIONS_ID_TOKEN_REQUEST_TOKEN);
255
+ }
256
+
257
+ function resolveCiProjectId(env = process.env) {
258
+ const projectId = getActiveProjectId() || env.RUN402_PROJECT_ID;
259
+ if (!projectId) {
260
+ fail({
261
+ code: "CI_PROJECT_REQUIRED",
262
+ message: "GitHub Actions OIDC deploy requires a project id.",
263
+ hint: "Pass --project <prj_...> in the workflow command, include project_id in the manifest, or set RUN402_PROJECT_ID.",
264
+ details: { sources: ["--project", "manifest.project_id", "active_project", "RUN402_PROJECT_ID"] },
265
+ });
199
266
  }
267
+ return projectId;
268
+ }
269
+
270
+ const CI_DEPLOY_ERROR_GUIDANCE = {
271
+ invalid_token: {
272
+ hint: "Ensure the workflow has permissions: id-token: write and is running in the repository/branch linked with run402 ci link github.",
273
+ next_actions: [
274
+ "Check the workflow permissions block includes id-token: write.",
275
+ "Re-run run402 ci link github if the repository, branch, or environment changed.",
276
+ ],
277
+ },
278
+ access_denied: {
279
+ hint: "The OIDC token was valid, but no active Run402 CI binding allowed this workflow.",
280
+ next_actions: [
281
+ "Run run402 ci list --project <prj_...> locally to inspect bindings.",
282
+ "Run run402 ci link github again for this repository/branch/environment.",
283
+ ],
284
+ },
285
+ event_not_allowed: {
286
+ hint: "This binding only allows push and workflow_dispatch events in v1.",
287
+ next_actions: [
288
+ "Trigger the workflow with push or workflow_dispatch.",
289
+ "Create a separate follow-up design before enabling PR deploy events.",
290
+ ],
291
+ },
292
+ repository_id_mismatch: {
293
+ hint: "The GitHub repository id in the OIDC token does not match the linked binding.",
294
+ next_actions: [
295
+ "Run run402 ci link github again from the current repository.",
296
+ "If automatic lookup fails, pass --repository-id with the numeric GitHub repository id.",
297
+ ],
298
+ },
299
+ forbidden_spec_field: {
300
+ hint: "CI deploys in v1 can deploy site/functions/database content only; link locally for secrets, routes, subdomains, checks, or oversized manifests.",
301
+ next_actions: [
302
+ "Remove forbidden fields such as secrets, routes, subdomains, or checks from the CI manifest.",
303
+ "Keep the normalized manifest small enough to avoid manifest_ref.",
304
+ ],
305
+ },
306
+ forbidden_plan: {
307
+ hint: "The gateway rejected this deploy plan for CI. Keep CI deploys to the v1 allowed resources and re-link if policy changed.",
308
+ next_actions: [
309
+ "Inspect the gateway error details for the rejected resource.",
310
+ "Run the deploy locally with run402 deploy apply for operations outside the CI allowlist.",
311
+ ],
312
+ },
313
+ payment_required: {
314
+ hint: "The project tier or payment state does not allow this CI deploy.",
315
+ next_actions: [
316
+ "Run run402 tier status --project <prj_...> locally.",
317
+ "Renew or upgrade the project tier, then re-run the workflow.",
318
+ ],
319
+ },
320
+ };
321
+
322
+ function reportDeployApplyError(err, useGithubActionsOidc) {
323
+ if (!useGithubActionsOidc) return reportSdkError(err);
324
+ return reportSdkError(enhanceCiDeployError(err));
325
+ }
326
+
327
+ function enhanceCiDeployError(err) {
328
+ const existingBody = err?.body && typeof err.body === "object" && !Array.isArray(err.body)
329
+ ? err.body
330
+ : {};
331
+ const code = existingBody.code || err?.code || (err?.status === 402 ? "payment_required" : null);
332
+ const guidance = code ? CI_DEPLOY_ERROR_GUIDANCE[code] : null;
333
+ if (!guidance) return err;
334
+
335
+ const enhanced = Object.assign(new Error(err?.message || existingBody.message || String(code)), err);
336
+ enhanced.body = {
337
+ ...existingBody,
338
+ code,
339
+ message: existingBody.message || err?.message || "GitHub Actions OIDC deploy failed.",
340
+ hint: existingBody.hint || guidance.hint,
341
+ next_actions: Array.isArray(existingBody.next_actions) && existingBody.next_actions.length > 0
342
+ ? existingBody.next_actions
343
+ : guidance.next_actions,
344
+ };
345
+ return enhanced;
200
346
  }
201
347
 
202
348
  async function resumeCmd(args) {
package/lib/functions.mjs CHANGED
@@ -1,8 +1,8 @@
1
- import { readFileSync, existsSync, statSync } from "fs";
1
+ import { readFileSync } from "fs";
2
2
  import { findProject, API } from "./config.mjs";
3
3
  import { getSdk } from "./sdk.mjs";
4
4
  import { reportSdkError, fail } from "./sdk-errors.mjs";
5
- import { assertKnownFlags, hasHelp, normalizeArgv, parseIntegerFlag } from "./argparse.mjs";
5
+ import { assertKnownFlags, hasHelp, normalizeArgv, parseIntegerFlag, validateRegularFile } from "./argparse.mjs";
6
6
 
7
7
  const HELP = `run402 functions — Manage serverless functions
8
8
 
@@ -181,24 +181,7 @@ async function deploy(projectId, name, args) {
181
181
  if (!opts.file) {
182
182
  fail({ code: "BAD_USAGE", message: "Missing --file <file>" });
183
183
  }
184
- if (!existsSync(opts.file)) {
185
- fail({
186
- code: "FILE_NOT_FOUND",
187
- message: `File not found: ${opts.file}`,
188
- field: "--file",
189
- path: opts.file,
190
- hint: "Check that --file points to an existing source file.",
191
- });
192
- }
193
- const stat = statSync(opts.file);
194
- if (!stat.isFile()) {
195
- fail({
196
- code: "NOT_A_FILE",
197
- message: `--file points to a ${stat.isDirectory() ? "directory" : "non-regular file"}: ${opts.file}`,
198
- field: "--file",
199
- path: opts.file,
200
- });
201
- }
184
+ validateRegularFile(opts.file, "--file");
202
185
  const code = readFileSync(opts.file, "utf-8");
203
186
 
204
187
  const deployOpts = { name, code };
package/lib/projects.mjs CHANGED
@@ -2,7 +2,7 @@ import { readFileSync } from "fs";
2
2
  import { findProject, loadKeyStore, API, allowanceAuthHeaders, resolveProjectId, getActiveProjectId } from "./config.mjs";
3
3
  import { getSdk } from "./sdk.mjs";
4
4
  import { reportSdkError, fail, parseFlagJson } from "./sdk-errors.mjs";
5
- import { assertKnownFlags, failBadProjectId, hasHelp, normalizeArgv, positionalArgs, resolvePositionalProject } from "./argparse.mjs";
5
+ import { assertKnownFlags, failBadProjectId, hasHelp, normalizeArgv, positionalArgs, resolvePositionalProject, validateRegularFile } from "./argparse.mjs";
6
6
 
7
7
  const HELP = `run402 projects — Manage your deployed Run402 projects
8
8
 
@@ -175,13 +175,14 @@ async function provision(args) {
175
175
  }
176
176
 
177
177
  async function applyExpose(projectId, args = []) {
178
- const p = findProject(projectId);
179
178
  let file = null;
180
179
  let inline = null;
181
180
  for (let i = 0; i < args.length; i++) {
182
181
  if (args[i] === "--file" && args[i + 1]) { file = args[++i]; }
183
182
  else if (!inline && !args[i].startsWith("--")) { inline = args[i]; }
184
183
  }
184
+ if (file) validateRegularFile(file, "--file");
185
+ const p = findProject(projectId);
185
186
  const raw = file ? readFileSync(file, "utf-8") : inline;
186
187
  if (!raw) {
187
188
  fail({
@@ -252,7 +253,6 @@ async function keys(projectId) {
252
253
  }
253
254
 
254
255
  async function sqlCmd(projectId, args = []) {
255
- const p = findProject(projectId);
256
256
  let file = null;
257
257
  let query = null;
258
258
  let paramsRaw = null;
@@ -261,6 +261,8 @@ async function sqlCmd(projectId, args = []) {
261
261
  else if (args[i] === "--params" && args[i + 1]) { paramsRaw = args[++i]; }
262
262
  else if (!query && !args[i].startsWith("--")) { query = args[i]; }
263
263
  }
264
+ if (file) validateRegularFile(file, "--file");
265
+ const p = findProject(projectId);
264
266
  const sql = file ? readFileSync(file, "utf-8") : query;
265
267
  if (!sql) {
266
268
  fail({
package/lib/sdk.mjs CHANGED
@@ -9,6 +9,6 @@
9
9
 
10
10
  import { run402 } from "#sdk/node";
11
11
 
12
- export function getSdk() {
13
- return run402();
12
+ export function getSdk(opts = {}) {
13
+ return run402(opts);
14
14
  }
package/lib/secrets.mjs CHANGED
@@ -1,6 +1,7 @@
1
1
  import { readFileSync } from "fs";
2
2
  import { getSdk } from "./sdk.mjs";
3
3
  import { reportSdkError, fail } from "./sdk-errors.mjs";
4
+ import { validateRegularFile } from "./argparse.mjs";
4
5
 
5
6
  const HELP = `run402 secrets — Manage project secrets
6
7
 
@@ -82,6 +83,7 @@ async function set(projectId, key, args = []) {
82
83
  if (args[i] === "--file" && args[i + 1]) { file = args[++i]; }
83
84
  else if (!value && !args[i].startsWith("--")) { value = args[i]; }
84
85
  }
86
+ if (file) validateRegularFile(file, "--file");
85
87
  const val = file ? readFileSync(file, "utf-8") : value;
86
88
  if (!val) {
87
89
  fail({
@@ -10,7 +10,7 @@ Usage:
10
10
  Subcommands:
11
11
  claim <name> [--project <id>] [--deployment <id>] Claim a subdomain
12
12
  delete <name> --confirm [--project <id>] Release a subdomain. Requires --confirm.
13
- list [<id>] List subdomains for a project
13
+ list [<id>] | list --project <id> List subdomains for a project
14
14
 
15
15
  Options default to the active project and its last deployment when omitted.
16
16
  Legacy syntax 'claim <deployment_id> <name>' is still supported.
@@ -151,8 +151,24 @@ async function deleteSubdomain(allArgs) {
151
151
  }
152
152
  }
153
153
 
154
- async function list(projectIdArg) {
155
- const projectId = resolveProjectId(projectIdArg);
154
+ function parseProjectFlag(args) {
155
+ let project = null;
156
+ const rest = [];
157
+ for (let i = 0; i < args.length; i++) {
158
+ if (args[i] === "--project" && args[i + 1]) { project = args[++i]; }
159
+ else { rest.push(args[i]); }
160
+ }
161
+ return { project, rest };
162
+ }
163
+
164
+ async function list(args) {
165
+ const argList = Array.isArray(args) ? args : [];
166
+ const { project, rest } = parseProjectFlag(argList);
167
+ // Either --project <id> or a positional id is accepted; --project wins
168
+ // when both are supplied. Falls back to the active project when neither
169
+ // is given. Keeps backward-compat with the legacy `subdomains list <id>`
170
+ // form (GH-231; mirrors the GH-209 fix for `domains list`).
171
+ const projectId = resolveProjectId(project || rest[0]);
156
172
  try {
157
173
  const data = await getSdk().subdomains.list(projectId);
158
174
  console.log(JSON.stringify(data, null, 2));
@@ -177,7 +193,7 @@ export async function run(sub, args) {
177
193
  break;
178
194
  }
179
195
  case "delete": await deleteSubdomain(args); break;
180
- case "list": await list(args[0]); break;
196
+ case "list": await list(args); break;
181
197
  default:
182
198
  console.error(`Unknown subcommand: ${sub}\n`);
183
199
  console.log(HELP);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "run402",
3
- "version": "1.54.3",
3
+ "version": "1.55.0",
4
4
  "description": "CLI for Run402 — provision Postgres databases, deploy static sites, generate images, and manage wallets via x402 and MPP micropayments.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -70,16 +70,44 @@ export function formatSIWEMessage(opts, address) {
70
70
  opts.statement,
71
71
  "",
72
72
  `URI: ${opts.uri}`,
73
- `Version: ${opts.version}`,
74
- `Chain ID: ${opts.chainId}`,
73
+ `Version: ${opts.version ?? "1"}`,
74
+ `Chain ID: ${messageChainId(opts.chainId)}`,
75
75
  `Nonce: ${opts.nonce}`,
76
76
  `Issued At: ${opts.issuedAt}`,
77
77
  ];
78
78
  if (opts.expirationTime) {
79
79
  lines.push(`Expiration Time: ${opts.expirationTime}`);
80
80
  }
81
+ if (opts.resources && opts.resources.length > 0) {
82
+ lines.push("Resources:");
83
+ for (const resource of opts.resources)
84
+ lines.push(`- ${resource}`);
85
+ }
81
86
  return lines.join("\n");
82
87
  }
88
+ export function buildSIWxAuthHeaders(opts) {
89
+ const message = formatSIWEMessage(opts, opts.allowance.address);
90
+ const signature = personalSign(opts.allowance.privateKey, opts.allowance.address, message);
91
+ const payload = {
92
+ domain: opts.domain,
93
+ address: toChecksumAddress(opts.allowance.address),
94
+ statement: opts.statement,
95
+ uri: opts.uri,
96
+ version: opts.version ?? "1",
97
+ chainId: payloadChainId(opts.chainId),
98
+ type: opts.type ?? "eip191",
99
+ nonce: opts.nonce,
100
+ issuedAt: opts.issuedAt,
101
+ expirationTime: opts.expirationTime,
102
+ signature,
103
+ };
104
+ if (opts.resources !== undefined) {
105
+ payload.resources = opts.resources;
106
+ }
107
+ return {
108
+ "SIGN-IN-WITH-X": Buffer.from(JSON.stringify(payload)).toString("base64"),
109
+ };
110
+ }
83
111
  /**
84
112
  * Get SIWX auth headers for the Run402 API.
85
113
  * Returns null if no allowance is configured.
@@ -103,32 +131,24 @@ export function getAllowanceAuthHeaders(path, allowancePath) {
103
131
  const now = new Date();
104
132
  const issuedAt = now.toISOString();
105
133
  const expirationTime = new Date(now.getTime() + 5 * 60 * 1000).toISOString();
106
- const message = formatSIWEMessage({
134
+ return buildSIWxAuthHeaders({
135
+ allowance,
107
136
  domain,
108
137
  uri,
109
138
  statement: "Sign in to Run402",
110
- version: "1",
111
- chainId: 84532, // Base Sepolia
112
- nonce,
113
- issuedAt,
114
- expirationTime,
115
- }, allowance.address);
116
- const signature = personalSign(allowance.privateKey, allowance.address, message);
117
- const payload = {
118
- domain,
119
- address: toChecksumAddress(allowance.address),
120
- statement: "Sign in to Run402",
121
- uri,
122
- version: "1",
123
139
  chainId: "eip155:84532",
124
- type: "eip191",
125
140
  nonce,
126
141
  issuedAt,
127
142
  expirationTime,
128
- signature,
129
- };
130
- return {
131
- "SIGN-IN-WITH-X": Buffer.from(JSON.stringify(payload)).toString("base64"),
132
- };
143
+ });
144
+ }
145
+ function messageChainId(chainId) {
146
+ if (typeof chainId === "number")
147
+ return String(chainId);
148
+ const match = /^eip155:(\d+)$/.exec(chainId);
149
+ return match ? match[1] : chainId;
150
+ }
151
+ function payloadChainId(chainId) {
152
+ return typeof chainId === "number" ? `eip155:${chainId}` : chainId;
133
153
  }
134
154
  //# sourceMappingURL=allowance-auth.js.map
@@ -0,0 +1,22 @@
1
+ /** CI-session credential helpers for OIDC-backed deploy flows. */
2
+ import type { CredentialsProvider } from "./credentials.js";
3
+ export declare const CI_SESSION_CREDENTIALS: unique symbol;
4
+ export interface CiMarkedCredentialsProvider extends CredentialsProvider {
5
+ readonly [CI_SESSION_CREDENTIALS]: true;
6
+ }
7
+ export interface CreateCiSessionCredentialsOptions {
8
+ projectId: string;
9
+ accessToken?: string;
10
+ getAccessToken?: () => Promise<string>;
11
+ }
12
+ export interface GithubActionsCredentialsOptions {
13
+ projectId: string;
14
+ apiBase?: string;
15
+ audience?: string;
16
+ refreshBeforeSeconds?: number;
17
+ fetch?: typeof globalThis.fetch;
18
+ }
19
+ export declare function isCiSessionCredentials(credentials: CredentialsProvider): credentials is CiMarkedCredentialsProvider;
20
+ export declare function createCiSessionCredentials(opts: CreateCiSessionCredentialsOptions): CiMarkedCredentialsProvider;
21
+ export declare function githubActionsCredentials(opts: GithubActionsCredentialsOptions): CiMarkedCredentialsProvider;
22
+ //# sourceMappingURL=ci-credentials.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ci-credentials.d.ts","sourceRoot":"","sources":["../src/ci-credentials.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAElE,OAAO,KAAK,EAAE,mBAAmB,EAAe,MAAM,kBAAkB,CAAC;AASzE,eAAO,MAAM,sBAAsB,eAAmD,CAAC;AAEvF,MAAM,WAAW,2BAA4B,SAAQ,mBAAmB;IACtE,QAAQ,CAAC,CAAC,sBAAsB,CAAC,EAAE,IAAI,CAAC;CACzC;AAED,MAAM,WAAW,iCAAiC;IAChD,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,cAAc,CAAC,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,CAAC;CACxC;AAED,MAAM,WAAW,+BAA+B;IAC9C,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,KAAK,CAAC,EAAE,OAAO,UAAU,CAAC,KAAK,CAAC;CACjC;AAED,wBAAgB,sBAAsB,CACpC,WAAW,EAAE,mBAAmB,GAC/B,WAAW,IAAI,2BAA2B,CAE5C;AAED,wBAAgB,0BAA0B,CACxC,IAAI,EAAE,iCAAiC,GACtC,2BAA2B,CAuC7B;AAED,wBAAgB,wBAAwB,CACtC,IAAI,EAAE,+BAA+B,GACpC,2BAA2B,CA4B7B"}
@@ -0,0 +1,103 @@
1
+ /** CI-session credential helpers for OIDC-backed deploy flows. */
2
+ import { LocalError } from "./errors.js";
3
+ import { buildClient } from "./kernel.js";
4
+ import { Ci } from "./namespaces/ci.js";
5
+ import { CI_AUDIENCE, } from "./namespaces/ci.types.js";
6
+ export const CI_SESSION_CREDENTIALS = Symbol.for("@run402/sdk/ci-session-credentials");
7
+ export function isCiSessionCredentials(credentials) {
8
+ return Boolean(credentials[CI_SESSION_CREDENTIALS]);
9
+ }
10
+ export function createCiSessionCredentials(opts) {
11
+ if (!opts?.projectId) {
12
+ throw new LocalError("createCiSessionCredentials requires projectId", "creating CI session credentials");
13
+ }
14
+ if (!opts.accessToken && !opts.getAccessToken) {
15
+ throw new LocalError("createCiSessionCredentials requires accessToken or getAccessToken", "creating CI session credentials");
16
+ }
17
+ const provider = {
18
+ async getAuth() {
19
+ const token = opts.getAccessToken ? await opts.getAccessToken() : opts.accessToken;
20
+ if (!token) {
21
+ throw new LocalError("CI session credentials did not return an access token", "authenticating with CI session");
22
+ }
23
+ return { Authorization: `Bearer ${token}` };
24
+ },
25
+ async getProject(id) {
26
+ if (id !== opts.projectId)
27
+ return null;
28
+ return { anon_key: "", service_key: "" };
29
+ },
30
+ async getActiveProject() {
31
+ return opts.projectId;
32
+ },
33
+ };
34
+ Object.defineProperty(provider, CI_SESSION_CREDENTIALS, {
35
+ value: true,
36
+ enumerable: false,
37
+ });
38
+ return provider;
39
+ }
40
+ export function githubActionsCredentials(opts) {
41
+ if (!opts?.projectId) {
42
+ throw new LocalError("githubActionsCredentials requires projectId", "creating GitHub Actions CI credentials");
43
+ }
44
+ const apiBase = opts.apiBase ?? CI_AUDIENCE;
45
+ const audience = opts.audience ?? CI_AUDIENCE;
46
+ const fetchImpl = opts.fetch ?? globalThis.fetch.bind(globalThis);
47
+ const refreshBeforeMs = Math.max(0, opts.refreshBeforeSeconds ?? 60) * 1000;
48
+ let cached = null;
49
+ return createCiSessionCredentials({
50
+ projectId: opts.projectId,
51
+ getAccessToken: async () => {
52
+ const now = Date.now();
53
+ if (cached && now < cached.refreshAtMs)
54
+ return cached.token;
55
+ const subjectToken = await requestGithubOidcToken(fetchImpl, audience);
56
+ const exchanged = await exchangeWithRun402Ci(fetchImpl, apiBase, opts.projectId, subjectToken);
57
+ cached = {
58
+ token: exchanged.access_token,
59
+ refreshAtMs: now + Math.max(0, exchanged.expires_in * 1000 - refreshBeforeMs),
60
+ };
61
+ return cached.token;
62
+ },
63
+ });
64
+ }
65
+ async function requestGithubOidcToken(fetchImpl, audience) {
66
+ const env = getProcessEnv();
67
+ const requestUrl = env.ACTIONS_ID_TOKEN_REQUEST_URL;
68
+ const requestToken = env.ACTIONS_ID_TOKEN_REQUEST_TOKEN;
69
+ if (!requestUrl || !requestToken) {
70
+ throw new LocalError("GitHub Actions OIDC environment is missing ACTIONS_ID_TOKEN_REQUEST_URL or ACTIONS_ID_TOKEN_REQUEST_TOKEN. Ensure the workflow has permissions: id-token: write.", "requesting GitHub Actions OIDC token");
71
+ }
72
+ const url = new URL(requestUrl);
73
+ url.searchParams.set("audience", audience);
74
+ const res = await fetchImpl(url.toString(), {
75
+ headers: { Authorization: `Bearer ${requestToken}` },
76
+ });
77
+ const body = await res.json().catch(() => null);
78
+ if (!res.ok || typeof body?.value !== "string" || body.value.length === 0) {
79
+ throw new LocalError(`GitHub Actions OIDC token request failed (HTTP ${res.status})`, "requesting GitHub Actions OIDC token");
80
+ }
81
+ return body.value;
82
+ }
83
+ async function exchangeWithRun402Ci(fetchImpl, apiBase, projectId, subjectToken) {
84
+ const noAuth = {
85
+ async getAuth() {
86
+ return null;
87
+ },
88
+ async getProject() {
89
+ return null;
90
+ },
91
+ };
92
+ const ci = new Ci(buildClient({
93
+ apiBase,
94
+ fetch: fetchImpl,
95
+ credentials: noAuth,
96
+ }));
97
+ return ci.exchangeToken({ project_id: projectId, subject_token: subjectToken });
98
+ }
99
+ function getProcessEnv() {
100
+ const proc = globalThis;
101
+ return proc.process?.env ?? {};
102
+ }
103
+ //# sourceMappingURL=ci-credentials.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ci-credentials.js","sourceRoot":"","sources":["../src/ci-credentials.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAGlE,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,EAAE,EAAE,MAAM,oBAAoB,CAAC;AACxC,OAAO,EACL,WAAW,GAEZ,MAAM,0BAA0B,CAAC;AAElC,MAAM,CAAC,MAAM,sBAAsB,GAAG,MAAM,CAAC,GAAG,CAAC,oCAAoC,CAAC,CAAC;AAoBvF,MAAM,UAAU,sBAAsB,CACpC,WAAgC;IAEhC,OAAO,OAAO,CAAE,WAAoD,CAAC,sBAAsB,CAAC,CAAC,CAAC;AAChG,CAAC;AAED,MAAM,UAAU,0BAA0B,CACxC,IAAuC;IAEvC,IAAI,CAAC,IAAI,EAAE,SAAS,EAAE,CAAC;QACrB,MAAM,IAAI,UAAU,CAClB,+CAA+C,EAC/C,iCAAiC,CAClC,CAAC;IACJ,CAAC;IACD,IAAI,CAAC,IAAI,CAAC,WAAW,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,CAAC;QAC9C,MAAM,IAAI,UAAU,CAClB,mEAAmE,EACnE,iCAAiC,CAClC,CAAC;IACJ,CAAC;IAED,MAAM,QAAQ,GAAwB;QACpC,KAAK,CAAC,OAAO;YACX,MAAM,KAAK,GAAG,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,MAAM,IAAI,CAAC,cAAc,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC;YACnF,IAAI,CAAC,KAAK,EAAE,CAAC;gBACX,MAAM,IAAI,UAAU,CAClB,uDAAuD,EACvD,gCAAgC,CACjC,CAAC;YACJ,CAAC;YACD,OAAO,EAAE,aAAa,EAAE,UAAU,KAAK,EAAE,EAAE,CAAC;QAC9C,CAAC;QACD,KAAK,CAA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I,IAAI,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC1E,MAAM,IAAI,UAAU,CAClB,kDAAkD,GAAG,CAAC,MAAM,GAAG,EAC/D,sCAAsC,CACvC,CAAC;IACJ,CAAC;IACD,OAAO,IAAI,CAAC,KAAK,CAAC;AACpB,CAAC;AAED,KAAK,UAAU,oBAAoB,CACjC,SAAkC,EAClC,OAAe,EACf,SAAiB,EACjB,YAAoB;IAEpB,MAAM,MAAM,GAAwB;QAClC,KAAK,CAAC,OAAO;YACX,OAAO,IAAI,CAAC;QACd,CAAC;QACD,KAAK,CAAC,UAAU;YACd,OAAO,IAAI,CAAC;QACd,CAAC;KACF,CAAC;IACF,MAAM,EAAE,GAAG,IAAI,EAAE,CAAC,WAAW,CAAC;QAC5B,OAAO;QACP,KAAK,EAAE,SAAS;QAChB,WAAW,EAAE,MAAM;KACpB,CAAC,CAAC,CAAC;IACJ,OAAO,EAAE,CAAC,aAAa,CAAC,EAAE,UAAU,EAAE,SAAS,EAAE,aAAa,EAAE,YAAY,EAAE,CAAC,CAAC;AAClF,CAAC;AAED,SAAS,aAAa;IACpB,MAAM,IAAI,GAAG,UAEZ,CAAC;IACF,OAAO,IAAI,CAAC,OAAO,EAAE,GAAG,IAAI,EAAE,CAAC;AACjC,CAAC"}
@@ -25,6 +25,7 @@ import { Email } from "./namespaces/email.js";
25
25
  import { Contracts } from "./namespaces/contracts.js";
26
26
  import { Admin } from "./namespaces/admin.js";
27
27
  import { Deploy } from "./namespaces/deploy.js";
28
+ import { Ci } from "./namespaces/ci.js";
28
29
  import type { ContentSource, FileSet } from "./namespaces/deploy.types.js";
29
30
  import { ScopedRun402 } from "./scoped.js";
30
31
  export interface Run402Options {
@@ -61,6 +62,7 @@ export declare class Run402 {
61
62
  readonly contracts: Contracts;
62
63
  readonly admin: Admin;
63
64
  readonly deploy: Deploy;
65
+ readonly ci: Ci;
64
66
  constructor(opts: Run402Options);
65
67
  /**
66
68
  * Return a project-scoped sub-client where every project-id-bearing namespace
@@ -122,7 +124,11 @@ export { withRetry } from "./retry.js";
122
124
  export type { RetryOptions } from "./retry.js";
123
125
  export type { CredentialsProvider, ProjectKeys } from "./credentials.js";
124
126
  export type { RequestOptions, Client } from "./kernel.js";
127
+ export { CI_SESSION_CREDENTIALS, createCiSessionCredentials, githubActionsCredentials, isCiSessionCredentials, } from "./ci-credentials.js";
128
+ export type { CiMarkedCredentialsProvider, CreateCiSessionCredentialsOptions, GithubActionsCredentialsOptions, } from "./ci-credentials.js";
125
129
  export { Deploy } from "./namespaces/deploy.js";
130
+ export { Ci, CI_AUDIENCE, CI_GITHUB_ACTIONS_ISSUER, CI_GITHUB_ACTIONS_PROVIDER, DEFAULT_CI_DELEGATION_CHAIN_ID, V1_CI_ALLOWED_ACTIONS, V1_CI_ALLOWED_EVENTS_DEFAULT, assertCiDeployableSpec, buildCiDelegationResourceUri, buildCiDelegationStatement, normalizeCiDelegationValues, validateCiNonce, validateCiSubjectMatch, } from "./namespaces/ci.js";
126
131
  export { ScopedRun402 } from "./scoped.js";
132
+ export type { CiAllowedAction, CiAllowedEvent, CiBindingErrorCode, CiBindingRow, CiCreateBindingInput, CiDelegationValues, CiDeployErrorCode, CiErrorCode, CiListBindingsInput, CiListBindingsResult, CiProvider, CiTokenExchangeErrorCode, CiTokenExchangeInput, CiTokenExchangeRequestBody, CiTokenExchangeResponse, NormalizedCiDelegationValues, ParsedDelegation, } from "./namespaces/ci.types.js";
127
133
  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";
128
134
  //# sourceMappingURL=index.d.ts.map
@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