@lunora/config 1.0.0-alpha.285 → 1.0.0-alpha.287
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 +75 -4
- package/dist/cloudflare/index.d.ts +75 -4
- package/dist/cloudflare/index.mjs +1 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.mjs +1 -1
- package/dist/packem_shared/BINDING_MANIFEST_VERSION-vItUTnHk.mjs +1 -0
- package/dist/packem_shared/COMPOSED_WORKER_ENTRY-C69wqbSP.mjs +1 -0
- package/dist/packem_shared/DEFAULT_DEPLOY_TARGET-Bl4jTTmt.mjs +2 -0
- package/dist/packem_shared/REQUIRED_COMPATIBILITY_DATE-jTnj2MPJ.mjs +1 -0
- package/dist/packem_shared/UNEXPORTED_CLASS_MARKER-CugcZbPf.mjs +1 -0
- package/dist/packem_shared/{assertWranglerSatisfiesSchema-B24XPKq7.mjs → assertWranglerSatisfiesSchema-BiABHeMv.mjs} +1 -1
- package/dist/packem_shared/collectExportGaps-FC62nUj0.mjs +2 -0
- package/dist/packem_shared/inferLunoraBindings-hCgGQAGN.mjs +1 -0
- package/dist/packem_shared/{interpretRemote-Da32GcUi.mjs → interpretRemote-T4emJRPB.mjs} +1 -1
- package/dist/packem_shared/mergeWranglerEnvironment-DOKJUNH8.mjs +1 -0
- package/dist/packem_shared/{reconcileBindingsSafely-Zi2HVRkH.mjs → reconcileBindingsSafely-JuzaIkAp.mjs} +1 -1
- package/dist/packem_shared/{schema-info.d-C3DeuUmC.d.mts → schema-info.d-CxMdnVt9.d.mts} +7 -7
- package/dist/packem_shared/{schema-info.d-C3DeuUmC.d.ts → schema-info.d-CxMdnVt9.d.ts} +7 -7
- package/dist/packem_shared/validate-bindings-Dnf1t0SY.mjs +1 -0
- package/dist/packem_shared/withTailConsumer-B1NoKIsj.mjs +1 -0
- package/dist/packem_shared/{wranglerToAlchemy-DZOim9As.mjs → wranglerToAlchemy-BMOQYRyw.mjs} +1 -1
- package/package.json +5 -5
- package/dist/packem_shared/BINDING_MANIFEST_VERSION-B4Tu8Ytd.mjs +0 -1
- package/dist/packem_shared/COMPOSED_WORKER_ENTRY-5R-BECOC.mjs +0 -1
- package/dist/packem_shared/DEFAULT_DEPLOY_TARGET-CtEZtsUF.mjs +0 -2
- package/dist/packem_shared/REQUIRED_COMPATIBILITY_DATE-g_1F-n2X.mjs +0 -1
- package/dist/packem_shared/UNEXPORTED_CLASS_MARKER-Bc302QS4.mjs +0 -1
- package/dist/packem_shared/collectExportGaps-DUaEyDNw.mjs +0 -2
- package/dist/packem_shared/inferLunoraBindings-GaAITuz-.mjs +0 -1
- package/dist/packem_shared/mergeWranglerEnvironment-BIcLqPfv.mjs +0 -1
- package/dist/packem_shared/validate-bindings-D6-vb6if.mjs +0 -1
- package/dist/packem_shared/withTailConsumer-DaP3r6ia.mjs +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { D as DeployDriver, G as GeneratedClassModule, I as InferredBindings, S as SchemaInfo } from "../packem_shared/schema-info.d-
|
|
1
|
+
import { D as DeployDriver, G as GeneratedClassModule, I as InferredBindings, S as SchemaInfo } from "../packem_shared/schema-info.d-CxMdnVt9.mjs";
|
|
2
2
|
import { 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;
|
|
@@ -144,14 +144,14 @@ interface BindingRequirement {
|
|
|
144
144
|
* exports it before publishing.
|
|
145
145
|
*/
|
|
146
146
|
className?: string;
|
|
147
|
-
/** Bucket name (`r2`), database name (`d1`), dataset (`analytics_engine`), queue name (`queue`), index (`vectorize`), pipeline (`
|
|
147
|
+
/** Bucket name (`r2`), database name (`d1`), dataset (`analytics_engine`), queue name (`queue`), index (`vectorize`), stream (`pipeline`), namespace (`artifacts`). */
|
|
148
148
|
resource?: string;
|
|
149
|
-
/** Remote resource id, when the config declares one (`d1`, `kv`, `hyperdrive`). */
|
|
149
|
+
/** Remote resource id, when the config declares one (`d1`, `kv`, `hyperdrive`, `vpc_service`, `vpc_network`). */
|
|
150
150
|
resourceId?: string;
|
|
151
151
|
/** For `durable_object`: whether the class uses SQLite storage (`new_sqlite_classes`). */
|
|
152
152
|
sqlite?: boolean;
|
|
153
153
|
/** The kind of resource, keyed to the wrangler section it came from. */
|
|
154
|
-
type: "ai" | "analytics_engine" | "assets" | "browser" | "container" | "d1" | "durable_object" | "hyperdrive" | "images" | "kv" | "pipeline" | "queue_consumer" | "queue_producer" | "r2" | "vectorize" | "workflow";
|
|
154
|
+
type: "ai" | "analytics_engine" | "artifacts" | "assets" | "browser" | "container" | "d1" | "durable_object" | "hyperdrive" | "images" | "kv" | "media" | "pipeline" | "queue_consumer" | "queue_producer" | "r2" | "stream" | "vectorize" | "vpc_network" | "vpc_service" | "workflow";
|
|
155
155
|
}
|
|
156
156
|
/** The document the `lunora build --emit-bindings` flag writes. */
|
|
157
157
|
interface BindingManifest {
|
|
@@ -190,6 +190,10 @@ interface ManifestConfigShape extends WranglerConfigShape {
|
|
|
190
190
|
binding?: string;
|
|
191
191
|
dataset?: string;
|
|
192
192
|
}>;
|
|
193
|
+
artifacts?: ReadonlyArray<{
|
|
194
|
+
binding?: string;
|
|
195
|
+
namespace?: string;
|
|
196
|
+
}>;
|
|
193
197
|
/** Static assets carry a real `binding` the Worker reads (`env.ASSETS`). */
|
|
194
198
|
assets?: {
|
|
195
199
|
binding?: string;
|
|
@@ -203,6 +207,11 @@ interface ManifestConfigShape extends WranglerConfigShape {
|
|
|
203
207
|
image?: string;
|
|
204
208
|
max_instances?: number;
|
|
205
209
|
}>;
|
|
210
|
+
/** Top-level exports; only `type: "workflow"` entries map to a binding requirement (see {@link collectWorkflowExports}). */
|
|
211
|
+
exports?: Record<string, {
|
|
212
|
+
name?: string;
|
|
213
|
+
type?: string;
|
|
214
|
+
} | null | undefined>;
|
|
206
215
|
hyperdrive?: ReadonlyArray<{
|
|
207
216
|
binding?: string;
|
|
208
217
|
id?: string;
|
|
@@ -210,9 +219,14 @@ interface ManifestConfigShape extends WranglerConfigShape {
|
|
|
210
219
|
images?: {
|
|
211
220
|
binding?: string;
|
|
212
221
|
};
|
|
222
|
+
media?: {
|
|
223
|
+
binding?: string;
|
|
224
|
+
};
|
|
225
|
+
/** `pipeline` is wrangler's deprecated spelling of `stream`; both are read. */
|
|
213
226
|
pipelines?: ReadonlyArray<{
|
|
214
227
|
binding?: string;
|
|
215
228
|
pipeline?: string;
|
|
229
|
+
stream?: string;
|
|
216
230
|
}>;
|
|
217
231
|
/** Adds `consumers` — the Alchemy translation models producers only. */
|
|
218
232
|
queues?: {
|
|
@@ -224,10 +238,22 @@ interface ManifestConfigShape extends WranglerConfigShape {
|
|
|
224
238
|
queue?: string;
|
|
225
239
|
}>;
|
|
226
240
|
};
|
|
241
|
+
stream?: {
|
|
242
|
+
binding?: string;
|
|
243
|
+
};
|
|
227
244
|
vectorize?: ReadonlyArray<{
|
|
228
245
|
binding?: string;
|
|
229
246
|
index_name?: string;
|
|
230
247
|
}>;
|
|
248
|
+
vpc_networks?: ReadonlyArray<{
|
|
249
|
+
binding?: string;
|
|
250
|
+
network_id?: string;
|
|
251
|
+
tunnel_id?: string;
|
|
252
|
+
}>;
|
|
253
|
+
vpc_services?: ReadonlyArray<{
|
|
254
|
+
binding?: string;
|
|
255
|
+
service_id?: string;
|
|
256
|
+
}>;
|
|
231
257
|
workflows?: ReadonlyArray<{
|
|
232
258
|
binding?: string;
|
|
233
259
|
class_name?: string;
|
|
@@ -649,12 +675,20 @@ interface TailConsumer {
|
|
|
649
675
|
interface WranglerContainerEntry {
|
|
650
676
|
class_name?: string;
|
|
651
677
|
image?: string;
|
|
678
|
+
/** Named images under the `durable_object` scheduling policy. */
|
|
679
|
+
images?: Record<string, {
|
|
680
|
+
build_context?: string;
|
|
681
|
+
build_vars?: Record<string, string>;
|
|
682
|
+
dockerfile?: string;
|
|
683
|
+
image?: string;
|
|
684
|
+
} | null | undefined>;
|
|
652
685
|
instance_type?: string | {
|
|
653
686
|
disk_mb?: number;
|
|
654
687
|
memory_mib?: number;
|
|
655
688
|
vcpu?: number;
|
|
656
689
|
};
|
|
657
690
|
max_instances?: number;
|
|
691
|
+
scheduling_policy?: string;
|
|
658
692
|
}
|
|
659
693
|
/**
|
|
660
694
|
* A wrangler `workflows[]` entry (parsed from untrusted JSONC). Unlike
|
|
@@ -664,7 +698,13 @@ interface WranglerContainerEntry {
|
|
|
664
698
|
interface WranglerWorkflowEntry {
|
|
665
699
|
binding?: string;
|
|
666
700
|
class_name?: string;
|
|
701
|
+
/** `{ success_retention?, error_retention? }` durations; shape-checked by `validateWorkflowSettings`. */
|
|
702
|
+
default_retention?: unknown;
|
|
703
|
+
/** `{ steps? }`; shape-checked by `validateWorkflowSettings`. */
|
|
704
|
+
limits?: unknown;
|
|
667
705
|
name?: string;
|
|
706
|
+
/** Cron strings that each start an instance; shape-checked by `validateWorkflowSettings`. */
|
|
707
|
+
schedules?: unknown;
|
|
668
708
|
/** Present when the class lives in ANOTHER Worker — then it is that script's to export. */
|
|
669
709
|
script_name?: string;
|
|
670
710
|
}
|
|
@@ -692,6 +732,11 @@ interface WranglerConfig {
|
|
|
692
732
|
binding?: string;
|
|
693
733
|
dataset?: string;
|
|
694
734
|
} | null | undefined>;
|
|
735
|
+
artifacts?: ReadonlyArray<{
|
|
736
|
+
binding?: string;
|
|
737
|
+
namespace?: string;
|
|
738
|
+
remote?: boolean;
|
|
739
|
+
} | null | undefined>;
|
|
695
740
|
assets?: {
|
|
696
741
|
binding?: string;
|
|
697
742
|
directory?: string;
|
|
@@ -711,6 +756,8 @@ interface WranglerConfig {
|
|
|
711
756
|
binding?: string;
|
|
712
757
|
database_id?: string;
|
|
713
758
|
database_name?: string;
|
|
759
|
+
migrations_dir?: string;
|
|
760
|
+
migrations_pattern?: string;
|
|
714
761
|
} | null | undefined>;
|
|
715
762
|
dispatch_namespaces?: ReadonlyArray<{
|
|
716
763
|
binding?: string;
|
|
@@ -725,6 +772,10 @@ interface WranglerConfig {
|
|
|
725
772
|
cache?: {
|
|
726
773
|
enabled?: boolean;
|
|
727
774
|
} | null;
|
|
775
|
+
default_retention?: unknown;
|
|
776
|
+
limits?: unknown;
|
|
777
|
+
name?: unknown;
|
|
778
|
+
schedules?: unknown;
|
|
728
779
|
type?: string;
|
|
729
780
|
} | null> | null;
|
|
730
781
|
flagship?: ReadonlyArray<{
|
|
@@ -748,6 +799,9 @@ interface WranglerConfig {
|
|
|
748
799
|
};
|
|
749
800
|
logpush?: boolean;
|
|
750
801
|
main?: string;
|
|
802
|
+
media?: {
|
|
803
|
+
binding?: string;
|
|
804
|
+
};
|
|
751
805
|
migrations?: ReadonlyArray<{
|
|
752
806
|
deleted_classes?: ReadonlyArray<string>;
|
|
753
807
|
new_classes?: ReadonlyArray<string>;
|
|
@@ -789,6 +843,9 @@ interface WranglerConfig {
|
|
|
789
843
|
binding?: string;
|
|
790
844
|
bucket_name?: string;
|
|
791
845
|
} | null | undefined>;
|
|
846
|
+
secrets?: {
|
|
847
|
+
required?: unknown;
|
|
848
|
+
} | null;
|
|
792
849
|
secrets_store_secrets?: ReadonlyArray<{
|
|
793
850
|
binding?: string;
|
|
794
851
|
secret_name?: string;
|
|
@@ -805,12 +862,26 @@ interface WranglerConfig {
|
|
|
805
862
|
environment?: string;
|
|
806
863
|
service?: string;
|
|
807
864
|
} | null | undefined>;
|
|
865
|
+
stream?: {
|
|
866
|
+
binding?: string;
|
|
867
|
+
};
|
|
808
868
|
tail_consumers?: ReadonlyArray<TailConsumer | null | undefined>;
|
|
809
869
|
vars?: Record<string, unknown>;
|
|
810
870
|
vectorize?: ReadonlyArray<{
|
|
811
871
|
binding?: string;
|
|
812
872
|
index_name?: string;
|
|
813
873
|
} | null | undefined>;
|
|
874
|
+
vpc_networks?: ReadonlyArray<{
|
|
875
|
+
binding?: string;
|
|
876
|
+
network_id?: string;
|
|
877
|
+
remote?: boolean;
|
|
878
|
+
tunnel_id?: string;
|
|
879
|
+
} | null | undefined>;
|
|
880
|
+
vpc_services?: ReadonlyArray<{
|
|
881
|
+
binding?: string;
|
|
882
|
+
remote?: boolean;
|
|
883
|
+
service_id?: string;
|
|
884
|
+
} | null | undefined>;
|
|
814
885
|
workflows?: ReadonlyArray<WranglerWorkflowEntry | null | undefined>;
|
|
815
886
|
}
|
|
816
887
|
interface WranglerValidationReport {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { D as DeployDriver, G as GeneratedClassModule, I as InferredBindings, S as SchemaInfo } from "../packem_shared/schema-info.d-
|
|
1
|
+
import { D as DeployDriver, G as GeneratedClassModule, I as InferredBindings, S as SchemaInfo } from "../packem_shared/schema-info.d-CxMdnVt9.js";
|
|
2
2
|
import { 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;
|
|
@@ -144,14 +144,14 @@ interface BindingRequirement {
|
|
|
144
144
|
* exports it before publishing.
|
|
145
145
|
*/
|
|
146
146
|
className?: string;
|
|
147
|
-
/** Bucket name (`r2`), database name (`d1`), dataset (`analytics_engine`), queue name (`queue`), index (`vectorize`), pipeline (`
|
|
147
|
+
/** Bucket name (`r2`), database name (`d1`), dataset (`analytics_engine`), queue name (`queue`), index (`vectorize`), stream (`pipeline`), namespace (`artifacts`). */
|
|
148
148
|
resource?: string;
|
|
149
|
-
/** Remote resource id, when the config declares one (`d1`, `kv`, `hyperdrive`). */
|
|
149
|
+
/** Remote resource id, when the config declares one (`d1`, `kv`, `hyperdrive`, `vpc_service`, `vpc_network`). */
|
|
150
150
|
resourceId?: string;
|
|
151
151
|
/** For `durable_object`: whether the class uses SQLite storage (`new_sqlite_classes`). */
|
|
152
152
|
sqlite?: boolean;
|
|
153
153
|
/** The kind of resource, keyed to the wrangler section it came from. */
|
|
154
|
-
type: "ai" | "analytics_engine" | "assets" | "browser" | "container" | "d1" | "durable_object" | "hyperdrive" | "images" | "kv" | "pipeline" | "queue_consumer" | "queue_producer" | "r2" | "vectorize" | "workflow";
|
|
154
|
+
type: "ai" | "analytics_engine" | "artifacts" | "assets" | "browser" | "container" | "d1" | "durable_object" | "hyperdrive" | "images" | "kv" | "media" | "pipeline" | "queue_consumer" | "queue_producer" | "r2" | "stream" | "vectorize" | "vpc_network" | "vpc_service" | "workflow";
|
|
155
155
|
}
|
|
156
156
|
/** The document the `lunora build --emit-bindings` flag writes. */
|
|
157
157
|
interface BindingManifest {
|
|
@@ -190,6 +190,10 @@ interface ManifestConfigShape extends WranglerConfigShape {
|
|
|
190
190
|
binding?: string;
|
|
191
191
|
dataset?: string;
|
|
192
192
|
}>;
|
|
193
|
+
artifacts?: ReadonlyArray<{
|
|
194
|
+
binding?: string;
|
|
195
|
+
namespace?: string;
|
|
196
|
+
}>;
|
|
193
197
|
/** Static assets carry a real `binding` the Worker reads (`env.ASSETS`). */
|
|
194
198
|
assets?: {
|
|
195
199
|
binding?: string;
|
|
@@ -203,6 +207,11 @@ interface ManifestConfigShape extends WranglerConfigShape {
|
|
|
203
207
|
image?: string;
|
|
204
208
|
max_instances?: number;
|
|
205
209
|
}>;
|
|
210
|
+
/** Top-level exports; only `type: "workflow"` entries map to a binding requirement (see {@link collectWorkflowExports}). */
|
|
211
|
+
exports?: Record<string, {
|
|
212
|
+
name?: string;
|
|
213
|
+
type?: string;
|
|
214
|
+
} | null | undefined>;
|
|
206
215
|
hyperdrive?: ReadonlyArray<{
|
|
207
216
|
binding?: string;
|
|
208
217
|
id?: string;
|
|
@@ -210,9 +219,14 @@ interface ManifestConfigShape extends WranglerConfigShape {
|
|
|
210
219
|
images?: {
|
|
211
220
|
binding?: string;
|
|
212
221
|
};
|
|
222
|
+
media?: {
|
|
223
|
+
binding?: string;
|
|
224
|
+
};
|
|
225
|
+
/** `pipeline` is wrangler's deprecated spelling of `stream`; both are read. */
|
|
213
226
|
pipelines?: ReadonlyArray<{
|
|
214
227
|
binding?: string;
|
|
215
228
|
pipeline?: string;
|
|
229
|
+
stream?: string;
|
|
216
230
|
}>;
|
|
217
231
|
/** Adds `consumers` — the Alchemy translation models producers only. */
|
|
218
232
|
queues?: {
|
|
@@ -224,10 +238,22 @@ interface ManifestConfigShape extends WranglerConfigShape {
|
|
|
224
238
|
queue?: string;
|
|
225
239
|
}>;
|
|
226
240
|
};
|
|
241
|
+
stream?: {
|
|
242
|
+
binding?: string;
|
|
243
|
+
};
|
|
227
244
|
vectorize?: ReadonlyArray<{
|
|
228
245
|
binding?: string;
|
|
229
246
|
index_name?: string;
|
|
230
247
|
}>;
|
|
248
|
+
vpc_networks?: ReadonlyArray<{
|
|
249
|
+
binding?: string;
|
|
250
|
+
network_id?: string;
|
|
251
|
+
tunnel_id?: string;
|
|
252
|
+
}>;
|
|
253
|
+
vpc_services?: ReadonlyArray<{
|
|
254
|
+
binding?: string;
|
|
255
|
+
service_id?: string;
|
|
256
|
+
}>;
|
|
231
257
|
workflows?: ReadonlyArray<{
|
|
232
258
|
binding?: string;
|
|
233
259
|
class_name?: string;
|
|
@@ -649,12 +675,20 @@ interface TailConsumer {
|
|
|
649
675
|
interface WranglerContainerEntry {
|
|
650
676
|
class_name?: string;
|
|
651
677
|
image?: string;
|
|
678
|
+
/** Named images under the `durable_object` scheduling policy. */
|
|
679
|
+
images?: Record<string, {
|
|
680
|
+
build_context?: string;
|
|
681
|
+
build_vars?: Record<string, string>;
|
|
682
|
+
dockerfile?: string;
|
|
683
|
+
image?: string;
|
|
684
|
+
} | null | undefined>;
|
|
652
685
|
instance_type?: string | {
|
|
653
686
|
disk_mb?: number;
|
|
654
687
|
memory_mib?: number;
|
|
655
688
|
vcpu?: number;
|
|
656
689
|
};
|
|
657
690
|
max_instances?: number;
|
|
691
|
+
scheduling_policy?: string;
|
|
658
692
|
}
|
|
659
693
|
/**
|
|
660
694
|
* A wrangler `workflows[]` entry (parsed from untrusted JSONC). Unlike
|
|
@@ -664,7 +698,13 @@ interface WranglerContainerEntry {
|
|
|
664
698
|
interface WranglerWorkflowEntry {
|
|
665
699
|
binding?: string;
|
|
666
700
|
class_name?: string;
|
|
701
|
+
/** `{ success_retention?, error_retention? }` durations; shape-checked by `validateWorkflowSettings`. */
|
|
702
|
+
default_retention?: unknown;
|
|
703
|
+
/** `{ steps? }`; shape-checked by `validateWorkflowSettings`. */
|
|
704
|
+
limits?: unknown;
|
|
667
705
|
name?: string;
|
|
706
|
+
/** Cron strings that each start an instance; shape-checked by `validateWorkflowSettings`. */
|
|
707
|
+
schedules?: unknown;
|
|
668
708
|
/** Present when the class lives in ANOTHER Worker — then it is that script's to export. */
|
|
669
709
|
script_name?: string;
|
|
670
710
|
}
|
|
@@ -692,6 +732,11 @@ interface WranglerConfig {
|
|
|
692
732
|
binding?: string;
|
|
693
733
|
dataset?: string;
|
|
694
734
|
} | null | undefined>;
|
|
735
|
+
artifacts?: ReadonlyArray<{
|
|
736
|
+
binding?: string;
|
|
737
|
+
namespace?: string;
|
|
738
|
+
remote?: boolean;
|
|
739
|
+
} | null | undefined>;
|
|
695
740
|
assets?: {
|
|
696
741
|
binding?: string;
|
|
697
742
|
directory?: string;
|
|
@@ -711,6 +756,8 @@ interface WranglerConfig {
|
|
|
711
756
|
binding?: string;
|
|
712
757
|
database_id?: string;
|
|
713
758
|
database_name?: string;
|
|
759
|
+
migrations_dir?: string;
|
|
760
|
+
migrations_pattern?: string;
|
|
714
761
|
} | null | undefined>;
|
|
715
762
|
dispatch_namespaces?: ReadonlyArray<{
|
|
716
763
|
binding?: string;
|
|
@@ -725,6 +772,10 @@ interface WranglerConfig {
|
|
|
725
772
|
cache?: {
|
|
726
773
|
enabled?: boolean;
|
|
727
774
|
} | null;
|
|
775
|
+
default_retention?: unknown;
|
|
776
|
+
limits?: unknown;
|
|
777
|
+
name?: unknown;
|
|
778
|
+
schedules?: unknown;
|
|
728
779
|
type?: string;
|
|
729
780
|
} | null> | null;
|
|
730
781
|
flagship?: ReadonlyArray<{
|
|
@@ -748,6 +799,9 @@ interface WranglerConfig {
|
|
|
748
799
|
};
|
|
749
800
|
logpush?: boolean;
|
|
750
801
|
main?: string;
|
|
802
|
+
media?: {
|
|
803
|
+
binding?: string;
|
|
804
|
+
};
|
|
751
805
|
migrations?: ReadonlyArray<{
|
|
752
806
|
deleted_classes?: ReadonlyArray<string>;
|
|
753
807
|
new_classes?: ReadonlyArray<string>;
|
|
@@ -789,6 +843,9 @@ interface WranglerConfig {
|
|
|
789
843
|
binding?: string;
|
|
790
844
|
bucket_name?: string;
|
|
791
845
|
} | null | undefined>;
|
|
846
|
+
secrets?: {
|
|
847
|
+
required?: unknown;
|
|
848
|
+
} | null;
|
|
792
849
|
secrets_store_secrets?: ReadonlyArray<{
|
|
793
850
|
binding?: string;
|
|
794
851
|
secret_name?: string;
|
|
@@ -805,12 +862,26 @@ interface WranglerConfig {
|
|
|
805
862
|
environment?: string;
|
|
806
863
|
service?: string;
|
|
807
864
|
} | null | undefined>;
|
|
865
|
+
stream?: {
|
|
866
|
+
binding?: string;
|
|
867
|
+
};
|
|
808
868
|
tail_consumers?: ReadonlyArray<TailConsumer | null | undefined>;
|
|
809
869
|
vars?: Record<string, unknown>;
|
|
810
870
|
vectorize?: ReadonlyArray<{
|
|
811
871
|
binding?: string;
|
|
812
872
|
index_name?: string;
|
|
813
873
|
} | null | undefined>;
|
|
874
|
+
vpc_networks?: ReadonlyArray<{
|
|
875
|
+
binding?: string;
|
|
876
|
+
network_id?: string;
|
|
877
|
+
remote?: boolean;
|
|
878
|
+
tunnel_id?: string;
|
|
879
|
+
} | null | undefined>;
|
|
880
|
+
vpc_services?: ReadonlyArray<{
|
|
881
|
+
binding?: string;
|
|
882
|
+
remote?: boolean;
|
|
883
|
+
service_id?: string;
|
|
884
|
+
} | null | undefined>;
|
|
814
885
|
workflows?: ReadonlyArray<WranglerWorkflowEntry | null | undefined>;
|
|
815
886
|
}
|
|
816
887
|
interface WranglerValidationReport {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{applyModify as o}from"../packem_shared/applyModify-DKP2l6S9.mjs";import{assertWranglerSatisfiesSchema as n}from"../packem_shared/assertWranglerSatisfiesSchema-
|
|
1
|
+
import{applyModify as o}from"../packem_shared/applyModify-DKP2l6S9.mjs";import{assertWranglerSatisfiesSchema as n}from"../packem_shared/assertWranglerSatisfiesSchema-BiABHeMv.mjs";import{BINDING_MANIFEST_VERSION as t,buildBindingManifest as i}from"../packem_shared/BINDING_MANIFEST_VERSION-vItUTnHk.mjs";import{default as E}from"../packem_shared/CLOUDFLARE_DRIVER-DUE6r-Pg.mjs";import{collectExportGaps as s,reconcileWranglerBindings as c}from"../packem_shared/collectExportGaps-FC62nUj0.mjs";import{reconcileWranglerCompatibilityDate as p}from"../packem_shared/reconcileWranglerCompatibilityDate-hocXEuRA.mjs";import{describePreservedCrons as x,reconcileWranglerCrons as d}from"../packem_shared/describePreservedCrons-Ci5r2aph.mjs";import{reconcileBindingsSafely as I,reconcileWranglerExtras as _}from"../packem_shared/reconcileBindingsSafely-JuzaIkAp.mjs";import{REMOTE_ELIGIBLE_KEYS as S,injectRemoteFlags as A,isRemoteEnvEnabled as D,materializeRemoteWranglerConfig as L,planRemoteBindings as T,resolveRemoteEnabled as b}from"../packem_shared/REMOTE_ELIGIBLE_KEYS-D72UkJEq.mjs";import{withTailConsumer as B}from"../packem_shared/withTailConsumer-B1NoKIsj.mjs";import{WORKERS_CACHE_MIN_DATE as M,isCacheEnabled as N}from"../packem_shared/WORKERS_CACHE_MIN_DATE-0k9ABJtF.mjs";import{mergeWranglerEnvironment as y}from"../packem_shared/mergeWranglerEnvironment-DOKJUNH8.mjs";import{WRANGLER_FILES as h,findWranglerFile as P,readWranglerJsonc as U}from"../packem_shared/WRANGLER_FILES-UNW-xY5u.mjs";import{UNEXPORTED_CLASS_MARKER as u,validateWranglerProject as K}from"../packem_shared/UNEXPORTED_CLASS_MARKER-CugcZbPf.mjs";import{collectWranglerSecretVariables as w,scanWranglerVariablesForSecrets as Q}from"../packem_shared/collectWranglerSecretVariables-D-usPfT8.mjs";import{wranglerToAlchemy as z}from"../packem_shared/wranglerToAlchemy-BMOQYRyw.mjs";import{REQUIRED_COMPATIBILITY_DATE as J,REQUIRED_FLAG as X,validateWrangler as k,validateWranglerConfig as q}from"../packem_shared/REQUIRED_COMPATIBILITY_DATE-jTnj2MPJ.mjs";export{t as BINDING_MANIFEST_VERSION,E as CLOUDFLARE_DRIVER,S as REMOTE_ELIGIBLE_KEYS,J as REQUIRED_COMPATIBILITY_DATE,X as REQUIRED_FLAG,u as UNEXPORTED_CLASS_MARKER,M as WORKERS_CACHE_MIN_DATE,h as WRANGLER_FILES,o as applyModify,n as assertWranglerSatisfiesSchema,i as buildBindingManifest,s as collectExportGaps,w as collectWranglerSecretVariables,x as describePreservedCrons,P as findWranglerFile,A as injectRemoteFlags,N as isCacheEnabled,D as isRemoteEnvEnabled,L as materializeRemoteWranglerConfig,y as mergeWranglerEnvironment,T as planRemoteBindings,U as readWranglerJsonc,I as reconcileBindingsSafely,c as reconcileWranglerBindings,p as reconcileWranglerCompatibilityDate,d as reconcileWranglerCrons,_ as reconcileWranglerExtras,b as resolveRemoteEnabled,Q as scanWranglerVariablesForSecrets,k as validateWrangler,q as validateWranglerConfig,K as validateWranglerProject,B as withTailConsumer,z as wranglerToAlchemy};
|
package/dist/index.d.mts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { AgentIR, ContainerIR, WorkflowIR, CodegenResult } from '@lunora/codegen';
|
|
2
2
|
export type { AgentIR, ContainerIR, WorkflowIR } from '@lunora/codegen';
|
|
3
3
|
import { Writable } from 'node:stream';
|
|
4
|
-
import { T as ToolchainCommand, D as DeployDriver, P as ProjectionPurpose } from "./packem_shared/schema-info.d-
|
|
5
|
-
export { C as COMPOSED_WORKER_ENTRY, type a as DeployRequest, type b as DevRequest, type c as DiscoverSchemaInfoResult, type d as DriverToolchain, e as GENERATED_CLASS_MODULES, type G as GeneratedClassModule, type f as InferOptions, type g as InferredAgent, type I as InferredBindings, type h as InferredContainer, type i as InferredWorkflow, type j as ProjectedConfig, type S as SchemaInfo, type k as SecretRequest, type l as TailRequest, m as discoverSchemaInfo, n as inferLunoraBindings, p as packageNamesFromBindings } from "./packem_shared/schema-info.d-
|
|
4
|
+
import { T as ToolchainCommand, D as DeployDriver, P as ProjectionPurpose } from "./packem_shared/schema-info.d-CxMdnVt9.mjs";
|
|
5
|
+
export { C as COMPOSED_WORKER_ENTRY, type a as DeployRequest, type b as DevRequest, type c as DiscoverSchemaInfoResult, type d as DriverToolchain, e as GENERATED_CLASS_MODULES, type G as GeneratedClassModule, type f as InferOptions, type g as InferredAgent, type I as InferredBindings, type h as InferredContainer, type i as InferredWorkflow, type j as ProjectedConfig, type S as SchemaInfo, type k as SecretRequest, type l as TailRequest, m as discoverSchemaInfo, n as inferLunoraBindings, p as packageNamesFromBindings } from "./packem_shared/schema-info.d-CxMdnVt9.mjs";
|
|
6
6
|
export { type A as AdditivePolicyEdit, type D as DestructivePolicyEdit, type P as PolicyEdit, type a as PolicyScaffoldFailureReason, type b as ScaffoldFileResult, type S as ScaffoldPolicyEdit, type c as WireResult, type W as WireRlsEdit, d as classifyPolicyEdit, r as resolveServerModule, s as scaffoldPolicyFile, w as wireRlsIntoProcedure } from "./packem_shared/policy-scaffold.d-D2H4_G01.mjs";
|
|
7
7
|
interface DiscoverAgentInfoResult {
|
|
8
8
|
/** Discovered agent definitions; `[]` when none are declared or parsing failed. */
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { AgentIR, ContainerIR, WorkflowIR, CodegenResult } from '@lunora/codegen';
|
|
2
2
|
export type { AgentIR, ContainerIR, WorkflowIR } from '@lunora/codegen';
|
|
3
3
|
import { Writable } from 'node:stream';
|
|
4
|
-
import { T as ToolchainCommand, D as DeployDriver, P as ProjectionPurpose } from "./packem_shared/schema-info.d-
|
|
5
|
-
export { C as COMPOSED_WORKER_ENTRY, type a as DeployRequest, type b as DevRequest, type c as DiscoverSchemaInfoResult, type d as DriverToolchain, e as GENERATED_CLASS_MODULES, type G as GeneratedClassModule, type f as InferOptions, type g as InferredAgent, type I as InferredBindings, type h as InferredContainer, type i as InferredWorkflow, type j as ProjectedConfig, type S as SchemaInfo, type k as SecretRequest, type l as TailRequest, m as discoverSchemaInfo, n as inferLunoraBindings, p as packageNamesFromBindings } from "./packem_shared/schema-info.d-
|
|
4
|
+
import { T as ToolchainCommand, D as DeployDriver, P as ProjectionPurpose } from "./packem_shared/schema-info.d-CxMdnVt9.js";
|
|
5
|
+
export { C as COMPOSED_WORKER_ENTRY, type a as DeployRequest, type b as DevRequest, type c as DiscoverSchemaInfoResult, type d as DriverToolchain, e as GENERATED_CLASS_MODULES, type G as GeneratedClassModule, type f as InferOptions, type g as InferredAgent, type I as InferredBindings, type h as InferredContainer, type i as InferredWorkflow, type j as ProjectedConfig, type S as SchemaInfo, type k as SecretRequest, type l as TailRequest, m as discoverSchemaInfo, n as inferLunoraBindings, p as packageNamesFromBindings } from "./packem_shared/schema-info.d-CxMdnVt9.js";
|
|
6
6
|
export { type A as AdditivePolicyEdit, type D as DestructivePolicyEdit, type P as PolicyEdit, type a as PolicyScaffoldFailureReason, type b as ScaffoldFileResult, type S as ScaffoldPolicyEdit, type c as WireResult, type W as WireRlsEdit, d as classifyPolicyEdit, r as resolveServerModule, s as scaffoldPolicyFile, w as wireRlsIntoProcedure } from "./packem_shared/policy-scaffold.d-D2H4_G01.js";
|
|
7
7
|
interface DiscoverAgentInfoResult {
|
|
8
8
|
/** Discovered agent definitions; `[]` when none are declared or parsing failed. */
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{AGENT_MODE_ENV as o,detectAiAgent as t}from"./packem_shared/AGENT_MODE_ENV-D8MvSwPE.mjs";import{discoverAgentInfo as E}from"./packem_shared/discoverAgentInfo-CTdCSfYM.mjs";import{AGENT_RULES_DIR as s,AGENT_RULES_HINT as n,AGENT_RULES_HINT_ENV as l,LUNORA_SKILL_NAMES as _,ROOT_SKILL_NAME as p,claimAgentRulesHint as c,detectAgentRules as d}from"./packem_shared/AGENT_RULES_DIR-C54Ta_vz.mjs";import{CODEGEN_ENV as D,isCodegenDisabled as m}from"./packem_shared/CODEGEN_ENV-ZsCxV1kP.mjs";import{discoverContainerInfo as f}from"./packem_shared/discoverContainerInfo-EhZtEBQs.mjs";import{streamContainerLogs as v}from"./packem_shared/streamContainerLogs-0nko1qpv.mjs";import{detectFramework as R,projectUsesUmbrella as g,readProjectDependencyNames as T}from"./packem_shared/detectFramework-CUiVEHDQ.mjs";import{DEV_BINDINGS_FILE as x,DEV_DAEMON_ENV as I,DEV_HANDOFF_ENV as u,DEV_LOG_FILE as O,DEV_LOG_FILE_ENV as P,DEV_STATE_DIR as F,DEV_STATE_FILE as C,claimDevServerState as U,clearDevServerState as G,isDevServerReady as b,isProcessAlive as M,isRecordedProcessCurrent as y,readDevServerState as k,readLiveDevServerState as B,updateDevServerState as K,writeDevServerState as w}from"./packem_shared/DEV_BINDINGS_FILE-pyOiNLP4.mjs";import{DEV_VARS_EXAMPLE_FILE as j,DEV_VARS_FILE as H,DEV_VARS_KEY_PATTERN as W,escapeRegExp as Y,parseDevVariableEntries as J,removeDevVariableLine as q,upsertDevVariableLine as X}from"./packem_shared/DEV_VARS_EXAMPLE_FILE-CqLorAxT.mjs";import{DEV_WORKER_ENV_VALUE as Q,DEV_WORKER_ENV_VAR as Z,ensureDevWorkerEnv as $}from"./packem_shared/DEV_WORKER_ENV_VALUE-DwGANZVw.mjs";import{DEFAULT_DEPLOY_TARGET as re,deployTargetIds as oe,isRunnableTarget as te,planToolchainInvocation as ae,resolveDeployDriver as Ee,runnableTargetIds as ie,targetRunsOwnDevServer as se}from"./packem_shared/DEFAULT_DEPLOY_TARGET-
|
|
1
|
+
import{AGENT_MODE_ENV as o,detectAiAgent as t}from"./packem_shared/AGENT_MODE_ENV-D8MvSwPE.mjs";import{discoverAgentInfo as E}from"./packem_shared/discoverAgentInfo-CTdCSfYM.mjs";import{AGENT_RULES_DIR as s,AGENT_RULES_HINT as n,AGENT_RULES_HINT_ENV as l,LUNORA_SKILL_NAMES as _,ROOT_SKILL_NAME as p,claimAgentRulesHint as c,detectAgentRules as d}from"./packem_shared/AGENT_RULES_DIR-C54Ta_vz.mjs";import{CODEGEN_ENV as D,isCodegenDisabled as m}from"./packem_shared/CODEGEN_ENV-ZsCxV1kP.mjs";import{discoverContainerInfo as f}from"./packem_shared/discoverContainerInfo-EhZtEBQs.mjs";import{streamContainerLogs as v}from"./packem_shared/streamContainerLogs-0nko1qpv.mjs";import{detectFramework as R,projectUsesUmbrella as g,readProjectDependencyNames as T}from"./packem_shared/detectFramework-CUiVEHDQ.mjs";import{DEV_BINDINGS_FILE as x,DEV_DAEMON_ENV as I,DEV_HANDOFF_ENV as u,DEV_LOG_FILE as O,DEV_LOG_FILE_ENV as P,DEV_STATE_DIR as F,DEV_STATE_FILE as C,claimDevServerState as U,clearDevServerState as G,isDevServerReady as b,isProcessAlive as M,isRecordedProcessCurrent as y,readDevServerState as k,readLiveDevServerState as B,updateDevServerState as K,writeDevServerState as w}from"./packem_shared/DEV_BINDINGS_FILE-pyOiNLP4.mjs";import{DEV_VARS_EXAMPLE_FILE as j,DEV_VARS_FILE as H,DEV_VARS_KEY_PATTERN as W,escapeRegExp as Y,parseDevVariableEntries as J,removeDevVariableLine as q,upsertDevVariableLine as X}from"./packem_shared/DEV_VARS_EXAMPLE_FILE-CqLorAxT.mjs";import{DEV_WORKER_ENV_VALUE as Q,DEV_WORKER_ENV_VAR as Z,ensureDevWorkerEnv as $}from"./packem_shared/DEV_WORKER_ENV_VALUE-DwGANZVw.mjs";import{DEFAULT_DEPLOY_TARGET as re,deployTargetIds as oe,isRunnableTarget as te,planToolchainInvocation as ae,resolveDeployDriver as Ee,runnableTargetIds as ie,targetRunsOwnDevServer as se}from"./packem_shared/DEFAULT_DEPLOY_TARGET-Bl4jTTmt.mjs";import{inferLunoraBindings as le,packageNamesFromBindings as _e}from"./packem_shared/inferLunoraBindings-hCgGQAGN.mjs";import{LINKED_PROJECT_DIR as ce,LINKED_PROJECT_FILE as de,readLinkedProject as Ae,writeLinkedProject as De}from"./packem_shared/LINKED_PROJECT_DIR-Ba5qPEwo.mjs";import{LUNORA_IGNORED_PATHS as Se,applyLintIgnores as fe,detectLintTools as Le}from"./packem_shared/LUNORA_IGNORED_PATHS-B0-PPvRp.mjs";import{LUNORA_TAG as Ne,advisoryLine as Re,blockingFindingsMessage as ge,lunoraLine as Te,reportCodegenFindings as Ve}from"./packem_shared/LUNORA_TAG-CiQM3BkI.mjs";import{LUNORA_EVENT_SOURCE as Ie,formatLunoraEvent as ue}from"./packem_shared/LUNORA_EVENT_SOURCE-DYdcDU9G.mjs";import{default as Pe}from"./packem_shared/LunoraReporter-f277GLNT.mjs";import{addArgsFor as Ce,detectInstalledManagers as Ue,detectPackageManager as Ge,execArgsFor as be,installArgsFor as Me,runScriptArgsFor as ye,runScriptCommand as ke,toolchainExecArgs as Be}from"./packem_shared/addArgsFor-CYZKhNIo.mjs";import{P as we,s as he}from"./packem_shared/package-secrets-registry-DvtTiK4b.mjs";import{runPostCodegenHook as He}from"./packem_shared/runPostCodegenHook-B0T1q2YI.mjs";import{interpretRemote as Ye,readProjectRemotePreference as Je,readProjectTarget as qe,resolveProjectTarget as Xe,resolveTargetOrThrow as ze}from"./packem_shared/interpretRemote-T4emJRPB.mjs";import{createConfirm as Ze,isInteractive as $e,promptMultiSelect as er,promptSelect as rr,promptText as or,promptYesNo as tr}from"./packem_shared/createConfirm-D5mKTMHj.mjs";import{buildPackageSecretsBlock as Er,ensureDevVariables as ir,ensureDevVarsExample as sr,fillDevSecrets as nr,generateSecretValue as lr,isMintableSecretKey as _r,isPlaceholderValue as pr,planDevSecretsFill as cr,planDevVariablesAugment as dr,planDevVariablesScaffold as Ar,requiredSecrets as Dr,writeDevVariablesFileAtomically as mr}from"./packem_shared/buildPackageSecretsBlock-yv9mjKEW.mjs";import{applyAdditiveEdit as fr,classifyEdit as Lr}from"./packem_shared/applyAdditiveEdit-CH0VhMJ2.mjs";import{parseSchema as Nr}from"./packem_shared/parseSchema-D1Wbr1qv.mjs";import{classifyPolicyEdit as gr,resolveServerModule as Tr,scaffoldPolicyFile as Vr,wireRlsIntoProcedure as xr}from"./packem_shared/classifyPolicyEdit-D8NwrHxR.mjs";import{discoverSchemaInfo as ur}from"./packem_shared/discoverSchemaInfo-DJvevsCm.mjs";import{ACCENT as Pr,BADGES as Fr,BADGE_COLUMN_WIDTH as Cr,LUNA_ART as Ur,LUNA_BUNNY as Gr,LUNA_NAME as br,LUNA_SIGNOFF as Mr,STEP_BADGE_NAMES as yr,badgeLead as kr,badgeWidth as Br,padBadge as Kr,paintAnswer as wr,paintBadge as hr}from"./packem_shared/ACCENT-CotPTfv7.mjs";import{COMPOSED_WORKER_ENTRY as Hr,GENERATED_CLASS_MODULES as Wr}from"./packem_shared/COMPOSED_WORKER_ENTRY-C69wqbSP.mjs";import{discoverWorkflowInfo as Jr}from"./packem_shared/discoverWorkflowInfo-BsPvlo6O.mjs";export{Pr as ACCENT,o as AGENT_MODE_ENV,s as AGENT_RULES_DIR,n as AGENT_RULES_HINT,l as AGENT_RULES_HINT_ENV,Fr as BADGES,Cr as BADGE_COLUMN_WIDTH,D as CODEGEN_ENV,Hr as COMPOSED_WORKER_ENTRY,re as DEFAULT_DEPLOY_TARGET,x as DEV_BINDINGS_FILE,I as DEV_DAEMON_ENV,u as DEV_HANDOFF_ENV,O as DEV_LOG_FILE,P as DEV_LOG_FILE_ENV,F as DEV_STATE_DIR,C as DEV_STATE_FILE,j as DEV_VARS_EXAMPLE_FILE,H as DEV_VARS_FILE,W as DEV_VARS_KEY_PATTERN,Q as DEV_WORKER_ENV_VALUE,Z as DEV_WORKER_ENV_VAR,Wr as GENERATED_CLASS_MODULES,ce as LINKED_PROJECT_DIR,de as LINKED_PROJECT_FILE,Ur as LUNA_ART,Gr as LUNA_BUNNY,br as LUNA_NAME,Mr as LUNA_SIGNOFF,Ie as LUNORA_EVENT_SOURCE,Se as LUNORA_IGNORED_PATHS,_ as LUNORA_SKILL_NAMES,Ne as LUNORA_TAG,Pe as LunoraReporter,we as PACKAGE_SECRETS_REGISTRY,p as ROOT_SKILL_NAME,yr as STEP_BADGE_NAMES,Ce as addArgsFor,Re as advisoryLine,fr as applyAdditiveEdit,fe as applyLintIgnores,kr as badgeLead,Br as badgeWidth,ge as blockingFindingsMessage,Er as buildPackageSecretsBlock,c as claimAgentRulesHint,U as claimDevServerState,Lr as classifyEdit,gr as classifyPolicyEdit,G as clearDevServerState,Ze as createConfirm,oe as deployTargetIds,d as detectAgentRules,t as detectAiAgent,R as detectFramework,Ue as detectInstalledManagers,Le as detectLintTools,Ge as detectPackageManager,E as discoverAgentInfo,f as discoverContainerInfo,ur as discoverSchemaInfo,Jr as discoverWorkflowInfo,ir as ensureDevVariables,sr as ensureDevVarsExample,$ as ensureDevWorkerEnv,Y as escapeRegExp,be as execArgsFor,nr as fillDevSecrets,ue as formatLunoraEvent,lr as generateSecretValue,le as inferLunoraBindings,Me as installArgsFor,Ye as interpretRemote,m as isCodegenDisabled,b as isDevServerReady,$e as isInteractive,_r as isMintableSecretKey,pr as isPlaceholderValue,M as isProcessAlive,y as isRecordedProcessCurrent,te as isRunnableTarget,Te as lunoraLine,_e as packageNamesFromBindings,Kr as padBadge,wr as paintAnswer,hr as paintBadge,J as parseDevVariableEntries,Nr as parseSchema,cr as planDevSecretsFill,dr as planDevVariablesAugment,Ar as planDevVariablesScaffold,ae as planToolchainInvocation,g as projectUsesUmbrella,er as promptMultiSelect,rr as promptSelect,or as promptText,tr as promptYesNo,k as readDevServerState,Ae as readLinkedProject,B as readLiveDevServerState,T as readProjectDependencyNames,Je as readProjectRemotePreference,qe as readProjectTarget,q as removeDevVariableLine,Ve as reportCodegenFindings,Dr as requiredSecrets,Ee as resolveDeployDriver,Xe as resolveProjectTarget,Tr as resolveServerModule,ze as resolveTargetOrThrow,He as runPostCodegenHook,ye as runScriptArgsFor,ke as runScriptCommand,ie as runnableTargetIds,Vr as scaffoldPolicyFile,he as secretsForPackages,v as streamContainerLogs,se as targetRunsOwnDevServer,Be as toolchainExecArgs,K as updateDevServerState,X as upsertDevVariableLine,xr as wireRlsIntoProcedure,w as writeDevServerState,mr as writeDevVariablesFileAtomically,De as writeLinkedProject};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{sqliteClasses as u}from"./wranglerToAlchemy-BMOQYRyw.mjs";const l=1,p=new Set(["$schema","account_id","compatibility_date","compatibility_flags","keep_vars","main","migrations","minify","name","observability","placement","routes","rules","secrets","triggers","upload_source_maps","vars","workers_dev"]),y=e=>Object.fromEntries(Object.entries(e).filter(([,n])=>n!==void 0)),a=[{bindingKey:"binding",field:"analytics_engine_datasets",resourceKey:"dataset",type:"analytics_engine"},{bindingKey:"binding",field:"artifacts",resourceKey:"namespace",type:"artifacts"},{bindingKey:"class_name",field:"containers",resourceKey:"image",type:"container"},{bindingKey:"binding",field:"d1_databases",resourceIdKey:"database_id",resourceKey:"database_name",type:"d1"},{bindingKey:"binding",field:"hyperdrive",resourceIdKey:"id",type:"hyperdrive"},{bindingKey:"binding",field:"kv_namespaces",resourceIdKey:"id",type:"kv"},{bindingKey:"binding",field:"pipelines",resourceKey:["stream","pipeline"],type:"pipeline"},{bindingKey:"binding",field:"r2_buckets",resourceKey:"bucket_name",type:"r2"},{bindingKey:"binding",field:"vectorize",resourceKey:"index_name",type:"vectorize"},{bindingKey:"binding",field:"vpc_networks",resourceIdKey:["tunnel_id","network_id"],type:"vpc_network"},{bindingKey:"binding",field:"vpc_services",resourceIdKey:"service_id",type:"vpc_service"},{bindingKey:"binding",field:"workflows",resourceKey:"name",type:"workflow"}],c=[{field:"ai",type:"ai"},{field:"assets",type:"assets"},{field:"browser",type:"browser"},{field:"images",type:"images"},{field:"media",type:"media"},{field:"stream",type:"stream"}],b=new Set([...a.map(e=>e.field),...c.map(e=>e.field),"durable_objects","exports","queues"]),d=(e,n)=>(typeof n=="string"?[n]:n??[]).map(i=>e[i]).find(i=>typeof i=="string"&&i!==""),m=(e,n)=>{const t=[];for(const i of a)for(const r of e[i.field]??[]){const s=d(r,i.bindingKey);if(s===void 0){n.push(i.field);continue}t.push({binding:s,className:d(r,"class_name"),resource:d(r,i.resourceKey),resourceId:d(r,i.resourceIdKey),type:i.type})}return t},_=(e,n)=>{const t=u(e),i=[];for(const r of e.durable_objects?.bindings??[]){if(r.name===void 0||r.name===""){n.push("durable_objects");continue}i.push({binding:r.name,className:r.class_name,sqlite:r.script_name===void 0&&r.class_name!==void 0?t.has(r.class_name):void 0,type:"durable_object"})}return i},g=(e,n)=>{const t=[];for(const i of e.queues?.producers??[]){if(i.binding===void 0||i.binding===""){n.push("queues.producers");continue}t.push({binding:i.binding,resource:i.queue,type:"queue_producer"})}for(const i of e.queues?.consumers??[]){if(i.queue===void 0||i.queue===""){n.push("queues.consumers");continue}t.push({binding:i.queue,resource:i.queue,type:"queue_consumer"})}return t},f=(e,n)=>Object.entries(e.exports??{}).flatMap(([t,i])=>i?.type!=="workflow"?(n.push(`exports.${t}`),[]):[{binding:t,className:t,resource:i.name,type:"workflow"}]),v=(e,n,t)=>[...f(e,t),...m(e,n),..._(e,n),...g(e,n),...c.filter(i=>e[i.field]?.binding!==void 0).map(i=>({binding:e[i.field]?.binding,type:i.type}))],w=e=>{const n=[],t=[],i=v(e,n,t).map(s=>y(s)).toSorted((s,o)=>s.type.localeCompare(o.type)||s.binding.localeCompare(o.binding)),r=[...Object.keys(e).filter(s=>!p.has(s)&&!b.has(s)),...n.map(s=>`${s} (entry with no binding name)`),...t].toSorted((s,o)=>s.localeCompare(o));return{bindings:i,...e.compatibility_date===void 0?{}:{compatibilityDate:e.compatibility_date},...e.compatibility_flags===void 0?{}:{compatibilityFlags:e.compatibility_flags},crons:e.triggers?.crons??[],...e.name===void 0?{}:{name:e.name},unknown:r,vars:Object.keys(e.vars??{}).toSorted((s,o)=>s.localeCompare(o)),version:l}};export{l as BINDING_MANIFEST_VERSION,w as buildBindingManifest};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{readFileSync as i,existsSync as E}from"node:fs";import{parse as u}from"es-module-lexer";import{WRANGLER_FILES as m,readWranglerJsonc as f}from"./WRANGLER_FILES-UNW-xY5u.mjs";import{escapeRegExp as R}from"./DEV_VARS_EXAMPLE_FILE-CqLorAxT.mjs";import{join as p}from"node:path";const x="_generated",_=["src/server.ts","src/server/index.ts","src/server/index.tsx","src/index.ts","src/worker.ts"],g=new Set(["build","coverage","dist",x,"node_modules","out","target"]),h=new Set([".client",".server"]),D=/[/\\]/u,b=t=>{const e=[];for(const r of t.split(D))r===""||r==="."||(r===".."&&e.length>0&&e.at(-1)!==".."?e.pop():e.push(r));return e},w=t=>b(t).slice(0,-1).some(e=>g.has(e)||e.startsWith(".")&&!h.has(e)),l={SchedulerDO:"SCHEDULER",SessionDO:"SESSION",ShardDO:"SHARD",ShardRegistryDO:"SHARD_REGISTRY"},S=Object.keys(l),k=t=>Object.hasOwn(l,t),T="virtual:lunora/worker",B=["ShardDO"],v=["agents","containers","scheduler","shardRegistry","workflows"],P={scheduler:"SchedulerDO",shardRegistry:"ShardRegistryDO"},A="src/worker.ts",G=t=>{for(const e of m){const r=p(t,e);if(!E(r))continue;const{parsed:s}=f(r),o=s?.main;if(o===T)return{composed:!0};const a=p(t,A);if(E(a))return{composed:!1,path:a};if(typeof o=="string"&&!w(o)&&E(p(t,o)))return{composed:!1,path:p(t,o)};break}for(const e of _){const r=p(t,e);if(E(r))return{composed:!1,path:r}}return{composed:!1}},L=/(?:^|[\s,{])type$/u,d=(t,e)=>{const r=e.ls>=0?e.ls:e.s;return L.test(t.slice(0,r).trimEnd())},O=(t,e)=>{const r=R(e);return new RegExp(String.raw`\bexport\s+type\s+${r}\b`,"u").test(t)||new RegExp(String.raw`\bexport\s+type\s*\{[^}]*\b${r}\b`,"u").test(t)||new RegExp(String.raw`\bexport\s+\{[^}]*\btype\s+${r}\b`,"u").test(t)},W=t=>{const e=i(t,"utf8");let r;try{const[,s]=u(e);r=new Set(s.filter(o=>!d(e,o)).map(o=>o.n))}catch{r=new Set(S.filter(s=>new RegExp(String.raw`\bexport\b[^\n;]*\b${s}\b`,"u").test(e)&&!O(e,s)))}return S.filter(s=>r.has(s)).map(s=>({binding:l[s],className:s}))},$=(t,e,r)=>{if(e.length===0)return[];if(t.composed)return e.map(n=>({...n,exported:!0}));if(t.path===void 0)return e.map(n=>({...n,exported:!1}));const s=i(t.path,"utf8"),o=new RegExp(String.raw`\bexport\s*\*\s*from\s*["'][^"']*_generated\/${r}(?:\.js)?["']`).test(s);let a;try{const[,n]=u(s);a=new Set(n.filter(c=>!d(s,c)).map(c=>c.n))}catch{a=new Set(e.map(n=>n.className).filter(n=>new RegExp(String.raw`\bexport\b[^\n;]*\b${R(n)}\b`,"u").test(s)&&!O(s,n)))}return e.map(n=>{const c=o||a.has(n.className);return{...n,exported:c}})};export{B as COMPOSED_ENTRY_DURABLE_OBJECTS,A as COMPOSED_WORKER_ENTRY,l as DURABLE_OBJECT_BINDINGS,v as GENERATED_CLASS_MODULES,x as GENERATED_DIRECTORY,P as GENERATED_MODULE_DURABLE_OBJECTS,T as LUNORA_WORKER_VIRTUAL_ID,g as NON_SOURCE_DIRECTORIES,h as SOURCE_DOT_DIRECTORIES,_ as WORKER_ENTRY_FALLBACKS,$ as detectClassExports,W as detectExportedDurableObjects,k as isFrameworkDurableObject,w as isGeneratedOutput,G as resolveWorkerEntry};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{writeFileSync as L,rmSync as N,existsSync as v,readFileSync as A}from"node:fs";import{dirname as E,resolve as d,join as y,sep as u,relative as w}from"node:path";import{findWranglerFile as $,readWranglerJsonc as V}from"./WRANGLER_FILES-UNW-xY5u.mjs";import W from"./CLOUDFLARE_DRIVER-DUE6r-Pg.mjs";const Y=".celld.wrangler.json",x=y(".wrangler","deploy","config.json"),F=new Set(["$schema","assets","compatibility_date","compatibility_flags","containers","d1_databases","define","durable_objects","kv_namespaces","main","migrations","name","no_bundle","queues","r2_buckets","rules","services","triggers","vars","worker_loaders","workflows"]),U=new Set(["class_name","image","instance_type","max_instances","name","runtime"]),B=new Set(["CompiledWasm","Data","Text"]),K=/\r?\n/u,G=/[!*?[]/u,J=/[.[]/u,M=["deleted_classes","new_classes","renamed_classes","transferred_classes"],c=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),P=e=>Array.isArray(e)&&e.length===0||c(e)&&Object.values(e).every(r=>P(r)),H=e=>Array.isArray(e)?e.map(r=>{if(!c(r))return r;const t=M.find(n=>r[n]!==void 0);if(t!==void 0)throw new Error(`migration "${String(r.tag)}" uses \`${t}\`, which celld refuses — celld accepts only \`new_sqlite_classes\` migrations`);return{new_sqlite_classes:r.new_sqlite_classes,tag:r.tag}}):e,X=(e,r)=>Array.isArray(e)?e.map((t,n)=>c(t)?Object.fromEntries(Object.entries(t).filter(([s])=>{const o=U.has(s);return o||r.push(`containers[${String(n)}].${s}`),o})):t):e,q=(e,r)=>Array.isArray(e)?e.filter((t,n)=>{const s=c(t)&&typeof t.type=="string"&&B.has(t.type);return s||r.push(`rules[${String(n)}]`),s}):e,z=e=>{const r=[],t={};for(const[n,s]of Object.entries(c(e)?e:{}))c(s)&&s.type==="workflow"?r.push({binding:n,class_name:n,name:s.name}):t[n]=s;return{bindings:r,rest:t}},Q=e=>{const r=[],t={},n=z(e.exports),s={...e,exports:n.rest};for(const[o,i]of Object.entries(s)){if(!F.has(o)){P(i)||r.push(o);continue}switch(o){case"containers":{t[o]=X(i,r);break}case"migrations":{t[o]=H(i);break}case"rules":{t[o]=q(i,r);break}default:t[o]=i}}if(n.bindings.length>0){const o=Array.isArray(t.workflows)?t.workflows:[];t.workflows=[...o,...n.bindings]}return{config:t,dropped:r}},Z=e=>{const[r=[],...t]=e.map(s=>d(s).split(u));let n=0;for(;n<r.length&&t.every(s=>s[n]===r[n]);)n+=1;return r.slice(0,n).join(u)||u},ee=(e,r,t)=>{const n=o=>w(t,d(r,o)).split(u).join("/"),s={...e};return typeof e.main=="string"&&(s.main=n(e.main)),c(e.assets)&&typeof e.assets.directory=="string"&&(s.assets={...e.assets,directory:n(e.assets.directory)}),s},re=e=>{const r=y(e,".assetsignore");if(!v(r))return;const t=A(r,"utf8").split(K).map(n=>n.trim()).filter(n=>n!==""&&!n.startsWith("#")).filter(n=>G.test(n)||v(y(e,n)));if(t.length>0)throw new Error(`${r} hides ${t.join(", ")} from the assets, and celld has no .assetsignore — remove those files from ${e} first`);return r},te=(e,r)=>{const t=y(e,x);if(!v(t))throw new Error(`wrangler \`main\` is the Vite virtual module "${r}", so celld deploys the Vite build output — and there is none yet. Run the project's build (\`vite build\`) first`);const{configPath:n}=JSON.parse(A(t,"utf8"));if(typeof n!="string")throw new TypeError(`${t} names no configPath`);return d(E(t),n)},S=e=>{const{parsed:r}=V(e);if(r===void 0)throw new Error(`${e} is not valid JSONC`);return r},ne=(e,r,t,n)=>{const{d1_databases:s}=e;if(!Array.isArray(s)||n===t)return e;const o=Array.isArray(r.d1_databases)?r.d1_databases.filter(i=>c(i)):[];return{...e,d1_databases:s.map(i=>{if(!c(i))return i;const a=o.find(b=>b.binding===i.binding),l=a?.migrations_dir,p=d(t,typeof l=="string"?l:"migrations"),f=v(p)?{...i,migrations_dir:w(n,p).split(u).join("/")}:i,m=a?.migrations_pattern;return typeof m=="string"?{...f,migrations_pattern:w(n,d(t,m)).split(u).join("/")}:f})}},se=(e,r,t,n)=>{const{main:s}=t;if(typeof s!="string"||!s.startsWith("virtual:"))return{fromBuild:!1,source:t,sourcePath:r};if(n==="dev")throw new Error(`wrangler \`main\` is the Vite virtual module "${s}", which only a Vite build can resolve — \`celld dev\` rebuilds from a source file. Use \`vite dev\` for the dev loop and \`lunora deploy\` to ship the build to celld, or point \`main\` at a worker file`);const o=te(e,s);return{fromBuild:!0,source:S(o),sourcePath:o}},oe=(e,r,t,n,s)=>{const o=r.filter(l=>Object.hasOwn(t,l.split(J)[0]??l));let i=e;e.no_bundle!==void 0&&(i=Object.fromEntries(Object.entries(e).filter(([l])=>l!=="no_bundle")),o.push("no_bundle (celld re-bundles the build output)"));const a=n===void 0?void 0:re(n);return a!==void 0&&o.push(`${w(s,a)} (matched no files)`),{assetsIgnore:a,projected:i,reported:o}},ie=e=>{const r=c(e.vars)?e.vars:{};return{...e,vars:{WORKER_ENV:"development",...r}}},ae=(e,r)=>{const t=$(e);if(t===void 0)throw new Error(`no wrangler.jsonc or wrangler.json in ${e} — celld deploys from the project's Wrangler config`);const n=S(t),{fromBuild:s,source:o,sourcePath:i}=se(e,t,n,r),a=E(i),{config:l,dropped:p}=Q(o),{assets:f}=o,m=c(f)&&typeof f.directory=="string"?d(a,f.directory):void 0,b=typeof o.main=="string"?E(d(a,o.main)):void 0,h=Z([a,b,m].filter(k=>k!==void 0));if(!s&&h!==a)throw new Error(`wrangler \`main\` and \`assets.directory\` must sit inside ${a} — celld resolves everything against the config's directory`);const j=ne(ee(l,a,h),n,e,h),g=s?oe(j,p,n,m,h):{assetsIgnore:void 0,projected:j,reported:p},R=r==="dev"?ie(g.projected):g.projected,O=y(h,Y),T=`${JSON.stringify(R,void 0,4)}
|
|
2
|
+
`;return{configPath:O,dropped:g.reported,write:()=>{L(O,T),g.assetsIgnore!==void 0&&N(g.assetsIgnore)}}},ce=[["entry","`celld deploy` deploys the config's `main`; a composed framework entry has no celld equivalent yet"],["environment","celld has no Wrangler environments — deploy a separate config per environment"],["outDir","`celld deploy` does not write its bundle to disk"],["preview","celld has no preview versions — a deploy replaces the fleet's current deployment"],["temporary","celld has no short-lived accounts — it deploys to the fleet bucket in CELLD_BUCKET"]],D=e=>{if(e===void 0)throw new Error("the celld driver runs the projected wrangler config — pass `configPath` from `projectConfig`");return e},le={deploy:e=>{const r=ce.find(([t])=>e[t]!==void 0&&e[t]!==!1);if(r!==void 0)throw new Error(r[1]);return{args:["deploy",D(e.configPath),...e.dryRun===!0?["--dry-run"]:[]],onPath:!0,tool:"celld"}},devServer:"own",prebuildsContainerImages:!1,dev:e=>{if(e.environment!==void 0)throw new Error("celld has no Wrangler environments — `celld dev` runs the top-level config");return{args:["dev",D(e.configPath),...e.extraArgs??[]],onPath:!0,tool:"celld"}}},de={id:"celld",name:"celld",projectConfig:ae,toolchain:le},fe={id:"node",name:"Node"},ue="cloudflare",_={celld:de,cloudflare:W,node:fe},C=()=>Object.keys(_).toSorted((e,r)=>e.localeCompare(r)),I=(e=ue)=>{const r=_[e];if(r===void 0)throw new Error(`unknown deploy target "${e}" — available targets: ${C().join(", ")}`);return r},pe=e=>Object.hasOwn(_,e)&&I(e).toolchain!==void 0,ve=()=>C().filter(e=>pe(e)),we=e=>I(e).toolchain?.devServer==="own",be=(e,r,t,n)=>{const s=e.projectConfig?.(r,t);return{command:n(s?.configPath),commit:()=>s?.write(),projection:s===void 0?void 0:{configPath:s.configPath,dropped:s.dropped}}};export{ue as DEFAULT_DEPLOY_TARGET,C as deployTargetIds,pe as isRunnableTarget,be as planToolchainInvocation,I as resolveDeployDriver,ve as runnableTargetIds,we as targetRunsOwnDevServer};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{o as g,v as _,a as b,b as f,c as E,d as m,e as d,f as h,g as D,H as R,h as S,R as p,S as I,i as y,j as B,W as L,k as O}from"./validate-bindings-Dnf1t0SY.mjs";import{validateTailConsumers as w,validateSendEmail as N,validateSecretsRequired as T,validateLogpush as C,validateLimits as j,validatePlacement as k,validateObservability as A,validateAssets as $,validateCache as U,validateExports as W,validateCorsVariables as G,validateSchedulerOrigin as H}from"./withTailConsumer-B1NoKIsj.mjs";import{isCacheEnabled as F,WORKERS_CACHE_MIN_DATE as c}from"./WORKERS_CACHE_MIN_DATE-0k9ABJtF.mjs";import{mergeWranglerEnvironment as M}from"./mergeWranglerEnvironment-DOKJUNH8.mjs";const v="2026-04-07",J="web_socket_auto_reply_to_close",u=/^\d{4}-\d{2}-\d{2}$/,V=(o,r,l)=>{const{error:e,merged:i,unverifiedKeys:n}=M(o,r);return e!==void 0?{error:e,wrangler:i}:(n.length>0&&l.push(`env.${String(r)} overrides ${n.join(", ")}, which this validator doesn't have a verified inheritance rule for — validated against the TOP-LEVEL value only. Double-check ${n.length===1?"it":"them"} by hand for "${String(r)}".`),{wrangler:i})},Y=(o,r,l)=>{const e=[],i=[];if(!o||typeof o!="object")return e.push("wrangler config is not a valid object"),{errors:e,valid:!1,warnings:i};const{error:n,wrangler:a}=V(o,l,i);if(n!==void 0)return e.push(n),{errors:e,valid:!1,warnings:i};g(a.durable_objects?.bindings).find(t=>t.name==="SHARD"&&t.class_name==="ShardDO")||e.push('durable_objects.bindings must include { "name": "SHARD", "class_name": "ShardDO" } — your dev server auto-reconciles this on startup, or add the binding manually'),_(a,e);const s=a.compatibility_date??"";s&&!u.test(s)?e.push(`compatibility_date must be in YYYY-MM-DD format (got "${s}")`):s<v&&e.push(`compatibility_date must be >= "${v}" (got "${s||"<missing>"}")`),F(a)&&u.test(s)&&s<c&&e.push(`cache.enabled requires compatibility_date >= "${c}" (got "${s||"<missing>"}")`),b(a,r,e),f(a,e),E(a,r?.vectorIndexNames??[],e),w(a,e),m(a,e,i),d(a.workflows,"workflows",L,e),h(a,e),D(a,e),d(a.secrets_store_secrets,"secrets_store_secrets",O,e);for(const t of R)S(a,t,e,i);for(const t of p)d(a[t.key],t.key,t,e);for(const t of I)y(a,t,e);return B(a,e),N(a,e,i),T(a,e),C(a,e),j(a,e),k(a,e),A(a,e),$(a,e),U(a,e),W(a,e),G(a,e),H(a,l,i),{errors:e,valid:e.length===0,warnings:i}},X=Y;export{v as REQUIRED_COMPATIBILITY_DATE,J as REQUIRED_FLAG,X as validateWrangler,Y as validateWranglerConfig};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{existsSync as f,readFileSync as N,readdirSync as W}from"node:fs";import{join as l,dirname as y,extname as w,basename as _}from"node:path";import{discoverSchemaInfo as P}from"./discoverSchemaInfo-DJvevsCm.mjs";import{COMPOSED_WORKER_ENTRY as L,LUNORA_WORKER_VIRTUAL_ID as g,isGeneratedOutput as F,WORKER_ENTRY_FALLBACKS as M,GENERATED_DIRECTORY as U,COMPOSED_ENTRY_DURABLE_OBJECTS as D,GENERATED_CLASS_MODULES as A,SOURCE_DOT_DIRECTORIES as B,NON_SOURCE_DIRECTORIES as G,isFrameworkDurableObject as Y}from"./COMPOSED_WORKER_ENTRY-C69wqbSP.mjs";import{o as K}from"./validate-bindings-Dnf1t0SY.mjs";import{Project as X,Node as p}from"ts-morph";import{mergeWranglerEnvironment as J}from"./mergeWranglerEnvironment-DOKJUNH8.mjs";import{findWranglerFile as V,readWranglerJsonc as q}from"./WRANGLER_FILES-UNW-xY5u.mjs";import{validateWranglerConfig as z}from"./REQUIRED_COMPATIBILITY_DATE-jTnj2MPJ.mjs";const E=[".ts",".tsx",".mts",".cts"],b=new Set(E),H=new Set([".cjs",".js",".mjs"]),v="default",S={".cjs":[".cts"],".js":[".ts",".tsx"],".mjs":[".mts"]},Q=250,Z=(e,s,t)=>{const o=l(s,L);if(f(o))return{origin:"declared",path:o};if(e===g)return{origin:"composed"};const n=()=>{const a=M.map(c=>l(s,c)).find(c=>f(c));return a===void 0?void 0:{origin:"probed",path:a}};if(typeof e!="string"||e.length===0||F(e))return n();const r=l(y(t),e),i=w(r);if(!(!b.has(i)&&!H.has(i)))return f(r)?{origin:"declared",path:r}:{origin:"absent",path:r}},T=(e,s)=>{if(p.isIdentifier(e)){s.add(e.getText());return}if(p.isObjectBindingPattern(e)||p.isArrayBindingPattern(e))for(const t of e.getElements())p.isBindingElement(t)&&T(t.getNameNode(),s)},ee=(e,s)=>{const t=[];for(const o of e.getExportDeclarations())if(!o.isTypeOnly()){if(o.isNamespaceExport()){const n=o.getNamespaceExport();n===void 0?t.push(o.getModuleSpecifierValue()??""):s.add(n.getName());continue}for(const n of o.getNamedExports())n.isTypeOnly()||s.add(n.getAliasNode()?.getText()??n.getName())}return t},te=(e,s)=>{for(const t of e.getVariableStatements().filter(o=>o.getExportKeyword()!==void 0))for(const o of t.getDeclarations())T(o.getNameNode(),s);for(const t of[...e.getClasses(),...e.getFunctions(),...e.getEnums()]){if(t.getExportKeyword()===void 0)continue;const o=t.isDefaultExport()?v:t.getName();o!==void 0&&s.add(o)}e.getExportAssignments().length>0&&s.add(v)},$=(e,s)=>{const t=new X({compilerOptions:{allowJs:!0},skipFileDependencyResolution:!0,skipLoadingLibFiles:!0,useInMemoryFileSystem:!0}),o=t.createSourceFile(e,s,{overwrite:!0});return t.getProgram().compilerObject.getSyntacticDiagnostics(o.compilerNode).length>0?void 0:o},re=(e,s)=>{if(!s.startsWith("./")&&!s.startsWith("../"))return;const t=l(y(e),s),o=w(t),n=b.has(o)||S[o]!==void 0,r=n?t.slice(0,-o.length):t;return[...b.has(o)?[t]:[],...(S[o]??[]).map(a=>`${r}${a}`),...n?[]:E.map(a=>`${t}${a}`),...n||o.length===0?E.map(a=>l(r,`index${a}`)):[]].find(a=>f(a))},k=e=>{const s=new Set,t=new Set([e]),o=[e];for(;o.length>0;){if(t.size-1>Q)return;const n=o.pop();let r;try{r=N(n,"utf8")}catch{return}const i=$(_(n),r);if(i===void 0)return;const a=ee(i,s);te(i,s);for(const c of a){const d=re(n,c);if(d===void 0)return;t.has(d)||(t.add(d),o.push(d))}}return s},oe=(e,s)=>{const t={exports:void 0,kind:"composed",path:g},o=l(e,s,U);if(!f(o))return t;const n=new Set(D);for(const r of A){const i=l(o,`${r}.ts`);if(!f(i))continue;const a=k(i);if(a===void 0)return t;for(const c of a)n.add(c)}return{exports:n,kind:"composed",path:g}},se=(e,s,t)=>{if(e===void 0||e.origin==="absent")return;if(e.origin==="composed")return oe(s,t);const o=k(e.path);if(!(e.origin==="probed"&&o!==void 0&&!o.has(v)))return{exports:o,kind:"authored",path:e.path}},ne=new Set([".cjs",".cts",".js",".jsx",".mjs",".mts",".ts",".tsx"]),ie=2e3,R="defineTable",O="defineApp",ae=e=>{const s=[],t=[];let o;try{o=W(e,{withFileTypes:!0})}catch{return{files:s,subdirectories:t}}for(const n of o)n.isDirectory()?n.name.startsWith(".")&&!B.has(n.name)||G.has(n.name)||t.push(l(e,n.name)):ne.has(w(n.name))&&s.push(l(e,n.name));return{files:s,subdirectories:t}},j=(e,s)=>{const t=new Set;for(const o of e.getImportDeclarations())for(const n of o.getNamedImports())!n.isTypeOnly()&&n.getName()===s&&t.add(n.getAliasNode()?.getText()??n.getName());return t},ce=(e,s)=>{let t=!1;return e.forEachDescendant((o,n)=>{if(!p.isCallExpression(o))return;const r=o.getExpression();p.isIdentifier(r)&&s.has(r.getText())&&(t=!0,n.stop())}),t},le=e=>{let s=e;for(;p.isCallExpression(s)||p.isPropertyAccessExpression(s);)s=s.getExpression();return s},de=(e,s)=>{const t=le(e);return p.isIdentifier(t)&&s.has(t.getText())},I={global:/\.\s*global\s*\(/u,hyperdriveGlobal:/\.\s*hyperdriveGlobal\s*\(/u,vectors:/\.\s*vectors\s*\(/u},pe=e=>Object.hasOwn(I,e),fe=(e,s)=>{const t=new Set,o=new Set([R,...j(e,R)]);return e.forEachDescendant(n=>{if(!p.isCallExpression(n))return;const r=n.getExpression();if(!p.isPropertyAccessExpression(r)||de(r,o))return;const i=r.getName();pe(i)&&s.has(i)&&t.add(i)}),t},he=(e,s)=>{let t;try{t=N(e,"utf8")}catch{return}const o=new Set([...s].filter(r=>I[r].test(t)));if(o.size===0&&!t.includes(O))return;const n=$(_(e),t);return n===void 0?{chained:o,composes:!1}:{chained:fe(n,o),composes:ce(n,j(n,O))}},ue=(e,s)=>{const t=[e],o=new Set;let n=0,r;const i=a=>{if(n+=1,n>ie)return!1;const c=he(a,s);for(const d of c?.chained??[])o.add(d);return c?.composes&&(r??=a),!0};for(;t.length>0;){const a=t.pop(),{files:c,subdirectories:d}=ae(a);t.push(...d);for(const m of c){if(!i(m))return;if(r!==void 0&&o.size===s.size)return{chained:o,site:r}}}return r===void 0?void 0:{chained:o,site:r}},C=e=>Array.isArray(e)?e:[],me=(e,s,t)=>Object.entries(e?.images??{}).flatMap(([o,n])=>{const r=n?.dockerfile;return typeof r!="string"||f(r.startsWith("/")?r:l(s,r))?[]:[`containers images["${o}"] dockerfile "${r}" does not exist (resolved relative to ${t}); create the Dockerfile`]}),ge=(e,s,t)=>{const o=[];for(const n of C(e)){const r=n?.image;typeof r=="string"&&(r.startsWith("./")||r.startsWith("../")||r.startsWith("/")||r.includes("Dockerfile"))&&!f(r.startsWith("/")?r:l(s,r))&&o.push(`containers image "${r}" does not exist (resolved relative to ${t}); create the Dockerfile or point image at a registry reference`),o.push(...me(n,s,t))}return o},Ee=(e,s)=>{const t=e?.vectorIndexNames??[],o=[];if(t.length>0&&o.push({message:r=>`schema declares vector index(es) ${t.map(i=>`"${i}"`).join(", ")} but nothing chains .vectors(...) onto defineApp() (composed in: ${r}) — \`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"}),e?.hasD1GlobalTable&&o.push({message:r=>`schema declares .global() table(s) but nothing chains .global(...) onto defineApp() (composed in: ${r}) — 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"}),e?.hasHyperdriveGlobalTable&&o.push({message:r=>`schema declares .global({ backend: "hyperdrive" }) table(s) but nothing chains .hyperdriveGlobal(...) onto defineApp() (composed in: ${r}) — 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"}),o.length===0)return[];const n=ue(s,new Set(o.map(r=>r.method)));return n===void 0?[]:o.filter(r=>!n.chained.has(r.method)).map(r=>r.message(n.site))},be="does not export it",ve=(e,s)=>{if(s!=="composed")return`Re-export it from the module that defines it (\`export { ${e} } from "./…";\`), or add it to the app builder's own export (\`export const { ${e} } = app;\`).`;const t=`it exports ${D.join(", ")}, SchedulerDO when its binding is declared, and every class codegen emits from your ${A.map(o=>`${o}.ts`).join(" / ")} declarations`;return Y(e)?`\`@lunora/vite\` generates that entry — ${t}, and ${e} is not among them. Class-A composition does not carry ${e}, 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 "${e}" in one of those and re-run \`lunora codegen\`, or drop the binding.`},ye=(e,s)=>{const t=s.exports;if(t===void 0)return[];const o=[];for(const r of K(e.durable_objects?.bindings))typeof r.class_name=="string"&&r.class_name.length>0&&r.script_name===void 0&&o.push({className:r.class_name,label:"durable_objects.bindings"});for(const r of C(e.workflows))typeof r?.class_name=="string"&&r.class_name.length>0&&r.script_name===void 0&&o.push({className:r.class_name,label:"workflows"});for(const[r,i]of Object.entries(e.exports??{}))i?.type==="workflow"&&o.push({className:r,label:"workflows"});return o.filter(r=>!t.has(r.className)).map(r=>`${r.label} declares class "${r.className}" but the ${s.kind==="composed"?"composed class-A worker entry":"worker entry"} (${s.path}) ${be} — wrangler refuses to bundle a Worker whose ${r.label==="workflows"?"Workflow":"Durable Object"} classes are not exported. ${ve(r.className,s.kind)}`)},we=e=>e?.origin!=="absent"?[]:[`main is set but no readable file is there (looked in ${e.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.`],$e=e=>{const s=e.schemaDir??"lunora",t=V(e.projectRoot);if(!t){const h=`wrangler.jsonc not found in ${e.projectRoot}; create one declaring at least the SHARD durable object binding.`;return{problems:[h],report:{errors:[h],valid:!1,warnings:[]},wranglerPath:void 0}}const{parsed:o}=q(t);if(o===void 0){const h=`failed to parse ${t} as JSONC.`;return{problems:[h],report:{errors:[h],valid:!1,warnings:[]},wranglerPath:t}}const{error:n,merged:r}=J(o,e.environment);if(n!==void 0)return{problems:[n],report:{errors:[n],valid:!1,warnings:[]},wranglerPath:t};const{error:i,info:a}=P(e.projectRoot,s),c=z(o,a,e.environment);i!==void 0&&c.warnings.push(`schema parse failed in ${s}/schema.ts: ${i}`);const d=y(t),m=Z(r.main,e.projectRoot,t),x=se(m,e.projectRoot,s);c.errors.push(...ge(r.containers??[],d,t)),c.warnings.push(...we(m)),x!==void 0&&c.errors.push(...ye(r,x)),c.errors.push(...Ee(a,e.projectRoot));const u=r.assets?.directory;if(typeof u=="string"&&u.length>0){const h=u.startsWith("/")?u:l(d,u);f(h)||c.warnings.push(`assets.directory "${u}" does not exist yet — it is created by the client build; run the build before deploy`)}return c.valid=c.errors.length===0,{problems:c.errors,report:c,wranglerPath:t}};export{be as UNEXPORTED_CLASS_MARKER,$e 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-CugcZbPf.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 C,writeFileSync as M}from"node:fs";import{createRequire as L}from"node:module";import{join as T}from"node:path";import{containerBuildTag as K}from"@lunora/container";import{applyModify as y}from"./applyModify-DKP2l6S9.mjs";import{a as Q,r as F}from"./lunora-manifest-V77OcyFC.mjs";import{parseTree as U,findNodeAtLocation as Y}from"jsonc-parser";import{DEV_VARS_FILE as G,parseDevVariableEntries as H}from"./DEV_VARS_EXAMPLE_FILE-CqLorAxT.mjs";import{packageNamesFromBindings as J}from"./inferLunoraBindings-hCgGQAGN.mjs";import{requiredSecrets as V}from"./buildPackageSecretsBlock-yv9mjKEW.mjs";import{w as X,m as z,s as I,o as q,n as S,p as Z}from"./validate-bindings-Dnf1t0SY.mjs";import{findWranglerFile as ee,readWranglerJsonc as ne}from"./WRANGLER_FILES-UNW-xY5u.mjs";const se=[["maxBatchSize","max_batch_size"],["maxBatchTimeout","max_batch_timeout"],["maxRetries","max_retries"],["deadLetterQueue","dead_letter_queue"],["retryDelay","retry_delay"]],j=e=>Object.fromEntries(se.filter(([n])=>e.tuning[n]!==void 0).map(([n,s])=>[s,e.tuning[n]])),A="queueTuning",te=/^[\t ]*(?:,[\t ]*)?(?:\/\/[^\n\r]*)?\r?\n/u,oe=/^[\t ]*,/u,re=(e,n)=>{const s=U(e),t=s===void 0?void 0:Y(s,[...n])?.parent;if(t?.type==="property"){const r=t.offset+t.length,o=e.lastIndexOf(`
|
|
2
|
+
`,t.offset-1)+1,l=te.exec(e.slice(r));if(l!==null&&e.slice(o,t.offset).trim()===""){const u=t.parent?.children??[],f=u.indexOf(t),i=f===u.length-1&&f>0?u[f-1]:void 0,d=i===void 0?void 0:oe.exec(e.slice(i.offset+i.length))??void 0;return(d===void 0||i===void 0?e.slice(0,o):e.slice(0,i.offset+i.length)+e.slice(i.offset+i.length+d[0].length,o))+e.slice(r+l[0].length)}}return y(e,n,void 0)},P=(e,n,s,t,r,o=new Set)=>{const l=s.join("."),u={},f=[],i=[];let d=e;return{entries:n.map((c,w)=>{const g=t(c);if(g===void 0||c.queue===void 0)return c;const m=Object.fromEntries(Object.entries(j(g)).filter(([h])=>!o.has(h))),b=Object.entries(r[c.queue]??{}).filter(([h])=>!Object.hasOwn(m,h)),v=Object.entries(m).filter(([h,a])=>c[h]!==a),x=b.filter(([h,a])=>c[h]===a).map(([h])=>h),k=Object.fromEntries(Object.entries({...c,...m}).filter(([h])=>!x.includes(h)));for(const[h,a]of v)d=y(d,[...s,w,h],a);for(const h of x)d=re(d,[...s,w,h]);for(const[h,a]of b){const _=c[h];_!==void 0&&_!==a&&i.push(`${l}/${c.queue}: ${h} is no longer declared by defineQueue, but it was changed by hand to ${JSON.stringify(_)} from the declared ${JSON.stringify(a)}, so it was kept. Delete it from wrangler.jsonc if it should go.`)}return(v.length>0||x.length>0)&&f.push(`${l}/${c.queue} (${[...v.map(([h])=>h),...x.map(h=>`removed ${h}`)].join(", ")})`),Object.keys(m).length>0&&(u[c.queue]=m),k}),owned:u,text:d,updated:f,warnings:i}},ae=(e,n,s,t)=>{const r=n.queues??{},o=r.producers??[],l=r.consumers??[],u=new Set(o.map(g=>g.binding)),f=new Set(l.map(g=>g.queue)),i=s.filter(g=>!u.has(g.bindingName)),d=s.filter(g=>!f.has(g.name)),p=P(e,l,["queues","consumers"],g=>s.find(m=>m.name===g.queue),t);let c=p.text;const w={...p.owned};if(i.length>0||d.length>0){const g=[...o,...i.map(b=>({binding:b.bindingName,queue:b.name}))],m=[...p.entries,...d.map(b=>({queue:b.name,...b.mode==="pull"?{type:"http_pull"}:{},...j(b)}))];for(const b of d){const v=j(b);Object.keys(v).length>0&&(w[b.name]=v)}c=y(c,["queues"],{consumers:m,producers:g})}return{added:[...i.map(g=>`queues.producers/${g.bindingName}`),...d.map(g=>`queues.consumers/${g.name}`)],owned:w,text:c,updated:p.updated,warnings:p.warnings}},ie=(e,n,s,t,r)=>{const o=n.env?.[t],l=o?.queues?.consumers??[],u=o?.queues?.producers??[],f=c=>{const w=u.find(g=>g.queue===c.queue)?.binding;return w!==void 0?s.find(g=>g.bindingName===w):s.find(g=>g.name===c.queue&&!u.some(m=>m.binding===g.bindingName))},i=P(e,l,["env",t,"queues","consumers"],f,r,new Set(["dead_letter_queue"])),d=l.filter(c=>c.queue!==void 0&&f(c)===void 0).map(c=>`env.${t}.queues.consumers/${String(c.queue)}: no defineQueue export matches it — this block declares no producer mapping one of their bindings to "${String(c.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.`),p=l.flatMap(c=>{const w=f(c)?.tuning.deadLetterQueue;return w===void 0||c.dead_letter_queue!==void 0?[]:[`env.${t}.queues.consumers/${String(c.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:i.owned,text:i.text,updated:i.updated,warnings:[...i.warnings,...p,...d]}},de=(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?.[A],t=r=>typeof r=="object"&&r!==null&&!Array.isArray(r);return s===void 0?{}:!t(s)||!Object.values(s).every(r=>t(r)&&Object.values(r).every(o=>t(o)))?(n.push(`${e?.path??"package.json"}: \`lunora.${A}\` 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},ce=(e,n,s)=>{const t=Object.fromEntries(Object.entries({...n,...s}).filter(([,r])=>Object.keys(r).length>0));Q(e,A,Object.keys(t).length===0?void 0:t)},O="PIPELINES",le=(e,n)=>{const s=e.flagshipBinding!==void 0&&!(n?.flagship??[]).some(o=>o.binding===e.flagshipBinding),t=e.usesPipelines&&!(n?.pipelines??[]).some(o=>o.binding===O);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 "${O}" pipelines binding exists; run 'wrangler pipelines create <name>' and add a 'pipelines' binding ({ binding: "${O}", stream }) — codegen resolves this one name, and the pipeline resource can't be auto-provisioned.`],[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(([o])=>o).map(([,o])=>o)},ue=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.usesX402Pay,"@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),N=(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.`),ge=(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,l])=>l?.type==="workflow"?[o]:[]),r=(n.workflows??[]).flatMap(o=>o.class_name===void 0||o.script_name!==void 0?[]:[o.class_name]);return[...new Set([...t,...r])].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.`)},pe=(e,n)=>{if(e.queues.length===0)return[];const s=new Set(e.queues.map(r=>r.name)),t=new Set(e.queues.map(r=>r.bindingName));return[...(n.queues?.consumers??[]).flatMap(r=>{const{queue:o}=r;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(r=>{const{binding:o}=r;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.`]})]},me=(e,n)=>[...ge(e,n),...pe(e,n)],R=[{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"}],fe=()=>R.map(({keys:e,label:n})=>`${e[0]} + ${e[1]} (${n})`).join(" or "),he=e=>{let n;try{n=C(T(e,G),"utf8")}catch{return!1}const s=new Map(H(n).map(t=>[t.key,t.value]));return R.some(({keys:t})=>t.every(r=>(s.get(r)??"")!==""))},be=(e,n)=>{const s=n?.secrets?.required;if(!Array.isArray(s))return[];const t=new Set(s),r=V(J(e)).map(o=>o.key).filter(o=>!t.has(o));return r.length===0?[]:[`wrangler.jsonc declares secrets.required without ${r.join(", ")}, which this app needs — wrangler dev loads only the listed keys from .dev.vars, so add ${r.length===1?"it":"them"} to secrets.required.`]},E=(e,n,s)=>{const t=new Set(e.durableObjects.map(u=>u.className)),r=[],o=(s?.r2_buckets?.length??0)>0,l=(s?.d1_databases?.some(u=>u.binding==="DB")??!1)||e.needsD1;return e.usesStorage&&!o&&r.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")&&!l&&r.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")&&r.push("@lunora/scheduler is used but the worker entry exports no SchedulerDO; export it so the SCHEDULER binding can be provisioned."),r.push(...N("container","containers",e.containers),...N("workflow","workflows",e.workflows),...N("agent","agents",e.agents)),e.containers.length>0&&s?.observability?.enabled===!1&&r.push("containers are declared but observability is explicitly disabled in wrangler.jsonc — container logs will not be captured."),e.usesPayment&&!he(n)&&r.push(`@lunora/payment is used; set one provider's secret pair in .dev.vars — ${fe()}.`),r.push(...ue(e),...le(e,s),...be(e,s)),s!==void 0&&r.push(...me(e,s)),r},B="<replace-with-d1-create-id>",we=e=>[["container","containers",e.containers],["workflow","workflows",e.workflows],["agent","agents",e.agents]].flatMap(([s,t,r])=>r.filter(o=>!o.exported).map(({className:o,exportName:l})=>({className:o,exportName:l,kind:s,module:t}))),ve=e=>{const n=new Set(q(e).map(t=>t.tag));let s=1;for(;n.has(`v${String(s)}`);)s+=1;return`v${String(s)}`},_e=e=>{const n=new Set;for(const s of q(e)){for(const t of S(s.deleted_classes))n.delete(t);for(const{from:t,to:r}of q(s.renamed_classes))t!==void 0&&n.delete(t),r!==void 0&&n.add(r);for(const t of[...S(s.new_classes),...S(s.new_sqlite_classes)])n.add(t)}return n},ye=(e,n,s)=>{const t=n.durable_objects?.bindings??[],r=new Set(t.map(d=>d.name)),o=s.filter(d=>!r.has(d.binding));let l=e;const u=[];if(o.length>0){const d=[...t,...o.map(p=>({class_name:p.className,name:p.binding}))];l=y(l,["durable_objects","bindings"],d),u.push(...o.map(p=>`${p.binding}/${p.className}`))}const f=n.migrations??[],i=s.map(d=>d.className).filter(d=>!_e(f).has(d));if(i.length>0){const d=[...f,{new_sqlite_classes:i,tag:ve(f)}];l=y(l,["migrations"],d)}return{added:u,text:l}},xe=(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",r=[...s,{binding:"DB",database_id:B,database_name:t}];return{added:["DB (D1)"],text:y(e,["d1_databases"],r)}},$=(e,n,s,t,r)=>{const o=n[s]?.binding;return typeof o=="string"&&o.length>0?{added:[],text:e}:{added:[r],text:y(e,[s],{binding:t})}},ke=(e,n)=>(n.analytics_engine_datasets?.length??0)>0?{added:[],text:e}:{added:["ANALYTICS (Analytics Engine)"],text:y(e,["analytics_engine_datasets"],[{binding:"ANALYTICS",dataset:"ANALYTICS"}])},Se=(e,n)=>{const s=n.worker_loaders??[];return s.some(t=>t.binding==="LOADER")?{added:[],text:e}:{added:["LOADER (Worker Loader)"],text:y(e,["worker_loaders"],[...s,{binding:"LOADER"}])}},Oe=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},Ne=e=>{const{image:n}=e;return n.kind==="dockerfile"?n.dockerfilePath:n.kind==="registry"?n.reference:K(e.exportName)},W=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}}},Ee=e=>{if(e.schedulingPolicy==="durable_object")return W(e);const{image:n}=e,s={class_name:e.className,image:Ne(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=Oe(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},$e=(e,n,s)=>{const t=n.containers??[],r=new Set(t.map(i=>i.class_name)),o=s.filter(i=>!r.has(i.className));let l=o.length===0?e:y(e,["containers"],[...t,...o.map(i=>Ee(i))]);const u=[],f=[];for(const[i,d]of t.entries()){const p=s.find(g=>g.className===d.class_name);if(p===void 0)continue;const c=p.schedulingPolicy??"default";if((d.scheduling_policy??"default")!==c){f.push(`containers/${p.className} has scheduling_policy "${d.scheduling_policy??"default"}" in wrangler.jsonc but defineContainer "${p.exportName}" declares "${c}" — the policy is immutable, so replace the entry (and its container application) by hand.`);continue}const w=p.schedulingPolicy==="durable_object"?W(p).images:void 0;w!==void 0&&JSON.stringify(d.images)!==JSON.stringify(w)&&(l=y(l,["containers",i,"images"],w),u.push(`containers/${p.className}.images`))}return{added:o.map(i=>`containers/${i.className}`),text:l,updated:u,warnings:f}},qe=(e,n)=>{if(n.observability!==void 0)return{added:[],text:e};const s=y(e,["observability"],{enabled:!0,head_sampling_rate:1});return{added:["observability"],text:s}},je=[{minimum:[4,142],name:"wrangler"},{minimum:[1,61],name:"@cloudflare/vite-plugin"}],Ae=(e,n)=>{try{const s=L(T(e,"package.json")).resolve(`${n}/package.json`),[t=0,r=0]=String(JSON.parse(C(s,"utf8")).version).split(".").map(Number);return[t,r]}catch{return}},De=e=>{const n=je.flatMap(({minimum:s,name:t})=>{const r=Ae(e,t);return r!==void 0&&(r[0]<s[0]||r[0]===s[0]&&r[1]<s[1])?[`${t} ${r.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 wrangler@^4.143.1 @cloudflare/vite-plugin@^1.62.1\`) and re-run.`},Ce=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.`]:[]),Te=(e,n,s)=>{let t=e;const r=[],o=[];for(const l of s){const u=n[l.className];if(u?.type==="workflow")for(const{of:f,path:i}of Z){const d=f(l),p=I(u,i),c=`exports/${l.className}.${i.join(".")}`;if(d===void 0){p!==void 0&&o.push(`${c} is set in wrangler.jsonc but defineWorkflow "${l.exportName}" does not declare it — reconcile leaves it in place. Remove it by hand if it was dropped from the definition.`);continue}JSON.stringify(p)!==JSON.stringify(d)&&(t=y(t,["exports",l.className,...i],d),r.push(c))}}return{text:t,updated:r,warnings:o}},Ie=(e,n,s,t,r)=>{if(r!==void 0)return{added:[],text:e,warnings:[r]};const o=[...s.map(m=>({settings:X(m),workflow:m})),...t.map(m=>({settings:{},workflow:m}))],l=new Set(o.map(({workflow:m})=>m.className)),u=n.workflows??[],f=u.filter(m=>m.script_name===void 0&&m.class_name!==void 0&&l.has(m.class_name)),i=n.exports??{},d=[],p=[],c=[];let w=e;for(const{settings:m,workflow:b}of o){if(i[b.className]!==void 0&&i[b.className]!==null)continue;const v=f.find(h=>h.class_name===b.className),x=Object.fromEntries(z.flatMap(h=>{const a=I(v,[h]);return a===void 0?[]:[[h,a]]})),k=v?.name??b.name;v?.name!==void 0&&v.name!==b.name&&c.push(`workflows/${b.className} is deployed as "${v.name}" but declared as "${b.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=y(w,["exports",b.className],{type:"workflow",...x,...m,name:k}),(v===void 0?d:p).push(`exports/${b.className}`)}if(f.length>0){const m=u.filter(b=>!f.includes(b));w=y(w,["workflows"],m.length===0?void 0:m),p.push(...f.map(b=>`workflows/${String(b.class_name)} → exports`))}c.push(...Ce(n));const g=Te(w,i,s);return{added:d,text:g.text,updated:[...p,...g.updated],warnings:[...c,...g.warnings]}},He=(e,n,s)=>{const t=ee(e),r=we(n);if(!t)return{added:[],changed:!1,exportGaps:r,reason:"wrangler.jsonc not found",updated:[],warnings:E(n,e)};const{parsed:o,text:l}=ne(t);if(o===void 0)return{added:[],changed:!1,exportGaps:r,reason:`failed to parse ${t} as JSONC`,updated:[],warnings:E(n,e),wranglerPath:t};const u=E(n,e,o);if(s!==void 0){const a=o.env?.[s]!==void 0;u.push(a?`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 f=n.containers.filter(a=>a.exported),i=n.agents.filter(a=>a.exported&&a.voice===!0&&a.voiceBindingName!==void 0&&a.voiceClassName!==void 0),d=[...n.durableObjects,...f.map(a=>({binding:a.bindingName,className:a.className})),...i.map(a=>({binding:a.voiceBindingName,className:a.voiceClassName}))],p=n.workflows.filter(a=>a.exported),c=n.agents.filter(a=>a.exported),w=F(e),g=de(w,u),m={},b=[{enabled:!0,run:a=>ye(a,o,d)},{enabled:n.needsD1,run:a=>xe(a,o)},{enabled:n.usesAi,run:a=>$(a,o,"ai","AI","AI (Workers AI)")},{enabled:n.usesBrowser,run:a=>$(a,o,"browser","BROWSER","BROWSER (Browser Rendering)")},{enabled:n.usesImages,run:a=>$(a,o,"images","IMAGES","IMAGES (Cloudflare Images)")},{enabled:n.usesAnalytics,run:a=>ke(a,o)},{enabled:n.usesWorkerLoader,run:a=>Se(a,o)},{enabled:!0,run:a=>qe(a,o)},{enabled:f.length>0,run:a=>$e(a,o,f)},{enabled:p.length>0||c.length>0,run:a=>Ie(a,o,p,c,De(e))},{enabled:n.queues.length>0,run:a=>{const _=ae(a,o,n.queues,g.queues??{});return m.queues=_.owned,_}},...s===void 0||o.env?.[s]===void 0?[]:[{enabled:n.queues.length>0,run:a=>{const _=`env.${s}.queues`,D=ie(a,o,n.queues,s,g[_]??{});return m[_]=D.owned,D}}]];let v=l;const x=[],k=[];for(const a of b){if(!a.enabled)continue;const _=a.run(v);v=_.text,x.push(..._.added),k.push(..._.updated??[]),u.push(..._.warnings??[])}const h=a=>{if(!(w===void 0||Object.keys(m).length===0))try{ce(w,g,m)}catch(_){u.push(`${a?"wrangler.jsonc was updated, but ":""}recording the queue tuning reconcile owns in ${w.path} (lunora.queueTuning) failed: ${_ instanceof Error?_.message:String(_)}. Until it is recorded, an option removed from defineQueue stays deployed.`)}};return x.includes("DB (D1)")&&u.push(`wrote a DB binding with a placeholder database_id ("${B}") — run \`wrangler d1 create <name>\` and replace it before deploying.`),v===l?(h(!1),{added:[],changed:!1,exportGaps:r,reason:"bindings already in sync",updated:[],warnings:u,wranglerPath:t}):(M(t,v,"utf8"),h(!0),{added:x,changed:!0,exportGaps:r,updated:k,warnings:u,wranglerPath:t})};export{we as collectExportGaps,He as reconcileWranglerBindings};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{existsSync as S,statSync as T,readFileSync as O,readdirSync as $}from"node:fs";import{parse as D,init as F}from"es-module-lexer";import{discoverAgentInfo as U}from"./discoverAgentInfo-CTdCSfYM.mjs";import{discoverContainerInfo as Y}from"./discoverContainerInfo-EhZtEBQs.mjs";import{discoverFlags as M,FLAGS_FILENAME as W,discoverQueues as G,QUEUES_FILENAME as K}from"@lunora/codegen";import{d as C}from"./discover-info-Vj9d4qYt.mjs";import{escapeRegExp as X}from"./DEV_VARS_EXAMPLE_FILE-CqLorAxT.mjs";import{discoverSchemaInfo as q}from"./discoverSchemaInfo-DJvevsCm.mjs";import{resolveWorkerEntry as H,COMPOSED_ENTRY_DURABLE_OBJECTS as Q,GENERATED_MODULE_DURABLE_OBJECTS as V,GENERATED_DIRECTORY as w,DURABLE_OBJECT_BINDINGS as J,detectExportedDurableObjects as z,detectClassExports as E}from"./COMPOSED_WORKER_ENTRY-C69wqbSP.mjs";import{discoverWorkflowInfo as Z}from"./discoverWorkflowInfo-BsPvlo6O.mjs";import{join as l}from"node:path";const ee=(e,s)=>{const{error:t,value:r}=C(e,s,W,M);return t===void 0?{flags:r}:{error:t}},L=/^\s*import\s+type\b/,se=new Set(["@lunora/agent","@lunora/agent/sandbox"]),f=["browserTool","jsCodeTool"],y=Object.fromEntries(f.map(e=>{const s=X(e);return[e,{fallback:new RegExp(String.raw`import\s+\{[^}]*\b${s}\b[^}]*\}\s+from\s+["']@lunora\/agent(?:\/sandbox)?["']`,"u"),name:new RegExp(String.raw`\b${s}\b`,"u"),typeSpecifier:new RegExp(String.raw`\btype\s+${s}\b`,"u")}]})),re=e=>{const s=e.indexOf("{");if(s===-1)return"";const t=e.indexOf("}",s+1);return t===-1?e.slice(s+1):e.slice(s+1,t)},te=(e,s)=>{if(L.test(e))return!1;const t=re(e);return y[s].name.test(t)&&!y[s].typeSpecifier.test(t)},oe=e=>{let s;try{const[t]=D(e);s=t.filter(r=>r.n!==void 0&&se.has(r.n)).map(r=>e.slice(r.ss,r.se))}catch{s=void 0}return Object.fromEntries(f.map(t=>[t,s===void 0?y[t].fallback.test(e):s.some(r=>te(r,t))]))},ne=(e,s)=>{const{error:t,value:r}=C(e,s,K,G);return t===void 0?{queues:r??[]}:{error:t,queues:[]}},ae=new Set([".cjs",".cts",".js",".jsx",".mjs",".mts",".ts",".tsx"]),ie=new Set([".git",".lunora-cache",".wrangler","dist",w,"node_modules"]),ce=["lunora","src"],de=/\benv\s*\.\s*DB\b/,ue=/\benv\s*\.\s*AI\b/,k=/\bctx\s*\.\s*pipelines\b/,P=/\bctx\s*\.\s*r2sql\b/,b={usesAi:{pattern:/\bfrom\s+["']@lunora\/ai["']/,source:"@lunora/ai"},usesAnalytics:{pattern:/\bfrom\s+["']@lunora\/bindings\/analytics["']/,source:"@lunora/bindings/analytics"},usesAuth:{pattern:/\bfrom\s+["']@lunora\/auth["']/,source:"@lunora/auth"},usesBrowser:{pattern:/\bfrom\s+["']@lunora\/browser["']/,source:"@lunora/browser"},usesHyperdrive:{pattern:/\bfrom\s+["']@lunora\/hyperdrive["']/,source:"@lunora/hyperdrive"},usesImages:{pattern:/\bfrom\s+["']@lunora\/bindings\/images["']/,source:"@lunora/bindings/images"},usesKv:{pattern:/\bfrom\s+["']@lunora\/bindings\/kv["']/,source:"@lunora/bindings/kv"},usesMail:{pattern:/\bfrom\s+["']@lunora\/mail["']/,source:"@lunora/mail"},usesNotify:{pattern:/\bfrom\s+["']@lunora\/notify["']/,source:"@lunora/notify"},usesPayment:{pattern:/\bfrom\s+["']@lunora\/payment["']/,source:"@lunora/payment"},usesPipelines:{pattern:k,source:"@lunora/bindings/pipelines"},usesR2sql:{pattern:P,source:"@lunora/bindings/r2sql"},usesScheduler:{pattern:/\bfrom\s+["']@lunora\/scheduler["']/,source:"@lunora/scheduler"},usesStorage:{pattern:/\bfrom\s+["']@lunora\/storage["']/,source:"@lunora/storage"},usesX402Charge:{pattern:/\bfrom\s+["']@lunora\/x402\/charge["']/,source:"@lunora/x402/charge"},usesX402Pay:{pattern:/\bfrom\s+["']@lunora\/x402\/pay["']/,source:"@lunora/x402/pay"}},p=Object.keys(b),le="STRIPE_SECRET_KEY + STRIPE_WEBHOOK_SECRET (Stripe) or POLAR_ACCESS_TOKEN + POLAR_WEBHOOK_SECRET (Polar)",B=[...p,"needsD1","usesWorkerLoader"],pe=()=>{const e={};for(const s of B)e[s]=!1;return e},u=Object.freeze(pe()),_=(e,s)=>{const t={};for(const r of B)t[r]=e[r]||s[r];return t},me=e=>{for(const s of p)if(b[s].source===e)return{...u,[s]:!0};return u},fe=e=>{const[s]=D(e);let t=u;for(const r of s){const o=r.n;!o||L.test(e.slice(r.ss,r.se))||(t=_(t,me(o)))}return t},be=e=>{const s={...u};for(const t of p)s[t]=b[t].pattern.test(e);return s},ge=e=>{let s;try{s=fe(e)}catch{s=be(e)}return _(s,{...u,needsD1:de.test(e),usesAi:ue.test(e),usesPipelines:k.test(e),usesR2sql:P.test(e)})},x=(e,s)=>{let t;try{t=$(e,{withFileTypes:!0})}catch{return}for(const r of t){if(r.isDirectory()){ie.has(r.name)||x(l(e,r.name),s);continue}const o=r.name.lastIndexOf(".");o!==-1&&ae.has(r.name.slice(o))&&s.push(l(e,r.name))}},he=(e,s)=>q(e,s).info?.hasD1GlobalTable??!1,Ee=(e,s)=>{let t=u;for(const r of s){const o=l(e,r);if(!S(o)||!T(o).isDirectory())continue;const n=[];x(o,n);for(const a of n)t=_(t,ge(O(a,"utf8")))}return t},ye=(e,s)=>{const t=l(e,s),r=Object.fromEntries(f.map(n=>[n,!1]));if(!S(t)||!T(t).isDirectory())return r;const o=[];x(t,o);for(const n of o){const a=oe(O(n,"utf8"));for(const i of f)r[i]||=a[i]}return r},Se=(e,s,t)=>[...e.map(r=>r.exported?`${r.bindingName}/${r.className} (container "${r.exportName}" declared and exported)`:`hint: container "${r.exportName}" is declared but ${r.className} is not exported by the worker entry — add \`export * from "./lunora/_generated/containers"\``),...s.map(r=>r.exported?`exports.${r.className} (workflow "${r.exportName}" declared and exported)`:`hint: workflow "${r.exportName}" is declared but ${r.className} is not exported by the worker entry — add \`export * from "./lunora/_generated/workflows"\``),...t.map(r=>r.exported?`exports.${r.className} (agent "${r.exportName}" declared and exported)`:`hint: agent "${r.exportName}" is declared but ${r.className} is not exported by the worker entry — add \`export * from "./lunora/_generated/agents"\``)],_e=(e,s)=>[[e.usesAi,"AI (@lunora/ai imported or env.AI used)"],[e.usesAuth&&!s.has("SessionDO"),"hint: @lunora/auth is imported; its tables are D1-backed by default. For DO-backed auth (what @better-auth/scim needs), pass `namespace` to .auth() and export the generated auth DO class"],[e.usesScheduler&&!s.has("SchedulerDO"),"hint: @lunora/scheduler is imported but no SchedulerDO is exported by the worker entry"],[e.usesStorage,"hint: @lunora/storage is imported; add an r2_buckets binding (bucket binding names are user-defined)"],[e.usesMail,"hint: @lunora/mail is imported; set RESEND_API_KEY in .dev.vars (obtain at https://resend.com/api-keys)"],[e.usesPayment,`hint: @lunora/payment is imported; set the provider secrets in .dev.vars — ${le}`],[e.usesBrowser,"browser (@lunora/browser imported) — self-describing { binding: BROWSER }"],[e.usesImages,"images (@lunora/bindings/images imported) — self-describing { binding: IMAGES }"],[e.usesAnalytics,"analytics_engine_datasets (@lunora/bindings/analytics imported) — self-describing { binding: ANALYTICS, dataset }"],[e.usesWorkerLoader,"worker_loaders (jsCodeTool imported in lunora/) — self-describing { binding: LOADER }"],[e.usesKv,"hint: @lunora/bindings/kv is imported; add a kv_namespaces binding ({ binding, id }) and pass env.<BINDING> to createKv() — the namespace id can't be auto-provisioned"],[e.usesHyperdrive,"hint: @lunora/hyperdrive is imported; run 'wrangler hyperdrive create' and add a 'hyperdrive' binding ({ binding, id }) — the id can't be auto-provisioned"],[e.usesPipelines,"hint: ctx.pipelines is used; run 'wrangler pipelines create <name>' and add a 'pipelines' binding ({ binding, stream }) — the pipeline resource can't be auto-provisioned"],[e.usesX402Charge,"hint: @lunora/x402/charge is imported; set the recipient wallet address as a [vars] entry (the var name is yours to choose) and pass it to the charge config — the x402 facilitator settles USDC to that address"],[e.usesX402Pay,"hint: @lunora/x402/pay is imported (ActionCtx-only, spends real funds); add a secrets_store_secrets[] binding for the agent wallet key (name it to match signer.secretName) and pair the pay rail with a spend policy — ctx.secrets reads a Secrets Store binding, not .dev.vars, so the key can't be auto-provisioned"]].filter(([r])=>r).map(([,r])=>r),xe=(e,s,t,r=[],o=[],n=[])=>{const a=new Set(e.map(c=>c.className)),i=e.map(c=>`${c.binding}/${c.className} (exported by worker entry)`);return s&&i.push("DB (.global() table declared)"),i.push(...Se(r,o,n),..._e(t,a)),i},ke=async e=>{await F;const s=e.schemaDir??"lunora",t=e.scanDirs??ce,r=Ee(e.projectRoot,t),o=ye(e.projectRoot,s),n={...r,usesBrowser:r.usesBrowser||o.browserTool,usesWorkerLoader:o.jsCodeTool},a=H(e.projectRoot);let i;a.composed?i=[...Q,...Object.entries(V).filter(([d])=>S(l(e.projectRoot,s,w,`${d}.ts`))).map(([,d])=>d)].map(d=>({binding:J[d],className:d})):i=a.path===void 0?[]:z(a.path);const c=n.needsD1||he(e.projectRoot,s),v=E(a,Y(e.projectRoot,s).containers,"containers"),I=E(a,Z(e.projectRoot,s).workflows,"workflows"),R=E(a,U(e.projectRoot,s).agents,"agents"),j=[...ne(e.projectRoot,s).queues],{flags:m}=ee(e.projectRoot,s),g=m?.provider==="flagship"&&m.mode==="binding"?m.bindingName:void 0,A={};for(const h of p)A[h]=n[h];const N=xe(i,c,n,v,I,R);return g!==void 0&&N.push(`hint: lunora/flags.ts uses Flagship in binding mode; add a flagship binding ({ binding: "${g}", app_id }) — the app_id can't be auto-provisioned`),{agents:R,containers:v,durableObjects:i,flagshipBinding:g,needsD1:c,queues:j,signals:N,usesFlags:m!==void 0,usesWorkerLoader:n.usesWorkerLoader,workflows:I,...A}},Pe=e=>{const s=[];for(const t of p)e[t]&&s.push(b[t].source);return s};export{ke as inferLunoraBindings,Pe as packageNamesFromBindings};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{readProjectConfigLiterals as o,readProjectTarget as n}from"@lunora/codegen";import{DEFAULT_DEPLOY_TARGET as c,resolveDeployDriver as a}from"./DEFAULT_DEPLOY_TARGET-
|
|
1
|
+
import{readProjectConfigLiterals as o,readProjectTarget as n}from"@lunora/codegen";import{DEFAULT_DEPLOY_TARGET as c,resolveDeployDriver as a}from"./DEFAULT_DEPLOY_TARGET-Bl4jTTmt.mjs";const s=e=>{if(typeof e=="boolean")return e;if(e!==null&&typeof e=="object")return!0},g=e=>s(o(e).remote),i=e=>n(e),T=(e,r)=>r??i(e)??c,j=(e,r)=>{const t=T(e,r);return a(t),t};export{s as interpretRemote,g as readProjectRemotePreference,i as readProjectTarget,T as resolveProjectTarget,j as resolveTargetOrThrow};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const c=["artifacts","containers","d1_databases","durable_objects","kv_namespaces","queues","r2_buckets","secrets","secrets_store_secrets","services","tail_consumers","vars","vectorize","workflows"],i=["assets","compatibility_date","exports","logpush","main","migrations","observability","placement"],m=(s,n)=>{if(n===void 0)return{merged:s,unverifiedKeys:[]};const t=s.env?.[n];if(t===void 0){const e=Object.keys(s.env??{}).toSorted((v,f)=>v.localeCompare(f)),l=e.length>0?` (declared: ${e.join(", ")}).`:" (no environments are declared).";return{error:`--env "${n}" names no environment declared in wrangler.jsonc's "env" block${l}`,merged:s,unverifiedKeys:[]}}const o={...s},r=Object.keys(t).filter(e=>e!=="env");for(const e of r)i.includes(e)&&(o[e]=t[e]);for(const e of c)o[e]=t[e];const a=new Set([...c,...i]),d=r.filter(e=>!a.has(e)).map(String);return{merged:o,unverifiedKeys:d}};export{m as mergeWranglerEnvironment};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{inferLunoraBindings as d}from"./inferLunoraBindings-
|
|
1
|
+
import{inferLunoraBindings as d}from"./inferLunoraBindings-hCgGQAGN.mjs";import{LUNORA_TAG as r}from"./LUNORA_TAG-CiQM3BkI.mjs";import{reconcileWranglerBindings as f}from"./collectExportGaps-FC62nUj0.mjs";import{reconcileWranglerCompatibilityDate as p}from"./reconcileWranglerCompatibilityDate-hocXEuRA.mjs";import{reconcileWranglerCrons as g,describePreservedCrons as $}from"./describePreservedCrons-Ci5r2aph.mjs";const b=async(i,a,t)=>{try{const n=await d({projectRoot:i.projectRoot,schemaDir:i.schemaDir}),e=f(i.projectRoot,n),o=e.wranglerPath??"wrangler.jsonc";e.added.length>0&&a.info?.(`${r} inferred bindings → ${e.added.join(", ")} (written to ${o})`),e.updated.length>0&&a.info?.(`${r} updated bindings → ${e.updated.join(", ")} (written to ${o})`);for(const s of e.warnings)a.warn(`${r} ${s}`);e.exportGaps.length>0&&t?.(e.exportGaps)}catch(n){const e=n instanceof Error?n.message:String(n);a.warn(`${r} binding inference skipped: ${e}`)}},c=new Map,j=(i,a,t)=>{try{const n=g(i,a);n.changed&&t.info?.(`${r} synced ${a.length.toFixed(0)} cron trigger(s) into ${n.wranglerPath??"wrangler.jsonc"}`);for(const s of n.warnings)t.warn(`${r} ${s}`);const e=n.preserved.join("\0"),o=$(n.preserved);o!==void 0&&(n.changed||c.get(i)!==e)&&t.info?.(`${r} ${o}`),c.set(i,e)}catch(n){const e=n instanceof Error?n.message:String(n);t.warn(`${r} cron trigger sync skipped: ${e}`)}try{const n=p(i);n.changed&&t.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);t.warn(`${r} compatibility date sync skipped: ${e}`)}};export{b as reconcileBindingsSafely,j as reconcileWranglerExtras};
|
|
@@ -204,7 +204,7 @@ interface DurableObjectSpec {
|
|
|
204
204
|
* has a `.scheduler()` method at all. `@lunora/vite` depends on `@lunora/config`, so config
|
|
205
205
|
* owning it is the direction the dependency graph allows.
|
|
206
206
|
*/
|
|
207
|
-
declare const GENERATED_CLASS_MODULES: readonly ["agents", "containers", "scheduler", "workflows"];
|
|
207
|
+
declare const GENERATED_CLASS_MODULES: readonly ["agents", "containers", "scheduler", "shardRegistry", "workflows"];
|
|
208
208
|
/** One {@link GENERATED_CLASS_MODULES} entry. */
|
|
209
209
|
type GeneratedClassModule = (typeof GENERATED_CLASS_MODULES)[number];
|
|
210
210
|
/**
|
|
@@ -228,14 +228,14 @@ declare const COMPOSED_WORKER_ENTRY = "src/worker.ts";
|
|
|
228
228
|
* provision — wrangler rejects a `containers[].class_name` (and its Durable
|
|
229
229
|
* Object binding) that the worker doesn't export.
|
|
230
230
|
*/
|
|
231
|
-
|
|
231
|
+
type InferredContainer = ContainerIR & {
|
|
232
232
|
exported: boolean;
|
|
233
|
-
}
|
|
233
|
+
};
|
|
234
234
|
/**
|
|
235
235
|
* A `defineWorkflow` declaration plus whether its generated
|
|
236
236
|
* `WorkflowEntrypoint` class is exported by the worker entry. Only exported
|
|
237
|
-
* workflows are safe to provision — wrangler rejects
|
|
238
|
-
* the worker doesn't export. Workflows are NOT Durable Objects, so this never
|
|
237
|
+
* workflows are safe to provision — wrangler rejects an `exports.<Class>`
|
|
238
|
+
* workflow the worker doesn't export. Workflows are NOT Durable Objects, so this never
|
|
239
239
|
* implies a `durable_objects` binding or migration.
|
|
240
240
|
*/
|
|
241
241
|
interface InferredWorkflow extends WorkflowIR {
|
|
@@ -246,7 +246,7 @@ interface InferredWorkflow extends WorkflowIR {
|
|
|
246
246
|
* `WorkflowEntrypoint` class (e.g. `SupportAgentWorkflow`) is exported by the
|
|
247
247
|
* worker entry. An agent compiles onto a Cloudflare Workflow, so — exactly like
|
|
248
248
|
* {@link InferredWorkflow} — only exported agents are safe to provision
|
|
249
|
-
* (wrangler rejects
|
|
249
|
+
* (wrangler rejects an `exports.<Class>` workflow the worker doesn't export), and
|
|
250
250
|
* an agent is NOT a Durable Object (no `durable_objects` binding or migration).
|
|
251
251
|
*/
|
|
252
252
|
interface InferredAgent extends AgentIR {
|
|
@@ -260,7 +260,7 @@ interface InferredAgent extends AgentIR {
|
|
|
260
260
|
*/
|
|
261
261
|
type InferredQueue = QueueIR;
|
|
262
262
|
interface InferredBindings {
|
|
263
|
-
/** Agents declared in `lunora/agents.ts` (exported or not — see {@link InferredAgent.exported}); reconciled into `
|
|
263
|
+
/** Agents declared in `lunora/agents.ts` (exported or not — see {@link InferredAgent.exported}); reconciled into wrangler `exports`. */
|
|
264
264
|
agents: InferredAgent[];
|
|
265
265
|
/** Containers declared in `lunora/containers.ts` (exported or not — see {@link InferredContainer.exported}). */
|
|
266
266
|
containers: InferredContainer[];
|
|
@@ -204,7 +204,7 @@ interface DurableObjectSpec {
|
|
|
204
204
|
* has a `.scheduler()` method at all. `@lunora/vite` depends on `@lunora/config`, so config
|
|
205
205
|
* owning it is the direction the dependency graph allows.
|
|
206
206
|
*/
|
|
207
|
-
declare const GENERATED_CLASS_MODULES: readonly ["agents", "containers", "scheduler", "workflows"];
|
|
207
|
+
declare const GENERATED_CLASS_MODULES: readonly ["agents", "containers", "scheduler", "shardRegistry", "workflows"];
|
|
208
208
|
/** One {@link GENERATED_CLASS_MODULES} entry. */
|
|
209
209
|
type GeneratedClassModule = (typeof GENERATED_CLASS_MODULES)[number];
|
|
210
210
|
/**
|
|
@@ -228,14 +228,14 @@ declare const COMPOSED_WORKER_ENTRY = "src/worker.ts";
|
|
|
228
228
|
* provision — wrangler rejects a `containers[].class_name` (and its Durable
|
|
229
229
|
* Object binding) that the worker doesn't export.
|
|
230
230
|
*/
|
|
231
|
-
|
|
231
|
+
type InferredContainer = ContainerIR & {
|
|
232
232
|
exported: boolean;
|
|
233
|
-
}
|
|
233
|
+
};
|
|
234
234
|
/**
|
|
235
235
|
* A `defineWorkflow` declaration plus whether its generated
|
|
236
236
|
* `WorkflowEntrypoint` class is exported by the worker entry. Only exported
|
|
237
|
-
* workflows are safe to provision — wrangler rejects
|
|
238
|
-
* the worker doesn't export. Workflows are NOT Durable Objects, so this never
|
|
237
|
+
* workflows are safe to provision — wrangler rejects an `exports.<Class>`
|
|
238
|
+
* workflow the worker doesn't export. Workflows are NOT Durable Objects, so this never
|
|
239
239
|
* implies a `durable_objects` binding or migration.
|
|
240
240
|
*/
|
|
241
241
|
interface InferredWorkflow extends WorkflowIR {
|
|
@@ -246,7 +246,7 @@ interface InferredWorkflow extends WorkflowIR {
|
|
|
246
246
|
* `WorkflowEntrypoint` class (e.g. `SupportAgentWorkflow`) is exported by the
|
|
247
247
|
* worker entry. An agent compiles onto a Cloudflare Workflow, so — exactly like
|
|
248
248
|
* {@link InferredWorkflow} — only exported agents are safe to provision
|
|
249
|
-
* (wrangler rejects
|
|
249
|
+
* (wrangler rejects an `exports.<Class>` workflow the worker doesn't export), and
|
|
250
250
|
* an agent is NOT a Durable Object (no `durable_objects` binding or migration).
|
|
251
251
|
*/
|
|
252
252
|
interface InferredAgent extends AgentIR {
|
|
@@ -260,7 +260,7 @@ interface InferredAgent extends AgentIR {
|
|
|
260
260
|
*/
|
|
261
261
|
type InferredQueue = QueueIR;
|
|
262
262
|
interface InferredBindings {
|
|
263
|
-
/** Agents declared in `lunora/agents.ts` (exported or not — see {@link InferredAgent.exported}); reconciled into `
|
|
263
|
+
/** Agents declared in `lunora/agents.ts` (exported or not — see {@link InferredAgent.exported}); reconciled into wrangler `exports`. */
|
|
264
264
|
agents: InferredAgent[];
|
|
265
265
|
/** Containers declared in `lunora/containers.ts` (exported or not — see {@link InferredContainer.exported}). */
|
|
266
266
|
containers: InferredContainer[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const f=[{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"]}],D=[...new Set(f.map(({path:e})=>e[0]))],u=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),p=(e,n)=>{let i=e;for(const s of n)i=u(i)?i[s]:void 0;return i},O=e=>{const n={};for(const{of:i,path:s}of f){const a=i(e);if(a===void 0)continue;const[t,o]=s;n[t]=o===void 0?a:{...n[t],[o]:a}}return n},I=(e,n,i)=>{if(n.length===0)return;const s=e.vectorize??[],a=new Set(s.filter(Boolean).map(t=>t?.index_name));for(const t of n)a.has(t)||i.push(`schema declares vector index "${t}"; wrangler "vectorize" must include a binding with index_name "${t}"`)},v=new Set(["basic","dev","lite","standard","standard-1","standard-2","standard-3","standard-4"]),$={disk_mb:2e4,memory_mib:12288,vcpu:4},k=(e,n,i)=>{const s=e.instance_type;if(s===void 0)return;if(typeof s=="string"){v.has(s)||i.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[r,c]of Object.entries($)){const m=s[r];m!==void 0&&(typeof m!="number"||m<=0||m>c)&&i.push(`${n} custom instance_type ${r} must be a positive number ≤ ${String(c)} (got ${String(m)})`)}const{disk_mb:a,memory_mib:t,vcpu:o}=s;if(typeof o=="number"&&typeof t=="number"&&t<o*3072&&i.push(`${n} custom instance_type needs ≥ 3 GiB (3072 MiB) memory per vCPU (got ${String(t)} MiB for ${String(o)} vCPU)`),typeof t=="number"&&typeof a=="number"){const r=Math.floor(t/1024*2e3);a>r&&i.push(`${n} custom instance_type allows ≤ 2 GB disk per GiB memory (≤ ${String(r)} MB for ${String(t)} MiB memory; got ${String(a)} MB)`)}},w=(e,n,i)=>{for(const s of["image","instance_type","max_instances"])e[s]!==void 0&&i.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,a]of Object.entries(e.images??{}))[a?.dockerfile,a?.image].filter(o=>typeof o=="string"&&o.length>0).length!==1&&i.push(`${n} images["${s}"] must set exactly one of "dockerfile" or "image"`)},M=(e,n,i)=>{const{boundClasses:s,classKinds:a,errors:t,warnings:o}=i;if(!e||typeof e!="object"||typeof e.class_name!="string"||e.class_name.length===0){t.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&&t.push(`${n} ("${e.class_name}") has unknown scheduling_policy "${e.scheduling_policy}" — expected "default" or "durable_object"`),r?w(e,`${n} ("${e.class_name}")`,t):(typeof e.image!="string"||e.image.length===0)&&t.push(`${n} ("${e.class_name}") must have an "image" — a Dockerfile path or a registry reference`),s.has(e.class_name)||t.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=a.get(e.class_name);c!=="sqlite"&&t.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}"]`),k(e,`${n} ("${e.class_name}")`,t),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`)},d=e=>typeof e=="string"&&e.length>0,g=e=>Array.isArray(e)?e.filter(n=>n!==null&&typeof n=="object"):[],l=e=>Array.isArray(e)?e.filter(n=>d(n)):[],_=e=>{const n=new Map;for(const i of g(e)){for(const s of l(i.new_classes))n.set(s,"classic");for(const s of l(i.new_sqlite_classes))n.set(s,"sqlite");for(const s of g(i.renamed_classes))if(d(s.from)&&d(s.to)){const a=n.get(s.from)??"sqlite";n.delete(s.from),n.set(s.to,a)}for(const s of l(i.deleted_classes))n.delete(s)}return n},S=e=>new Set(_(e).keys()),N=(e,n)=>{const i=S(e.migrations);for(const s of g(e.durable_objects?.bindings))s.script_name===void 0&&d(s.class_name)&&!i.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`)},C=(e,n,i)=>{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 a=new Set(g(e.durable_objects?.bindings).map(o=>o.class_name)),t=_(e.migrations);for(const[o,r]of s.entries())M(r,`containers[${String(o)}]`,{boundClasses:a,classKinds:t,errors:n,warnings:i});e.observability?.enabled!==!0&&i.push('containers are configured but observability is not enabled — container logs will not be captured (add { "observability": { "enabled": true } })')},b=e=>e,h=(e,n,i,s)=>{if(e!==void 0){if(!Array.isArray(e)){s.push(i.arrayMessage);return}for(const[a,t]of b(e).entries()){const o=`${n}[${String(a)}]`;if(!t||typeof t!="object"){s.push(i.objectMessage(o));continue}for(const r of i.fields)d(t[r.field])||s.push(r.message(o))}}},F={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`},j=(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",E=e=>{if(e!==void 0)return u(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"},x=e=>e===void 0?[]:u(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"],y=(e,n,i,s)=>{const a=[j(e.schedules,i),E(e.limits),...x(e.default_retention)];for(const t of a)t!==void 0&&s.push(`${n}.${t}`)},A=(e,n)=>f.map(({path:i})=>i).filter(i=>{const s=p(e,i),a=p(n,i),t=typeof a=="string"&&i[0]==="schedules"?[a]:a;return s!==void 0&&a!==void 0&&JSON.stringify(s)!==JSON.stringify(t)}).map(i=>i.join(".")),R=(e,n,i,s)=>{const a=`exports["${e}"]`,t=String(n.name);for(const o of i){if(!u(o)||o.name!==n.name)continue;const r=`workflows entry "${String(o.binding)}"`;if(o.script_name!==void 0){s.push(`${r} binds workflow "${t}" in another Worker, but ${a} declares a workflow with that name here — workflow names are unique per account`);continue}o.class_name!==e&&s.push(`${r} and ${a} both declare workflow "${t}" but name different classes ("${String(o.class_name)}" vs "${e}")`);for(const c of A(o,n))s.push(`${r} and ${a} set ${c} to different values for workflow "${t}" — set it in one place`)}},L=(e,n)=>{const i=Array.isArray(e.workflows)?b(e.workflows):[];for(const[a,t]of i.entries())u(t)&&y(t,`workflows[${String(a)}]`,!1,n);const s=u(e.exports)?Object.entries(e.exports):[];for(const[a,t]of s)!u(t)||t.type!=="workflow"||(d(t.name)?(y(t,`exports["${a}"]`,!0,n),R(a,t,i,n)):n.push(`exports["${a}"] is a workflow export and must have a non-empty "name" naming the deployed workflow`))},q={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`},B={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`},U=(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}h(e.queues.producers,"queues.producers",q,n),h(e.queues.consumers,"queues.consumers",B,n)}},T={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`},W=[{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"}],G=(e,n,i,s)=>{const a=e[n.key];if(a!==void 0){if(!Array.isArray(a)){i.push(n.arrayMessage);return}for(const[t,o]of b(a).entries()){const r=`${n.key}[${String(t)}]`;if(!o||typeof o!="object"||!d(o.binding)){i.push(n.bindingMessage(r));continue}(typeof n.hintField=="string"?[n.hintField]:n.hintField).some(m=>d(o[m]))||s.push(n.hintMessage(r,o.binding))}}},P=[{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" })'}],K=(e,n,i)=>{const s=e[n.key];s!==void 0&&(typeof s!="object"||s===null||Array.isArray(s)||!d(s.binding))&&i.push(n.message)},Q=[{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,i)=>{n?.hasD1GlobalTable&&!g(e.d1_databases).some(s=>s.binding==="DB")&&i.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&&g(e.hyperdrive).length===0&&i.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)')},H=(e,n)=>{const{d1_databases:i}=e;if(i!==void 0){if(!Array.isArray(i)){n.push("d1_databases must be an array of { binding, database_id | database_name } entries");return}for(const[s,a]of b(i).entries()){const t=`d1_databases[${String(s)}]`;if(!a||typeof a!="object"){n.push(`${t} must be a { binding, database_id | database_name } object`);continue}d(a.binding)||n.push(`${t} must have a non-empty "binding" naming the D1 binding`),!d(a.database_id)&&!d(a.database_name)&&n.push(`${t} must have a "database_id" or a "database_name" — run \`wrangler d1 create\` and set one, or the binding can't resolve`)}}},V=(e,n)=>{const{vpc_networks:i}=e;if(i!==void 0){if(!Array.isArray(i)){n.push("vpc_networks must be an array of { binding, tunnel_id | network_id } entries");return}for(const[s,a]of b(i).entries()){const t=`vpc_networks[${String(s)}]`;if(!a||typeof a!="object"){n.push(`${t} must be a { binding, tunnel_id | network_id } object`);continue}d(a.binding)||n.push(`${t} must have a non-empty "binding" naming the VPC Network binding`),d(a.tunnel_id)===d(a.network_id)&&n.push(`${t} must set exactly one of "tunnel_id" (a Cloudflare Tunnel) or "network_id" ("cf1:network" for Cloudflare Mesh)`)}}};export{W as H,Q as R,P as S,F as W,z as a,H as b,I as c,C as d,h as e,L as f,U as g,G as h,K as i,V as j,T as k,d as l,D as m,l as n,g as o,f as p,p as s,N as v,O as w};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{l as d,o as p}from"./validate-bindings-Dnf1t0SY.mjs";const b=new Set(["1","enabled","on","true","yes"]),m=s=>typeof s=="string"&&b.has(s.trim().toLowerCase()),y=(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`)},g=(s,t)=>{s.logpush!==void 0&&typeof s.logpush!="boolean"&&t.push('logpush must be a boolean (set "logpush": true to enable Cloudflare Logpush)')},v=(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"] })')},c=3e5,_=(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>c&&t.push(`limits.cpu_ms must be at most ${String(c)} (Cloudflare's per-invocation ceiling)`)}},l=new Set(["off","smart","targeted"]),A=(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"||!l.has(i))&&t.push(`placement.mode must be one of ${[...l].map(n=>`"${n}"`).join(", ")}`)},j=(s,t)=>{const{observability:e}=s;if(e===void 0)return;if(typeof e!="object"||Array.isArray(e)){t.push('observability must be an object (e.g. { "enabled": true, "head_sampling_rate": 1 })');return}const i=(n,o)=>{n!==void 0&&(typeof n!="number"||Number.isNaN(n)||n<0||n>1)&&t.push(`${o} must be a number in [0, 1] (the fraction of requests sampled)`)};i(e.head_sampling_rate,"observability.head_sampling_rate"),e.logs!==void 0&&(typeof e.logs!="object"||Array.isArray(e.logs)?t.push("observability.logs must be an object"):(i(e.logs.head_sampling_rate,"observability.logs.head_sampling_rate"),e.logs.invocation_logs!==void 0&&typeof e.logs.invocation_logs!="boolean"&&t.push('observability.logs.invocation_logs must be a boolean (set "invocation_logs": true to keep per-invocation summaries)')))},S=(s,t)=>{const{cache:e}=s;if(e!==void 0){if(typeof e!="object"||e===null||Array.isArray(e)){t.push('cache must be an object (e.g. { "enabled": true })');return}e.enabled!==void 0&&typeof e.enabled!="boolean"&&t.push("cache.enabled must be a boolean (true or false)")}},O=(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`))}}},E=(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")}},L=(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`)},N=(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]}},R=(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(u=>u.trim()==="*"),a=m(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')},f=s=>p(s.durable_objects?.bindings).some(t=>t.class_name==="SchedulerDO"&&t.script_name===void 0),r="LUNORA_ORIGIN_URL",$=(s,t,e)=>{if(!f(s)||d(s.vars?.[r]))return;const i=t===void 0?"vars":`env.${t}.vars`,n=t===void 0?"":` --env ${t}`;e.push(`durable_objects.bindings declares the SchedulerDO but ${i}.${r} 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}.${r} to the worker's public URL, or \`wrangler secret put ${r}${n}\` (ignore this if it is already set as a secret or in the dashboard).`)};export{E as validateAssets,S as validateCache,R as validateCorsVariables,O as validateExports,_ as validateLimits,g as validateLogpush,j as validateObservability,A as validatePlacement,$ as validateSchedulerOrigin,v as validateSecretsRequired,y as validateSendEmail,L as validateTailConsumers,N as withTailConsumer};
|
package/dist/packem_shared/{wranglerToAlchemy-DZOim9As.mjs → wranglerToAlchemy-BMOQYRyw.mjs}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const o=e=>JSON.stringify(e),$=/^[A-Z_a-z][\w$]*$/u,d=e=>$.test(e),u=e=>d(e)?e:`binding_${e.replaceAll(/\W/gu,"_")}`,m=(e,s=u(e))=>{const n=d(e);return n&&s===e?`${e},`:`${n?e:o(e)}: ${s},`},g=e=>{const s=new Set;for(const n of e.migrations??[])for(const r of n.new_sqlite_classes??[])s.add(r);return s},v=(e,s,n,r,c)=>{for(const a of e.durable_objects?.bindings??[])if(!(a.name===void 0||a.class_name===void 0)){if(a.script_name!==void 0){c.push(`durable_objects.${a.name} (external script_name "${a.script_name}")`);continue}n.add("DurableObjectNamespace"),r.push(m(a.name,`DurableObjectNamespace(${o(a.name)}, { className: ${o(a.class_name)}, sqlite: ${String(s.has(a.class_name))} })`))}},h=(e,s)=>{for(const[n,r]of Object.entries(e.vars??{}))s.push(m(n,o(r)))},w=["ai","analytics_engine_datasets","assets","browser","containers","flagship","hyperdrive","images","pipelines","secrets_store_secrets","send_email","services","tail_consumers","vectorize","worker_loaders","workflows"],f=(e,s)=>{for(const n of w){const r=e[n];r!==void 0&&(!Array.isArray(r)||r.length>0)&&s.push(n)}(e.queues?.consumers?.length??0)>0&&s.push("queues.consumers")},k=e=>{const s=e.name??"worker",n=[],r=new Set(["Worker"]),c=[],a=[],p=g(e),b=[{construct:"D1Database",entries:(e.d1_databases??[]).map(t=>({binding:t.binding,name:t.database_name})),nameKey:"name"},{construct:"R2Bucket",entries:(e.r2_buckets??[]).map(t=>({binding:t.binding,name:t.bucket_name})),nameKey:"name"},{construct:"KVNamespace",entries:(e.kv_namespaces??[]).map(t=>({binding:t.binding,name:t.binding})),nameKey:"title"},{construct:"Queue",entries:(e.queues?.producers??[]).map(t=>({binding:t.binding,name:t.queue})),nameKey:"name"}];for(const{construct:t,entries:l,nameKey:y}of b)for(const i of l)i.binding!==void 0&&(r.add(t),c.push(`const ${u(i.binding)} = await ${t}(${o(i.binding)}, { adopt: true, ${y}: ${o(i.name??i.binding)} });`),a.push(m(i.binding)));v(e,p,r,a,n),h(e,a),f(e,n);const _=["adopt: true,",a.length===0?void 0:`bindings: {
|
|
1
|
+
const o=e=>JSON.stringify(e),$=/^[A-Z_a-z][\w$]*$/u,d=e=>$.test(e),u=e=>d(e)?e:`binding_${e.replaceAll(/\W/gu,"_")}`,m=(e,s=u(e))=>{const n=d(e);return n&&s===e?`${e},`:`${n?e:o(e)}: ${s},`},g=e=>{const s=new Set;for(const n of e.migrations??[])for(const r of n.new_sqlite_classes??[])s.add(r);return s},v=(e,s,n,r,c)=>{for(const a of e.durable_objects?.bindings??[])if(!(a.name===void 0||a.class_name===void 0)){if(a.script_name!==void 0){c.push(`durable_objects.${a.name} (external script_name "${a.script_name}")`);continue}n.add("DurableObjectNamespace"),r.push(m(a.name,`DurableObjectNamespace(${o(a.name)}, { className: ${o(a.class_name)}, sqlite: ${String(s.has(a.class_name))} })`))}},h=(e,s)=>{for(const[n,r]of Object.entries(e.vars??{}))s.push(m(n,o(r)))},w=["ai","analytics_engine_datasets","assets","browser","containers","flagship","hyperdrive","images","pipelines","secrets_store_secrets","send_email","services","tail_consumers","vectorize","worker_loaders","workflows","exports"],f=(e,s)=>{for(const n of w){const r=e[n];r!==void 0&&(!Array.isArray(r)||r.length>0)&&s.push(n)}(e.queues?.consumers?.length??0)>0&&s.push("queues.consumers")},k=e=>{const s=e.name??"worker",n=[],r=new Set(["Worker"]),c=[],a=[],p=g(e),b=[{construct:"D1Database",entries:(e.d1_databases??[]).map(t=>({binding:t.binding,name:t.database_name})),nameKey:"name"},{construct:"R2Bucket",entries:(e.r2_buckets??[]).map(t=>({binding:t.binding,name:t.bucket_name})),nameKey:"name"},{construct:"KVNamespace",entries:(e.kv_namespaces??[]).map(t=>({binding:t.binding,name:t.binding})),nameKey:"title"},{construct:"Queue",entries:(e.queues?.producers??[]).map(t=>({binding:t.binding,name:t.queue})),nameKey:"name"}];for(const{construct:t,entries:l,nameKey:y}of b)for(const i of l)i.binding!==void 0&&(r.add(t),c.push(`const ${u(i.binding)} = await ${t}(${o(i.binding)}, { adopt: true, ${y}: ${o(i.name??i.binding)} });`),a.push(m(i.binding)));v(e,p,r,a,n),h(e,a),f(e,n);const _=["adopt: true,",a.length===0?void 0:`bindings: {
|
|
2
2
|
${a.join(`
|
|
3
3
|
`)}
|
|
4
4
|
},`,e.compatibility_date===void 0?void 0:`compatibilityDate: ${o(e.compatibility_date)},`,e.compatibility_flags===void 0||e.compatibility_flags.length===0?void 0:`compatibilityFlags: ${o([...e.compatibility_flags])},`,e.triggers?.crons===void 0||e.triggers.crons.length===0?void 0:`crons: ${o([...e.triggers.crons])},`,e.main===void 0?void 0:`entrypoint: ${o(e.main)},`,`name: ${o(s)},`].filter(t=>t!==void 0);return{source:["// GENERATED by @lunora/config from wrangler.jsonc — do not edit.","// Re-generated on every `lunora deploy`; edit wrangler.jsonc instead.","",'import alchemy from "alchemy";',`import { ${[...r].toSorted((t,l)=>t.localeCompare(l)).join(", ")} } from "alchemy/cloudflare";`,"",`const app = await alchemy(${o(s)});`,"",...c.length===0?[]:[...c,""],`export const worker = await Worker(${o(s)}, {`,` ${_.join(`
|
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.287",
|
|
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.
|
|
58
|
-
"@lunora/container": "1.0.0-alpha.
|
|
59
|
-
"@lunora/errors": "1.0.0-alpha.
|
|
60
|
-
"@lunora/seed": "1.0.0-alpha.
|
|
57
|
+
"@lunora/codegen": "1.0.0-alpha.242",
|
|
58
|
+
"@lunora/container": "1.0.0-alpha.64",
|
|
59
|
+
"@lunora/errors": "1.0.0-alpha.48",
|
|
60
|
+
"@lunora/seed": "1.0.0-alpha.172",
|
|
61
61
|
"@visulima/colorize": "2.1.1",
|
|
62
62
|
"@visulima/find-ai-runner": "1.0.2",
|
|
63
63
|
"@visulima/package": "5.0.20",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{sqliteClasses as c}from"./wranglerToAlchemy-DZOim9As.mjs";const u=1,l=new Set(["$schema","account_id","compatibility_date","compatibility_flags","keep_vars","main","migrations","minify","name","observability","placement","routes","rules","triggers","upload_source_maps","vars","workers_dev"]),p=e=>Object.fromEntries(Object.entries(e).filter(([,t])=>t!==void 0)),a=[{bindingKey:"binding",field:"analytics_engine_datasets",resourceKey:"dataset",type:"analytics_engine"},{bindingKey:"class_name",field:"containers",resourceKey:"image",type:"container"},{bindingKey:"binding",field:"d1_databases",resourceIdKey:"database_id",resourceKey:"database_name",type:"d1"},{bindingKey:"binding",field:"hyperdrive",resourceIdKey:"id",type:"hyperdrive"},{bindingKey:"binding",field:"kv_namespaces",resourceIdKey:"id",type:"kv"},{bindingKey:"binding",field:"pipelines",resourceKey:"pipeline",type:"pipeline"},{bindingKey:"binding",field:"r2_buckets",resourceKey:"bucket_name",type:"r2"},{bindingKey:"binding",field:"vectorize",resourceKey:"index_name",type:"vectorize"},{bindingKey:"binding",field:"workflows",resourceKey:"name",type:"workflow"}],d=[{field:"ai",type:"ai"},{field:"assets",type:"assets"},{field:"browser",type:"browser"},{field:"images",type:"images"}],y=new Set([...a.map(e=>e.field),...d.map(e=>e.field),"durable_objects","queues"]),o=(e,t)=>{const s=t===void 0?void 0:e[t];return typeof s=="string"&&s!==""?s:void 0},b=(e,t)=>{const s=[];for(const n of a)for(const i of e[n.field]??[]){const r=o(i,n.bindingKey);if(r===void 0){t.push(n.field);continue}s.push({binding:r,className:o(i,"class_name"),resource:o(i,n.resourceKey),resourceId:o(i,n.resourceIdKey),type:n.type})}return s},m=(e,t)=>{const s=c(e),n=[];for(const i of e.durable_objects?.bindings??[]){if(i.name===void 0||i.name===""){t.push("durable_objects");continue}n.push({binding:i.name,className:i.class_name,sqlite:i.script_name===void 0&&i.class_name!==void 0?s.has(i.class_name):void 0,type:"durable_object"})}return n},_=(e,t)=>{const s=[];for(const n of e.queues?.producers??[]){if(n.binding===void 0||n.binding===""){t.push("queues.producers");continue}s.push({binding:n.binding,resource:n.queue,type:"queue_producer"})}for(const n of e.queues?.consumers??[]){if(n.queue===void 0||n.queue===""){t.push("queues.consumers");continue}s.push({binding:n.queue,resource:n.queue,type:"queue_consumer"})}return s},g=(e,t)=>[...b(e,t),...m(e,t),..._(e,t),...d.filter(s=>e[s.field]?.binding!==void 0).map(s=>({binding:e[s.field]?.binding,type:s.type}))],v=e=>{const t=[],s=g(e,t).map(i=>p(i)).toSorted((i,r)=>i.type.localeCompare(r.type)||i.binding.localeCompare(r.binding)),n=[...Object.keys(e).filter(i=>!l.has(i)&&!y.has(i)),...t.map(i=>`${i} (entry with no binding name)`)].toSorted((i,r)=>i.localeCompare(r));return{bindings:s,...e.compatibility_date===void 0?{}:{compatibilityDate:e.compatibility_date},...e.compatibility_flags===void 0?{}:{compatibilityFlags:e.compatibility_flags},crons:e.triggers?.crons??[],...e.name===void 0?{}:{name:e.name},unknown:n,vars:Object.keys(e.vars??{}).toSorted((i,r)=>i.localeCompare(r)),version:u}};export{u as BINDING_MANIFEST_VERSION,v as buildBindingManifest};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{readFileSync as i,existsSync as E}from"node:fs";import{parse as S}from"es-module-lexer";import{WRANGLER_FILES as O,readWranglerJsonc as d}from"./WRANGLER_FILES-UNW-xY5u.mjs";import{escapeRegExp as R}from"./DEV_VARS_EXAMPLE_FILE-CqLorAxT.mjs";import{join as p}from"node:path";const x="_generated",b=["src/server.ts","src/server/index.ts","src/server/index.tsx","src/index.ts","src/worker.ts"],_=new Set(["build","coverage","dist",x,"node_modules","out","target"]),g=new Set([".client",".server"]),w=/[/\\]/u,h=t=>{const e=[];for(const r of t.split(w))r===""||r==="."||(r===".."&&e.length>0&&e.at(-1)!==".."?e.pop():e.push(r));return e},D=t=>h(t).slice(0,-1).some(e=>_.has(e)||e.startsWith(".")&&!g.has(e)),l={SchedulerDO:"SCHEDULER",SessionDO:"SESSION",ShardDO:"SHARD"},u=Object.keys(l),U=t=>Object.hasOwn(l,t),T="virtual:lunora/worker",v=["ShardDO"],B=["agents","containers","scheduler","workflows"],A="src/worker.ts",P=t=>{for(const e of O){const r=p(t,e);if(!E(r))continue;const{parsed:s}=d(r),o=s?.main;if(o===T)return{composed:!0};const a=p(t,A);if(E(a))return{composed:!1,path:a};if(typeof o=="string"&&!D(o)&&E(p(t,o)))return{composed:!1,path:p(t,o)};break}for(const e of b){const r=p(t,e);if(E(r))return{composed:!1,path:r}}return{composed:!1}},C=/(?:^|[\s,{])type$/u,m=(t,e)=>{const r=e.ls>=0?e.ls:e.s;return C.test(t.slice(0,r).trimEnd())},f=(t,e)=>{const r=R(e);return new RegExp(String.raw`\bexport\s+type\s+${r}\b`,"u").test(t)||new RegExp(String.raw`\bexport\s+type\s*\{[^}]*\b${r}\b`,"u").test(t)||new RegExp(String.raw`\bexport\s+\{[^}]*\btype\s+${r}\b`,"u").test(t)},W=t=>{const e=i(t,"utf8");let r;try{const[,s]=S(e);r=new Set(s.filter(o=>!m(e,o)).map(o=>o.n))}catch{r=new Set(u.filter(s=>new RegExp(String.raw`\bexport\b[^\n;]*\b${s}\b`,"u").test(e)&&!f(e,s)))}return u.filter(s=>r.has(s)).map(s=>({binding:l[s],className:s}))},$=(t,e,r)=>{if(e.length===0)return[];if(t.composed)return e.map(n=>({...n,exported:!0}));if(t.path===void 0)return e.map(n=>({...n,exported:!1}));const s=i(t.path,"utf8"),o=new RegExp(String.raw`\bexport\s*\*\s*from\s*["'][^"']*_generated\/${r}(?:\.js)?["']`).test(s);let a;try{const[,n]=S(s);a=new Set(n.filter(c=>!m(s,c)).map(c=>c.n))}catch{a=new Set(e.map(n=>n.className).filter(n=>new RegExp(String.raw`\bexport\b[^\n;]*\b${R(n)}\b`,"u").test(s)&&!f(s,n)))}return e.map(n=>{const c=o||a.has(n.className);return{...n,exported:c}})};export{v as COMPOSED_ENTRY_DURABLE_OBJECTS,A as COMPOSED_WORKER_ENTRY,l as DURABLE_OBJECT_BINDINGS,B as GENERATED_CLASS_MODULES,x as GENERATED_DIRECTORY,T as LUNORA_WORKER_VIRTUAL_ID,_ as NON_SOURCE_DIRECTORIES,g as SOURCE_DOT_DIRECTORIES,b as WORKER_ENTRY_FALLBACKS,$ as detectClassExports,W as detectExportedDurableObjects,U as isFrameworkDurableObject,D as isGeneratedOutput,P as resolveWorkerEntry};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{writeFileSync as $,rmSync as N,existsSync as v,readFileSync as D}from"node:fs";import{dirname as y,resolve as d,join as h,sep as p,relative as w}from"node:path";import{findWranglerFile as k,readWranglerJsonc as V}from"./WRANGLER_FILES-UNW-xY5u.mjs";import W from"./CLOUDFLARE_DRIVER-DUE6r-Pg.mjs";const Y=".celld.wrangler.json",F=h(".wrangler","deploy","config.json"),U=new Set(["$schema","assets","compatibility_date","compatibility_flags","containers","d1_databases","define","durable_objects","kv_namespaces","main","migrations","name","no_bundle","queues","r2_buckets","rules","services","triggers","vars","worker_loaders","workflows"]),B=new Set(["class_name","image","instance_type","max_instances","name","runtime"]),K=new Set(["CompiledWasm","Data","Text"]),x=/\r?\n/u,G=/[!*?[]/u,J=/[.[]/u,M=["deleted_classes","new_classes","renamed_classes","transferred_classes"],l=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),P=e=>Array.isArray(e)&&e.length===0||l(e)&&Object.values(e).every(r=>P(r)),H=e=>Array.isArray(e)?e.map(r=>{if(!l(r))return r;const n=M.find(t=>r[t]!==void 0);if(n!==void 0)throw new Error(`migration "${String(r.tag)}" uses \`${n}\`, which celld refuses — celld accepts only \`new_sqlite_classes\` migrations`);return{new_sqlite_classes:r.new_sqlite_classes,tag:r.tag}}):e,X=(e,r)=>Array.isArray(e)?e.map((n,t)=>l(n)?Object.fromEntries(Object.entries(n).filter(([o])=>{const s=B.has(o);return s||r.push(`containers[${String(t)}].${o}`),s})):n):e,q=(e,r)=>Array.isArray(e)?e.filter((n,t)=>{const o=l(n)&&typeof n.type=="string"&&K.has(n.type);return o||r.push(`rules[${String(t)}]`),o}):e,z=e=>{const r=[],n={};for(const[t,o]of Object.entries(e)){if(!U.has(t)){P(o)||r.push(t);continue}switch(t){case"containers":{n[t]=X(o,r);break}case"migrations":{n[t]=H(o);break}case"rules":{n[t]=q(o,r);break}default:n[t]=o}}return{config:n,dropped:r}},Q=e=>{const[r=[],...n]=e.map(o=>d(o).split(p));let t=0;for(;t<r.length&&n.every(o=>o[t]===r[t]);)t+=1;return r.slice(0,t).join(p)||p},Z=(e,r,n)=>{const t=s=>w(n,d(r,s)).split(p).join("/"),o={...e};return typeof e.main=="string"&&(o.main=t(e.main)),l(e.assets)&&typeof e.assets.directory=="string"&&(o.assets={...e.assets,directory:t(e.assets.directory)}),o},ee=e=>{const r=h(e,".assetsignore");if(!v(r))return;const n=D(r,"utf8").split(x).map(t=>t.trim()).filter(t=>t!==""&&!t.startsWith("#")).filter(t=>G.test(t)||v(h(e,t)));if(n.length>0)throw new Error(`${r} hides ${n.join(", ")} from the assets, and celld has no .assetsignore — remove those files from ${e} first`);return r},re=(e,r)=>{const n=h(e,F);if(!v(n))throw new Error(`wrangler \`main\` is the Vite virtual module "${r}", so celld deploys the Vite build output — and there is none yet. Run the project's build (\`vite build\`) first`);const{configPath:t}=JSON.parse(D(n,"utf8"));if(typeof t!="string")throw new TypeError(`${n} names no configPath`);return d(y(n),t)},S=e=>{const{parsed:r}=V(e);if(r===void 0)throw new Error(`${e} is not valid JSONC`);return r},te=(e,r,n,t)=>{const{d1_databases:o}=e;if(!Array.isArray(o)||t===n)return e;const s=Array.isArray(r.d1_databases)?r.d1_databases.filter(a=>l(a)):[];return{...e,d1_databases:o.map(a=>{if(!l(a))return a;const i=s.find(m=>m.binding===a.binding)?.migrations_dir,c=d(n,typeof i=="string"?i:"migrations");return v(c)?{...a,migrations_dir:w(t,c).split(p).join("/")}:a})}},ne=(e,r,n,t)=>{const{main:o}=n;if(typeof o!="string"||!o.startsWith("virtual:"))return{fromBuild:!1,source:n,sourcePath:r};if(t==="dev")throw new Error(`wrangler \`main\` is the Vite virtual module "${o}", which only a Vite build can resolve — \`celld dev\` rebuilds from a source file. Use \`vite dev\` for the dev loop and \`lunora deploy\` to ship the build to celld, or point \`main\` at a worker file`);const s=re(e,o);return{fromBuild:!0,source:S(s),sourcePath:s}},oe=(e,r,n,t,o)=>{const s=r.filter(c=>Object.hasOwn(n,c.split(J)[0]??c));let a=e;e.no_bundle!==void 0&&(a=Object.fromEntries(Object.entries(e).filter(([c])=>c!=="no_bundle")),s.push("no_bundle (celld re-bundles the build output)"));const i=t===void 0?void 0:ee(t);return i!==void 0&&s.push(`${w(o,i)} (matched no files)`),{assetsIgnore:i,projected:a,reported:s}},se=e=>{const r=l(e.vars)?e.vars:{};return{...e,vars:{WORKER_ENV:"development",...r}}},ie=(e,r)=>{const n=k(e);if(n===void 0)throw new Error(`no wrangler.jsonc or wrangler.json in ${e} — celld deploys from the project's Wrangler config`);const t=S(n),{fromBuild:o,source:s,sourcePath:a}=ne(e,n,t,r),i=y(a),{config:c,dropped:m}=z(s),{assets:g}=s,_=l(g)&&typeof g.directory=="string"?d(i,g.directory):void 0,I=typeof s.main=="string"?y(d(i,s.main)):void 0,f=Q([i,I,_].filter(L=>L!==void 0));if(!o&&f!==i)throw new Error(`wrangler \`main\` and \`assets.directory\` must sit inside ${i} — celld resolves everything against the config's directory`);const b=te(Z(c,i,f),t,e,f),u=o?oe(b,m,t,_,f):{assetsIgnore:void 0,projected:b,reported:m},R=r==="dev"?se(u.projected):u.projected,j=h(f,Y),T=`${JSON.stringify(R,void 0,4)}
|
|
2
|
-
`;return{configPath:j,dropped:u.reported,write:()=>{$(j,T),u.assetsIgnore!==void 0&&N(u.assetsIgnore)}}},ae=[["entry","`celld deploy` deploys the config's `main`; a composed framework entry has no celld equivalent yet"],["environment","celld has no Wrangler environments — deploy a separate config per environment"],["outDir","`celld deploy` does not write its bundle to disk"],["preview","celld has no preview versions — a deploy replaces the fleet's current deployment"],["temporary","celld has no short-lived accounts — it deploys to the fleet bucket in CELLD_BUCKET"]],O=e=>{if(e===void 0)throw new Error("the celld driver runs the projected wrangler config — pass `configPath` from `projectConfig`");return e},ce={deploy:e=>{const r=ae.find(([n])=>e[n]!==void 0&&e[n]!==!1);if(r!==void 0)throw new Error(r[1]);return{args:["deploy",O(e.configPath),...e.dryRun===!0?["--dry-run"]:[]],onPath:!0,tool:"celld"}},devServer:"own",prebuildsContainerImages:!1,dev:e=>{if(e.environment!==void 0)throw new Error("celld has no Wrangler environments — `celld dev` runs the top-level config");return{args:["dev",O(e.configPath),...e.extraArgs??[]],onPath:!0,tool:"celld"}}},le={id:"celld",name:"celld",projectConfig:ie,toolchain:ce},de={id:"node",name:"Node"},fe="cloudflare",E={celld:le,cloudflare:W,node:de},A=()=>Object.keys(E).toSorted((e,r)=>e.localeCompare(r)),C=(e=fe)=>{const r=E[e];if(r===void 0)throw new Error(`unknown deploy target "${e}" — available targets: ${A().join(", ")}`);return r},ue=e=>Object.hasOwn(E,e)&&C(e).toolchain!==void 0,ge=()=>A().filter(e=>ue(e)),ye=e=>C(e).toolchain?.devServer==="own",we=(e,r,n,t)=>{const o=e.projectConfig?.(r,n);return{command:t(o?.configPath),commit:()=>o?.write(),projection:o===void 0?void 0:{configPath:o.configPath,dropped:o.dropped}}};export{fe as DEFAULT_DEPLOY_TARGET,A as deployTargetIds,ue as isRunnableTarget,we as planToolchainInvocation,C as resolveDeployDriver,ge as runnableTargetIds,ye as targetRunsOwnDevServer};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{o as g,v as _,a as b,b as f,c as E,d as m,e as d,f as h,H as D,g as R,R as S,S as p,h as I,W as y,i as B}from"./validate-bindings-D6-vb6if.mjs";import{validateTailConsumers as L,validateSendEmail as O,validateLogpush as T,validateLimits as C,validatePlacement as N,validateObservability as w,validateAssets as A,validateCache as $,validateExports as j,validateCorsVariables as U,validateSchedulerOrigin as k}from"./withTailConsumer-DaP3r6ia.mjs";import{isCacheEnabled as W,WORKERS_CACHE_MIN_DATE as c}from"./WORKERS_CACHE_MIN_DATE-0k9ABJtF.mjs";import{mergeWranglerEnvironment as G}from"./mergeWranglerEnvironment-BIcLqPfv.mjs";const v="2026-04-07",K="web_socket_auto_reply_to_close",u=/^\d{4}-\d{2}-\d{2}$/,H=(o,r,l)=>{const{error:e,merged:i,unverifiedKeys:n}=G(o,r);return e!==void 0?{error:e,wrangler:i}:(n.length>0&&l.push(`env.${String(r)} overrides ${n.join(", ")}, which this validator doesn't have a verified inheritance rule for — validated against the TOP-LEVEL value only. Double-check ${n.length===1?"it":"them"} by hand for "${String(r)}".`),{wrangler:i})},F=(o,r,l)=>{const e=[],i=[];if(!o||typeof o!="object")return e.push("wrangler config is not a valid object"),{errors:e,valid:!1,warnings:i};const{error:n,wrangler:a}=H(o,l,i);if(n!==void 0)return e.push(n),{errors:e,valid:!1,warnings:i};g(a.durable_objects?.bindings).find(t=>t.name==="SHARD"&&t.class_name==="ShardDO")||e.push('durable_objects.bindings must include { "name": "SHARD", "class_name": "ShardDO" } — your dev server auto-reconciles this on startup, or add the binding manually'),_(a,e);const s=a.compatibility_date??"";s&&!u.test(s)?e.push(`compatibility_date must be in YYYY-MM-DD format (got "${s}")`):s<v&&e.push(`compatibility_date must be >= "${v}" (got "${s||"<missing>"}")`),W(a)&&u.test(s)&&s<c&&e.push(`cache.enabled requires compatibility_date >= "${c}" (got "${s||"<missing>"}")`),b(a,r,e),f(a,e),E(a,r?.vectorIndexNames??[],e),L(a,e),m(a,e,i),d(a.workflows,"workflows",y,e),h(a,e),d(a.secrets_store_secrets,"secrets_store_secrets",B,e);for(const t of D)R(a,t,e,i);for(const t of S)d(a[t.key],t.key,t,e);for(const t of p)I(a,t,e);return O(a,e,i),T(a,e),C(a,e),N(a,e),w(a,e),A(a,e),$(a,e),j(a,e),U(a,e),k(a,l,i),{errors:e,valid:e.length===0,warnings:i}},q=F;export{v as REQUIRED_COMPATIBILITY_DATE,K as REQUIRED_FLAG,q as validateWrangler,F as validateWranglerConfig};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{existsSync as f,readFileSync as O,readdirSync as W}from"node:fs";import{join as p,dirname as y,extname as w,basename as _}from"node:path";import{discoverSchemaInfo as P}from"./discoverSchemaInfo-DJvevsCm.mjs";import{COMPOSED_WORKER_ENTRY as L,LUNORA_WORKER_VIRTUAL_ID as g,isGeneratedOutput as F,WORKER_ENTRY_FALLBACKS as M,GENERATED_DIRECTORY as U,COMPOSED_ENTRY_DURABLE_OBJECTS as D,GENERATED_CLASS_MODULES as A,SOURCE_DOT_DIRECTORIES as B,NON_SOURCE_DIRECTORIES as G,isFrameworkDurableObject as Y}from"./COMPOSED_WORKER_ENTRY-5R-BECOC.mjs";import{o as K}from"./validate-bindings-D6-vb6if.mjs";import{Project as X,Node as l}from"ts-morph";import{mergeWranglerEnvironment as J}from"./mergeWranglerEnvironment-BIcLqPfv.mjs";import{findWranglerFile as V,readWranglerJsonc as q}from"./WRANGLER_FILES-UNW-xY5u.mjs";import{validateWranglerConfig as z}from"./REQUIRED_COMPATIBILITY_DATE-g_1F-n2X.mjs";const E=[".ts",".tsx",".mts",".cts"],b=new Set(E),H=new Set([".cjs",".js",".mjs"]),v="default",x={".cjs":[".cts"],".js":[".ts",".tsx"],".mjs":[".mts"]},Q=250,Z=(e,s,t)=>{const r=p(s,L);if(f(r))return{origin:"declared",path:r};if(e===g)return{origin:"composed"};const n=()=>{const i=M.map(a=>p(s,a)).find(a=>f(a));return i===void 0?void 0:{origin:"probed",path:i}};if(typeof e!="string"||e.length===0||F(e))return n();const o=p(y(t),e),c=w(o);if(!(!b.has(c)&&!H.has(c)))return f(o)?{origin:"declared",path:o}:{origin:"absent",path:o}},T=(e,s)=>{if(l.isIdentifier(e)){s.add(e.getText());return}if(l.isObjectBindingPattern(e)||l.isArrayBindingPattern(e))for(const t of e.getElements())l.isBindingElement(t)&&T(t.getNameNode(),s)},ee=(e,s)=>{const t=[];for(const r of e.getExportDeclarations())if(!r.isTypeOnly()){if(r.isNamespaceExport()){const n=r.getNamespaceExport();n===void 0?t.push(r.getModuleSpecifierValue()??""):s.add(n.getName());continue}for(const n of r.getNamedExports())n.isTypeOnly()||s.add(n.getAliasNode()?.getText()??n.getName())}return t},te=(e,s)=>{for(const t of e.getVariableStatements().filter(r=>r.getExportKeyword()!==void 0))for(const r of t.getDeclarations())T(r.getNameNode(),s);for(const t of[...e.getClasses(),...e.getFunctions(),...e.getEnums()]){if(t.getExportKeyword()===void 0)continue;const r=t.isDefaultExport()?v:t.getName();r!==void 0&&s.add(r)}e.getExportAssignments().length>0&&s.add(v)},$=(e,s)=>{const t=new X({compilerOptions:{allowJs:!0},skipFileDependencyResolution:!0,skipLoadingLibFiles:!0,useInMemoryFileSystem:!0}),r=t.createSourceFile(e,s,{overwrite:!0});return t.getProgram().compilerObject.getSyntacticDiagnostics(r.compilerNode).length>0?void 0:r},re=(e,s)=>{if(!s.startsWith("./")&&!s.startsWith("../"))return;const t=p(y(e),s),r=w(t),n=b.has(r)||x[r]!==void 0,o=n?t.slice(0,-r.length):t;return[...b.has(r)?[t]:[],...(x[r]??[]).map(i=>`${o}${i}`),...n?[]:E.map(i=>`${t}${i}`),...n||r.length===0?E.map(i=>p(o,`index${i}`)):[]].find(i=>f(i))},j=e=>{const s=new Set,t=new Set([e]),r=[e];for(;r.length>0;){if(t.size-1>Q)return;const n=r.pop();let o;try{o=O(n,"utf8")}catch{return}const c=$(_(n),o);if(c===void 0)return;const i=ee(c,s);te(c,s);for(const a of i){const d=re(n,a);if(d===void 0)return;t.has(d)||(t.add(d),r.push(d))}}return s},oe=(e,s)=>{const t={exports:void 0,kind:"composed",path:g},r=p(e,s,U);if(!f(r))return t;const n=new Set(D);for(const o of A){const c=p(r,`${o}.ts`);if(!f(c))continue;const i=j(c);if(i===void 0)return t;for(const a of i)n.add(a)}return{exports:n,kind:"composed",path:g}},se=(e,s,t)=>{if(e===void 0||e.origin==="absent")return;if(e.origin==="composed")return oe(s,t);const r=j(e.path);if(!(e.origin==="probed"&&r!==void 0&&!r.has(v)))return{exports:r,kind:"authored",path:e.path}},ne=new Set([".cjs",".cts",".js",".jsx",".mjs",".mts",".ts",".tsx"]),ie=2e3,R="defineTable",N="defineApp",ae=e=>{const s=[],t=[];let r;try{r=W(e,{withFileTypes:!0})}catch{return{files:s,subdirectories:t}}for(const n of r)n.isDirectory()?n.name.startsWith(".")&&!B.has(n.name)||G.has(n.name)||t.push(p(e,n.name)):ne.has(w(n.name))&&s.push(p(e,n.name));return{files:s,subdirectories:t}},k=(e,s)=>{const t=new Set;for(const r of e.getImportDeclarations())for(const n of r.getNamedImports())!n.isTypeOnly()&&n.getName()===s&&t.add(n.getAliasNode()?.getText()??n.getName());return t},ce=(e,s)=>{let t=!1;return e.forEachDescendant((r,n)=>{if(!l.isCallExpression(r))return;const o=r.getExpression();l.isIdentifier(o)&&s.has(o.getText())&&(t=!0,n.stop())}),t},de=e=>{let s=e;for(;l.isCallExpression(s)||l.isPropertyAccessExpression(s);)s=s.getExpression();return s},le=(e,s)=>{const t=de(e);return l.isIdentifier(t)&&s.has(t.getText())},C={global:/\.\s*global\s*\(/u,hyperdriveGlobal:/\.\s*hyperdriveGlobal\s*\(/u,vectors:/\.\s*vectors\s*\(/u},pe=e=>Object.hasOwn(C,e),fe=(e,s)=>{const t=new Set,r=new Set([R,...k(e,R)]);return e.forEachDescendant(n=>{if(!l.isCallExpression(n))return;const o=n.getExpression();if(!l.isPropertyAccessExpression(o)||le(o,r))return;const c=o.getName();pe(c)&&s.has(c)&&t.add(c)}),t},he=(e,s)=>{let t;try{t=O(e,"utf8")}catch{return}const r=new Set([...s].filter(o=>C[o].test(t)));if(r.size===0&&!t.includes(N))return;const n=$(_(e),t);return n===void 0?{chained:r,composes:!1}:{chained:fe(n,r),composes:ce(n,k(n,N))}},ue=(e,s)=>{const t=[e],r=new Set;let n=0,o;const c=i=>{if(n+=1,n>ie)return!1;const a=he(i,s);for(const d of a?.chained??[])r.add(d);return a?.composes&&(o??=i),!0};for(;t.length>0;){const i=t.pop(),{files:a,subdirectories:d}=ae(i);t.push(...d);for(const m of a){if(!c(m))return;if(o!==void 0&&r.size===s.size)return{chained:r,site:o}}}return o===void 0?void 0:{chained:r,site:o}},I=e=>Array.isArray(e)?e:[],me=(e,s,t)=>{const r=[];for(const n of I(e)){const o=n?.image;typeof o!="string"||!(o.startsWith("./")||o.startsWith("../")||o.startsWith("/")||o.includes("Dockerfile"))||f(o.startsWith("/")?o:p(s,o))||r.push(`containers image "${o}" does not exist (resolved relative to ${t}); create the Dockerfile or point image at a registry reference`)}return r},ge=(e,s)=>{const t=e?.vectorIndexNames??[],r=[];if(t.length>0&&r.push({message:o=>`schema declares vector index(es) ${t.map(c=>`"${c}"`).join(", ")} but nothing chains .vectors(...) onto defineApp() (composed in: ${o}) — \`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"}),e?.hasD1GlobalTable&&r.push({message:o=>`schema declares .global() table(s) but nothing chains .global(...) onto defineApp() (composed in: ${o}) — 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"}),e?.hasHyperdriveGlobalTable&&r.push({message:o=>`schema declares .global({ backend: "hyperdrive" }) table(s) but nothing chains .hyperdriveGlobal(...) onto defineApp() (composed in: ${o}) — 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"}),r.length===0)return[];const n=ue(s,new Set(r.map(o=>o.method)));return n===void 0?[]:r.filter(o=>!n.chained.has(o.method)).map(o=>o.message(n.site))},Ee="does not export it",be=(e,s)=>{if(s!=="composed")return`Re-export it from the module that defines it (\`export { ${e} } from "./…";\`), or add it to the app builder's own export (\`export const { ${e} } = app;\`).`;const t=`it exports ${D.join(", ")}, SchedulerDO when its binding is declared, and every class codegen emits from your ${A.map(r=>`${r}.ts`).join(" / ")} declarations`;return Y(e)?`\`@lunora/vite\` generates that entry — ${t}, and ${e} is not among them. Class-A composition does not carry ${e}, 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 "${e}" in one of those and re-run \`lunora codegen\`, or drop the binding.`},ve=(e,s)=>{const t=s.exports;if(t===void 0)return[];const r=[];for(const o of K(e.durable_objects?.bindings))typeof o.class_name=="string"&&o.class_name.length>0&&o.script_name===void 0&&r.push({className:o.class_name,label:"durable_objects.bindings"});for(const o of I(e.workflows))typeof o?.class_name=="string"&&o.class_name.length>0&&o.script_name===void 0&&r.push({className:o.class_name,label:"workflows"});return r.filter(o=>!t.has(o.className)).map(o=>`${o.label} declares class "${o.className}" but the ${s.kind==="composed"?"composed class-A worker entry":"worker entry"} (${s.path}) ${Ee} — wrangler refuses to bundle a Worker whose ${o.label==="workflows"?"Workflow":"Durable Object"} classes are not exported. ${be(o.className,s.kind)}`)},ye=e=>e?.origin!=="absent"?[]:[`main is set but no readable file is there (looked in ${e.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.`],Te=e=>{const s=e.schemaDir??"lunora",t=V(e.projectRoot);if(!t){const h=`wrangler.jsonc not found in ${e.projectRoot}; create one declaring at least the SHARD durable object binding.`;return{problems:[h],report:{errors:[h],valid:!1,warnings:[]},wranglerPath:void 0}}const{parsed:r}=q(t);if(r===void 0){const h=`failed to parse ${t} as JSONC.`;return{problems:[h],report:{errors:[h],valid:!1,warnings:[]},wranglerPath:t}}const{error:n,merged:o}=J(r,e.environment);if(n!==void 0)return{problems:[n],report:{errors:[n],valid:!1,warnings:[]},wranglerPath:t};const{error:c,info:i}=P(e.projectRoot,s),a=z(r,i,e.environment);c!==void 0&&a.warnings.push(`schema parse failed in ${s}/schema.ts: ${c}`);const d=y(t),m=Z(o.main,e.projectRoot,t),S=se(m,e.projectRoot,s);a.errors.push(...me(o.containers??[],d,t)),a.warnings.push(...ye(m)),S!==void 0&&a.errors.push(...ve(o,S)),a.errors.push(...ge(i,e.projectRoot));const u=o.assets?.directory;if(typeof u=="string"&&u.length>0){const h=u.startsWith("/")?u:p(d,u);f(h)||a.warnings.push(`assets.directory "${u}" 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{Ee as UNEXPORTED_CLASS_MARKER,Te as validateWranglerProject};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{readFileSync as R,writeFileSync as T}from"node:fs";import{containerBuildTag as M}from"@lunora/container";import{applyModify as _}from"./applyModify-DKP2l6S9.mjs";import{a as W,r as L}from"./lunora-manifest-V77OcyFC.mjs";import{parseTree as Q,findNodeAtLocation as K}from"jsonc-parser";import{join as U}from"node:path";import{DEV_VARS_FILE as Y,parseDevVariableEntries as F}from"./DEV_VARS_EXAMPLE_FILE-CqLorAxT.mjs";import{o as q,s as k}from"./validate-bindings-D6-vb6if.mjs";import{findWranglerFile as G,readWranglerJsonc as H}from"./WRANGLER_FILES-UNW-xY5u.mjs";const J=[["maxBatchSize","max_batch_size"],["maxBatchTimeout","max_batch_timeout"],["maxRetries","max_retries"],["deadLetterQueue","dead_letter_queue"],["retryDelay","retry_delay"]],D=e=>Object.fromEntries(J.filter(([n])=>e.tuning[n]!==void 0).map(([n,s])=>[s,e.tuning[n]])),A="queueTuning",V=/^[\t ]*(?:,[\t ]*)?(?:\/\/[^\n\r]*)?\r?\n/u,z=/^[\t ]*,/u,X=(e,n)=>{const s=Q(e),t=s===void 0?void 0:K(s,[...n])?.parent;if(t?.type==="property"){const a=t.offset+t.length,o=e.lastIndexOf(`
|
|
2
|
-
`,t.offset-1)+1,c=V.exec(e.slice(a));if(c!==null&&e.slice(o,t.offset).trim()===""){const d=t.parent?.children??[],p=d.indexOf(t),r=p===d.length-1&&p>0?d[p-1]:void 0,l=r===void 0?void 0:z.exec(e.slice(r.offset+r.length))??void 0;return(l===void 0||r===void 0?e.slice(0,o):e.slice(0,r.offset+r.length)+e.slice(r.offset+r.length+l[0].length,o))+e.slice(a+c[0].length)}}return _(e,n,void 0)},I=(e,n,s,t,a,o=new Set)=>{const c=s.join("."),d={},p=[],r=[];let l=e;return{entries:n.map((u,f)=>{const g=t(u);if(g===void 0||u.queue===void 0)return u;const v=Object.fromEntries(Object.entries(D(g)).filter(([m])=>!o.has(m))),w=Object.entries(a[u.queue]??{}).filter(([m])=>!Object.hasOwn(v,m)),x=Object.entries(v).filter(([m,i])=>u[m]!==i),y=w.filter(([m,i])=>u[m]===i).map(([m])=>m),E=Object.fromEntries(Object.entries({...u,...v}).filter(([m])=>!y.includes(m)));for(const[m,i]of x)l=_(l,[...s,f,m],i);for(const m of y)l=X(l,[...s,f,m]);for(const[m,i]of w){const h=u[m];h!==void 0&&h!==i&&r.push(`${c}/${u.queue}: ${m} is no longer declared by defineQueue, but it was changed by hand to ${JSON.stringify(h)} from the declared ${JSON.stringify(i)}, so it was kept. Delete it from wrangler.jsonc if it should go.`)}return(x.length>0||y.length>0)&&p.push(`${c}/${u.queue} (${[...x.map(([m])=>m),...y.map(m=>`removed ${m}`)].join(", ")})`),Object.keys(v).length>0&&(d[u.queue]=v),E}),owned:d,text:l,updated:p,warnings:r}},Z=(e,n,s,t)=>{const a=n.queues??{},o=a.producers??[],c=a.consumers??[],d=new Set(o.map(g=>g.binding)),p=new Set(c.map(g=>g.queue)),r=s.filter(g=>!d.has(g.bindingName)),l=s.filter(g=>!p.has(g.name)),b=I(e,c,["queues","consumers"],g=>s.find(v=>v.name===g.queue),t);let u=b.text;const f={...b.owned};if(r.length>0||l.length>0){const g=[...o,...r.map(w=>({binding:w.bindingName,queue:w.name}))],v=[...b.entries,...l.map(w=>({queue:w.name,...w.mode==="pull"?{type:"http_pull"}:{},...D(w)}))];for(const w of l){const x=D(w);Object.keys(x).length>0&&(f[w.name]=x)}u=_(u,["queues"],{consumers:v,producers:g})}return{added:[...r.map(g=>`queues.producers/${g.bindingName}`),...l.map(g=>`queues.consumers/${g.name}`)],owned:f,text:u,updated:b.updated,warnings:b.warnings}},ee=(e,n,s,t,a)=>{const o=n.env?.[t],c=o?.queues?.consumers??[],d=o?.queues?.producers??[],p=u=>{const f=d.find(g=>g.queue===u.queue)?.binding;return f!==void 0?s.find(g=>g.bindingName===f):s.find(g=>g.name===u.queue&&!d.some(v=>v.binding===g.bindingName))},r=I(e,c,["env",t,"queues","consumers"],p,a,new Set(["dead_letter_queue"])),l=c.filter(u=>u.queue!==void 0&&p(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.`),b=c.flatMap(u=>{const f=p(u)?.tuning.deadLetterQueue;return f===void 0||u.dead_letter_queue!==void 0?[]:[`env.${t}.queues.consumers/${String(u.queue)}: defineQueue declares deadLetterQueue "${f}", 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:r.owned,text:r.text,updated:r.updated,warnings:[...r.warnings,...b,...l]}},ne=(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?.[A],t=a=>typeof a=="object"&&a!==null&&!Array.isArray(a);return s===void 0?{}:!t(s)||!Object.values(s).every(a=>t(a)&&Object.values(a).every(o=>t(o)))?(n.push(`${e?.path??"package.json"}: \`lunora.${A}\` 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},se=(e,n,s)=>{const t=Object.fromEntries(Object.entries({...n,...s}).filter(([,a])=>Object.keys(a).length>0));W(e,A,Object.keys(t).length===0?void 0:t)},S="PIPELINES",te=(e,n)=>{const s=e.flagshipBinding!==void 0&&!(n?.flagship??[]).some(o=>o.binding===e.flagshipBinding),t=e.usesPipelines&&!(n?.pipelines??[]).some(o=>o.binding===S);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 "${S}" pipelines binding exists; run 'wrangler pipelines create <name>' and add a 'pipelines' binding ({ binding: "${S}", pipeline }) — codegen resolves this one name, and the pipeline resource can't be auto-provisioned.`],[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(([o])=>o).map(([,o])=>o)},oe=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.usesX402Pay,"@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),O=(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.`),ae=(e,n)=>{const s=new Set([...e.workflows,...e.agents].map(t=>t.className));return s.size===0?[]:(n.workflows??[]).flatMap(t=>{const a=t.class_name;return a===void 0||s.has(a)?[]:[`wrangler.jsonc declares workflows[] entry "${a}" but no defineWorkflow/defineAgent export generates that class — a leftover from a rename will fail the deploy (wrangler rejects a class_name the worker does not export). Remove it if it is not hand-wired.`]})},ie=(e,n)=>{if(e.queues.length===0)return[];const s=new Set(e.queues.map(a=>a.name)),t=new Set(e.queues.map(a=>a.bindingName));return[...(n.queues?.consumers??[]).flatMap(a=>{const{queue:o}=a;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(a=>{const{binding:o}=a;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.`]})]},re=(e,n)=>[...ae(e,n),...ie(e,n)],j=[{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"}],de=()=>j.map(({keys:e,label:n})=>`${e[0]} + ${e[1]} (${n})`).join(" or "),ce=e=>{let n;try{n=R(U(e,Y),"utf8")}catch{return!1}const s=new Map(F(n).map(t=>[t.key,t.value]));return j.some(({keys:t})=>t.every(a=>(s.get(a)??"")!==""))},N=(e,n,s)=>{const t=new Set(e.durableObjects.map(d=>d.className)),a=[],o=(s?.r2_buckets?.length??0)>0,c=(s?.d1_databases?.some(d=>d.binding==="DB")??!1)||e.needsD1;return e.usesStorage&&!o&&a.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")&&!c&&a.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")&&a.push("@lunora/scheduler is used but the worker entry exports no SchedulerDO; export it so the SCHEDULER binding can be provisioned."),a.push(...O("container","containers",e.containers),...O("workflow","workflows",e.workflows),...O("agent","agents",e.agents)),e.containers.length>0&&s?.observability?.enabled===!1&&a.push("containers are declared but observability is explicitly disabled in wrangler.jsonc — container logs will not be captured."),e.usesPayment&&!ce(n)&&a.push(`@lunora/payment is used; set one provider's secret pair in .dev.vars — ${de()}.`),a.push(...oe(e),...te(e,s)),s!==void 0&&a.push(...re(e,s)),a},P="<replace-with-d1-create-id>",ue=e=>[["container","containers",e.containers],["workflow","workflows",e.workflows],["agent","agents",e.agents]].flatMap(([s,t,a])=>a.filter(o=>!o.exported).map(({className:o,exportName:c})=>({className:o,exportName:c,kind:s,module:t}))),le=e=>{const n=new Set(q(e).map(t=>t.tag));let s=1;for(;n.has(`v${String(s)}`);)s+=1;return`v${String(s)}`},ge=e=>{const n=new Set;for(const s of q(e)){for(const t of k(s.deleted_classes))n.delete(t);for(const{from:t,to:a}of q(s.renamed_classes))t!==void 0&&n.delete(t),a!==void 0&&n.add(a);for(const t of[...k(s.new_classes),...k(s.new_sqlite_classes)])n.add(t)}return n},me=(e,n,s)=>{const t=n.durable_objects?.bindings??[],a=new Set(t.map(l=>l.name)),o=s.filter(l=>!a.has(l.binding));let c=e;const d=[];if(o.length>0){const l=[...t,...o.map(b=>({class_name:b.className,name:b.binding}))];c=_(c,["durable_objects","bindings"],l),d.push(...o.map(b=>`${b.binding}/${b.className}`))}const p=n.migrations??[],r=s.map(l=>l.className).filter(l=>!ge(p).has(l));if(r.length>0){const l=[...p,{new_sqlite_classes:r,tag:le(p)}];c=_(c,["migrations"],l)}return{added:d,text:c}},pe=(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",a=[...s,{binding:"DB",database_id:P,database_name:t}];return{added:["DB (D1)"],text:_(e,["d1_databases"],a)}},$=(e,n,s,t,a)=>{const o=n[s]?.binding;return typeof o=="string"&&o.length>0?{added:[],text:e}:{added:[a],text:_(e,[s],{binding:t})}},be=(e,n)=>(n.analytics_engine_datasets?.length??0)>0?{added:[],text:e}:{added:["ANALYTICS (Analytics Engine)"],text:_(e,["analytics_engine_datasets"],[{binding:"ANALYTICS",dataset:"ANALYTICS"}])},he=(e,n)=>{const s=n.worker_loaders??[];return s.some(t=>t.binding==="LOADER")?{added:[],text:e}:{added:["LOADER (Worker Loader)"],text:_(e,["worker_loaders"],[...s,{binding:"LOADER"}])}},fe=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=>e.image.kind==="dockerfile"?e.image.dockerfilePath:e.image.kind==="registry"?e.image.reference:M(e.exportName),we=e=>{const n={class_name:e.className,image:ve(e)};return e.image.kind==="dockerfile"&&(n.image_build_context=e.image.buildContext),e.buildArgs!==void 0&&e.image.kind!=="registry"&&(n.image_vars=e.buildArgs),e.instanceType!==void 0&&(n.instance_type=fe(e.instanceType)),e.maxInstances!==void 0&&(n.max_instances=e.maxInstances),e.name!==void 0&&(n.name=e.name),e.rollout?.stepPercentage!==void 0&&(n.rollout_step_percentage=e.rollout.stepPercentage),e.rollout?.gracePeriodSeconds!==void 0&&(n.rollout_active_grace_period=e.rollout.gracePeriodSeconds),n},_e=(e,n,s)=>{const t=n.containers??[],a=new Set(t.map(d=>d.class_name)),o=s.filter(d=>!a.has(d.className));if(o.length===0)return{added:[],text:e};const c=_(e,["containers"],[...t,...o.map(d=>we(d))]);return{added:o.map(d=>`containers/${d.className}`),text:c}},xe=(e,n)=>{if(n.observability!==void 0)return{added:[],text:e};const s=_(e,["observability"],{enabled:!0,head_sampling_rate:1});return{added:["observability"],text:s}},B=e=>({binding:e.bindingName,class_name:e.className,name:e.name}),ye=(e,n,s,t=[])=>{const a=n.workflows??[],o=new Set(a.map(r=>r.class_name)),c=s.filter(r=>!o.has(r.className)),d=t.filter(r=>!o.has(r.className));if(c.length===0&&d.length===0)return{added:[],text:e};const p=_(e,["workflows"],[...a,...c.map(r=>B(r)),...d.map(r=>B(r))]);return{added:[...c.map(r=>`workflows/${r.className}`),...d.map(r=>`workflows/${r.className}`)],text:p}},Ce=(e,n,s)=>{const t=G(e),a=ue(n);if(!t)return{added:[],changed:!1,exportGaps:a,reason:"wrangler.jsonc not found",updated:[],warnings:N(n,e)};const{parsed:o,text:c}=H(t);if(o===void 0)return{added:[],changed:!1,exportGaps:a,reason:`failed to parse ${t} as JSONC`,updated:[],warnings:N(n,e),wranglerPath:t};const d=N(n,e,o);if(s!==void 0){const i=o.env?.[s]!==void 0;d.push(i?`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 p=n.containers.filter(i=>i.exported),r=n.agents.filter(i=>i.exported&&i.voice===!0&&i.voiceBindingName!==void 0&&i.voiceClassName!==void 0),l=[...n.durableObjects,...p.map(i=>({binding:i.bindingName,className:i.className})),...r.map(i=>({binding:i.voiceBindingName,className:i.voiceClassName}))],b=n.workflows.filter(i=>i.exported),u=n.agents.filter(i=>i.exported),f=L(e),g=ne(f,d),v={},w=[{enabled:!0,run:i=>me(i,o,l)},{enabled:n.needsD1,run:i=>pe(i,o)},{enabled:n.usesAi,run:i=>$(i,o,"ai","AI","AI (Workers AI)")},{enabled:n.usesBrowser,run:i=>$(i,o,"browser","BROWSER","BROWSER (Browser Rendering)")},{enabled:n.usesImages,run:i=>$(i,o,"images","IMAGES","IMAGES (Cloudflare Images)")},{enabled:n.usesAnalytics,run:i=>be(i,o)},{enabled:n.usesWorkerLoader,run:i=>he(i,o)},{enabled:!0,run:i=>xe(i,o)},{enabled:p.length>0,run:i=>_e(i,o,p)},{enabled:b.length>0||u.length>0,run:i=>ye(i,o,b,u)},{enabled:n.queues.length>0,run:i=>{const h=Z(i,o,n.queues,g.queues??{});return v.queues=h.owned,h}},...s===void 0||o.env?.[s]===void 0?[]:[{enabled:n.queues.length>0,run:i=>{const h=`env.${s}.queues`,C=ee(i,o,n.queues,s,g[h]??{});return v[h]=C.owned,C}}]];let x=c;const y=[],E=[];for(const i of w){if(!i.enabled)continue;const h=i.run(x);x=h.text,y.push(...h.added),E.push(...h.updated??[]),d.push(...h.warnings??[])}const m=i=>{if(!(f===void 0||Object.keys(v).length===0))try{se(f,g,v)}catch(h){d.push(`${i?"wrangler.jsonc was updated, but ":""}recording the queue tuning reconcile owns in ${f.path} (lunora.queueTuning) failed: ${h instanceof Error?h.message:String(h)}. Until it is recorded, an option removed from defineQueue stays deployed.`)}};return y.includes("DB (D1)")&&d.push(`wrote a DB binding with a placeholder database_id ("${P}") — run \`wrangler d1 create <name>\` and replace it before deploying.`),x===c?(m(!1),{added:[],changed:!1,exportGaps:a,reason:"bindings already in sync",updated:[],warnings:d,wranglerPath:t}):(T(t,x,"utf8"),m(!0),{added:y,changed:!0,exportGaps:a,updated:E,warnings:d,wranglerPath:t})};export{ue as collectExportGaps,Ce as reconcileWranglerBindings};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{existsSync as y,statSync as T,readFileSync as O,readdirSync as $}from"node:fs";import{parse as D,init as F}from"es-module-lexer";import{discoverAgentInfo as Y}from"./discoverAgentInfo-CTdCSfYM.mjs";import{discoverContainerInfo as U}from"./discoverContainerInfo-EhZtEBQs.mjs";import{discoverFlags as W,FLAGS_FILENAME as K,discoverQueues as M,QUEUES_FILENAME as X}from"@lunora/codegen";import{d as C}from"./discover-info-Vj9d4qYt.mjs";import{escapeRegExp as q}from"./DEV_VARS_EXAMPLE_FILE-CqLorAxT.mjs";import{discoverSchemaInfo as G}from"./discoverSchemaInfo-DJvevsCm.mjs";import{resolveWorkerEntry as H,COMPOSED_ENTRY_DURABLE_OBJECTS as Q,GENERATED_DIRECTORY as w,DURABLE_OBJECT_BINDINGS as V,detectExportedDurableObjects as J,detectClassExports as h}from"./COMPOSED_WORKER_ENTRY-5R-BECOC.mjs";import{discoverWorkflowInfo as z}from"./discoverWorkflowInfo-BsPvlo6O.mjs";import{join as u}from"node:path";const Z=(e,s)=>{const{error:o,value:r}=C(e,s,K,W);return o===void 0?{flags:r}:{error:o}},k=/^\s*import\s+type\b/,ee=new Set(["@lunora/agent","@lunora/agent/sandbox"]),m=["browserTool","jsCodeTool"],E=Object.fromEntries(m.map(e=>{const s=q(e);return[e,{fallback:new RegExp(String.raw`import\s+\{[^}]*\b${s}\b[^}]*\}\s+from\s+["']@lunora\/agent(?:\/sandbox)?["']`,"u"),name:new RegExp(String.raw`\b${s}\b`,"u"),typeSpecifier:new RegExp(String.raw`\btype\s+${s}\b`,"u")}]})),se=e=>{const s=e.indexOf("{");if(s===-1)return"";const o=e.indexOf("}",s+1);return o===-1?e.slice(s+1):e.slice(s+1,o)},re=(e,s)=>{if(k.test(e))return!1;const o=se(e);return E[s].name.test(o)&&!E[s].typeSpecifier.test(o)},oe=e=>{let s;try{const[o]=D(e);s=o.filter(r=>r.n!==void 0&&ee.has(r.n)).map(r=>e.slice(r.ss,r.se))}catch{s=void 0}return Object.fromEntries(m.map(o=>[o,s===void 0?E[o].fallback.test(e):s.some(r=>re(r,o))]))},te=(e,s)=>{const{error:o,value:r}=C(e,s,X,M);return o===void 0?{queues:r??[]}:{error:o,queues:[]}},ne=new Set([".cjs",".cts",".js",".jsx",".mjs",".mts",".ts",".tsx"]),ae=new Set([".git",".lunora-cache",".wrangler","dist",w,"node_modules"]),ie=["lunora","src"],ce=/\benv\s*\.\s*DB\b/,de=/\benv\s*\.\s*AI\b/,L=/\bctx\s*\.\s*pipelines\b/,P=/\bctx\s*\.\s*r2sql\b/,f={usesAi:{pattern:/\bfrom\s+["']@lunora\/ai["']/,source:"@lunora/ai"},usesAnalytics:{pattern:/\bfrom\s+["']@lunora\/bindings\/analytics["']/,source:"@lunora/bindings/analytics"},usesAuth:{pattern:/\bfrom\s+["']@lunora\/auth["']/,source:"@lunora/auth"},usesBrowser:{pattern:/\bfrom\s+["']@lunora\/browser["']/,source:"@lunora/browser"},usesHyperdrive:{pattern:/\bfrom\s+["']@lunora\/hyperdrive["']/,source:"@lunora/hyperdrive"},usesImages:{pattern:/\bfrom\s+["']@lunora\/bindings\/images["']/,source:"@lunora/bindings/images"},usesKv:{pattern:/\bfrom\s+["']@lunora\/bindings\/kv["']/,source:"@lunora/bindings/kv"},usesMail:{pattern:/\bfrom\s+["']@lunora\/mail["']/,source:"@lunora/mail"},usesNotify:{pattern:/\bfrom\s+["']@lunora\/notify["']/,source:"@lunora/notify"},usesPayment:{pattern:/\bfrom\s+["']@lunora\/payment["']/,source:"@lunora/payment"},usesPipelines:{pattern:L,source:"@lunora/bindings/pipelines"},usesR2sql:{pattern:P,source:"@lunora/bindings/r2sql"},usesScheduler:{pattern:/\bfrom\s+["']@lunora\/scheduler["']/,source:"@lunora/scheduler"},usesStorage:{pattern:/\bfrom\s+["']@lunora\/storage["']/,source:"@lunora/storage"},usesX402Charge:{pattern:/\bfrom\s+["']@lunora\/x402\/charge["']/,source:"@lunora/x402/charge"},usesX402Pay:{pattern:/\bfrom\s+["']@lunora\/x402\/pay["']/,source:"@lunora/x402/pay"}},l=Object.keys(f),ue="STRIPE_SECRET_KEY + STRIPE_WEBHOOK_SECRET (Stripe) or POLAR_ACCESS_TOKEN + POLAR_WEBHOOK_SECRET (Polar)",B=[...l,"needsD1","usesWorkerLoader"],le=()=>{const e={};for(const s of B)e[s]=!1;return e},d=Object.freeze(le()),S=(e,s)=>{const o={};for(const r of B)o[r]=e[r]||s[r];return o},pe=e=>{for(const s of l)if(f[s].source===e)return{...d,[s]:!0};return d},me=e=>{const[s]=D(e);let o=d;for(const r of s){const t=r.n;!t||k.test(e.slice(r.ss,r.se))||(o=S(o,pe(t)))}return o},fe=e=>{const s={...d};for(const o of l)s[o]=f[o].pattern.test(e);return s},be=e=>{let s;try{s=me(e)}catch{s=fe(e)}return S(s,{...d,needsD1:ce.test(e),usesAi:de.test(e),usesPipelines:L.test(e),usesR2sql:P.test(e)})},_=(e,s)=>{let o;try{o=$(e,{withFileTypes:!0})}catch{return}for(const r of o){if(r.isDirectory()){ae.has(r.name)||_(u(e,r.name),s);continue}const t=r.name.lastIndexOf(".");t!==-1&&ne.has(r.name.slice(t))&&s.push(u(e,r.name))}},ge=(e,s)=>G(e,s).info?.hasD1GlobalTable??!1,he=(e,s)=>{let o=d;for(const r of s){const t=u(e,r);if(!y(t)||!T(t).isDirectory())continue;const n=[];_(t,n);for(const a of n)o=S(o,be(O(a,"utf8")))}return o},Ee=(e,s)=>{const o=u(e,s),r=Object.fromEntries(m.map(n=>[n,!1]));if(!y(o)||!T(o).isDirectory())return r;const t=[];_(o,t);for(const n of t){const a=oe(O(n,"utf8"));for(const i of m)r[i]||=a[i]}return r},ye=(e,s,o)=>[...e.map(r=>r.exported?`${r.bindingName}/${r.className} (container "${r.exportName}" declared and exported)`:`hint: container "${r.exportName}" is declared but ${r.className} is not exported by the worker entry — add \`export * from "./lunora/_generated/containers"\``),...s.map(r=>r.exported?`${r.bindingName}/${r.className} (workflow "${r.exportName}" declared and exported)`:`hint: workflow "${r.exportName}" is declared but ${r.className} is not exported by the worker entry — add \`export * from "./lunora/_generated/workflows"\``),...o.map(r=>r.exported?`${r.bindingName}/${r.className} (agent "${r.exportName}" declared and exported)`:`hint: agent "${r.exportName}" is declared but ${r.className} is not exported by the worker entry — add \`export * from "./lunora/_generated/agents"\``)],Se=(e,s)=>[[e.usesAi,"AI (@lunora/ai imported or env.AI used)"],[e.usesAuth&&!s.has("SessionDO"),"hint: @lunora/auth is imported; its tables are D1-backed by default. For DO-backed auth (what @better-auth/scim needs), pass `namespace` to .auth() and export the generated auth DO class"],[e.usesScheduler&&!s.has("SchedulerDO"),"hint: @lunora/scheduler is imported but no SchedulerDO is exported by the worker entry"],[e.usesStorage,"hint: @lunora/storage is imported; add an r2_buckets binding (bucket binding names are user-defined)"],[e.usesMail,"hint: @lunora/mail is imported; set RESEND_API_KEY in .dev.vars (obtain at https://resend.com/api-keys)"],[e.usesPayment,`hint: @lunora/payment is imported; set the provider secrets in .dev.vars — ${ue}`],[e.usesBrowser,"browser (@lunora/browser imported) — self-describing { binding: BROWSER }"],[e.usesImages,"images (@lunora/bindings/images imported) — self-describing { binding: IMAGES }"],[e.usesAnalytics,"analytics_engine_datasets (@lunora/bindings/analytics imported) — self-describing { binding: ANALYTICS, dataset }"],[e.usesWorkerLoader,"worker_loaders (jsCodeTool imported in lunora/) — self-describing { binding: LOADER }"],[e.usesKv,"hint: @lunora/bindings/kv is imported; add a kv_namespaces binding ({ binding, id }) and pass env.<BINDING> to createKv() — the namespace id can't be auto-provisioned"],[e.usesHyperdrive,"hint: @lunora/hyperdrive is imported; run 'wrangler hyperdrive create' and add a 'hyperdrive' binding ({ binding, id }) — the id can't be auto-provisioned"],[e.usesPipelines,"hint: ctx.pipelines is used; run 'wrangler pipelines create <name>' and add a 'pipelines' binding ({ binding, pipeline }) — the pipeline resource can't be auto-provisioned"],[e.usesX402Charge,"hint: @lunora/x402/charge is imported; set the recipient wallet address as a [vars] entry (the var name is yours to choose) and pass it to the charge config — the x402 facilitator settles USDC to that address"],[e.usesX402Pay,"hint: @lunora/x402/pay is imported (ActionCtx-only, spends real funds); add a secrets_store_secrets[] binding for the agent wallet key (name it to match signer.secretName) and pair the pay rail with a spend policy — ctx.secrets reads a Secrets Store binding, not .dev.vars, so the key can't be auto-provisioned"]].filter(([r])=>r).map(([,r])=>r),_e=(e,s,o,r=[],t=[],n=[])=>{const a=new Set(e.map(c=>c.className)),i=e.map(c=>`${c.binding}/${c.className} (exported by worker entry)`);return s&&i.push("DB (.global() table declared)"),i.push(...ye(r,t,n),...Se(o,a)),i},ke=async e=>{await F;const s=e.schemaDir??"lunora",o=e.scanDirs??ie,r=he(e.projectRoot,o),t=Ee(e.projectRoot,s),n={...r,usesBrowser:r.usesBrowser||t.browserTool,usesWorkerLoader:t.jsCodeTool},a=H(e.projectRoot);let i;a.composed?i=[...Q,...y(u(e.projectRoot,s,w,"scheduler.ts"))?["SchedulerDO"]:[]].map(A=>({binding:V[A],className:A})):i=a.path===void 0?[]:J(a.path);const c=n.needsD1||ge(e.projectRoot,s),v=h(a,U(e.projectRoot,s).containers,"containers"),x=h(a,z(e.projectRoot,s).workflows,"workflows"),I=h(a,Y(e.projectRoot,s).agents,"agents"),j=[...te(e.projectRoot,s).queues],{flags:p}=Z(e.projectRoot,s),b=p?.provider==="flagship"&&p.mode==="binding"?p.bindingName:void 0,R={};for(const g of l)R[g]=n[g];const N=_e(i,c,n,v,x,I);return b!==void 0&&N.push(`hint: lunora/flags.ts uses Flagship in binding mode; add a flagship binding ({ binding: "${b}", app_id }) — the app_id can't be auto-provisioned`),{agents:I,containers:v,durableObjects:i,flagshipBinding:b,needsD1:c,queues:j,signals:N,usesFlags:p!==void 0,usesWorkerLoader:n.usesWorkerLoader,workflows:x,...R}},Le=e=>{const s=[];for(const o of l)e[o]&&s.push(f[o].source);return s};export{ke as inferLunoraBindings,Le as packageNamesFromBindings};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const c=["containers","d1_databases","durable_objects","kv_namespaces","queues","r2_buckets","secrets_store_secrets","services","tail_consumers","vars","vectorize","workflows"],i=["assets","compatibility_date","exports","logpush","main","migrations","observability","placement"],m=(s,o)=>{if(o===void 0)return{merged:s,unverifiedKeys:[]};const n=s.env?.[o];if(n===void 0){const e=Object.keys(s.env??{}).toSorted((v,f)=>v.localeCompare(f)),l=e.length>0?` (declared: ${e.join(", ")}).`:" (no environments are declared).";return{error:`--env "${o}" names no environment declared in wrangler.jsonc's "env" block${l}`,merged:s,unverifiedKeys:[]}}const t={...s},r=Object.keys(n).filter(e=>e!=="env");for(const e of r)i.includes(e)&&(t[e]=n[e]);for(const e of c)t[e]=n[e];const a=new Set([...c,...i]),d=r.filter(e=>!a.has(e)).map(String);return{merged:t,unverifiedKeys:d}};export{m as mergeWranglerEnvironment};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const k=(e,s,a)=>{if(s.length===0)return;const n=e.vectorize??[],t=new Set(n.filter(Boolean).map(i=>i?.index_name));for(const i of s)t.has(i)||a.push(`schema declares vector index "${i}"; wrangler "vectorize" must include a binding with index_name "${i}"`)},p=new Set(["basic","dev","lite","standard","standard-1","standard-2","standard-3","standard-4"]),h={disk_mb:2e4,memory_mib:12288,vcpu:4},y=(e,s,a)=>{const n=e.instance_type;if(n===void 0)return;if(typeof n=="string"){p.has(n)||a.push(`${s} has unknown instance_type "${n}" — expected lite, basic, standard-1..4, or a custom { vcpu, memory_mib, disk_mb } object`);return}for(const[o,g]of Object.entries(h)){const c=n[o];c!==void 0&&(typeof c!="number"||c<=0||c>g)&&a.push(`${s} custom instance_type ${o} must be a positive number ≤ ${String(g)} (got ${String(c)})`)}const{disk_mb:t,memory_mib:i,vcpu:r}=n;if(typeof r=="number"&&typeof i=="number"&&i<r*3072&&a.push(`${s} custom instance_type needs ≥ 3 GiB (3072 MiB) memory per vCPU (got ${String(i)} MiB for ${String(r)} vCPU)`),typeof i=="number"&&typeof t=="number"){const o=Math.floor(i/1024*2e3);t>o&&a.push(`${s} custom instance_type allows ≤ 2 GB disk per GiB memory (≤ ${String(o)} MB for ${String(i)} MiB memory; got ${String(t)} MB)`)}},_=(e,s,a)=>{const{boundClasses:n,classKinds:t,errors:i,warnings:r}=a;if(!e||typeof e!="object"||typeof e.class_name!="string"||e.class_name.length===0){i.push(`${s} must have a non-empty "class_name" naming its container-enabled Durable Object class`);return}(typeof e.image!="string"||e.image.length===0)&&i.push(`${s} ("${e.class_name}") must have an "image" — a Dockerfile path or a registry reference`),n.has(e.class_name)||i.push(`${s} class "${e.class_name}" has no matching durable_objects binding — your dev server auto-reconciles this on startup; add { "name": "...", "class_name": "${e.class_name}" } to fix it by hand`);const o=t.get(e.class_name);o!=="sqlite"&&i.push(o==="classic"?`${s} class "${e.class_name}" is registered via "new_classes" but containers require SQLite-backed DOs — move it to "new_sqlite_classes"`:`${s} class "${e.class_name}" is missing from migrations — add a migration entry with "new_sqlite_classes": ["${e.class_name}"]`),y(e,`${s} ("${e.class_name}")`,i),e.max_instances===void 0&&r.push(`${s} ("${e.class_name}") declares no max_instances — set a cap so a traffic spike can't fan out unbounded container spend`)},d=e=>typeof e=="string"&&e.length>0,m=e=>Array.isArray(e)?e.filter(s=>s!==null&&typeof s=="object"):[],b=e=>Array.isArray(e)?e.filter(s=>d(s)):[],f=e=>{const s=new Map;for(const a of m(e)){for(const n of b(a.new_classes))s.set(n,"classic");for(const n of b(a.new_sqlite_classes))s.set(n,"sqlite");for(const n of m(a.renamed_classes))if(d(n.from)&&d(n.to)){const t=s.get(n.from)??"sqlite";s.delete(n.from),s.set(n.to,t)}for(const n of b(a.deleted_classes))s.delete(n)}return s},v=e=>new Set(f(e).keys()),E=(e,s)=>{const a=v(e.migrations);for(const n of m(e.durable_objects?.bindings))n.script_name===void 0&&d(n.class_name)&&!a.has(n.class_name)&&s.push(`durable_objects.bindings declares class "${n.class_name}" but it is missing from migrations — add a migration entry with "new_sqlite_classes": ["${n.class_name}"] (or "new_classes" for a non-SQLite-backed class), or let the dev server auto-reconcile it on the next start`)},S=(e,s,a)=>{if(e.containers===void 0)return;if(!Array.isArray(e.containers)){s.push("containers must be an array of { class_name, image, ... } entries");return}const n=e.containers;if(n.length===0)return;const t=new Set(m(e.durable_objects?.bindings).map(r=>r.class_name)),i=f(e.migrations);for(const[r,o]of n.entries())_(o,`containers[${String(r)}]`,{boundClasses:t,classKinds:i,errors:s,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 } })')},u=e=>e,l=(e,s,a,n)=>{if(e!==void 0){if(!Array.isArray(e)){n.push(a.arrayMessage);return}for(const[t,i]of u(e).entries()){const r=`${s}[${String(t)}]`;if(!i||typeof i!="object"){n.push(a.objectMessage(r));continue}for(const o of a.fields)d(i[o.field])||n.push(o.message(r))}}},j={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. WORKFLOW_ORDER_PIPELINE)`},{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`},$={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`},M={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,s)=>{if(e.queues!==void 0){if(typeof e.queues!="object"||Array.isArray(e.queues)){s.push("queues must be a { producers, consumers } object");return}l(e.queues.producers,"queues.producers",$,s),l(e.queues.consumers,"queues.consumers",M,s)}},w={arrayMessage:"secrets_store_secrets must be an array of { binding, store_id, secret_name } entries",fields:["binding","store_id","secret_name"].map(e=>({field:e,message:s=>`${s} must have a non-empty "${e}"`})),objectMessage:e=>`${e} must be a { binding, store_id, secret_name } object`},R=[{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,s)=>`${e} ("${s}") 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,s)=>`${e} ("${s}") has no "app_id" — create a Flagship app and set its id, or the binding can't resolve`,key:"flagship"},{arrayMessage:"hyperdrive must be an array of { binding, id } entries",bindingMessage:e=>`${e} must have a non-empty "binding" naming the Hyperdrive binding`,hintField:"id",hintMessage:(e,s)=>`${e} ("${s}") has no "id" — run \`wrangler hyperdrive create\` and set the id, or the binding can't connect`,key:"hyperdrive"},{arrayMessage:"pipelines must be an array of { binding, stream } entries",bindingMessage:e=>`${e} must have a non-empty "binding" naming the Pipelines binding`,hintField:["stream","pipeline"],hintMessage:(e,s)=>`${e} ("${s}") has no "stream" — run \`wrangler pipelines create <name>\` and set the stream name, or the binding can't resolve`,key:"pipelines"},{arrayMessage:"analytics_engine_datasets must be an array of { binding, dataset } entries",bindingMessage:e=>`${e} must have a non-empty "binding" naming the Analytics Engine binding`,hintField:"dataset",hintMessage:(e,s)=>`${e} ("${s}") has no "dataset" — it defaults to the binding name; set it explicitly to avoid drift`,key:"analytics_engine_datasets"}],B=(e,s,a,n)=>{const t=e[s.key];if(t!==void 0){if(!Array.isArray(t)){a.push(s.arrayMessage);return}for(const[i,r]of u(t).entries()){const o=`${s.key}[${String(i)}]`;if(!r||typeof r!="object"||!d(r.binding)){a.push(s.bindingMessage(o));continue}(typeof s.hintField=="string"?[s.hintField]:s.hintField).some(c=>d(r[c]))||n.push(s.hintMessage(o,r.binding))}}},D=[{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" })'}],A=(e,s,a)=>{const n=e[s.key];n!==void 0&&(typeof n!="object"||n===null||Array.isArray(n)||!d(n.binding))&&a.push(s.message)},I=[{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`}],x=(e,s,a)=>{s?.hasD1GlobalTable&&!m(e.d1_databases).some(n=>n.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'),s?.hasHyperdriveGlobalTable&&m(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)')},U=(e,s)=>{const{d1_databases:a}=e;if(a!==void 0){if(!Array.isArray(a)){s.push("d1_databases must be an array of { binding, database_id | database_name } entries");return}for(const[n,t]of u(a).entries()){const i=`d1_databases[${String(n)}]`;if(!t||typeof t!="object"){s.push(`${i} must be a { binding, database_id | database_name } object`);continue}d(t.binding)||s.push(`${i} must have a non-empty "binding" naming the D1 binding`),!d(t.database_id)&&!d(t.database_name)&&s.push(`${i} must have a "database_id" or a "database_name" — run \`wrangler d1 create\` and set one, or the binding can't resolve`)}}};export{R as H,I as R,D as S,j as W,x as a,U as b,k as c,S as d,l as e,q as f,B as g,A as h,w as i,d as j,m as o,b as s,E as v};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as d,o as p}from"./validate-bindings-D6-vb6if.mjs";const b=new Set(["1","enabled","on","true","yes"]),m=s=>typeof s=="string"&&b.has(s.trim().toLowerCase()),g=(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`)},y=(s,t)=>{s.logpush!==void 0&&typeof s.logpush!="boolean"&&t.push('logpush must be a boolean (set "logpush": true to enable Cloudflare Logpush)')},c=3e5,v=(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>c&&t.push(`limits.cpu_ms must be at most ${String(c)} (Cloudflare's per-invocation ceiling)`)}},l=new Set(["off","smart","targeted"]),_=(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"||!l.has(i))&&t.push(`placement.mode must be one of ${[...l].map(n=>`"${n}"`).join(", ")}`)},A=(s,t)=>{const{observability:e}=s;if(e===void 0)return;if(typeof e!="object"||Array.isArray(e)){t.push('observability must be an object (e.g. { "enabled": true, "head_sampling_rate": 1 })');return}const i=(n,o)=>{n!==void 0&&(typeof n!="number"||Number.isNaN(n)||n<0||n>1)&&t.push(`${o} must be a number in [0, 1] (the fraction of requests sampled)`)};i(e.head_sampling_rate,"observability.head_sampling_rate"),e.logs!==void 0&&(typeof e.logs!="object"||Array.isArray(e.logs)?t.push("observability.logs must be an object"):(i(e.logs.head_sampling_rate,"observability.logs.head_sampling_rate"),e.logs.invocation_logs!==void 0&&typeof e.logs.invocation_logs!="boolean"&&t.push('observability.logs.invocation_logs must be a boolean (set "invocation_logs": true to keep per-invocation summaries)')))},j=(s,t)=>{const{cache:e}=s;if(e!==void 0){if(typeof e!="object"||e===null||Array.isArray(e)){t.push('cache must be an object (e.g. { "enabled": true })');return}e.enabled!==void 0&&typeof e.enabled!="boolean"&&t.push("cache.enabled must be a boolean (true or false)")}},S=(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`))}}},O=(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")}},E=(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`)},L=(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]}},N=(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(u=>u.trim()==="*"),a=m(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')},f=s=>p(s.durable_objects?.bindings).some(t=>t.class_name==="SchedulerDO"&&t.script_name===void 0),r="LUNORA_ORIGIN_URL",R=(s,t,e)=>{if(!f(s)||d(s.vars?.[r]))return;const i=t===void 0?"vars":`env.${t}.vars`,n=t===void 0?"":` --env ${t}`;e.push(`durable_objects.bindings declares the SchedulerDO but ${i}.${r} 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}.${r} to the worker's public URL, or \`wrangler secret put ${r}${n}\` (ignore this if it is already set as a secret or in the dashboard).`)};export{O as validateAssets,j as validateCache,N as validateCorsVariables,S as validateExports,v as validateLimits,y as validateLogpush,A as validateObservability,_ as validatePlacement,R as validateSchedulerOrigin,g as validateSendEmail,E as validateTailConsumers,L as withTailConsumer};
|