@cloudflare/workers-utils 0.0.2 → 0.1.1

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