@lunora/config 1.0.0-alpha.46 → 1.0.0-alpha.461
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/LICENSE.md +336 -104
- package/README.md +6 -6
- package/dist/cli/index.d.mts +2 -0
- package/dist/cli/index.d.ts +2 -0
- package/dist/cli/index.mjs +1 -0
- package/dist/cloudflare/index.d.mts +1492 -0
- package/dist/cloudflare/index.d.ts +1492 -0
- package/dist/cloudflare/index.mjs +1 -0
- package/dist/index.d.mts +1076 -975
- package/dist/index.d.ts +1076 -975
- package/dist/index.mjs +1 -23
- package/dist/packem_shared/ACCENT-CotPTfv7.mjs +7 -0
- package/dist/packem_shared/ADVISOR_PROCEDURES_ENDPOINT-BPnqzAgT.mjs +1 -0
- package/dist/packem_shared/AGENT_MODE_ENV-D8MvSwPE.mjs +1 -0
- package/dist/packem_shared/AGENT_RULES_DIR-Bd6JPtNa.mjs +1 -0
- package/dist/packem_shared/ALLOW_FORWARDED_ENV-BUndghJx.mjs +1 -0
- package/dist/packem_shared/BINDING_MANIFEST_VERSION-CR06-eW7.mjs +1 -0
- package/dist/packem_shared/BUILD_ROOT_ENV-Dg4MV3wY.mjs +1 -0
- package/dist/packem_shared/CLOUDFLARE_CLI_CONFIG_WARNING_ENV-75Y5zVF8.mjs +1 -0
- package/dist/packem_shared/CLOUDFLARE_DRIVER-DbmpoIcg.mjs +1 -0
- package/dist/packem_shared/CLOUDFLARE_TOOLCHAIN_VERSIONS-DWyZ_2QM.mjs +1 -0
- package/dist/packem_shared/COMPOSED_WORKER_ENTRY-LpLlp-aF.mjs +1 -0
- package/dist/packem_shared/D1_PLACEHOLDER_ID-ZnDjVymH.mjs +1 -0
- package/dist/packem_shared/DEFAULT_DEPLOY_TARGET-CAJl2nEI.mjs +1 -0
- package/dist/packem_shared/DEFAULT_OBSERVABILITY-CPLADr5u.mjs +1 -0
- package/dist/packem_shared/DEV_BINDINGS_FILE-C0ZN_XlP.mjs +4 -0
- package/dist/packem_shared/DEV_VARS_EXAMPLE_FILE-hBT89IXh.mjs +6 -0
- package/dist/packem_shared/DEV_WORKER_ENV_VALUE-FoysLtF0.mjs +1 -0
- package/dist/packem_shared/GLOBAL_FETCH_STRICTLY_PUBLIC_FLAG-f8CnJha3.mjs +1 -0
- package/dist/packem_shared/LINKED_PROJECT_DIR-Ba5qPEwo.mjs +2 -0
- package/dist/packem_shared/LUNORA_EVENT_SOURCE-Cq0oj0_9.mjs +9 -0
- package/dist/packem_shared/LUNORA_IGNORED_PATHS-U93uPxrW.mjs +19 -0
- package/dist/packem_shared/LUNORA_TAG-DQTGPqcJ.mjs +1 -0
- package/dist/packem_shared/LunoraReporter-f277GLNT.mjs +6 -0
- package/dist/packem_shared/MissingBuildOutputError-BAyekzof.mjs +1 -0
- package/dist/packem_shared/PACKAGE_SECRETS_REGISTRY-CPWkw-qE.mjs +1 -0
- package/dist/packem_shared/POLICY_SCAFFOLD_ENDPOINT-DfNG44Lm.mjs +1 -0
- package/dist/packem_shared/REMOTE_ELIGIBLE_KEYS-D66_hwjD.mjs +1 -0
- package/dist/packem_shared/REQUIRED_COMPATIBILITY_DATE-BPxR2Ht_.mjs +1 -0
- package/dist/packem_shared/SCHEMA_EDIT_ENDPOINT-CN5_FXGg.mjs +1 -0
- package/dist/packem_shared/SEED_ENDPOINT-C1fhrehH.mjs +1 -0
- package/dist/packem_shared/STUDIO_PATH-o75cnR4-.mjs +1 -0
- package/dist/packem_shared/STUDIO_WRITE_TEMP_SUFFIX-BTTELz3K.mjs +1 -0
- package/dist/packem_shared/UNEXPORTED_CLASS_MARKER-Zw1oiigQ.mjs +1 -0
- package/dist/packem_shared/WORKERS_CACHE_MIN_DATE-0k9ABJtF.mjs +1 -0
- package/dist/packem_shared/WRANGLER_FILES-BF8PUjuo.mjs +1 -0
- package/dist/packem_shared/acceptsConnection-DHhUYGjT.mjs +2 -0
- package/dist/packem_shared/addArgsFor-CYZKhNIo.mjs +1 -0
- package/dist/packem_shared/applyAdditiveEdit-DEwPKcJg.mjs +6 -0
- package/dist/packem_shared/applyModify-DKP2l6S9.mjs +1 -0
- package/dist/packem_shared/assertBuildTargetMatches-tkKAa5zl.mjs +1 -0
- package/dist/packem_shared/assertWranglerSatisfiesSchema-CZWQnfly.mjs +3 -0
- package/dist/packem_shared/asset-headers-CPuEX21i.mjs +4 -0
- package/dist/packem_shared/assetContentType-CUb5bpbI.mjs +1 -0
- package/dist/packem_shared/bindingsNeedingDatabase-3KyGflIq.mjs +3 -0
- package/dist/packem_shared/blockingFindingsMessage-CRbg1sla.mjs +1 -0
- package/dist/packem_shared/buildPackageSecretsBlock-DrSD60vH.mjs +19 -0
- package/dist/packem_shared/canonicalPath-DrfMiT3U.mjs +1 -0
- package/dist/packem_shared/celld-binding-id-9MiUoteo.mjs +1 -0
- package/dist/packem_shared/celld-config-CpvLkAEg.mjs +3 -0
- package/dist/packem_shared/checkDevEnv-egiW2lSF.mjs +3 -0
- package/dist/packem_shared/classifyPolicyEdit-DJi9Fk8G.mjs +24 -0
- package/dist/packem_shared/clearApiSpecMarker-DMGpP41V.mjs +2 -0
- package/dist/packem_shared/collectExportGaps-BYo3bcXi.mjs +2 -0
- package/dist/packem_shared/createConfirm-D5mKTMHj.mjs +7 -0
- package/dist/packem_shared/createDiscoveryCache-npJI4uej.mjs +1 -0
- package/dist/packem_shared/createStudioDocumentCache-XBG1aWbl.mjs +1 -0
- package/dist/packem_shared/deploy-driver.d-CHVNQFV2.d.mts +190 -0
- package/dist/packem_shared/deploy-driver.d-CHVNQFV2.d.ts +190 -0
- package/dist/packem_shared/describePreservedCrons-i5XT6rtl.mjs +1 -0
- package/dist/packem_shared/describeWithheld-CbyzZjZF.mjs +1 -0
- package/dist/packem_shared/detectFramework-Dfpvu6rD.mjs +1 -0
- package/dist/packem_shared/devTriggerHints-CN_RJxWW.mjs +1 -0
- package/dist/packem_shared/devVariablesStamp-BQkGEn9d.mjs +1 -0
- package/dist/packem_shared/discover-info-DC2MrAIM.mjs +1 -0
- package/dist/packem_shared/discoverAgentInfo-pqFMJBtJ.mjs +1 -0
- package/dist/packem_shared/discoverContainerInfo-DzXr7Vm3.mjs +1 -0
- package/dist/packem_shared/discoverSchemaInfo-DRPnqgif.mjs +1 -0
- package/dist/packem_shared/discoverWorkflowInfo-zW7Tt0Tn.mjs +1 -0
- package/dist/packem_shared/emitProjectAssetHeaders-6iinmRWE.mjs +1 -0
- package/dist/packem_shared/ensureGitignoreEntries-Tsk8Qkw7.mjs +7 -0
- package/dist/packem_shared/env-flag-u4B05gLp.mjs +1 -0
- package/dist/packem_shared/guards-CoCtgpeR.mjs +1 -0
- package/dist/packem_shared/hasCloudflareCredentials-ByCrwaLT.mjs +1 -0
- package/dist/packem_shared/index.d-BoUSSRrk.d.mts +270 -0
- package/dist/packem_shared/index.d-C1nVDcie.d.ts +270 -0
- package/dist/packem_shared/inferLunoraBindings-Biq1OW9V.mjs +1 -0
- package/dist/packem_shared/is-plain-object-CWxHeOY1.mjs +1 -0
- package/dist/packem_shared/materializeServiceDevConfigs-CI1HXv7f.mjs +1 -0
- package/dist/packem_shared/mergeWranglerEnvironment-D5ekKj5x.mjs +1 -0
- package/dist/packem_shared/parseSchema-D1Wbr1qv.mjs +1 -0
- package/dist/packem_shared/pendingBindingChanges-5fPhwxMt.mjs +1 -0
- package/dist/packem_shared/placeholder-ids.d-DvGHP6bl.d.mts +338 -0
- package/dist/packem_shared/placeholder-ids.d-DvGHP6bl.d.ts +338 -0
- package/dist/packem_shared/policy-scaffold.d-D2H4_G01.d.mts +86 -0
- package/dist/packem_shared/policy-scaffold.d-D2H4_G01.d.ts +86 -0
- package/dist/packem_shared/probeCelldToolchain-DxDttfHy.mjs +1 -0
- package/dist/packem_shared/process-tree-once-Ou4SfxKM.mjs +1 -0
- package/dist/packem_shared/queue-info-D38n7YdX.mjs +1 -0
- package/dist/packem_shared/readManifest-Cighz3WC.mjs +6 -0
- package/dist/packem_shared/readProjectDependencies-l3uhUKjo.mjs +1 -0
- package/dist/packem_shared/reconcile-services-CjgIJKim.mjs +1 -0
- package/dist/packem_shared/reconcileWranglerBindings-D7mXDfAe.mjs +1 -0
- package/dist/packem_shared/reconcileWranglerCompatibilityDate-Cj94osA-.mjs +1 -0
- package/dist/packem_shared/renderStudioHtml-CRDTNivi.mjs +15 -0
- package/dist/packem_shared/resolveSchemaDirectory-Ca5P6KuP.mjs +1 -0
- package/dist/packem_shared/runPostCodegenHook-Dx3yTsYZ.mjs +1 -0
- package/dist/packem_shared/scanWranglerVariablesForSecrets-BQIPpHpH.mjs +1 -0
- package/dist/packem_shared/secret-key-xi4VK8Jw.mjs +1 -0
- package/dist/packem_shared/sendStudioAsset-B81Pex91.mjs +1 -0
- package/dist/packem_shared/serveJsonHandler-B8_GE6QC.mjs +1 -0
- package/dist/packem_shared/startCelldDevSession-DQ7YylR_.mjs +1 -0
- package/dist/packem_shared/streamContainerLogs-0nko1qpv.mjs +2 -0
- package/dist/packem_shared/validate-bindings-CQbR23li.mjs +1 -0
- package/dist/packem_shared/withTailConsumer-CKXL6P6s.mjs +1 -0
- package/dist/packem_shared/worker-entry-checks-DH-ApvvX.mjs +1 -0
- package/dist/packem_shared/wranglerCodegenInputs-Cty6-8es.mjs +1 -0
- package/dist/packem_shared/wranglerToAlchemy-CBO2ucRm.mjs +6 -0
- package/dist/packem_shared/write-atomic-C_tVwH0p.mjs +3 -0
- package/dist/packem_shared/writeAssetHeaders-C5igmezc.mjs +1 -0
- package/dist/studio-host/index.d.mts +371 -136
- package/dist/studio-host/index.d.ts +371 -136
- package/dist/studio-host/index.mjs +1 -7
- package/package.json +35 -9
- package/dist/packem_shared/ACCENT-DW1XJn8i.mjs +0 -40
- package/dist/packem_shared/AGENT_RULES_DIR-lcgC08aE.mjs +0 -40
- package/dist/packem_shared/DEV_VARS_EXAMPLE_FILE-dJPNTEnK.mjs +0 -37
- package/dist/packem_shared/LINKED_PROJECT_DIR-CXwXzV_C.mjs +0 -52
- package/dist/packem_shared/LUNORA_CONFIG_FILE-CtcIcB5-.mjs +0 -34
- package/dist/packem_shared/LUNORA_EVENT_SOURCE-D2fDeGB6.mjs +0 -86
- package/dist/packem_shared/LunoraReporter-Ci-bDCK9.mjs +0 -70
- package/dist/packem_shared/PACKAGE_SECRETS_REGISTRY-B8t_SdoZ.mjs +0 -70
- package/dist/packem_shared/POLICY_SCAFFOLD_ENDPOINT-8bNMHGiu.mjs +0 -104
- package/dist/packem_shared/REMOTE_ELIGIBLE_KEYS-BC7_e9Bz.mjs +0 -105
- package/dist/packem_shared/REQUIRED_COMPATIBILITY_DATE-2YYyWJUq.mjs +0 -561
- package/dist/packem_shared/SCHEMA_EDIT_ENDPOINT-Df-Wrix-.mjs +0 -99
- package/dist/packem_shared/SEED_ENDPOINT-DVCjaGO-.mjs +0 -61
- package/dist/packem_shared/WRANGLER_FILES-DwSuC-Kn.mjs +0 -25
- package/dist/packem_shared/applyAdditiveEdit-C-snTFEV.mjs +0 -228
- package/dist/packem_shared/assetContentType-ByZjeV3D.mjs +0 -72
- package/dist/packem_shared/buildPackageSecretsBlock-B8iSX1Zo.mjs +0 -281
- package/dist/packem_shared/classifyPolicyEdit-BHeAqF8P.mjs +0 -99
- package/dist/packem_shared/createConfirm-fvpdgJ9s.mjs +0 -100
- package/dist/packem_shared/detectFramework-Br-BcPBq.mjs +0 -41
- package/dist/packem_shared/discoverContainerInfo-BXFs6Wav.mjs +0 -19
- package/dist/packem_shared/discoverSchemaInfo-BB-CKlTK.mjs +0 -25
- package/dist/packem_shared/discoverWorkflowInfo-CedvR0mn.mjs +0 -19
- package/dist/packem_shared/inferLunoraBindings-ByMwG-gH.mjs +0 -352
- package/dist/packem_shared/parseDevVariable-CJiq2IwE.mjs +0 -30
- package/dist/packem_shared/parseSchema-DSeyktvG.mjs +0 -107
- package/dist/packem_shared/policy-scaffold.d-DCmwn7zQ.d.mts +0 -74
- package/dist/packem_shared/policy-scaffold.d-DCmwn7zQ.d.ts +0 -74
- package/dist/packem_shared/reconcileWranglerBindings-Cruwwx1M.mjs +0 -334
- package/dist/packem_shared/renderStudioHtml-449Ysn75.mjs +0 -37
- package/dist/packem_shared/serveJsonHandler-B4OLTGLS.mjs +0 -86
- package/dist/packem_shared/streamContainerLogs-BZ4cOZwH.mjs +0 -157
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as w}from"./is-plain-object-CWxHeOY1.mjs";import{applyModify as F}from"./applyModify-DKP2l6S9.mjs";import{recordManifestKey as P}from"./readManifest-Cighz3WC.mjs";import{s as O,i as f,a as d}from"./guards-CoCtgpeR.mjs";import{CUSTOM_INSTANCE_TYPE_LIMITS as j,CUSTOM_INSTANCE_MIN_MEMORY_MIB_PER_VCPU as I}from"@lunora/container";const p=["/_lunora/*","/__lunora/*"],B=[p,["/_lunora/*"]],D="/*",y=100,v=100,R="runWorkerFirst",K=/^[\w.~@%+-]+$/u,G=e=>{const s=e.split("/").filter(r=>r!==""),t=s.map(r=>K.test(r));if(s.length===0||t[0]===!1)return;const n=s.map((r,c)=>t[c]?r:"*"),i=`/${n.join("/")}`,a=s.at(-1)??"";return a==="*"||t.at(-1)===!1&&a.endsWith("?")?[`/${n.slice(0,-1).join("/")}`,i]:[i]},h=(e,s)=>s!==e&&s.endsWith("*")&&e.startsWith(s.slice(0,-1)),N=e=>e.flatMap((s,t)=>{const n=e.find(i=>h(s,i));return[...s.length>v?[`assets.run_worker_first entry "${s}" is ${String(s.length)} characters; Cloudflare accepts at most ${String(v)}`]:[],...e.indexOf(s)===t?[]:[`assets.run_worker_first lists "${s}" twice`],...n===void 0?[]:[`assets.run_worker_first entry "${s}" is already covered by "${n}", which wrangler refuses`]]}),ye=e=>{if(e.length===0)return["assets.run_worker_first is an empty list, which wrangler refuses; remove it, or name at least one path"];const s=[];e.length>y&&s.push(`assets.run_worker_first has ${String(e.length)} rules; Cloudflare accepts at most ${String(y)}, duplicates included`);const t=[],n=[];for(const i of e)typeof i=="string"&&i.startsWith("/")?t.push(i):typeof i=="string"&&i.startsWith("!/")?n.push(i):s.push(`assets.run_worker_first entry ${JSON.stringify(i)} must be a path rule starting with "/" (or "!/" to exempt a path)`);return t.length===0&&n.length>0&&s.push("assets.run_worker_first has only negative (!/…) rules; wrangler needs at least one path that runs the Worker first"),s.push(...N(t),...N(n)),s},H=e=>e.split("/").every(s=>s==="")?`the route "${e}" is the site root; run_worker_first leaves it to the assets (index.html), so add "/" to run_worker_first yourself if the Worker should answer it`:`the route "${e}" starts with a parameter, so no run_worker_first rule names it without sending every path to the Worker; a matching file in the assets directory, or the not_found_handling fallback, answers instead`,Q=e=>{const s=[],t=new Set;for(const o of e){const r=G(o);if(r===void 0){s.push(H(o));continue}for(const c of r)c.length>v?s.push(`run_worker_first rule "${c}" is longer than Cloudflare's ${String(v)} characters and was left out`):t.add(c)}const n=[...p,...t],i=[...new Set(n)].filter(o=>!n.some(r=>h(o,r))&&!p.includes(o)).toSorted((o,r)=>o.localeCompare(r)),a=y-p.length;return i.length>a&&s.push(`the routes need ${String(i.length+p.length)} run_worker_first rules and Cloudflare accepts ${String(y)}; ${i.slice(a).join(", ")} were left out`),{rules:[...p,...i.slice(0,a)],warnings:s}},L=(e,s)=>e===s||h(e,s)||h(s,e),V=(e,s)=>{const t=new Map,n=[];if(e===!0)return{excluded:t,missing:n};const i=Array.isArray(e)?e.filter(r=>typeof r=="string"):[],a=i.filter(r=>r.startsWith("/")),o=i.filter(r=>r.startsWith("!/"));for(const r of s){if(!a.some(m=>m===r||h(r,m))){n.push(r);continue}const c=o.filter(m=>L(m.slice(1),r));c.length>0&&t.set(r,c)}return{excluded:t,missing:n}},Y=(e,s,t)=>{const{excluded:n,missing:i}=V(e,t),a=[];i.length>0&&a.push(`${s} does not send ${i.join(", ")} to the Worker first, so a matching file in the assets directory (or the SPA fallback) answers instead of Lunora — add ${i.map(o=>`"${o}"`).join(", ")} to it`);for(const[o,r]of n)a.push(`${s} sends ${o} to the Worker first, but ${r.map(c=>`"${c}"`).join(", ")} takes part of it back to the assets — remove ${r.length===1?"that rule":"those rules"} unless the Worker never serves the paths it names`);return a.length===0?void 0:a.join("; ")},M=(e,s)=>Array.isArray(e)&&e.length===s?.length&&e.every((t,n)=>t===s[n]),z=e=>{const s=e?.lunora?.[R];return w(s)?Object.fromEntries(Object.entries(s).filter(t=>Array.isArray(t[1])&&t[1].every(n=>typeof n=="string"))):{}},J=(e,s)=>{const t=[...new Set(s)].filter(o=>o.length<v&&!e.some(r=>L(o,r))),n=t.filter(o=>!t.some(r=>h(o,r))).toSorted((o,r)=>o.localeCompare(r)).map(o=>`!${o}`),i=y-1,a=n.length>i?[`run_worker_first has room for ${String(i)} static exemptions; ${n.slice(i).join(", ")} run the Worker, which serves them from the assets binding`]:[];return{rules:[D,...n.slice(0,i)],warnings:a}},X=e=>`${e} falls back to a single-page app but sets no "binding", so the Worker cannot serve the app shell or a static file; run_worker_first keeps naming only the routes Lunora can see, and a Worker path it misses (a route on a Hono httpRouter, a computed auth basePath) gets index.html. Add "binding": "ASSETS" to ${e}`,Z=(e,s,t,n,i)=>e===void 0||M(e,i)||B.some(o=>M(e,o))?M(e,t)?{change:void 0,owned:!0,warning:void 0}:{change:e===void 0?"added":"updated",owned:!0,warning:void 0}:{change:void 0,owned:!1,warning:Y(e,s,n)},ee=e=>[{assets:e.assets,path:["assets"]},...Object.entries(e.env??{}).flatMap(([s,t])=>w(t)?[{assets:t.assets,path:["env",s,"assets"]}]:[])],ve=(e,s,t,n,i)=>{const a=ee(s),o=Q(t),r=J(o.rules,i),c=z(n),m={},u={added:[],text:e,updated:[],warnings:[]};for(const{assets:l,path:x}of a.filter(g=>w(g.assets))){const g=x.join("."),k=l,W=O(k)!==void 0,S=W?r.rules:o.rules,b=Z(k.run_worker_first,`${g}.run_worker_first`,S,o.rules,c[g]);b.owned&&(m[g]=S),b.owned&&!W&&k.not_found_handling==="single-page-application"&&u.warnings.push(X(g)),b.warning!==void 0&&u.warnings.push(b.warning),b.change!==void 0&&(u.text=F(u.text,[...x,"run_worker_first"],S),u[b.change].push(`${g}.run_worker_first`))}return a.some(l=>w(l.assets))&&u.warnings.unshift(...o.warnings,...a.some(l=>O(l.assets)!==void 0)?r.warnings:[]),{...u,record:{consequence:"the next route change leaves run_worker_first as it is",key:R,label:"run_worker_first rules",write:l=>{P(l,R,Object.keys(m).length===0?void 0:m)}}}},A=[{of:e=>e.schedules===void 0?void 0:[...e.schedules],path:["schedules"]},{of:e=>e.limits?.steps,path:["limits","steps"]},{of:e=>e.defaultRetention?.successRetention,path:["default_retention","success_retention"]},{of:e=>e.defaultRetention?.errorRetention,path:["default_retention","error_retention"]}],$e=[...new Set(A.map(({path:e})=>e[0]))],T=(e,s)=>{let t=e;for(const n of s)t=f(t)?t[n]:void 0;return t},we=e=>{const s={};for(const{of:t,path:n}of A){const i=t(e);if(i===void 0)continue;const[a,o]=n;s[a]=o===void 0?i:{...s[a],[o]:i}}return s},ke=(e,s,t)=>{if(s.length===0)return;const n=e.vectorize??[],i=new Set(n.filter(Boolean).map(a=>a?.index_name));for(const a of s)i.has(a)||t.push(`schema declares vector index "${a}"; wrangler "vectorize" must include a binding with index_name "${a}"`)},se=new Set(["basic","dev","lite","standard","standard-1","standard-2","standard-3","standard-4"]),ne={disk_mb:j.diskMb,memory_mib:j.memoryMib,vcpu:{...j.vcpu,hint:'use the named "lite" or "basic" instance type below 1 vCPU'}},te=(e,s,t)=>{const n=e.instance_type;if(n===void 0)return;if(typeof n=="string"){se.has(n)||t.push(`${s} has unknown instance_type "${n}" — expected lite, basic, standard-1..4, or a custom { vcpu, memory_mib, disk_mb } object`);return}for(const[o,{hint:r,max:c,min:m}]of Object.entries(ne)){const u=n[o];if(u!==void 0&&(typeof u!="number"||Number.isNaN(u)||u<m||u>c)){const l=r!==void 0&&typeof u=="number"&&u<m?` — ${r}`:"";t.push(`${s} custom instance_type ${o} must be a number in ${String(m)}–${String(c)} (got ${String(u)})${l}`)}}const{memory_mib:i,vcpu:a}=n;typeof a=="number"&&typeof i=="number"&&i<a*I&&t.push(`${s} custom instance_type needs ≥ 3 GiB (${String(I)} MiB) memory per vCPU (got ${String(i)} MiB for ${String(a)} vCPU)`)},ie=(e,s,t)=>{for(const n of["image","instance_type","max_instances"])e[n]!==void 0&&t.push(`${s} sets "${n}", which the durable_object scheduling policy does not take — the Durable Object picks image and size at start`);for(const[n,i]of Object.entries(e.images??{}))[i?.dockerfile,i?.image].filter(o=>typeof o=="string"&&o.length>0).length!==1&&t.push(`${s} images["${n}"] must set exactly one of "dockerfile" or "image"`)},ae=(e,s,t)=>{const{boundClasses:n,classKinds:i,errors:a,warnings:o}=t;if(!e||typeof e!="object"||typeof e.class_name!="string"||e.class_name.length===0){a.push(`${s} must have a non-empty "class_name" naming its container-enabled Durable Object class`);return}const r=e.scheduling_policy==="durable_object";e.scheduling_policy!==void 0&&e.scheduling_policy!=="default"&&!r&&a.push(`${s} ("${e.class_name}") has unknown scheduling_policy "${e.scheduling_policy}" — expected "default" or "durable_object"`),r?ie(e,`${s} ("${e.class_name}")`,a):(typeof e.image!="string"||e.image.length===0)&&a.push(`${s} ("${e.class_name}") must have an "image" — a Dockerfile path or a registry reference`),n.has(e.class_name)||a.push(`${s} class "${e.class_name}" has no matching durable_objects binding — your dev server auto-reconciles this on startup; add { "name": "...", "class_name": "${e.class_name}" } to fix it by hand`);const c=i.get(e.class_name);c!=="sqlite"&&a.push(c==="classic"?`${s} class "${e.class_name}" is registered via "new_classes" but containers require SQLite-backed DOs — move it to "new_sqlite_classes"`:`${s} class "${e.class_name}" is missing from migrations — add a migration entry with "new_sqlite_classes": ["${e.class_name}"]`),te(e,`${s} ("${e.class_name}")`,a),e.max_instances===void 0&&!r&&o.push(`${s} ("${e.class_name}") declares no max_instances — set a cap so a traffic spike can't fan out unbounded container spend`)},_=e=>Array.isArray(e)?e.filter(s=>s!==null&&typeof s=="object"):[],E=e=>Array.isArray(e)?e.filter(s=>d(s)):[],U=e=>{const s=new Map;for(const t of _(e)){for(const n of E(t.new_classes))s.set(n,"classic");for(const n of E(t.new_sqlite_classes))s.set(n,"sqlite");for(const n of _(t.renamed_classes))if(d(n.from)&&d(n.to)){const i=s.get(n.from)??"sqlite";s.delete(n.from),s.set(n.to,i)}for(const n of E(t.deleted_classes))s.delete(n)}return s},oe=e=>new Set(U(e).keys()),Se=(e,s)=>{const t=oe(e.migrations);for(const n of _(e.durable_objects?.bindings))n.script_name===void 0&&d(n.class_name)&&!t.has(n.class_name)&&s.push(`durable_objects.bindings declares class "${n.class_name}" but it is missing from migrations — add a migration entry with "new_sqlite_classes": ["${n.class_name}"] (or "new_classes" for a non-SQLite-backed class), or let the dev server auto-reconcile it on the next start`)},je=(e,s,t)=>{if(e.containers===void 0)return;if(!Array.isArray(e.containers)){s.push("containers must be an array of { class_name, image, ... } entries");return}const n=e.containers;if(n.length===0)return;const i=new Set(_(e.durable_objects?.bindings).map(o=>o.class_name)),a=U(e.migrations);for(const[o,r]of n.entries())ae(r,`containers[${String(o)}]`,{boundClasses:i,classKinds:a,errors:s,warnings:t});e.observability?.enabled!==!0&&t.push('containers are configured but observability is not enabled — container logs will not be captured (add { "observability": { "enabled": true } })')},$=e=>e,C=(e,s,t,n)=>{if(e!==void 0){if(!Array.isArray(e)){n.push(t.arrayMessage);return}for(const[i,a]of $(e).entries()){const o=`${s}[${String(i)}]`;if(!a||typeof a!="object"){n.push(t.objectMessage(o));continue}for(const r of t.fields)d(a[r.field])||n.push(r.message(o))}}},Me={arrayMessage:"workflows must be an array of { name, binding, class_name } entries",fields:[{field:"binding",message:e=>`${e} must have a non-empty "binding" naming the Workflow binding (e.g. MY_WORKFLOW)`},{field:"class_name",message:e=>`${e} must have a non-empty "class_name" naming the exported WorkflowEntrypoint class`},{field:"name",message:e=>`${e} must have a non-empty "name" naming the deployed workflow`}],objectMessage:e=>`${e} must be a { name, binding, class_name } object`},re=(e,s)=>e===void 0||s&&d(e)||Array.isArray(e)&&e.length>0&&e.every(n=>d(n))?void 0:"schedules must be a non-empty array of cron expression strings",ce=e=>{if(e!==void 0)return f(e)?e.steps===void 0||Number.isInteger(e.steps)&&e.steps>0?void 0:"limits.steps must be a positive integer":"limits must be an object"},de=e=>e===void 0?[]:f(e)?["success_retention","error_retention"].filter(s=>e[s]!==void 0&&!d(e[s])).map(s=>`default_retention.${s} must be a duration string (e.g. "7 days")`):["default_retention must be an object"],q=(e,s,t,n)=>{const i=[re(e.schedules,t),ce(e.limits),...de(e.default_retention)];for(const a of i)a!==void 0&&n.push(`${s}.${a}`)},ue=(e,s)=>A.map(({path:t})=>t).filter(t=>{const n=T(e,t),i=T(s,t),a=typeof i=="string"&&t[0]==="schedules"?[i]:i;return n!==void 0&&i!==void 0&&JSON.stringify(n)!==JSON.stringify(a)}).map(t=>t.join(".")),me=(e,s,t,n)=>{const i=`exports["${e}"]`,a=String(s.name);for(const o of t){if(!f(o)||o.name!==s.name)continue;const r=`workflows entry "${String(o.binding)}"`;if(o.script_name!==void 0){n.push(`${r} binds workflow "${a}" in another Worker, but ${i} declares a workflow with that name here — workflow names are unique per account`);continue}o.class_name!==e&&n.push(`${r} and ${i} both declare workflow "${a}" but name different classes ("${String(o.class_name)}" vs "${e}")`);for(const c of ue(o,s))n.push(`${r} and ${i} set ${c} to different values for workflow "${a}" — set it in one place`)}},Ee=(e,s)=>{const t=Array.isArray(e.workflows)?$(e.workflows):[];for(const[i,a]of t.entries())f(a)&&q(a,`workflows[${String(i)}]`,!1,s);const n=f(e.exports)?Object.entries(e.exports):[];for(const[i,a]of n)!f(a)||a.type!=="workflow"||(d(a.name)?(q(a,`exports["${i}"]`,!0,s),me(i,a,t,s)):s.push(`exports["${i}"] is a workflow export and must have a non-empty "name" naming the deployed workflow`))},le={arrayMessage:"queues.producers must be an array of { binding, queue } entries",fields:[{field:"binding",message:e=>`${e} must have a non-empty "binding" naming the Queue producer (e.g. QUEUE_EMAIL)`},{field:"queue",message:e=>`${e} must have a non-empty "queue" naming the deployed queue`}],objectMessage:e=>`${e} must be a { binding, queue } object`},ge={arrayMessage:"queues.consumers must be an array of { queue } entries",fields:[{field:"queue",message:e=>`${e} must have a non-empty "queue" naming the consumed queue`}],objectMessage:e=>`${e} must be a { queue } object`},Re=(e,s)=>{if(e.queues!==void 0){if(typeof e.queues!="object"||Array.isArray(e.queues)){s.push("queues must be a { producers, consumers } object");return}C(e.queues.producers,"queues.producers",le,s),C(e.queues.consumers,"queues.consumers",ge,s)}},Ae={arrayMessage:"secrets_store_secrets must be an array of { binding, store_id, secret_name } entries",fields:["binding","store_id","secret_name"].map(e=>({field:e,message:s=>`${s} must have a non-empty "${e}"`})),objectMessage:e=>`${e} must be a { binding, store_id, secret_name } object`},xe=[{arrayMessage:"kv_namespaces must be an array of { binding, id } entries",bindingMessage:e=>`${e} must have a non-empty "binding" naming the KV namespace binding`,key:"kv_namespaces"},{arrayMessage:"flagship must be an array of { binding, app_id } entries",bindingMessage:e=>`${e} must have a non-empty "binding" naming the Flagship binding`,hintField:"app_id",hintMessage:(e,s)=>`${e} ("${s}") has no "app_id" — create a Flagship app and set its id, or the binding can't resolve`,key:"flagship"},{arrayMessage:"hyperdrive must be an array of { binding, id } entries",bindingMessage:e=>`${e} must have a non-empty "binding" naming the Hyperdrive binding`,hintField:"id",hintMessage:(e,s)=>`${e} ("${s}") has no "id" — run \`wrangler hyperdrive create\` and set the id, or the binding can't connect`,key:"hyperdrive"},{arrayMessage:"pipelines must be an array of { binding, stream } entries",bindingMessage:e=>`${e} must have a non-empty "binding" naming the Pipelines binding`,hintField:["stream","pipeline"],hintMessage:(e,s)=>`${e} ("${s}") has no "stream" — run \`wrangler pipelines create <name>\` and set the stream name, or the binding can't resolve`,key:"pipelines"},{arrayMessage:"analytics_engine_datasets must be an array of { binding, dataset } entries",bindingMessage:e=>`${e} must have a non-empty "binding" naming the Analytics Engine binding`,hintField:"dataset",hintMessage:(e,s)=>`${e} ("${s}") has no "dataset" — it defaults to the binding name; set it explicitly to avoid drift`,key:"analytics_engine_datasets"}],We=(e,s,t,n)=>{const i=e[s.key];if(i!==void 0){if(!Array.isArray(i)){t.push(s.arrayMessage);return}for(const[a,o]of $(i).entries()){const r=`${s.key}[${String(a)}]`;if(!o||typeof o!="object"||!d(o.binding)){t.push(s.bindingMessage(r));continue}if(!("hintField"in s))continue;(typeof s.hintField=="string"?[s.hintField]:s.hintField).some(m=>d(o[m]))||n.push(s.hintMessage(r,o.binding))}}},Oe=[{key:"analytics",message:'analytics must be an object with a non-empty "binding" (e.g. { "binding": "ANALYTICS_SQL" })'},{key:"browser",message:'browser must be an object with a non-empty "binding" (e.g. { "binding": "BROWSER" })'},{key:"images",message:'images must be an object with a non-empty "binding" (e.g. { "binding": "IMAGES" })'},{key:"media",message:'media must be an object with a non-empty "binding" (e.g. { "binding": "MEDIA" })'},{key:"stream",message:'stream must be an object with a non-empty "binding" (e.g. { "binding": "STREAM" })'}],Ie=(e,s,t)=>{const n=e[s.key];n!==void 0&&(typeof n!="object"||n===null||Array.isArray(n)||!d(n.binding))&&t.push(s.message)},Ne=[{arrayMessage:"ai_search_namespaces must be an array of { binding, namespace } entries",fields:[{field:"binding",message:e=>`${e} must have a non-empty "binding" naming the AI Search binding`},{field:"namespace",message:e=>`${e} must have a non-empty "namespace" naming the AI Search namespace (every account has "default")`}],key:"ai_search_namespaces",objectMessage:e=>`${e} must be a { binding, namespace } object`},{arrayMessage:"ai_search must be an array of { binding, instance_name } entries",fields:[{field:"binding",message:e=>`${e} must have a non-empty "binding" naming the AI Search binding`},{field:"instance_name",message:e=>`${e} must have a non-empty "instance_name" naming an existing AI Search instance`}],key:"ai_search",objectMessage:e=>`${e} must be a { binding, instance_name } object`},{arrayMessage:"services must be an array of { binding, service, entrypoint? } entries",fields:[{field:"binding",message:e=>`${e} must have a non-empty "binding" naming the service binding`},{field:"service",message:e=>`${e} must have a non-empty "service" naming the target Worker`}],key:"services",objectMessage:e=>`${e} must be a { binding, service, entrypoint? } object`},{arrayMessage:"dispatch_namespaces must be an array of { binding, namespace } entries",fields:[{field:"binding",message:e=>`${e} must have a non-empty "binding"`},{field:"namespace",message:e=>`${e} must have a non-empty "namespace" naming the dispatch namespace`}],key:"dispatch_namespaces",objectMessage:e=>`${e} must be a { binding, namespace } object`},{arrayMessage:"mtls_certificates must be an array of { binding, certificate_id } entries",fields:[{field:"binding",message:e=>`${e} must have a non-empty "binding"`},{field:"certificate_id",message:e=>`${e} must have a non-empty "certificate_id" (upload via \`wrangler mtls-certificate upload\`)`}],key:"mtls_certificates",objectMessage:e=>`${e} must be a { binding, certificate_id } object`},{arrayMessage:"r2_buckets must be an array of { binding, bucket_name } entries",fields:[{field:"binding",message:e=>`${e} must have a non-empty "binding" naming the R2 bucket binding`},{field:"bucket_name",message:e=>`${e} must have a non-empty "bucket_name" naming the deployed bucket`}],key:"r2_buckets",objectMessage:e=>`${e} must be a { binding, bucket_name } object`},{arrayMessage:"vpc_services must be an array of { binding, service_id } entries",fields:[{field:"binding",message:e=>`${e} must have a non-empty "binding" naming the VPC Service binding`},{field:"service_id",message:e=>`${e} must have a non-empty "service_id" (create one with \`wrangler vpc service create\`)`}],key:"vpc_services",objectMessage:e=>`${e} must be a { binding, service_id } object`},{arrayMessage:"artifacts must be an array of { binding, namespace } entries",fields:[{field:"binding",message:e=>`${e} must have a non-empty "binding" naming the Artifacts binding`},{field:"namespace",message:e=>`${e} must have a non-empty "namespace" naming the Artifacts namespace`}],key:"artifacts",objectMessage:e=>`${e} must be a { binding, namespace } object`}],Te=(e,s,t)=>{s?.hasD1GlobalTable&&!_(e.d1_databases).some(n=>n.binding==="DB")&&t.push('schema declares .global() tables; d1_databases must include a binding named "DB" — your dev server auto-reconciles this on startup, or add the binding manually'),s?.hasHyperdriveGlobalTable&&_(e.hyperdrive).length===0&&t.push('schema declares .global({ backend: "hyperdrive" }) tables; wrangler must declare a hyperdrive binding for `.hyperdriveGlobal({ exec })` to read — run `wrangler hyperdrive create <name> --connection-string=...` and add `"hyperdrive": [{ "binding": "HYPERDRIVE", "id": "<id>" }]` (any binding name works; your `exec` selector picks it)')},Ce=(e,s)=>{const{d1_databases:t}=e;if(t!==void 0){if(!Array.isArray(t)){s.push("d1_databases must be an array of { binding, database_id | database_name } entries");return}for(const[n,i]of $(t).entries()){const a=`d1_databases[${String(n)}]`;if(!i||typeof i!="object"){s.push(`${a} must be a { binding, database_id | database_name } object`);continue}d(i.binding)||s.push(`${a} must have a non-empty "binding" naming the D1 binding`),!d(i.database_id)&&!d(i.database_name)&&s.push(`${a} must have a "database_id" or a "database_name" — run \`wrangler d1 create\` and set one, or the binding can't resolve`)}}},qe=(e,s)=>{const{vpc_networks:t}=e;if(t!==void 0){if(!Array.isArray(t)){s.push("vpc_networks must be an array of { binding, tunnel_id | network_id } entries");return}for(const[n,i]of $(t).entries()){const a=`vpc_networks[${String(n)}]`;if(!i||typeof i!="object"){s.push(`${a} must be a { binding, tunnel_id | network_id } object`);continue}d(i.binding)||s.push(`${a} must have a non-empty "binding" naming the VPC Network binding`),d(i.tunnel_id)===d(i.network_id)&&s.push(`${a} must set exactly one of "tunnel_id" (a Cloudflare Tunnel) or "network_id" ("cf1:network" for Cloudflare Mesh)`)}}};export{xe as H,Ne as R,Oe as S,Me as W,Te as a,Ce as b,ke as c,je as d,C as e,oe as f,Ee as g,Re as h,We as i,Ie as j,qe as k,Ae as l,ve as m,$e as n,_ as o,E as p,A as q,ye as r,T as s,Se as v,we as w};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as _}from"./env-flag-u4B05gLp.mjs";import{i as u,a as h}from"./guards-CoCtgpeR.mjs";import{r as A,o as O}from"./validate-bindings-CQbR23li.mjs";const p=(s,e,t,i)=>{s!==void 0&&typeof s!="boolean"&&t.push(`${e} must be a boolean${i===void 0?"":` (${i})`}`)},S=(s,e,t)=>{s!==void 0&&(typeof s!="number"||Number.isNaN(s)||s<0||s>1)&&t.push(`${e} must be a number in [0, 1] (the fraction of requests sampled)`)},D=(s,e,t)=>{const i=s.send_email;if(i===void 0)return;if(!Array.isArray(i)){e.push("send_email must be an array of { name, destination_address? } entries");return}const n=i;for(const[o,a]of n.entries())(!a||typeof a!="object"||typeof a.name!="string"||a.name.length===0)&&t.push(`send_email[${String(o)}] has no non-empty "name" naming the send-email binding — set one before deploying`)},T=(s,e)=>{p(s.logpush,"logpush",e,'set "logpush": true to enable Cloudflare Logpush')},x=(s,e)=>{const t=s.secrets;if(t===void 0)return;const i=typeof t=="object"&&t!==null&&!Array.isArray(t)?t.required:void 0;(!Array.isArray(i)||i.some(n=>typeof n!="string"||n===""))&&e.push('secrets must be an object whose "required" is an array of secret names (e.g. { "required": ["API_KEY"] })')},b=3e5,U=(s,e)=>{const{limits:t}=s;if(t===void 0)return;if(typeof t!="object"||Array.isArray(t)){e.push('limits must be an object (e.g. { "cpu_ms": 30000 })');return}const i=t.cpu_ms;if(i!==void 0){if(typeof i!="number"||!Number.isFinite(i)||!Number.isInteger(i)||i<=0){e.push("limits.cpu_ms must be a positive integer number of milliseconds");return}i>b&&e.push(`limits.cpu_ms must be at most ${String(b)} (Cloudflare's per-invocation ceiling)`)}},m=new Set(["off","smart","targeted"]),B=(s,e)=>{const{placement:t}=s;if(t===void 0)return;if(typeof t!="object"||t===null||Array.isArray(t)){e.push('placement must be an object (e.g. { "mode": "smart" })');return}const{mode:i}=t;i!==void 0&&(typeof i!="string"||!m.has(i))&&e.push(`placement.mode must be one of ${[...m].map(n=>`"${n}"`).join(", ")}`)},c={kind:"boolean"},y={kind:"samplingRate"},g={destinations:{kind:"destinations"},enabled:c,head_sampling_rate:y,persist:c},L={...g,invocation_logs:{hint:'set "invocation_logs": true to keep per-invocation summaries',kind:"boolean"}},j={enabled:c,head_sampling_rate:y,issues:{kind:"level",level:{enabled:c}},logs:{kind:"level",level:L},redact_query_string:c,traces:{kind:"level",level:g}},$=(s,e,t,i)=>{switch(s.kind){case"boolean":{p(e,t,i,s.hint);break}case"destinations":{e!==void 0&&(!Array.isArray(e)||e.some(n=>!h(n)))&&i.push(`${t} must be an array of destination names configured in the Cloudflare dashboard`);break}case"samplingRate":{S(e,t,i);break}}},v=(s,e,t,i,n)=>{for(const[o,a]of Object.entries(s)){const r=Object.hasOwn(e,o)?e[o]:void 0,l=`${t}.${o}`;r===void 0?n.push(`${l} is not a documented wrangler key (expected one of ${Object.keys(e).join(", ")}) — a typo is silently ignored by wrangler`):r.kind!=="level"?$(r,a,l,i):u(a)?v(a,r.level,l,i,n):a!==void 0&&i.push(`${l} must be an object`)}},G=(s,e,t)=>{const{observability:i}=s;if(i!==void 0){if(!u(i)){e.push('observability must be an object (e.g. { "enabled": true, "head_sampling_rate": 1 })');return}v(i,j,"observability",e,t)}},W=(s,e)=>{const{cache:t}=s;if(t!==void 0){if(!u(t)){e.push('cache must be an object (e.g. { "enabled": true })');return}p(t.enabled,"cache.enabled",e)}},P=(s,e)=>{const{exports:t}=s;if(t!==void 0){if(typeof t!="object"||t===null||Array.isArray(t)){e.push("exports must be an object keyed by entrypoint name");return}for(const[i,n]of Object.entries(t)){if(typeof n!="object"||n===null){e.push(`exports["${i}"] must be an object`);continue}n.type!==void 0&&typeof n.type!="string"&&e.push(`exports["${i}"].type must be a string`),n.cache!==void 0&&(typeof n.cache!="object"||n.cache===null||Array.isArray(n.cache)?e.push(`exports["${i}"].cache must be an object`):n.cache.enabled!==void 0&&typeof n.cache.enabled!="boolean"&&e.push(`exports["${i}"].cache.enabled must be a boolean`))}}},E=["auto-trailing-slash","drop-trailing-slash","force-trailing-slash","none"],N=["404-page","none","single-page-application"],f=(s,e,t,i)=>{e!==void 0&&(typeof e!="string"||!t.includes(e))&&i.push(`assets.${s} must be one of ${t.map(n=>`"${n}"`).join(", ")} (got ${JSON.stringify(e)})`)},R=(s,e)=>{if(!(s===void 0||typeof s=="boolean")){if(!Array.isArray(s)){e.push('assets.run_worker_first must be a boolean or an array of path rules (e.g. ["/_lunora/*"])');return}e.push(...A(s))}},q=(s,e)=>{const{assets:t}=s;if(t!==void 0){if(typeof t!="object"||Array.isArray(t)){e.push('assets must be an object (e.g. { "directory": "./dist/client", "binding": "ASSETS" })');return}(typeof t.directory!="string"||t.directory.length===0)&&e.push('assets must declare a non-empty "directory" pointing at the built client output (e.g. "./dist/client")'),t.binding!==void 0&&(typeof t.binding!="string"||t.binding.length===0)&&e.push('assets.binding must be a non-empty string (e.g. "ASSETS")'),f("html_handling",t.html_handling,E,e),f("not_found_handling",t.not_found_handling,N,e),R(t.run_worker_first,e)}},F=(s,e)=>{const t=s.tail_consumers;if(t===void 0)return;if(!Array.isArray(t)){e.push("tail_consumers must be an array of { service, environment? } entries");return}const i=t;for(const[n,o]of i.entries())(!o||typeof o!="object"||typeof o.service!="string"||o.service.length===0)&&e.push(`tail_consumers[${String(n)}] must have a non-empty "service" naming the consumer Worker`)},M=(s,e)=>{const t=s.tail_consumers??[];return t.some(n=>!!n&&n?.service===e.service&&n?.environment===e.environment)?s:{...s,tail_consumers:[...t,e]}},V=(s,e)=>{const{vars:t}=s;if(!t||typeof t!="object")return;const i=t.LUNORA_ALLOWED_ORIGINS,n=t.LUNORA_CORS_ALLOW_CREDENTIALS,o=typeof i=="string"&&i.split(",").some(r=>r.trim()==="*"),a=_(n);o&&a&&e.push('vars.LUNORA_ALLOWED_ORIGINS includes a "*" wildcard while vars.LUNORA_CORS_ALLOW_CREDENTIALS is on — browsers reject this combination and it defeats the allowlist; name explicit origins or drop credentials')},k=s=>O(s.durable_objects?.bindings).some(e=>e.class_name==="SchedulerDO"&&e.script_name===void 0),d="LUNORA_ORIGIN_URL",H=(s,e,t,i=k(s)?"durable_objects.bindings declares the SchedulerDO":void 0)=>{if(i===void 0||h(s.vars?.[d]))return;const n=e===void 0?"vars":`env.${e}.vars`,o=e===void 0?"":` --env ${e}`;t.push(`${i} but ${n}.${d} is unset — the DO reads its dispatch origin from its own env and refuses to schedule without it, so every ctx.scheduler.runAfter/runAt fails with ORIGIN_NOT_CONFIGURED. Set ${n}.${d} to the worker's public URL, or \`wrangler secret put ${d}${o}\` (ignore this if it is already set as a secret or in the dashboard).`)};export{q as validateAssets,W as validateCache,V as validateCorsVariables,P as validateExports,U as validateLimits,T as validateLogpush,G as validateObservability,B as validatePlacement,H as validateSchedulerOrigin,x as validateSecretsRequired,D as validateSendEmail,F as validateTailConsumers,M as withTailConsumer};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{existsSync as f,readFileSync as N,readdirSync as I}from"node:fs";import{join as p,dirname as v,extname as h,basename as x}from"node:path";import{Project as b,Node as d}from"ts-morph";import{COMPOSED_WORKER_ENTRY as w,LUNORA_WORKER_VIRTUAL_ID as u,isGeneratedOutput as L,WORKER_ENTRY_FALLBACKS as M,GENERATED_DIRECTORY as j,isMergedProject as F,MERGED_DURABLE_OBJECT as P,COMPOSED_ENTRY_DURABLE_OBJECTS as k,GENERATED_CLASS_MODULES as U,isMergedRoleModule as W,SOURCE_DOT_DIRECTORIES as B,NON_SOURCE_DIRECTORIES as K}from"./COMPOSED_WORKER_ENTRY-LpLlp-aF.mjs";const E=[".ts",".tsx",".mts",".cts"],g=new Set(E),X=new Set([".cjs",".js",".mjs"]),m="default",S={".cjs":[".cts"],".js":[".ts",".tsx"],".mjs":[".mts"]},Y=250,ae=(e,o,t)=>{const s=p(o,w);if(f(s))return{origin:"declared",path:s};if(e===u)return{origin:"composed"};const n=()=>{const i=M.map(a=>p(o,a)).find(a=>f(a));return i===void 0?void 0:{origin:"probed",path:i}};if(typeof e!="string"||e.length===0||L(e))return n();const r=p(v(t),e),c=h(r);if(!(!g.has(c)&&!X.has(c)))return f(r)?{origin:"declared",path:r}:{origin:"absent",path:r}},_=(e,o)=>{if(d.isIdentifier(e)){o.add(e.getText());return}if(d.isObjectBindingPattern(e)||d.isArrayBindingPattern(e))for(const t of e.getElements())d.isBindingElement(t)&&_(t.getNameNode(),o)},G=(e,o)=>{const t=[];for(const s of e.getExportDeclarations())if(!s.isTypeOnly()){if(s.isNamespaceExport()){const n=s.getNamespaceExport();n===void 0?t.push(s.getModuleSpecifierValue()??""):o.add(n.getName());continue}for(const n of s.getNamedExports())n.isTypeOnly()||o.add(n.getAliasNode()?.getText()??n.getName())}return t},$=(e,o)=>{for(const t of e.getVariableStatements().filter(s=>s.getExportKeyword()!==void 0))for(const s of t.getDeclarations())_(s.getNameNode(),o);for(const t of[...e.getClasses(),...e.getFunctions(),...e.getEnums()]){if(t.getExportKeyword()===void 0)continue;const s=t.isDefaultExport()?m:t.getName();s!==void 0&&o.add(s)}e.getExportAssignments().length>0&&o.add(m)},y=(e,o)=>{const t=new b({compilerOptions:{allowJs:!0},skipFileDependencyResolution:!0,skipLoadingLibFiles:!0,useInMemoryFileSystem:!0}),s=t.createSourceFile(e,o,{overwrite:!0});return t.getProgram().compilerObject.getSyntacticDiagnostics(s.compilerNode).length>0?void 0:s},J=(e,o)=>{if(!o.startsWith("./")&&!o.startsWith("../"))return;const t=p(v(e),o),s=h(t),n=g.has(s)||S[s]!==void 0,r=n?t.slice(0,-s.length):t;return[...g.has(s)?[t]:[],...(S[s]??[]).map(i=>`${r}${i}`),...n?[]:E.map(i=>`${t}${i}`),...n||s.length===0?E.map(i=>p(r,`index${i}`)):[]].find(i=>f(i))},T=e=>{const o=new Set,t=new Set([e]),s=[e];for(;s.length>0;){if(t.size-1>Y)return;const n=s.pop();let r;try{r=N(n,"utf8")}catch{return}const c=y(x(n),r);if(c===void 0)return;const i=G(c,o);$(c,o);for(const a of i){const l=J(n,a);if(l===void 0)return;t.has(l)||(t.add(l),s.push(l))}}return o},z=(e,o)=>{const t={exports:void 0,kind:"composed",path:u},s=p(e,o,j);if(!f(s))return t;const n=F(s),r=new Set(n?[P]:k);for(const c of U){const i=p(s,`${c}.ts`);if(!f(i)||n&&W(c))continue;const a=T(i);if(a===void 0)return t;for(const l of a)r.add(l)}return{exports:r,kind:"composed",path:u}},de=(e,o,t)=>{if(e===void 0||e.origin==="absent")return;if(e.origin==="composed")return z(o,t);const s=T(e.path);if(!(e.origin==="probed"&&s!==void 0&&!s.has(m)))return{exports:s,kind:"authored",path:e.path}},q=new Set([".cjs",".cts",".js",".jsx",".mjs",".mts",".ts",".tsx"]),V=2e3,O="defineTable",R="defineApp",H=e=>{const o=[],t=[];let s;try{s=I(e,{withFileTypes:!0})}catch{return{files:o,subdirectories:t}}for(const n of s)n.isDirectory()?n.name.startsWith(".")&&!B.has(n.name)||K.has(n.name)||t.push(p(e,n.name)):q.has(h(n.name))&&o.push(p(e,n.name));return{files:o,subdirectories:t}},D=(e,o)=>{const t=new Set;for(const s of e.getImportDeclarations())for(const n of s.getNamedImports())!n.isTypeOnly()&&n.getName()===o&&t.add(n.getAliasNode()?.getText()??n.getName());return t},Q=(e,o)=>{let t=!1;return e.forEachDescendant((s,n)=>{if(!d.isCallExpression(s))return;const r=s.getExpression();d.isIdentifier(r)&&o.has(r.getText())&&(t=!0,n.stop())}),t},Z=e=>{let o=e;for(;d.isCallExpression(o)||d.isPropertyAccessExpression(o);)o=o.getExpression();return o},ee=(e,o)=>{const t=Z(e);return d.isIdentifier(t)&&o.has(t.getText())},A={analyticsSql:/\.\s*analyticsSql\s*\(/u,global:/\.\s*global\s*\(/u,hyperdriveGlobal:/\.\s*hyperdriveGlobal\s*\(/u,vectors:/\.\s*vectors\s*\(/u},te=e=>Object.hasOwn(A,e),se=(e,o)=>{const t=new Set,s=new Set([O,...D(e,O)]);return e.forEachDescendant(n=>{if(!d.isCallExpression(n))return;const r=n.getExpression();if(!d.isPropertyAccessExpression(r)||ee(r,s))return;const c=r.getName();te(c)&&o.has(c)&&t.add(c)}),t},oe=(e,o)=>{let t;try{t=N(e,"utf8")}catch{return}const s=new Set([...o].filter(r=>A[r].test(t)));if(s.size===0&&!t.includes(R))return;const n=y(x(e),t);return n===void 0?{chained:s,composes:!1}:{chained:se(n,s),composes:Q(n,D(n,R))}},le=(e,o)=>{const t=[e],s=new Set;let n=0,r;const c=i=>{if(n+=1,n>V)return!1;const a=oe(i,o);for(const l of a?.chained??[])s.add(l);return a?.composes&&(r??=i),!0};for(;t.length>0;){const i=t.pop(),{files:a,subdirectories:l}=H(i);t.push(...l);for(const C of a){if(!c(C))return;if(r!==void 0&&s.size===o.size)return{chained:s,site:r}}}return r===void 0?void 0:{chained:s,site:r}};export{ae as l,de as r,le as s};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{relative as l}from"node:path";import{s as c,i as u}from"./guards-CoCtgpeR.mjs";import{findWranglerFile as g,readWranglerJsonc as p}from"./WRANGLER_FILES-BF8PUjuo.mjs";import{variableKeyLines as v,scanWranglerVariablesForSecrets as f}from"./scanWranglerVariablesForSecrets-BQIPpHpH.mjs";const o=(i,r)=>{const n=i?.producers;return(Array.isArray(n)?n:[]).flatMap(s=>u(s)&&typeof s.binding=="string"&&typeof s.queue=="string"?[{binding:s.binding,queue:s.queue,...r===void 0?{}:{env:r}}]:[])},A=i=>{const r=g(i),n=r===void 0?void 0:p(r),e=n?.parsed;if(r===void 0||n?.text===void 0||e===void 0)return{wranglerQueueProducers:[],wranglerVariables:[]};const s=v(n.text),t=[...new Set([e.assets,...Object.values(e.env??{}).map(a=>a?.assets)].flatMap(a=>c(a)??[]))];return{...t.length===0?{}:{spaAssetsBindings:t},wranglerQueueProducers:[...o(e.queues),...Object.entries(e.env??{}).flatMap(([a,d])=>o(d?.queues,a))],wranglerVariables:f(u(e.vars)?e.vars:void 0,l(i,r),a=>s.get(a))}};export{A as wranglerCodegenInputs};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
const o=e=>JSON.stringify(e),$=/^[A-Z_a-z][\w$]*$/u,d=e=>$.test(e),u=e=>d(e)?e:`binding_${e.replaceAll(/\W/gu,"_")}`,m=(e,t=u(e))=>{const n=d(e);return n&&t===e?`${e},`:`${n?e:o(e)}: ${t},`},h=e=>{const t=new Set;for(const n of e.migrations??[])for(const r of n.new_sqlite_classes??[])t.add(r);return t},g=(e,t,n,r,c)=>{for(const a of e.durable_objects?.bindings??[])if(!(a.name===void 0||a.class_name===void 0)){if(a.script_name!==void 0){c.push(`durable_objects.${a.name} (external script_name "${a.script_name}")`);continue}n.add("DurableObjectNamespace"),r.push(m(a.name,`DurableObjectNamespace(${o(a.name)}, { className: ${o(a.class_name)}, sqlite: ${String(t.has(a.class_name))} })`))}},v=(e,t)=>{for(const[n,r]of Object.entries(e.vars??{}))t.push(m(n,o(r)))},f=["ai","ai_search","ai_search_namespaces","analytics","analytics_engine_datasets","artifacts","assets","browser","containers","flagship","hyperdrive","images","k2","pipelines","secrets_store_secrets","send_email","services","tail_consumers","vectorize","worker_loaders","workflows","exports"],w=(e,t)=>{for(const n of f){const r=e[n];r!==void 0&&(!Array.isArray(r)||r.length>0)&&t.push(n)}(e.queues?.consumers?.length??0)>0&&t.push("queues.consumers")},k=e=>{const t=e.name??"worker",n=[],r=new Set(["Worker"]),c=[],a=[],p=h(e),b=[{construct:"D1Database",entries:(e.d1_databases??[]).map(s=>({binding:s.binding,name:s.database_name})),nameKey:"name"},{construct:"R2Bucket",entries:(e.r2_buckets??[]).map(s=>({binding:s.binding,name:s.bucket_name})),nameKey:"name"},{construct:"KVNamespace",entries:(e.kv_namespaces??[]).map(s=>({binding:s.binding,name:s.binding})),nameKey:"title"},{construct:"Queue",entries:(e.queues?.producers??[]).map(s=>({binding:s.binding,name:s.queue})),nameKey:"name"}];for(const{construct:s,entries:l,nameKey:y}of b)for(const i of l)i.binding!==void 0&&(r.add(s),c.push(`const ${u(i.binding)} = await ${s}(${o(i.binding)}, { adopt: true, ${y}: ${o(i.name??i.binding)} });`),a.push(m(i.binding)));g(e,p,r,a,n),v(e,a),w(e,n);const _=["adopt: true,",a.length===0?void 0:`bindings: {
|
|
2
|
+
${a.join(`
|
|
3
|
+
`)}
|
|
4
|
+
},`,e.compatibility_date===void 0?void 0:`compatibilityDate: ${o(e.compatibility_date)},`,e.compatibility_flags===void 0||e.compatibility_flags.length===0?void 0:`compatibilityFlags: ${o([...e.compatibility_flags])},`,e.triggers?.crons===void 0||e.triggers.crons.length===0?void 0:`crons: ${o([...e.triggers.crons])},`,e.main===void 0?void 0:`entrypoint: ${o(e.main)},`,`name: ${o(t)},`].filter(s=>s!==void 0);return{source:["// GENERATED by @lunora/config from wrangler.jsonc — do not edit.","// Re-generated on every `lunora deploy`; edit wrangler.jsonc instead.","",'import alchemy from "alchemy";',`import { ${[...r].toSorted((s,l)=>s.localeCompare(l)).join(", ")} } from "alchemy/cloudflare";`,"",`const app = await alchemy(${o(t)});`,"",...c.length===0?[]:[...c,""],`export const worker = await Worker(${o(t)}, {`,` ${_.join(`
|
|
5
|
+
`)}`,"});","","await app.finalize();",""].join(`
|
|
6
|
+
`),unsupported:n}};export{h as sqliteClasses,k as wranglerToAlchemy};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{existsSync as s,statSync as a,writeFileSync as p,renameSync as d,rmSync as g}from"node:fs";import{join as m}from"node:path";import{runCodegen as f,CodegenDiagnosticError as j,refreshCodegenProject as u,createCodegenProject as y,findTsconfig as S,tsconfigFingerprint as C,projectConfigCandidatePaths as h}from"@lunora/codegen";import{wranglerCodegenInputs as l}from"./wranglerCodegenInputs-Cty6-8es.mjs";import{isCodegenDisabled as w,CODEGEN_ENV as n}from"./BUILD_ROOT_ENV-Dg4MV3wY.mjs";import{recordStudioWrite as P,STUDIO_WRITE_TEMP_SUFFIX as $}from"./STUDIO_WRITE_TEMP_SUFFIX-BTTELz3K.mjs";const F=o=>({apiSpec:o.apiSpec,lazyFunctions:o.lazyFunctions,lunoraDirectory:o.schemaDirectory??"lunora",projectRoot:o.projectRoot,...l(o.projectRoot)});let r;const c=o=>{const t=a(o);return`${o}:${String(t.mtimeMs)}:${String(t.size)}`},E=o=>{const t=S(o);return[t===void 0?"":`${c(t)}
|
|
2
|
+
${C(t)}`,...h(o).filter(e=>s(e)).map(e=>c(e))].join(`
|
|
3
|
+
`)},R=o=>{const t=E(o);return r?.lunoraDirectory===o&&r.key===t?(u(r.project,o),r.project):(r={key:t,lunoraDirectory:o,project:y(o)},r.project)},x=(o,t)=>{if(w(process.env[n]))return[`codegen is off (${n}=0 / \`lunora dev --no-codegen\`) — the source was written but \`_generated/\` was NOT regenerated`];try{const e=m(o.projectRoot,o.schemaDirectory??"lunora");f({...F(o),project:R(e)})}catch(e){if(r=void 0,e instanceof j)return[e.message];throw e}return P(t.path,t.text),[]},z=(o,t)=>{const e=`${o}${$}`;try{p(e,t,"utf8"),d(e,o)}catch(i){throw g(e,{force:!0}),i}};export{x as r,z as w};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{m as r,w as a}from"./asset-headers-CPuEX21i.mjs";export{r as mergeAssetHeaders,a as writeAssetHeaders};
|