@lunora/codegen 1.0.0-alpha.139 → 1.0.0-alpha.140
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/{GENERATED_HEADER-BT6vm22F.mjs → GENERATED_HEADER-BgmuZY9e.mjs} +1 -1
- package/dist/packem_shared/{OPENRPC_VERSION-CgE7dKyx.mjs → OPENRPC_VERSION-B9ZC0SrC.mjs} +1 -1
- package/dist/packem_shared/{SCHEMA_SNAPSHOT_FILENAME--KH8_wfq.mjs → SCHEMA_SNAPSHOT_FILENAME-BqXGGcOj.mjs} +1 -1
- package/dist/packem_shared/{SCHEMA_SNAPSHOT_VERSION-CftvRWB8.mjs → SCHEMA_SNAPSHOT_VERSION-DLXXalg2.mjs} +1 -1
- package/dist/packem_shared/{SchemaSnapshotParseError-D2h88OHU.mjs → SchemaSnapshotParseError-CvPTjDrT.mjs} +1 -1
- package/dist/packem_shared/{buildOpenApiDocument-DKGnSpzJ.mjs → buildOpenApiDocument-DLEWgA5Y.mjs} +1 -1
- package/dist/packem_shared/{emit-CMv9Snzk.mjs → emit-s6mHBmXu.mjs} +1 -1
- package/dist/packem_shared/{emitApp-BVvidAuv.mjs → emitApp-1QfYpsq0.mjs} +1 -1
- package/package.json +14 -10
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{SCHEMA_SNAPSHOT_VERSION as t,diffSchemaSnapshots as s,serializeSchemaSnapshot as a}from"./packem_shared/SCHEMA_SNAPSHOT_VERSION-
|
|
1
|
+
import{SCHEMA_SNAPSHOT_VERSION as t,diffSchemaSnapshots as s,serializeSchemaSnapshot as a}from"./packem_shared/SCHEMA_SNAPSHOT_VERSION-DLXXalg2.mjs";import{formatAdvisories as m,lintSchema as d,toAdvisorContext as f}from"./packem_shared/formatAdvisories-CkEu1eye.mjs";import{describeErrorLevelFindings as c,errorAdvisoryNames as n,errorPlatformDiagnosticNames as S}from"./packem_shared/describeErrorLevelFindings-D23VSkFP.mjs";import{CodegenDiagnosticError as E,diagnosticAt as x}from"./packem_shared/CodegenDiagnosticError-BUXlG3P-.mjs";import{AGENTS_FILENAME as u,discoverAgents as v}from"./packem_shared/AGENTS_FILENAME-D1qA0h5m.mjs";import{default as g}from"./packem_shared/discoverAuthApiCalls-C35kkayg.mjs";import{CONTAINERS_FILENAME as R,discoverContainers as M}from"./packem_shared/CONTAINERS_FILENAME-oKaARMoA.mjs";import{default as C}from"./packem_shared/discoverCrons-wXBfQcfn.mjs";import{FLAGS_FILENAME as T,discoverFlags as I}from"./packem_shared/FLAGS_FILENAME-BasxlnVS.mjs";import{default as F}from"./packem_shared/discoverFunctions-BBDziFXy.mjs";import{default as P}from"./packem_shared/discoverHttpRoutes-Dmow2gql.mjs";import{default as G}from"./packem_shared/discoverInserts-C5l2INmE.mjs";import{d as b}from"./packem_shared/index-CCDlo9L7.mjs";import{default as y}from"./packem_shared/discoverMigrations-CWH7T6qz.mjs";import{MUTATORS_FILENAME as j,discoverMutators as K}from"./packem_shared/MUTATORS_FILENAME-DJvAhDlD.mjs";import{default as z}from"./packem_shared/discoverNondeterministicCalls-JsO91i57.mjs";import{NOTIFY_FILENAME as w,discoverNotifyCalls as q,discoverNotifyConfig as B}from"./packem_shared/NOTIFY_FILENAME-B-eIjru_.mjs";import{default as Y}from"./packem_shared/readPackageDependencies-C6h6FZuP.mjs";import{d as Z}from"./packem_shared/queries-B_xEHIeL.mjs";import{QUEUES_FILENAME as ee,discoverQueues as re}from"./packem_shared/QUEUES_FILENAME-D229WtRm.mjs";import{default as te}from"./packem_shared/discoverR2sqlCalls-BbfOpwE4.mjs";import{default as ae}from"./packem_shared/discoverRlsProcedures-CRshfYZE.mjs";import{default as me}from"./packem_shared/discoverRlsMetadata-DGUGYgWs.mjs";import{discoverSandboxUsage as fe}from"./packem_shared/discoverSandboxUsage-DdewAOuj.mjs";import{default as ce}from"./packem_shared/discoverSchema-Bp8DcNq7.mjs";import{SHAPES_FILENAME as Se,discoverShapes as le}from"./packem_shared/SHAPES_FILENAME-BTdasTq2.mjs";import{default as xe}from"./packem_shared/discoverStorageRulesMetadata-gyO60A5S.mjs";import{WORKFLOWS_FILENAME as ue,discoverWorkflows as ve}from"./packem_shared/WORKFLOWS_FILENAME-DRaiCNa6.mjs";import{G as ge,e as Oe,a as Re,b as Me,c as he,d as Ce,f as _e,g as Te,h as Ie,i as Le,j as Fe,k as De,l as Pe,m as Ue}from"./packem_shared/emit-s6mHBmXu.mjs";import{emitApp as He}from"./packem_shared/emitApp-1QfYpsq0.mjs";import{buildOpenApiDocument as ke,emitOpenApi as ye,emitOpenApiModule as We}from"./packem_shared/buildOpenApiDocument-DLEWgA5Y.mjs";import{OPENRPC_VERSION as Ke,buildOpenRpcDocument as Ve,emitOpenRpc as ze,emitOpenRpcModule as Qe}from"./packem_shared/OPENRPC_VERSION-B9ZC0SrC.mjs";import{DEFAULT_TARGET as qe,platformMatrixIds as Be,readProjectTarget as Je,resolveCodegenTarget as Ye}from"./packem_shared/DEFAULT_TARGET-CrhWLUK7.mjs";import{SCHEMA_SNAPSHOT_FILENAME as Ze,createCodegenProject as $e,findTsconfig as er,refreshCodegenProject as rr,runCodegen as or}from"./packem_shared/SCHEMA_SNAPSHOT_FILENAME-BqXGGcOj.mjs";import{SchemaSnapshotParseError as sr,buildSchemaSnapshot as ar,evaluateSchemaDrift as ir,parseSchemaSnapshot as mr}from"./packem_shared/SchemaSnapshotParseError-CvPTjDrT.mjs";import{schemaFromIr as fr}from"./packem_shared/schemaFromIr-BWFnvCVg.mjs";import{LUNORA_ERROR_CODES as cr,validatorIrToJsonSchema as nr}from"./packem_shared/LUNORA_ERROR_CODES-BYg8Lpgb.mjs";import{SDK_LANGUAGES as lr,SDK_TARGETS as Er,generateSdk as xr}from"./packem_shared/SDK_LANGUAGES-CFyux-74.mjs";import{redact as ur,secretKindOf as vr}from"./packem_shared/redact-Cy14LEnc.mjs";import{MESSAGE_SOLUTIONS as gr,findSolutionByMessage as Or}from"@lunora/errors";import{isTypedSchema as Mr}from"./packem_shared/isTypedSchema-B_qlBbE-.mjs";const e="0.0.0";export{u as AGENTS_FILENAME,R as CONTAINERS_FILENAME,E as CodegenDiagnosticError,qe as DEFAULT_TARGET,T as FLAGS_FILENAME,ge as GENERATED_HEADER,cr as LUNORA_ERROR_CODES,gr as LUNORA_SOLUTION_RULES,j as MUTATORS_FILENAME,w as NOTIFY_FILENAME,Ke as OPENRPC_VERSION,ee as QUEUES_FILENAME,Ze as SCHEMA_SNAPSHOT_FILENAME,t as SCHEMA_SNAPSHOT_VERSION,lr as SDK_LANGUAGES,Er as SDK_TARGETS,Se as SHAPES_FILENAME,sr as SchemaSnapshotParseError,e as VERSION,ue as WORKFLOWS_FILENAME,ke as buildOpenApiDocument,Ve as buildOpenRpcDocument,ar as buildSchemaSnapshot,$e as createCodegenProject,c as describeErrorLevelFindings,x as diagnosticAt,s as diffSchemaSnapshots,v as discoverAgents,g as discoverAuthApiCalls,M as discoverContainers,C as discoverCrons,I as discoverFlags,F as discoverFunctions,P as discoverHttpRoutes,G as discoverInserts,b as discoverMaskProcedures,y as discoverMigrations,K as discoverMutators,z as discoverNondeterministicCalls,q as discoverNotifyCalls,B as discoverNotifyConfig,Z as discoverQueries,re as discoverQueues,te as discoverR2sqlCalls,me as discoverRlsMetadata,ae as discoverRlsProcedures,fe as discoverSandboxUsage,ce as discoverSchema,le as discoverShapes,xe as discoverStorageRulesMetadata,ve as discoverWorkflows,Oe as emitAgents,Re as emitApi,He as emitApp,Me as emitCollections,he as emitContainers,Ce as emitCrons,_e as emitDataModel,Te as emitDrizzleSchema,Ie as emitFunctions,ye as emitOpenApi,We as emitOpenApiModule,ze as emitOpenRpc,Qe as emitOpenRpcModule,Le as emitServer,Fe as emitShard,De as emitVectors,Pe as emitWorkflows,Ue as emitWranglerCronTriggers,n as errorAdvisoryNames,S as errorPlatformDiagnosticNames,ir as evaluateSchemaDrift,Or as findLunoraSolution,er as findTsconfig,m as formatAdvisories,xr as generateSdk,Mr as isTypedSchema,d as lintSchema,mr as parseSchemaSnapshot,Be as platformMatrixIds,Y as readPackageDependencies,Je as readProjectTarget,ur as redact,rr as refreshCodegenProject,Ye as resolveCodegenTarget,or as runCodegen,fr as schemaFromIr,vr as secretKindOf,a as serializeSchemaSnapshot,f as toAdvisorContext,nr as validatorIrToJsonSchema};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./SCHEMA_SNAPSHOT_VERSION-
|
|
1
|
+
import"./SCHEMA_SNAPSHOT_VERSION-DLXXalg2.mjs";import{G as t,U as m,n as r,e as o,a as n,b as l,c as A,d as E,f as S,g,h as C,o as c,p as d,i as p,j as u,k as D,l as f,m as h}from"./emit-s6mHBmXu.mjs";import"./paths-C-9fwEgQ.mjs";export{t as GENERATED_HEADER,m as UMBRELLA_BASE_PACKAGES,r as buildStorageColumns,o as emitAgents,n as emitApi,l as emitCollections,A as emitContainers,E as emitCrons,S as emitDataModel,g as emitDrizzleSchema,C as emitFunctions,c as emitQueues,d as emitSeed,p as emitServer,u as emitShard,D as emitVectors,f as emitWorkflows,h as emitWranglerCronTriggers};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{G as c}from"./emit-
|
|
1
|
+
import{G as c}from"./emit-s6mHBmXu.mjs";import{s as u}from"./paths-C-9fwEgQ.mjs";import{validatorIrToJsonSchema as m,objectSchema as p,LUNORA_ERROR_CODES as i}from"./LUNORA_ERROR_CODES-BYg8Lpgb.mjs";const l="1.3.2",d={description:"Result is TS-inferred from the function's return type (no `.output()` declared); best-effort — any JSON."},R=e=>{const n=u(e.filePath),o=`${n}:${e.exportName}`;return{description:`Invoke the \`${e.kind}\` \`${o}\` over the Lunora RPC envelope (POST /_lunora/rpc, body \`{ "functionPath": "${o}", "args": { … } }\`).`,errors:i.map((r,s)=>({code:-32e3-s,data:{code:r},message:r})),name:o,params:[{description:"The function's argument object (the RPC envelope's `args`).",name:"args",required:Object.keys(e.args).length>0,schema:p(e.args)}],result:{name:"result",schema:e.output?m(e.output):d},summary:`${e.kind}: ${o}`,"x-lunora-function-kind":e.kind,"x-tags":[{name:n}]}},g=e=>{const n=e.version??"0.0.0",r=e.functions.filter(t=>t.visibility!=="internal"&&t.kind!=="stream").map(t=>R(t)).toSorted((t,a)=>t.name.localeCompare(a.name));return{info:{description:"Auto-generated from @lunora/values-typed functions by @lunora/codegen. Do not edit — run `lunora codegen` to regenerate.",title:"Lunora RPC",version:n},methods:r,openrpc:l}},S=e=>`${JSON.stringify(g(e),void 0,2)}
|
|
2
2
|
`,v=e=>`${c}export const openRpcSpec: Record<string, unknown> = ${JSON.stringify(e,void 0,4)};
|
|
3
3
|
`;export{l as OPENRPC_VERSION,g as buildOpenRpcDocument,S as emitOpenRpc,v as emitOpenRpcModule};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{existsSync as b,mkdirSync as ss,readFileSync as At,writeFileSync as ns,rmSync as rs}from"node:fs";import{join as f,dirname as fe}from"node:path";import{performance as pe}from"node:perf_hooks";import{runAdvisor as is}from"@lunora/advisor";import{LunoraError as k}from"@lunora/errors";import{SyntaxKind as l,Node as o,Project as Xe}from"ts-morph";import{serializeSchemaSnapshot as os}from"./SCHEMA_SNAPSHOT_VERSION-
|
|
1
|
+
import{existsSync as b,mkdirSync as ss,readFileSync as At,writeFileSync as ns,rmSync as rs}from"node:fs";import{join as f,dirname as fe}from"node:path";import{performance as pe}from"node:perf_hooks";import{runAdvisor as is}from"@lunora/advisor";import{LunoraError as k}from"@lunora/errors";import{SyntaxKind as l,Node as o,Project as Xe}from"ts-morph";import{serializeSchemaSnapshot as os}from"./SCHEMA_SNAPSHOT_VERSION-DLXXalg2.mjs";import{toAdvisorContext as as}from"./formatAdvisories-CkEu1eye.mjs";import{discoverAgents as cs}from"./AGENTS_FILENAME-D1qA0h5m.mjs";import{discoverContainers as ls}from"./CONTAINERS_FILENAME-oKaARMoA.mjs";import{diagnosticAt as se}from"./CodegenDiagnosticError-BUXlG3P-.mjs";import{b as ne}from"./module-specifiers-WF8iAydP.mjs";import{C as ge,i as us,f as ds,n as fs,j as ps,b as gs,c as ms,l as hs,e as xs,o as Es,d as vs,k as Ss,g as As,p as ys,m as Ns,a as bs,h as Ps}from"./emit-s6mHBmXu.mjs";import{l as g,a as E,f as P,p as y,g as yt,j as Ee,h as Is,i as L,b as Ze,r as Nt,e as ws}from"./ast-CjWtsS6S.mjs";import Ts from"./readPackageDependencies-C6h6FZuP.mjs";import{discoverQueues as Cs}from"./QUEUES_FILENAME-D229WtRm.mjs";import{discoverSandboxUsage as Fs}from"./discoverSandboxUsage-DdewAOuj.mjs";import Os from"./discoverStorageRulesMetadata-gyO60A5S.mjs";import{discoverWorkflows as Rs}from"./WORKFLOWS_FILENAME-DRaiCNa6.mjs";import{gatePlatformFeatures as Ls,resolveCodegenTarget as Ds}from"./DEFAULT_TARGET-CrhWLUK7.mjs";import{i as T,a as M,e as v,r as ks,b as Ms,s as re,c as Ks,f as _s,d as zs}from"./queries-B_xEHIeL.mjs";import{a as A,c as K,d as bt,e as Us}from"./classify-procedure-call-AKeIK05y.mjs";import Bs from"./discoverAuthApiCalls-C35kkayg.mjs";import qs from"./discoverCrons-wXBfQcfn.mjs";import Je from"./discoverFunctions-BBDziFXy.mjs";import{i as $s,r as js,e as Vs}from"./unwrap-handler-return-CmIWbykC.mjs";import et from"./discoverHttpRoutes-Dmow2gql.mjs";import Ws from"./discoverInserts-C5l2INmE.mjs";import{m as Ae,a as X,s as Pt,d as Hs}from"./index-CCDlo9L7.mjs";import{e as It}from"./exported-procedure-chains-MlZRKqSD.mjs";import Gs from"./discoverMigrations-CWH7T6qz.mjs";import{MUTATORS_FILENAME as Ys,isDefineMutatorCallee as Qs,discoverMutators as tt}from"./MUTATORS_FILENAME-DJvAhDlD.mjs";import Xs from"./discoverNondeterministicCalls-JsO91i57.mjs";import{discoverNotifyConfig as Zs,discoverNotifyCalls as Js}from"./NOTIFY_FILENAME-B-eIjru_.mjs";import en from"./discoverR2sqlCalls-BbfOpwE4.mjs";import tn from"./discoverRlsProcedures-CRshfYZE.mjs";import sn from"./discoverRlsMetadata-DGUGYgWs.mjs";import nn from"./discoverSchema-Bp8DcNq7.mjs";import{secretKindOf as rn,redact as on,isHeuristicSecretKind as an,isSecretishName as cn}from"./redact-Cy14LEnc.mjs";import{discoverShapes as ln}from"./SHAPES_FILENAME-BTdasTq2.mjs";import{emitApp as un}from"./emitApp-1QfYpsq0.mjs";import{buildOpenApiDocument as dn,emitOpenApiModule as fn}from"./buildOpenApiDocument-DLEWgA5Y.mjs";import{buildOpenRpcDocument as pn,emitOpenRpcModule as gn}from"./OPENRPC_VERSION-B9ZC0SrC.mjs";import{s as mn}from"./parse-validator-BFTp87yz.mjs";import{buildSchemaSnapshot as hn}from"./SchemaSnapshotParseError-CvPTjDrT.mjs";const xn=e=>{const t=[],s=e.tables.filter(n=>n.shardMode==="global");return s.some(n=>n.globalBackend!=="hyperdrive")&&t.push({name:"@lunora/d1",reason:"`.global()` tables are D1-backed, so `_generated/app.ts` imports the D1 `ctx.db` adapter"}),s.some(n=>n.globalBackend==="hyperdrive")&&t.push({name:"@lunora/hyperdrive",reason:'`.global({ backend: "hyperdrive" })` tables route through `@lunora/hyperdrive/global`'}),e.vectorIndexes.length>0&&t.push({name:"@lunora/bindings",reason:"`.vectorize()` indexes make `_generated/vectors.ts` import `@lunora/bindings/vectors`"}),t},En=(e,t)=>{if(t===void 0)return;const s=xn(e).filter(i=>!t.has(i.name));if(s.length===0)return;const n=s.map(i=>` - ${i.name} — ${i.reason}`).join(`
|
|
2
2
|
`);throw new k("INTERNAL",`@lunora/codegen: this schema's generated code imports packages the project does not declare:
|
|
3
3
|
${n}
|
|
4
4
|
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
const r=(e,i=2166136261)=>{let t=i;for(let s=0;s<e.length;s+=1)t^=e.codePointAt(s)??0,t=Math.imul(t,16777619);return(t>>>0).toString(16).padStart(8,"0")},l=e=>`${r(e,2166136261)}${r(e,16777619)}`,g=1;function S(e){const i={},t=Object.keys(e);t.sort();for(const s of t)i[s]=e[s];return i}const c=e=>`${JSON.stringify(e,void 0,2)}
|
|
2
|
-
`,$=e=>l(c(e)),a=e=>typeof e=="object"&&e!==null,
|
|
2
|
+
`,$=e=>l(c(e)),a=e=>typeof e=="object"&&e!==null,p=e=>a(e)&&a(e.fields)&&a(e.indexes)&&a(e.relations)&&typeof e.shardMode=="string",O=e=>{if(e===void 0||e.trim()==="")return{status:"absent"};let i;try{i=JSON.parse(e)}catch(s){return{error:`baseline is not valid JSON: ${s instanceof Error?s.message:String(s)}`,status:"invalid"}}if(!a(i)||i.version!==1||!a(i.tables))return{error:`baseline is malformed or written by an incompatible version (expected version ${String(1)})`,status:"invalid"};for(const[s,o]of Object.entries(i.tables))if(!p(o))return{error:`baseline table "${s}" has an invalid structure`,status:"invalid"};return{snapshot:{jurisdiction:typeof i.jurisdiction=="string"?i.jurisdiction:void 0,migrationIds:Array.isArray(i.migrationIds)?i.migrationIds:[],tables:i.tables,version:1},status:"ok"}},f=(e,i)=>e.unique===i.unique&&e.fields.length===i.fields.length&&e.fields.every((t,s)=>t===i.fields[s]),h=(e,i,t,s)=>{const o=[];return t.kind!==s.kind&&o.push({severity:"breaking",summary:`field ${e}.${i} changed type: ${t.kind} → ${s.kind} — add a data migration to convert existing values`,table:e,scope:"table",type:"changedFieldKind"}),t.optional&&!s.optional?o.push({severity:"breaking",summary:`field ${e}.${i} became required — rows missing it would be invalid; add a data migration to backfill it`,table:e,scope:"table",type:"fieldOptionalToRequired"}):!t.optional&&s.optional&&o.push({scope:"table",severity:"safe",summary:`field ${e}.${i} became optional`,table:e,type:"fieldRequiredToOptional"}),o},u=(e,i,t)=>t.optional?{scope:"table",severity:"safe",summary:`added optional field ${e}.${i}`,table:e,type:"addedOptionalField"}:{severity:"breaking",summary:`added required field ${e}.${i} — existing rows have no value; add a data migration to backfill it`,table:e,scope:"table",type:"addedRequiredField"},y=(e,i,t,s)=>{for(const[o,d]of Object.entries(t.fields)){const n=i.fields[o];n===void 0?s.push(u(e,o,d)):s.push(...h(e,o,n,d))}for(const o of Object.keys(i.fields))t.fields[o]===void 0&&s.push({severity:"breaking",summary:`removed field ${e}.${o} — add a data migration if stored data must be cleaned up`,table:e,scope:"table",type:"removedField"})},m=(e,i,t,s)=>{for(const[o,d]of Object.entries(t.indexes)){const n=i.indexes[o];if(n===void 0){s.push({scope:"table",severity:"safe",summary:`added index ${o} on ${e}`,table:e,type:"addedIndex"});continue}f(n,d)||s.push({severity:"breaking",summary:`index ${o} on ${e} changed shape — a query may have relied on the old index`,table:e,scope:"table",type:"changedIndex"})}for(const o of Object.keys(i.indexes))t.indexes[o]===void 0&&s.push({severity:"breaking",summary:`removed index ${o} on ${e} — a query that used \`.withIndex("${o}")\` would break`,table:e,scope:"table",type:"removedIndex"})},v=(e,i,t,s)=>{for(const o of Object.keys(t.relations))i.relations[o]===void 0&&s.push({scope:"schema",severity:"safe",summary:`added relation ${e}.${o}`,table:e,type:"addedRelation"});for(const o of Object.keys(i.relations))t.relations[o]===void 0&&s.push({scope:"schema",severity:"breaking",summary:`removed relation ${e}.${o}`,table:e,type:"removedRelation"})},b=(e,i,t,s)=>{i.shardMode!==t.shardMode&&s.push({severity:"breaking",summary:`table ${e} changed shard mode: ${i.shardMode} → ${t.shardMode} — its physical storage moves, and existing rows do NOT follow the schema; re-home them with an export/import round trip (https://lunora.sh/docs/concepts/sharding#migrating-a-populated-table)`,table:e,scope:"table",type:"changedShardMode"}),y(e,i,t,s),m(e,i,t,s),v(e,i,t,s)},x=(e,i)=>{const t=[],s=e?.tables??{};for(const[o,d]of Object.entries(i.tables)){const n=s[o];if(n===void 0){t.push({scope:"table",severity:"safe",summary:`added table ${o}`,table:o,type:"addedTable"});continue}b(o,n,d,t)}for(const o of Object.keys(s))i.tables[o]===void 0&&t.push({scope:"table",severity:"breaking",summary:`removed table ${o} — add a data migration if its data must be archived/cleaned up`,table:o,type:"removedTable"});if(e!==void 0&&e.jurisdiction!==i.jurisdiction){const o=e.jurisdiction??"(none)",d=i.jurisdiction??"(none)";t.push({scope:"schema",severity:"breaking",summary:`Durable Object jurisdiction changed from ${o} to ${d} — this re-homes every DO and strands all existing shard, scheduler, and session-DO data in the old region (no in-place migration; export then import to move it). Revert the change, or override the gate to proceed intentionally.`,type:"changedJurisdiction"})}return{changes:t}};export{g as SCHEMA_SNAPSHOT_VERSION,x as diffSchemaSnapshots,$ as hashSchemaSnapshot,p as isValidTableSnapshot,O as parseSnapshotJson,c as serializeSchemaSnapshot,S as sortKeys};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{LunoraError as g}from"@lunora/errors";import{SCHEMA_SNAPSHOT_VERSION as m,sortKeys as b,diffSchemaSnapshots as S,parseSnapshotJson as k}from"./SCHEMA_SNAPSHOT_VERSION-
|
|
1
|
+
import{LunoraError as g}from"@lunora/errors";import{SCHEMA_SNAPSHOT_VERSION as m,sortKeys as b,diffSchemaSnapshots as S,parseSnapshotJson as k}from"./SCHEMA_SNAPSHOT_VERSION-DLXXalg2.mjs";import{serializeSchemaSnapshot as O}from"./SCHEMA_SNAPSHOT_VERSION-DLXXalg2.mjs";const w=e=>e==="global"||e==="root"?e:`shardBy:${e.field}`,$=e=>e.kind==="optional"?{kind:e.inner?.kind??"unknown",optional:!0}:{kind:e.kind,optional:!1},v=e=>{const t={};for(const[n,o]of Object.entries(e.shape))t[n]=$(o);const a={};for(const n of e.indexes)a[n.name]={fields:[...n.fields],unique:n.unique??!1};const s={};for(const n of e.relations)s[n.name]={field:n.field,kind:n.kind,table:n.table};return{fields:t,indexes:a,relations:s,shardMode:w(e.shardMode)}},D=(e,t)=>{const a={};for(const n of e.tables)a[n.name]=v(n);const s=[...t].sort();return{jurisdiction:e.jurisdiction,migrationIds:s,tables:b(a),version:m}};class y extends g{constructor(t){super("SCHEMA_SNAPSHOT_PARSE",t,{name:"SchemaSnapshotParseError"})}}const L=e=>{const t=k(e);if(t.status==="invalid")throw new y(t.error);return t.status==="ok"?t.snapshot:void 0},E={deploy:{allowDrift:!0,updateBaseline:!0},prepare:{allowDrift:!0,updateBaseline:!0},verify:{allowDrift:!0,updateBaseline:!1}},f=" • For backward-compatible changes (e.g. adding an optional field): pass `--allow-schema-drift` to skip the block.",p=" • To accept the new shape without a migration (you know data is compatible): pass `--update-schema-baseline`.",I=e=>{const t=e===void 0?void 0:E[e];if(e===void 0||t===void 0)return`${f}
|
|
2
2
|
${p}
|
|
3
3
|
`;const a=t.updateBaseline?p:` • To accept the new shape without a migration, run \`lunora prepare --update-schema-baseline\` — \`lunora ${e}\` does not take that flag.`;return`${f}
|
|
4
4
|
${a}
|
package/dist/packem_shared/{buildOpenApiDocument-DKGnSpzJ.mjs → buildOpenApiDocument-DLEWgA5Y.mjs}
RENAMED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{G as S}from"./emit-
|
|
1
|
+
import{G as S}from"./emit-s6mHBmXu.mjs";import{s as p}from"./paths-C-9fwEgQ.mjs";import{LUNORA_ERROR_CODES as O,objectSchema as h,validatorIrToJsonSchema as u}from"./LUNORA_ERROR_CODES-BYg8Lpgb.mjs";const E="/_lunora/rest",A=["authorization","cf-access-jwt-assertion","cookie","x-payment"],f=["x-d1-bookmark","x-lunora-shard-key"],P=e=>[...A,...(e.credentialHeaders??[]).map(t=>t.toLowerCase())],g=e=>Number.isFinite(e)?Math.max(0,Math.floor(e)):0,y=(...e)=>{const t=[];for(const r of e)for(const o of r?.split(",")??[]){const s=o.trim().toLowerCase();s!==""&&!t.includes(s)&&t.push(s)}return t.length===0?void 0:t.join(", ")},T=(e,t)=>{const r=[t,`max-age=${String(g(e.maxAge))}`];return e.staleWhileRevalidate!==void 0&&r.push(`stale-while-revalidate=${String(g(e.staleWhileRevalidate))}`),r.join(", ")},b=e=>e.scope==="public"?y(e.vary,...P(e),...f):y(e.vary,...f),x=e=>{const t=e.indexOf(":");if(!(t<=0||t>=e.length-1||e.indexOf(":",t+1)!==-1))return{name:e.slice(t+1),namespace:e.slice(0,t)}},N=e=>{const t=x(e);if(t!==void 0)return`${E}/${t.namespace}/${t.name}`},k=e=>e==="query"?"GET":"POST",m="#/components/responses/LunoraError",v=/:([A-Za-z_$][\w$]*)/gu,q=e=>[...e.matchAll(v)].map(t=>t[1]),_=e=>e.replaceAll(v,"{$1}"),l=e=>e.kind==="optional"?e.inner??e:e,j=e=>{const t=new Set(q(e.path)),r=[];for(const[o,s]of Object.entries(e.searchParams)){const c=l(s);r.push({description:`Query parameter \`${o}\``,in:"query",name:o,required:s.kind!=="optional",schema:u(c)})}for(const[o,s]of Object.entries(e.params)){const c=l(s);r.push({description:`Path parameter \`${o}\``,in:t.has(o)?"path":"query",name:o,required:t.has(o)?!0:s.kind!=="optional",schema:u(c)})}return r},$=e=>e?{content:{"application/json":{schema:u(e)}},description:"Successful response."}:{content:{"application/json":{schema:{description:"Return shape is TS-inferred (no `.output()` declared); best-effort — any JSON."}}},description:"Successful response. The return shape is TypeScript-inferred and not declared via `.output()`, so it is documented best-effort."},C=e=>{const t=p(e.filePath),r=j(e),o={description:`${e.stream?"Streaming (SSE) ":""}HTTP route handler \`${e.exportName}\` (${e.method} ${e.path}).`,operationId:`${e.method.toLowerCase()}_${p(e.path)}`,responses:{200:$(e.output),204:{description:"No content (handler returned `undefined`)."},default:{$ref:m}},summary:`${e.method} ${e.path}`,tags:[t]};return r.length>0&&(o.parameters=r),Object.keys(e.body).length>0&&(o.requestBody={content:{"application/json":{schema:h(e.body)}},required:!0}),e.stream&&(o["x-lunora-stream"]="text/event-stream"),o},w=e=>{const t=p(e.filePath),r=`${t}:${e.exportName}`,o={additionalProperties:!1,properties:{args:h(e.args),functionPath:{const:r,type:"string"},shardKey:{description:"Optional shard key; omitted routes to the default shard.",type:"string"}},required:["functionPath"],type:"object"};return{operation:{description:`Invoke the \`${e.kind}\` \`${r}\` over the Lunora RPC envelope (POST /_lunora/rpc).`,operationId:r,requestBody:{content:{"application/json":{schema:o}},required:!0},responses:{200:$(e.output),default:{$ref:m}},summary:`${e.kind}: ${r}`,tags:[t],"x-lunora-function-kind":e.kind},pathKey:`/_lunora/rpc#${r}`}},D=(e,t)=>{if(e===void 0||t!=="get"||e.scope===void 0||e.maxAge===void 0)return{};const r={maxAge:e.maxAge,scope:e.scope,...e.staleWhileRevalidate===void 0?{}:{staleWhileRevalidate:e.staleWhileRevalidate},...e.tag===void 0?{}:{tag:e.tag},...e.vary===void 0?{}:{vary:e.vary}},o={"Cache-Control":{description:r.scope==="public"?"Caching policy. `public` applies only to an uncredentialed request — a request carrying `Authorization` or `Cookie` is always answered `private`.":"Caching policy. Restricted to the caller's own cache; never stored by a shared/edge cache.",schema:{example:T(r,r.scope),type:"string"}}};r.tag!==void 0&&(o["Cache-Tag"]={description:"Purge tag for `ctx.cache.purge({ tags: [...] })`.",schema:{example:r.tag,type:"string"}});const s=b(r);return s!==void 0&&(o.Vary={description:"Request headers this response varies by. The endpoint's own negotiated headers are merged in at runtime.",schema:{example:s,type:"string"}}),{headers:o}},L=e=>{const t=p(e.filePath),r=`${t}:${e.exportName}`,o=N(r);if(o===void 0)return;const s=k(e.kind),c=s==="GET",d={description:`Public REST endpoint for the \`${e.kind}\` \`${r}\` (opt-in via \`.expose({ rest: true })\`). Routed through the procedure, so auth / RLS / validators are enforced.`,operationId:`rest_${p(o)}`,responses:{200:{content:{"application/json":{schema:{description:"Procedure result. The shape is TS-inferred from the return type; best-effort — any JSON."}}},description:"Successful result (TypeScript-inferred return shape, documented best-effort).",...D(e.expose?.cache,c?"get":"post")},default:{$ref:m}},summary:`${s} ${o}`,tags:[t],"x-lunora-function-kind":e.kind};if(c){const n=Object.entries(e.args).map(([a,i])=>{const R=l(i);return{description:`Argument \`${a}\` (JSON-encoded for non-string values).`,in:"query",name:a,required:i.kind!=="optional",schema:u(R)}});return n.length>0&&(d.parameters=n),{method:"get",operation:d,path:o}}return d.requestBody={content:{"application/json":{schema:h(e.args)}},required:Object.keys(e.args).length>0},{method:"post",operation:d,path:o}},I=e=>{const t=e.version??"0.0.0",r={},o=new Set;for(const n of e.httpRoutes){const a=_(n.path),i=r[a]??{};i[n.method.toLowerCase()]=C(n),r[a]=i,o.add(p(n.filePath))}const s=e.functions.filter(n=>n.visibility!=="internal"&&n.kind!=="stream");for(const n of s){const{operation:a,pathKey:i}=w(n);r[i]={post:a},o.add(p(n.filePath))}for(const n of s){if(n.expose?.rest!==!0)continue;const a=L(n);if(a===void 0)continue;const i=r[a.path]??{};i[a.method]=a.operation,r[a.path]=i}const c=[...o].toSorted((n,a)=>n.localeCompare(a)).map(n=>({description:`Operations declared in \`lunora/${n}\`.`,name:n}));return{components:{responses:{LunoraError:{content:{"application/json":{schema:{additionalProperties:!1,description:"Standard Lunora error envelope.",properties:{error:{additionalProperties:!1,properties:{code:{description:"Machine-readable error code. Clients switch on this value.",enum:O,type:"string"},message:{description:"Human-readable error message (never echoes internal details).",type:"string"}},required:["code","message"],type:"object"}},required:["error"],type:"object"}}},description:"A Lunora error response. The HTTP status reflects the error code (e.g. BAD_REQUEST→400, UNAUTHORIZED→401, FORBIDDEN→403, NOT_FOUND→404)."}}},info:{description:"Auto-generated from @lunora/values-typed functions by @lunora/codegen. Do not edit — run `lunora codegen` to regenerate.",title:"Lunora API",version:t},openapi:"3.1.0",paths:r,tags:c}},J=e=>`${JSON.stringify(I(e),void 0,2)}
|
|
2
2
|
`,U=e=>`${S}export const openApiSpec: Record<string, unknown> = ${JSON.stringify(e,void 0,4)};
|
|
3
3
|
`;export{I as buildOpenApiDocument,J as emitOpenApi,U as emitOpenApiModule};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{agentComponent as dt}from"@lunora/agent/component";import{LunoraError as Z}from"@lunora/errors";import{serializeSchemaSnapshot as kn,hashSchemaSnapshot as xn}from"./SCHEMA_SNAPSHOT_VERSION-
|
|
1
|
+
import{agentComponent as dt}from"@lunora/agent/component";import{LunoraError as Z}from"@lunora/errors";import{serializeSchemaSnapshot as kn,hashSchemaSnapshot as xn}from"./SCHEMA_SNAPSHOT_VERSION-DLXXalg2.mjs";import{s as N}from"./paths-C-9fwEgQ.mjs";const ut=[{contextProperty:"access",key:"access",moduleSpecifier:"@lunora/cloudflare-access"},{appMethod:{configKey:"ai",doc:"Override the Workers AI binding backing `ctx.ai` (defaults to `env.AI`).",method:"ai"},contextProperty:"ai",key:"ai",moduleSpecifier:"@lunora/ai"},{appMethod:{configKey:"analytics",doc:"Override the Analytics Engine dataset backing `ctx.analytics` (defaults to `env.ANALYTICS`).",method:"analytics"},contextProperty:"analytics",key:"analytics",moduleSpecifier:"@lunora/bindings/analytics",serverCtxField:{field:`
|
|
2
2
|
/** Analytics Engine telemetry sink. Fire-and-forget and sampled; do not read it back in-handler. */
|
|
3
3
|
readonly analytics: import("@lunora/bindings/analytics").AnalyticsClient;`,tier:"every"}},{appMethod:{configKey:"browser",doc:"Override the Browser Rendering binding backing `ctx.browser` (defaults to `env.BROWSER`).",method:"browser"},contextProperty:"browser",key:"browser",moduleSpecifier:"@lunora/browser",serverCtxField:{field:`
|
|
4
4
|
/** Browser Rendering (screenshots/PDF/scrape). Non-deterministic — available only in actions. */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{A as S,G as D}from"./emit-
|
|
1
|
+
import{A as S,G as D}from"./emit-s6mHBmXu.mjs";const E=e=>`has${e.charAt(0).toUpperCase()}${e.slice(1)}`,v=S.map(({appMethod:e,key:t})=>[E(t),e.method,e.configKey,e.doc]),m=e=>v.some(([t])=>e[t]),A=e=>e?['import * as lunoraIdentityContract from "../identity.js";']:[],R=(e,t)=>e?['import type { CreateAccessResolverOptions } from "@lunora/cloudflare-access";',`import { createAccessResolver${t?", composeResolvers":""} } from "@lunora/cloudflare-access";`]:[],x=e=>e?['import { createKvIntrospectorFromEnv } from "@lunora/bindings/kv";']:[],C=e=>e?['import notifyConfig from "../notify.js";']:[],k=e=>(e.emailAgents?.length??0)>0,O=e=>k(e)?['import { dispatchAgentEmail } from "@lunora/agent/inbound";']:[],T=e=>k(e)?['import * as lunoraAgentDefinitions from "../agents.js";']:[],L=e=>{const{hasAccess:t,hasAuth:a,hasFramework:r,hasGlobal:n,hasHyperdriveGlobal:o,hasKv:c,hasQueue:s,hasScheduler:d,hasStorage:h,hasWorkflow:u,useUmbrella:l,wantsOpenApi:p,wantsOpenRpc:b}=e,i=l?"lunorash/runtime":"@lunora/runtime",g=["ExecutionContextLike","HttpRouterLike","LunoraWorker","Route","ScheduledControllerLike","ShardNamespaceLike","WorkerOptions"];n&&g.push("GlobalIntrospector","AdminTableResolver"),r&&g.push("FrameworkHostHandler");const w=[...n||o?["createCrossShardRelationCapabilities"]:[],"createWorker","resolveLogArchiveFromEnv",...r?["withFrameworkWorker"]:[]].join(", ");return[...a?['import type { AuthNamespaceLike, LunoraAuth, LunoraAuthOptions } from "@lunora/auth";','import { createAuth, createAuthAdmin, createAuthAuditReader, createDoAuthWiring, d1Executor, ensureMigrated, handleAuthRequest, lunoraD1Adapter } from "@lunora/auth";']:[],...R(t,a),...n?['import type { D1CtxDbOptions, D1DatabaseLike, D1Exec } from "@lunora/d1";','import { applyCdcChanges, createD1CtxDb, exportGlobalRows, facetGlobalColumn, importGlobalRows, listGlobalTables, readD1CdcChanges, readGlobalTablePage, retryingExec } from "@lunora/d1";']:[],...o?['import type { HyperdriveEngine } from "@lunora/hyperdrive/global";','import { createHyperdriveGlobalCtxDb } from "@lunora/hyperdrive/global";','import type { SqlCtxDbOptions, SqlExec } from "@lunora/sql-store";']:[],...x(c),...d?['import type { DurableObjectNamespaceLike } from "@lunora/scheduler";','import { createScheduler } from "@lunora/scheduler";']:[],...h?['import type { R2BucketLike, Storage } from "@lunora/storage";','import { createBucketStorage, createStorage } from "@lunora/storage";']:[],...u?['import { createWorkflowsRestClient } from "@lunora/workflow";']:[],...O(e),`import type { ${[...g].toSorted((f,y)=>f.localeCompare(y)).join(", ")} } from "${i}";`,`import { ${w} } from "${i}";`,"",...A(e.identity),...T(e),...n||o?['import schema from "../schema.js";']:[],...C(e.hasNotify),'import { LUNORA_CRONS } from "./crons.js";','import { LUNORA_FUNCTIONS } from "./functions.js";',...s?['import { createQueueCaptureSink, dispatchQueueBatch, shouldCaptureQueue } from "@lunora/queue";','import { LUNORA_QUEUE_REGISTRY } from "./queues.js";']:[],...p?['import { openApiSpec } from "./openapi.js";']:[],...b?['import { openRpcSpec } from "./openrpc.js";']:[],'import { createShardDO } from "./shard.js";']},q=e=>[...e.hasStorage?[`/** \`.storage(...)\` declaration — one bucket (required) plus optional extra named buckets and signed-URL config. Backs \`ctx.storage\` AND the studio file browser. */
|
|
2
2
|
interface StorageDeclaration<Env> {
|
|
3
3
|
/** The default R2 bucket binding (the bare \`ctx.storage\`). */
|
|
4
4
|
bucket: Selector<Env, R2BucketLike>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lunora/codegen",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.140",
|
|
4
4
|
"description": "Code generator for Lunora: emits _generated/{api,server,dataModel}.ts from your schema",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cloudflare",
|
|
@@ -46,19 +46,23 @@
|
|
|
46
46
|
"access": "public"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@lunora/advisor": "1.0.0-alpha.
|
|
50
|
-
"@lunora/agent": "1.0.0-alpha.
|
|
51
|
-
"@lunora/container": "1.0.0-alpha.
|
|
52
|
-
"@lunora/errors": "1.0.0-alpha.
|
|
53
|
-
"@lunora/platform": "1.0.0-alpha.
|
|
54
|
-
"@lunora/queue": "1.0.0-alpha.
|
|
55
|
-
"@lunora/scheduler": "1.0.0-alpha.
|
|
56
|
-
"@lunora/values": "1.0.0-alpha.
|
|
57
|
-
"@lunora/workflow": "1.0.0-alpha.
|
|
49
|
+
"@lunora/advisor": "1.0.0-alpha.99",
|
|
50
|
+
"@lunora/agent": "1.0.0-alpha.74",
|
|
51
|
+
"@lunora/container": "1.0.0-alpha.37",
|
|
52
|
+
"@lunora/errors": "1.0.0-alpha.26",
|
|
53
|
+
"@lunora/platform": "1.0.0-alpha.21",
|
|
54
|
+
"@lunora/queue": "1.0.0-alpha.38",
|
|
55
|
+
"@lunora/scheduler": "1.0.0-alpha.44",
|
|
56
|
+
"@lunora/values": "1.0.0-alpha.33",
|
|
57
|
+
"@lunora/workflow": "1.0.0-alpha.37",
|
|
58
58
|
"jsonc-parser": "^3.3.1",
|
|
59
59
|
"quicktype-core": "^26.0.0",
|
|
60
60
|
"ts-morph": "^28.0.0"
|
|
61
61
|
},
|
|
62
|
+
"peerDependencies": {
|
|
63
|
+
"@lunora/server": ">=1.0.0-alpha.91 <2.0.0-0",
|
|
64
|
+
"@lunora/shard-engine": ">=1.0.0-alpha.45 <2.0.0-0"
|
|
65
|
+
},
|
|
62
66
|
"engines": {
|
|
63
67
|
"node": "^22.15.0 || >=24.11.0"
|
|
64
68
|
}
|