@lunora/codegen 1.0.0-alpha.37 → 1.0.0-alpha.39

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -1895,6 +1895,8 @@ interface EmitServerOptions {
1895
1895
  hasPipelines?: boolean;
1896
1896
  /** A `lunora/` source uses `@lunora/bindings/r2sql` / `ctx.r2sql` — wires `ctx.r2sql` onto ActionCtx only. */
1897
1897
  hasR2sql?: boolean;
1898
+ /** A `lunora/` source uses `@lunora/x402/pay` / `ctx.x402` — wires the agent-wallet pay rail onto ActionCtx only. */
1899
+ hasX402?: boolean;
1898
1900
  /**
1899
1901
  * The single `defineIdentity(...)` claim contract declared in
1900
1902
  * `lunora/identity.ts` (Plan 080). When present, `ctx.auth.getIdentity()`,
@@ -1926,6 +1928,7 @@ declare const emitServer: ({
1926
1928
  hasPayments,
1927
1929
  hasPipelines,
1928
1930
  hasR2sql,
1931
+ hasX402,
1929
1932
  identity,
1930
1933
  queues,
1931
1934
  schema,
@@ -1999,6 +2002,8 @@ interface EmitShardOptions {
1999
2002
  hasPipelines?: boolean;
2000
2003
  /** A `lunora/` source reads `ctx.r2sql` (R2 SQL) — wires `ctx.r2sql` onto the ActionCtx only. */
2001
2004
  hasR2sql?: boolean;
2005
+ /** A `lunora/` source reads `ctx.x402` — wires the agent-wallet pay rail onto the ActionCtx only. */
2006
+ hasX402?: boolean;
2002
2007
  maskMetadata?: MaskMetadataIR;
2003
2008
  /** Custom mutators declared via `defineMutator` in `lunora/mutators.ts` — wires the `isCustomMutator` push-protocol override. */
2004
2009
  mutators?: ReadonlyArray<MutatorIR>;
@@ -2030,6 +2035,7 @@ declare const emitShard: ({
2030
2035
  hasPayments,
2031
2036
  hasPipelines,
2032
2037
  hasR2sql,
2038
+ hasX402,
2033
2039
  maskMetadata,
2034
2040
  mutators,
2035
2041
  queues,
@@ -2136,6 +2142,8 @@ interface EmitAppOptions {
2136
2142
  hasVectors: boolean;
2137
2143
  /** App declares Cloudflare Workflows (`defineWorkflow`) → wire `options.workflowsClient` so the studio's workflow-instance proxy can reach the CF REST API. */
2138
2144
  hasWorkflow: boolean;
2145
+ /** App uses `@lunora/x402/pay` / `ctx.x402` → emit `.x402()` (wire the agent-wallet pay rail). */
2146
+ hasX402: boolean;
2139
2147
  /** The single `defineIdentity(...)` contract in `lunora/identity.ts` (Plan 080) → import it as a VALUE and wire `options.identity`, so the runtime trust boundary validates every resolved identity before it becomes `ctx.auth`. `undefined` ⇒ no wiring, byte-identical output. */
2140
2148
  identity?: IdentityIR;
2141
2149
  /** Schema declares `.jurisdiction("…")` → pin every DO the worker reaches (shards, fan-out, scheduler, containers) to the Cloudflare data-residency jurisdiction. */
package/dist/index.d.ts CHANGED
@@ -1895,6 +1895,8 @@ interface EmitServerOptions {
1895
1895
  hasPipelines?: boolean;
1896
1896
  /** A `lunora/` source uses `@lunora/bindings/r2sql` / `ctx.r2sql` — wires `ctx.r2sql` onto ActionCtx only. */
1897
1897
  hasR2sql?: boolean;
1898
+ /** A `lunora/` source uses `@lunora/x402/pay` / `ctx.x402` — wires the agent-wallet pay rail onto ActionCtx only. */
1899
+ hasX402?: boolean;
1898
1900
  /**
1899
1901
  * The single `defineIdentity(...)` claim contract declared in
1900
1902
  * `lunora/identity.ts` (Plan 080). When present, `ctx.auth.getIdentity()`,
@@ -1926,6 +1928,7 @@ declare const emitServer: ({
1926
1928
  hasPayments,
1927
1929
  hasPipelines,
1928
1930
  hasR2sql,
1931
+ hasX402,
1929
1932
  identity,
1930
1933
  queues,
1931
1934
  schema,
@@ -1999,6 +2002,8 @@ interface EmitShardOptions {
1999
2002
  hasPipelines?: boolean;
2000
2003
  /** A `lunora/` source reads `ctx.r2sql` (R2 SQL) — wires `ctx.r2sql` onto the ActionCtx only. */
2001
2004
  hasR2sql?: boolean;
2005
+ /** A `lunora/` source reads `ctx.x402` — wires the agent-wallet pay rail onto the ActionCtx only. */
2006
+ hasX402?: boolean;
2002
2007
  maskMetadata?: MaskMetadataIR;
2003
2008
  /** Custom mutators declared via `defineMutator` in `lunora/mutators.ts` — wires the `isCustomMutator` push-protocol override. */
2004
2009
  mutators?: ReadonlyArray<MutatorIR>;
@@ -2030,6 +2035,7 @@ declare const emitShard: ({
2030
2035
  hasPayments,
2031
2036
  hasPipelines,
2032
2037
  hasR2sql,
2038
+ hasX402,
2033
2039
  maskMetadata,
2034
2040
  mutators,
2035
2041
  queues,
@@ -2136,6 +2142,8 @@ interface EmitAppOptions {
2136
2142
  hasVectors: boolean;
2137
2143
  /** App declares Cloudflare Workflows (`defineWorkflow`) → wire `options.workflowsClient` so the studio's workflow-instance proxy can reach the CF REST API. */
2138
2144
  hasWorkflow: boolean;
2145
+ /** App uses `@lunora/x402/pay` / `ctx.x402` → emit `.x402()` (wire the agent-wallet pay rail). */
2146
+ hasX402: boolean;
2139
2147
  /** The single `defineIdentity(...)` contract in `lunora/identity.ts` (Plan 080) → import it as a VALUE and wire `options.identity`, so the runtime trust boundary validates every resolved identity before it becomes `ctx.auth`. `undefined` ⇒ no wiring, byte-identical output. */
2140
2148
  identity?: IdentityIR;
2141
2149
  /** Schema declares `.jurisdiction("…")` → pin every DO the worker reaches (shards, fan-out, scheduler, containers) to the Cloudflare data-residency jurisdiction. */
package/dist/index.mjs CHANGED
@@ -19,11 +19,11 @@ export { default as discoverSchema } from './packem_shared/discoverSchema-CeXJWV
19
19
  export { SHAPES_FILENAME, discoverShapes } from './packem_shared/SHAPES_FILENAME-DOhPGi-6.mjs';
20
20
  export { default as discoverStorageRulesMetadata } from './packem_shared/discoverStorageRulesMetadata-CFHByjIl.mjs';
21
21
  export { WORKFLOWS_FILENAME, discoverWorkflows } from './packem_shared/WORKFLOWS_FILENAME-CCC_42o3.mjs';
22
- export { G as GENERATED_HEADER, e as emitApi, a as emitCollections, b as emitContainers, c as emitCrons, d as emitDataModel, f as emitDrizzleSchema, g as emitFunctions, h as emitServer, i as emitShard, j as emitVectors, k as emitWorkflows, l as emitWranglerCronTriggers } from './packem_shared/emit-Bl3STBW9.mjs';
23
- export { emitApp } from './packem_shared/emitApp-CPfFyx9U.mjs';
24
- export { buildOpenApiDocument, emitOpenApi, emitOpenApiModule } from './packem_shared/buildOpenApiDocument-CYHG8Yuq.mjs';
25
- export { OPENRPC_VERSION, buildOpenRpcDocument, emitOpenRpc, emitOpenRpcModule } from './packem_shared/OPENRPC_VERSION-BUv-bV3M.mjs';
26
- export { SCHEMA_SNAPSHOT_FILENAME, createCodegenProject, refreshCodegenProject, runCodegen } from './packem_shared/SCHEMA_SNAPSHOT_FILENAME-CCiIKql3.mjs';
22
+ export { G as GENERATED_HEADER, e as emitApi, a as emitCollections, b as emitContainers, c as emitCrons, d as emitDataModel, f as emitDrizzleSchema, g as emitFunctions, h as emitServer, i as emitShard, j as emitVectors, k as emitWorkflows, l as emitWranglerCronTriggers } from './packem_shared/emit-G43y_pKR.mjs';
23
+ export { emitApp } from './packem_shared/emitApp-BgyRbMJU.mjs';
24
+ export { buildOpenApiDocument, emitOpenApi, emitOpenApiModule } from './packem_shared/buildOpenApiDocument-Bfq9qaTd.mjs';
25
+ export { OPENRPC_VERSION, buildOpenRpcDocument, emitOpenRpc, emitOpenRpcModule } from './packem_shared/OPENRPC_VERSION-Ca1zCt-A.mjs';
26
+ export { SCHEMA_SNAPSHOT_FILENAME, createCodegenProject, refreshCodegenProject, runCodegen } from './packem_shared/SCHEMA_SNAPSHOT_FILENAME-CTuUa9Ox.mjs';
27
27
  export { SCHEMA_SNAPSHOT_VERSION, SchemaSnapshotParseError, buildSchemaSnapshot, diffSchemaSnapshots, evaluateSchemaDrift, parseSchemaSnapshot, serializeSchemaSnapshot } from './packem_shared/SCHEMA_SNAPSHOT_VERSION-D0ARY6rL.mjs';
28
28
  export { schemaFromIr } from './packem_shared/schemaFromIr-DTYsLBaA.mjs';
29
29
  export { LUNORA_ERROR_CODES, validatorIrToJsonSchema } from './packem_shared/LUNORA_ERROR_CODES-CySpQPD3.mjs';
@@ -1,3 +1,3 @@
1
1
  import '@lunora/errors';
2
- export { G as GENERATED_HEADER, m as buildStorageColumns, e as emitApi, a as emitCollections, b as emitContainers, c as emitCrons, d as emitDataModel, f as emitDrizzleSchema, g as emitFunctions, n as emitQueues, o as emitSeed, h as emitServer, i as emitShard, j as emitVectors, k as emitWorkflows, l as emitWranglerCronTriggers } from './emit-Bl3STBW9.mjs';
2
+ export { G as GENERATED_HEADER, m as buildStorageColumns, e as emitApi, a as emitCollections, b as emitContainers, c as emitCrons, d as emitDataModel, f as emitDrizzleSchema, g as emitFunctions, n as emitQueues, o as emitSeed, h as emitServer, i as emitShard, j as emitVectors, k as emitWorkflows, l as emitWranglerCronTriggers } from './emit-G43y_pKR.mjs';
3
3
  import './paths-BRd6JHuF.mjs';
@@ -1,4 +1,4 @@
1
- import { G as GENERATED_HEADER } from './emit-Bl3STBW9.mjs';
1
+ import { G as GENERATED_HEADER } from './emit-G43y_pKR.mjs';
2
2
  import { s as sanitizeNamespace } from './paths-BRd6JHuF.mjs';
3
3
  import { argsObjectSchema, LUNORA_ERROR_CODES } from './LUNORA_ERROR_CODES-CySpQPD3.mjs';
4
4
 
@@ -9,7 +9,7 @@ import discoverAuthApiCalls from './discoverAuthApiCalls-URDoTADN.mjs';
9
9
  import { discoverContainers } from './CONTAINERS_FILENAME-DjpXMqhp.mjs';
10
10
  import discoverCrons from './discoverCrons-BNL5hAPv.mjs';
11
11
  import { diagnosticAt } from './CodegenDiagnosticError-DyQ5FwkM.mjs';
12
- import { C as CAPABILITIES, m as buildStorageColumns, d as emitDataModel, e as emitApi, h as emitServer, g as emitFunctions, i as emitShard, a as emitCollections, b as emitContainers, k as emitWorkflows, n as emitQueues, c as emitCrons, j as emitVectors, f as emitDrizzleSchema, o as emitSeed, l as emitWranglerCronTriggers } from './emit-Bl3STBW9.mjs';
12
+ import { C as CAPABILITIES, m as buildStorageColumns, d as emitDataModel, e as emitApi, h as emitServer, g as emitFunctions, i as emitShard, a as emitCollections, b as emitContainers, k as emitWorkflows, n as emitQueues, c as emitCrons, j as emitVectors, f as emitDrizzleSchema, o as emitSeed, l as emitWranglerCronTriggers } from './emit-G43y_pKR.mjs';
13
13
  import { discoverFlagKeys } from './FLAGS_FILENAME-BjpS5w08.mjs';
14
14
  import discoverHttpRoutes from './discoverHttpRoutes-CcwP-Rkr.mjs';
15
15
  import discoverInserts from './discoverInserts-BpFhM32L.mjs';
@@ -27,9 +27,9 @@ import { discoverShapes } from './SHAPES_FILENAME-DOhPGi-6.mjs';
27
27
  import discoverStorageRulesMetadata from './discoverStorageRulesMetadata-CFHByjIl.mjs';
28
28
  import { e as enclosingExportName$2 } from './discover-ast-CT6BgBr4.mjs';
29
29
  import { discoverWorkflows } from './WORKFLOWS_FILENAME-CCC_42o3.mjs';
30
- import { emitApp } from './emitApp-CPfFyx9U.mjs';
31
- import { buildOpenApiDocument, emitOpenApiModule } from './buildOpenApiDocument-CYHG8Yuq.mjs';
32
- import { buildOpenRpcDocument, emitOpenRpcModule } from './OPENRPC_VERSION-BUv-bV3M.mjs';
30
+ import { emitApp } from './emitApp-BgyRbMJU.mjs';
31
+ import { buildOpenApiDocument, emitOpenApiModule } from './buildOpenApiDocument-Bfq9qaTd.mjs';
32
+ import { buildOpenRpcDocument, emitOpenRpcModule } from './OPENRPC_VERSION-Ca1zCt-A.mjs';
33
33
  import { buildSchemaSnapshot, serializeSchemaSnapshot } from './SCHEMA_SNAPSHOT_VERSION-D0ARY6rL.mjs';
34
34
 
35
35
  const HTTP_VERBS$1 = /* @__PURE__ */ new Set(["delete", "get", "head", "options", "patch", "post", "put"]);
@@ -3221,6 +3221,7 @@ const runCodegen = (options) => {
3221
3221
  const hasAnalytics = featureUsage.analytics;
3222
3222
  const hasPipelines = featureUsage.pipelines;
3223
3223
  const hasR2sql = featureUsage.r2sql;
3224
+ const hasX402 = featureUsage.x402;
3224
3225
  const dependencies = discoverPackageDependencies(options.projectRoot);
3225
3226
  const studioFeatures = buildStudioFeatures(featureUsage, {
3226
3227
  containerCount: containers.length,
@@ -3250,6 +3251,7 @@ const runCodegen = (options) => {
3250
3251
  hasPayments,
3251
3252
  hasPipelines,
3252
3253
  hasR2sql,
3254
+ hasX402,
3253
3255
  identity,
3254
3256
  queues,
3255
3257
  schema,
@@ -3274,6 +3276,7 @@ const runCodegen = (options) => {
3274
3276
  hasPayments,
3275
3277
  hasPipelines,
3276
3278
  hasR2sql,
3279
+ hasX402,
3277
3280
  maskMetadata,
3278
3281
  mutators,
3279
3282
  queues,
@@ -3324,6 +3327,7 @@ const runCodegen = (options) => {
3324
3327
  hasStorage: studioFeatures.storage,
3325
3328
  hasVectors: schema.vectorIndexes.length > 0,
3326
3329
  hasWorkflow: workflows.length > 0,
3330
+ hasX402,
3327
3331
  // The single `defineIdentity(...)` contract (Plan 080). Wires
3328
3332
  // `options.identity` so the runtime trust boundary validates every
3329
3333
  // resolved identity before it becomes `ctx.auth`; `undefined` keeps the
@@ -1,4 +1,4 @@
1
- import { G as GENERATED_HEADER } from './emit-Bl3STBW9.mjs';
1
+ import { G as GENERATED_HEADER } from './emit-G43y_pKR.mjs';
2
2
  import { s as sanitizeNamespace } from './paths-BRd6JHuF.mjs';
3
3
  import { LUNORA_ERROR_CODES, objectSchema, argsObjectSchema, validatorIrToJsonSchema } from './LUNORA_ERROR_CODES-CySpQPD3.mjs';
4
4
 
@@ -110,6 +110,20 @@ const CAPABILITY_ROWS = [
110
110
  key: "payments",
111
111
  moduleSpecifier: "@lunora/payment"
112
112
  },
113
+ // `ctx.x402` — the x402 agent-wallet pay rail. ActionCtx ONLY: it signs and
114
+ // settles real USDC over the network per request. Like `payments`, its ctx
115
+ // field is bespoke (a lazily-built, per-run-metered rail), so no
116
+ // `serverCtxField` — `emit.ts` hand-wires it.
117
+ {
118
+ appMethod: {
119
+ configKey: "x402",
120
+ doc: "Wire the x402 agent-wallet pay rail backing `ctx.x402` — a payment-enabled `fetch` that answers `402` challenges under a mandatory spend policy (ActionCtx-only; spends real funds).",
121
+ method: "x402"
122
+ },
123
+ contextProperty: "x402",
124
+ key: "x402",
125
+ moduleSpecifier: "@lunora/x402/pay"
126
+ },
113
127
  // Pipelines is its own `@lunora/bindings/pipelines` subpath (distinct from
114
128
  // `/analytics`), so a real import is a clean signal that won't be flipped by a
115
129
  // plain analytics import; `ctx.pipelines` reads flip it too.
@@ -927,6 +941,7 @@ const emitServer = ({
927
941
  hasPayments = false,
928
942
  hasPipelines = false,
929
943
  hasR2sql = false,
944
+ hasX402 = false,
930
945
  identity,
931
946
  queues = [],
932
947
  schema,
@@ -944,6 +959,10 @@ const emitServer = ({
944
959
  ` : "";
945
960
  const paymentsActionField = hasPayments ? `
946
961
  readonly payments: LunoraPayment;` : "";
962
+ const x402TypeImport = hasX402 ? `import type { X402Pay } from "@lunora/x402/pay";
963
+ ` : "";
964
+ const x402ActionField = hasX402 ? `
965
+ readonly x402: X402Pay;` : "";
947
966
  const containersTypeImport = containers.length > 0 ? `import type { ContainerAccessor } from "@lunora/container";
948
967
  ` : "";
949
968
  const containersActionField = containers.length > 0 ? `
@@ -1082,7 +1101,7 @@ import type {
1082
1101
  } from "${base.server}";
1083
1102
 
1084
1103
  import type { DataModel, DatabaseReaderFacade, DatabaseWriterFacade, Doc, Id as IdOfTable, OrmReader, OrmWriter, Relations, TableName } from "./dataModel.js";
1085
- ${aiTypeImport}${paymentsTypeImport}${containersTypeImport}${workflowsTypeImport}${queuesTypeImport}${identityTypeImport}${envTypeImport}
1104
+ ${aiTypeImport}${paymentsTypeImport}${x402TypeImport}${containersTypeImport}${workflowsTypeImport}${queuesTypeImport}${identityTypeImport}${envTypeImport}
1086
1105
  export type { DataModel, Doc, Id, TableName } from "./dataModel.js";
1087
1106
 
1088
1107
  /** Storage buckets this schema declares (\`v.storage("name")\`), narrowing \`ctx.storage.bucket(name)\`. */
@@ -1130,7 +1149,7 @@ export interface MutationCtx extends Omit<MutationCtxBase, "db" | "storage"${wor
1130
1149
  export interface ActionCtx extends Omit<ActionCtxBase, "db" | "storage"${workflowsOmit}${authOmit}${envOmit}> {
1131
1150
  readonly db: Omit<DatabaseWriter, "query" | "get"> & DatabaseWriterFacade & { query: TypedTableQuery; get: TypedTableGet };
1132
1151
  readonly orm: OrmWriter;
1133
- readonly storage: StorageBase<StorageBucketName>;${accessContextField}${aiActionField}${paymentsActionField}${containersActionField}${kvContextField}${flagsContextField}${hyperdriveActionField}${browserActionField}${imagesActionField}${analyticsContextField}${pipelinesActionField}${r2sqlActionField}${envContextField}${workflowsContextField}${queuesContextField}${authContextField}
1152
+ readonly storage: StorageBase<StorageBucketName>;${accessContextField}${aiActionField}${paymentsActionField}${x402ActionField}${containersActionField}${kvContextField}${flagsContextField}${hyperdriveActionField}${browserActionField}${imagesActionField}${analyticsContextField}${pipelinesActionField}${r2sqlActionField}${envContextField}${workflowsContextField}${queuesContextField}${authContextField}
1134
1153
  }
1135
1154
 
1136
1155
  /**
@@ -2133,6 +2152,32 @@ const paymentStub: LunoraPayment = {
2133
2152
  `
2134
2153
  };
2135
2154
  };
2155
+ const emitX402Fragments = (hasX402) => {
2156
+ if (!hasX402) {
2157
+ return { build: "", configField: "", contextField: "", imports: [], stub: "" };
2158
+ }
2159
+ return {
2160
+ imports: [`import type { X402Pay, X402PayConfig } from "@lunora/x402/pay";`, `import { lazyX402Pay } from "@lunora/x402/pay";`],
2161
+ // Built lazily off `secrets` (the Secrets Store facade already in scope) and
2162
+ // the `config.x402` thunk over env; falls back to `x402Stub`.
2163
+ build: `
2164
+ const x402: X402Pay = config.x402
2165
+ ? lazyX402Pay(config.x402(env), { getSecret: (name: string) => secrets.get(name) })
2166
+ : x402Stub;
2167
+ `,
2168
+ configField: `
2169
+ x402?: (env: Record<string, unknown>) => X402PayConfig;`,
2170
+ contextField: `
2171
+ x402,`,
2172
+ stub: `
2173
+ const x402Stub: X402Pay = {
2174
+ fetch: () => {
2175
+ throw new Error("ctx.x402: no pay rail configured. Pass \\\`x402\\\` to createShardDO().");
2176
+ },
2177
+ } as unknown as X402Pay;
2178
+ `
2179
+ };
2180
+ };
2136
2181
  const buildDoTypeImports = (hasVectors, hasWorkflows, hasQueues, hasFlags) => [
2137
2182
  "AdvisoryFinding",
2138
2183
  "DatabaseWriterLike",
@@ -2176,6 +2221,7 @@ const emitShard = ({
2176
2221
  hasPayments = false,
2177
2222
  hasPipelines = false,
2178
2223
  hasR2sql = false,
2224
+ hasX402 = false,
2179
2225
  maskMetadata,
2180
2226
  mutators = [],
2181
2227
  queues = [],
@@ -2222,6 +2268,7 @@ const emitShard = ({
2222
2268
  imports: paymentsImports,
2223
2269
  stub: paymentStub
2224
2270
  } = emitPaymentFragments(hasPayments);
2271
+ const { build: x402Build, configField: x402ConfigField, imports: x402Imports, stub: x402Stub } = emitX402Fragments(hasX402);
2225
2272
  const advisoryData = advisories;
2226
2273
  const rlsData = rlsMetadata ?? { policies: [], roles: [] };
2227
2274
  const maskData = maskMetadata ?? { columns: [] };
@@ -2361,6 +2408,7 @@ const LUNORA_RLS_READ_REGISTRY = buildRlsReadRegistry(Object.values(LUNORA_FUNCT
2361
2408
  ...workflowImportLines,
2362
2409
  ...queueImportLines,
2363
2410
  ...paymentsImports,
2411
+ ...x402Imports,
2364
2412
  ``,
2365
2413
  `import schema from "../schema.js";`,
2366
2414
  // Local-first sync registries are pulled in alongside the function table
@@ -2649,17 +2697,18 @@ ${schema.tables.map(
2649
2697
  const everyContextBuild = `${accessFragments.build}${kvFragments.build}${flagsFragments.build}${analyticsFragments.build}${envFragments.build}${secretsBuild}`;
2650
2698
  const everyContextField = `${accessFragments.contextField}${kvFragments.contextField}${flagsFragments.contextField}${analyticsFragments.contextField}${envFragments.contextField}
2651
2699
  secrets,`;
2652
- const actionOnlyHasAny = hasImages || hasHyperdrive || hasBrowser || hasR2sql || hasPipelines;
2700
+ const actionOnlyHasAny = hasImages || hasHyperdrive || hasBrowser || hasR2sql || hasPipelines || hasX402;
2653
2701
  const actionOnlyBlock = actionOnlyHasAny ? `
2654
2702
  // ActionCtx-only helpers (external, non-deterministic I/O): constructed
2655
2703
  // and attached only for an \`action\` so query/mutation ctx never carry them.
2656
2704
  if (isAction) {
2657
- ${imagesFragments.build}${hyperdriveFragments.build}${browserFragments.build}${r2sqlFragments.build}${pipelinesFragments.build}${[
2705
+ ${imagesFragments.build}${hyperdriveFragments.build}${browserFragments.build}${r2sqlFragments.build}${pipelinesFragments.build}${x402Build}${[
2658
2706
  ...hasImages ? [" ctx.images = images;"] : [],
2659
2707
  ...hasHyperdrive ? [" ctx.sql = sql;"] : [],
2660
2708
  ...hasBrowser ? [" ctx.browser = browser;"] : [],
2661
2709
  ...hasR2sql ? [" ctx.r2sql = r2sql;"] : [],
2662
- ...hasPipelines ? [" ctx.pipelines = pipelines;"] : []
2710
+ ...hasPipelines ? [" ctx.pipelines = pipelines;"] : [],
2711
+ ...hasX402 ? [" ctx.x402 = x402;"] : []
2663
2712
  ].join("\n")}
2664
2713
  }
2665
2714
  ` : "";
@@ -2706,7 +2755,7 @@ export interface ShardDOConfig {
2706
2755
  /** Optional telemetry sink. When supplied, each \`ctx.log.*\` call is forwarded to \`sink.onLog\`. Pass the SAME sink you give \`createWorker({ observability })\` (which drives \`onRpc\`) to route both RPC and log events. */
2707
2756
  observability?: (env: Record<string, unknown>) => LogSink | undefined;
2708
2757
  scheduler?: (env: Record<string, unknown>) => unknown;
2709
- storage?: (env: Record<string, unknown>) => unknown;${vectorsConfigField}${aiConfigField}${kvFragments.configField}${flagsFragments.configField}${analyticsFragments.configField}${imagesFragments.configField}${hyperdriveFragments.configField}${browserFragments.configField}${r2sqlFragments.configField}${pipelinesFragments.configField}${paymentsConfigField}${d1ConfigField}${hyperdriveGlobalConfigField}${sourceClientConfigField}
2758
+ storage?: (env: Record<string, unknown>) => unknown;${vectorsConfigField}${aiConfigField}${kvFragments.configField}${flagsFragments.configField}${analyticsFragments.configField}${imagesFragments.configField}${hyperdriveFragments.configField}${browserFragments.configField}${r2sqlFragments.configField}${pipelinesFragments.configField}${paymentsConfigField}${x402ConfigField}${d1ConfigField}${hyperdriveGlobalConfigField}${sourceClientConfigField}
2710
2759
  }
2711
2760
 
2712
2761
  const schedulerStub = {
@@ -2744,7 +2793,7 @@ const storageStub = {
2744
2793
  throw new Error("ctx.storage: no storage configured. Pass \`storage\` to createShardDO().");
2745
2794
  },
2746
2795
  };
2747
- ${globalDatabaseStub}${sourceClientCacheConst}${vectorsStub}${aiStub}${kvFragments.stub}${flagsFragments.stub}${analyticsFragments.stub}${imagesFragments.stub}${hyperdriveFragments.stub}${browserFragments.stub}${r2sqlFragments.stub}${pipelinesFragments.stub}${paymentStub}${bindTableHelper}
2796
+ ${globalDatabaseStub}${sourceClientCacheConst}${vectorsStub}${aiStub}${kvFragments.stub}${flagsFragments.stub}${analyticsFragments.stub}${imagesFragments.stub}${hyperdriveFragments.stub}${browserFragments.stub}${r2sqlFragments.stub}${pipelinesFragments.stub}${paymentStub}${x402Stub}${bindTableHelper}
2748
2797
  // Bound in-process \`ctx.run*\` composition depth so a self- or cyclically-
2749
2798
  // referencing call fails loudly with a clear error instead of overflowing the
2750
2799
  // stack. Tracked across the awaited handler chain (one DO invocation is
@@ -1,4 +1,4 @@
1
- import { A as APP_METHOD_CAPABILITIES, G as GENERATED_HEADER } from './emit-Bl3STBW9.mjs';
1
+ import { A as APP_METHOD_CAPABILITIES, G as GENERATED_HEADER } from './emit-G43y_pKR.mjs';
2
2
 
3
3
  const hasFlagKey = (key) => `has${key.charAt(0).toUpperCase()}${key.slice(1)}`;
4
4
  const LONG_TAIL = APP_METHOD_CAPABILITIES.map(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lunora/codegen",
3
- "version": "1.0.0-alpha.37",
3
+ "version": "1.0.0-alpha.39",
4
4
  "description": "Code generator for Lunora: emits _generated/{api,server,dataModel}.ts from your schema",
5
5
  "keywords": [
6
6
  "cloudflare",
@@ -46,13 +46,13 @@
46
46
  "access": "public"
47
47
  },
48
48
  "dependencies": {
49
- "@lunora/advisor": "1.0.0-alpha.23",
50
- "@lunora/container": "1.0.0-alpha.7",
51
- "@lunora/errors": "1.0.0-alpha.2",
52
- "@lunora/queue": "1.0.0-alpha.5",
53
- "@lunora/scheduler": "1.0.0-alpha.6",
54
- "@lunora/values": "1.0.0-alpha.5",
55
- "@lunora/workflow": "1.0.0-alpha.7",
49
+ "@lunora/advisor": "1.0.0-alpha.25",
50
+ "@lunora/container": "1.0.0-alpha.8",
51
+ "@lunora/errors": "1.0.0-alpha.3",
52
+ "@lunora/queue": "1.0.0-alpha.6",
53
+ "@lunora/scheduler": "1.0.0-alpha.7",
54
+ "@lunora/values": "1.0.0-alpha.6",
55
+ "@lunora/workflow": "1.0.0-alpha.8",
56
56
  "ts-morph": "^28.0.0"
57
57
  },
58
58
  "engines": {