@cloudflare/workers-utils 0.0.2 → 0.1.0

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.
@@ -0,0 +1,2190 @@
1
+ import { RouterConfig, AssetConfig } from '@cloudflare/workers-shared';
2
+ import { Cloudflare } from 'cloudflare';
3
+
4
+ /**
5
+ * A symbol to inherit a binding from the deployed worker.
6
+ */
7
+ declare const INHERIT_SYMBOL: unique symbol;
8
+ declare const SERVICE_TAG_PREFIX = "cf:service=";
9
+ declare const ENVIRONMENT_TAG_PREFIX = "cf:environment=";
10
+ declare const PATH_TO_DEPLOY_CONFIG = ".wrangler/deploy/config.json";
11
+
12
+ /**
13
+ * The type of Worker
14
+ */
15
+ type CfScriptFormat = "modules" | "service-worker";
16
+ /**
17
+ * A module type.
18
+ */
19
+ type CfModuleType = "esm" | "commonjs" | "compiled-wasm" | "text" | "buffer" | "python" | "python-requirement";
20
+ /**
21
+ * An imported module.
22
+ */
23
+ interface CfModule {
24
+ /**
25
+ * The module name.
26
+ *
27
+ * @example
28
+ * './src/index.js'
29
+ */
30
+ name: string;
31
+ /**
32
+ * The absolute path of the module on disk, or `undefined` if this is a
33
+ * virtual module. Used as the source URL for this module, so source maps are
34
+ * correctly resolved.
35
+ *
36
+ * @example
37
+ * '/path/to/src/index.js'
38
+ */
39
+ filePath: string | undefined;
40
+ /**
41
+ * The module content, usually JavaScript or WASM code.
42
+ *
43
+ * @example
44
+ * export default {
45
+ * async fetch(request) {
46
+ * return new Response('Ok')
47
+ * }
48
+ * }
49
+ */
50
+ content: string | Buffer<ArrayBuffer>;
51
+ /**
52
+ * An optional sourcemap for this module if it's of a ESM or CJS type, this will only be present
53
+ * if we're deploying with sourcemaps enabled. Since we copy extra modules that aren't bundled
54
+ * we need to also copy the relevant sourcemaps into the final out directory.
55
+ */
56
+ sourceMap?: CfWorkerSourceMap;
57
+ /**
58
+ * The module type.
59
+ *
60
+ * If absent, will default to the main module's type.
61
+ */
62
+ type?: CfModuleType;
63
+ }
64
+ /**
65
+ * A map of variable names to values.
66
+ */
67
+ interface CfVars {
68
+ [key: string]: string | Json;
69
+ }
70
+ /**
71
+ * A KV namespace.
72
+ */
73
+ interface CfKvNamespace {
74
+ binding: string;
75
+ id?: string | typeof INHERIT_SYMBOL;
76
+ remote?: boolean;
77
+ raw?: boolean;
78
+ }
79
+ /**
80
+ * A binding to send email.
81
+ */
82
+ type CfSendEmailBindings = {
83
+ name: string;
84
+ remote?: boolean;
85
+ } & ({
86
+ destination_address?: string;
87
+ } | {
88
+ allowed_destination_addresses?: string[];
89
+ } | {
90
+ allowed_sender_addresses?: string[];
91
+ });
92
+ /**
93
+ * A binding to a wasm module (in service-worker format)
94
+ */
95
+ interface CfWasmModuleBindings {
96
+ [key: string]: string | Uint8Array<ArrayBuffer>;
97
+ }
98
+ /**
99
+ * A binding to a text blob (in service-worker format)
100
+ */
101
+ interface CfTextBlobBindings {
102
+ [key: string]: string;
103
+ }
104
+ /**
105
+ * A binding to a browser
106
+ */
107
+ interface CfBrowserBinding {
108
+ binding: string;
109
+ raw?: boolean;
110
+ remote?: boolean;
111
+ }
112
+ /**
113
+ * A binding to the AI project
114
+ */
115
+ interface CfAIBinding {
116
+ binding: string;
117
+ staging?: boolean;
118
+ remote?: boolean;
119
+ raw?: boolean;
120
+ }
121
+ /**
122
+ * A binding to Cloudflare Images
123
+ */
124
+ interface CfImagesBinding {
125
+ binding: string;
126
+ raw?: boolean;
127
+ remote?: boolean;
128
+ }
129
+ /**
130
+ * A binding to Cloudflare Media Transformations
131
+ */
132
+ interface CfMediaBinding {
133
+ binding: string;
134
+ remote?: boolean;
135
+ }
136
+ /**
137
+ * A binding to the Worker Version's metadata
138
+ */
139
+ interface CfVersionMetadataBinding {
140
+ binding: string;
141
+ }
142
+ /**
143
+ * A binding to a data blob (in service-worker format)
144
+ */
145
+ interface CfDataBlobBindings {
146
+ [key: string]: string | Uint8Array<ArrayBuffer>;
147
+ }
148
+ /**
149
+ * A Durable Object.
150
+ */
151
+ interface CfDurableObject {
152
+ name: string;
153
+ class_name: string;
154
+ script_name?: string;
155
+ environment?: string;
156
+ }
157
+ interface CfWorkflow {
158
+ name: string;
159
+ class_name: string;
160
+ binding: string;
161
+ script_name?: string;
162
+ remote?: boolean;
163
+ raw?: boolean;
164
+ }
165
+ interface CfQueue {
166
+ binding: string;
167
+ queue_name: string;
168
+ delivery_delay?: number;
169
+ remote?: boolean;
170
+ raw?: boolean;
171
+ }
172
+ interface CfR2Bucket {
173
+ binding: string;
174
+ bucket_name?: string | typeof INHERIT_SYMBOL;
175
+ jurisdiction?: string;
176
+ remote?: boolean;
177
+ raw?: boolean;
178
+ }
179
+ interface CfD1Database {
180
+ binding: string;
181
+ database_id?: string | typeof INHERIT_SYMBOL;
182
+ database_name?: string;
183
+ preview_database_id?: string;
184
+ database_internal_env?: string;
185
+ migrations_table?: string;
186
+ migrations_dir?: string;
187
+ remote?: boolean;
188
+ raw?: boolean;
189
+ }
190
+ interface CfVectorize {
191
+ binding: string;
192
+ index_name: string;
193
+ raw?: boolean;
194
+ remote?: boolean;
195
+ }
196
+ interface CfSecretsStoreSecrets {
197
+ binding: string;
198
+ store_id: string;
199
+ secret_name: string;
200
+ }
201
+ interface CfHelloWorld {
202
+ binding: string;
203
+ enable_timer?: boolean;
204
+ }
205
+ interface CfWorkerLoader {
206
+ binding: string;
207
+ }
208
+ interface CfRateLimit {
209
+ name: string;
210
+ namespace_id: string;
211
+ simple: {
212
+ limit: number;
213
+ period: 10 | 60;
214
+ };
215
+ }
216
+ interface CfHyperdrive {
217
+ binding: string;
218
+ id: string;
219
+ localConnectionString?: string;
220
+ }
221
+ interface CfService {
222
+ binding: string;
223
+ service: string;
224
+ environment?: string;
225
+ entrypoint?: string;
226
+ props?: Record<string, unknown>;
227
+ remote?: boolean;
228
+ }
229
+ interface CfVpcService {
230
+ binding: string;
231
+ service_id: string;
232
+ remote?: boolean;
233
+ }
234
+ interface CfAnalyticsEngineDataset {
235
+ binding: string;
236
+ dataset?: string;
237
+ }
238
+ interface CfDispatchNamespace {
239
+ binding: string;
240
+ namespace: string;
241
+ outbound?: {
242
+ service: string;
243
+ environment?: string;
244
+ parameters?: string[];
245
+ };
246
+ remote?: boolean;
247
+ }
248
+ interface CfMTlsCertificate {
249
+ binding: string;
250
+ certificate_id: string;
251
+ remote?: boolean;
252
+ }
253
+ interface CfLogfwdr {
254
+ bindings: CfLogfwdrBinding[];
255
+ }
256
+ interface CfLogfwdrBinding {
257
+ name: string;
258
+ destination: string;
259
+ }
260
+ interface CfAssetsBinding {
261
+ binding: string;
262
+ }
263
+ interface CfPipeline {
264
+ binding: string;
265
+ pipeline: string;
266
+ remote?: boolean;
267
+ }
268
+ interface CfUnsafeBinding {
269
+ name: string;
270
+ type: string;
271
+ dev?: {
272
+ plugin: {
273
+ /**
274
+ * Package is the bare specifier of the package that exposes plugins to integrate into Miniflare via a named `plugins` export.
275
+ * @example "@cloudflare/my-external-miniflare-plugin"
276
+ */
277
+ package: string;
278
+ /**
279
+ * Plugin is the name of the plugin exposed by the package.
280
+ * @example "my-unsafe-plugin"
281
+ */
282
+ name: string;
283
+ };
284
+ /**
285
+ * dev-only options to pass to the plugin.
286
+ */
287
+ options?: Record<string, unknown>;
288
+ };
289
+ }
290
+ type CfUnsafeMetadata = Record<string, unknown>;
291
+ type CfCapnp = {
292
+ base_path?: never;
293
+ source_schemas?: never;
294
+ compiled_schema: string;
295
+ } | {
296
+ base_path: string;
297
+ source_schemas: string[];
298
+ compiled_schema?: never;
299
+ };
300
+ interface CfUnsafe {
301
+ bindings: CfUnsafeBinding[] | undefined;
302
+ metadata: CfUnsafeMetadata | undefined;
303
+ capnp: CfCapnp | undefined;
304
+ }
305
+ interface CfDurableObjectMigrations {
306
+ old_tag?: string;
307
+ new_tag: string;
308
+ steps: {
309
+ new_classes?: string[];
310
+ new_sqlite_classes?: string[];
311
+ renamed_classes?: {
312
+ from: string;
313
+ to: string;
314
+ }[];
315
+ deleted_classes?: string[];
316
+ }[];
317
+ }
318
+ interface CfPlacement {
319
+ mode: "smart";
320
+ hint?: string;
321
+ }
322
+ interface CfTailConsumer {
323
+ service: string;
324
+ environment?: string;
325
+ }
326
+ interface CfUserLimits {
327
+ cpu_ms?: number;
328
+ }
329
+ /**
330
+ * Options for creating a `CfWorker`.
331
+ */
332
+ interface CfWorkerInit {
333
+ /**
334
+ * The name of the worker.
335
+ */
336
+ name: string | undefined;
337
+ /**
338
+ * The entrypoint module.
339
+ */
340
+ main: CfModule;
341
+ /**
342
+ * The list of additional modules.
343
+ */
344
+ modules: CfModule[] | undefined;
345
+ /**
346
+ * The list of source maps to include on upload.
347
+ */
348
+ sourceMaps: CfWorkerSourceMap[] | undefined;
349
+ /**
350
+ * All the bindings
351
+ */
352
+ bindings: {
353
+ vars: CfVars | undefined;
354
+ kv_namespaces: CfKvNamespace[] | undefined;
355
+ send_email: CfSendEmailBindings[] | undefined;
356
+ wasm_modules: CfWasmModuleBindings | undefined;
357
+ text_blobs: CfTextBlobBindings | undefined;
358
+ browser: CfBrowserBinding | undefined;
359
+ ai: CfAIBinding | undefined;
360
+ images: CfImagesBinding | undefined;
361
+ version_metadata: CfVersionMetadataBinding | undefined;
362
+ data_blobs: CfDataBlobBindings | undefined;
363
+ durable_objects: {
364
+ bindings: CfDurableObject[];
365
+ } | undefined;
366
+ workflows: CfWorkflow[] | undefined;
367
+ queues: CfQueue[] | undefined;
368
+ r2_buckets: CfR2Bucket[] | undefined;
369
+ d1_databases: CfD1Database[] | undefined;
370
+ vectorize: CfVectorize[] | undefined;
371
+ hyperdrive: CfHyperdrive[] | undefined;
372
+ secrets_store_secrets: CfSecretsStoreSecrets[] | undefined;
373
+ services: CfService[] | undefined;
374
+ vpc_services: CfVpcService[] | undefined;
375
+ analytics_engine_datasets: CfAnalyticsEngineDataset[] | undefined;
376
+ dispatch_namespaces: CfDispatchNamespace[] | undefined;
377
+ mtls_certificates: CfMTlsCertificate[] | undefined;
378
+ logfwdr: CfLogfwdr | undefined;
379
+ pipelines: CfPipeline[] | undefined;
380
+ unsafe: CfUnsafe | undefined;
381
+ assets: CfAssetsBinding | undefined;
382
+ unsafe_hello_world: CfHelloWorld[] | undefined;
383
+ ratelimits: CfRateLimit[] | undefined;
384
+ worker_loaders: CfWorkerLoader[] | undefined;
385
+ media: CfMediaBinding | undefined;
386
+ };
387
+ containers?: {
388
+ class_name: string;
389
+ }[];
390
+ /**
391
+ * The raw bindings - this is basically never provided and it'll be the bindings above
392
+ * but if we're just taking from the api and re-putting then this is how we can do that
393
+ * without going between the different types
394
+ */
395
+ rawBindings?: WorkerMetadataBinding[];
396
+ migrations: CfDurableObjectMigrations | undefined;
397
+ compatibility_date: string | undefined;
398
+ compatibility_flags: string[] | undefined;
399
+ keepVars: boolean | undefined;
400
+ keepSecrets: boolean | undefined;
401
+ keepBindings?: WorkerMetadata["keep_bindings"];
402
+ logpush: boolean | undefined;
403
+ placement: CfPlacement | undefined;
404
+ tail_consumers: CfTailConsumer[] | undefined;
405
+ limits: CfUserLimits | undefined;
406
+ annotations?: Record<string, string | undefined>;
407
+ keep_assets?: boolean | undefined;
408
+ assets: {
409
+ jwt: string;
410
+ routerConfig: RouterConfig;
411
+ assetConfig: AssetConfig;
412
+ run_worker_first?: string[] | boolean;
413
+ _redirects?: string;
414
+ _headers?: string;
415
+ } | undefined;
416
+ observability: Observability | undefined;
417
+ }
418
+ interface CfWorkerContext {
419
+ env: string | undefined;
420
+ useServiceEnvironments: boolean | undefined;
421
+ zone: string | undefined;
422
+ host: string | undefined;
423
+ routes: Route[] | undefined;
424
+ sendMetrics: boolean | undefined;
425
+ }
426
+ interface CfWorkerSourceMap {
427
+ /**
428
+ * The name of the source map.
429
+ *
430
+ * @example
431
+ * 'out.js.map'
432
+ */
433
+ name: string;
434
+ /**
435
+ * The content of the source map, which is a JSON object described by the v3
436
+ * spec.
437
+ *
438
+ * @example
439
+ * {
440
+ * "version" : 3,
441
+ * "file": "out.js",
442
+ * "sourceRoot": "",
443
+ * "sources": ["foo.js", "bar.js"],
444
+ * "sourcesContent": [null, null],
445
+ * "names": ["src", "maps", "are", "fun"],
446
+ * "mappings": "A,AAAB;;ABCDE;"
447
+ * }
448
+ */
449
+ content: string | Buffer;
450
+ }
451
+
452
+ type Json = string | number | boolean | null | Json[] | {
453
+ [id: string]: Json;
454
+ };
455
+ type WorkerMetadataBinding = {
456
+ type: "inherit";
457
+ name: string;
458
+ } | {
459
+ type: "plain_text";
460
+ name: string;
461
+ text: string;
462
+ } | {
463
+ type: "secret_text";
464
+ name: string;
465
+ text: string;
466
+ } | {
467
+ type: "json";
468
+ name: string;
469
+ json: Json;
470
+ } | {
471
+ type: "wasm_module";
472
+ name: string;
473
+ part: string;
474
+ } | {
475
+ type: "text_blob";
476
+ name: string;
477
+ part: string;
478
+ } | {
479
+ type: "browser";
480
+ name: string;
481
+ raw?: boolean;
482
+ } | {
483
+ type: "ai";
484
+ name: string;
485
+ staging?: boolean;
486
+ raw?: boolean;
487
+ } | {
488
+ type: "images";
489
+ name: string;
490
+ raw?: boolean;
491
+ } | {
492
+ type: "version_metadata";
493
+ name: string;
494
+ } | {
495
+ type: "data_blob";
496
+ name: string;
497
+ part: string;
498
+ } | {
499
+ type: "kv_namespace";
500
+ name: string;
501
+ namespace_id: string;
502
+ raw?: boolean;
503
+ } | {
504
+ type: "media";
505
+ name: string;
506
+ } | {
507
+ type: "send_email";
508
+ name: string;
509
+ destination_address?: string;
510
+ allowed_destination_addresses?: string[];
511
+ allowed_sender_addresses?: string[];
512
+ } | {
513
+ type: "durable_object_namespace";
514
+ name: string;
515
+ class_name: string;
516
+ script_name?: string;
517
+ environment?: string;
518
+ namespace_id?: string;
519
+ } | {
520
+ type: "workflow";
521
+ name: string;
522
+ workflow_name: string;
523
+ class_name: string;
524
+ script_name?: string;
525
+ raw?: boolean;
526
+ } | {
527
+ type: "queue";
528
+ name: string;
529
+ queue_name: string;
530
+ delivery_delay?: number;
531
+ raw?: boolean;
532
+ } | {
533
+ type: "r2_bucket";
534
+ name: string;
535
+ bucket_name: string;
536
+ jurisdiction?: string;
537
+ raw?: boolean;
538
+ } | {
539
+ type: "d1";
540
+ name: string;
541
+ id: string;
542
+ internalEnv?: string;
543
+ raw?: boolean;
544
+ } | {
545
+ type: "vectorize";
546
+ name: string;
547
+ index_name: string;
548
+ internalEnv?: string;
549
+ raw?: boolean;
550
+ } | {
551
+ type: "hyperdrive";
552
+ name: string;
553
+ id: string;
554
+ } | {
555
+ type: "service";
556
+ name: string;
557
+ service: string;
558
+ environment?: string;
559
+ entrypoint?: string;
560
+ } | {
561
+ type: "analytics_engine";
562
+ name: string;
563
+ dataset?: string;
564
+ } | {
565
+ type: "dispatch_namespace";
566
+ name: string;
567
+ namespace: string;
568
+ outbound?: {
569
+ worker: {
570
+ service: string;
571
+ environment?: string;
572
+ };
573
+ params?: {
574
+ name: string;
575
+ }[];
576
+ };
577
+ } | {
578
+ type: "mtls_certificate";
579
+ name: string;
580
+ certificate_id: string;
581
+ } | {
582
+ type: "pipelines";
583
+ name: string;
584
+ pipeline: string;
585
+ } | {
586
+ type: "secrets_store_secret";
587
+ name: string;
588
+ store_id: string;
589
+ secret_name: string;
590
+ } | {
591
+ type: "unsafe_hello_world";
592
+ name: string;
593
+ enable_timer?: boolean;
594
+ } | {
595
+ type: "ratelimit";
596
+ name: string;
597
+ namespace_id: string;
598
+ simple: {
599
+ limit: number;
600
+ period: 10 | 60;
601
+ };
602
+ } | {
603
+ type: "vpc_service";
604
+ name: string;
605
+ service_id: string;
606
+ } | {
607
+ type: "worker_loader";
608
+ name: string;
609
+ } | {
610
+ type: "logfwdr";
611
+ name: string;
612
+ destination: string;
613
+ } | {
614
+ type: "assets";
615
+ name: string;
616
+ };
617
+ type AssetConfigMetadata = {
618
+ html_handling?: AssetConfig["html_handling"];
619
+ not_found_handling?: AssetConfig["not_found_handling"];
620
+ run_worker_first?: boolean | string[];
621
+ _redirects?: string;
622
+ _headers?: string;
623
+ };
624
+ type WorkerMetadataPut = {
625
+ /** The name of the entry point module. Only exists when the worker is in the ES module format */
626
+ main_module?: string;
627
+ /** The name of the entry point module. Only exists when the worker is in the service-worker format */
628
+ body_part?: string;
629
+ compatibility_date?: string;
630
+ compatibility_flags?: string[];
631
+ usage_model?: "bundled" | "unbound";
632
+ migrations?: CfDurableObjectMigrations;
633
+ capnp_schema?: string;
634
+ bindings: WorkerMetadataBinding[];
635
+ keep_bindings?: (WorkerMetadataBinding["type"] | "secret_text" | "secret_key")[];
636
+ logpush?: boolean;
637
+ placement?: CfPlacement;
638
+ tail_consumers?: CfTailConsumer[];
639
+ limits?: CfUserLimits;
640
+ assets?: {
641
+ jwt: string;
642
+ config?: AssetConfigMetadata;
643
+ };
644
+ observability?: Observability | undefined;
645
+ [key: string]: unknown;
646
+ };
647
+ type WorkerMetadataVersionsPost = WorkerMetadataPut & {
648
+ annotations?: Record<string, string>;
649
+ };
650
+ type WorkerMetadata = WorkerMetadataPut | WorkerMetadataVersionsPost;
651
+ type ServiceMetadataRes = {
652
+ id: string;
653
+ default_environment: {
654
+ environment: string;
655
+ created_on: string;
656
+ modified_on: string;
657
+ script: {
658
+ id: string;
659
+ tag: string;
660
+ tags: string[];
661
+ etag: string;
662
+ handlers: string[];
663
+ modified_on: string;
664
+ created_on: string;
665
+ migration_tag: string;
666
+ usage_model: "bundled" | "unbound";
667
+ limits: {
668
+ cpu_ms: number;
669
+ };
670
+ compatibility_date: string;
671
+ compatibility_flags: string[];
672
+ last_deployed_from?: "wrangler" | "dash" | "api";
673
+ placement_mode?: "smart";
674
+ tail_consumers?: TailConsumer[];
675
+ observability?: Observability;
676
+ };
677
+ };
678
+ created_on: string;
679
+ modified_on: string;
680
+ usage_model: "bundled" | "unbound";
681
+ environments: [
682
+ {
683
+ environment: string;
684
+ created_on: string;
685
+ modified_on: string;
686
+ }
687
+ ];
688
+ };
689
+
690
+ /**
691
+ * The `Environment` interface declares all the configuration fields that
692
+ * can be specified for an environment.
693
+ *
694
+ * This could be the top-level default environment, or a specific named environment.
695
+ */
696
+ interface Environment extends EnvironmentInheritable, EnvironmentNonInheritable {
697
+ }
698
+ type SimpleRoute = string;
699
+ type ZoneIdRoute = {
700
+ pattern: string;
701
+ zone_id: string;
702
+ custom_domain?: boolean;
703
+ };
704
+ type ZoneNameRoute = {
705
+ pattern: string;
706
+ zone_name: string;
707
+ custom_domain?: boolean;
708
+ };
709
+ type CustomDomainRoute = {
710
+ pattern: string;
711
+ custom_domain: boolean;
712
+ };
713
+ type Route = SimpleRoute | ZoneIdRoute | ZoneNameRoute | CustomDomainRoute;
714
+ /**
715
+ * Configuration in wrangler for Cloudchamber
716
+ */
717
+ type CloudchamberConfig = {
718
+ image?: string;
719
+ location?: string;
720
+ instance_type?: "dev" | "basic" | "standard" | "lite" | "standard-1" | "standard-2" | "standard-3" | "standard-4";
721
+ vcpu?: number;
722
+ memory?: string;
723
+ ipv4?: boolean;
724
+ };
725
+ type UnsafeBinding = {
726
+ /**
727
+ * The name of the binding provided to the Worker
728
+ */
729
+ name: string;
730
+ /**
731
+ * The 'type' of the unsafe binding.
732
+ */
733
+ type: string;
734
+ dev?: {
735
+ plugin: {
736
+ /**
737
+ * Package is the bare specifier of the package that exposes plugins to integrate into Miniflare via a named `plugins` export.
738
+ * @example "@cloudflare/my-external-miniflare-plugin"
739
+ */
740
+ package: string;
741
+ /**
742
+ * Plugin is the name of the plugin exposed by the package.
743
+ * @example "MY_UNSAFE_PLUGIN"
744
+ */
745
+ name: string;
746
+ };
747
+ /**
748
+ * Optional mapping of unsafe bindings names to options provided for the plugin.
749
+ */
750
+ options?: Record<string, unknown>;
751
+ };
752
+ [key: string]: unknown;
753
+ };
754
+ /**
755
+ * Configuration for a container application
756
+ */
757
+ type ContainerApp = {
758
+ /**
759
+ * Name of the application
760
+ * @optional Defaults to `worker_name-class_name` if not specified.
761
+ */
762
+ name?: string;
763
+ /**
764
+ * Number of application instances
765
+ * @deprecated
766
+ * @hidden
767
+ */
768
+ instances?: number;
769
+ /**
770
+ * Number of maximum application instances.
771
+ * @optional
772
+ */
773
+ max_instances?: number;
774
+ /**
775
+ * The path to a Dockerfile, or an image URI for the Cloudflare registry.
776
+ */
777
+ image: string;
778
+ /**
779
+ * Build context of the application.
780
+ * @optional - defaults to the directory of `image`.
781
+ */
782
+ image_build_context?: string;
783
+ /**
784
+ * Image variables available to the image at build-time only.
785
+ * For runtime env vars, refer to https://developers.cloudflare.com/containers/examples/env-vars-and-secrets/
786
+ * @optional
787
+ */
788
+ image_vars?: Record<string, string>;
789
+ /**
790
+ * The class name of the Durable Object the container is connected to.
791
+ */
792
+ class_name: string;
793
+ /**
794
+ * The scheduling policy of the application
795
+ * @optional
796
+ * @default "default"
797
+ */
798
+ scheduling_policy?: "default" | "moon" | "regional";
799
+ /**
800
+ * The instance type to be used for the container.
801
+ * Select from one of the following named instance types:
802
+ * - lite: 1/16 vCPU, 256 MiB memory, and 2 GB disk
803
+ * - basic: 1/4 vCPU, 1 GiB memory, and 4 GB disk
804
+ * - standard-1: 1/2 vCPU, 4 GiB memory, and 8 GB disk
805
+ * - standard-2: 1 vCPU, 6 GiB memory, and 12 GB disk
806
+ * - standard-3: 2 vCPU, 8 GiB memory, and 16 GB disk
807
+ * - standard-4: 4 vCPU, 12 GiB memory, and 20 GB disk
808
+ * - dev: 1/16 vCPU, 256 MiB memory, and 2 GB disk (deprecated, use "lite" instead)
809
+ * - standard: 1 vCPU, 4 GiB memory, and 4 GB disk (deprecated, use "standard-1" instead)
810
+ *
811
+ * Customers on an enterprise plan have the additional option to set custom limits.
812
+ *
813
+ * @optional
814
+ * @default "dev"
815
+ */
816
+ instance_type?: "dev" | "basic" | "standard" | "lite" | "standard-1" | "standard-2" | "standard-3" | "standard-4" | {
817
+ /** @defaults to 0.0625 (1/16 vCPU) */
818
+ vcpu?: number;
819
+ /** @defaults to 256 MiB */
820
+ memory_mib?: number;
821
+ /** @defaults to 2 GB */
822
+ disk_mb?: number;
823
+ };
824
+ /**
825
+ * @deprecated Use top level `containers` fields instead.
826
+ * `configuration.image` should be `image`
827
+ * limits should be set via `instance_type`
828
+ * @hidden
829
+ */
830
+ configuration?: {
831
+ image?: string;
832
+ labels?: {
833
+ name: string;
834
+ value: string;
835
+ }[];
836
+ secrets?: {
837
+ name: string;
838
+ type: "env";
839
+ secret: string;
840
+ }[];
841
+ disk?: {
842
+ size_mb: number;
843
+ };
844
+ vcpu?: number;
845
+ memory_mib?: number;
846
+ };
847
+ /**
848
+ * Scheduling constraints
849
+ * @hidden
850
+ */
851
+ constraints?: {
852
+ regions?: string[];
853
+ cities?: string[];
854
+ tier?: number;
855
+ };
856
+ /**
857
+ * Scheduling affinities
858
+ * @hidden
859
+ */
860
+ affinities?: {
861
+ colocation?: "datacenter";
862
+ hardware_generation?: "highest-overall-performance";
863
+ };
864
+ /**
865
+ * @deprecated use the `class_name` field instead.
866
+ * @hidden
867
+ */
868
+ durable_objects?: {
869
+ namespace_id: string;
870
+ };
871
+ /**
872
+ * Configures what percentage of instances should be updated at each step of a rollout.
873
+ * You can specify this as a single number, or an array of numbers.
874
+ *
875
+ * If this is a single number, each step will progress by that percentage.
876
+ * The options are 5, 10, 20, 25, 50 or 100.
877
+ *
878
+ * If this is an array, each step specifies the cumulative rollout progress.
879
+ * The final step must be 100.
880
+ *
881
+ * This can be overridden adhoc by deploying with the `--containers-rollout=immediate` flag,
882
+ * which will roll out to 100% of instances in one step.
883
+ *
884
+ * @optional
885
+ * @default [10,100]
886
+ * */
887
+ rollout_step_percentage?: number | number[];
888
+ /**
889
+ * How a rollout should be created. It supports the following modes:
890
+ * - full_auto: The container application will be rolled out fully automatically.
891
+ * - none: The container application won't have a roll out or update.
892
+ * - manual: The container application will be rollout fully by manually actioning progress steps.
893
+ * @optional
894
+ * @default "full_auto"
895
+ * @hidden
896
+ */
897
+ rollout_kind?: "full_auto" | "none" | "full_manual";
898
+ /**
899
+ * Configures the grace period (in seconds) for active instances before being shutdown during a rollout.
900
+ * @optional
901
+ * @default 0
902
+ */
903
+ rollout_active_grace_period?: number;
904
+ };
905
+ /**
906
+ * Configuration in wrangler for Durable Object Migrations
907
+ */
908
+ type DurableObjectMigration = {
909
+ /** A unique identifier for this migration. */
910
+ tag: string;
911
+ /** The new Durable Objects being defined. */
912
+ new_classes?: string[];
913
+ /** The new SQLite Durable Objects being defined. */
914
+ new_sqlite_classes?: string[];
915
+ /** The Durable Objects being renamed. */
916
+ renamed_classes?: {
917
+ from: string;
918
+ to: string;
919
+ }[];
920
+ /** The Durable Objects being removed. */
921
+ deleted_classes?: string[];
922
+ };
923
+ /**
924
+ * The `EnvironmentInheritable` interface declares all the configuration fields for an environment
925
+ * that can be inherited (and overridden) from the top-level environment.
926
+ */
927
+ interface EnvironmentInheritable {
928
+ /**
929
+ * The name of your Worker. Alphanumeric + dashes only.
930
+ *
931
+ * @inheritable
932
+ */
933
+ name: string | undefined;
934
+ /**
935
+ * This is the ID of the account associated with your zone.
936
+ * You might have more than one account, so make sure to use
937
+ * the ID of the account associated with the zone/route you
938
+ * provide, if you provide one. It can also be specified through
939
+ * the CLOUDFLARE_ACCOUNT_ID environment variable.
940
+ *
941
+ * @inheritable
942
+ */
943
+ account_id: string | undefined;
944
+ /**
945
+ * A date in the form yyyy-mm-dd, which will be used to determine
946
+ * which version of the Workers runtime is used.
947
+ *
948
+ * More details at https://developers.cloudflare.com/workers/configuration/compatibility-dates
949
+ *
950
+ * @inheritable
951
+ */
952
+ compatibility_date: string | undefined;
953
+ /**
954
+ * A list of flags that enable features from upcoming features of
955
+ * the Workers runtime, usually used together with compatibility_date.
956
+ *
957
+ * More details at https://developers.cloudflare.com/workers/configuration/compatibility-flags/
958
+ *
959
+ * @default []
960
+ * @inheritable
961
+ */
962
+ compatibility_flags: string[];
963
+ /**
964
+ * The entrypoint/path to the JavaScript file that will be executed.
965
+ *
966
+ * @inheritable
967
+ */
968
+ main: string | undefined;
969
+ /**
970
+ * If true then Wrangler will traverse the file tree below `base_dir`;
971
+ * Any files that match `rules` will be included in the deployed Worker.
972
+ * Defaults to true if `no_bundle` is true, otherwise false.
973
+ *
974
+ * @inheritable
975
+ */
976
+ find_additional_modules: boolean | undefined;
977
+ /**
978
+ * Determines whether Wrangler will preserve bundled file names.
979
+ * Defaults to false.
980
+ * If left unset, files will be named using the pattern ${fileHash}-${basename},
981
+ * for example, `34de60b44167af5c5a709e62a4e20c4f18c9e3b6-favicon.ico`.
982
+ *
983
+ * @inheritable
984
+ */
985
+ preserve_file_names: boolean | undefined;
986
+ /**
987
+ * The directory in which module rules should be evaluated when including additional files into a Worker deployment.
988
+ * This defaults to the directory containing the `main` entry point of the Worker if not specified.
989
+ *
990
+ * @inheritable
991
+ */
992
+ base_dir: string | undefined;
993
+ /**
994
+ * Whether we use <name>.<subdomain>.workers.dev to
995
+ * test and deploy your Worker.
996
+ *
997
+ * For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#workersdev
998
+ *
999
+ * @default true
1000
+ * @breaking
1001
+ * @inheritable
1002
+ */
1003
+ workers_dev: boolean | undefined;
1004
+ /**
1005
+ * Whether we use <version>-<name>.<subdomain>.workers.dev to
1006
+ * serve Preview URLs for your Worker.
1007
+ *
1008
+ * @default false
1009
+ * @inheritable
1010
+ */
1011
+ preview_urls: boolean | undefined;
1012
+ /**
1013
+ * A list of routes that your Worker should be published to.
1014
+ * Only one of `routes` or `route` is required.
1015
+ *
1016
+ * Only required when workers_dev is false, and there's no scheduled Worker (see `triggers`)
1017
+ *
1018
+ * For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#types-of-routes
1019
+ *
1020
+ * @inheritable
1021
+ */
1022
+ routes: Route[] | undefined;
1023
+ /**
1024
+ * A route that your Worker should be published to. Literally
1025
+ * the same as routes, but only one.
1026
+ * Only one of `routes` or `route` is required.
1027
+ *
1028
+ * Only required when workers_dev is false, and there's no scheduled Worker
1029
+ *
1030
+ * @inheritable
1031
+ */
1032
+ route: Route | undefined;
1033
+ /**
1034
+ * Path to a custom tsconfig
1035
+ *
1036
+ * @inheritable
1037
+ */
1038
+ tsconfig: string | undefined;
1039
+ /**
1040
+ * The function to use to replace jsx syntax.
1041
+ *
1042
+ * @default "React.createElement"
1043
+ * @inheritable
1044
+ */
1045
+ jsx_factory: string;
1046
+ /**
1047
+ * The function to use to replace jsx fragment syntax.
1048
+ *
1049
+ * @default "React.Fragment"
1050
+ * @inheritable
1051
+ */
1052
+ jsx_fragment: string;
1053
+ /**
1054
+ * A list of migrations that should be uploaded with your Worker.
1055
+ *
1056
+ * These define changes in your Durable Object declarations.
1057
+ *
1058
+ * More details at https://developers.cloudflare.com/workers/learning/using-durable-objects#configuring-durable-object-classes-with-migrations
1059
+ *
1060
+ * @default []
1061
+ * @inheritable
1062
+ */
1063
+ migrations: DurableObjectMigration[];
1064
+ /**
1065
+ * "Cron" definitions to trigger a Worker's "scheduled" function.
1066
+ *
1067
+ * Lets you call Workers periodically, much like a cron job.
1068
+ *
1069
+ * More details here https://developers.cloudflare.com/workers/platform/cron-triggers
1070
+ *
1071
+ * For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#triggers
1072
+ *
1073
+ * @default {crons: undefined}
1074
+ * @inheritable
1075
+ */
1076
+ triggers: {
1077
+ crons: string[] | undefined;
1078
+ };
1079
+ /**
1080
+ * Specify limits for runtime behavior.
1081
+ * Only supported for the "standard" Usage Model
1082
+ *
1083
+ * For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#limits
1084
+ *
1085
+ * @inheritable
1086
+ */
1087
+ limits: UserLimits | undefined;
1088
+ /**
1089
+ * An ordered list of rules that define which modules to import,
1090
+ * and what type to import them as. You will need to specify rules
1091
+ * to use Text, Data, and CompiledWasm modules, or when you wish to
1092
+ * have a .js file be treated as an ESModule instead of CommonJS.
1093
+ *
1094
+ * For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#bundling
1095
+ *
1096
+ * @inheritable
1097
+ */
1098
+ rules: Rule[];
1099
+ /**
1100
+ * Configures a custom build step to be run by Wrangler when building your Worker.
1101
+ *
1102
+ * Refer to the [custom builds documentation](https://developers.cloudflare.com/workers/cli-wrangler/configuration#build)
1103
+ * for more details.
1104
+ *
1105
+ * For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#custom-builds
1106
+ *
1107
+ * @default {watch_dir:"./src"}
1108
+ */
1109
+ build: {
1110
+ /** The command used to build your Worker. On Linux and macOS, the command is executed in the `sh` shell and the `cmd` shell for Windows. The `&&` and `||` shell operators may be used. */
1111
+ command?: string;
1112
+ /** The directory in which the command is executed. */
1113
+ cwd?: string;
1114
+ /** The directory to watch for changes while using wrangler dev, defaults to the current working directory */
1115
+ watch_dir?: string | string[];
1116
+ };
1117
+ /**
1118
+ * Skip internal build steps and directly deploy script
1119
+ * @inheritable
1120
+ */
1121
+ no_bundle: boolean | undefined;
1122
+ /**
1123
+ * Minify the script before uploading.
1124
+ * @inheritable
1125
+ */
1126
+ minify: boolean | undefined;
1127
+ /**
1128
+ * Set the `name` property to the original name for functions and classes renamed during minification.
1129
+ *
1130
+ * See https://esbuild.github.io/api/#keep-names
1131
+ *
1132
+ * @default true
1133
+ * @inheritable
1134
+ */
1135
+ keep_names: boolean | undefined;
1136
+ /**
1137
+ * Designates this Worker as an internal-only "first-party" Worker.
1138
+ *
1139
+ * @inheritable
1140
+ */
1141
+ first_party_worker: boolean | undefined;
1142
+ /**
1143
+ * List of bindings that you will send to logfwdr
1144
+ *
1145
+ * @default {bindings:[]}
1146
+ * @inheritable
1147
+ */
1148
+ logfwdr: {
1149
+ bindings: {
1150
+ /** The binding name used to refer to logfwdr */
1151
+ name: string;
1152
+ /** The destination for this logged message */
1153
+ destination: string;
1154
+ }[];
1155
+ };
1156
+ /**
1157
+ * Send Trace Events from this Worker to Workers Logpush.
1158
+ *
1159
+ * This will not configure a corresponding Logpush job automatically.
1160
+ *
1161
+ * For more information about Workers Logpush, see:
1162
+ * https://blog.cloudflare.com/logpush-for-workers/
1163
+ *
1164
+ * @inheritable
1165
+ */
1166
+ logpush: boolean | undefined;
1167
+ /**
1168
+ * Include source maps when uploading this worker.
1169
+ *
1170
+ * For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#source-maps
1171
+ *
1172
+ * @inheritable
1173
+ */
1174
+ upload_source_maps: boolean | undefined;
1175
+ /**
1176
+ * Specify how the Worker should be located to minimize round-trip time.
1177
+ *
1178
+ * More details: https://developers.cloudflare.com/workers/platform/smart-placement/
1179
+ *
1180
+ * @inheritable
1181
+ */
1182
+ placement: {
1183
+ mode: "off" | "smart";
1184
+ hint?: string;
1185
+ } | undefined;
1186
+ /**
1187
+ * Specify the directory of static assets to deploy/serve
1188
+ *
1189
+ * More details at https://developers.cloudflare.com/workers/frameworks/
1190
+ *
1191
+ * For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#assets
1192
+ *
1193
+ * @inheritable
1194
+ */
1195
+ assets: Assets | undefined;
1196
+ /**
1197
+ * Specify the observability behavior of the Worker.
1198
+ *
1199
+ * For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#observability
1200
+ *
1201
+ * @inheritable
1202
+ */
1203
+ observability: Observability | undefined;
1204
+ /**
1205
+ * Specify the compliance region mode of the Worker.
1206
+ *
1207
+ * Although if the user does not specify a compliance region, the default is `public`,
1208
+ * it can be set to `undefined` in configuration to delegate to the CLOUDFLARE_COMPLIANCE_REGION environment variable.
1209
+ */
1210
+ compliance_region: "public" | "fedramp_high" | undefined;
1211
+ /**
1212
+ * Configuration for Python modules.
1213
+ *
1214
+ * @inheritable
1215
+ */
1216
+ python_modules: {
1217
+ /**
1218
+ * A list of glob patterns to exclude files from the python_modules directory when bundling.
1219
+ *
1220
+ * Patterns are relative to the python_modules directory and use glob syntax.
1221
+ *
1222
+ * @default ["**\*.pyc"]
1223
+ */
1224
+ exclude: string[];
1225
+ };
1226
+ }
1227
+ type DurableObjectBindings = {
1228
+ /** The name of the binding used to refer to the Durable Object */
1229
+ name: string;
1230
+ /** The exported class name of the Durable Object */
1231
+ class_name: string;
1232
+ /** The script where the Durable Object is defined (if it's external to this Worker) */
1233
+ script_name?: string;
1234
+ /** The service environment of the script_name to bind to */
1235
+ environment?: string;
1236
+ }[];
1237
+ type WorkflowBinding = {
1238
+ /** The name of the binding used to refer to the Workflow */
1239
+ binding: string;
1240
+ /** The name of the Workflow */
1241
+ name: string;
1242
+ /** The exported class name of the Workflow */
1243
+ class_name: string;
1244
+ /** The script where the Workflow is defined (if it's external to this Worker) */
1245
+ script_name?: string;
1246
+ /** Whether the Workflow should be remote or not in local development */
1247
+ remote?: boolean;
1248
+ };
1249
+ /**
1250
+ * The `EnvironmentNonInheritable` interface declares all the configuration fields for an environment
1251
+ * that cannot be inherited from the top-level environment, and must be defined specifically.
1252
+ *
1253
+ * If any of these fields are defined at the top-level then they should also be specifically defined
1254
+ * for each named environment.
1255
+ */
1256
+ interface EnvironmentNonInheritable {
1257
+ /**
1258
+ * A map of values to substitute when deploying your Worker.
1259
+ *
1260
+ * NOTE: This field is not automatically inherited from the top level environment,
1261
+ * and so must be specified in every named environment.
1262
+ *
1263
+ * @default {}
1264
+ * @nonInheritable
1265
+ */
1266
+ define: Record<string, string>;
1267
+ /**
1268
+ * A map of environment variables to set when deploying your Worker.
1269
+ *
1270
+ * NOTE: This field is not automatically inherited from the top level environment,
1271
+ * and so must be specified in every named environment.
1272
+ *
1273
+ * For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#environment-variables
1274
+ *
1275
+ * @default {}
1276
+ * @nonInheritable
1277
+ */
1278
+ vars: Record<string, string | Json>;
1279
+ /**
1280
+ * A list of durable objects that your Worker should be bound to.
1281
+ *
1282
+ * For more information about Durable Objects, see the documentation at
1283
+ * https://developers.cloudflare.com/workers/learning/using-durable-objects
1284
+ *
1285
+ * NOTE: This field is not automatically inherited from the top level environment,
1286
+ * and so must be specified in every named environment.
1287
+ *
1288
+ * For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#durable-objects
1289
+ *
1290
+ * @default {bindings:[]}
1291
+ * @nonInheritable
1292
+ */
1293
+ durable_objects: {
1294
+ bindings: DurableObjectBindings;
1295
+ };
1296
+ /**
1297
+ * A list of workflows that your Worker should be bound to.
1298
+ *
1299
+ * NOTE: This field is not automatically inherited from the top level environment,
1300
+ * and so must be specified in every named environment.
1301
+ *
1302
+ * @default []
1303
+ * @nonInheritable
1304
+ */
1305
+ workflows: WorkflowBinding[];
1306
+ /**
1307
+ * Cloudchamber configuration
1308
+ *
1309
+ * NOTE: This field is not automatically inherited from the top level environment,
1310
+ * and so must be specified in every named environment.
1311
+ *
1312
+ * @default {}
1313
+ * @nonInheritable
1314
+ */
1315
+ cloudchamber: CloudchamberConfig;
1316
+ /**
1317
+ * Container related configuration
1318
+ *
1319
+ * NOTE: This field is not automatically inherited from the top level environment,
1320
+ * and so must be specified in every named environment.
1321
+ *
1322
+ * @default []
1323
+ * @nonInheritable
1324
+ */
1325
+ containers?: ContainerApp[];
1326
+ /**
1327
+ * These specify any Workers KV Namespaces you want to
1328
+ * access from inside your Worker.
1329
+ *
1330
+ * To learn more about KV Namespaces,
1331
+ * see the documentation at https://developers.cloudflare.com/workers/learning/how-kv-works
1332
+ *
1333
+ * NOTE: This field is not automatically inherited from the top level environment,
1334
+ * and so must be specified in every named environment.
1335
+ *
1336
+ * For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#kv-namespaces
1337
+ *
1338
+ * @default []
1339
+ * @nonInheritable
1340
+ */
1341
+ kv_namespaces: {
1342
+ /** The binding name used to refer to the KV Namespace */
1343
+ binding: string;
1344
+ /** The ID of the KV namespace */
1345
+ id?: string;
1346
+ /** The ID of the KV namespace used during `wrangler dev` */
1347
+ preview_id?: string;
1348
+ /** Whether the KV namespace should be remote or not in local development */
1349
+ remote?: boolean;
1350
+ }[];
1351
+ /**
1352
+ * These specify bindings to send email from inside your Worker.
1353
+ *
1354
+ * NOTE: This field is not automatically inherited from the top level environment,
1355
+ * and so must be specified in every named environment.
1356
+ *
1357
+ * For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#email-bindings
1358
+ *
1359
+ * @default []
1360
+ * @nonInheritable
1361
+ */
1362
+ send_email: {
1363
+ /** The binding name used to refer to the this binding */
1364
+ name: string;
1365
+ /** If this binding should be restricted to a specific verified address */
1366
+ destination_address?: string;
1367
+ /** If this binding should be restricted to a set of verified addresses */
1368
+ allowed_destination_addresses?: string[];
1369
+ /** If this binding should be restricted to a set of sender addresses */
1370
+ allowed_sender_addresses?: string[];
1371
+ /** Whether the binding should be remote or not in local development */
1372
+ remote?: boolean;
1373
+ }[];
1374
+ /**
1375
+ * Specifies Queues that are bound to this Worker environment.
1376
+ *
1377
+ * NOTE: This field is not automatically inherited from the top level environment,
1378
+ * and so must be specified in every named environment.
1379
+ *
1380
+ * For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#queues
1381
+ *
1382
+ * @default {consumers:[],producers:[]}
1383
+ * @nonInheritable
1384
+ */
1385
+ queues: {
1386
+ /** Producer bindings */
1387
+ producers?: {
1388
+ /** The binding name used to refer to the Queue in the Worker. */
1389
+ binding: string;
1390
+ /** The name of this Queue. */
1391
+ queue: string;
1392
+ /** The number of seconds to wait before delivering a message */
1393
+ delivery_delay?: number;
1394
+ /** Whether the Queue producer should be remote or not in local development */
1395
+ remote?: boolean;
1396
+ }[];
1397
+ /** Consumer configuration */
1398
+ consumers?: {
1399
+ /** The name of the queue from which this consumer should consume. */
1400
+ queue: string;
1401
+ /** The consumer type, e.g., worker, http-pull, r2-bucket, etc. Default is worker. */
1402
+ type?: string;
1403
+ /** The maximum number of messages per batch */
1404
+ max_batch_size?: number;
1405
+ /** The maximum number of seconds to wait to fill a batch with messages. */
1406
+ max_batch_timeout?: number;
1407
+ /** The maximum number of retries for each message. */
1408
+ max_retries?: number;
1409
+ /** The queue to send messages that failed to be consumed. */
1410
+ dead_letter_queue?: string;
1411
+ /** The maximum number of concurrent consumer Worker invocations. Leaving this unset will allow your consumer to scale to the maximum concurrency needed to keep up with the message backlog. */
1412
+ max_concurrency?: number | null;
1413
+ /** The number of milliseconds to wait for pulled messages to become visible again */
1414
+ visibility_timeout_ms?: number;
1415
+ /** The number of seconds to wait before retrying a message */
1416
+ retry_delay?: number;
1417
+ }[];
1418
+ };
1419
+ /**
1420
+ * Specifies R2 buckets that are bound to this Worker environment.
1421
+ *
1422
+ * NOTE: This field is not automatically inherited from the top level environment,
1423
+ * and so must be specified in every named environment.
1424
+ *
1425
+ * For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#r2-buckets
1426
+ *
1427
+ * @default []
1428
+ * @nonInheritable
1429
+ */
1430
+ r2_buckets: {
1431
+ /** The binding name used to refer to the R2 bucket in the Worker. */
1432
+ binding: string;
1433
+ /** The name of this R2 bucket at the edge. */
1434
+ bucket_name?: string;
1435
+ /** The preview name of this R2 bucket at the edge. */
1436
+ preview_bucket_name?: string;
1437
+ /** The jurisdiction that the bucket exists in. Default if not present. */
1438
+ jurisdiction?: string;
1439
+ /** Whether the R2 bucket should be remote or not in local development */
1440
+ remote?: boolean;
1441
+ }[];
1442
+ /**
1443
+ * Specifies D1 databases that are bound to this Worker environment.
1444
+ *
1445
+ * NOTE: This field is not automatically inherited from the top level environment,
1446
+ * and so must be specified in every named environment.
1447
+ *
1448
+ * For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#d1-databases
1449
+ *
1450
+ * @default []
1451
+ * @nonInheritable
1452
+ */
1453
+ d1_databases: {
1454
+ /** The binding name used to refer to the D1 database in the Worker. */
1455
+ binding: string;
1456
+ /** The name of this D1 database. */
1457
+ database_name?: string;
1458
+ /** The UUID of this D1 database (not required). */
1459
+ database_id?: string;
1460
+ /** The UUID of this D1 database for Wrangler Dev (if specified). */
1461
+ preview_database_id?: string;
1462
+ /** The name of the migrations table for this D1 database (defaults to 'd1_migrations'). */
1463
+ migrations_table?: string;
1464
+ /** The path to the directory of migrations for this D1 database (defaults to './migrations'). */
1465
+ migrations_dir?: string;
1466
+ /** Internal use only. */
1467
+ database_internal_env?: string;
1468
+ /** Whether the D1 database should be remote or not in local development */
1469
+ remote?: boolean;
1470
+ }[];
1471
+ /**
1472
+ * Specifies Vectorize indexes that are bound to this Worker environment.
1473
+ *
1474
+ * NOTE: This field is not automatically inherited from the top level environment,
1475
+ * and so must be specified in every named environment.
1476
+ *
1477
+ * For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#vectorize-indexes
1478
+ *
1479
+ * @default []
1480
+ * @nonInheritable
1481
+ */
1482
+ vectorize: {
1483
+ /** The binding name used to refer to the Vectorize index in the Worker. */
1484
+ binding: string;
1485
+ /** The name of the index. */
1486
+ index_name: string;
1487
+ /** Whether the Vectorize index should be remote or not in local development */
1488
+ remote?: boolean;
1489
+ }[];
1490
+ /**
1491
+ * Specifies Hyperdrive configs that are bound to this Worker environment.
1492
+ *
1493
+ * NOTE: This field is not automatically inherited from the top level environment,
1494
+ * and so must be specified in every named environment.
1495
+ *
1496
+ * For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#hyperdrive
1497
+ *
1498
+ * @default []
1499
+ * @nonInheritable
1500
+ */
1501
+ hyperdrive: {
1502
+ /** The binding name used to refer to the project in the Worker. */
1503
+ binding: string;
1504
+ /** The id of the database. */
1505
+ id: string;
1506
+ /** The local database connection string for `wrangler dev` */
1507
+ localConnectionString?: string;
1508
+ }[];
1509
+ /**
1510
+ * Specifies service bindings (Worker-to-Worker) that are bound to this Worker environment.
1511
+ *
1512
+ * NOTE: This field is not automatically inherited from the top level environment,
1513
+ * and so must be specified in every named environment.
1514
+ *
1515
+ * For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#service-bindings
1516
+ *
1517
+ * @default []
1518
+ * @nonInheritable
1519
+ */
1520
+ services: {
1521
+ /** The binding name used to refer to the bound service. */
1522
+ binding: string;
1523
+ /**
1524
+ * The name of the service.
1525
+ * To bind to a worker in a specific environment,
1526
+ * you should use the format `<worker_name>-<environment_name>`.
1527
+ */
1528
+ service: string;
1529
+ /**
1530
+ * @hidden
1531
+ * @deprecated you should use `service: <worker_name>-<environment_name>` instead.
1532
+ * This refers to the deprecated concept of 'service environments'.
1533
+ * The environment of the service (e.g. production, staging, etc).
1534
+ */
1535
+ environment?: string;
1536
+ /** Optionally, the entrypoint (named export) of the service to bind to. */
1537
+ entrypoint?: string;
1538
+ /** Optional properties that will be made available to the service via ctx.props. */
1539
+ props?: Record<string, unknown>;
1540
+ /** Whether the service binding should be remote or not in local development */
1541
+ remote?: boolean;
1542
+ }[] | undefined;
1543
+ /**
1544
+ * Specifies analytics engine datasets that are bound to this Worker environment.
1545
+ *
1546
+ * NOTE: This field is not automatically inherited from the top level environment,
1547
+ * and so must be specified in every named environment.
1548
+ *
1549
+ * For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#analytics-engine-datasets
1550
+ *
1551
+ * @default []
1552
+ * @nonInheritable
1553
+ */
1554
+ analytics_engine_datasets: {
1555
+ /** The binding name used to refer to the dataset in the Worker. */
1556
+ binding: string;
1557
+ /** The name of this dataset to write to. */
1558
+ dataset?: string;
1559
+ }[];
1560
+ /**
1561
+ * A browser that will be usable from the Worker.
1562
+ *
1563
+ * NOTE: This field is not automatically inherited from the top level environment,
1564
+ * and so must be specified in every named environment.
1565
+ *
1566
+ * For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#browser-rendering
1567
+ *
1568
+ * @default {}
1569
+ * @nonInheritable
1570
+ */
1571
+ browser: {
1572
+ binding: string;
1573
+ /** Whether the Browser binding should be remote or not in local development */
1574
+ remote?: boolean;
1575
+ } | undefined;
1576
+ /**
1577
+ * Binding to the AI project.
1578
+ *
1579
+ * NOTE: This field is not automatically inherited from the top level environment,
1580
+ * and so must be specified in every named environment.
1581
+ *
1582
+ * For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#workers-ai
1583
+ *
1584
+ * @default {}
1585
+ * @nonInheritable
1586
+ */
1587
+ ai: {
1588
+ binding: string;
1589
+ staging?: boolean;
1590
+ /** Whether the AI binding should be remote or not in local development */
1591
+ remote?: boolean;
1592
+ } | undefined;
1593
+ /**
1594
+ * Binding to Cloudflare Images
1595
+ *
1596
+ * NOTE: This field is not automatically inherited from the top level environment,
1597
+ * and so must be specified in every named environment.
1598
+ *
1599
+ * For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#images
1600
+ *
1601
+ * @default {}
1602
+ * @nonInheritable
1603
+ */
1604
+ images: {
1605
+ binding: string;
1606
+ /** Whether the Images binding should be remote or not in local development */
1607
+ remote?: boolean;
1608
+ } | undefined;
1609
+ /**
1610
+ * Binding to Cloudflare Media Transformations
1611
+ *
1612
+ * NOTE: This field is not automatically inherited from the top level environment,
1613
+ * and so must be specified in every named environment.
1614
+ *
1615
+ * @default {}
1616
+ * @nonInheritable
1617
+ */
1618
+ media: {
1619
+ binding: string;
1620
+ /** Whether the Media binding should be remote or not */
1621
+ remote?: boolean;
1622
+ } | undefined;
1623
+ /**
1624
+ * Binding to the Worker Version's metadata
1625
+ */
1626
+ version_metadata: {
1627
+ binding: string;
1628
+ } | undefined;
1629
+ /**
1630
+ * "Unsafe" tables for features that aren't directly supported by wrangler.
1631
+ *
1632
+ * NOTE: This field is not automatically inherited from the top level environment,
1633
+ * and so must be specified in every named environment.
1634
+ *
1635
+ * @default {}
1636
+ * @nonInheritable
1637
+ */
1638
+ unsafe: {
1639
+ /**
1640
+ * A set of bindings that should be put into a Worker's upload metadata without changes. These
1641
+ * can be used to implement bindings for features that haven't released and aren't supported
1642
+ * directly by wrangler or miniflare.
1643
+ */
1644
+ bindings?: UnsafeBinding[];
1645
+ /**
1646
+ * Arbitrary key/value pairs that will be included in the uploaded metadata. Values specified
1647
+ * here will always be applied to metadata last, so can add new or override existing fields.
1648
+ */
1649
+ metadata?: {
1650
+ [key: string]: unknown;
1651
+ };
1652
+ /**
1653
+ * Used for internal capnp uploads for the Workers runtime
1654
+ */
1655
+ capnp?: {
1656
+ base_path: string;
1657
+ source_schemas: string[];
1658
+ compiled_schema?: never;
1659
+ } | {
1660
+ base_path?: never;
1661
+ source_schemas?: never;
1662
+ compiled_schema: string;
1663
+ };
1664
+ };
1665
+ /**
1666
+ * Specifies a list of mTLS certificates that are bound to this Worker environment.
1667
+ *
1668
+ * NOTE: This field is not automatically inherited from the top level environment,
1669
+ * and so must be specified in every named environment.
1670
+ *
1671
+ * For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#mtls-certificates
1672
+ *
1673
+ * @default []
1674
+ * @nonInheritable
1675
+ */
1676
+ mtls_certificates: {
1677
+ /** The binding name used to refer to the certificate in the Worker */
1678
+ binding: string;
1679
+ /** The uuid of the uploaded mTLS certificate */
1680
+ certificate_id: string;
1681
+ /** Whether the mtls fetcher should be remote or not in local development */
1682
+ remote?: boolean;
1683
+ }[];
1684
+ /**
1685
+ * Specifies a list of Tail Workers that are bound to this Worker environment
1686
+ *
1687
+ * NOTE: This field is not automatically inherited from the top level environment,
1688
+ * and so must be specified in every named environment.
1689
+ *
1690
+ * @default []
1691
+ * @nonInheritable
1692
+ */
1693
+ tail_consumers?: TailConsumer[];
1694
+ /**
1695
+ * Specifies namespace bindings that are bound to this Worker environment.
1696
+ *
1697
+ * NOTE: This field is not automatically inherited from the top level environment,
1698
+ * and so must be specified in every named environment.
1699
+ *
1700
+ * For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#dispatch-namespace-bindings-workers-for-platforms
1701
+ *
1702
+ * @default []
1703
+ * @nonInheritable
1704
+ */
1705
+ dispatch_namespaces: {
1706
+ /** The binding name used to refer to the bound service. */
1707
+ binding: string;
1708
+ /** The namespace to bind to. */
1709
+ namespace: string;
1710
+ /** Details about the outbound Worker which will handle outbound requests from your namespace */
1711
+ outbound?: DispatchNamespaceOutbound;
1712
+ /** Whether the Dispatch Namespace should be remote or not in local development */
1713
+ remote?: boolean;
1714
+ }[];
1715
+ /**
1716
+ * Specifies list of Pipelines bound to this Worker environment
1717
+ *
1718
+ * NOTE: This field is not automatically inherited from the top level environment,
1719
+ * and so must be specified in every named environment.
1720
+ *
1721
+ * @default []
1722
+ * @nonInheritable
1723
+ */
1724
+ pipelines: {
1725
+ /** The binding name used to refer to the bound service. */
1726
+ binding: string;
1727
+ /** Name of the Pipeline to bind */
1728
+ pipeline: string;
1729
+ /** Whether the pipeline should be remote or not in local development */
1730
+ remote?: boolean;
1731
+ }[];
1732
+ /**
1733
+ * Specifies Secret Store bindings that are bound to this Worker environment.
1734
+ *
1735
+ * NOTE: This field is not automatically inherited from the top level environment,
1736
+ * and so must be specified in every named environment.
1737
+ *
1738
+ * @default []
1739
+ * @nonInheritable
1740
+ */
1741
+ secrets_store_secrets: {
1742
+ /** The binding name used to refer to the bound service. */
1743
+ binding: string;
1744
+ /** Id of the secret store */
1745
+ store_id: string;
1746
+ /** Name of the secret */
1747
+ secret_name: string;
1748
+ }[];
1749
+ /**
1750
+ * **DO NOT USE**. Hello World Binding Config to serve as an explanatory example.
1751
+ *
1752
+ * NOTE: This field is not automatically inherited from the top level environment,
1753
+ * and so must be specified in every named environment.
1754
+ *
1755
+ * @default []
1756
+ * @nonInheritable
1757
+ */
1758
+ unsafe_hello_world: {
1759
+ /** The binding name used to refer to the bound service. */
1760
+ binding: string;
1761
+ /** Whether the timer is enabled */
1762
+ enable_timer?: boolean;
1763
+ }[];
1764
+ /**
1765
+ * Specifies rate limit bindings that are bound to this Worker environment.
1766
+ *
1767
+ * NOTE: This field is not automatically inherited from the top level environment,
1768
+ * and so must be specified in every named environment.
1769
+ *
1770
+ * @default []
1771
+ * @nonInheritable
1772
+ */
1773
+ ratelimits: {
1774
+ /** The binding name used to refer to the rate limiter in the Worker. */
1775
+ name: string;
1776
+ /** The namespace ID for this rate limiter. */
1777
+ namespace_id: string;
1778
+ /** Simple rate limiting configuration. */
1779
+ simple: {
1780
+ /** The maximum number of requests allowed in the time period. */
1781
+ limit: number;
1782
+ /** The time period in seconds (10 for ten seconds, 60 for one minute). */
1783
+ period: 10 | 60;
1784
+ };
1785
+ }[];
1786
+ /**
1787
+ * Specifies Worker Loader bindings that are bound to this Worker environment.
1788
+ *
1789
+ * NOTE: This field is not automatically inherited from the top level environment,
1790
+ * and so must be specified in every named environment.
1791
+ *
1792
+ * @default []
1793
+ * @nonInheritable
1794
+ */
1795
+ worker_loaders: {
1796
+ /** The binding name used to refer to the Worker Loader in the Worker. */
1797
+ binding: string;
1798
+ }[];
1799
+ /**
1800
+ * Specifies VPC services that are bound to this Worker environment.
1801
+ *
1802
+ * NOTE: This field is not automatically inherited from the top level environment,
1803
+ * and so must be specified in every named environment.
1804
+ *
1805
+ * @default []
1806
+ * @nonInheritable
1807
+ */
1808
+ vpc_services: {
1809
+ /** The binding name used to refer to the VPC service in the Worker. */
1810
+ binding: string;
1811
+ /** The service ID of the VPC connectivity service. */
1812
+ service_id: string;
1813
+ /** Whether the VPC service is remote or not */
1814
+ remote?: boolean;
1815
+ }[];
1816
+ }
1817
+ /**
1818
+ * The raw environment configuration that we read from the config file.
1819
+ *
1820
+ * All the properties are optional, and will be replaced with defaults in the configuration that
1821
+ * is used in the rest of the codebase.
1822
+ */
1823
+ type RawEnvironment = Partial<Environment>;
1824
+ /**
1825
+ * A bundling resolver rule, defining the modules type for paths that match the specified globs.
1826
+ */
1827
+ type Rule = {
1828
+ type: ConfigModuleRuleType;
1829
+ globs: string[];
1830
+ fallthrough?: boolean;
1831
+ };
1832
+ /**
1833
+ * The possible types for a `Rule`.
1834
+ */
1835
+ type ConfigModuleRuleType = "ESModule" | "CommonJS" | "CompiledWasm" | "Text" | "Data" | "PythonModule" | "PythonRequirement";
1836
+ type TailConsumer = {
1837
+ /** The name of the service tail events will be forwarded to. */
1838
+ service: string;
1839
+ /** (Optional) The environment of the service. */
1840
+ environment?: string;
1841
+ };
1842
+ interface DispatchNamespaceOutbound {
1843
+ /** Name of the service handling the outbound requests */
1844
+ service: string;
1845
+ /** (Optional) Name of the environment handling the outbound requests. */
1846
+ environment?: string;
1847
+ /** (Optional) List of parameter names, for sending context from your dispatch Worker to the outbound handler */
1848
+ parameters?: string[];
1849
+ }
1850
+ interface UserLimits {
1851
+ /** Maximum allowed CPU time for a Worker's invocation in milliseconds */
1852
+ cpu_ms: number;
1853
+ }
1854
+ type Assets = {
1855
+ /** Absolute path to assets directory */
1856
+ directory?: string;
1857
+ /** Name of `env` binding property in the User Worker. */
1858
+ binding?: string;
1859
+ /** How to handle HTML requests. */
1860
+ html_handling?: "auto-trailing-slash" | "force-trailing-slash" | "drop-trailing-slash" | "none";
1861
+ /** How to handle requests that do not match an asset. */
1862
+ not_found_handling?: "single-page-application" | "404-page" | "none";
1863
+ /**
1864
+ * Matches will be routed to the User Worker, and matches to negative rules will go to the Asset Worker.
1865
+ *
1866
+ * Can also be `true`, indicating that every request should be routed to the User Worker.
1867
+ */
1868
+ run_worker_first?: string[] | boolean;
1869
+ };
1870
+ interface Observability {
1871
+ /** If observability is enabled for this Worker */
1872
+ enabled?: boolean;
1873
+ /** The sampling rate */
1874
+ head_sampling_rate?: number;
1875
+ logs?: {
1876
+ enabled?: boolean;
1877
+ /** The sampling rate */
1878
+ head_sampling_rate?: number;
1879
+ /** Set to false to disable invocation logs */
1880
+ invocation_logs?: boolean;
1881
+ /**
1882
+ * If logs should be persisted to the Cloudflare observability platform where they can be queried in the dashboard.
1883
+ *
1884
+ * @default true
1885
+ */
1886
+ persist?: boolean;
1887
+ /**
1888
+ * What destinations logs emitted from the Worker should be sent to.
1889
+ *
1890
+ * @default []
1891
+ */
1892
+ destinations?: string[];
1893
+ };
1894
+ traces?: {
1895
+ enabled?: boolean;
1896
+ /** The sampling rate */
1897
+ head_sampling_rate?: number;
1898
+ /**
1899
+ * If traces should be persisted to the Cloudflare observability platform where they can be queried in the dashboard.
1900
+ *
1901
+ * @default true
1902
+ */
1903
+ persist?: boolean;
1904
+ /**
1905
+ * What destinations traces emitted from the Worker should be sent to.
1906
+ *
1907
+ * @default []
1908
+ */
1909
+ destinations?: string[];
1910
+ };
1911
+ }
1912
+ type DockerConfiguration = {
1913
+ /** Socket used by miniflare to communicate with Docker */
1914
+ socketPath: string;
1915
+ };
1916
+ type ContainerEngine = {
1917
+ localDocker: DockerConfiguration;
1918
+ } | string;
1919
+
1920
+ /**
1921
+ * This is the static type definition for the configuration object.
1922
+ *
1923
+ * It reflects a normalized and validated version of the configuration that you can write in a Wrangler configuration file,
1924
+ * and optionally augment with arguments passed directly to wrangler.
1925
+ *
1926
+ * For more information about the configuration object, see the
1927
+ * documentation at https://developers.cloudflare.com/workers/cli-wrangler/configuration
1928
+ *
1929
+ * Notes:
1930
+ *
1931
+ * - Fields that are only specified in `ConfigFields` and not `Environment` can only appear
1932
+ * in the top level config and should not appear in any environments.
1933
+ * - Fields that are specified in `PagesConfigFields` are only relevant for Pages projects
1934
+ * - All top level fields in config and environments are optional in the Wrangler configuration file.
1935
+ *
1936
+ * Legend for the annotations:
1937
+ *
1938
+ * - `@breaking`: the deprecation/optionality is a breaking change from Wrangler v1.
1939
+ * - `@todo`: there's more work to be done (with details attached).
1940
+ */
1941
+ type Config = ComputedFields & ConfigFields<DevConfig> & PagesConfigFields & Environment;
1942
+ type RawConfig = Partial<ConfigFields<RawDevConfig>> & PagesConfigFields & RawEnvironment & EnvironmentMap & {
1943
+ $schema?: string;
1944
+ };
1945
+ type RedirectedRawConfig = RawConfig & Partial<ComputedFields>;
1946
+ interface ComputedFields {
1947
+ /** The path to the Wrangler configuration file (if any, and possibly redirected from the user Wrangler configuration) used to create this configuration. */
1948
+ configPath: string | undefined;
1949
+ /** The path to the user's Wrangler configuration file (if any), which may have been redirected to another file that used to create this configuration. */
1950
+ userConfigPath: string | undefined;
1951
+ /**
1952
+ * The original top level name for the Worker in the raw configuration.
1953
+ *
1954
+ * When a raw configuration has been flattened to a single environment the worker name may have been replaced or transformed.
1955
+ * It can be useful to know what the top-level name was before the flattening.
1956
+ */
1957
+ topLevelName: string | undefined;
1958
+ /** A list of environment names declared in the raw configuration. */
1959
+ definedEnvironments: string[] | undefined;
1960
+ /** The name of the environment being targeted. */
1961
+ targetEnvironment: string | undefined;
1962
+ }
1963
+ interface ConfigFields<Dev extends RawDevConfig> {
1964
+ /**
1965
+ * A boolean to enable "legacy" style wrangler environments (from Wrangler v1).
1966
+ * These have been superseded by Services, but there may be projects that won't
1967
+ * (or can't) use them. If you're using a legacy environment, you can set this
1968
+ * to `true` to enable it.
1969
+ */
1970
+ legacy_env: boolean;
1971
+ /**
1972
+ * Whether Wrangler should send usage metrics to Cloudflare for this project.
1973
+ *
1974
+ * When defined this will override any user settings.
1975
+ * Otherwise, Wrangler will use the user's preference.
1976
+ */
1977
+ send_metrics: boolean | undefined;
1978
+ /**
1979
+ * Options to configure the development server that your worker will use.
1980
+ *
1981
+ * For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#local-development-settings
1982
+ */
1983
+ dev: Dev;
1984
+ /**
1985
+ * The definition of a Worker Site, a feature that lets you upload
1986
+ * static assets with your Worker.
1987
+ *
1988
+ * More details at https://developers.cloudflare.com/workers/platform/sites
1989
+ *
1990
+ * For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#workers-sites
1991
+ */
1992
+ site: {
1993
+ /**
1994
+ * The directory containing your static assets.
1995
+ *
1996
+ * It must be a path relative to your Wrangler configuration file.
1997
+ * Example: bucket = "./public"
1998
+ *
1999
+ * If there is a `site` field then it must contain this `bucket` field.
2000
+ */
2001
+ bucket: string;
2002
+ /**
2003
+ * The location of your Worker script.
2004
+ *
2005
+ * @deprecated DO NOT use this (it's a holdover from Wrangler v1.x). Either use the top level `main` field, or pass the path to your entry file as a command line argument.
2006
+ * @breaking
2007
+ */
2008
+ "entry-point"?: string;
2009
+ /**
2010
+ * An exclusive list of .gitignore-style patterns that match file
2011
+ * or directory names from your bucket location. Only matched
2012
+ * items will be uploaded. Example: include = ["upload_dir"]
2013
+ *
2014
+ * @optional
2015
+ * @default []
2016
+ */
2017
+ include?: string[];
2018
+ /**
2019
+ * A list of .gitignore-style patterns that match files or
2020
+ * directories in your bucket that should be excluded from
2021
+ * uploads. Example: exclude = ["ignore_dir"]
2022
+ *
2023
+ * @optional
2024
+ * @default []
2025
+ */
2026
+ exclude?: string[];
2027
+ } | undefined;
2028
+ /**
2029
+ * A list of wasm modules that your worker should be bound to. This is
2030
+ * the "legacy" way of binding to a wasm module. ES module workers should
2031
+ * do proper module imports.
2032
+ */
2033
+ wasm_modules: {
2034
+ [key: string]: string;
2035
+ } | undefined;
2036
+ /**
2037
+ * A list of text files that your worker should be bound to. This is
2038
+ * the "legacy" way of binding to a text file. ES module workers should
2039
+ * do proper module imports.
2040
+ */
2041
+ text_blobs: {
2042
+ [key: string]: string;
2043
+ } | undefined;
2044
+ /**
2045
+ * A list of data files that your worker should be bound to. This is
2046
+ * the "legacy" way of binding to a data file. ES module workers should
2047
+ * do proper module imports.
2048
+ */
2049
+ data_blobs: {
2050
+ [key: string]: string;
2051
+ } | undefined;
2052
+ /**
2053
+ * A map of module aliases. Lets you swap out a module for any others.
2054
+ * Corresponds with esbuild's `alias` config
2055
+ *
2056
+ * For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#module-aliasing
2057
+ */
2058
+ alias: {
2059
+ [key: string]: string;
2060
+ } | undefined;
2061
+ /**
2062
+ * By default, the Wrangler configuration file is the source of truth for your environment configuration, like a terraform file.
2063
+ *
2064
+ * If you change your vars in the dashboard, wrangler *will* override/delete them on its next deploy.
2065
+ *
2066
+ * If you want to keep your dashboard vars when wrangler deploys, set this field to true.
2067
+ *
2068
+ * @default false
2069
+ * @nonInheritable
2070
+ */
2071
+ keep_vars?: boolean;
2072
+ }
2073
+ interface PagesConfigFields {
2074
+ /**
2075
+ * The directory of static assets to serve.
2076
+ *
2077
+ * The presence of this field in a Wrangler configuration file indicates a Pages project,
2078
+ * and will prompt the handling of the configuration file according to the
2079
+ * Pages-specific validation rules.
2080
+ */
2081
+ pages_build_output_dir?: string;
2082
+ }
2083
+ interface DevConfig {
2084
+ /**
2085
+ * IP address for the local dev server to listen on,
2086
+ *
2087
+ * @default localhost
2088
+ */
2089
+ ip: string;
2090
+ /**
2091
+ * Port for the local dev server to listen on
2092
+ *
2093
+ * @default 8787
2094
+ */
2095
+ port: number | undefined;
2096
+ /**
2097
+ * Port for the local dev server's inspector to listen on
2098
+ *
2099
+ * @default 9229
2100
+ */
2101
+ inspector_port: number | undefined;
2102
+ /**
2103
+ * Protocol that local wrangler dev server listens to requests on.
2104
+ *
2105
+ * @default http
2106
+ */
2107
+ local_protocol: "http" | "https";
2108
+ /**
2109
+ * Protocol that wrangler dev forwards requests on
2110
+ *
2111
+ * Setting this to `http` is not currently implemented for remote mode.
2112
+ * See https://github.com/cloudflare/workers-sdk/issues/583
2113
+ *
2114
+ * @default https
2115
+ */
2116
+ upstream_protocol: "https" | "http";
2117
+ /**
2118
+ * Host to forward requests to, defaults to the host of the first route of project
2119
+ */
2120
+ host: string | undefined;
2121
+ /**
2122
+ * When developing, whether to build and connect to containers. This requires a Docker daemon to be running.
2123
+ * Defaults to `true`.
2124
+ *
2125
+ * @default true
2126
+ */
2127
+ enable_containers: boolean;
2128
+ /**
2129
+ * Either the Docker unix socket i.e. `unix:///var/run/docker.sock` or a full configuration.
2130
+ * Note that windows is only supported via WSL at the moment
2131
+ */
2132
+ container_engine: ContainerEngine | undefined;
2133
+ }
2134
+ type RawDevConfig = Partial<DevConfig>;
2135
+ interface EnvironmentMap {
2136
+ /**
2137
+ * The `env` section defines overrides for the configuration for different environments.
2138
+ *
2139
+ * All environment fields can be specified at the top level of the config indicating the default environment settings.
2140
+ *
2141
+ * - Some fields are inherited and overridable in each environment.
2142
+ * - But some are not inherited and must be explicitly specified in every environment, if they are specified at the top level.
2143
+ *
2144
+ * For more information, see the documentation at https://developers.cloudflare.com/workers/cli-wrangler/configuration#environments
2145
+ *
2146
+ * @default {}
2147
+ */
2148
+ env?: {
2149
+ [envName: string]: RawEnvironment;
2150
+ };
2151
+ }
2152
+ declare const defaultWranglerConfig: Config;
2153
+
2154
+ type RoutesRes = {
2155
+ id: string;
2156
+ pattern: string;
2157
+ zone_name: string;
2158
+ script: string;
2159
+ }[];
2160
+ interface APIWorkerConfig {
2161
+ name: string;
2162
+ entrypoint: string;
2163
+ tags: string[];
2164
+ compatibility_date: string;
2165
+ compatibility_flags: string[];
2166
+ logpush: boolean | undefined;
2167
+ routes: RoutesRes;
2168
+ tail_consumers: TailConsumer[] | undefined;
2169
+ migration_tag?: string;
2170
+ domains: Cloudflare.Workers.Domain[];
2171
+ schedules: Cloudflare.Workers.Scripts.Schedules.ScheduleGetResponse.Schedule[];
2172
+ assets?: AssetConfig;
2173
+ bindings: WorkerMetadata["bindings"];
2174
+ observability: Cloudflare.Workers.Beta.Worker.Observability | undefined;
2175
+ limits: {
2176
+ cpu_ms: number;
2177
+ } | undefined;
2178
+ placement: Cloudflare.Workers.Beta.Workers.Version.Placement | undefined;
2179
+ subdomain: {
2180
+ enabled: boolean;
2181
+ previews_enabled: boolean;
2182
+ };
2183
+ }
2184
+ /**
2185
+ * Given the information of multiple Workers (representing different environments),
2186
+ * construct a Wrangler config file for the application.
2187
+ */
2188
+ declare function constructWranglerConfig(workerOrWorkers: APIWorkerConfig | APIWorkerConfig[]): RawConfig;
2189
+
2190
+ export { type CfRateLimit as $, type Assets as A, type CfWasmModuleBindings as B, type CfWorkerInit as C, type DurableObjectMigration as D, type Environment as E, type CfTextBlobBindings as F, type CfBrowserBinding as G, type CfAIBinding as H, type CfImagesBinding as I, type CfMediaBinding as J, type CfVersionMetadataBinding as K, type CfDataBlobBindings as L, type CfDurableObject as M, type CfWorkflow as N, type Observability as O, type CfQueue as P, type CfR2Bucket as Q, type RawConfig as R, type CfD1Database as S, type TailConsumer as T, type UserLimits as U, type CfVectorize as V, type WorkerMetadataBinding as W, type CfSecretsStoreSecrets as X, type CfHelloWorld as Y, type ZoneIdRoute as Z, type CfWorkerLoader as _, type Config as a, type CfHyperdrive as a0, type CfService as a1, type CfVpcService as a2, type CfAnalyticsEngineDataset as a3, type CfDispatchNamespace as a4, type CfMTlsCertificate as a5, type CfLogfwdr as a6, type CfLogfwdrBinding as a7, type CfAssetsBinding as a8, type CfPipeline as a9, type CfUnsafeBinding as aa, type CfCapnp as ab, type CfUnsafe as ac, type CfDurableObjectMigrations as ad, type CfPlacement as ae, type CfTailConsumer as af, type CfUserLimits as ag, type CfWorkerContext as ah, type CfWorkerSourceMap as ai, type Json as aj, type AssetConfigMetadata as ak, type WorkerMetadata as al, type ServiceMetadataRes as am, INHERIT_SYMBOL as an, SERVICE_TAG_PREFIX as ao, ENVIRONMENT_TAG_PREFIX as ap, PATH_TO_DEPLOY_CONFIG as aq, type RawDevConfig as b, type ConfigFields as c, type RawEnvironment as d, type RedirectedRawConfig as e, defaultWranglerConfig as f, constructWranglerConfig as g, type ZoneNameRoute as h, type CustomDomainRoute as i, type Route as j, type CloudchamberConfig as k, type ContainerApp as l, type DurableObjectBindings as m, type WorkflowBinding as n, type EnvironmentNonInheritable as o, type Rule as p, type ConfigModuleRuleType as q, type DispatchNamespaceOutbound as r, type DockerConfiguration as s, type ContainerEngine as t, type CfScriptFormat as u, type CfModuleType as v, type CfModule as w, type CfVars as x, type CfKvNamespace as y, type CfSendEmailBindings as z };