@secondlayer/shared 13.7.1 → 13.9.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 (41) hide show
  1. package/dist/src/archive/range-digest.d.ts +5 -0
  2. package/dist/src/archive/semantic-digest-builder.d.ts +5 -0
  3. package/dist/src/coverage/index.d.ts +5 -0
  4. package/dist/src/db/index.d.ts +5 -0
  5. package/dist/src/db/queries/chain-reorgs.d.ts +5 -0
  6. package/dist/src/db/queries/contracts.d.ts +5 -0
  7. package/dist/src/db/queries/instance.d.ts +5 -0
  8. package/dist/src/db/queries/integrity.d.ts +5 -0
  9. package/dist/src/db/queries/subgraph-gaps.d.ts +5 -0
  10. package/dist/src/db/queries/subgraph-operations.d.ts +5 -0
  11. package/dist/src/db/queries/subgraphs.d.ts +5 -0
  12. package/dist/src/db/queries/sync-scope.d.ts +5 -0
  13. package/dist/src/db/queries/webhooks.d.ts +5 -0
  14. package/dist/src/db/schema.d.ts +5 -0
  15. package/dist/src/error-envelope.d.ts +1 -0
  16. package/dist/src/error-envelope.js.map +2 -2
  17. package/dist/src/errors.d.ts +7 -1
  18. package/dist/src/errors.js +12 -1
  19. package/dist/src/errors.js.map +3 -3
  20. package/dist/src/index.d.ts +17 -8
  21. package/dist/src/index.js +86 -35
  22. package/dist/src/index.js.map +6 -5
  23. package/dist/src/insights/index.d.ts +13 -2
  24. package/dist/src/insights/index.js +15 -7
  25. package/dist/src/insights/index.js.map +4 -4
  26. package/dist/src/insights/thresholds.d.ts +6 -1
  27. package/dist/src/insights/thresholds.js +5 -1
  28. package/dist/src/insights/thresholds.js.map +3 -3
  29. package/dist/src/node/local-client.d.ts +5 -0
  30. package/dist/src/schemas/chain-triggers.d.ts +7 -0
  31. package/dist/src/schemas/chain-triggers.js +78 -0
  32. package/dist/src/schemas/chain-triggers.js.map +10 -0
  33. package/dist/src/schemas/index.d.ts +5 -7
  34. package/dist/src/schemas/index.js +75 -35
  35. package/dist/src/schemas/index.js.map +5 -4
  36. package/dist/src/schemas/webhooks.d.ts +6 -8
  37. package/dist/src/schemas/webhooks.js +75 -35
  38. package/dist/src/schemas/webhooks.js.map +5 -4
  39. package/migrations/0174_internal_accounts.ts +21 -0
  40. package/migrations/0175_failed_request_key_id.ts +23 -0
  41. package/package.json +5 -1
@@ -306,6 +306,9 @@ interface AccountsTable {
306
306
  email: string | null;
307
307
  /** True for anonymous self-serve accounts until claimed via magic link. */
308
308
  ghost: Generated<boolean>;
309
+ /** First-party service account: usage priced at $0, never gated on
310
+ * credits. Set by ops only. */
311
+ internal: Generated<boolean>;
309
312
  /** Stacks principal owning a wallet-ghost account. */
310
313
  wallet_principal: string | null;
311
314
  display_name: string | null;
@@ -1196,6 +1199,8 @@ interface ApiFailedRequestsTable {
1196
1199
  message: Generated<string>;
1197
1200
  query: Record<string, unknown>;
1198
1201
  origin: string | null;
1202
+ /** Revoked account key the request presented (`KEY_REVOKED` only). */
1203
+ api_key_id: string | null;
1199
1204
  created_at: Generated<Date>;
1200
1205
  }
1201
1206
  /**
@@ -306,6 +306,9 @@ interface AccountsTable {
306
306
  email: string | null;
307
307
  /** True for anonymous self-serve accounts until claimed via magic link. */
308
308
  ghost: Generated<boolean>;
309
+ /** First-party service account: usage priced at $0, never gated on
310
+ * credits. Set by ops only. */
311
+ internal: Generated<boolean>;
309
312
  /** Stacks principal owning a wallet-ghost account. */
310
313
  wallet_principal: string | null;
311
314
  display_name: string | null;
@@ -1196,6 +1199,8 @@ interface ApiFailedRequestsTable {
1196
1199
  message: Generated<string>;
1197
1200
  query: Record<string, unknown>;
1198
1201
  origin: string | null;
1202
+ /** Revoked account key the request presented (`KEY_REVOKED` only). */
1203
+ api_key_id: string | null;
1199
1204
  created_at: Generated<Date>;
1200
1205
  }
1201
1206
  /**
@@ -623,6 +623,9 @@ interface AccountsTable {
623
623
  email: string | null;
624
624
  /** True for anonymous self-serve accounts until claimed via magic link. */
625
625
  ghost: Generated<boolean>;
626
+ /** First-party service account: usage priced at $0, never gated on
627
+ * credits. Set by ops only. */
628
+ internal: Generated<boolean>;
626
629
  /** Stacks principal owning a wallet-ghost account. */
627
630
  wallet_principal: string | null;
628
631
  display_name: string | null;
@@ -1513,6 +1516,8 @@ interface ApiFailedRequestsTable {
1513
1516
  message: Generated<string>;
1514
1517
  query: Record<string, unknown>;
1515
1518
  origin: string | null;
1519
+ /** Revoked account key the request presented (`KEY_REVOKED` only). */
1520
+ api_key_id: string | null;
1516
1521
  created_at: Generated<Date>;
1517
1522
  }
1518
1523
  /**
@@ -307,6 +307,9 @@ interface AccountsTable {
307
307
  email: string | null;
308
308
  /** True for anonymous self-serve accounts until claimed via magic link. */
309
309
  ghost: Generated<boolean>;
310
+ /** First-party service account: usage priced at $0, never gated on
311
+ * credits. Set by ops only. */
312
+ internal: Generated<boolean>;
310
313
  /** Stacks principal owning a wallet-ghost account. */
311
314
  wallet_principal: string | null;
312
315
  display_name: string | null;
@@ -1265,6 +1268,8 @@ interface ApiFailedRequestsTable {
1265
1268
  message: Generated<string>;
1266
1269
  query: Record<string, unknown>;
1267
1270
  origin: string | null;
1271
+ /** Revoked account key the request presented (`KEY_REVOKED` only). */
1272
+ api_key_id: string | null;
1268
1273
  created_at: Generated<Date>;
1269
1274
  }
1270
1275
  type ApiFailedRequest = Selectable<ApiFailedRequestsTable>;
@@ -306,6 +306,9 @@ interface AccountsTable {
306
306
  email: string | null;
307
307
  /** True for anonymous self-serve accounts until claimed via magic link. */
308
308
  ghost: Generated<boolean>;
309
+ /** First-party service account: usage priced at $0, never gated on
310
+ * credits. Set by ops only. */
311
+ internal: Generated<boolean>;
309
312
  /** Stacks principal owning a wallet-ghost account. */
310
313
  wallet_principal: string | null;
311
314
  display_name: string | null;
@@ -1196,6 +1199,8 @@ interface ApiFailedRequestsTable {
1196
1199
  message: Generated<string>;
1197
1200
  query: Record<string, unknown>;
1198
1201
  origin: string | null;
1202
+ /** Revoked account key the request presented (`KEY_REVOKED` only). */
1203
+ api_key_id: string | null;
1199
1204
  created_at: Generated<Date>;
1200
1205
  }
1201
1206
  /**
@@ -306,6 +306,9 @@ interface AccountsTable {
306
306
  email: string | null;
307
307
  /** True for anonymous self-serve accounts until claimed via magic link. */
308
308
  ghost: Generated<boolean>;
309
+ /** First-party service account: usage priced at $0, never gated on
310
+ * credits. Set by ops only. */
311
+ internal: Generated<boolean>;
309
312
  /** Stacks principal owning a wallet-ghost account. */
310
313
  wallet_principal: string | null;
311
314
  display_name: string | null;
@@ -1197,6 +1200,8 @@ interface ApiFailedRequestsTable {
1197
1200
  message: Generated<string>;
1198
1201
  query: Record<string, unknown>;
1199
1202
  origin: string | null;
1203
+ /** Revoked account key the request presented (`KEY_REVOKED` only). */
1204
+ api_key_id: string | null;
1200
1205
  created_at: Generated<Date>;
1201
1206
  }
1202
1207
  /**
@@ -306,6 +306,9 @@ interface AccountsTable {
306
306
  email: string | null;
307
307
  /** True for anonymous self-serve accounts until claimed via magic link. */
308
308
  ghost: Generated<boolean>;
309
+ /** First-party service account: usage priced at $0, never gated on
310
+ * credits. Set by ops only. */
311
+ internal: Generated<boolean>;
309
312
  /** Stacks principal owning a wallet-ghost account. */
310
313
  wallet_principal: string | null;
311
314
  display_name: string | null;
@@ -1196,6 +1199,8 @@ interface ApiFailedRequestsTable {
1196
1199
  message: Generated<string>;
1197
1200
  query: Record<string, unknown>;
1198
1201
  origin: string | null;
1202
+ /** Revoked account key the request presented (`KEY_REVOKED` only). */
1203
+ api_key_id: string | null;
1199
1204
  created_at: Generated<Date>;
1200
1205
  }
1201
1206
  /**
@@ -306,6 +306,9 @@ interface AccountsTable {
306
306
  email: string | null;
307
307
  /** True for anonymous self-serve accounts until claimed via magic link. */
308
308
  ghost: Generated<boolean>;
309
+ /** First-party service account: usage priced at $0, never gated on
310
+ * credits. Set by ops only. */
311
+ internal: Generated<boolean>;
309
312
  /** Stacks principal owning a wallet-ghost account. */
310
313
  wallet_principal: string | null;
311
314
  display_name: string | null;
@@ -1196,6 +1199,8 @@ interface ApiFailedRequestsTable {
1196
1199
  message: Generated<string>;
1197
1200
  query: Record<string, unknown>;
1198
1201
  origin: string | null;
1202
+ /** Revoked account key the request presented (`KEY_REVOKED` only). */
1203
+ api_key_id: string | null;
1199
1204
  created_at: Generated<Date>;
1200
1205
  }
1201
1206
  /**
@@ -306,6 +306,9 @@ interface AccountsTable {
306
306
  email: string | null;
307
307
  /** True for anonymous self-serve accounts until claimed via magic link. */
308
308
  ghost: Generated<boolean>;
309
+ /** First-party service account: usage priced at $0, never gated on
310
+ * credits. Set by ops only. */
311
+ internal: Generated<boolean>;
309
312
  /** Stacks principal owning a wallet-ghost account. */
310
313
  wallet_principal: string | null;
311
314
  display_name: string | null;
@@ -1196,6 +1199,8 @@ interface ApiFailedRequestsTable {
1196
1199
  message: Generated<string>;
1197
1200
  query: Record<string, unknown>;
1198
1201
  origin: string | null;
1202
+ /** Revoked account key the request presented (`KEY_REVOKED` only). */
1203
+ api_key_id: string | null;
1199
1204
  created_at: Generated<Date>;
1200
1205
  }
1201
1206
  /**
@@ -306,6 +306,9 @@ interface AccountsTable {
306
306
  email: string | null;
307
307
  /** True for anonymous self-serve accounts until claimed via magic link. */
308
308
  ghost: Generated<boolean>;
309
+ /** First-party service account: usage priced at $0, never gated on
310
+ * credits. Set by ops only. */
311
+ internal: Generated<boolean>;
309
312
  /** Stacks principal owning a wallet-ghost account. */
310
313
  wallet_principal: string | null;
311
314
  display_name: string | null;
@@ -1197,6 +1200,8 @@ interface ApiFailedRequestsTable {
1197
1200
  message: Generated<string>;
1198
1201
  query: Record<string, unknown>;
1199
1202
  origin: string | null;
1203
+ /** Revoked account key the request presented (`KEY_REVOKED` only). */
1204
+ api_key_id: string | null;
1200
1205
  created_at: Generated<Date>;
1201
1206
  }
1202
1207
  /**
@@ -306,6 +306,9 @@ interface AccountsTable {
306
306
  email: string | null;
307
307
  /** True for anonymous self-serve accounts until claimed via magic link. */
308
308
  ghost: Generated<boolean>;
309
+ /** First-party service account: usage priced at $0, never gated on
310
+ * credits. Set by ops only. */
311
+ internal: Generated<boolean>;
309
312
  /** Stacks principal owning a wallet-ghost account. */
310
313
  wallet_principal: string | null;
311
314
  display_name: string | null;
@@ -1197,6 +1200,8 @@ interface ApiFailedRequestsTable {
1197
1200
  message: Generated<string>;
1198
1201
  query: Record<string, unknown>;
1199
1202
  origin: string | null;
1203
+ /** Revoked account key the request presented (`KEY_REVOKED` only). */
1204
+ api_key_id: string | null;
1200
1205
  created_at: Generated<Date>;
1201
1206
  }
1202
1207
  /**
@@ -316,6 +316,9 @@ interface AccountsTable {
316
316
  email: string | null;
317
317
  /** True for anonymous self-serve accounts until claimed via magic link. */
318
318
  ghost: Generated<boolean>;
319
+ /** First-party service account: usage priced at $0, never gated on
320
+ * credits. Set by ops only. */
321
+ internal: Generated<boolean>;
319
322
  /** Stacks principal owning a wallet-ghost account. */
320
323
  wallet_principal: string | null;
321
324
  display_name: string | null;
@@ -1206,6 +1209,8 @@ interface ApiFailedRequestsTable {
1206
1209
  message: Generated<string>;
1207
1210
  query: Record<string, unknown>;
1208
1211
  origin: string | null;
1212
+ /** Revoked account key the request presented (`KEY_REVOKED` only). */
1213
+ api_key_id: string | null;
1209
1214
  created_at: Generated<Date>;
1210
1215
  }
1211
1216
  /**
@@ -306,6 +306,9 @@ interface AccountsTable {
306
306
  email: string | null;
307
307
  /** True for anonymous self-serve accounts until claimed via magic link. */
308
308
  ghost: Generated<boolean>;
309
+ /** First-party service account: usage priced at $0, never gated on
310
+ * credits. Set by ops only. */
311
+ internal: Generated<boolean>;
309
312
  /** Stacks principal owning a wallet-ghost account. */
310
313
  wallet_principal: string | null;
311
314
  display_name: string | null;
@@ -1197,6 +1200,8 @@ interface ApiFailedRequestsTable {
1197
1200
  message: Generated<string>;
1198
1201
  query: Record<string, unknown>;
1199
1202
  origin: string | null;
1203
+ /** Revoked account key the request presented (`KEY_REVOKED` only). */
1204
+ api_key_id: string | null;
1200
1205
  created_at: Generated<Date>;
1201
1206
  }
1202
1207
  /**
@@ -305,6 +305,9 @@ interface AccountsTable {
305
305
  email: string | null;
306
306
  /** True for anonymous self-serve accounts until claimed via magic link. */
307
307
  ghost: Generated<boolean>;
308
+ /** First-party service account: usage priced at $0, never gated on
309
+ * credits. Set by ops only. */
310
+ internal: Generated<boolean>;
308
311
  /** Stacks principal owning a wallet-ghost account. */
309
312
  wallet_principal: string | null;
310
313
  display_name: string | null;
@@ -1263,6 +1266,8 @@ interface ApiFailedRequestsTable {
1263
1266
  message: Generated<string>;
1264
1267
  query: Record<string, unknown>;
1265
1268
  origin: string | null;
1269
+ /** Revoked account key the request presented (`KEY_REVOKED` only). */
1270
+ api_key_id: string | null;
1266
1271
  created_at: Generated<Date>;
1267
1272
  }
1268
1273
  type ApiFailedRequest = Selectable<ApiFailedRequestsTable>;
@@ -21,6 +21,7 @@ type FailedRequestRecord = {
21
21
  message: string
22
22
  query: Record<string, unknown>
23
23
  origin: string | null
24
+ api_key_id?: string | null
24
25
  };
25
26
  /** Incoming `X-Request-Id` values matching this are reused. */
26
27
  declare const REQUEST_ID_PATTERN: RegExp;
@@ -2,9 +2,9 @@
2
2
  "version": 3,
3
3
  "sources": ["../src/error-envelope.ts"],
4
4
  "sourcesContent": [
5
- "/**\n * Pure, dependency-free pieces of the API error envelope: request ids,\n * default codes by status, feedback pointers and query redaction. Shared by\n * the API middleware and the workload gateway so both emit the same shape.\n */\n\n/** Default `code` for an error body that set none, keyed by HTTP status. */\nexport const DEFAULT_CODE_BY_STATUS: Record<number, string> = {\n\t400: \"VALIDATION_ERROR\",\n\t401: \"AUTHENTICATION_ERROR\",\n\t402: \"PAYMENT_REQUIRED\",\n\t403: \"FORBIDDEN\",\n\t404: \"NOT_FOUND\",\n\t409: \"CONFLICT\",\n\t410: \"GONE\",\n\t415: \"UNSUPPORTED_MEDIA_TYPE\",\n\t422: \"VALIDATION_ERROR\",\n\t429: \"RATE_LIMIT_ERROR\",\n\t500: \"INTERNAL_ERROR\",\n\t502: \"UPSTREAM_ERROR\",\n\t503: \"SERVICE_UNAVAILABLE\",\n};\n\n/** Where to report a gap: a path on hosted, the issue tracker on self-host. */\nexport const FEEDBACK_URL = {\n\tplatform: \"/v1/feedback\",\n\toss: \"https://github.com/ryanwaits/secondlayer/issues/new\",\n} as const;\n\n/** One hosted failed-request record (account-scoped, kept 24h). */\nexport type FailedRequestRecord = {\n\trequest_id: string;\n\taccount_id: string;\n\tmethod: string;\n\tpath: string;\n\tstatus: number;\n\tcode: string;\n\tmessage: string;\n\tquery: Record<string, unknown>;\n\torigin: string | null;\n};\n\n/** Incoming `X-Request-Id` values matching this are reused. */\nexport const REQUEST_ID_PATTERN: RegExp = /^[A-Za-z0-9._-]{8,64}$/;\n\n/** `req_` plus 24 lowercase hex chars. */\nexport function newRequestId(): string {\n\tconst bytes = crypto.getRandomValues(new Uint8Array(12));\n\tlet hex = \"\";\n\tfor (const b of bytes) hex += b.toString(16).padStart(2, \"0\");\n\treturn `req_${hex}`;\n}\n\nconst SENSITIVE_KEY = /token|key|secret|signature|password|auth/i;\nconst MAX_VALUE_CHARS = 200;\nconst MAX_QUERY_JSON_CHARS = 2048;\n\n/**\n * Query params safe to store: sensitive keys dropped, values capped at 200\n * chars, and a `{ _truncated, keys }` stub when the result is over 2048 chars.\n */\nexport function redactQuery(params: URLSearchParams): Record<string, unknown> {\n\tconst out: Record<string, unknown> = {};\n\tfor (const [key, value] of params) {\n\t\tif (SENSITIVE_KEY.test(key)) continue;\n\t\tout[key] = value.slice(0, MAX_VALUE_CHARS);\n\t}\n\tif (JSON.stringify(out).length > MAX_QUERY_JSON_CHARS) {\n\t\treturn { _truncated: true, keys: Object.keys(out) };\n\t}\n\treturn out;\n}\n\n/**\n * Additive error body: `request_id` always set, `code` only when absent or\n * not a string, `feedback` only when absent (or always with\n * `overrideFeedback`). Returns null when `body` is not an object carrying an\n * `error` key, so callers leave such responses alone.\n */\nexport function augmentErrorBody(\n\tbody: unknown,\n\topts: {\n\t\tstatus: number;\n\t\trequestId: string;\n\t\tfeedbackUrl: string;\n\t\toverrideFeedback?: boolean;\n\t},\n): Record<string, unknown> | null {\n\tif (typeof body !== \"object\" || body === null || Array.isArray(body)) {\n\t\treturn null;\n\t}\n\tif (!(\"error\" in body)) return null;\n\tconst src = body as Record<string, unknown>;\n\tconst next: Record<string, unknown> = { ...src, request_id: opts.requestId };\n\tif (typeof src.code !== \"string\") {\n\t\tnext.code = DEFAULT_CODE_BY_STATUS[opts.status] ?? \"HTTP_ERROR\";\n\t}\n\tif (opts.overrideFeedback || src.feedback === undefined) {\n\t\tnext.feedback = { url: opts.feedbackUrl };\n\t}\n\treturn next;\n}\n\nconst KNOWN_ORIGINS = [\"cli\", \"mcp\", \"session\"];\n\n/** `x-sl-origin` header reduced to a known value, else null. */\nexport function normalizeOrigin(header: string | undefined): string | null {\n\tconst v = header?.toLowerCase();\n\treturn v !== undefined && KNOWN_ORIGINS.includes(v) ? v : null;\n}\n"
5
+ "/**\n * Pure, dependency-free pieces of the API error envelope: request ids,\n * default codes by status, feedback pointers and query redaction. Shared by\n * the API middleware and the workload gateway so both emit the same shape.\n */\n\n/** Default `code` for an error body that set none, keyed by HTTP status. */\nexport const DEFAULT_CODE_BY_STATUS: Record<number, string> = {\n\t400: \"VALIDATION_ERROR\",\n\t401: \"AUTHENTICATION_ERROR\",\n\t402: \"PAYMENT_REQUIRED\",\n\t403: \"FORBIDDEN\",\n\t404: \"NOT_FOUND\",\n\t409: \"CONFLICT\",\n\t410: \"GONE\",\n\t415: \"UNSUPPORTED_MEDIA_TYPE\",\n\t422: \"VALIDATION_ERROR\",\n\t429: \"RATE_LIMIT_ERROR\",\n\t500: \"INTERNAL_ERROR\",\n\t502: \"UPSTREAM_ERROR\",\n\t503: \"SERVICE_UNAVAILABLE\",\n};\n\n/** Where to report a gap: a path on hosted, the issue tracker on self-host. */\nexport const FEEDBACK_URL = {\n\tplatform: \"/v1/feedback\",\n\toss: \"https://github.com/ryanwaits/secondlayer/issues/new\",\n} as const;\n\n/** One hosted failed-request record (account-scoped, kept 24h). */\nexport type FailedRequestRecord = {\n\trequest_id: string;\n\taccount_id: string;\n\tmethod: string;\n\tpath: string;\n\tstatus: number;\n\tcode: string;\n\tmessage: string;\n\tquery: Record<string, unknown>;\n\torigin: string | null;\n\tapi_key_id?: string | null;\n};\n\n/** Incoming `X-Request-Id` values matching this are reused. */\nexport const REQUEST_ID_PATTERN: RegExp = /^[A-Za-z0-9._-]{8,64}$/;\n\n/** `req_` plus 24 lowercase hex chars. */\nexport function newRequestId(): string {\n\tconst bytes = crypto.getRandomValues(new Uint8Array(12));\n\tlet hex = \"\";\n\tfor (const b of bytes) hex += b.toString(16).padStart(2, \"0\");\n\treturn `req_${hex}`;\n}\n\nconst SENSITIVE_KEY = /token|key|secret|signature|password|auth/i;\nconst MAX_VALUE_CHARS = 200;\nconst MAX_QUERY_JSON_CHARS = 2048;\n\n/**\n * Query params safe to store: sensitive keys dropped, values capped at 200\n * chars, and a `{ _truncated, keys }` stub when the result is over 2048 chars.\n */\nexport function redactQuery(params: URLSearchParams): Record<string, unknown> {\n\tconst out: Record<string, unknown> = {};\n\tfor (const [key, value] of params) {\n\t\tif (SENSITIVE_KEY.test(key)) continue;\n\t\tout[key] = value.slice(0, MAX_VALUE_CHARS);\n\t}\n\tif (JSON.stringify(out).length > MAX_QUERY_JSON_CHARS) {\n\t\treturn { _truncated: true, keys: Object.keys(out) };\n\t}\n\treturn out;\n}\n\n/**\n * Additive error body: `request_id` always set, `code` only when absent or\n * not a string, `feedback` only when absent (or always with\n * `overrideFeedback`). Returns null when `body` is not an object carrying an\n * `error` key, so callers leave such responses alone.\n */\nexport function augmentErrorBody(\n\tbody: unknown,\n\topts: {\n\t\tstatus: number;\n\t\trequestId: string;\n\t\tfeedbackUrl: string;\n\t\toverrideFeedback?: boolean;\n\t},\n): Record<string, unknown> | null {\n\tif (typeof body !== \"object\" || body === null || Array.isArray(body)) {\n\t\treturn null;\n\t}\n\tif (!(\"error\" in body)) return null;\n\tconst src = body as Record<string, unknown>;\n\tconst next: Record<string, unknown> = { ...src, request_id: opts.requestId };\n\tif (typeof src.code !== \"string\") {\n\t\tnext.code = DEFAULT_CODE_BY_STATUS[opts.status] ?? \"HTTP_ERROR\";\n\t}\n\tif (opts.overrideFeedback || src.feedback === undefined) {\n\t\tnext.feedback = { url: opts.feedbackUrl };\n\t}\n\treturn next;\n}\n\nconst KNOWN_ORIGINS = [\"cli\", \"mcp\", \"session\"];\n\n/** `x-sl-origin` header reduced to a known value, else null. */\nexport function normalizeOrigin(header: string | undefined): string | null {\n\tconst v = header?.toLowerCase();\n\treturn v !== undefined && KNOWN_ORIGINS.includes(v) ? v : null;\n}\n"
6
6
  ],
7
- "mappings": ";AAOO,IAAM,yBAAiD;AAAA,EAC7D,KAAK;AAAA,EACL,KAAK;AAAA,EACL,KAAK;AAAA,EACL,KAAK;AAAA,EACL,KAAK;AAAA,EACL,KAAK;AAAA,EACL,KAAK;AAAA,EACL,KAAK;AAAA,EACL,KAAK;AAAA,EACL,KAAK;AAAA,EACL,KAAK;AAAA,EACL,KAAK;AAAA,EACL,KAAK;AACN;AAGO,IAAM,eAAe;AAAA,EAC3B,UAAU;AAAA,EACV,KAAK;AACN;AAgBO,IAAM,qBAA6B;AAGnC,SAAS,YAAY,GAAW;AAAA,EACtC,MAAM,QAAQ,OAAO,gBAAgB,IAAI,WAAW,EAAE,CAAC;AAAA,EACvD,IAAI,MAAM;AAAA,EACV,WAAW,KAAK;AAAA,IAAO,OAAO,EAAE,SAAS,EAAE,EAAE,SAAS,GAAG,GAAG;AAAA,EAC5D,OAAO,OAAO;AAAA;AAGf,IAAM,gBAAgB;AACtB,IAAM,kBAAkB;AACxB,IAAM,uBAAuB;AAMtB,SAAS,WAAW,CAAC,QAAkD;AAAA,EAC7E,MAAM,MAA+B,CAAC;AAAA,EACtC,YAAY,KAAK,UAAU,QAAQ;AAAA,IAClC,IAAI,cAAc,KAAK,GAAG;AAAA,MAAG;AAAA,IAC7B,IAAI,OAAO,MAAM,MAA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AM,IAAI,QAAQ,YAAY;AAAA,EAC9B,OAAO,MAAM,aAAa,cAAc,SAAS,CAAC,IAAI,IAAI;AAAA;",
8
8
  "debugId": "5A36C709A44A1A2864756E2164756E21",
9
9
  "names": []
10
10
  }
@@ -9,6 +9,7 @@ declare const ErrorCodes: {
9
9
  readonly VERSION_CONFLICT: "VERSION_CONFLICT"
10
10
  readonly NOT_FOUND: "NOT_FOUND"
11
11
  readonly KEY_ROTATED: "KEY_ROTATED"
12
+ readonly KEY_REVOKED: "KEY_REVOKED"
12
13
  readonly TENANT_SUSPENDED: "TENANT_SUSPENDED"
13
14
  readonly NO_TENANT_FOR_PROJECT: "NO_TENANT_FOR_PROJECT"
14
15
  readonly INSTANCE_EXISTS: "INSTANCE_EXISTS"
@@ -48,6 +49,11 @@ declare class AuthenticationError extends SecondLayerError {
48
49
  declare class AuthorizationError extends SecondLayerError {
49
50
  constructor(message: string, details?: Record<string, unknown>);
50
51
  }
52
+ /** A real account key that was revoked. Distinct from an unknown key so the
53
+ * caller (and the account's error log) can tell which one it is. */
54
+ declare class ApiKeyRevokedError extends SecondLayerError {
55
+ constructor();
56
+ }
51
57
  declare class RateLimitError extends SecondLayerError {
52
58
  constructor(message: string);
53
59
  }
@@ -77,4 +83,4 @@ declare class TenantSuspendedError extends SecondLayerError {
77
83
  * (avoids cross-bundle instanceof failures from bunup class duplication). */
78
84
  declare const CODE_TO_STATUS: Record<string, 400 | 401 | 402 | 403 | 404 | 409 | 415 | 422 | 423 | 429 | 503>;
79
85
  declare function getErrorMessage(err: unknown): string;
80
- export { AuthenticationError, AuthorizationError, CODE_TO_STATUS, DatabaseError, ErrorCode, ErrorCodes, ForbiddenError, KeyRotatedError, NotFoundError, PaymentRequiredError, RateLimitError, SecondLayerError, TenantSuspendedError, ValidationError, VersionConflictError, getErrorMessage };
86
+ export { ApiKeyRevokedError, AuthenticationError, AuthorizationError, CODE_TO_STATUS, DatabaseError, ErrorCode, ErrorCodes, ForbiddenError, KeyRotatedError, NotFoundError, PaymentRequiredError, RateLimitError, SecondLayerError, TenantSuspendedError, ValidationError, VersionConflictError, getErrorMessage };
@@ -10,6 +10,7 @@ var ErrorCodes = {
10
10
  VERSION_CONFLICT: "VERSION_CONFLICT",
11
11
  NOT_FOUND: "NOT_FOUND",
12
12
  KEY_ROTATED: "KEY_ROTATED",
13
+ KEY_REVOKED: "KEY_REVOKED",
13
14
  TENANT_SUSPENDED: "TENANT_SUSPENDED",
14
15
  NO_TENANT_FOR_PROJECT: "NO_TENANT_FOR_PROJECT",
15
16
  INSTANCE_EXISTS: "INSTANCE_EXISTS"
@@ -69,6 +70,14 @@ class AuthorizationError extends SecondLayerError {
69
70
  }
70
71
  }
71
72
 
73
+ class ApiKeyRevokedError extends SecondLayerError {
74
+ constructor() {
75
+ super("KEY_REVOKED", "API key has been revoked", undefined, {
76
+ hint: "Make a new key at https://secondlayer.tools/account/keys and replace the revoked one wherever it is configured."
77
+ });
78
+ }
79
+ }
80
+
72
81
  class RateLimitError extends SecondLayerError {
73
82
  constructor(message) {
74
83
  super("RATE_LIMIT_ERROR", message);
@@ -118,6 +127,7 @@ var CODE_TO_STATUS = {
118
127
  NOT_FOUND: 404,
119
128
  VALIDATION_ERROR: 400,
120
129
  KEY_ROTATED: 401,
130
+ KEY_REVOKED: 401,
121
131
  TENANT_SUSPENDED: 423,
122
132
  NO_TENANT_FOR_PROJECT: 404,
123
133
  INSTANCE_EXISTS: 409,
@@ -129,6 +139,7 @@ function getErrorMessage(err) {
129
139
  return err instanceof Error ? err.message : String(err);
130
140
  }
131
141
  export {
142
+ ApiKeyRevokedError,
132
143
  AuthenticationError,
133
144
  AuthorizationError,
134
145
  CODE_TO_STATUS,
@@ -146,5 +157,5 @@ export {
146
157
  getErrorMessage
147
158
  };
148
159
 
149
- //# debugId=342CE76CCD6FF26D64756E2164756E21
160
+ //# debugId=7D27C3B75AB151ED64756E2164756E21
150
161
  //# sourceMappingURL=errors.js.map
@@ -2,9 +2,9 @@
2
2
  "version": 3,
3
3
  "sources": ["../src/errors.ts"],
4
4
  "sourcesContent": [
5
- "export const ErrorCodes = {\n\tVALIDATION_ERROR: \"VALIDATION_ERROR\",\n\tDATABASE_ERROR: \"DATABASE_ERROR\",\n\tAUTHENTICATION_ERROR: \"AUTHENTICATION_ERROR\",\n\tAUTHORIZATION_ERROR: \"AUTHORIZATION_ERROR\",\n\tRATE_LIMIT_ERROR: \"RATE_LIMIT_ERROR\",\n\tPAYMENT_REQUIRED: \"PAYMENT_REQUIRED\",\n\tFORBIDDEN: \"FORBIDDEN\",\n\tVERSION_CONFLICT: \"VERSION_CONFLICT\",\n\tNOT_FOUND: \"NOT_FOUND\",\n\t// Tenant lifecycle (CLI surfaces these verbatim)\n\tKEY_ROTATED: \"KEY_ROTATED\",\n\tTENANT_SUSPENDED: \"TENANT_SUSPENDED\",\n\tNO_TENANT_FOR_PROJECT: \"NO_TENANT_FOR_PROJECT\",\n\tINSTANCE_EXISTS: \"INSTANCE_EXISTS\",\n} as const;\n\nexport type ErrorCode = (typeof ErrorCodes)[keyof typeof ErrorCodes];\n\n/** Base error class for all Secondlayer errors. */\nexport class SecondLayerError extends Error {\n\tpublic code: ErrorCode;\n\tpublic override cause?: unknown;\n\t/** Optional structured payload merged into the HTTP error body (machine-readable hints). */\n\tpublic details?: Record<string, unknown>;\n\n\tconstructor(\n\t\tcode: ErrorCode,\n\t\tmessage: string,\n\t\tcause?: unknown,\n\t\tdetails?: Record<string, unknown>,\n\t) {\n\t\tsuper(message);\n\t\tthis.code = code;\n\t\tthis.cause = cause;\n\t\tthis.details = details;\n\t\tthis.name = this.constructor.name;\n\t\tError.captureStackTrace?.(this, this.constructor);\n\t}\n\n\ttoJSON(): {\n\t\tname: string;\n\t\tcode: string;\n\t\tmessage: string;\n\t\tstack: string | undefined;\n\t\tcause: unknown;\n\t\tdetails: Record<string, unknown> | undefined;\n\t} {\n\t\treturn {\n\t\t\tname: this.name,\n\t\t\tcode: this.code,\n\t\t\tmessage: this.message,\n\t\t\tstack: this.stack,\n\t\t\tcause: this.cause,\n\t\t\tdetails: this.details,\n\t\t};\n\t}\n}\n\nexport class NotFoundError extends SecondLayerError {\n\tconstructor(message: string) {\n\t\tsuper(\"NOT_FOUND\", message);\n\t}\n}\n\nexport class ValidationError extends SecondLayerError {\n\tconstructor(message: string, cause?: unknown) {\n\t\tsuper(\"VALIDATION_ERROR\", message, cause);\n\t}\n}\n\nexport class DatabaseError extends SecondLayerError {\n\tconstructor(message: string, cause?: unknown) {\n\t\tsuper(\"DATABASE_ERROR\", message, cause);\n\t}\n}\n\nexport class AuthenticationError extends SecondLayerError {\n\t/** `details` is merged into the HTTP body — use it to carry the recovery\n\t * hint (which credential, where it comes from) instead of a bare \"invalid\n\t * key\" the caller cannot act on. */\n\tconstructor(message: string, details?: Record<string, unknown>) {\n\t\tsuper(\"AUTHENTICATION_ERROR\", message, undefined, details);\n\t}\n}\n\nexport class AuthorizationError extends SecondLayerError {\n\tconstructor(message: string, details?: Record<string, unknown>) {\n\t\tsuper(\"AUTHORIZATION_ERROR\", message, undefined, details);\n\t}\n}\n\nexport class RateLimitError extends SecondLayerError {\n\tconstructor(message: string) {\n\t\tsuper(\"RATE_LIMIT_ERROR\", message);\n\t}\n}\n\n/**\n * HTTP 402: insufficient credits. Carries a machine-readable reason (e.g.\n * `insufficient_credits`, `UPGRADE_REQUIRED`) in `details` so the global\n * error handler emits it in the body, alongside a top-up hint/link.\n */\nexport class PaymentRequiredError extends SecondLayerError {\n\tconstructor(message: string, details?: Record<string, unknown>) {\n\t\tsuper(\"PAYMENT_REQUIRED\", message, undefined, details);\n\t}\n}\n\nexport class ForbiddenError extends SecondLayerError {\n\tconstructor(message = \"Forbidden\") {\n\t\tsuper(\"FORBIDDEN\", message);\n\t}\n}\n\nexport class VersionConflictError extends SecondLayerError {\n\tpublic currentVersion: string;\n\tpublic expectedVersion: string;\n\n\tconstructor(currentVersion: string, expectedVersion: string) {\n\t\tsuper(\n\t\t\t\"VERSION_CONFLICT\",\n\t\t\t`Version conflict: expected ${expectedVersion}, current ${currentVersion}`,\n\t\t);\n\t\tthis.currentVersion = currentVersion;\n\t\tthis.expectedVersion = expectedVersion;\n\t}\n}\n\nexport class KeyRotatedError extends SecondLayerError {\n\tconstructor(message = \"Token has been rotated\") {\n\t\tsuper(\"KEY_ROTATED\", message);\n\t}\n}\n\nexport class TenantSuspendedError extends SecondLayerError {\n\tconstructor(message = \"Instance is suspended\") {\n\t\tsuper(\"TENANT_SUSPENDED\", message);\n\t}\n}\n\n/** Error code → HTTP status. Used by API middleware for code-based matching\n * (avoids cross-bundle instanceof failures from bunup class duplication). */\n// String literal map — codes don't have to be in the central ErrorCode\n// enum (route-local error classes can supply any code; we just map the\n// HTTP status here). This keeps cross-bundle instanceof failures out of\n// the equation.\nexport const CODE_TO_STATUS: Record<\n\tstring,\n\t400 | 401 | 402 | 403 | 404 | 409 | 415 | 422 | 423 | 429 | 503\n> = {\n\t// The chain plane has no data yet — a fresh self-host install before the\n\t// first block lands. Retryable, and not the operator's mistake, so it is a\n\t// 503 with a name rather than an opaque 500.\n\tCHAIN_DATA_UNAVAILABLE: 503,\n\tAUTHENTICATION_ERROR: 401,\n\tAUTHORIZATION_ERROR: 403,\n\tPAYMENT_REQUIRED: 402,\n\tRATE_LIMIT_ERROR: 429,\n\tFORBIDDEN: 403,\n\tNOT_FOUND: 404,\n\tVALIDATION_ERROR: 400,\n\tKEY_ROTATED: 401,\n\tTENANT_SUSPENDED: 423,\n\tNO_TENANT_FOR_PROJECT: 404,\n\tINSTANCE_EXISTS: 409,\n\tSUBGRAPH_NOT_FOUND: 404,\n\tGHOST_KEY_READ_ONLY: 403,\n\t// A write that did not declare `Content-Type: application/json`. Shaped\n\t// like something a browser could have forged cross-origin without a CORS\n\t// preflight — see the API's `middleware/csrf.ts`.\n\tUNSUPPORTED_MEDIA_TYPE: 415,\n} as const;\n\nexport function getErrorMessage(err: unknown): string {\n\treturn err instanceof Error ? err.message : String(err);\n}\n"
5
+ "export const ErrorCodes = {\n\tVALIDATION_ERROR: \"VALIDATION_ERROR\",\n\tDATABASE_ERROR: \"DATABASE_ERROR\",\n\tAUTHENTICATION_ERROR: \"AUTHENTICATION_ERROR\",\n\tAUTHORIZATION_ERROR: \"AUTHORIZATION_ERROR\",\n\tRATE_LIMIT_ERROR: \"RATE_LIMIT_ERROR\",\n\tPAYMENT_REQUIRED: \"PAYMENT_REQUIRED\",\n\tFORBIDDEN: \"FORBIDDEN\",\n\tVERSION_CONFLICT: \"VERSION_CONFLICT\",\n\tNOT_FOUND: \"NOT_FOUND\",\n\t// Tenant lifecycle (CLI surfaces these verbatim)\n\tKEY_ROTATED: \"KEY_ROTATED\",\n\tKEY_REVOKED: \"KEY_REVOKED\",\n\tTENANT_SUSPENDED: \"TENANT_SUSPENDED\",\n\tNO_TENANT_FOR_PROJECT: \"NO_TENANT_FOR_PROJECT\",\n\tINSTANCE_EXISTS: \"INSTANCE_EXISTS\",\n} as const;\n\nexport type ErrorCode = (typeof ErrorCodes)[keyof typeof ErrorCodes];\n\n/** Base error class for all Secondlayer errors. */\nexport class SecondLayerError extends Error {\n\tpublic code: ErrorCode;\n\tpublic override cause?: unknown;\n\t/** Optional structured payload merged into the HTTP error body (machine-readable hints). */\n\tpublic details?: Record<string, unknown>;\n\n\tconstructor(\n\t\tcode: ErrorCode,\n\t\tmessage: string,\n\t\tcause?: unknown,\n\t\tdetails?: Record<string, unknown>,\n\t) {\n\t\tsuper(message);\n\t\tthis.code = code;\n\t\tthis.cause = cause;\n\t\tthis.details = details;\n\t\tthis.name = this.constructor.name;\n\t\tError.captureStackTrace?.(this, this.constructor);\n\t}\n\n\ttoJSON(): {\n\t\tname: string;\n\t\tcode: string;\n\t\tmessage: string;\n\t\tstack: string | undefined;\n\t\tcause: unknown;\n\t\tdetails: Record<string, unknown> | undefined;\n\t} {\n\t\treturn {\n\t\t\tname: this.name,\n\t\t\tcode: this.code,\n\t\t\tmessage: this.message,\n\t\t\tstack: this.stack,\n\t\t\tcause: this.cause,\n\t\t\tdetails: this.details,\n\t\t};\n\t}\n}\n\nexport class NotFoundError extends SecondLayerError {\n\tconstructor(message: string) {\n\t\tsuper(\"NOT_FOUND\", message);\n\t}\n}\n\nexport class ValidationError extends SecondLayerError {\n\tconstructor(message: string, cause?: unknown) {\n\t\tsuper(\"VALIDATION_ERROR\", message, cause);\n\t}\n}\n\nexport class DatabaseError extends SecondLayerError {\n\tconstructor(message: string, cause?: unknown) {\n\t\tsuper(\"DATABASE_ERROR\", message, cause);\n\t}\n}\n\nexport class AuthenticationError extends SecondLayerError {\n\t/** `details` is merged into the HTTP body — use it to carry the recovery\n\t * hint (which credential, where it comes from) instead of a bare \"invalid\n\t * key\" the caller cannot act on. */\n\tconstructor(message: string, details?: Record<string, unknown>) {\n\t\tsuper(\"AUTHENTICATION_ERROR\", message, undefined, details);\n\t}\n}\n\nexport class AuthorizationError extends SecondLayerError {\n\tconstructor(message: string, details?: Record<string, unknown>) {\n\t\tsuper(\"AUTHORIZATION_ERROR\", message, undefined, details);\n\t}\n}\n\n/** A real account key that was revoked. Distinct from an unknown key so the\n * caller (and the account's error log) can tell which one it is. */\nexport class ApiKeyRevokedError extends SecondLayerError {\n\tconstructor() {\n\t\tsuper(\"KEY_REVOKED\", \"API key has been revoked\", undefined, {\n\t\t\thint: \"Make a new key at https://secondlayer.tools/account/keys and replace the revoked one wherever it is configured.\",\n\t\t});\n\t}\n}\n\nexport class RateLimitError extends SecondLayerError {\n\tconstructor(message: string) {\n\t\tsuper(\"RATE_LIMIT_ERROR\", message);\n\t}\n}\n\n/**\n * HTTP 402: insufficient credits. Carries a machine-readable reason (e.g.\n * `insufficient_credits`, `UPGRADE_REQUIRED`) in `details` so the global\n * error handler emits it in the body, alongside a top-up hint/link.\n */\nexport class PaymentRequiredError extends SecondLayerError {\n\tconstructor(message: string, details?: Record<string, unknown>) {\n\t\tsuper(\"PAYMENT_REQUIRED\", message, undefined, details);\n\t}\n}\n\nexport class ForbiddenError extends SecondLayerError {\n\tconstructor(message = \"Forbidden\") {\n\t\tsuper(\"FORBIDDEN\", message);\n\t}\n}\n\nexport class VersionConflictError extends SecondLayerError {\n\tpublic currentVersion: string;\n\tpublic expectedVersion: string;\n\n\tconstructor(currentVersion: string, expectedVersion: string) {\n\t\tsuper(\n\t\t\t\"VERSION_CONFLICT\",\n\t\t\t`Version conflict: expected ${expectedVersion}, current ${currentVersion}`,\n\t\t);\n\t\tthis.currentVersion = currentVersion;\n\t\tthis.expectedVersion = expectedVersion;\n\t}\n}\n\nexport class KeyRotatedError extends SecondLayerError {\n\tconstructor(message = \"Token has been rotated\") {\n\t\tsuper(\"KEY_ROTATED\", message);\n\t}\n}\n\nexport class TenantSuspendedError extends SecondLayerError {\n\tconstructor(message = \"Instance is suspended\") {\n\t\tsuper(\"TENANT_SUSPENDED\", message);\n\t}\n}\n\n/** Error code → HTTP status. Used by API middleware for code-based matching\n * (avoids cross-bundle instanceof failures from bunup class duplication). */\n// String literal map — codes don't have to be in the central ErrorCode\n// enum (route-local error classes can supply any code; we just map the\n// HTTP status here). This keeps cross-bundle instanceof failures out of\n// the equation.\nexport const CODE_TO_STATUS: Record<\n\tstring,\n\t400 | 401 | 402 | 403 | 404 | 409 | 415 | 422 | 423 | 429 | 503\n> = {\n\t// The chain plane has no data yet — a fresh self-host install before the\n\t// first block lands. Retryable, and not the operator's mistake, so it is a\n\t// 503 with a name rather than an opaque 500.\n\tCHAIN_DATA_UNAVAILABLE: 503,\n\tAUTHENTICATION_ERROR: 401,\n\tAUTHORIZATION_ERROR: 403,\n\tPAYMENT_REQUIRED: 402,\n\tRATE_LIMIT_ERROR: 429,\n\tFORBIDDEN: 403,\n\tNOT_FOUND: 404,\n\tVALIDATION_ERROR: 400,\n\tKEY_ROTATED: 401,\n\tKEY_REVOKED: 401,\n\tTENANT_SUSPENDED: 423,\n\tNO_TENANT_FOR_PROJECT: 404,\n\tINSTANCE_EXISTS: 409,\n\tSUBGRAPH_NOT_FOUND: 404,\n\tGHOST_KEY_READ_ONLY: 403,\n\t// A write that did not declare `Content-Type: application/json`. Shaped\n\t// like something a browser could have forged cross-origin without a CORS\n\t// preflight — see the API's `middleware/csrf.ts`.\n\tUNSUPPORTED_MEDIA_TYPE: 415,\n} as const;\n\nexport function getErrorMessage(err: unknown): string {\n\treturn err instanceof Error ? err.message : String(err);\n}\n"
6
6
  ],
7
- "mappings": ";AAAO,IAAM,aAAa;AAAA,EACzB,kBAAkB;AAAA,EAClB,gBAAgB;AAAA,EAChB,sBAAsB;AAAA,EACtB,qBAAqB;AAAA,EACrB,kBAAkB;AAAA,EAClB,kBAAkB;AAAA,EAClB,WAAW;AAAA,EACX,kBAAkB;AAAA,EAClB,WAAW;AAAA,EAEX,aAAa;AAAA,EACb,kBAAkB;AAAA,EAClB,uBAAuB;AAAA,EACvB,iBAAiB;AAClB;AAAA;AAKO,MAAM,yBAAyB,MAAM;AAAA,EACpC;AAAA,EACS;AAAA,EAET;AAAA,EAEP,WAAW,CACV,MACA,SACA,OACA,SACC;AAAA,IACD,MAAM,OAAO;AAAA,IACb,KAAK,OAAO;AAAA,IACZ,KAAK,QAAQ;AAAA,IACb,KAAK,UAAU;AAAA,IACf,KAAK,OAAO,KAAK,YAAY;AAAA,IAC7B,MAAM,oBAAoB,MAAM,KAAK,WAAW;AAAA;AAAA,EAGjD,MAAM,GAOJ;AAAA,IACD,OAAO;AAAA,MACN,MAAM,KAAK;AAAA,MACX,MAAM,KAAK;AAAA,MACX,SAAS,KAAK;AAAA,MACd,OAAO,KAAK;AAAA,MACZ,OAAO,KAAK;AAAA,MACZ,SAAS,KAAK;AAAA,IACf;AAAA;AAEF;AAAA;AAEO,MAAM,sBAAsB,iBAAiB;AAAA,EACnD,WAAW,CAAC,SAAiB;AAAA,IAC5B,MAAM,aAAa,OAAO;AAAA;AAE5B;AAAA;AAEO,MAAM,wBAAwB,iBAAiB;AAAA,EACrD,WAAW,CAAC,SAAiB,OAAiB;AAAA,IAC7C,MAAM,oBAAoB,SAAS,KA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gBAAwB,iBAAyB;AAAA,IAC5D,MACC,oBACA,8BAA8B,4BAA4B,gBAC3D;AAAA,IACA,KAAK,iBAAiB;AAAA,IACtB,KAAK,kBAAkB;AAAA;AAEzB;AAAA;AAEO,MAAM,wBAAwB,iBAAiB;AAAA,EACrD,WAAW,CAAC,UAAU,0BAA0B;AAAA,IAC/C,MAAM,eAAe,OAAO;AAAA;AAE9B;AAAA;AAEO,MAAM,6BAA6B,iBAAiB;AAAA,EAC1D,WAAW,CAAC,UAAU,yBAAyB;AAAA,IAC9C,MAAM,oBAAoB,OAAO;AAAA;AAEnC;AAQO,IAAM,iBAGT;AAAA,EAIH,wBAAwB;AAAA,EACxB,sBAAsB;AAAA,EACtB,qBAAqB;AAAA,EACrB,kBAAkB;AAAA,EAClB,kBAAkB;AAAA,EAClB,WAAW;AAAA,EACX,WAAW;AAAA,EACX,kBAAkB;AAAA,EAClB,aAAa;AAAA,EACb,aAAa;AAAA,EACb,kBAAkB;AAAA,EAClB,uBAAuB;AAAA,EACvB,iBAAiB;AAAA,EACjB,oBAAoB;AAAA,EACpB,qBAAqB;AAAA,EAIrB,wBAAwB;AACzB;AAEO,SAAS,eAAe,CAAC,KAAsB;AAAA,EACrD,OAAO,eAAe,QAAQ,IAAI,UAAU,OAAO,GAAG;AAAA;",
8
+ "debugId": "7D27C3B75AB151ED64756E2164756E21",
9
9
  "names": []
10
10
  }
@@ -524,6 +524,9 @@ interface AccountsTable {
524
524
  email: string | null;
525
525
  /** True for anonymous self-serve accounts until claimed via magic link. */
526
526
  ghost: Generated<boolean>;
527
+ /** First-party service account: usage priced at $0, never gated on
528
+ * credits. Set by ops only. */
529
+ internal: Generated<boolean>;
527
530
  /** Stacks principal owning a wallet-ghost account. */
528
531
  wallet_principal: string | null;
529
532
  display_name: string | null;
@@ -1482,6 +1485,8 @@ interface ApiFailedRequestsTable {
1482
1485
  message: Generated<string>;
1483
1486
  query: Record<string, unknown>;
1484
1487
  origin: string | null;
1488
+ /** Revoked account key the request presented (`KEY_REVOKED` only). */
1489
+ api_key_id: string | null;
1485
1490
  created_at: Generated<Date>;
1486
1491
  }
1487
1492
  type ApiFailedRequest = Selectable<ApiFailedRequestsTable>;
@@ -2678,6 +2683,7 @@ declare const ErrorCodes: {
2678
2683
  readonly VERSION_CONFLICT: "VERSION_CONFLICT"
2679
2684
  readonly NOT_FOUND: "NOT_FOUND"
2680
2685
  readonly KEY_ROTATED: "KEY_ROTATED"
2686
+ readonly KEY_REVOKED: "KEY_REVOKED"
2681
2687
  readonly TENANT_SUSPENDED: "TENANT_SUSPENDED"
2682
2688
  readonly NO_TENANT_FOR_PROJECT: "NO_TENANT_FOR_PROJECT"
2683
2689
  readonly INSTANCE_EXISTS: "INSTANCE_EXISTS"
@@ -2717,6 +2723,11 @@ declare class AuthenticationError extends SecondLayerError {
2717
2723
  declare class AuthorizationError extends SecondLayerError {
2718
2724
  constructor(message: string, details?: Record<string, unknown>);
2719
2725
  }
2726
+ /** A real account key that was revoked. Distinct from an unknown key so the
2727
+ * caller (and the account's error log) can tell which one it is. */
2728
+ declare class ApiKeyRevokedError extends SecondLayerError {
2729
+ constructor();
2730
+ }
2720
2731
  declare class RateLimitError extends SecondLayerError {
2721
2732
  constructor(message: string);
2722
2733
  }
@@ -2909,17 +2920,15 @@ declare const InsightSchema: z3.ZodType<Insight>;
2909
2920
  declare const InsightListResponseSchema: z3.ZodType<InsightListResponse>;
2910
2921
  declare const SEVERITY_ORDER: Record<InsightSeverity, number>;
2911
2922
  import { z as z4 } from "zod";
2912
- declare const WEBHOOK_FORMATS: readonly ["standard-webhooks", "inngest", "trigger", "cloudflare", "cloudevents", "raw"];
2913
- declare const WEBHOOK_STATUSES: readonly ["active", "paused", "error"];
2914
- declare const WebhookStatusSchema: z4.ZodType<WebhookStatus2>;
2915
- declare const WebhookFormatSchema: z4.ZodType<WebhookFormat2>;
2916
2923
  declare const CHAIN_TRIGGER_TYPES: readonly ["stx_transfer", "stx_mint", "stx_burn", "stx_lock", "ft_transfer", "ft_mint", "ft_burn", "nft_transfer", "nft_mint", "nft_burn", "contract_call", "contract_deploy", "print_event", "nested_contract_call", "var_set", "map_set", "map_insert", "map_delete", "sbtc_deposit", "sbtc_withdrawal_create", "sbtc_withdrawal_accept", "sbtc_withdrawal_reject", "sbtc_withdrawal_swept_confirmed", "rune_etch", "rune_mint", "rune_transfer", "rune_burn"];
2917
2924
  /**
2918
- * Per-type accepted filter fields for chain triggers, DERIVED from
2919
- * {@link ChainTriggerSchema} so the agent-facing reference can never drift behind
2920
- * the validator. `{ stx_transfer: ["sender","recipient","minAmount","maxAmount"], ... }`.
2925
+ * Per-type accepted filter fields for chain triggers, in validator key order.
2921
2926
  */
2922
2927
  declare const CHAIN_TRIGGER_FIELDS: Record<string, string[]>;
2928
+ declare const WEBHOOK_FORMATS: readonly ["standard-webhooks", "inngest", "trigger", "cloudflare", "cloudevents", "raw"];
2929
+ declare const WEBHOOK_STATUSES: readonly ["active", "paused", "error"];
2930
+ declare const WebhookStatusSchema: z4.ZodType<WebhookStatus2>;
2931
+ declare const WebhookFormatSchema: z4.ZodType<WebhookFormat2>;
2923
2932
  declare const CreateWebhookRequestSchema: z4.ZodType<ParsedCreateWebhookRequest>;
2924
2933
  declare const UpdateWebhookRequestSchema: z4.ZodType<UpdateWebhookRequest>;
2925
2934
  declare const ReplayWebhookRequestSchema: z4.ZodType<ReplayWebhookRequest>;
@@ -3653,4 +3662,4 @@ declare function publicKeyPemFromPrivate(privateKeyPem: string): string;
3653
3662
  declare function ed25519KeyId(publicKeyPem: string): string;
3654
3663
  declare function signEd25519(payload: string, privateKey: KeyObject): string;
3655
3664
  declare function verifyEd25519(payload: string, signatureBase64: string, publicKey: KeyObject): boolean;
3656
- export { Account, AccountBalanceAlerts, AccountBalanceAlertsTable, AccountCredits, AccountCreditsTable, AccountSpendCap, AccountSpendCapsTable, AccountsTable, ApiFailedRequest, ApiFailedRequestsTable, ApiKey, ApiKeysTable, ApiRequestLogRow, ApiRequestLogTable, ArchiveFetch, ArchiveFetchesTable, AuthenticationError, AuthorizationError, BILLING_PAUSED_PREFIX, Block, BlocksTable, BnsMarketplaceAction, BnsMarketplaceEventsTable, BnsNameEventTopic, BnsNameEventsTable, BnsNamesTable, BnsNamespaceEventStatus, BnsNamespaceEventsTable, BnsNamespacesTable, BurnBlockRewardSlotsTable, BurnBlockRewardsTable, CHAIN_TRIGGER_FIELDS, CHAIN_TRIGGER_TYPES, CODE_TO_STATUS, ChainApplyDeliveryOf, ChainApplyEnvelope, ChainApplyEnvelopeOf, ChainEventEnvelope, ChainFtBurnData, ChainFtMintData, ChainFtTransferData, ChainNftBurnData, ChainNftMintData, ChainNftTransferData, ChainPrintEventData, ChainReadCacheTable, ChainReorgOrphanedEntry, ChainReorgRollbackDelivery, ChainReorgRollbackEnvelope, ChainReorgsTable, ChainStxBurnData, ChainStxLockData, ChainStxMintData, ChainStxTransferData, ChainTestDelivery, ChainTxLevelEvent, ChainWebhookDelivery, ChainWebhookEnvelope, CliDeviceLogin, CliDeviceLoginStatus, CliDeviceLoginsTable, ContactRequest, ContactRequestsTable, Contract, ContractsTable, CoverageSegmentsTable, CreateWebhookRequest, CreateWebhookRequestSchema, CreateWebhookResponse, DB_TO_STREAMS_EVENT_TYPE, DECODED_EVENT_TYPES2 as DECODED_EVENT_TYPES, DEFAULT_BTC_CONFIRMATIONS, Database, DatabaseError, DbPlane, DbReadRow, DbSplitStatus, DeadLetterEventsTable, DeadRow, DecodedEventType2 as DecodedEventType, DecodedEventsTable, DecoderCheckpointsTable, DeliveryRow, DeploySubgraphRequest, DeploySubgraphRequestSchema, DeploySubgraphResponse, EMPTY_RANGE_EVENT_INDEX_SENTINEL, Env, ErrorCode, ErrorCodes, Event, EventsArchiveTable, EventsTable, FailureClass, FailureUnit, FeedbackTicket, FeedbackTicketsTable, ForbiddenError, HealthHour, HealthSnapshotPoint, INSIGHT_SEVERITIES, IndexColumn, IndexColumnType, IndexPrimaryKey, IndexProgress, IndexProgressTable, InsertAccount, InsertAccountBalanceAlerts, InsertAccountCredits, InsertAccountSpendCap, InsertApiFailedRequest, InsertApiKey, InsertApiRequestLogRow, InsertArchiveFetch, InsertBlock, InsertContactRequest, InsertContract, InsertEvent, InsertFeedbackTicket, InsertIndexProgress, InsertMagicLink, InsertMempoolTransaction, InsertSession, InsertStateWrite, InsertSubgraph, InsertSubgraphGap, InsertSubgraphHealthSnapshot, InsertSubgraphOperation, InsertTransaction, InsertUsageLedgerRow, InsertVmEvent, InsertWaitlistSignup, InsertWebhook, InsertWebhookDelivery, InsertWebhookOutbox, Insight, InsightEvidence, InsightEvidenceSchema, InsightListResponse, InsightListResponseSchema, InsightMutesTable, InsightResourceKind, InsightResourceKindSchema, InsightSchema, InsightSeverity, InsightSeveritySchema, InsightsTable, InstancesTable, KeyRotatedError, MagicLink, MagicLinksTable, MempoolTransaction, MempoolTransactionsTable, MigrationRole, NativeClock, NotFoundError, NumericAsText, ObserverJournalStatus, ObserverJournalTable, OutboxStatus, ParsedCreateWebhookRequest, ParsedReplayWebhookRequest, ParsedUpdateWebhookRequest, PaymentRequiredError, PendingForkBlocksTable, Pox4CallsTable, Pox4FunctionName, Pox5CycleSignersTable, Pox5CyclesTable, Pox5EventTopic, Pox5EventsTable, ProcessedStripeEventsTable, RUNE_EVENT_TYPES, RateLimitError, ReindexResponse, RepairMode, ReplayResult, ReplayWebhookRequest, ReplayWebhookRequestSchema, RetryState, RotateSecretResponse, RunStatus, RuneApplyDeliveryOf, RuneApplyEnvelope, RuneEventType, SEVERITY_ORDER, SOURCE_READ_COLUMNS, SOURCE_READ_PKS, SOURCE_READ_TYPES, STREAMS_DB_EVENT_TYPES, STREAMS_EVENT_TYPES, STREAMS_TO_DB_EVENT_TYPES, SbtcDepositEvent, SbtcEventTopic, SbtcEventsTable, SbtcSettlementsTable, SbtcTokenEventType, SbtcTokenEventsTable, SbtcWithdrawalEvent, SbtcWithdrawalSweptConfirmedEvent, SecondLayerError, SentinelAccount, SentinelAccountsTable, ServiceHeartbeatsTable, Session, SessionsTable, StageBlockReceiptsTable, StageFailuresTable, StageKind, StageRegistryTable, StageRunsTable, StateWrite, StateWritesArchiveTable, StateWritesTable, StreamsCursor, StreamsDbEventType, StreamsEventType, Subgraph, SubgraphAgentSchema, SubgraphAggregateParams, SubgraphAggregateResponse, SubgraphDetail, SubgraphErrorGroupsTable, SubgraphGap, SubgraphGapEntry, SubgraphGapRange, SubgraphGapsResponse, SubgraphGapsTable, SubgraphHealthSnapshot, SubgraphHealthSnapshotsTable, SubgraphOperation, SubgraphOperationKind, SubgraphOperationStatus, SubgraphOperationsTable, SubgraphProcessingStatsTable, SubgraphQueryParams, SubgraphSpecFormat, SubgraphSpecOptions, SubgraphSummary, SubgraphSyncInfo, SubgraphVerification, SubgraphViolationsTable, SubgraphsTable, SyncScopesTable, TABLE_TO_DB, TenantSuspendedError, Transaction, TransactionsArchiveTable, TransactionsTable, TriggerEvaluatorState, TriggerEvaluatorStateTable, UpdateAccountBalanceAlerts, UpdateAccountCredits, UpdateAccountSpendCap, UpdateApiKey, UpdateArchiveFetch, UpdateBlock, UpdateContract, UpdateEvent, UpdateIndexProgress, UpdateSubgraph, UpdateSubgraphOperation, UpdateTransaction, UpdateUsageLedgerRow, UpdateVmEvent, UpdateWebhook, UpdateWebhookOutbox, UpdateWebhookRequest, UpdateWebhookRequestSchema, UsageLedgerRow, UsageLedgerTable, VM_EVENT_TYPES, VM_NODE_TO_STORED_TYPE2 as VM_NODE_TO_STORED_TYPE, VM_STORED_TO_NODE_TYPE, ValidationError, VersionConflictError, VmEvent, VmEventType, VmEventsArchiveTable, VmEventsTable, VmNodeEventType, WEBHOOK_FORMATS, WEBHOOK_STATUSES, Waitlist, WaitlistSignup, WaitlistSignupsTable, WaitlistsTable, Webhook, WebhookDeliveriesTable, WebhookDelivery, WebhookDetail, WebhookFormat, WebhookFormatSchema, WebhookIncidentAlert, WebhookIncidentAlertsTable, WebhookKind, WebhookOutbox, WebhookOutboxTable, WebhookStatus, WebhookStatusSchema, WebhookSummary, WebhooksTable, applicationDatabaseUrl, assertDbSplit, billingPausedCode, blockEndCursor, bucketHourly, closeDb, closeDbOrTimeout, committedHeight, compareStreamsCursor, exports_hmac as crypto, decodeStreamsCursor, describeDbUrl, exports_ed25519 as ed25519, encodeStreamsCursor, finalizedBurnHeight, formatWebhookSchemaErrors, generateSubgraphAgentSchema, generateSubgraphMarkdown, generateSubgraphOpenApi, generateSubgraphSpec, getDb, getDbSplitStatus, getEnv, getErrorMessage, getMigrationRole, getRawClient, getSourceDb, getTargetDb, isBnsDecoderEnabled, isEmptyRangeCursor, isPox4DecoderEnabled, isPox5DecoderEnabled, isSbtcDecoderEnabled, jsonb, logger, onChainPlane, onControlPlane, parseJsonb, resolveSourceUrl, resolveTargetUrl, setMigrationRole, sql };
3665
+ export { Account, AccountBalanceAlerts, AccountBalanceAlertsTable, AccountCredits, AccountCreditsTable, AccountSpendCap, AccountSpendCapsTable, AccountsTable, ApiFailedRequest, ApiFailedRequestsTable, ApiKey, ApiKeyRevokedError, ApiKeysTable, ApiRequestLogRow, ApiRequestLogTable, ArchiveFetch, ArchiveFetchesTable, AuthenticationError, AuthorizationError, BILLING_PAUSED_PREFIX, Block, BlocksTable, BnsMarketplaceAction, BnsMarketplaceEventsTable, BnsNameEventTopic, BnsNameEventsTable, BnsNamesTable, BnsNamespaceEventStatus, BnsNamespaceEventsTable, BnsNamespacesTable, BurnBlockRewardSlotsTable, BurnBlockRewardsTable, CHAIN_TRIGGER_FIELDS, CHAIN_TRIGGER_TYPES, CODE_TO_STATUS, ChainApplyDeliveryOf, ChainApplyEnvelope, ChainApplyEnvelopeOf, ChainEventEnvelope, ChainFtBurnData, ChainFtMintData, ChainFtTransferData, ChainNftBurnData, ChainNftMintData, ChainNftTransferData, ChainPrintEventData, ChainReadCacheTable, ChainReorgOrphanedEntry, ChainReorgRollbackDelivery, ChainReorgRollbackEnvelope, ChainReorgsTable, ChainStxBurnData, ChainStxLockData, ChainStxMintData, ChainStxTransferData, ChainTestDelivery, ChainTxLevelEvent, ChainWebhookDelivery, ChainWebhookEnvelope, CliDeviceLogin, CliDeviceLoginStatus, CliDeviceLoginsTable, ContactRequest, ContactRequestsTable, Contract, ContractsTable, CoverageSegmentsTable, CreateWebhookRequest, CreateWebhookRequestSchema, CreateWebhookResponse, DB_TO_STREAMS_EVENT_TYPE, DECODED_EVENT_TYPES2 as DECODED_EVENT_TYPES, DEFAULT_BTC_CONFIRMATIONS, Database, DatabaseError, DbPlane, DbReadRow, DbSplitStatus, DeadLetterEventsTable, DeadRow, DecodedEventType2 as DecodedEventType, DecodedEventsTable, DecoderCheckpointsTable, DeliveryRow, DeploySubgraphRequest, DeploySubgraphRequestSchema, DeploySubgraphResponse, EMPTY_RANGE_EVENT_INDEX_SENTINEL, Env, ErrorCode, ErrorCodes, Event, EventsArchiveTable, EventsTable, FailureClass, FailureUnit, FeedbackTicket, FeedbackTicketsTable, ForbiddenError, HealthHour, HealthSnapshotPoint, INSIGHT_SEVERITIES, IndexColumn, IndexColumnType, IndexPrimaryKey, IndexProgress, IndexProgressTable, InsertAccount, InsertAccountBalanceAlerts, InsertAccountCredits, InsertAccountSpendCap, InsertApiFailedRequest, InsertApiKey, InsertApiRequestLogRow, InsertArchiveFetch, InsertBlock, InsertContactRequest, InsertContract, InsertEvent, InsertFeedbackTicket, InsertIndexProgress, InsertMagicLink, InsertMempoolTransaction, InsertSession, InsertStateWrite, InsertSubgraph, InsertSubgraphGap, InsertSubgraphHealthSnapshot, InsertSubgraphOperation, InsertTransaction, InsertUsageLedgerRow, InsertVmEvent, InsertWaitlistSignup, InsertWebhook, InsertWebhookDelivery, InsertWebhookOutbox, Insight, InsightEvidence, InsightEvidenceSchema, InsightListResponse, InsightListResponseSchema, InsightMutesTable, InsightResourceKind, InsightResourceKindSchema, InsightSchema, InsightSeverity, InsightSeveritySchema, InsightsTable, InstancesTable, KeyRotatedError, MagicLink, MagicLinksTable, MempoolTransaction, MempoolTransactionsTable, MigrationRole, NativeClock, NotFoundError, NumericAsText, ObserverJournalStatus, ObserverJournalTable, OutboxStatus, ParsedCreateWebhookRequest, ParsedReplayWebhookRequest, ParsedUpdateWebhookRequest, PaymentRequiredError, PendingForkBlocksTable, Pox4CallsTable, Pox4FunctionName, Pox5CycleSignersTable, Pox5CyclesTable, Pox5EventTopic, Pox5EventsTable, ProcessedStripeEventsTable, RUNE_EVENT_TYPES, RateLimitError, ReindexResponse, RepairMode, ReplayResult, ReplayWebhookRequest, ReplayWebhookRequestSchema, RetryState, RotateSecretResponse, RunStatus, RuneApplyDeliveryOf, RuneApplyEnvelope, RuneEventType, SEVERITY_ORDER, SOURCE_READ_COLUMNS, SOURCE_READ_PKS, SOURCE_READ_TYPES, STREAMS_DB_EVENT_TYPES, STREAMS_EVENT_TYPES, STREAMS_TO_DB_EVENT_TYPES, SbtcDepositEvent, SbtcEventTopic, SbtcEventsTable, SbtcSettlementsTable, SbtcTokenEventType, SbtcTokenEventsTable, SbtcWithdrawalEvent, SbtcWithdrawalSweptConfirmedEvent, SecondLayerError, SentinelAccount, SentinelAccountsTable, ServiceHeartbeatsTable, Session, SessionsTable, StageBlockReceiptsTable, StageFailuresTable, StageKind, StageRegistryTable, StageRunsTable, StateWrite, StateWritesArchiveTable, StateWritesTable, StreamsCursor, StreamsDbEventType, StreamsEventType, Subgraph, SubgraphAgentSchema, SubgraphAggregateParams, SubgraphAggregateResponse, SubgraphDetail, SubgraphErrorGroupsTable, SubgraphGap, SubgraphGapEntry, SubgraphGapRange, SubgraphGapsResponse, SubgraphGapsTable, SubgraphHealthSnapshot, SubgraphHealthSnapshotsTable, SubgraphOperation, SubgraphOperationKind, SubgraphOperationStatus, SubgraphOperationsTable, SubgraphProcessingStatsTable, SubgraphQueryParams, SubgraphSpecFormat, SubgraphSpecOptions, SubgraphSummary, SubgraphSyncInfo, SubgraphVerification, SubgraphViolationsTable, SubgraphsTable, SyncScopesTable, TABLE_TO_DB, TenantSuspendedError, Transaction, TransactionsArchiveTable, TransactionsTable, TriggerEvaluatorState, TriggerEvaluatorStateTable, UpdateAccountBalanceAlerts, UpdateAccountCredits, UpdateAccountSpendCap, UpdateApiKey, UpdateArchiveFetch, UpdateBlock, UpdateContract, UpdateEvent, UpdateIndexProgress, UpdateSubgraph, UpdateSubgraphOperation, UpdateTransaction, UpdateUsageLedgerRow, UpdateVmEvent, UpdateWebhook, UpdateWebhookOutbox, UpdateWebhookRequest, UpdateWebhookRequestSchema, UsageLedgerRow, UsageLedgerTable, VM_EVENT_TYPES, VM_NODE_TO_STORED_TYPE2 as VM_NODE_TO_STORED_TYPE, VM_STORED_TO_NODE_TYPE, ValidationError, VersionConflictError, VmEvent, VmEventType, VmEventsArchiveTable, VmEventsTable, VmNodeEventType, WEBHOOK_FORMATS, WEBHOOK_STATUSES, Waitlist, WaitlistSignup, WaitlistSignupsTable, WaitlistsTable, Webhook, WebhookDeliveriesTable, WebhookDelivery, WebhookDetail, WebhookFormat, WebhookFormatSchema, WebhookIncidentAlert, WebhookIncidentAlertsTable, WebhookKind, WebhookOutbox, WebhookOutboxTable, WebhookStatus, WebhookStatusSchema, WebhookSummary, WebhooksTable, applicationDatabaseUrl, assertDbSplit, billingPausedCode, blockEndCursor, bucketHourly, closeDb, closeDbOrTimeout, committedHeight, compareStreamsCursor, exports_hmac as crypto, decodeStreamsCursor, describeDbUrl, exports_ed25519 as ed25519, encodeStreamsCursor, finalizedBurnHeight, formatWebhookSchemaErrors, generateSubgraphAgentSchema, generateSubgraphMarkdown, generateSubgraphOpenApi, generateSubgraphSpec, getDb, getDbSplitStatus, getEnv, getErrorMessage, getMigrationRole, getRawClient, getSourceDb, getTargetDb, isBnsDecoderEnabled, isEmptyRangeCursor, isPox4DecoderEnabled, isPox5DecoderEnabled, isSbtcDecoderEnabled, jsonb, logger, onChainPlane, onControlPlane, parseJsonb, resolveSourceUrl, resolveTargetUrl, setMigrationRole, sql };