@lunora/codegen 1.0.0-alpha.106 → 1.0.0-alpha.107
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 +23 -7
- package/dist/index.d.ts +23 -7
- package/dist/index.mjs +1 -1
- package/dist/packem_shared/{SCHEMA_SNAPSHOT_FILENAME-CXtgvIcd.mjs → SCHEMA_SNAPSHOT_FILENAME-DlCvMk66.mjs} +1 -1
- package/dist/packem_shared/discover-queries-CU9o_j87.mjs +1 -0
- package/dist/packem_shared/discoverQueries-CIU5dc0u.mjs +1 -0
- package/package.json +2 -2
- package/dist/packem_shared/discover-queries-i4Vd2si7.mjs +0 -1
- package/dist/packem_shared/discoverQueries-uFtLDmn_.mjs +0 -1
package/dist/index.d.mts
CHANGED
|
@@ -817,9 +817,10 @@ interface WorkflowCallIR {
|
|
|
817
817
|
}
|
|
818
818
|
/**
|
|
819
819
|
* A `ctx.db.query("table")…` read discovered in a function body, reduced to what
|
|
820
|
-
* the
|
|
821
|
-
*
|
|
822
|
-
* `query(...)` argument is not a string literal (a
|
|
820
|
+
* the query advisor lints need: which table, whether the chain narrows with an
|
|
821
|
+
* index, whether it filters, and which terminal materializes the result.
|
|
822
|
+
* `table` is `""` when the `query(...)` argument is not a string literal (a
|
|
823
|
+
* dynamic table — not lintable).
|
|
823
824
|
*/
|
|
824
825
|
interface QueryReadIR {
|
|
825
826
|
/** Exported procedure the read sits in, or `""` at module scope. */
|
|
@@ -841,6 +842,18 @@ interface QueryReadIR {
|
|
|
841
842
|
line: number;
|
|
842
843
|
/** Queried table name, or `""` when the argument is not a string literal. */
|
|
843
844
|
table: string;
|
|
845
|
+
/**
|
|
846
|
+
* The materializing call the chain ends in — `"collect"`, `"take"`,
|
|
847
|
+
* `"paginate"`, `"first"`, `"unique"`, … — i.e. how much of the narrowed set
|
|
848
|
+
* the read actually loads.
|
|
849
|
+
*
|
|
850
|
+
* `undefined` when the chain reaches no recognised terminal (a reader passed
|
|
851
|
+
* on, a bare `query(...)`) AND when a feeder predating this field produced
|
|
852
|
+
* the read. The two are deliberately not distinguished: no consumer could act
|
|
853
|
+
* on the difference, so the terminal-shaped lints skip the read either way
|
|
854
|
+
* rather than guessing a terminal.
|
|
855
|
+
*/
|
|
856
|
+
terminal?: string;
|
|
844
857
|
}
|
|
845
858
|
/**
|
|
846
859
|
* A `ctx.authApi.<method>(...)` call discovered in a function body, attributed
|
|
@@ -2720,10 +2733,13 @@ declare const discoverNotifyConfig: (project: Project, lunoraDirectory: string)
|
|
|
2720
2733
|
*/
|
|
2721
2734
|
declare const readPackageDependencies: (projectRoot: string) => Set<string> | undefined;
|
|
2722
2735
|
/**
|
|
2723
|
-
* Discover `ctx.db.query("table")…`
|
|
2724
|
-
* reduce each to a {@link QueryReadIR}.
|
|
2725
|
-
*
|
|
2726
|
-
*
|
|
2736
|
+
* Discover every `ctx.db.query("table")…` read under the lunora source directory
|
|
2737
|
+
* and reduce each to a {@link QueryReadIR}.
|
|
2738
|
+
*
|
|
2739
|
+
* Reads without a `.filter()` are kept too. They are never
|
|
2740
|
+
* `filter_without_index` candidates (that lint gates on `hasFilter`), but an
|
|
2741
|
+
* unfiltered, unindexed `.collect()` is the read `unbounded_collect` exists for
|
|
2742
|
+
* — and dropping it here is precisely why nothing could see it.
|
|
2727
2743
|
*/
|
|
2728
2744
|
declare const discoverQueries: (project: Project, lunoraDirectory: string) => QueryReadIR[];
|
|
2729
2745
|
/** The only file queues may be declared in — mirrors `lunora/workflows.ts`. */
|
package/dist/index.d.ts
CHANGED
|
@@ -817,9 +817,10 @@ interface WorkflowCallIR {
|
|
|
817
817
|
}
|
|
818
818
|
/**
|
|
819
819
|
* A `ctx.db.query("table")…` read discovered in a function body, reduced to what
|
|
820
|
-
* the
|
|
821
|
-
*
|
|
822
|
-
* `query(...)` argument is not a string literal (a
|
|
820
|
+
* the query advisor lints need: which table, whether the chain narrows with an
|
|
821
|
+
* index, whether it filters, and which terminal materializes the result.
|
|
822
|
+
* `table` is `""` when the `query(...)` argument is not a string literal (a
|
|
823
|
+
* dynamic table — not lintable).
|
|
823
824
|
*/
|
|
824
825
|
interface QueryReadIR {
|
|
825
826
|
/** Exported procedure the read sits in, or `""` at module scope. */
|
|
@@ -841,6 +842,18 @@ interface QueryReadIR {
|
|
|
841
842
|
line: number;
|
|
842
843
|
/** Queried table name, or `""` when the argument is not a string literal. */
|
|
843
844
|
table: string;
|
|
845
|
+
/**
|
|
846
|
+
* The materializing call the chain ends in — `"collect"`, `"take"`,
|
|
847
|
+
* `"paginate"`, `"first"`, `"unique"`, … — i.e. how much of the narrowed set
|
|
848
|
+
* the read actually loads.
|
|
849
|
+
*
|
|
850
|
+
* `undefined` when the chain reaches no recognised terminal (a reader passed
|
|
851
|
+
* on, a bare `query(...)`) AND when a feeder predating this field produced
|
|
852
|
+
* the read. The two are deliberately not distinguished: no consumer could act
|
|
853
|
+
* on the difference, so the terminal-shaped lints skip the read either way
|
|
854
|
+
* rather than guessing a terminal.
|
|
855
|
+
*/
|
|
856
|
+
terminal?: string;
|
|
844
857
|
}
|
|
845
858
|
/**
|
|
846
859
|
* A `ctx.authApi.<method>(...)` call discovered in a function body, attributed
|
|
@@ -2720,10 +2733,13 @@ declare const discoverNotifyConfig: (project: Project, lunoraDirectory: string)
|
|
|
2720
2733
|
*/
|
|
2721
2734
|
declare const readPackageDependencies: (projectRoot: string) => Set<string> | undefined;
|
|
2722
2735
|
/**
|
|
2723
|
-
* Discover `ctx.db.query("table")…`
|
|
2724
|
-
* reduce each to a {@link QueryReadIR}.
|
|
2725
|
-
*
|
|
2726
|
-
*
|
|
2736
|
+
* Discover every `ctx.db.query("table")…` read under the lunora source directory
|
|
2737
|
+
* and reduce each to a {@link QueryReadIR}.
|
|
2738
|
+
*
|
|
2739
|
+
* Reads without a `.filter()` are kept too. They are never
|
|
2740
|
+
* `filter_without_index` candidates (that lint gates on `hasFilter`), but an
|
|
2741
|
+
* unfiltered, unindexed `.collect()` is the read `unbounded_collect` exists for
|
|
2742
|
+
* — and dropping it here is precisely why nothing could see it.
|
|
2727
2743
|
*/
|
|
2728
2744
|
declare const discoverQueries: (project: Project, lunoraDirectory: string) => QueryReadIR[];
|
|
2729
2745
|
/** The only file queues may be declared in — mirrors `lunora/workflows.ts`. */
|
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-CFhF_hmg.mjs";import{formatAdvisories as m,lintSchema as d,toAdvisorContext as p}from"./packem_shared/formatAdvisories-CQvIhQ04.mjs";import{describeErrorLevelFindings as c,errorAdvisoryNames as n,errorPlatformDiagnosticNames as S}from"./packem_shared/describeErrorLevelFindings-IhNx9gPr.mjs";import{CodegenDiagnosticError as E,diagnosticAt as x}from"./packem_shared/CodegenDiagnosticError-DPezpZTz.mjs";import{AGENTS_FILENAME as u,discoverAgents as v}from"./packem_shared/AGENTS_FILENAME-Dk-k250h.mjs";import{default as O}from"./packem_shared/discoverAuthApiCalls-XfNbxqlq.mjs";import{CONTAINERS_FILENAME as g,discoverContainers as M}from"./packem_shared/CONTAINERS_FILENAME-DQpyhY6c.mjs";import{default as h}from"./packem_shared/discoverCrons-RlATa0_t.mjs";import{FLAGS_FILENAME as
|
|
1
|
+
import{SCHEMA_SNAPSHOT_VERSION as t,diffSchemaSnapshots as s,serializeSchemaSnapshot as a}from"./packem_shared/SCHEMA_SNAPSHOT_VERSION-CFhF_hmg.mjs";import{formatAdvisories as m,lintSchema as d,toAdvisorContext as p}from"./packem_shared/formatAdvisories-CQvIhQ04.mjs";import{describeErrorLevelFindings as c,errorAdvisoryNames as n,errorPlatformDiagnosticNames as S}from"./packem_shared/describeErrorLevelFindings-IhNx9gPr.mjs";import{CodegenDiagnosticError as E,diagnosticAt as x}from"./packem_shared/CodegenDiagnosticError-DPezpZTz.mjs";import{AGENTS_FILENAME as u,discoverAgents as v}from"./packem_shared/AGENTS_FILENAME-Dk-k250h.mjs";import{default as O}from"./packem_shared/discoverAuthApiCalls-XfNbxqlq.mjs";import{CONTAINERS_FILENAME as g,discoverContainers as M}from"./packem_shared/CONTAINERS_FILENAME-DQpyhY6c.mjs";import{default as h}from"./packem_shared/discoverCrons-RlATa0_t.mjs";import{FLAGS_FILENAME as I,discoverFlags as L}from"./packem_shared/FLAGS_FILENAME-Boqm0YCP.mjs";import{discoverFunctions as F}from"./packem_shared/discoverFunctions-4TNKUv7P.mjs";import{default as P}from"./packem_shared/discoverHttpRoutes-DQivLBqT.mjs";import{default as G}from"./packem_shared/discoverInserts-D6szWzrV.mjs";import{default as b}from"./packem_shared/discoverMaskProcedures-BBPqLXA5.mjs";import{default as y}from"./packem_shared/discoverMigrations-rbjxflR8.mjs";import{MUTATORS_FILENAME as W,discoverMutators as K}from"./packem_shared/MUTATORS_FILENAME-Cp_JxLSz.mjs";import{default as j}from"./packem_shared/discoverNondeterministicCalls-Bxr652Rz.mjs";import{NOTIFY_FILENAME as w,discoverNotifyCalls as B,discoverNotifyConfig as q}from"./packem_shared/NOTIFY_FILENAME-DwyJ5I4Q.mjs";import{default as Y}from"./packem_shared/readPackageDependencies-CogJX1Ia.mjs";import{I as X}from"./packem_shared/discover-queries-CU9o_j87.mjs";import{QUEUES_FILENAME as ee,discoverQueues as re}from"./packem_shared/QUEUES_FILENAME-QpMZsde0.mjs";import{default as te}from"./packem_shared/discoverR2sqlCalls-DMxG6gHr.mjs";import{discoverRlsMetadata as ae,default as ie}from"./packem_shared/discoverRlsMetadata-B63ARnKG.mjs";import{discoverSandboxUsage as de}from"./packem_shared/discoverSandboxUsage-DBM98vVh.mjs";import{default as fe}from"./packem_shared/discoverSchema-BNr7PVcZ.mjs";import{SHAPES_FILENAME as ne,discoverShapes as Se}from"./packem_shared/SHAPES_FILENAME-WxXOsYfe.mjs";import{default as Ee}from"./packem_shared/discoverStorageRulesMetadata-_40MGqRX.mjs";import{WORKFLOWS_FILENAME as Ae,discoverWorkflows as ue}from"./packem_shared/WORKFLOWS_FILENAME-Dz80zqeT.mjs";import{S as Ne,h as Oe,M as Re,B as ge,p as Me,L as Ce,R as he,C as _e,V as Ie,Q as Le,$ as Te,E as Fe,m as De,F as Pe}from"./packem_shared/emit-BbLyaTLJ.mjs";import{emitApp as Ge}from"./packem_shared/emitApp-DkO-Qvoo.mjs";import{buildOpenApiDocument as be,emitOpenApi as ke,emitOpenApiModule as ye}from"./packem_shared/buildOpenApiDocument-B8-PH9af.mjs";import{OPENRPC_VERSION as We,buildOpenRpcDocument as Ke,emitOpenRpc as Qe,emitOpenRpcModule as je}from"./packem_shared/OPENRPC_VERSION-Bzh1vxcl.mjs";import{DEFAULT_TARGET as we,platformMatrixIds as Be,readProjectTarget as qe,resolveCodegenTarget as Je}from"./packem_shared/DEFAULT_TARGET-CH5disA3.mjs";import{SCHEMA_SNAPSHOT_FILENAME as $e,createCodegenProject as Xe,refreshCodegenProject as Ze,runCodegen as er}from"./packem_shared/SCHEMA_SNAPSHOT_FILENAME-DlCvMk66.mjs";import{SchemaSnapshotParseError as or,buildSchemaSnapshot as tr,evaluateSchemaDrift as sr,parseSchemaSnapshot as ar}from"./packem_shared/SchemaSnapshotParseError-BkgxjBPQ.mjs";import{schemaFromIr as mr}from"./packem_shared/schemaFromIr-R1ZFzVyy.mjs";import{LUNORA_ERROR_CODES as pr,validatorIrToJsonSchema as fr}from"./packem_shared/LUNORA_ERROR_CODES-zfAI2OFs.mjs";import{SDK_LANGUAGES as nr,SDK_TARGETS as Sr,generateSdk as lr}from"./packem_shared/SDK_LANGUAGES-fIqQtE14.mjs";import{redact as xr,secretKindOf as Ar}from"./packem_shared/redact-6jD4lAhq.mjs";import{MESSAGE_SOLUTIONS as vr,findSolutionByMessage as Nr}from"@lunora/errors";import{isTypedSchema as Rr}from"./packem_shared/isTypedSchema-9wiKtXr2.mjs";const e="0.0.0";export{u as AGENTS_FILENAME,g as CONTAINERS_FILENAME,E as CodegenDiagnosticError,we as DEFAULT_TARGET,I as FLAGS_FILENAME,Ne as GENERATED_HEADER,pr as LUNORA_ERROR_CODES,vr as LUNORA_SOLUTION_RULES,W as MUTATORS_FILENAME,w as NOTIFY_FILENAME,We as OPENRPC_VERSION,ee as QUEUES_FILENAME,$e as SCHEMA_SNAPSHOT_FILENAME,t as SCHEMA_SNAPSHOT_VERSION,nr as SDK_LANGUAGES,Sr as SDK_TARGETS,ne as SHAPES_FILENAME,or as SchemaSnapshotParseError,e as VERSION,Ae as WORKFLOWS_FILENAME,be as buildOpenApiDocument,Ke as buildOpenRpcDocument,tr as buildSchemaSnapshot,Xe as createCodegenProject,c as describeErrorLevelFindings,x as diagnosticAt,s as diffSchemaSnapshots,v as discoverAgents,O as discoverAuthApiCalls,M as discoverContainers,h as discoverCrons,L as discoverFlags,F as discoverFunctions,P as discoverHttpRoutes,G as discoverInserts,b as discoverMaskProcedures,y as discoverMigrations,K as discoverMutators,j as discoverNondeterministicCalls,B as discoverNotifyCalls,q as discoverNotifyConfig,X as discoverQueries,re as discoverQueues,te as discoverR2sqlCalls,ae as discoverRlsMetadata,ie as discoverRlsProcedures,de as discoverSandboxUsage,fe as discoverSchema,Se as discoverShapes,Ee as discoverStorageRulesMetadata,ue as discoverWorkflows,Oe as emitAgents,Re as emitApi,Ge as emitApp,ge as emitCollections,Me as emitContainers,Ce as emitCrons,he as emitDataModel,_e as emitDrizzleSchema,Ie as emitFunctions,ke as emitOpenApi,ye as emitOpenApiModule,Qe as emitOpenRpc,je as emitOpenRpcModule,Le as emitServer,Te as emitShard,Fe as emitVectors,De as emitWorkflows,Pe as emitWranglerCronTriggers,n as errorAdvisoryNames,S as errorPlatformDiagnosticNames,sr as evaluateSchemaDrift,Nr as findLunoraSolution,m as formatAdvisories,lr as generateSdk,Rr as isTypedSchema,d as lintSchema,ar as parseSchemaSnapshot,Be as platformMatrixIds,Y as readPackageDependencies,qe as readProjectTarget,xr as redact,Ze as refreshCodegenProject,Je as resolveCodegenTarget,er as runCodegen,mr as schemaFromIr,Ar as secretKindOf,a as serializeSchemaSnapshot,p as toAdvisorContext,fr as validatorIrToJsonSchema};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{existsSync as b,mkdirSync as qt,readFileSync as dt,writeFileSync as Bt,rmSync as Ut}from"node:fs";import{join as g,dirname as le}from"node:path";import{performance as ue}from"node:perf_hooks";import{runAdvisor as Vt}from"@lunora/advisor";import{LunoraError as k}from"@lunora/errors";import{SyntaxKind as l,Node as o,Project as Ge}from"ts-morph";import{serializeSchemaSnapshot as Wt}from"./SCHEMA_SNAPSHOT_VERSION-CFhF_hmg.mjs";import{toAdvisorContext as _t}from"./formatAdvisories-CQvIhQ04.mjs";import{discoverAgents as Gt}from"./AGENTS_FILENAME-Dk-k250h.mjs";import{discoverContainers as Ht}from"./CONTAINERS_FILENAME-DQpyhY6c.mjs";import{diagnosticAt as Z}from"./CodegenDiagnosticError-DPezpZTz.mjs";import{o as Y}from"./module-specifiers-8FEEiUcv.mjs";import{r as de,Q as Qt,R as Jt,a as Xt,M as Zt,V as Yt,$ as es,B as ts,p as ss,m as rs,h as ns,f as is,L as os,E as as,C as cs,P as ls,F as us}from"./emit-BbLyaTLJ.mjs";import{g as h,p as E,P as N,C as $,O as gt,z as ds,R as pt,h as gs}from"./discover-ast-7ABwvTVn.mjs";import ps from"./readPackageDependencies-CogJX1Ia.mjs";import{discoverQueues as fs}from"./QUEUES_FILENAME-QpMZsde0.mjs";import{discoverSandboxUsage as ms}from"./discoverSandboxUsage-DBM98vVh.mjs";import hs from"./discoverStorageRulesMetadata-_40MGqRX.mjs";import{discoverWorkflows as xs}from"./WORKFLOWS_FILENAME-Dz80zqeT.mjs";import{gatePlatformFeatures as Es,resolveCodegenTarget as ys}from"./DEFAULT_TARGET-CH5disA3.mjs";import{i as I,a as D,e as x,c as A,r as $s,b as vs,s as ee,d as bs,f as Ns,
|
|
1
|
+
import{existsSync as b,mkdirSync as qt,readFileSync as dt,writeFileSync as Bt,rmSync as Ut}from"node:fs";import{join as g,dirname as le}from"node:path";import{performance as ue}from"node:perf_hooks";import{runAdvisor as Vt}from"@lunora/advisor";import{LunoraError as k}from"@lunora/errors";import{SyntaxKind as l,Node as o,Project as Ge}from"ts-morph";import{serializeSchemaSnapshot as Wt}from"./SCHEMA_SNAPSHOT_VERSION-CFhF_hmg.mjs";import{toAdvisorContext as _t}from"./formatAdvisories-CQvIhQ04.mjs";import{discoverAgents as Gt}from"./AGENTS_FILENAME-Dk-k250h.mjs";import{discoverContainers as Ht}from"./CONTAINERS_FILENAME-DQpyhY6c.mjs";import{diagnosticAt as Z}from"./CodegenDiagnosticError-DPezpZTz.mjs";import{o as Y}from"./module-specifiers-8FEEiUcv.mjs";import{r as de,Q as Qt,R as Jt,a as Xt,M as Zt,V as Yt,$ as es,B as ts,p as ss,m as rs,h as ns,f as is,L as os,E as as,C as cs,P as ls,F as us}from"./emit-BbLyaTLJ.mjs";import{g as h,p as E,P as N,C as $,O as gt,z as ds,R as pt,h as gs}from"./discover-ast-7ABwvTVn.mjs";import ps from"./readPackageDependencies-CogJX1Ia.mjs";import{discoverQueues as fs}from"./QUEUES_FILENAME-QpMZsde0.mjs";import{discoverSandboxUsage as ms}from"./discoverSandboxUsage-DBM98vVh.mjs";import hs from"./discoverStorageRulesMetadata-_40MGqRX.mjs";import{discoverWorkflows as xs}from"./WORKFLOWS_FILENAME-Dz80zqeT.mjs";import{gatePlatformFeatures as Es,resolveCodegenTarget as ys}from"./DEFAULT_TARGET-CH5disA3.mjs";import{i as I,a as D,e as x,c as A,r as $s,b as vs,s as ee,d as bs,f as Ns,I as Ss}from"./discover-queries-CU9o_j87.mjs";import{classifyProcedureCall as M,inlineHandler as As,procedureHandler as ft,chainUsesWrappedCall as mt,isDatabaseAccessor as R,chainHasStep as ws,discoverFunctions as Ps,resolveStandardSchemaType as Is}from"./discoverFunctions-4TNKUv7P.mjs";import Ts from"./discoverAuthApiCalls-XfNbxqlq.mjs";import Ls from"./discoverCrons-RlATa0_t.mjs";import{discoverFlagKeys as ks}from"./FLAGS_FILENAME-Boqm0YCP.mjs";import Ds from"./discoverHttpRoutes-DQivLBqT.mjs";import Os from"./discoverInserts-D6szWzrV.mjs";import Cs,{discoverMaskStrategies as Fs,discoverMaskMetadata as Ks,discoverMaskHasNonLiteralPolicy as Rs}from"./discoverMaskProcedures-BBPqLXA5.mjs";import Ms from"./discoverMigrations-rbjxflR8.mjs";import{MUTATORS_FILENAME as js,isDefineMutatorCallee as zs,discoverMutators as qs}from"./MUTATORS_FILENAME-Cp_JxLSz.mjs";import Bs from"./discoverNondeterministicCalls-Bxr652Rz.mjs";import{discoverNotifyConfig as Us,discoverNotifyCalls as Vs}from"./NOTIFY_FILENAME-DwyJ5I4Q.mjs";import Ws from"./discoverR2sqlCalls-DMxG6gHr.mjs";import _s,{discoverRlsMetadata as Gs}from"./discoverRlsMetadata-B63ARnKG.mjs";import Hs from"./discoverSchema-BNr7PVcZ.mjs";import{secretKindOf as Qs,redact as Js,isHeuristicSecretKind as Xs,isSecretishName as Zs}from"./redact-6jD4lAhq.mjs";import{discoverShapes as Ys}from"./SHAPES_FILENAME-WxXOsYfe.mjs";import{emitApp as er}from"./emitApp-DkO-Qvoo.mjs";import{buildOpenApiDocument as tr,emitOpenApiModule as sr}from"./buildOpenApiDocument-B8-PH9af.mjs";import{buildOpenRpcDocument as rr,emitOpenRpcModule as nr}from"./OPENRPC_VERSION-Bzh1vxcl.mjs";import{y as ir}from"./parse-validator-CusS8QwU.mjs";import{buildSchemaSnapshot as or}from"./SchemaSnapshotParseError-BkgxjBPQ.mjs";const ar=e=>{const t=[],s=e.tables.filter(r=>r.shardMode==="global");return s.some(r=>r.globalBackend!=="hyperdrive")&&t.push({name:"@lunora/d1",reason:"`.global()` tables are D1-backed, so `_generated/app.ts` imports the D1 `ctx.db` adapter"}),s.some(r=>r.globalBackend==="hyperdrive")&&t.push({name:"@lunora/hyperdrive",reason:'`.global({ backend: "hyperdrive" })` tables route through `@lunora/hyperdrive/global`'}),e.vectorIndexes.length>0&&t.push({name:"@lunora/bindings",reason:"`.vectorize()` indexes make `_generated/vectors.ts` import `@lunora/bindings/vectors`"}),t},cr=(e,t)=>{if(t===void 0)return;const s=ar(e).filter(i=>!t.has(i.name));if(s.length===0)return;const r=s.map(i=>` - ${i.name} — ${i.reason}`).join(`
|
|
2
2
|
`);throw new k("INTERNAL",`@lunora/codegen: this schema's generated code imports packages the project does not declare:
|
|
3
3
|
${r}
|
|
4
4
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Node as s,SyntaxKind as l}from"ts-morph";import{g as N,p as A}from"./discover-ast-7ABwvTVn.mjs";const m=(e,t)=>{if(e.getText()!==t)return!1;const r=e.getParent();return s.isPropertyAccessExpression(r)&&r.getNameNode()===e?!1:!(s.isPropertyAssignment(r)&&r.getNameNode()===e)},x=(e,t)=>s.isIdentifier(e)?m(e,t):e.getDescendantsOfKind(l.Identifier).some(r=>m(r,t)),d=e=>x(e,"ctx"),I=e=>{let t=e;for(;s.isPropertyAccessExpression(t)||s.isElementAccessExpression(t)||s.isNonNullExpression(t);)t=t.getExpression();return s.isIdentifier(t)?t:void 0},C=e=>{if(s.isIdentifier(e))return e.getText();if(s.isPropertyAccessExpression(e))return e.getName()},E=e=>x(e,"args"),f=e=>{if(!s.isIdentifier(e))return;const t=e.getText(),r=e.getFirstAncestor(o=>s.isArrowFunction(o)||s.isFunctionExpression(o)||s.isFunctionDeclaration(o));if(r===void 0)return;const n=e.getStart();let i,u=-1;for(const o of r.getDescendantsOfKind(l.VariableDeclaration)){if(o.getName()!==t)continue;const a=o.getInitializer(),c=o.getStart();a!==void 0&&c<n&&c>u&&(i=a,u=c)}return i},T=e=>{if(E(e))return!0;const t=f(e);return t!==void 0&&E(t)},q=e=>{if(s.isCallExpression(e)||s.isNewExpression(e))return!1;const t=f(e);return t===void 0||!(s.isCallExpression(t)||s.isNewExpression(t))},L=e=>{if(d(e))return!0;const t=f(e);if(t!==void 0&&d(t))return!0;const r=t??e;return(s.isIdentifier(r)?[r]:r.getDescendantsOfKind(l.Identifier)).some(n=>{const i=f(n);return i!==void 0&&d(i)})},p=(e,t)=>x(e,t),O=(e,t)=>{if(p(e,t))return!0;const r=f(e);if(r!==void 0&&p(r,t))return!0;const n=I(e);if(n!==void 0){const i=f(n);return i!==void 0&&p(i,t)}return!1},P=e=>{for(const t of e.getAncestors())if(s.isVariableDeclaration(t)&&t.getVariableStatement()?.hasExportKeyword()===!0)return t.getName();return"<module>"},h=new Set(["withGeoIndex","withIndex","withSearchIndex"]),y=new Set(["collect","collectWithScores","first","paginate","take","unique"]),S=e=>{const t=e.getExpression();if(!s.isPropertyAccessExpression(t)||t.getName()!=="query")return!1;const r=t.getExpression();return s.isPropertyAccessExpression(r)?r.getName()==="db":s.isIdentifier(r)&&r.getText()==="db"},v=e=>{const t=[];let r=e;for(;;){const n=r.getParent();if(!n||!s.isPropertyAccessExpression(n))break;const i=n.getParent();if(!i||!s.isCallExpression(i))break;t.push(n.getName()),r=i}return t},b=/\b[A-Za-z_$][\w$]*\._id\s*===?[^=]/u,w=e=>{let t=e;for(;;){const r=t.getParent();if(!r||!s.isPropertyAccessExpression(r))return!1;const n=r.getParent();if(!n||!s.isCallExpression(n))return!1;if(r.getName()==="filter"){const i=n.getArguments()[0];if(i&&b.test(i.getText()))return!0}t=n}},D=e=>{const t=e.getArguments()[0];return t&&s.isStringLiteral(t)?t.getLiteralText():""},$=(e,t)=>{const r=[];for(const n of N(t)){const i=e.getSourceFile(n)??e.addSourceFileAtPath(n),u=A(t,n);for(const o of i.getDescendantsOfKind(l.CallExpression)){if(!S(o))continue;const a=v(o),c=a.includes("filter");r.push({exportName:P(o),file:u,filtersPrimaryKey:c&&w(o),hasFilter:c,hasIndex:a.some(g=>h.has(g)),line:o.getStartLineNumber(),table:D(o),terminal:a.findLast(g=>y.has(g))})}}return r};export{$ as I,L as a,q as b,C as c,O as d,P as e,p as f,T as i,E as r,f as s};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"ts-morph";import{I as p}from"./discover-queries-CU9o_j87.mjs";import"./discover-ast-7ABwvTVn.mjs";export{p as default};
|
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.107",
|
|
4
4
|
"description": "Code generator for Lunora: emits _generated/{api,server,dataModel}.ts from your schema",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cloudflare",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"access": "public"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@lunora/advisor": "1.0.0-alpha.
|
|
49
|
+
"@lunora/advisor": "1.0.0-alpha.77",
|
|
50
50
|
"@lunora/agent": "1.0.0-alpha.52",
|
|
51
51
|
"@lunora/container": "1.0.0-alpha.30",
|
|
52
52
|
"@lunora/errors": "1.0.0-alpha.21",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{Node as s,SyntaxKind as g}from"ts-morph";import{g as E,p as N}from"./discover-ast-7ABwvTVn.mjs";const x=(e,t)=>{if(e.getText()!==t)return!1;const r=e.getParent();return s.isPropertyAccessExpression(r)&&r.getNameNode()===e?!1:!(s.isPropertyAssignment(r)&&r.getNameNode()===e)},p=(e,t)=>s.isIdentifier(e)?x(e,t):e.getDescendantsOfKind(g.Identifier).some(r=>x(r,t)),l=e=>p(e,"ctx"),A=e=>{let t=e;for(;s.isPropertyAccessExpression(t)||s.isElementAccessExpression(t)||s.isNonNullExpression(t);)t=t.getExpression();return s.isIdentifier(t)?t:void 0},F=e=>{if(s.isIdentifier(e))return e.getText();if(s.isPropertyAccessExpression(e))return e.getName()},m=e=>p(e,"args"),a=e=>{if(!s.isIdentifier(e))return;const t=e.getText(),r=e.getFirstAncestor(o=>s.isArrowFunction(o)||s.isFunctionExpression(o)||s.isFunctionDeclaration(o));if(r===void 0)return;const n=e.getStart();let i,f=-1;for(const o of r.getDescendantsOfKind(g.VariableDeclaration)){if(o.getName()!==t)continue;const c=o.getInitializer(),u=o.getStart();c!==void 0&&u<n&&u>f&&(i=c,f=u)}return i},K=e=>{if(m(e))return!0;const t=a(e);return t!==void 0&&m(t)},C=e=>{if(s.isCallExpression(e)||s.isNewExpression(e))return!1;const t=a(e);return t===void 0||!(s.isCallExpression(t)||s.isNewExpression(t))},T=e=>{if(l(e))return!0;const t=a(e);if(t!==void 0&&l(t))return!0;const r=t??e;return(s.isIdentifier(r)?[r]:r.getDescendantsOfKind(g.Identifier)).some(n=>{const i=a(n);return i!==void 0&&l(i)})},d=(e,t)=>p(e,t),$=(e,t)=>{if(d(e,t))return!0;const r=a(e);if(r!==void 0&&d(r,t))return!0;const n=A(e);if(n!==void 0){const i=a(n);return i!==void 0&&d(i,t)}return!1},P=e=>{for(const t of e.getAncestors())if(s.isVariableDeclaration(t)&&t.getVariableStatement()?.hasExportKeyword()===!0)return t.getName();return"<module>"},y=new Set(["withIndex","withSearchIndex"]),I=e=>{const t=e.getExpression();if(!s.isPropertyAccessExpression(t)||t.getName()!=="query")return!1;const r=t.getExpression();return s.isPropertyAccessExpression(r)?r.getName()==="db":s.isIdentifier(r)&&r.getText()==="db"},h=e=>{const t=[];let r=e;for(;;){const n=r.getParent();if(!n||!s.isPropertyAccessExpression(n))break;const i=n.getParent();if(!i||!s.isCallExpression(i))break;t.push(n.getName()),r=i}return t},v=/\b[A-Za-z_$][\w$]*\._id\s*===?[^=]/u,b=e=>{let t=e;for(;;){const r=t.getParent();if(!r||!s.isPropertyAccessExpression(r))return!1;const n=r.getParent();if(!n||!s.isCallExpression(n))return!1;if(r.getName()==="filter"){const i=n.getArguments()[0];if(i&&v.test(i.getText()))return!0}t=n}},S=e=>{const t=e.getArguments()[0];return t&&s.isStringLiteral(t)?t.getLiteralText():""},O=(e,t)=>{const r=[];for(const n of E(t)){const i=e.getSourceFile(n)??e.addSourceFileAtPath(n),f=N(t,n);for(const o of i.getDescendantsOfKind(g.CallExpression)){if(!I(o))continue;const c=h(o);c.includes("filter")&&r.push({exportName:P(o),file:f,filtersPrimaryKey:b(o),hasFilter:!0,hasIndex:c.some(u=>y.has(u)),line:o.getStartLineNumber(),table:S(o)})}}return r};export{T as a,C as b,F as c,$ as d,P as e,d as f,K as i,m as r,a as s,O as y};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import"ts-morph";import{y as p}from"./discover-queries-i4Vd2si7.mjs";import"./discover-ast-7ABwvTVn.mjs";export{p as default};
|