@cloudflare/workers-utils 0.43.0 → 0.44.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.
Files changed (32) hide show
  1. package/dist/browser.d.mts +2363 -3
  2. package/dist/browser.mjs +469 -2
  3. package/dist/{chunk-C6O4ION7.mjs → chunk-2Q77CKVU.mjs} +3 -1
  4. package/dist/{chunk-Z62CVNHJ.mjs → chunk-6G6FCMPX.mjs} +4 -1
  5. package/dist/{chunk-FLRJ77A6.mjs → chunk-AUSY7DKT.mjs} +6 -3
  6. package/dist/{chunk-IYSONYTF.mjs → chunk-FR75DWDU.mjs} +7 -5
  7. package/dist/{chunk-MCNIGVAF.mjs → chunk-M3RITKR3.mjs} +4 -1
  8. package/dist/{chunk-53IMCORZ.mjs → chunk-MIA26B4M.mjs} +3 -1
  9. package/dist/{chunk-34VZWBGB.mjs → chunk-MV2OJK3L.mjs} +4 -2
  10. package/dist/{chunk-WO2IAW6M.mjs → chunk-OWPFSLY6.mjs} +4 -1
  11. package/dist/{chunk-OWXQB7GP.mjs → chunk-PWC7WAOU.mjs} +4 -1
  12. package/dist/{chunk-3IYLA2JH.mjs → chunk-QSRIB43D.mjs} +5 -2
  13. package/dist/{chunk-Q72B4Q5Z.mjs → chunk-U6NEESU5.mjs} +6 -3
  14. package/dist/compatibility-date.mjs +5 -2
  15. package/dist/{compliance-DzwHmPKm.d.mts → compliance-CZ8Ownqu.d.mts} +534 -509
  16. package/dist/compliance.d.mts +1 -1
  17. package/dist/compliance.mjs +10 -7
  18. package/dist/docker-path.mjs +6 -3
  19. package/dist/errors.mjs +5 -2
  20. package/dist/fs-helpers.mjs +5 -2
  21. package/dist/global-wrangler-config-path.mjs +6 -3
  22. package/dist/index.d.mts +45 -6
  23. package/dist/index.mjs +583 -36
  24. package/dist/local-env.mjs +4 -1
  25. package/dist/metafile-esm.json +1 -1
  26. package/dist/{open-PBXRGS4R.mjs → open-PCXX3ZDZ.mjs} +3 -1
  27. package/dist/prometheus-metrics.mjs +5 -2
  28. package/dist/test-helpers/index.d.mts +1 -1
  29. package/dist/test-helpers/index.mjs +8 -5
  30. package/dist/zod-format.mjs +5 -2
  31. package/package.json +1 -1
  32. package/dist/chunk-DKSA7K25.mjs +0 -468
@@ -1,8 +1,2368 @@
1
- import { bh as TailConsumer, bn as WorkerMetadata, R as RawConfig } from './compliance-DzwHmPKm.mjs';
2
1
  import { AssetConfig } from '@cloudflare/workers-shared';
3
2
  import { Cloudflare } from 'cloudflare';
4
- import 'node:url';
5
- import 'undici';
3
+
4
+ interface CfDurableObjectMigrations {
5
+ old_tag?: string;
6
+ new_tag: string;
7
+ steps: {
8
+ new_classes?: string[];
9
+ new_sqlite_classes?: string[];
10
+ renamed_classes?: {
11
+ from: string;
12
+ to: string;
13
+ }[];
14
+ transferred_classes?: {
15
+ from: string;
16
+ from_script: string;
17
+ to: string;
18
+ }[];
19
+ deleted_classes?: string[];
20
+ }[];
21
+ }
22
+ /**
23
+ * The declarative `exports` map keyed by class name.
24
+ *
25
+ * Durable Objects can only be configured by `exports` or `migrations`, not both.
26
+ */
27
+ type CfExports = Exports;
28
+ type CfPlacement = {
29
+ mode: "smart";
30
+ hint?: string;
31
+ } | {
32
+ mode?: "targeted";
33
+ region: string;
34
+ } | {
35
+ mode?: "targeted";
36
+ host: string;
37
+ } | {
38
+ mode?: "targeted";
39
+ hostname: string;
40
+ };
41
+ interface CfTailConsumer {
42
+ service: string;
43
+ environment?: string;
44
+ }
45
+ interface CfUserLimits {
46
+ cpu_ms?: number;
47
+ subrequests?: number;
48
+ }
49
+
50
+ type Json = string | number | boolean | null | Json[] | {
51
+ [id: string]: Json;
52
+ };
53
+ type WorkerMetadataBinding = {
54
+ type: "inherit";
55
+ name: string;
56
+ } | {
57
+ type: "plain_text";
58
+ name: string;
59
+ text: string;
60
+ } | {
61
+ type: "secret_text";
62
+ name: string;
63
+ text: string;
64
+ } | {
65
+ type: "json";
66
+ name: string;
67
+ json: Json;
68
+ } | {
69
+ type: "wasm_module";
70
+ name: string;
71
+ part: string;
72
+ } | {
73
+ type: "text_blob";
74
+ name: string;
75
+ part: string;
76
+ } | {
77
+ type: "browser";
78
+ name: string;
79
+ raw?: boolean;
80
+ } | {
81
+ type: "ai";
82
+ name: string;
83
+ staging?: boolean;
84
+ raw?: boolean;
85
+ } | {
86
+ type: "images";
87
+ name: string;
88
+ raw?: boolean;
89
+ } | {
90
+ type: "stream";
91
+ name: string;
92
+ } | {
93
+ type: "version_metadata";
94
+ name: string;
95
+ } | {
96
+ type: "data_blob";
97
+ name: string;
98
+ part: string;
99
+ } | {
100
+ type: "ai_search_namespace";
101
+ name: string;
102
+ namespace: string;
103
+ } | {
104
+ type: "ai_search";
105
+ name: string;
106
+ instance_name: string;
107
+ } | {
108
+ type: "agent_memory";
109
+ name: string;
110
+ namespace: string;
111
+ } | {
112
+ type: "kv_namespace";
113
+ name: string;
114
+ namespace_id: string;
115
+ raw?: boolean;
116
+ } | {
117
+ type: "media";
118
+ name: string;
119
+ } | {
120
+ type: "send_email";
121
+ name: string;
122
+ destination_address?: string;
123
+ allowed_destination_addresses?: string[];
124
+ allowed_sender_addresses?: string[];
125
+ } | {
126
+ type: "durable_object_namespace";
127
+ name: string;
128
+ class_name: string;
129
+ script_name?: string;
130
+ environment?: string;
131
+ namespace_id?: string;
132
+ } | {
133
+ type: "workflow";
134
+ name: string;
135
+ workflow_name: string;
136
+ class_name: string;
137
+ script_name?: string;
138
+ raw?: boolean;
139
+ } | {
140
+ type: "queue";
141
+ name: string;
142
+ queue_name: string;
143
+ delivery_delay?: number;
144
+ raw?: boolean;
145
+ } | {
146
+ type: "r2_bucket";
147
+ name: string;
148
+ bucket_name: string;
149
+ jurisdiction?: string;
150
+ raw?: boolean;
151
+ } | {
152
+ type: "d1";
153
+ name: string;
154
+ id: string;
155
+ internalEnv?: string;
156
+ raw?: boolean;
157
+ } | {
158
+ type: "vectorize";
159
+ name: string;
160
+ index_name: string;
161
+ internalEnv?: string;
162
+ raw?: boolean;
163
+ } | {
164
+ type: "hyperdrive";
165
+ name: string;
166
+ id: string;
167
+ } | {
168
+ type: "service";
169
+ name: string;
170
+ service: string;
171
+ environment?: string;
172
+ entrypoint?: string;
173
+ cross_account_grant?: string;
174
+ } | {
175
+ type: "analytics_engine";
176
+ name: string;
177
+ dataset?: string;
178
+ } | {
179
+ type: "dispatch_namespace";
180
+ name: string;
181
+ namespace: string;
182
+ outbound?: {
183
+ worker: {
184
+ service: string;
185
+ environment?: string;
186
+ };
187
+ params?: {
188
+ name: string;
189
+ }[];
190
+ };
191
+ } | {
192
+ type: "mtls_certificate";
193
+ name: string;
194
+ certificate_id: string;
195
+ } | {
196
+ type: "pipelines";
197
+ name: string;
198
+ stream?: string;
199
+ pipeline?: string;
200
+ } | {
201
+ type: "secrets_store_secret";
202
+ name: string;
203
+ store_id: string;
204
+ secret_name: string;
205
+ } | {
206
+ type: "artifacts";
207
+ name: string;
208
+ namespace: string;
209
+ } | {
210
+ type: "unsafe_hello_world";
211
+ name: string;
212
+ enable_timer?: boolean;
213
+ } | {
214
+ type: "flagship";
215
+ name: string;
216
+ app_id: string;
217
+ } | {
218
+ type: "ratelimit";
219
+ name: string;
220
+ namespace_id: string;
221
+ simple: {
222
+ limit: number;
223
+ period: 10 | 60;
224
+ };
225
+ } | {
226
+ type: "vpc_service";
227
+ name: string;
228
+ service_id: string;
229
+ } | {
230
+ type: "vpc_network";
231
+ name: string;
232
+ tunnel_id?: string;
233
+ network_id?: string;
234
+ } | {
235
+ type: "worker_loader";
236
+ name: string;
237
+ } | {
238
+ type: "logfwdr";
239
+ name: string;
240
+ destination: string;
241
+ } | {
242
+ type: "assets";
243
+ name: string;
244
+ };
245
+ type AssetConfigMetadata = {
246
+ html_handling?: AssetConfig["html_handling"];
247
+ not_found_handling?: AssetConfig["not_found_handling"];
248
+ run_worker_first?: boolean | string[];
249
+ _redirects?: string;
250
+ _headers?: string;
251
+ };
252
+ type WorkerMetadataPut = {
253
+ /** The name of the entry point module. Only exists when the worker is in the ES module format */
254
+ main_module?: string;
255
+ /** The name of the entry point module. Only exists when the worker is in the service-worker format */
256
+ body_part?: string;
257
+ compatibility_date?: string;
258
+ compatibility_flags?: string[];
259
+ usage_model?: "bundled" | "unbound";
260
+ migrations?: CfDurableObjectMigrations;
261
+ code_update_strategy?: DurableObjectCodeUpdateStrategy;
262
+ exports?: CfExports;
263
+ capnp_schema?: string;
264
+ bindings: WorkerMetadataBinding[];
265
+ keep_bindings?: (WorkerMetadataBinding["type"] | "secret_text" | "secret_key")[];
266
+ logpush?: boolean;
267
+ placement?: CfPlacement;
268
+ tail_consumers?: CfTailConsumer[];
269
+ streaming_tail_consumers?: CfTailConsumer[];
270
+ limits?: CfUserLimits;
271
+ assets?: {
272
+ jwt: string;
273
+ config?: AssetConfigMetadata;
274
+ };
275
+ observability?: Observability | undefined;
276
+ containers?: {
277
+ name?: string;
278
+ class_name?: string;
279
+ images?: Record<string, string>;
280
+ }[];
281
+ package_dependencies?: Array<{
282
+ name: string;
283
+ packageJsonVersion: string;
284
+ installedVersion: string;
285
+ }>;
286
+ [key: string]: unknown;
287
+ };
288
+ type WorkerMetadataVersionsPost = WorkerMetadataPut & {
289
+ annotations?: Record<string, string>;
290
+ };
291
+ type WorkerMetadata = WorkerMetadataPut | WorkerMetadataVersionsPost;
292
+
293
+ /**
294
+ * Wrangler configuration types. The JSDoc on these fields is also the source
295
+ * of truth for the equivalent fields in `@cloudflare/config`
296
+ * (`packages/config/src/types.ts` — `WorkerConfig` — and the binding option
297
+ * interfaces in `packages/config/src/config.ts`). When editing prose here,
298
+ * mirror the changes there.
299
+ */
300
+
301
+ /**
302
+ * The `Environment` interface declares all the configuration fields that
303
+ * can be specified for an environment.
304
+ *
305
+ * This could be the top-level default environment, or a specific named environment.
306
+ */
307
+ interface Environment extends EnvironmentInheritable, EnvironmentNonInheritable {
308
+ }
309
+ type SimpleRoute = string;
310
+ /** AWS SigV4 credentials for miniflare's local S3-compatible endpoint */
311
+ interface LocalS3Credentials {
312
+ accessKeyId: string;
313
+ secretAccessKey: string;
314
+ }
315
+ type ZoneIdRoute = {
316
+ pattern: string;
317
+ zone_id: string;
318
+ custom_domain?: boolean;
319
+ };
320
+ type ZoneNameRoute = {
321
+ pattern: string;
322
+ zone_name: string;
323
+ custom_domain?: boolean;
324
+ };
325
+ type CustomDomainRoute = {
326
+ pattern: string;
327
+ custom_domain: boolean;
328
+ enabled?: boolean;
329
+ previews_enabled?: boolean;
330
+ };
331
+ type Route = SimpleRoute | ZoneIdRoute | ZoneNameRoute | CustomDomainRoute;
332
+ /**
333
+ * Configuration in wrangler for Cloudchamber
334
+ */
335
+ type CloudchamberConfig = {
336
+ image?: string;
337
+ location?: string;
338
+ instance_type?: "dev" | "basic" | "standard" | "lite" | "standard-1" | "standard-2" | "standard-3" | "standard-4";
339
+ vcpu?: number;
340
+ memory?: string;
341
+ ipv4?: boolean;
342
+ };
343
+ type UnsafeBinding = {
344
+ /**
345
+ * The name of the binding provided to the Worker
346
+ */
347
+ name: string;
348
+ /**
349
+ * The 'type' of the unsafe binding.
350
+ */
351
+ type: string;
352
+ dev?: {
353
+ plugin: {
354
+ /**
355
+ * Package is the bare specifier of the package that exposes plugins to integrate into Miniflare via a named `plugins` export.
356
+ * @example "@cloudflare/my-external-miniflare-plugin"
357
+ */
358
+ package: string;
359
+ /**
360
+ * Plugin is the name of the plugin exposed by the package.
361
+ * @example "MY_UNSAFE_PLUGIN"
362
+ */
363
+ name: string;
364
+ };
365
+ /**
366
+ * Optional mapping of unsafe bindings names to options provided for the plugin.
367
+ */
368
+ options?: Record<string, unknown>;
369
+ };
370
+ [key: string]: unknown;
371
+ };
372
+ /**
373
+ * An image Wrangler prepares for a Durable Object-managed container.
374
+ */
375
+ type DurableObjectContainerImage = {
376
+ /**
377
+ * Path to the Dockerfile Wrangler builds and pushes.
378
+ */
379
+ dockerfile: string;
380
+ /**
381
+ * Build context, relative to the Wrangler configuration file.
382
+ * Defaults to the Dockerfile's directory.
383
+ */
384
+ build_context?: string;
385
+ /** Variables available to the image only while it is being built. */
386
+ build_vars?: Record<string, string>;
387
+ image?: never;
388
+ } | {
389
+ /**
390
+ * Digest-pinned image in the account's managed registry.
391
+ */
392
+ image: string;
393
+ dockerfile?: never;
394
+ build_context?: never;
395
+ build_vars?: never;
396
+ };
397
+ /**
398
+ * Configuration for a container application.
399
+ */
400
+ type ContainerObservability = {
401
+ /** If observability is enabled for this container application */
402
+ enabled?: boolean;
403
+ logs?: {
404
+ enabled?: boolean;
405
+ };
406
+ /**
407
+ * Percentage of instances to target with application-level observability hot reloads.
408
+ * Mutually exclusive with `target_instance_count`.
409
+ */
410
+ target_instance_percentage?: number;
411
+ /**
412
+ * Number of instances to target with application-level observability hot reloads.
413
+ * Mutually exclusive with `target_instance_percentage`.
414
+ */
415
+ target_instance_count?: number;
416
+ };
417
+ type ContainerApp = {
418
+ /**
419
+ * Name of the application.
420
+ *
421
+ * This is also the identifier used to reference the container from a Durable
422
+ * Object's `exports` entry via its `container` field.
423
+ *
424
+ * @optional Defaults to `worker_name-class_name` if not specified. A name is
425
+ * required when `class_name` is not set, since there is no class name to
426
+ * derive the default from.
427
+ */
428
+ name?: string;
429
+ /**
430
+ * Number of application instances
431
+ * @deprecated
432
+ * @hidden
433
+ */
434
+ instances?: number;
435
+ /**
436
+ * Number of maximum application instances.
437
+ * @optional
438
+ */
439
+ max_instances?: number;
440
+ /**
441
+ * The path to a Dockerfile, or an image URI for the Cloudflare registry.
442
+ */
443
+ image?: string;
444
+ /**
445
+ * Named images available to a Durable Object-managed container through
446
+ * `ctx.container.images`.
447
+ *
448
+ * Only supported when `scheduling_policy` is `"durable_object"`.
449
+ * When omitted, run `wrangler deploy` to provision the application before
450
+ * uploading versions. Version deployments use its existing application.
451
+ */
452
+ images?: Record<string, DurableObjectContainerImage>;
453
+ /**
454
+ * Build context of the application.
455
+ * @optional - defaults to the directory of `image`.
456
+ */
457
+ image_build_context?: string;
458
+ /**
459
+ * Image variables available to the image at build-time only.
460
+ * For runtime env vars, refer to https://developers.cloudflare.com/containers/examples/env-vars-and-secrets/
461
+ * @optional
462
+ */
463
+ image_vars?: Record<string, string>;
464
+ /**
465
+ * The class name of the Durable Object the container is connected to.
466
+ *
467
+ * @optional Instead of naming the Durable Object here, you can reference this
468
+ * container from the Durable Object's `exports` entry via its `container`
469
+ * field. Exactly one of the two directions must be configured.
470
+ */
471
+ class_name?: string;
472
+ /**
473
+ * Specify the observability behavior of this container application.
474
+ *
475
+ * When set, this overrides the root `observability` config for this container.
476
+ * Durable Object-managed Containers only support enabling or disabling logs.
477
+ * Their settings are application-wide, and omitted settings preserve the
478
+ * existing application rather than inheriting root Worker observability.
479
+ */
480
+ observability?: ContainerObservability;
481
+ /**
482
+ * The scheduling policy of the application
483
+ * @optional
484
+ * `"durable_object"` makes each Durable Object instance own its Container.
485
+ * In that mode, `name`, `class_name`, `scheduling_policy`, `images`,
486
+ * application-wide log `observability`, `ssh`, and `authorized_keys` are
487
+ * supported on this entry.
488
+ *
489
+ * @default "default"
490
+ */
491
+ scheduling_policy?: "default" | "durable_object" | "moon" | "regional";
492
+ /**
493
+ * The instance type to be used for the container.
494
+ * Select from one of the following named instance types:
495
+ * - lite: 1/16 vCPU, 256 MiB memory, and 2 GB disk
496
+ * - basic: 1/4 vCPU, 1 GiB memory, and 4 GB disk
497
+ * - standard-1: 1/2 vCPU, 4 GiB memory, and 8 GB disk
498
+ * - standard-2: 1 vCPU, 6 GiB memory, and 12 GB disk
499
+ * - standard-3: 2 vCPU, 8 GiB memory, and 16 GB disk
500
+ * - standard-4: 4 vCPU, 12 GiB memory, and 20 GB disk
501
+ * - dev: 1/16 vCPU, 256 MiB memory, and 2 GB disk (deprecated, use "lite" instead)
502
+ * - standard: 1 vCPU, 4 GiB memory, and 4 GB disk (deprecated, use "standard-1" instead)
503
+ *
504
+ * Customers on an enterprise plan have the additional option to set custom limits.
505
+ *
506
+ * @optional
507
+ * @default "dev"
508
+ */
509
+ instance_type?: "dev" | "basic" | "standard" | "lite" | "standard-1" | "standard-2" | "standard-3" | "standard-4" | {
510
+ /** @defaults to 0.0625 (1/16 vCPU) */
511
+ vcpu?: number;
512
+ /** @defaults to 256 MiB */
513
+ memory_mib?: number;
514
+ /** @defaults to 2 GB */
515
+ disk_mb?: number;
516
+ };
517
+ ssh?: {
518
+ /**
519
+ * If enabled, those with write access to a container will be able to SSH into it through Wrangler.
520
+ * @default false
521
+ */
522
+ enabled: boolean;
523
+ /**
524
+ * Port that the SSH service is running on
525
+ * @defaults to 22
526
+ */
527
+ port?: number;
528
+ };
529
+ /**
530
+ * @deprecated Use `ssh` instead.
531
+ * @hidden
532
+ */
533
+ wrangler_ssh?: {
534
+ enabled: boolean;
535
+ port?: number;
536
+ };
537
+ /**
538
+ * SSH public keys to put in the container's authorized_keys file.
539
+ */
540
+ authorized_keys?: {
541
+ name: string;
542
+ public_key: string;
543
+ }[];
544
+ /**
545
+ * Trusted user CA keys to put in the container's trusted_user_ca_keys file.
546
+ */
547
+ trusted_user_ca_keys?: {
548
+ name?: string;
549
+ public_key: string;
550
+ }[];
551
+ /**
552
+ * @deprecated Use top level `containers` fields instead.
553
+ * `configuration.image` should be `image`
554
+ * limits should be set via `instance_type`
555
+ * @hidden
556
+ */
557
+ configuration?: {
558
+ image?: string;
559
+ labels?: {
560
+ name: string;
561
+ value: string;
562
+ }[];
563
+ secrets?: {
564
+ name: string;
565
+ type: "env";
566
+ secret: string;
567
+ }[];
568
+ disk?: {
569
+ size_mb: number;
570
+ };
571
+ vcpu?: number;
572
+ memory_mib?: number;
573
+ };
574
+ /**
575
+ * Scheduling constraints for container placement.
576
+ */
577
+ constraints?: {
578
+ /**
579
+ * Limit container placement to specific geographic regions.
580
+ */
581
+ regions?: ("ENAM" | "WNAM" | "EEUR" | "WEUR" | "APAC" | "SAM" | "ME" | "OC" | "AFR")[];
582
+ /**
583
+ * Restrict containers to compliance boundaries.
584
+ */
585
+ jurisdiction?: "eu" | "fedramp";
586
+ /**
587
+ * @hidden
588
+ */
589
+ cities?: string[];
590
+ /**
591
+ * @deprecated Use `tiers` instead
592
+ * @hidden
593
+ */
594
+ tier?: number;
595
+ /**
596
+ * @hidden
597
+ */
598
+ tiers?: number[];
599
+ };
600
+ /**
601
+ * Scheduling affinities
602
+ * @hidden
603
+ */
604
+ affinities?: {
605
+ colocation?: "datacenter";
606
+ hardware_generation?: "highest-overall-performance";
607
+ };
608
+ /**
609
+ * @deprecated use the `class_name` field instead.
610
+ * @hidden
611
+ */
612
+ durable_objects?: {
613
+ namespace_id: string;
614
+ };
615
+ /**
616
+ * Configures what percentage of instances should be updated at each step of a rollout.
617
+ * You can specify this as a single number, or an array of numbers.
618
+ *
619
+ * If this is a single number, each step will progress by that percentage.
620
+ * The options are 5, 10, 20, 25, 50 or 100.
621
+ *
622
+ * If this is an array, each step specifies the cumulative rollout progress.
623
+ * The final step must be 100.
624
+ *
625
+ * This can be overridden adhoc by deploying with the `--containers-rollout=immediate` flag,
626
+ * which will roll out to 100% of instances in one step.
627
+ *
628
+ * @optional
629
+ * @default [10,100]
630
+ * */
631
+ rollout_step_percentage?: number | number[];
632
+ /**
633
+ * How a rollout should be created. It supports the following modes:
634
+ * - full_auto: The container application will be rolled out fully automatically.
635
+ * - none: The container application won't have a roll out or update.
636
+ * - manual: The container application will be rollout fully by manually actioning progress steps.
637
+ * @optional
638
+ * @default "full_auto"
639
+ * @hidden
640
+ */
641
+ rollout_kind?: "full_auto" | "none" | "full_manual";
642
+ /**
643
+ * Configures the grace period (in seconds) for active instances before being shutdown during a rollout.
644
+ * @optional
645
+ * @default 0
646
+ */
647
+ rollout_active_grace_period?: number;
648
+ /**
649
+ * Directly passed to the API without wrangler-side validation or transformation.
650
+ * @hidden
651
+ */
652
+ unsafe?: Record<string, unknown>;
653
+ };
654
+ /**
655
+ * Configuration in wrangler for Durable Object Migrations
656
+ */
657
+ type DurableObjectMigration = {
658
+ /** A unique identifier for this migration. */
659
+ tag: string;
660
+ /** The new Durable Objects being defined. */
661
+ new_classes?: string[];
662
+ /** The new SQLite Durable Objects being defined. */
663
+ new_sqlite_classes?: string[];
664
+ /** The Durable Objects being renamed. */
665
+ renamed_classes?: {
666
+ from: string;
667
+ to: string;
668
+ }[];
669
+ /** The Durable Objects being transferred from another Worker. */
670
+ transferred_classes?: {
671
+ from: string;
672
+ from_script: string;
673
+ to: string;
674
+ }[];
675
+ /** The Durable Objects being removed. */
676
+ deleted_classes?: string[];
677
+ };
678
+ /**
679
+ * Storage backend for a declarative Durable Object export. See
680
+ * {@link DurableObjectExport}.
681
+ */
682
+ type DurableObjectExportStorage = "sqlite" | "legacy-kv";
683
+ /**
684
+ * A single declarative Durable Object export entry in the `exports` config
685
+ * map. `type` is reserved for the export kind. `state` carries the Durable
686
+ * Object lifecycle and defaults to `"created"` (live) when omitted.
687
+ *
688
+ * Mutually exclusive with {@link DurableObjectMigration} at the config-
689
+ * validation boundary.
690
+ *
691
+ * - `created` (default, live): `storage` is required.
692
+ * - `deleted` (tombstone): retire a provisioned namespace whose class has
693
+ * been removed from code.
694
+ * - `renamed` (tombstone): rewrite a provisioned namespace's class name to
695
+ * `renamed_to`. The target name must also appear as a live (state
696
+ * `"created"`) `durable-object` entry in the same map.
697
+ * - `transferred` (tombstone): hand ownership of the namespace to another
698
+ * script in the same account (`transferred_to`). Two-phase commit;
699
+ * the target must first deploy an `expecting-transfer` entry naming this
700
+ * script via `transfer_from`.
701
+ * - `expecting-transfer` (live): receiving side of a two-phase transfer;
702
+ * `storage` and `transfer_from` are both required.
703
+ *
704
+ * The live states may additionally attach a container via `container`, which
705
+ * names an entry in the top-level `containers` array. Tombstones cannot.
706
+ */
707
+ type DurableObjectExport = {
708
+ type: "durable-object";
709
+ state?: "created";
710
+ storage: DurableObjectExportStorage;
711
+ /**
712
+ * Attach a container to this Durable Object. Must match the `name` of an
713
+ * entry in the top-level `containers` array, and requires
714
+ * `storage: "sqlite"`.
715
+ *
716
+ * @optional
717
+ */
718
+ container?: string;
719
+ } | {
720
+ type: "durable-object";
721
+ state: "deleted";
722
+ } | {
723
+ type: "durable-object";
724
+ state: "renamed";
725
+ renamed_to: string;
726
+ } | {
727
+ type: "durable-object";
728
+ state: "transferred";
729
+ transferred_to: string;
730
+ } | {
731
+ type: "durable-object";
732
+ state: "expecting-transfer";
733
+ storage: DurableObjectExportStorage;
734
+ transfer_from: string;
735
+ /**
736
+ * Attach a container to this Durable Object. Must match the `name` of an
737
+ * entry in the top-level `containers` array, and requires
738
+ * `storage: "sqlite"`.
739
+ *
740
+ * @optional
741
+ */
742
+ container?: string;
743
+ };
744
+ interface WorkerEntrypointExport {
745
+ type: "worker";
746
+ cache?: {
747
+ /** Whether cache is enabled for this entrypoint. */
748
+ enabled: boolean;
749
+ };
750
+ }
751
+ /**
752
+ * A single declarative Workflow export entry in the `exports` config map. The
753
+ * map key is the exported class name (the class extending `WorkflowEntrypoint`);
754
+ * `name` is the workflow's stable identity, used for instance and storage
755
+ * namespacing, and is required. The remaining settings match the ones accepted
756
+ * by `workflows` bindings.
757
+ */
758
+ interface WorkflowExport extends Pick<WorkflowBinding, "limits" | "concurrency" | "schedules" | "default_retention"> {
759
+ type: "workflow";
760
+ name: string;
761
+ }
762
+ type ConfiguredExport = DurableObjectExport | WorkerEntrypointExport | WorkflowExport;
763
+ /**
764
+ * The declarative `exports` map keyed by export name. Durable Object exports
765
+ * are mutually exclusive with `migrations` at the wrangler config layer.
766
+ */
767
+ type Exports = Record<string, ConfiguredExport>;
768
+ /**
769
+ * The `EnvironmentInheritable` interface declares all the configuration fields for an environment
770
+ * that can be inherited (and overridden) from the top-level environment.
771
+ */
772
+ interface EnvironmentInheritable {
773
+ /**
774
+ * The name of your Worker. Alphanumeric + dashes only.
775
+ *
776
+ * @inheritable
777
+ */
778
+ name: string | undefined;
779
+ /**
780
+ * This is the ID of the account associated with your zone.
781
+ * You might have more than one account, so make sure to use
782
+ * the ID of the account associated with the zone/route you
783
+ * provide, if you provide one. It can also be specified through
784
+ * the CLOUDFLARE_ACCOUNT_ID environment variable.
785
+ *
786
+ * @inheritable
787
+ */
788
+ account_id: string | undefined;
789
+ /**
790
+ * A date in the form yyyy-mm-dd, which will be used to determine
791
+ * which version of the Workers runtime is used.
792
+ *
793
+ * More details at https://developers.cloudflare.com/workers/configuration/compatibility-dates
794
+ *
795
+ * @inheritable
796
+ */
797
+ compatibility_date: string | undefined;
798
+ /**
799
+ * A list of flags that enable features from upcoming features of
800
+ * the Workers runtime, usually used together with compatibility_date.
801
+ *
802
+ * More details at https://developers.cloudflare.com/workers/configuration/compatibility-flags/
803
+ *
804
+ * @default []
805
+ * @inheritable
806
+ */
807
+ compatibility_flags: string[];
808
+ /**
809
+ * The entrypoint/path to the JavaScript file that will be executed.
810
+ *
811
+ * @inheritable
812
+ */
813
+ main: string | undefined;
814
+ /**
815
+ * If true then Wrangler will traverse the file tree below `base_dir`;
816
+ * Any files that match `rules` will be included in the deployed Worker.
817
+ * Defaults to true if `no_bundle` is true, otherwise false.
818
+ *
819
+ * @inheritable
820
+ */
821
+ find_additional_modules: boolean | undefined;
822
+ /**
823
+ * Determines whether Wrangler will preserve bundled file names.
824
+ * Defaults to false.
825
+ * If left unset, files will be named using the pattern ${fileHash}-${basename},
826
+ * for example, `34de60b44167af5c5a709e62a4e20c4f18c9e3b6-favicon.ico`.
827
+ *
828
+ * @inheritable
829
+ */
830
+ preserve_file_names: boolean | undefined;
831
+ /**
832
+ * The directory in which module rules should be evaluated when including additional files into a Worker deployment.
833
+ * This defaults to the directory containing the `main` entry point of the Worker if not specified.
834
+ *
835
+ * @inheritable
836
+ */
837
+ base_dir: string | undefined;
838
+ /**
839
+ * Whether we use <name>.<subdomain>.workers.dev to
840
+ * test and deploy your Worker.
841
+ *
842
+ * For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#workersdev
843
+ *
844
+ * @default true
845
+ * @breaking
846
+ * @inheritable
847
+ */
848
+ workers_dev: boolean | undefined;
849
+ /**
850
+ * Whether we use <version>-<name>.<subdomain>.workers.dev to
851
+ * serve Preview URLs for your Worker.
852
+ *
853
+ * @default false
854
+ * @inheritable
855
+ */
856
+ preview_urls: boolean | undefined;
857
+ /**
858
+ * A list of routes that your Worker should be published to.
859
+ * Only one of `routes` or `route` is required.
860
+ *
861
+ * Only required when workers_dev is false, and there's no scheduled Worker (see `triggers`)
862
+ *
863
+ * For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#types-of-routes
864
+ *
865
+ * @inheritable
866
+ */
867
+ routes: Route[] | undefined;
868
+ /**
869
+ * A route that your Worker should be published to. Literally
870
+ * the same as routes, but only one.
871
+ * Only one of `routes` or `route` is required.
872
+ *
873
+ * Only required when workers_dev is false, and there's no scheduled Worker
874
+ *
875
+ * @inheritable
876
+ */
877
+ route: Route | undefined;
878
+ /**
879
+ * Path to a custom tsconfig
880
+ *
881
+ * @inheritable
882
+ */
883
+ tsconfig: string | undefined;
884
+ /**
885
+ * The function to use to replace jsx syntax.
886
+ *
887
+ * @default "React.createElement"
888
+ * @inheritable
889
+ */
890
+ jsx_factory: string;
891
+ /**
892
+ * The function to use to replace jsx fragment syntax.
893
+ *
894
+ * @default "React.Fragment"
895
+ * @inheritable
896
+ */
897
+ jsx_fragment: string;
898
+ /**
899
+ * A list of migrations that should be uploaded with your Worker.
900
+ *
901
+ * These define changes in your Durable Object declarations.
902
+ *
903
+ * More details at https://developers.cloudflare.com/workers/learning/using-durable-objects#configuring-durable-object-classes-with-migrations
904
+ *
905
+ * @default []
906
+ * @inheritable
907
+ */
908
+ migrations: DurableObjectMigration[];
909
+ /**
910
+ * Declarative exports configuration — a map of class name to export configuration.
911
+ *
912
+ * The configuration of Durable Objects via `exports` is mutually exclusive with `migrations`.
913
+ *
914
+ * @default {}
915
+ * @inheritable
916
+ */
917
+ exports: Exports;
918
+ /**
919
+ * Definitions that trigger a Worker from a schedule or a Cloudflare event.
920
+ *
921
+ * More details about cron triggers: https://developers.cloudflare.com/workers/platform/cron-triggers
922
+ *
923
+ * More details about Artifacts events: https://developers.cloudflare.com/artifacts/guides/event-subscriptions/
924
+ *
925
+ * For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#triggers
926
+ *
927
+ * @default {crons:[]}
928
+ * @inheritable
929
+ */
930
+ triggers: {
931
+ crons?: string[];
932
+ events?: ArtifactsEventTrigger[];
933
+ };
934
+ /**
935
+ * Specify limits for runtime behavior.
936
+ * Only supported for the "standard" Usage Model
937
+ *
938
+ * For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#limits
939
+ *
940
+ * @inheritable
941
+ */
942
+ limits: UserLimits | undefined;
943
+ /**
944
+ * An ordered list of rules that define which modules to import,
945
+ * and what type to import them as. You will need to specify rules
946
+ * to use Text, Data, and CompiledWasm modules, or when you wish to
947
+ * have a .js file be treated as an ESModule instead of CommonJS.
948
+ *
949
+ * For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#bundling
950
+ *
951
+ * @inheritable
952
+ */
953
+ rules: Rule[];
954
+ /**
955
+ * Configures a custom build step to be run by Wrangler when building your Worker.
956
+ *
957
+ * Refer to the [custom builds documentation](https://developers.cloudflare.com/workers/cli-wrangler/configuration#build)
958
+ * for more details.
959
+ *
960
+ * For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#custom-builds
961
+ *
962
+ * @default {watch_dir:"./src"}
963
+ */
964
+ build: {
965
+ /** 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. */
966
+ command?: string;
967
+ /** The directory in which the command is executed. */
968
+ cwd?: string;
969
+ /** The directory to watch for changes while using wrangler dev, defaults to the current working directory */
970
+ watch_dir?: string | string[];
971
+ };
972
+ /**
973
+ * Skip internal build steps and directly deploy script
974
+ * @inheritable
975
+ */
976
+ no_bundle: boolean | undefined;
977
+ /**
978
+ * Minify the script before uploading.
979
+ * @inheritable
980
+ */
981
+ minify: boolean | undefined;
982
+ /**
983
+ * Set the `name` property to the original name for functions and classes renamed during minification.
984
+ *
985
+ * See https://esbuild.github.io/api/#keep-names
986
+ *
987
+ * @default true
988
+ * @inheritable
989
+ */
990
+ keep_names: boolean | undefined;
991
+ /**
992
+ * Designates this Worker as an internal-only "first-party" Worker.
993
+ *
994
+ * @inheritable
995
+ */
996
+ first_party_worker: boolean | undefined;
997
+ /**
998
+ * List of bindings that you will send to logfwdr
999
+ *
1000
+ * @default {bindings:[]}
1001
+ * @inheritable
1002
+ */
1003
+ logfwdr: {
1004
+ bindings: {
1005
+ /** The binding name used to refer to logfwdr */
1006
+ name: string;
1007
+ /** The destination for this logged message */
1008
+ destination: string;
1009
+ }[];
1010
+ };
1011
+ /**
1012
+ * Send Trace Events from this Worker to Workers Logpush.
1013
+ *
1014
+ * This will not configure a corresponding Logpush job automatically.
1015
+ *
1016
+ * For more information about Workers Logpush, see:
1017
+ * https://blog.cloudflare.com/logpush-for-workers/
1018
+ *
1019
+ * @inheritable
1020
+ */
1021
+ logpush: boolean | undefined;
1022
+ /**
1023
+ * Include source maps when uploading this worker.
1024
+ *
1025
+ * For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#source-maps
1026
+ *
1027
+ * @inheritable
1028
+ */
1029
+ upload_source_maps: boolean | undefined;
1030
+ /**
1031
+ * Specify how the Worker should be located to minimize round-trip time.
1032
+ *
1033
+ * More details: https://developers.cloudflare.com/workers/platform/smart-placement/
1034
+ *
1035
+ * @inheritable
1036
+ */
1037
+ placement: {
1038
+ mode: "off" | "smart";
1039
+ hint?: string;
1040
+ } | {
1041
+ mode?: "targeted";
1042
+ region: string;
1043
+ } | {
1044
+ mode?: "targeted";
1045
+ host: string;
1046
+ } | {
1047
+ mode?: "targeted";
1048
+ hostname: string;
1049
+ } | undefined;
1050
+ /**
1051
+ * Specify the directory of static assets to deploy/serve
1052
+ *
1053
+ * More details at https://developers.cloudflare.com/workers/frameworks/
1054
+ *
1055
+ * For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#assets
1056
+ *
1057
+ * @inheritable
1058
+ */
1059
+ assets: Assets | undefined;
1060
+ /**
1061
+ * Specify the observability behavior of the Worker.
1062
+ *
1063
+ * For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#observability
1064
+ *
1065
+ * @inheritable
1066
+ */
1067
+ observability: Observability | undefined;
1068
+ /**
1069
+ * Specify the Cloudflare Access authentication behavior of the Worker.
1070
+ *
1071
+ * @inheritable
1072
+ */
1073
+ access: Access | undefined;
1074
+ /**
1075
+ * Specify the cache behavior of the Worker.
1076
+ *
1077
+ * @inheritable
1078
+ */
1079
+ cache: CacheOptions | undefined;
1080
+ /**
1081
+ * Specify the compliance region mode of the Worker.
1082
+ *
1083
+ * Although if the user does not specify a compliance region, the default is `public`,
1084
+ * it can be set to `undefined` in configuration to delegate to the CLOUDFLARE_COMPLIANCE_REGION environment variable.
1085
+ */
1086
+ compliance_region: "public" | "fedramp_high" | undefined;
1087
+ /**
1088
+ * Configuration for Python modules.
1089
+ *
1090
+ * @inheritable
1091
+ */
1092
+ python_modules: {
1093
+ /**
1094
+ * A list of glob patterns to exclude files from the python_modules directory when bundling.
1095
+ *
1096
+ * Patterns are relative to the python_modules directory and use glob syntax.
1097
+ *
1098
+ * @default ["**\*.pyc"]
1099
+ */
1100
+ exclude: string[];
1101
+ };
1102
+ /**
1103
+ * Configuration for Worker Previews.
1104
+ *
1105
+ * Previews are branches of your Worker's main instance used to test features
1106
+ * in development outside of production. This block defines the settings
1107
+ * used when creating Preview deployments via `wrangler preview`.
1108
+ *
1109
+ * For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#previews
1110
+ *
1111
+ * @inheritable
1112
+ */
1113
+ previews: PreviewsConfig | undefined;
1114
+ }
1115
+ type DurableObjectBindings = {
1116
+ /** The name of the binding used to refer to the Durable Object */
1117
+ name: string;
1118
+ /** The exported class name of the Durable Object */
1119
+ class_name: string;
1120
+ /** The script where the Durable Object is defined (if it's external to this Worker) */
1121
+ script_name?: string;
1122
+ /** The service environment of the script_name to bind to */
1123
+ environment?: string;
1124
+ }[];
1125
+ type DurableObjectCodeUpdateStrategy = {
1126
+ /** How Durable Object code updates should be applied. */
1127
+ mode: "immediate" | "deferred";
1128
+ /**
1129
+ * Maximum time, in seconds, to wait for Durable Objects to hibernate.
1130
+ * Defaults to 300 (5 minutes) and cannot exceed 86400 (24 hours).
1131
+ * @minimum 0
1132
+ * @maximum 86400
1133
+ * @multipleOf 0.001
1134
+ * @default 300
1135
+ */
1136
+ max_delay?: number;
1137
+ };
1138
+ type DurableObjectsConfig = {
1139
+ bindings: DurableObjectBindings;
1140
+ code_update_strategy?: DurableObjectCodeUpdateStrategy;
1141
+ };
1142
+ type RawDurableObjectsConfig = Omit<DurableObjectsConfig, "bindings"> & {
1143
+ bindings?: DurableObjectBindings;
1144
+ };
1145
+ declare const ARTIFACTS_EVENT_TYPES: readonly ["cf.artifacts.repo.created", "cf.artifacts.repo.deleted", "cf.artifacts.repo.forked", "cf.artifacts.repo.imported", "cf.artifacts.repo.pushed", "cf.artifacts.repo.cloned", "cf.artifacts.repo.fetched", "cf.artifacts.repo.token.created", "cf.artifacts.repo.token.revoked"];
1146
+ type ArtifactsEventType = (typeof ARTIFACTS_EVENT_TYPES)[number];
1147
+ type ArtifactsEventTrigger = {
1148
+ type: ArtifactsEventType;
1149
+ filter?: {
1150
+ namespace?: string;
1151
+ repo_name?: string;
1152
+ };
1153
+ targets: {
1154
+ type: "workflow";
1155
+ workflow_name: string;
1156
+ }[];
1157
+ };
1158
+ type WorkflowBinding = {
1159
+ /** The name of the binding used to refer to the Workflow */
1160
+ binding: string;
1161
+ /** The name of the Workflow */
1162
+ name: string;
1163
+ /** The exported class name of the Workflow */
1164
+ class_name: string;
1165
+ /** The script where the Workflow is defined (if it's external to this Worker) */
1166
+ script_name?: string;
1167
+ /** Optional limits for the Workflow */
1168
+ limits?: {
1169
+ /** Maximum number of steps a Workflow instance can execute */
1170
+ steps?: number;
1171
+ };
1172
+ /** Optional concurrency configuration for the Workflow */
1173
+ concurrency?: {
1174
+ /** Maximum number of Workflow instances that can run concurrently */
1175
+ limit?: number;
1176
+ };
1177
+ /** Optional cron schedule(s) for automatically triggering workflow instances */
1178
+ schedules?: string | string[];
1179
+ /**
1180
+ * Optional default retention for instances of this Workflow, applied when an instance does not
1181
+ * set its own retention. Accepts milliseconds or a duration string such as `"3 days"`, and is
1182
+ * validated by the Workflows API at deploy time.
1183
+ */
1184
+ default_retention?: {
1185
+ /** How long to retain instances that completed successfully or were terminated */
1186
+ success_retention?: number | string;
1187
+ /** How long to retain errored instances */
1188
+ error_retention?: number | string;
1189
+ };
1190
+ };
1191
+ type ConnectHandlerConfigBase = {
1192
+ /** The port to listen on. */
1193
+ port: number;
1194
+ /** The address to bind to. Defaults to `127.0.0.1`. */
1195
+ address?: string;
1196
+ };
1197
+ type TcpConnectHandlerConfig = ConnectHandlerConfigBase & {
1198
+ protocol: "tcp";
1199
+ };
1200
+ type UdpConnectHandlerConfig = ConnectHandlerConfigBase & {
1201
+ protocol: "udp";
1202
+ /** The idle timeout in milliseconds after which a peer flow is closed. */
1203
+ idle_timeout_ms?: number;
1204
+ /** The maximum number of pending datagram bytes per peer flow. */
1205
+ max_pending_bytes?: number;
1206
+ };
1207
+ type ConnectHandlerConfig = TcpConnectHandlerConfig | UdpConnectHandlerConfig;
1208
+ /**
1209
+ * The `EnvironmentNonInheritable` interface declares all the configuration fields for an environment
1210
+ * that cannot be inherited from the top-level environment, and must be defined specifically.
1211
+ *
1212
+ * If any of these fields are defined at the top-level then they should also be specifically defined
1213
+ * for each named environment.
1214
+ */
1215
+ interface EnvironmentNonInheritable {
1216
+ /**
1217
+ * A map of values to substitute when deploying your Worker.
1218
+ *
1219
+ * NOTE: This field is not automatically inherited from the top level environment,
1220
+ * and so must be specified in every named environment.
1221
+ *
1222
+ * @default {}
1223
+ * @nonInheritable
1224
+ */
1225
+ define: Record<string, string>;
1226
+ /**
1227
+ * A map of environment variables to set when deploying your Worker.
1228
+ *
1229
+ * NOTE: This field is not automatically inherited from the top level environment,
1230
+ * and so must be specified in every named environment.
1231
+ *
1232
+ * For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#environment-variables
1233
+ *
1234
+ * @default {}
1235
+ * @nonInheritable
1236
+ */
1237
+ vars: Record<string, string | Json>;
1238
+ /**
1239
+ * Secrets configuration.
1240
+ *
1241
+ * NOTE: This field is not automatically inherited from the top level environment,
1242
+ * and so must be specified in every named environment.
1243
+ *
1244
+ * For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#secrets-configuration-property
1245
+ *
1246
+ * @nonInheritable
1247
+ */
1248
+ secrets?: {
1249
+ /**
1250
+ * List of secret names that are required by your Worker.
1251
+ * When defined, this property:
1252
+ * - Replaces .dev.vars/.env/process.env inference for type generation
1253
+ * - Enables local dev validation with warnings for missing secrets
1254
+ */
1255
+ required?: string[];
1256
+ };
1257
+ /**
1258
+ * Durable Object bindings and code update strategy for your Worker.
1259
+ *
1260
+ * For more information about Durable Objects, see the documentation at
1261
+ * https://developers.cloudflare.com/workers/learning/using-durable-objects
1262
+ *
1263
+ * NOTE: This field is not automatically inherited from the top level environment,
1264
+ * and so must be specified in every named environment.
1265
+ *
1266
+ * For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#durable-objects
1267
+ *
1268
+ * @default {bindings:[]}
1269
+ * @nonInheritable
1270
+ */
1271
+ durable_objects: DurableObjectsConfig;
1272
+ /**
1273
+ * A list of workflows that your Worker should be bound to.
1274
+ *
1275
+ * NOTE: This field is not automatically inherited from the top level environment,
1276
+ * and so must be specified in every named environment.
1277
+ *
1278
+ * @default []
1279
+ * @nonInheritable
1280
+ */
1281
+ workflows: WorkflowBinding[];
1282
+ /**
1283
+ * Cloudchamber configuration
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
+ * @default {}
1289
+ * @nonInheritable
1290
+ */
1291
+ cloudchamber: CloudchamberConfig;
1292
+ /**
1293
+ * Container related configuration
1294
+ *
1295
+ * NOTE: This field is not automatically inherited from the top level environment,
1296
+ * and so must be specified in every named environment.
1297
+ *
1298
+ * @default []
1299
+ * @nonInheritable
1300
+ */
1301
+ containers?: ContainerApp[];
1302
+ /**
1303
+ * These specify any Workers KV Namespaces you want to
1304
+ * access from inside your Worker.
1305
+ *
1306
+ * To learn more about KV Namespaces,
1307
+ * see the documentation at https://developers.cloudflare.com/workers/learning/how-kv-works
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
+ * For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#kv-namespaces
1313
+ *
1314
+ * @default []
1315
+ * @nonInheritable
1316
+ */
1317
+ kv_namespaces: {
1318
+ /** The binding name used to refer to the KV Namespace */
1319
+ binding: string;
1320
+ /** The ID of the KV namespace */
1321
+ id?: string;
1322
+ /** The ID of the KV namespace used during `wrangler dev` */
1323
+ preview_id?: string;
1324
+ /** Whether the KV namespace should be remote or not in local development */
1325
+ remote?: boolean;
1326
+ }[];
1327
+ /**
1328
+ * These specify bindings to send email from inside your Worker.
1329
+ *
1330
+ * NOTE: This field is not automatically inherited from the top level environment,
1331
+ * and so must be specified in every named environment.
1332
+ *
1333
+ * For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#email-bindings
1334
+ *
1335
+ * @default []
1336
+ * @nonInheritable
1337
+ */
1338
+ send_email: {
1339
+ /** The binding name used to refer to the this binding */
1340
+ name: string;
1341
+ /** If this binding should be restricted to a specific verified address */
1342
+ destination_address?: string;
1343
+ /** If this binding should be restricted to a set of verified addresses */
1344
+ allowed_destination_addresses?: string[];
1345
+ /** If this binding should be restricted to a set of sender addresses */
1346
+ allowed_sender_addresses?: string[];
1347
+ /** Whether the binding should be remote or not in local development */
1348
+ remote?: boolean;
1349
+ }[];
1350
+ /**
1351
+ * Specifies Queues that are bound to this Worker environment.
1352
+ *
1353
+ * NOTE: This field is not automatically inherited from the top level environment,
1354
+ * and so must be specified in every named environment.
1355
+ *
1356
+ * For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#queues
1357
+ *
1358
+ * @default {consumers:[],producers:[]}
1359
+ * @nonInheritable
1360
+ */
1361
+ queues: {
1362
+ /** Producer bindings */
1363
+ producers?: {
1364
+ /** The binding name used to refer to the Queue in the Worker. */
1365
+ binding: string;
1366
+ /** The name of this Queue. */
1367
+ queue?: string;
1368
+ /** The number of seconds to wait before delivering a message */
1369
+ delivery_delay?: number;
1370
+ /** Whether the Queue producer should be remote or not in local development */
1371
+ remote?: boolean;
1372
+ }[];
1373
+ /** Consumer configuration */
1374
+ consumers?: {
1375
+ /** The name of the queue from which this consumer should consume. */
1376
+ queue: string;
1377
+ /** The consumer type. Only "worker" is supported in wrangler config. Default is "worker". */
1378
+ type?: "worker";
1379
+ /** The maximum number of messages per batch */
1380
+ max_batch_size?: number;
1381
+ /** The maximum number of seconds to wait to fill a batch with messages. */
1382
+ max_batch_timeout?: number;
1383
+ /** The maximum number of retries for each message. */
1384
+ max_retries?: number;
1385
+ /** The queue to send messages that failed to be consumed. */
1386
+ dead_letter_queue?: string;
1387
+ /** 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. */
1388
+ max_concurrency?: number | null;
1389
+ /** The number of milliseconds to wait for pulled messages to become visible again */
1390
+ visibility_timeout_ms?: number;
1391
+ /** The number of seconds to wait before retrying a message */
1392
+ retry_delay?: number;
1393
+ }[];
1394
+ };
1395
+ /**
1396
+ * Specifies raw sockets that this Worker should listen on.
1397
+ * Each entry opens a listening socket on the
1398
+ * given port that delivers incoming connections directly to the Worker's
1399
+ * `connect(socket, env, ctx)` handler.
1400
+ *
1401
+ * NOTE: This field is not automatically inherited from the top level environment,
1402
+ * and so must be specified in every named environment.
1403
+ *
1404
+ * @default []
1405
+ * @nonInheritable
1406
+ */
1407
+ connect: ConnectHandlerConfig[];
1408
+ /**
1409
+ * Specifies R2 buckets that are bound to this Worker environment.
1410
+ *
1411
+ * NOTE: This field is not automatically inherited from the top level environment,
1412
+ * and so must be specified in every named environment.
1413
+ *
1414
+ * For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#r2-buckets
1415
+ *
1416
+ * @default []
1417
+ * @nonInheritable
1418
+ */
1419
+ r2_buckets: {
1420
+ /** The binding name used to refer to the R2 bucket in the Worker. */
1421
+ binding: string;
1422
+ /** The name of this R2 bucket at the edge. */
1423
+ bucket_name?: string;
1424
+ /** The preview name of this R2 bucket at the edge. */
1425
+ preview_bucket_name?: string;
1426
+ /** The jurisdiction that the bucket exists in. Default if not present. */
1427
+ jurisdiction?: string;
1428
+ /** Whether the R2 bucket should be remote or not in local development */
1429
+ remote?: boolean;
1430
+ /** Settings that only apply to local development */
1431
+ local_dev?: {
1432
+ /**
1433
+ * EXPERIMENTAL: AWS SigV4 credentials for the local S3-compatible
1434
+ * endpoint. When set, the bucket is served at
1435
+ * `/cdn-cgi/local/r2/s3/<bucket-name>` during local development.
1436
+ * Ignored when the bucket runs remotely.
1437
+ */
1438
+ experimental_s3_credentials?: LocalS3Credentials;
1439
+ };
1440
+ }[];
1441
+ /**
1442
+ * Specifies D1 databases that are bound to this Worker environment.
1443
+ *
1444
+ * NOTE: This field is not automatically inherited from the top level environment,
1445
+ * and so must be specified in every named environment.
1446
+ *
1447
+ * For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#d1-databases
1448
+ *
1449
+ * @default []
1450
+ * @nonInheritable
1451
+ */
1452
+ d1_databases: {
1453
+ /** The binding name used to refer to the D1 database in the Worker. */
1454
+ binding: string;
1455
+ /** The name of this D1 database. */
1456
+ database_name?: string;
1457
+ /** The UUID of this D1 database (not required). */
1458
+ database_id?: string;
1459
+ /** The UUID of this D1 database for Wrangler Dev (if specified). */
1460
+ preview_database_id?: string;
1461
+ /** The name of the migrations table for this D1 database (defaults to 'd1_migrations'). */
1462
+ migrations_table?: string;
1463
+ /** The path to the directory of migrations for this D1 database (defaults to './migrations'). */
1464
+ migrations_dir?: string;
1465
+ /**
1466
+ * A glob pattern (relative to the Wrangler config file) used to discover
1467
+ * migration files for this D1 database. Defaults to `${migrations_dir}/*.sql`
1468
+ * if not specified.
1469
+ *
1470
+ * Use this to opt in to nested layouts such as `migrations/*\/migration.sql`
1471
+ * (as produced by some ORMs).
1472
+ *
1473
+ * When `migrations_pattern` is set, `migrations_dir` must also be set, and
1474
+ * `migrations_pattern` must start with `${migrations_dir}/`. This keeps the
1475
+ * relationship between the two settings explicit and lets Wrangler record
1476
+ * each migration's name in the migrations table as a path relative to
1477
+ * `migrations_dir`.
1478
+ */
1479
+ migrations_pattern?: string;
1480
+ /** Internal use only. */
1481
+ database_internal_env?: string;
1482
+ /** Whether the D1 database should be remote or not in local development */
1483
+ remote?: boolean;
1484
+ }[];
1485
+ /**
1486
+ * Specifies Vectorize indexes that are bound to this Worker environment.
1487
+ *
1488
+ * NOTE: This field is not automatically inherited from the top level environment,
1489
+ * and so must be specified in every named environment.
1490
+ *
1491
+ * For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#vectorize-indexes
1492
+ *
1493
+ * @default []
1494
+ * @nonInheritable
1495
+ */
1496
+ vectorize: {
1497
+ /** The binding name used to refer to the Vectorize index in the Worker. */
1498
+ binding: string;
1499
+ /** The name of the index. */
1500
+ index_name: string;
1501
+ /** Whether the Vectorize index should be remote or not in local development */
1502
+ remote?: boolean;
1503
+ }[];
1504
+ /**
1505
+ * Specifies AI Search namespace bindings that are bound to this Worker environment.
1506
+ * Each binding is scoped to a namespace and allows dynamic instance CRUD within it.
1507
+ *
1508
+ * NOTE: This field is not automatically inherited from the top level environment,
1509
+ * and so must be specified in every named environment.
1510
+ *
1511
+ * @default []
1512
+ * @nonInheritable
1513
+ */
1514
+ ai_search_namespaces: {
1515
+ /** The binding name used to refer to the AI Search namespace in the Worker. */
1516
+ binding: string;
1517
+ /** The user-chosen namespace name. Must exist in Cloudflare at deploy time. */
1518
+ namespace: string;
1519
+ /** Whether the AI Search namespace binding should be remote in local development */
1520
+ remote?: boolean;
1521
+ }[];
1522
+ /**
1523
+ * Specifies AI Search instance bindings that are bound to this Worker environment.
1524
+ * Each binding is bound directly to a single pre-existing instance within the "default" namespace.
1525
+ *
1526
+ * NOTE: This field is not automatically inherited from the top level environment,
1527
+ * and so must be specified in every named environment.
1528
+ *
1529
+ * @default []
1530
+ * @nonInheritable
1531
+ */
1532
+ ai_search: {
1533
+ /** The binding name used to refer to the AI Search instance in the Worker. */
1534
+ binding: string;
1535
+ /** The user-chosen instance name. Must exist in Cloudflare at deploy time. */
1536
+ instance_name: string;
1537
+ /** Whether the AI Search instance binding should be remote in local development */
1538
+ remote?: boolean;
1539
+ }[];
1540
+ /**
1541
+ * Specifies Agent Memory namespace bindings that are bound to this Worker environment.
1542
+ *
1543
+ * NOTE: This field is not automatically inherited from the top level environment,
1544
+ * and so must be specified in every named environment.
1545
+ *
1546
+ * @default []
1547
+ * @nonInheritable
1548
+ */
1549
+ agent_memory: {
1550
+ /** The binding name used to refer to the Agent Memory namespace in the Worker. */
1551
+ binding: string;
1552
+ /** The user-chosen namespace name. Must exist in Cloudflare at deploy time. */
1553
+ namespace: string;
1554
+ /** Whether the Agent Memory binding should be remote in local development */
1555
+ remote?: boolean;
1556
+ }[];
1557
+ /**
1558
+ * Specifies Hyperdrive configs that are bound to this Worker environment.
1559
+ *
1560
+ * NOTE: This field is not automatically inherited from the top level environment,
1561
+ * and so must be specified in every named environment.
1562
+ *
1563
+ * For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#hyperdrive
1564
+ *
1565
+ * @default []
1566
+ * @nonInheritable
1567
+ */
1568
+ hyperdrive: {
1569
+ /** The binding name used to refer to the project in the Worker. */
1570
+ binding: string;
1571
+ /** The id of the database. */
1572
+ id: string;
1573
+ /** The local database connection string for `wrangler dev` */
1574
+ localConnectionString?: string;
1575
+ }[];
1576
+ /**
1577
+ * Specifies service bindings (Worker-to-Worker) that are bound to this Worker environment.
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/#service-bindings
1583
+ *
1584
+ * @default []
1585
+ * @nonInheritable
1586
+ */
1587
+ services: {
1588
+ /** The binding name used to refer to the bound service. */
1589
+ binding: string;
1590
+ /**
1591
+ * The name of the service.
1592
+ * To bind to a worker in a specific environment,
1593
+ * you should use the format `<worker_name>-<environment_name>`.
1594
+ */
1595
+ service: string;
1596
+ /**
1597
+ * @hidden
1598
+ * @deprecated you should use `service: <worker_name>-<environment_name>` instead.
1599
+ * This refers to the deprecated concept of 'service environments'.
1600
+ * The environment of the service (e.g. production, staging, etc).
1601
+ */
1602
+ environment?: string;
1603
+ /** Optionally, the entrypoint (named export) of the service to bind to. */
1604
+ entrypoint?: string;
1605
+ /** Optional properties that will be made available to the service via ctx.props. */
1606
+ props?: Record<string, unknown>;
1607
+ /** Whether the service binding should be remote or not in local development */
1608
+ remote?: boolean;
1609
+ }[] | undefined;
1610
+ /**
1611
+ * Specifies analytics engine datasets that are bound to this Worker environment.
1612
+ *
1613
+ * NOTE: This field is not automatically inherited from the top level environment,
1614
+ * and so must be specified in every named environment.
1615
+ *
1616
+ * For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#analytics-engine-datasets
1617
+ *
1618
+ * @default []
1619
+ * @nonInheritable
1620
+ */
1621
+ analytics_engine_datasets: {
1622
+ /** The binding name used to refer to the dataset in the Worker. */
1623
+ binding: string;
1624
+ /** The name of this dataset to write to. */
1625
+ dataset?: string;
1626
+ }[];
1627
+ /**
1628
+ * A browser that will be usable from the Worker.
1629
+ *
1630
+ * NOTE: This field is not automatically inherited from the top level environment,
1631
+ * and so must be specified in every named environment.
1632
+ *
1633
+ * For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#browser-rendering
1634
+ *
1635
+ * @default {}
1636
+ * @nonInheritable
1637
+ */
1638
+ browser: {
1639
+ binding: string;
1640
+ /** Whether the Browser binding should be remote or not in local development */
1641
+ remote?: boolean;
1642
+ } | undefined;
1643
+ /**
1644
+ * Binding to the AI project.
1645
+ *
1646
+ * NOTE: This field is not automatically inherited from the top level environment,
1647
+ * and so must be specified in every named environment.
1648
+ *
1649
+ * For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#workers-ai
1650
+ *
1651
+ * @default {}
1652
+ * @nonInheritable
1653
+ */
1654
+ ai: {
1655
+ binding: string;
1656
+ staging?: boolean;
1657
+ /** Whether the AI binding should be remote or not in local development */
1658
+ remote?: boolean;
1659
+ } | undefined;
1660
+ /**
1661
+ * Binding to Cloudflare Images
1662
+ *
1663
+ * NOTE: This field is not automatically inherited from the top level environment,
1664
+ * and so must be specified in every named environment.
1665
+ *
1666
+ * For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#images
1667
+ *
1668
+ * @default {}
1669
+ * @nonInheritable
1670
+ */
1671
+ images: {
1672
+ binding: string;
1673
+ /** Whether the Images binding should be remote or not in local development */
1674
+ remote?: boolean;
1675
+ } | undefined;
1676
+ /**
1677
+ * Binding to Cloudflare Media Transformations
1678
+ *
1679
+ * NOTE: This field is not automatically inherited from the top level environment,
1680
+ * and so must be specified in every named environment.
1681
+ *
1682
+ * @default {}
1683
+ * @nonInheritable
1684
+ */
1685
+ media: {
1686
+ binding: string;
1687
+ /** Whether the Media binding should be remote or not */
1688
+ remote?: boolean;
1689
+ } | undefined;
1690
+ /**
1691
+ * Binding to Cloudflare Stream
1692
+ *
1693
+ * NOTE: This field is not automatically inherited from the top level environment,
1694
+ * and so must be specified in every named environment.
1695
+ *
1696
+ * @default {}
1697
+ * @nonInheritable
1698
+ */
1699
+ stream: {
1700
+ binding: string;
1701
+ /** Whether the Stream binding should be remote or not in local development */
1702
+ remote?: boolean;
1703
+ } | undefined;
1704
+ /**
1705
+ * Binding to the Worker Version's metadata
1706
+ */
1707
+ version_metadata: {
1708
+ binding: string;
1709
+ } | undefined;
1710
+ /**
1711
+ * "Unsafe" tables for features that aren't directly supported by wrangler.
1712
+ *
1713
+ * NOTE: This field is not automatically inherited from the top level environment,
1714
+ * and so must be specified in every named environment.
1715
+ *
1716
+ * @default {}
1717
+ * @nonInheritable
1718
+ */
1719
+ unsafe: {
1720
+ /**
1721
+ * A set of bindings that should be put into a Worker's upload metadata without changes. These
1722
+ * can be used to implement bindings for features that haven't released and aren't supported
1723
+ * directly by wrangler or miniflare.
1724
+ */
1725
+ bindings?: UnsafeBinding[];
1726
+ /**
1727
+ * Arbitrary key/value pairs that will be included in the uploaded metadata. Values specified
1728
+ * here will always be applied to metadata last, so can add new or override existing fields.
1729
+ */
1730
+ metadata?: {
1731
+ [key: string]: unknown;
1732
+ };
1733
+ /**
1734
+ * Used for internal capnp uploads for the Workers runtime
1735
+ */
1736
+ capnp?: {
1737
+ base_path: string;
1738
+ source_schemas: string[];
1739
+ compiled_schema?: never;
1740
+ } | {
1741
+ base_path?: never;
1742
+ source_schemas?: never;
1743
+ compiled_schema: string;
1744
+ };
1745
+ };
1746
+ /**
1747
+ * Specifies a list of mTLS certificates that are bound to this Worker environment.
1748
+ *
1749
+ * NOTE: This field is not automatically inherited from the top level environment,
1750
+ * and so must be specified in every named environment.
1751
+ *
1752
+ * For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#mtls-certificates
1753
+ *
1754
+ * @default []
1755
+ * @nonInheritable
1756
+ */
1757
+ mtls_certificates: {
1758
+ /** The binding name used to refer to the certificate in the Worker */
1759
+ binding: string;
1760
+ /** The uuid of the uploaded mTLS certificate */
1761
+ certificate_id: string;
1762
+ /** Whether the mtls fetcher should be remote or not in local development */
1763
+ remote?: boolean;
1764
+ }[];
1765
+ /**
1766
+ * Specifies a list of Tail Workers that are bound to this Worker environment
1767
+ *
1768
+ * NOTE: This field is not automatically inherited from the top level environment,
1769
+ * and so must be specified in every named environment.
1770
+ *
1771
+ * @default []
1772
+ * @nonInheritable
1773
+ */
1774
+ tail_consumers?: TailConsumer[];
1775
+ /**
1776
+ * Specifies a list of Streaming Tail Workers that are bound to this Worker environment
1777
+ *
1778
+ * NOTE: This field is not automatically inherited from the top level environment,
1779
+ * and so must be specified in every named environment.
1780
+ *
1781
+ * @default []
1782
+ * @nonInheritable
1783
+ */
1784
+ streaming_tail_consumers?: StreamingTailConsumer[];
1785
+ /**
1786
+ * Specifies namespace bindings that are bound to this Worker environment.
1787
+ *
1788
+ * NOTE: This field is not automatically inherited from the top level environment,
1789
+ * and so must be specified in every named environment.
1790
+ *
1791
+ * For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#dispatch-namespace-bindings-workers-for-platforms
1792
+ *
1793
+ * @default []
1794
+ * @nonInheritable
1795
+ */
1796
+ dispatch_namespaces: {
1797
+ /** The binding name used to refer to the bound service. */
1798
+ binding: string;
1799
+ /** The namespace to bind to. */
1800
+ namespace?: string;
1801
+ /** Details about the outbound Worker which will handle outbound requests from your namespace */
1802
+ outbound?: DispatchNamespaceOutbound;
1803
+ /** Whether the Dispatch Namespace should be remote or not in local development */
1804
+ remote?: boolean;
1805
+ }[];
1806
+ /**
1807
+ * Specifies list of Pipelines bound to this Worker environment
1808
+ *
1809
+ * NOTE: This field is not automatically inherited from the top level environment,
1810
+ * and so must be specified in every named environment.
1811
+ *
1812
+ * @default []
1813
+ * @nonInheritable
1814
+ */
1815
+ pipelines: {
1816
+ /** The binding name used to refer to the bound service. */
1817
+ binding: string;
1818
+ /** Id of the Stream to bind */
1819
+ stream?: string;
1820
+ /**
1821
+ * Id of the Stream to bind
1822
+ * @deprecated Use `stream` instead.
1823
+ */
1824
+ pipeline?: string;
1825
+ /** Whether the pipeline should be remote or not in local development */
1826
+ remote?: boolean;
1827
+ }[];
1828
+ /**
1829
+ * Specifies Secret Store bindings that are bound to this Worker environment.
1830
+ *
1831
+ * NOTE: This field is not automatically inherited from the top level environment,
1832
+ * and so must be specified in every named environment.
1833
+ *
1834
+ * @default []
1835
+ * @nonInheritable
1836
+ */
1837
+ secrets_store_secrets: {
1838
+ /** The binding name used to refer to the bound service. */
1839
+ binding: string;
1840
+ /** Id of the secret store */
1841
+ store_id: string;
1842
+ /** Name of the secret */
1843
+ secret_name: string;
1844
+ }[];
1845
+ /**
1846
+ * Specifies Artifacts bindings that are bound to this Worker environment.
1847
+ * Artifacts provides git-compatible file storage on Cloudflare Workers.
1848
+ *
1849
+ * NOTE: This field is not automatically inherited from the top level environment,
1850
+ * and so must be specified in every named environment.
1851
+ *
1852
+ * @default []
1853
+ * @nonInheritable
1854
+ */
1855
+ artifacts: {
1856
+ /** The binding name used to refer to the Artifacts instance. */
1857
+ binding: string;
1858
+ /** The namespace to use. */
1859
+ namespace: string;
1860
+ /** Whether to use the remote Artifacts service in local dev. */
1861
+ remote?: boolean;
1862
+ }[];
1863
+ /**
1864
+ * **DO NOT USE**. Hello World Binding Config to serve as an explanatory example.
1865
+ *
1866
+ * NOTE: This field is not automatically inherited from the top level environment,
1867
+ * and so must be specified in every named environment.
1868
+ *
1869
+ * @default []
1870
+ * @nonInheritable
1871
+ */
1872
+ unsafe_hello_world: {
1873
+ /** The binding name used to refer to the bound service. */
1874
+ binding: string;
1875
+ /** Whether the timer is enabled */
1876
+ enable_timer?: boolean;
1877
+ }[];
1878
+ /**
1879
+ * Specifies Flagship feature flag bindings that are bound to this Worker environment.
1880
+ *
1881
+ * NOTE: This field is not automatically inherited from the top level environment,
1882
+ * and so must be specified in every named environment.
1883
+ *
1884
+ * @default []
1885
+ * @nonInheritable
1886
+ */
1887
+ flagship: {
1888
+ /** The binding name used to refer to the bound Flagship service. */
1889
+ binding: string;
1890
+ /** The Flagship app ID to bind to. */
1891
+ app_id?: string;
1892
+ /** Set to `true` to evaluate flags against the remote Flagship app during local dev, instead of the local simulator. */
1893
+ remote?: boolean;
1894
+ }[];
1895
+ /**
1896
+ * Specifies rate limit bindings that are bound to this Worker environment.
1897
+ *
1898
+ * NOTE: This field is not automatically inherited from the top level environment,
1899
+ * and so must be specified in every named environment.
1900
+ *
1901
+ * @default []
1902
+ * @nonInheritable
1903
+ */
1904
+ ratelimits: {
1905
+ /** The binding name used to refer to the rate limiter in the Worker. */
1906
+ name: string;
1907
+ /** The namespace ID for this rate limiter. */
1908
+ namespace_id: string;
1909
+ /** Simple rate limiting configuration. */
1910
+ simple: {
1911
+ /** The maximum number of requests allowed in the time period. */
1912
+ limit: number;
1913
+ /** The time period in seconds (10 for ten seconds, 60 for one minute). */
1914
+ period: 10 | 60;
1915
+ };
1916
+ }[];
1917
+ /**
1918
+ * Specifies Worker Loader bindings that are bound to this Worker environment.
1919
+ *
1920
+ * NOTE: This field is not automatically inherited from the top level environment,
1921
+ * and so must be specified in every named environment.
1922
+ *
1923
+ * @default []
1924
+ * @nonInheritable
1925
+ */
1926
+ worker_loaders: {
1927
+ /** The binding name used to refer to the Worker Loader in the Worker. */
1928
+ binding: string;
1929
+ }[];
1930
+ /**
1931
+ * Specifies VPC services that are bound to this Worker environment.
1932
+ *
1933
+ * NOTE: This field is not automatically inherited from the top level environment,
1934
+ * and so must be specified in every named environment.
1935
+ *
1936
+ * @default []
1937
+ * @nonInheritable
1938
+ */
1939
+ vpc_services: {
1940
+ /** The binding name used to refer to the VPC service in the Worker. */
1941
+ binding: string;
1942
+ /** The service ID of the VPC connectivity service. */
1943
+ service_id: string;
1944
+ /** Whether the VPC service is remote or not */
1945
+ remote?: boolean;
1946
+ }[];
1947
+ /**
1948
+ * Specifies VPC networks that are bound to this Worker environment.
1949
+ *
1950
+ * NOTE: This field is not automatically inherited from the top level environment,
1951
+ * and so must be specified in every named environment.
1952
+ *
1953
+ * @default []
1954
+ * @nonInheritable
1955
+ */
1956
+ vpc_networks: ({
1957
+ /** The binding name used to refer to the VPC network in the Worker. */
1958
+ binding: string;
1959
+ /** The tunnel ID of the Cloudflare Tunnel to route traffic through. Mutually exclusive with network_id. */
1960
+ tunnel_id: string;
1961
+ /** Whether the VPC network is remote or not */
1962
+ remote?: boolean;
1963
+ } | {
1964
+ /** The binding name used to refer to the VPC network in the Worker. */
1965
+ binding: string;
1966
+ /** The network ID to route traffic through. Mutually exclusive with tunnel_id. */
1967
+ network_id: string;
1968
+ /** Whether the VPC network is remote or not */
1969
+ remote?: boolean;
1970
+ })[];
1971
+ }
1972
+ /**
1973
+ * The raw environment configuration that we read from the config file.
1974
+ *
1975
+ * All the properties are optional, and will be replaced with defaults in the configuration that
1976
+ * is used in the rest of the codebase.
1977
+ */
1978
+ type RawEnvironment = Partial<Omit<Environment, "durable_objects">> & {
1979
+ durable_objects?: RawDurableObjectsConfig;
1980
+ };
1981
+ /**
1982
+ * A bundling resolver rule, defining the modules type for paths that match the specified globs.
1983
+ */
1984
+ type Rule = {
1985
+ type: ConfigModuleRuleType;
1986
+ globs: string[];
1987
+ fallthrough?: boolean;
1988
+ };
1989
+ /**
1990
+ * The possible types for a `Rule`.
1991
+ */
1992
+ type ConfigModuleRuleType = "ESModule" | "CommonJS" | "CompiledWasm" | "Text" | "Data" | "PythonModule" | "PythonRequirement";
1993
+ type TailConsumer = {
1994
+ /** The name of the service tail events will be forwarded to. */
1995
+ service: string;
1996
+ /** (Optional) The environment of the service. */
1997
+ environment?: string;
1998
+ };
1999
+ type StreamingTailConsumer = {
2000
+ /** The name of the service streaming tail events will be forwarded to. */
2001
+ service: string;
2002
+ };
2003
+ interface DispatchNamespaceOutbound {
2004
+ /** Name of the service handling the outbound requests */
2005
+ service: string;
2006
+ /** (Optional) Name of the environment handling the outbound requests. */
2007
+ environment?: string;
2008
+ /** (Optional) List of parameter names, for sending context from your dispatch Worker to the outbound handler */
2009
+ parameters?: string[];
2010
+ }
2011
+ interface UserLimits {
2012
+ /** Maximum allowed CPU time for a Worker's invocation in milliseconds */
2013
+ cpu_ms?: number;
2014
+ /** Maximum allowed number of fetch requests that a Worker's invocation can execute */
2015
+ subrequests?: number;
2016
+ }
2017
+ type Assets = {
2018
+ /** Absolute path to assets directory */
2019
+ directory?: string;
2020
+ /** Name of `env` binding property in the User Worker. */
2021
+ binding?: string;
2022
+ /** How to handle HTML requests. */
2023
+ html_handling?: "auto-trailing-slash" | "force-trailing-slash" | "drop-trailing-slash" | "none";
2024
+ /** How to handle requests that do not match an asset. */
2025
+ not_found_handling?: "single-page-application" | "404-page" | "none";
2026
+ /**
2027
+ * Matches will be routed to the User Worker, and matches to negative rules will go to the Asset Worker.
2028
+ *
2029
+ * Can also be `true`, indicating that every request should be routed to the User Worker.
2030
+ */
2031
+ run_worker_first?: string[] | boolean;
2032
+ };
2033
+ interface Observability {
2034
+ /** If observability is enabled for this Worker */
2035
+ enabled?: boolean;
2036
+ /** The sampling rate */
2037
+ head_sampling_rate?: number;
2038
+ /**
2039
+ * Whether query strings are removed from request URLs in logs and traces.
2040
+ *
2041
+ * @default false
2042
+ */
2043
+ redact_query_string?: boolean;
2044
+ /** Real-time Issues settings for this Worker. */
2045
+ issues?: {
2046
+ /** Whether real-time Issues are enabled. */
2047
+ enabled?: boolean;
2048
+ };
2049
+ logs?: {
2050
+ enabled?: boolean;
2051
+ /** The sampling rate */
2052
+ head_sampling_rate?: number;
2053
+ /** Set to false to disable invocation logs */
2054
+ invocation_logs?: boolean;
2055
+ /**
2056
+ * If logs should be persisted to the Cloudflare observability platform where they can be queried in the dashboard.
2057
+ *
2058
+ * @default true
2059
+ */
2060
+ persist?: boolean;
2061
+ /**
2062
+ * What destinations logs emitted from the Worker should be sent to.
2063
+ *
2064
+ * @default []
2065
+ */
2066
+ destinations?: string[];
2067
+ };
2068
+ traces?: {
2069
+ enabled?: boolean;
2070
+ /** The sampling rate */
2071
+ head_sampling_rate?: number;
2072
+ /**
2073
+ * If traces should be persisted to the Cloudflare observability platform where they can be queried in the dashboard.
2074
+ *
2075
+ * @default true
2076
+ */
2077
+ persist?: boolean;
2078
+ /**
2079
+ * What destinations traces emitted from the Worker should be sent to.
2080
+ *
2081
+ * @default []
2082
+ */
2083
+ destinations?: string[];
2084
+ };
2085
+ }
2086
+ interface Access {
2087
+ /** Local dev simulation of Cloudflare Access authentication */
2088
+ dev?: {
2089
+ /** The Access application audience tag (aud) */
2090
+ aud: string;
2091
+ /** Mock identity object returned by ctx.access.getIdentity() */
2092
+ identity?: Record<string, unknown>;
2093
+ };
2094
+ }
2095
+ interface CacheOptions {
2096
+ /** If cache is enabled for this Worker */
2097
+ enabled: boolean;
2098
+ /** Whether cached assets may be reused across Worker versions. */
2099
+ cross_version_cache?: boolean;
2100
+ }
2101
+ type DockerConfiguration = {
2102
+ /** Socket used by miniflare to communicate with Docker */
2103
+ socketPath: string;
2104
+ /** Docker image name for the container egress interceptor sidecar */
2105
+ containerEgressInterceptorImage?: string;
2106
+ };
2107
+ type ContainerEngine = {
2108
+ localDocker: DockerConfiguration;
2109
+ } | string;
2110
+ /**
2111
+ * Configuration for Worker Previews.
2112
+ *
2113
+ * This defines the settings used when creating Preview deployments.
2114
+ * Previews are branches of your Worker's main instance used to test features
2115
+ * during feature development outside of production.
2116
+ *
2117
+ * The `previews` block contains any intentionally divergent configuration intended solely for Previews, including:
2118
+ * - All non-inheritable properties (environment variables and bindings like KV, D1, R2, etc.)
2119
+ * - Select inheritable properties: `logpush`, `observability`, `limits`, `placement`, `cache`
2120
+ *
2121
+ * @inheritable
2122
+ */
2123
+ interface PreviewsConfig extends Partial<Omit<EnvironmentNonInheritable, "durable_objects">>, Partial<Pick<EnvironmentInheritable, "logpush" | "observability" | "limits" | "placement" | "cache">> {
2124
+ durable_objects?: {
2125
+ bindings: DurableObjectBindings;
2126
+ };
2127
+ }
2128
+
2129
+ type RawConfig = Partial<ConfigFields<RawDevConfig>> & PagesConfigFields & RawEnvironment & EnvironmentMap & {
2130
+ $schema?: string;
2131
+ };
2132
+ interface ConfigFields<Dev extends RawDevConfig> {
2133
+ /**
2134
+ * Whether Wrangler should send usage metrics to Cloudflare for this project.
2135
+ *
2136
+ * When defined this will override any user settings.
2137
+ * Otherwise, Wrangler will use the user's preference.
2138
+ */
2139
+ send_metrics: boolean | undefined;
2140
+ /**
2141
+ * Configuration for npm package dependency instrumentation.
2142
+ *
2143
+ * Controls whether Wrangler should collect and send npm package dependency
2144
+ * metadata when deploying or uploading a Worker version.
2145
+ *
2146
+ * When `enabled` is set to `false`, Wrangler will not include
2147
+ * `package_dependencies` in the upload payload. Defaults to enabled when
2148
+ * not specified.
2149
+ *
2150
+ * Note: This is considered build metadata, so managed separately from the
2151
+ * telemetry one and not disabled when
2152
+ * `send_metrics`/`WRANGLER_SEND_METRICS` is set to `false`
2153
+ */
2154
+ dependencies_instrumentation: {
2155
+ /** Whether dependency instrumentation is enabled. Defaults to `true`. */
2156
+ enabled: boolean;
2157
+ /**
2158
+ * An optional list of package name patterns to exclude from the
2159
+ * collected dependency metadata.
2160
+ *
2161
+ * Each entry can be an exact package name (e.g. `"lodash"`) or a glob
2162
+ * pattern using `*` as a wildcard (e.g. `"@internal/*"` to exclude all
2163
+ * packages under the `@internal` scope).
2164
+ */
2165
+ exclude_packages?: string[];
2166
+ } | undefined;
2167
+ /**
2168
+ * Options to configure the development server that your worker will use.
2169
+ *
2170
+ * For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#local-development-settings
2171
+ */
2172
+ dev: Dev;
2173
+ /**
2174
+ * The definition of a Worker Site, a feature that lets you upload
2175
+ * static assets with your Worker.
2176
+ *
2177
+ * More details at https://developers.cloudflare.com/workers/platform/sites
2178
+ *
2179
+ * For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#workers-sites
2180
+ */
2181
+ site: {
2182
+ /**
2183
+ * The directory containing your static assets.
2184
+ *
2185
+ * It must be a path relative to your Wrangler configuration file.
2186
+ * Example: bucket = "./public"
2187
+ *
2188
+ * If there is a `site` field then it must contain this `bucket` field.
2189
+ */
2190
+ bucket: string;
2191
+ /**
2192
+ * The location of your Worker script.
2193
+ *
2194
+ * @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.
2195
+ * @breaking
2196
+ */
2197
+ "entry-point"?: string;
2198
+ /**
2199
+ * An exclusive list of .gitignore-style patterns that match file
2200
+ * or directory names from your bucket location. Only matched
2201
+ * items will be uploaded. Example: include = ["upload_dir"]
2202
+ *
2203
+ * @optional
2204
+ * @default []
2205
+ */
2206
+ include?: string[];
2207
+ /**
2208
+ * A list of .gitignore-style patterns that match files or
2209
+ * directories in your bucket that should be excluded from
2210
+ * uploads. Example: exclude = ["ignore_dir"]
2211
+ *
2212
+ * @optional
2213
+ * @default []
2214
+ */
2215
+ exclude?: string[];
2216
+ } | undefined;
2217
+ /**
2218
+ * A list of wasm modules that your worker should be bound to. This is
2219
+ * the "legacy" way of binding to a wasm module. ES module workers should
2220
+ * do proper module imports.
2221
+ */
2222
+ wasm_modules: {
2223
+ [key: string]: string;
2224
+ } | undefined;
2225
+ /**
2226
+ * A list of text files that your worker should be bound to. This is
2227
+ * the "legacy" way of binding to a text file. ES module workers should
2228
+ * do proper module imports.
2229
+ */
2230
+ text_blobs: {
2231
+ [key: string]: string;
2232
+ } | undefined;
2233
+ /**
2234
+ * A list of data files that your worker should be bound to. This is
2235
+ * the "legacy" way of binding to a data file. ES module workers should
2236
+ * do proper module imports.
2237
+ */
2238
+ data_blobs: {
2239
+ [key: string]: string;
2240
+ } | undefined;
2241
+ /**
2242
+ * A map of module aliases. Lets you swap out a module for any others.
2243
+ * Corresponds with esbuild's `alias` config
2244
+ *
2245
+ * For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#module-aliasing
2246
+ */
2247
+ alias: {
2248
+ [key: string]: string;
2249
+ } | undefined;
2250
+ /**
2251
+ * By default, the Wrangler configuration file is the source of truth for your environment configuration, like a terraform file.
2252
+ *
2253
+ * If you change your vars in the dashboard, wrangler *will* override/delete them on its next deploy.
2254
+ *
2255
+ * If you want to keep your dashboard vars when wrangler deploys, set this field to true.
2256
+ *
2257
+ * @default false
2258
+ * @nonInheritable
2259
+ */
2260
+ keep_vars?: boolean;
2261
+ /**
2262
+ * The inbound email addresses handled by the Worker being deployed.
2263
+ *
2264
+ * Each entry is a literal recipient address (e.g. `"support@example.com"`)
2265
+ * or a `*@domain` catch-all (e.g. `"*@example.com"`). Every entry creates an
2266
+ * Email Routing rule whose action routes mail to this Worker.
2267
+ *
2268
+ * This field is top-level only and applies to every environment of the
2269
+ * Worker; it cannot be set under `env.*`.
2270
+ *
2271
+ * @nonInheritable
2272
+ */
2273
+ addresses?: string[];
2274
+ }
2275
+ interface PagesConfigFields {
2276
+ /**
2277
+ * The directory of static assets to serve.
2278
+ *
2279
+ * The presence of this field in a Wrangler configuration file indicates a Pages project,
2280
+ * and will prompt the handling of the configuration file according to the
2281
+ * Pages-specific validation rules.
2282
+ */
2283
+ pages_build_output_dir?: string;
2284
+ }
2285
+ interface DevConfig {
2286
+ /**
2287
+ * IP address for the local dev server to listen on,
2288
+ *
2289
+ * @default localhost
2290
+ */
2291
+ ip: string;
2292
+ /**
2293
+ * Port for the local dev server to listen on
2294
+ *
2295
+ * @default 8787
2296
+ */
2297
+ port: number | undefined;
2298
+ /**
2299
+ * Port for the local dev server's inspector to listen on
2300
+ *
2301
+ * @default 9229
2302
+ */
2303
+ inspector_port: number | undefined;
2304
+ /**
2305
+ * IP address for the local dev server's inspector to listen on
2306
+ *
2307
+ * @default 127.0.0.1
2308
+ */
2309
+ inspector_ip: string | undefined;
2310
+ /**
2311
+ * Protocol that local wrangler dev server listens to requests on.
2312
+ *
2313
+ * @default http
2314
+ */
2315
+ local_protocol: "http" | "https";
2316
+ /**
2317
+ * Protocol that wrangler dev forwards requests on
2318
+ *
2319
+ * Setting this to `http` is not currently implemented for remote mode.
2320
+ * See https://github.com/cloudflare/workers-sdk/issues/583
2321
+ *
2322
+ * @default https
2323
+ */
2324
+ upstream_protocol: "https" | "http";
2325
+ /**
2326
+ * Host to forward requests to, defaults to the host of the first route of project
2327
+ */
2328
+ host: string | undefined;
2329
+ /**
2330
+ * When developing, whether to build and connect to containers. This requires a Docker daemon to be running.
2331
+ * Defaults to `true`.
2332
+ *
2333
+ * @default true
2334
+ */
2335
+ enable_containers: boolean;
2336
+ /**
2337
+ * Either the Docker unix socket i.e. `unix:///var/run/docker.sock` or a full configuration.
2338
+ * Note that windows is only supported via WSL at the moment
2339
+ */
2340
+ container_engine: ContainerEngine | undefined;
2341
+ /**
2342
+ * Re-generate your worker types when your Wrangler configuration file changes.
2343
+ *
2344
+ * @default false
2345
+ */
2346
+ generate_types: boolean;
2347
+ }
2348
+ type RawDevConfig = Partial<DevConfig>;
2349
+ interface EnvironmentMap {
2350
+ /**
2351
+ * The `env` section defines overrides for the configuration for different environments.
2352
+ *
2353
+ * All environment fields can be specified at the top level of the config indicating the default environment settings.
2354
+ *
2355
+ * - Some fields are inherited and overridable in each environment.
2356
+ * - But some are not inherited and must be explicitly specified in every environment, if they are specified at the top level.
2357
+ *
2358
+ * For more information, see the documentation at https://developers.cloudflare.com/workers/cli-wrangler/configuration#environments
2359
+ *
2360
+ * @default {}
2361
+ */
2362
+ env?: {
2363
+ [envName: string]: RawEnvironment;
2364
+ };
2365
+ }
6
2366
 
7
2367
  type RoutesRes = {
8
2368
  id: string;