@lunora/config 1.0.0-alpha.323 → 1.0.0-alpha.325
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/cloudflare/index.d.mts +12 -11
- package/dist/cloudflare/index.d.ts +12 -11
- package/dist/cloudflare/index.mjs +1 -1
- package/dist/packem_shared/{POLICY_SCAFFOLD_ENDPOINT-CeBHVoYH.mjs → POLICY_SCAFFOLD_ENDPOINT-BquzWeBo.mjs} +1 -1
- package/dist/packem_shared/{REQUIRED_COMPATIBILITY_DATE-CFpBYYW4.mjs → REQUIRED_COMPATIBILITY_DATE-OLQlG0oj.mjs} +1 -1
- package/dist/packem_shared/{SCHEMA_EDIT_ENDPOINT-x627vqD5.mjs → SCHEMA_EDIT_ENDPOINT-DrZLd5rF.mjs} +1 -1
- package/dist/packem_shared/{STUDIO_PATH-gSAnfmNj.mjs → STUDIO_PATH-B-rhpKZU.mjs} +1 -1
- package/dist/packem_shared/{UNEXPORTED_CLASS_MARKER-Bqat6Syj.mjs → UNEXPORTED_CLASS_MARKER-IAK9PiDz.mjs} +1 -1
- package/dist/packem_shared/{assertWranglerSatisfiesSchema-CeUFnD5J.mjs → assertWranglerSatisfiesSchema-Dy0WXvP8.mjs} +1 -1
- package/dist/packem_shared/collectExportGaps-DwkdLyZ9.mjs +2 -0
- package/dist/packem_shared/guards-Buu_E7mP.mjs +1 -0
- package/dist/packem_shared/{reconcileBindingsSafely-OyMciU5L.mjs → reconcileBindingsSafely-zYvGZ8FL.mjs} +1 -1
- package/dist/packem_shared/scanWranglerVariablesForSecrets-BF-791aw.mjs +1 -0
- package/dist/packem_shared/validate-bindings-CvNBF3U4.mjs +1 -0
- package/dist/packem_shared/withTailConsumer-DngzpJMK.mjs +1 -0
- package/dist/packem_shared/wranglerCodegenInputs-DBtq3faO.mjs +1 -0
- package/dist/packem_shared/write-atomic-COUkUylA.mjs +1 -0
- package/dist/studio-host/index.mjs +1 -1
- package/package.json +3 -3
- package/dist/packem_shared/collectExportGaps-D8MCOiip.mjs +0 -2
- package/dist/packem_shared/collectWranglerSecretVariables-A6TjJjZK.mjs +0 -1
- package/dist/packem_shared/validate-bindings-DKlB-1sF.mjs +0 -1
- package/dist/packem_shared/withTailConsumer-CV75ggJW.mjs +0 -1
- package/dist/packem_shared/write-atomic-2Wn0K0G1.mjs +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { D as DeployDriver, G as GeneratedClassModule, I as InferredBindings, S as SchemaInfo } from "../packem_shared/infer-bindings.d-RLlCg7Zn.mjs";
|
|
2
|
-
import { WranglerVariableIR } from '@lunora/codegen';
|
|
2
|
+
import { WranglerQueueProducerIR, WranglerVariableIR } from '@lunora/codegen';
|
|
3
3
|
/** Apply one structural jsonc edit and return the rewritten text (a no-op edit returns the input). */
|
|
4
4
|
declare const applyModify: (text: string, path: ReadonlyArray<number | string>, value: unknown) => string;
|
|
5
5
|
/** The project coordinates the validator needs. */
|
|
@@ -882,6 +882,7 @@ interface WranglerQueueConsumer {
|
|
|
882
882
|
dead_letter_queue?: string;
|
|
883
883
|
max_batch_size?: number;
|
|
884
884
|
max_batch_timeout?: number;
|
|
885
|
+
max_concurrency?: number;
|
|
885
886
|
max_retries?: number;
|
|
886
887
|
queue?: string;
|
|
887
888
|
retry_delay?: number;
|
|
@@ -1100,6 +1101,14 @@ interface WranglerCacheShape {
|
|
|
1100
1101
|
* `undefined`/`null` (an unparsed or absent config) is treated as disabled.
|
|
1101
1102
|
*/
|
|
1102
1103
|
declare const isCacheEnabled: (parsed: WranglerCacheShape | null | undefined) => boolean;
|
|
1104
|
+
interface WranglerCodegenInputs {
|
|
1105
|
+
/** Every well-formed `queues.producers[]` entry of the top level and each `env.<name>` block. */
|
|
1106
|
+
wranglerQueueProducers: WranglerQueueProducerIR[];
|
|
1107
|
+
/** Top-level `vars` entries that look like plaintext secrets. */
|
|
1108
|
+
wranglerVariables: WranglerVariableIR[];
|
|
1109
|
+
}
|
|
1110
|
+
/** Both inputs are empty when there is no wrangler config or it does not parse. */
|
|
1111
|
+
declare const wranglerCodegenInputs: (projectRoot: string) => WranglerCodegenInputs;
|
|
1103
1112
|
interface WranglerEnvironmentMerge {
|
|
1104
1113
|
/** Set when `environment` names no `env.<name>` block declared in the config — the caller should treat this as a hard validation failure. */
|
|
1105
1114
|
error?: string;
|
|
@@ -1184,14 +1193,6 @@ declare const validateWranglerProject: (options: WranglerProjectValidationOption
|
|
|
1184
1193
|
* `secret_named_var` for the key-name path.
|
|
1185
1194
|
*/
|
|
1186
1195
|
declare const scanWranglerVariablesForSecrets: (variables: Record<string, unknown> | undefined, file: string) => WranglerVariableIR[];
|
|
1187
|
-
/**
|
|
1188
|
-
* Read the project's `wrangler.jsonc` and return its plaintext-secret `vars` as IR
|
|
1189
|
-
* for the `plaintext_secret_in_wrangler_vars` lint. Returns `[]` when there is no
|
|
1190
|
-
* wrangler config, it doesn't parse, or nothing looks like a secret. Scans the
|
|
1191
|
-
* top-level `vars` block (mirroring the existing `validateCorsVariables` scope);
|
|
1192
|
-
* per-environment `env.<name>.vars` overrides are out of scope for now.
|
|
1193
|
-
*/
|
|
1194
|
-
declare const collectWranglerSecretVariables: (projectRoot: string) => WranglerVariableIR[];
|
|
1195
1196
|
declare const REQUIRED_COMPATIBILITY_DATE: string;
|
|
1196
1197
|
declare const REQUIRED_FLAG: string;
|
|
1197
1198
|
/**
|
|
@@ -1212,7 +1213,7 @@ declare const validateWranglerConfig: (wranglerInput: WranglerConfig | undefined
|
|
|
1212
1213
|
* `{ valid, errors, warnings }`.
|
|
1213
1214
|
*/
|
|
1214
1215
|
declare const validateWrangler: typeof validateWranglerConfig;
|
|
1215
|
-
export { type AlchemyTranslation, type AssertWranglerOptions, BINDING_MANIFEST_VERSION, type BindingManifest, type BindingRequirement, CLOUDFLARE_CLI_CONFIG_WARNING_ENV, CLOUDFLARE_DRIVER, CLOUDFLARE_TOOLCHAIN_VERSIONS, type CloudflareCliConfigFinding, DEFAULT_OBSERVABILITY, type ExportGap, GLOBAL_FETCH_STRICTLY_PUBLIC_FLAG, type ManifestConfigShape, type MaterializeOptions, type MaterializeResult, type ObservabilitySignalSampling, REMOTE_ELIGIBLE_KEYS, REQUIRED_COMPATIBILITY_DATE, REQUIRED_FLAG, type ReadWranglerResult, type ReconcileBindingsResult, type ReconcileCompatibilityDateResult, type ReconcileResult as ReconcileCronsResult, type ReconcileProject, type RemoteBindingPlan, type RemoteEnableInputs, type RemoteWranglerShape, type ServiceDevConfigs, type TailConsumer, UNEXPORTED_CLASS_MARKER, WORKERS_CACHE_MIN_DATE, WRANGLER_FILES, type WranglerCacheShape, type WranglerConfig, type WranglerConfigShape, type WranglerContainerEntry, type WranglerEnvironmentMerge, type WranglerObservability, type WranglerObservabilityLogs, type WranglerObservabilityTraces, type WranglerProjectValidationOptions, type WranglerProjectValidationResult, type WranglerValidationReport, type WranglerWorkflowEntry,
|
|
1216
|
+
export { type AlchemyTranslation, type AssertWranglerOptions, BINDING_MANIFEST_VERSION, type BindingManifest, type BindingRequirement, CLOUDFLARE_CLI_CONFIG_WARNING_ENV, CLOUDFLARE_DRIVER, CLOUDFLARE_TOOLCHAIN_VERSIONS, type CloudflareCliConfigFinding, DEFAULT_OBSERVABILITY, type ExportGap, GLOBAL_FETCH_STRICTLY_PUBLIC_FLAG, type ManifestConfigShape, type MaterializeOptions, type MaterializeResult, type ObservabilitySignalSampling, REMOTE_ELIGIBLE_KEYS, REQUIRED_COMPATIBILITY_DATE, REQUIRED_FLAG, type ReadWranglerResult, type ReconcileBindingsResult, type ReconcileCompatibilityDateResult, type ReconcileResult as ReconcileCronsResult, type ReconcileProject, type RemoteBindingPlan, type RemoteEnableInputs, type RemoteWranglerShape, type ServiceDevConfigs, type TailConsumer, UNEXPORTED_CLASS_MARKER, WORKERS_CACHE_MIN_DATE, WRANGLER_FILES, type WranglerCacheShape, type WranglerCodegenInputs, type WranglerConfig, type WranglerConfigShape, type WranglerContainerEntry, type WranglerEnvironmentMerge, type WranglerObservability, type WranglerObservabilityLogs, type WranglerObservabilityTraces, type WranglerProjectValidationOptions, type WranglerProjectValidationResult, type WranglerValidationReport, type WranglerWorkflowEntry,
|
|
1216
1217
|
/**
|
|
1217
1218
|
* `@lunora/config/cloudflare` — the wrangler layer.
|
|
1218
1219
|
*
|
|
@@ -1228,4 +1229,4 @@ export { type AlchemyTranslation, type AssertWranglerOptions, BINDING_MANIFEST_V
|
|
|
1228
1229
|
* Plan 114 §5.3 (D6): a package carrying real provider code isolates it behind a
|
|
1229
1230
|
* subpath rather than relocating wholesale.
|
|
1230
1231
|
*/
|
|
1231
|
-
applyModify, assertWranglerSatisfiesSchema, buildBindingManifest, collectExportGaps,
|
|
1232
|
+
applyModify, assertWranglerSatisfiesSchema, buildBindingManifest, collectExportGaps, describePreservedCrons, detectCloudflareCliConfig, findWranglerFile, injectRemoteFlags, isCacheEnabled, isRemoteEnvEnabled, materializeRemoteWranglerConfig, materializeServiceDevConfigs, mergeWranglerEnvironment, planRemoteBindings, readWranglerJsonc, reconcileBindingsSafely, reconcileWranglerBindings, reconcileWranglerCompatibilityDate, reconcileWranglerCrons, reconcileWranglerExtras, resolveObservabilitySampling, resolveRemoteEnabled, scanWranglerVariablesForSecrets, validateWrangler, validateWranglerConfig, validateWranglerProject, warnCloudflareCliConfigOnce, withTailConsumer, wranglerCodegenInputs, wranglerToAlchemy };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { D as DeployDriver, G as GeneratedClassModule, I as InferredBindings, S as SchemaInfo } from "../packem_shared/infer-bindings.d-RLlCg7Zn.js";
|
|
2
|
-
import { WranglerVariableIR } from '@lunora/codegen';
|
|
2
|
+
import { WranglerQueueProducerIR, WranglerVariableIR } from '@lunora/codegen';
|
|
3
3
|
/** Apply one structural jsonc edit and return the rewritten text (a no-op edit returns the input). */
|
|
4
4
|
declare const applyModify: (text: string, path: ReadonlyArray<number | string>, value: unknown) => string;
|
|
5
5
|
/** The project coordinates the validator needs. */
|
|
@@ -882,6 +882,7 @@ interface WranglerQueueConsumer {
|
|
|
882
882
|
dead_letter_queue?: string;
|
|
883
883
|
max_batch_size?: number;
|
|
884
884
|
max_batch_timeout?: number;
|
|
885
|
+
max_concurrency?: number;
|
|
885
886
|
max_retries?: number;
|
|
886
887
|
queue?: string;
|
|
887
888
|
retry_delay?: number;
|
|
@@ -1100,6 +1101,14 @@ interface WranglerCacheShape {
|
|
|
1100
1101
|
* `undefined`/`null` (an unparsed or absent config) is treated as disabled.
|
|
1101
1102
|
*/
|
|
1102
1103
|
declare const isCacheEnabled: (parsed: WranglerCacheShape | null | undefined) => boolean;
|
|
1104
|
+
interface WranglerCodegenInputs {
|
|
1105
|
+
/** Every well-formed `queues.producers[]` entry of the top level and each `env.<name>` block. */
|
|
1106
|
+
wranglerQueueProducers: WranglerQueueProducerIR[];
|
|
1107
|
+
/** Top-level `vars` entries that look like plaintext secrets. */
|
|
1108
|
+
wranglerVariables: WranglerVariableIR[];
|
|
1109
|
+
}
|
|
1110
|
+
/** Both inputs are empty when there is no wrangler config or it does not parse. */
|
|
1111
|
+
declare const wranglerCodegenInputs: (projectRoot: string) => WranglerCodegenInputs;
|
|
1103
1112
|
interface WranglerEnvironmentMerge {
|
|
1104
1113
|
/** Set when `environment` names no `env.<name>` block declared in the config — the caller should treat this as a hard validation failure. */
|
|
1105
1114
|
error?: string;
|
|
@@ -1184,14 +1193,6 @@ declare const validateWranglerProject: (options: WranglerProjectValidationOption
|
|
|
1184
1193
|
* `secret_named_var` for the key-name path.
|
|
1185
1194
|
*/
|
|
1186
1195
|
declare const scanWranglerVariablesForSecrets: (variables: Record<string, unknown> | undefined, file: string) => WranglerVariableIR[];
|
|
1187
|
-
/**
|
|
1188
|
-
* Read the project's `wrangler.jsonc` and return its plaintext-secret `vars` as IR
|
|
1189
|
-
* for the `plaintext_secret_in_wrangler_vars` lint. Returns `[]` when there is no
|
|
1190
|
-
* wrangler config, it doesn't parse, or nothing looks like a secret. Scans the
|
|
1191
|
-
* top-level `vars` block (mirroring the existing `validateCorsVariables` scope);
|
|
1192
|
-
* per-environment `env.<name>.vars` overrides are out of scope for now.
|
|
1193
|
-
*/
|
|
1194
|
-
declare const collectWranglerSecretVariables: (projectRoot: string) => WranglerVariableIR[];
|
|
1195
1196
|
declare const REQUIRED_COMPATIBILITY_DATE: string;
|
|
1196
1197
|
declare const REQUIRED_FLAG: string;
|
|
1197
1198
|
/**
|
|
@@ -1212,7 +1213,7 @@ declare const validateWranglerConfig: (wranglerInput: WranglerConfig | undefined
|
|
|
1212
1213
|
* `{ valid, errors, warnings }`.
|
|
1213
1214
|
*/
|
|
1214
1215
|
declare const validateWrangler: typeof validateWranglerConfig;
|
|
1215
|
-
export { type AlchemyTranslation, type AssertWranglerOptions, BINDING_MANIFEST_VERSION, type BindingManifest, type BindingRequirement, CLOUDFLARE_CLI_CONFIG_WARNING_ENV, CLOUDFLARE_DRIVER, CLOUDFLARE_TOOLCHAIN_VERSIONS, type CloudflareCliConfigFinding, DEFAULT_OBSERVABILITY, type ExportGap, GLOBAL_FETCH_STRICTLY_PUBLIC_FLAG, type ManifestConfigShape, type MaterializeOptions, type MaterializeResult, type ObservabilitySignalSampling, REMOTE_ELIGIBLE_KEYS, REQUIRED_COMPATIBILITY_DATE, REQUIRED_FLAG, type ReadWranglerResult, type ReconcileBindingsResult, type ReconcileCompatibilityDateResult, type ReconcileResult as ReconcileCronsResult, type ReconcileProject, type RemoteBindingPlan, type RemoteEnableInputs, type RemoteWranglerShape, type ServiceDevConfigs, type TailConsumer, UNEXPORTED_CLASS_MARKER, WORKERS_CACHE_MIN_DATE, WRANGLER_FILES, type WranglerCacheShape, type WranglerConfig, type WranglerConfigShape, type WranglerContainerEntry, type WranglerEnvironmentMerge, type WranglerObservability, type WranglerObservabilityLogs, type WranglerObservabilityTraces, type WranglerProjectValidationOptions, type WranglerProjectValidationResult, type WranglerValidationReport, type WranglerWorkflowEntry,
|
|
1216
|
+
export { type AlchemyTranslation, type AssertWranglerOptions, BINDING_MANIFEST_VERSION, type BindingManifest, type BindingRequirement, CLOUDFLARE_CLI_CONFIG_WARNING_ENV, CLOUDFLARE_DRIVER, CLOUDFLARE_TOOLCHAIN_VERSIONS, type CloudflareCliConfigFinding, DEFAULT_OBSERVABILITY, type ExportGap, GLOBAL_FETCH_STRICTLY_PUBLIC_FLAG, type ManifestConfigShape, type MaterializeOptions, type MaterializeResult, type ObservabilitySignalSampling, REMOTE_ELIGIBLE_KEYS, REQUIRED_COMPATIBILITY_DATE, REQUIRED_FLAG, type ReadWranglerResult, type ReconcileBindingsResult, type ReconcileCompatibilityDateResult, type ReconcileResult as ReconcileCronsResult, type ReconcileProject, type RemoteBindingPlan, type RemoteEnableInputs, type RemoteWranglerShape, type ServiceDevConfigs, type TailConsumer, UNEXPORTED_CLASS_MARKER, WORKERS_CACHE_MIN_DATE, WRANGLER_FILES, type WranglerCacheShape, type WranglerCodegenInputs, type WranglerConfig, type WranglerConfigShape, type WranglerContainerEntry, type WranglerEnvironmentMerge, type WranglerObservability, type WranglerObservabilityLogs, type WranglerObservabilityTraces, type WranglerProjectValidationOptions, type WranglerProjectValidationResult, type WranglerValidationReport, type WranglerWorkflowEntry,
|
|
1216
1217
|
/**
|
|
1217
1218
|
* `@lunora/config/cloudflare` — the wrangler layer.
|
|
1218
1219
|
*
|
|
@@ -1228,4 +1229,4 @@ export { type AlchemyTranslation, type AssertWranglerOptions, BINDING_MANIFEST_V
|
|
|
1228
1229
|
* Plan 114 §5.3 (D6): a package carrying real provider code isolates it behind a
|
|
1229
1230
|
* subpath rather than relocating wholesale.
|
|
1230
1231
|
*/
|
|
1231
|
-
applyModify, assertWranglerSatisfiesSchema, buildBindingManifest, collectExportGaps,
|
|
1232
|
+
applyModify, assertWranglerSatisfiesSchema, buildBindingManifest, collectExportGaps, describePreservedCrons, detectCloudflareCliConfig, findWranglerFile, injectRemoteFlags, isCacheEnabled, isRemoteEnvEnabled, materializeRemoteWranglerConfig, materializeServiceDevConfigs, mergeWranglerEnvironment, planRemoteBindings, readWranglerJsonc, reconcileBindingsSafely, reconcileWranglerBindings, reconcileWranglerCompatibilityDate, reconcileWranglerCrons, reconcileWranglerExtras, resolveObservabilitySampling, resolveRemoteEnabled, scanWranglerVariablesForSecrets, validateWrangler, validateWranglerConfig, validateWranglerProject, warnCloudflareCliConfigOnce, withTailConsumer, wranglerCodegenInputs, wranglerToAlchemy };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{applyModify as o}from"../packem_shared/applyModify-DKP2l6S9.mjs";import{assertWranglerSatisfiesSchema as
|
|
1
|
+
import{applyModify as o}from"../packem_shared/applyModify-DKP2l6S9.mjs";import{assertWranglerSatisfiesSchema as n}from"../packem_shared/assertWranglerSatisfiesSchema-Dy0WXvP8.mjs";import{BINDING_MANIFEST_VERSION as l,buildBindingManifest as i}from"../packem_shared/BINDING_MANIFEST_VERSION-CfXEYG8e.mjs";import{CLOUDFLARE_CLI_CONFIG_WARNING_ENV as m,detectCloudflareCliConfig as E,warnCloudflareCliConfigOnce as p}from"../packem_shared/CLOUDFLARE_CLI_CONFIG_WARNING_ENV-BKMrOuXV.mjs";import{default as g}from"../packem_shared/CLOUDFLARE_DRIVER-Ci3VIqnk.mjs";import{default as R}from"../packem_shared/GLOBAL_FETCH_STRICTLY_PUBLIC_FLAG-f8CnJha3.mjs";import{collectExportGaps as _,reconcileWranglerBindings as c}from"../packem_shared/collectExportGaps-DwkdLyZ9.mjs";import{reconcileWranglerCompatibilityDate as d}from"../packem_shared/reconcileWranglerCompatibilityDate-hocXEuRA.mjs";import{describePreservedCrons as A,reconcileWranglerCrons as S}from"../packem_shared/describePreservedCrons-C5KPuPy3.mjs";import{reconcileBindingsSafely as W,reconcileWranglerExtras as T}from"../packem_shared/reconcileBindingsSafely-zYvGZ8FL.mjs";import{REMOTE_ELIGIBLE_KEYS as F,injectRemoteFlags as N,isRemoteEnvEnabled as v,materializeRemoteWranglerConfig as B,planRemoteBindings as b,resolveRemoteEnabled as G}from"../packem_shared/REMOTE_ELIGIBLE_KEYS-DPv7P69m.mjs";import{materializeServiceDevConfigs as U}from"../packem_shared/materializeServiceDevConfigs-Dot5AUtE.mjs";import{default as y}from"../packem_shared/CLOUDFLARE_TOOLCHAIN_VERSIONS-DV5E_f_q.mjs";import{withTailConsumer as P}from"../packem_shared/withTailConsumer-DngzpJMK.mjs";import{WORKERS_CACHE_MIN_DATE as w,isCacheEnabled as Y}from"../packem_shared/WORKERS_CACHE_MIN_DATE-0k9ABJtF.mjs";import{wranglerCodegenInputs as K}from"../packem_shared/wranglerCodegenInputs-DBtq3faO.mjs";import{DEFAULT_OBSERVABILITY as z,resolveObservabilitySampling as Q}from"../packem_shared/DEFAULT_OBSERVABILITY-bN6UkTMx.mjs";import{mergeWranglerEnvironment as X}from"../packem_shared/mergeWranglerEnvironment-DXiB-HcS.mjs";import{WRANGLER_FILES as q,findWranglerFile as Z,readWranglerJsonc as $}from"../packem_shared/WRANGLER_FILES-UNW-xY5u.mjs";import{UNEXPORTED_CLASS_MARKER as re,validateWranglerProject as oe}from"../packem_shared/UNEXPORTED_CLASS_MARKER-IAK9PiDz.mjs";import{scanWranglerVariablesForSecrets as ne}from"../packem_shared/scanWranglerVariablesForSecrets-BF-791aw.mjs";import{wranglerToAlchemy as le}from"../packem_shared/wranglerToAlchemy-CBO2ucRm.mjs";import{REQUIRED_COMPATIBILITY_DATE as fe,REQUIRED_FLAG as me,validateWrangler as Ee,validateWranglerConfig as pe}from"../packem_shared/REQUIRED_COMPATIBILITY_DATE-OLQlG0oj.mjs";export{l as BINDING_MANIFEST_VERSION,m as CLOUDFLARE_CLI_CONFIG_WARNING_ENV,g as CLOUDFLARE_DRIVER,y as CLOUDFLARE_TOOLCHAIN_VERSIONS,z as DEFAULT_OBSERVABILITY,R as GLOBAL_FETCH_STRICTLY_PUBLIC_FLAG,F as REMOTE_ELIGIBLE_KEYS,fe as REQUIRED_COMPATIBILITY_DATE,me as REQUIRED_FLAG,re as UNEXPORTED_CLASS_MARKER,w as WORKERS_CACHE_MIN_DATE,q as WRANGLER_FILES,o as applyModify,n as assertWranglerSatisfiesSchema,i as buildBindingManifest,_ as collectExportGaps,A as describePreservedCrons,E as detectCloudflareCliConfig,Z as findWranglerFile,N as injectRemoteFlags,Y as isCacheEnabled,v as isRemoteEnvEnabled,B as materializeRemoteWranglerConfig,U as materializeServiceDevConfigs,X as mergeWranglerEnvironment,b as planRemoteBindings,$ as readWranglerJsonc,W as reconcileBindingsSafely,c as reconcileWranglerBindings,d as reconcileWranglerCompatibilityDate,S as reconcileWranglerCrons,T as reconcileWranglerExtras,Q as resolveObservabilitySampling,G as resolveRemoteEnabled,ne as scanWranglerVariablesForSecrets,Ee as validateWrangler,pe as validateWranglerConfig,oe as validateWranglerProject,p as warnCloudflareCliConfigOnce,P as withTailConsumer,K as wranglerCodegenInputs,le as wranglerToAlchemy};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{existsSync as d,readFileSync as y}from"node:fs";import{join as s,isAbsolute as a,relative as m}from"node:path";import{LunoraError as p}from"@lunora/errors";import{classifyPolicyEdit as k,scaffoldPolicyFile as v,resolveServerModule as l,wireRlsIntoProcedure as b}from"./classifyPolicyEdit-DJi9Fk8G.mjs";import{w as c,r as h}from"./write-atomic-
|
|
1
|
+
import{existsSync as d,readFileSync as y}from"node:fs";import{join as s,isAbsolute as a,relative as m}from"node:path";import{LunoraError as p}from"@lunora/errors";import{classifyPolicyEdit as k,scaffoldPolicyFile as v,resolveServerModule as l,wireRlsIntoProcedure as b}from"./classifyPolicyEdit-DJi9Fk8G.mjs";import{w as c,r as h}from"./write-atomic-COUkUylA.mjs";const D="/__lunora/policy-scaffold",u=e=>e==="unknown-procedure"?404:e==="already-wired"||e==="destructive"?409:422,f=(e,o)=>{let r;try{r=h(e)}catch(t){return{body:{error:t instanceof Error?t.message:String(t),ok:!1},status:500}}return{body:{...o,diagnostics:r,ok:!0},status:200}},g=e=>({body:{edit:e,message:"Rewriting an existing policy predicate changes evaluation semantics and must be done by hand. The scaffolder only adds new, deny-by-default rules.",needsManualEdit:!0,ok:!1},status:409}),w=(e,o)=>{const r=v(o,l(e.projectRoot));if(!r.ok)return{body:{error:r.reason,ok:!1},status:u(r.reason)};const t=e.schemaDirectory??"lunora",n=s(e.projectRoot,t,r.fileName);return d(n)?{body:{error:"file-exists",fileName:r.fileName,ok:!1},status:409}:(c(n,r.source),f(e,{fileName:r.fileName}))},R=(e,o,r)=>{if(typeof r!="string"||r.length===0||a(r)||r.includes("\\"))return;const t=s(e,o),n=s(t,`${r}.ts`),i=m(t,n);if(!(i.startsWith("..")||a(i)))return n},N=(e,o)=>{const r=R(e.projectRoot,e.schemaDirectory??"lunora",o.filePath);if(r===void 0||!d(r))return{body:{error:"unknown-procedure",ok:!1},status:404};const t=b(y(r,"utf8"),o,l(e.projectRoot));return t.ok?(c(r,t.text),f(e,{exportName:o.exportName})):{body:{error:t.reason,ok:!1},status:u(t.reason)}},E=e=>{if(e.method!=="POST")return{body:{error:"method-not-allowed",ok:!1},status:405};const{body:o}=e;if(o==null||typeof o!="object"||typeof o.kind!="string")return{body:{error:"invalid-edit",ok:!1},status:400};const r=o;if(k(r)==="destructive")return g(r);if(r.kind==="scaffoldPolicy")return w(e,r);if(r.kind==="wireRls")return N(e,r);throw new p("INTERNAL",`unhandled additive policy edit kind: ${String(r.kind)}`)};export{D as POLICY_SCAFFOLD_ENDPOINT,E as handlePolicyScaffoldRequest};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{MERGED_DURABLE_OBJECT as _}from"./COMPOSED_WORKER_ENTRY-Ciiba5g_.mjs";import{o as E,v as h,a as p,b as D,c as O,d as R,e as l,g as y,h as I,H as S,i as $,R as j,S as A,j as k,k as L,W as w,l as B}from"./validate-bindings-
|
|
1
|
+
import{MERGED_DURABLE_OBJECT as _}from"./COMPOSED_WORKER_ENTRY-Ciiba5g_.mjs";import{o as E,v as h,a as p,b as D,c as O,d as R,e as l,g as y,h as I,H as S,i as $,R as j,S as A,j as k,k as L,W as w,l as B}from"./validate-bindings-CvNBF3U4.mjs";import{validateTailConsumers as T,validateSendEmail as C,validateSecretsRequired as N,validateLogpush as U,validateLimits as G,validatePlacement as P,validateObservability as K,validateAssets as V,validateCache as W,validateExports as M,validateCorsVariables as x,validateSchedulerOrigin as F}from"./withTailConsumer-DngzpJMK.mjs";import{isCacheEnabled as H,WORKERS_CACHE_MIN_DATE as b}from"./WORKERS_CACHE_MIN_DATE-0k9ABJtF.mjs";import{mergeWranglerEnvironment as Y}from"./mergeWranglerEnvironment-DXiB-HcS.mjs";const q=i=>typeof i=="object"&&i!==null&&!Array.isArray(i),g=i=>Array.isArray(i)?i.flatMap((a,n)=>q(a)?[[n,a]]:[]):[],m=i=>typeof i.binding=="string"?i.binding:"",J=(i,a,n)=>{for(const[e,s]of g(i.kv_namespaces))typeof s.id=="string"&&s.id!==""||n.push(`kv_namespaces[${String(e)}] ("${m(s)}") is not created yet and the schema pins data to "${a}" — create it with \`wrangler kv namespace create <name> --jurisdiction=${a}\`; a namespace's jurisdiction cannot be changed afterwards`)},Q=(i,a,n)=>{for(const[e,s]of g(i.r2_buckets)){const o=s.jurisdiction;if(o===a)continue;const t=typeof o=="string"?`names the "${o}" jurisdiction`:"names no jurisdiction";n.push(`r2_buckets[${String(e)}] ("${m(s)}") ${t}, but the schema pins data to "${a}" — create the bucket with \`wrangler r2 bucket create <name> --jurisdiction=${a}\` and set "jurisdiction": "${a}" on the binding`)}},z=(i,a,n)=>{const e=a?.jurisdiction;e!==void 0&&(J(i,e,n),Q(i,e,n))},v="2026-04-07",le="web_socket_auto_reply_to_close",u="2026-10-01",f="durable_object_io_tasks_prevent_eviction",X="durable_object_io_tasks_do_not_prevent_eviction",Z=/^\d{4}-\d{2}-\d{2}$/,ee=(i,a,n)=>{i>=u||a.includes(f)||a.includes(X)||n.push(`compatibility_date "${i}" predates "${u}", so pending I/O (waitUntil, cross-Durable-Object RPC, service-binding calls, timers) does not keep a Durable Object alive once its last client disconnects — live-query refreshes and durable streams can be cut off mid-flight. Set compatibility_date >= "${u}" or add the "${f}" compatibility flag`)},te=(i,a,n)=>{const{error:e,merged:s,unverifiedKeys:o}=Y(i,a);return e!==void 0?{error:e,wrangler:s}:(o.length>0&&n.push(`env.${String(a)} overrides ${o.join(", ")}, which this validator doesn't have a verified inheritance rule for — validated against the TOP-LEVEL value only. Double-check ${o.length===1?"it":"them"} by hand for "${String(a)}".`),{wrangler:s})},ie=(i,a,n)=>{const e=[],s=[];if(!i||typeof i!="object")return e.push("wrangler config is not a valid object"),{errors:e,valid:!1,warnings:s};const{error:o,wrangler:t}=te(i,n,s);if(o!==void 0)return e.push(o),{errors:e,valid:!1,warnings:s};E(t.durable_objects?.bindings).find(r=>r.name==="SHARD"&&(r.class_name==="ShardDO"||r.class_name===_))||e.push(`durable_objects.bindings must include { "name": "SHARD", "class_name": "ShardDO" } (or "${_}" when the app merges its Durable Objects) — your dev server auto-reconciles this on startup, or add the binding manually`),h(t,e);const d=t.compatibility_date??"",c=Z.test(d);d&&!c?e.push(`compatibility_date must be in YYYY-MM-DD format (got "${d}")`):d<v&&e.push(`compatibility_date must be >= "${v}" (got "${d||"<missing>"}")`),H(t)&&c&&d<b&&e.push(`cache.enabled requires compatibility_date >= "${b}" (got "${d||"<missing>"}")`),c&&ee(d,t.compatibility_flags??[],s),p(t,a,e),z(t,a,s),D(t,e),O(t,a?.vectorIndexNames??[],e),T(t,e),R(t,e,s),l(t.workflows,"workflows",w,e),y(t,e),I(t,e),l(t.secrets_store_secrets,"secrets_store_secrets",B,e);for(const r of S)$(t,r,e,s);for(const r of j)l(t[r.key],r.key,r,e);for(const r of A)k(t,r,e);return L(t,e),C(t,e,s),N(t,e),U(t,e),G(t,e),P(t,e),K(t,e,s),V(t,e),W(t,e),M(t,e),x(t,e),F(t,n,s),{errors:e,valid:e.length===0,warnings:s}},ue=ie;export{v as REQUIRED_COMPATIBILITY_DATE,le as REQUIRED_FLAG,ue as validateWrangler,ie as validateWranglerConfig};
|
package/dist/packem_shared/{SCHEMA_EDIT_ENDPOINT-x627vqD5.mjs → SCHEMA_EDIT_ENDPOINT-DrZLd5rF.mjs}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{existsSync as a,readFileSync as d}from"node:fs";import{classifyEdit as l,applyAdditiveEdit as c}from"./applyAdditiveEdit-CH0VhMJ2.mjs";import{parseSchema as u}from"./parseSchema-D1Wbr1qv.mjs";import{w as f,r as p}from"./write-atomic-
|
|
1
|
+
import{existsSync as a,readFileSync as d}from"node:fs";import{classifyEdit as l,applyAdditiveEdit as c}from"./applyAdditiveEdit-CH0VhMJ2.mjs";import{parseSchema as u}from"./parseSchema-D1Wbr1qv.mjs";import{w as f,r as p}from"./write-atomic-COUkUylA.mjs";import{join as m}from"node:path";const F="/__lunora/schema-edit",b=t=>t==="destructive"||t==="duplicate-table"||t==="duplicate-column"||t==="duplicate-index"?409:t==="unknown-table"?404:t==="invalid-identifier"||t==="invalid-validator"?400:422,y=t=>({body:{error:t.reason,ok:!1},status:422}),h=t=>{if(!a(t))return{response:{body:{error:"no-schema-file",ok:!1},status:404}};const r=u(d(t,"utf8"));return r.ok?{tables:r.tables}:{response:y(r)}},k=t=>({body:{edit:t,message:"This edit changes stored data and must go through a migration. Review the migration before applying.",needsMigration:!0,ok:!1},status:409}),g=(t,r)=>{const e=t.body;if(e==null||typeof e!="object"||typeof e.kind!="string")return{body:{error:"invalid-edit",ok:!1},status:400};if(l(e)==="destructive")return k(e);if(!a(r))return{body:{error:"no-schema-file",ok:!1},status:404};const o=c(d(r,"utf8"),e);if(!o.ok)return{body:{error:o.reason,ok:!1},status:b(o.reason)};f(r,o.text);let i;try{i=p(t)}catch(s){return{body:{error:s instanceof Error?s.message:String(s),ok:!1},status:500}}const n=u(o.text);return{body:{diagnostics:i,ok:!0,tables:n.ok?n.tables:[]},status:200}},R=t=>{const r=m(t.projectRoot,t.schemaDirectory??"lunora","schema.ts");if(t.method==="GET"){const e=h(r);return"response"in e?e.response:{body:{ok:!0,tables:e.tables},status:200}}return t.method==="POST"?g(t,r):{body:{error:"method-not-allowed",ok:!1},status:405}};export{F as SCHEMA_EDIT_ENDPOINT,R as handleSchemaEditRequest};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{resolveAdminToken as A}from"./parseDevVariable-teAAahVD.mjs";import{sendStudioDocument as I,applyStudioAssetCache as O}from"./applyStudioAssetCache-DHQEJuuv.mjs";import{isStandaloneModulePath as _,studioAssetsStamp as H,loadStudioAssets as N,readStandaloneAsset as C,assetContentType as D}from"./assetContentType-CUb5bpbI.mjs";import{detectAgentRules as E}from"./AGENT_RULES_DIR-HrrbNZPy.mjs";import{handlePolicyScaffoldRequest as v,POLICY_SCAFFOLD_ENDPOINT as L}from"./POLICY_SCAFFOLD_ENDPOINT-
|
|
1
|
+
import{resolveAdminToken as A}from"./parseDevVariable-teAAahVD.mjs";import{sendStudioDocument as I,applyStudioAssetCache as O}from"./applyStudioAssetCache-DHQEJuuv.mjs";import{isStandaloneModulePath as _,studioAssetsStamp as H,loadStudioAssets as N,readStandaloneAsset as C,assetContentType as D}from"./assetContentType-CUb5bpbI.mjs";import{detectAgentRules as E}from"./AGENT_RULES_DIR-HrrbNZPy.mjs";import{handlePolicyScaffoldRequest as v,POLICY_SCAFFOLD_ENDPOINT as L}from"./POLICY_SCAFFOLD_ENDPOINT-BquzWeBo.mjs";import R from"./renderStudioHtml-ByowDtMl.mjs";import{handleSchemaEditRequest as b,SCHEMA_EDIT_ENDPOINT as x}from"./SCHEMA_EDIT_ENDPOINT-DrZLd5rF.mjs";import{handleSeedRequest as k,SEED_ENDPOINT as $}from"./SEED_ENDPOINT-2B56PN_H.mjs";import{serveJsonHandler as g}from"./serveJsonHandler-Dv0EdCb9.mjs";import{transportRejectionReason as j}from"./ALLOW_FORWARDED_ENV-BUndghJx.mjs";const d="/__lunora",M=`${d}/studio.js`,m=`${d}/styles.css`,p=/\/$/,U={[L]:v,[x]:b,[$]:k},q=new Set(["127.0.0.1","::1","localhost"]),X=t=>t!==void 0&&t!==!1&&!q.has(t),y=t=>t===void 0||t==="/"?"":t.replace(p,""),Z=t=>`${y(t)}${d}`,T=(t,n,c)=>{t.statusCode=200,t.setHeader("Content-Type",c),t.end(n)},w=t=>{try{return new URL(t,"http://localhost").pathname}catch{const n=t.indexOf("?");return n===-1?t:t.slice(0,n)}},tt=t=>{const{logger:n,projectRoot:c}=t,u=y(t.base);let l,f,S;const P=(o,s,e)=>{const i=H();if((l===void 0||i!==f)&&(l=N(n),f=i),l===void 0){e.statusCode=501,e.setHeader("Content-Type","text/plain"),e.end("Lunora studio assets not found — install and build @lunora/studio.");return}const a=o===m,r=o.slice(o.lastIndexOf("/")+1);if(O(s,e,r,i))return;if(a){T(e,l.styles,"text/css; charset=utf-8");return}const h=C(r);if(h===void 0){e.statusCode=404,e.setHeader("Content-Type","text/plain"),e.end("Not found");return}T(e,h,D(r))};return(o,s,e)=>{const i=w(o.url??"").replace(p,""),a=u!==""&&i.startsWith(u)?i.slice(u.length):i;if(a!==d&&!a.startsWith(`${d}/`)){e();return}if(t.isNonLoopbackBind||j(o,n)!==void 0){s.statusCode=403,s.setHeader("Content-Type","text/plain"),s.end("Lunora studio is only available on loopback hosts in dev.");return}const r=U[a];if(r!==void 0){g(o,s,r,c,{apiSpec:t.apiSpec,schemaDirectory:t.schemaDirectory});return}if(a===m||_(a)){P(a,o,s);return}S??=R({adminToken:A(c),basePath:d,dataEditable:!0,rulesInstalled:E(c).installed,runAsIdentity:!0,schemaEditable:!0,scriptSrc:M,styleHref:m}),I(s,S)}};export{d as STUDIO_PATH,M as STUDIO_SCRIPT_PATH,m as STUDIO_STYLE_PATH,tt as createStudioMiddleware,X as isNonLoopbackHost,w as requestPathname,Z as studioMountPath};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{existsSync as h}from"node:fs";import{dirname as y,join as p}from"node:path";import{discoverSchemaInfo as E}from"./discoverSchemaInfo-BLe1EVI8.mjs";import{MERGED_DURABLE_OBJECT as i,GENERATED_DIRECTORY as w,MERGED_ROLE_DURABLE_OBJECTS as u,COMPOSED_ENTRY_DURABLE_OBJECTS as $,GENERATED_CLASS_MODULES as k,isFrameworkDurableObject as D}from"./COMPOSED_WORKER_ENTRY-Ciiba5g_.mjs";import{o as R,f as j}from"./validate-bindings-
|
|
1
|
+
import{existsSync as h}from"node:fs";import{dirname as y,join as p}from"node:path";import{discoverSchemaInfo as E}from"./discoverSchemaInfo-BLe1EVI8.mjs";import{MERGED_DURABLE_OBJECT as i,GENERATED_DIRECTORY as w,MERGED_ROLE_DURABLE_OBJECTS as u,COMPOSED_ENTRY_DURABLE_OBJECTS as $,GENERATED_CLASS_MODULES as k,isFrameworkDurableObject as D}from"./COMPOSED_WORKER_ENTRY-Ciiba5g_.mjs";import{o as R,f as j}from"./validate-bindings-CvNBF3U4.mjs";import{validateSchedulerOrigin as x}from"./withTailConsumer-DngzpJMK.mjs";import{l as O,r as _,s as A}from"./worker-entry-checks-AIASCYl7.mjs";import{mergeWranglerEnvironment as S}from"./mergeWranglerEnvironment-DXiB-HcS.mjs";import{findWranglerFile as W,readWranglerJsonc as C}from"./WRANGLER_FILES-UNW-xY5u.mjs";import{validateWranglerConfig as T}from"./REQUIRED_COMPATIBILITY_DATE-OLQlG0oj.mjs";const v=r=>Array.isArray(r)?r:[],L=(r,o,t)=>Object.entries(r?.images??{}).flatMap(([s,n])=>{const e=n?.dockerfile;return typeof e!="string"||h(e.startsWith("/")?e:p(o,e))?[]:[`containers images["${s}"] dockerfile "${e}" does not exist (resolved relative to ${t}); create the Dockerfile`]}),I=(r,o,t)=>{const s=[];for(const n of v(r)){const e=n?.image;typeof e=="string"&&(e.startsWith("./")||e.startsWith("../")||e.startsWith("/")||e.includes("Dockerfile"))&&!h(e.startsWith("/")?e:p(o,e))&&s.push(`containers image "${e}" does not exist (resolved relative to ${t}); create the Dockerfile or point image at a registry reference`),s.push(...L(n,o,t))}return s},P=(r,o)=>{const t=r?.vectorIndexNames??[],s=[];if(t.length>0&&s.push({message:e=>`schema declares vector index(es) ${t.map(l=>`"${l}"`).join(", ")} but nothing chains .vectors(...) onto defineApp() (composed in: ${e}) — \`ctx.vectors\` is then a throwing stub and buildWorkerOptions rejects EVERY request, /_lunora/health included. Add \`.vectors((env) => ({ ${String(t[0])}: env.<BINDING> }))\` to the chain.`,method:"vectors"}),r?.hasD1GlobalTable&&s.push({message:e=>`schema declares .global() table(s) but nothing chains .global(...) onto defineApp() (composed in: ${e}) — the shard then has no global writer, so every read or write of a global table throws INTERNAL ("requires a globalDb writer"). Add \`.global({ d1: (env) => env.DB })\` to the chain.`,method:"global"}),r?.hasHyperdriveGlobalTable&&s.push({message:e=>`schema declares .global({ backend: "hyperdrive" }) table(s) but nothing chains .hyperdriveGlobal(...) onto defineApp() (composed in: ${e}) — the shard then has no global writer, so every read or write of those tables throws INTERNAL. Add \`.hyperdriveGlobal({ engine: "postgres", exec: (env) => buildPgExec(fromPostgresJs(postgres(env.HYPERDRIVE.connectionString))) })\` to the chain (\`buildPgExec\` from \`@lunora/hyperdrive/global\`, \`fromPostgresJs\` from \`@lunora/hyperdrive\`).`,method:"hyperdriveGlobal"}),s.length===0)return[];const n=A(o,new Set(s.map(e=>e.method)));return n===void 0?[]:s.filter(e=>!n.chained.has(e.method)).map(e=>e.message(n.site))},G="does not export it",B=(r,o)=>{if(o.exports?.has(i)===!0&&u.has(r))return`This app merges its Durable Objects (\`durableObjects.merge\` in lunora.config), so ${i} hosts ${r}: bind only \`SHARD\` to "${i}" and drop the SCHEDULER / SHARD_REGISTRY bindings. Do that only if this Worker has never been deployed — a deployed ${r} namespace keeps its data, which the merged class cannot reach; turn \`durableObjects.merge\` off to keep it.`;if(r===i)return`${i} is the merged class (\`durableObjects.merge\` in lunora.config), and merging cannot be undone once deployed: the shard data lives in ${i}. Turn \`durableObjects.merge\` back on. Only a Worker that has never been deployed may rebind SHARD to "ShardDO".`;if(o.kind!=="composed")return`Re-export it from the module that defines it (\`export { ${r} } from "./…";\`), or add it to the app builder's own export (\`export const { ${r} } = app;\`).`;const t=`it exports ${$.join(", ")}, SchedulerDO when its binding is declared, and every class codegen emits from your ${k.map(s=>`${s}.ts`).join(" / ")} declarations`;return D(r)?`\`@lunora/vite\` generates that entry — ${t}, and ${r} is not among them. Class-A composition does not carry ${r}, so drop the binding; a project that needs it has to own its worker entry (add \`src/worker.ts\`, which \`lunora deploy\` bundles in place of \`main\`, and compose \`defineApp()\` there).`:`\`@lunora/vite\` generates that entry, so there is no file to add a re-export to: ${t}. Declare "${r}" in one of those and re-run \`lunora codegen\`, or drop the binding.`},M=(r,o)=>{const t=o.exports;if(t===void 0)return[];const s=[];for(const e of R(r.durable_objects?.bindings))typeof e.class_name=="string"&&e.class_name.length>0&&e.script_name===void 0&&s.push({className:e.class_name,label:"durable_objects.bindings"});for(const e of v(r.workflows))typeof e?.class_name=="string"&&e.class_name.length>0&&e.script_name===void 0&&s.push({className:e.class_name,label:"workflows"});for(const[e,l]of Object.entries(r.exports??{}))l?.type==="workflow"&&s.push({className:e,label:"workflows"});return s.filter(e=>!t.has(e.className)).map(e=>`${e.label} declares class "${e.className}" but the ${o.kind==="composed"?"composed class-A worker entry":"worker entry"} (${o.path}) ${G} — wrangler refuses to bundle a Worker whose ${e.label==="workflows"?"Workflow":"Durable Object"} classes are not exported. ${B(e.className,o)}`)},N=r=>[...j(r.migrations)].filter(o=>u.has(o)).map(o=>`migrations create class "${o}", which this app hosts in ${i} because it merges its Durable Objects (\`durableObjects.merge\`). Before the first deploy, replace "${o}" with "${i}" in new_sqlite_classes; a Worker already deployed with "${o}" keeps its data there and cannot merge — turn \`durableObjects.merge\` off.`),U=r=>r?.origin!=="absent"?[]:[`main is set but no readable file is there (looked in ${r.path}) — wrangler cannot resolve the worker entry, so a deploy will fail there. Point main at the entry that composes your app, or remove it to fall back to the conventional locations.`],Z=r=>{const o=r.schemaDir??"lunora",t=W(r.projectRoot);if(!t){const c=`wrangler.jsonc not found in ${r.projectRoot}; create one declaring at least the SHARD durable object binding.`;return{problems:[c],report:{errors:[c],valid:!1,warnings:[]},wranglerPath:void 0}}const{parsed:s}=C(t);if(s===void 0){const c=`failed to parse ${t} as JSONC.`;return{problems:[c],report:{errors:[c],valid:!1,warnings:[]},wranglerPath:t}}const{error:n,merged:e}=S(s,r.environment);if(n!==void 0)return{problems:[n],report:{errors:[n],valid:!1,warnings:[]},wranglerPath:t};const{error:l,info:f}=E(r.projectRoot,o),a=T(s,f,r.environment);l!==void 0&&a.warnings.push(`schema parse failed in ${o}/schema.ts: ${l}`);const g=y(t),b=O(e.main,r.projectRoot,t),m=_(b,r.projectRoot,o);a.errors.push(...I(e.containers??[],g,t)),a.warnings.push(...U(b)),m!==void 0&&a.errors.push(...M(e,m)),m?.exports?.has(i)===!0&&(a.errors.push(...N(e)),h(p(r.projectRoot,o,w,"scheduler.ts"))&&x(e,r.environment,a.warnings,"the merged LunoraDO hosts the scheduler")),a.errors.push(...P(f,r.projectRoot));const d=e.assets?.directory;if(typeof d=="string"&&d.length>0){const c=d.startsWith("/")?d:p(g,d);h(c)||a.warnings.push(`assets.directory "${d}" does not exist yet — it is created by the client build; run the build before deploy`)}return a.valid=a.errors.length===0,{problems:a.errors,report:a,wranglerPath:t}};export{G as UNEXPORTED_CLASS_MARKER,Z as validateWranglerProject};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{LunoraError as n}from"@lunora/errors";import{lunoraLine as i}from"./LUNORA_TAG-CiQM3BkI.mjs";import{validateWranglerProject as l}from"./UNEXPORTED_CLASS_MARKER-
|
|
1
|
+
import{LunoraError as n}from"@lunora/errors";import{lunoraLine as i}from"./LUNORA_TAG-CiQM3BkI.mjs";import{validateWranglerProject as l}from"./UNEXPORTED_CLASS_MARKER-IAK9PiDz.mjs";const m=(e,a,t)=>{const r=l({projectRoot:e.projectRoot,schemaDir:e.schemaDir});if(!r.wranglerPath)throw new n("INTERNAL",["[lunora] wrangler.jsonc not found.",` searched in: ${e.projectRoot}`," create a wrangler.jsonc declaring at least the SHARD durable object binding."].join(`
|
|
2
2
|
`));for(const o of r.report.warnings)a(i(`wrangler validator: ${o}`));if(r.problems.length>0)throw new n("INTERNAL",["[lunora] wrangler configuration is missing bindings required by your schema.",` file: ${r.wranglerPath}`,"",...r.problems.map(o=>` - ${o}`),"",` ${t}`].join(`
|
|
3
3
|
`))};export{m as assertWranglerSatisfiesSchema};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{readFileSync as V,writeFileSync as X}from"node:fs";import{createRequire as z}from"node:module";import{join as F}from"node:path";import{containerBuildTag as Z}from"@lunora/container";import{readJsonSync as ee}from"@visulima/fs";import{applyModify as S}from"./applyModify-DKP2l6S9.mjs";import{a as ne,r as M}from"./lunora-manifest-DuH_Cmyu.mjs";import{parseTree as se,findNodeAtLocation as te}from"jsonc-parser";import{r as oe,a as ie,b as re,c as ae}from"./reconcile-services-BwMkaWAq.mjs";import{a as de,s as ce}from"./infer-bindings-BsgN5eCm.mjs";import{DEV_VARS_FILE as le,parseDevVariableEntries as ue}from"./DEV_VARS_EXAMPLE_FILE-CqLorAxT.mjs";import{requiredSecrets as ge}from"./buildPackageSecretsBlock-xaAqLu5K.mjs";import{w as me,m as pe,s as Q,o as B,n as C,p as fe}from"./validate-bindings-CvNBF3U4.mjs";import{s as be}from"./worker-entry-checks-AIASCYl7.mjs";import{DEFAULT_OBSERVABILITY as he}from"./DEFAULT_OBSERVABILITY-bN6UkTMx.mjs";import{findWranglerFile as we,readWranglerJsonc as ve}from"./WRANGLER_FILES-UNW-xY5u.mjs";const _e=[["maxBatchSize","max_batch_size"],["maxBatchTimeout","max_batch_timeout"],["maxConcurrency","max_concurrency"],["maxRetries","max_retries"],["deadLetterQueue","dead_letter_queue"],["retryDelay","retry_delay"]],R=e=>Object.fromEntries(_e.filter(([n])=>e.tuning[n]!==void 0).map(([n,s])=>[s,e.tuning[n]])),P="queueTuning",ye=/^[\t ]*(?:,[\t ]*)?(?:\/\/[^\n\r]*)?\r?\n/u,Se=/^[\t ]*,/u,xe=(e,n)=>{const s=se(e),t=s===void 0?void 0:te(s,[...n])?.parent;if(t?.type==="property"){const i=t.offset+t.length,o=e.lastIndexOf(`
|
|
2
|
+
`,t.offset-1)+1,d=ye.exec(e.slice(i));if(d!==null&&e.slice(o,t.offset).trim()===""){const a=t.parent?.children??[],b=a.indexOf(t),c=b===a.length-1&&b>0?a[b-1]:void 0,l=c===void 0?void 0:Se.exec(e.slice(c.offset+c.length))??void 0;return(l===void 0||c===void 0?e.slice(0,o):e.slice(0,c.offset+c.length)+e.slice(c.offset+c.length+l[0].length,o))+e.slice(i+d[0].length)}}return S(e,n,void 0)},Y=(e,n,s,t,i,o=new Set)=>{const d=s.join("."),a={},b=[],c=[];let l=e;return{entries:n.map((u,w)=>{const g=t(u);if(g===void 0||u.queue===void 0)return u;const p=Object.fromEntries(Object.entries(R(g)).filter(([f])=>!o.has(f))),h=Object.entries(i[u.queue]??{}).filter(([f])=>!Object.hasOwn(p,f)),v=Object.entries(p).filter(([f,y])=>u[f]!==y),x=h.filter(([f,y])=>u[f]===y).map(([f])=>f),N=Object.fromEntries(Object.entries({...u,...p}).filter(([f])=>!x.includes(f)));for(const[f,y]of v)l=S(l,[...s,w,f],y);for(const f of x)l=xe(l,[...s,w,f]);for(const[f,y]of h){const E=u[f];E!==void 0&&E!==y&&c.push(`${d}/${u.queue}: ${f} is no longer declared by defineQueue, but it was changed by hand to ${JSON.stringify(E)} from the declared ${JSON.stringify(y)}, so it was kept. Delete it from wrangler.jsonc if it should go.`)}return(v.length>0||x.length>0)&&b.push(`${d}/${u.queue} (${[...v.map(([f])=>f),...x.map(f=>`removed ${f}`)].join(", ")})`),Object.keys(p).length>0&&(a[u.queue]=p),N}),owned:a,text:l,updated:b,warnings:c}},Ne=(e,n,s,t)=>{const i=n.queues??{},o=i.producers??[],d=i.consumers??[],a=new Set(o.map(g=>g?.binding)),b=new Set(d.map(g=>g.queue)),c=s.filter(g=>!a.has(g.bindingName)),l=s.filter(g=>!b.has(g.name)),m=Y(e,d,["queues","consumers"],g=>s.find(p=>p.name===g.queue),t);let u=m.text;const w={...m.owned};if(c.length>0||l.length>0){const g=[...o,...c.map(h=>({binding:h.bindingName,queue:h.name}))],p=[...m.entries,...l.map(h=>({queue:h.name,...h.mode==="pull"?{type:"http_pull"}:{},...R(h)}))];for(const h of l){const v=R(h);Object.keys(v).length>0&&(w[h.name]=v)}u=S(u,["queues"],{consumers:p,producers:g})}return{added:[...c.map(g=>`queues.producers/${g.bindingName}`),...l.map(g=>`queues.consumers/${g.name}`)],owned:w,text:u,updated:m.updated,warnings:m.warnings}},Oe=(e,n,s,t,i)=>{const o=n.env?.[t],d=o?.queues?.consumers??[],a=o?.queues?.producers??[],b=u=>{const w=a.find(g=>g?.queue===u.queue)?.binding;return w!==void 0?s.find(g=>g.bindingName===w):s.find(g=>g.name===u.queue&&!a.some(p=>p?.binding===g.bindingName))},c=Y(e,d,["env",t,"queues","consumers"],b,i,new Set(["dead_letter_queue"])),l=d.filter(u=>u.queue!==void 0&&b(u)===void 0).map(u=>`env.${t}.queues.consumers/${String(u.queue)}: no defineQueue export matches it — this block declares no producer mapping one of their bindings to "${String(u.queue)}", and no export is named that — so it was not retuned. A consumer for a queue another worker produces is skipped the same way.`),m=d.flatMap(u=>{const w=b(u)?.tuning.deadLetterQueue;return w===void 0||u.dead_letter_queue!==void 0?[]:[`env.${t}.queues.consumers/${String(u.queue)}: defineQueue declares deadLetterQueue "${w}", but this consumer has no dead_letter_queue, so its exhausted messages are dropped. Queue names differ per environment, so reconcile does not write it here; add it by hand.`]});return{added:[],owned:c.owned,text:c.text,updated:c.updated,warnings:[...c.warnings,...m,...l]}},Ee=(e,n)=>{if(e?.lunoraIsForeign===!0)return n.push(`${e.path}: \`lunora\` is not an object, so the queue tuning ownership record cannot be read or written — an option removed from defineQueue stays deployed.`),{};const s=e?.lunora?.[P],t=i=>typeof i=="object"&&i!==null&&!Array.isArray(i);return s===void 0?{}:!t(s)||!Object.values(s).every(i=>t(i)&&Object.values(i).every(o=>t(o)))?(n.push(`${e?.path??"package.json"}: \`lunora.${P}\` is not a map of scope → queue → fields, so it is ignored — an option removed from defineQueue stays deployed until the next pass records it again.`),{}):s},ke=(e,n,s)=>{const t=Object.fromEntries(Object.entries({...n,...s}).filter(([,i])=>Object.keys(i).length>0));ne(e,P,Object.keys(t).length===0?void 0:t)},j="PIPELINES",I="ARTIFACTS",$e=(e,n)=>{const s=e.flagshipBinding!==void 0&&!(n?.flagship??[]).some(a=>a.binding===e.flagshipBinding),t=e.usesPipelines&&!(n?.pipelines??[]).some(a=>a.binding===j),i=e.usesArtifacts?n?.artifacts??[]:[],o=i.some(a=>a.binding===I)?[]:i.flatMap(a=>a.binding===void 0?[]:[a.binding]);return[[e.usesKv&&(n?.kv_namespaces?.length??0)===0,"@lunora/bindings/kv is used but no kv_namespaces binding exists; add a kv_namespaces entry ({ binding, id }) and pass env.<BINDING> to createKv() — the namespace id can't be auto-provisioned."],[e.usesHyperdrive&&(n?.hyperdrive?.length??0)===0,"@lunora/hyperdrive is used but no hyperdrive binding exists; run 'wrangler hyperdrive create' and add a 'hyperdrive' binding ({ binding, id }) — the id can't be auto-provisioned."],[t,`ctx.pipelines is used but no "${j}" pipelines binding exists; run 'wrangler pipelines create <name>' and add a 'pipelines' binding ({ binding: "${j}", stream }) — codegen resolves this one name, and the pipeline resource can't be auto-provisioned.`],[e.usesArtifacts&&i.length===0,de(e.jurisdiction)],[o.length>0,`ctx.artifacts is used and ${o.map(a=>`"${a}"`).join(", ")} ${o.length===1?"is":"are"} bound, but none is named "${I}"; make sure \`.artifacts()\` on defineApp points ctx.artifacts at it — otherwise it reads env.${I} and throws.`],[s,`lunora/flags.ts uses Flagship in binding mode but no flagship binding "${e.flagshipBinding??""}" exists; add a flagship entry ({ binding: "${e.flagshipBinding??""}", app_id }) — the app_id can't be auto-provisioned.`]].filter(([a])=>a).map(([,a])=>a)},Ae=e=>[[e.usesX402Charge,"@lunora/x402/charge is used; set the recipient wallet address as a [vars] entry (the var name is your choice) and pass it to the charge config — the x402 facilitator settles USDC to that address."],[e.usesX402,"@lunora/x402/pay is used (ActionCtx-only, spends real funds); add a secrets_store_secrets[] binding holding the agent wallet key (binding name == signer.secretName) and pair the pay rail with a spend policy — ctx.secrets reads a Secrets Store binding, not .dev.vars."]].filter(([s])=>s).map(([,s])=>s),D=(e,n,s)=>s.filter(t=>!t.exported).map(t=>`${e} "${t.exportName}" is declared but ${t.className} is not exported by the worker entry; add \`export * from "./lunora/_generated/${n}"\` so its binding can be provisioned.`),qe=(e,n)=>{const s=new Set([...e.workflows,...e.agents].map(o=>o.className));if(s.size===0)return[];const t=Object.entries(n.exports??{}).flatMap(([o,d])=>d?.type==="workflow"?[o]:[]),i=(n.workflows??[]).flatMap(o=>o.class_name===void 0||o.script_name!==void 0?[]:[o.class_name]);return[...new Set([...t,...i])].filter(o=>!s.has(o)).map(o=>`wrangler.jsonc declares workflow "${o}" but no defineWorkflow/defineAgent export generates that class — a leftover from a rename will fail the deploy (wrangler rejects a class the worker does not export). Remove it if it is not hand-wired.`)},Ce=(e,n)=>{if(e.queues.length===0)return[];const s=new Set(e.queues.map(i=>i.name)),t=new Set(e.queues.map(i=>i.bindingName));return[...(n.queues?.consumers??[]).flatMap(i=>{const{queue:o}=i;return o===void 0||s.has(o)?[]:[`wrangler.jsonc subscribes queues.consumers[] to "${o}" but no defineQueue export declares that queue — a leftover from a rename keeps delivering batches this worker has no handler for (they retry to exhaustion, then drop or dead-letter). Remove it if it is not hand-wired.`]}),...(n.queues?.producers??[]).flatMap(i=>{const o=i?.binding;return o===void 0||t.has(o)?[]:[`wrangler.jsonc declares queues.producers[] binding "${o}" but no defineQueue export declares it — a leftover from a rename. Remove it if it is not hand-wired.`]})]},je=(e,n)=>[...qe(e,n),...Ce(e,n)],G=[{keys:["STRIPE_SECRET_KEY","STRIPE_WEBHOOK_SECRET"],label:"Stripe"},{keys:["POLAR_ACCESS_TOKEN","POLAR_WEBHOOK_SECRET"],label:"Polar"},{keys:["CREEM_API_KEY","CREEM_WEBHOOK_SECRET"],label:"Creem"},{keys:["AUTUMN_SECRET_KEY","AUTUMN_WEBHOOK_SECRET"],label:"Autumn"},{keys:["DODO_PAYMENTS_API_KEY","DODO_PAYMENTS_WEBHOOK_KEY"],label:"Dodo Payments"}],Ie=()=>G.map(({keys:e,label:n})=>`${e[0]} + ${e[1]} (${n})`).join(" or "),De=e=>{let n;try{n=V(F(e,le),"utf8")}catch{return!1}const s=new Map(ue(n).map(t=>[t.key,t.value]));return G.some(({keys:t})=>t.every(i=>(s.get(i)??"")!==""))},Te=(e,n)=>{const s=n?.secrets?.required;if(!Array.isArray(s))return[];const t=new Set(s),i=ge(ce(e)).map(o=>o.key).filter(o=>!t.has(o));return i.length===0?[]:[`wrangler.jsonc declares secrets.required without ${i.join(", ")}, which this app needs — wrangler dev loads only the listed keys from .dev.vars, so add ${i.length===1?"it":"them"} to secrets.required.`]},T=(e,n,s)=>{const t=new Set(e.durableObjects.map(a=>a.className)),i=[],o=(s?.r2_buckets?.length??0)>0,d=(s?.d1_databases?.some(a=>a.binding==="DB")??!1)||e.needsD1;return e.usesStorage&&!o&&i.push("@lunora/storage is used but R2 bucket bindings have user-defined names; add an r2_buckets entry and pass env.<BINDING> to createStorage()."),e.usesAuth&&!t.has("SessionDO")&&!d&&i.push("@lunora/auth is used but the worker entry exports no SessionDO; sessions are D1-backed, or export SessionDO to enable DO-backed sessions."),e.usesScheduler&&!t.has("SchedulerDO")&&i.push("@lunora/scheduler is used but the worker entry exports no SchedulerDO; export it so the SCHEDULER binding can be provisioned."),i.push(...D("container","containers",e.containers),...D("workflow","workflows",e.workflows),...D("agent","agents",e.agents)),e.containers.length>0&&s?.observability?.enabled===!1&&i.push("containers are declared but observability is explicitly disabled in wrangler.jsonc — container logs will not be captured."),e.usesPayments&&!De(n)&&i.push(`@lunora/payment is used; set one provider's secret pair in .dev.vars — ${Ie()}.`),i.push(...Ae(e),...$e(e,s),...Te(e,s)),s!==void 0&&i.push(...je(e,s)),i},U="<replace-with-d1-create-id>",Be=e=>[["container","containers",e.containers],["workflow","workflows",e.workflows],["agent","agents",e.agents]].flatMap(([s,t,i])=>i.filter(o=>!o.exported).map(({className:o,exportName:d})=>({className:o,exportName:d,kind:s,module:t}))),Re=e=>{const n=new Set(B(e).map(t=>t.tag));let s=1;for(;n.has(`v${String(s)}`);)s+=1;return`v${String(s)}`},Pe=e=>{const n=new Set;for(const s of B(e)){for(const t of C(s.deleted_classes))n.delete(t);for(const{from:t,to:i}of B(s.renamed_classes))t!==void 0&&n.delete(t),i!==void 0&&n.add(i);for(const t of[...C(s.new_classes),...C(s.new_sqlite_classes)])n.add(t)}return n},Le=(e,n,s)=>{const t=n.durable_objects?.bindings??[],i=new Set(t.map(l=>l.name)),o=s.filter(l=>!i.has(l.binding));let d=e;const a=[];if(o.length>0){const l=[...t,...o.map(m=>({class_name:m.className,name:m.binding}))];d=S(d,["durable_objects","bindings"],l),a.push(...o.map(m=>`${m.binding}/${m.className}`))}const b=n.migrations??[],c=s.map(l=>l.className).filter(l=>!Pe(b).has(l));if(c.length>0){const l=[...b,{new_sqlite_classes:c,tag:Re(b)}];d=S(d,["migrations"],l)}return{added:a,text:d}},We=(e,n)=>{const s=n.d1_databases??[];if(s.some(o=>o.binding==="DB"))return{added:[],text:e};const t=typeof n.name=="string"&&n.name.length>0?n.name:"lunora",i=[...s,{binding:"DB",database_id:U,database_name:t}];return{added:["DB (D1)"],text:S(e,["d1_databases"],i)}},Me={ai:{binding:"AI",label:"AI (Workers AI)"},analytics:{binding:"ANALYTICS_SQL",label:"ANALYTICS_SQL (Analytics SQL)"},browser:{binding:"BROWSER",label:"BROWSER (Browser Rendering)"},images:{binding:"IMAGES",label:"IMAGES (Cloudflare Images)"}},$=(e,n,s)=>{const{binding:t,label:i}=Me[s],o=n[s]?.binding;return typeof o=="string"&&o.length>0?{added:[],text:e}:{added:[i],text:S(e,[s],{binding:t})}},Ke=(e,n)=>e.usesAnalyticsSql&&be(n,new Set(["analyticsSql"]))?.chained.has("analyticsSql")!==!0,Fe=new Set(["ratelimits","send_email"]),Qe=["durable_objects","logfwdr","unsafe"],Ye=new Set(["data_blobs","text_blobs","vars","wasm_modules"]),W=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),L=(e,n,s)=>W(e)&&e[n]===s,Ge=(e,n,s)=>{if(Ye.has(e))return W(n)&&Object.hasOwn(n,s);const t=Fe.has(e)?"name":"binding";return Array.isArray(n)?n.some(i=>L(i,t,s)):L(n,"binding",s)},Ue=(e,n)=>{const s=e,t=Object.entries(s).find(([o,d])=>o!=="env"&&Ge(o,d,n));if(t!==void 0)return t[0];for(const o of Qe){const d=s[o];if(W(d)&&Array.isArray(d.bindings)&&d.bindings.some(a=>L(a,"name",n)))return`${o}.bindings`}if(e.queues?.producers?.some(o=>o?.binding===n)===!0)return"queues.producers";const i=e.secrets?.required;if(Array.isArray(i)&&i.includes(n))return"secrets.required"},K=(e,n,s,t,i)=>{if((n[s]?.length??0)>0)return{added:[],text:e};const o=Ue(n,t.binding);return o!==void 0?{added:[],text:e,warnings:[`${s}: not adding ${JSON.stringify(t)} — the name "${t.binding}" is already bound by \`${o}\` in wrangler.jsonc. Add a ${s} entry under another binding name and point the matching \`defineApp()\` override at it.`]}:{added:[i],text:S(e,[s],[t])}},He=(e,n)=>{const s=n.worker_loaders??[];return s.some(t=>t.binding==="LOADER")?{added:[],text:e}:{added:["LOADER (Worker Loader)"],text:S(e,["worker_loaders"],[...s,{binding:"LOADER"}])}},Je=e=>{if(typeof e=="string")return e;const n={};return e.diskMb!==void 0&&(n.disk_mb=e.diskMb),e.memoryMib!==void 0&&(n.memory_mib=e.memoryMib),e.vcpu!==void 0&&(n.vcpu=e.vcpu),n},Ve=e=>{const{image:n}=e;return n.kind==="dockerfile"?n.dockerfilePath:n.kind==="registry"?n.reference:Z(e.exportName)},H=e=>{const n={};for(const[s,t]of Object.entries(e.images??{}))n[s]=t.kind==="registry"?{image:t.reference}:{build_context:t.buildContext,dockerfile:t.dockerfilePath,...e.buildArgs===void 0?{}:{build_vars:e.buildArgs}};return{class_name:e.className,scheduling_policy:"durable_object",...Object.keys(n).length>0?{images:n}:{},...e.name===void 0?{}:{name:e.name}}},Xe=e=>{if(e.schedulingPolicy==="durable_object")return H(e);const{image:n}=e,s={class_name:e.className,image:Ve(e)};return n.kind==="dockerfile"&&(s.image_build_context=n.buildContext),e.buildArgs!==void 0&&n.kind!=="registry"&&(s.image_vars=e.buildArgs),e.instanceType!==void 0&&(s.instance_type=Je(e.instanceType)),e.maxInstances!==void 0&&(s.max_instances=e.maxInstances),e.name!==void 0&&(s.name=e.name),e.rollout?.stepPercentage!==void 0&&(s.rollout_step_percentage=e.rollout.stepPercentage),e.rollout?.gracePeriodSeconds!==void 0&&(s.rollout_active_grace_period=e.rollout.gracePeriodSeconds),s},ze=(e,n,s)=>{const t=n.containers??[],i=new Set(t.map(c=>c.class_name)),o=s.filter(c=>!i.has(c.className));let d=o.length===0?e:S(e,["containers"],[...t,...o.map(c=>Xe(c))]);const a=[],b=[];for(const[c,l]of t.entries()){const m=s.find(g=>g.className===l.class_name);if(m===void 0)continue;const u=m.schedulingPolicy??"default";if((l.scheduling_policy??"default")!==u){b.push(`containers/${m.className} has scheduling_policy "${l.scheduling_policy??"default"}" in wrangler.jsonc but defineContainer "${m.exportName}" declares "${u}" — the policy is immutable, so replace the entry (and its container application) by hand.`);continue}const w=m.schedulingPolicy==="durable_object"?H(m).images:void 0;w!==void 0&&JSON.stringify(l.images)!==JSON.stringify(w)&&(d=S(d,["containers",c,"images"],w),a.push(`containers/${m.className}.images`))}return{added:o.map(c=>`containers/${c.className}`),text:d,updated:a,warnings:b}},Ze=(e,n)=>{if(n.observability!==void 0)return{added:[],text:e};const s=S(e,["observability"],{...he});return{added:["observability"],text:s}},J=[{minimum:[4,142],name:"wrangler"},{minimum:[1,61],name:"@cloudflare/vite-plugin"}],en=J.map(({minimum:e,name:n})=>`${n}@^${e.join(".")}.0`).join(" "),nn=(e,n)=>{try{const s=z(F(e,"package.json")).resolve(`${n}/package.json`),[t=0,i=0]=String(ee(s).version).split(".").map(Number);return[t,i]}catch{return}},sn=e=>{const n=J.flatMap(({minimum:s,name:t})=>{const i=nn(e,t);return i!==void 0&&(i[0]<s[0]||i[0]===s[0]&&i[1]<s[1])?[`${t} ${i.join(".")} (needs >= ${s.join(".")})`]:[]});return n.length===0?void 0:`workflows are declared in wrangler \`exports\`, which ${n.join(" and ")} cannot run — reconcile left workflows[] untouched. Upgrade (\`pnpm add -D ${en}\`) and re-run.`},tn=e=>Object.entries(e.env??{}).flatMap(([n,s])=>Array.isArray(s?.workflows)?[`env.${n}.workflows declares workflow bindings, but Lunora now declares workflows in \`exports\` and resolves them on ctx.exports — move them to that environment's own \`exports\` by hand.`]:[]),on=(e,n,s)=>{let t=e;const i=[],o=[];for(const d of s){const a=n[d.className];if(a?.type==="workflow")for(const{of:b,path:c}of fe){const l=b(d),m=Q(a,c),u=`exports/${d.className}.${c.join(".")}`;if(l===void 0){m!==void 0&&o.push(`${u} is set in wrangler.jsonc but defineWorkflow "${d.exportName}" does not declare it — reconcile leaves it in place. Remove it by hand if it was dropped from the definition.`);continue}JSON.stringify(m)!==JSON.stringify(l)&&(t=S(t,["exports",d.className,...c],l),i.push(u))}}return{text:t,updated:i,warnings:o}},rn=(e,n,s,t,i)=>{if(i!==void 0)return{added:[],text:e,warnings:[i]};const o=[...s.map(p=>({settings:me(p),workflow:p})),...t.map(p=>({settings:{},workflow:p}))],d=new Set(o.map(({workflow:p})=>p.className)),a=n.workflows??[],b=a.filter(p=>p.script_name===void 0&&p.class_name!==void 0&&d.has(p.class_name)),c=n.exports??{},l=[],m=[],u=[];let w=e;for(const{settings:p,workflow:h}of o){if(c[h.className]!==void 0&&c[h.className]!==null)continue;const v=b.find(f=>f.class_name===h.className),x=Object.fromEntries(pe.flatMap(f=>{const y=Q(v,[f]);return y===void 0?[]:[[f,y]]})),N=v?.name??h.name;v?.name!==void 0&&v.name!==h.name&&u.push(`workflows/${h.className} is deployed as "${v.name}" but declared as "${h.name}" — its export keeps "${v.name}" so running instances survive. Change the declaration to match, or rename deliberately (it starts a new, empty workflow).`),w=S(w,["exports",h.className],{type:"workflow",...x,...p,name:N}),(v===void 0?l:m).push(`exports/${h.className}`)}if(b.length>0){const p=a.filter(h=>!b.includes(h));w=S(w,["workflows"],p.length===0?void 0:p),m.push(...b.map(h=>`workflows/${String(h.class_name)} → exports`))}u.push(...tn(n));const g=on(w,c,s);return{added:l,text:g.text,updated:[...m,...g.updated],warnings:[...u,...g.warnings]}},xn=(e,n,s)=>{const t=we(e),i=Be(n);if(!t)return{added:[],changed:!1,exportGaps:i,reason:"wrangler.jsonc not found",updated:[],warnings:T(n,e)};const{parsed:o,text:d}=ve(t);if(o===void 0)return{added:[],changed:!1,exportGaps:i,reason:`failed to parse ${t} as JSONC`,updated:[],warnings:T(n,e),wranglerPath:t};const a=T(n,e,o);if(s!==void 0){const r=o.env?.[s]!==void 0;a.push(r?`auto-provisioned bindings are written to the top level of wrangler.jsonc only (queue consumers "env.${s}" already declares are retuned, nothing is added) — "env.${s}" has its own (non-inheritable) bindings and must be reconciled by hand; \`lunora deploy --env ${s}\` now validates them, so a gap here will be reported at deploy time.`:`--env "${s}" was requested but wrangler.jsonc declares no "env.${s}" block — auto-provisioned bindings are written to the top level only and will not apply to that environment.`)}const b=n.containers.filter(r=>r.exported),c=n.agents.filter(r=>r.exported&&r.voice===!0&&r.voiceBindingName!==void 0&&r.voiceClassName!==void 0),l=[...n.durableObjects,...b.map(r=>({binding:r.bindingName,className:r.className})),...c.map(r=>({binding:r.voiceBindingName,className:r.voiceClassName}))],m=n.workflows.filter(r=>r.exported),u=n.agents.filter(r=>r.exported),w=M(e),g=Ee(w,a),p={},h=oe(w);let v;const x=[{enabled:!0,run:r=>Le(r,o,l)},{enabled:n.needsD1,run:r=>We(r,o)},{enabled:n.usesAi,run:r=>$(r,o,"ai")},{enabled:n.usesAiSearch,run:r=>K(r,o,"ai_search_namespaces",{binding:"AI_SEARCH",namespace:"default"},"AI_SEARCH (AI Search namespace)")},{enabled:Ke(n,e),run:r=>$(r,o,"analytics")},{enabled:n.usesBrowser,run:r=>$(r,o,"browser")},{enabled:n.usesImages,run:r=>$(r,o,"images")},{enabled:n.usesAnalytics,run:r=>K(r,o,"analytics_engine_datasets",{binding:"ANALYTICS",dataset:"ANALYTICS"},"ANALYTICS (Analytics Engine)")},{enabled:n.usesWorkerLoader,run:r=>He(r,o)},{enabled:!0,run:r=>Ze(r,o)},{enabled:b.length>0,run:r=>ze(r,o,b)},{enabled:m.length>0||u.length>0,run:r=>rn(r,o,m,u,sn(e))},{enabled:n.queues.length>0,run:r=>{const _=Ne(r,o,n.queues,g.queues??{});return p.queues=_.owned,_}},{enabled:n.services!==void 0&&(n.services.length>0||Object.keys(h).length>0),run:r=>{const _=ie(r,o,n.services??[],h);return v=_.owned,_}},...s===void 0||o.env?.[s]===void 0?[]:[{enabled:n.queues.length>0,run:r=>{const _=`env.${s}.queues`,k=Oe(r,o,n.queues,s,g[_]??{});return p[_]=k.owned,k}}]];let N=d;const f=[],y=[];for(const r of x){if(!r.enabled)continue;const _=r.run(N);N=_.text,f.push(..._.added),y.push(..._.updated??[]),a.push(..._.warnings??[])}const E=r=>{if(w===void 0)return;const _=v,k=[...Object.keys(p).length>0?[{consequence:"an option removed from defineQueue stays deployed",key:"queueTuning",label:"queue tuning",write:O=>{ke(O,g,p)}}]:[],..._===void 0?[]:[{consequence:"a service removed from lunora.config stays bound",key:"services",label:"service bindings",write:O=>{ae(O,_)}}]];for(const O of k)try{O.write(M(e)??w)}catch(q){a.push(`${r?"wrangler.jsonc was updated, but ":""}recording the ${O.label} reconcile owns in ${w.path} (lunora.${O.key}) failed: ${q instanceof Error?q.message:String(q)}. Until it is recorded, ${O.consequence}.`)}};let A;if(n.services!==void 0){const r=re(e,n.services,h);a.push(...r.warnings),v={...v,...r.owned},A=r.added.length>0||r.updated.length>0?{added:r.added,path:r.path,updated:r.updated}:void 0}return f.includes("DB (D1)")&&a.push(`wrote a DB binding with a placeholder database_id ("${U}") — run \`wrangler d1 create <name>\` and replace it before deploying.`),N===d?(E(!1),{added:f,changed:!1,devConfig:A,exportGaps:i,reason:"bindings already in sync",updated:y,warnings:a,wranglerPath:t}):(X(t,N,"utf8"),E(!0),{added:f,changed:!0,devConfig:A,exportGaps:i,updated:y,warnings:a,wranglerPath:t})};export{Be as collectExportGaps,xn as reconcileWranglerBindings};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const n=t=>typeof t=="object"&&t!==null&&!Array.isArray(t),s=t=>typeof t=="string"&&t.length>0;export{s as a,n as i};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as p}from"./infer-bindings-BsgN5eCm.mjs";import{LUNORA_TAG as r}from"./LUNORA_TAG-CiQM3BkI.mjs";import{reconcileWranglerBindings as $}from"./collectExportGaps-
|
|
1
|
+
import{i as p}from"./infer-bindings-BsgN5eCm.mjs";import{LUNORA_TAG as r}from"./LUNORA_TAG-CiQM3BkI.mjs";import{reconcileWranglerBindings as $}from"./collectExportGaps-DwkdLyZ9.mjs";import{reconcileWranglerCompatibilityDate as g}from"./reconcileWranglerCompatibilityDate-hocXEuRA.mjs";import{reconcileWranglerCrons as m,describePreservedCrons as w}from"./describePreservedCrons-C5KPuPy3.mjs";const j=async(i,t,a)=>{try{const n=await p({projectRoot:i.projectRoot,schemaDir:i.schemaDir}),e=$(i.projectRoot,n),o=e.wranglerPath??"wrangler.jsonc";if(e.added.length>0&&t.info?.(`${r} inferred bindings → ${e.added.join(", ")} (written to ${o})`),e.updated.length>0&&t.info?.(`${r} updated bindings → ${e.updated.join(", ")} (written to ${o})`),e.devConfig!==void 0){const{added:s,path:d,updated:f}=e.devConfig;t.info?.(`${r} dev sidecar bindings → ${[...s,...f].join(", ")} (written to ${d})`)}for(const s of e.warnings)t.warn(`${r} ${s}`);e.exportGaps.length>0&&a?.(e.exportGaps)}catch(n){const e=n instanceof Error?n.message:String(n);t.warn(`${r} binding inference skipped: ${e}`)}},c=new Map,u=(i,t,a)=>{try{const n=m(i,t);n.changed&&a.info?.(`${r} synced ${t.length.toFixed(0)} cron trigger(s) into ${n.wranglerPath??"wrangler.jsonc"}`);for(const s of n.warnings)a.warn(`${r} ${s}`);const e=n.preserved.join("\0"),o=w(n.preserved);o!==void 0&&(n.changed||c.get(i)!==e)&&a.info?.(`${r} ${o}`),c.set(i,e)}catch(n){const e=n instanceof Error?n.message:String(n);a.warn(`${r} cron trigger sync skipped: ${e}`)}try{const n=g(i);n.changed&&a.info?.(`${r} bumped compatibility_date to ${n.date??"unknown"} (Workers Cache enabled) → ${n.wranglerPath??"wrangler.jsonc"}`)}catch(n){const e=n instanceof Error?n.message:String(n);a.warn(`${r} compatibility date sync skipped: ${e}`)}};export{j as reconcileBindingsSafely,u as reconcileWranglerExtras};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{secretKindOf as s,redact as c}from"@lunora/codegen";import{i as a,a as f}from"./package-secrets-registry-BeheNwsP.mjs";import{isPlaceholderValue as d}from"./buildPackageSecretsBlock-xaAqLu5K.mjs";const u=8,h=(n,o)=>{if(n===void 0)return[];const r=[];for(const[i,e]of Object.entries(n)){if(typeof e!="string"||d(e)||a(i))continue;const t=s(e)??(f(i)&&e.length>=u?"secret_named_var":void 0);t!==void 0&&r.push({file:o,key:i,kind:t,preview:c(e)})}return r};export{h as scanWranglerVariablesForSecrets};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{CUSTOM_INSTANCE_TYPE_LIMITS as f,CUSTOM_INSTANCE_MIN_MEMORY_MIB_PER_VCPU as y}from"@lunora/container";import{i as g,a as d}from"./guards-Buu_E7mP.mjs";const h=[{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"]}],B=[...new Set(h.map(({path:e})=>e[0]))],_=(e,n)=>{let a=e;for(const s of n)a=g(a)?a[s]:void 0;return a},L=e=>{const n={};for(const{of:a,path:s}of h){const t=a(e);if(t===void 0)continue;const[i,o]=s;n[i]=o===void 0?t:{...n[i],[o]:t}}return n},F=(e,n,a)=>{if(n.length===0)return;const s=e.vectorize??[],t=new Set(s.filter(Boolean).map(i=>i?.index_name));for(const i of n)t.has(i)||a.push(`schema declares vector index "${i}"; wrangler "vectorize" must include a binding with index_name "${i}"`)},M=new Set(["basic","dev","lite","standard","standard-1","standard-2","standard-3","standard-4"]),S={disk_mb:f.diskMb,memory_mib:f.memoryMib,vcpu:{...f.vcpu,hint:'use the named "lite" or "basic" instance type below 1 vCPU'}},j=(e,n,a)=>{const s=e.instance_type;if(s===void 0)return;if(typeof s=="string"){M.has(s)||a.push(`${n} has unknown instance_type "${s}" — expected lite, basic, standard-1..4, or a custom { vcpu, memory_mib, disk_mb } object`);return}for(const[o,{hint:r,max:c,min:b}]of Object.entries(S)){const m=s[o];if(m!==void 0&&(typeof m!="number"||Number.isNaN(m)||m<b||m>c)){const w=r!==void 0&&typeof m=="number"&&m<b?` — ${r}`:"";a.push(`${n} custom instance_type ${o} must be a number in ${String(b)}–${String(c)} (got ${String(m)})${w}`)}}const{memory_mib:t,vcpu:i}=s;typeof i=="number"&&typeof t=="number"&&t<i*y&&a.push(`${n} custom instance_type needs ≥ 3 GiB (${String(y)} MiB) memory per vCPU (got ${String(t)} MiB for ${String(i)} vCPU)`)},E=(e,n,a)=>{for(const s of["image","instance_type","max_instances"])e[s]!==void 0&&a.push(`${n} sets "${s}", which the durable_object scheduling policy does not take — the Durable Object picks image and size at start`);for(const[s,t]of Object.entries(e.images??{}))[t?.dockerfile,t?.image].filter(o=>typeof o=="string"&&o.length>0).length!==1&&a.push(`${n} images["${s}"] must set exactly one of "dockerfile" or "image"`)},A=(e,n,a)=>{const{boundClasses:s,classKinds:t,errors:i,warnings:o}=a;if(!e||typeof e!="object"||typeof e.class_name!="string"||e.class_name.length===0){i.push(`${n} 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&&i.push(`${n} ("${e.class_name}") has unknown scheduling_policy "${e.scheduling_policy}" — expected "default" or "durable_object"`),r?E(e,`${n} ("${e.class_name}")`,i):(typeof e.image!="string"||e.image.length===0)&&i.push(`${n} ("${e.class_name}") must have an "image" — a Dockerfile path or a registry reference`),s.has(e.class_name)||i.push(`${n} 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=t.get(e.class_name);c!=="sqlite"&&i.push(c==="classic"?`${n} class "${e.class_name}" is registered via "new_classes" but containers require SQLite-backed DOs — move it to "new_sqlite_classes"`:`${n} class "${e.class_name}" is missing from migrations — add a migration entry with "new_sqlite_classes": ["${e.class_name}"]`),j(e,`${n} ("${e.class_name}")`,i),e.max_instances===void 0&&!r&&o.push(`${n} ("${e.class_name}") declares no max_instances — set a cap so a traffic spike can't fan out unbounded container spend`)},u=e=>Array.isArray(e)?e.filter(n=>n!==null&&typeof n=="object"):[],p=e=>Array.isArray(e)?e.filter(n=>d(n)):[],k=e=>{const n=new Map;for(const a of u(e)){for(const s of p(a.new_classes))n.set(s,"classic");for(const s of p(a.new_sqlite_classes))n.set(s,"sqlite");for(const s of u(a.renamed_classes))if(d(s.from)&&d(s.to)){const t=n.get(s.from)??"sqlite";n.delete(s.from),n.set(s.to,t)}for(const s of p(a.deleted_classes))n.delete(s)}return n},x=e=>new Set(k(e).keys()),P=(e,n)=>{const a=x(e.migrations);for(const s of u(e.durable_objects?.bindings))s.script_name===void 0&&d(s.class_name)&&!a.has(s.class_name)&&n.push(`durable_objects.bindings declares class "${s.class_name}" but it is missing from migrations — add a migration entry with "new_sqlite_classes": ["${s.class_name}"] (or "new_classes" for a non-SQLite-backed class), or let the dev server auto-reconcile it on the next start`)},W=(e,n,a)=>{if(e.containers===void 0)return;if(!Array.isArray(e.containers)){n.push("containers must be an array of { class_name, image, ... } entries");return}const s=e.containers;if(s.length===0)return;const t=new Set(u(e.durable_objects?.bindings).map(o=>o.class_name)),i=k(e.migrations);for(const[o,r]of s.entries())A(r,`containers[${String(o)}]`,{boundClasses:t,classKinds:i,errors:n,warnings:a});e.observability?.enabled!==!0&&a.push('containers are configured but observability is not enabled — container logs will not be captured (add { "observability": { "enabled": true } })')},l=e=>e,v=(e,n,a,s)=>{if(e!==void 0){if(!Array.isArray(e)){s.push(a.arrayMessage);return}for(const[t,i]of l(e).entries()){const o=`${n}[${String(t)}]`;if(!i||typeof i!="object"){s.push(a.objectMessage(o));continue}for(const r of a.fields)d(i[r.field])||s.push(r.message(o))}}},G={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`},I=(e,n)=>e===void 0||n&&d(e)||Array.isArray(e)&&e.length>0&&e.every(s=>d(s))?void 0:"schedules must be a non-empty array of cron expression strings",R=e=>{if(e!==void 0)return g(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"},N=e=>e===void 0?[]:g(e)?["success_retention","error_retention"].filter(n=>e[n]!==void 0&&!d(e[n])).map(n=>`default_retention.${n} must be a duration string (e.g. "7 days")`):["default_retention must be an object"],$=(e,n,a,s)=>{const t=[I(e.schedules,a),R(e.limits),...N(e.default_retention)];for(const i of t)i!==void 0&&s.push(`${n}.${i}`)},q=(e,n)=>h.map(({path:a})=>a).filter(a=>{const s=_(e,a),t=_(n,a),i=typeof t=="string"&&a[0]==="schedules"?[t]:t;return s!==void 0&&t!==void 0&&JSON.stringify(s)!==JSON.stringify(i)}).map(a=>a.join(".")),O=(e,n,a,s)=>{const t=`exports["${e}"]`,i=String(n.name);for(const o of a){if(!g(o)||o.name!==n.name)continue;const r=`workflows entry "${String(o.binding)}"`;if(o.script_name!==void 0){s.push(`${r} binds workflow "${i}" in another Worker, but ${t} declares a workflow with that name here — workflow names are unique per account`);continue}o.class_name!==e&&s.push(`${r} and ${t} both declare workflow "${i}" but name different classes ("${String(o.class_name)}" vs "${e}")`);for(const c of q(o,n))s.push(`${r} and ${t} set ${c} to different values for workflow "${i}" — set it in one place`)}},K=(e,n)=>{const a=Array.isArray(e.workflows)?l(e.workflows):[];for(const[t,i]of a.entries())g(i)&&$(i,`workflows[${String(t)}]`,!1,n);const s=g(e.exports)?Object.entries(e.exports):[];for(const[t,i]of s)!g(i)||i.type!=="workflow"||(d(i.name)?($(i,`exports["${t}"]`,!0,n),O(t,i,a,n)):n.push(`exports["${t}"] is a workflow export and must have a non-empty "name" naming the deployed workflow`))},C={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`},T={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`},Q=(e,n)=>{if(e.queues!==void 0){if(typeof e.queues!="object"||Array.isArray(e.queues)){n.push("queues must be a { producers, consumers } object");return}v(e.queues.producers,"queues.producers",C,n),v(e.queues.consumers,"queues.consumers",T,n)}},V={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:n=>`${n} must have a non-empty "${e}"`})),objectMessage:e=>`${e} must be a { binding, store_id, secret_name } object`},Y=[{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`,hintField:"id",hintMessage:(e,n)=>`${e} ("${n}") has no "id" — run \`wrangler kv namespace create\` and set the namespace id, or the binding can't resolve`,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,n)=>`${e} ("${n}") 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,n)=>`${e} ("${n}") 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,n)=>`${e} ("${n}") 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,n)=>`${e} ("${n}") has no "dataset" — it defaults to the binding name; set it explicitly to avoid drift`,key:"analytics_engine_datasets"}],z=(e,n,a,s)=>{const t=e[n.key];if(t!==void 0){if(!Array.isArray(t)){a.push(n.arrayMessage);return}for(const[i,o]of l(t).entries()){const r=`${n.key}[${String(i)}]`;if(!o||typeof o!="object"||!d(o.binding)){a.push(n.bindingMessage(r));continue}(typeof n.hintField=="string"?[n.hintField]:n.hintField).some(b=>d(o[b]))||s.push(n.hintMessage(r,o.binding))}}},H=[{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" })'}],J=(e,n,a)=>{const s=e[n.key];s!==void 0&&(typeof s!="object"||s===null||Array.isArray(s)||!d(s.binding))&&a.push(n.message)},X=[{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`}],Z=(e,n,a)=>{n?.hasD1GlobalTable&&!u(e.d1_databases).some(s=>s.binding==="DB")&&a.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'),n?.hasHyperdriveGlobalTable&&u(e.hyperdrive).length===0&&a.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)')},ee=(e,n)=>{const{d1_databases:a}=e;if(a!==void 0){if(!Array.isArray(a)){n.push("d1_databases must be an array of { binding, database_id | database_name } entries");return}for(const[s,t]of l(a).entries()){const i=`d1_databases[${String(s)}]`;if(!t||typeof t!="object"){n.push(`${i} must be a { binding, database_id | database_name } object`);continue}d(t.binding)||n.push(`${i} must have a non-empty "binding" naming the D1 binding`),!d(t.database_id)&&!d(t.database_name)&&n.push(`${i} must have a "database_id" or a "database_name" — run \`wrangler d1 create\` and set one, or the binding can't resolve`)}}},ne=(e,n)=>{const{vpc_networks:a}=e;if(a!==void 0){if(!Array.isArray(a)){n.push("vpc_networks must be an array of { binding, tunnel_id | network_id } entries");return}for(const[s,t]of l(a).entries()){const i=`vpc_networks[${String(s)}]`;if(!t||typeof t!="object"){n.push(`${i} must be a { binding, tunnel_id | network_id } object`);continue}d(t.binding)||n.push(`${i} must have a non-empty "binding" naming the VPC Network binding`),d(t.tunnel_id)===d(t.network_id)&&n.push(`${i} must set exactly one of "tunnel_id" (a Cloudflare Tunnel) or "network_id" ("cf1:network" for Cloudflare Mesh)`)}}};export{Y as H,X as R,H as S,G as W,Z as a,ee as b,F as c,W as d,v as e,x as f,K as g,Q as h,z as i,J as j,ne as k,V as l,B as m,p as n,u as o,h as p,_ as s,P as v,L as w};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as u,a as f}from"./guards-Buu_E7mP.mjs";import{o as v}from"./validate-bindings-CvNBF3U4.mjs";const _=new Set(["1","enabled","on","true","yes"]),A=s=>typeof s=="string"&&_.has(s.trim().toLowerCase()),b=(s,t,e,i)=>{s!==void 0&&typeof s!="boolean"&&e.push(`${t} must be a boolean${i===void 0?"":` (${i})`}`)},O=(s,t,e)=>{s!==void 0&&(typeof s!="number"||Number.isNaN(s)||s<0||s>1)&&e.push(`${t} must be a number in [0, 1] (the fraction of requests sampled)`)},N=(s,t,e)=>{const i=s.send_email;if(i===void 0)return;if(!Array.isArray(i)){t.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)&&e.push(`send_email[${String(o)}] has no non-empty "name" naming the send-email binding — set one before deploying`)},k=(s,t)=>{b(s.logpush,"logpush",t,'set "logpush": true to enable Cloudflare Logpush')},I=(s,t)=>{const e=s.secrets;if(e===void 0)return;const i=typeof e=="object"&&e!==null&&!Array.isArray(e)?e.required:void 0;(!Array.isArray(i)||i.some(n=>typeof n!="string"||n===""))&&t.push('secrets must be an object whose "required" is an array of secret names (e.g. { "required": ["API_KEY"] })')},m=3e5,C=(s,t)=>{const{limits:e}=s;if(e===void 0)return;if(typeof e!="object"||Array.isArray(e)){t.push('limits must be an object (e.g. { "cpu_ms": 30000 })');return}const i=e.cpu_ms;if(i!==void 0){if(typeof i!="number"||!Number.isFinite(i)||!Number.isInteger(i)||i<=0){t.push("limits.cpu_ms must be a positive integer number of milliseconds");return}i>m&&t.push(`limits.cpu_ms must be at most ${String(m)} (Cloudflare's per-invocation ceiling)`)}},p=new Set(["off","smart","targeted"]),w=(s,t)=>{const{placement:e}=s;if(e===void 0)return;if(typeof e!="object"||e===null||Array.isArray(e)){t.push('placement must be an object (e.g. { "mode": "smart" })');return}const{mode:i}=e;i!==void 0&&(typeof i!="string"||!p.has(i))&&t.push(`placement.mode must be one of ${[...p].map(n=>`"${n}"`).join(", ")}`)},c={kind:"boolean"},h={kind:"samplingRate"},y={destinations:{kind:"destinations"},enabled:c,head_sampling_rate:h,persist:c},S={...y,invocation_logs:{hint:'set "invocation_logs": true to keep per-invocation summaries',kind:"boolean"}},L={enabled:c,head_sampling_rate:h,issues:{kind:"level",level:{enabled:c}},logs:{kind:"level",level:S},redact_query_string:c,traces:{kind:"level",level:y}},E=(s,t,e,i)=>{switch(s.kind){case"boolean":{b(t,e,i,s.hint);break}case"destinations":{t!==void 0&&(!Array.isArray(t)||t.some(n=>!f(n)))&&i.push(`${e} must be an array of destination names configured in the Cloudflare dashboard`);break}case"samplingRate":{O(t,e,i);break}}},g=(s,t,e,i,n)=>{for(const[o,a]of Object.entries(s)){const r=Object.hasOwn(t,o)?t[o]:void 0,l=`${e}.${o}`;r===void 0?n.push(`${l} is not a documented wrangler key (expected one of ${Object.keys(t).join(", ")}) — a typo is silently ignored by wrangler`):r.kind!=="level"?E(r,a,l,i):u(a)?g(a,r.level,l,i,n):a!==void 0&&i.push(`${l} must be an object`)}},x=(s,t,e)=>{const{observability:i}=s;if(i!==void 0){if(!u(i)){t.push('observability must be an object (e.g. { "enabled": true, "head_sampling_rate": 1 })');return}g(i,L,"observability",t,e)}},D=(s,t)=>{const{cache:e}=s;if(e!==void 0){if(!u(e)){t.push('cache must be an object (e.g. { "enabled": true })');return}b(e.enabled,"cache.enabled",t)}},T=(s,t)=>{const{exports:e}=s;if(e!==void 0){if(typeof e!="object"||e===null||Array.isArray(e)){t.push("exports must be an object keyed by entrypoint name");return}for(const[i,n]of Object.entries(e)){if(typeof n!="object"||n===null){t.push(`exports["${i}"] must be an object`);continue}n.type!==void 0&&typeof n.type!="string"&&t.push(`exports["${i}"].type must be a string`),n.cache!==void 0&&(typeof n.cache!="object"||n.cache===null||Array.isArray(n.cache)?t.push(`exports["${i}"].cache must be an object`):n.cache.enabled!==void 0&&typeof n.cache.enabled!="boolean"&&t.push(`exports["${i}"].cache.enabled must be a boolean`))}}},B=(s,t)=>{const{assets:e}=s;if(e!==void 0){if(typeof e!="object"||Array.isArray(e)){t.push('assets must be an object (e.g. { "directory": "./dist/client", "binding": "ASSETS" })');return}(typeof e.directory!="string"||e.directory.length===0)&&t.push('assets must declare a non-empty "directory" pointing at the built client output (e.g. "./dist/client")'),e.binding!==void 0&&(typeof e.binding!="string"||e.binding.length===0)&&t.push('assets.binding must be a non-empty string (e.g. "ASSETS")'),e.html_handling!==void 0&&typeof e.html_handling!="string"&&t.push("assets.html_handling must be a string"),e.not_found_handling!==void 0&&typeof e.not_found_handling!="string"&&t.push("assets.not_found_handling must be a string")}},U=(s,t)=>{const e=s.tail_consumers;if(e===void 0)return;if(!Array.isArray(e)){t.push("tail_consumers must be an array of { service, environment? } entries");return}const i=e;for(const[n,o]of i.entries())(!o||typeof o!="object"||typeof o.service!="string"||o.service.length===0)&&t.push(`tail_consumers[${String(n)}] must have a non-empty "service" naming the consumer Worker`)},G=(s,t)=>{const e=s.tail_consumers??[];return e.some(n=>!!n&&n?.service===t.service&&n?.environment===t.environment)?s:{...s,tail_consumers:[...e,t]}},P=(s,t)=>{const{vars:e}=s;if(!e||typeof e!="object")return;const i=e.LUNORA_ALLOWED_ORIGINS,n=e.LUNORA_CORS_ALLOW_CREDENTIALS,o=typeof i=="string"&&i.split(",").some(r=>r.trim()==="*"),a=A(n);o&&a&&t.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')},j=s=>v(s.durable_objects?.bindings).some(t=>t.class_name==="SchedulerDO"&&t.script_name===void 0),d="LUNORA_ORIGIN_URL",W=(s,t,e,i=j(s)?"durable_objects.bindings declares the SchedulerDO":void 0)=>{if(i===void 0||f(s.vars?.[d]))return;const n=t===void 0?"vars":`env.${t}.vars`,o=t===void 0?"":` --env ${t}`;e.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{B as validateAssets,D as validateCache,P as validateCorsVariables,T as validateExports,C as validateLimits,k as validateLogpush,x as validateObservability,w as validatePlacement,W as validateSchedulerOrigin,I as validateSecretsRequired,N as validateSendEmail,U as validateTailConsumers,G as withTailConsumer};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{relative as t}from"node:path";import{i as o}from"./guards-Buu_E7mP.mjs";import{findWranglerFile as u,readWranglerJsonc as d}from"./WRANGLER_FILES-UNW-xY5u.mjs";import{scanWranglerVariablesForSecrets as l}from"./scanWranglerVariablesForSecrets-BF-791aw.mjs";const n=(s,e)=>{const r=s?.producers;return(Array.isArray(r)?r:[]).flatMap(i=>o(i)&&typeof i.binding=="string"&&typeof i.queue=="string"?[{binding:i.binding,queue:i.queue,...e===void 0?{}:{env:e}}]:[])},v=s=>{const e=u(s),r=e===void 0?void 0:d(e).parsed;return e===void 0||r===void 0?{wranglerQueueProducers:[],wranglerVariables:[]}:{wranglerQueueProducers:[...n(r.queues),...Object.entries(r.env??{}).flatMap(([a,i])=>n(i?.queues,a))],wranglerVariables:l(o(r.vars)?r.vars:void 0,t(s,e))}};export{v as wranglerCodegenInputs};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{runCodegen as c,CodegenDiagnosticError as i}from"@lunora/codegen";import{wranglerCodegenInputs as a}from"./wranglerCodegenInputs-DBtq3faO.mjs";import{isCodegenDisabled as s,CODEGEN_ENV as t}from"./CODEGEN_ENV-ZsCxV1kP.mjs";import{writeFileSync as p,renameSync as m,rmSync as d}from"node:fs";const u=r=>({apiSpec:r.apiSpec,lunoraDirectory:r.schemaDirectory??"lunora",projectRoot:r.projectRoot,...a(r.projectRoot)}),y=r=>{if(s(process.env[t]))return[`codegen is off (${t}=0 / \`lunora dev --no-codegen\`) — the source was written but \`_generated/\` was NOT regenerated`];try{c(u(r))}catch(o){if(o instanceof i)return[o.message];throw o}return[]},C=(r,o)=>{const e=`${r}.lunora-tmp`;try{p(e,o,"utf8"),m(e,r)}catch(n){throw d(e,{force:!0}),n}};export{y as r,C as w};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{parseDevVariable as t,resolveAdminToken as r}from"../packem_shared/parseDevVariable-teAAahVD.mjs";import{applyStudioAssetCache as s,sendStudioDocument as d}from"../packem_shared/applyStudioAssetCache-DHQEJuuv.mjs";import{assetContentType as S,isStandaloneModulePath as l,loadStudioAssets as p,readStandaloneAsset as i,resolveStandaloneDirectory as m,studioAssetsStamp as u}from"../packem_shared/assetContentType-CUb5bpbI.mjs";import{STUDIO_PATH as T,STUDIO_SCRIPT_PATH as f,STUDIO_STYLE_PATH as A,createStudioMiddleware as P,isNonLoopbackHost as _,requestPathname as E,studioMountPath as c}from"../packem_shared/STUDIO_PATH-
|
|
1
|
+
import{parseDevVariable as t,resolveAdminToken as r}from"../packem_shared/parseDevVariable-teAAahVD.mjs";import{applyStudioAssetCache as s,sendStudioDocument as d}from"../packem_shared/applyStudioAssetCache-DHQEJuuv.mjs";import{assetContentType as S,isStandaloneModulePath as l,loadStudioAssets as p,readStandaloneAsset as i,resolveStandaloneDirectory as m,studioAssetsStamp as u}from"../packem_shared/assetContentType-CUb5bpbI.mjs";import{STUDIO_PATH as T,STUDIO_SCRIPT_PATH as f,STUDIO_STYLE_PATH as A,createStudioMiddleware as P,isNonLoopbackHost as _,requestPathname as E,studioMountPath as c}from"../packem_shared/STUDIO_PATH-B-rhpKZU.mjs";import{POLICY_SCAFFOLD_ENDPOINT as O,handlePolicyScaffoldRequest as h}from"../packem_shared/POLICY_SCAFFOLD_ENDPOINT-BquzWeBo.mjs";import{default as N}from"../packem_shared/renderStudioHtml-ByowDtMl.mjs";import{SCHEMA_EDIT_ENDPOINT as H,handleSchemaEditRequest as L}from"../packem_shared/SCHEMA_EDIT_ENDPOINT-DrZLd5rF.mjs";import{SEED_ENDPOINT as q,handleSeedRequest as v}from"../packem_shared/SEED_ENDPOINT-2B56PN_H.mjs";import{serveJsonHandler as M}from"../packem_shared/serveJsonHandler-Dv0EdCb9.mjs";import{ALLOW_FORWARDED_ENV as k,headerValue as F,isLoopbackAddress as U,transportRejectionReason as V}from"../packem_shared/ALLOW_FORWARDED_ENV-BUndghJx.mjs";export{k as ALLOW_FORWARDED_ENV,O as POLICY_SCAFFOLD_ENDPOINT,H as SCHEMA_EDIT_ENDPOINT,q as SEED_ENDPOINT,T as STUDIO_PATH,f as STUDIO_SCRIPT_PATH,A as STUDIO_STYLE_PATH,s as applyStudioAssetCache,S as assetContentType,P as createStudioMiddleware,h as handlePolicyScaffoldRequest,L as handleSchemaEditRequest,v as handleSeedRequest,F as headerValue,U as isLoopbackAddress,_ as isNonLoopbackHost,l as isStandaloneModulePath,p as loadStudioAssets,t as parseDevVariable,i as readStandaloneAsset,N as renderStudioHtml,E as requestPathname,r as resolveAdminToken,m as resolveStandaloneDirectory,d as sendStudioDocument,M as serveJsonHandler,u as studioAssetsStamp,c as studioMountPath,V as transportRejectionReason};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lunora/config",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.325",
|
|
4
4
|
"description": "Internal shared CLI + Vite config layer for Lunora: wrangler.jsonc validation, binding inference, and .dev.vars scaffolding",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"bindings",
|
|
@@ -54,10 +54,10 @@
|
|
|
54
54
|
"access": "public"
|
|
55
55
|
},
|
|
56
56
|
"dependencies": {
|
|
57
|
-
"@lunora/codegen": "1.0.0-alpha.
|
|
57
|
+
"@lunora/codegen": "1.0.0-alpha.280",
|
|
58
58
|
"@lunora/container": "1.0.0-alpha.71",
|
|
59
59
|
"@lunora/errors": ">=1.0.0-alpha.51 <2.0.0-0",
|
|
60
|
-
"@lunora/seed": "1.0.0-alpha.
|
|
60
|
+
"@lunora/seed": "1.0.0-alpha.204",
|
|
61
61
|
"@visulima/colorize": "2.1.1",
|
|
62
62
|
"@visulima/find-ai-runner": "1.0.2",
|
|
63
63
|
"@visulima/fs": "6.0.28",
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{readFileSync as V,writeFileSync as X}from"node:fs";import{createRequire as z}from"node:module";import{join as F}from"node:path";import{containerBuildTag as Z}from"@lunora/container";import{readJsonSync as ee}from"@visulima/fs";import{applyModify as S}from"./applyModify-DKP2l6S9.mjs";import{a as ne,r as M}from"./lunora-manifest-DuH_Cmyu.mjs";import{parseTree as se,findNodeAtLocation as te}from"jsonc-parser";import{r as oe,a as ie,b as re,c as ae}from"./reconcile-services-BwMkaWAq.mjs";import{a as de,s as ce}from"./infer-bindings-BsgN5eCm.mjs";import{DEV_VARS_FILE as le,parseDevVariableEntries as ue}from"./DEV_VARS_EXAMPLE_FILE-CqLorAxT.mjs";import{requiredSecrets as ge}from"./buildPackageSecretsBlock-xaAqLu5K.mjs";import{w as me,p as pe,s as Q,o as B,q as j,r as fe}from"./validate-bindings-DKlB-1sF.mjs";import{s as be}from"./worker-entry-checks-AIASCYl7.mjs";import{DEFAULT_OBSERVABILITY as he}from"./DEFAULT_OBSERVABILITY-bN6UkTMx.mjs";import{findWranglerFile as we,readWranglerJsonc as ve}from"./WRANGLER_FILES-UNW-xY5u.mjs";const _e=[["maxBatchSize","max_batch_size"],["maxBatchTimeout","max_batch_timeout"],["maxRetries","max_retries"],["deadLetterQueue","dead_letter_queue"],["retryDelay","retry_delay"]],R=e=>Object.fromEntries(_e.filter(([n])=>e.tuning[n]!==void 0).map(([n,s])=>[s,e.tuning[n]])),P="queueTuning",ye=/^[\t ]*(?:,[\t ]*)?(?:\/\/[^\n\r]*)?\r?\n/u,Se=/^[\t ]*,/u,xe=(e,n)=>{const s=se(e),t=s===void 0?void 0:te(s,[...n])?.parent;if(t?.type==="property"){const i=t.offset+t.length,o=e.lastIndexOf(`
|
|
2
|
-
`,t.offset-1)+1,d=ye.exec(e.slice(i));if(d!==null&&e.slice(o,t.offset).trim()===""){const a=t.parent?.children??[],b=a.indexOf(t),c=b===a.length-1&&b>0?a[b-1]:void 0,l=c===void 0?void 0:Se.exec(e.slice(c.offset+c.length))??void 0;return(l===void 0||c===void 0?e.slice(0,o):e.slice(0,c.offset+c.length)+e.slice(c.offset+c.length+l[0].length,o))+e.slice(i+d[0].length)}}return S(e,n,void 0)},Y=(e,n,s,t,i,o=new Set)=>{const d=s.join("."),a={},b=[],c=[];let l=e;return{entries:n.map((u,w)=>{const g=t(u);if(g===void 0||u.queue===void 0)return u;const p=Object.fromEntries(Object.entries(R(g)).filter(([f])=>!o.has(f))),h=Object.entries(i[u.queue]??{}).filter(([f])=>!Object.hasOwn(p,f)),v=Object.entries(p).filter(([f,y])=>u[f]!==y),x=h.filter(([f,y])=>u[f]===y).map(([f])=>f),N=Object.fromEntries(Object.entries({...u,...p}).filter(([f])=>!x.includes(f)));for(const[f,y]of v)l=S(l,[...s,w,f],y);for(const f of x)l=xe(l,[...s,w,f]);for(const[f,y]of h){const E=u[f];E!==void 0&&E!==y&&c.push(`${d}/${u.queue}: ${f} is no longer declared by defineQueue, but it was changed by hand to ${JSON.stringify(E)} from the declared ${JSON.stringify(y)}, so it was kept. Delete it from wrangler.jsonc if it should go.`)}return(v.length>0||x.length>0)&&b.push(`${d}/${u.queue} (${[...v.map(([f])=>f),...x.map(f=>`removed ${f}`)].join(", ")})`),Object.keys(p).length>0&&(a[u.queue]=p),N}),owned:a,text:l,updated:b,warnings:c}},Ne=(e,n,s,t)=>{const i=n.queues??{},o=i.producers??[],d=i.consumers??[],a=new Set(o.map(g=>g.binding)),b=new Set(d.map(g=>g.queue)),c=s.filter(g=>!a.has(g.bindingName)),l=s.filter(g=>!b.has(g.name)),m=Y(e,d,["queues","consumers"],g=>s.find(p=>p.name===g.queue),t);let u=m.text;const w={...m.owned};if(c.length>0||l.length>0){const g=[...o,...c.map(h=>({binding:h.bindingName,queue:h.name}))],p=[...m.entries,...l.map(h=>({queue:h.name,...h.mode==="pull"?{type:"http_pull"}:{},...R(h)}))];for(const h of l){const v=R(h);Object.keys(v).length>0&&(w[h.name]=v)}u=S(u,["queues"],{consumers:p,producers:g})}return{added:[...c.map(g=>`queues.producers/${g.bindingName}`),...l.map(g=>`queues.consumers/${g.name}`)],owned:w,text:u,updated:m.updated,warnings:m.warnings}},Oe=(e,n,s,t,i)=>{const o=n.env?.[t],d=o?.queues?.consumers??[],a=o?.queues?.producers??[],b=u=>{const w=a.find(g=>g.queue===u.queue)?.binding;return w!==void 0?s.find(g=>g.bindingName===w):s.find(g=>g.name===u.queue&&!a.some(p=>p.binding===g.bindingName))},c=Y(e,d,["env",t,"queues","consumers"],b,i,new Set(["dead_letter_queue"])),l=d.filter(u=>u.queue!==void 0&&b(u)===void 0).map(u=>`env.${t}.queues.consumers/${String(u.queue)}: no defineQueue export matches it — this block declares no producer mapping one of their bindings to "${String(u.queue)}", and no export is named that — so it was not retuned. A consumer for a queue another worker produces is skipped the same way.`),m=d.flatMap(u=>{const w=b(u)?.tuning.deadLetterQueue;return w===void 0||u.dead_letter_queue!==void 0?[]:[`env.${t}.queues.consumers/${String(u.queue)}: defineQueue declares deadLetterQueue "${w}", but this consumer has no dead_letter_queue, so its exhausted messages are dropped. Queue names differ per environment, so reconcile does not write it here; add it by hand.`]});return{added:[],owned:c.owned,text:c.text,updated:c.updated,warnings:[...c.warnings,...m,...l]}},Ee=(e,n)=>{if(e?.lunoraIsForeign===!0)return n.push(`${e.path}: \`lunora\` is not an object, so the queue tuning ownership record cannot be read or written — an option removed from defineQueue stays deployed.`),{};const s=e?.lunora?.[P],t=i=>typeof i=="object"&&i!==null&&!Array.isArray(i);return s===void 0?{}:!t(s)||!Object.values(s).every(i=>t(i)&&Object.values(i).every(o=>t(o)))?(n.push(`${e?.path??"package.json"}: \`lunora.${P}\` is not a map of scope → queue → fields, so it is ignored — an option removed from defineQueue stays deployed until the next pass records it again.`),{}):s},ke=(e,n,s)=>{const t=Object.fromEntries(Object.entries({...n,...s}).filter(([,i])=>Object.keys(i).length>0));ne(e,P,Object.keys(t).length===0?void 0:t)},C="PIPELINES",I="ARTIFACTS",$e=(e,n)=>{const s=e.flagshipBinding!==void 0&&!(n?.flagship??[]).some(a=>a.binding===e.flagshipBinding),t=e.usesPipelines&&!(n?.pipelines??[]).some(a=>a.binding===C),i=e.usesArtifacts?n?.artifacts??[]:[],o=i.some(a=>a.binding===I)?[]:i.flatMap(a=>a.binding===void 0?[]:[a.binding]);return[[e.usesKv&&(n?.kv_namespaces?.length??0)===0,"@lunora/bindings/kv is used but no kv_namespaces binding exists; add a kv_namespaces entry ({ binding, id }) and pass env.<BINDING> to createKv() — the namespace id can't be auto-provisioned."],[e.usesHyperdrive&&(n?.hyperdrive?.length??0)===0,"@lunora/hyperdrive is used but no hyperdrive binding exists; run 'wrangler hyperdrive create' and add a 'hyperdrive' binding ({ binding, id }) — the id can't be auto-provisioned."],[t,`ctx.pipelines is used but no "${C}" pipelines binding exists; run 'wrangler pipelines create <name>' and add a 'pipelines' binding ({ binding: "${C}", stream }) — codegen resolves this one name, and the pipeline resource can't be auto-provisioned.`],[e.usesArtifacts&&i.length===0,de(e.jurisdiction)],[o.length>0,`ctx.artifacts is used and ${o.map(a=>`"${a}"`).join(", ")} ${o.length===1?"is":"are"} bound, but none is named "${I}"; make sure \`.artifacts()\` on defineApp points ctx.artifacts at it — otherwise it reads env.${I} and throws.`],[s,`lunora/flags.ts uses Flagship in binding mode but no flagship binding "${e.flagshipBinding??""}" exists; add a flagship entry ({ binding: "${e.flagshipBinding??""}", app_id }) — the app_id can't be auto-provisioned.`]].filter(([a])=>a).map(([,a])=>a)},Ae=e=>[[e.usesX402Charge,"@lunora/x402/charge is used; set the recipient wallet address as a [vars] entry (the var name is your choice) and pass it to the charge config — the x402 facilitator settles USDC to that address."],[e.usesX402,"@lunora/x402/pay is used (ActionCtx-only, spends real funds); add a secrets_store_secrets[] binding holding the agent wallet key (binding name == signer.secretName) and pair the pay rail with a spend policy — ctx.secrets reads a Secrets Store binding, not .dev.vars."]].filter(([s])=>s).map(([,s])=>s),D=(e,n,s)=>s.filter(t=>!t.exported).map(t=>`${e} "${t.exportName}" is declared but ${t.className} is not exported by the worker entry; add \`export * from "./lunora/_generated/${n}"\` so its binding can be provisioned.`),qe=(e,n)=>{const s=new Set([...e.workflows,...e.agents].map(o=>o.className));if(s.size===0)return[];const t=Object.entries(n.exports??{}).flatMap(([o,d])=>d?.type==="workflow"?[o]:[]),i=(n.workflows??[]).flatMap(o=>o.class_name===void 0||o.script_name!==void 0?[]:[o.class_name]);return[...new Set([...t,...i])].filter(o=>!s.has(o)).map(o=>`wrangler.jsonc declares workflow "${o}" but no defineWorkflow/defineAgent export generates that class — a leftover from a rename will fail the deploy (wrangler rejects a class the worker does not export). Remove it if it is not hand-wired.`)},je=(e,n)=>{if(e.queues.length===0)return[];const s=new Set(e.queues.map(i=>i.name)),t=new Set(e.queues.map(i=>i.bindingName));return[...(n.queues?.consumers??[]).flatMap(i=>{const{queue:o}=i;return o===void 0||s.has(o)?[]:[`wrangler.jsonc subscribes queues.consumers[] to "${o}" but no defineQueue export declares that queue — a leftover from a rename keeps delivering batches this worker has no handler for (they retry to exhaustion, then drop or dead-letter). Remove it if it is not hand-wired.`]}),...(n.queues?.producers??[]).flatMap(i=>{const{binding:o}=i;return o===void 0||t.has(o)?[]:[`wrangler.jsonc declares queues.producers[] binding "${o}" but no defineQueue export declares it — a leftover from a rename. Remove it if it is not hand-wired.`]})]},Ce=(e,n)=>[...qe(e,n),...je(e,n)],G=[{keys:["STRIPE_SECRET_KEY","STRIPE_WEBHOOK_SECRET"],label:"Stripe"},{keys:["POLAR_ACCESS_TOKEN","POLAR_WEBHOOK_SECRET"],label:"Polar"},{keys:["CREEM_API_KEY","CREEM_WEBHOOK_SECRET"],label:"Creem"},{keys:["AUTUMN_SECRET_KEY","AUTUMN_WEBHOOK_SECRET"],label:"Autumn"},{keys:["DODO_PAYMENTS_API_KEY","DODO_PAYMENTS_WEBHOOK_KEY"],label:"Dodo Payments"}],Ie=()=>G.map(({keys:e,label:n})=>`${e[0]} + ${e[1]} (${n})`).join(" or "),De=e=>{let n;try{n=V(F(e,le),"utf8")}catch{return!1}const s=new Map(ue(n).map(t=>[t.key,t.value]));return G.some(({keys:t})=>t.every(i=>(s.get(i)??"")!==""))},Te=(e,n)=>{const s=n?.secrets?.required;if(!Array.isArray(s))return[];const t=new Set(s),i=ge(ce(e)).map(o=>o.key).filter(o=>!t.has(o));return i.length===0?[]:[`wrangler.jsonc declares secrets.required without ${i.join(", ")}, which this app needs — wrangler dev loads only the listed keys from .dev.vars, so add ${i.length===1?"it":"them"} to secrets.required.`]},T=(e,n,s)=>{const t=new Set(e.durableObjects.map(a=>a.className)),i=[],o=(s?.r2_buckets?.length??0)>0,d=(s?.d1_databases?.some(a=>a.binding==="DB")??!1)||e.needsD1;return e.usesStorage&&!o&&i.push("@lunora/storage is used but R2 bucket bindings have user-defined names; add an r2_buckets entry and pass env.<BINDING> to createStorage()."),e.usesAuth&&!t.has("SessionDO")&&!d&&i.push("@lunora/auth is used but the worker entry exports no SessionDO; sessions are D1-backed, or export SessionDO to enable DO-backed sessions."),e.usesScheduler&&!t.has("SchedulerDO")&&i.push("@lunora/scheduler is used but the worker entry exports no SchedulerDO; export it so the SCHEDULER binding can be provisioned."),i.push(...D("container","containers",e.containers),...D("workflow","workflows",e.workflows),...D("agent","agents",e.agents)),e.containers.length>0&&s?.observability?.enabled===!1&&i.push("containers are declared but observability is explicitly disabled in wrangler.jsonc — container logs will not be captured."),e.usesPayments&&!De(n)&&i.push(`@lunora/payment is used; set one provider's secret pair in .dev.vars — ${Ie()}.`),i.push(...Ae(e),...$e(e,s),...Te(e,s)),s!==void 0&&i.push(...Ce(e,s)),i},U="<replace-with-d1-create-id>",Be=e=>[["container","containers",e.containers],["workflow","workflows",e.workflows],["agent","agents",e.agents]].flatMap(([s,t,i])=>i.filter(o=>!o.exported).map(({className:o,exportName:d})=>({className:o,exportName:d,kind:s,module:t}))),Re=e=>{const n=new Set(B(e).map(t=>t.tag));let s=1;for(;n.has(`v${String(s)}`);)s+=1;return`v${String(s)}`},Pe=e=>{const n=new Set;for(const s of B(e)){for(const t of j(s.deleted_classes))n.delete(t);for(const{from:t,to:i}of B(s.renamed_classes))t!==void 0&&n.delete(t),i!==void 0&&n.add(i);for(const t of[...j(s.new_classes),...j(s.new_sqlite_classes)])n.add(t)}return n},Le=(e,n,s)=>{const t=n.durable_objects?.bindings??[],i=new Set(t.map(l=>l.name)),o=s.filter(l=>!i.has(l.binding));let d=e;const a=[];if(o.length>0){const l=[...t,...o.map(m=>({class_name:m.className,name:m.binding}))];d=S(d,["durable_objects","bindings"],l),a.push(...o.map(m=>`${m.binding}/${m.className}`))}const b=n.migrations??[],c=s.map(l=>l.className).filter(l=>!Pe(b).has(l));if(c.length>0){const l=[...b,{new_sqlite_classes:c,tag:Re(b)}];d=S(d,["migrations"],l)}return{added:a,text:d}},We=(e,n)=>{const s=n.d1_databases??[];if(s.some(o=>o.binding==="DB"))return{added:[],text:e};const t=typeof n.name=="string"&&n.name.length>0?n.name:"lunora",i=[...s,{binding:"DB",database_id:U,database_name:t}];return{added:["DB (D1)"],text:S(e,["d1_databases"],i)}},Me={ai:{binding:"AI",label:"AI (Workers AI)"},analytics:{binding:"ANALYTICS_SQL",label:"ANALYTICS_SQL (Analytics SQL)"},browser:{binding:"BROWSER",label:"BROWSER (Browser Rendering)"},images:{binding:"IMAGES",label:"IMAGES (Cloudflare Images)"}},$=(e,n,s)=>{const{binding:t,label:i}=Me[s],o=n[s]?.binding;return typeof o=="string"&&o.length>0?{added:[],text:e}:{added:[i],text:S(e,[s],{binding:t})}},Ke=(e,n)=>e.usesAnalyticsSql&&be(n,new Set(["analyticsSql"]))?.chained.has("analyticsSql")!==!0,Fe=new Set(["ratelimits","send_email"]),Qe=["durable_objects","logfwdr","unsafe"],Ye=new Set(["data_blobs","text_blobs","vars","wasm_modules"]),W=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),L=(e,n,s)=>W(e)&&e[n]===s,Ge=(e,n,s)=>{if(Ye.has(e))return W(n)&&Object.hasOwn(n,s);const t=Fe.has(e)?"name":"binding";return Array.isArray(n)?n.some(i=>L(i,t,s)):L(n,"binding",s)},Ue=(e,n)=>{const s=e,t=Object.entries(s).find(([o,d])=>o!=="env"&&Ge(o,d,n));if(t!==void 0)return t[0];for(const o of Qe){const d=s[o];if(W(d)&&Array.isArray(d.bindings)&&d.bindings.some(a=>L(a,"name",n)))return`${o}.bindings`}if(e.queues?.producers?.some(o=>o.binding===n)===!0)return"queues.producers";const i=e.secrets?.required;if(Array.isArray(i)&&i.includes(n))return"secrets.required"},K=(e,n,s,t,i)=>{if((n[s]?.length??0)>0)return{added:[],text:e};const o=Ue(n,t.binding);return o!==void 0?{added:[],text:e,warnings:[`${s}: not adding ${JSON.stringify(t)} — the name "${t.binding}" is already bound by \`${o}\` in wrangler.jsonc. Add a ${s} entry under another binding name and point the matching \`defineApp()\` override at it.`]}:{added:[i],text:S(e,[s],[t])}},He=(e,n)=>{const s=n.worker_loaders??[];return s.some(t=>t.binding==="LOADER")?{added:[],text:e}:{added:["LOADER (Worker Loader)"],text:S(e,["worker_loaders"],[...s,{binding:"LOADER"}])}},Je=e=>{if(typeof e=="string")return e;const n={};return e.diskMb!==void 0&&(n.disk_mb=e.diskMb),e.memoryMib!==void 0&&(n.memory_mib=e.memoryMib),e.vcpu!==void 0&&(n.vcpu=e.vcpu),n},Ve=e=>{const{image:n}=e;return n.kind==="dockerfile"?n.dockerfilePath:n.kind==="registry"?n.reference:Z(e.exportName)},H=e=>{const n={};for(const[s,t]of Object.entries(e.images??{}))n[s]=t.kind==="registry"?{image:t.reference}:{build_context:t.buildContext,dockerfile:t.dockerfilePath,...e.buildArgs===void 0?{}:{build_vars:e.buildArgs}};return{class_name:e.className,scheduling_policy:"durable_object",...Object.keys(n).length>0?{images:n}:{},...e.name===void 0?{}:{name:e.name}}},Xe=e=>{if(e.schedulingPolicy==="durable_object")return H(e);const{image:n}=e,s={class_name:e.className,image:Ve(e)};return n.kind==="dockerfile"&&(s.image_build_context=n.buildContext),e.buildArgs!==void 0&&n.kind!=="registry"&&(s.image_vars=e.buildArgs),e.instanceType!==void 0&&(s.instance_type=Je(e.instanceType)),e.maxInstances!==void 0&&(s.max_instances=e.maxInstances),e.name!==void 0&&(s.name=e.name),e.rollout?.stepPercentage!==void 0&&(s.rollout_step_percentage=e.rollout.stepPercentage),e.rollout?.gracePeriodSeconds!==void 0&&(s.rollout_active_grace_period=e.rollout.gracePeriodSeconds),s},ze=(e,n,s)=>{const t=n.containers??[],i=new Set(t.map(c=>c.class_name)),o=s.filter(c=>!i.has(c.className));let d=o.length===0?e:S(e,["containers"],[...t,...o.map(c=>Xe(c))]);const a=[],b=[];for(const[c,l]of t.entries()){const m=s.find(g=>g.className===l.class_name);if(m===void 0)continue;const u=m.schedulingPolicy??"default";if((l.scheduling_policy??"default")!==u){b.push(`containers/${m.className} has scheduling_policy "${l.scheduling_policy??"default"}" in wrangler.jsonc but defineContainer "${m.exportName}" declares "${u}" — the policy is immutable, so replace the entry (and its container application) by hand.`);continue}const w=m.schedulingPolicy==="durable_object"?H(m).images:void 0;w!==void 0&&JSON.stringify(l.images)!==JSON.stringify(w)&&(d=S(d,["containers",c,"images"],w),a.push(`containers/${m.className}.images`))}return{added:o.map(c=>`containers/${c.className}`),text:d,updated:a,warnings:b}},Ze=(e,n)=>{if(n.observability!==void 0)return{added:[],text:e};const s=S(e,["observability"],{...he});return{added:["observability"],text:s}},J=[{minimum:[4,142],name:"wrangler"},{minimum:[1,61],name:"@cloudflare/vite-plugin"}],en=J.map(({minimum:e,name:n})=>`${n}@^${e.join(".")}.0`).join(" "),nn=(e,n)=>{try{const s=z(F(e,"package.json")).resolve(`${n}/package.json`),[t=0,i=0]=String(ee(s).version).split(".").map(Number);return[t,i]}catch{return}},sn=e=>{const n=J.flatMap(({minimum:s,name:t})=>{const i=nn(e,t);return i!==void 0&&(i[0]<s[0]||i[0]===s[0]&&i[1]<s[1])?[`${t} ${i.join(".")} (needs >= ${s.join(".")})`]:[]});return n.length===0?void 0:`workflows are declared in wrangler \`exports\`, which ${n.join(" and ")} cannot run — reconcile left workflows[] untouched. Upgrade (\`pnpm add -D ${en}\`) and re-run.`},tn=e=>Object.entries(e.env??{}).flatMap(([n,s])=>Array.isArray(s?.workflows)?[`env.${n}.workflows declares workflow bindings, but Lunora now declares workflows in \`exports\` and resolves them on ctx.exports — move them to that environment's own \`exports\` by hand.`]:[]),on=(e,n,s)=>{let t=e;const i=[],o=[];for(const d of s){const a=n[d.className];if(a?.type==="workflow")for(const{of:b,path:c}of fe){const l=b(d),m=Q(a,c),u=`exports/${d.className}.${c.join(".")}`;if(l===void 0){m!==void 0&&o.push(`${u} is set in wrangler.jsonc but defineWorkflow "${d.exportName}" does not declare it — reconcile leaves it in place. Remove it by hand if it was dropped from the definition.`);continue}JSON.stringify(m)!==JSON.stringify(l)&&(t=S(t,["exports",d.className,...c],l),i.push(u))}}return{text:t,updated:i,warnings:o}},rn=(e,n,s,t,i)=>{if(i!==void 0)return{added:[],text:e,warnings:[i]};const o=[...s.map(p=>({settings:me(p),workflow:p})),...t.map(p=>({settings:{},workflow:p}))],d=new Set(o.map(({workflow:p})=>p.className)),a=n.workflows??[],b=a.filter(p=>p.script_name===void 0&&p.class_name!==void 0&&d.has(p.class_name)),c=n.exports??{},l=[],m=[],u=[];let w=e;for(const{settings:p,workflow:h}of o){if(c[h.className]!==void 0&&c[h.className]!==null)continue;const v=b.find(f=>f.class_name===h.className),x=Object.fromEntries(pe.flatMap(f=>{const y=Q(v,[f]);return y===void 0?[]:[[f,y]]})),N=v?.name??h.name;v?.name!==void 0&&v.name!==h.name&&u.push(`workflows/${h.className} is deployed as "${v.name}" but declared as "${h.name}" — its export keeps "${v.name}" so running instances survive. Change the declaration to match, or rename deliberately (it starts a new, empty workflow).`),w=S(w,["exports",h.className],{type:"workflow",...x,...p,name:N}),(v===void 0?l:m).push(`exports/${h.className}`)}if(b.length>0){const p=a.filter(h=>!b.includes(h));w=S(w,["workflows"],p.length===0?void 0:p),m.push(...b.map(h=>`workflows/${String(h.class_name)} → exports`))}u.push(...tn(n));const g=on(w,c,s);return{added:l,text:g.text,updated:[...m,...g.updated],warnings:[...u,...g.warnings]}},xn=(e,n,s)=>{const t=we(e),i=Be(n);if(!t)return{added:[],changed:!1,exportGaps:i,reason:"wrangler.jsonc not found",updated:[],warnings:T(n,e)};const{parsed:o,text:d}=ve(t);if(o===void 0)return{added:[],changed:!1,exportGaps:i,reason:`failed to parse ${t} as JSONC`,updated:[],warnings:T(n,e),wranglerPath:t};const a=T(n,e,o);if(s!==void 0){const r=o.env?.[s]!==void 0;a.push(r?`auto-provisioned bindings are written to the top level of wrangler.jsonc only (queue consumers "env.${s}" already declares are retuned, nothing is added) — "env.${s}" has its own (non-inheritable) bindings and must be reconciled by hand; \`lunora deploy --env ${s}\` now validates them, so a gap here will be reported at deploy time.`:`--env "${s}" was requested but wrangler.jsonc declares no "env.${s}" block — auto-provisioned bindings are written to the top level only and will not apply to that environment.`)}const b=n.containers.filter(r=>r.exported),c=n.agents.filter(r=>r.exported&&r.voice===!0&&r.voiceBindingName!==void 0&&r.voiceClassName!==void 0),l=[...n.durableObjects,...b.map(r=>({binding:r.bindingName,className:r.className})),...c.map(r=>({binding:r.voiceBindingName,className:r.voiceClassName}))],m=n.workflows.filter(r=>r.exported),u=n.agents.filter(r=>r.exported),w=M(e),g=Ee(w,a),p={},h=oe(w);let v;const x=[{enabled:!0,run:r=>Le(r,o,l)},{enabled:n.needsD1,run:r=>We(r,o)},{enabled:n.usesAi,run:r=>$(r,o,"ai")},{enabled:n.usesAiSearch,run:r=>K(r,o,"ai_search_namespaces",{binding:"AI_SEARCH",namespace:"default"},"AI_SEARCH (AI Search namespace)")},{enabled:Ke(n,e),run:r=>$(r,o,"analytics")},{enabled:n.usesBrowser,run:r=>$(r,o,"browser")},{enabled:n.usesImages,run:r=>$(r,o,"images")},{enabled:n.usesAnalytics,run:r=>K(r,o,"analytics_engine_datasets",{binding:"ANALYTICS",dataset:"ANALYTICS"},"ANALYTICS (Analytics Engine)")},{enabled:n.usesWorkerLoader,run:r=>He(r,o)},{enabled:!0,run:r=>Ze(r,o)},{enabled:b.length>0,run:r=>ze(r,o,b)},{enabled:m.length>0||u.length>0,run:r=>rn(r,o,m,u,sn(e))},{enabled:n.queues.length>0,run:r=>{const _=Ne(r,o,n.queues,g.queues??{});return p.queues=_.owned,_}},{enabled:n.services!==void 0&&(n.services.length>0||Object.keys(h).length>0),run:r=>{const _=ie(r,o,n.services??[],h);return v=_.owned,_}},...s===void 0||o.env?.[s]===void 0?[]:[{enabled:n.queues.length>0,run:r=>{const _=`env.${s}.queues`,k=Oe(r,o,n.queues,s,g[_]??{});return p[_]=k.owned,k}}]];let N=d;const f=[],y=[];for(const r of x){if(!r.enabled)continue;const _=r.run(N);N=_.text,f.push(..._.added),y.push(..._.updated??[]),a.push(..._.warnings??[])}const E=r=>{if(w===void 0)return;const _=v,k=[...Object.keys(p).length>0?[{consequence:"an option removed from defineQueue stays deployed",key:"queueTuning",label:"queue tuning",write:O=>{ke(O,g,p)}}]:[],..._===void 0?[]:[{consequence:"a service removed from lunora.config stays bound",key:"services",label:"service bindings",write:O=>{ae(O,_)}}]];for(const O of k)try{O.write(M(e)??w)}catch(q){a.push(`${r?"wrangler.jsonc was updated, but ":""}recording the ${O.label} reconcile owns in ${w.path} (lunora.${O.key}) failed: ${q instanceof Error?q.message:String(q)}. Until it is recorded, ${O.consequence}.`)}};let A;if(n.services!==void 0){const r=re(e,n.services,h);a.push(...r.warnings),v={...v,...r.owned},A=r.added.length>0||r.updated.length>0?{added:r.added,path:r.path,updated:r.updated}:void 0}return f.includes("DB (D1)")&&a.push(`wrote a DB binding with a placeholder database_id ("${U}") — run \`wrangler d1 create <name>\` and replace it before deploying.`),N===d?(E(!1),{added:f,changed:!1,devConfig:A,exportGaps:i,reason:"bindings already in sync",updated:y,warnings:a,wranglerPath:t}):(X(t,N,"utf8"),E(!0),{added:f,changed:!0,devConfig:A,exportGaps:i,updated:y,warnings:a,wranglerPath:t})};export{Be as collectExportGaps,xn as reconcileWranglerBindings};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{relative as s}from"node:path";import{secretKindOf as a,redact as c}from"@lunora/codegen";import{i as f,a as d}from"./package-secrets-registry-BeheNwsP.mjs";import{isPlaceholderValue as l}from"./buildPackageSecretsBlock-xaAqLu5K.mjs";import{findWranglerFile as m,readWranglerJsonc as u}from"./WRANGLER_FILES-UNW-xY5u.mjs";const p=8,g=(e,r)=>{if(e===void 0)return[];const n=[];for(const[t,i]of Object.entries(e)){if(typeof i!="string"||l(i)||f(t))continue;const o=a(i)??(d(t)&&i.length>=p?"secret_named_var":void 0);o!==void 0&&n.push({file:r,key:t,kind:o,preview:c(i)})}return n},V=e=>{const r=m(e);if(r===void 0)return[];const{parsed:n}=u(r);return n===void 0?[]:g(n.vars,s(e,r))};export{V as collectWranglerSecretVariables,g as scanWranglerVariablesForSecrets};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{CUSTOM_INSTANCE_TYPE_LIMITS as f,CUSTOM_INSTANCE_MIN_MEMORY_MIB_PER_VCPU as y}from"@lunora/container";const g=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),d=e=>typeof e=="string"&&e.length>0,h=[{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"]}],U=[...new Set(h.map(({path:e})=>e[0]))],_=(e,n)=>{let a=e;for(const s of n)a=g(a)?a[s]:void 0;return a},B=e=>{const n={};for(const{of:a,path:s}of h){const t=a(e);if(t===void 0)continue;const[i,o]=s;n[i]=o===void 0?t:{...n[i],[o]:t}}return n},L=(e,n,a)=>{if(n.length===0)return;const s=e.vectorize??[],t=new Set(s.filter(Boolean).map(i=>i?.index_name));for(const i of n)t.has(i)||a.push(`schema declares vector index "${i}"; wrangler "vectorize" must include a binding with index_name "${i}"`)},M=new Set(["basic","dev","lite","standard","standard-1","standard-2","standard-3","standard-4"]),S={disk_mb:f.diskMb,memory_mib:f.memoryMib,vcpu:{...f.vcpu,hint:'use the named "lite" or "basic" instance type below 1 vCPU'}},j=(e,n,a)=>{const s=e.instance_type;if(s===void 0)return;if(typeof s=="string"){M.has(s)||a.push(`${n} has unknown instance_type "${s}" — expected lite, basic, standard-1..4, or a custom { vcpu, memory_mib, disk_mb } object`);return}for(const[o,{hint:r,max:c,min:u}]of Object.entries(S)){const m=s[o];if(m!==void 0&&(typeof m!="number"||Number.isNaN(m)||m<u||m>c)){const w=r!==void 0&&typeof m=="number"&&m<u?` — ${r}`:"";a.push(`${n} custom instance_type ${o} must be a number in ${String(u)}–${String(c)} (got ${String(m)})${w}`)}}const{memory_mib:t,vcpu:i}=s;typeof i=="number"&&typeof t=="number"&&t<i*y&&a.push(`${n} custom instance_type needs ≥ 3 GiB (${String(y)} MiB) memory per vCPU (got ${String(t)} MiB for ${String(i)} vCPU)`)},E=(e,n,a)=>{for(const s of["image","instance_type","max_instances"])e[s]!==void 0&&a.push(`${n} sets "${s}", which the durable_object scheduling policy does not take — the Durable Object picks image and size at start`);for(const[s,t]of Object.entries(e.images??{}))[t?.dockerfile,t?.image].filter(o=>typeof o=="string"&&o.length>0).length!==1&&a.push(`${n} images["${s}"] must set exactly one of "dockerfile" or "image"`)},A=(e,n,a)=>{const{boundClasses:s,classKinds:t,errors:i,warnings:o}=a;if(!e||typeof e!="object"||typeof e.class_name!="string"||e.class_name.length===0){i.push(`${n} 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&&i.push(`${n} ("${e.class_name}") has unknown scheduling_policy "${e.scheduling_policy}" — expected "default" or "durable_object"`),r?E(e,`${n} ("${e.class_name}")`,i):(typeof e.image!="string"||e.image.length===0)&&i.push(`${n} ("${e.class_name}") must have an "image" — a Dockerfile path or a registry reference`),s.has(e.class_name)||i.push(`${n} 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=t.get(e.class_name);c!=="sqlite"&&i.push(c==="classic"?`${n} class "${e.class_name}" is registered via "new_classes" but containers require SQLite-backed DOs — move it to "new_sqlite_classes"`:`${n} class "${e.class_name}" is missing from migrations — add a migration entry with "new_sqlite_classes": ["${e.class_name}"]`),j(e,`${n} ("${e.class_name}")`,i),e.max_instances===void 0&&!r&&o.push(`${n} ("${e.class_name}") declares no max_instances — set a cap so a traffic spike can't fan out unbounded container spend`)},b=e=>Array.isArray(e)?e.filter(n=>n!==null&&typeof n=="object"):[],p=e=>Array.isArray(e)?e.filter(n=>d(n)):[],k=e=>{const n=new Map;for(const a of b(e)){for(const s of p(a.new_classes))n.set(s,"classic");for(const s of p(a.new_sqlite_classes))n.set(s,"sqlite");for(const s of b(a.renamed_classes))if(d(s.from)&&d(s.to)){const t=n.get(s.from)??"sqlite";n.delete(s.from),n.set(s.to,t)}for(const s of p(a.deleted_classes))n.delete(s)}return n},x=e=>new Set(k(e).keys()),F=(e,n)=>{const a=x(e.migrations);for(const s of b(e.durable_objects?.bindings))s.script_name===void 0&&d(s.class_name)&&!a.has(s.class_name)&&n.push(`durable_objects.bindings declares class "${s.class_name}" but it is missing from migrations — add a migration entry with "new_sqlite_classes": ["${s.class_name}"] (or "new_classes" for a non-SQLite-backed class), or let the dev server auto-reconcile it on the next start`)},P=(e,n,a)=>{if(e.containers===void 0)return;if(!Array.isArray(e.containers)){n.push("containers must be an array of { class_name, image, ... } entries");return}const s=e.containers;if(s.length===0)return;const t=new Set(b(e.durable_objects?.bindings).map(o=>o.class_name)),i=k(e.migrations);for(const[o,r]of s.entries())A(r,`containers[${String(o)}]`,{boundClasses:t,classKinds:i,errors:n,warnings:a});e.observability?.enabled!==!0&&a.push('containers are configured but observability is not enabled — container logs will not be captured (add { "observability": { "enabled": true } })')},l=e=>e,v=(e,n,a,s)=>{if(e!==void 0){if(!Array.isArray(e)){s.push(a.arrayMessage);return}for(const[t,i]of l(e).entries()){const o=`${n}[${String(t)}]`;if(!i||typeof i!="object"){s.push(a.objectMessage(o));continue}for(const r of a.fields)d(i[r.field])||s.push(r.message(o))}}},W={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`},I=(e,n)=>e===void 0||n&&d(e)||Array.isArray(e)&&e.length>0&&e.every(s=>d(s))?void 0:"schedules must be a non-empty array of cron expression strings",R=e=>{if(e!==void 0)return g(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"},q=e=>e===void 0?[]:g(e)?["success_retention","error_retention"].filter(n=>e[n]!==void 0&&!d(e[n])).map(n=>`default_retention.${n} must be a duration string (e.g. "7 days")`):["default_retention must be an object"],$=(e,n,a,s)=>{const t=[I(e.schedules,a),R(e.limits),...q(e.default_retention)];for(const i of t)i!==void 0&&s.push(`${n}.${i}`)},N=(e,n)=>h.map(({path:a})=>a).filter(a=>{const s=_(e,a),t=_(n,a),i=typeof t=="string"&&a[0]==="schedules"?[t]:t;return s!==void 0&&t!==void 0&&JSON.stringify(s)!==JSON.stringify(i)}).map(a=>a.join(".")),O=(e,n,a,s)=>{const t=`exports["${e}"]`,i=String(n.name);for(const o of a){if(!g(o)||o.name!==n.name)continue;const r=`workflows entry "${String(o.binding)}"`;if(o.script_name!==void 0){s.push(`${r} binds workflow "${i}" in another Worker, but ${t} declares a workflow with that name here — workflow names are unique per account`);continue}o.class_name!==e&&s.push(`${r} and ${t} both declare workflow "${i}" but name different classes ("${String(o.class_name)}" vs "${e}")`);for(const c of N(o,n))s.push(`${r} and ${t} set ${c} to different values for workflow "${i}" — set it in one place`)}},G=(e,n)=>{const a=Array.isArray(e.workflows)?l(e.workflows):[];for(const[t,i]of a.entries())g(i)&&$(i,`workflows[${String(t)}]`,!1,n);const s=g(e.exports)?Object.entries(e.exports):[];for(const[t,i]of s)!g(i)||i.type!=="workflow"||(d(i.name)?($(i,`exports["${t}"]`,!0,n),O(t,i,a,n)):n.push(`exports["${t}"] is a workflow export and must have a non-empty "name" naming the deployed workflow`))},C={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`},T={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`},K=(e,n)=>{if(e.queues!==void 0){if(typeof e.queues!="object"||Array.isArray(e.queues)){n.push("queues must be a { producers, consumers } object");return}v(e.queues.producers,"queues.producers",C,n),v(e.queues.consumers,"queues.consumers",T,n)}},Q={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:n=>`${n} must have a non-empty "${e}"`})),objectMessage:e=>`${e} must be a { binding, store_id, secret_name } object`},V=[{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`,hintField:"id",hintMessage:(e,n)=>`${e} ("${n}") has no "id" — run \`wrangler kv namespace create\` and set the namespace id, or the binding can't resolve`,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,n)=>`${e} ("${n}") 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,n)=>`${e} ("${n}") 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,n)=>`${e} ("${n}") 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,n)=>`${e} ("${n}") has no "dataset" — it defaults to the binding name; set it explicitly to avoid drift`,key:"analytics_engine_datasets"}],Y=(e,n,a,s)=>{const t=e[n.key];if(t!==void 0){if(!Array.isArray(t)){a.push(n.arrayMessage);return}for(const[i,o]of l(t).entries()){const r=`${n.key}[${String(i)}]`;if(!o||typeof o!="object"||!d(o.binding)){a.push(n.bindingMessage(r));continue}(typeof n.hintField=="string"?[n.hintField]:n.hintField).some(u=>d(o[u]))||s.push(n.hintMessage(r,o.binding))}}},z=[{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" })'}],H=(e,n,a)=>{const s=e[n.key];s!==void 0&&(typeof s!="object"||s===null||Array.isArray(s)||!d(s.binding))&&a.push(n.message)},J=[{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`}],X=(e,n,a)=>{n?.hasD1GlobalTable&&!b(e.d1_databases).some(s=>s.binding==="DB")&&a.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'),n?.hasHyperdriveGlobalTable&&b(e.hyperdrive).length===0&&a.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)')},Z=(e,n)=>{const{d1_databases:a}=e;if(a!==void 0){if(!Array.isArray(a)){n.push("d1_databases must be an array of { binding, database_id | database_name } entries");return}for(const[s,t]of l(a).entries()){const i=`d1_databases[${String(s)}]`;if(!t||typeof t!="object"){n.push(`${i} must be a { binding, database_id | database_name } object`);continue}d(t.binding)||n.push(`${i} must have a non-empty "binding" naming the D1 binding`),!d(t.database_id)&&!d(t.database_name)&&n.push(`${i} must have a "database_id" or a "database_name" — run \`wrangler d1 create\` and set one, or the binding can't resolve`)}}},ee=(e,n)=>{const{vpc_networks:a}=e;if(a!==void 0){if(!Array.isArray(a)){n.push("vpc_networks must be an array of { binding, tunnel_id | network_id } entries");return}for(const[s,t]of l(a).entries()){const i=`vpc_networks[${String(s)}]`;if(!t||typeof t!="object"){n.push(`${i} must be a { binding, tunnel_id | network_id } object`);continue}d(t.binding)||n.push(`${i} must have a non-empty "binding" naming the VPC Network binding`),d(t.tunnel_id)===d(t.network_id)&&n.push(`${i} must set exactly one of "tunnel_id" (a Cloudflare Tunnel) or "network_id" ("cf1:network" for Cloudflare Mesh)`)}}};export{V as H,J as R,z as S,W,X as a,Z as b,L as c,P as d,v as e,x as f,G as g,K as h,Y as i,H as j,ee as k,Q as l,g as m,d as n,b as o,U as p,p as q,h as r,_ as s,F as v,B as w};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{m as u,n as f,o as v}from"./validate-bindings-DKlB-1sF.mjs";const _=new Set(["1","enabled","on","true","yes"]),A=s=>typeof s=="string"&&_.has(s.trim().toLowerCase()),b=(s,t,e,n)=>{s!==void 0&&typeof s!="boolean"&&e.push(`${t} must be a boolean${n===void 0?"":` (${n})`}`)},O=(s,t,e)=>{s!==void 0&&(typeof s!="number"||Number.isNaN(s)||s<0||s>1)&&e.push(`${t} must be a number in [0, 1] (the fraction of requests sampled)`)},$=(s,t,e)=>{const n=s.send_email;if(n===void 0)return;if(!Array.isArray(n)){t.push("send_email must be an array of { name, destination_address? } entries");return}const i=n;for(const[o,a]of i.entries())(!a||typeof a!="object"||typeof a.name!="string"||a.name.length===0)&&e.push(`send_email[${String(o)}] has no non-empty "name" naming the send-email binding — set one before deploying`)},N=(s,t)=>{b(s.logpush,"logpush",t,'set "logpush": true to enable Cloudflare Logpush')},k=(s,t)=>{const e=s.secrets;if(e===void 0)return;const n=typeof e=="object"&&e!==null&&!Array.isArray(e)?e.required:void 0;(!Array.isArray(n)||n.some(i=>typeof i!="string"||i===""))&&t.push('secrets must be an object whose "required" is an array of secret names (e.g. { "required": ["API_KEY"] })')},m=3e5,I=(s,t)=>{const{limits:e}=s;if(e===void 0)return;if(typeof e!="object"||Array.isArray(e)){t.push('limits must be an object (e.g. { "cpu_ms": 30000 })');return}const n=e.cpu_ms;if(n!==void 0){if(typeof n!="number"||!Number.isFinite(n)||!Number.isInteger(n)||n<=0){t.push("limits.cpu_ms must be a positive integer number of milliseconds");return}n>m&&t.push(`limits.cpu_ms must be at most ${String(m)} (Cloudflare's per-invocation ceiling)`)}},p=new Set(["off","smart","targeted"]),C=(s,t)=>{const{placement:e}=s;if(e===void 0)return;if(typeof e!="object"||e===null||Array.isArray(e)){t.push('placement must be an object (e.g. { "mode": "smart" })');return}const{mode:n}=e;n!==void 0&&(typeof n!="string"||!p.has(n))&&t.push(`placement.mode must be one of ${[...p].map(i=>`"${i}"`).join(", ")}`)},c={kind:"boolean"},h={kind:"samplingRate"},y={destinations:{kind:"destinations"},enabled:c,head_sampling_rate:h,persist:c},S={...y,invocation_logs:{hint:'set "invocation_logs": true to keep per-invocation summaries',kind:"boolean"}},L={enabled:c,head_sampling_rate:h,issues:{kind:"level",level:{enabled:c}},logs:{kind:"level",level:S},redact_query_string:c,traces:{kind:"level",level:y}},E=(s,t,e,n)=>{switch(s.kind){case"boolean":{b(t,e,n,s.hint);break}case"destinations":{t!==void 0&&(!Array.isArray(t)||t.some(i=>!f(i)))&&n.push(`${e} must be an array of destination names configured in the Cloudflare dashboard`);break}case"samplingRate":{O(t,e,n);break}}},g=(s,t,e,n,i)=>{for(const[o,a]of Object.entries(s)){const r=Object.hasOwn(t,o)?t[o]:void 0,l=`${e}.${o}`;r===void 0?i.push(`${l} is not a documented wrangler key (expected one of ${Object.keys(t).join(", ")}) — a typo is silently ignored by wrangler`):r.kind!=="level"?E(r,a,l,n):u(a)?g(a,r.level,l,n,i):a!==void 0&&n.push(`${l} must be an object`)}},w=(s,t,e)=>{const{observability:n}=s;if(n!==void 0){if(!u(n)){t.push('observability must be an object (e.g. { "enabled": true, "head_sampling_rate": 1 })');return}g(n,L,"observability",t,e)}},x=(s,t)=>{const{cache:e}=s;if(e!==void 0){if(!u(e)){t.push('cache must be an object (e.g. { "enabled": true })');return}b(e.enabled,"cache.enabled",t)}},D=(s,t)=>{const{exports:e}=s;if(e!==void 0){if(typeof e!="object"||e===null||Array.isArray(e)){t.push("exports must be an object keyed by entrypoint name");return}for(const[n,i]of Object.entries(e)){if(typeof i!="object"||i===null){t.push(`exports["${n}"] must be an object`);continue}i.type!==void 0&&typeof i.type!="string"&&t.push(`exports["${n}"].type must be a string`),i.cache!==void 0&&(typeof i.cache!="object"||i.cache===null||Array.isArray(i.cache)?t.push(`exports["${n}"].cache must be an object`):i.cache.enabled!==void 0&&typeof i.cache.enabled!="boolean"&&t.push(`exports["${n}"].cache.enabled must be a boolean`))}}},T=(s,t)=>{const{assets:e}=s;if(e!==void 0){if(typeof e!="object"||Array.isArray(e)){t.push('assets must be an object (e.g. { "directory": "./dist/client", "binding": "ASSETS" })');return}(typeof e.directory!="string"||e.directory.length===0)&&t.push('assets must declare a non-empty "directory" pointing at the built client output (e.g. "./dist/client")'),e.binding!==void 0&&(typeof e.binding!="string"||e.binding.length===0)&&t.push('assets.binding must be a non-empty string (e.g. "ASSETS")'),e.html_handling!==void 0&&typeof e.html_handling!="string"&&t.push("assets.html_handling must be a string"),e.not_found_handling!==void 0&&typeof e.not_found_handling!="string"&&t.push("assets.not_found_handling must be a string")}},B=(s,t)=>{const e=s.tail_consumers;if(e===void 0)return;if(!Array.isArray(e)){t.push("tail_consumers must be an array of { service, environment? } entries");return}const n=e;for(const[i,o]of n.entries())(!o||typeof o!="object"||typeof o.service!="string"||o.service.length===0)&&t.push(`tail_consumers[${String(i)}] must have a non-empty "service" naming the consumer Worker`)},U=(s,t)=>{const e=s.tail_consumers??[];return e.some(i=>!!i&&i?.service===t.service&&i?.environment===t.environment)?s:{...s,tail_consumers:[...e,t]}},G=(s,t)=>{const{vars:e}=s;if(!e||typeof e!="object")return;const n=e.LUNORA_ALLOWED_ORIGINS,i=e.LUNORA_CORS_ALLOW_CREDENTIALS,o=typeof n=="string"&&n.split(",").some(r=>r.trim()==="*"),a=A(i);o&&a&&t.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')},j=s=>v(s.durable_objects?.bindings).some(t=>t.class_name==="SchedulerDO"&&t.script_name===void 0),d="LUNORA_ORIGIN_URL",P=(s,t,e,n=j(s)?"durable_objects.bindings declares the SchedulerDO":void 0)=>{if(n===void 0||f(s.vars?.[d]))return;const i=t===void 0?"vars":`env.${t}.vars`,o=t===void 0?"":` --env ${t}`;e.push(`${n} but ${i}.${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 ${i}.${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{T as validateAssets,x as validateCache,G as validateCorsVariables,D as validateExports,I as validateLimits,N as validateLogpush,w as validateObservability,C as validatePlacement,P as validateSchedulerOrigin,k as validateSecretsRequired,$ as validateSendEmail,B as validateTailConsumers,U as withTailConsumer};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{runCodegen as c,CodegenDiagnosticError as a}from"@lunora/codegen";import{collectWranglerSecretVariables as i}from"./collectWranglerSecretVariables-A6TjJjZK.mjs";import{isCodegenDisabled as s,CODEGEN_ENV as t}from"./CODEGEN_ENV-ZsCxV1kP.mjs";import{writeFileSync as m,renameSync as p,rmSync as d}from"node:fs";const g=r=>({apiSpec:r.apiSpec,lunoraDirectory:r.schemaDirectory??"lunora",projectRoot:r.projectRoot,wranglerVariables:i(r.projectRoot)}),y=r=>{if(s(process.env[t]))return[`codegen is off (${t}=0 / \`lunora dev --no-codegen\`) — the source was written but \`_generated/\` was NOT regenerated`];try{c(g(r))}catch(e){if(e instanceof a)return[e.message];throw e}return[]},S=(r,e)=>{const o=`${r}.lunora-tmp`;try{m(o,e,"utf8"),p(o,r)}catch(n){throw d(o,{force:!0}),n}};export{y as r,S as w};
|