@lunora/codegen 1.0.0-alpha.270 → 1.0.0-alpha.271

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
@@ -2482,6 +2482,7 @@ declare const CAPABILITY_ROWS: readonly [{
2482
2482
  readonly doc: "Override the Workers AI binding backing `ctx.ai` (defaults to `env.AI`).";
2483
2483
  readonly method: "ai";
2484
2484
  };
2485
+ readonly bindingFreeExports: readonly ["DEFAULT_MODEL_PRICES", "estimateModelCost", "lookupModelPrice"];
2485
2486
  readonly contextProperty: "ai";
2486
2487
  readonly key: "ai";
2487
2488
  readonly moduleSpecifier: "@lunora/ai";
@@ -2635,6 +2636,7 @@ declare const CAPABILITY_ROWS: readonly [{
2635
2636
  readonly doc: "Override the Images binding backing `ctx.images` (defaults to `env.IMAGES`).";
2636
2637
  readonly method: "images";
2637
2638
  };
2639
+ readonly bindingFreeExports: readonly ["buildImageDeliveryUrl", "buildSignedImageUrl", "parseSignedTransform", "verifySignedImageUrl"];
2638
2640
  readonly contextProperty: "images";
2639
2641
  readonly key: "images";
2640
2642
  readonly moduleSpecifier: "@lunora/bindings/images";
@@ -2660,6 +2662,7 @@ declare const CAPABILITY_ROWS: readonly [{
2660
2662
  readonly doc: "Override the Workers KV binding backing `ctx.kv` (defaults to `env.KV`).";
2661
2663
  readonly method: "kv";
2662
2664
  };
2665
+ readonly bindingFreeExports: readonly ["scopeKey"];
2663
2666
  readonly contextProperty: "kv";
2664
2667
  readonly key: "kv";
2665
2668
  readonly moduleSpecifier: "@lunora/bindings/kv";
@@ -2746,10 +2749,12 @@ declare const CAPABILITY_ROWS: readonly [{
2746
2749
  readonly shardBinding: "bespoke";
2747
2750
  readonly tier: "action";
2748
2751
  }, {
2752
+ readonly bindingFreeExports: readonly ["assertValidCronExpression", "isValidCronExpression"];
2749
2753
  readonly contextProperty: "scheduler";
2750
2754
  readonly key: "scheduler";
2751
2755
  readonly moduleSpecifier: "@lunora/scheduler";
2752
2756
  }, {
2757
+ readonly bindingFreeExports: readonly ["buildPresignedUrl", "buildSignedUrl", "scopeKey", "verifySignedUrl"];
2753
2758
  readonly contextProperty: "storage";
2754
2759
  readonly key: "storage";
2755
2760
  readonly moduleSpecifier: "@lunora/storage";
@@ -2818,7 +2823,11 @@ interface SourceCapabilitySignals {
2818
2823
  dynamicImports: ReadonlySet<string>;
2819
2824
  /** The `@lunora/agent` sandbox tools the file value-imports — the same reading as `discoverSandboxUsage`. */
2820
2825
  sandboxTools: Readonly<SandboxUsage>;
2821
- /** Module specifiers of the file's static imports and re-exports (`export … from "…"`) that survive compilation — see {@link compilesAway}. */
2826
+ /**
2827
+ * Module specifiers of the file's static imports and re-exports (`export … from "…"`)
2828
+ * that survive compilation ({@link compilesAway}) and name more than binding-free
2829
+ * helpers ({@link namesOnlyBindingFreeExports}).
2830
+ */
2822
2831
  valueImports: ReadonlySet<string>;
2823
2832
  }
2824
2833
  /**
package/dist/index.d.ts CHANGED
@@ -2482,6 +2482,7 @@ declare const CAPABILITY_ROWS: readonly [{
2482
2482
  readonly doc: "Override the Workers AI binding backing `ctx.ai` (defaults to `env.AI`).";
2483
2483
  readonly method: "ai";
2484
2484
  };
2485
+ readonly bindingFreeExports: readonly ["DEFAULT_MODEL_PRICES", "estimateModelCost", "lookupModelPrice"];
2485
2486
  readonly contextProperty: "ai";
2486
2487
  readonly key: "ai";
2487
2488
  readonly moduleSpecifier: "@lunora/ai";
@@ -2635,6 +2636,7 @@ declare const CAPABILITY_ROWS: readonly [{
2635
2636
  readonly doc: "Override the Images binding backing `ctx.images` (defaults to `env.IMAGES`).";
2636
2637
  readonly method: "images";
2637
2638
  };
2639
+ readonly bindingFreeExports: readonly ["buildImageDeliveryUrl", "buildSignedImageUrl", "parseSignedTransform", "verifySignedImageUrl"];
2638
2640
  readonly contextProperty: "images";
2639
2641
  readonly key: "images";
2640
2642
  readonly moduleSpecifier: "@lunora/bindings/images";
@@ -2660,6 +2662,7 @@ declare const CAPABILITY_ROWS: readonly [{
2660
2662
  readonly doc: "Override the Workers KV binding backing `ctx.kv` (defaults to `env.KV`).";
2661
2663
  readonly method: "kv";
2662
2664
  };
2665
+ readonly bindingFreeExports: readonly ["scopeKey"];
2663
2666
  readonly contextProperty: "kv";
2664
2667
  readonly key: "kv";
2665
2668
  readonly moduleSpecifier: "@lunora/bindings/kv";
@@ -2746,10 +2749,12 @@ declare const CAPABILITY_ROWS: readonly [{
2746
2749
  readonly shardBinding: "bespoke";
2747
2750
  readonly tier: "action";
2748
2751
  }, {
2752
+ readonly bindingFreeExports: readonly ["assertValidCronExpression", "isValidCronExpression"];
2749
2753
  readonly contextProperty: "scheduler";
2750
2754
  readonly key: "scheduler";
2751
2755
  readonly moduleSpecifier: "@lunora/scheduler";
2752
2756
  }, {
2757
+ readonly bindingFreeExports: readonly ["buildPresignedUrl", "buildSignedUrl", "scopeKey", "verifySignedUrl"];
2753
2758
  readonly contextProperty: "storage";
2754
2759
  readonly key: "storage";
2755
2760
  readonly moduleSpecifier: "@lunora/storage";
@@ -2818,7 +2823,11 @@ interface SourceCapabilitySignals {
2818
2823
  dynamicImports: ReadonlySet<string>;
2819
2824
  /** The `@lunora/agent` sandbox tools the file value-imports — the same reading as `discoverSandboxUsage`. */
2820
2825
  sandboxTools: Readonly<SandboxUsage>;
2821
- /** Module specifiers of the file's static imports and re-exports (`export … from "…"`) that survive compilation — see {@link compilesAway}. */
2826
+ /**
2827
+ * Module specifiers of the file's static imports and re-exports (`export … from "…"`)
2828
+ * that survive compilation ({@link compilesAway}) and name more than binding-free
2829
+ * helpers ({@link namesOnlyBindingFreeExports}).
2830
+ */
2822
2831
  valueImports: ReadonlySet<string>;
2823
2832
  }
2824
2833
  /**
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- import{SCHEMA_SNAPSHOT_VERSION as t,diffSchemaSnapshots as a,serializeSchemaSnapshot as s}from"./packem_shared/SCHEMA_SNAPSHOT_VERSION-C0oHwiJZ.mjs";import{formatAdvisories as m,lintSchema as f,toAdvisorContext as d}from"./packem_shared/formatAdvisories-DwmUKYuc.mjs";import{describeErrorLevelFindings as l,errorAdvisoryNames as n,errorPlatformDiagnosticNames as c,sortedUniqueNames as x}from"./packem_shared/describeErrorLevelFindings-vzaGS9KL.mjs";import{CAPABILITY_PROBES as E}from"./packem_shared/CAPABILITY_PROBES-DFsutD7g.mjs";import{CodegenDiagnosticError as A,diagnosticAt as v}from"./packem_shared/CodegenDiagnosticError-BUXlG3P-.mjs";import{AGENTS_FILENAME as C,discoverAgents as N}from"./packem_shared/AGENTS_FILENAME-lBe4g_sU.mjs";import{isTestPath as R,listLunoraSourceFiles as T}from"./packem_shared/isTestPath-DCyIyPa7.mjs";import{default as h}from"./packem_shared/discoverAuthApiCalls-TA2a8bZI.mjs";import{CONTAINERS_FILENAME as L,discoverContainers as M}from"./packem_shared/CONTAINERS_FILENAME-CY43AXXN.mjs";import{default as P}from"./packem_shared/discoverCrons-PQeDYVPc.mjs";import{capabilitiesUsedBy as b,foldCapabilitySignals as U,mayReadCapabilityContext as y,sourceCapabilitySignals as G}from"./packem_shared/capabilitiesUsedBy-DKQfzdUf.mjs";import{FLAGS_FILENAME as j,discoverFlags as B}from"./packem_shared/FLAGS_FILENAME-DXltN9DD.mjs";import{default as W}from"./packem_shared/discoverFunctions-4sef11AC.mjs";import{default as V}from"./packem_shared/discoverHttpRoutes-CLGXL19M.mjs";import{default as Q}from"./packem_shared/discoverHyperdriveCalls-imtma-ic.mjs";import{default as w}from"./packem_shared/discoverInserts-CKEO1mZZ.mjs";import{d as Y}from"./packem_shared/index-CRO3TRxd.mjs";import{default as Z}from"./packem_shared/discoverMigrations-DYQbnqow.mjs";import{MUTATORS_FILENAME as ee,discoverMutators as re}from"./packem_shared/MUTATORS_FILENAME-BxRrG_s-.mjs";import{default as te}from"./packem_shared/discoverNondeterministicCalls-BfdM93-8.mjs";import{NOTIFY_FILENAME as se,discoverNotifyCalls as ie,discoverNotifyConfig as me}from"./packem_shared/NOTIFY_FILENAME-J5MGAkca.mjs";import{default as de}from"./packem_shared/readPackageDependencies-RHhGiz0k.mjs";import{default as le}from"./packem_shared/discoverQueries-DEkIMaBP.mjs";import{QUEUES_FILENAME as ce,discoverQueues as xe}from"./packem_shared/QUEUES_FILENAME-C6us1zjh.mjs";import{default as Ee}from"./packem_shared/discoverR2sqlCalls-BRIyb8Cl.mjs";import{default as Ae}from"./packem_shared/discoverRlsProcedures-BtT8-r93.mjs";import{default as ge}from"./packem_shared/discoverRlsMetadata-rpiO4wSi.mjs";import{discoverSandboxUsage as Ne}from"./packem_shared/discoverSandboxUsage-B8P9QjWZ.mjs";import{default as Re}from"./packem_shared/discoverSchema-BdmC-kO2.mjs";import{readServiceBindings as _e,resolveServiceBindings as he}from"./packem_shared/readServiceBindings-DuE9xlvV.mjs";import{SHAPES_FILENAME as Le,discoverShapes as Me}from"./packem_shared/SHAPES_FILENAME-CeBFuc8M.mjs";import{default as Pe}from"./packem_shared/discoverStorageRulesMetadata-C2hYksmI.mjs";import{WORKFLOWS_FILENAME as be,discoverWorkflows as Ue}from"./packem_shared/WORKFLOWS_FILENAME-B47AB5pc.mjs";import{emitApp as Ge}from"./packem_shared/emitApp-CT3NRUF_.mjs";import{isD1GlobalTable as je,isHyperdriveGlobalTable as Be}from"./packem_shared/isD1GlobalTable-udvHAAzD.mjs";import{buildOpenApiDocument as We,emitOpenApi as Ke,emitOpenApiModule as Ve}from"./packem_shared/buildOpenApiDocument-6VJGU6fU.mjs";import{OPENRPC_VERSION as Qe,buildOpenRpcDocument as qe,emitOpenRpc as we,emitOpenRpcModule as Je}from"./packem_shared/OPENRPC_VERSION-B8RT1JYn.mjs";import{DEFAULT_TARGET as Xe,platformMatrixIds as Ze,readProjectTarget as $e,resolveCodegenTarget as er}from"./packem_shared/DEFAULT_TARGET-rlz3WdHe.mjs";import{l as or,r as tr}from"./packem_shared/project-config-file-Bv2l-Kmm.mjs";import{SCHEMA_SNAPSHOT_FILENAME as sr,createCodegenProject as ir,findTsconfig as mr,refreshCodegenProject as fr,runCodegen as dr}from"./packem_shared/SCHEMA_SNAPSHOT_FILENAME-B3gunaV8.mjs";import{SchemaSnapshotParseError as lr,buildSchemaSnapshot as nr,evaluateSchemaDrift as cr,parseSchemaSnapshot as xr}from"./packem_shared/SchemaSnapshotParseError-CPOXlFhI.mjs";import{default as Er}from"./packem_shared/fingerprintSchemaSources-ChYfrghz.mjs";import{schemaFromIr as Ar}from"./packem_shared/schemaFromIr-BWFnvCVg.mjs";import{LUNORA_ERROR_CODES as gr,validatorIrToJsonSchema as Cr}from"./packem_shared/LUNORA_ERROR_CODES-C2s0xWQD.mjs";import{SDK_LANGUAGES as Or,SDK_TARGETS as Rr,generateSdk as Tr}from"./packem_shared/SDK_LANGUAGES-Df_CnJx5.mjs";import{redact as hr,secretKindOf as Ir}from"./packem_shared/redact-Cy14LEnc.mjs";import{default as Mr}from"./packem_shared/emitDrizzleSchema-DohtnI8c.mjs";import{default as Pr}from"./packem_shared/emitFunctions-evl8Mx1a.mjs";import{default as br}from"./packem_shared/emitServer-DymRagL2.mjs";import{e as yr}from"./packem_shared/shard-DTJX0sDf.mjs";import{G as Hr}from"./packem_shared/shared-BXUKWh7t.mjs";import{MESSAGE_SOLUTIONS as Br,findSolutionByMessage as kr}from"@lunora/errors";import{PROJECT_CONFIG_FILENAMES as Kr,findProjectConfigFile as Vr}from"./packem_shared/PROJECT_CONFIG_FILENAMES-DzOu-lSc.mjs";import{s as Qr,t as qr,u as wr}from"./packem_shared/shard-runtime-BXp-lUsd.mjs";import{emitApi as Yr,emitCollections as Xr}from"./packem_shared/emitApi-xDIHPRPH.mjs";import{emitCrons as $r,emitScheduler as eo,emitVectors as ro,emitWranglerCronTriggers as oo}from"./packem_shared/emitCrons-DKeoaeqU.mjs";import{emitDataModel as ao}from"./packem_shared/emitDataModel-DSk9AkJe.mjs";import{isTypedSchema as io}from"./packem_shared/isTypedSchema-CKzc3ioR.mjs";const e="0.0.0";export{C as AGENTS_FILENAME,E as CAPABILITY_PROBES,L as CONTAINERS_FILENAME,A as CodegenDiagnosticError,Xe as DEFAULT_TARGET,j as FLAGS_FILENAME,Hr as GENERATED_HEADER,gr as LUNORA_ERROR_CODES,Br as LUNORA_SOLUTION_RULES,ee as MUTATORS_FILENAME,se as NOTIFY_FILENAME,Qe as OPENRPC_VERSION,Kr as PROJECT_CONFIG_FILENAMES,ce as QUEUES_FILENAME,sr as SCHEMA_SNAPSHOT_FILENAME,t as SCHEMA_SNAPSHOT_VERSION,Or as SDK_LANGUAGES,Rr as SDK_TARGETS,Le as SHAPES_FILENAME,lr as SchemaSnapshotParseError,e as VERSION,be as WORKFLOWS_FILENAME,We as buildOpenApiDocument,qe as buildOpenRpcDocument,nr as buildSchemaSnapshot,b as capabilitiesUsedBy,ir as createCodegenProject,l as describeErrorLevelFindings,v as diagnosticAt,a as diffSchemaSnapshots,N as discoverAgents,h as discoverAuthApiCalls,M as discoverContainers,P as discoverCrons,B as discoverFlags,W as discoverFunctions,V as discoverHttpRoutes,Q as discoverHyperdriveCalls,w as discoverInserts,Y as discoverMaskProcedures,Z as discoverMigrations,re as discoverMutators,te as discoverNondeterministicCalls,ie as discoverNotifyCalls,me as discoverNotifyConfig,le as discoverQueries,xe as discoverQueues,Ee as discoverR2sqlCalls,ge as discoverRlsMetadata,Ae as discoverRlsProcedures,Ne as discoverSandboxUsage,Re as discoverSchema,Me as discoverShapes,Pe as discoverStorageRulesMetadata,Ue as discoverWorkflows,Qr as emitAgents,Yr as emitApi,Ge as emitApp,Xr as emitCollections,qr as emitContainers,$r as emitCrons,ao as emitDataModel,Mr as emitDrizzleSchema,Pr as emitFunctions,Ke as emitOpenApi,Ve as emitOpenApiModule,we as emitOpenRpc,Je as emitOpenRpcModule,eo as emitScheduler,br as emitServer,yr as emitShard,ro as emitVectors,wr as emitWorkflows,oo as emitWranglerCronTriggers,n as errorAdvisoryNames,c as errorPlatformDiagnosticNames,cr as evaluateSchemaDrift,kr as findLunoraSolution,Vr as findProjectConfigFile,mr as findTsconfig,Er as fingerprintSchemaSources,U as foldCapabilitySignals,m as formatAdvisories,Tr as generateSdk,je as isD1GlobalTable,Be as isHyperdriveGlobalTable,R as isTestPath,io as isTypedSchema,f as lintSchema,T as listLunoraSourceFiles,or as loadProjectConfig,y as mayReadCapabilityContext,xr as parseSchemaSnapshot,Ze as platformMatrixIds,de as readPackageDependencies,tr as readProjectConfigLiterals,$e as readProjectTarget,_e as readServiceBindings,hr as redact,fr as refreshCodegenProject,er as resolveCodegenTarget,he as resolveServiceBindings,dr as runCodegen,Ar as schemaFromIr,Ir as secretKindOf,s as serializeSchemaSnapshot,x as sortedUniqueNames,G as sourceCapabilitySignals,d as toAdvisorContext,Cr as validatorIrToJsonSchema};
1
+ import{SCHEMA_SNAPSHOT_VERSION as t,diffSchemaSnapshots as a,serializeSchemaSnapshot as s}from"./packem_shared/SCHEMA_SNAPSHOT_VERSION-C0oHwiJZ.mjs";import{formatAdvisories as m,lintSchema as f,toAdvisorContext as d}from"./packem_shared/formatAdvisories-DwmUKYuc.mjs";import{describeErrorLevelFindings as l,errorAdvisoryNames as n,errorPlatformDiagnosticNames as c,sortedUniqueNames as x}from"./packem_shared/describeErrorLevelFindings-vzaGS9KL.mjs";import{CAPABILITY_PROBES as E}from"./packem_shared/CAPABILITY_PROBES-brcmKenl.mjs";import{CodegenDiagnosticError as A,diagnosticAt as v}from"./packem_shared/CodegenDiagnosticError-BUXlG3P-.mjs";import{AGENTS_FILENAME as C,discoverAgents as N}from"./packem_shared/AGENTS_FILENAME-lBe4g_sU.mjs";import{isTestPath as R,listLunoraSourceFiles as T}from"./packem_shared/isTestPath-DCyIyPa7.mjs";import{default as h}from"./packem_shared/discoverAuthApiCalls-TA2a8bZI.mjs";import{CONTAINERS_FILENAME as L,discoverContainers as M}from"./packem_shared/CONTAINERS_FILENAME-CY43AXXN.mjs";import{default as P}from"./packem_shared/discoverCrons-PQeDYVPc.mjs";import{capabilitiesUsedBy as b,foldCapabilitySignals as U,mayReadCapabilityContext as y,sourceCapabilitySignals as G}from"./packem_shared/capabilitiesUsedBy-DARbl-4Z.mjs";import{FLAGS_FILENAME as j,discoverFlags as B}from"./packem_shared/FLAGS_FILENAME-DXltN9DD.mjs";import{default as W}from"./packem_shared/discoverFunctions-4sef11AC.mjs";import{default as V}from"./packem_shared/discoverHttpRoutes-CLGXL19M.mjs";import{default as Q}from"./packem_shared/discoverHyperdriveCalls-imtma-ic.mjs";import{default as w}from"./packem_shared/discoverInserts-CKEO1mZZ.mjs";import{d as Y}from"./packem_shared/index-CRO3TRxd.mjs";import{default as Z}from"./packem_shared/discoverMigrations-DYQbnqow.mjs";import{MUTATORS_FILENAME as ee,discoverMutators as re}from"./packem_shared/MUTATORS_FILENAME-BxRrG_s-.mjs";import{default as te}from"./packem_shared/discoverNondeterministicCalls-BfdM93-8.mjs";import{NOTIFY_FILENAME as se,discoverNotifyCalls as ie,discoverNotifyConfig as me}from"./packem_shared/NOTIFY_FILENAME-J5MGAkca.mjs";import{default as de}from"./packem_shared/readPackageDependencies-RHhGiz0k.mjs";import{default as le}from"./packem_shared/discoverQueries-DEkIMaBP.mjs";import{QUEUES_FILENAME as ce,discoverQueues as xe}from"./packem_shared/QUEUES_FILENAME-C6us1zjh.mjs";import{default as Ee}from"./packem_shared/discoverR2sqlCalls-BRIyb8Cl.mjs";import{default as Ae}from"./packem_shared/discoverRlsProcedures-BtT8-r93.mjs";import{default as ge}from"./packem_shared/discoverRlsMetadata-rpiO4wSi.mjs";import{discoverSandboxUsage as Ne}from"./packem_shared/discoverSandboxUsage-B8P9QjWZ.mjs";import{default as Re}from"./packem_shared/discoverSchema-BdmC-kO2.mjs";import{readServiceBindings as _e,resolveServiceBindings as he}from"./packem_shared/readServiceBindings-DuE9xlvV.mjs";import{SHAPES_FILENAME as Le,discoverShapes as Me}from"./packem_shared/SHAPES_FILENAME-CeBFuc8M.mjs";import{default as Pe}from"./packem_shared/discoverStorageRulesMetadata-C2hYksmI.mjs";import{WORKFLOWS_FILENAME as be,discoverWorkflows as Ue}from"./packem_shared/WORKFLOWS_FILENAME-B47AB5pc.mjs";import{emitApp as Ge}from"./packem_shared/emitApp-BdVXkH7A.mjs";import{isD1GlobalTable as je,isHyperdriveGlobalTable as Be}from"./packem_shared/isD1GlobalTable-udvHAAzD.mjs";import{buildOpenApiDocument as We,emitOpenApi as Ke,emitOpenApiModule as Ve}from"./packem_shared/buildOpenApiDocument-6VJGU6fU.mjs";import{OPENRPC_VERSION as Qe,buildOpenRpcDocument as qe,emitOpenRpc as we,emitOpenRpcModule as Je}from"./packem_shared/OPENRPC_VERSION-B8RT1JYn.mjs";import{DEFAULT_TARGET as Xe,platformMatrixIds as Ze,readProjectTarget as $e,resolveCodegenTarget as er}from"./packem_shared/DEFAULT_TARGET-rlz3WdHe.mjs";import{l as or,r as tr}from"./packem_shared/project-config-file-Bv2l-Kmm.mjs";import{SCHEMA_SNAPSHOT_FILENAME as sr,createCodegenProject as ir,findTsconfig as mr,refreshCodegenProject as fr,runCodegen as dr}from"./packem_shared/SCHEMA_SNAPSHOT_FILENAME-BhC_TLfJ.mjs";import{SchemaSnapshotParseError as lr,buildSchemaSnapshot as nr,evaluateSchemaDrift as cr,parseSchemaSnapshot as xr}from"./packem_shared/SchemaSnapshotParseError-CPOXlFhI.mjs";import{default as Er}from"./packem_shared/fingerprintSchemaSources-ChYfrghz.mjs";import{schemaFromIr as Ar}from"./packem_shared/schemaFromIr-BWFnvCVg.mjs";import{LUNORA_ERROR_CODES as gr,validatorIrToJsonSchema as Cr}from"./packem_shared/LUNORA_ERROR_CODES-C2s0xWQD.mjs";import{SDK_LANGUAGES as Or,SDK_TARGETS as Rr,generateSdk as Tr}from"./packem_shared/SDK_LANGUAGES-Df_CnJx5.mjs";import{redact as hr,secretKindOf as Ir}from"./packem_shared/redact-Cy14LEnc.mjs";import{default as Mr}from"./packem_shared/emitDrizzleSchema-DohtnI8c.mjs";import{default as Pr}from"./packem_shared/emitFunctions-evl8Mx1a.mjs";import{default as br}from"./packem_shared/emitServer-ePSDJ972.mjs";import{e as yr}from"./packem_shared/shard-DvYJO-cH.mjs";import{G as Hr}from"./packem_shared/shared-BXUKWh7t.mjs";import{MESSAGE_SOLUTIONS as Br,findSolutionByMessage as kr}from"@lunora/errors";import{PROJECT_CONFIG_FILENAMES as Kr,findProjectConfigFile as Vr}from"./packem_shared/PROJECT_CONFIG_FILENAMES-DzOu-lSc.mjs";import{s as Qr,t as qr,u as wr}from"./packem_shared/shard-runtime-WWedZtLA.mjs";import{emitApi as Yr,emitCollections as Xr}from"./packem_shared/emitApi-xDIHPRPH.mjs";import{emitCrons as $r,emitScheduler as eo,emitVectors as ro,emitWranglerCronTriggers as oo}from"./packem_shared/emitCrons-DKeoaeqU.mjs";import{emitDataModel as ao}from"./packem_shared/emitDataModel-DSk9AkJe.mjs";import{isTypedSchema as io}from"./packem_shared/isTypedSchema-CKzc3ioR.mjs";const e="0.0.0";export{C as AGENTS_FILENAME,E as CAPABILITY_PROBES,L as CONTAINERS_FILENAME,A as CodegenDiagnosticError,Xe as DEFAULT_TARGET,j as FLAGS_FILENAME,Hr as GENERATED_HEADER,gr as LUNORA_ERROR_CODES,Br as LUNORA_SOLUTION_RULES,ee as MUTATORS_FILENAME,se as NOTIFY_FILENAME,Qe as OPENRPC_VERSION,Kr as PROJECT_CONFIG_FILENAMES,ce as QUEUES_FILENAME,sr as SCHEMA_SNAPSHOT_FILENAME,t as SCHEMA_SNAPSHOT_VERSION,Or as SDK_LANGUAGES,Rr as SDK_TARGETS,Le as SHAPES_FILENAME,lr as SchemaSnapshotParseError,e as VERSION,be as WORKFLOWS_FILENAME,We as buildOpenApiDocument,qe as buildOpenRpcDocument,nr as buildSchemaSnapshot,b as capabilitiesUsedBy,ir as createCodegenProject,l as describeErrorLevelFindings,v as diagnosticAt,a as diffSchemaSnapshots,N as discoverAgents,h as discoverAuthApiCalls,M as discoverContainers,P as discoverCrons,B as discoverFlags,W as discoverFunctions,V as discoverHttpRoutes,Q as discoverHyperdriveCalls,w as discoverInserts,Y as discoverMaskProcedures,Z as discoverMigrations,re as discoverMutators,te as discoverNondeterministicCalls,ie as discoverNotifyCalls,me as discoverNotifyConfig,le as discoverQueries,xe as discoverQueues,Ee as discoverR2sqlCalls,ge as discoverRlsMetadata,Ae as discoverRlsProcedures,Ne as discoverSandboxUsage,Re as discoverSchema,Me as discoverShapes,Pe as discoverStorageRulesMetadata,Ue as discoverWorkflows,Qr as emitAgents,Yr as emitApi,Ge as emitApp,Xr as emitCollections,qr as emitContainers,$r as emitCrons,ao as emitDataModel,Mr as emitDrizzleSchema,Pr as emitFunctions,Ke as emitOpenApi,Ve as emitOpenApiModule,we as emitOpenRpc,Je as emitOpenRpcModule,eo as emitScheduler,br as emitServer,yr as emitShard,ro as emitVectors,wr as emitWorkflows,oo as emitWranglerCronTriggers,n as errorAdvisoryNames,c as errorPlatformDiagnosticNames,cr as evaluateSchemaDrift,kr as findLunoraSolution,Vr as findProjectConfigFile,mr as findTsconfig,Er as fingerprintSchemaSources,U as foldCapabilitySignals,m as formatAdvisories,Tr as generateSdk,je as isD1GlobalTable,Be as isHyperdriveGlobalTable,R as isTestPath,io as isTypedSchema,f as lintSchema,T as listLunoraSourceFiles,or as loadProjectConfig,y as mayReadCapabilityContext,xr as parseSchemaSnapshot,Ze as platformMatrixIds,de as readPackageDependencies,tr as readProjectConfigLiterals,$e as readProjectTarget,_e as readServiceBindings,hr as redact,fr as refreshCodegenProject,er as resolveCodegenTarget,he as resolveServiceBindings,dr as runCodegen,Ar as schemaFromIr,Ir as secretKindOf,s as serializeSchemaSnapshot,x as sortedUniqueNames,G as sourceCapabilitySignals,d as toAdvisorContext,Cr as validatorIrToJsonSchema};
@@ -1,6 +1,6 @@
1
1
  const n=[{contextProperty:"access",key:"access",moduleSpecifier:"@lunora/cloudflare-access",requiredPackage:"@lunora/cloudflare-access",serverCtxField:`
2
2
  /** Verified Cloudflare Access identity — a synchronous facade over the resolved claims (email / groups / hasGroup / claims). Anonymous when no Access token is present. */
3
- readonly access: import("@lunora/cloudflare-access/context").AccessFacade;`,shardBinding:"bespoke",tier:"every"},{appMethod:{configKey:"ai",doc:"Override the Workers AI binding backing `ctx.ai` (defaults to `env.AI`).",method:"ai"},contextProperty:"ai",key:"ai",moduleSpecifier:"@lunora/ai",requiredPackage:"@lunora/ai",serverCtxField:`
3
+ readonly access: import("@lunora/cloudflare-access/context").AccessFacade;`,shardBinding:"bespoke",tier:"every"},{appMethod:{configKey:"ai",doc:"Override the Workers AI binding backing `ctx.ai` (defaults to `env.AI`).",method:"ai"},bindingFreeExports:["DEFAULT_MODEL_PRICES","estimateModelCost","lookupModelPrice"],contextProperty:"ai",key:"ai",moduleSpecifier:"@lunora/ai",requiredPackage:"@lunora/ai",serverCtxField:`
4
4
  readonly ai: import("@lunora/ai").LunoraAi;`,shardBinding:"bespoke",tier:"action"},{appMethod:{configKey:"aiSearch",doc:"Override the AI Search namespace binding backing `ctx.aiSearch` (defaults to `env.AI_SEARCH`).",method:"aiSearch"},contextProperty:"aiSearch",key:"aiSearch",moduleSpecifier:"@lunora/bindings/ai-search",requiredPackage:"@lunora/bindings",serverCtxField:'\n /** Cloudflare AI Search namespace (`ai_search_namespaces`): `.get(name)` an instance, then `search` / `chatCompletions`. Billed, non-deterministic network I/O — available only in actions. */\n readonly aiSearch: import("@lunora/bindings/ai-search").AiSearch;',shardBinding:{binding:{envName:"AI_SEARCH"},clientType:"AiSearch",missingMessage:"ctx.aiSearch: no AI Search binding found. Add an `ai_search_namespaces` binding (env.AI_SEARCH) to wrangler.jsonc, or point `defineApp().aiSearch((env) => …)` at yours.",stubMethods:["chatCompletions","create","delete","get","list","search"],syncStubMethods:["get"]},tier:"action"},{appMethod:{configKey:"analytics",doc:"Override the Analytics Engine dataset backing `ctx.analytics` (defaults to `env.ANALYTICS`).",method:"analytics"},contextProperty:"analytics",key:"analytics",moduleSpecifier:"@lunora/bindings/analytics",requiredPackage:"@lunora/bindings",serverCtxField:`
5
5
  /** Analytics Engine telemetry sink. Fire-and-forget and sampled; do not read it back in-handler. */
6
6
  readonly analytics: import("@lunora/bindings/analytics").AnalyticsClient;`,shardBinding:{binding:{bindingType:"AnalyticsEngineDatasetLike",envName:"ANALYTICS",factory:{name:"createAnalytics"}},clientType:"AnalyticsClient",missingMessage:"ctx.analytics: no Analytics Engine binding found. Add an `analytics_engine_datasets` binding (env.ANALYTICS) to wrangler.jsonc, or pass `analytics` to createShardDO().",stubMethods:["track","writeDataPoint"],syncStubMethods:["track","writeDataPoint"]},tier:"every"},{appMethod:{configKey:"analyticsSql",doc:"Override the Analytics SQL binding backing `ctx.analyticsSql` (defaults to `env.ANALYTICS_SQL`), e.g. `(env) => createAnalyticsSqlRest({ accountId, apiToken })` where the Worker has no `analytics` binding.",method:"analyticsSql"},contextProperty:"analyticsSql",key:"analyticsSql",moduleSpecifier:"@lunora/bindings/analytics-sql",requiredPackage:"@lunora/bindings",serverCtxField:`
@@ -11,9 +11,9 @@ const n=[{contextProperty:"access",key:"access",moduleSpecifier:"@lunora/cloudfl
11
11
  /**
12
12
  * External database access via Hyperdrive. Non-deterministic — available only in actions. Writes here are NOT tracked by Lunora live queries; subscriptions will not re-run on external DB changes.
13
13
  */
14
- readonly sql: import("@lunora/hyperdrive").SqlClient;`,shardBinding:{clientType:"SqlClient",instrument:"instrumentSql",missingMessage:"ctx.sql: provide a `sql` config thunk that builds a SqlClient from your driver, e.g. `sql: (env) => fromPostgresJs(postgres(env.HYPERDRIVE.connectionString))`.",stubMethods:["query"]},tier:"action"},{appMethod:{configKey:"images",doc:"Override the Images binding backing `ctx.images` (defaults to `env.IMAGES`).",method:"images"},contextProperty:"images",key:"images",moduleSpecifier:"@lunora/bindings/images",requiredPackage:"@lunora/bindings",serverCtxField:`
14
+ readonly sql: import("@lunora/hyperdrive").SqlClient;`,shardBinding:{clientType:"SqlClient",instrument:"instrumentSql",missingMessage:"ctx.sql: provide a `sql` config thunk that builds a SqlClient from your driver, e.g. `sql: (env) => fromPostgresJs(postgres(env.HYPERDRIVE.connectionString))`.",stubMethods:["query"]},tier:"action"},{appMethod:{configKey:"images",doc:"Override the Images binding backing `ctx.images` (defaults to `env.IMAGES`).",method:"images"},bindingFreeExports:["buildImageDeliveryUrl","buildSignedImageUrl","parseSignedTransform","verifySignedImageUrl"],contextProperty:"images",key:"images",moduleSpecifier:"@lunora/bindings/images",requiredPackage:"@lunora/bindings",serverCtxField:`
15
15
  /** Cloudflare Images transforms (resize/format/optimize). Non-deterministic — available only in actions. */
16
- readonly images: import("@lunora/bindings/images").Images;`,shardBinding:{binding:{bindingType:"ImagesBindingLike",envName:"IMAGES",factory:{name:"createImages",option:"binding"}},clientType:"Images",missingMessage:"ctx.images: no Images binding found. Add an `images` binding (env.IMAGES) to wrangler.jsonc, or pass `images` to createShardDO().",stubMethods:["info","transform"]},tier:"action"},{appMethod:{configKey:"kv",doc:"Override the Workers KV binding backing `ctx.kv` (defaults to `env.KV`).",method:"kv"},contextProperty:"kv",key:"kv",moduleSpecifier:"@lunora/bindings/kv",requiredPackage:"@lunora/bindings",serverCtxField:`
16
+ readonly images: import("@lunora/bindings/images").Images;`,shardBinding:{binding:{bindingType:"ImagesBindingLike",envName:"IMAGES",factory:{name:"createImages",option:"binding"}},clientType:"Images",missingMessage:"ctx.images: no Images binding found. Add an `images` binding (env.IMAGES) to wrangler.jsonc, or pass `images` to createShardDO().",stubMethods:["info","transform"]},tier:"action"},{appMethod:{configKey:"kv",doc:"Override the Workers KV binding backing `ctx.kv` (defaults to `env.KV`).",method:"kv"},bindingFreeExports:["scopeKey"],contextProperty:"kv",key:"kv",moduleSpecifier:"@lunora/bindings/kv",requiredPackage:"@lunora/bindings",serverCtxField:`
17
17
  readonly kv: import("@lunora/bindings/kv").Kv;`,shardBinding:{binding:{bindingType:"KVNamespaceLike",envName:"KV",factory:{name:"createKv",option:"namespace"},unvouchableReads:["get","getRaw","getWithMetadata","list"]},clientType:"Kv",missingMessage:"ctx.kv: no KV binding found. Add a `kv_namespaces` binding (env.KV) to wrangler.jsonc, or pass `kv` to createShardDO().",stubMethods:["delete","get","getRaw","getWithMetadata","list","put"]},tier:"every"},{key:"mail",moduleSpecifier:"@lunora/mail"},{contextProperty:"notify",key:"notify",moduleSpecifier:"@lunora/notify"},{appMethod:{configKey:"payment",doc:"Wire the payment options backing `ctx.payments`.",method:"payment"},contextProperty:"payments",key:"payments",moduleSpecifier:"@lunora/payment",requiredPackage:"@lunora/payment",serverCtxField:`
18
18
  readonly payments: import("@lunora/payment").LunoraPayment;`,tier:"action"},{appMethod:{configKey:"x402",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).",method:"x402"},contextProperty:"x402",key:"x402",moduleSpecifier:"@lunora/x402/pay",requiredPackage:"@lunora/x402",serverCtxField:`
19
19
  readonly x402: import("@lunora/x402/pay").X402Pay;`,shardBinding:"bespoke",tier:"action"},{contextProperty:"pipelines",key:"pipelines",moduleSpecifier:"@lunora/bindings/pipelines",requiredPackage:"@lunora/bindings",serverCtxField:`
@@ -22,4 +22,4 @@ const n=[{contextProperty:"access",key:"access",moduleSpecifier:"@lunora/cloudfl
22
22
  /**
23
23
  * R2 SQL over Apache Iceberg tables (window functions, DISTINCT, set operations). Non-deterministic — available only in actions. Reads here are NOT tracked by Lunora live queries.
24
24
  */
25
- readonly r2sql: import("@lunora/bindings/r2sql").R2SqlClient;`,shardBinding:"bespoke",tier:"action"},{contextProperty:"scheduler",key:"scheduler",moduleSpecifier:"@lunora/scheduler"},{contextProperty:"storage",key:"storage",moduleSpecifier:"@lunora/storage"},{contextProperty:"vectors",key:"vectors",moduleSpecifier:"@lunora/bindings/vectors"},{contextProperty:"workflows",key:"workflows",moduleSpecifier:"@lunora/workflow"}],a=n,r=n.flatMap(e=>"appMethod"in e?[{appMethod:e.appMethod,key:e.key}]:[]),o=Object.fromEntries(a.map(({contextProperty:e,key:i,moduleSpecifier:t})=>[i,{contextProperty:e,moduleSpecifier:t}])),s=e=>new Set(a.filter(i=>e[i.key]).map(i=>i.key));export{r as APP_METHOD_CAPABILITIES,a as CAPABILITIES,o as CAPABILITY_PROBES,s as usedCapabilities};
25
+ readonly r2sql: import("@lunora/bindings/r2sql").R2SqlClient;`,shardBinding:"bespoke",tier:"action"},{bindingFreeExports:["assertValidCronExpression","isValidCronExpression"],contextProperty:"scheduler",key:"scheduler",moduleSpecifier:"@lunora/scheduler"},{bindingFreeExports:["buildPresignedUrl","buildSignedUrl","scopeKey","verifySignedUrl"],contextProperty:"storage",key:"storage",moduleSpecifier:"@lunora/storage"},{contextProperty:"vectors",key:"vectors",moduleSpecifier:"@lunora/bindings/vectors"},{contextProperty:"workflows",key:"workflows",moduleSpecifier:"@lunora/workflow"}],a=n,r=n.flatMap(e=>"appMethod"in e?[{appMethod:e.appMethod,key:e.key}]:[]),o=Object.fromEntries(a.map(({contextProperty:e,key:i,moduleSpecifier:t})=>[i,{contextProperty:e,moduleSpecifier:t}])),s=e=>new Set(a.filter(i=>e[i.key]).map(i=>i.key));export{r as APP_METHOD_CAPABILITIES,a as CAPABILITIES,o as CAPABILITY_PROBES,s as usedCapabilities};
@@ -1,4 +1,4 @@
1
- import{existsSync as O,mkdirSync as Xn,readFileSync as Jn,writeFileSync as Zn,rmSync as er}from"node:fs";import{join as S,dirname as Ne}from"node:path";import{performance as Xe}from"node:perf_hooks";import{runAdvisor as tr}from"@lunora/advisor";import{LunoraError as W}from"@lunora/errors";import{readJsonSync as sr}from"@visulima/fs";import{SyntaxKind as d,Node as i,Project as Xt}from"ts-morph";import{serializeSchemaSnapshot as nr}from"./SCHEMA_SNAPSHOT_VERSION-C0oHwiJZ.mjs";import{toAdvisorContext as rr}from"./formatAdvisories-DwmUKYuc.mjs";import{r as ir,a as y,s as or,b as ar}from"./project-config-file-Bv2l-Kmm.mjs";import{a as Jt,d as cr,r as lr}from"./modules-6EEBTEDo.mjs";import{QUEUES_FILENAME as dr,discoverQueueDeclarations as ur}from"./QUEUES_FILENAME-C6us1zjh.mjs";import{WORKFLOWS_FILENAME as fr,discoverWorkflows as pr}from"./WORKFLOWS_FILENAME-B47AB5pc.mjs";import{r as gr}from"./json-data-Chfs2Cz5.mjs";import{s as Me}from"./paths-C-9fwEgQ.mjs";import{G as mr}from"./shared-BXUKWh7t.mjs";import{CAPABILITIES as hr,usedCapabilities as vr}from"./CAPABILITY_PROBES-DFsutD7g.mjs";import{isD1GlobalTable as Bs,isHyperdriveGlobalTable as $s}from"./isD1GlobalTable-udvHAAzD.mjs";import{discoverAgents as Er}from"./AGENTS_FILENAME-lBe4g_sU.mjs";import{discoverContainers as xr}from"./CONTAINERS_FILENAME-CY43AXXN.mjs";import Sr from"./discoverCrons-PQeDYVPc.mjs";import{diagnosticAt as ge}from"./CodegenDiagnosticError-BUXlG3P-.mjs";import{b as _e}from"./module-specifiers-WF8iAydP.mjs";import{a as Us,b as V,d as K,f as R,g as xt,c as h,w as St,k as yr,l as Ar,h as br,j as ot,i as Nr}from"./attribution-NRssTEkk.mjs";import{contextPropertiesRead as Pr,discoverFeatureUsage as wr}from"./capabilitiesUsedBy-DKQfzdUf.mjs";import Ir from"./readPackageDependencies-RHhGiz0k.mjs";import{listLunoraSourceFiles as E,unwrapExpression as v,listSecurityScanFiles as Ke,objectLiteralFromCallbackBody as js,propertyInitializer as P,lunoraRelativePath as w,bindingKeyName as me,collectCallRows as I,findObjectProperty as D,collectSecurityCallRows as Cr,collectNodeRows as at,RUN_METHODS as Vs,functionReferenceSegments as qs,limitNameOf as Ws,optionsObjectLiteral as Hs,handlerOf as Tr,chainRootOf as yt,outermostValueWrapper as b,isWriteTarget as ze,isSameNode as ue,isConstDeclaration as Z,returningFunctionOf as ct,walkChain as Or,memberAccessOf as Rr,isTestPath as kr}from"./isTestPath-DCyIyPa7.mjs";import{discoverSandboxUsage as Fr}from"./discoverSandboxUsage-B8P9QjWZ.mjs";import{resolveServiceBindings as Dr}from"./readServiceBindings-DuE9xlvV.mjs";import Lr from"./discoverStorageRulesMetadata-C2hYksmI.mjs";import{a as A,c as H,d as Gs,e as Mr}from"./classify-procedure-call-BBKuBvKg.mjs";import{i as _r}from"./ir-DBSvhNa-.mjs";import{gatePlatformFeatures as Kr,resolveCodegenTarget as Ys,readTargetDiagnostics as zr,studioPlatformFor as Br}from"./DEFAULT_TARGET-rlz3WdHe.mjs";import{b as Qs,e as $r}from"./shard-DTJX0sDf.mjs";import Ur from"./emitServer-DymRagL2.mjs";import{emitDataModel as jr}from"./emitDataModel-DSk9AkJe.mjs";import{a as Zt,r as Je,i as U,b as Vr,m as Xs,c as Be,e as Js,E as Zs,C as en,d as qr,f as Wr,g as Hr}from"./context-root-IuI71QkK.mjs";import{r as $e,s as Gr}from"./parse-validator-DYdT7Hyf.mjs";import Yr from"./discoverAuthApiCalls-TA2a8bZI.mjs";import{i as Qr,a as Xr,e as Jr,b as Zr,d as ei,c as ti}from"./unwrap-handler-return-Dy8h5-I6.mjs";import si from"./discoverFunctions-4sef11AC.mjs";import ni from"./discoverHttpRoutes-CLGXL19M.mjs";import ri from"./discoverHyperdriveCalls-imtma-ic.mjs";import ii from"./discoverInserts-CKEO1mZZ.mjs";import{m as At,a as Te,s as tn,d as oi}from"./index-CRO3TRxd.mjs";import{e as sn}from"./exported-procedure-chains-DqU-ZCbG.mjs";import ai from"./discoverMigrations-DYQbnqow.mjs";import{i as _,r as nn}from"./database-calls-BFY_pIUf.mjs";import{MUTATORS_FILENAME as ci,isDefineMutatorCallee as li,mutatorServerImplOf as di,discoverMutators as ui}from"./MUTATORS_FILENAME-BxRrG_s-.mjs";import fi from"./discoverNondeterministicCalls-BfdM93-8.mjs";import{discoverNotifyConfig as pi,discoverNotifyCalls as gi}from"./NOTIFY_FILENAME-J5MGAkca.mjs";import mi from"./discoverQueries-DEkIMaBP.mjs";import hi from"./discoverR2sqlCalls-BRIyb8Cl.mjs";import vi from"./discoverRlsProcedures-BtT8-r93.mjs";import Ei from"./discoverRlsMetadata-rpiO4wSi.mjs";import xi from"./discoverSchema-BdmC-kO2.mjs";import{secretKindOf as Si,redact as yi,isHeuristicSecretKind as Ai,isSecretishName as bi}from"./redact-Cy14LEnc.mjs";import{discoverShapes as Ni}from"./SHAPES_FILENAME-CeBFuc8M.mjs";import{i as Pi}from"./reserved-words-CW1QFbTd.mjs";import{emitApp as wi}from"./emitApp-CT3NRUF_.mjs";import{buildOpenApiDocument as Ii,emitOpenApiModule as Ci}from"./buildOpenApiDocument-6VJGU6fU.mjs";import{buildOpenRpcDocument as Ti,emitOpenRpcModule as Oi}from"./OPENRPC_VERSION-B8RT1JYn.mjs";import{buildSchemaSnapshot as Ri}from"./SchemaSnapshotParseError-CPOXlFhI.mjs";import{emitCollections as ki,emitSeed as Fi,emitApi as Di}from"./emitApi-xDIHPRPH.mjs";import{t as Li,u as Mi,s as _i,v as Ki}from"./shard-runtime-BXp-lUsd.mjs";import{emitCrons as zi,emitScheduler as Bi,emitShardRegistry as $i,emitDurableObjects as Ui,emitVectors as ji,emitWranglerCronTriggers as Vi}from"./emitCrons-DKeoaeqU.mjs";import qi from"./emitDrizzleSchema-DohtnI8c.mjs";import Wi from"./emitFunctions-evl8Mx1a.mjs";const es={error:"ERROR",info:"INFO",warn:"WARN"},ts={ERROR:2,INFO:0,WARN:1},Hi=e=>({cacheKey:"advisor_min_severity_invalid",categories:["SCHEMA"],description:"`advisor.minSeverity` in `lunora.config.*` sets the lowest advisory level codegen reports and writes into `_generated/shard.ts`. Codegen reads it by parsing the file, so it has to be a string literal.",detail:e,facing:"INTERNAL",level:"WARN",metadata:{},name:"advisor_min_severity_invalid",remediation:'Set `advisor: { minSeverity: "info" | "warn" | "error" }` as a literal on the config\'s default export.',title:"`advisor.minSeverity` is not a level codegen can read, so every advisory was reported"}),Gi=(e,t)=>{const{advisor:s}=ir(e);if(s===void 0||s.minSeverity===void 0&&s.unreadable!==!0)return[...t];const{minSeverity:n}=s,r=n!==void 0&&Object.hasOwn(es,n)?es[n]:void 0;return r===void 0?[...t,Hi(n===void 0?"`advisor.minSeverity` is not a string literal codegen can read without evaluating the config: a computed value or key, or a spread that could set or override it.":`\`advisor.minSeverity\` is "${n}", which is not one of "info", "warn" or "error".`)]:t.filter(o=>ts[o.level]>=ts[r])},Yi={call:"function",enqueue:"queue",invoke:"service",publish:"topic",schedule:"function"},rn=dr.replace(/\.ts$/u,""),Qi="crons",Xi=fr.replace(/\.ts$/u,""),ie=(e,t)=>`${Me(e)}:${t}`,Ze=(e,t,s)=>t===""?{reason:`the ${s} is not a string literal`}:{to:`${e}:${t}`},Ji=e=>[...e.callEdges.map(t=>{const s=t.target===void 0?{reason:t.reason??"unreadable target"}:{to:`${Yi[t.kind]}:${t.target}`};return{file:t.file,kind:t.kind,line:t.line,scope:t.scope,...s}}),...e.queries.map(t=>({file:t.file,kind:"read",line:t.line,scope:t.scope,...Ze("table",t.table,"table name")})),...[...e.inserts,...e.tableWrites].map(t=>({file:t.file,kind:"write",line:t.line,scope:t.scope,...Ze("table",t.table,"written table")})),...e.workflowCalls.map(t=>({file:t.file,kind:"start",line:t.line,scope:t.scope,...Ze("workflow",t.workflow,"workflow name")}))],Zi=e=>e.untracked===!0?"inside a helper only code outside any export calls":"inside a non-exported helper",eo=e=>{const{scope:t}=e;switch(t.kind){case"export":return[{...e,exportName:t.name}];case"helper":return t.callers.length===0?[{...e,unattributed:Zi(t)}]:t.callers.map(s=>({...e,exportName:s}));default:return[{...e,unattributed:"at module scope"}]}},to=e=>Ji(e).flatMap(t=>eo(t)),so=e=>[...e.queues.flatMap(t=>t.topic===void 0?[]:[{file:rn,from:`topic:${t.topic}`,kind:"subscribe",line:0,to:`queue:${t.exportName}`}]),...e.crons.map(t=>{const s=t.workflow===void 0?void 0:`workflow:${t.workflow.exportName}`,n=t.functionPath===void 0?void 0:`function:${t.functionPath}`,r=s??n;return{file:Qi,from:`cron:${t.name}`,kind:"trigger",line:0,...r===void 0?{reason:"the cron has no target"}:{to:r}}})],no=e=>new Map(e.flatMap(t=>t.tables.map(s=>[s,t.name]))),et=(e,t)=>t===void 0?e:{...e,module:t},ro=e=>{const t=new Map,s=new Map,n=no(e.modules),r=(c,l)=>{s.set(c,[...s.get(c)??[],l])},o=(c,l)=>{t.set(c.id,c),l!==void 0&&r(l,c.id)},a=(c,l)=>{c!==void 0&&r(ie(c.file,c.exportName),l)};for(const c of e.functions){const l=ie(c.filePath,c.exportName),u=`${Me(c.filePath)}.${c.exportName}`;o(et({detail:c.kind,id:`function:${l}`,kind:"function",name:u},Jt(e.modules,c.filePath)),l)}for(const c of e.httpRoutes){const l=ie(c.filePath,c.exportName);o(et({id:`http:${l}`,kind:"http",name:`${c.method} ${c.path}`},Jt(e.modules,c.filePath)),l)}for(const c of e.schema.tables)o(et({id:`table:${c.name}`,kind:"table",name:c.name},n.get(c.name)));for(const c of e.queues){const l=c.topic===void 0?{}:{detail:"subscription"};o({...l,id:`queue:${c.exportName}`,kind:"queue",name:c.exportName},ie(rn,c.exportName)),a(c.handlerSite,`queue:${c.exportName}`)}for(const c of e.topics)o({id:`topic:${c.exportName}`,kind:"topic",name:c.exportName});for(const c of e.workflows)o({id:`workflow:${c.exportName}`,kind:"workflow",name:c.exportName},ie(Xi,c.exportName)),a(c.handlerSite,`workflow:${c.exportName}`);for(const c of e.crons)o({detail:c.cron,id:`cron:${c.name}`,kind:"cron",name:c.name});for(const c of e.services){const l=c.rpcEntrypoint===void 0?"fetch":"rpc";o({detail:c.entrypoint===void 0?l:`${l} · ${c.entrypoint}`,id:`service:${c.name}`,kind:"service",name:c.worker})}return{nodes:t,sites:s}},io=e=>e==="default"?"the default export is not a registered function":`"${e}" is not a registered function`,oo=(e,t)=>"from"in e?[e.from]:"unattributed"in e?{reason:e.unattributed}:t.get(ie(e.file,e.exportName))??{reason:io(e.exportName)},ao=(e,t,s)=>{if("reason"in e)return{reason:e.reason};const n=oo(e,t);if("reason"in n)return n;const{to:r}=e;return s.has(r)?{drawn:n.map(o=>({from:o,kind:e.kind,to:r}))}:{reason:`${r} is not declared`}},tt=e=>`${e.from}|${e.kind}|${e.to}`,co=e=>`${e.file}|${String(e.line)}|${e.kind}|${e.reason}`,lo=e=>{const{nodes:t,sites:s}=ro(e),n=new Map,r=new Map;for(const o of[...so(e),...to(e)]){const a=ao(o,s,t);if("drawn"in a)for(const c of a.drawn)n.set(tt(c),c);else{const c={file:o.file,kind:o.kind,line:o.line,reason:a.reason};r.set(co(c),c)}}return{edges:[...n.values()].toSorted((o,a)=>tt(o).localeCompare(tt(a))),nodes:[...t.values()].toSorted((o,a)=>o.id.localeCompare(a.id)),modules:e.modules.map(o=>({...o.description===void 0?{}:{description:o.description},...o.installed===!0?{installed:!0}:{},...o.ownsFolder===!1?{ownsFolder:!1}:{},name:o.name,tables:[...o.tables]})),unresolved:[...r.values()].toSorted((o,a)=>o.file.localeCompare(a.file)||o.line-a.line),version:1}},uo=e=>`${mr}export const architecture = ${gr(e,"Record<string, unknown>")};
1
+ import{existsSync as O,mkdirSync as Xn,readFileSync as Jn,writeFileSync as Zn,rmSync as er}from"node:fs";import{join as S,dirname as Ne}from"node:path";import{performance as Xe}from"node:perf_hooks";import{runAdvisor as tr}from"@lunora/advisor";import{LunoraError as W}from"@lunora/errors";import{readJsonSync as sr}from"@visulima/fs";import{SyntaxKind as d,Node as i,Project as Xt}from"ts-morph";import{serializeSchemaSnapshot as nr}from"./SCHEMA_SNAPSHOT_VERSION-C0oHwiJZ.mjs";import{toAdvisorContext as rr}from"./formatAdvisories-DwmUKYuc.mjs";import{r as ir,a as y,s as or,b as ar}from"./project-config-file-Bv2l-Kmm.mjs";import{a as Jt,d as cr,r as lr}from"./modules-6EEBTEDo.mjs";import{QUEUES_FILENAME as dr,discoverQueueDeclarations as ur}from"./QUEUES_FILENAME-C6us1zjh.mjs";import{WORKFLOWS_FILENAME as fr,discoverWorkflows as pr}from"./WORKFLOWS_FILENAME-B47AB5pc.mjs";import{r as gr}from"./json-data-Chfs2Cz5.mjs";import{s as Me}from"./paths-C-9fwEgQ.mjs";import{G as mr}from"./shared-BXUKWh7t.mjs";import{CAPABILITIES as hr,usedCapabilities as vr}from"./CAPABILITY_PROBES-brcmKenl.mjs";import{isD1GlobalTable as Bs,isHyperdriveGlobalTable as $s}from"./isD1GlobalTable-udvHAAzD.mjs";import{discoverAgents as Er}from"./AGENTS_FILENAME-lBe4g_sU.mjs";import{discoverContainers as xr}from"./CONTAINERS_FILENAME-CY43AXXN.mjs";import Sr from"./discoverCrons-PQeDYVPc.mjs";import{diagnosticAt as ge}from"./CodegenDiagnosticError-BUXlG3P-.mjs";import{b as _e}from"./module-specifiers-WF8iAydP.mjs";import{a as Us,b as V,d as K,f as R,g as xt,c as h,w as St,k as yr,l as Ar,h as br,j as ot,i as Nr}from"./attribution-NRssTEkk.mjs";import{contextPropertiesRead as Pr,discoverFeatureUsage as wr}from"./capabilitiesUsedBy-DARbl-4Z.mjs";import Ir from"./readPackageDependencies-RHhGiz0k.mjs";import{listLunoraSourceFiles as E,unwrapExpression as v,listSecurityScanFiles as Ke,objectLiteralFromCallbackBody as js,propertyInitializer as P,lunoraRelativePath as w,bindingKeyName as me,collectCallRows as I,findObjectProperty as D,collectSecurityCallRows as Cr,collectNodeRows as at,RUN_METHODS as Vs,functionReferenceSegments as qs,limitNameOf as Ws,optionsObjectLiteral as Hs,handlerOf as Tr,chainRootOf as yt,outermostValueWrapper as b,isWriteTarget as ze,isSameNode as ue,isConstDeclaration as Z,returningFunctionOf as ct,walkChain as Or,memberAccessOf as Rr,isTestPath as kr}from"./isTestPath-DCyIyPa7.mjs";import{discoverSandboxUsage as Fr}from"./discoverSandboxUsage-B8P9QjWZ.mjs";import{resolveServiceBindings as Dr}from"./readServiceBindings-DuE9xlvV.mjs";import Lr from"./discoverStorageRulesMetadata-C2hYksmI.mjs";import{a as A,c as H,d as Gs,e as Mr}from"./classify-procedure-call-BBKuBvKg.mjs";import{i as _r}from"./ir-DBSvhNa-.mjs";import{gatePlatformFeatures as Kr,resolveCodegenTarget as Ys,readTargetDiagnostics as zr,studioPlatformFor as Br}from"./DEFAULT_TARGET-rlz3WdHe.mjs";import{b as Qs,e as $r}from"./shard-DvYJO-cH.mjs";import Ur from"./emitServer-ePSDJ972.mjs";import{emitDataModel as jr}from"./emitDataModel-DSk9AkJe.mjs";import{a as Zt,r as Je,i as U,b as Vr,m as Xs,c as Be,e as Js,E as Zs,C as en,d as qr,f as Wr,g as Hr}from"./context-root-IuI71QkK.mjs";import{r as $e,s as Gr}from"./parse-validator-DYdT7Hyf.mjs";import Yr from"./discoverAuthApiCalls-TA2a8bZI.mjs";import{i as Qr,a as Xr,e as Jr,b as Zr,d as ei,c as ti}from"./unwrap-handler-return-Dy8h5-I6.mjs";import si from"./discoverFunctions-4sef11AC.mjs";import ni from"./discoverHttpRoutes-CLGXL19M.mjs";import ri from"./discoverHyperdriveCalls-imtma-ic.mjs";import ii from"./discoverInserts-CKEO1mZZ.mjs";import{m as At,a as Te,s as tn,d as oi}from"./index-CRO3TRxd.mjs";import{e as sn}from"./exported-procedure-chains-DqU-ZCbG.mjs";import ai from"./discoverMigrations-DYQbnqow.mjs";import{i as _,r as nn}from"./database-calls-BFY_pIUf.mjs";import{MUTATORS_FILENAME as ci,isDefineMutatorCallee as li,mutatorServerImplOf as di,discoverMutators as ui}from"./MUTATORS_FILENAME-BxRrG_s-.mjs";import fi from"./discoverNondeterministicCalls-BfdM93-8.mjs";import{discoverNotifyConfig as pi,discoverNotifyCalls as gi}from"./NOTIFY_FILENAME-J5MGAkca.mjs";import mi from"./discoverQueries-DEkIMaBP.mjs";import hi from"./discoverR2sqlCalls-BRIyb8Cl.mjs";import vi from"./discoverRlsProcedures-BtT8-r93.mjs";import Ei from"./discoverRlsMetadata-rpiO4wSi.mjs";import xi from"./discoverSchema-BdmC-kO2.mjs";import{secretKindOf as Si,redact as yi,isHeuristicSecretKind as Ai,isSecretishName as bi}from"./redact-Cy14LEnc.mjs";import{discoverShapes as Ni}from"./SHAPES_FILENAME-CeBFuc8M.mjs";import{i as Pi}from"./reserved-words-CW1QFbTd.mjs";import{emitApp as wi}from"./emitApp-BdVXkH7A.mjs";import{buildOpenApiDocument as Ii,emitOpenApiModule as Ci}from"./buildOpenApiDocument-6VJGU6fU.mjs";import{buildOpenRpcDocument as Ti,emitOpenRpcModule as Oi}from"./OPENRPC_VERSION-B8RT1JYn.mjs";import{buildSchemaSnapshot as Ri}from"./SchemaSnapshotParseError-CPOXlFhI.mjs";import{emitCollections as ki,emitSeed as Fi,emitApi as Di}from"./emitApi-xDIHPRPH.mjs";import{t as Li,u as Mi,s as _i,v as Ki}from"./shard-runtime-WWedZtLA.mjs";import{emitCrons as zi,emitScheduler as Bi,emitShardRegistry as $i,emitDurableObjects as Ui,emitVectors as ji,emitWranglerCronTriggers as Vi}from"./emitCrons-DKeoaeqU.mjs";import qi from"./emitDrizzleSchema-DohtnI8c.mjs";import Wi from"./emitFunctions-evl8Mx1a.mjs";const es={error:"ERROR",info:"INFO",warn:"WARN"},ts={ERROR:2,INFO:0,WARN:1},Hi=e=>({cacheKey:"advisor_min_severity_invalid",categories:["SCHEMA"],description:"`advisor.minSeverity` in `lunora.config.*` sets the lowest advisory level codegen reports and writes into `_generated/shard.ts`. Codegen reads it by parsing the file, so it has to be a string literal.",detail:e,facing:"INTERNAL",level:"WARN",metadata:{},name:"advisor_min_severity_invalid",remediation:'Set `advisor: { minSeverity: "info" | "warn" | "error" }` as a literal on the config\'s default export.',title:"`advisor.minSeverity` is not a level codegen can read, so every advisory was reported"}),Gi=(e,t)=>{const{advisor:s}=ir(e);if(s===void 0||s.minSeverity===void 0&&s.unreadable!==!0)return[...t];const{minSeverity:n}=s,r=n!==void 0&&Object.hasOwn(es,n)?es[n]:void 0;return r===void 0?[...t,Hi(n===void 0?"`advisor.minSeverity` is not a string literal codegen can read without evaluating the config: a computed value or key, or a spread that could set or override it.":`\`advisor.minSeverity\` is "${n}", which is not one of "info", "warn" or "error".`)]:t.filter(o=>ts[o.level]>=ts[r])},Yi={call:"function",enqueue:"queue",invoke:"service",publish:"topic",schedule:"function"},rn=dr.replace(/\.ts$/u,""),Qi="crons",Xi=fr.replace(/\.ts$/u,""),ie=(e,t)=>`${Me(e)}:${t}`,Ze=(e,t,s)=>t===""?{reason:`the ${s} is not a string literal`}:{to:`${e}:${t}`},Ji=e=>[...e.callEdges.map(t=>{const s=t.target===void 0?{reason:t.reason??"unreadable target"}:{to:`${Yi[t.kind]}:${t.target}`};return{file:t.file,kind:t.kind,line:t.line,scope:t.scope,...s}}),...e.queries.map(t=>({file:t.file,kind:"read",line:t.line,scope:t.scope,...Ze("table",t.table,"table name")})),...[...e.inserts,...e.tableWrites].map(t=>({file:t.file,kind:"write",line:t.line,scope:t.scope,...Ze("table",t.table,"written table")})),...e.workflowCalls.map(t=>({file:t.file,kind:"start",line:t.line,scope:t.scope,...Ze("workflow",t.workflow,"workflow name")}))],Zi=e=>e.untracked===!0?"inside a helper only code outside any export calls":"inside a non-exported helper",eo=e=>{const{scope:t}=e;switch(t.kind){case"export":return[{...e,exportName:t.name}];case"helper":return t.callers.length===0?[{...e,unattributed:Zi(t)}]:t.callers.map(s=>({...e,exportName:s}));default:return[{...e,unattributed:"at module scope"}]}},to=e=>Ji(e).flatMap(t=>eo(t)),so=e=>[...e.queues.flatMap(t=>t.topic===void 0?[]:[{file:rn,from:`topic:${t.topic}`,kind:"subscribe",line:0,to:`queue:${t.exportName}`}]),...e.crons.map(t=>{const s=t.workflow===void 0?void 0:`workflow:${t.workflow.exportName}`,n=t.functionPath===void 0?void 0:`function:${t.functionPath}`,r=s??n;return{file:Qi,from:`cron:${t.name}`,kind:"trigger",line:0,...r===void 0?{reason:"the cron has no target"}:{to:r}}})],no=e=>new Map(e.flatMap(t=>t.tables.map(s=>[s,t.name]))),et=(e,t)=>t===void 0?e:{...e,module:t},ro=e=>{const t=new Map,s=new Map,n=no(e.modules),r=(c,l)=>{s.set(c,[...s.get(c)??[],l])},o=(c,l)=>{t.set(c.id,c),l!==void 0&&r(l,c.id)},a=(c,l)=>{c!==void 0&&r(ie(c.file,c.exportName),l)};for(const c of e.functions){const l=ie(c.filePath,c.exportName),u=`${Me(c.filePath)}.${c.exportName}`;o(et({detail:c.kind,id:`function:${l}`,kind:"function",name:u},Jt(e.modules,c.filePath)),l)}for(const c of e.httpRoutes){const l=ie(c.filePath,c.exportName);o(et({id:`http:${l}`,kind:"http",name:`${c.method} ${c.path}`},Jt(e.modules,c.filePath)),l)}for(const c of e.schema.tables)o(et({id:`table:${c.name}`,kind:"table",name:c.name},n.get(c.name)));for(const c of e.queues){const l=c.topic===void 0?{}:{detail:"subscription"};o({...l,id:`queue:${c.exportName}`,kind:"queue",name:c.exportName},ie(rn,c.exportName)),a(c.handlerSite,`queue:${c.exportName}`)}for(const c of e.topics)o({id:`topic:${c.exportName}`,kind:"topic",name:c.exportName});for(const c of e.workflows)o({id:`workflow:${c.exportName}`,kind:"workflow",name:c.exportName},ie(Xi,c.exportName)),a(c.handlerSite,`workflow:${c.exportName}`);for(const c of e.crons)o({detail:c.cron,id:`cron:${c.name}`,kind:"cron",name:c.name});for(const c of e.services){const l=c.rpcEntrypoint===void 0?"fetch":"rpc";o({detail:c.entrypoint===void 0?l:`${l} · ${c.entrypoint}`,id:`service:${c.name}`,kind:"service",name:c.worker})}return{nodes:t,sites:s}},io=e=>e==="default"?"the default export is not a registered function":`"${e}" is not a registered function`,oo=(e,t)=>"from"in e?[e.from]:"unattributed"in e?{reason:e.unattributed}:t.get(ie(e.file,e.exportName))??{reason:io(e.exportName)},ao=(e,t,s)=>{if("reason"in e)return{reason:e.reason};const n=oo(e,t);if("reason"in n)return n;const{to:r}=e;return s.has(r)?{drawn:n.map(o=>({from:o,kind:e.kind,to:r}))}:{reason:`${r} is not declared`}},tt=e=>`${e.from}|${e.kind}|${e.to}`,co=e=>`${e.file}|${String(e.line)}|${e.kind}|${e.reason}`,lo=e=>{const{nodes:t,sites:s}=ro(e),n=new Map,r=new Map;for(const o of[...so(e),...to(e)]){const a=ao(o,s,t);if("drawn"in a)for(const c of a.drawn)n.set(tt(c),c);else{const c={file:o.file,kind:o.kind,line:o.line,reason:a.reason};r.set(co(c),c)}}return{edges:[...n.values()].toSorted((o,a)=>tt(o).localeCompare(tt(a))),nodes:[...t.values()].toSorted((o,a)=>o.id.localeCompare(a.id)),modules:e.modules.map(o=>({...o.description===void 0?{}:{description:o.description},...o.installed===!0?{installed:!0}:{},...o.ownsFolder===!1?{ownsFolder:!1}:{},name:o.name,tables:[...o.tables]})),unresolved:[...r.values()].toSorted((o,a)=>o.file.localeCompare(a.file)||o.line-a.line),version:1}},uo=e=>`${mr}export const architecture = ${gr(e,"Record<string, unknown>")};
2
2
  `,fo=(e,t)=>{if(!(!t||e.jurisdiction!=="fedramp"))throw new W("CODEGEN_DIAGNOSTIC",'@lunora/codegen: the schema pins data to the "fedramp" jurisdiction, but this app uses Cloudflare Artifacts (`ctx.artifacts`), which supports only the "eu" and "us" jurisdictions. Repo data would be stored outside the declared residency. Remove the `ctx.artifacts` usage, or pin the schema to a jurisdiction Artifacts supports.')},ss=(e,t="api")=>{const s=new Map;for(const n of e){const r=Me(n),o=s.get(r);if(o===void 0){s.set(r,n);continue}if(o!==n){const a=t==="api"?`the generated api.ts would declare "${r}" twice and the dispatch key "${r}:<fn>" would be ambiguous`:`the generated api.ts would declare "${r}" twice in HttpStreamsRef and again in the httpStreams object literal`;throw new W("INTERNAL",`@lunora/codegen: "${o}" and "${n}" both map to the ${t} namespace "${r}" — ${a}. Rename one file so the two differ by more than a non-identifier character (\`-\`, \`.\`, \`/\` and \`_\` all sanitize to \`_\`).`,{status:500})}}},po=(e,t={})=>{const{hasVectors:s=!0,scheduler:n=!1,storage:r=!1,usage:o}=t,a=[];e.tables.some(c=>Bs(c))&&a.push({name:"@lunora/d1",reason:"`.global()` tables are D1-backed, so `_generated/app.ts` imports the D1 `ctx.db` adapter"}),e.tables.some(c=>$s(c))&&a.push({name:"@lunora/hyperdrive",reason:'`.global({ backend: "hyperdrive" })` tables route through `@lunora/hyperdrive/global`'},{name:"@lunora/sql-store",reason:'`.global({ backend: "hyperdrive" })` makes `_generated/app.ts` import the `SqlCtxDbOptions` / `SqlExec` types'}),n&&a.push({name:"@lunora/scheduler",reason:"a declared cron (or `ctx.scheduler` use) makes `_generated/app.ts` import `createScheduler`"}),r&&a.push({name:"@lunora/storage",reason:"a `v.storage()` column, a storage access rule (or `ctx.storage` use) makes `_generated/app.ts` import `createStorage`"}),e.vectorIndexes.length>0&&s&&a.push({name:"@lunora/bindings",reason:"`.vectorize()` indexes make `_generated/shard.ts` import `@lunora/bindings/vectors`"});for(const c of o===void 0?[]:hr)c.requiredPackage!==void 0&&o?.[c.key]===!0&&a.push({name:c.requiredPackage,reason:`\`ctx.${c.contextProperty??c.key}\` usage makes \`_generated/\` import \`${c.moduleSpecifier}\``});return a.filter((c,l)=>a.findIndex(u=>u.name===c.name)===l)},go=(e,t,s={})=>{if(t===void 0)return;const n=po(e,s).filter(o=>!t.has(o.name));if(n.length===0)return;const r=n.map(o=>` - ${o.name} — ${o.reason}`).join(`
3
3
  `);throw new W("INTERNAL",`@lunora/codegen: this schema's generated code imports packages the project does not declare:
4
4
  ${r}
@@ -0,0 +1 @@
1
+ import{SyntaxKind as c,Node as r}from"ts-morph";import{CAPABILITIES as m}from"./CAPABILITY_PROBES-brcmKenl.mjs";import{bindingKeyName as p,listLunoraSourceFiles as g}from"./isTestPath-DCyIyPa7.mjs";import{scanImportDeclaration as u,noSandboxUsage as l}from"./discoverSandboxUsage-B8P9QjWZ.mjs";const d="ctx",x=e=>{const t=new Set,o=new Set([d]),n=s=>{if(r.isObjectBindingPattern(s))for(const i of s.getElements()){const f=p(i);f&&t.add(f)}};for(const s of e.getDescendantsOfKind(c.BindingElement)){if(p(s)!==d)continue;const i=s.getNameNode();r.isIdentifier(i)?o.add(i.getText()):n(i)}const a=s=>r.isIdentifier(s)&&o.has(s.getText());for(const s of e.getDescendantsOfKind(c.PropertyAccessExpression))a(s.getExpression())&&t.add(s.getName());for(const s of e.getDescendantsOfKind(c.VariableDeclaration)){const i=s.getInitializer();i!==void 0&&a(i)&&n(s.getNameNode())}return t},E=e=>{if(e.isTypeOnly())return!0;if(r.isExportDeclaration(e)){const o=e.getNamedExports();return!e.isNamespaceExport()&&o.length>0&&o.every(n=>n.isTypeOnly())}const t=e.getNamedImports();return e.getDefaultImport()===void 0&&e.getNamespaceImport()===void 0&&t.length>0&&t.every(o=>o.isTypeOnly())},I=new Map(m.flatMap(({bindingFreeExports:e,moduleSpecifier:t})=>e===void 0?[]:[[t,new Set(e)]])),N=(e,t)=>{const o=I.get(t);if(o===void 0||r.isImportDeclaration(e)&&(e.getDefaultImport()!==void 0||e.getNamespaceImport()!==void 0))return!1;const n=r.isExportDeclaration(e)?e.getNamedExports():e.getNamedImports();return n.length>0&&n.every(a=>a.isTypeOnly()||o.has(a.getName()))},y=e=>{const t=new Set;for(const o of e.getDescendantsOfKind(c.CallExpression)){const[n]=o.getArguments();o.getExpression().getKind()===c.ImportKeyword&&(r.isStringLiteral(n)||r.isNoSubstitutionTemplateLiteral(n))&&t.add(n.getLiteralValue())}return t},S=e=>{const t=e.getImportDeclarations(),o=l();for(const n of t){const a=u(n);for(const s of Object.keys(o))o[s]||=a[s]}return{contextReads:x(e),dynamicImports:y(e),sandboxTools:o,valueImports:new Set([...t,...e.getExportDeclarations()].flatMap(n=>{const a=n.getModuleSpecifierValue();return a===void 0||E(n)||N(n,a)?[]:[a]}))}},T=e=>{const t=new Set,o=new Set,n=l(),a=new Set;for(const s of e){for(const i of s.contextReads)t.add(i);for(const i of s.dynamicImports)o.add(i);for(const i of s.valueImports)a.add(i);for(const i of Object.keys(n))n[i]||=s.sandboxTools[i]}return{contextReads:t,dynamicImports:o,sandboxTools:n,valueImports:a}},b=e=>new Set(m.filter(({contextProperty:t,moduleSpecifier:o})=>e.valueImports.has(o)||t!==void 0&&e.contextReads.has(t)).map(({key:t})=>t)),O=new RegExp(String.raw`\b${d}\b`,"u"),v=new RegExp(String.raw`\b(?:${m.flatMap(({contextProperty:e})=>e===void 0?[]:[e]).join("|")})\b`,"u"),h=e=>O.test(e)&&v.test(e),P=(e,t)=>{const o=T(g(t).map(a=>S(e.getSourceFile(a)??e.addSourceFileAtPath(a)))),n=b(o);return Object.fromEntries(m.map(({key:a})=>[a,n.has(a)]))};export{b as capabilitiesUsedBy,x as contextPropertiesRead,P as discoverFeatureUsage,T as foldCapabilitySignals,h as mayReadCapabilityContext,S as sourceCapabilitySignals};
@@ -1 +1 @@
1
- import"./ir-DBSvhNa-.mjs";import"./json-data-Chfs2Cz5.mjs";import{o as i,j as r,s as o,h as n,t as g,k as F,d as u,v as p,m as f,g as l,f as d,i as k,u as w,l as Q}from"./shard-runtime-BXp-lUsd.mjs";import"./shared-BXUKWh7t.mjs";export{i as buildDoTypeImports,r as emitAgentFragments,o as emitAgents,n as emitContainerFragments,g as emitContainers,F as emitPaymentFragments,u as emitQueueFragments,p as emitQueues,f as emitQueuesMetadataFragments,l as emitServiceFragments,d as emitTopicFragments,k as emitWorkflowFragments,w as emitWorkflows,Q as emitWorkflowsMetadataFragments};
1
+ import"./ir-DBSvhNa-.mjs";import"./json-data-Chfs2Cz5.mjs";import{o as i,j as r,s as o,h as n,t as g,k as F,d as u,v as p,m as f,g as l,f as d,i as k,u as w,l as Q}from"./shard-runtime-WWedZtLA.mjs";import"./shared-BXUKWh7t.mjs";export{i as buildDoTypeImports,r as emitAgentFragments,o as emitAgents,n as emitContainerFragments,g as emitContainers,F as emitPaymentFragments,u as emitQueueFragments,p as emitQueues,f as emitQueuesMetadataFragments,l as emitServiceFragments,d as emitTopicFragments,k as emitWorkflowFragments,w as emitWorkflows,Q as emitWorkflowsMetadataFragments};
@@ -1,4 +1,4 @@
1
- import{APP_METHOD_CAPABILITIES as k}from"./CAPABILITY_PROBES-DFsutD7g.mjs";import{i as S}from"./ir-DBSvhNa-.mjs";import{G as E}from"./shared-BXUKWh7t.mjs";const D={configKey:"vectors",doc:"Wire the Vectorize index map backing `ctx.vectors`.",method:"vectors"},g=e=>[...k.filter(({key:r})=>e.capabilities.has(r)).map(({appMethod:r})=>r),...e.hasVectors?[D]:[]],m=e=>g(e).length>0,v=e=>(e.emailAgents?.length??0)>0,d=e=>e.tables.some(r=>S(r)),R=e=>e.hasScheduler?`
1
+ import{APP_METHOD_CAPABILITIES as k}from"./CAPABILITY_PROBES-brcmKenl.mjs";import{i as S}from"./ir-DBSvhNa-.mjs";import{G as E}from"./shared-BXUKWh7t.mjs";const D={configKey:"vectors",doc:"Wire the Vectorize index map backing `ctx.vectors`.",method:"vectors"},g=e=>[...k.filter(({key:r})=>e.capabilities.has(r)).map(({appMethod:r})=>r),...e.hasVectors?[D]:[]],m=e=>g(e).length>0,v=e=>(e.emailAgents?.length??0)>0,d=e=>e.tables.some(r=>S(r)),R=e=>e.hasScheduler?`
2
2
  /** Resolve the \`SchedulerDO\`-backed scheduler for this env; \`undefined\` until the namespace is wired. */
3
3
  private resolveScheduler(env: Env): ReturnType<typeof createScheduler> | undefined {
4
4
  const namespace = this.schedulerDeclaration?.namespace(env);
@@ -1,4 +1,4 @@
1
- import{relative as ve,isAbsolute as ke,sep as we}from"node:path";import{LunoraError as V}from"@lunora/errors";import{CAPABILITIES as Ie}from"./CAPABILITY_PROBES-DFsutD7g.mjs";import{p as $e}from"./ir-DBSvhNa-.mjs";import{a as p,G as Be,u as Re,d as Oe}from"./shared-BXUKWh7t.mjs";const Ne=/\.([cm]?)tsx?$/u,Me=(d,l=[])=>{const r=new Set;for(const t of d.tables)for(const i of Object.values(t.shape)){const n=Re(i);n.kind==="storage"&&typeof n.bucket=="string"&&n.bucket!==""&&r.add(n.bucket)}for(const t of l)t!==""&&t!=="default"&&r.add(t);return["default",...[...r].toSorted((t,i)=>t.localeCompare(i))]},Qe=({agents:d=[],capabilities:l=new Set,containers:r=[],env:t,hasVectors:i=!0,hasFlags:n=!1,hasNotify:_=!1,identity:s,queues:R=[],schema:O,generatedDirectory:N="",services:y=[],storageRuleBuckets:H=[],topics:M=[],useUmbrella:z=!1,workflows:C=[]}={})=>{const o=Oe(z),U=Me(O??{tables:[]},H).map(e=>JSON.stringify(e)).join(" | "),D=e=>e.sandbox===!0?"SandboxContainerAccessor":"ContainerAccessor",J=[...new Set(r.map(e=>D(e)))].toSorted((e,a)=>e.localeCompare(a)),K=r.length>0?`import type { ${J.join(", ")} } from "@lunora/container";
1
+ import{relative as ve,isAbsolute as ke,sep as we}from"node:path";import{LunoraError as V}from"@lunora/errors";import{CAPABILITIES as Ie}from"./CAPABILITY_PROBES-brcmKenl.mjs";import{p as $e}from"./ir-DBSvhNa-.mjs";import{a as p,G as Be,u as Re,d as Oe}from"./shared-BXUKWh7t.mjs";const Ne=/\.([cm]?)tsx?$/u,Me=(d,l=[])=>{const r=new Set;for(const t of d.tables)for(const i of Object.values(t.shape)){const n=Re(i);n.kind==="storage"&&typeof n.bucket=="string"&&n.bucket!==""&&r.add(n.bucket)}for(const t of l)t!==""&&t!=="default"&&r.add(t);return["default",...[...r].toSorted((t,i)=>t.localeCompare(i))]},Qe=({agents:d=[],capabilities:l=new Set,containers:r=[],env:t,hasVectors:i=!0,hasFlags:n=!1,hasNotify:_=!1,identity:s,queues:R=[],schema:O,generatedDirectory:N="",services:y=[],storageRuleBuckets:H=[],topics:M=[],useUmbrella:z=!1,workflows:C=[]}={})=>{const o=Oe(z),U=Me(O??{tables:[]},H).map(e=>JSON.stringify(e)).join(" | "),D=e=>e.sandbox===!0?"SandboxContainerAccessor":"ContainerAccessor",J=[...new Set(r.map(e=>D(e)))].toSorted((e,a)=>e.localeCompare(a)),K=r.length>0?`import type { ${J.join(", ")} } from "@lunora/container";
2
2
  `:"",Y=r.length>0?`
3
3
  readonly containers: {${r.map(e=>`
4
4
  readonly ${e.exportName}: ${D(e)};`).join("")}
@@ -1 +1 @@
1
- import"./SCHEMA_SNAPSHOT_VERSION-C0oHwiJZ.mjs";import"./isD1GlobalTable-udvHAAzD.mjs";import"./ir-DBSvhNa-.mjs";import"./json-data-Chfs2Cz5.mjs";import{e as f}from"./shard-DTJX0sDf.mjs";import"./shard-runtime-BXp-lUsd.mjs";import"./shared-BXUKWh7t.mjs";export{f as default};
1
+ import"./SCHEMA_SNAPSHOT_VERSION-C0oHwiJZ.mjs";import"./isD1GlobalTable-udvHAAzD.mjs";import"./ir-DBSvhNa-.mjs";import"./json-data-Chfs2Cz5.mjs";import{e as f}from"./shard-DvYJO-cH.mjs";import"./shard-runtime-WWedZtLA.mjs";import"./shared-BXUKWh7t.mjs";export{f as default};
@@ -1,4 +1,4 @@
1
- import{LunoraError as vt}from"@lunora/errors";import{serializeSchemaSnapshot as kt,hashSchemaSnapshot as St}from"./SCHEMA_SNAPSHOT_VERSION-C0oHwiJZ.mjs";import{isHyperdriveGlobalTable as Rt,isD1GlobalTable as xt}from"./isD1GlobalTable-udvHAAzD.mjs";import{p as At,i as Dt}from"./ir-DBSvhNa-.mjs";import{r as h}from"./json-data-Chfs2Cz5.mjs";import{r as C,e as Tt,a as Ot,b as Et,c as Ct,d as Lt,f as It,g as _t,h as Mt,i as Pt,j as qt,k as Nt,l as $t,m as Ft,n as Ut,o as Bt,p as Wt,q as jt}from"./shard-runtime-BXp-lUsd.mjs";import{u as K,i as Ht,G as Vt,d as Kt}from"./shared-BXUKWh7t.mjs";const Gt=` /**
1
+ import{LunoraError as vt}from"@lunora/errors";import{serializeSchemaSnapshot as kt,hashSchemaSnapshot as St}from"./SCHEMA_SNAPSHOT_VERSION-C0oHwiJZ.mjs";import{isHyperdriveGlobalTable as Rt,isD1GlobalTable as xt}from"./isD1GlobalTable-udvHAAzD.mjs";import{p as At,i as Dt}from"./ir-DBSvhNa-.mjs";import{r as h}from"./json-data-Chfs2Cz5.mjs";import{r as C,e as Tt,a as Ot,b as Et,c as Ct,d as Lt,f as It,g as _t,h as Mt,i as Pt,j as qt,k as Nt,l as $t,m as Ft,n as Ut,o as Bt,p as Wt,q as jt}from"./shard-runtime-WWedZtLA.mjs";import{u as K,i as Ht,G as Vt,d as Kt}from"./shared-BXUKWh7t.mjs";const Gt=` /**
2
2
  * The bare writer every admin/maintenance entry point writes through.
3
3
  *
4
4
  * Admin and maintenance writes go through the SAME reactive-cache hooks as a
@@ -1,4 +1,4 @@
1
- import{s as b}from"./ir-DBSvhNa-.mjs";import{r as y}from"./json-data-Chfs2Cz5.mjs";import{CAPABILITIES as $}from"./CAPABILITY_PROBES-DFsutD7g.mjs";import{a as c,G as p}from"./shared-BXUKWh7t.mjs";const I=e=>e?{importFragment:"serveRelationFanout, ",override:`
1
+ import{s as b}from"./ir-DBSvhNa-.mjs";import{r as y}from"./json-data-Chfs2Cz5.mjs";import{CAPABILITIES as $}from"./CAPABILITY_PROBES-brcmKenl.mjs";import{a as c,G as p}from"./shared-BXUKWh7t.mjs";const I=e=>e?{importFragment:"serveRelationFanout, ",override:`
2
2
  protected override async runRelationFanoutRead(functionPath: string, args: Record<string, unknown>): Promise<unknown> {
3
3
  this.ensureMigrated();
4
4
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lunora/codegen",
3
- "version": "1.0.0-alpha.270",
3
+ "version": "1.0.0-alpha.271",
4
4
  "description": "Code generator for Lunora: emits _generated/{api,server,dataModel}.ts from your schema",
5
5
  "keywords": [
6
6
  "cloudflare",
@@ -1 +0,0 @@
1
- import{SyntaxKind as c,Node as r}from"ts-morph";import{CAPABILITIES as f}from"./CAPABILITY_PROBES-DFsutD7g.mjs";import{bindingKeyName as p,listLunoraSourceFiles as g}from"./isTestPath-DCyIyPa7.mjs";import{scanImportDeclaration as u,noSandboxUsage as l}from"./discoverSandboxUsage-B8P9QjWZ.mjs";const d="ctx",x=e=>{const t=new Set,n=new Set([d]),s=o=>{if(r.isObjectBindingPattern(o))for(const i of o.getElements()){const m=p(i);m&&t.add(m)}};for(const o of e.getDescendantsOfKind(c.BindingElement)){if(p(o)!==d)continue;const i=o.getNameNode();r.isIdentifier(i)?n.add(i.getText()):s(i)}const a=o=>r.isIdentifier(o)&&n.has(o.getText());for(const o of e.getDescendantsOfKind(c.PropertyAccessExpression))a(o.getExpression())&&t.add(o.getName());for(const o of e.getDescendantsOfKind(c.VariableDeclaration)){const i=o.getInitializer();i!==void 0&&a(i)&&s(o.getNameNode())}return t},E=e=>{if(e.isTypeOnly())return!0;if(r.isExportDeclaration(e)){const n=e.getNamedExports();return!e.isNamespaceExport()&&n.length>0&&n.every(s=>s.isTypeOnly())}const t=e.getNamedImports();return e.getDefaultImport()===void 0&&e.getNamespaceImport()===void 0&&t.length>0&&t.every(n=>n.isTypeOnly())},S=e=>{const t=new Set;for(const n of e.getDescendantsOfKind(c.CallExpression)){const[s]=n.getArguments();n.getExpression().getKind()===c.ImportKeyword&&(r.isStringLiteral(s)||r.isNoSubstitutionTemplateLiteral(s))&&t.add(s.getLiteralValue())}return t},y=e=>{const t=e.getImportDeclarations(),n=l();for(const s of t){const a=u(s);for(const o of Object.keys(n))n[o]||=a[o]}return{contextReads:x(e),dynamicImports:S(e),sandboxTools:n,valueImports:new Set([...t,...e.getExportDeclarations()].flatMap(s=>{const a=s.getModuleSpecifierValue();return a===void 0||E(s)?[]:[a]}))}},T=e=>{const t=new Set,n=new Set,s=l(),a=new Set;for(const o of e){for(const i of o.contextReads)t.add(i);for(const i of o.dynamicImports)n.add(i);for(const i of o.valueImports)a.add(i);for(const i of Object.keys(s))s[i]||=o.sandboxTools[i]}return{contextReads:t,dynamicImports:n,sandboxTools:s,valueImports:a}},I=e=>new Set(f.filter(({contextProperty:t,moduleSpecifier:n})=>e.valueImports.has(n)||t!==void 0&&e.contextReads.has(t)).map(({key:t})=>t)),N=new RegExp(String.raw`\b${d}\b`,"u"),b=new RegExp(String.raw`\b(?:${f.flatMap(({contextProperty:e})=>e===void 0?[]:[e]).join("|")})\b`,"u"),C=e=>N.test(e)&&b.test(e),D=(e,t)=>{const n=T(g(t).map(a=>y(e.getSourceFile(a)??e.addSourceFileAtPath(a)))),s=I(n);return Object.fromEntries(f.map(({key:a})=>[a,s.has(a)]))};export{I as capabilitiesUsedBy,x as contextPropertiesRead,D as discoverFeatureUsage,T as foldCapabilitySignals,C as mayReadCapabilityContext,y as sourceCapabilitySignals};