wrangler 3.78.3 → 3.78.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wrangler",
3
- "version": "3.78.3",
3
+ "version": "3.78.4",
4
4
  "description": "Command-line interface for all things Cloudflare Workers",
5
5
  "keywords": [
6
6
  "wrangler",
@@ -66,8 +66,8 @@
66
66
  "workerd": "1.20240909.0",
67
67
  "xxhash-wasm": "^1.0.1",
68
68
  "@cloudflare/kv-asset-handler": "0.3.4",
69
- "@cloudflare/workers-shared": "0.5.3",
70
- "miniflare": "3.20240909.2"
69
+ "miniflare": "3.20240909.2",
70
+ "@cloudflare/workers-shared": "0.5.3"
71
71
  },
72
72
  "devDependencies": {
73
73
  "@cloudflare/types": "^6.18.4",
@@ -152876,7 +152876,7 @@ init_import_meta_url();
152876
152876
  init_import_meta_url();
152877
152877
 
152878
152878
  // package.json
152879
- var version = "3.78.3";
152879
+ var version = "3.78.4";
152880
152880
  var package_default = {
152881
152881
  name: "wrangler",
152882
152882
  version,
@@ -161421,7 +161421,9 @@ function createWorkerUploadForm(worker) {
161421
161421
  assets: {
161422
161422
  jwt: experimental_assets.jwt,
161423
161423
  config: assetConfig
161424
- }
161424
+ },
161425
+ ...compatibility_date && { compatibility_date },
161426
+ ...compatibility_flags && { compatibility_flags }
161425
161427
  })
161426
161428
  );
161427
161429
  return formData;
@@ -191729,7 +191731,6 @@ async function handler5(args) {
191729
191731
  args.host,
191730
191732
  args.port,
191731
191733
  args.scheme,
191732
- args.database,
191733
191734
  args.user,
191734
191735
  args.password
191735
191736
  );
@@ -191752,9 +191753,9 @@ async function handler5(args) {
191752
191753
  throw new UserError(
191753
191754
  "You must provide a port number - e.g. 'user:password@database.example.com:port/databasename"
191754
191755
  );
191755
- } else if (url4.pathname === "") {
191756
+ } else if (args.connectionString && url4.pathname === "" || args.database === "") {
191756
191757
  throw new UserError(
191757
- "You must provide a database name as the path component - e.g. /postgres"
191758
+ "You must provide a database name as the path component - e.g. example.com:port/postgres"
191758
191759
  );
191759
191760
  } else if (url4.username === "") {
191760
191761
  throw new UserError(
@@ -191767,9 +191768,9 @@ async function handler5(args) {
191767
191768
  } else {
191768
191769
  logger.log(`\u{1F6A7} Creating '${args.name}'`);
191769
191770
  const origin = args.accessClientId && args.accessClientSecret ? {
191770
- host: url4.hostname,
191771
+ host: url4.hostname + url4.pathname,
191771
191772
  scheme: url4.protocol.replace(":", ""),
191772
- database: decodeURIComponent(url4.pathname.replace("/", "")),
191773
+ database: args.database,
191773
191774
  user: decodeURIComponent(url4.username),
191774
191775
  password: decodeURIComponent(url4.password),
191775
191776
  access_client_id: args.accessClientId,
@@ -191778,7 +191779,8 @@ async function handler5(args) {
191778
191779
  host: url4.hostname,
191779
191780
  port: parseInt(url4.port),
191780
191781
  scheme: url4.protocol.replace(":", ""),
191781
- database: decodeURIComponent(url4.pathname.replace("/", "")),
191782
+ // database will either be the value passed in the relevant yargs flag or is URL-decoded value from the url pathname
191783
+ database: args.connectionString !== "" ? decodeURIComponent(url4.pathname.replace("/", "")) : args.database,
191782
191784
  user: decodeURIComponent(url4.username),
191783
191785
  password: decodeURIComponent(url4.password)
191784
191786
  };
@@ -191799,8 +191801,8 @@ async function handler5(args) {
191799
191801
  }
191800
191802
  }
191801
191803
  __name(handler5, "handler");
191802
- function buildURLFromParts(host, port2, scheme, database, user, password) {
191803
- const url4 = new URL(database ? `/${database}` : "", `${scheme}://${host}`);
191804
+ function buildURLFromParts(host, port2, scheme, user, password) {
191805
+ const url4 = new URL(`${scheme}://${host}`);
191804
191806
  if (port2) {
191805
191807
  url4.port = port2.toString();
191806
191808
  }
@@ -191884,11 +191886,13 @@ function options8(yargs) {
191884
191886
  name: { type: "string", describe: "Give your config a new name" },
191885
191887
  "origin-host": {
191886
191888
  type: "string",
191887
- describe: "The host of the origin database"
191889
+ describe: "The host of the origin database",
191890
+ implies: ["database", "origin-user", "origin-password"]
191888
191891
  },
191889
191892
  "origin-port": {
191890
191893
  type: "number",
191891
- describe: "The port number of the origin database"
191894
+ describe: "The port number of the origin database",
191895
+ implies: ["origin-host", "database", "origin-user", "origin-password"]
191892
191896
  },
191893
191897
  "origin-scheme": {
191894
191898
  type: "string",
@@ -191896,27 +191900,42 @@ function options8(yargs) {
191896
191900
  },
191897
191901
  database: {
191898
191902
  type: "string",
191899
- describe: "The name of the database within the origin database"
191903
+ describe: "The name of the database within the origin database",
191904
+ implies: ["origin-host", "origin-user", "origin-password"]
191900
191905
  },
191901
191906
  "origin-user": {
191902
191907
  type: "string",
191903
- describe: "The username used to connect to the origin database"
191908
+ describe: "The username used to connect to the origin database",
191909
+ implies: ["origin-host", "database", "origin-password"]
191904
191910
  },
191905
191911
  "origin-password": {
191906
191912
  type: "string",
191907
- describe: "The password used to connect to the origin database"
191913
+ describe: "The password used to connect to the origin database",
191914
+ implies: ["origin-host", "database", "origin-user"]
191908
191915
  },
191909
191916
  "access-client-id": {
191910
191917
  type: "string",
191911
191918
  describe: "The Client ID of the Access token to use when connecting to the origin database",
191912
191919
  conflicts: ["origin-port"],
191913
- implies: ["access-client-secret"]
191920
+ implies: [
191921
+ "access-client-secret",
191922
+ "origin-host",
191923
+ "database",
191924
+ "origin-user",
191925
+ "origin-password"
191926
+ ]
191914
191927
  },
191915
191928
  "access-client-secret": {
191916
191929
  type: "string",
191917
191930
  describe: "The Client Secret of the Access token to use when connecting to the origin database",
191918
191931
  conflicts: ["origin-port"],
191919
- implies: ["access-client-id"]
191932
+ implies: [
191933
+ "access-client-id",
191934
+ "origin-host",
191935
+ "database",
191936
+ "origin-user",
191937
+ "origin-password"
191938
+ ]
191920
191939
  },
191921
191940
  "caching-disabled": {
191922
191941
  type: "boolean",
@@ -191934,33 +191953,21 @@ function options8(yargs) {
191934
191953
  });
191935
191954
  }
191936
191955
  __name(options8, "options");
191937
- var requiredOriginOptions = [
191956
+ var coreOriginOptions = [
191938
191957
  "originHost",
191939
191958
  "database",
191940
191959
  "originUser",
191941
191960
  "originPassword"
191942
191961
  ];
191943
- function camelToKebab(str) {
191944
- return str.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
191945
- }
191946
- __name(camelToKebab, "camelToKebab");
191947
191962
  function isOptionSet(args, key) {
191948
191963
  return key in args && args[key] !== void 0;
191949
191964
  }
191950
191965
  __name(isOptionSet, "isOptionSet");
191951
191966
  async function handler9(args) {
191952
- const allOriginFieldsSet = requiredOriginOptions.every(
191967
+ const coreOriginFieldsSet = coreOriginOptions.every(
191953
191968
  (field) => isOptionSet(args, field)
191954
191969
  );
191955
- const noOriginFieldSet = requiredOriginOptions.every(
191956
- (field) => !isOptionSet(args, field)
191957
- );
191958
- if (!allOriginFieldsSet && !noOriginFieldSet) {
191959
- throw new UserError(
191960
- `When updating the origin, all of the following must be set: ${requiredOriginOptions.map((option) => camelToKebab(option)).join(", ")}`
191961
- );
191962
- }
191963
- if (allOriginFieldsSet && args.originPort === void 0 && args.accessClientId === void 0 && args.accessClientSecret === void 0) {
191970
+ if (coreOriginFieldsSet && args.originPort === void 0 && args.accessClientId === void 0 && args.accessClientSecret === void 0) {
191964
191971
  throw new UserError(
191965
191972
  `When updating the origin, either the port or the Access Client ID and Secret must be set`
191966
191973
  );
@@ -191971,7 +191978,7 @@ async function handler9(args) {
191971
191978
  if (args.name !== void 0) {
191972
191979
  database.name = args.name;
191973
191980
  }
191974
- if (allOriginFieldsSet) {
191981
+ if (coreOriginFieldsSet) {
191975
191982
  if (args.accessClientId && args.accessClientSecret) {
191976
191983
  database.origin = {
191977
191984
  scheme: args.originScheme ?? "postgresql",
@@ -199312,13 +199319,20 @@ async function deleteEventNotificationConfig(config, apiCredentials, accountId,
199312
199319
  logger.log(
199313
199320
  `Disabling event notifications for "${bucketName}" to queue ${queueName}...`
199314
199321
  );
199315
- const body = ruleId !== void 0 ? {
199316
- ruleIds: [ruleId]
199317
- } : {};
199318
- return await fetchResult(
199319
- `/accounts/${accountId}/event_notifications/r2/${bucketName}/configuration/queues/${queue.queue_id}`,
199320
- { method: "DELETE", body: JSON.stringify(body), headers }
199321
- );
199322
+ if (ruleId !== void 0) {
199323
+ const body = ruleId !== void 0 ? {
199324
+ ruleIds: [ruleId]
199325
+ } : {};
199326
+ return await fetchResult(
199327
+ `/accounts/${accountId}/event_notifications/r2/${bucketName}/configuration/queues/${queue.queue_id}`,
199328
+ { method: "DELETE", body: JSON.stringify(body), headers }
199329
+ );
199330
+ } else {
199331
+ return await fetchResult(
199332
+ `/accounts/${accountId}/event_notifications/r2/${bucketName}/configuration/queues/${queue.queue_id}`,
199333
+ { method: "DELETE", headers }
199334
+ );
199335
+ }
199322
199336
  }
199323
199337
  __name(deleteEventNotificationConfig, "deleteEventNotificationConfig");
199324
199338
  function isValidR2BucketName(name) {
@@ -199356,21 +199370,21 @@ function CreateOptions4(yargs) {
199356
199370
  type: "string",
199357
199371
  demandOption: true
199358
199372
  }).option("event-types", {
199359
- describe: "Specify the kinds of object events to emit notifications for. ex. '--event-types object-create object-delete'",
199373
+ describe: "The type of event(s) that will emit event notifications",
199360
199374
  alias: "event-type",
199361
199375
  choices: Object.keys(actionsForEventCategories),
199362
199376
  demandOption: true,
199363
199377
  requiresArg: true,
199364
199378
  type: "array"
199365
199379
  }).option("prefix", {
199366
- describe: "only actions on objects with this prefix will emit notifications",
199380
+ describe: "The prefix that an object must match to emit event notifications (note: regular expressions not supported)",
199367
199381
  requiresArg: false,
199368
199382
  type: "string"
199369
199383
  }).option("suffix", {
199370
- describe: "only actions on objects with this suffix will emit notifications",
199384
+ describe: "The suffix that an object must match to emit event notifications (note: regular expressions not supported)",
199371
199385
  type: "string"
199372
199386
  }).option("queue", {
199373
- describe: "The name of the queue to which event notifications will be sent. ex '--queue my-queue'",
199387
+ describe: "The name of the queue that will receive event notification messages",
199374
199388
  demandOption: true,
199375
199389
  requiresArg: true,
199376
199390
  type: "string"
@@ -199402,12 +199416,12 @@ function DeleteOptions2(yargs) {
199402
199416
  type: "string",
199403
199417
  demandOption: true
199404
199418
  }).option("queue", {
199405
- describe: "The name of the queue that is configured to receive notifications. ex '--queue my-queue'",
199419
+ describe: "The name of the queue that will receive event notification messages",
199406
199420
  demandOption: true,
199407
199421
  requiresArg: true,
199408
199422
  type: "string"
199409
199423
  }).option("rule", {
199410
- describe: "The id of the rule to delete. If no rule is specified, all rules for the bucket/queue configuration will be deleted.",
199424
+ describe: "The id of the rule to delete. If no rule is specified, all rules for the bucket/queue configuration will be deleted",
199411
199425
  requiresArg: false,
199412
199426
  type: "string"
199413
199427
  });
@@ -218066,3 +218080,4 @@ yargs-parser/build/lib/index.js:
218066
218080
  * SPDX-License-Identifier: ISC
218067
218081
  *)
218068
218082
  */
218083
+ //# sourceMappingURL=cli.js.map