@cloudflare/workers-utils 0.12.0 → 0.18.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.
- package/README.md +3 -1
- package/dist/browser.d.mts +1 -1
- package/dist/browser.mjs +3 -2
- package/dist/{chunk-NNMRVG4F.mjs → chunk-A4F3D336.mjs} +5 -1
- package/dist/{chunk-4233U5MA.mjs → chunk-BLWXWFJK.mjs} +72 -36
- package/dist/{chunk-LDFBMPMW.mjs → chunk-DCOBXSFB.mjs} +1 -8
- package/dist/chunk-O4YGOZSW.mjs +52 -0
- package/dist/chunk-OZQVB3L3.mjs +8 -0
- package/dist/{config-BQZJPwXe.d.mts → config-_M2XwEUI.d.mts} +249 -13
- package/dist/index.d.mts +44 -28
- package/dist/index.mjs +4845 -310
- package/dist/metafile-esm.json +1 -1
- package/dist/prometheus-metrics.d.mts +50 -0
- package/dist/prometheus-metrics.mjs +2 -0
- package/dist/test-helpers/index.d.mts +1 -1
- package/dist/test-helpers/index.mjs +3 -2
- package/package.json +20 -18
|
@@ -136,6 +136,13 @@ interface CfMediaBinding {
|
|
|
136
136
|
binding: string;
|
|
137
137
|
remote?: boolean;
|
|
138
138
|
}
|
|
139
|
+
/**
|
|
140
|
+
* A binding to Cloudflare Stream
|
|
141
|
+
*/
|
|
142
|
+
interface CfStreamBinding {
|
|
143
|
+
binding: string;
|
|
144
|
+
remote?: boolean;
|
|
145
|
+
}
|
|
139
146
|
/**
|
|
140
147
|
* A binding to the Worker Version's metadata
|
|
141
148
|
*/
|
|
@@ -164,6 +171,9 @@ interface CfWorkflow {
|
|
|
164
171
|
script_name?: string;
|
|
165
172
|
remote?: boolean;
|
|
166
173
|
raw?: boolean;
|
|
174
|
+
limits?: {
|
|
175
|
+
steps?: number;
|
|
176
|
+
};
|
|
167
177
|
}
|
|
168
178
|
interface CfQueue {
|
|
169
179
|
binding: string;
|
|
@@ -196,15 +206,35 @@ interface CfVectorize {
|
|
|
196
206
|
raw?: boolean;
|
|
197
207
|
remote?: boolean;
|
|
198
208
|
}
|
|
209
|
+
interface CfAISearchNamespace {
|
|
210
|
+
binding: string;
|
|
211
|
+
namespace: string | typeof INHERIT_SYMBOL;
|
|
212
|
+
remote?: boolean;
|
|
213
|
+
}
|
|
214
|
+
interface CfAISearch {
|
|
215
|
+
binding: string;
|
|
216
|
+
instance_name: string;
|
|
217
|
+
remote?: boolean;
|
|
218
|
+
}
|
|
199
219
|
interface CfSecretsStoreSecrets {
|
|
200
220
|
binding: string;
|
|
201
221
|
store_id: string;
|
|
202
222
|
secret_name: string;
|
|
203
223
|
}
|
|
224
|
+
interface CfArtifacts {
|
|
225
|
+
binding: string;
|
|
226
|
+
namespace: string;
|
|
227
|
+
remote?: boolean;
|
|
228
|
+
}
|
|
204
229
|
interface CfHelloWorld {
|
|
205
230
|
binding: string;
|
|
206
231
|
enable_timer?: boolean;
|
|
207
232
|
}
|
|
233
|
+
interface CfFlagship {
|
|
234
|
+
binding: string;
|
|
235
|
+
app_id: string;
|
|
236
|
+
remote?: boolean;
|
|
237
|
+
}
|
|
208
238
|
interface CfWorkerLoader {
|
|
209
239
|
binding: string;
|
|
210
240
|
}
|
|
@@ -235,6 +265,12 @@ interface CfVpcService {
|
|
|
235
265
|
service_id: string;
|
|
236
266
|
remote?: boolean;
|
|
237
267
|
}
|
|
268
|
+
interface CfVpcNetwork {
|
|
269
|
+
binding: string;
|
|
270
|
+
tunnel_id?: string;
|
|
271
|
+
network_id?: string;
|
|
272
|
+
remote?: boolean;
|
|
273
|
+
}
|
|
238
274
|
interface CfAnalyticsEngineDataset {
|
|
239
275
|
binding: string;
|
|
240
276
|
dataset?: string;
|
|
@@ -460,6 +496,9 @@ type WorkerMetadataBinding = {
|
|
|
460
496
|
type: "images";
|
|
461
497
|
name: string;
|
|
462
498
|
raw?: boolean;
|
|
499
|
+
} | {
|
|
500
|
+
type: "stream";
|
|
501
|
+
name: string;
|
|
463
502
|
} | {
|
|
464
503
|
type: "version_metadata";
|
|
465
504
|
name: string;
|
|
@@ -467,6 +506,14 @@ type WorkerMetadataBinding = {
|
|
|
467
506
|
type: "data_blob";
|
|
468
507
|
name: string;
|
|
469
508
|
part: string;
|
|
509
|
+
} | {
|
|
510
|
+
type: "ai_search_namespace";
|
|
511
|
+
name: string;
|
|
512
|
+
namespace: string;
|
|
513
|
+
} | {
|
|
514
|
+
type: "ai_search";
|
|
515
|
+
name: string;
|
|
516
|
+
instance_name: string;
|
|
470
517
|
} | {
|
|
471
518
|
type: "kv_namespace";
|
|
472
519
|
name: string;
|
|
@@ -560,10 +607,18 @@ type WorkerMetadataBinding = {
|
|
|
560
607
|
name: string;
|
|
561
608
|
store_id: string;
|
|
562
609
|
secret_name: string;
|
|
610
|
+
} | {
|
|
611
|
+
type: "artifacts";
|
|
612
|
+
name: string;
|
|
613
|
+
namespace: string;
|
|
563
614
|
} | {
|
|
564
615
|
type: "unsafe_hello_world";
|
|
565
616
|
name: string;
|
|
566
617
|
enable_timer?: boolean;
|
|
618
|
+
} | {
|
|
619
|
+
type: "flagship";
|
|
620
|
+
name: string;
|
|
621
|
+
app_id: string;
|
|
567
622
|
} | {
|
|
568
623
|
type: "ratelimit";
|
|
569
624
|
name: string;
|
|
@@ -576,6 +631,11 @@ type WorkerMetadataBinding = {
|
|
|
576
631
|
type: "vpc_service";
|
|
577
632
|
name: string;
|
|
578
633
|
service_id: string;
|
|
634
|
+
} | {
|
|
635
|
+
type: "vpc_network";
|
|
636
|
+
name: string;
|
|
637
|
+
tunnel_id?: string;
|
|
638
|
+
network_id?: string;
|
|
579
639
|
} | {
|
|
580
640
|
type: "worker_loader";
|
|
581
641
|
name: string;
|
|
@@ -689,7 +749,7 @@ type Trigger = {
|
|
|
689
749
|
cron: string;
|
|
690
750
|
} | ({
|
|
691
751
|
type: "queue-consumer";
|
|
692
|
-
} & QueueConsumer);
|
|
752
|
+
} & Omit<QueueConsumer, "type">);
|
|
693
753
|
type BindingOmit<T> = Omit<T, "binding">;
|
|
694
754
|
type NameOmit<T> = Omit<T, "name">;
|
|
695
755
|
type Binding = {
|
|
@@ -723,7 +783,9 @@ type Binding = {
|
|
|
723
783
|
type: "ai";
|
|
724
784
|
} & BindingOmit<CfAIBinding>) | ({
|
|
725
785
|
type: "images";
|
|
726
|
-
} & BindingOmit<CfImagesBinding>) | {
|
|
786
|
+
} & BindingOmit<CfImagesBinding>) | ({
|
|
787
|
+
type: "stream";
|
|
788
|
+
} & BindingOmit<CfStreamBinding>) | {
|
|
727
789
|
type: "version_metadata";
|
|
728
790
|
} | {
|
|
729
791
|
type: "data_blob";
|
|
@@ -741,6 +803,10 @@ type Binding = {
|
|
|
741
803
|
} & BindingOmit<CfD1Database>) | ({
|
|
742
804
|
type: "vectorize";
|
|
743
805
|
} & BindingOmit<CfVectorize>) | ({
|
|
806
|
+
type: "ai_search_namespace";
|
|
807
|
+
} & BindingOmit<CfAISearchNamespace>) | ({
|
|
808
|
+
type: "ai_search";
|
|
809
|
+
} & BindingOmit<CfAISearch>) | ({
|
|
744
810
|
type: "hyperdrive";
|
|
745
811
|
} & BindingOmit<CfHyperdrive>) | ({
|
|
746
812
|
type: "service";
|
|
@@ -758,16 +824,22 @@ type Binding = {
|
|
|
758
824
|
} & BindingOmit<CfPipeline>) | ({
|
|
759
825
|
type: "secrets_store_secret";
|
|
760
826
|
} & BindingOmit<CfSecretsStoreSecrets>) | ({
|
|
827
|
+
type: "artifacts";
|
|
828
|
+
} & BindingOmit<CfArtifacts>) | ({
|
|
761
829
|
type: "logfwdr";
|
|
762
830
|
} & NameOmit<CfLogfwdrBinding>) | ({
|
|
763
831
|
type: "unsafe_hello_world";
|
|
764
832
|
} & BindingOmit<CfHelloWorld>) | ({
|
|
833
|
+
type: "flagship";
|
|
834
|
+
} & BindingOmit<CfFlagship>) | ({
|
|
765
835
|
type: "ratelimit";
|
|
766
836
|
} & NameOmit<CfRateLimit>) | ({
|
|
767
837
|
type: "worker_loader";
|
|
768
838
|
} & BindingOmit<CfWorkerLoader>) | ({
|
|
769
839
|
type: "vpc_service";
|
|
770
840
|
} & BindingOmit<CfVpcService>) | ({
|
|
841
|
+
type: "vpc_network";
|
|
842
|
+
} & BindingOmit<CfVpcNetwork>) | ({
|
|
771
843
|
type: "media";
|
|
772
844
|
} & BindingOmit<CfMediaBinding>) | ({
|
|
773
845
|
type: `unsafe_${string}`;
|
|
@@ -799,6 +871,8 @@ type ZoneNameRoute = {
|
|
|
799
871
|
type CustomDomainRoute = {
|
|
800
872
|
pattern: string;
|
|
801
873
|
custom_domain: boolean;
|
|
874
|
+
enabled?: boolean;
|
|
875
|
+
previews_enabled?: boolean;
|
|
802
876
|
};
|
|
803
877
|
type Route = SimpleRoute | ZoneIdRoute | ZoneNameRoute | CustomDomainRoute;
|
|
804
878
|
/**
|
|
@@ -911,7 +985,7 @@ type ContainerApp = {
|
|
|
911
985
|
/** @defaults to 2 GB */
|
|
912
986
|
disk_mb?: number;
|
|
913
987
|
};
|
|
914
|
-
|
|
988
|
+
ssh?: {
|
|
915
989
|
/**
|
|
916
990
|
* If enabled, those with write access to a container will be able to SSH into it through Wrangler.
|
|
917
991
|
* @default false
|
|
@@ -923,6 +997,14 @@ type ContainerApp = {
|
|
|
923
997
|
*/
|
|
924
998
|
port?: number;
|
|
925
999
|
};
|
|
1000
|
+
/**
|
|
1001
|
+
* @deprecated Use `ssh` instead.
|
|
1002
|
+
* @hidden
|
|
1003
|
+
*/
|
|
1004
|
+
wrangler_ssh?: {
|
|
1005
|
+
enabled: boolean;
|
|
1006
|
+
port?: number;
|
|
1007
|
+
};
|
|
926
1008
|
/**
|
|
927
1009
|
* SSH public keys to put in the container's authorized_keys file.
|
|
928
1010
|
*/
|
|
@@ -961,16 +1043,29 @@ type ContainerApp = {
|
|
|
961
1043
|
memory_mib?: number;
|
|
962
1044
|
};
|
|
963
1045
|
/**
|
|
964
|
-
* Scheduling constraints
|
|
965
|
-
* @hidden
|
|
1046
|
+
* Scheduling constraints for container placement.
|
|
966
1047
|
*/
|
|
967
1048
|
constraints?: {
|
|
968
|
-
|
|
1049
|
+
/**
|
|
1050
|
+
* Limit container placement to specific geographic regions.
|
|
1051
|
+
*/
|
|
1052
|
+
regions?: ("ENAM" | "WNAM" | "EEUR" | "WEUR" | "APAC" | "SAM" | "ME" | "OC" | "AFR")[];
|
|
1053
|
+
/**
|
|
1054
|
+
* Restrict containers to compliance boundaries.
|
|
1055
|
+
*/
|
|
1056
|
+
jurisdiction?: "eu" | "fedramp";
|
|
1057
|
+
/**
|
|
1058
|
+
* @hidden
|
|
1059
|
+
*/
|
|
969
1060
|
cities?: string[];
|
|
970
1061
|
/**
|
|
971
1062
|
* @deprecated Use `tiers` instead
|
|
1063
|
+
* @hidden
|
|
972
1064
|
*/
|
|
973
1065
|
tier?: number;
|
|
1066
|
+
/**
|
|
1067
|
+
* @hidden
|
|
1068
|
+
*/
|
|
974
1069
|
tiers?: number[];
|
|
975
1070
|
};
|
|
976
1071
|
/**
|
|
@@ -1364,6 +1459,18 @@ interface EnvironmentInheritable {
|
|
|
1364
1459
|
*/
|
|
1365
1460
|
exclude: string[];
|
|
1366
1461
|
};
|
|
1462
|
+
/**
|
|
1463
|
+
* Configuration for Worker Previews.
|
|
1464
|
+
*
|
|
1465
|
+
* Previews are branches of your Worker's main instance used to test features
|
|
1466
|
+
* in development outside of production. This block defines the settings
|
|
1467
|
+
* used when creating Preview deployments via `wrangler preview`.
|
|
1468
|
+
*
|
|
1469
|
+
* For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#previews
|
|
1470
|
+
*
|
|
1471
|
+
* @inheritable
|
|
1472
|
+
*/
|
|
1473
|
+
previews: PreviewsConfig | undefined;
|
|
1367
1474
|
}
|
|
1368
1475
|
type DurableObjectBindings = {
|
|
1369
1476
|
/** The name of the binding used to refer to the Durable Object */
|
|
@@ -1386,6 +1493,11 @@ type WorkflowBinding = {
|
|
|
1386
1493
|
script_name?: string;
|
|
1387
1494
|
/** Whether the Workflow should be remote or not in local development */
|
|
1388
1495
|
remote?: boolean;
|
|
1496
|
+
/** Optional limits for the Workflow */
|
|
1497
|
+
limits?: {
|
|
1498
|
+
/** Maximum number of steps a Workflow instance can execute */
|
|
1499
|
+
steps?: number;
|
|
1500
|
+
};
|
|
1389
1501
|
};
|
|
1390
1502
|
/**
|
|
1391
1503
|
* The `EnvironmentNonInheritable` interface declares all the configuration fields for an environment
|
|
@@ -1418,20 +1530,18 @@ interface EnvironmentNonInheritable {
|
|
|
1418
1530
|
*/
|
|
1419
1531
|
vars: Record<string, string | Json>;
|
|
1420
1532
|
/**
|
|
1421
|
-
* Secrets configuration.
|
|
1533
|
+
* Secrets configuration (experimental).
|
|
1422
1534
|
*
|
|
1423
1535
|
* NOTE: This field is not automatically inherited from the top level environment,
|
|
1424
1536
|
* and so must be specified in every named environment.
|
|
1425
1537
|
*
|
|
1426
|
-
* @default undefined
|
|
1427
1538
|
* @nonInheritable
|
|
1428
1539
|
*/
|
|
1429
1540
|
secrets?: {
|
|
1430
1541
|
/**
|
|
1431
1542
|
* List of secret names that are required by your Worker.
|
|
1432
1543
|
* When defined, this property:
|
|
1433
|
-
* - Replaces .dev.vars/.env inference for type generation
|
|
1434
|
-
* - Enables deploy-time validation to ensure secrets are configured
|
|
1544
|
+
* - Replaces .dev.vars/.env/process.env inference for type generation
|
|
1435
1545
|
* - Enables local dev validation with warnings for missing secrets
|
|
1436
1546
|
*/
|
|
1437
1547
|
required?: string[];
|
|
@@ -1558,8 +1668,8 @@ interface EnvironmentNonInheritable {
|
|
|
1558
1668
|
consumers?: {
|
|
1559
1669
|
/** The name of the queue from which this consumer should consume. */
|
|
1560
1670
|
queue: string;
|
|
1561
|
-
/** The consumer type
|
|
1562
|
-
type?:
|
|
1671
|
+
/** The consumer type. Only "worker" is supported in wrangler config. Default is "worker". */
|
|
1672
|
+
type?: "worker";
|
|
1563
1673
|
/** The maximum number of messages per batch */
|
|
1564
1674
|
max_batch_size?: number;
|
|
1565
1675
|
/** The maximum number of seconds to wait to fill a batch with messages. */
|
|
@@ -1647,6 +1757,42 @@ interface EnvironmentNonInheritable {
|
|
|
1647
1757
|
/** Whether the Vectorize index should be remote or not in local development */
|
|
1648
1758
|
remote?: boolean;
|
|
1649
1759
|
}[];
|
|
1760
|
+
/**
|
|
1761
|
+
* Specifies AI Search namespace bindings that are bound to this Worker environment.
|
|
1762
|
+
* Each binding is scoped to a namespace and allows dynamic instance CRUD within it.
|
|
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
|
+
ai_search_namespaces: {
|
|
1771
|
+
/** The binding name used to refer to the AI Search namespace in the Worker. */
|
|
1772
|
+
binding: string;
|
|
1773
|
+
/** The user-chosen namespace name. Must exist in Cloudflare at deploy time. */
|
|
1774
|
+
namespace: string;
|
|
1775
|
+
/** Whether the AI Search namespace binding should be remote in local development */
|
|
1776
|
+
remote?: boolean;
|
|
1777
|
+
}[];
|
|
1778
|
+
/**
|
|
1779
|
+
* Specifies AI Search instance bindings that are bound to this Worker environment.
|
|
1780
|
+
* Each binding is bound directly to a single pre-existing instance within the "default" namespace.
|
|
1781
|
+
*
|
|
1782
|
+
* NOTE: This field is not automatically inherited from the top level environment,
|
|
1783
|
+
* and so must be specified in every named environment.
|
|
1784
|
+
*
|
|
1785
|
+
* @default []
|
|
1786
|
+
* @nonInheritable
|
|
1787
|
+
*/
|
|
1788
|
+
ai_search: {
|
|
1789
|
+
/** The binding name used to refer to the AI Search instance in the Worker. */
|
|
1790
|
+
binding: string;
|
|
1791
|
+
/** The user-chosen instance name. Must exist in Cloudflare at deploy time. */
|
|
1792
|
+
instance_name: string;
|
|
1793
|
+
/** Whether the AI Search instance binding should be remote in local development */
|
|
1794
|
+
remote?: boolean;
|
|
1795
|
+
}[];
|
|
1650
1796
|
/**
|
|
1651
1797
|
* Specifies Hyperdrive configs that are bound to this Worker environment.
|
|
1652
1798
|
*
|
|
@@ -1780,6 +1926,20 @@ interface EnvironmentNonInheritable {
|
|
|
1780
1926
|
/** Whether the Media binding should be remote or not */
|
|
1781
1927
|
remote?: boolean;
|
|
1782
1928
|
} | undefined;
|
|
1929
|
+
/**
|
|
1930
|
+
* Binding to Cloudflare Stream
|
|
1931
|
+
*
|
|
1932
|
+
* NOTE: This field is not automatically inherited from the top level environment,
|
|
1933
|
+
* and so must be specified in every named environment.
|
|
1934
|
+
*
|
|
1935
|
+
* @default {}
|
|
1936
|
+
* @nonInheritable
|
|
1937
|
+
*/
|
|
1938
|
+
stream: {
|
|
1939
|
+
binding: string;
|
|
1940
|
+
/** Whether the Stream binding should be remote or not in local development */
|
|
1941
|
+
remote?: boolean;
|
|
1942
|
+
} | undefined;
|
|
1783
1943
|
/**
|
|
1784
1944
|
* Binding to the Worker Version's metadata
|
|
1785
1945
|
*/
|
|
@@ -1916,6 +2076,24 @@ interface EnvironmentNonInheritable {
|
|
|
1916
2076
|
/** Name of the secret */
|
|
1917
2077
|
secret_name: string;
|
|
1918
2078
|
}[];
|
|
2079
|
+
/**
|
|
2080
|
+
* Specifies Artifacts bindings that are bound to this Worker environment.
|
|
2081
|
+
* Artifacts provides git-compatible file storage on Cloudflare Workers.
|
|
2082
|
+
*
|
|
2083
|
+
* NOTE: This field is not automatically inherited from the top level environment,
|
|
2084
|
+
* and so must be specified in every named environment.
|
|
2085
|
+
*
|
|
2086
|
+
* @default []
|
|
2087
|
+
* @nonInheritable
|
|
2088
|
+
*/
|
|
2089
|
+
artifacts: {
|
|
2090
|
+
/** The binding name used to refer to the Artifacts instance. */
|
|
2091
|
+
binding: string;
|
|
2092
|
+
/** The namespace to use. */
|
|
2093
|
+
namespace: string;
|
|
2094
|
+
/** Whether to use the remote Artifacts service in local dev. */
|
|
2095
|
+
remote?: boolean;
|
|
2096
|
+
}[];
|
|
1919
2097
|
/**
|
|
1920
2098
|
* **DO NOT USE**. Hello World Binding Config to serve as an explanatory example.
|
|
1921
2099
|
*
|
|
@@ -1931,6 +2109,23 @@ interface EnvironmentNonInheritable {
|
|
|
1931
2109
|
/** Whether the timer is enabled */
|
|
1932
2110
|
enable_timer?: boolean;
|
|
1933
2111
|
}[];
|
|
2112
|
+
/**
|
|
2113
|
+
* Specifies Flagship feature flag bindings that are bound to this Worker environment.
|
|
2114
|
+
*
|
|
2115
|
+
* NOTE: This field is not automatically inherited from the top level environment,
|
|
2116
|
+
* and so must be specified in every named environment.
|
|
2117
|
+
*
|
|
2118
|
+
* @default []
|
|
2119
|
+
* @nonInheritable
|
|
2120
|
+
*/
|
|
2121
|
+
flagship: {
|
|
2122
|
+
/** The binding name used to refer to the bound Flagship service. */
|
|
2123
|
+
binding: string;
|
|
2124
|
+
/** The Flagship app ID to bind to. */
|
|
2125
|
+
app_id: string;
|
|
2126
|
+
/** Whether to use the remote Flagship service for flag evaluation in local dev. */
|
|
2127
|
+
remote?: boolean;
|
|
2128
|
+
}[];
|
|
1934
2129
|
/**
|
|
1935
2130
|
* Specifies rate limit bindings that are bound to this Worker environment.
|
|
1936
2131
|
*
|
|
@@ -1983,6 +2178,30 @@ interface EnvironmentNonInheritable {
|
|
|
1983
2178
|
/** Whether the VPC service is remote or not */
|
|
1984
2179
|
remote?: boolean;
|
|
1985
2180
|
}[];
|
|
2181
|
+
/**
|
|
2182
|
+
* Specifies VPC networks that are bound to this Worker environment.
|
|
2183
|
+
*
|
|
2184
|
+
* NOTE: This field is not automatically inherited from the top level environment,
|
|
2185
|
+
* and so must be specified in every named environment.
|
|
2186
|
+
*
|
|
2187
|
+
* @default []
|
|
2188
|
+
* @nonInheritable
|
|
2189
|
+
*/
|
|
2190
|
+
vpc_networks: ({
|
|
2191
|
+
/** The binding name used to refer to the VPC network in the Worker. */
|
|
2192
|
+
binding: string;
|
|
2193
|
+
/** The tunnel ID of the Cloudflare Tunnel to route traffic through. Mutually exclusive with network_id. */
|
|
2194
|
+
tunnel_id: string;
|
|
2195
|
+
/** Whether the VPC network is remote or not */
|
|
2196
|
+
remote?: boolean;
|
|
2197
|
+
} | {
|
|
2198
|
+
/** The binding name used to refer to the VPC network in the Worker. */
|
|
2199
|
+
binding: string;
|
|
2200
|
+
/** The network ID to route traffic through. Mutually exclusive with tunnel_id. */
|
|
2201
|
+
network_id: string;
|
|
2202
|
+
/** Whether the VPC network is remote or not */
|
|
2203
|
+
remote?: boolean;
|
|
2204
|
+
})[];
|
|
1986
2205
|
}
|
|
1987
2206
|
/**
|
|
1988
2207
|
* The raw environment configuration that we read from the config file.
|
|
@@ -2092,10 +2311,27 @@ interface CacheOptions {
|
|
|
2092
2311
|
type DockerConfiguration = {
|
|
2093
2312
|
/** Socket used by miniflare to communicate with Docker */
|
|
2094
2313
|
socketPath: string;
|
|
2314
|
+
/** Docker image name for the container egress interceptor sidecar */
|
|
2315
|
+
containerEgressInterceptorImage?: string;
|
|
2095
2316
|
};
|
|
2096
2317
|
type ContainerEngine = {
|
|
2097
2318
|
localDocker: DockerConfiguration;
|
|
2098
2319
|
} | string;
|
|
2320
|
+
/**
|
|
2321
|
+
* Configuration for Worker Previews.
|
|
2322
|
+
*
|
|
2323
|
+
* This defines the settings used when creating Preview deployments.
|
|
2324
|
+
* Previews are branches of your Worker's main instance used to test features
|
|
2325
|
+
* during feature development outside of production.
|
|
2326
|
+
*
|
|
2327
|
+
* The `previews` block contains any intentionally divergent configuration intended solely for Previews, including:
|
|
2328
|
+
* - All non-inheritable properties (environment variables and bindings like KV, D1, R2, etc.)
|
|
2329
|
+
* - Select inheritable properties: `logpush`, `observability`, `limits`
|
|
2330
|
+
*
|
|
2331
|
+
* @inheritable
|
|
2332
|
+
*/
|
|
2333
|
+
interface PreviewsConfig extends Partial<EnvironmentNonInheritable>, Partial<Pick<EnvironmentInheritable, "logpush" | "observability" | "limits">> {
|
|
2334
|
+
}
|
|
2099
2335
|
|
|
2100
2336
|
/**
|
|
2101
2337
|
* This is the static type definition for the configuration object.
|
|
@@ -2343,4 +2579,4 @@ interface EnvironmentMap {
|
|
|
2343
2579
|
}
|
|
2344
2580
|
declare const defaultWranglerConfig: Config;
|
|
2345
2581
|
|
|
2346
|
-
export { type
|
|
2582
|
+
export { type CfAISearchNamespace as $, type Assets as A, type Binding as B, type Config 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 CfStreamBinding as K, type CfVersionMetadataBinding as L, type CfDataBlobBindings as M, type CfDurableObject as N, type Observability as O, type PreviewsConfig as P, type CfWorkflow as Q, type RawConfig as R, type StreamingTailConsumer as S, type TailConsumer as T, type UserLimits as U, type CfQueue as V, type WorkerMetadataBinding as W, type CfR2Bucket as X, type CfD1Database as Y, type ZoneIdRoute as Z, type CfVectorize as _, type RedirectedRawConfig as a, type CfAISearch as a0, type CfSecretsStoreSecrets as a1, type CfArtifacts as a2, type CfHelloWorld as a3, type CfFlagship as a4, type CfWorkerLoader as a5, type CfRateLimit as a6, type CfHyperdrive as a7, type CfService as a8, type CfVpcService as a9, INHERIT_SYMBOL as aA, SERVICE_TAG_PREFIX as aB, ENVIRONMENT_TAG_PREFIX as aC, PATH_TO_DEPLOY_CONFIG as aD, JSON_CONFIG_FORMATS as aE, type CfVpcNetwork as aa, type CfAnalyticsEngineDataset as ab, type CfDispatchNamespace as ac, type CfMTlsCertificate as ad, type CfLogfwdr as ae, type CfLogfwdrBinding as af, type CfAssetsBinding as ag, type CfPipeline as ah, type CfUnsafeBinding as ai, type CfCapnp as aj, type CfUnsafe as ak, type CfDurableObjectMigrations as al, type CfPlacement as am, type CfTailConsumer as an, type CfUserLimits as ao, type CfWorkerInit as ap, type CfWorkerContext as aq, type CfWorkerSourceMap as ar, type Json as as, type AssetConfigMetadata as at, type WorkerMetadata as au, type ServiceMetadataRes as av, type ServiceFetch as aw, type File as ax, type BinaryFile as ay, type Trigger as az, type RawDevConfig as b, type ConfigFields as c, type RawEnvironment as d, defaultWranglerConfig as e, type ZoneNameRoute as f, type CustomDomainRoute as g, type Route as h, type CloudchamberConfig as i, type ContainerApp as j, type DurableObjectBindings as k, type WorkflowBinding as l, type EnvironmentNonInheritable as m, type Rule as n, type ConfigModuleRuleType as o, type DispatchNamespaceOutbound as p, type CacheOptions as q, type DockerConfiguration as r, type ContainerEngine as s, type CfScriptFormat as t, type CfModuleType as u, type CfModule as v, type CfVars as w, type CfKvNamespace as x, type CfSendEmailBindings as y, type CfWasmModuleBindings as z };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { B as Binding, R as RawConfig, C as Config, W as WorkerMetadataBinding } from './config-
|
|
2
|
-
export {
|
|
1
|
+
import { B as Binding, R as RawConfig, C as Config, W as WorkerMetadataBinding } from './config-_M2XwEUI.mjs';
|
|
2
|
+
export { at as AssetConfigMetadata, A as Assets, ay as BinaryFile, q as CacheOptions, H as CfAIBinding, a0 as CfAISearch, $ as CfAISearchNamespace, ab as CfAnalyticsEngineDataset, a2 as CfArtifacts, ag as CfAssetsBinding, G as CfBrowserBinding, aj as CfCapnp, Y as CfD1Database, M as CfDataBlobBindings, ac as CfDispatchNamespace, N as CfDurableObject, al as CfDurableObjectMigrations, a4 as CfFlagship, a3 as CfHelloWorld, a7 as CfHyperdrive, I as CfImagesBinding, x as CfKvNamespace, ae as CfLogfwdr, af as CfLogfwdrBinding, ad as CfMTlsCertificate, J as CfMediaBinding, v as CfModule, u as CfModuleType, ah as CfPipeline, am as CfPlacement, V as CfQueue, X as CfR2Bucket, a6 as CfRateLimit, t as CfScriptFormat, a1 as CfSecretsStoreSecrets, y as CfSendEmailBindings, a8 as CfService, K as CfStreamBinding, an as CfTailConsumer, F as CfTextBlobBindings, ak as CfUnsafe, ai as CfUnsafeBinding, ao as CfUserLimits, w as CfVars, _ as CfVectorize, L as CfVersionMetadataBinding, aa as CfVpcNetwork, a9 as CfVpcService, z as CfWasmModuleBindings, aq as CfWorkerContext, ap as CfWorkerInit, a5 as CfWorkerLoader, ar as CfWorkerSourceMap, Q as CfWorkflow, i as CloudchamberConfig, c as ConfigFields, o as ConfigModuleRuleType, j as ContainerApp, s as ContainerEngine, g as CustomDomainRoute, p as DispatchNamespaceOutbound, r as DockerConfiguration, k as DurableObjectBindings, D as DurableObjectMigration, aC as ENVIRONMENT_TAG_PREFIX, E as Environment, m as EnvironmentNonInheritable, ax as File, aA as INHERIT_SYMBOL, aE as JSON_CONFIG_FORMATS, as as Json, O as Observability, aD as PATH_TO_DEPLOY_CONFIG, P as PreviewsConfig, b as RawDevConfig, d as RawEnvironment, a as RedirectedRawConfig, h as Route, n as Rule, aB as SERVICE_TAG_PREFIX, aw as ServiceFetch, av as ServiceMetadataRes, S as StreamingTailConsumer, T as TailConsumer, az as Trigger, U as UserLimits, au as WorkerMetadata, l as WorkflowBinding, Z as ZoneIdRoute, f as ZoneNameRoute, e as defaultWranglerConfig } from './config-_M2XwEUI.mjs';
|
|
3
3
|
import * as jsoncParser from 'jsonc-parser';
|
|
4
4
|
export { constructWranglerConfig } from './browser.mjs';
|
|
5
|
+
export { Counter, MetricsRegistry } from './prometheus-metrics.mjs';
|
|
5
6
|
import '@cloudflare/workers-shared';
|
|
6
7
|
import 'cloudflare';
|
|
7
8
|
|
|
@@ -49,6 +50,8 @@ declare class Diagnostics {
|
|
|
49
50
|
errors: string[];
|
|
50
51
|
warnings: string[];
|
|
51
52
|
children: Diagnostics[];
|
|
53
|
+
/** Set to true when an unexpected/unknown field is encountered during validation. */
|
|
54
|
+
hasUnexpectedFields: boolean;
|
|
52
55
|
/**
|
|
53
56
|
* Create a new Diagnostics object.
|
|
54
57
|
* @param description A general description of this collection of messages.
|
|
@@ -60,6 +63,8 @@ declare class Diagnostics {
|
|
|
60
63
|
addChild(diagnostics: Diagnostics): void;
|
|
61
64
|
/** Does this or any of its children have errors. */
|
|
62
65
|
hasErrors(): boolean;
|
|
66
|
+
/** Does this or any of its children have unexpected fields. */
|
|
67
|
+
hasUnexpectedFieldsInTree(): boolean;
|
|
63
68
|
/** Render the errors of this and all its children. */
|
|
64
69
|
renderErrors(): string;
|
|
65
70
|
/** Does this or any of its children have warnings. */
|
|
@@ -83,7 +88,7 @@ declare const bucketFormatMessage = "Bucket names must begin and end with an alp
|
|
|
83
88
|
* Config field names for bindings (e.g., "kv_namespaces", "d1_databases").
|
|
84
89
|
* These are the keys used in Wrangler's config file
|
|
85
90
|
*/
|
|
86
|
-
type ConfigBindingFieldName = "data_blobs" | "durable_objects" | "kv_namespaces" | "send_email" | "queues" | "d1_databases" | "vectorize" | "hyperdrive" | "r2_buckets" | "logfwdr" | "services" | "analytics_engine_datasets" | "text_blobs" | "browser" | "ai" | "images" | "media" | "version_metadata" | "unsafe" | "vars" | "wasm_modules" | "dispatch_namespaces" | "mtls_certificates" | "workflows" | "pipelines" | "secrets_store_secrets" | "ratelimits" | "assets" | "unsafe_hello_world" | "worker_loaders" | "vpc_services";
|
|
91
|
+
type ConfigBindingFieldName = "data_blobs" | "durable_objects" | "kv_namespaces" | "send_email" | "queues" | "d1_databases" | "vectorize" | "ai_search_namespaces" | "ai_search" | "hyperdrive" | "r2_buckets" | "logfwdr" | "services" | "analytics_engine_datasets" | "text_blobs" | "browser" | "ai" | "images" | "stream" | "media" | "version_metadata" | "unsafe" | "vars" | "wasm_modules" | "dispatch_namespaces" | "mtls_certificates" | "workflows" | "pipelines" | "secrets_store_secrets" | "artifacts" | "ratelimits" | "assets" | "unsafe_hello_world" | "flagship" | "worker_loaders" | "vpc_services" | "vpc_networks";
|
|
87
92
|
/**
|
|
88
93
|
* @deprecated new code should use getBindingTypeFriendlyName() instead
|
|
89
94
|
*/
|
|
@@ -133,6 +138,8 @@ declare function normalizeAndValidateConfig(rawConfig: RawConfig, configPath: st
|
|
|
133
138
|
*/
|
|
134
139
|
declare function isDockerfile(imagePath: string, configPath: string | undefined): boolean;
|
|
135
140
|
|
|
141
|
+
type ConfigBindingOptions = Pick<Config, "ai" | "browser" | "d1_databases" | "dispatch_namespaces" | "durable_objects" | "queues" | "r2_buckets" | "services" | "kv_namespaces" | "mtls_certificates" | "vectorize" | "workflows" | "vpc_services">;
|
|
142
|
+
|
|
136
143
|
declare function configFormat(configPath: string | undefined): "json" | "jsonc" | "toml" | "none";
|
|
137
144
|
declare function configFileName(configPath: string | undefined): "wrangler.json" | "wrangler.jsonc" | "wrangler.toml" | "Wrangler configuration";
|
|
138
145
|
declare function formatConfigSnippet(snippet: RawConfig, configPath: Config["configPath"], formatted?: boolean): string;
|
|
@@ -252,6 +259,7 @@ declare class APIError extends ParseError {
|
|
|
252
259
|
constructor({ status, ...rest }: Message & {
|
|
253
260
|
status?: number;
|
|
254
261
|
});
|
|
262
|
+
get status(): number | undefined;
|
|
255
263
|
isGatewayError(): boolean;
|
|
256
264
|
isRetryable(): boolean;
|
|
257
265
|
get reportable(): boolean;
|
|
@@ -432,6 +440,8 @@ type VariableNames =
|
|
|
432
440
|
| "CLOUDFLARE_ENV"
|
|
433
441
|
/** Custom directory for Wrangler's cache files (overrides `node_modules/.cache/wrangler`). */
|
|
434
442
|
| "WRANGLER_CACHE_DIR"
|
|
443
|
+
/** Custom path to cloudflared binary (overrides automatic binary management). */
|
|
444
|
+
| "CLOUDFLARED_PATH"
|
|
435
445
|
/** Set to "staging" to use staging APIs instead of production. */
|
|
436
446
|
| "WRANGLER_API_ENVIRONMENT"
|
|
437
447
|
/** Custom auth domain (usually auto-configured). */
|
|
@@ -446,8 +456,14 @@ type VariableNames =
|
|
|
446
456
|
| "WRANGLER_REVOKE_URL"
|
|
447
457
|
/** Direct authorization token for API requests. */
|
|
448
458
|
| "WRANGLER_CF_AUTHORIZATION_TOKEN"
|
|
459
|
+
/** Cloudflare Access Service Token Client ID. Used to authenticate with Access-protected domains in non-interactive environments (e.g. CI). */
|
|
460
|
+
| "CLOUDFLARE_ACCESS_CLIENT_ID"
|
|
461
|
+
/** Cloudflare Access Service Token Client Secret. Used with CLOUDFLARE_ACCESS_CLIENT_ID. */
|
|
462
|
+
| "CLOUDFLARE_ACCESS_CLIENT_SECRET"
|
|
449
463
|
/** Enable the local explorer UI at /cdn-cgi/explorer (experimental, default: false). */
|
|
450
464
|
| "X_LOCAL_EXPLORER"
|
|
465
|
+
/** Open the browser in headful (visible) mode when using the Browser Run API in local dev (default: false). */
|
|
466
|
+
| "X_BROWSER_HEADFUL"
|
|
451
467
|
/** Override command used by `wrangler init` (default: "create cloudflare"). */
|
|
452
468
|
| "WRANGLER_C3_COMMAND"
|
|
453
469
|
/** Enable/disable telemetry data collection. */
|
|
@@ -694,9 +710,23 @@ declare const getCloudflareEnv: () => string | undefined;
|
|
|
694
710
|
declare const getOpenNextDeployFromEnv: () => string | undefined;
|
|
695
711
|
/**
|
|
696
712
|
* `X_LOCAL_EXPLORER` enables the local explorer UI at /cdn-cgi/explorer.
|
|
697
|
-
* This is an experimental feature flag. Defaults to false when not set.
|
|
698
713
|
*/
|
|
699
714
|
declare const getLocalExplorerEnabledFromEnv: () => boolean;
|
|
715
|
+
/**
|
|
716
|
+
* `X_BROWSER_HEADFUL` opens the browser in headful (visible) mode when using the
|
|
717
|
+
* Browser Run API in local development.
|
|
718
|
+
*
|
|
719
|
+
* Set to "true" to enable:
|
|
720
|
+
*
|
|
721
|
+
* ```sh
|
|
722
|
+
* X_BROWSER_HEADFUL=true vite dev
|
|
723
|
+
* ```
|
|
724
|
+
*
|
|
725
|
+
* Note: when using `@cloudflare/playwright`, two Chrome windows may appear — the initial blank
|
|
726
|
+
* page and the one created by `browser.newPage()`. This is expected due to how Playwright handles
|
|
727
|
+
* browser contexts via CDP.
|
|
728
|
+
*/
|
|
729
|
+
declare const getBrowserRenderingHeadfulFromEnv: () => boolean;
|
|
700
730
|
/**
|
|
701
731
|
* `CLOUDFLARE_CF_FETCH_ENABLED` controls whether Miniflare fetches the `cf.json` file
|
|
702
732
|
* containing request.cf properties from workers.cloudflare.com.
|
|
@@ -733,6 +763,13 @@ declare const getCfFetchPathFromEnv: () => string | undefined;
|
|
|
733
763
|
* Useful for Yarn PnP or projects without node_modules.
|
|
734
764
|
*/
|
|
735
765
|
declare const getWranglerCacheDirFromEnv: () => string | undefined;
|
|
766
|
+
/**
|
|
767
|
+
* `CLOUDFLARED_PATH` specifies a custom path to a cloudflared binary.
|
|
768
|
+
*
|
|
769
|
+
* If set, Wrangler will use this cloudflared binary instead of downloading one.
|
|
770
|
+
* The path must point to an existing executable file.
|
|
771
|
+
*/
|
|
772
|
+
declare const getCloudflaredPathFromEnv: () => string | undefined;
|
|
736
773
|
|
|
737
774
|
declare function getGlobalWranglerConfigPath(): string;
|
|
738
775
|
|
|
@@ -743,24 +780,6 @@ type DD = `${number}${number}`;
|
|
|
743
780
|
* Represents a valid compatibility date, a string such as `2025-09-27`
|
|
744
781
|
*/
|
|
745
782
|
type CompatDate = `${YYYY}-${MM}-${DD}`;
|
|
746
|
-
type GetCompatDateOptions = {
|
|
747
|
-
projectPath?: string;
|
|
748
|
-
};
|
|
749
|
-
type GetCompatDateResult = {
|
|
750
|
-
date: CompatDate;
|
|
751
|
-
source: "workerd" | "fallback";
|
|
752
|
-
};
|
|
753
|
-
/**
|
|
754
|
-
* Gets the compatibility date of the locally installed workerd package.
|
|
755
|
-
*
|
|
756
|
-
* If the package is not found the fallback date of 2025-09-27 is returned instead.
|
|
757
|
-
*
|
|
758
|
-
* Additionally, if the workerd date is set to the future then the current date is returned instead.
|
|
759
|
-
*
|
|
760
|
-
* @param options.projectPath the path to the project
|
|
761
|
-
* @returns an object including the compatibility date and its source
|
|
762
|
-
*/
|
|
763
|
-
declare function getLocalWorkerdCompatibilityDate({ projectPath, }?: GetCompatDateOptions): GetCompatDateResult;
|
|
764
783
|
/**
|
|
765
784
|
* Discern whether a string represents a compatibility date (`YYYY-MM-DD`)
|
|
766
785
|
*
|
|
@@ -769,12 +788,9 @@ declare function getLocalWorkerdCompatibilityDate({ projectPath, }?: GetCompatDa
|
|
|
769
788
|
*/
|
|
770
789
|
declare function isCompatDate(str: string): str is CompatDate;
|
|
771
790
|
/**
|
|
772
|
-
* Returns
|
|
773
|
-
*
|
|
774
|
-
* @param date The target date to convert
|
|
775
|
-
* @returns The date as a CompatDate string (a string following the format `YYYY-MM-DD`)
|
|
791
|
+
* Returns today's date as a compatibility date string (`YYYY-MM-DD`).
|
|
776
792
|
*/
|
|
777
|
-
declare function
|
|
793
|
+
declare function getTodaysCompatDate(): CompatDate;
|
|
778
794
|
|
|
779
795
|
/**
|
|
780
796
|
* Returns whether the given path is a directory
|
|
@@ -815,4 +831,4 @@ declare function removeDir(dirPath: string, options?: {
|
|
|
815
831
|
*/
|
|
816
832
|
declare function removeDirSync(dirPath: string): void;
|
|
817
833
|
|
|
818
|
-
export { APIError, Binding, COMPLIANCE_REGION_CONFIG_PUBLIC, COMPLIANCE_REGION_CONFIG_UNKNOWN, CommandLineArgsError, type CompatDate, type ComplianceConfig, Config, type ConfigBindingFieldName, DeprecationError, FatalError, JsonFriendlyFatalError, type Location, type Message, MissingConfigError, type NormalizeAndValidateConfigArgs, type PackageJSON, ParseError, type ParseFile, PatchConfigError, RawConfig, type ResolveConfigPathOptions, type TelemetryMessage, UserError, WorkerMetadataBinding, assertNever, bucketFormatMessage, configFileName, configFormat, createFatalError, experimental_patchConfig, experimental_readRawConfig, findWranglerConfig,
|
|
834
|
+
export { APIError, Binding, COMPLIANCE_REGION_CONFIG_PUBLIC, COMPLIANCE_REGION_CONFIG_UNKNOWN, CommandLineArgsError, type CompatDate, type ComplianceConfig, Config, type ConfigBindingFieldName, type ConfigBindingOptions, DeprecationError, Diagnostics, FatalError, JsonFriendlyFatalError, type Location, type Message, MissingConfigError, type NormalizeAndValidateConfigArgs, type PackageJSON, ParseError, type ParseFile, PatchConfigError, RawConfig, type ResolveConfigPathOptions, type TelemetryMessage, UserError, WorkerMetadataBinding, assertNever, bucketFormatMessage, configFileName, configFormat, createFatalError, experimental_patchConfig, experimental_readRawConfig, findWranglerConfig, formatConfigSnippet, friendlyBindingNames, getBindingTypeFriendlyName, getBooleanEnvironmentVariableFactory, getBrowserRenderingHeadfulFromEnv, getBuildConditionsFromEnv, getBuildPlatformFromEnv, getC3CommandFromEnv, getCIGeneratePreviewAlias, getCIMatchTag, getCIOverrideName, getCIOverrideNetworkModeHost, getCfFetchEnabledFromEnv, getCfFetchPathFromEnv, getCloudflareApiBaseUrl, getCloudflareApiEnvironmentFromEnv, getCloudflareComplianceRegion, getCloudflareEnv, getCloudflareIncludeProcessEnvFromEnv, getCloudflareLoadDevVarsFromDotEnv, getCloudflaredPathFromEnv, getComplianceRegionSubdomain, getD1ExtraLocationChoices, getDisableConfigWatching, getDockerPath, getEnvironmentVariableFactory, getGlobalWranglerConfigPath, getLocalExplorerEnabledFromEnv, getOpenNextDeployFromEnv, getOutputFileDirectoryFromEnv, getOutputFilePathFromEnv, getRegistryPath, getSanitizeLogs, getSubdomainMixedStateCheckDisabled, getTodaysCompatDate, getTraceHeader, getWorkersCIBranchName, getWranglerCacheDirFromEnv, getWranglerHideBanner, getWranglerSendErrorReportsFromEnv, getWranglerSendMetricsFromEnv, hasProperty, indexLocation, isCompatDate, isDirectory, isDockerfile, isOptionalProperty, isPagesConfig, isRequiredProperty, isValidR2BucketName, mapWorkerMetadataBindings, normalizeAndValidateConfig, parseByteSize, parseHumanDuration, parseJSON, parseJSONC, parseNonHyphenedUuid, parsePackageJSON, parseTOML, readFileSync, readFileSyncToBuffer, removeDir, removeDirSync, resolveWranglerConfigPath, searchLocation, validatePagesConfig };
|