@lunora/codegen 1.0.0-alpha.288 → 1.0.0-alpha.289
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 +9 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.mjs +1 -1
- package/dist/packem_shared/{AGENTS_FILENAME-CMApbNUc.mjs → AGENTS_FILENAME-CwwSEW6a.mjs} +1 -1
- package/dist/packem_shared/{CONTAINERS_FILENAME-CotojPk5.mjs → CONTAINERS_FILENAME-BtX5vWh8.mjs} +1 -1
- package/dist/packem_shared/{DEFAULT_TARGET-GPPgJNTn.mjs → DEFAULT_TARGET-3U7x981M.mjs} +1 -1
- package/dist/packem_shared/{FLAGS_FILENAME-C1RHlinh.mjs → FLAGS_FILENAME-Bf0MSlHH.mjs} +1 -1
- package/dist/packem_shared/{MUTATORS_FILENAME-DQ-010Zm.mjs → MUTATORS_FILENAME-Dl1tElqi.mjs} +1 -1
- package/dist/packem_shared/{NOTIFY_FILENAME-BOdrj1Oc.mjs → NOTIFY_FILENAME-BeTurUSC.mjs} +1 -1
- package/dist/packem_shared/{OPENRPC_VERSION-DnYKkFP6.mjs → OPENRPC_VERSION-CCY7xqSL.mjs} +1 -1
- package/dist/packem_shared/{QUEUES_FILENAME-DLCZe-bV.mjs → QUEUES_FILENAME-D588u733.mjs} +1 -1
- package/dist/packem_shared/{SCHEMA_SNAPSHOT_FILENAME-B7WJKe_F.mjs → SCHEMA_SNAPSHOT_FILENAME-Ddnww-0x.mjs} +6 -6
- package/dist/packem_shared/{SHAPES_FILENAME-CAJGkW3k.mjs → SHAPES_FILENAME-D-Q8lSEw.mjs} +1 -1
- package/dist/packem_shared/{WORKFLOWS_FILENAME-CKclegFS.mjs → WORKFLOWS_FILENAME-BGMSNTDC.mjs} +1 -1
- package/dist/packem_shared/{attribution-0YtR4LvZ.mjs → attribution-BUciBs1M.mjs} +1 -1
- package/dist/packem_shared/{buildOpenApiDocument-D_8TtHK1.mjs → buildOpenApiDocument-DFv-RYZU.mjs} +1 -1
- package/dist/packem_shared/{capabilitiesUsedBy-CmSX6ODG.mjs → capabilitiesUsedBy-QgSZyE0T.mjs} +1 -1
- package/dist/packem_shared/chain-BUxIVIw_.mjs +1 -0
- package/dist/packem_shared/{classify-procedure-call-C9lQCjso.mjs → classify-procedure-call-BJdf_-M6.mjs} +1 -1
- package/dist/packem_shared/{context-property-calls-mJoBjbyp.mjs → context-property-calls-DPnUYWSX.mjs} +1 -1
- package/dist/packem_shared/{context-root-DX4uZFBy.mjs → context-root-Dlo21ybw.mjs} +1 -1
- package/dist/packem_shared/{database-calls-DyOLz_lK.mjs → database-calls-ONnjnkMd.mjs} +1 -1
- package/dist/packem_shared/{discoverAuthApiCalls-DZu_PHnZ.mjs → discoverAuthApiCalls-DAaK0HUK.mjs} +1 -1
- package/dist/packem_shared/{discoverCrons-DBuEbNrB.mjs → discoverCrons-DF7dOP9x.mjs} +1 -1
- package/dist/packem_shared/{discoverFunctions-CgyrgvUR.mjs → discoverFunctions-DsQwrwWq.mjs} +1 -1
- package/dist/packem_shared/{discoverHttpRoutes-Bwqu4zSU.mjs → discoverHttpRoutes-Cv-h-Yuc.mjs} +1 -1
- package/dist/packem_shared/discoverHyperdriveCalls-xy2G6igG.mjs +1 -0
- package/dist/packem_shared/{discoverInserts-S3k8YMGc.mjs → discoverInserts-CQsoloGk.mjs} +1 -1
- package/dist/packem_shared/discoverMaskProcedures-Dr1UccD6.mjs +1 -0
- package/dist/packem_shared/{discoverMigrations-DG1eWtr3.mjs → discoverMigrations-uxm9qHrr.mjs} +1 -1
- package/dist/packem_shared/{discoverNondeterministicCalls-Bzr6I_nH.mjs → discoverNondeterministicCalls-Dm7_PJoA.mjs} +1 -1
- package/dist/packem_shared/{discoverQueries-DZ4v6es7.mjs → discoverQueries-BqECbkm9.mjs} +1 -1
- package/dist/packem_shared/discoverR2sqlCalls-I9IqJFcy.mjs +1 -0
- package/dist/packem_shared/{discoverRlsMetadata-BnFqUsvY.mjs → discoverRlsMetadata-Cu4bc5KZ.mjs} +1 -1
- package/dist/packem_shared/{discoverRlsProcedures-DTexWDMq.mjs → discoverRlsProcedures-Bkohn4ZR.mjs} +1 -1
- package/dist/packem_shared/{discoverSandboxUsage-ejLtE6Ky.mjs → discoverSandboxUsage-w6Q3RvxZ.mjs} +1 -1
- package/dist/packem_shared/{discoverSchema-C3WOG-xt.mjs → discoverSchema-BCxeD80d.mjs} +1 -1
- package/dist/packem_shared/{discoverStorageRulesMetadata-DE2Kblph.mjs → discoverStorageRulesMetadata-D6rjgKYC.mjs} +1 -1
- package/dist/packem_shared/{emitApp-CBIXVzkw.mjs → emitApp-D7G7gmV7.mjs} +5 -5
- package/dist/packem_shared/{exported-procedure-chains-DLor3aUN.mjs → exported-procedure-chains-BZk1-hro.mjs} +1 -1
- package/dist/packem_shared/{fingerprintSchemaSources-C4PkhFFQ.mjs → fingerprintSchemaSources-eVG9aVt0.mjs} +1 -1
- package/dist/packem_shared/{handler-reference-DQlWnkjm.mjs → handler-reference-DXkpwoAq.mjs} +1 -1
- package/dist/packem_shared/{index-DbaVBeCK.mjs → index-BoPXSW7g.mjs} +1 -1
- package/dist/packem_shared/{isTestPath-CiIyKqhF.mjs → isTestPath-B81lOULB.mjs} +1 -1
- package/dist/packem_shared/{loadProjectConfig-DGqGWOfa.mjs → loadProjectConfig-NO0dVJSl.mjs} +1 -1
- package/dist/packem_shared/{modules-Cuogms61.mjs → modules-CjOcuQnK.mjs} +1 -1
- package/dist/packem_shared/{parse-validator-DYdT7Hyf.mjs → parse-validator-IDBKIT7M.mjs} +1 -1
- package/dist/packem_shared/project-config-file-BV7RR-l6.mjs +1 -0
- package/dist/packem_shared/{readServiceBindings-DuE9xlvV.mjs → readServiceBindings-DvqIThzd.mjs} +1 -1
- package/dist/packem_shared/{unwrap-handler-return-BedChFbC.mjs → unwrap-handler-return-B-jQde6M.mjs} +1 -1
- package/package.json +1 -1
- package/dist/packem_shared/chain-Dsgmjc_m.mjs +0 -1
- package/dist/packem_shared/discoverHyperdriveCalls-CkLpUaGK.mjs +0 -1
- package/dist/packem_shared/discoverMaskProcedures-DthLheP8.mjs +0 -1
- package/dist/packem_shared/discoverR2sqlCalls-L3A7rGcQ.mjs +0 -1
- package/dist/packem_shared/project-config-file-Bv2l-Kmm.mjs +0 -1
|
@@ -396,7 +396,7 @@ const buildGlobalCdcApplier =
|
|
|
396
396
|
this.storageDeclaration = declaration;
|
|
397
397
|
|
|
398
398
|
return this;
|
|
399
|
-
}`]:[],...T(e)],
|
|
399
|
+
}`]:[],...T(e)],I=e=>{const r=a=>e.hasScheduler?`
|
|
400
400
|
...(this.schedulerDeclaration ? { scheduler: this.resolveScheduler(env) as unknown as ${a}["scheduler"] } : {}),`:"",t=[" cdc: this.cdcEnabled,"," reactiveCache: this.reactiveCacheConfig,"," ...(this.maxRelationKeysLimit === undefined ? {} : { maxRelationKeys: this.maxRelationKeysLimit }),"," ...(this.observabilitySink === undefined ? {} : { observability: this.observabilitySink }),"," ...(this.relationExistsPushDownMode === undefined ? {} : { relationExistsPushDown: this.relationExistsPushDownMode }),",...e.hasGlobal?[` ...(this.globalDeclaration
|
|
401
401
|
? {
|
|
402
402
|
d1: (rawEnv: Record<string, unknown>, request?: { bookmark?: string; cdc?: boolean; cdcRetentionMs?: number; identity?: Record<string, unknown>; onBookmark?: (bookmark: string | undefined) => void; userId?: string | null }) => {
|
|
@@ -471,7 +471,7 @@ const buildGlobalCdcApplier =
|
|
|
471
471
|
: {}),`]:[],...d(e)?[" ...(this.shardRegistrySelector ? { shardRegistry: (rawEnv: Record<string, unknown>) => this.shardRegistrySelector?.(rawEnv as Env) } : {}),"]:[],...e.hasSourcedTables?[" ...(this.sourceClientFactory === undefined ? {} : { sourceClient: this.sourceClientFactory }),"]:[],...e.hasStorage?[" ...(this.storageDeclaration ? { storage: (rawEnv: Record<string, unknown>, origin?: string) => this.resolveStorage(rawEnv as Env, origin) } : {}),"]:[],...m(e)?[" ...this.shardExtras,"]:[]];return t.length>0?`
|
|
472
472
|
${t.join(`
|
|
473
473
|
`)}
|
|
474
|
-
`:""},
|
|
474
|
+
`:""},q=e=>e?['import * as lunoraIdentityContract from "../identity.js";']:[],L=(e,r)=>e?['import type { CreateAccessResolverOptions } from "@lunora/cloudflare-access";',`import { createAccessResolver${r?", composeResolvers":""} } from "@lunora/cloudflare-access";`]:[],j=e=>e?['import { createKvIntrospectorFromEnv } from "@lunora/bindings/kv";']:[],G=e=>e?['import { createVectorAdminIntrospector } from "@lunora/bindings/vectors";']:[],B=e=>e?['import type { D1CtxDbOptions, D1DatabaseLike, D1Exec } from "@lunora/d1";','import { applyCdcChanges, createD1CtxDb, emitD1QueryCost, exportGlobalRows, facetGlobalColumn, importGlobalRows, listGlobalTables, readD1CdcChanges, readGlobalTablePage, retryingExec } from "@lunora/d1";']:[],P=e=>e?['import notifyConfig from "../notify.js";']:[],W=e=>v(e)?['import { dispatchAgentEmail } from "@lunora/agent/inbound";']:[],_=e=>v(e)?['import * as lunoraAgentDefinitions from "../agents.js";']:[],$=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}";`]},H=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";']:[],...L(r,t),...B(a),...n?['import type { HyperdriveEngine } from "@lunora/hyperdrive/global";','import { createHyperdriveGlobalCtxDb } from "@lunora/hyperdrive/global";','import type { SqlCtxDbOptions, SqlExec } from "@lunora/sql-store";']:[],...j(o),...G(e.hasVectors),...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";']:[],...W(e),...$(e),"",...q(e.identity),..._(e),...a||n?['import schema from "../schema.js";']:[],...P(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?['import { LUNORA_VECTOR_INDEXES } from "./vectors.js";']:[]]},U=e=>e.jurisdiction&&e.jurisdictionPinsAuth===!0?`
|
|
475
475
|
// The schema's jurisdiction pins the auth object like every other DO.
|
|
476
476
|
jurisdiction: ${JSON.stringify(e.jurisdiction)},`:"",F=e=>typeof e=="string"?`{ mode: { kind: ${JSON.stringify(e)} } }`:`{ mode: { field: ${JSON.stringify(e.field)}, kind: "shardBy" } }`,M=e=>[...e.tables.length>0?[` const tableSharding = new Map<string, ShardingInfo>([
|
|
477
477
|
${e.tables.map(r=>` [${JSON.stringify(r.name)}, ${F(r.shardMode)}],`).join(`
|
|
@@ -744,7 +744,7 @@ ${w}
|
|
|
744
744
|
|
|
745
745
|
/** Build the shard DO + compose the worker (standalone or framework-hosted), wrapping the lazy per-isolate singletons + auth init. */
|
|
746
746
|
private assemble(${y}): ComposedApp {
|
|
747
|
-
const ShardDO = createShardDO({${
|
|
747
|
+
const ShardDO = createShardDO({${I(t)}});
|
|
748
748
|
|
|
749
749
|
// Per-isolate singletons: the worker (and auth instance) are expensive to
|
|
750
750
|
// build, so the first request constructs them and every later request on
|
|
@@ -831,8 +831,8 @@ ${A(t.hasGlobal)}
|
|
|
831
831
|
* bundled into the worker, and a runtime import in that file ships with it.
|
|
832
832
|
*/
|
|
833
833
|
interface LunoraConfig<Env extends object = object> {
|
|
834
|
-
/** Codegen's static advisor. \`minSeverity\` is the lowest level it reports and writes into \`_generated/shard.ts\`; an \`"error"\` is never dropped, so the gate that fails codegen stays on. A literal, for the same reason as \`target\`. */
|
|
835
|
-
advisor?: { minSeverity?: "error" | "info" | "warn" };
|
|
834
|
+
/** Codegen's static advisor. \`minSeverity\` is the lowest level it reports and writes into \`_generated/shard.ts\`; an \`"error"\` is never dropped, so the gate that fails codegen stays on. \`accept\` demotes a reviewed ERROR to INFO when its rule, file and export all match. A literal, for the same reason as \`target\`. */
|
|
835
|
+
advisor?: { accept?: ReadonlyArray<{ exportName: string; file: string; reason: string; rule: string }>; minSeverity?: "error" | "info" | "warn" };
|
|
836
836
|
/** Receives this project's \`defineApp()\` builder and returns it — where a Vite-first app makes the builder calls its generated entry cannot derive. */
|
|
837
837
|
app?: (app: AppBuilder<Env>) => AppBuilder<Env>;
|
|
838
838
|
/** Codegen's source walk. \`exclude\` adds globs (relative to \`lunora/\`, e.g. \`"seed/**"\`) to skip on top of the built-in test-file patterns. A literal array of strings, for the same reason as \`target\`. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Node as s}from"ts-morph";import{b as t,d as c}from"./attribution-
|
|
1
|
+
import{Node as s}from"ts-morph";import{b as t,d as c}from"./attribution-BUciBs1M.mjs";import{c as n}from"./classify-procedure-call-BJdf_-M6.mjs";const m=a=>{const i=[];for(const e of t(a)){const r=e.getInitializer(),o=r&&s.isCallExpression(r)?n(r):void 0;o?.receiver&&i.push({name:c(e)??e.getName(),receiver:o.receiver})}return i};export{m as e};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createHash as i}from"node:crypto";import{existsSync as s,readFileSync as c}from"node:fs";import{join as u}from"node:path";import{listLunoraSourceFiles as h}from"./isTestPath-
|
|
1
|
+
import{createHash as i}from"node:crypto";import{existsSync as s,readFileSync as c}from"node:fs";import{join as u}from"node:path";import{listLunoraSourceFiles as h}from"./isTestPath-B81lOULB.mjs";const S=t=>{if(!s(t))return"unreadable";const e=h(t,{includeSkipped:!0}),o=u(t,"schema.ts");s(o)&&e.push(o);const r=i("sha256");for(const a of e.toSorted((n,p)=>n.localeCompare(p)))try{r.update(a).update("\0").update(c(a))}catch{}return r.digest("hex")};export{S as default};
|
package/dist/packem_shared/{handler-reference-DQlWnkjm.mjs → handler-reference-DXkpwoAq.mjs}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{dirname as F}from"node:path";import{Node as e}from"ts-morph";import{unwrapExpression as m,lunoraRelativePath as u}from"./isTestPath-
|
|
1
|
+
import{dirname as F}from"node:path";import{Node as e}from"ts-morph";import{unwrapExpression as m,lunoraRelativePath as u}from"./isTestPath-B81lOULB.mjs";import{r as v,d as b}from"./attribution-BUciBs1M.mjs";const h=i=>e.isPropertyAssignment(i)?m(i.getInitializer()):e.isShorthandPropertyAssignment(i)?i.getNameNode():void 0,A=(i,s)=>{const o=i===void 0?void 0:h(i);if(o===void 0||!e.isIdentifier(o))return;const a=v(o),g=a?.getAliasedSymbol()??a;for(const t of g?.getDeclarations()??[]){const n=e.isVariableDeclaration(t)?m(t.getInitializer()):t;if(!(e.isFunctionDeclaration(n)||e.isArrowFunction(n)||e.isFunctionExpression(n))||!(e.isFunctionDeclaration(t)||e.isVariableDeclaration(t)))continue;const r=t.getSourceFile(),c=u(s,r.getFilePath()),l=!c.startsWith("../"),d=l?c:u(F(s),r.getFilePath()),f=b(t);return{body:n,...r===o.getSourceFile()?{}:{file:d},...l&&f!==void 0?{site:{exportName:f,file:d}}:{}}}};export{A as r};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Node as i}from"ts-morph";import{listLunoraSourceFiles as u,lunoraRelativePath as f}from"./isTestPath-
|
|
1
|
+
import{Node as i}from"ts-morph";import{listLunoraSourceFiles as u,lunoraRelativePath as f}from"./isTestPath-B81lOULB.mjs";import{b as m,d as p}from"./attribution-BUciBs1M.mjs";import{t as d}from"./database-calls-ONnjnkMd.mjs";import{w as g,c as h}from"./classify-procedure-call-BJdf_-M6.mjs";import{a as k}from"./project-config-file-BV7RR-l6.mjs";const l=e=>{if(!(!i.isPropertyAssignment(e)&&!i.isShorthandPropertyAssignment(e)&&!i.isMethodDeclaration(e)&&!i.isGetAccessorDeclaration(e)))return k(e)},v=e=>g(e,"use","mask"),D=e=>{if(i.isPropertyAssignment(e)){const s=e.getInitializer();if(s&&i.isStringLiteral(s)){const t=s.getLiteralText();if(t==="redact"||t==="hash")return t}}return"custom"},P=e=>{const s=e.getArguments()[0];if(!s||!i.isObjectLiteralExpression(s))return[];const t=[];for(const r of s.getProperties()){const o=l(r);if(o===void 0||!i.isPropertyAssignment(r))continue;const n=r.getInitializer();if(!(!n||!i.isObjectLiteralExpression(n)))for(const a of n.getProperties()){const c=l(a);c!==void 0&&t.push({column:c,table:o})}}return t},y=e=>{const s=v(e);return{maskColumns:s.flatMap(t=>P(t)),usesMask:s.length>0}},C=new Set(["findFirst","findFirstOrThrow","findMany","get","query"]),M=new Set(["delete","insert","patch","replace"]),b=(e,s)=>{if(!i.isVariableDeclaration(e))return;const t=e.getInitializer();if(!t||!i.isCallExpression(t))return;const r=h(t);if(!r)return;const o=r.receiver?y(r.receiver):{maskColumns:[],usesMask:!1},{tablesRead:n,tablesWritten:a}=d(e,C,M);return{exportName:p(e)??e.getName(),file:s,maskColumns:o.maskColumns,tablesRead:n,tablesWritten:a,usesMask:o.usesMask,visibility:r.visibility}},E=(e,s)=>{const t=[];for(const r of u(s)){const o=e.getSourceFile(r)??e.addSourceFileAtPath(r),n=f(s,r);for(const a of m(o)){const c=b(a,n);c&&t.push(c)}}return t};export{l as a,E as d,v as m,D as s};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{existsSync as h,statSync as P,readdirSync as A,realpathSync as D,lstatSync as C}from"node:fs";import{dirname as f,join as g,relative as F,sep as w,resolve as k,extname as O,basename as j}from"node:path";import{findUpSync as z,FIND_UP_STOP as V,matcher as K}from"@visulima/fs";import{SyntaxKind as p,Node as i,VariableDeclarationKind as $}from"ts-morph";import{diagnosticAt as M}from"./CodegenDiagnosticError-BUXlG3P-.mjs";import{p as U,a as B,r as W}from"./project-config-file-
|
|
1
|
+
import{existsSync as h,statSync as P,readdirSync as A,realpathSync as D,lstatSync as C}from"node:fs";import{dirname as f,join as g,relative as F,sep as w,resolve as k,extname as O,basename as j}from"node:path";import{findUpSync as z,FIND_UP_STOP as V,matcher as K}from"@visulima/fs";import{SyntaxKind as p,Node as i,VariableDeclarationKind as $}from"ts-morph";import{diagnosticAt as M}from"./CodegenDiagnosticError-BUXlG3P-.mjs";import{p as U,a as B,r as W}from"./project-config-file-BV7RR-l6.mjs";import{findProjectConfigFile as N}from"./PROJECT_CONFIG_FILENAMES-DzOu-lSc.mjs";const X=/\.ts$/u,d=(e,t)=>F(e,t).split(w).join("/").replace(X,""),G=new Set(["_generated","node_modules"]),_=new Set(["__fixtures__","__mocks__","__snapshots__","__tests__"]),L=/\.(?:bench|e2e|e2e-spec|spec|spec-d|test|test-d)(?:\.tsx?)?$/u,Se=e=>{const t=e.split("/");return L.test(t.at(-1)??"")||t.slice(0,-1).some(s=>_.has(s))},E=(e,t,s)=>t?G.has(e)||!s&&_.has(e):!s&&L.test(e),v=new Map,m=()=>!1,H=e=>{const t=z(a=>N(a)??(h(g(a,"package.json"))||h(g(a,".git"))?V:void 0),{cwd:f(k(e))}),s=t===void 0?void 0:P(t,{throwIfNoEntry:!1});if(t===void 0||s===void 0)return m;const n=`${String(s.mtimeMs)}:${String(s.size)}`,r=v.get(t);if(r?.key===n)return r.isExcluded;const{codegen:o}=W(f(t));o?.unreadable&&console.warn("@lunora/codegen: `codegen.exclude` in lunora.config is not an array of string literals without `!` negations — ignoring it.");const c=o?.exclude?.length?K(o.exclude):m;return v.set(t,{isExcluded:c,key:n}),c},Y=(e,t,s)=>e==="schema.ts"&&t===s,q=e=>{try{return P(e)}catch{console.warn(`@lunora/codegen: skipping ${e} — it is a symlink that does not resolve (or vanished mid-scan).`);return}},R=(e,t,s,n,r)=>{let o,c;try{o=A(e),c=D(e)}catch{return t}if(n.has(c))return t;n.add(c);for(const a of o){const u=g(e,a),l=q(u);l===void 0||r(a,F(s,u).split(w).join("/"),l.isDirectory())||(l.isDirectory()?R(u,t,s,n,r):l.isFile()&&O(a)===".ts"&&!Y(a,e,s)&&t.push(u))}return t},T=(e,t={})=>{const s=t.includeSkipped??!1,n=s?m:H(e);return R(e,[],e,new Set,(r,o,c)=>E(r,c,s)||n(o))},Q=["src/server","src/index.ts","src/worker.ts"],J=new Set([".ts",".tsx"]),b=(e,t=[])=>{let s;try{s=C(e)}catch{return t}if(s.isFile())return J.has(O(e))&&!E(j(e),!1,!1)&&t.push(e),t;if(!s.isDirectory())return t;for(const n of A(e))E(n,!0,!1)||b(g(e,n),t);return t},Z=e=>{const t=f(e),s=T(e).map(o=>({displayPath:d(e,o),filePath:o})),n=new Set(s.map(o=>o.filePath)),r=N(t);for(const o of[...Q.flatMap(c=>b(g(t,c))),...r===void 0?[]:[r]])n.has(o)||(n.add(o),s.push({displayPath:d(t,o),filePath:o}));return s},ee=e=>Array.isArray(e),I=(e,t,s,n)=>{const r=[];for(const{displayPath:o,filePath:c}of t){const a=e.getSourceFile(c)??e.addSourceFileAtPath(c);for(const u of a.getDescendantsOfKind(s)){const l=n(u,o);ee(l)?r.push(...l):l!==void 0&&r.push(l)}}return r},te=e=>T(e).map(t=>({displayPath:d(e,t),filePath:t})),se=(e,t,s,n)=>I(e,te(t),s,n),he=(e,t,s)=>se(e,t,p.CallExpression,s),ve=(e,t,s)=>I(e,Z(t),p.CallExpression,s),ye=e=>U(e.getPropertyNameNode()??e.getNameNode()),S=(e,t)=>e?.getProperties().find(s=>!i.isSpreadAssignment(s)&&B(s)===t),Pe=(e,t)=>{if(t){const o=e.getArguments()[0];return o&&(i.isArrowFunction(o)||i.isFunctionExpression(o))?o:void 0}const s=e.getArguments()[0];if(!s||!i.isObjectLiteralExpression(s))return;const n=S(s,"handler");if(!n||!i.isPropertyAssignment(n))return;const r=n.getInitializer();return r&&(i.isArrowFunction(r)||i.isFunctionExpression(r))?r:void 0},Ae=(e,t)=>{if(!e||!i.isObjectLiteralExpression(e))return;const s=S(e,t);return s&&i.isPropertyAssignment(s)?s.getInitializer():void 0},ie=e=>{const t=e?.getParent();return i.isVariableDeclaration(e)&&i.isVariableDeclarationList(t)&&t.getDeclarationKind()===$.Const},ne=e=>{let t=e,s=t.getParent();for(;s!==void 0&&(i.isParenthesizedExpression(s)||i.isAsExpression(s)||i.isSatisfiesExpression(s)||i.isTypeAssertion(s)||i.isNonNullExpression(s));)t=s,s=t.getParent();return t},y=e=>{const t=ne(e),s=t.getParent();if(s===void 0)return!1;if(i.isBinaryExpression(s)){const r=s.getOperatorToken().getKind();return s.getLeft()===t&&r>=p.FirstAssignment&&r<=p.LastAssignment}if(i.isPrefixUnaryExpression(s)||i.isPostfixUnaryExpression(s)){const r=s.getOperatorToken();return r===p.PlusPlusToken||r===p.MinusMinusToken}return i.isDeleteExpression(s)?!0:i.isForOfStatement(s)||i.isForInStatement(s)?s.getInitializer()===t:i.isPropertyAssignment(s)?s.getInitializer()===t&&y(s):(i.isShorthandPropertyAssignment(s)||i.isSpreadAssignment(s)||i.isSpreadElement(s)||i.isObjectLiteralExpression(s)||i.isArrayLiteralExpression(s))&&y(s)},re=e=>{const t=e?.getDeclarations().find(n=>i.isVariableDeclaration(n));if(!ie(t))return;const s=t.getParent().getParent();return i.isVariableStatement(s)&&i.isSourceFile(s.getParent())?t.getInitializer():void 0},oe=e=>re(e.getSymbol()),Fe=e=>{if(!e)return;if(i.isObjectLiteralExpression(e))return e;if(!i.isIdentifier(e))return;const t=oe(e);return t!==void 0&&i.isObjectLiteralExpression(t)?t:void 0},x=e=>{let t=e;for(;t&&(i.isAsExpression(t)||i.isSatisfiesExpression(t)||i.isParenthesizedExpression(t)||i.isNonNullExpression(t));)t=t.getExpression();return t},ce=(e,t)=>{let s=x(e);for(;i.isAwaitExpression(s)||i.isPropertyAccessExpression(s)||i.isElementAccessExpression(s)||i.isCallExpression(s);){const n=i.isCallExpression(s)?t?.(s):void 0;if(n!==void 0)return{verdict:n};s=x(s.getExpression())}return{root:s}},we=e=>ce(e).root,Oe=e=>i.isArrowFunction(e)||i.isConstructorDeclaration(e)||i.isFunctionDeclaration(e)||i.isFunctionExpression(e)||i.isGetAccessorDeclaration(e)||i.isMethodDeclaration(e)||i.isSetAccessorDeclaration(e),Ne=(e,t)=>e?.compilerNode===t.compilerNode,_e=e=>{if(i.isPropertyAccessExpression(e))return{member:e.getName(),object:e.getExpression()};const t=i.isElementAccessExpression(e)?e.getArgumentExpression():void 0;return i.isElementAccessExpression(e)&&i.isStringLiteral(t)?{member:t.getLiteralValue(),object:e.getExpression()}:void 0},Le=e=>{const t=e.getParent();return i.isReturnStatement(t)||i.isArrowFunction(t)&&t.getBody()===e?e.getFirstAncestor(n=>i.isFunctionLikeDeclaration(n)||i.isArrowFunction(n)):void 0},Re=e=>{const t=x(e);return t&&i.isCallExpression(t)?t:void 0},Te=e=>{const t=e.getExportAssignment(r=>!r.isExportEquals());if(!t)return;const s=t.getExpression();if(!i.isIdentifier(s))return s;const n=s.getSymbol()?.getValueDeclaration();return n&&i.isVariableDeclaration(n)?n.getInitializer():s},be=e=>{const t=e.getArguments()[1];return t&&i.isStringLiteral(t)?t.getLiteralValue():""},Ie=(e,t)=>{if(!i.isObjectLiteralExpression(e))return;const s=S(e,t);if(!s||!i.isPropertyAssignment(s))return;const n=s.getInitializer();return n&&i.isStringLiteral(n)?n.getLiteralText():void 0},ae=e=>{const t=e.getStatements(),[s]=t;if(t.length!==1||s===void 0||!i.isReturnStatement(s))return;const n=s.getExpression();return n!==void 0&&i.isObjectLiteralExpression(n)?n:void 0},De=e=>{if(i.isObjectLiteralExpression(e))return e;if(i.isParenthesizedExpression(e)){const t=e.getExpression();return i.isObjectLiteralExpression(t)?t:void 0}return i.isBlock(e)?ae(e):void 0},Ce=e=>(t,s,n)=>{if(i.isStringLiteral(t)||i.isNoSubstitutionTemplateLiteral(t))return t.getLiteralValue();throw M(t,`${e} "${s}": \`${n}\` must be a static string literal — it is deploy configuration codegen writes into wrangler.jsonc`)},le=new Set(["api","internal"]),ke=new Set(["run","runAction","runMutation","runQuery"]),ue=e=>{if(e===void 0||!i.isPropertyAccessExpression(e))return;const t=[];let s=e;for(;i.isPropertyAccessExpression(s);)t.unshift(s.getName()),s=s.getExpression();return i.isIdentifier(s)&&le.has(s.getText())&&t.length>=2?t:void 0},je=e=>{const t=ue(e);return t===void 0?void 0:`${t.slice(0,-1).join("_")}:${String(t.at(-1))}`};export{ke as RUN_METHODS,X as TS_EXTENSION_RE,ye as bindingKeyName,we as chainRootOf,he as collectCallRows,se as collectNodeRows,ve as collectSecurityCallRows,Te as defaultExportExpression,S as findObjectProperty,je as functionKeyOf,ue as functionReferenceSegments,Pe as handlerOf,ie as isConstDeclaration,Oe as isFunctionLike,Ne as isSameNode,Se as isTestPath,y as isWriteTarget,be as limitNameOf,T as listLunoraSourceFiles,Z as listSecurityScanFiles,d as lunoraRelativePath,_e as memberAccessOf,De as objectLiteralFromCallbackBody,Fe as optionsObjectLiteral,ne as outermostValueWrapper,Ae as propertyInitializer,B as propertyKeyName,U as propertyNameText,Le as returningFunctionOf,Ce as stringPropertyFor,Ie as stringPropertyOf,re as symbolConstInitializer,x as unwrapExpression,Re as unwrapToCallExpression,ce as walkChain};
|
package/dist/packem_shared/{loadProjectConfig-DGqGWOfa.mjs → loadProjectConfig-NO0dVJSl.mjs}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{l as o,b as a,r as t}from"./project-config-file-
|
|
1
|
+
import{l as o,b as a,r as t}from"./project-config-file-BV7RR-l6.mjs";import{PROJECT_CONFIG_FILENAMES as i,findProjectConfigFile as l}from"./PROJECT_CONFIG_FILENAMES-DzOu-lSc.mjs";export{i as PROJECT_CONFIG_FILENAMES,l as findProjectConfigFile,o as loadProjectConfig,a as readMergeDurableObjects,t as readProjectConfigLiterals};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{basename as b}from"node:path";import{Node as d}from"ts-morph";import{diagnosticAt as c}from"./CodegenDiagnosticError-BUXlG3P-.mjs";import{listLunoraSourceFiles as $,lunoraRelativePath as v,unwrapToCallExpression as E,defaultExportExpression as S,findObjectProperty as M}from"./isTestPath-
|
|
1
|
+
import{basename as b}from"node:path";import{Node as d}from"ts-morph";import{diagnosticAt as c}from"./CodegenDiagnosticError-BUXlG3P-.mjs";import{listLunoraSourceFiles as $,lunoraRelativePath as v,unwrapToCallExpression as E,defaultExportExpression as S,findObjectProperty as M}from"./isTestPath-B81lOULB.mjs";import{s as g}from"./dispatch-namespace-DwTjD7BU.mjs";const h=(e,o)=>e.find(t=>t.ownsFolder!==!1&&o.startsWith(`${t.name}/`))?.name,F="module.ts",w=(e,o,t)=>{if(d.isStringLiteral(e)||d.isNoSubstitutionTemplateLiteral(e))return e.getLiteralValue();throw c(e,`module "${o}": \`${t}\` must be a static string literal — codegen reads it without running the file`)},L=(e,o,t)=>{if(!d.isArrayLiteralExpression(e))throw c(e,`module "${o}": \`${t}\` must be an inline array of table names`);return e.getElements().map(n=>w(n,o,t))},p=(e,o,t)=>{const n=M(e,o);if(n!==void 0){if(!d.isPropertyAssignment(n))throw c(n,`module "${t}": write \`${o}\` inline as \`${o}: …\` — codegen reads it without running the file`);return n.getInitializerOrThrow()}},A=(e,o,t)=>{const n=e.getSourceFile(o)??e.addSourceFileAtPath(o),s=E(S(n)),a=s?.getExpression();if(!s||!a||!d.isIdentifier(a)||a.getText()!=="defineModule")return;if(t==="")throw c(s,"defineModule: lunora/module.ts would make the whole app one module — move it into the folder it describes (lunora/<module>/module.ts)");const i=s.getArguments()[0],m={name:t,tables:[]};if(i===void 0)return m;if(!d.isObjectLiteralExpression(i))throw c(i,`module "${t}": defineModule must be passed an inline object literal`);const r=p(i,"description",t);r!==void 0&&(m.description=w(r,t,"description"));const l=p(i,"tables",t);return l!==void 0&&(m.tables=L(l,t,"tables")),m},k=(e,o)=>{const t=[];for(const n of $(o)){if(b(n)!==F)continue;const s=v(o,n),a=A(e,n,s==="module"?"":s.slice(0,-7));a&&t.push(a)}return t.toSorted((n,s)=>n.name.localeCompare(s.name))},T=(e,o)=>{const t=new Set(e.map(r=>r.name)),n=new Set(e.flatMap(r=>r.tables)),s=o.tables.filter(r=>r.extensionKey!==void 0&&!n.has(r.name)),a=Map.groupBy(s,r=>String(r.extensionKey)),i=e.map(r=>{const l=a.get(r.name);return l===void 0?r:{...r,tables:[...r.tables,...l.map(u=>u.name)]}}),m=[...a].filter(([r])=>!t.has(r)).map(([r,l])=>{const u=l.every(f=>f.extensionFromPackage===!0);return{installed:!0,name:r,...u?{ownsFolder:!1}:{},tables:l.map(f=>f.name)}});return[...i,...m].toSorted((r,l)=>r.name.localeCompare(l.name))},x=e=>{for(const o of e){const t=e.find(n=>n.name.startsWith(`${o.name}/`));if(t)throw new Error(`@lunora/codegen: module "${t.name}" is nested inside ${o.installed===!0?"installed component":"module"} "${o.name}" — a file can belong to one module only, so move one of the two`)}},y=(e,o)=>{const t=new Set(o.tables.map(s=>s.name)),n=new Map;for(const s of e)for(const a of s.tables){if(!t.has(a))throw new Error(`@lunora/codegen: module "${s.name}" declares table "${a}", which lunora/schema.ts does not define`);const i=n.get(a);if(i!==void 0)throw new Error(`@lunora/codegen: table "${a}" is claimed by both module "${i}" and module "${s.name}" — a table has one owner`);n.set(a,s.name)}},C=(e,o,t)=>{if(e.length===0)return;const n=new Set(o.map(s=>s.name));for(const s of t){const a=g(s);if(h(o,s)===void 0&&n.has(a))throw new Error(`@lunora/codegen: lunora/${s}.ts sits beside module "${a}" and shares its name — move it into lunora/${a}/ or rename one of them`)}},z=(e,o,t)=>{const n=T(e,o);return x(n),y(n,o),C(e,n,t),n},K=(e,o)=>h(e,o)??g(o);export{h as a,k as d,K as m,z as r};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{LunoraError as y}from"@lunora/errors";import{Node as i,VariableDeclarationKind as h}from"ts-morph";import{diagnosticAt as b}from"./CodegenDiagnosticError-BUXlG3P-.mjs";import{s as E}from"./project-config-file-
|
|
1
|
+
import{LunoraError as y}from"@lunora/errors";import{Node as i,VariableDeclarationKind as h}from"ts-morph";import{diagnosticAt as b}from"./CodegenDiagnosticError-BUXlG3P-.mjs";import{s as E}from"./project-config-file-BV7RR-l6.mjs";let f;const z=e=>{f=e},A=/^[A-Za-z_$][\w$]*$/u,p=new Set(["$defaultFn","$onUpdateFn","$type","default","defaultNow","nullable","serverDefault","unique"]),k=(e,t)=>{const r={notNull:!0,...e.column};switch(t){case"$defaultFn":case"default":case"defaultNow":case"serverDefault":{r.hasDefault=!0;break}case"$onUpdateFn":{r.hasOnUpdate=!0;break}case"$type":break;case"nullable":{r.notNull=!1;break}case"unique":{r.unique=!0;break}}return{...e,column:r}},N=new Set(["any","bigint","boolean","bytes","date","geoPoint","null","number","string","timestamp"]),m=new Set(["check","email","int","length","max","min","pattern","positive","url"]),I=new Set(["meta"]),T=new Set(["strip"]),l=new Set,g=new Set,S=e=>{const t=e.getSymbol();let r=(t?.getAliasedSymbol()??t)?.getValueDeclaration();if(r!==void 0&&i.isShorthandPropertyAssignment(r)){const n=r.getValueSymbol();r=(n?.getAliasedSymbol()??n)?.getValueDeclaration()}if(!(r===void 0||!i.isVariableDeclaration(r)))return r.getInitializer()},L=e=>{const t=e.getParent();return!i.isVariableDeclaration(t)||t.getVariableStatement()?.getDeclarationKind()===h.Const},u=e=>{if(i.isParenthesizedExpression(e)||i.isAsExpression(e)||i.isSatisfiesExpression(e))return u(e.getExpression());if(i.isObjectLiteralExpression(e))return e;if(i.isPropertyAccessExpression(e)){const r=e.getSymbol()?.getValueDeclaration(),n=r!==void 0&&i.isPropertyAssignment(r)?r.getInitializer():void 0;return n===void 0?void 0:u(n)}if(!i.isIdentifier(e)||l.has(e))return;const t=S(e);if(!(t===void 0||!L(t))){l.add(e);try{return u(t)}finally{l.delete(e)}}},w="v",D=e=>{if(i.isIdentifier(e))return!0;let t=e;for(;i.isCallExpression(t);){const r=t.getExpression();if(!i.isPropertyAccessExpression(r))return!1;t=r.getExpression()}return i.isIdentifier(t)&&t.getText()===w},c=e=>{if(i.isIdentifier(e)&&!l.has(e)){const t=S(e);if(t!==void 0&&D(t)){l.add(e);try{return c(t)}finally{l.delete(e)}}}return i.isCallExpression(e)?$(e):{kind:"any",sourceText:e.getText()}},R=e=>{const t=u(e.getExpression());if(t===void 0||g.has(t))return{};g.add(t);try{return v(t)}finally{g.delete(t)}},V=e=>{throw b(e,`computed property name ${e.getText()} must be a string literal — codegen resolves object keys statically.`)},v=e=>{const t={};for(const r of e.getProperties()){if(i.isSpreadAssignment(r)){Object.assign(t,R(r));continue}const n=i.isShorthandPropertyAssignment(r);if(!n&&!i.isPropertyAssignment(r))continue;const s=n?r.getNameNode():r.getInitializer();if(!s)continue;const a=r.getNameNode(),o=E(a)??V(a);if(!A.test(o))throw new y("INTERNAL",`@lunora/codegen: field name is not a valid JS identifier: ${JSON.stringify(o)}`);t[o]=c(s)}return t},d=(e,t)=>e&&i.isExpression(e)?c(e):t,x=e=>e===void 0?"undefined":i.isStringLiteral(e)||i.isNoSubstitutionTemplateLiteral(e)?JSON.stringify(e.getLiteralValue()):e.getText(),O=e=>{const t=e&&f?f(e):void 0;return t===void 0?{kind:"from"}:{kind:"from",tsType:t}},M=(e,t,r)=>{if(N.has(e))return{kind:e};const[n,s]=t;switch(e){case"array":return{inner:d(n,{kind:"any"}),kind:"array"};case"from":return O(n);case"id":{if(!n||!i.isStringLiteral(n))throw b(n??r,`v.id(...) target table must be a string literal — codegen resolves foreign-key targets statically. Got ${n?n.getText():"no argument"}.`);return{kind:"id",tableName:n.getLiteralText()}}case"literal":return{kind:"literal",literalValue:x(n)};case"object":return n&&i.isObjectLiteralExpression(n)?{kind:"object",shape:v(n)}:{kind:"object",shape:{}};case"optional":return{inner:d(n,{kind:"any"}),kind:"optional"};case"record":return{keyType:d(n,{kind:"string"}),kind:"record",valueType:d(s,{kind:"any"})};case"storage":return n&&i.isStringLiteral(n)?{bucket:n.getLiteralText(),kind:"storage"}:{kind:"storage"};case"union":return{kind:"union",members:t.filter(a=>i.isExpression(a)).map(a=>c(a))};default:throw new y("INTERNAL",`Unsupported validator kind: ${e}`)}},P=e=>{const[t]=e;if(e.length!==1||t===void 0||!i.isNumericLiteral(t))return;const r=Number(t.getText().replaceAll("_",""));return Number.isSafeInteger(r)&&r>=0?r:void 0},$=e=>{const t=e.getExpression();if(!i.isPropertyAccessExpression(t))return{kind:"any",sourceText:e.getText()};const r=t.getName(),n=e.getArguments();if(p.has(r)||m.has(r)||I.has(r)||T.has(r)){const s=t.getExpression(),a=i.isExpression(s)?c(s):{kind:"any"};if(p.has(r))return k(a,r);if(!m.has(r))return a;const o=r==="max"&&a.kind==="string"?P(n):void 0;return o!==void 0?{...a,hasRefinement:!0,stringMaxLength:Math.min(a.stringMaxLength??o,o)}:{...a,hasRefinement:!0,unmodelledRefinement:!0}}return M(r,n,e)};export{c as a,v as p,u as r,z as s};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{statSync as x,readFileSync as y}from"node:fs";import{basename as E}from"node:path";import{createJiti as P}from"jiti";import{Node as i,Project as S}from"ts-morph";import{findProjectConfigFile as v}from"./PROJECT_CONFIG_FILENAMES-DzOu-lSc.mjs";const j=r=>{if(i.isStringLiteral(r)||i.isNoSubstitutionTemplateLiteral(r)||i.isNumericLiteral(r))return r.getLiteralText();if(i.isComputedPropertyName(r)){const t=r.getExpression();return i.isStringLiteral(t)||i.isNoSubstitutionTemplateLiteral(t)?t.getLiteralText():void 0}return r.getText()},A=r=>j(r)??r.getText(),d=r=>A(r.getNameNode()),f=new Map,$=async r=>{const t=v(r);if(t===void 0)return{};let e;try{const a=x(t);e=`${String(a.mtimeMs)}:${String(a.size)}`}catch{return{}}const n=f.get(t);if(n?.key===e)return n.value;const s=(async()=>{try{const o=(await P(t,{interopDefault:!1,moduleCache:!1}).import(t))?.default;return{config:o!==null&&typeof o=="object"?o:void 0}}catch(a){return{error:a instanceof Error?a.message:String(a)}}})();return f.set(t,{key:e,value:s}),s},h=r=>{let e=r.getExportAssignments().find(n=>!n.isExportEquals())?.getExpression();for(;e!==void 0&&(i.isSatisfiesExpression(e)||i.isAsExpression(e)||i.isParenthesizedExpression(e));)e=e.getExpression();if(e!==void 0&&i.isIdentifier(e))for(e=r.getVariableDeclaration(e.getText())?.getInitializer();e!==void 0&&(i.isSatisfiesExpression(e)||i.isAsExpression(e));)e=e.getExpression();return e!==void 0&&i.isObjectLiteralExpression(e)?e:void 0},g=(r,t)=>i.isPropertyAssignment(r)?r.getInitializer():t.getVariableDeclaration(d(r))?.getInitializer(),b=r=>{let t=r;for(;t!==void 0&&(i.isSatisfiesExpression(t)||i.isAsExpression(t)||i.isParenthesizedExpression(t));)t=t.getExpression();return t},p=(r,t,e)=>{const n=b(r);if(n===void 0||!i.isObjectLiteralExpression(n))return{unreadable:!0};const s=n.getProperties(),a=s.filter(u=>i.isPropertyAssignment(u)&&!i.isComputedPropertyName(u.getNameNode())||i.isShorthandPropertyAssignment(u));if(a.length!==s.length)return{unreadable:!0};const o=a.find(u=>d(u)===e);if(o===void 0)return{absent:!0};const l=g(o,t);return l===void 0?{unreadable:!0}:{literal:l}},O=["exportName","file","reason","rule"],N=r=>{const t=b(r);if(t===void 0||!i.isObjectLiteralExpression(t))return;const e={};for(const l of t.getProperties()){if(!i.isPropertyAssignment(l)||i.isComputedPropertyName(l.getNameNode()))return;const u=d(l),c=b(l.getInitializer());if(!O.includes(u)||c===void 0||!i.isStringLiteral(c)&&!i.isNoSubstitutionTemplateLiteral(c))return;e[u]=c.getLiteralValue()}const{exportName:n,file:s,reason:a,rule:o}=e;return n?.trim()&&s?.trim()&&a?.trim()&&o?.trim()?{exportName:n,file:s,reason:a,rule:o}:void 0},T=(r,t)=>{const e=p(r,t,"accept");if("absent"in e)return{};const n="literal"in e?b(e.literal):void 0;if(n===void 0||!i.isArrayLiteralExpression(n))return{acceptUnreadable:!0};const s=[];for(const a of n.getElements()){const o=N(a);if(o===void 0)return{acceptUnreadable:!0};s.push(o)}return{accept:s}},C=(r,t)=>{const e=p(r,t,"minSeverity"),n=T(r,t);return"absent"in e?{advisor:n}:"literal"in e&&i.isStringLiteral(e.literal)?{advisor:{...n,minSeverity:e.literal.getLiteralValue()}}:{advisor:{...n,unreadable:!0}}},z=(r,t)=>{const e=p(r,t,"exclude");if("absent"in e)return{codegen:{}};if(!("literal"in e)||!i.isArrayLiteralExpression(e.literal))return{codegen:{unreadable:!0}};const n=[];for(const s of e.literal.getElements()){if(!i.isStringLiteral(s)&&!i.isNoSubstitutionTemplateLiteral(s)||s.getLiteralValue().startsWith("!"))return{codegen:{unreadable:!0}};n.push(s.getLiteralValue())}return{codegen:{exclude:n}}},w=(r,t)=>{const e=p(r,t,"merge");return"absent"in e?{durableObjects:{}}:"literal"in e&&(i.isTrueLiteral(e.literal)||i.isFalseLiteral(e.literal))?{durableObjects:{merge:e.literal.getLiteralValue()}}:{durableObjects:{unreadable:!0}}},D=new Map([["advisor",{advisor:{unreadable:!0}}],["codegen",{codegen:{unreadable:!0}}],["durableObjects",{durableObjects:{unreadable:!0}}],["remote",{unreadable:!0}],["target",{unreadable:!0}]]),L=(r,t)=>{const e=r.getProperty(t);if(e!==void 0)return(i.isPropertyAssignment(e)?e.getInitializer():void 0)??"unreadable"},m=(r,t)=>{const e=L(r,t);if(e!==void 0)return e!=="unreadable"&&(i.isStringLiteral(e)||i.isNoSubstitutionTemplateLiteral(e))?e.getLiteralValue():!1},V=r=>{const t=L(r,"rpc");if(t!==void 0)return t!=="unreadable"&&i.isFalseLiteral(t)?!1:"unreadable"},I=r=>{const t=b(r);if(t===void 0||!i.isObjectLiteralExpression(t))return{services:{unreadable:!0}};const e={};for(const n of t.getProperties()){if(!i.isPropertyAssignment(n)||i.isComputedPropertyName(n.getNameNode()))return{services:{unreadable:!0}};const s=b(n.getInitializer());if(s===void 0||!i.isObjectLiteralExpression(s)||s.getProperties().some(u=>!i.isPropertyAssignment(u)))return{services:{unreadable:!0}};const a=m(s,"dir"),o=m(s,"entrypoint"),l=V(s);if(typeof a!="string"||o===!1||l==="unreadable")return{services:{unreadable:!0}};e[d(n)]={dir:a,...o===void 0?{}:{entrypoint:o},...l===void 0?{}:{rpc:l}}}return{services:{declared:e}}},M=(r,t)=>{if(i.isGetAccessorDeclaration(r)||i.isMethodDeclaration(r))return D.get(d(r))??{};if(!i.isPropertyAssignment(r)&&!i.isShorthandPropertyAssignment(r))return{};const e=d(r);if(e==="advisor")return C(g(r,t),t);if(e==="services")return I(g(r,t));if(e==="codegen")return z(g(r,t),t);if(e==="durableObjects")return w(g(r,t),t);if(e!=="target"&&e!=="remote")return{};const n=g(r,t);return n===void 0?{unreadable:!0}:e==="target"?i.isStringLiteral(n)?{target:n.getLiteralValue()}:{unreadable:!0}:i.isTrueLiteral(n)||i.isFalseLiteral(n)?{remote:n.getLiteralValue()}:i.isObjectLiteralExpression(n)?{remote:!0}:{unreadable:!0}},k=r=>{const t=v(r);if(t===void 0)return{};let e;try{e=y(t,"utf8")}catch{return{unreadable:!0}}const s=new S({compilerOptions:{allowJs:!0},skipFileDependencyResolution:!0,skipLoadingLibFiles:!0,useInMemoryFileSystem:!0}).createSourceFile(E(t),e,{overwrite:!0}),a=h(s);if(a===void 0)return{unreadable:!0};if(a.getProperties().some(l=>i.isSpreadAssignment(l))){const l=u=>a.getProperties().some(c=>!i.isSpreadAssignment(c)&&d(c)===u);return{...l("advisor")?{advisor:{unreadable:!0}}:{},...l("codegen")?{codegen:{unreadable:!0}}:{},...l("durableObjects")?{durableObjects:{unreadable:!0}}:{},...l("services")?{services:{unreadable:!0}}:{},unreadable:!0}}let o={};for(const l of a.getProperties())o={...o,...M(l,s)};return o},q=r=>{const{durableObjects:t}=k(r);return t?.unreadable&&console.warn("@lunora/codegen: `durableObjects.merge` in lunora.config is not a boolean literal — the Durable Object classes stay separate."),t?.merge===!0};export{d as a,q as b,$ as l,A as p,k as r,j as s};
|
package/dist/packem_shared/{readServiceBindings-DuE9xlvV.mjs → readServiceBindings-DvqIThzd.mjs}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{existsSync as g,readFileSync as p}from"node:fs";import{isAbsolute as w,resolve as m,join as u}from"node:path";import{ts as h}from"ts-morph";import{r as E}from"./project-config-file-
|
|
1
|
+
import{existsSync as g,readFileSync as p}from"node:fs";import{isAbsolute as w,resolve as m,join as u}from"node:path";import{ts as h}from"ts-morph";import{r as E}from"./project-config-file-BV7RR-l6.mjs";const f=/^[A-Za-z_$][\w$]*$/u,$=["wrangler.jsonc","wrangler.json"],b=t=>`SERVICE_${t.replaceAll(/(?<=[a-z0-9])(?=[A-Z])/gu,"_").toUpperCase()}`,y=(t,e)=>{const r=$.map(n=>u(e,n)).find(n=>g(n));if(r===void 0){const n=g(u(e,"wrangler.toml"))?" (its wrangler.toml is not read — Lunora reads a service's config as JSON(C) only)":"";throw new Error(`@lunora/codegen: service "${t}" points at ${e}, which has no wrangler.jsonc / wrangler.json${n}`)}const o=h.parseConfigFileTextToJson(r,p(r,"utf8"));if(o.error!==void 0||typeof o.config!="object"||o.config===null)throw new Error(`@lunora/codegen: service "${t}": ${r} is not valid JSON(C)`);return{config:o.config,path:r}},v=(t,e)=>{const r=t.route??e.route,o=t.routes??e.routes;return!(r!==void 0||Array.isArray(o)&&o.length>0)&&(t.workers_dev??e.workers_dev)!==!1},S=(t,e,r)=>{if(!f.test(e))throw new Error(`@lunora/codegen: service key "${e}" must be an identifier — it becomes ctx.services.${e}`);if(r.entrypoint!==void 0&&!f.test(r.entrypoint))throw new Error(`@lunora/codegen: service "${e}": entrypoint "${r.entrypoint}" must name an exported WorkerEntrypoint class`);const o=w(r.dir)?r.dir:m(t,r.dir),{config:n,path:s}=y(e,o),{main:c,name:l}=n;if(typeof l!="string"||l==="")throw new Error(`@lunora/codegen: service "${e}": ${s} declares no Worker "name"`);if(typeof c!="string"||c==="")throw new Error(`@lunora/codegen: service "${e}": ${s} declares no "main" entry module`);const d=Object.entries(n.env??{}).map(([i,a])=>[i,a??{}]);return{binding:b(e),...r.entrypoint===void 0?{}:{entrypoint:r.entrypoint},envWorkers:Object.fromEntries(d.flatMap(([i,a])=>typeof a.name=="string"&&a.name!==""?[[i,a.name]]:[])),main:m(o,c),name:e,publicScopes:[...v(n,n)?[""]:[],...d.filter(([,i])=>v(i,n)).map(([i])=>i)],...r.entrypoint===void 0||r.rpc===!1?{}:{rpcEntrypoint:r.entrypoint},worker:l,wranglerPath:s}},j=t=>{const{services:e}=E(t);if(e?.unreadable===!0)throw new Error('@lunora/codegen: lunora.config `services` must be an inline object of { dir: "…", entrypoint?: "…", rpc?: false } literals — codegen reads it without running the file');const r=Object.entries(e?.declared??{}).map(([o,n])=>S(t,o,n)).toSorted((o,n)=>o.name.localeCompare(n.name));for(const[o,n]of r.entries()){const s=r.slice(o+1).find(c=>c.binding===n.binding);if(s!==void 0)throw new Error(`@lunora/codegen: services "${n.name}" and "${s.name}" both map to the binding ${n.binding} — rename one`)}return r},A=t=>{try{return{services:j(t)}}catch(e){return{error:e instanceof Error?e.message:String(e),services:[]}}};export{A as readServiceBindings,j as resolveServiceBindings};
|
package/dist/packem_shared/{unwrap-handler-return-BedChFbC.mjs → unwrap-handler-return-B-jQde6M.mjs}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Node as l,SyntaxKind as g,DiagnosticCategory as j}from"ts-morph";import{lunoraRelativePath as P}from"./isTestPath-CiIyKqhF.mjs";import{posix as h}from"node:path";let S,v;const _e=e=>{const t=S,r=[];S=r;try{return{erased:r,value:e()}}finally{S=t}},Re=e=>{S?.push(...e)},U=e=>{for(const t of e.getAncestors())if(l.isVariableDeclaration(t))return t.getName()},E=(e,t)=>{S?.push({exportName:U(e),filePath:e.getSourceFile().getFilePath(),line:e.getStartLineNumber(),rendered:t})},$e=e=>{v!==void 0&&E(v,e)},Ce=(e,t)=>{const r=v;v=e;try{return t()}finally{v=r}},K=(e,t)=>{const r=e.exportName??`line ${e.line.toString()}`;return{cacheKey:`procedure_return_type_erased:${t}:${r}`,categories:["SCHEMA"],description:"Codegen renders a procedure's return type into `_generated/`, where only names that resolve from that directory may appear. A type it can neither name nor reproduce structurally — a class instance, a call or index signature, a recursive or very deeply nested shape — is emitted as `unknown` instead, so callers lose the shape while the runtime still returns it.",detail:`\`${r}\` in \`${t}\` (line ${e.line.toString()}) returns \`${e.rendered}\`, which codegen could not reproduce — its generated type is \`unknown\`.`,facing:"INTERNAL",level:"WARN",metadata:{exportName:e.exportName,filePath:t,line:e.line,rendered:e.rendered},name:"procedure_return_type_erased",remediation:"Declare the shape explicitly with `.output(...)`, or export the type from the module that declares it so codegen can name it. A class instance cannot cross the wire at all — return a plain object.",title:"Procedure return type is missing from the generated type"}},ke=(e,t)=>{const r=new Map;for(const n of e){const s=K(n,P(t,n.filePath));r.set(s.cacheKey,s)}return[...r.values()].toSorted((n,s)=>n.cacheKey.localeCompare(s.cacheKey))},F=/\bany\b(?!\s*(?:\?\s*)?:)/u,B=/"(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*'|`(?:[^`\\]|\\.)*`/gu,V=e=>F.test(e.replaceAll(B,"")),W="/_generated/",q=e=>{const t=[e.getSymbol(),e.getAliasSymbol()].flatMap(r=>r?.getDeclarations()??[]);return t.length>0&&t.every(r=>r.getSourceFile().getSymbol()===void 0)},G=/^(?<quote>["'])(?<specifier>.*)\k<quote>$/su,N=e=>{for(const t of e.getAncestors())if(l.isModuleDeclaration(t)){const r=G.exec(t.getName());if(r?.groups?.specifier!==void 0)return r.groups.specifier}},w=new WeakMap,X=(e,t)=>{const r=e.getSymbol();if(r===void 0)return;let n=w.get(r.compilerSymbol);return n===void 0&&(n=new Map,w.set(r.compilerSymbol,n)),n.has(t)||n.set(t,r.getExport(t)??e.getExportSymbols().find(s=>s.getName()===t)),n.get(t)},$=(e,t)=>e.getNamespaceImport()!==void 0||e.getNamedImports().some(r=>r.getName()===t),H=(e,t,r)=>e.getModuleSpecifierValue()===t&&$(e,r)?r:void 0,Y=(e,t)=>{const r=e.getDefaultImport();if(r===void 0)return;const n=r.getSymbol();return(n?.getAliasedSymbol()??n)?.getDeclarations().includes(t)===!0?"default":void 0},J=(e,t,r)=>{if(!$(e,r))return;const n=e.getModuleSpecifierSourceFile(),s=n===void 0?void 0:X(n,r);return(s?.getAliasedSymbol()??s)?.getDeclarations().includes(t)===!0?r:void 0},z=/^\.\.?(?:$|\/)/u,Q=new Map([[".cjs",".cjs"],[".cts",".cjs"],[".d.ts",".js"],[".js",".js"],[".jsx",".jsx"],[".mjs",".mjs"],[".mts",".mjs"],[".ts",".js"],[".tsx",".js"]]),Z=(e,t)=>{const r=t.getModuleSpecifierValue();if(!z.test(r))return;const n=t.getModuleSpecifierSourceFile(),s=n===void 0?void 0:Q.get(n.getExtension());if(n===void 0||s===void 0)return;const o=`${h.join(n.getDirectoryPath(),n.getBaseNameWithoutExtension())}${s}`,i=h.relative(e.getDirectoryPath(),o);return i.startsWith(".")?i:`./${i}`},ee=(e,t,r)=>{const n=N(t);for(const s of e.getImportDeclarations()){const o=n===void 0?Y(s,t)??J(s,t,r):H(s,n,r);if(o!==void 0)return{exportName:o,specifier:Z(e,s)??s.getModuleSpecifierValue()}}},te=(e,t)=>Object.keys(t.getProject().getCompilerOptions().paths??{}).some(r=>{const n=r.indexOf("*");return n===-1?e===r:e.startsWith(r.slice(0,n))&&e.endsWith(r.slice(n+1))}),f={kind:"verbatim"},p={kind:"expand"},re=new Set([g.ClassDeclaration,g.EnumDeclaration,g.EnumMember,g.InterfaceDeclaration,g.TypeAliasDeclaration]),ne=e=>N(e)!==void 0||l.isExportable(e)&&e.isExported(),se=(e,t)=>new RegExp(String.raw`(?<![$\w])${t.replaceAll(/[$()*+.?[\\\]^{|}]/gu,String.raw`\$&`)}(?![$\w])`,"u").test(e),C=(e,t,r,n)=>{const s=e.getSourceFile();if(s.getSymbol()===void 0&&N(e)===void 0||!re.has(e.getKind()))return f;const o=s.getFilePath();if(o.includes(W))return f;if(o===r)return p;const i=l.isEnumMember(e)?e.getParent():e;if(!l.hasName(i))return p;const a=ee(t.getSourceFile(),i,i.getName());return a===void 0?ne(i)||!se(n(),i.getName())?f:p:te(a.specifier,t)?p:{kind:"qualify",qualified:a}},oe=new Set([g.ClassDeclaration,g.EnumDeclaration,g.FunctionDeclaration,g.ModuleDeclaration]),M=e=>{const t=e?.getDeclarations()??[];return t.length>0&&t.every(r=>r.getSourceFile().getSymbol()===void 0)},ie=e=>{for(const t of e.getDeclarations()){const r=t.getFirstChildByKind(g.ComputedPropertyName);if(r!==void 0){let n=r.getExpression();for(;l.isPropertyAccessExpression(n);)n=n.getExpression();return n}}},ae=(e,t)=>{if(e.getProperties().some(s=>{if(!s.getName().startsWith("__@"))return!1;const o=ie(s);return o===void 0||!M(o.getSymbol())}))return!0;const n=e.getSymbol();return n!==void 0&&n.getDeclarations().some(s=>oe.has(s.getKind()))&&!M(n)&&t().startsWith("typeof ")},k=(e,t,r)=>{const n=e.getAliasSymbol(),s=e.getSymbol(),o=new Set((n??s)?.getDeclarations());let i=!1,a;const c=()=>(a??=e.getText(t),a);for(const u of[s,n].flatMap(d=>d?.getDeclarations()??[])){const d=C(u,t,r,c);if(d.kind==="qualify"&&o.has(u))return d;i||=d.kind!=="verbatim"}return i||ae(e,c)?p:f},ce=(e,t,r)=>{const n=l.isPropertySignature(e)||l.isPropertyDeclaration(e)?e.getTypeNode():void 0;if(n===void 0)return f;let s=!1;for(const o of[n,...n.getDescendantsOfKind(g.TypeReference)].filter(i=>l.isTypeReference(i))){const i=o.getTypeName().getSymbol();for(const a of(i?.getAliasedSymbol()??i)?.getDeclarations()??[]){const c=C(a,t,r,()=>o.getText());if(c.kind==="qualify")return c;s||=c.kind!=="verbatim"}}return s?p:f},ue=/^[A-Za-z_$][\w$]*$/u,le=e=>ue.test(e)?e:JSON.stringify(e),O=e=>{const t=[...e.getTypeArguments()];return e.isUnion()&&t.push(...e.getUnionTypes()),e.isIntersection()&&t.push(...e.getIntersectionTypes()),t},A=e=>!e.isObject()||e.isArray()||e.isTuple()||e.getCallSignatures().length>0||e.getConstructSignatures().length>0?!1:e.getStringIndexType()===void 0&&e.getNumberIndexType()===void 0&&!e.getProperties().some(t=>t.getName().startsWith("__@")),T=(e,t,r,n=new Set)=>n.has(e)?!1:(n.add(e),k(e,t,r).kind!=="verbatim"||O(e).some(s=>T(s,t,r,n))?!0:A(e)?e.getProperties().some(s=>s.getDeclarations().some(o=>ce(o,t,r).kind!=="verbatim")?!0:T(s.getTypeAtLocation(t),t,r,n)):!1),ge=(e,t)=>{const r=e.getValueDeclaration()??e.getDeclarations()[0];return r&&(l.isPropertySignature(r)||l.isPropertyDeclaration(r))&&r.hasQuestionToken()?!0:t.isUnion()&&t.getUnionTypes().some(n=>n.isUndefined())},L=(e,t)=>e!==void 0&&(A(e)||e.isString()||e.isNumber()||e.isBigInt()||e.isBoolean()||e.isLiteral()||e.isBooleanLiteral()||e.isEnumLiteral()||e.isTemplateLiteral()||e.isNull()||e.isUndefined()||e.isAny()||e.isUnknown()||e.isNever()||e.isVoid())?t:`(${t})`,de=32,fe=8,me=(e,t,r,n,s,o)=>{const i=e.getArrayElementType(),a=i?o(i,t,r,n,s):void 0;if(a!==void 0)return`${L(i,a)}[]`},pe=(e,t,r,n,s,o)=>{const i=[];for(const a of e.getUnionTypes()){const c=o(a,t,r,n,s);if(c===void 0)return;i.push(c)}return i.join(" | ")},Se=(e,t,r,n,s,o)=>{const i=[];for(const a of e.getIntersectionTypes()){const c=o(a,t,r,n,s);if(c===void 0)return;i.push(L(a,c))}return i.join(" & ")},ve=(e,t,r,n,s,o)=>{if(!A(e))return;const i=[];for(const a of e.getProperties()){const c=a.getTypeAtLocation(t),u=ge(a,c),d=u&&c.isUnion()?c.getUnionTypes().filter(x=>!x.isUndefined()):[c],D=[];for(const x of d){const I=o(x,t,r,n+1,s);if(I===void 0)return;D.push(I)}i.push(`${le(a.getName())}${u?"?":""}: ${D.join(" | ")}`)}return i.length>0?`{ ${i.join("; ")} }`:"{}"},Ee=e=>{const t=e.getLiteralValue();return typeof t=="string"?JSON.stringify(t):typeof t=="number"?String(t):void 0},be=e=>[e.getSymbol(),e.getAliasSymbol()].flatMap(t=>t?.getDeclarations()??[]).some(t=>l.isClassDeclaration(t)||l.isClassExpression(t)),b=(e,t,r,n,s=new Set)=>{if(n.has(e)||s.has(e))return!1;if(r>de)return!0;const o=new Set(n).add(e);if(O(e).some(u=>b(u,t,r+1,o,s)))return!0;const i=e.getArrayElementType();if(i!==void 0)return b(i,t,r+1,o,s);if(q(e))return s.add(e),!1;if(e.getCallSignatures().length>0||e.getConstructSignatures().length>0||[e.getSymbol(),e.getAliasSymbol()].flatMap(u=>u?.getDeclarations()??[]).some(u=>l.isClassDeclaration(u)||l.isClassExpression(u)))return!0;const c=A(e)&&e.getProperties().some(u=>b(u.getTypeAtLocation(t),t,r+1,o,s));return c||s.add(e),c},ye=(e,t,r,n,s,o,i)=>{const a=[];for(const c of t.getAliasSymbol()===void 0?t.getTypeArguments():t.getAliasTypeArguments()){const u=i(c,r,n,s+1,o);if(u===void 0)return;a.push(u)}return`import("${e.specifier}").${e.exportName}${a.length>0?`<${a.join(", ")}>`:""}`},Te=e=>[e.getSymbol(),e.getAliasSymbol()].flatMap(t=>t?.getDeclarations()??[]).some(t=>l.isEnumDeclaration(t)||l.isEnumMember(t)),m=(e,t,r,n,s)=>{if(n>fe||s.has(e))return;const o=k(e,t,r);if(o.kind==="verbatim"&&!T(e,t,r))return e.getText(t);const i=new Set(s).add(e);if(!be(e)){if(e.isEnumLiteral())return Ee(e);if(o.kind==="qualify"&&!Te(e)){const a=ye(o.qualified,e,t,r,n,i,m);if(a!==void 0)return a}return e.isArray()?me(e,t,r,n,i,m):e.isUnion()?pe(e,t,r,n,i,m):e.isIntersection()?Se(e,t,r,n,i,m):ve(e,t,r,n,i,m)}},_=new WeakMap,Ae=e=>{const t=_.get(e);if(t)return t;const r=e.getPreEmitDiagnostics().filter(n=>n.getCategory()===j.Error);return _.set(e,r),r},y=e=>{const t=e.getMessageText();return typeof t=="string"?t:t.getMessageText()},xe=/is of type 'unknown'|on type '\{\}'/,Ne=e=>xe.test(e),De=/has no exported member '([^']+)'/,Ie=(e,t,r,n)=>{const s=e.getSourceFile();for(const o of e.getDescendantsOfKind(g.Identifier))for(const i of o.getSymbol()?.getDeclarations()??[]){const a=i.getStart();if(i.getSourceFile()!==s||a>=r&&a<=n)continue;const c=t.find(u=>{const d=u.getStart();return d!==void 0&&d>=i.getStart()&&d<=i.getEnd()});if(c!==void 0)return y(c)}},R=e=>{const t=e.getStart(),r=e.getEnd(),n=Ae(e.getSourceFile()),s=n.find(c=>{const u=c.getStart();return u!==void 0&&u>=t&&u<=r});if(s===void 0){const c=Ie(e,n,t,r);return c===void 0?void 0:{derivative:!0,message:c}}const o=y(s);if(!Ne(o))return{derivative:!1,message:o};const i=new Set(e.getDescendantsOfKind(g.Identifier).map(c=>c.getText())),a=n.find(c=>{const u=De.exec(y(c))?.[1];return u!==void 0&&i.has(u)});return{derivative:!0,message:a?`${o}; caused by: ${y(a)}`:o}},Oe=e=>{const t=e.getType().getCallSignatures()[0];if(!t)return"unknown";let r=t.getReturnType();const s=(r.getSymbol()??r.getAliasSymbol())?.getName();if(s==="Promise"||s==="AsyncIterable"||s==="AsyncIterableIterator"||s==="AsyncGenerator"){const a=r.getTypeArguments()[0];a&&(r=a)}const o=r.getText(e);if(!o||o==="any"||o==="never"||o==="unknown"){const a=R(e);return a!==void 0&&(o!=="unknown"||a.derivative)&&E(e,`${o||"any"} (${a.message})`),"unknown"}if(V(o)){const a=R(e);return a!==void 0&&E(e,`${o} (${a.message})`),"unknown"}if(b(r,e,0,new Set))return"unknown";const i=e.getSourceFile().getFilePath();if(T(r,e,i)){const a=m(r,e,i,0,new Set);return a===void 0&&E(e,o),a??"unknown"}return o};export{T as a,$e as b,_e as c,ke as d,m as e,V as i,Ce as p,Re as r,Oe as u};
|
|
1
|
+
import{Node as l,SyntaxKind as g,DiagnosticCategory as j}from"ts-morph";import{lunoraRelativePath as P}from"./isTestPath-B81lOULB.mjs";import{posix as h}from"node:path";let S,v;const _e=e=>{const t=S,r=[];S=r;try{return{erased:r,value:e()}}finally{S=t}},Re=e=>{S?.push(...e)},U=e=>{for(const t of e.getAncestors())if(l.isVariableDeclaration(t))return t.getName()},E=(e,t)=>{S?.push({exportName:U(e),filePath:e.getSourceFile().getFilePath(),line:e.getStartLineNumber(),rendered:t})},$e=e=>{v!==void 0&&E(v,e)},Ce=(e,t)=>{const r=v;v=e;try{return t()}finally{v=r}},K=(e,t)=>{const r=e.exportName??`line ${e.line.toString()}`;return{cacheKey:`procedure_return_type_erased:${t}:${r}`,categories:["SCHEMA"],description:"Codegen renders a procedure's return type into `_generated/`, where only names that resolve from that directory may appear. A type it can neither name nor reproduce structurally — a class instance, a call or index signature, a recursive or very deeply nested shape — is emitted as `unknown` instead, so callers lose the shape while the runtime still returns it.",detail:`\`${r}\` in \`${t}\` (line ${e.line.toString()}) returns \`${e.rendered}\`, which codegen could not reproduce — its generated type is \`unknown\`.`,facing:"INTERNAL",level:"WARN",metadata:{exportName:e.exportName,filePath:t,line:e.line,rendered:e.rendered},name:"procedure_return_type_erased",remediation:"Declare the shape explicitly with `.output(...)`, or export the type from the module that declares it so codegen can name it. A class instance cannot cross the wire at all — return a plain object.",title:"Procedure return type is missing from the generated type"}},ke=(e,t)=>{const r=new Map;for(const n of e){const s=K(n,P(t,n.filePath));r.set(s.cacheKey,s)}return[...r.values()].toSorted((n,s)=>n.cacheKey.localeCompare(s.cacheKey))},F=/\bany\b(?!\s*(?:\?\s*)?:)/u,B=/"(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*'|`(?:[^`\\]|\\.)*`/gu,V=e=>F.test(e.replaceAll(B,"")),W="/_generated/",q=e=>{const t=[e.getSymbol(),e.getAliasSymbol()].flatMap(r=>r?.getDeclarations()??[]);return t.length>0&&t.every(r=>r.getSourceFile().getSymbol()===void 0)},G=/^(?<quote>["'])(?<specifier>.*)\k<quote>$/su,N=e=>{for(const t of e.getAncestors())if(l.isModuleDeclaration(t)){const r=G.exec(t.getName());if(r?.groups?.specifier!==void 0)return r.groups.specifier}},w=new WeakMap,X=(e,t)=>{const r=e.getSymbol();if(r===void 0)return;let n=w.get(r.compilerSymbol);return n===void 0&&(n=new Map,w.set(r.compilerSymbol,n)),n.has(t)||n.set(t,r.getExport(t)??e.getExportSymbols().find(s=>s.getName()===t)),n.get(t)},$=(e,t)=>e.getNamespaceImport()!==void 0||e.getNamedImports().some(r=>r.getName()===t),H=(e,t,r)=>e.getModuleSpecifierValue()===t&&$(e,r)?r:void 0,Y=(e,t)=>{const r=e.getDefaultImport();if(r===void 0)return;const n=r.getSymbol();return(n?.getAliasedSymbol()??n)?.getDeclarations().includes(t)===!0?"default":void 0},J=(e,t,r)=>{if(!$(e,r))return;const n=e.getModuleSpecifierSourceFile(),s=n===void 0?void 0:X(n,r);return(s?.getAliasedSymbol()??s)?.getDeclarations().includes(t)===!0?r:void 0},z=/^\.\.?(?:$|\/)/u,Q=new Map([[".cjs",".cjs"],[".cts",".cjs"],[".d.ts",".js"],[".js",".js"],[".jsx",".jsx"],[".mjs",".mjs"],[".mts",".mjs"],[".ts",".js"],[".tsx",".js"]]),Z=(e,t)=>{const r=t.getModuleSpecifierValue();if(!z.test(r))return;const n=t.getModuleSpecifierSourceFile(),s=n===void 0?void 0:Q.get(n.getExtension());if(n===void 0||s===void 0)return;const o=`${h.join(n.getDirectoryPath(),n.getBaseNameWithoutExtension())}${s}`,i=h.relative(e.getDirectoryPath(),o);return i.startsWith(".")?i:`./${i}`},ee=(e,t,r)=>{const n=N(t);for(const s of e.getImportDeclarations()){const o=n===void 0?Y(s,t)??J(s,t,r):H(s,n,r);if(o!==void 0)return{exportName:o,specifier:Z(e,s)??s.getModuleSpecifierValue()}}},te=(e,t)=>Object.keys(t.getProject().getCompilerOptions().paths??{}).some(r=>{const n=r.indexOf("*");return n===-1?e===r:e.startsWith(r.slice(0,n))&&e.endsWith(r.slice(n+1))}),f={kind:"verbatim"},p={kind:"expand"},re=new Set([g.ClassDeclaration,g.EnumDeclaration,g.EnumMember,g.InterfaceDeclaration,g.TypeAliasDeclaration]),ne=e=>N(e)!==void 0||l.isExportable(e)&&e.isExported(),se=(e,t)=>new RegExp(String.raw`(?<![$\w])${t.replaceAll(/[$()*+.?[\\\]^{|}]/gu,String.raw`\$&`)}(?![$\w])`,"u").test(e),C=(e,t,r,n)=>{const s=e.getSourceFile();if(s.getSymbol()===void 0&&N(e)===void 0||!re.has(e.getKind()))return f;const o=s.getFilePath();if(o.includes(W))return f;if(o===r)return p;const i=l.isEnumMember(e)?e.getParent():e;if(!l.hasName(i))return p;const a=ee(t.getSourceFile(),i,i.getName());return a===void 0?ne(i)||!se(n(),i.getName())?f:p:te(a.specifier,t)?p:{kind:"qualify",qualified:a}},oe=new Set([g.ClassDeclaration,g.EnumDeclaration,g.FunctionDeclaration,g.ModuleDeclaration]),M=e=>{const t=e?.getDeclarations()??[];return t.length>0&&t.every(r=>r.getSourceFile().getSymbol()===void 0)},ie=e=>{for(const t of e.getDeclarations()){const r=t.getFirstChildByKind(g.ComputedPropertyName);if(r!==void 0){let n=r.getExpression();for(;l.isPropertyAccessExpression(n);)n=n.getExpression();return n}}},ae=(e,t)=>{if(e.getProperties().some(s=>{if(!s.getName().startsWith("__@"))return!1;const o=ie(s);return o===void 0||!M(o.getSymbol())}))return!0;const n=e.getSymbol();return n!==void 0&&n.getDeclarations().some(s=>oe.has(s.getKind()))&&!M(n)&&t().startsWith("typeof ")},k=(e,t,r)=>{const n=e.getAliasSymbol(),s=e.getSymbol(),o=new Set((n??s)?.getDeclarations());let i=!1,a;const c=()=>(a??=e.getText(t),a);for(const u of[s,n].flatMap(d=>d?.getDeclarations()??[])){const d=C(u,t,r,c);if(d.kind==="qualify"&&o.has(u))return d;i||=d.kind!=="verbatim"}return i||ae(e,c)?p:f},ce=(e,t,r)=>{const n=l.isPropertySignature(e)||l.isPropertyDeclaration(e)?e.getTypeNode():void 0;if(n===void 0)return f;let s=!1;for(const o of[n,...n.getDescendantsOfKind(g.TypeReference)].filter(i=>l.isTypeReference(i))){const i=o.getTypeName().getSymbol();for(const a of(i?.getAliasedSymbol()??i)?.getDeclarations()??[]){const c=C(a,t,r,()=>o.getText());if(c.kind==="qualify")return c;s||=c.kind!=="verbatim"}}return s?p:f},ue=/^[A-Za-z_$][\w$]*$/u,le=e=>ue.test(e)?e:JSON.stringify(e),O=e=>{const t=[...e.getTypeArguments()];return e.isUnion()&&t.push(...e.getUnionTypes()),e.isIntersection()&&t.push(...e.getIntersectionTypes()),t},A=e=>!e.isObject()||e.isArray()||e.isTuple()||e.getCallSignatures().length>0||e.getConstructSignatures().length>0?!1:e.getStringIndexType()===void 0&&e.getNumberIndexType()===void 0&&!e.getProperties().some(t=>t.getName().startsWith("__@")),T=(e,t,r,n=new Set)=>n.has(e)?!1:(n.add(e),k(e,t,r).kind!=="verbatim"||O(e).some(s=>T(s,t,r,n))?!0:A(e)?e.getProperties().some(s=>s.getDeclarations().some(o=>ce(o,t,r).kind!=="verbatim")?!0:T(s.getTypeAtLocation(t),t,r,n)):!1),ge=(e,t)=>{const r=e.getValueDeclaration()??e.getDeclarations()[0];return r&&(l.isPropertySignature(r)||l.isPropertyDeclaration(r))&&r.hasQuestionToken()?!0:t.isUnion()&&t.getUnionTypes().some(n=>n.isUndefined())},L=(e,t)=>e!==void 0&&(A(e)||e.isString()||e.isNumber()||e.isBigInt()||e.isBoolean()||e.isLiteral()||e.isBooleanLiteral()||e.isEnumLiteral()||e.isTemplateLiteral()||e.isNull()||e.isUndefined()||e.isAny()||e.isUnknown()||e.isNever()||e.isVoid())?t:`(${t})`,de=32,fe=8,me=(e,t,r,n,s,o)=>{const i=e.getArrayElementType(),a=i?o(i,t,r,n,s):void 0;if(a!==void 0)return`${L(i,a)}[]`},pe=(e,t,r,n,s,o)=>{const i=[];for(const a of e.getUnionTypes()){const c=o(a,t,r,n,s);if(c===void 0)return;i.push(c)}return i.join(" | ")},Se=(e,t,r,n,s,o)=>{const i=[];for(const a of e.getIntersectionTypes()){const c=o(a,t,r,n,s);if(c===void 0)return;i.push(L(a,c))}return i.join(" & ")},ve=(e,t,r,n,s,o)=>{if(!A(e))return;const i=[];for(const a of e.getProperties()){const c=a.getTypeAtLocation(t),u=ge(a,c),d=u&&c.isUnion()?c.getUnionTypes().filter(x=>!x.isUndefined()):[c],D=[];for(const x of d){const I=o(x,t,r,n+1,s);if(I===void 0)return;D.push(I)}i.push(`${le(a.getName())}${u?"?":""}: ${D.join(" | ")}`)}return i.length>0?`{ ${i.join("; ")} }`:"{}"},Ee=e=>{const t=e.getLiteralValue();return typeof t=="string"?JSON.stringify(t):typeof t=="number"?String(t):void 0},be=e=>[e.getSymbol(),e.getAliasSymbol()].flatMap(t=>t?.getDeclarations()??[]).some(t=>l.isClassDeclaration(t)||l.isClassExpression(t)),b=(e,t,r,n,s=new Set)=>{if(n.has(e)||s.has(e))return!1;if(r>de)return!0;const o=new Set(n).add(e);if(O(e).some(u=>b(u,t,r+1,o,s)))return!0;const i=e.getArrayElementType();if(i!==void 0)return b(i,t,r+1,o,s);if(q(e))return s.add(e),!1;if(e.getCallSignatures().length>0||e.getConstructSignatures().length>0||[e.getSymbol(),e.getAliasSymbol()].flatMap(u=>u?.getDeclarations()??[]).some(u=>l.isClassDeclaration(u)||l.isClassExpression(u)))return!0;const c=A(e)&&e.getProperties().some(u=>b(u.getTypeAtLocation(t),t,r+1,o,s));return c||s.add(e),c},ye=(e,t,r,n,s,o,i)=>{const a=[];for(const c of t.getAliasSymbol()===void 0?t.getTypeArguments():t.getAliasTypeArguments()){const u=i(c,r,n,s+1,o);if(u===void 0)return;a.push(u)}return`import("${e.specifier}").${e.exportName}${a.length>0?`<${a.join(", ")}>`:""}`},Te=e=>[e.getSymbol(),e.getAliasSymbol()].flatMap(t=>t?.getDeclarations()??[]).some(t=>l.isEnumDeclaration(t)||l.isEnumMember(t)),m=(e,t,r,n,s)=>{if(n>fe||s.has(e))return;const o=k(e,t,r);if(o.kind==="verbatim"&&!T(e,t,r))return e.getText(t);const i=new Set(s).add(e);if(!be(e)){if(e.isEnumLiteral())return Ee(e);if(o.kind==="qualify"&&!Te(e)){const a=ye(o.qualified,e,t,r,n,i,m);if(a!==void 0)return a}return e.isArray()?me(e,t,r,n,i,m):e.isUnion()?pe(e,t,r,n,i,m):e.isIntersection()?Se(e,t,r,n,i,m):ve(e,t,r,n,i,m)}},_=new WeakMap,Ae=e=>{const t=_.get(e);if(t)return t;const r=e.getPreEmitDiagnostics().filter(n=>n.getCategory()===j.Error);return _.set(e,r),r},y=e=>{const t=e.getMessageText();return typeof t=="string"?t:t.getMessageText()},xe=/is of type 'unknown'|on type '\{\}'/,Ne=e=>xe.test(e),De=/has no exported member '([^']+)'/,Ie=(e,t,r,n)=>{const s=e.getSourceFile();for(const o of e.getDescendantsOfKind(g.Identifier))for(const i of o.getSymbol()?.getDeclarations()??[]){const a=i.getStart();if(i.getSourceFile()!==s||a>=r&&a<=n)continue;const c=t.find(u=>{const d=u.getStart();return d!==void 0&&d>=i.getStart()&&d<=i.getEnd()});if(c!==void 0)return y(c)}},R=e=>{const t=e.getStart(),r=e.getEnd(),n=Ae(e.getSourceFile()),s=n.find(c=>{const u=c.getStart();return u!==void 0&&u>=t&&u<=r});if(s===void 0){const c=Ie(e,n,t,r);return c===void 0?void 0:{derivative:!0,message:c}}const o=y(s);if(!Ne(o))return{derivative:!1,message:o};const i=new Set(e.getDescendantsOfKind(g.Identifier).map(c=>c.getText())),a=n.find(c=>{const u=De.exec(y(c))?.[1];return u!==void 0&&i.has(u)});return{derivative:!0,message:a?`${o}; caused by: ${y(a)}`:o}},Oe=e=>{const t=e.getType().getCallSignatures()[0];if(!t)return"unknown";let r=t.getReturnType();const s=(r.getSymbol()??r.getAliasSymbol())?.getName();if(s==="Promise"||s==="AsyncIterable"||s==="AsyncIterableIterator"||s==="AsyncGenerator"){const a=r.getTypeArguments()[0];a&&(r=a)}const o=r.getText(e);if(!o||o==="any"||o==="never"||o==="unknown"){const a=R(e);return a!==void 0&&(o!=="unknown"||a.derivative)&&E(e,`${o||"any"} (${a.message})`),"unknown"}if(V(o)){const a=R(e);return a!==void 0&&E(e,`${o} (${a.message})`),"unknown"}if(b(r,e,0,new Set))return"unknown";const i=e.getSourceFile().getFilePath();if(T(r,e,i)){const a=m(r,e,i,0,new Set);return a===void 0&&E(e,o),a??"unknown"}return o};export{T as a,$e as b,_e as c,ke as d,m as e,V as i,Ce as p,Re as r,Oe as u};
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{w as a}from"./classify-procedure-call-C9lQCjso.mjs";const l=s=>a(s,"use","rls");export{l as r};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{d as o}from"./context-property-calls-mJoBjbyp.mjs";const t=(r,e)=>o(r,e,"sql");export{t as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import"./isTestPath-CiIyKqhF.mjs";import"./attribution-0YtR4LvZ.mjs";import"./database-calls-DyOLz_lK.mjs";import"./classify-procedure-call-C9lQCjso.mjs";import{d as a}from"./index-DbaVBeCK.mjs";export{a as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{d as r}from"./context-property-calls-mJoBjbyp.mjs";const t=(s,o)=>r(s,o,"r2sql");export{t as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{statSync as x,readFileSync as y}from"node:fs";import{basename as P}from"node:path";import{createJiti as S}from"jiti";import{Node as i,Project as E}from"ts-morph";import{findProjectConfigFile as v}from"./PROJECT_CONFIG_FILENAMES-DzOu-lSc.mjs";const j=t=>{if(i.isStringLiteral(t)||i.isNoSubstitutionTemplateLiteral(t)||i.isNumericLiteral(t))return t.getLiteralText();if(i.isComputedPropertyName(t)){const r=t.getExpression();return i.isStringLiteral(r)||i.isNoSubstitutionTemplateLiteral(r)?r.getLiteralText():void 0}return t.getText()},h=t=>j(t)??t.getText(),d=t=>h(t.getNameNode()),m=new Map,J=async t=>{const r=v(t);if(r===void 0)return{};let e;try{const a=x(r);e=`${String(a.mtimeMs)}:${String(a.size)}`}catch{return{}}const s=m.get(r);if(s?.key===e)return s.value;const n=(async()=>{try{const l=(await S(r,{interopDefault:!1,moduleCache:!1}).import(r))?.default;return{config:l!==null&&typeof l=="object"?l:void 0}}catch(a){return{error:a instanceof Error?a.message:String(a)}}})();return m.set(r,{key:e,value:n}),n},O=t=>{let e=t.getExportAssignments().find(s=>!s.isExportEquals())?.getExpression();for(;e!==void 0&&(i.isSatisfiesExpression(e)||i.isAsExpression(e)||i.isParenthesizedExpression(e));)e=e.getExpression();if(e!==void 0&&i.isIdentifier(e))for(e=t.getVariableDeclaration(e.getText())?.getInitializer();e!==void 0&&(i.isSatisfiesExpression(e)||i.isAsExpression(e));)e=e.getExpression();return e!==void 0&&i.isObjectLiteralExpression(e)?e:void 0},c=(t,r)=>i.isPropertyAssignment(t)?t.getInitializer():r.getVariableDeclaration(d(t))?.getInitializer(),g=t=>{let r=t;for(;r!==void 0&&(i.isSatisfiesExpression(r)||i.isAsExpression(r)||i.isParenthesizedExpression(r));)r=r.getExpression();return r},b=(t,r,e)=>{const s=g(t);if(s===void 0||!i.isObjectLiteralExpression(s))return{unreadable:!0};const n=s.getProperties(),a=n.filter(u=>i.isPropertyAssignment(u)&&!i.isComputedPropertyName(u.getNameNode())||i.isShorthandPropertyAssignment(u));if(a.length!==n.length)return{unreadable:!0};const l=a.find(u=>d(u)===e);if(l===void 0)return{absent:!0};const o=c(l,r);return o===void 0?{unreadable:!0}:{literal:o}},A=(t,r)=>{const e=b(t,r,"minSeverity");return"absent"in e?{advisor:{}}:"literal"in e&&i.isStringLiteral(e.literal)?{advisor:{minSeverity:e.literal.getLiteralValue()}}:{advisor:{unreadable:!0}}},N=(t,r)=>{const e=b(t,r,"exclude");if("absent"in e)return{codegen:{}};if(!("literal"in e)||!i.isArrayLiteralExpression(e.literal))return{codegen:{unreadable:!0}};const s=[];for(const n of e.literal.getElements()){if(!i.isStringLiteral(n)&&!i.isNoSubstitutionTemplateLiteral(n)||n.getLiteralValue().startsWith("!"))return{codegen:{unreadable:!0}};s.push(n.getLiteralValue())}return{codegen:{exclude:s}}},T=(t,r)=>{const e=b(t,r,"merge");return"absent"in e?{durableObjects:{}}:"literal"in e&&(i.isTrueLiteral(e.literal)||i.isFalseLiteral(e.literal))?{durableObjects:{merge:e.literal.getLiteralValue()}}:{durableObjects:{unreadable:!0}}},w=new Map([["advisor",{advisor:{unreadable:!0}}],["codegen",{codegen:{unreadable:!0}}],["durableObjects",{durableObjects:{unreadable:!0}}],["remote",{unreadable:!0}],["target",{unreadable:!0}]]),L=(t,r)=>{const e=t.getProperty(r);if(e!==void 0)return(i.isPropertyAssignment(e)?e.getInitializer():void 0)??"unreadable"},p=(t,r)=>{const e=L(t,r);if(e!==void 0)return e!=="unreadable"&&(i.isStringLiteral(e)||i.isNoSubstitutionTemplateLiteral(e))?e.getLiteralValue():!1},z=t=>{const r=L(t,"rpc");if(r!==void 0)return r!=="unreadable"&&i.isFalseLiteral(r)?!1:"unreadable"},C=t=>{const r=g(t);if(r===void 0||!i.isObjectLiteralExpression(r))return{services:{unreadable:!0}};const e={};for(const s of r.getProperties()){if(!i.isPropertyAssignment(s)||i.isComputedPropertyName(s.getNameNode()))return{services:{unreadable:!0}};const n=g(s.getInitializer());if(n===void 0||!i.isObjectLiteralExpression(n)||n.getProperties().some(u=>!i.isPropertyAssignment(u)))return{services:{unreadable:!0}};const a=p(n,"dir"),l=p(n,"entrypoint"),o=z(n);if(typeof a!="string"||l===!1||o==="unreadable")return{services:{unreadable:!0}};e[d(s)]={dir:a,...l===void 0?{}:{entrypoint:l},...o===void 0?{}:{rpc:o}}}return{services:{declared:e}}},D=(t,r)=>{if(i.isGetAccessorDeclaration(t)||i.isMethodDeclaration(t))return w.get(d(t))??{};if(!i.isPropertyAssignment(t)&&!i.isShorthandPropertyAssignment(t))return{};const e=d(t);if(e==="advisor")return A(c(t,r),r);if(e==="services")return C(c(t,r));if(e==="codegen")return N(c(t,r),r);if(e==="durableObjects")return T(c(t,r),r);if(e!=="target"&&e!=="remote")return{};const s=c(t,r);return s===void 0?{unreadable:!0}:e==="target"?i.isStringLiteral(s)?{target:s.getLiteralValue()}:{unreadable:!0}:i.isTrueLiteral(s)||i.isFalseLiteral(s)?{remote:s.getLiteralValue()}:i.isObjectLiteralExpression(s)?{remote:!0}:{unreadable:!0}},M=t=>{const r=v(t);if(r===void 0)return{};let e;try{e=y(r,"utf8")}catch{return{unreadable:!0}}const n=new E({compilerOptions:{allowJs:!0},skipFileDependencyResolution:!0,skipLoadingLibFiles:!0,useInMemoryFileSystem:!0}).createSourceFile(P(r),e,{overwrite:!0}),a=O(n);if(a===void 0)return{unreadable:!0};if(a.getProperties().some(o=>i.isSpreadAssignment(o))){const o=u=>a.getProperties().some(f=>!i.isSpreadAssignment(f)&&d(f)===u);return{...o("advisor")?{advisor:{unreadable:!0}}:{},...o("codegen")?{codegen:{unreadable:!0}}:{},...o("durableObjects")?{durableObjects:{unreadable:!0}}:{},...o("services")?{services:{unreadable:!0}}:{},unreadable:!0}}let l={};for(const o of a.getProperties())l={...l,...D(o,n)};return l},$=t=>{const{durableObjects:r}=M(t);return r?.unreadable&&console.warn("@lunora/codegen: `durableObjects.merge` in lunora.config is not a boolean literal — the Durable Object classes stay separate."),r?.merge===!0};export{d as a,$ as b,J as l,h as p,M as r,j as s};
|