wrangler 4.34.0 → 4.36.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.
@@ -9,6 +9,7 @@ import Protocol from 'devtools-protocol/types/protocol-mapping';
9
9
  import { ContainerNormalizedConfig } from '@cloudflare/containers-shared';
10
10
  import { IncomingRequestCfProperties } from '@cloudflare/workers-types/experimental';
11
11
  import { URLSearchParams } from 'node:url';
12
+ import Cloudflare from 'cloudflare';
12
13
 
13
14
  /**
14
15
  * The `Environment` interface declares all the configuration fields that
@@ -45,6 +46,35 @@ type CloudchamberConfig = {
45
46
  memory?: string;
46
47
  ipv4?: boolean;
47
48
  };
49
+ type UnsafeBinding = {
50
+ /**
51
+ * The name of the binding provided to the Worker
52
+ */
53
+ name: string;
54
+ /**
55
+ * The 'type' of the unsafe binding.
56
+ */
57
+ type: string;
58
+ dev?: {
59
+ plugin: {
60
+ /**
61
+ * Package is the bare specifier of the package that exposes plugins to integrate into Miniflare via a named `plugins` export.
62
+ * @example "@cloudflare/my-external-miniflare-plugin"
63
+ */
64
+ package: string;
65
+ /**
66
+ * Plugin is the name of the plugin exposed by the package.
67
+ * @example "MY_UNSAFE_PLUGIN"
68
+ */
69
+ name: string;
70
+ };
71
+ /**
72
+ * Optional mapping of unsafe bindings names to options provided for the plugin.
73
+ */
74
+ options?: Record<string, unknown>;
75
+ };
76
+ [key: string]: unknown;
77
+ };
48
78
  /**
49
79
  * Configuration for a container application
50
80
  */
@@ -517,8 +547,8 @@ type WorkflowBinding = {
517
547
  class_name: string;
518
548
  /** The script where the Workflow is defined (if it's external to this Worker) */
519
549
  script_name?: string;
520
- /** Whether the Workflow should be remote or not (only available under `--x-remote-bindings`) */
521
- experimental_remote?: boolean;
550
+ /** Whether the Workflow should be remote or not */
551
+ remote?: boolean;
522
552
  };
523
553
  /**
524
554
  * The `EnvironmentNonInheritable` interface declares all the configuration fields for an environment
@@ -619,8 +649,8 @@ interface EnvironmentNonInheritable {
619
649
  id?: string;
620
650
  /** The ID of the KV namespace used during `wrangler dev` */
621
651
  preview_id?: string;
622
- /** Whether the KV namespace should be remote or not (only available under `--x-remote-bindings`) */
623
- experimental_remote?: boolean;
652
+ /** Whether the KV namespace should be remote or not */
653
+ remote?: boolean;
624
654
  }[];
625
655
  /**
626
656
  * These specify bindings to send email from inside your Worker.
@@ -640,6 +670,8 @@ interface EnvironmentNonInheritable {
640
670
  destination_address?: string;
641
671
  /** If this binding should be restricted to a set of verified addresses */
642
672
  allowed_destination_addresses?: string[];
673
+ /** Whether the binding should be remote or not */
674
+ remote?: boolean;
643
675
  }[];
644
676
  /**
645
677
  * Specifies Queues that are bound to this Worker environment.
@@ -661,8 +693,8 @@ interface EnvironmentNonInheritable {
661
693
  queue: string;
662
694
  /** The number of seconds to wait before delivering a message */
663
695
  delivery_delay?: number;
664
- /** Whether the Queue producer should be remote or not (only available under `--x-remote-bindings`) */
665
- experimental_remote?: boolean;
696
+ /** Whether the Queue producer should be remote or not */
697
+ remote?: boolean;
666
698
  }[];
667
699
  /** Consumer configuration */
668
700
  consumers?: {
@@ -706,8 +738,8 @@ interface EnvironmentNonInheritable {
706
738
  preview_bucket_name?: string;
707
739
  /** The jurisdiction that the bucket exists in. Default if not present. */
708
740
  jurisdiction?: string;
709
- /** Whether the R2 bucket should be remote or not (only available under `--x-remote-bindings`) */
710
- experimental_remote?: boolean;
741
+ /** Whether the R2 bucket should be remote or not */
742
+ remote?: boolean;
711
743
  }[];
712
744
  /**
713
745
  * Specifies D1 databases that are bound to this Worker environment.
@@ -735,8 +767,8 @@ interface EnvironmentNonInheritable {
735
767
  migrations_dir?: string;
736
768
  /** Internal use only. */
737
769
  database_internal_env?: string;
738
- /** Whether the D1 database should be remote or not (only available under `--x-remote-bindings`) */
739
- experimental_remote?: boolean;
770
+ /** Whether the D1 database should be remote or not */
771
+ remote?: boolean;
740
772
  }[];
741
773
  /**
742
774
  * Specifies Vectorize indexes that are bound to this Worker environment.
@@ -754,8 +786,8 @@ interface EnvironmentNonInheritable {
754
786
  binding: string;
755
787
  /** The name of the index. */
756
788
  index_name: string;
757
- /** Whether the Vectorize index should be remote or not (only available under `--x-remote-bindings`) */
758
- experimental_remote?: boolean;
789
+ /** Whether the Vectorize index should be remote or not */
790
+ remote?: boolean;
759
791
  }[];
760
792
  /**
761
793
  * Specifies Hyperdrive configs that are bound to this Worker environment.
@@ -807,8 +839,8 @@ interface EnvironmentNonInheritable {
807
839
  entrypoint?: string;
808
840
  /** Optional properties that will be made available to the service via ctx.props. */
809
841
  props?: Record<string, unknown>;
810
- /** Whether the service binding should be remote or not (only available under `--x-remote-bindings`) */
811
- experimental_remote?: boolean;
842
+ /** Whether the service binding should be remote or not */
843
+ remote?: boolean;
812
844
  }[] | undefined;
813
845
  /**
814
846
  * Specifies analytics engine datasets that are bound to this Worker environment.
@@ -840,8 +872,8 @@ interface EnvironmentNonInheritable {
840
872
  */
841
873
  browser: {
842
874
  binding: string;
843
- /** Whether the Browser binding should be remote or not (only available under `--x-remote-bindings`) */
844
- experimental_remote?: boolean;
875
+ /** Whether the Browser binding should be remote or not */
876
+ remote?: boolean;
845
877
  } | undefined;
846
878
  /**
847
879
  * Binding to the AI project.
@@ -857,8 +889,8 @@ interface EnvironmentNonInheritable {
857
889
  ai: {
858
890
  binding: string;
859
891
  staging?: boolean;
860
- /** Whether the AI binding should be remote or not (only available under `--x-remote-bindings`) */
861
- experimental_remote?: boolean;
892
+ /** Whether the AI binding should be remote or not */
893
+ remote?: boolean;
862
894
  } | undefined;
863
895
  /**
864
896
  * Binding to Cloudflare Images
@@ -873,8 +905,8 @@ interface EnvironmentNonInheritable {
873
905
  */
874
906
  images: {
875
907
  binding: string;
876
- /** Whether the Images binding should be remote or not (only available under `--x-remote-bindings`) */
877
- experimental_remote?: boolean;
908
+ /** Whether the Images binding should be remote or not */
909
+ remote?: boolean;
878
910
  } | undefined;
879
911
  /**
880
912
  * Binding to the Worker Version's metadata
@@ -897,11 +929,7 @@ interface EnvironmentNonInheritable {
897
929
  * can be used to implement bindings for features that haven't released and aren't supported
898
930
  * directly by wrangler or miniflare.
899
931
  */
900
- bindings?: {
901
- name: string;
902
- type: string;
903
- [key: string]: unknown;
904
- }[];
932
+ bindings?: UnsafeBinding[];
905
933
  /**
906
934
  * Arbitrary key/value pairs that will be included in the uploaded metadata. Values specified
907
935
  * here will always be applied to metadata last, so can add new or override existing fields.
@@ -938,8 +966,8 @@ interface EnvironmentNonInheritable {
938
966
  binding: string;
939
967
  /** The uuid of the uploaded mTLS certificate */
940
968
  certificate_id: string;
941
- /** Whether the mtls fetcher should be remote or not (only available under `--x-remote-bindings`) */
942
- experimental_remote?: boolean;
969
+ /** Whether the mtls fetcher should be remote or not */
970
+ remote?: boolean;
943
971
  }[];
944
972
  /**
945
973
  * Specifies a list of Tail Workers that are bound to this Worker environment
@@ -969,8 +997,8 @@ interface EnvironmentNonInheritable {
969
997
  namespace: string;
970
998
  /** Details about the outbound Worker which will handle outbound requests from your namespace */
971
999
  outbound?: DispatchNamespaceOutbound;
972
- /** Whether the Dispatch Namespace should be remote or not (only available under `--x-remote-bindings`) */
973
- experimental_remote?: boolean;
1000
+ /** Whether the Dispatch Namespace should be remote or not */
1001
+ remote?: boolean;
974
1002
  }[];
975
1003
  /**
976
1004
  * Specifies list of Pipelines bound to this Worker environment
@@ -1019,6 +1047,28 @@ interface EnvironmentNonInheritable {
1019
1047
  /** Whether the timer is enabled */
1020
1048
  enable_timer?: boolean;
1021
1049
  }[];
1050
+ /**
1051
+ * Specifies rate limit bindings that are bound to this Worker environment.
1052
+ *
1053
+ * NOTE: This field is not automatically inherited from the top level environment,
1054
+ * and so must be specified in every named environment.
1055
+ *
1056
+ * @default []
1057
+ * @nonInheritable
1058
+ */
1059
+ ratelimits: {
1060
+ /** The binding name used to refer to the rate limiter in the Worker. */
1061
+ name: string;
1062
+ /** The namespace ID for this rate limiter. */
1063
+ namespace_id: string;
1064
+ /** Simple rate limiting configuration. */
1065
+ simple: {
1066
+ /** The maximum number of requests allowed in the time period. */
1067
+ limit: number;
1068
+ /** The time period in seconds (10 for ten seconds, 60 for one minute). */
1069
+ period: 10 | 60;
1070
+ };
1071
+ }[];
1022
1072
  }
1023
1073
  /**
1024
1074
  * The raw environment configuration that we read from the config file.
@@ -1084,6 +1134,35 @@ interface Observability {
1084
1134
  head_sampling_rate?: number;
1085
1135
  /** Set to false to disable invocation logs */
1086
1136
  invocation_logs?: boolean;
1137
+ /**
1138
+ * If logs should be persisted to the Cloudflare observability platform where they can be queried in the dashboard.
1139
+ *
1140
+ * @default true
1141
+ */
1142
+ persist?: boolean;
1143
+ /**
1144
+ * What destinations logs emitted from the Worker should be sent to.
1145
+ *
1146
+ * @default []
1147
+ */
1148
+ destinations?: string[];
1149
+ };
1150
+ traces?: {
1151
+ enabled?: boolean;
1152
+ /** The sampling rate */
1153
+ head_sampling_rate?: number;
1154
+ /**
1155
+ * If traces should be persisted to the Cloudflare observability platform where they can be queried in the dashboard.
1156
+ *
1157
+ * @default true
1158
+ */
1159
+ persist?: boolean;
1160
+ /**
1161
+ * What destinations traces emitted from the Worker should be sent to.
1162
+ *
1163
+ * @default []
1164
+ */
1165
+ destinations?: string[];
1087
1166
  };
1088
1167
  }
1089
1168
  type DockerConfiguration = {
@@ -1157,7 +1236,7 @@ interface CfModule {
1157
1236
  interface CfKvNamespace {
1158
1237
  binding: string;
1159
1238
  id?: string | typeof INHERIT_SYMBOL;
1160
- experimental_remote?: boolean;
1239
+ remote?: boolean;
1161
1240
  raw?: boolean;
1162
1241
  }
1163
1242
  /**
@@ -1165,7 +1244,7 @@ interface CfKvNamespace {
1165
1244
  */
1166
1245
  type CfSendEmailBindings = {
1167
1246
  name: string;
1168
- experimental_remote?: boolean;
1247
+ remote?: boolean;
1169
1248
  } & ({
1170
1249
  destination_address?: string;
1171
1250
  } | {
@@ -1177,7 +1256,7 @@ type CfSendEmailBindings = {
1177
1256
  interface CfAIBinding {
1178
1257
  binding: string;
1179
1258
  staging?: boolean;
1180
- experimental_remote?: boolean;
1259
+ remote?: boolean;
1181
1260
  raw?: boolean;
1182
1261
  }
1183
1262
  /**
@@ -1194,21 +1273,21 @@ interface CfWorkflow {
1194
1273
  class_name: string;
1195
1274
  binding: string;
1196
1275
  script_name?: string;
1197
- experimental_remote?: boolean;
1276
+ remote?: boolean;
1198
1277
  raw?: boolean;
1199
1278
  }
1200
1279
  interface CfQueue {
1201
1280
  binding: string;
1202
1281
  queue_name: string;
1203
1282
  delivery_delay?: number;
1204
- experimental_remote?: boolean;
1283
+ remote?: boolean;
1205
1284
  raw?: boolean;
1206
1285
  }
1207
1286
  interface CfR2Bucket {
1208
1287
  binding: string;
1209
1288
  bucket_name?: string | typeof INHERIT_SYMBOL;
1210
1289
  jurisdiction?: string;
1211
- experimental_remote?: boolean;
1290
+ remote?: boolean;
1212
1291
  raw?: boolean;
1213
1292
  }
1214
1293
  interface CfD1Database {
@@ -1219,14 +1298,14 @@ interface CfD1Database {
1219
1298
  database_internal_env?: string;
1220
1299
  migrations_table?: string;
1221
1300
  migrations_dir?: string;
1222
- experimental_remote?: boolean;
1301
+ remote?: boolean;
1223
1302
  raw?: boolean;
1224
1303
  }
1225
1304
  interface CfVectorize {
1226
1305
  binding: string;
1227
1306
  index_name: string;
1228
1307
  raw?: boolean;
1229
- experimental_remote?: boolean;
1308
+ remote?: boolean;
1230
1309
  }
1231
1310
  interface CfSecretsStoreSecrets {
1232
1311
  binding: string;
@@ -1237,6 +1316,14 @@ interface CfHelloWorld {
1237
1316
  binding: string;
1238
1317
  enable_timer?: boolean;
1239
1318
  }
1319
+ interface CfRateLimit {
1320
+ name: string;
1321
+ namespace_id: string;
1322
+ simple: {
1323
+ limit: number;
1324
+ period: 10 | 60;
1325
+ };
1326
+ }
1240
1327
  interface CfHyperdrive {
1241
1328
  binding: string;
1242
1329
  id: string;
@@ -1248,7 +1335,7 @@ interface CfService {
1248
1335
  environment?: string;
1249
1336
  entrypoint?: string;
1250
1337
  props?: Record<string, unknown>;
1251
- experimental_remote?: boolean;
1338
+ remote?: boolean;
1252
1339
  }
1253
1340
  interface CfAnalyticsEngineDataset {
1254
1341
  binding: string;
@@ -1262,12 +1349,12 @@ interface CfDispatchNamespace {
1262
1349
  environment?: string;
1263
1350
  parameters?: string[];
1264
1351
  };
1265
- experimental_remote?: boolean;
1352
+ remote?: boolean;
1266
1353
  }
1267
1354
  interface CfMTlsCertificate {
1268
1355
  binding: string;
1269
1356
  certificate_id: string;
1270
- experimental_remote?: boolean;
1357
+ remote?: boolean;
1271
1358
  }
1272
1359
  interface CfLogfwdrBinding {
1273
1360
  name: string;
@@ -1276,11 +1363,29 @@ interface CfLogfwdrBinding {
1276
1363
  interface CfPipeline {
1277
1364
  binding: string;
1278
1365
  pipeline: string;
1279
- experimental_remote?: boolean;
1366
+ remote?: boolean;
1280
1367
  }
1281
1368
  interface CfUnsafeBinding {
1282
1369
  name: string;
1283
1370
  type: string;
1371
+ dev?: {
1372
+ plugin: {
1373
+ /**
1374
+ * Package is the bare specifier of the package that exposes plugins to integrate into Miniflare via a named `plugins` export.
1375
+ * @example "@cloudflare/my-external-miniflare-plugin"
1376
+ */
1377
+ package: string;
1378
+ /**
1379
+ * Plugin is the name of the plugin exposed by the package.
1380
+ * @example "my-unsafe-plugin"
1381
+ */
1382
+ name: string;
1383
+ };
1384
+ /**
1385
+ * dev-only options to pass to the plugin.
1386
+ */
1387
+ options?: Record<string, unknown>;
1388
+ };
1284
1389
  }
1285
1390
  type CfUnsafeMetadata = Record<string, unknown>;
1286
1391
  type CfCapnp = {
@@ -1597,6 +1702,7 @@ type ReadConfigCommandArgs = NormalizeAndValidateConfigArgs & {
1597
1702
  };
1598
1703
  type ReadConfigOptions = ResolveConfigPathOptions & {
1599
1704
  hideWarnings?: boolean;
1705
+ preserveOriginalMain?: boolean;
1600
1706
  };
1601
1707
  type ConfigBindingOptions = Pick<Config, "ai" | "browser" | "d1_databases" | "dispatch_namespaces" | "durable_objects" | "queues" | "r2_buckets" | "services" | "kv_namespaces" | "mtls_certificates" | "vectorize" | "workflows">;
1602
1708
  /**
@@ -2067,7 +2173,7 @@ interface StartDevWorkerInput {
2067
2173
  watch?: boolean;
2068
2174
  /** Whether a script tag is inserted on text/html responses which will reload the page upon file changes. Defaults to false. */
2069
2175
  liveReload?: boolean;
2070
- /** The local address to reach your worker. Applies to experimental_remote: true (remote mode) and remote: false (local mode). */
2176
+ /** The local address to reach your worker. Applies to remote: true (remote mode) and remote: false (local mode). */
2071
2177
  server?: {
2072
2178
  hostname?: string;
2073
2179
  port?: number;
@@ -2228,7 +2334,9 @@ type Binding = {
2228
2334
  type: "logfwdr";
2229
2335
  } & NameOmit<CfLogfwdrBinding>) | ({
2230
2336
  type: "unsafe_hello_world";
2231
- } & BindingOmit<CfHelloWorld>) | {
2337
+ } & BindingOmit<CfHelloWorld>) | ({
2338
+ type: "ratelimit";
2339
+ } & NameOmit<CfRateLimit>) | {
2232
2340
  type: `unsafe_${string}`;
2233
2341
  } | {
2234
2342
  type: "assets";
@@ -2651,7 +2759,6 @@ type StartRemoteProxySessionOptions = {
2651
2759
  complianceRegion?: Config["compliance_region"];
2652
2760
  };
2653
2761
  declare function startRemoteProxySession(bindings: StartDevWorkerInput["bindings"], options?: StartRemoteProxySessionOptions): Promise<RemoteProxySession>;
2654
- declare function pickRemoteBindings(bindings: Record<string, Binding>): Record<string, Binding>;
2655
2762
  type WranglerConfigObject = {
2656
2763
  /** The path to the wrangler config file */
2657
2764
  path: string;
@@ -2712,7 +2819,10 @@ declare class Logger {
2712
2819
  log: (...args: unknown[]) => void;
2713
2820
  warn: (...args: unknown[]) => void;
2714
2821
  error: (...args: unknown[]) => void;
2715
- table<Keys extends string>(data: TableRow<Keys>[]): void;
2822
+ table<Keys extends string>(data: TableRow<Keys>[], options?: {
2823
+ wordWrap: boolean;
2824
+ head?: Keys[];
2825
+ }): void;
2716
2826
  console<M extends Exclude<keyof Console, "Console">>(method: M, ...args: Parameters<Console[M]>): void;
2717
2827
  get once(): {
2718
2828
  info: (...args: unknown[]) => void;
@@ -2768,6 +2878,7 @@ type Teams =
2768
2878
  | "Product: KV"
2769
2879
  | "Product: R2"
2770
2880
  | "Product: R2 Data Catalog"
2881
+ | "Product: R2 SQL"
2771
2882
  | "Product: D1"
2772
2883
  | "Product: Queues"
2773
2884
  | "Product: AI"
@@ -2776,7 +2887,8 @@ type Teams =
2776
2887
  | "Product: Vectorize"
2777
2888
  | "Product: Workflows"
2778
2889
  | "Product: Cloudchamber"
2779
- | "Product: SSL";
2890
+ | "Product: SSL"
2891
+ | "Product: WVPC";
2780
2892
 
2781
2893
  type StringKeyOf<T> = Extract<keyof T, string>;
2782
2894
  type DeepFlatten<T> = T extends object ? {
@@ -2825,6 +2937,10 @@ type HandlerContext = {
2825
2937
  UserError: typeof UserError;
2826
2938
  FatalError: typeof FatalError;
2827
2939
  };
2940
+ /**
2941
+ * API SDK
2942
+ */
2943
+ sdk: Cloudflare;
2828
2944
  };
2829
2945
  type CommandDefinition<NamedArgDefs extends NamedArgDefinitions = NamedArgDefinitions> = {
2830
2946
  /**
@@ -2995,6 +3111,7 @@ declare function createCLIParser(argv: string[]): {
2995
3111
  readonly describe: "Experimental: Enable Remote Bindings";
2996
3112
  readonly type: "boolean";
2997
3113
  readonly hidden: true;
3114
+ readonly default: true;
2998
3115
  readonly alias: readonly ["x-remote-bindings"];
2999
3116
  };
3000
3117
  readonly "experimental-provision": {
@@ -3024,4 +3141,4 @@ interface Unstable_ASSETSBindingsOptions {
3024
3141
  }
3025
3142
  declare const generateASSETSBinding: (opts: Unstable_ASSETSBindingsOptions) => (request: Request) => Promise<Response$1>;
3026
3143
 
3027
- export { type ConfigBindingOptions as Experimental_ConfigBindingOptions, type RemoteProxySession as Experimental_RemoteProxySession, type GetPlatformProxyOptions, type PlatformProxy, type SourcelessWorkerOptions, type Unstable_ASSETSBindingsOptions, type Binding as Unstable_Binding, type Config as Unstable_Config, type Unstable_DevOptions, type Unstable_DevWorker, type Unstable_MiniflareWorkerOptions, type RawConfig as Unstable_RawConfig, type RawEnvironment as Unstable_RawEnvironment, type StartRemoteProxySessionOptions as experimental_StartRemoteProxySessionOptions, experimental_getWranglerCommands, maybeStartOrUpdateRemoteProxySession as experimental_maybeStartOrUpdateRemoteProxySession, experimental_patchConfig, pickRemoteBindings as experimental_pickRemoteBindings, experimental_readRawConfig, startRemoteProxySession as experimental_startRemoteProxySession, getPlatformProxy, DevEnv as unstable_DevEnv, convertConfigBindingsToStartWorkerBindings as unstable_convertConfigBindingsToStartWorkerBindings, unstable_dev, generateASSETSBinding as unstable_generateASSETSBinding, unstable_getMiniflareWorkerOptions, getVarsForDev as unstable_getVarsForDev, unstable_pages, readConfig as unstable_readConfig, splitSqlQuery as unstable_splitSqlQuery, startWorker as unstable_startWorker };
3144
+ export { type Binding, type ConfigBindingOptions as Experimental_ConfigBindingOptions, type GetPlatformProxyOptions, type PlatformProxy, type RemoteProxySession, type SourcelessWorkerOptions, type StartRemoteProxySessionOptions, type Unstable_ASSETSBindingsOptions, type Config as Unstable_Config, type Unstable_DevOptions, type Unstable_DevWorker, type Unstable_MiniflareWorkerOptions, type RawConfig as Unstable_RawConfig, type RawEnvironment as Unstable_RawEnvironment, experimental_getWranglerCommands, experimental_patchConfig, experimental_readRawConfig, getPlatformProxy, maybeStartOrUpdateRemoteProxySession, startRemoteProxySession, DevEnv as unstable_DevEnv, convertConfigBindingsToStartWorkerBindings as unstable_convertConfigBindingsToStartWorkerBindings, unstable_dev, generateASSETSBinding as unstable_generateASSETSBinding, unstable_getMiniflareWorkerOptions, getVarsForDev as unstable_getVarsForDev, unstable_pages, readConfig as unstable_readConfig, splitSqlQuery as unstable_splitSqlQuery, startWorker as unstable_startWorker };