@lunora/codegen 1.0.0-alpha.251 → 1.0.0-alpha.253
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 +28 -2
- package/dist/index.d.ts +28 -2
- package/dist/index.mjs +1 -1
- package/dist/packem_shared/{CAPABILITY_PROBES-BbW-W0N2.mjs → CAPABILITY_PROBES-BPeV994T.mjs} +4 -2
- package/dist/packem_shared/DEFAULT_TARGET-Co7ZXJ21.mjs +1 -0
- package/dist/packem_shared/{SCHEMA_SNAPSHOT_FILENAME-qrQnFo7L.mjs → SCHEMA_SNAPSHOT_FILENAME-CVtSBGXP.mjs} +1 -1
- package/dist/packem_shared/{emitAgents-DtZrevpx.mjs → emitAgents-QaI2dB2T.mjs} +1 -1
- package/dist/packem_shared/{emitApp-Cp0kB4-N.mjs → emitApp-CokyctXT.mjs} +1 -1
- package/dist/packem_shared/{emitServer-BOpHpi8r.mjs → emitServer-DThb0DLe.mjs} +1 -1
- package/dist/packem_shared/{emitShard-HB5NPFdO.mjs → emitShard-BF9yqSKI.mjs} +1 -1
- package/dist/packem_shared/{shard-CyNCZP7J.mjs → shard-CBwweXGB.mjs} +2 -2
- package/dist/packem_shared/{shard-runtime-DMN3MgIM.mjs → shard-runtime-DTSpJxxd.mjs} +6 -6
- package/dist/packem_shared/{sourceCapabilitySignals-oZFprILA.mjs → sourceCapabilitySignals-NsxX0VDV.mjs} +1 -1
- package/package.json +10 -10
- package/dist/packem_shared/DEFAULT_TARGET-vMWzRzRF.mjs +0 -1
package/dist/index.d.mts
CHANGED
|
@@ -2411,8 +2411,8 @@ declare const formatAdvisories: (findings: ReadonlyArray<Finding>) => string;
|
|
|
2411
2411
|
/**
|
|
2412
2412
|
* The canonical capability list. **Order is load-bearing** — every consumer
|
|
2413
2413
|
* emits in row order (see the module doc). The `appMethod` rows reproduce the
|
|
2414
|
-
* original `LONG_TAIL` builder sequence (ai, aiSearch, analytics, artifacts, browser,
|
|
2415
|
-
* images, kv, payment, x402, r2sql — `.vectors()` follows them, emitted off the
|
|
2414
|
+
* original `LONG_TAIL` builder sequence (ai, aiSearch, analytics, analyticsSql, artifacts, browser,
|
|
2415
|
+
* hyperdrive, images, kv, payment, x402, r2sql — `.vectors()` follows them, emitted off the
|
|
2416
2416
|
* declaration), and the same order places the `ctx.*` fields and the ShardDO wiring.
|
|
2417
2417
|
*/
|
|
2418
2418
|
declare const CAPABILITY_ROWS: readonly [{
|
|
@@ -2482,6 +2482,31 @@ declare const CAPABILITY_ROWS: readonly [{
|
|
|
2482
2482
|
readonly syncStubMethods: readonly ["track", "writeDataPoint"];
|
|
2483
2483
|
};
|
|
2484
2484
|
readonly tier: "every";
|
|
2485
|
+
}, {
|
|
2486
|
+
readonly appMethod: {
|
|
2487
|
+
readonly configKey: "analyticsSql";
|
|
2488
|
+
readonly 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.";
|
|
2489
|
+
readonly method: "analyticsSql";
|
|
2490
|
+
};
|
|
2491
|
+
readonly contextProperty: "analyticsSql";
|
|
2492
|
+
readonly key: "analyticsSql";
|
|
2493
|
+
readonly moduleSpecifier: "@lunora/bindings/analytics-sql";
|
|
2494
|
+
readonly requiredPackage: "@lunora/bindings";
|
|
2495
|
+
readonly serverCtxField: "\n /** Read-only SQL over Cloudflare's Analytics SQL API (Analytics Engine datasets and more) through the `analytics` binding. Non-deterministic — available only in actions. Reads here are NOT tracked by Lunora live queries. */\n readonly analyticsSql: import(\"@lunora/bindings/analytics-sql\").AnalyticsSql;";
|
|
2496
|
+
readonly shardBinding: {
|
|
2497
|
+
readonly binding: {
|
|
2498
|
+
readonly bindingType: "AnalyticsSqlBindingLike";
|
|
2499
|
+
readonly envName: "ANALYTICS_SQL";
|
|
2500
|
+
readonly factory: {
|
|
2501
|
+
readonly name: "createAnalyticsSql";
|
|
2502
|
+
readonly option: "binding";
|
|
2503
|
+
};
|
|
2504
|
+
};
|
|
2505
|
+
readonly clientType: "AnalyticsSql";
|
|
2506
|
+
readonly missingMessage: "ctx.analyticsSql: no Analytics SQL binding found. Add an `analytics` binding ({ binding: \"ANALYTICS_SQL\" }, wrangler >= 4.145.0) to wrangler.jsonc, or point ctx.analyticsSql at a token transport with defineApp().analyticsSql((env) => createAnalyticsSqlRest({ accountId, apiToken })).";
|
|
2507
|
+
readonly stubMethods: readonly ["query"];
|
|
2508
|
+
};
|
|
2509
|
+
readonly tier: "action";
|
|
2485
2510
|
}, {
|
|
2486
2511
|
readonly appMethod: {
|
|
2487
2512
|
readonly configKey: "artifacts";
|
|
@@ -2546,6 +2571,7 @@ declare const CAPABILITY_ROWS: readonly [{
|
|
|
2546
2571
|
readonly serverCtxField: "\n /**\n * 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.\n */\n readonly sql: import(\"@lunora/hyperdrive\").SqlClient;";
|
|
2547
2572
|
readonly shardBinding: {
|
|
2548
2573
|
readonly clientType: "SqlClient";
|
|
2574
|
+
readonly instrument: "instrumentSql";
|
|
2549
2575
|
readonly missingMessage: "ctx.sql: provide a `sql` config thunk that builds a SqlClient from your driver, e.g. `sql: (env) => fromPostgresJs(postgres(env.HYPERDRIVE.connectionString))`.";
|
|
2550
2576
|
readonly stubMethods: readonly ["query"];
|
|
2551
2577
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -2411,8 +2411,8 @@ declare const formatAdvisories: (findings: ReadonlyArray<Finding>) => string;
|
|
|
2411
2411
|
/**
|
|
2412
2412
|
* The canonical capability list. **Order is load-bearing** — every consumer
|
|
2413
2413
|
* emits in row order (see the module doc). The `appMethod` rows reproduce the
|
|
2414
|
-
* original `LONG_TAIL` builder sequence (ai, aiSearch, analytics, artifacts, browser,
|
|
2415
|
-
* images, kv, payment, x402, r2sql — `.vectors()` follows them, emitted off the
|
|
2414
|
+
* original `LONG_TAIL` builder sequence (ai, aiSearch, analytics, analyticsSql, artifacts, browser,
|
|
2415
|
+
* hyperdrive, images, kv, payment, x402, r2sql — `.vectors()` follows them, emitted off the
|
|
2416
2416
|
* declaration), and the same order places the `ctx.*` fields and the ShardDO wiring.
|
|
2417
2417
|
*/
|
|
2418
2418
|
declare const CAPABILITY_ROWS: readonly [{
|
|
@@ -2482,6 +2482,31 @@ declare const CAPABILITY_ROWS: readonly [{
|
|
|
2482
2482
|
readonly syncStubMethods: readonly ["track", "writeDataPoint"];
|
|
2483
2483
|
};
|
|
2484
2484
|
readonly tier: "every";
|
|
2485
|
+
}, {
|
|
2486
|
+
readonly appMethod: {
|
|
2487
|
+
readonly configKey: "analyticsSql";
|
|
2488
|
+
readonly 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.";
|
|
2489
|
+
readonly method: "analyticsSql";
|
|
2490
|
+
};
|
|
2491
|
+
readonly contextProperty: "analyticsSql";
|
|
2492
|
+
readonly key: "analyticsSql";
|
|
2493
|
+
readonly moduleSpecifier: "@lunora/bindings/analytics-sql";
|
|
2494
|
+
readonly requiredPackage: "@lunora/bindings";
|
|
2495
|
+
readonly serverCtxField: "\n /** Read-only SQL over Cloudflare's Analytics SQL API (Analytics Engine datasets and more) through the `analytics` binding. Non-deterministic — available only in actions. Reads here are NOT tracked by Lunora live queries. */\n readonly analyticsSql: import(\"@lunora/bindings/analytics-sql\").AnalyticsSql;";
|
|
2496
|
+
readonly shardBinding: {
|
|
2497
|
+
readonly binding: {
|
|
2498
|
+
readonly bindingType: "AnalyticsSqlBindingLike";
|
|
2499
|
+
readonly envName: "ANALYTICS_SQL";
|
|
2500
|
+
readonly factory: {
|
|
2501
|
+
readonly name: "createAnalyticsSql";
|
|
2502
|
+
readonly option: "binding";
|
|
2503
|
+
};
|
|
2504
|
+
};
|
|
2505
|
+
readonly clientType: "AnalyticsSql";
|
|
2506
|
+
readonly missingMessage: "ctx.analyticsSql: no Analytics SQL binding found. Add an `analytics` binding ({ binding: \"ANALYTICS_SQL\" }, wrangler >= 4.145.0) to wrangler.jsonc, or point ctx.analyticsSql at a token transport with defineApp().analyticsSql((env) => createAnalyticsSqlRest({ accountId, apiToken })).";
|
|
2507
|
+
readonly stubMethods: readonly ["query"];
|
|
2508
|
+
};
|
|
2509
|
+
readonly tier: "action";
|
|
2485
2510
|
}, {
|
|
2486
2511
|
readonly appMethod: {
|
|
2487
2512
|
readonly configKey: "artifacts";
|
|
@@ -2546,6 +2571,7 @@ declare const CAPABILITY_ROWS: readonly [{
|
|
|
2546
2571
|
readonly serverCtxField: "\n /**\n * 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.\n */\n readonly sql: import(\"@lunora/hyperdrive\").SqlClient;";
|
|
2547
2572
|
readonly shardBinding: {
|
|
2548
2573
|
readonly clientType: "SqlClient";
|
|
2574
|
+
readonly instrument: "instrumentSql";
|
|
2549
2575
|
readonly missingMessage: "ctx.sql: provide a `sql` config thunk that builds a SqlClient from your driver, e.g. `sql: (env) => fromPostgresJs(postgres(env.HYPERDRIVE.connectionString))`.";
|
|
2550
2576
|
readonly stubMethods: readonly ["query"];
|
|
2551
2577
|
};
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{SCHEMA_SNAPSHOT_VERSION as t,diffSchemaSnapshots as s,serializeSchemaSnapshot as a}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 c,errorAdvisoryNames as n,errorPlatformDiagnosticNames as l,sortedUniqueNames as x}from"./packem_shared/describeErrorLevelFindings-vzaGS9KL.mjs";import{CAPABILITY_PROBES as E}from"./packem_shared/CAPABILITY_PROBES-
|
|
1
|
+
import{SCHEMA_SNAPSHOT_VERSION as t,diffSchemaSnapshots as s,serializeSchemaSnapshot as a}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 c,errorAdvisoryNames as n,errorPlatformDiagnosticNames as l,sortedUniqueNames as x}from"./packem_shared/describeErrorLevelFindings-vzaGS9KL.mjs";import{CAPABILITY_PROBES as E}from"./packem_shared/CAPABILITY_PROBES-BPeV994T.mjs";import{CodegenDiagnosticError as A,diagnosticAt as v}from"./packem_shared/CodegenDiagnosticError-BUXlG3P-.mjs";import{AGENTS_FILENAME as g,discoverAgents as C}from"./packem_shared/AGENTS_FILENAME-D8SgT3OR.mjs";import{listLunoraSourceFiles as R}from"./packem_shared/listLunoraSourceFiles-CSlcBYlo.mjs";import{default as _}from"./packem_shared/discoverAuthApiCalls-DoSN_yc3.mjs";import{CONTAINERS_FILENAME as L,discoverContainers as M}from"./packem_shared/CONTAINERS_FILENAME-C13yKxas.mjs";import{default as F}from"./packem_shared/discoverCrons-BEALHx1S.mjs";import{sourceCapabilitySignals as D}from"./packem_shared/sourceCapabilitySignals-NsxX0VDV.mjs";import{FLAGS_FILENAME as U,discoverFlags as b}from"./packem_shared/FLAGS_FILENAME-W5XQz_Po.mjs";import{default as y}from"./packem_shared/discoverFunctions-BcBzcG5x.mjs";import{default as k}from"./packem_shared/discoverHttpRoutes-CJHS4llq.mjs";import{default as W}from"./packem_shared/discoverHyperdriveCalls-Bkbh4tG7.mjs";import{default as V}from"./packem_shared/discoverInserts-DpuLYPPd.mjs";import{d as Q}from"./packem_shared/index-D7dKfGPh.mjs";import{default as w}from"./packem_shared/discoverMigrations-Dt7ywfZv.mjs";import{MUTATORS_FILENAME as Y,discoverMutators as X}from"./packem_shared/MUTATORS_FILENAME-DqWOgC5Z.mjs";import{default as $}from"./packem_shared/discoverNondeterministicCalls-CNJV2BiP.mjs";import{NOTIFY_FILENAME as re,discoverNotifyCalls as oe,discoverNotifyConfig as te}from"./packem_shared/NOTIFY_FILENAME-C1J_47et.mjs";import{default as ae}from"./packem_shared/readPackageDependencies-C6h6FZuP.mjs";import{default as me}from"./packem_shared/discoverQueries-BcdqjYky.mjs";import{QUEUES_FILENAME as de,discoverQueues as pe}from"./packem_shared/QUEUES_FILENAME-RGwht3Xu.mjs";import{default as ne}from"./packem_shared/discoverR2sqlCalls-30Wtbc0P.mjs";import{default as xe}from"./packem_shared/discoverRlsProcedures-F4Cy-kSi.mjs";import{default as Ee}from"./packem_shared/discoverRlsMetadata-mXBmPOGj.mjs";import{discoverSandboxUsage as Ae}from"./packem_shared/discoverSandboxUsage-BnsPld5I.mjs";import{default as Ne}from"./packem_shared/discoverSchema-D5R60b4F.mjs";import{readServiceBindings as Ce,resolveServiceBindings as Oe}from"./packem_shared/readServiceBindings-CeQvSswr.mjs";import{SHAPES_FILENAME as Te,discoverShapes as _e}from"./packem_shared/SHAPES_FILENAME-DRUFomCj.mjs";import{default as Le}from"./packem_shared/discoverStorageRulesMetadata-D3Ot9g5f.mjs";import{WORKFLOWS_FILENAME as he,discoverWorkflows as Fe}from"./packem_shared/WORKFLOWS_FILENAME-4-ib4HH-.mjs";import{emitApp as De}from"./packem_shared/emitApp-CokyctXT.mjs";import{isD1GlobalTable as Ue,isHyperdriveGlobalTable as be}from"./packem_shared/isD1GlobalTable-udvHAAzD.mjs";import{buildOpenApiDocument as ye,emitOpenApi as je,emitOpenApiModule as ke}from"./packem_shared/buildOpenApiDocument-SxfElVzK.mjs";import{OPENRPC_VERSION as We,buildOpenRpcDocument as Ke,emitOpenRpc as Ve,emitOpenRpcModule as ze}from"./packem_shared/OPENRPC_VERSION-Cr7Zzp6s.mjs";import{DEFAULT_TARGET as qe,platformMatrixIds as we,readProjectTarget as Je,resolveCodegenTarget as Ye}from"./packem_shared/DEFAULT_TARGET-Co7ZXJ21.mjs";import{loadProjectConfig as Ze,readProjectConfigLiterals as $e}from"./packem_shared/loadProjectConfig-nNIDOrlR.mjs";import{SCHEMA_SNAPSHOT_FILENAME as rr,createCodegenProject as or,findTsconfig as tr,refreshCodegenProject as sr,runCodegen as ar}from"./packem_shared/SCHEMA_SNAPSHOT_FILENAME-CVtSBGXP.mjs";import{SchemaSnapshotParseError as mr,buildSchemaSnapshot as fr,evaluateSchemaDrift as dr,parseSchemaSnapshot as pr}from"./packem_shared/SchemaSnapshotParseError-CPOXlFhI.mjs";import{default as nr}from"./packem_shared/fingerprintSchemaSources-Cl1CJFeh.mjs";import{schemaFromIr as xr}from"./packem_shared/schemaFromIr-BWFnvCVg.mjs";import{LUNORA_ERROR_CODES as Er,validatorIrToJsonSchema as ur}from"./packem_shared/LUNORA_ERROR_CODES-C2s0xWQD.mjs";import{SDK_LANGUAGES as vr,SDK_TARGETS as Nr,generateSdk as gr}from"./packem_shared/SDK_LANGUAGES-Df_CnJx5.mjs";import{redact as Or,secretKindOf as Rr}from"./packem_shared/redact-Cy14LEnc.mjs";import{default as _r}from"./packem_shared/emitDrizzleSchema-Cv0HtLR3.mjs";import{default as Lr}from"./packem_shared/emitFunctions-BgNeOZt_.mjs";import{default as hr}from"./packem_shared/emitServer-DThb0DLe.mjs";import{e as Pr}from"./packem_shared/shard-CBwweXGB.mjs";import{G as Gr}from"./packem_shared/shared-DjUziztz.mjs";import{MESSAGE_SOLUTIONS as br,findSolutionByMessage as Hr}from"@lunora/errors";import{PROJECT_CONFIG_FILENAMES as jr,findProjectConfigFile as kr}from"./packem_shared/PROJECT_CONFIG_FILENAMES-DzOu-lSc.mjs";import{s as Wr,t as Kr,u as Vr}from"./packem_shared/shard-runtime-DTSpJxxd.mjs";import{emitApi as Qr,emitCollections as qr}from"./packem_shared/emitApi-DdW9RyGG.mjs";import{emitCrons as Jr,emitScheduler as Yr,emitVectors as Xr,emitWranglerCronTriggers as Zr}from"./packem_shared/emitCrons-BRKXFGFu.mjs";import{emitDataModel as eo}from"./packem_shared/emitDataModel-D3WuEZ4b.mjs";import{isTypedSchema as oo}from"./packem_shared/isTypedSchema-CKzc3ioR.mjs";const e="0.0.0";export{g as AGENTS_FILENAME,E as CAPABILITY_PROBES,L as CONTAINERS_FILENAME,A as CodegenDiagnosticError,qe as DEFAULT_TARGET,U as FLAGS_FILENAME,Gr as GENERATED_HEADER,Er as LUNORA_ERROR_CODES,br as LUNORA_SOLUTION_RULES,Y as MUTATORS_FILENAME,re as NOTIFY_FILENAME,We as OPENRPC_VERSION,jr as PROJECT_CONFIG_FILENAMES,de as QUEUES_FILENAME,rr as SCHEMA_SNAPSHOT_FILENAME,t as SCHEMA_SNAPSHOT_VERSION,vr as SDK_LANGUAGES,Nr as SDK_TARGETS,Te as SHAPES_FILENAME,mr as SchemaSnapshotParseError,e as VERSION,he as WORKFLOWS_FILENAME,ye as buildOpenApiDocument,Ke as buildOpenRpcDocument,fr as buildSchemaSnapshot,or as createCodegenProject,c as describeErrorLevelFindings,v as diagnosticAt,s as diffSchemaSnapshots,C as discoverAgents,_ as discoverAuthApiCalls,M as discoverContainers,F as discoverCrons,b as discoverFlags,y as discoverFunctions,k as discoverHttpRoutes,W as discoverHyperdriveCalls,V as discoverInserts,Q as discoverMaskProcedures,w as discoverMigrations,X as discoverMutators,$ as discoverNondeterministicCalls,oe as discoverNotifyCalls,te as discoverNotifyConfig,me as discoverQueries,pe as discoverQueues,ne as discoverR2sqlCalls,Ee as discoverRlsMetadata,xe as discoverRlsProcedures,Ae as discoverSandboxUsage,Ne as discoverSchema,_e as discoverShapes,Le as discoverStorageRulesMetadata,Fe as discoverWorkflows,Wr as emitAgents,Qr as emitApi,De as emitApp,qr as emitCollections,Kr as emitContainers,Jr as emitCrons,eo as emitDataModel,_r as emitDrizzleSchema,Lr as emitFunctions,je as emitOpenApi,ke as emitOpenApiModule,Ve as emitOpenRpc,ze as emitOpenRpcModule,Yr as emitScheduler,hr as emitServer,Pr as emitShard,Xr as emitVectors,Vr as emitWorkflows,Zr as emitWranglerCronTriggers,n as errorAdvisoryNames,l as errorPlatformDiagnosticNames,dr as evaluateSchemaDrift,Hr as findLunoraSolution,kr as findProjectConfigFile,tr as findTsconfig,nr as fingerprintSchemaSources,m as formatAdvisories,gr as generateSdk,Ue as isD1GlobalTable,be as isHyperdriveGlobalTable,oo as isTypedSchema,f as lintSchema,R as listLunoraSourceFiles,Ze as loadProjectConfig,pr as parseSchemaSnapshot,we as platformMatrixIds,ae as readPackageDependencies,$e as readProjectConfigLiterals,Je as readProjectTarget,Ce as readServiceBindings,Or as redact,sr as refreshCodegenProject,Ye as resolveCodegenTarget,Oe as resolveServiceBindings,ar as runCodegen,xr as schemaFromIr,Rr as secretKindOf,a as serializeSchemaSnapshot,x as sortedUniqueNames,D as sourceCapabilitySignals,d as toAdvisorContext,ur as validatorIrToJsonSchema};
|
package/dist/packem_shared/{CAPABILITY_PROBES-BbW-W0N2.mjs → CAPABILITY_PROBES-BPeV994T.mjs}
RENAMED
|
@@ -3,13 +3,15 @@ const n=[{contextProperty:"access",key:"access",moduleSpecifier:"@lunora/cloudfl
|
|
|
3
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:`
|
|
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
|
-
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:"
|
|
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:`
|
|
7
|
+
/** Read-only SQL over Cloudflare's Analytics SQL API (Analytics Engine datasets and more) through the \`analytics\` binding. Non-deterministic — available only in actions. Reads here are NOT tracked by Lunora live queries. */
|
|
8
|
+
readonly analyticsSql: import("@lunora/bindings/analytics-sql").AnalyticsSql;`,shardBinding:{binding:{bindingType:"AnalyticsSqlBindingLike",envName:"ANALYTICS_SQL",factory:{name:"createAnalyticsSql",option:"binding"}},clientType:"AnalyticsSql",missingMessage:'ctx.analyticsSql: no Analytics SQL binding found. Add an `analytics` binding ({ binding: "ANALYTICS_SQL" }, wrangler >= 4.145.0) to wrangler.jsonc, or point ctx.analyticsSql at a token transport with defineApp().analyticsSql((env) => createAnalyticsSqlRest({ accountId, apiToken })).',stubMethods:["query"]},tier:"action"},{appMethod:{configKey:"artifacts",doc:"Override the Artifacts binding backing `ctx.artifacts` (defaults to `env.ARTIFACTS`).",method:"artifacts"},contextProperty:"artifacts",key:"artifacts",moduleSpecifier:"@lunora/bindings/artifacts",requiredPackage:"@lunora/bindings",serverCtxField:'\n /** Cloudflare Artifacts repos (create/import/fork, Git tokens, read commits and files). Non-deterministic — available only in actions. Writes go through `git push` with a token, not this client. */\n readonly artifacts: import("@lunora/bindings/artifacts").ArtifactsClient;',shardBinding:{binding:{bindingType:"ArtifactsBindingLike",envName:"ARTIFACTS",factory:{name:"createArtifacts",option:"binding"}},clientType:"ArtifactsClient",missingMessage:'ctx.artifacts: no Artifacts binding found. Add an `artifacts` binding ({ binding: "ARTIFACTS", namespace }) to wrangler.jsonc, or point ctx.artifacts at another binding with defineApp().artifacts((env) => env.<BINDING>).',stubMethods:["authenticatedRemote","create","delete","import","info","list","withRepo"],syncStubMethods:["authenticatedRemote"]},tier:"action"},{appMethod:{configKey:"browser",doc:"Build the `ctx.browser` helper, e.g. `(env) => createBrowser({ binding: env.BROWSER, launch })`. REQUIRED: unlike the binding-backed capabilities, `ctx.browser` is not auto-constructed — without this thunk every method throws, because the generated worker deliberately stays free of the optional `@cloudflare/playwright` peer.",method:"browser"},contextProperty:"browser",key:"browser",moduleSpecifier:"@lunora/browser",requiredPackage:"@lunora/browser",serverCtxField:`
|
|
7
9
|
/** Browser Rendering (screenshots/PDF/scrape). Non-deterministic — available only in actions. */
|
|
8
10
|
readonly browser: import("@lunora/browser").Browser;`,shardBinding:{clientType:"Browser",missingMessage:"ctx.browser: provide a `browser` config thunk, e.g. `browser: (env) => createBrowser({ binding: env.BROWSER, launch })` with `import { launch } from '@cloudflare/playwright'`. Session reuse (connect/sessions) additionally needs those two exports passed the same way.",stubMethods:["cancelCrawl","connect","content","crawl","crawlResult","launch","pdf","quickAction","scrape","screenshot","sessions"]},tier:"action"},{contextProperty:"containers",key:"container",moduleSpecifier:"@lunora/container"},{contextProperty:"flags",key:"flags",moduleSpecifier:"@lunora/flags"},{appMethod:{configKey:"sql",doc:"Wire the Hyperdrive SQL client backing `ctx.sql` — build it with `createHyperdrive` + `fromPostgresJs`/`fromNodePg`/`fromMysql2`.",method:"hyperdrive"},contextProperty:"sql",key:"hyperdrive",moduleSpecifier:"@lunora/hyperdrive",requiredPackage:"@lunora/hyperdrive",serverCtxField:`
|
|
9
11
|
/**
|
|
10
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.
|
|
11
13
|
*/
|
|
12
|
-
readonly sql: import("@lunora/hyperdrive").SqlClient;`,shardBinding:{clientType:"SqlClient",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"},contextProperty:"images",key:"images",moduleSpecifier:"@lunora/bindings/images",requiredPackage:"@lunora/bindings",serverCtxField:`
|
|
13
15
|
/** Cloudflare Images transforms (resize/format/optimize). Non-deterministic — available only in actions. */
|
|
14
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:`
|
|
15
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"},{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:`
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{NODE_CAPABILITIES as f,CLOUDFLARE_CAPABILITIES as h,CELLD_CAPABILITIES as b}from"@lunora/platform";import{readProjectConfigLiterals as g}from"./loadProjectConfig-nNIDOrlR.mjs";const d="cloudflare",v=t=>{const{target:e}=g(t);return e!==void 0&&e.length>0?e:void 0},A=(t,e)=>e??v(t)??d,L=(t,e)=>{if(e!==void 0)return[];const{target:a,unreadable:r}=g(t);return r!==!0||a!==void 0?[]:[{level:"warn",message:`lunora.config declares a \`target\` that codegen cannot read without evaluating it, so the "${d}" surface was emitted. \`runCodegen\` resolves the target synchronously, which means it reads literals only.`,name:"platform_unreadable_target",remediation:`Write \`target\` as a string literal on the config's default export (\`export default { target: "${d}" }\`), or pass \`--target\`.`,target:d}]},u={celld:b,cloudflare:h,node:f},C=()=>Object.keys(u).toSorted((t,e)=>t.localeCompare(e)),S={access:null,ai:"ai",aiSearch:"aiSearch",analytics:"analytics",analyticsSql:"analyticsSql",artifacts:"artifacts",browser:"browser",container:"containers",flags:null,hyperdrive:"hyperdrive",images:"images",kv:"keyValueStore",mail:"mail",notify:null,payments:null,pipelines:"pipelines",r2sql:null,scheduler:"scheduler",storage:"objectStorage",vectors:"vectorStore",workflows:"workflows",x402:null},w=["agents","commitOrderedTables","containerEgressPolicy","containerRuntimeScheduling","containerSandboxTools","cronTriggers","crossShardFanout","durableStreams","globalTables","queues","relationGraph","secrets","services","topics","vectorStore","workerLoaders","workflowRollback","workflowSchedules"],m={agents:"durable agents (`defineAgent`)",commitOrderedTables:"commit-ordered tables (`.commitOrdered()`)",containerEgressPolicy:"container egress policies (`defineContainer({ allowedHosts | deniedHosts | interceptHttps })`)",containerRuntimeScheduling:'per-instance container images and snapshots (`defineContainer({ schedulingPolicy: "durable_object" })`)',containerSandboxTools:"container sandbox helpers — files, directory backups, bucket mounts (`defineContainer({ sandbox: true })`)",cronTriggers:"declared cron triggers (`cronJobs()`)",crossShardFanout:"cross-shard fan-out queries (a `.shardBy(...)` schema)",durableStreams:"durable streams (`.stream(handler, { durable: true })`)",globalTables:"global tables (`.global()`)",queues:"queues (`defineQueue`)",relationGraph:"relation-graph traversal (`ctx.db.related`, derived from `v.id(...)` columns)",secrets:"the secrets store (`ctx.secrets`)",services:"service bindings to sibling Workers (`lunora.config` `services`)",topics:"pub/sub topics (`defineTopic` / `defineSubscription`)",vectorStore:"vector indexes (`.vectorize()`)",workerLoaders:"sandboxed agent scripts (`jsCodeTool`, on Worker Loaders)",workflowRollback:"workflow step rollback (`defineStep({ rollback })`)",workflowSchedules:"scheduled workflow instances (`defineWorkflow({ schedules })`)"},y=(t,e,a)=>({level:"error",message:`${e.name} does not support ${m[t]}, which this app declares.`,name:"platform_unsupported_feature",remediation:`Remove the declaration, or deploy to a target whose capability matrix marks "${t}" as native or emulated.`,target:a}),T=(t,e,a)=>({level:"error",message:`${e.name}'s capability matrix does not declare a support level for ${m[t]}, which this app declares. Treated as unsupported.`,name:"platform_undeclared_feature",remediation:`Rate "${t}" in the ${e.name} capability matrix as "native", "emulated", or "unsupported" — an undeclared feature fails closed rather than letting the app deploy onto a primitive the host may not provide.`,target:a}),k=t=>{const{diagnostics:e,gatedSignals:a,matrix:r,reported:n,signals:c,target:i}=t;for(const s of w){if(c[s]!==!0)continue;const o=r.features[s]?.level;o!=="unsupported"&&o!==void 0||(a[s]=!1,!n.has(s)&&e.push(o==="unsupported"?y(s,r,i):T(s,r,i)))}},_=(t,e,a,r={})=>{const n={...t},c={...r},i=[],s=new Set;for(const[o,l]of Object.entries(S)){if(l===null||!t[o])continue;const p=e.features[l]?.level;p==="unsupported"?(n[o]=!1,s.add(l),i.push({feature:o,level:"error",message:`${e.name} does not support "${o}" (ctx.${o}).`,name:"platform_unsupported_feature",remediation:`Remove the ctx.${o} usage, or deploy to a target whose capability matrix marks "${l}" as native or emulated.`,target:a})):p===void 0&&(n[o]=!1,s.add(l),i.push({feature:o,level:"error",message:`${e.name}'s capability matrix does not declare a support level for "${o}" (ctx.${o}). Treated as unsupported.`,name:"platform_undeclared_feature",remediation:`Rate "${l}" in the ${e.name} capability matrix as "native", "emulated", or "unsupported" — an undeclared feature fails closed rather than shipping a surface the host may not provide.`,target:a}))}return k({diagnostics:i,gatedSignals:c,matrix:e,reported:s,signals:r,target:a}),{diagnostics:i,signals:c,usage:n}},E=(t,e,a={})=>{const r=u[e];return r===void 0?{diagnostics:[{level:"error",message:`Unknown deploy target "${e}" — no capability matrix is registered for it. Codegen emitted the full Cloudflare surface un-gated.`,name:"platform_unknown_target",remediation:`Use a registered target (${Object.keys(u).join(", ")}) or install the target's @lunora/platform-${e} package.`,target:e}],signals:{...a},usage:{...t}}:_(t,r,e,a)},I=t=>{const e=u[t];if(e===void 0)return;const a=Object.entries(e.features).filter(([,r])=>r.level==="unsupported").map(([r])=>r).toSorted((r,n)=>r.localeCompare(n));return{id:e.id,name:e.name,unsupported:a}};export{S as CAPABILITY_TO_FEATURE,d as DEFAULT_TARGET,_ as gateAgainstMatrix,E as gatePlatformFeatures,C as platformMatrixIds,v as readProjectTarget,L as readTargetDiagnostics,A as resolveCodegenTarget,I as studioPlatformFor};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{existsSync as w,mkdirSync as rn,readFileSync as cs,writeFileSync as on,rmSync as an}from"node:fs";import{join as h,dirname as he}from"node:path";import{performance as Ke}from"node:perf_hooks";import{runAdvisor as cn}from"@lunora/advisor";import{LunoraError as U}from"@lunora/errors";import{SyntaxKind as l,Node as i,VariableDeclarationKind as ln,Project as Ot}from"ts-morph";import{serializeSchemaSnapshot as un}from"./SCHEMA_SNAPSHOT_VERSION-C0oHwiJZ.mjs";import{toAdvisorContext as dn}from"./formatAdvisories-DwmUKYuc.mjs";import{readProjectConfigLiterals as fn}from"./loadProjectConfig-nNIDOrlR.mjs";import{a as Rt,d as pn,r as gn}from"./modules-DyCocr1e.mjs";import{QUEUES_FILENAME as mn,discoverQueueDeclarations as hn}from"./QUEUES_FILENAME-RGwht3Xu.mjs";import{WORKFLOWS_FILENAME as vn,discoverWorkflows as xn}from"./WORKFLOWS_FILENAME-4-ib4HH-.mjs";import{r as En}from"./json-data-Chfs2Cz5.mjs";import{s as be}from"./paths-C-9fwEgQ.mjs";import{G as Sn}from"./shared-DjUziztz.mjs";import{CAPABILITIES as yn,usedCapabilities as An}from"./CAPABILITY_PROBES-
|
|
1
|
+
import{existsSync as w,mkdirSync as rn,readFileSync as cs,writeFileSync as on,rmSync as an}from"node:fs";import{join as h,dirname as he}from"node:path";import{performance as Ke}from"node:perf_hooks";import{runAdvisor as cn}from"@lunora/advisor";import{LunoraError as U}from"@lunora/errors";import{SyntaxKind as l,Node as i,VariableDeclarationKind as ln,Project as Ot}from"ts-morph";import{serializeSchemaSnapshot as un}from"./SCHEMA_SNAPSHOT_VERSION-C0oHwiJZ.mjs";import{toAdvisorContext as dn}from"./formatAdvisories-DwmUKYuc.mjs";import{readProjectConfigLiterals as fn}from"./loadProjectConfig-nNIDOrlR.mjs";import{a as Rt,d as pn,r as gn}from"./modules-DyCocr1e.mjs";import{QUEUES_FILENAME as mn,discoverQueueDeclarations as hn}from"./QUEUES_FILENAME-RGwht3Xu.mjs";import{WORKFLOWS_FILENAME as vn,discoverWorkflows as xn}from"./WORKFLOWS_FILENAME-4-ib4HH-.mjs";import{r as En}from"./json-data-Chfs2Cz5.mjs";import{s as be}from"./paths-C-9fwEgQ.mjs";import{G as Sn}from"./shared-DjUziztz.mjs";import{CAPABILITIES as yn,usedCapabilities as An}from"./CAPABILITY_PROBES-BPeV994T.mjs";import{isD1GlobalTable as ls,isHyperdriveGlobalTable as us}from"./isD1GlobalTable-udvHAAzD.mjs";import{discoverAgents as bn}from"./AGENTS_FILENAME-D8SgT3OR.mjs";import{discoverContainers as Nn}from"./CONTAINERS_FILENAME-C13yKxas.mjs";import wn from"./discoverCrons-BEALHx1S.mjs";import{diagnosticAt as ae}from"./CodegenDiagnosticError-BUXlG3P-.mjs";import{b as Ne}from"./module-specifiers-WF8iAydP.mjs";import{contextPropertiesRead as Pn,discoverFeatureUsage as In}from"./sourceCapabilitySignals-NsxX0VDV.mjs";import Tn from"./readPackageDependencies-C6h6FZuP.mjs";import{listLunoraSourceFiles as g,propertyKeyName as x,unwrapExpression as ne,listSecurityScanFiles as we,objectLiteralFromCallbackBody as ds,propertyInitializer as b,lunoraRelativePath as m,enclosingExportName as re,bindingKeyName as Pe,collectCallRows as F,findObjectProperty as C,collectSecurityCallRows as Cn,RUN_METHODS as fs,functionReferenceSegments as ps,limitNameOf as gs,optionsObjectLiteral as ms,isContextIdentifier as Ve,handlerOf as Fn,isDatabaseAccessor as k,readTargetOf as hs}from"./listLunoraSourceFiles-CSlcBYlo.mjs";import{discoverSandboxUsage as On}from"./discoverSandboxUsage-BnsPld5I.mjs";import{resolveServiceBindings as Rn}from"./readServiceBindings-CeQvSswr.mjs";import Ln from"./discoverStorageRulesMetadata-D3Ot9g5f.mjs";import{a as S,c as B,d as vs,e as kn}from"./classify-procedure-call-CmcShAze.mjs";import{i as Dn}from"./ir-DBSvhNa-.mjs";import{gatePlatformFeatures as Mn,resolveCodegenTarget as xs,readTargetDiagnostics as _n,studioPlatformFor as Kn}from"./DEFAULT_TARGET-Co7ZXJ21.mjs";import{b as Es,e as $n}from"./shard-CBwweXGB.mjs";import zn from"./emitServer-DThb0DLe.mjs";import{emitDataModel as Un}from"./emitDataModel-D3WuEZ4b.mjs";import{r as Ie,s as Bn}from"./parse-validator-C6fHL7OS.mjs";import qn from"./discoverAuthApiCalls-DoSN_yc3.mjs";import{i as jn,a as Wn,e as Vn,b as Hn,d as Gn,c as Yn}from"./unwrap-handler-return-DVY_kFF7.mjs";import Qn from"./discoverFunctions-BcBzcG5x.mjs";import Xn from"./discoverHttpRoutes-CJHS4llq.mjs";import Jn from"./discoverHyperdriveCalls-Bkbh4tG7.mjs";import Zn from"./discoverInserts-DpuLYPPd.mjs";import{m as Ze,a as Ee,s as Ss,d as er}from"./index-D7dKfGPh.mjs";import{e as ys}from"./exported-procedure-chains-D48EXUVQ.mjs";import tr from"./discoverMigrations-Dt7ywfZv.mjs";import{MUTATORS_FILENAME as sr,isDefineMutatorCallee as nr,discoverMutators as rr}from"./MUTATORS_FILENAME-DqWOgC5Z.mjs";import or from"./discoverNondeterministicCalls-CNJV2BiP.mjs";import{discoverNotifyConfig as ir,discoverNotifyCalls as ar}from"./NOTIFY_FILENAME-C1J_47et.mjs";import cr from"./discoverQueries-BcdqjYky.mjs";import lr from"./discoverR2sqlCalls-30Wtbc0P.mjs";import ur from"./discoverRlsProcedures-F4Cy-kSi.mjs";import dr from"./discoverRlsMetadata-mXBmPOGj.mjs";import fr from"./discoverSchema-D5R60b4F.mjs";import{secretKindOf as pr,redact as gr,isHeuristicSecretKind as mr,isSecretishName as hr}from"./redact-Cy14LEnc.mjs";import{discoverShapes as vr}from"./SHAPES_FILENAME-DRUFomCj.mjs";import{emitApp as xr}from"./emitApp-CokyctXT.mjs";import{buildOpenApiDocument as Er,emitOpenApiModule as Sr}from"./buildOpenApiDocument-SxfElVzK.mjs";import{buildOpenRpcDocument as yr,emitOpenRpcModule as Ar}from"./OPENRPC_VERSION-Cr7Zzp6s.mjs";import{buildSchemaSnapshot as br}from"./SchemaSnapshotParseError-CPOXlFhI.mjs";import{emitCollections as Nr,emitSeed as wr,emitApi as Pr}from"./emitApi-DdW9RyGG.mjs";import{t as Ir,u as Tr,s as Cr,v as Fr}from"./shard-runtime-DTSpJxxd.mjs";import{emitCrons as Or,emitScheduler as Rr,emitShardRegistry as Lr,emitVectors as kr,emitWranglerCronTriggers as Dr}from"./emitCrons-BRKXFGFu.mjs";import Mr from"./emitDrizzleSchema-Cv0HtLR3.mjs";import _r from"./emitFunctions-BgNeOZt_.mjs";const Lt={error:"ERROR",info:"INFO",warn:"WARN"},kt={ERROR:2,INFO:0,WARN:1},Kr=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"}),$r=(e,t)=>{const{advisor:s}=fn(e);if(s===void 0||s.minSeverity===void 0&&s.unreadable!==!0)return[...t];const{minSeverity:n}=s,o=n!==void 0&&Object.hasOwn(Lt,n)?Lt[n]:void 0;return o===void 0?[...t,Kr(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(r=>kt[r.level]>=kt[o])},zr={call:"function",enqueue:"queue",invoke:"service",publish:"topic",schedule:"function"},As=mn.replace(/\.ts$/u,""),Ur="crons",Br=vn.replace(/\.ts$/u,""),te=(e,t)=>`${be(e)}:${t}`,$e=(e,t,s)=>t===""?{reason:`the ${s} is not a string literal`}:{to:`${e}:${t}`},qr=e=>[...e.callEdges.map(t=>{const s=t.target===void 0?{reason:t.reason??"unreadable target"}:{to:`${zr[t.kind]}:${t.target}`};return{exportName:t.exportName,file:t.file,kind:t.kind,line:t.line,...s}}),...e.queries.map(t=>({exportName:t.exportName,file:t.file,kind:"read",line:t.line,...$e("table",t.table,"table name")})),...[...e.inserts,...e.tableWrites].map(t=>({exportName:t.exportName,file:t.file,kind:"write",line:t.line,...$e("table",t.table,"written table")})),...e.workflowCalls.map(t=>({exportName:t.exportName,file:t.file,kind:"start",line:t.line,...$e("workflow",t.workflow,"workflow name")}))],jr=e=>[...e.queues.flatMap(t=>t.topic===void 0?[]:[{exportName:t.exportName,file:As,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}`,o=s??n;return{exportName:t.name,file:Ur,from:`cron:${t.name}`,kind:"trigger",line:0,...o===void 0?{reason:"the cron has no target"}:{to:o}}})],Wr=e=>new Map(e.flatMap(t=>t.tables.map(s=>[s,t.name]))),ze=(e,t)=>t===void 0?e:{...e,module:t},Vr=e=>{const t=new Map,s=new Map,n=Wr(e.modules),o=(r,a)=>{t.set(r.id,r),a!==void 0&&s.set(a,r.id)};for(const r of e.functions){const a=te(r.filePath,r.exportName),c=`${be(r.filePath)}.${r.exportName}`;o(ze({detail:r.kind,id:`function:${a}`,kind:"function",name:c},Rt(e.modules,r.filePath)),a)}for(const r of e.httpRoutes){const a=te(r.filePath,r.exportName);o(ze({id:`http:${a}`,kind:"http",name:`${r.method} ${r.path}`},Rt(e.modules,r.filePath)),a)}for(const r of e.schema.tables)o(ze({id:`table:${r.name}`,kind:"table",name:r.name},n.get(r.name)));for(const r of e.queues){const a=r.topic===void 0?{}:{detail:"subscription"};o({...a,id:`queue:${r.exportName}`,kind:"queue",name:r.exportName},te(As,r.exportName))}for(const r of e.topics)o({id:`topic:${r.exportName}`,kind:"topic",name:r.exportName});for(const r of e.workflows)o({id:`workflow:${r.exportName}`,kind:"workflow",name:r.exportName},te(Br,r.exportName));for(const r of e.crons)o({detail:r.cron,id:`cron:${r.name}`,kind:"cron",name:r.name});for(const r of e.services){const a=r.rpcEntrypoint===void 0?"fetch":"rpc";o({detail:r.entrypoint===void 0?a:`${a} · ${r.entrypoint}`,id:`service:${r.name}`,kind:"service",name:r.worker})}return{nodes:t,sites:s}},Hr=e=>e===""?"inside a non-exported helper":e==="default"?"the default export is not a registered function":`"${e}" is not a registered function`,Gr=(e,t,s)=>{if("reason"in e)return{reason:e.reason};const n=e.from??t.get(te(e.file,e.exportName));return n===void 0?{reason:Hr(e.exportName)}:s.has(e.to)?{drawn:{from:n,kind:e.kind,to:e.to}}:{reason:`${e.to} is not declared`}},Ue=e=>`${e.from}|${e.kind}|${e.to}`,Yr=e=>`${e.file}|${String(e.line)}|${e.kind}|${e.reason}`,Qr=e=>{const{nodes:t,sites:s}=Vr(e),n=new Map,o=new Map;for(const r of[...jr(e),...qr(e)]){const a=Gr(r,s,t);if("drawn"in a)n.set(Ue(a.drawn),a.drawn);else{const c={file:r.file,kind:r.kind,line:r.line,reason:a.reason};o.set(Yr(c),c)}}return{edges:[...n.values()].toSorted((r,a)=>Ue(r).localeCompare(Ue(a))),nodes:[...t.values()].toSorted((r,a)=>r.id.localeCompare(a.id)),modules:e.modules.map(r=>({...r.description===void 0?{}:{description:r.description},...r.installed===!0?{installed:!0}:{},...r.ownsFolder===!1?{ownsFolder:!1}:{},name:r.name,tables:[...r.tables]})),unresolved:[...o.values()].toSorted((r,a)=>r.file.localeCompare(a.file)||r.line-a.line),version:1}},Xr=e=>`${Sn}export const architecture = ${En(e,"Record<string, unknown>")};
|
|
2
2
|
`,Jr=(e,t)=>{if(!(!t||e.jurisdiction!=="fedramp"))throw new U("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.')},Dt=(e,t="api")=>{const s=new Map;for(const n of e){const o=be(n),r=s.get(o);if(r===void 0){s.set(o,n);continue}if(r!==n){const a=t==="api"?`the generated api.ts would declare "${o}" twice and the dispatch key "${o}:<fn>" would be ambiguous`:`the generated api.ts would declare "${o}" twice in HttpStreamsRef and again in the httpStreams object literal`;throw new U("INTERNAL",`@lunora/codegen: "${r}" and "${n}" both map to the ${t} namespace "${o}" — ${a}. Rename one file so the two differ by more than a non-identifier character (\`-\`, \`.\`, \`/\` and \`_\` all sanitize to \`_\`).`,{status:500})}}},Zr=(e,t={})=>{const{hasVectors:s=!0,scheduler:n=!1,storage:o=!1,usage:r}=t,a=[];e.tables.some(c=>ls(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=>us(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`"}),o&&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 r===void 0?[]:yn)c.requiredPackage!==void 0&&r?.[c.key]===!0&&a.push({name:c.requiredPackage,reason:`\`ctx.${c.contextProperty??c.key}\` usage makes \`_generated/\` import \`${c.moduleSpecifier}\``});return a.filter((c,u)=>a.findIndex(d=>d.name===c.name)===u)},eo=(e,t,s={})=>{if(t===void 0)return;const n=Zr(e,s).filter(r=>!t.has(r.name));if(n.length===0)return;const o=n.map(r=>` - ${r.name} — ${r.reason}`).join(`
|
|
3
3
|
`);throw new U("INTERNAL",`@lunora/codegen: this schema's generated code imports packages the project does not declare:
|
|
4
4
|
${o}
|
|
@@ -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-
|
|
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-DTSpJxxd.mjs";import"./shared-DjUziztz.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-BbW-W0N2.mjs";import{i as S}from"./ir-DBSvhNa-.mjs";import{G as E}from"./shared-DjUziztz.mjs";const D=e=>k.filter(({key:r})=>e.capabilities.has(r)),R={configKey:"vectors",doc:"Wire the Vectorize index map backing `ctx.vectors`.",method:"vectors"},g=e=>[...D(e).map(({appMethod:r})=>r),...e.hasVectors===!0?[R]:[]],m=e=>g(e).length>0,x=e=>e?['import * as lunoraIdentityContract from "../identity.js";']:[],A=(e,r)=>e?['import type { CreateAccessResolverOptions } from "@lunora/cloudflare-access";',`import { createAccessResolver${r?", composeResolvers":""} } from "@lunora/cloudflare-access";`]:[],C=e=>e?['import { createKvIntrospectorFromEnv } from "@lunora/bindings/kv";']:[],O=e=>e?['import { createVectorAdminIntrospector } from "@lunora/bindings/vectors";']:[],T=e=>e?['import type { D1CtxDbOptions, D1DatabaseLike, D1Exec } from "@lunora/d1";','import { applyCdcChanges, createD1CtxDb, emitD1QueryCost, exportGlobalRows, facetGlobalColumn, importGlobalRows, listGlobalTables, readD1CdcChanges, readGlobalTablePage, retryingExec } from "@lunora/d1";']:[],N=e=>e?['import notifyConfig from "../notify.js";']:[],v=e=>(e.emailAgents?.length??0)>0,q=e=>v(e)?['import { dispatchAgentEmail } from "@lunora/agent/inbound";']:[],I=e=>v(e)?['import * as lunoraAgentDefinitions from "../agents.js";']:[],d=e=>e.tables.some(r=>S(r)),L=e=>{const{hasFramework:r,hasGlobal:t,hasHyperdriveGlobal:a,hasQueue:n,useUmbrella:o}=e,i=o?"lunorash/runtime":"@lunora/runtime",l=["ExecutionContextLike","HttpRouterLike","LunoraWorker","Route","ScheduledControllerLike","ShardNamespaceLike","WorkerOptions",...n?["TriggerTrace"]:[],...t?["GlobalIntrospector"]:[],...e.tables.length>0?["ShardingInfo"]:[],...r?["FrameworkHostHandler"]:[]],c=[...t||a?["createCrossShardRelationCapabilities"]:[],...d(e)?["createDynamicShardRegistry","createQueryCoordinator"]:[],"createWorker",...e.jurisdiction?["declareAppJurisdiction"]:[],"resolveLogArchiveFromEnv",...r?["withFrameworkWorker"]:[]].join(", ");return[`import type { ${[...l].toSorted((s,h)=>s.localeCompare(h)).join(", ")} } from "${i}";`,`import { ${c} } from "${i}";`]},j=e=>{const{hasAccess:r,hasAuth:t,hasGlobal:a,hasHyperdriveGlobal:n,hasKvIntrospector:o,hasQueue:i,hasScheduler:l,hasStorage:c,hasWorkflow:s,wantsOpenApi:h,wantsOpenRpc:u}=e;return[...t?['import type { AuthNamespaceLike, LunoraAuth, LunoraAuthOptions } from "@lunora/auth";','import { authDiscoveryPathsFor, createAuth, createAuthAdmin, createAuthAuditReader, createDoAuthWiring, d1Executor, ensureMigrated, handleAuthDiscoveryRequest, handleAuthRequest, lunoraD1Adapter } from "@lunora/auth";']:[],...A(r,t),...T(a),...n?['import type { HyperdriveEngine } from "@lunora/hyperdrive/global";','import { createHyperdriveGlobalCtxDb } from "@lunora/hyperdrive/global";','import type { SqlCtxDbOptions, SqlExec } from "@lunora/sql-store";']:[],...C(o),...O(e.hasVectors===!0),...l?['import type { DurableObjectNamespaceLike } from "@lunora/scheduler";','import { createScheduler } from "@lunora/scheduler";']:[],...c?['import type { R2BucketLike, R2S3Credentials, Storage } from "@lunora/storage";','import { createBucketStorage, createStorage } from "@lunora/storage";']:[],...s?['import { createWorkflowsRestClient } from "@lunora/workflow";']:[],...q(e),...L(e),"",...x(e.identity),...I(e),...a||n?['import schema from "../schema.js";']:[],...N(e.hasNotify),'import { LUNORA_CRONS } from "./crons.js";','import { LUNORA_FUNCTIONS } from "./functions.js";',...i?['import { createQueueCaptureSink, dispatchQueueBatch, shouldCaptureQueue } from "@lunora/queue";','import { LUNORA_QUEUE_REGISTRY } from "./queues.js";']:[],...e.wantsArchitecture?['import { architecture } from "./architecture.js";']:[],...h?['import { openApiSpec } from "./openapi.js";']:[],...u?['import { openRpcSpec } from "./openrpc.js";']:[],'import { createShardDO } from "./shard.js";',...e.hasVectors===!0?['import { LUNORA_VECTOR_INDEXES } from "./vectors.js";']:[]]},G=e=>[...e.hasStorage?["/** `.storage(...)` declaration — one bucket (required) plus optional extra named buckets and signed-URL config. Backs `ctx.storage` AND the studio file browser. */\ninterface StorageDeclaration<Env> {\n /** The default R2 bucket binding (the bare `ctx.storage`). */\n bucket: Selector<Env, R2BucketLike>;\n /** Extra named buckets, reached via `ctx.storage.bucket(\"name\")` and the studio's bucket picker. */\n buckets?: Record<string, Selector<Env, R2BucketLike>>;\n /** Public base URL signed/public object URLs resolve against. Omit it and `ctx.storage` in a mutation, action or HTTP handler (and the studio's copy-URL) signs against the origin the request reached the worker on — no per-environment value to ship. Queries get no such fallback (a live query re-runs with no request behind it), so a query that signs URLs needs this set. */\n publicBaseUrl?: Selector<Env, string>;\n /** R2 S3-API credentials (`{ accountId, accessKeyId, secretAccessKey, bucket, jurisdiction? }`) enabling `ctx.storage.getPresignedUrl` — native S3 presigned URLs that hit R2 directly, bypassing the worker. Omit to use only the worker-signed `getSignedUrl` path. */\n s3?: Selector<Env, R2S3Credentials>;\n /** HMAC secret for signed URLs. */\n signingSecret?: Selector<Env, string>;\n}"]:[],...e.hasScheduler?["/** `.scheduler(...)` declaration — the `SchedulerDO` namespace. Backs `ctx.scheduler` AND the studio's scheduled-jobs view. The origin its callbacks dispatch back to is not declared here: the DO reads `env.LUNORA_ORIGIN_URL` at fire time, because a caller-supplied dispatch target would be an SSRF vector. */\ninterface SchedulerDeclaration<Env> {\n /** The `SchedulerDO` namespace binding (typically `env.SCHEDULER`). */\n namespace: Selector<Env, DurableObjectNamespaceLike & ShardNamespaceLike>;\n}"]:[],...e.hasGlobal?["/** `.global(...)` declaration — the D1 binding backing `.global()` tables. Backs cross-tenant `ctx.db` reads/writes AND the studio's global data browser. */\ninterface GlobalDeclaration<Env> {\n /** The D1 binding (typically `env.DB`). */\n d1: Selector<Env, D1DatabaseLike>;\n /** The worker origin used to fan reverse cross-backend relations across shards. Without it, such a relation throws a clear error. */\n origin?: Selector<Env, string>;\n}"]:[],...e.hasHyperdriveGlobal?['/** `.hyperdriveGlobal(...)` declaration — backs `.global({ backend: "hyperdrive" })` tables on a Postgres/MySQL database via Hyperdrive. Stays reactive: the writer is injected as `globalDb` and the broadcast hook drives live queries. */\ninterface HyperdriveGlobalDeclaration<Env> {\n /** The Hyperdrive engine — selects the Postgres or MySQL dialect. */\n engine: HyperdriveEngine;\n /** Build the `SqlExec` from `env` — e.g. `buildPgExec(fromPostgresJs(postgres(env.HYPERDRIVE.connectionString)))`. Cache the driver on the DO instance; rebuild lazily after hibernation. */\n exec: (env: Env) => SqlExec;\n /** The worker origin used to fan reverse cross-backend relations across shards. Without it, such a relation throws a clear error. */\n origin?: Selector<Env, string>;\n}']:[],...e.hasAuth?['/** `.auth(...)` declaration — better-auth options plus the storage the adapter reads. Give it `d1` (the default) or `namespace` (a Durable Object that hosts the auth tables), never both. The builder owns the lazy build + `ensureMigrated` dance and wires `authHandler` / `resolveIdentity` / `authAdmin`. */\ninterface AuthDeclaration<Env> {\n /** The D1 binding the auth SQL adapter is wired over (via `lunoraD1Adapter`). Omit only when using `namespace`. */\n d1?: Selector<Env, unknown>;\n /** Shared secret the worker presents on the object\'s internal session route. REQUIRED with `namespace`: the binding is reachable from any worker bound to it, so the secret — not the binding — is the authorization boundary. Without it identity resolution fails closed. */\n internalSecret?: Selector<Env, string>;\n /** Name of the Durable Object instance holding the auth tables. Defaults to `"auth"`. Set it to run separate auth objects (per deployment, per tenant) off one namespace. */\n objectName?: Selector<Env, string>;\n /** The auth Durable Object namespace — the DO-backed mode. Needed for `@better-auth/scim`, which requires native transactions that D1 has none of. The object owns the auth tables, so `/api/auth/*` and identity resolution both go through it. Typed as `AuthNamespaceLike` because `createDoAuthWiring` resolves through `idFromName` + `get` and has no `getByName` fallback — both members are load-bearing here, and `ShardNamespaceLike` leaves both optional. */\n namespace?: Selector<Env, AuthNamespaceLike>;\n /** Build the better-auth options from `env` (secret, plugins, email/password, …). */\n options: (env: Env) => LunoraAuthOptions;\n}']:[]],B=e=>[...e.hasAccess?[" private accessSelector?: Selector<Env, CreateAccessResolverOptions | undefined>;"]:[]," private adminToken?: Selector<Env, string>;",...e.hasAuth?[" private authDeclaration?: AuthDeclaration<Env>;"]:[]," private cdcEnabled = false;"," private reactiveCacheConfig: boolean | { maxBytes?: number; maxEntries?: number } = false;",' private maxRelationKeysLimit?: ShardConfig["maxRelationKeys"];',' private observabilitySink?: ShardConfig["observability"];',' private relationExistsPushDownMode?: ShardConfig["relationExistsPushDown"];'," private readonly extendFns: ((env: Env, derived: Readonly<WorkerOptions>) => Partial<WorkerOptions>)[] = [];",...e.hasGlobal?[" private globalDeclaration?: GlobalDeclaration<Env>;"]:[],...e.hasHyperdriveGlobal?[" private hyperdriveGlobalDeclaration?: HyperdriveGlobalDeclaration<Env>;"]:[]," private httpRouterApp?: HttpRouterLike;"," private readonly routeMap: Record<string, Route> = {};",...e.hasScheduler?[" private schedulerDeclaration?: SchedulerDeclaration<Env>;"]:[],...m(e)?[" private readonly shardExtras: Partial<ShardConfig> = {};"]:[],...d(e)?[" private shardRegistrySelector?: Selector<Env, ShardNamespaceLike>;"]:[]," private shardSelector?: Selector<Env, ShardNamespaceLike>;",...e.hasSourcedTables?[' private sourceClientFactory?: NonNullable<ShardConfig["sourceClient"]>;']:[],...e.hasStorage?[" private storageDeclaration?: StorageDeclaration<Env>;"]:[]],P=e=>g(e).map(({configKey:r,doc:t,method:a})=>` /** ${t} */
|
|
1
|
+
import{APP_METHOD_CAPABILITIES as k}from"./CAPABILITY_PROBES-BPeV994T.mjs";import{i as S}from"./ir-DBSvhNa-.mjs";import{G as E}from"./shared-DjUziztz.mjs";const D=e=>k.filter(({key:r})=>e.capabilities.has(r)),R={configKey:"vectors",doc:"Wire the Vectorize index map backing `ctx.vectors`.",method:"vectors"},g=e=>[...D(e).map(({appMethod:r})=>r),...e.hasVectors===!0?[R]:[]],m=e=>g(e).length>0,x=e=>e?['import * as lunoraIdentityContract from "../identity.js";']:[],A=(e,r)=>e?['import type { CreateAccessResolverOptions } from "@lunora/cloudflare-access";',`import { createAccessResolver${r?", composeResolvers":""} } from "@lunora/cloudflare-access";`]:[],C=e=>e?['import { createKvIntrospectorFromEnv } from "@lunora/bindings/kv";']:[],O=e=>e?['import { createVectorAdminIntrospector } from "@lunora/bindings/vectors";']:[],T=e=>e?['import type { D1CtxDbOptions, D1DatabaseLike, D1Exec } from "@lunora/d1";','import { applyCdcChanges, createD1CtxDb, emitD1QueryCost, exportGlobalRows, facetGlobalColumn, importGlobalRows, listGlobalTables, readD1CdcChanges, readGlobalTablePage, retryingExec } from "@lunora/d1";']:[],N=e=>e?['import notifyConfig from "../notify.js";']:[],v=e=>(e.emailAgents?.length??0)>0,q=e=>v(e)?['import { dispatchAgentEmail } from "@lunora/agent/inbound";']:[],I=e=>v(e)?['import * as lunoraAgentDefinitions from "../agents.js";']:[],d=e=>e.tables.some(r=>S(r)),L=e=>{const{hasFramework:r,hasGlobal:t,hasHyperdriveGlobal:a,hasQueue:n,useUmbrella:o}=e,i=o?"lunorash/runtime":"@lunora/runtime",l=["ExecutionContextLike","HttpRouterLike","LunoraWorker","Route","ScheduledControllerLike","ShardNamespaceLike","WorkerOptions",...n?["TriggerTrace"]:[],...t?["GlobalIntrospector"]:[],...e.tables.length>0?["ShardingInfo"]:[],...r?["FrameworkHostHandler"]:[]],c=[...t||a?["createCrossShardRelationCapabilities"]:[],...d(e)?["createDynamicShardRegistry","createQueryCoordinator"]:[],"createWorker",...e.jurisdiction?["declareAppJurisdiction"]:[],"resolveLogArchiveFromEnv",...r?["withFrameworkWorker"]:[]].join(", ");return[`import type { ${[...l].toSorted((s,h)=>s.localeCompare(h)).join(", ")} } from "${i}";`,`import { ${c} } from "${i}";`]},j=e=>{const{hasAccess:r,hasAuth:t,hasGlobal:a,hasHyperdriveGlobal:n,hasKvIntrospector:o,hasQueue:i,hasScheduler:l,hasStorage:c,hasWorkflow:s,wantsOpenApi:h,wantsOpenRpc:u}=e;return[...t?['import type { AuthNamespaceLike, LunoraAuth, LunoraAuthOptions } from "@lunora/auth";','import { authDiscoveryPathsFor, createAuth, createAuthAdmin, createAuthAuditReader, createDoAuthWiring, d1Executor, ensureMigrated, handleAuthDiscoveryRequest, handleAuthRequest, lunoraD1Adapter } from "@lunora/auth";']:[],...A(r,t),...T(a),...n?['import type { HyperdriveEngine } from "@lunora/hyperdrive/global";','import { createHyperdriveGlobalCtxDb } from "@lunora/hyperdrive/global";','import type { SqlCtxDbOptions, SqlExec } from "@lunora/sql-store";']:[],...C(o),...O(e.hasVectors===!0),...l?['import type { DurableObjectNamespaceLike } from "@lunora/scheduler";','import { createScheduler } from "@lunora/scheduler";']:[],...c?['import type { R2BucketLike, R2S3Credentials, Storage } from "@lunora/storage";','import { createBucketStorage, createStorage } from "@lunora/storage";']:[],...s?['import { createWorkflowsRestClient } from "@lunora/workflow";']:[],...q(e),...L(e),"",...x(e.identity),...I(e),...a||n?['import schema from "../schema.js";']:[],...N(e.hasNotify),'import { LUNORA_CRONS } from "./crons.js";','import { LUNORA_FUNCTIONS } from "./functions.js";',...i?['import { createQueueCaptureSink, dispatchQueueBatch, shouldCaptureQueue } from "@lunora/queue";','import { LUNORA_QUEUE_REGISTRY } from "./queues.js";']:[],...e.wantsArchitecture?['import { architecture } from "./architecture.js";']:[],...h?['import { openApiSpec } from "./openapi.js";']:[],...u?['import { openRpcSpec } from "./openrpc.js";']:[],'import { createShardDO } from "./shard.js";',...e.hasVectors===!0?['import { LUNORA_VECTOR_INDEXES } from "./vectors.js";']:[]]},G=e=>[...e.hasStorage?["/** `.storage(...)` declaration — one bucket (required) plus optional extra named buckets and signed-URL config. Backs `ctx.storage` AND the studio file browser. */\ninterface StorageDeclaration<Env> {\n /** The default R2 bucket binding (the bare `ctx.storage`). */\n bucket: Selector<Env, R2BucketLike>;\n /** Extra named buckets, reached via `ctx.storage.bucket(\"name\")` and the studio's bucket picker. */\n buckets?: Record<string, Selector<Env, R2BucketLike>>;\n /** Public base URL signed/public object URLs resolve against. Omit it and `ctx.storage` in a mutation, action or HTTP handler (and the studio's copy-URL) signs against the origin the request reached the worker on — no per-environment value to ship. Queries get no such fallback (a live query re-runs with no request behind it), so a query that signs URLs needs this set. */\n publicBaseUrl?: Selector<Env, string>;\n /** R2 S3-API credentials (`{ accountId, accessKeyId, secretAccessKey, bucket, jurisdiction? }`) enabling `ctx.storage.getPresignedUrl` — native S3 presigned URLs that hit R2 directly, bypassing the worker. Omit to use only the worker-signed `getSignedUrl` path. */\n s3?: Selector<Env, R2S3Credentials>;\n /** HMAC secret for signed URLs. */\n signingSecret?: Selector<Env, string>;\n}"]:[],...e.hasScheduler?["/** `.scheduler(...)` declaration — the `SchedulerDO` namespace. Backs `ctx.scheduler` AND the studio's scheduled-jobs view. The origin its callbacks dispatch back to is not declared here: the DO reads `env.LUNORA_ORIGIN_URL` at fire time, because a caller-supplied dispatch target would be an SSRF vector. */\ninterface SchedulerDeclaration<Env> {\n /** The `SchedulerDO` namespace binding (typically `env.SCHEDULER`). */\n namespace: Selector<Env, DurableObjectNamespaceLike & ShardNamespaceLike>;\n}"]:[],...e.hasGlobal?["/** `.global(...)` declaration — the D1 binding backing `.global()` tables. Backs cross-tenant `ctx.db` reads/writes AND the studio's global data browser. */\ninterface GlobalDeclaration<Env> {\n /** The D1 binding (typically `env.DB`). */\n d1: Selector<Env, D1DatabaseLike>;\n /** The worker origin used to fan reverse cross-backend relations across shards. Without it, such a relation throws a clear error. */\n origin?: Selector<Env, string>;\n}"]:[],...e.hasHyperdriveGlobal?['/** `.hyperdriveGlobal(...)` declaration — backs `.global({ backend: "hyperdrive" })` tables on a Postgres/MySQL database via Hyperdrive. Stays reactive: the writer is injected as `globalDb` and the broadcast hook drives live queries. */\ninterface HyperdriveGlobalDeclaration<Env> {\n /** The Hyperdrive engine — selects the Postgres or MySQL dialect. */\n engine: HyperdriveEngine;\n /** Build the `SqlExec` from `env` — e.g. `buildPgExec(fromPostgresJs(postgres(env.HYPERDRIVE.connectionString)))`. Cache the driver on the DO instance; rebuild lazily after hibernation. */\n exec: (env: Env) => SqlExec;\n /** The worker origin used to fan reverse cross-backend relations across shards. Without it, such a relation throws a clear error. */\n origin?: Selector<Env, string>;\n}']:[],...e.hasAuth?['/** `.auth(...)` declaration — better-auth options plus the storage the adapter reads. Give it `d1` (the default) or `namespace` (a Durable Object that hosts the auth tables), never both. The builder owns the lazy build + `ensureMigrated` dance and wires `authHandler` / `resolveIdentity` / `authAdmin`. */\ninterface AuthDeclaration<Env> {\n /** The D1 binding the auth SQL adapter is wired over (via `lunoraD1Adapter`). Omit only when using `namespace`. */\n d1?: Selector<Env, unknown>;\n /** Shared secret the worker presents on the object\'s internal session route. REQUIRED with `namespace`: the binding is reachable from any worker bound to it, so the secret — not the binding — is the authorization boundary. Without it identity resolution fails closed. */\n internalSecret?: Selector<Env, string>;\n /** Name of the Durable Object instance holding the auth tables. Defaults to `"auth"`. Set it to run separate auth objects (per deployment, per tenant) off one namespace. */\n objectName?: Selector<Env, string>;\n /** The auth Durable Object namespace — the DO-backed mode. Needed for `@better-auth/scim`, which requires native transactions that D1 has none of. The object owns the auth tables, so `/api/auth/*` and identity resolution both go through it. Typed as `AuthNamespaceLike` because `createDoAuthWiring` resolves through `idFromName` + `get` and has no `getByName` fallback — both members are load-bearing here, and `ShardNamespaceLike` leaves both optional. */\n namespace?: Selector<Env, AuthNamespaceLike>;\n /** Build the better-auth options from `env` (secret, plugins, email/password, …). */\n options: (env: Env) => LunoraAuthOptions;\n}']:[]],B=e=>[...e.hasAccess?[" private accessSelector?: Selector<Env, CreateAccessResolverOptions | undefined>;"]:[]," private adminToken?: Selector<Env, string>;",...e.hasAuth?[" private authDeclaration?: AuthDeclaration<Env>;"]:[]," private cdcEnabled = false;"," private reactiveCacheConfig: boolean | { maxBytes?: number; maxEntries?: number } = false;",' private maxRelationKeysLimit?: ShardConfig["maxRelationKeys"];',' private observabilitySink?: ShardConfig["observability"];',' private relationExistsPushDownMode?: ShardConfig["relationExistsPushDown"];'," private readonly extendFns: ((env: Env, derived: Readonly<WorkerOptions>) => Partial<WorkerOptions>)[] = [];",...e.hasGlobal?[" private globalDeclaration?: GlobalDeclaration<Env>;"]:[],...e.hasHyperdriveGlobal?[" private hyperdriveGlobalDeclaration?: HyperdriveGlobalDeclaration<Env>;"]:[]," private httpRouterApp?: HttpRouterLike;"," private readonly routeMap: Record<string, Route> = {};",...e.hasScheduler?[" private schedulerDeclaration?: SchedulerDeclaration<Env>;"]:[],...m(e)?[" private readonly shardExtras: Partial<ShardConfig> = {};"]:[],...d(e)?[" private shardRegistrySelector?: Selector<Env, ShardNamespaceLike>;"]:[]," private shardSelector?: Selector<Env, ShardNamespaceLike>;",...e.hasSourcedTables?[' private sourceClientFactory?: NonNullable<ShardConfig["sourceClient"]>;']:[],...e.hasStorage?[" private storageDeclaration?: StorageDeclaration<Env>;"]:[]],P=e=>g(e).map(({configKey:r,doc:t,method:a})=>` /** ${t} */
|
|
2
2
|
public ${a}(factory: (env: Env) => ReturnType<NonNullable<ShardConfig["${r}"]>>): this {
|
|
3
3
|
this.shardExtras.${r} = factory as NonNullable<ShardConfig["${r}"]>;
|
|
4
4
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{relative as Ie,isAbsolute as $e,sep as Be}from"node:path";import{LunoraError as _}from"@lunora/errors";import{CAPABILITIES as Re}from"./CAPABILITY_PROBES-
|
|
1
|
+
import{relative as Ie,isAbsolute as $e,sep as Be}from"node:path";import{LunoraError as _}from"@lunora/errors";import{CAPABILITIES as Re}from"./CAPABILITY_PROBES-BPeV994T.mjs";import{p as Oe}from"./ir-DBSvhNa-.mjs";import{a as p,G as Ne,u as Ce,d as Me}from"./shared-DjUziztz.mjs";const De=/\.([cm]?)tsx?$/u,Ae=(l,i=[])=>{const r=new Set;for(const t of l.tables)for(const d of Object.values(t.shape)){const n=Ce(d);n.kind==="storage"&&typeof n.bucket=="string"&&n.bucket!==""&&r.add(n.bucket)}for(const t of i)t!==""&&t!=="default"&&r.add(t);return["default",...[...r].toSorted((t,d)=>t.localeCompare(d))]},Ee=({agents:l=[],capabilities:i=new Set,containers:r=[],env:t,hasVectors:d=!0,hasFlags:n=!1,hasNotify:H=!1,identity:s,queues:R=[],schema:O,generatedDirectory:N="",services:y=[],storageRuleBuckets:z=[],topics:C=[],useUmbrella:U=!1,workflows:M=[]}={})=>{const o=Me(U),D=i.has("payments"),J=Ae(O??{tables:[]},z).map(e=>JSON.stringify(e)).join(" | "),K=D?`import type { LunoraPayment } from "@lunora/payment";
|
|
2
2
|
`:"",Y=D?`
|
|
3
3
|
readonly payments: LunoraPayment;`:"",A=e=>e.sandbox===!0?"SandboxContainerAccessor":"ContainerAccessor",X=[...new Set(r.map(e=>A(e)))].toSorted((e,a)=>e.localeCompare(a)),Z=r.length>0?`import type { ${X.join(", ")} } from "@lunora/container";
|
|
4
4
|
`:"",ee=r.length>0?`
|
|
@@ -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-
|
|
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-CBwweXGB.mjs";import"./shard-runtime-DTSpJxxd.mjs";import"./shared-DjUziztz.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 Ot,a as Tt,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-
|
|
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 Ot,a as Tt,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-DTSpJxxd.mjs";import{u as K,i as Ht,G as Vt,d as Kt}from"./shared-DjUziztz.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
|
|
@@ -1295,7 +1295,7 @@ export interface ShardDOConfig {
|
|
|
1295
1295
|
/** \`origin\` is the origin the current \`/rpc\` request reached the worker on — the fallback base for signed object URLs when no \`publicBaseUrl\` is configured. \`undefined\` off the synchronous dispatch path. */
|
|
1296
1296
|
storage?: (env: Record<string, unknown>, origin?: string) => unknown;${Ke}${b.configFields}${O.configField}${xe}${Ge}${Qe}${ze}${W.configField}
|
|
1297
1297
|
}
|
|
1298
|
-
${C("schedulerStub",Je,["cancel","runAfter","runAt"])}${C("storageStub",Ye,["delete","download","getMetadata","getSignedUrl","getUrl","head","list","upload"],{sync:["getUrl"]})}${Ze}${lt}${rt}${b.stubs}${Oe}
|
|
1298
|
+
${C("schedulerStub",Je,["cancel","runAfter","runAt"])}${C("storageStub",Ye,["createMultipartUpload","delete","download","generateUploadUrl","getMetadata","getPresignedUrl","getSignedUrl","getUrl","head","list","resumeMultipartUpload","store","upload"],{sync:["getUrl","resumeMultipartUpload"]})}${Ze}${lt}${rt}${b.stubs}${Oe}
|
|
1299
1299
|
${Xt}
|
|
1300
1300
|
|
|
1301
1301
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{s as $}from"./ir-DBSvhNa-.mjs";import{r as x}from"./json-data-Chfs2Cz5.mjs";import{CAPABILITIES as v}from"./CAPABILITY_PROBES-
|
|
1
|
+
import{s as $}from"./ir-DBSvhNa-.mjs";import{r as x}from"./json-data-Chfs2Cz5.mjs";import{CAPABILITIES as v}from"./CAPABILITY_PROBES-BPeV994T.mjs";import{a as c,G as f}from"./shared-DjUziztz.mjs";const P=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
|
|
|
@@ -133,7 +133,7 @@ const LUNORA_FLAG_KEYS = ${x(e,'ReadonlyArray<{ key: string; type: "boolean" | "
|
|
|
133
133
|
? lazyX402Pay(config.x402(env), { getSecret: (name: string) => secrets.get(name) })
|
|
134
134
|
: x402Stub;
|
|
135
135
|
`,configField:`
|
|
136
|
-
x402?: (env: Record<string, unknown>) => X402PayConfig;`,importLines:['import type { X402Pay, X402PayConfig } from "@lunora/x402/pay";','import { lazyX402Pay } from "@lunora/x402/pay";'],stub:y("x402Stub: X402Pay",'throw new Error("ctx.x402: no pay rail configured. Pass \\`x402\\` to createShardDO().");',["fetch"],{cast:" as unknown as X402Pay",sync:["fetch"]})}),w={access:R,ai:k,r2sql:N,x402:S},d=" ",L=(e,r,t)=>{const n=`${e}Binding`,{factory:o}=t;let i=`(${n} as ${r})`;if(o!==void 0){const u=`${n} as ${t.bindingType??r}`;i=o.option===void 0?`${o.name}(${u})`:`${o.name}({ ${o.option}: ${u} })`}return`${n} ? ${i} : ${e}Stub`},
|
|
136
|
+
x402?: (env: Record<string, unknown>) => X402PayConfig;`,importLines:['import type { X402Pay, X402PayConfig } from "@lunora/x402/pay";','import { lazyX402Pay } from "@lunora/x402/pay";'],stub:y("x402Stub: X402Pay",'throw new Error("ctx.x402: no pay rail configured. Pass \\`x402\\` to createShardDO().");',["fetch"],{cast:" as unknown as X402Pay",sync:["fetch"]})}),w={access:R,ai:k,r2sql:N,x402:S},d=" ",L=(e,r,t)=>{const n=`${e}Binding`,{factory:o}=t;let i=`(${n} as ${r})`;if(o!==void 0){const u=`${n} as ${t.bindingType??r}`;i=o.option===void 0?`${o.name}(${u})`:`${o.name}({ ${o.option}: ${u} })`}return`${n} ? ${i} : ${e}Stub`},A=(e,r,t)=>{const n=L(e,r,t),o=`${d}const ${e}Binding = config.${e}?.(env) ?? (env as Record<string, unknown>).${t.envName};
|
|
137
137
|
`,i=t.unvouchableReads??[];return i.length===0?`
|
|
138
138
|
${o}${d}const ${e}: ${r} = ${n};
|
|
139
139
|
`:`
|
|
@@ -144,11 +144,11 @@ ${d}const ${e}: ${r} = markUnvouchableReads(${n}, options.onRead, [
|
|
|
144
144
|
${i.map(u=>`${d} ${JSON.stringify(u)},`).join(`
|
|
145
145
|
`)}
|
|
146
146
|
${d}]);
|
|
147
|
-
`},
|
|
148
|
-
${d}const ${e}: ${o} = config.${e} ?
|
|
147
|
+
`},C=(e,r,t)=>{const{binding:n,clientType:o}=t,i=y(`${e}Stub: ${o}`,`throw new Error(${JSON.stringify(t.missingMessage)});`,t.stubMethods,{sync:t.syncStubMethods});if(n===void 0){const l=t.instrument===void 0?`config.${e}(env)`:`this.${t.instrument}(config.${e}(env), logFunctionPath, traceAnchor, observability)`;return{build:`
|
|
148
|
+
${d}const ${e}: ${o} = config.${e} ? ${l} : ${e}Stub;
|
|
149
149
|
`,configField:`
|
|
150
|
-
${e}?: (env: Record<string, unknown>) => ${o};`,importLines:[`import type { ${o} } from "${r}";`],stub:i}
|
|
151
|
-
${e}?: (env: Record<string, unknown>) => ${u};`,importLines:[`import type { ${s.join(", ")} } from "${r}";`,...n.factory===void 0?[]:[`import { ${n.factory.name} } from "${r}";`]],stub:i}},D=e=>{const r=[],t=[];let n="",o="",i="",u="",s="";for(const l of v){const{key:a,shardBinding:m}=l;if(m===void 0||!e.has(a))continue;const p=l.contextProperty,g=m==="bespoke"?w[a]():
|
|
150
|
+
${e}?: (env: Record<string, unknown>) => ${o};`,importLines:[`import type { ${o} } from "${r}";`],stub:i}}const u=n.bindingType??o,s=[...new Set([u,o])].toSorted((l,a)=>l.localeCompare(a));return{build:A(e,o,n),configField:`
|
|
151
|
+
${e}?: (env: Record<string, unknown>) => ${u};`,importLines:[`import type { ${s.join(", ")} } from "${r}";`,...n.factory===void 0?[]:[`import { ${n.factory.name} } from "${r}";`]],stub:i}},D=e=>{const r=[],t=[];let n="",o="",i="",u="",s="";for(const l of v){const{key:a,shardBinding:m}=l;if(m===void 0||!e.has(a))continue;const p=l.contextProperty,g=m==="bespoke"?w[a]():C(p,l.moduleSpecifier,m);t.push(...g.importLines),o+=g.configField,s+=g.stub,l.tier==="every"?(i+=g.build,u+=`
|
|
152
152
|
${p},`):(n+=g.build,r.push(p))}return{actionBuild:n,actionFields:r,configFields:o,everyBuild:i,everyFields:u,importLines:t,stubs:s}},U=(e,r)=>{if(e.length===0)return"";const t=r?`, ${JSON.stringify(r)}`:"",n=e.map(a=>{c(a.exportName,`container export "${a.exportName}"`),c(a.className,`container class "${a.className}"`);const m=a.sandbox===!0?"LunoraSandboxContainer":"LunoraContainer";return`/** Container DO for the \`${a.exportName}\` definition (binding \`${a.bindingName}\`). */
|
|
153
153
|
export class ${a.className} extends ${m} {
|
|
154
154
|
public constructor(ctx: ConstructorParameters<typeof ${m}>[0], env: Record<string, unknown>) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{SyntaxKind as c,Node as f}from"ts-morph";import{CAPABILITIES as d}from"./CAPABILITY_PROBES-
|
|
1
|
+
import{SyntaxKind as c,Node as f}from"ts-morph";import{CAPABILITIES as d}from"./CAPABILITY_PROBES-BPeV994T.mjs";import{bindingKeyName as m,listLunoraSourceFiles as p}from"./listLunoraSourceFiles-CSlcBYlo.mjs";const l="ctx",g=t=>{const n=new Set,i=new Set([l]),r=e=>{if(f.isObjectBindingPattern(e))for(const s of e.getElements()){const o=m(s);o&&n.add(o)}};for(const e of t.getDescendantsOfKind(c.BindingElement)){if(m(e)!==l)continue;const s=e.getNameNode();f.isIdentifier(s)?i.add(s.getText()):r(s)}const a=e=>f.isIdentifier(e)&&i.has(e.getText());for(const e of t.getDescendantsOfKind(c.PropertyAccessExpression))a(e.getExpression())&&n.add(e.getName());for(const e of t.getDescendantsOfKind(c.VariableDeclaration)){const s=e.getInitializer();s!==void 0&&a(s)&&r(e.getNameNode())}return n},u=t=>{if(t.isTypeOnly())return!0;const n=t.getNamedImports();return t.getDefaultImport()===void 0&&t.getNamespaceImport()===void 0&&n.length>0&&n.every(i=>i.isTypeOnly())},y=t=>({contextReads:g(t),valueImports:new Set(t.getImportDeclarations().filter(n=>!u(n)).map(n=>n.getModuleSpecifierValue()))}),P=(t,n)=>{const i=Object.fromEntries(d.map(r=>[r.key,!1]));for(const r of p(n)){const a=t.getSourceFile(r)??t.addSourceFileAtPath(r),{contextReads:e,valueImports:s}=y(a);for(const o of d)if(!i[o.key]){if(s.has(o.moduleSpecifier)){i[o.key]=!0;continue}o.contextProperty!==void 0&&e.has(o.contextProperty)&&(i[o.key]=!0)}if(d.every(o=>i[o.key]))break}return i};export{g as contextPropertiesRead,P as discoverFeatureUsage,y as sourceCapabilitySignals};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lunora/codegen",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.253",
|
|
4
4
|
"description": "Code generator for Lunora: emits _generated/{api,server,dataModel}.ts from your schema",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cloudflare",
|
|
@@ -46,15 +46,15 @@
|
|
|
46
46
|
"access": "public"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@lunora/advisor": "1.0.0-alpha.
|
|
50
|
-
"@lunora/agent": "1.0.0-alpha.
|
|
51
|
-
"@lunora/container": "1.0.0-alpha.
|
|
52
|
-
"@lunora/errors": "1.0.0-alpha.
|
|
53
|
-
"@lunora/platform": "1.0.0-alpha.
|
|
54
|
-
"@lunora/queue": "1.0.0-alpha.
|
|
55
|
-
"@lunora/scheduler": "1.0.0-alpha.
|
|
56
|
-
"@lunora/values": "1.0.0-alpha.
|
|
57
|
-
"@lunora/workflow": "1.0.0-alpha.
|
|
49
|
+
"@lunora/advisor": "1.0.0-alpha.184",
|
|
50
|
+
"@lunora/agent": "1.0.0-alpha.166",
|
|
51
|
+
"@lunora/container": "1.0.0-alpha.68",
|
|
52
|
+
"@lunora/errors": "1.0.0-alpha.50",
|
|
53
|
+
"@lunora/platform": "1.0.0-alpha.53",
|
|
54
|
+
"@lunora/queue": "1.0.0-alpha.89",
|
|
55
|
+
"@lunora/scheduler": "1.0.0-alpha.107",
|
|
56
|
+
"@lunora/values": "1.0.0-alpha.60",
|
|
57
|
+
"@lunora/workflow": "1.0.0-alpha.71",
|
|
58
58
|
"jiti": "^2.7.0",
|
|
59
59
|
"quicktype-core": "^26.0.0",
|
|
60
60
|
"ts-morph": "^28.0.0"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{NODE_CAPABILITIES as f,CLOUDFLARE_CAPABILITIES as h,CELLD_CAPABILITIES as b}from"@lunora/platform";import{readProjectConfigLiterals as g}from"./loadProjectConfig-nNIDOrlR.mjs";const d="cloudflare",v=t=>{const{target:e}=g(t);return e!==void 0&&e.length>0?e:void 0},A=(t,e)=>e??v(t)??d,L=(t,e)=>{if(e!==void 0)return[];const{target:a,unreadable:r}=g(t);return r!==!0||a!==void 0?[]:[{level:"warn",message:`lunora.config declares a \`target\` that codegen cannot read without evaluating it, so the "${d}" surface was emitted. \`runCodegen\` resolves the target synchronously, which means it reads literals only.`,name:"platform_unreadable_target",remediation:`Write \`target\` as a string literal on the config's default export (\`export default { target: "${d}" }\`), or pass \`--target\`.`,target:d}]},u={celld:b,cloudflare:h,node:f},C=()=>Object.keys(u).toSorted((t,e)=>t.localeCompare(e)),S={access:null,ai:"ai",aiSearch:"aiSearch",analytics:"analytics",artifacts:"artifacts",browser:"browser",container:"containers",flags:null,hyperdrive:"hyperdrive",images:"images",kv:"keyValueStore",mail:"mail",notify:null,payments:null,pipelines:"pipelines",r2sql:null,scheduler:"scheduler",storage:"objectStorage",vectors:"vectorStore",workflows:"workflows",x402:null},w=["agents","commitOrderedTables","containerEgressPolicy","containerRuntimeScheduling","containerSandboxTools","cronTriggers","crossShardFanout","durableStreams","globalTables","queues","relationGraph","secrets","services","topics","vectorStore","workerLoaders","workflowRollback","workflowSchedules"],m={agents:"durable agents (`defineAgent`)",commitOrderedTables:"commit-ordered tables (`.commitOrdered()`)",containerEgressPolicy:"container egress policies (`defineContainer({ allowedHosts | deniedHosts | interceptHttps })`)",containerRuntimeScheduling:'per-instance container images and snapshots (`defineContainer({ schedulingPolicy: "durable_object" })`)',containerSandboxTools:"container sandbox helpers — files, directory backups, bucket mounts (`defineContainer({ sandbox: true })`)",cronTriggers:"declared cron triggers (`cronJobs()`)",crossShardFanout:"cross-shard fan-out queries (a `.shardBy(...)` schema)",durableStreams:"durable streams (`.stream(handler, { durable: true })`)",globalTables:"global tables (`.global()`)",queues:"queues (`defineQueue`)",relationGraph:"relation-graph traversal (`ctx.db.related`, derived from `v.id(...)` columns)",secrets:"the secrets store (`ctx.secrets`)",services:"service bindings to sibling Workers (`lunora.config` `services`)",topics:"pub/sub topics (`defineTopic` / `defineSubscription`)",vectorStore:"vector indexes (`.vectorize()`)",workerLoaders:"sandboxed agent scripts (`jsCodeTool`, on Worker Loaders)",workflowRollback:"workflow step rollback (`defineStep({ rollback })`)",workflowSchedules:"scheduled workflow instances (`defineWorkflow({ schedules })`)"},y=(t,e,a)=>({level:"error",message:`${e.name} does not support ${m[t]}, which this app declares.`,name:"platform_unsupported_feature",remediation:`Remove the declaration, or deploy to a target whose capability matrix marks "${t}" as native or emulated.`,target:a}),T=(t,e,a)=>({level:"error",message:`${e.name}'s capability matrix does not declare a support level for ${m[t]}, which this app declares. Treated as unsupported.`,name:"platform_undeclared_feature",remediation:`Rate "${t}" in the ${e.name} capability matrix as "native", "emulated", or "unsupported" — an undeclared feature fails closed rather than letting the app deploy onto a primitive the host may not provide.`,target:a}),k=t=>{const{diagnostics:e,gatedSignals:a,matrix:r,reported:n,signals:c,target:i}=t;for(const s of w){if(c[s]!==!0)continue;const o=r.features[s]?.level;o!=="unsupported"&&o!==void 0||(a[s]=!1,!n.has(s)&&e.push(o==="unsupported"?y(s,r,i):T(s,r,i)))}},_=(t,e,a,r={})=>{const n={...t},c={...r},i=[],s=new Set;for(const[o,l]of Object.entries(S)){if(l===null||!t[o])continue;const p=e.features[l]?.level;p==="unsupported"?(n[o]=!1,s.add(l),i.push({feature:o,level:"error",message:`${e.name} does not support "${o}" (ctx.${o}).`,name:"platform_unsupported_feature",remediation:`Remove the ctx.${o} usage, or deploy to a target whose capability matrix marks "${l}" as native or emulated.`,target:a})):p===void 0&&(n[o]=!1,s.add(l),i.push({feature:o,level:"error",message:`${e.name}'s capability matrix does not declare a support level for "${o}" (ctx.${o}). Treated as unsupported.`,name:"platform_undeclared_feature",remediation:`Rate "${l}" in the ${e.name} capability matrix as "native", "emulated", or "unsupported" — an undeclared feature fails closed rather than shipping a surface the host may not provide.`,target:a}))}return k({diagnostics:i,gatedSignals:c,matrix:e,reported:s,signals:r,target:a}),{diagnostics:i,signals:c,usage:n}},E=(t,e,a={})=>{const r=u[e];return r===void 0?{diagnostics:[{level:"error",message:`Unknown deploy target "${e}" — no capability matrix is registered for it. Codegen emitted the full Cloudflare surface un-gated.`,name:"platform_unknown_target",remediation:`Use a registered target (${Object.keys(u).join(", ")}) or install the target's @lunora/platform-${e} package.`,target:e}],signals:{...a},usage:{...t}}:_(t,r,e,a)},I=t=>{const e=u[t];if(e===void 0)return;const a=Object.entries(e.features).filter(([,r])=>r.level==="unsupported").map(([r])=>r).toSorted((r,n)=>r.localeCompare(n));return{id:e.id,name:e.name,unsupported:a}};export{S as CAPABILITY_TO_FEATURE,d as DEFAULT_TARGET,_ as gateAgainstMatrix,E as gatePlatformFeatures,C as platformMatrixIds,v as readProjectTarget,L as readTargetDiagnostics,A as resolveCodegenTarget,I as studioPlatformFor};
|