@lunora/codegen 1.0.0-alpha.421 → 1.0.0-alpha.422
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.mjs +1 -1
- package/dist/packem_shared/{SCHEMA_SNAPSHOT_FILENAME-CvXFQ6RH.mjs → SCHEMA_SNAPSHOT_FILENAME-Ce8xsmI9.mjs} +1 -1
- package/dist/packem_shared/{SHAPES_FILENAME-BxRvP1ab.mjs → SHAPES_FILENAME-DTJKanSz.mjs} +1 -1
- package/dist/packem_shared/{discoverFunctions-BNqI2S6a.mjs → discoverFunctions-CGrAezsY.mjs} +1 -1
- package/dist/packem_shared/{index-DFMCX2vk.mjs → index-M4HwQ4Jr.mjs} +1 -1
- package/dist/packem_shared/{ip-reads-D4nRZgML.mjs → ip-reads-By7tJdyu.mjs} +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{SCHEMA_SNAPSHOT_VERSION as t,diffSchemaSnapshots as i,serializeSchemaSnapshot as a}from"./packem_shared/SCHEMA_SNAPSHOT_VERSION-DTLoSaNn.mjs";import{formatAdvisories as d,lintSchema as f,toAdvisorContext as m}from"./packem_shared/formatAdvisories-Bue5tbp6.mjs";import{describeErrorLevelFindings as n,errorAdvisoryNames as c,errorPlatformDiagnosticNames as l,sortedUniqueNames as S}from"./packem_shared/describeErrorLevelFindings-DlkgCw8a.mjs";import{CAPABILITY_PROBES as E}from"./packem_shared/CAPABILITY_PROBES-DCzOjTN7.mjs";import{COMPANION_BINDING as u,COMPANION_SERVICE_NAME as N}from"./packem_shared/COMPANION_BINDING-Da_v9XpC.mjs";import{CodegenDiagnosticError as g,diagnosticAt as C}from"./packem_shared/CodegenDiagnosticError-BUXlG3P-.mjs";import{AGENTS_FILENAME as I,discoverAgents as _}from"./packem_shared/AGENTS_FILENAME-C4tHmiZZ.mjs";import{isTestPath as L,listLunoraSourceFiles as M}from"./packem_shared/isTestPath-Uwb5a6Kq.mjs";import{default as F}from"./packem_shared/discoverAuthApiCalls-CuqaLRa0.mjs";import{CONTAINERS_FILENAME as P,discoverContainers as D}from"./packem_shared/CONTAINERS_FILENAME-d3XTFcqV.mjs";import{default as b}from"./packem_shared/discoverCrons-bT8F5GyL.mjs";import{ENV_FILENAME as U}from"./packem_shared/ENV_FILENAME-DJ11PXN5.mjs";import{capabilitiesUsedBy as H,createTargetScope as j,foldCapabilitySignals as V,mayReadCapabilityContext as k,sourceCapabilitySignals as W}from"./packem_shared/capabilitiesUsedBy-BNvoiCu1.mjs";import{FLAGS_FILENAME as K,discoverFlags as Q}from"./packem_shared/FLAGS_FILENAME-DeSjFBWq.mjs";import{d as q}from"./packem_shared/index-
|
|
1
|
+
import{SCHEMA_SNAPSHOT_VERSION as t,diffSchemaSnapshots as i,serializeSchemaSnapshot as a}from"./packem_shared/SCHEMA_SNAPSHOT_VERSION-DTLoSaNn.mjs";import{formatAdvisories as d,lintSchema as f,toAdvisorContext as m}from"./packem_shared/formatAdvisories-Bue5tbp6.mjs";import{describeErrorLevelFindings as n,errorAdvisoryNames as c,errorPlatformDiagnosticNames as l,sortedUniqueNames as S}from"./packem_shared/describeErrorLevelFindings-DlkgCw8a.mjs";import{CAPABILITY_PROBES as E}from"./packem_shared/CAPABILITY_PROBES-DCzOjTN7.mjs";import{COMPANION_BINDING as u,COMPANION_SERVICE_NAME as N}from"./packem_shared/COMPANION_BINDING-Da_v9XpC.mjs";import{CodegenDiagnosticError as g,diagnosticAt as C}from"./packem_shared/CodegenDiagnosticError-BUXlG3P-.mjs";import{AGENTS_FILENAME as I,discoverAgents as _}from"./packem_shared/AGENTS_FILENAME-C4tHmiZZ.mjs";import{isTestPath as L,listLunoraSourceFiles as M}from"./packem_shared/isTestPath-Uwb5a6Kq.mjs";import{default as F}from"./packem_shared/discoverAuthApiCalls-CuqaLRa0.mjs";import{CONTAINERS_FILENAME as P,discoverContainers as D}from"./packem_shared/CONTAINERS_FILENAME-d3XTFcqV.mjs";import{default as b}from"./packem_shared/discoverCrons-bT8F5GyL.mjs";import{ENV_FILENAME as U}from"./packem_shared/ENV_FILENAME-DJ11PXN5.mjs";import{capabilitiesUsedBy as H,createTargetScope as j,foldCapabilitySignals as V,mayReadCapabilityContext as k,sourceCapabilitySignals as W}from"./packem_shared/capabilitiesUsedBy-BNvoiCu1.mjs";import{FLAGS_FILENAME as K,discoverFlags as Q}from"./packem_shared/FLAGS_FILENAME-DeSjFBWq.mjs";import{d as q}from"./packem_shared/index-M4HwQ4Jr.mjs";import{default as J}from"./packem_shared/discoverHttpRoutes-CesuhqW1.mjs";import{default as Z}from"./packem_shared/discoverHyperdriveCalls-BmAoOGGq.mjs";import{default as ee}from"./packem_shared/discoverInserts-DIarYU2P.mjs";import{d as oe}from"./packem_shared/index-CfSmiylg.mjs";import{default as ie}from"./packem_shared/discoverMigrations-C9AlZYFi.mjs";import{MUTATORS_FILENAME as se,discoverMutators as de}from"./packem_shared/MUTATORS_FILENAME-C0ZV0hh6.mjs";import{default as me}from"./packem_shared/discoverNondeterministicCalls-ZeZDQJAI.mjs";import{ALL_NOTIFY_CHANNELS as ne,NOTIFY_FILENAME as ce,discoverNotifyCalls as le,discoverNotifyChannels as Se,discoverNotifyConfig as xe}from"./packem_shared/ALL_NOTIFY_CHANNELS-BgkkvuUe.mjs";import{default as Ae}from"./packem_shared/readPackageDependencies-RHhGiz0k.mjs";import{default as Ne}from"./packem_shared/discoverQueries-DLZHcDzB.mjs";import{QUEUES_FILENAME as ge,discoverQueues as Ce}from"./packem_shared/QUEUES_FILENAME-DbuJZnrY.mjs";import{default as Ie}from"./packem_shared/discoverR2sqlCalls-D_HWbbky.mjs";import{default as Re}from"./packem_shared/discoverRlsProcedures-BbSdCvmA.mjs";import{default as Me}from"./packem_shared/discoverRlsMetadata-C0UkQkWd.mjs";import{discoverSandboxUsage as Fe}from"./packem_shared/discoverSandboxUsage-Dgvv6F_7.mjs";import{default as Pe}from"./packem_shared/discoverSchema-BLTROO8Z.mjs";import{companionServiceBinding as ye,readBoundServiceBindings as be,readDevServiceBindings as Ge,readServiceBindings as Ue,resolveServiceBindings as Be}from"./packem_shared/companionServiceBinding-BZjm486n.mjs";import{SHAPES_FILENAME as je,discoverShapes as Ve}from"./packem_shared/SHAPES_FILENAME-DTJKanSz.mjs";import{default as We}from"./packem_shared/discoverStorageRulesMetadata-DeBgC7po.mjs";import{WORKFLOWS_FILENAME as Ke,discoverWorkflows as Qe}from"./packem_shared/WORKFLOWS_FILENAME-7FysJsMZ.mjs";import{emitApp as qe}from"./packem_shared/emitApp-LFKtDRYu.mjs";import{isD1GlobalTable as Je,isHyperdriveGlobalTable as Xe}from"./packem_shared/isD1GlobalTable-udvHAAzD.mjs";import{buildOpenApiDocument as $e,emitOpenApi as er,emitOpenApiModule as rr}from"./packem_shared/buildOpenApiDocument-DmV_PBFv.mjs";import{OPENRPC_VERSION as tr,buildOpenRpcDocument as ir,emitOpenRpc as ar,emitOpenRpcModule as sr}from"./packem_shared/OPENRPC_VERSION-BOBo0zdQ.mjs";import{DEFAULT_TARGET as fr,platformMatrixIds as mr,readProjectTarget as pr,resolveCodegenTarget as nr}from"./packem_shared/DEFAULT_TARGET-CVYzxQ0y.mjs";import{b as lr,r as Sr,c as xr,d as Er}from"./packem_shared/project-config-file-DR7xrrNB.mjs";import{PROJECT_CONFIG_FILENAMES as ur,findCodegenConfigFile as Nr,findProjectConfigFile as vr,projectConfigCandidatePaths as gr}from"./packem_shared/PROJECT_CONFIG_FILENAMES-CLfsyvjA.mjs";import{SCHEMA_SNAPSHOT_FILENAME as Or,runCodegen as Ir}from"./packem_shared/SCHEMA_SNAPSHOT_FILENAME-Ce8xsmI9.mjs";import{SchemaSnapshotParseError as Rr,buildSchemaSnapshot as Lr,evaluateSchemaDrift as Mr,indexReferencesOf as Tr,parseSchemaSnapshot as Fr}from"./packem_shared/SchemaSnapshotParseError-CV7mmuPi.mjs";import{default as Pr}from"./packem_shared/fingerprintSchemaSources-TN-rU6Of.mjs";import{schemaFromIr as yr}from"./packem_shared/schemaFromIr-CByOxuZb.mjs";import{LUNORA_ERROR_CODES as Gr,validatorIrToJsonSchema as Ur}from"./packem_shared/LUNORA_ERROR_CODES-D7AVT7qF.mjs";import{SDK_LANGUAGES as Hr,SDK_TARGETS as jr,generateSdk as Vr}from"./sdk/index.mjs";import{redact as Wr,secretKindOf as zr}from"./packem_shared/redact-Cy14LEnc.mjs";import{default as Qr}from"./packem_shared/emitDrizzleSchema-BzOChEYW.mjs";import{e as qr}from"./packem_shared/server-Dfxmm5Zw.mjs";import{e as Jr}from"./packem_shared/shard-CWAD5mYy.mjs";import{G as Zr}from"./packem_shared/shared-Cn7dMQ_u.mjs";import{MESSAGE_SOLUTIONS as eo,findSolutionByMessage as ro}from"@lunora/errors";import{createCodegenProject as to,findTsconfig as io,refreshCodegenProject as ao,tsconfigFingerprint as so}from"./packem_shared/createCodegenProject-dC6oJh5H.mjs";import{t as mo,u as po,v as no}from"./packem_shared/shard-runtime-G5mZQjY0.mjs";import{emitApi as lo,emitCollections as So,emitInternalApi as xo}from"./packem_shared/emitApi-lwadq5G7.mjs";import{emitCrons as Ao,emitScheduler as uo,emitVectors as No,emitWranglerCronTriggers as vo}from"./packem_shared/emitCrons-CCRKs482.mjs";import{emitDataModel as Co}from"./packem_shared/emitDataModel-BvCZS4Yq.mjs";import{emitFunctions as Io}from"./packem_shared/emitFunctions-ppMX7E3X.mjs";import{isTypedSchema as Ro}from"./packem_shared/isTypedSchema-CDv3pJB6.mjs";const e="0.0.0";export{I as AGENTS_FILENAME,ne as ALL_NOTIFY_CHANNELS,E as CAPABILITY_PROBES,u as COMPANION_BINDING,N as COMPANION_SERVICE_NAME,P as CONTAINERS_FILENAME,g as CodegenDiagnosticError,fr as DEFAULT_TARGET,U as ENV_FILENAME,K as FLAGS_FILENAME,Zr as GENERATED_HEADER,Gr as LUNORA_ERROR_CODES,eo as LUNORA_SOLUTION_RULES,se as MUTATORS_FILENAME,ce as NOTIFY_FILENAME,tr as OPENRPC_VERSION,ur as PROJECT_CONFIG_FILENAMES,ge as QUEUES_FILENAME,Or as SCHEMA_SNAPSHOT_FILENAME,t as SCHEMA_SNAPSHOT_VERSION,Hr as SDK_LANGUAGES,jr as SDK_TARGETS,je as SHAPES_FILENAME,Rr as SchemaSnapshotParseError,e as VERSION,Ke as WORKFLOWS_FILENAME,$e as buildOpenApiDocument,ir as buildOpenRpcDocument,Lr as buildSchemaSnapshot,H as capabilitiesUsedBy,ye as companionServiceBinding,to as createCodegenProject,j as createTargetScope,n as describeErrorLevelFindings,C as diagnosticAt,i as diffSchemaSnapshots,_ as discoverAgents,F as discoverAuthApiCalls,D as discoverContainers,b as discoverCrons,Q as discoverFlags,q as discoverFunctions,J as discoverHttpRoutes,Z as discoverHyperdriveCalls,ee as discoverInserts,oe as discoverMaskProcedures,ie as discoverMigrations,de as discoverMutators,me as discoverNondeterministicCalls,le as discoverNotifyCalls,Se as discoverNotifyChannels,xe as discoverNotifyConfig,Ne as discoverQueries,Ce as discoverQueues,Ie as discoverR2sqlCalls,Me as discoverRlsMetadata,Re as discoverRlsProcedures,Fe as discoverSandboxUsage,Pe as discoverSchema,Ve as discoverShapes,We as discoverStorageRulesMetadata,Qe as discoverWorkflows,mo as emitAgents,lo as emitApi,qe as emitApp,So as emitCollections,po as emitContainers,Ao as emitCrons,Co as emitDataModel,Qr as emitDrizzleSchema,Io as emitFunctions,xo as emitInternalApi,er as emitOpenApi,rr as emitOpenApiModule,ar as emitOpenRpc,sr as emitOpenRpcModule,uo as emitScheduler,qr as emitServer,Jr as emitShard,No as emitVectors,no as emitWorkflows,vo as emitWranglerCronTriggers,c as errorAdvisoryNames,l as errorPlatformDiagnosticNames,Mr as evaluateSchemaDrift,Nr as findCodegenConfigFile,ro as findLunoraSolution,vr as findProjectConfigFile,io as findTsconfig,Pr as fingerprintSchemaSources,V as foldCapabilitySignals,d as formatAdvisories,Vr as generateSdk,Tr as indexReferencesOf,Je as isD1GlobalTable,Xe as isHyperdriveGlobalTable,L as isTestPath,Ro as isTypedSchema,f as lintSchema,M as listLunoraSourceFiles,lr as loadProjectConfig,k as mayReadCapabilityContext,Fr as parseSchemaSnapshot,mr as platformMatrixIds,gr as projectConfigCandidatePaths,be as readBoundServiceBindings,Ge as readDevServiceBindings,Ae as readPackageDependencies,Sr as readProjectConfigLiterals,xr as readProjectLazyFunctions,Er as readProjectSecurityHeaders,pr as readProjectTarget,Ue as readServiceBindings,Wr as redact,ao as refreshCodegenProject,nr as resolveCodegenTarget,Be as resolveServiceBindings,Ir as runCodegen,yr as schemaFromIr,zr as secretKindOf,a as serializeSchemaSnapshot,S as sortedUniqueNames,W as sourceCapabilitySignals,m as toAdvisorContext,so as tsconfigFingerprint,Ur as validatorIrToJsonSchema};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{existsSync as z,readFileSync as ze,mkdirSync as pt,writeFileSync as ho,rmSync as ve,readdirSync as ds}from"node:fs";import{dirname as gt,join as E,relative as Be,sep as si,basename as vo}from"node:path";import{performance as _t}from"node:perf_hooks";import{RUNTIME_LINTS as Eo,STATIC_LINTS as xo,runAdvisor as So}from"@lunora/advisor";import{LunoraError as F}from"@lunora/errors";import{serializeSchemaSnapshot as yo}from"./SCHEMA_SNAPSHOT_VERSION-DTLoSaNn.mjs";import{toAdvisorContext as Ao}from"./formatAdvisories-Bue5tbp6.mjs";import{Node as r,SyntaxKind as d,Project as us,VariableDeclarationKind as fs,ts as C}from"ts-morph";import{listLunoraSourceFiles as b,lunoraRelativePath as I,declarationLineOf as ni,collectCallRows as R,descendantsOfKind as S,bindingKeyName as Ee,findObjectProperty as U,collectSecurityCallRows as bo,propertyInitializer as $,listSecurityScanFiles as Ve,objectLiteralFromCallbackBody as ii,limitNameOf as ri,optionsObjectLiteral as oi,handlerOf as No,memberAccessOf as ps,chainRootOf as mt,unwrapExpression as v,collectNodeRows as ce,isConstDeclaration as X,outermostValueWrapper as O,isWriteTarget as we,isSameNode as w,returningFunctionOf as Ht,walkChain as wo,staticNumberValue as ai,RUN_METHODS as gs,functionReferenceSegments as Po,isTestPath as Io,isFunctionLike as pe,functionKeyOf as ci,withSourceListMemo as To}from"./isTestPath-Uwb5a6Kq.mjs";import{j as te,h as Z,c as A,a as ms,w as hs,k as Co,d as V,l as Oo,b as li,f as ko,m as Ro,g as Gt,i as Lo}from"./attribution-Cwt30DDJ.mjs";import{i as H,a as Ae,r as Fo,b as Do,c as di,d as _o,s as Ue,e as Mo,f as $o,g as Ko}from"./ip-reads-
|
|
1
|
+
import{existsSync as z,readFileSync as ze,mkdirSync as pt,writeFileSync as ho,rmSync as ve,readdirSync as ds}from"node:fs";import{dirname as gt,join as E,relative as Be,sep as si,basename as vo}from"node:path";import{performance as _t}from"node:perf_hooks";import{RUNTIME_LINTS as Eo,STATIC_LINTS as xo,runAdvisor as So}from"@lunora/advisor";import{LunoraError as F}from"@lunora/errors";import{serializeSchemaSnapshot as yo}from"./SCHEMA_SNAPSHOT_VERSION-DTLoSaNn.mjs";import{toAdvisorContext as Ao}from"./formatAdvisories-Bue5tbp6.mjs";import{Node as r,SyntaxKind as d,Project as us,VariableDeclarationKind as fs,ts as C}from"ts-morph";import{listLunoraSourceFiles as b,lunoraRelativePath as I,declarationLineOf as ni,collectCallRows as R,descendantsOfKind as S,bindingKeyName as Ee,findObjectProperty as U,collectSecurityCallRows as bo,propertyInitializer as $,listSecurityScanFiles as Ve,objectLiteralFromCallbackBody as ii,limitNameOf as ri,optionsObjectLiteral as oi,handlerOf as No,memberAccessOf as ps,chainRootOf as mt,unwrapExpression as v,collectNodeRows as ce,isConstDeclaration as X,outermostValueWrapper as O,isWriteTarget as we,isSameNode as w,returningFunctionOf as Ht,walkChain as wo,staticNumberValue as ai,RUN_METHODS as gs,functionReferenceSegments as Po,isTestPath as Io,isFunctionLike as pe,functionKeyOf as ci,withSourceListMemo as To}from"./isTestPath-Uwb5a6Kq.mjs";import{j as te,h as Z,c as A,a as ms,w as hs,k as Co,d as V,l as Oo,b as li,f as ko,m as Ro,g as Gt,i as Lo}from"./attribution-Cwt30DDJ.mjs";import{i as H,a as Ae,r as Fo,b as Do,c as di,d as _o,s as Ue,e as Mo,f as $o,g as Ko}from"./ip-reads-By7tJdyu.mjs";import{e as J,f as zo,m as ui,b as ht,g as vs,E as fi,C as pi,d as gi,h as Bo,j as Vo,a as Uo}from"./context-root-BpDEhvNE.mjs";import{a as k,i as mi,c as le,d as hi,e as vi,f as Wo,b as jo,g as qo,h as Ho}from"./classify-procedure-call-BmEirzc_.mjs";import{a as y,s as Es}from"./property-name-7cBlgK_O.mjs";import{b as Go,a as Ei}from"./module-specifiers-BctA0m_p.mjs";import{r as vt,s as Yo}from"./parse-validator-BisfC8bR.mjs";import Qo from"./discoverAuthApiCalls-CuqaLRa0.mjs";import{i as B,r as xi}from"./database-calls-d-Sssc-3.mjs";import{i as Yt,p as Si,w as Xo,d as Jo}from"./index-M4HwQ4Jr.mjs";import Zo from"./discoverHyperdriveCalls-BmAoOGGq.mjs";import{PROJECT_CONFIG_FILENAMES as ea,findProjectConfigFile as yi,findCodegenConfigFile as ta}from"./PROJECT_CONFIG_FILENAMES-CLfsyvjA.mjs";import{contextPropertiesRead as sa,createTargetScope as na,fileWiresRequestSecretTool as ia,discoverFeatureUsage as ra}from"./capabilitiesUsedBy-BNvoiCu1.mjs";import{diagnosticAt as Pe}from"./CodegenDiagnosticError-BUXlG3P-.mjs";import{m as xs,a as ot,s as Ai,d as oa}from"./index-CfSmiylg.mjs";import{MUTATORS_FILENAME as aa,isDefineMutatorCallee as ca,mutatorServerImplOf as la,discoverMutators as da}from"./MUTATORS_FILENAME-C0ZV0hh6.mjs";import ua from"./discoverNondeterministicCalls-ZeZDQJAI.mjs";import{discoverNotifyConfig as fa,discoverNotifyCalls as pa}from"./ALL_NOTIFY_CHANNELS-BgkkvuUe.mjs";import ga from"./discoverR2sqlCalls-D_HWbbky.mjs";import ma from"./discoverRlsProcedures-BbSdCvmA.mjs";import{s as Ss,n as ha}from"./dispatch-namespace-DwTjD7BU.mjs";import{secretKindOf as va,redact as Ea,isHeuristicSecretKind as xa,isSecretishName as Sa}from"./redact-Cy14LEnc.mjs";import{r as bi,p as ya,c as Aa,a as ba,e as Na,d as wa}from"./project-config-file-DR7xrrNB.mjs";import{a as Je,d as Pa,r as Ia}from"./modules-DdOd-7Wp.mjs";import{WORKFLOWS_FILENAME as Ta,discoverWorkflows as Ca}from"./WORKFLOWS_FILENAME-7FysJsMZ.mjs";import{r as Oa}from"./json-data-Chfs2Cz5.mjs";import{a as ka,I as Ra,g as La,G as Ni,d as Fa,i as Da}from"./shared-Cn7dMQ_u.mjs";import{createCodegenProject as _a}from"./createCodegenProject-dC6oJh5H.mjs";import{findTsconfig as MS,refreshCodegenProject as $S,tsconfigFingerprint as KS}from"./createCodegenProject-dC6oJh5H.mjs";import{wranglerString as Ma,wranglerValue as $a,companionName as Ka,COMPANION_FILES as za}from"./COMPANION_BINDING-Da_v9XpC.mjs";import{CAPABILITIES as Ba,usedCapabilities as Va}from"./CAPABILITY_PROBES-DCzOjTN7.mjs";import{isD1GlobalTable as wi,isHyperdriveGlobalTable as Pi}from"./isD1GlobalTable-udvHAAzD.mjs";import{discoverAgents as Ua}from"./AGENTS_FILENAME-C4tHmiZZ.mjs";import{discoverContainers as Wa}from"./CONTAINERS_FILENAME-d3XTFcqV.mjs";import ja from"./discoverCrons-bT8F5GyL.mjs";import{discoverEnv as qa}from"./ENV_FILENAME-DJ11PXN5.mjs";import Ii from"./readPackageDependencies-RHhGiz0k.mjs";import{discoverQueueDeclarations as Ha}from"./QUEUES_FILENAME-DbuJZnrY.mjs";import{discoverSandboxUsage as Ga}from"./discoverSandboxUsage-Dgvv6F_7.mjs";import{resolveServiceBindings as Ya}from"./companionServiceBinding-BZjm486n.mjs";import Qa from"./discoverStorageRulesMetadata-DeBgC7po.mjs";import{resolveCodegenTarget as ke,gatePlatformFeatures as Xa,readTargetDiagnostics as Ja,vectorizeDimensionDiagnostics as Za,liveStreamsDeliveryAuthorizationDiagnostic as ec,socketRoutesDeliveryAuthorizationDiagnostic as tc,studioPlatformFor as sc,platformFeatureAvailable as nc,gateAdminTokenRevocation as ic}from"./DEFAULT_TARGET-CVYzxQ0y.mjs";import{i as rc}from"./schema-BgM8A3XV.mjs";import{b as Ti,e as oc}from"./shard-CWAD5mYy.mjs";import{e as ac,a as cc}from"./server-Dfxmm5Zw.mjs";import{emitDataModel as lc}from"./emitDataModel-BvCZS4Yq.mjs";import{i as dc,b as uc,e as fc,d as pc,f as gc,c as mc}from"./unwrap-handler-return-DvbyiLjc.mjs";import hc from"./discoverHttpRoutes-CesuhqW1.mjs";import vc from"./discoverInserts-DIarYU2P.mjs";import{e as Ci}from"./exported-procedure-chains-CfH5jrzD.mjs";import Ec from"./discoverMigrations-C9AlZYFi.mjs";import on from"./discoverQueries-DLZHcDzB.mjs";import xc from"./discoverRlsMetadata-C0UkQkWd.mjs";import Sc from"./discoverSchema-BLTROO8Z.mjs";import{discoverShapes as yc}from"./SHAPES_FILENAME-DTJKanSz.mjs";import{i as Ac}from"./reserved-words-CW1QFbTd.mjs";import{emitAuthModule as bc,emitApp as Nc}from"./emitApp-LFKtDRYu.mjs";import{readJsonSync as wc}from"@visulima/fs";import{indexReferencesOf as Pc,buildSchemaSnapshot as Ic}from"./SchemaSnapshotParseError-CV7mmuPi.mjs";import{buildOpenApiDocument as Tc,emitOpenApiModule as Cc}from"./buildOpenApiDocument-DmV_PBFv.mjs";import{buildOpenRpcDocument as Oc,emitOpenRpcModule as kc}from"./OPENRPC_VERSION-BOBo0zdQ.mjs";import{w as Rc,u as Lc,v as Fc,t as Dc,x as _c}from"./shard-runtime-G5mZQjY0.mjs";import{emitCollections as Mc,emitSeed as $c,emitApi as Kc,emitInternalApi as zc}from"./emitApi-lwadq5G7.mjs";import{emitCrons as Bc,emitScheduler as Vc,emitAdminRevocations as Uc,emitShardRegistry as Wc,emitDurableObjects as jc,emitVectors as qc,emitWranglerCronTriggers as Hc}from"./emitCrons-CCRKs482.mjs";import Gc from"./emitDrizzleSchema-BzOChEYW.mjs";import{LAZY_FUNCTION_DIRECTORY as Oi,emitFunctions as Yc,emitLazyFunctionModules as Qc}from"./emitFunctions-ppMX7E3X.mjs";const Xc=(e,t=!1)=>{if(e.length===0)return"";const s=Fa(t),n=e.map(c=>{if(ka(c.exportName,"live stream export name"),!Ra.test(c.filePath))throw new Error(`@lunora/codegen: live stream file path is not safe to import: ${JSON.stringify(c.filePath)}`);return`import type { ${c.exportName} as ${c.exportName}Stream } from "../${c.filePath}.js";`}),i=e.map(c=>{const l=c.topics.map(u=>{La(u.name,"live topic name");const f=`(typeof ${c.exportName}Stream)["topics"]["${u.name}"]`,p=`LiveTopicRef<LiveTopicPayload<${f}>>`,g=JSON.stringify(c.id);if(u.fields.length===0)return` ${u.name}: (): ${p} => ({ __lunoraLive: ${g}, topic: ${JSON.stringify(u.name)} }),`;const h=u.fields.map(x=>`\${encodeURIComponent(key.${x})}`).join(":");return` ${u.name}: (key: LiveTopicKey<${f}>): ${p} => ({
|
|
2
2
|
__lunoraLive: ${g},
|
|
3
3
|
topic: \`${u.name}:${h}\`,
|
|
4
4
|
}),`});return` ${c.exportName}: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{existsSync as d}from"node:fs";import{join as l}from"node:path";import{SyntaxKind as m,Node as n}from"ts-morph";import{diagnosticAt as g}from"./CodegenDiagnosticError-BUXlG3P-.mjs";import{a as u}from"./module-specifiers-BctA0m_p.mjs";import{p as h}from"./parse-validator-BisfC8bR.mjs";import{declarationLineOf as x,findObjectProperty as c}from"./isTestPath-Uwb5a6Kq.mjs";import{a as S}from"./attribution-Cwt30DDJ.mjs";import{m as f}from"./ip-reads-
|
|
1
|
+
import{existsSync as d}from"node:fs";import{join as l}from"node:path";import{SyntaxKind as m,Node as n}from"ts-morph";import{diagnosticAt as g}from"./CodegenDiagnosticError-BUXlG3P-.mjs";import{a as u}from"./module-specifiers-BctA0m_p.mjs";import{p as h}from"./parse-validator-BisfC8bR.mjs";import{declarationLineOf as x,findObjectProperty as c}from"./isTestPath-Uwb5a6Kq.mjs";import{a as S}from"./attribution-Cwt30DDJ.mjs";import{m as f}from"./ip-reads-By7tJdyu.mjs";const b="shapes.ts",y=r=>{const t=r.getSymbol();if(!t)return r.getText()==="defineShape";for(const e of t.getDeclarations())if(n.isImportSpecifier(e))return u(e.getImportDeclaration().getModuleSpecifierValue())?e.getNameNode().getText()==="defineShape":!1;return!1},I=r=>{const t=r.getSymbol();if(!t)return!1;for(const e of t.getDeclarations()){if(!n.isNamespaceImport(e))continue;const i=e.getFirstAncestorByKind(m.ImportDeclaration);return i!==void 0&&u(i.getModuleSpecifierValue())}return!1},N=r=>{if(n.isIdentifier(r))return y(r);if(n.isPropertyAccessExpression(r)){const t=r.getExpression();return r.getName()==="defineShape"&&n.isIdentifier(t)&&I(t)}return!1},A=r=>{const[t]=r.getArguments();if(!t||!n.isObjectLiteralExpression(t))return;const e=c(t,"table");if(!e||!n.isPropertyAssignment(e))return;const i=e.getInitializer();return i&&n.isStringLiteral(i)?i.getLiteralValue():void 0},E=r=>{const[t]=r.getArguments();if(!t||!n.isObjectLiteralExpression(t))return{};const e=c(t,"args");if(!e||!n.isPropertyAssignment(e))return{};const i=e.getInitializer();return!i||!n.isObjectLiteralExpression(i)?{}:h(i)},P=r=>{const[t]=r.getArguments(),e=n.isObjectLiteralExpression(t)?c(t,"where"):void 0,i=n.isPropertyAssignment(e)?e.getInitializer():void 0;if(e===void 0)return f(r);if(!n.isArrowFunction(i)&&!n.isFunctionExpression(i))return!0;const o=i.getParameters()[0]?.getNameNode();return n.isIdentifier(o)&&o.getText()!=="ctx"&&o.findReferencesAsNodes().length>0||f(r)},v=r=>{const t=[];for(const e of r.getVariableDeclarations()){const i=e.getInitializer();if(i?.getKind()!==m.CallExpression)continue;const o=i,s=o.getExpression();if(!N(s))continue;const a=e.getNameNode();if(!n.isIdentifier(a)){if(e.getVariableStatement()?.hasExportKeyword()!==!0)continue;throw g(a,"defineShape exports must be plain named exports (no destructuring)")}const p=S(e,"binding");p!==void 0&&t.push({args:E(o),exportName:p,filePath:"shapes",line:x(e),...P(o)?{readsIp:!0}:{},table:A(o)})}return t},K=(r,t)=>{const e=l(t,b);if(!d(e))return[];const i=r.getSourceFile(e)??r.addSourceFileAtPath(e),o=v(i);return o.sort((s,a)=>s.exportName.localeCompare(a.exportName)),o};export{b as SHAPES_FILENAME,K as discoverShapes};
|
package/dist/packem_shared/{discoverFunctions-BNqI2S6a.mjs → discoverFunctions-CGrAezsY.mjs}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./declared-output-Iaar469J.mjs";import"./isTestPath-Uwb5a6Kq.mjs";import"./attribution-Cwt30DDJ.mjs";import"./unwrap-handler-return-DvbyiLjc.mjs";import"./ip-reads-
|
|
1
|
+
import"./declared-output-Iaar469J.mjs";import"./isTestPath-Uwb5a6Kq.mjs";import"./attribution-Cwt30DDJ.mjs";import"./unwrap-handler-return-DvbyiLjc.mjs";import"./ip-reads-By7tJdyu.mjs";import"./classify-procedure-call-BmEirzc_.mjs";import{d as f}from"./index-M4HwQ4Jr.mjs";import"./dispatch-namespace-DwTjD7BU.mjs";export{f as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{LunoraError as g}from"@lunora/errors";import{Node as s,SyntaxKind as B}from"ts-morph";import{d as z}from"./declared-output-Iaar469J.mjs";import{findObjectProperty as h,bindingKeyName as H,listLunoraSourceFiles as M,lunoraRelativePath as W}from"./isTestPath-Uwb5a6Kq.mjs";import{e as K,i as O}from"./attribution-Cwt30DDJ.mjs";import{u as R,p as q,r as Y,c as w,a as G}from"./unwrap-handler-return-DvbyiLjc.mjs";import{m as J}from"./ip-reads-D4nRZgML.mjs";import{b as L,s as X,c as Q}from"./classify-procedure-call-BmEirzc_.mjs";import{r as D,p as C,a as Z}from"./parse-validator-BisfC8bR.mjs";import{N as ee,l as te}from"./project-config-file-DR7xrrNB.mjs";import{s as ie}from"./dispatch-namespace-DwTjD7BU.mjs";const I=e=>e!==void 0&&(s.isArrowFunction(e)||s.isFunctionExpression(e))?e:void 0,ne=e=>{const i=e.getArguments()[0],t=I(i);if(t!==void 0)return t;if(i===void 0||!s.isObjectLiteralExpression(i))return;const n=h(i,"handler");return n!==void 0&&s.isPropertyAssignment(n)?I(n.getInitializer()):void 0},re=e=>{const i=e.getArguments()[0];if(!i||!s.isObjectLiteralExpression(i))return"unknown";const t=h(i,"handler");if(!t||!s.isPropertyAssignment(t))return"unknown";const n=t.getInitializer();return!n||!(s.isArrowFunction(n)||s.isFunctionExpression(n))?"unknown":R(n)},oe=e=>{const i=e.getArguments()[0];return!i||!(s.isArrowFunction(i)||s.isFunctionExpression(i))?"unknown":R(i)},se=e=>{let i={};for(const t of L(e)){if(t.name!=="input")continue;const n=t.call.getArguments()[0],o=n!==void 0&&s.isExpression(n)?D(n):void 0;o!==void 0&&(i={...C(o),...i})}return i},ae=e=>{const i=L(e).find(n=>n.name==="output");if(!i)return;const t=i.call.getArguments()[0];return t&&s.isExpression(t)?q(i.call,()=>Z(t)):void 0},E=(e,i)=>{const t=h(e,i);if(t===void 0||!s.isPropertyAssignment(t))return;const n=t.getInitializer();return n!==void 0&&s.isStringLiteral(n)?n.getLiteralValue():void 0},k=(e,i)=>{const t=h(e,i);if(t===void 0||!s.isPropertyAssignment(t))return;const n=t.getInitializer();return n!==void 0&&s.isNumericLiteral(n)?n.getLiteralValue():void 0},ce=e=>{const i=h(e,"cache");if(i===void 0||!s.isPropertyAssignment(i))return;const t=i.getInitializer();if(t===void 0||!s.isObjectLiteralExpression(t))return;const n=E(t,"scope"),o=k(t,"maxAge"),r=k(t,"staleWhileRevalidate"),a=E(t,"tag"),c=E(t,"vary"),l={...o===void 0?{}:{maxAge:o},...n==="private"||n==="public"?{scope:n}:{},...r===void 0?{}:{staleWhileRevalidate:r},...a===void 0?{}:{tag:a},...c===void 0?{}:{vary:c}};return Object.keys(l).length===0?void 0:l},le=e=>{if(e===void 0||!s.isObjectLiteralExpression(e))return{};const i=ce(e),t=h(e,"rest");return t!==void 0&&s.isPropertyAssignment(t)?{...i===void 0?{}:{cache:i},rest:t.getInitializer()?.getText()==="true"}:i===void 0?{}:{cache:i}},ue=e=>{const i=L(e).find(t=>t.name==="expose");return i?le(i.call.getArguments()[0]):void 0},de=e=>{const i=L(e).find(r=>r.name==="x402");if(!i)return;const t=i.call.getArguments()[0];if(t===void 0||!s.isObjectLiteralExpression(t))return{};const n=h(t,"price");if(n===void 0||!s.isPropertyAssignment(n))return{};const o=n.getInitializer();return o===void 0?{}:s.isStringLiteral(o)?{price:o.getLiteralValue()}:s.isNumericLiteral(o)?{price:o.getLiteralValue()}:{}},ge=e=>{const i=e.getArguments()[0];if(!i||!s.isObjectLiteralExpression(i))return{};const t=h(i,"args");if(!t||!s.isPropertyAssignment(t))return{};const n=t.getInitializer(),o=n===void 0?void 0:D(n);return o===void 0?{}:C(o)},f=(e,i)=>{throw new g("INTERNAL",`@lunora/codegen: lazy function registry needs literal ${i} in ${e.getSourceFile().getFilePath()}:${String(e.getStartLineNumber())}`)},S=(e,i,t)=>{if(!e||!s.isObjectLiteralExpression(e))return f(i,"metadata objects");const n=new Set;for(const o of e.getProperties()){if(!s.isPropertyAssignment(o))return f(o,"metadata fields without spreads, getters, or shorthand");const r=o.getNameNode(),a=s.isStringLiteral(r)?r.getLiteralValue():r.getText();if(!s.isIdentifier(r)&&!s.isStringLiteral(r)||!t.includes(a)||n.has(a))return f(o,"supported, unique metadata fields");n.add(a)}return e},y=(e,i)=>{const t=e.getProperty(i);return t&&s.isPropertyAssignment(t)?t.getInitializer():void 0},pe=e=>{const i=S(e,e,["credentialHeaders","maxAge","scope","staleWhileRevalidate","tag","vary"]),t={};for(const r of["maxAge","staleWhileRevalidate"]){const a=y(i,r);if(!(a===void 0&&r!=="maxAge")){if(!a||!s.isNumericLiteral(a))return f(e,`cache.${r}`);t[r]=a.getLiteralValue()}}const n=y(i,"scope");if(!n||!s.isStringLiteral(n)||!["private","public"].includes(n.getLiteralValue()))return f(e,"cache.scope");t.scope=n.getLiteralValue();for(const r of["tag","vary"]){const a=y(i,r);if(a!==void 0){if(!s.isStringLiteral(a))return f(a,`cache.${r}`);t[r]=a.getLiteralValue()}}const o=y(i,"credentialHeaders");if(o!==void 0){if(!s.isArrayLiteralExpression(o))return f(o,"cache.credentialHeaders");t.credentialHeaders=o.getElements().map(r=>s.isStringLiteral(r)?r.getLiteralValue():f(r,"cache.credentialHeaders string entries"))}return t},fe=e=>{const i=S(e.getArguments()[0],e,["rest","cache"]),t=y(i,"rest"),n=y(i,"cache");return t!==void 0&&!s.isTrueLiteral(t)&&!s.isFalseLiteral(t)?f(t,".expose({ rest })"):{...t?{rest:s.isTrueLiteral(t)}:{},...n?{cache:pe(n)}:{}}},me=e=>{const i=S(e.getArguments()[0],e,["price"]),t=y(i,"price");return!t||!s.isStringLiteral(t)&&!s.isNumericLiteral(t)?f(e,"`.x402({ price })` value"):{price:t.getLiteralValue()}},he=e=>{const i=e.map(o=>{const r=o.getArguments()[0];return r===void 0?ee:te(r)}),t=i.every(o=>o!==null&&typeof o=="object"&&!Array.isArray(o)),n=i.reduce((o,r)=>({...r,...o}),{});return t?n:"unloaded"},ye=e=>{const{factory:i,steps:t}=X(e);if(!i)return f(e,"metadata from a resolvable Lunora factory root");const n={visibility:i.startsWith("internal")?"internal":"public"};for(const{call:r,name:a}of t){if(!["expose","input","meta","output","use","x402"].includes(a))return f(r,`known builder modifiers, got .${a}()`);a==="expose"&&n.expose===void 0&&(n.expose=fe(r)),a==="x402"&&n.x402===void 0&&(n.x402=me(r))}const o=t.filter(r=>r.name==="meta").map(r=>r.call);return o.length===0?n:{...n,meta:he(o)}},ve=new Set(["action","mutation","query","stream"]),N=(e,i,t)=>{const n=e.getProperty(i)?.getTypeAtLocation(t);if(n===void 0)return;const o=n.isUnion()?n.getUnionTypes().filter(a=>!a.isUndefined()):[n],r=o.length===1?o[0]?.getLiteralValue():void 0;return typeof r=="string"?r:void 0},U=(e,i)=>{const t=N(e,"kind",i);return t!==void 0&&ve.has(t)&&e.getProperty("handler")!==void 0?t:void 0},be=e=>{const i=e.getParent();if(s.isPropertyAccessExpression(i)&&i.getExpression()===e)return i.getName()==="functions";if(s.isElementAccessExpression(i)&&i.getExpression()===e){const n=i.getArgumentExpression();return n!==void 0&&s.isStringLiteral(n)&&n.getLiteralValue()==="functions"}const t=s.isVariableDeclaration(i)&&i.getNameNode()!==e?i.getNameNode():void 0;return t!==void 0&&s.isObjectBindingPattern(t)&&t.getElements().some(n=>(n.getPropertyNameNode()?.getText()??n.getName())==="functions")},it=(e,i)=>{for(const t of e)for(const n of t.getVariableDeclarations()){const o=n.getNameNode();if(!n.isExported()||!s.isIdentifier(o))continue;const a=(n.getType().getProperty("functions")?.getTypeAtLocation(n)?.getProperties()??[]).filter(u=>U(u.getTypeAtLocation(n),n)!==void 0);if(a.length===0||o.findReferencesAsNodes().some(u=>be(u)))continue;const l=n.getName(),d=a.map(u=>u.getName()).join(", ");console.warn(`@lunora/codegen: ${i(t)}:${l} ships functions (${d}) that nothing re-exports, so none is in the generated api. Add \`export const { ${d} } = ${l}.functions;\` (or export your own wrappers of them).`)}},Ne=new Set(["connect","disconnect","init","reactor","whisper"]),Le={ArrayBuffer:"bytes",GeoPoint:"geoPoint"},Ae=8,P=(e,i)=>{const t=e.getText(i);return t===""?{kind:"from"}:{kind:"from",tsType:t}},Ee=new Set(["false","true"]),Pe=[[e=>e.isAny()||e.isUnknown(),"any"],[e=>e.isString(),"string"],[e=>e.isNumber(),"number"],[e=>e.isBoolean(),"boolean"],[e=>e.isNull(),"null"],[e=>e.isBigInt(),"bigint"]],Te=(e,i,t)=>{if(!e.isObject()||e.isIntersection()||e.getCallSignatures().length>0||e.isClass())return;const n=e.getProperties();if(n.some(r=>r.getTypeAtLocation(i).getCallSignatures().length>0))return;const o=e.getStringIndexType();if(o!==void 0&&n.length===0)return{keyType:{kind:"string"},kind:"record",valueType:b(o,i,t+1)};if(!(o!==void 0||n.length===0))return{kind:"object",shape:Object.fromEntries(n.map(r=>[r.getName(),$(r.getTypeAtLocation(i),r.isOptional(),i,t+1)]))}},b=(e,i,t)=>{if(t>Ae)return P(e,i);const n=Pe.find(([a])=>a(e));if(n!==void 0)return{kind:n[1]};const o=Le[(e.getSymbol()??e.getAliasSymbol())?.getName()??""];if(o!==void 0)return{kind:o};if(e.isStringLiteral()||e.isNumberLiteral()||e.isBooleanLiteral()||e.isBigIntLiteral())return{kind:"literal",literalValue:e.getText(i),sensitive:!0};const r=e.isIntersection()?N(e,"__table",i):void 0;if(r!==void 0)return{kind:"id",tableName:r};if(e.isUnion())return F(e.getUnionTypes(),i,t);if(e.isArray()){const a=e.getArrayElementType();return a===void 0?P(e,i):{inner:b(a,i,t+1),kind:"array"}}return Te(e,i,t)??P(e,i)},F=(e,i,t)=>{const o=new Set(e.filter(l=>l.isBooleanLiteral()).map(l=>l.getText(i))).size===Ee.size,r=e.filter(l=>!(o&&l.isBooleanLiteral())).map(l=>b(l,i,t+1)),a=o?[...r,{kind:"boolean"}]:r,[c]=a;return a.length===1&&c!==void 0?c:{kind:"union",members:a}},$=(e,i,t,n)=>{const o=e.isUnion()?e.getUnionTypes():[e],r=o.filter(l=>!l.isUndefined());if(!i&&r.length===o.length)return b(e,t,n);if(r.length===0)return{inner:{kind:"any"},kind:"optional"};const[a]=r;return{inner:r.length===1&&a!==void 0?b(a,t,n):F(r,t,n),kind:"optional"}},xe=(e,i)=>{const t=e.getProperty("__type")?.getTypeAtLocation(i);if(t===void 0)return{kind:"from"};const n=(e.getSymbol()??e.getAliasSymbol())?.getName();return n==="TimestampColumnValidator"?{kind:"timestamp"}:n==="ObjectColumnValidator"&&t.getProperties().length===0?{kind:"object",shape:{}}:$(t,!1,i,0)},Se=new Set(["AsyncGenerator","AsyncIterable","AsyncIterableIterator"]),Oe=(e,i)=>{const t=e.getProperty("handler")?.getTypeAtLocation(i).getCallSignatures()[0]?.getReturnType();if(t===void 0)return[];if(Se.has((t.getSymbol()??t.getAliasSymbol())?.getName()??"")){const[n]=t.getTypeArguments();return n===void 0?[]:[n]}return(t.isUnion()?t.getUnionTypes():[t]).map(n=>n.getSymbol()?.getName()==="Promise"?n.getTypeArguments()[0]??n:n)},we=(e,i)=>{const t=[...new Set(e.map(n=>Y(n,i)))];return t.length===0||t.includes("unknown")?"unknown":t.join(" | ")},Ie=(e,i,t,n)=>{const o=e.getType(),r=U(o,e);if(r===void 0)return;const a={...n?{description:n}:{},exportName:i,filePath:t,kind:r};if(o.getProperty("channel")?.isOptional()===!1)throw new g("PUBLISHED_FUNCTION_UNSUPPORTED",`${t}:${i} re-exports a room from a published package; its name is not in the declared type, so codegen cannot route it. Declare the room with \`defineRoom\` in this file instead.`);const c=N(o,"lifecycle",e),l=o.getProperty("lifecycle");if(c===void 0&&l!==void 0&&!l.isOptional())throw new g("PUBLISHED_FUNCTION_UNSUPPORTED",`${t}:${i} re-exports a lifecycle hook from a published package whose type does not say which moment it runs at. Declare it with its moment, e.g. \`RegisteredLifecycleHook & { readonly lifecycle: "disconnect" }\` (what \`onDisconnect\` returns).`);if(c!==void 0){if(!Ne.has(c))throw new g("PUBLISHED_FUNCTION_UNSUPPORTED",`${t}:${i} re-exports a "${c}" lifecycle hook from a published package; only a locally declared hook can carry its route. Declare it in this file instead.`);return{...a,args:{},lifecycle:c,returnType:"void",visibility:"internal"}}const d=N(o,"visibility",e);if(d!=="internal"&&d!=="public")throw new g("PUBLISHED_FUNCTION_VISIBILITY_UNKNOWN",`${t}:${i} re-exports a function from a published package whose type does not say whether it is internal or public. Declare it in that package as \`RegisteredQuery\` / \`RegisteredMutation\` / \`RegisteredAction\` (public) or their \`RegisteredInternal*\` counterparts, not the bare \`RegisteredFunction\`, so codegen does not list an internal function in the client \`api\`.`);if(d==="internal"&&o.getProperty("visibility")?.isOptional()!==!1)throw new g("PUBLISHED_FUNCTION_UNSUPPORTED",`${t}:${i} re-exports an internal function from a published package whose type makes \`visibility\` optional, so the value may not carry it. Declare it with a \`RegisteredInternal*\` type, which requires \`visibility: "internal"\`.`);const u=o.getProperty("args")?.getTypeAtLocation(e);if(u===void 0||u.isAny()||u.isUnknown()||u.getStringIndexType()!==void 0||u.getNumberIndexType()!==void 0)throw new g("PUBLISHED_FUNCTION_UNSUPPORTED",`${t}:${i} re-exports a function from a published package whose type does not list its arguments. Declare its validator map with one key per argument (an empty \`{}\` for none) so codegen can type the client call.`);const m=Object.fromEntries(u.getProperties().map(p=>[p.getName(),xe(p.getTypeAtLocation(e),e)]));return{...a,args:m,...r==="query"?{readsIp:!0}:{},returnType:we(Oe(o,e),e),typeDerivedArgs:!0,visibility:d}},ke=8,A=(e,i=0)=>{if(i>ke)return;if(s.isCallExpression(e))return{call:e};if(s.isParenthesizedExpression(e)||s.isAsExpression(e)||s.isSatisfiesExpression(e)||s.isNonNullExpression(e))return A(e.getExpression(),i+1);if(!s.isIdentifier(e)&&!s.isPropertyAccessExpression(e))return;const t=e.getSymbol()?.getValueDeclaration();return t?T(t,i+1):void 0},T=(e,i)=>{if(s.isVariableDeclaration(e)||s.isPropertyAssignment(e)){const t=e.getInitializer();return t?A(t,i):{deadEnd:e}}if(s.isShorthandPropertyAssignment(e)){const t=e.getValueSymbol()?.getValueDeclaration();return t?T(t,i+1):void 0}if(s.isBindingElement(e)){const t=H(e),r=e.getFirstAncestorByKind(B.VariableDeclaration)?.getInitializer()?.getType().getProperty(t)?.getValueDeclaration();return r?T(r,i+1):void 0}return{deadEnd:e}},x=e=>{const i=A(e);return i!==void 0&&"call"in i?i.call:void 0},_=e=>{const i=A(e);return i!==void 0&&"deadEnd"in i&&i.deadEnd.getSourceFile().isDeclarationFile()},_e=(e,i=()=>!0)=>{const t=e.getNameNode();if(s.isObjectBindingPattern(t)){const r=[];for(const a of t.getElements().filter(c=>i(c.getName()))){const c=x(a.getNameNode());c&&r.push([a.getName(),c])}return r}if(!i(e.getName()))return[];const n=e.getInitializer(),o=n&&(s.isCallExpression(n)?n:x(n));return o?[[e.getName(),o]]:[]},Re=(e,i)=>{const t=e.getNameNode();if(s.isObjectBindingPattern(t))return t.getElements().filter(o=>i(o.getName())&&_(o.getNameNode())).map(o=>[o.getName(),o.getNameNode()]);const n=e.getInitializer();return i(e.getName())&&n!==void 0&&_(n)?[[e.getName(),t]]:[]},De=e=>{const i=e.getArguments()[0],t=s.isObjectLiteralExpression(i)?i.getProperty("name"):void 0,n=s.isPropertyAssignment(t)?t.getInitializer():void 0;if(!n||!s.isStringLiteral(n))throw new g("ROOM_NAME_NOT_LITERAL",'defineRoom needs a string-literal `name` (e.g. `defineRoom({ name: "chat", … })`) so codegen can type its reference.');return n.getLiteralValue()},Ce=e=>e.startsWith("/")&&new URL(e,"https://lunora.invalid").pathname===e&&e!=="/_lunora"&&!e.startsWith("/_lunora/"),Ue=e=>{const i=e.getArguments()[0];if(!s.isObjectLiteralExpression(i))throw new g("SOCKET_PATH_NOT_LITERAL","defineWebSocket needs an object-literal options argument so codegen can read its `path` and `auth`.");const t=i.getProperty("path"),n=s.isPropertyAssignment(t)?t.getInitializer():void 0;if(!n||!s.isStringLiteral(n))throw new g("SOCKET_PATH_NOT_LITERAL",'defineWebSocket needs a string-literal `path` (e.g. `defineWebSocket({ path: "/chat", … })`) so codegen can route its upgrade.');const o=n.getLiteralValue();if(!Ce(o))throw new g("SOCKET_PATH_INVALID",`defineWebSocket path "${o}" must be a plain URL path starting with "/" (no "?", "#", ".." or unencoded characters) and not under "/_lunora".`);if(i.getProperties().some(l=>s.isSpreadAssignment(l)||s.isPropertyAssignment(l)&&s.isComputedPropertyName(l.getNameNode())))throw new g("SOCKET_AUTH_NOT_LITERAL","defineWebSocket cannot spread its options or use a computed key: codegen must read `auth` as a literal `auth: true` or `auth: false`.");const a=i.getProperty("auth");if(a===void 0)return{auth:!1,path:o};const c=s.isPropertyAssignment(a)?a.getInitializer():void 0;if(c===void 0||!(s.isTrueLiteral(c)||s.isFalseLiteral(c)))throw new g("SOCKET_AUTH_NOT_LITERAL","defineWebSocket needs a literal `auth: true` or `auth: false`, so codegen can read whether the route requires a session. A shorthand or a variable is not read.");return{auth:s.isTrueLiteral(c),path:o}},Fe=(e,i,t,n)=>{const o=n?ye(i):void 0,r=n?o?.expose:ue(i),a=n?o?.x402:de(i),c=w(()=>ae(i)),l=w(()=>oe(e)),d=z({kind:t.kind,output:c.value});return G(d?c.erased:l.erased),{args:se(i),...r?{expose:r}:{},...a?{x402:a}:{},...o?.meta===void 0?{}:{meta:o.meta},...t.adminOnly?{adminOnly:!0}:{},kind:t.kind,...c.value?{output:c.value}:{},returnType:l.value,visibility:o?.visibility==="internal"||t.visibility==="internal"?"internal":"public"}},$e=(e,i)=>{const t=Q(e,i);if(!t)return;if(t.channel)return{args:{},channel:{kind:t.channel,name:De(e)},kind:t.kind,returnType:"void",visibility:t.visibility};const{receiver:n}=t;return n?Fe(e,n,t,i):t.lifecycle?{args:{},kind:t.kind,lifecycle:t.lifecycle,returnType:"void",...t.lifecycle==="socket"?{socket:{...Ue(e),origin:`${e.getSourceFile().getFilePath()}@${String(e.getStart())}`}}:{},visibility:t.visibility}:{args:ge(e),kind:t.kind,returnType:re(e),visibility:t.visibility}},V=e=>{const i=e?.getJsDocs().at(-1)?.getDescription().trim();return i===""?void 0:i},Ve=e=>V(e.getFirstAncestor(i=>s.isVariableStatement(i))),je=e=>{const i=new Map;for(const t of e.getVariableStatements())if(t.isExported())for(const n of t.getDeclarations())i.has(n.getName())||i.set(n.getName(),t);return t=>V(i.get(t))},j=(e,i,t,n,o)=>{const r=$e(e,n);if(!r)return;const a=o??Ve(e);return{args:r.args,...a?{description:a}:{},exportName:i,filePath:t,kind:r.kind,returnType:r.returnType,...r.output?{output:r.output}:{},...r.meta===void 0?{}:{meta:r.meta},visibility:r.visibility,...r.adminOnly?{adminOnly:!0}:{},...r.kind==="query"&&(ne(e)===void 0||J(e))?{readsIp:!0}:{},...r.expose?{expose:r.expose}:{},...r.x402?{x402:r.x402}:{},...r.lifecycle?{lifecycle:r.lifecycle}:{},...r.channel?{channel:r.channel}:{},...r.socket?{socket:r.socket}:{}}},Be=(e,i,t)=>{const n=[];for(const o of e.getExportAssignments()){if(o.isExportEquals())continue;const r=x(o.getExpression()),a=r?j(r,"default",i,t):void 0;r&&a&&n.push({call:r,entry:a})}return n},ze=(e,i,t)=>{const n=K(e),o=je(e),r=new Map,a=(d,u)=>{if(d?.channel?.kind!=="room")return;const m=r.get(d.channel.name);if(m!==void 0&&m!==u)throw new g("DUPLICATE_ROOM_NAME",`Duplicate room name "${d.channel.name}" in ${i}: two defineRoom calls share it. Room names must be unique.`);r.set(d.channel.name,u)},c=e.getVariableStatements().flatMap(d=>d.getDeclarations()).flatMap(d=>_e(d,u=>n.has(u))).flatMap(([d,u])=>(n.get(d)??[]).filter(m=>O(m)).flatMap(m=>{const p=j(u,m,i,t,o(m));return a(p,u),p?[p]:[]})),l=new Set(c.map(d=>d.exportName));for(const d of e.getVariableStatements().flatMap(u=>u.getDeclarations()))for(const[u,m]of Re(d,p=>n.has(p)))for(const p of(n.get(u)??[]).filter(v=>O(v)&&!l.has(v))){const v=Ie(m,p,i,o(p));v&&(c.push(v),l.add(p))}for(const{call:d,entry:u}of Be(e,i,t))l.has(u.exportName)||(a(u,d),c.push(u));return c},He=e=>{const i=new Map;for(const t of e){if(t.channel?.kind!=="room")continue;const n=i.get(t.channel.name);if(n!==void 0&&n.file!==t.filePath)throw new g("DUPLICATE_ROOM_NAME",`Duplicate room name "${t.channel.name}": defined in ${n.origin} and ${t.filePath}:${t.exportName}. Room names must be unique across the project.`);n===void 0&&i.set(t.channel.name,{file:t.filePath,origin:`${t.filePath}:${t.exportName}`})}},Me=e=>{const i=new Map;for(const t of e){const n=ie(t.filePath),o=i.get(n);if(o&&o!==t.filePath)throw Object.assign(new Error(`Namespace collision: "${o}" and "${t.filePath}" both resolve to "${n}". Rename one of the files so the JS-identifier-sanitized names differ. (note: case-insensitive filesystems may also cause this — \`foo\` and \`FOO\` map to the same identifier)`),{code:"NAMESPACE_COLLISION",name:"LunoraError",paths:[o,t.filePath],status:500});i.set(n,t.filePath)}},nt=(e,i,t={})=>{const n=M(i),o=[];for(const r of n){const a=e.getSourceFile(r)??e.addSourceFileAtPath(r),c=W(i,r);o.push(...ze(a,c,t.lazyFunctions===!0))}return o.sort((r,a)=>`${r.filePath}:${r.exportName}`.localeCompare(`${a.filePath}:${a.exportName}`)),Me(o),He(o),o};export{nt as d,I as i,ne as p,it as w};
|
|
1
|
+
import{LunoraError as g}from"@lunora/errors";import{Node as s,SyntaxKind as B}from"ts-morph";import{d as z}from"./declared-output-Iaar469J.mjs";import{findObjectProperty as h,bindingKeyName as H,listLunoraSourceFiles as M,lunoraRelativePath as W}from"./isTestPath-Uwb5a6Kq.mjs";import{e as K,i as O}from"./attribution-Cwt30DDJ.mjs";import{u as R,p as q,r as Y,c as w,a as G}from"./unwrap-handler-return-DvbyiLjc.mjs";import{m as J}from"./ip-reads-By7tJdyu.mjs";import{b as L,s as X,c as Q}from"./classify-procedure-call-BmEirzc_.mjs";import{r as D,p as C,a as Z}from"./parse-validator-BisfC8bR.mjs";import{N as ee,l as te}from"./project-config-file-DR7xrrNB.mjs";import{s as ie}from"./dispatch-namespace-DwTjD7BU.mjs";const I=e=>e!==void 0&&(s.isArrowFunction(e)||s.isFunctionExpression(e))?e:void 0,ne=e=>{const i=e.getArguments()[0],t=I(i);if(t!==void 0)return t;if(i===void 0||!s.isObjectLiteralExpression(i))return;const n=h(i,"handler");return n!==void 0&&s.isPropertyAssignment(n)?I(n.getInitializer()):void 0},re=e=>{const i=e.getArguments()[0];if(!i||!s.isObjectLiteralExpression(i))return"unknown";const t=h(i,"handler");if(!t||!s.isPropertyAssignment(t))return"unknown";const n=t.getInitializer();return!n||!(s.isArrowFunction(n)||s.isFunctionExpression(n))?"unknown":R(n)},oe=e=>{const i=e.getArguments()[0];return!i||!(s.isArrowFunction(i)||s.isFunctionExpression(i))?"unknown":R(i)},se=e=>{let i={};for(const t of L(e)){if(t.name!=="input")continue;const n=t.call.getArguments()[0],o=n!==void 0&&s.isExpression(n)?D(n):void 0;o!==void 0&&(i={...C(o),...i})}return i},ae=e=>{const i=L(e).find(n=>n.name==="output");if(!i)return;const t=i.call.getArguments()[0];return t&&s.isExpression(t)?q(i.call,()=>Z(t)):void 0},E=(e,i)=>{const t=h(e,i);if(t===void 0||!s.isPropertyAssignment(t))return;const n=t.getInitializer();return n!==void 0&&s.isStringLiteral(n)?n.getLiteralValue():void 0},k=(e,i)=>{const t=h(e,i);if(t===void 0||!s.isPropertyAssignment(t))return;const n=t.getInitializer();return n!==void 0&&s.isNumericLiteral(n)?n.getLiteralValue():void 0},ce=e=>{const i=h(e,"cache");if(i===void 0||!s.isPropertyAssignment(i))return;const t=i.getInitializer();if(t===void 0||!s.isObjectLiteralExpression(t))return;const n=E(t,"scope"),o=k(t,"maxAge"),r=k(t,"staleWhileRevalidate"),a=E(t,"tag"),c=E(t,"vary"),l={...o===void 0?{}:{maxAge:o},...n==="private"||n==="public"?{scope:n}:{},...r===void 0?{}:{staleWhileRevalidate:r},...a===void 0?{}:{tag:a},...c===void 0?{}:{vary:c}};return Object.keys(l).length===0?void 0:l},le=e=>{if(e===void 0||!s.isObjectLiteralExpression(e))return{};const i=ce(e),t=h(e,"rest");return t!==void 0&&s.isPropertyAssignment(t)?{...i===void 0?{}:{cache:i},rest:t.getInitializer()?.getText()==="true"}:i===void 0?{}:{cache:i}},ue=e=>{const i=L(e).find(t=>t.name==="expose");return i?le(i.call.getArguments()[0]):void 0},de=e=>{const i=L(e).find(r=>r.name==="x402");if(!i)return;const t=i.call.getArguments()[0];if(t===void 0||!s.isObjectLiteralExpression(t))return{};const n=h(t,"price");if(n===void 0||!s.isPropertyAssignment(n))return{};const o=n.getInitializer();return o===void 0?{}:s.isStringLiteral(o)?{price:o.getLiteralValue()}:s.isNumericLiteral(o)?{price:o.getLiteralValue()}:{}},ge=e=>{const i=e.getArguments()[0];if(!i||!s.isObjectLiteralExpression(i))return{};const t=h(i,"args");if(!t||!s.isPropertyAssignment(t))return{};const n=t.getInitializer(),o=n===void 0?void 0:D(n);return o===void 0?{}:C(o)},f=(e,i)=>{throw new g("INTERNAL",`@lunora/codegen: lazy function registry needs literal ${i} in ${e.getSourceFile().getFilePath()}:${String(e.getStartLineNumber())}`)},S=(e,i,t)=>{if(!e||!s.isObjectLiteralExpression(e))return f(i,"metadata objects");const n=new Set;for(const o of e.getProperties()){if(!s.isPropertyAssignment(o))return f(o,"metadata fields without spreads, getters, or shorthand");const r=o.getNameNode(),a=s.isStringLiteral(r)?r.getLiteralValue():r.getText();if(!s.isIdentifier(r)&&!s.isStringLiteral(r)||!t.includes(a)||n.has(a))return f(o,"supported, unique metadata fields");n.add(a)}return e},y=(e,i)=>{const t=e.getProperty(i);return t&&s.isPropertyAssignment(t)?t.getInitializer():void 0},pe=e=>{const i=S(e,e,["credentialHeaders","maxAge","scope","staleWhileRevalidate","tag","vary"]),t={};for(const r of["maxAge","staleWhileRevalidate"]){const a=y(i,r);if(!(a===void 0&&r!=="maxAge")){if(!a||!s.isNumericLiteral(a))return f(e,`cache.${r}`);t[r]=a.getLiteralValue()}}const n=y(i,"scope");if(!n||!s.isStringLiteral(n)||!["private","public"].includes(n.getLiteralValue()))return f(e,"cache.scope");t.scope=n.getLiteralValue();for(const r of["tag","vary"]){const a=y(i,r);if(a!==void 0){if(!s.isStringLiteral(a))return f(a,`cache.${r}`);t[r]=a.getLiteralValue()}}const o=y(i,"credentialHeaders");if(o!==void 0){if(!s.isArrayLiteralExpression(o))return f(o,"cache.credentialHeaders");t.credentialHeaders=o.getElements().map(r=>s.isStringLiteral(r)?r.getLiteralValue():f(r,"cache.credentialHeaders string entries"))}return t},fe=e=>{const i=S(e.getArguments()[0],e,["rest","cache"]),t=y(i,"rest"),n=y(i,"cache");return t!==void 0&&!s.isTrueLiteral(t)&&!s.isFalseLiteral(t)?f(t,".expose({ rest })"):{...t?{rest:s.isTrueLiteral(t)}:{},...n?{cache:pe(n)}:{}}},me=e=>{const i=S(e.getArguments()[0],e,["price"]),t=y(i,"price");return!t||!s.isStringLiteral(t)&&!s.isNumericLiteral(t)?f(e,"`.x402({ price })` value"):{price:t.getLiteralValue()}},he=e=>{const i=e.map(o=>{const r=o.getArguments()[0];return r===void 0?ee:te(r)}),t=i.every(o=>o!==null&&typeof o=="object"&&!Array.isArray(o)),n=i.reduce((o,r)=>({...r,...o}),{});return t?n:"unloaded"},ye=e=>{const{factory:i,steps:t}=X(e);if(!i)return f(e,"metadata from a resolvable Lunora factory root");const n={visibility:i.startsWith("internal")?"internal":"public"};for(const{call:r,name:a}of t){if(!["expose","input","meta","output","use","x402"].includes(a))return f(r,`known builder modifiers, got .${a}()`);a==="expose"&&n.expose===void 0&&(n.expose=fe(r)),a==="x402"&&n.x402===void 0&&(n.x402=me(r))}const o=t.filter(r=>r.name==="meta").map(r=>r.call);return o.length===0?n:{...n,meta:he(o)}},ve=new Set(["action","mutation","query","stream"]),N=(e,i,t)=>{const n=e.getProperty(i)?.getTypeAtLocation(t);if(n===void 0)return;const o=n.isUnion()?n.getUnionTypes().filter(a=>!a.isUndefined()):[n],r=o.length===1?o[0]?.getLiteralValue():void 0;return typeof r=="string"?r:void 0},U=(e,i)=>{const t=N(e,"kind",i);return t!==void 0&&ve.has(t)&&e.getProperty("handler")!==void 0?t:void 0},be=e=>{const i=e.getParent();if(s.isPropertyAccessExpression(i)&&i.getExpression()===e)return i.getName()==="functions";if(s.isElementAccessExpression(i)&&i.getExpression()===e){const n=i.getArgumentExpression();return n!==void 0&&s.isStringLiteral(n)&&n.getLiteralValue()==="functions"}const t=s.isVariableDeclaration(i)&&i.getNameNode()!==e?i.getNameNode():void 0;return t!==void 0&&s.isObjectBindingPattern(t)&&t.getElements().some(n=>(n.getPropertyNameNode()?.getText()??n.getName())==="functions")},it=(e,i)=>{for(const t of e)for(const n of t.getVariableDeclarations()){const o=n.getNameNode();if(!n.isExported()||!s.isIdentifier(o))continue;const a=(n.getType().getProperty("functions")?.getTypeAtLocation(n)?.getProperties()??[]).filter(u=>U(u.getTypeAtLocation(n),n)!==void 0);if(a.length===0||o.findReferencesAsNodes().some(u=>be(u)))continue;const l=n.getName(),d=a.map(u=>u.getName()).join(", ");console.warn(`@lunora/codegen: ${i(t)}:${l} ships functions (${d}) that nothing re-exports, so none is in the generated api. Add \`export const { ${d} } = ${l}.functions;\` (or export your own wrappers of them).`)}},Ne=new Set(["connect","disconnect","init","reactor","whisper"]),Le={ArrayBuffer:"bytes",GeoPoint:"geoPoint"},Ae=8,P=(e,i)=>{const t=e.getText(i);return t===""?{kind:"from"}:{kind:"from",tsType:t}},Ee=new Set(["false","true"]),Pe=[[e=>e.isAny()||e.isUnknown(),"any"],[e=>e.isString(),"string"],[e=>e.isNumber(),"number"],[e=>e.isBoolean(),"boolean"],[e=>e.isNull(),"null"],[e=>e.isBigInt(),"bigint"]],Te=(e,i,t)=>{if(!e.isObject()||e.isIntersection()||e.getCallSignatures().length>0||e.isClass())return;const n=e.getProperties();if(n.some(r=>r.getTypeAtLocation(i).getCallSignatures().length>0))return;const o=e.getStringIndexType();if(o!==void 0&&n.length===0)return{keyType:{kind:"string"},kind:"record",valueType:b(o,i,t+1)};if(!(o!==void 0||n.length===0))return{kind:"object",shape:Object.fromEntries(n.map(r=>[r.getName(),$(r.getTypeAtLocation(i),r.isOptional(),i,t+1)]))}},b=(e,i,t)=>{if(t>Ae)return P(e,i);const n=Pe.find(([a])=>a(e));if(n!==void 0)return{kind:n[1]};const o=Le[(e.getSymbol()??e.getAliasSymbol())?.getName()??""];if(o!==void 0)return{kind:o};if(e.isStringLiteral()||e.isNumberLiteral()||e.isBooleanLiteral()||e.isBigIntLiteral())return{kind:"literal",literalValue:e.getText(i),sensitive:!0};const r=e.isIntersection()?N(e,"__table",i):void 0;if(r!==void 0)return{kind:"id",tableName:r};if(e.isUnion())return F(e.getUnionTypes(),i,t);if(e.isArray()){const a=e.getArrayElementType();return a===void 0?P(e,i):{inner:b(a,i,t+1),kind:"array"}}return Te(e,i,t)??P(e,i)},F=(e,i,t)=>{const o=new Set(e.filter(l=>l.isBooleanLiteral()).map(l=>l.getText(i))).size===Ee.size,r=e.filter(l=>!(o&&l.isBooleanLiteral())).map(l=>b(l,i,t+1)),a=o?[...r,{kind:"boolean"}]:r,[c]=a;return a.length===1&&c!==void 0?c:{kind:"union",members:a}},$=(e,i,t,n)=>{const o=e.isUnion()?e.getUnionTypes():[e],r=o.filter(l=>!l.isUndefined());if(!i&&r.length===o.length)return b(e,t,n);if(r.length===0)return{inner:{kind:"any"},kind:"optional"};const[a]=r;return{inner:r.length===1&&a!==void 0?b(a,t,n):F(r,t,n),kind:"optional"}},xe=(e,i)=>{const t=e.getProperty("__type")?.getTypeAtLocation(i);if(t===void 0)return{kind:"from"};const n=(e.getSymbol()??e.getAliasSymbol())?.getName();return n==="TimestampColumnValidator"?{kind:"timestamp"}:n==="ObjectColumnValidator"&&t.getProperties().length===0?{kind:"object",shape:{}}:$(t,!1,i,0)},Se=new Set(["AsyncGenerator","AsyncIterable","AsyncIterableIterator"]),Oe=(e,i)=>{const t=e.getProperty("handler")?.getTypeAtLocation(i).getCallSignatures()[0]?.getReturnType();if(t===void 0)return[];if(Se.has((t.getSymbol()??t.getAliasSymbol())?.getName()??"")){const[n]=t.getTypeArguments();return n===void 0?[]:[n]}return(t.isUnion()?t.getUnionTypes():[t]).map(n=>n.getSymbol()?.getName()==="Promise"?n.getTypeArguments()[0]??n:n)},we=(e,i)=>{const t=[...new Set(e.map(n=>Y(n,i)))];return t.length===0||t.includes("unknown")?"unknown":t.join(" | ")},Ie=(e,i,t,n)=>{const o=e.getType(),r=U(o,e);if(r===void 0)return;const a={...n?{description:n}:{},exportName:i,filePath:t,kind:r};if(o.getProperty("channel")?.isOptional()===!1)throw new g("PUBLISHED_FUNCTION_UNSUPPORTED",`${t}:${i} re-exports a room from a published package; its name is not in the declared type, so codegen cannot route it. Declare the room with \`defineRoom\` in this file instead.`);const c=N(o,"lifecycle",e),l=o.getProperty("lifecycle");if(c===void 0&&l!==void 0&&!l.isOptional())throw new g("PUBLISHED_FUNCTION_UNSUPPORTED",`${t}:${i} re-exports a lifecycle hook from a published package whose type does not say which moment it runs at. Declare it with its moment, e.g. \`RegisteredLifecycleHook & { readonly lifecycle: "disconnect" }\` (what \`onDisconnect\` returns).`);if(c!==void 0){if(!Ne.has(c))throw new g("PUBLISHED_FUNCTION_UNSUPPORTED",`${t}:${i} re-exports a "${c}" lifecycle hook from a published package; only a locally declared hook can carry its route. Declare it in this file instead.`);return{...a,args:{},lifecycle:c,returnType:"void",visibility:"internal"}}const d=N(o,"visibility",e);if(d!=="internal"&&d!=="public")throw new g("PUBLISHED_FUNCTION_VISIBILITY_UNKNOWN",`${t}:${i} re-exports a function from a published package whose type does not say whether it is internal or public. Declare it in that package as \`RegisteredQuery\` / \`RegisteredMutation\` / \`RegisteredAction\` (public) or their \`RegisteredInternal*\` counterparts, not the bare \`RegisteredFunction\`, so codegen does not list an internal function in the client \`api\`.`);if(d==="internal"&&o.getProperty("visibility")?.isOptional()!==!1)throw new g("PUBLISHED_FUNCTION_UNSUPPORTED",`${t}:${i} re-exports an internal function from a published package whose type makes \`visibility\` optional, so the value may not carry it. Declare it with a \`RegisteredInternal*\` type, which requires \`visibility: "internal"\`.`);const u=o.getProperty("args")?.getTypeAtLocation(e);if(u===void 0||u.isAny()||u.isUnknown()||u.getStringIndexType()!==void 0||u.getNumberIndexType()!==void 0)throw new g("PUBLISHED_FUNCTION_UNSUPPORTED",`${t}:${i} re-exports a function from a published package whose type does not list its arguments. Declare its validator map with one key per argument (an empty \`{}\` for none) so codegen can type the client call.`);const m=Object.fromEntries(u.getProperties().map(p=>[p.getName(),xe(p.getTypeAtLocation(e),e)]));return{...a,args:m,...r==="query"?{readsIp:!0}:{},returnType:we(Oe(o,e),e),typeDerivedArgs:!0,visibility:d}},ke=8,A=(e,i=0)=>{if(i>ke)return;if(s.isCallExpression(e))return{call:e};if(s.isParenthesizedExpression(e)||s.isAsExpression(e)||s.isSatisfiesExpression(e)||s.isNonNullExpression(e))return A(e.getExpression(),i+1);if(!s.isIdentifier(e)&&!s.isPropertyAccessExpression(e))return;const t=e.getSymbol()?.getValueDeclaration();return t?T(t,i+1):void 0},T=(e,i)=>{if(s.isVariableDeclaration(e)||s.isPropertyAssignment(e)){const t=e.getInitializer();return t?A(t,i):{deadEnd:e}}if(s.isShorthandPropertyAssignment(e)){const t=e.getValueSymbol()?.getValueDeclaration();return t?T(t,i+1):void 0}if(s.isBindingElement(e)){const t=H(e),r=e.getFirstAncestorByKind(B.VariableDeclaration)?.getInitializer()?.getType().getProperty(t)?.getValueDeclaration();return r?T(r,i+1):void 0}return{deadEnd:e}},x=e=>{const i=A(e);return i!==void 0&&"call"in i?i.call:void 0},_=e=>{const i=A(e);return i!==void 0&&"deadEnd"in i&&i.deadEnd.getSourceFile().isDeclarationFile()},_e=(e,i=()=>!0)=>{const t=e.getNameNode();if(s.isObjectBindingPattern(t)){const r=[];for(const a of t.getElements().filter(c=>i(c.getName()))){const c=x(a.getNameNode());c&&r.push([a.getName(),c])}return r}if(!i(e.getName()))return[];const n=e.getInitializer(),o=n&&(s.isCallExpression(n)?n:x(n));return o?[[e.getName(),o]]:[]},Re=(e,i)=>{const t=e.getNameNode();if(s.isObjectBindingPattern(t))return t.getElements().filter(o=>i(o.getName())&&_(o.getNameNode())).map(o=>[o.getName(),o.getNameNode()]);const n=e.getInitializer();return i(e.getName())&&n!==void 0&&_(n)?[[e.getName(),t]]:[]},De=e=>{const i=e.getArguments()[0],t=s.isObjectLiteralExpression(i)?i.getProperty("name"):void 0,n=s.isPropertyAssignment(t)?t.getInitializer():void 0;if(!n||!s.isStringLiteral(n))throw new g("ROOM_NAME_NOT_LITERAL",'defineRoom needs a string-literal `name` (e.g. `defineRoom({ name: "chat", … })`) so codegen can type its reference.');return n.getLiteralValue()},Ce=e=>e.startsWith("/")&&new URL(e,"https://lunora.invalid").pathname===e&&e!=="/_lunora"&&!e.startsWith("/_lunora/"),Ue=e=>{const i=e.getArguments()[0];if(!s.isObjectLiteralExpression(i))throw new g("SOCKET_PATH_NOT_LITERAL","defineWebSocket needs an object-literal options argument so codegen can read its `path` and `auth`.");const t=i.getProperty("path"),n=s.isPropertyAssignment(t)?t.getInitializer():void 0;if(!n||!s.isStringLiteral(n))throw new g("SOCKET_PATH_NOT_LITERAL",'defineWebSocket needs a string-literal `path` (e.g. `defineWebSocket({ path: "/chat", … })`) so codegen can route its upgrade.');const o=n.getLiteralValue();if(!Ce(o))throw new g("SOCKET_PATH_INVALID",`defineWebSocket path "${o}" must be a plain URL path starting with "/" (no "?", "#", ".." or unencoded characters) and not under "/_lunora".`);if(i.getProperties().some(l=>s.isSpreadAssignment(l)||s.isPropertyAssignment(l)&&s.isComputedPropertyName(l.getNameNode())))throw new g("SOCKET_AUTH_NOT_LITERAL","defineWebSocket cannot spread its options or use a computed key: codegen must read `auth` as a literal `auth: true` or `auth: false`.");const a=i.getProperty("auth");if(a===void 0)return{auth:!1,path:o};const c=s.isPropertyAssignment(a)?a.getInitializer():void 0;if(c===void 0||!(s.isTrueLiteral(c)||s.isFalseLiteral(c)))throw new g("SOCKET_AUTH_NOT_LITERAL","defineWebSocket needs a literal `auth: true` or `auth: false`, so codegen can read whether the route requires a session. A shorthand or a variable is not read.");return{auth:s.isTrueLiteral(c),path:o}},Fe=(e,i,t,n)=>{const o=n?ye(i):void 0,r=n?o?.expose:ue(i),a=n?o?.x402:de(i),c=w(()=>ae(i)),l=w(()=>oe(e)),d=z({kind:t.kind,output:c.value});return G(d?c.erased:l.erased),{args:se(i),...r?{expose:r}:{},...a?{x402:a}:{},...o?.meta===void 0?{}:{meta:o.meta},...t.adminOnly?{adminOnly:!0}:{},kind:t.kind,...c.value?{output:c.value}:{},returnType:l.value,visibility:o?.visibility==="internal"||t.visibility==="internal"?"internal":"public"}},$e=(e,i)=>{const t=Q(e,i);if(!t)return;if(t.channel)return{args:{},channel:{kind:t.channel,name:De(e)},kind:t.kind,returnType:"void",visibility:t.visibility};const{receiver:n}=t;return n?Fe(e,n,t,i):t.lifecycle?{args:{},kind:t.kind,lifecycle:t.lifecycle,returnType:"void",...t.lifecycle==="socket"?{socket:{...Ue(e),origin:`${e.getSourceFile().getFilePath()}@${String(e.getStart())}`}}:{},visibility:t.visibility}:{args:ge(e),kind:t.kind,returnType:re(e),visibility:t.visibility}},V=e=>{const i=e?.getJsDocs().at(-1)?.getDescription().trim();return i===""?void 0:i},Ve=e=>V(e.getFirstAncestor(i=>s.isVariableStatement(i))),je=e=>{const i=new Map;for(const t of e.getVariableStatements())if(t.isExported())for(const n of t.getDeclarations())i.has(n.getName())||i.set(n.getName(),t);return t=>V(i.get(t))},j=(e,i,t,n,o)=>{const r=$e(e,n);if(!r)return;const a=o??Ve(e);return{args:r.args,...a?{description:a}:{},exportName:i,filePath:t,kind:r.kind,returnType:r.returnType,...r.output?{output:r.output}:{},...r.meta===void 0?{}:{meta:r.meta},visibility:r.visibility,...r.adminOnly?{adminOnly:!0}:{},...r.kind==="query"&&(ne(e)===void 0||J(e))?{readsIp:!0}:{},...r.expose?{expose:r.expose}:{},...r.x402?{x402:r.x402}:{},...r.lifecycle?{lifecycle:r.lifecycle}:{},...r.channel?{channel:r.channel}:{},...r.socket?{socket:r.socket}:{}}},Be=(e,i,t)=>{const n=[];for(const o of e.getExportAssignments()){if(o.isExportEquals())continue;const r=x(o.getExpression()),a=r?j(r,"default",i,t):void 0;r&&a&&n.push({call:r,entry:a})}return n},ze=(e,i,t)=>{const n=K(e),o=je(e),r=new Map,a=(d,u)=>{if(d?.channel?.kind!=="room")return;const m=r.get(d.channel.name);if(m!==void 0&&m!==u)throw new g("DUPLICATE_ROOM_NAME",`Duplicate room name "${d.channel.name}" in ${i}: two defineRoom calls share it. Room names must be unique.`);r.set(d.channel.name,u)},c=e.getVariableStatements().flatMap(d=>d.getDeclarations()).flatMap(d=>_e(d,u=>n.has(u))).flatMap(([d,u])=>(n.get(d)??[]).filter(m=>O(m)).flatMap(m=>{const p=j(u,m,i,t,o(m));return a(p,u),p?[p]:[]})),l=new Set(c.map(d=>d.exportName));for(const d of e.getVariableStatements().flatMap(u=>u.getDeclarations()))for(const[u,m]of Re(d,p=>n.has(p)))for(const p of(n.get(u)??[]).filter(v=>O(v)&&!l.has(v))){const v=Ie(m,p,i,o(p));v&&(c.push(v),l.add(p))}for(const{call:d,entry:u}of Be(e,i,t))l.has(u.exportName)||(a(u,d),c.push(u));return c},He=e=>{const i=new Map;for(const t of e){if(t.channel?.kind!=="room")continue;const n=i.get(t.channel.name);if(n!==void 0&&n.file!==t.filePath)throw new g("DUPLICATE_ROOM_NAME",`Duplicate room name "${t.channel.name}": defined in ${n.origin} and ${t.filePath}:${t.exportName}. Room names must be unique across the project.`);n===void 0&&i.set(t.channel.name,{file:t.filePath,origin:`${t.filePath}:${t.exportName}`})}},Me=e=>{const i=new Map;for(const t of e){const n=ie(t.filePath),o=i.get(n);if(o&&o!==t.filePath)throw Object.assign(new Error(`Namespace collision: "${o}" and "${t.filePath}" both resolve to "${n}". Rename one of the files so the JS-identifier-sanitized names differ. (note: case-insensitive filesystems may also cause this — \`foo\` and \`FOO\` map to the same identifier)`),{code:"NAMESPACE_COLLISION",name:"LunoraError",paths:[o,t.filePath],status:500});i.set(n,t.filePath)}},nt=(e,i,t={})=>{const n=M(i),o=[];for(const r of n){const a=e.getSourceFile(r)??e.addSourceFileAtPath(r),c=W(i,r);o.push(...ze(a,c,t.lazyFunctions===!0))}return o.sort((r,a)=>`${r.filePath}:${r.exportName}`.localeCompare(`${a.filePath}:${a.exportName}`)),Me(o),He(o),o};export{nt as d,I as i,ne as p,it as w};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Node as n,SyntaxKind as d,VariableDeclarationKind as we}from"ts-morph";import{isConstDeclaration as K,unwrapExpression as l,descendantsOfKind as Be,bindingKeyName as ue,findObjectProperty as Fe}from"./isTestPath-Uwb5a6Kq.mjs";import{r as Ce,b as V,d as p}from"./attribution-Cwt30DDJ.mjs";import{i as ae,r as j,c as m,a as Le}from"./context-root-BpDEhvNE.mjs";import{a as M,s as Z}from"./property-name-7cBlgK_O.mjs";const Re=e=>{const t=e.getText(),s=i=>{const r=i.getNameNode();return n.isIdentifier(r)&&r.getText()===t};for(const i of e.getAncestors())if(!(!n.isArrowFunction(i)&&!n.isFunctionExpression(i)&&!n.isFunctionDeclaration(i)))for(const r of i.getParameters()){const o=r.getDescendantsOfKind(d.BindingElement).find(a=>s(a));if(o!==void 0)return o}},ze=e=>{let t=e;for(;;){const s=t.getParent();if(!n.isObjectBindingPattern(s))return;const i=s.getParent();if(n.isBindingElement(i)){t=i;continue}return n.isParameterDeclaration(i)?ue(t):void 0}},ke=e=>{const t=e.getText();if(!e.getAncestors().some(o=>{const a=n.isFunctionLikeDeclaration(o)||n.isArrowFunction(o)?o.getParameters()[1]:void 0,c=a?.getNameNode();return a!==void 0&&(n.isIdentifier(c)?c.getText()===t:a.getDescendantsOfKind(d.BindingElement).some(u=>u.getName()===t))&&ae(a)}))return!1;const i=p(e),r=n.isParameterDeclaration(i)?i:i?.getFirstAncestorByKind(d.Parameter);return r!==void 0&&(n.isParameterDeclaration(i)||n.isBindingElement(i))&&ae(r)},ce=(e,t)=>{const s=e.getParent();if(n.isPropertyAccessExpression(s)&&s.getNameNode()===e||n.isPropertyAssignment(s)&&s.getNameNode()===e)return!1;if(e.getText()===t)return!0;const i=Re(e);return i!==void 0&&ze(i)===t?!0:t==="args"&&ke(e)},L=(e,t)=>n.isIdentifier(e)?ce(e,t):e.getDescendantsOfKind(d.Identifier).some(s=>ce(s,t)),Ke=e=>{let t=e;for(;n.isPropertyAccessExpression(t)||n.isElementAccessExpression(t)||n.isNonNullExpression(t);)t=t.getExpression();return n.isIdentifier(t)?t:void 0},f=e=>{const t=n.isIdentifier(e)?p(e):void 0;return n.isVariableDeclaration(t)&&n.isIdentifier(t.getNameNode())&&!V(t)?t.getInitializer():void 0},Ve=(e,t)=>{const s=e.getParent();if(n.isVariableDeclarationList(s)&&s.getDeclarationKind()===we.Var)return t;const i=s.getParent();return n.isVariableStatement(i)?i.getParent():i},Me=(e,t)=>{const s=e.getNameNode();return n.isIdentifier(s)?s.getText()===t:s.getDescendantsOfKind(d.BindingElement).some(i=>{const r=i.getNameNode();return n.isIdentifier(r)&&r.getText()===t})},J=e=>e.getDescendantsOfKind(d.Identifier).filter(t=>{const s=t.getParent();return!(n.isPropertyAccessExpression(s)&&s.getNameNode()===t)&&!(n.isPropertyAssignment(s)&&s.getNameNode()===t)}),O=e=>n.isIdentifier(e)?[e]:J(e),T=e=>{let t=e;for(;;){const s=t.getParent();if(!((n.isPropertyAccessExpression(s)||n.isElementAccessExpression(s)||n.isNonNullExpression(s))&&s.getExpression()===t))return t;t=s}},We=e=>{const t=e.getParent();return n.isCallExpression(t)&&t.getExpression()===e?t:void 0},_e=new Set(["find","findFirst","findFirstOrThrow","findMany","findUnique","first","get","unique"]),U=new Set(["findFirst","findUnique","first","get","unique"]),W=e=>{const t=e.getExpression();return n.isPropertyAccessExpression(t)&&_e.has(t.getName())&&m(t)?.[0]==="db"},I=(e,t)=>{for(let s=e,i=e.getParent();i!==void 0&&s!==t;s=i,i=i.getParent()){if(n.isConditionalExpression(i))return!0;if(n.isBinaryExpression(i)){const r=i.getOperatorToken().getKind();if(s===i.getRight()&&(r===d.QuestionQuestionToken||r===d.BarBarToken)||s===i.getLeft()&&r===d.AmpersandAmpersandToken)return!0}}return!1},ge=e=>O(e).some(t=>{if(I(t,e))return!1;if(m(T(t))?.[0]==="auth")return!0;const s=f(t);return s!==void 0&&O(s).some(i=>m(T(i))?.[0]==="auth"&&!I(i,s))}),je=e=>W(e)&&e.getArguments().some(t=>ge(t)),fe=(e,t)=>{for(let s=e.getParent();s!==void 0;s=s.getParent()){if(n.isCallExpression(s)&&m(s.getExpression())?.[0]==="db")return!0;if(s===t)return!1}return!1},qe=new Set(["_id","id"]),X=e=>{let t=e;for(let s=t.getParent();;s=t.getParent()){if(n.isAwaitExpression(s)||n.isParenthesizedExpression(s)||n.isNonNullExpression(s)||n.isAsExpression(s)||n.isSatisfiesExpression(s)||n.isTypeAssertion(s)){t=s;continue}if(n.isPropertyAccessExpression(s)&&s.getExpression()===t)return{field:s.getName(),read:s};if(n.isElementAccessExpression(s)&&s.getExpression()===t){const i=l(s.getArgumentExpression());return{field:n.isStringLiteral(i)||n.isNoSubstitutionTemplateLiteral(i)?i.getLiteralValue():void 0,read:s}}return{field:void 0,read:t}}},$="userId",y=e=>{let t=e;for(;;){const s=n.isNonNullExpression(t)||n.isAwaitExpression(t)?t.getExpression():l(t);if(s===void 0||s===t)return t;t=s}},G=e=>{const t=m(y(e));return t?.length===2&&t[0]==="auth"&&t[1]===$},ee=e=>n.isPropertyAssignment(e)?e.getInitializer():n.isShorthandPropertyAssignment(e)?e.getNameNode():void 0,b=e=>{let t=e;for(let s=t.getParent();;s=t.getParent()){if(!(n.isParenthesizedExpression(s)||n.isNonNullExpression(s)||n.isAsExpression(s)||n.isSatisfiesExpression(s)||n.isTypeAssertion(s)))return t;t=s}},pe=e=>{const t=p(e);return e.getSourceFile().getDescendantsOfKind(d.Identifier).filter(s=>s.getText()===e.getText()&&p(s)===t).filter(s=>{const i=s.getParent();return!((n.isVariableDeclaration(i)||n.isBindingElement(i))&&i.getNameNode()===s)})},le=e=>{const t=b(e).getParent();return n.isCallExpression(t)&&W(t)&&t.getArguments().includes(b(e))},Ue=e=>pe(e).every(t=>{if(le(t))return!0;const s=b(t),i=s.getParent(),r=i?.getParent();return(n.isPropertyAssignment(i)&&i.getNameNode()!==s&&M(i)==="where"||n.isShorthandPropertyAssignment(i)&&i.getName()==="where")&&r!==void 0&&le(r)}),R=e=>{const t=l(e);if(n.isObjectLiteralExpression(t))return t;const s=n.isIdentifier(t)&&Ue(t)?l(f(t)):void 0;return n.isObjectLiteralExpression(s)?s:void 0},Ge=e=>{const t=l(e)??e;if(!n.isObjectLiteralExpression(t))return G(e);const[s,...i]=t.getProperties(),r=i.length===0&&n.isPropertyAssignment(s)&&M(s)==="eq"?s.getInitializer():void 0;return r!==void 0&&G(r)},te=(e,t)=>{const s=e.getProperties(),i=n.isSpreadAssignment(t)?void 0:M(t);return s.slice(s.indexOf(t)+1).some(r=>{if(n.isSpreadAssignment(r))return!0;const o=Z(r.getNameNode());return o===void 0||o===i})},se=e=>e.getProperties().some(t=>n.isGetAccessorDeclaration(t)||n.isSetAccessorDeclaration(t)||n.isMethodDeclaration(t)),me=(e,t)=>!se(e)&&e.getProperties().some(s=>{const i=ee(s);if(i===void 0||n.isSpreadAssignment(s)||te(e,s))return!1;const r=Z(s.getNameNode());if(r===void 0)return!1;if(r==="AND"){const o=l(i);return n.isArrayLiteralExpression(o)&&o.getElements().some(a=>{const c=R(a);return c!==void 0&&me(c,t)})}return(t===void 0||r===t)&&Ge(i)}),Ee=(e,t)=>{const s=R(e),i=s===void 0?void 0:Fe(s,"where"),r=s===void 0||i===void 0||se(s)||te(s,i)?void 0:R(ee(i));return r!==void 0&&me(r,t)},ve=e=>e.getArguments().some(t=>G(t)||Ee(t,void 0)),He=(e,t)=>t===void 0?!1:qe.has(t)?ve(e):e.getArguments().some(s=>Ee(s,t)),Qe=new Set(["_creationTime","_id"]),Ye=(e,t)=>Qe.has(t)||e.getArguments().every(s=>{const i=R(s);if(i===void 0)return!0;const r=i.getProperties(),o=r.findLast(c=>!n.isSpreadAssignment(c)&&M(c)==="select");if(se(i))return!1;if(o===void 0)return!r.some(c=>n.isSpreadAssignment(c)||Z(c.getNameNode())===void 0);if(te(i,o))return!1;const a=l(ee(o));return n.isArrayLiteralExpression(a)&&a.getElements().some(c=>(n.isStringLiteral(c)||n.isNoSubstitutionTemplateLiteral(c))&&c.getLiteralValue()===t)}),w=(e,t,s,i)=>{const r=e.getExpression(),o=n.isPropertyAccessExpression(r)&&(U.has(r.getName())||r.getName().endsWith("OrThrow"));return!je(e)||!o||s!==void 0&&!Ye(e,s)?!1:i!==void 0&&l(t)===l(i)&&ve(e)||He(e,s)},ie=(e,t)=>{const s=t.getExpression(),i=n.isPropertyAccessExpression(s)&&s.getName().endsWith("OrThrow");return(n.isPropertyAccessExpression(e)||n.isElementAccessExpression(e))&&e.hasQuestionDotToken()&&!i},xe=(e,t)=>O(e).some(s=>{const i=T(s),r=m(i)?.[0];if(r==="auth")return!I(s,e)&&!fe(s,e);const o=r==="db"&&!I(s,e)?We(i):void 0;if(o===void 0)return!1;const{field:a,read:c}=X(o);return!ie(c,o)&&w(o,c,a,t)}),H=e=>n.isArrowFunction(e)||n.isFunctionExpression(e)||n.isFunctionDeclaration(e)||n.isMethodDeclaration(e),Q=e=>{const t=e.getFirstAncestor(s=>H(s));return H(t)?t:void 0},Ze=e=>{const t=l(e);return n.isAwaitExpression(t)?l(t.getExpression()):t},D=e=>{const t=[];let s=l(e);for(;s!==void 0;)if(n.isPropertyAccessExpression(s))t.unshift(s.getName()),s=l(s.getExpression());else if(n.isElementAccessExpression(s)){const i=s.getArgumentExpression();if(!n.isStringLiteral(i))return;t.unshift(i.getLiteralValue()),s=l(s.getExpression())}else return n.isIdentifier(s)?{path:t,root:s}:void 0},E=(e,t)=>p(e)?.compilerNode===t.compilerNode,Ae=e=>{if(!n.isIdentifier(e))return;const t=Ce(e),s=t?.isAlias()===!0?t.getAliasedSymbol():t,i=s?.getValueDeclaration()??s?.getDeclarations()[0];if(i===void 0)return;const r=i.getSourceFile();if(r.isDeclarationFile()||r.isInNodeModules())return;if(n.isFunctionDeclaration(i))return i.getBody()===void 0||i.isGenerator()||V(i)?void 0:i;if(!K(i))return;const o=l(i.getInitializer());return n.isArrowFunction(o)||n.isFunctionExpression(o)&&!o.isGenerator()?o:void 0},Je=e=>e>=d.FirstAssignment&&e<=d.LastAssignment,ne=e=>{const t=[],s=[];let i=l(e);for(;i!==void 0;)if(n.isCallExpression(i))t.push(i),i=l(i.getExpression());else if(n.isPropertyAccessExpression(i))s.unshift(i.getName()),i=l(i.getExpression());else if(n.isElementAccessExpression(i)){const r=i.getArgumentExpression();if(!n.isStringLiteral(r))return;s.unshift(r.getLiteralValue()),i=l(i.getExpression())}else return n.isIdentifier(i)&&t.length>0&&s.length>0?{calls:t,names:s,root:i}:void 0},re=e=>{const t=e.names[e.names.length-1]??"";if(U.has(t))return{selfEnforcing:!1};const s=t.endsWith("OrThrow")?t.slice(0,-7):void 0;return s!==void 0&&U.has(s)?{selfEnforcing:!0}:void 0},Xe=e=>{const t=l(e),s=n.isIdentifier(t)?l(f(t))??t:t,i=D(s);if(i===void 0||i.path.length===0)return;const r=p(i.root);if(!K(r)||!n.isIdentifier(r.getNameNode()))return;const o=Ze(r.getInitializer()),a=n.isCallExpression(o)&&m(o.getExpression())?.[0]==="db"?ne(o):void 0;return a!==void 0&&re(a)!==void 0?r:void 0},Ne=e=>e.calls.flatMap(t=>t.getArguments().flatMap(s=>[s,...s.getDescendants()])),$e=(e,t)=>{const s=n.isIdentifier(e)?p(e):void 0;if(!n.isBindingElement(s)||s.getDotDotDotToken()!==void 0||s.getInitializer()!==void 0)return!1;const i=s.getParent(),r=n.isObjectBindingPattern(i)?i.getParent():void 0;if(!K(r))return!1;const o=D(r.getInitializer());return o?.path[0]==="auth"&&E(o.root,t)},et=(e,t)=>{const s=D(e);if(s!==void 0&&s.path.length>0)return s.path[0]==="auth"&&E(s.root,t);const i=D(f(e));return i?.path[0]==="auth"&&E(i.root,t)?!0:$e(e,t)},Pe=e=>{if(!n.isVariableStatement(e))return;const t=e.getDeclarations(),s=t.length===1?t[0]:void 0;return s!==void 0&&K(s)&&n.isIdentifier(s.getNameNode())?s:void 0},tt=(e,t)=>{const s=l(e),i=a=>n.isIdentifier(a)&&E(a,t);if(n.isPrefixUnaryExpression(s))return s.getOperatorToken()===d.ExclamationToken&&i(l(s.getOperand()));if(!n.isBinaryExpression(s)||s.getOperatorToken().getKind()!==d.EqualsEqualsToken)return!1;const r=l(s.getLeft()),o=l(s.getRight());return i(r)&&n.isNullLiteral(o)||i(o)&&n.isNullLiteral(r)},st=(e,t)=>{const s=n.isBlock(e)?e.getStatements():void 0,i=s===void 0?e:s[s.length-1];return n.isThrowStatement(i)||!t&&n.isReturnStatement(i)},he=(e,t,s)=>n.isIfStatement(e)&&e.getElseStatement()===void 0&&tt(e.getExpression(),t)&&st(e.getThenStatement(),s),it=(e,t,s)=>{const i=e.getBody();if(!n.isBlock(i))return!1;const r=i.getStatements();return r.some((o,a)=>{const c=Pe(o),u=l(c?.getInitializer()),g=n.isAwaitExpression(u)?ne(u.getExpression()):void 0,A=g===void 0?void 0:re(g);if(c===void 0||g===void 0||A===void 0||g.names[0]!=="db"||!E(g.root,t))return!1;const v=Ne(g),P=v.some(x=>et(x,t)),F=s.some(x=>v.some(oe=>n.isIdentifier(oe)&&E(oe,x)));if(!P||!F)return!1;const h=A.selfEnforcing?o:r.slice(a+1).find(x=>he(x,c,!0));return h!==void 0&&!e.getDescendantsOfKind(d.ReturnStatement).some(x=>Q(x)?.compilerNode===e.compilerNode&&x.getStart()<h.getEnd())})},nt=(e,t,s)=>{const i=Ae(e.getExpression()),r=e.getArguments();if(i===void 0||r.some(v=>n.isSpreadElement(v)))return!1;const o=r.flatMap((v,P)=>m(v)?.length===0?[P]:[]),a=o.length===1?o[0]:void 0,c=a===void 0?void 0:i.getParameters()[a];if(a===void 0||c===void 0||c.isRestParameter()||!n.isIdentifier(c.getNameNode()))return!1;const u=[];r.forEach((v,P)=>{const F=D(l(v)),h=P===a||F===void 0||!E(F.root,t)?void 0:i.getParameters()[P];h!==void 0&&n.isIdentifier(h.getNameNode())&&u.push(h)});const g=i.getReturnType(),A=i.isAsync()||g.isAny()||g.isUnknown()||g.getText().includes("Promise");return u.length===0||!s&&A?!1:it(i,c,u)},rt=(e,t)=>{const s=Pe(e),i=l(s?.getInitializer()),r=n.isAwaitExpression(i)?ne(i.getExpression()):void 0,o=r===void 0?void 0:re(r);if(s===void 0||r===void 0||o===void 0||r.names[0]!=="db"||m(r.root)?.length!==0)return;const a=r.calls.some(u=>u.getArguments().some(g=>ge(g))),c=Ne(r).some(u=>n.isIdentifier(u)&&E(u,t));return a&&c?{declaration:s,selfEnforcing:o.selfEnforcing}:void 0},ot=(e,t,s)=>{const i=(r,o)=>o.getStart()<=r.getStart()&&r.getEnd()<=o.getEnd();for(let r=e.getParent();r!==void 0&&r.compilerNode!==t.compilerNode;r=r.getParent()){if(H(r)||n.isIfStatement(r)||n.isIterationStatement(r)||n.isCaseClause(r)||n.isDefaultClause(r)||n.isCatchClause(r))return!1;if(n.isTryStatement(r)&&r.getCatchClause()!==void 0){const o=r.getTryBlock();if(!i(e,o)||!i(s,o))return!1}}return!0},at=(e,t,s,i,r)=>e.slice(0,t).some((o,a)=>{if(!ot(o,i,r))return!1;if(n.isExpressionStatement(o)){const u=l(o.getExpression()),g=n.isAwaitExpression(u),A=g?l(u.getExpression()):u;if(n.isCallExpression(A)&&nt(A,s,g))return!0}const c=rt(o,s);return c!==void 0&&(c.selfEnforcing||a+1<t&&he(e[a+1],c.declaration,!1))}),_=e=>{let t=l(e)??e;for(;n.isAwaitExpression(t);)t=l(t.getExpression())??t.getExpression();return t},C=e=>{const t=_(e);return n.isCallExpression(t)||n.isNewExpression(t)},ct=e=>{const t=_(e);return n.isCallExpression(t)&&m(t.getExpression())?.[0]==="db"},Ie=e=>{const t=_(e);return n.isCallExpression(t)&&W(t)},ye=e=>L(e,"args")||O(e).some(t=>{const s=f(t);return s!==void 0&&L(s,"args")}),z=(e,t)=>{const s=e?.getNameNode().getDescendantsOfKind(d.BindingElement).find(i=>n.isIdentifier(i.getNameNode())&&i.getNameNode().getText()===t);return s===void 0?[]:[s,...s.getAncestors().filter(i=>n.isBindingElement(i))].map(i=>n.isBindingElement(i)?i.getInitializer():void 0).filter(i=>i!==void 0)},De=e=>{const t=n.isIdentifier(e)?p(e):void 0;if(!n.isBindingElement(t)||V(t))return;const s=t.getFirstAncestorByKind(d.VariableDeclaration),i=s?.getInitializer();if(!z(s,e.getText()).some(r=>ye(r)))return i!==void 0&&Ie(i)?i:void 0},B=e=>{const t=_(e);return n.isCallExpression(t)&&W(t)?t:void 0},Se=e=>{if(!(!n.isBindingElement(e)||!n.isObjectBindingPattern(e.getParent())||e.getDotDotDotToken()!==void 0||n.isBindingElement(e.getParent().getParent())))return ue(e)},lt=e=>{let t=e,s=t.getParent();for(;n.isParenthesizedExpression(s)||n.isArrayLiteralExpression(s)||n.isObjectLiteralExpression(s)||n.isSpreadElement(s)||n.isSpreadAssignment(s)||n.isShorthandPropertyAssignment(s)||n.isPropertyAssignment(s)&&s.getNameNode()!==t;)t=s,s=t.getParent();if(n.isBinaryExpression(s)){const i=s.getOperatorToken().getKind();return s.getLeft()===t&&i>=d.FirstAssignment&&i<=d.LastAssignment}if(n.isForOfStatement(s)||n.isForInStatement(s))return s.getInitializer()===t;if(n.isPrefixUnaryExpression(s)||n.isPostfixUnaryExpression(s)){const i=s.getOperatorToken();return i===d.PlusPlusToken||i===d.MinusMinusToken}return n.isDeleteExpression(s)},Oe=e=>pe(e).every(t=>{const s=b(t),i=s.getParent();return n.isVariableDeclaration(i)&&n.isObjectBindingPattern(i.getNameNode())||n.isSpreadAssignment(i)?!0:(n.isPropertyAccessExpression(i)||n.isElementAccessExpression(i))&&i.getExpression()===s&&!lt(b(T(i)))}),de=(e,t)=>{const s=t!==void 0&&l(e)===l(t),i=f(e);if(i!==void 0){const a=B(i);if(a===void 0)return xe(i,s?i:void 0);if(n.isIdentifier(e)&&!Oe(e))return!1;const{field:c,read:u}=X(e);return ie(u,a)?!1:w(a,u,c,t)}const r=De(e),o=r===void 0?void 0:B(r);return o!==void 0&&n.isIdentifier(e)&&w(o,e,Se(p(e)),t)},S=(e,t=!0)=>{const s=y(e);if(n.isTemplateExpression(s))return s.getTemplateSpans().flatMap(o=>S(o.getExpression(),t));if(n.isBinaryExpression(s)&&s.getOperatorToken().getKind()===d.PlusToken)return[...S(s.getLeft(),t),...S(s.getRight(),t)];const i=t&&n.isIdentifier(s)?f(s):void 0,r=i===void 0?void 0:y(i);return r!==void 0&&(n.isTemplateExpression(r)||n.isBinaryExpression(r)&&r.getOperatorToken().getKind()===d.PlusToken)?S(r,!1):[s]},dt=e=>n.isStringLiteral(e)||n.isNoSubstitutionTemplateLiteral(e)||n.isNumericLiteral(e),ut=e=>{const t=y(e.getExpression()),s=n.isIdentifier(t)?f(t):void 0;if(n.isIdentifier(t)&&s!==void 0&&!Oe(t))return!1;const i=B(t)??(s===void 0?void 0:B(s));return i!==void 0&&!ie(e,i)&&w(i,e,X(e.getExpression()).field,void 0)},gt=e=>{const t=p(e),s=Se(t),i=n.isBindingElement(t)?t.getFirstAncestorByKind(d.VariableDeclaration)?.getInitializer():void 0,r=i===void 0?void 0:m(y(i));if(r!==void 0)return r.length===1&&r[0]==="auth"&&s===$;const o=De(e),a=o===void 0?void 0:B(o);return a!==void 0&&w(a,e,s,void 0)},Te=(e,t=!0)=>{const s=y(e),i=n.isIdentifier(s)?p(s):void 0;if((n.isVariableDeclaration(i)||n.isBindingElement(i))&&V(i))return!1;const r=m(s);if(r!==void 0)return r.length===2&&r[0]==="auth"&&r[1]===$;if(n.isPropertyAccessExpression(s)||n.isElementAccessExpression(s))return ut(s);if(!n.isIdentifier(s))return!1;const o=f(s);return o===void 0?gt(s):t&&Te(o,!1)},ft=(e,t)=>{const s=S(t),i=s.findIndex(a=>!dt(a)),r=s.findIndex(a=>a.getPos()<=e.getPos()&&e.getEnd()<=a.getEnd()),o=s[i];return o!==void 0&&i<r&&Te(o)},N=e=>L(e,"args"),k=e=>{if(!n.isIdentifier(e))return;const t=e.getText(),s=e.getFirstAncestor(a=>n.isArrowFunction(a)||n.isFunctionExpression(a)||n.isFunctionDeclaration(a));if(s===void 0)return;const i=e.getStart();let r,o=-1;for(const a of Be(s,d.VariableDeclaration)){if(!Me(a,t))continue;const c=Ve(a,s);if(c===void 0||i<c.getStart()||i>=c.getEnd())continue;const u=a.getInitializer(),g=a.getStart();u!==void 0&&g<i&&g>o&&(r=a,o=g)}return r},Y=e=>k(e)?.getInitializer(),wt=e=>{if(N(e))return!0;const t=s=>{const i=k(s),r=i?.getInitializer();return r!==void 0&&N(r)||z(i,s.getText()).some(o=>N(o))};return t(e)||J(e).some(s=>t(s))},Bt=e=>{if(C(e))return!1;if(z(k(e),e.getText()).some(i=>N(i)&&!C(i)))return!0;const t=Y(e);if(t!==void 0&&C(t)&&!(Ie(t)&&N(t)))return!1;const s=t??e;return N(s)?!0:J(s).some(i=>{if(i.getFirstAncestor(c=>c===s||n.isCallExpression(c)||n.isNewExpression(c))!==s)return!1;const o=k(i),a=c=>c!==void 0&&N(c)&&(!C(c)||ct(c));return a(o?.getInitializer())||z(o,i.getText()).some(c=>a(c))})},Ft=e=>{if(j(e))return!0;const t=f(e);if(t!==void 0&&j(t))return!0;const s=t??e;return(n.isIdentifier(s)?[s]:s.getDescendantsOfKind(d.Identifier)).some(r=>{const o=f(r);return o!==void 0&&j(o)})},Ct=e=>{const t=f(e)??e;if(O(t).some(r=>I(r,t)&&ye(T(r))&&!ft(r,t)))return!1;if(xe(e,e)||de(e,e))return!0;const s=f(e)??e;return(n.isIdentifier(s)?[s]:s.getDescendantsOfKind(d.Identifier)).some(r=>!I(r,s)&&!fe(r,s)&&de(r,s))},q=(e,t)=>L(e,t),Lt=(e,t)=>{if(q(e,t))return!0;const s=Y(e);if(s!==void 0&&q(s,t))return!0;const i=Ke(e);if(i!==void 0){const r=Y(i);return r!==void 0&&q(r,t)}return!1},Rt=(e,t)=>{const s=Q(e),i=Xe(t);if(s===void 0||i===void 0||Q(i)?.compilerNode!==s.compilerNode||s.getDescendantsOfKind(d.BinaryExpression).some(c=>{const u=D(c.getLeft());return Je(c.getOperatorToken().getKind())&&u!==void 0&&E(u.root,i)}))return!1;let o=e,a=e.getParent();for(;a!==void 0&&a.compilerNode!==s.compilerNode;){if(n.isBlock(a)){const c=a.getStatements(),u=c.findIndex(g=>g.compilerNode===o.compilerNode);if(u>0&&at(c,u,i,s,e))return!0}o=a,a=a.getParent()}return!1},pt=/rate|limit|\bip\b|geo|throttle/iu,mt=/^run[A-Z]/u,Et=e=>n.isIdentifier(e)?(e.getSymbol()?.getDeclarations()??[]).some(s=>s.getFirstAncestorByKind(d.ImportDeclaration)?.getModuleSpecifierValue().startsWith("@lunora/")===!0):!1,vt=e=>{const t=n.isCallExpression(e)?e.getExpression():e;let s;return n.isIdentifier(t)?s=t:n.isPropertyAccessExpression(t)&&(s=t.getNameNode()),s!==void 0&&Et(n.isPropertyAccessExpression(t)?t.getExpression():s)&&!pt.test(s.getText())},xt=e=>{const t=n.isCallExpression(e)?e.getExpression():void 0;if(n.isElementAccessExpression(t)){const s=t.getArgumentExpression();return(n.isStringLiteral(s)||n.isNoSubstitutionTemplateLiteral(s))&&s.getLiteralText()==="use"}return n.isPropertyAccessExpression(t)&&t.getName()==="use"},At=e=>{const t=e.getParent();return n.isPropertyAccessExpression(t)&&t.getExpression()===e?!mt.test(t.getName()):n.isElementAccessExpression(t)&&t.getExpression()===e?n.isStringLiteral(t.getArgumentExpression())||n.isNoSubstitutionTemplateLiteral(t.getArgumentExpression()):n.isVariableDeclaration(t)&&t.getInitializer()?.getText()===e.getText()},Nt=e=>{if(n.isPropertyAccessExpression(e))return e.getName()==="ip";if(n.isElementAccessExpression(e)){const t=e.getArgumentExpression();return(n.isStringLiteral(t)||n.isNoSubstitutionTemplateLiteral(t))&&t.getLiteralText()==="ip"}return n.isBindingElement(e)?e.getDotDotDotToken()!==void 0||(e.getPropertyNameNode()?.getText()??e.getName())==="ip":n.isShorthandPropertyAssignment(e)&&e.getName()==="ip"},Pt=(e,t)=>{const s=e.getParent();if(!n.isCallExpression(s)||s.getExpression()===e)return!1;const i=s.getArguments().indexOf(e),r=Ae(s.getExpression()),o=i===-1||r===void 0?void 0:r.getParameters()[i];return r===void 0||o===void 0||o.isRestParameter()||!n.isIdentifier(o.getNameNode())?!1:t.has(r.compilerNode)?!0:(t.add(r.compilerNode),!be(r,o,t))},ht=(e,t)=>t!==void 0&&n.isIdentifier(e)&&p(e)?.compilerNode===t.compilerNode,It=e=>n.isArrowFunction(e)||n.isFunctionExpression(e)||n.isFunctionDeclaration(e)||n.isMethodDeclaration(e),yt=(e,t)=>!n.isBindingElement(e)||e.getDotDotDotToken()===void 0?!1:e.getFirstAncestorByKind(d.Parameter)?.getParent()?.getAncestors().some(r=>r!==t&&It(r)&&r.getAncestors().includes(t))===!0,be=(e,t,s)=>{for(const i of e.getDescendants()){if(Nt(i)&&!yt(i,e)||xt(i)&&!vt(i.getArguments()[0]))return!0;if(n.isIdentifier(i)&&(Le(i)||ht(i,t))&&!At(i)){const r=i.getParent();if(!(n.isParameterDeclaration(r)||n.isBindingElement(r)||n.isVariableDeclaration(r))&&!Pt(i,s))return!0}}return!1},zt=e=>be(e,void 0,new Set);export{Ft as a,Bt as b,Ct as c,Rt as d,Lt as e,q as f,k as g,wt as i,zt as m,N as r,Y as s};
|
|
1
|
+
import{Node as n,SyntaxKind as d,VariableDeclarationKind as Be}from"ts-morph";import{isConstDeclaration as K,unwrapExpression as l,descendantsOfKind as Fe,bindingKeyName as ue,findObjectProperty as Ce}from"./isTestPath-Uwb5a6Kq.mjs";import{r as Le,b as V,d as p}from"./attribution-Cwt30DDJ.mjs";import{i as ae,r as j,c as m,a as ze}from"./context-root-BpDEhvNE.mjs";import{a as M,s as Z}from"./property-name-7cBlgK_O.mjs";const Re=e=>{const t=e.getText(),s=i=>{const r=i.getNameNode();return n.isIdentifier(r)&&r.getText()===t};for(const i of e.getAncestors())if(!(!n.isArrowFunction(i)&&!n.isFunctionExpression(i)&&!n.isFunctionDeclaration(i)))for(const r of i.getParameters()){const o=r.getDescendantsOfKind(d.BindingElement).find(a=>s(a));if(o!==void 0)return o}},ke=e=>{let t=e;for(;;){const s=t.getParent();if(!n.isObjectBindingPattern(s))return;const i=s.getParent();if(n.isBindingElement(i)){t=i;continue}return n.isParameterDeclaration(i)?ue(t):void 0}},Ke=e=>{const t=e.getText();if(!e.getAncestors().some(o=>{const a=n.isFunctionLikeDeclaration(o)||n.isArrowFunction(o)?o.getParameters()[1]:void 0,c=a?.getNameNode();return a!==void 0&&(n.isIdentifier(c)?c.getText()===t:a.getDescendantsOfKind(d.BindingElement).some(u=>u.getName()===t))&&ae(a)}))return!1;const i=p(e),r=n.isParameterDeclaration(i)?i:i?.getFirstAncestorByKind(d.Parameter);return r!==void 0&&(n.isParameterDeclaration(i)||n.isBindingElement(i))&&ae(r)},ce=(e,t)=>{const s=e.getParent();if(n.isPropertyAccessExpression(s)&&s.getNameNode()===e||n.isPropertyAssignment(s)&&s.getNameNode()===e)return!1;if(e.getText()===t)return!0;const i=Re(e);return i!==void 0&&ke(i)===t?!0:t==="args"&&Ke(e)},L=(e,t)=>n.isIdentifier(e)?ce(e,t):e.getDescendantsOfKind(d.Identifier).some(s=>ce(s,t)),Ve=e=>{let t=e;for(;n.isPropertyAccessExpression(t)||n.isElementAccessExpression(t)||n.isNonNullExpression(t);)t=t.getExpression();return n.isIdentifier(t)?t:void 0},f=e=>{const t=n.isIdentifier(e)?p(e):void 0;return n.isVariableDeclaration(t)&&n.isIdentifier(t.getNameNode())&&!V(t)?t.getInitializer():void 0},Me=(e,t)=>{const s=e.getParent();if(n.isVariableDeclarationList(s)&&s.getDeclarationKind()===Be.Var)return t;const i=s.getParent();return n.isVariableStatement(i)?i.getParent():i},We=(e,t)=>{const s=e.getNameNode();return n.isIdentifier(s)?s.getText()===t:s.getDescendantsOfKind(d.BindingElement).some(i=>{const r=i.getNameNode();return n.isIdentifier(r)&&r.getText()===t})},J=e=>e.getDescendantsOfKind(d.Identifier).filter(t=>{const s=t.getParent();return!(n.isPropertyAccessExpression(s)&&s.getNameNode()===t)&&!(n.isPropertyAssignment(s)&&s.getNameNode()===t)}),O=e=>n.isIdentifier(e)?[e]:J(e),T=e=>{let t=e;for(;;){const s=t.getParent();if(!((n.isPropertyAccessExpression(s)||n.isElementAccessExpression(s)||n.isNonNullExpression(s))&&s.getExpression()===t))return t;t=s}},_e=e=>{const t=e.getParent();return n.isCallExpression(t)&&t.getExpression()===e?t:void 0},je=new Set(["find","findFirst","findFirstOrThrow","findMany","findUnique","first","get","unique"]),U=new Set(["findFirst","findUnique","first","get","unique"]),W=e=>{const t=e.getExpression();return n.isPropertyAccessExpression(t)&&je.has(t.getName())&&m(t)?.[0]==="db"},I=(e,t)=>{for(let s=e,i=e.getParent();i!==void 0&&s!==t;s=i,i=i.getParent()){if(n.isConditionalExpression(i))return!0;if(n.isBinaryExpression(i)){const r=i.getOperatorToken().getKind();if(s===i.getRight()&&(r===d.QuestionQuestionToken||r===d.BarBarToken)||s===i.getLeft()&&r===d.AmpersandAmpersandToken)return!0}}return!1},ge=e=>O(e).some(t=>{if(I(t,e))return!1;if(m(T(t))?.[0]==="auth")return!0;const s=f(t);return s!==void 0&&O(s).some(i=>m(T(i))?.[0]==="auth"&&!I(i,s))}),qe=e=>W(e)&&e.getArguments().some(t=>ge(t)),fe=(e,t)=>{for(let s=e.getParent();s!==void 0;s=s.getParent()){if(n.isCallExpression(s)&&m(s.getExpression())?.[0]==="db")return!0;if(s===t)return!1}return!1},Ue=new Set(["_id","id"]),X=e=>{let t=e;for(let s=t.getParent();;s=t.getParent()){if(n.isAwaitExpression(s)||n.isParenthesizedExpression(s)||n.isNonNullExpression(s)||n.isAsExpression(s)||n.isSatisfiesExpression(s)||n.isTypeAssertion(s)){t=s;continue}if(n.isPropertyAccessExpression(s)&&s.getExpression()===t)return{field:s.getName(),read:s};if(n.isElementAccessExpression(s)&&s.getExpression()===t){const i=l(s.getArgumentExpression());return{field:n.isStringLiteral(i)||n.isNoSubstitutionTemplateLiteral(i)?i.getLiteralValue():void 0,read:s}}return{field:void 0,read:t}}},$="userId",y=e=>{let t=e;for(;;){const s=n.isNonNullExpression(t)||n.isAwaitExpression(t)?t.getExpression():l(t);if(s===void 0||s===t)return t;t=s}},G=e=>{const t=m(y(e));return t?.length===2&&t[0]==="auth"&&t[1]===$},ee=e=>n.isPropertyAssignment(e)?e.getInitializer():n.isShorthandPropertyAssignment(e)?e.getNameNode():void 0,b=e=>{let t=e;for(let s=t.getParent();;s=t.getParent()){if(!(n.isParenthesizedExpression(s)||n.isNonNullExpression(s)||n.isAsExpression(s)||n.isSatisfiesExpression(s)||n.isTypeAssertion(s)))return t;t=s}},pe=e=>{const t=p(e);return e.getSourceFile().getDescendantsOfKind(d.Identifier).filter(s=>s.getText()===e.getText()&&p(s)===t).filter(s=>{const i=s.getParent();return!((n.isVariableDeclaration(i)||n.isBindingElement(i))&&i.getNameNode()===s)})},le=e=>{const t=b(e).getParent();return n.isCallExpression(t)&&W(t)&&t.getArguments().includes(b(e))},Ge=e=>pe(e).every(t=>{if(le(t))return!0;const s=b(t),i=s.getParent(),r=i?.getParent();return(n.isPropertyAssignment(i)&&i.getNameNode()!==s&&M(i)==="where"||n.isShorthandPropertyAssignment(i)&&i.getName()==="where")&&r!==void 0&&le(r)}),z=e=>{const t=l(e);if(n.isObjectLiteralExpression(t))return t;const s=n.isIdentifier(t)&&Ge(t)?l(f(t)):void 0;return n.isObjectLiteralExpression(s)?s:void 0},He=e=>{const t=l(e)??e;if(!n.isObjectLiteralExpression(t))return G(e);const[s,...i]=t.getProperties(),r=i.length===0&&n.isPropertyAssignment(s)&&M(s)==="eq"?s.getInitializer():void 0;return r!==void 0&&G(r)},te=(e,t)=>{const s=e.getProperties(),i=n.isSpreadAssignment(t)?void 0:M(t);return s.slice(s.indexOf(t)+1).some(r=>{if(n.isSpreadAssignment(r))return!0;const o=Z(r.getNameNode());return o===void 0||o===i})},se=e=>e.getProperties().some(t=>n.isGetAccessorDeclaration(t)||n.isSetAccessorDeclaration(t)||n.isMethodDeclaration(t)),me=(e,t)=>!se(e)&&e.getProperties().some(s=>{const i=ee(s);if(i===void 0||n.isSpreadAssignment(s)||te(e,s))return!1;const r=Z(s.getNameNode());if(r===void 0)return!1;if(r==="AND"){const o=l(i);return n.isArrayLiteralExpression(o)&&o.getElements().some(a=>{const c=z(a);return c!==void 0&&me(c,t)})}return(t===void 0||r===t)&&He(i)}),Ee=(e,t)=>{const s=z(e),i=s===void 0?void 0:Ce(s,"where"),r=s===void 0||i===void 0||se(s)||te(s,i)?void 0:z(ee(i));return r!==void 0&&me(r,t)},ve=e=>e.getArguments().some(t=>G(t)||Ee(t,void 0)),Qe=(e,t)=>t===void 0?!1:Ue.has(t)?ve(e):e.getArguments().some(s=>Ee(s,t)),Ye=new Set(["_creationTime","_id"]),Ze=(e,t)=>Ye.has(t)||e.getArguments().every(s=>{const i=z(s);if(i===void 0)return!0;const r=i.getProperties(),o=r.findLast(c=>!n.isSpreadAssignment(c)&&M(c)==="select");if(se(i))return!1;if(o===void 0)return!r.some(c=>n.isSpreadAssignment(c)||Z(c.getNameNode())===void 0);if(te(i,o))return!1;const a=l(ee(o));return n.isArrayLiteralExpression(a)&&a.getElements().some(c=>(n.isStringLiteral(c)||n.isNoSubstitutionTemplateLiteral(c))&&c.getLiteralValue()===t)}),w=(e,t,s,i)=>{const r=e.getExpression(),o=n.isPropertyAccessExpression(r)&&(U.has(r.getName())||r.getName().endsWith("OrThrow"));return!qe(e)||!o||s!==void 0&&!Ze(e,s)?!1:i!==void 0&&l(t)===l(i)&&ve(e)||Qe(e,s)},ie=(e,t)=>{const s=t.getExpression(),i=n.isPropertyAccessExpression(s)&&s.getName().endsWith("OrThrow");return(n.isPropertyAccessExpression(e)||n.isElementAccessExpression(e))&&e.hasQuestionDotToken()&&!i},xe=(e,t)=>O(e).some(s=>{const i=T(s),r=m(i)?.[0];if(r==="auth")return!I(s,e)&&!fe(s,e);const o=r==="db"&&!I(s,e)?_e(i):void 0;if(o===void 0)return!1;const{field:a,read:c}=X(o);return!ie(c,o)&&w(o,c,a,t)}),H=e=>n.isArrowFunction(e)||n.isFunctionExpression(e)||n.isFunctionDeclaration(e)||n.isMethodDeclaration(e),Q=e=>{const t=e.getFirstAncestor(s=>H(s));return H(t)?t:void 0},Je=e=>{const t=l(e);return n.isAwaitExpression(t)?l(t.getExpression()):t},D=e=>{const t=[];let s=l(e);for(;s!==void 0;)if(n.isPropertyAccessExpression(s))t.unshift(s.getName()),s=l(s.getExpression());else if(n.isElementAccessExpression(s)){const i=s.getArgumentExpression();if(!n.isStringLiteral(i))return;t.unshift(i.getLiteralValue()),s=l(s.getExpression())}else return n.isIdentifier(s)?{path:t,root:s}:void 0},E=(e,t)=>p(e)?.compilerNode===t.compilerNode,Ae=e=>{if(!n.isIdentifier(e))return;const t=Le(e),s=t?.isAlias()===!0?t.getAliasedSymbol():t,i=s?.getValueDeclaration()??s?.getDeclarations()[0];if(i===void 0)return;const r=i.getSourceFile();if(r.isDeclarationFile()||r.isInNodeModules())return;if(n.isFunctionDeclaration(i))return i.getBody()===void 0||i.isGenerator()||V(i)?void 0:i;if(!K(i))return;const o=l(i.getInitializer());return n.isArrowFunction(o)||n.isFunctionExpression(o)&&!o.isGenerator()?o:void 0},Xe=e=>e>=d.FirstAssignment&&e<=d.LastAssignment,ne=e=>{const t=[],s=[];let i=l(e);for(;i!==void 0;)if(n.isCallExpression(i))t.push(i),i=l(i.getExpression());else if(n.isPropertyAccessExpression(i))s.unshift(i.getName()),i=l(i.getExpression());else if(n.isElementAccessExpression(i)){const r=i.getArgumentExpression();if(!n.isStringLiteral(r))return;s.unshift(r.getLiteralValue()),i=l(i.getExpression())}else return n.isIdentifier(i)&&t.length>0&&s.length>0?{calls:t,names:s,root:i}:void 0},re=e=>{const t=e.names[e.names.length-1]??"";if(U.has(t))return{selfEnforcing:!1};const s=t.endsWith("OrThrow")?t.slice(0,-7):void 0;return s!==void 0&&U.has(s)?{selfEnforcing:!0}:void 0},$e=e=>{const t=l(e),s=n.isIdentifier(t)?l(f(t))??t:t,i=D(s);if(i===void 0||i.path.length===0)return;const r=p(i.root);if(!K(r)||!n.isIdentifier(r.getNameNode()))return;const o=Je(r.getInitializer()),a=n.isCallExpression(o)&&m(o.getExpression())?.[0]==="db"?ne(o):void 0;return a!==void 0&&re(a)!==void 0?r:void 0},Ne=e=>e.calls.flatMap(t=>t.getArguments().flatMap(s=>[s,...s.getDescendants()])),et=(e,t)=>{const s=n.isIdentifier(e)?p(e):void 0;if(!n.isBindingElement(s)||s.getDotDotDotToken()!==void 0||s.getInitializer()!==void 0)return!1;const i=s.getParent(),r=n.isObjectBindingPattern(i)?i.getParent():void 0;if(!K(r))return!1;const o=D(r.getInitializer());return o?.path[0]==="auth"&&E(o.root,t)},tt=(e,t)=>{const s=D(e);if(s!==void 0&&s.path.length>0)return s.path[0]==="auth"&&E(s.root,t);const i=D(f(e));return i?.path[0]==="auth"&&E(i.root,t)?!0:et(e,t)},he=e=>{if(!n.isVariableStatement(e))return;const t=e.getDeclarations(),s=t.length===1?t[0]:void 0;return s!==void 0&&K(s)&&n.isIdentifier(s.getNameNode())?s:void 0},st=(e,t)=>{const s=l(e),i=a=>n.isIdentifier(a)&&E(a,t);if(n.isPrefixUnaryExpression(s))return s.getOperatorToken()===d.ExclamationToken&&i(l(s.getOperand()));if(!n.isBinaryExpression(s)||s.getOperatorToken().getKind()!==d.EqualsEqualsToken)return!1;const r=l(s.getLeft()),o=l(s.getRight());return i(r)&&n.isNullLiteral(o)||i(o)&&n.isNullLiteral(r)},it=(e,t)=>{const s=n.isBlock(e)?e.getStatements():void 0,i=s===void 0?e:s[s.length-1];return n.isThrowStatement(i)||!t&&n.isReturnStatement(i)},Pe=(e,t,s)=>n.isIfStatement(e)&&e.getElseStatement()===void 0&&st(e.getExpression(),t)&&it(e.getThenStatement(),s),nt=(e,t,s)=>{const i=e.getBody();if(!n.isBlock(i))return!1;const r=i.getStatements();return r.some((o,a)=>{const c=he(o),u=l(c?.getInitializer()),g=n.isAwaitExpression(u)?ne(u.getExpression()):void 0,A=g===void 0?void 0:re(g);if(c===void 0||g===void 0||A===void 0||g.names[0]!=="db"||!E(g.root,t))return!1;const v=Ne(g),h=v.some(x=>tt(x,t)),F=s.some(x=>v.some(oe=>n.isIdentifier(oe)&&E(oe,x)));if(!h||!F)return!1;const P=A.selfEnforcing?o:r.slice(a+1).find(x=>Pe(x,c,!0));return P!==void 0&&!e.getDescendantsOfKind(d.ReturnStatement).some(x=>Q(x)?.compilerNode===e.compilerNode&&x.getStart()<P.getEnd())})},rt=(e,t,s)=>{const i=Ae(e.getExpression()),r=e.getArguments();if(i===void 0||r.some(v=>n.isSpreadElement(v)))return!1;const o=r.flatMap((v,h)=>m(v)?.length===0?[h]:[]),a=o.length===1?o[0]:void 0,c=a===void 0?void 0:i.getParameters()[a];if(a===void 0||c===void 0||c.isRestParameter()||!n.isIdentifier(c.getNameNode()))return!1;const u=[];r.forEach((v,h)=>{const F=D(l(v)),P=h===a||F===void 0||!E(F.root,t)?void 0:i.getParameters()[h];P!==void 0&&n.isIdentifier(P.getNameNode())&&u.push(P)});const g=i.getReturnType(),A=i.isAsync()||g.isAny()||g.isUnknown()||g.getText().includes("Promise");return u.length===0||!s&&A?!1:nt(i,c,u)},ot=(e,t)=>{const s=he(e),i=l(s?.getInitializer()),r=n.isAwaitExpression(i)?ne(i.getExpression()):void 0,o=r===void 0?void 0:re(r);if(s===void 0||r===void 0||o===void 0||r.names[0]!=="db"||m(r.root)?.length!==0)return;const a=r.calls.some(u=>u.getArguments().some(g=>ge(g))),c=Ne(r).some(u=>n.isIdentifier(u)&&E(u,t));return a&&c?{declaration:s,selfEnforcing:o.selfEnforcing}:void 0},at=(e,t,s)=>{const i=(r,o)=>o.getStart()<=r.getStart()&&r.getEnd()<=o.getEnd();for(let r=e.getParent();r!==void 0&&r.compilerNode!==t.compilerNode;r=r.getParent()){if(H(r)||n.isIfStatement(r)||n.isIterationStatement(r)||n.isCaseClause(r)||n.isDefaultClause(r)||n.isCatchClause(r))return!1;if(n.isTryStatement(r)&&r.getCatchClause()!==void 0){const o=r.getTryBlock();if(!i(e,o)||!i(s,o))return!1}}return!0},ct=(e,t,s,i,r)=>e.slice(0,t).some((o,a)=>{if(!at(o,i,r))return!1;if(n.isExpressionStatement(o)){const u=l(o.getExpression()),g=n.isAwaitExpression(u),A=g?l(u.getExpression()):u;if(n.isCallExpression(A)&&rt(A,s,g))return!0}const c=ot(o,s);return c!==void 0&&(c.selfEnforcing||a+1<t&&Pe(e[a+1],c.declaration,!1))}),_=e=>{let t=l(e)??e;for(;n.isAwaitExpression(t);)t=l(t.getExpression())??t.getExpression();return t},C=e=>{const t=_(e);return n.isCallExpression(t)||n.isNewExpression(t)},lt=e=>{const t=_(e);return n.isCallExpression(t)&&m(t.getExpression())?.[0]==="db"},Ie=e=>{const t=_(e);return n.isCallExpression(t)&&W(t)},ye=e=>L(e,"args")||O(e).some(t=>{const s=f(t);return s!==void 0&&L(s,"args")}),R=(e,t)=>{const s=e?.getNameNode().getDescendantsOfKind(d.BindingElement).find(i=>n.isIdentifier(i.getNameNode())&&i.getNameNode().getText()===t);return s===void 0?[]:[s,...s.getAncestors().filter(i=>n.isBindingElement(i))].map(i=>n.isBindingElement(i)?i.getInitializer():void 0).filter(i=>i!==void 0)},De=e=>{const t=n.isIdentifier(e)?p(e):void 0;if(!n.isBindingElement(t)||V(t))return;const s=t.getFirstAncestorByKind(d.VariableDeclaration),i=s?.getInitializer();if(!R(s,e.getText()).some(r=>ye(r)))return i!==void 0&&Ie(i)?i:void 0},B=e=>{const t=_(e);return n.isCallExpression(t)&&W(t)?t:void 0},Se=e=>{if(!(!n.isBindingElement(e)||!n.isObjectBindingPattern(e.getParent())||e.getDotDotDotToken()!==void 0||n.isBindingElement(e.getParent().getParent())))return ue(e)},dt=e=>{let t=e,s=t.getParent();for(;n.isParenthesizedExpression(s)||n.isArrayLiteralExpression(s)||n.isObjectLiteralExpression(s)||n.isSpreadElement(s)||n.isSpreadAssignment(s)||n.isShorthandPropertyAssignment(s)||n.isPropertyAssignment(s)&&s.getNameNode()!==t;)t=s,s=t.getParent();if(n.isBinaryExpression(s)){const i=s.getOperatorToken().getKind();return s.getLeft()===t&&i>=d.FirstAssignment&&i<=d.LastAssignment}if(n.isForOfStatement(s)||n.isForInStatement(s))return s.getInitializer()===t;if(n.isPrefixUnaryExpression(s)||n.isPostfixUnaryExpression(s)){const i=s.getOperatorToken();return i===d.PlusPlusToken||i===d.MinusMinusToken}return n.isDeleteExpression(s)},Oe=e=>pe(e).every(t=>{const s=b(t),i=s.getParent();return n.isVariableDeclaration(i)&&n.isObjectBindingPattern(i.getNameNode())||n.isSpreadAssignment(i)?!0:(n.isPropertyAccessExpression(i)||n.isElementAccessExpression(i))&&i.getExpression()===s&&!dt(b(T(i)))}),de=(e,t)=>{const s=t!==void 0&&l(e)===l(t),i=f(e);if(i!==void 0){const a=B(i);if(a===void 0)return xe(i,s?i:void 0);if(n.isIdentifier(e)&&!Oe(e))return!1;const{field:c,read:u}=X(e);return ie(u,a)?!1:w(a,u,c,t)}const r=De(e),o=r===void 0?void 0:B(r);return o!==void 0&&n.isIdentifier(e)&&w(o,e,Se(p(e)),t)},S=(e,t=!0)=>{const s=y(e);if(n.isTemplateExpression(s))return s.getTemplateSpans().flatMap(o=>S(o.getExpression(),t));if(n.isBinaryExpression(s)&&s.getOperatorToken().getKind()===d.PlusToken)return[...S(s.getLeft(),t),...S(s.getRight(),t)];const i=t&&n.isIdentifier(s)?f(s):void 0,r=i===void 0?void 0:y(i);return r!==void 0&&(n.isTemplateExpression(r)||n.isBinaryExpression(r)&&r.getOperatorToken().getKind()===d.PlusToken)?S(r,!1):[s]},ut=e=>n.isStringLiteral(e)||n.isNoSubstitutionTemplateLiteral(e)||n.isNumericLiteral(e),gt=e=>{const t=y(e.getExpression()),s=n.isIdentifier(t)?f(t):void 0;if(n.isIdentifier(t)&&s!==void 0&&!Oe(t))return!1;const i=B(t)??(s===void 0?void 0:B(s));return i!==void 0&&!ie(e,i)&&w(i,e,X(e.getExpression()).field,void 0)},ft=e=>{const t=p(e),s=Se(t),i=n.isBindingElement(t)?t.getFirstAncestorByKind(d.VariableDeclaration)?.getInitializer():void 0,r=i===void 0?void 0:m(y(i));if(r!==void 0)return r.length===1&&r[0]==="auth"&&s===$;const o=De(e),a=o===void 0?void 0:B(o);return a!==void 0&&w(a,e,s,void 0)},Te=(e,t=!0)=>{const s=y(e),i=n.isIdentifier(s)?p(s):void 0;if((n.isVariableDeclaration(i)||n.isBindingElement(i))&&V(i))return!1;const r=m(s);if(r!==void 0)return r.length===2&&r[0]==="auth"&&r[1]===$;if(n.isPropertyAccessExpression(s)||n.isElementAccessExpression(s))return gt(s);if(!n.isIdentifier(s))return!1;const o=f(s);return o===void 0?ft(s):t&&Te(o,!1)},pt=(e,t)=>{const s=S(t),i=s.findIndex(a=>!ut(a)),r=s.findIndex(a=>a.getPos()<=e.getPos()&&e.getEnd()<=a.getEnd()),o=s[i];return o!==void 0&&i<r&&Te(o)},N=e=>L(e,"args"),k=e=>{if(!n.isIdentifier(e))return;const t=e.getText(),s=e.getFirstAncestor(a=>n.isArrowFunction(a)||n.isFunctionExpression(a)||n.isFunctionDeclaration(a));if(s===void 0)return;const i=e.getStart();let r,o=-1;for(const a of Fe(s,d.VariableDeclaration)){if(!We(a,t))continue;const c=Me(a,s);if(c===void 0||i<c.getStart()||i>=c.getEnd())continue;const u=a.getInitializer(),g=a.getStart();u!==void 0&&g<i&&g>o&&(r=a,o=g)}return r},Y=e=>k(e)?.getInitializer(),Bt=e=>{if(N(e))return!0;const t=s=>{const i=k(s),r=i?.getInitializer();return r!==void 0&&N(r)||R(i,s.getText()).some(o=>N(o))};return t(e)||J(e).some(s=>t(s))},Ft=e=>{if(C(e))return!1;if(R(k(e),e.getText()).some(i=>N(i)&&!C(i)))return!0;const t=Y(e);if(t!==void 0&&C(t)&&!(Ie(t)&&N(t)))return!1;const s=t??e;return N(s)?!0:J(s).some(i=>{if(i.getFirstAncestor(c=>c===s||n.isCallExpression(c)||n.isNewExpression(c))!==s)return!1;const o=k(i),a=c=>c!==void 0&&N(c)&&(!C(c)||lt(c));return a(o?.getInitializer())||R(o,i.getText()).some(c=>a(c))})},Ct=e=>{if(j(e))return!0;const t=f(e);if(t!==void 0&&j(t))return!0;const s=t??e;return(n.isIdentifier(s)?[s]:s.getDescendantsOfKind(d.Identifier)).some(r=>{const o=f(r);return o!==void 0&&j(o)})},Lt=e=>{const t=f(e)??e;if(O(t).some(r=>I(r,t)&&ye(T(r))&&!pt(r,t)))return!1;if(xe(e,e)||de(e,e))return!0;const s=f(e)??e;return(n.isIdentifier(s)?[s]:s.getDescendantsOfKind(d.Identifier)).some(r=>!I(r,s)&&!fe(r,s)&&de(r,s))},q=(e,t)=>L(e,t),zt=(e,t)=>{if(q(e,t))return!0;const s=Y(e);if(s!==void 0&&q(s,t))return!0;const i=Ve(e);if(i!==void 0){const r=Y(i);return r!==void 0&&q(r,t)}return!1},Rt=(e,t)=>{const s=Q(e),i=$e(t);if(s===void 0||i===void 0||Q(i)?.compilerNode!==s.compilerNode||s.getDescendantsOfKind(d.BinaryExpression).some(c=>{const u=D(c.getLeft());return Xe(c.getOperatorToken().getKind())&&u!==void 0&&E(u.root,i)}))return!1;let o=e,a=e.getParent();for(;a!==void 0&&a.compilerNode!==s.compilerNode;){if(n.isBlock(a)){const c=a.getStatements(),u=c.findIndex(g=>g.compilerNode===o.compilerNode);if(u>0&&ct(c,u,i,s,e))return!0}o=a,a=a.getParent()}return!1},mt=/rate|limit|\bip\b|geo|throttle/iu,Et=/^run[A-Z]/u,vt=e=>n.isIdentifier(e)?(e.getSymbol()?.getDeclarations()??[]).some(s=>s.getFirstAncestorByKind(d.ImportDeclaration)?.getModuleSpecifierValue().startsWith("@lunora/")===!0):!1,xt=e=>{const t=n.isCallExpression(e)?e.getExpression():e;let s;return n.isIdentifier(t)?s=t:n.isPropertyAccessExpression(t)&&(s=t.getNameNode()),s!==void 0&&vt(n.isPropertyAccessExpression(t)?t.getExpression():s)&&!mt.test(s.getText())},At=e=>{const t=n.isCallExpression(e)?e.getExpression():void 0;if(n.isElementAccessExpression(t)){const s=t.getArgumentExpression();return(n.isStringLiteral(s)||n.isNoSubstitutionTemplateLiteral(s))&&s.getLiteralText()==="use"}return n.isPropertyAccessExpression(t)&&t.getName()==="use"},Nt=e=>{const t=e.getParent();return n.isPropertyAccessExpression(t)&&t.getExpression()===e?!Et.test(t.getName()):n.isElementAccessExpression(t)&&t.getExpression()===e?n.isStringLiteral(t.getArgumentExpression())||n.isNoSubstitutionTemplateLiteral(t.getArgumentExpression()):n.isVariableDeclaration(t)&&t.getInitializer()?.getText()===e.getText()},ht=e=>{if(n.isPropertyAccessExpression(e))return e.getName()==="ip";if(n.isElementAccessExpression(e)){const t=e.getArgumentExpression();return(n.isStringLiteral(t)||n.isNoSubstitutionTemplateLiteral(t))&&t.getLiteralText()==="ip"}return n.isBindingElement(e)?e.getDotDotDotToken()!==void 0||(e.getPropertyNameNode()?.getText()??e.getName())==="ip":n.isShorthandPropertyAssignment(e)&&e.getName()==="ip"},Pt=(e,t)=>{const s=e.getParent();if(!n.isCallExpression(s)||s.getExpression()===e)return!1;const i=s.getArguments(),r=i.indexOf(e);if(i.slice(0,Math.max(r,0)).some(c=>n.isSpreadElement(c)))return!1;const o=Ae(s.getExpression()),a=r===-1||o===void 0?void 0:o.getParameters()[r];return o===void 0||a===void 0||a.isRestParameter()||!n.isIdentifier(a.getNameNode())?!1:t.has(a.compilerNode)?!0:(t.add(a.compilerNode),!we(o,a,t))},be=(e,t,s=new Set)=>{if(t===void 0||!n.isIdentifier(e))return!1;const i=p(e);if(i?.compilerNode===t.compilerNode)return!0;if(i===void 0||s.has(i.compilerNode))return!1;s.add(i.compilerNode);const r=n.isVariableDeclaration(i)&&n.isIdentifier(i.getNameNode())?i.getInitializer():void 0;return r!==void 0&&be(r,t,s)},It=e=>{const t=e.getParent();return n.isParameterDeclaration(t)||n.isBindingElement(t)||n.isVariableDeclaration(t)?t.getInitializer()!==e:!1},yt=e=>n.isArrowFunction(e)||n.isFunctionExpression(e)||n.isFunctionDeclaration(e)||n.isMethodDeclaration(e),Dt=(e,t)=>!n.isBindingElement(e)||e.getDotDotDotToken()===void 0?!1:e.getFirstAncestorByKind(d.Parameter)?.getParent()?.getAncestors().some(r=>r!==t&&yt(r)&&r.getAncestors().includes(t))===!0,we=(e,t,s)=>{for(const i of e.getDescendants())if(ht(i)&&!Dt(i,e)||At(i)&&!xt(i.getArguments()[0])||n.isIdentifier(i)&&(ze(i)||be(i,t))&&!Nt(i)&&!It(i)&&!Pt(i,s))return!0;return!1},kt=e=>we(e,void 0,new Set);export{Ct as a,Ft as b,Lt as c,Rt as d,zt as e,q as f,k as g,Bt as i,kt as m,N as r,Y as s};
|