vercel 48.6.7 → 48.7.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 (2) hide show
  1. package/dist/index.js +108 -31
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -31698,6 +31698,14 @@ var init_command4 = __esm({
31698
31698
  type: String,
31699
31699
  argument: "TAGS",
31700
31700
  deprecated: false
31701
+ },
31702
+ {
31703
+ name: "srcimg",
31704
+ description: "Source Image to invalidate",
31705
+ shorthand: null,
31706
+ type: String,
31707
+ argument: "SRCIMG",
31708
+ deprecated: false
31701
31709
  }
31702
31710
  ],
31703
31711
  examples: [
@@ -31708,6 +31716,10 @@ var init_command4 = __esm({
31708
31716
  {
31709
31717
  name: "Invalidate all cached content associated with any one of multiple tags",
31710
31718
  value: `${packageName} cache invalidate --tag foo,bar,baz`
31719
+ },
31720
+ {
31721
+ name: "Invalidate all cached content associated with a source image",
31722
+ value: `${packageName} cache invalidate --srcimg /api/avatar/1`
31711
31723
  }
31712
31724
  ]
31713
31725
  };
@@ -31726,6 +31738,14 @@ var init_command4 = __esm({
31726
31738
  argument: "TAGS",
31727
31739
  deprecated: false
31728
31740
  },
31741
+ {
31742
+ name: "srcimg",
31743
+ description: "Source Image to delete",
31744
+ shorthand: null,
31745
+ type: String,
31746
+ argument: "SRCIMG",
31747
+ deprecated: false
31748
+ },
31729
31749
  {
31730
31750
  name: "revalidation-deadline-seconds",
31731
31751
  description: "Revalidation deadline in seconds",
@@ -31743,6 +31763,14 @@ var init_command4 = __esm({
31743
31763
  {
31744
31764
  name: "Dangerously delete all cached content associated with a tag if not accessed in the next hour",
31745
31765
  value: `${packageName} cache dangerously-delete --tag foo --revalidation-deadline-seconds 3600`
31766
+ },
31767
+ {
31768
+ name: "Dangerously delete all cached content associated with a source image",
31769
+ value: `${packageName} cache dangerously-delete --srcimg /api/avatar/1`
31770
+ },
31771
+ {
31772
+ name: "Dangerously delete all cached content associated with a source image if not accessed in the next hour",
31773
+ value: `${packageName} cache dangerously-delete --srcimg /api/avatar/1 --revalidation-deadline-seconds 3600`
31746
31774
  }
31747
31775
  ]
31748
31776
  };
@@ -148909,6 +148937,14 @@ var init_invalidate = __esm({
148909
148937
  });
148910
148938
  }
148911
148939
  }
148940
+ trackCliOptionSrcimg(srcimg) {
148941
+ if (srcimg) {
148942
+ this.trackCliOption({
148943
+ option: "srcimg",
148944
+ value: srcimg
148945
+ });
148946
+ }
148947
+ }
148912
148948
  };
148913
148949
  }
148914
148950
  });
@@ -148944,19 +148980,40 @@ async function invalidate(client2, argv) {
148944
148980
  client2.config.currentTeam = org.type === "team" ? org.id : void 0;
148945
148981
  const yes = Boolean(parsedArgs.flags["--yes"]);
148946
148982
  const tag = parsedArgs.flags["--tag"];
148983
+ const srcimg = parsedArgs.flags["--srcimg"];
148947
148984
  telemetry2.trackCliFlagYes(yes);
148948
148985
  telemetry2.trackCliOptionTag(tag);
148949
- if (!tag) {
148950
- output_manager_default.error(`The --tag option is required`);
148986
+ telemetry2.trackCliOptionSrcimg(srcimg);
148987
+ if (tag && srcimg) {
148988
+ output_manager_default.error(`Cannot use both --tag and --srcimg options`);
148951
148989
  return 1;
148952
148990
  }
148953
- const tagsDesc = (0, import_pluralize5.default)("tag", tag.split(",").length, false);
148954
- const msg = `You are about to invalidate all cached content associated with ${tagsDesc} ${tag} for project ${project.name}`;
148955
- const query = new URLSearchParams({ projectIdOrName: project.id }).toString();
148991
+ let itemName = "";
148992
+ let itemValue = "";
148993
+ let flag = "";
148994
+ let postUrl = "";
148995
+ let postBody = {};
148996
+ if (tag) {
148997
+ itemName = (0, import_pluralize5.default)("tag", tag.split(",").length, false);
148998
+ itemValue = tag;
148999
+ flag = "--tag";
149000
+ postUrl = "/v1/edge-cache/invalidate-by-tags";
149001
+ postBody = { tags: tag };
149002
+ } else if (srcimg) {
149003
+ itemName = "source image";
149004
+ itemValue = srcimg;
149005
+ flag = "--srcimg";
149006
+ postUrl = "/v1/edge-cache/invalidate-by-src-images";
149007
+ postBody = { srcImages: [srcimg] };
149008
+ } else {
149009
+ output_manager_default.error(`The --tag or --srcimg option is required`);
149010
+ return 1;
149011
+ }
149012
+ const msg = `You are about to invalidate all cached content associated with ${itemName} ${itemValue} for project ${project.name}`;
148956
149013
  if (!yes) {
148957
149014
  if (!process.stdin.isTTY) {
148958
149015
  output_manager_default.print(
148959
- `${msg}. To continue, run ${getCommandName(`cache invalidate --tag ${tag} --yes`)}.`
149016
+ `${msg}. To continue, run ${getCommandName(`cache invalidate ${flag} ${itemValue} --yes`)}.`
148960
149017
  );
148961
149018
  return 1;
148962
149019
  }
@@ -148967,18 +149024,14 @@ async function invalidate(client2, argv) {
148967
149024
  return 0;
148968
149025
  }
148969
149026
  }
148970
- await client2.fetch(`/v1/edge-cache/invalidate-by-tags?${query}`, {
149027
+ await client2.fetch(`${postUrl}?projectIdOrName=${project.id}`, {
148971
149028
  method: "POST",
148972
- headers: {
148973
- "Content-Type": "application/json"
148974
- },
148975
- body: JSON.stringify({
148976
- tags: tag
148977
- })
149029
+ headers: { "Content-Type": "application/json" },
149030
+ body: JSON.stringify(postBody)
148978
149031
  });
148979
149032
  output_manager_default.print(
148980
149033
  prependEmoji(
148981
- `Successfully invalidated all cached content associated with ${tagsDesc} ${tag}`,
149034
+ `Successfully invalidated all cached content associated with ${itemName} ${itemValue}`,
148982
149035
  emoji("success")
148983
149036
  ) + `
148984
149037
  `
@@ -149022,6 +149075,14 @@ var init_dangerously_delete = __esm({
149022
149075
  });
149023
149076
  }
149024
149077
  }
149078
+ trackCliOptionSrcimg(srcimg) {
149079
+ if (srcimg) {
149080
+ this.trackCliOption({
149081
+ option: "srcimg",
149082
+ value: srcimg
149083
+ });
149084
+ }
149085
+ }
149025
149086
  trackCliOptionRevalidationDeadlineSeconds(seconds) {
149026
149087
  if (seconds) {
149027
149088
  this.trackCliOption({
@@ -149065,22 +149126,43 @@ async function dangerouslyDelete(client2, argv) {
149065
149126
  client2.config.currentTeam = org.type === "team" ? org.id : void 0;
149066
149127
  const yes = Boolean(parsedArgs.flags["--yes"]);
149067
149128
  const tag = parsedArgs.flags["--tag"];
149129
+ const srcimg = parsedArgs.flags["--srcimg"];
149130
+ const revalidate = parsedArgs.flags["--revalidation-deadline-seconds"];
149068
149131
  telemetry2.trackCliFlagYes(yes);
149069
149132
  telemetry2.trackCliOptionTag(tag);
149070
- if (!tag) {
149071
- output_manager_default.error(`The --tag option is required`);
149133
+ telemetry2.trackCliOptionSrcimg(srcimg);
149134
+ telemetry2.trackCliOptionRevalidationDeadlineSeconds(revalidate);
149135
+ if (tag && srcimg) {
149136
+ output_manager_default.error(`Cannot use both --tag and --srcimg options`);
149072
149137
  return 1;
149073
149138
  }
149074
- const revalidate = parsedArgs.flags["--revalidation-deadline-seconds"];
149075
- telemetry2.trackCliOptionRevalidationDeadlineSeconds(revalidate);
149076
- const tagsDesc = (0, import_pluralize6.default)("tag", tag.split(",").length, false);
149077
- const msg = `You are about to dangerously delete all cached content associated with ${tagsDesc} ${tag} for project ${project.name}`;
149078
- const query = new URLSearchParams({ projectIdOrName: project.id }).toString();
149139
+ let itemName = "";
149140
+ let itemValue = "";
149141
+ let flag = "";
149142
+ let postUrl = "";
149143
+ let postBody = {};
149144
+ if (tag) {
149145
+ itemName = (0, import_pluralize6.default)("tag", tag.split(",").length, false);
149146
+ itemValue = tag;
149147
+ flag = "--tag";
149148
+ postUrl = "/v1/edge-cache/dangerously-delete-by-tags";
149149
+ postBody = { tags: tag, revalidationDeadlineSeconds: revalidate };
149150
+ } else if (srcimg) {
149151
+ itemName = "source image";
149152
+ itemValue = srcimg;
149153
+ flag = "--srcimg";
149154
+ postUrl = "/v1/edge-cache/dangerously-delete-by-src-images";
149155
+ postBody = { srcImages: [srcimg], revalidationDeadlineSeconds: revalidate };
149156
+ } else {
149157
+ output_manager_default.error(`The --tag or --srcimg option is required`);
149158
+ return 1;
149159
+ }
149160
+ const msg = `You are about to dangerously delete all cached content associated with ${itemName} ${itemValue} for project ${project.name}`;
149079
149161
  if (!yes) {
149080
149162
  if (!process.stdin.isTTY) {
149081
149163
  const optional = typeof revalidate !== "undefined" ? ` --revalidation-deadline-seconds ${revalidate}` : "";
149082
149164
  output_manager_default.print(
149083
- `${msg}. To continue, run ${getCommandName(`cache dangerously-delete --tag ${tag}${optional} --yes`)}.`
149165
+ `${msg}. To continue, run ${getCommandName(`cache dangerously-delete ${flag} ${itemValue}${optional} --yes`)}.`
149084
149166
  );
149085
149167
  return 1;
149086
149168
  }
@@ -149091,19 +149173,14 @@ async function dangerouslyDelete(client2, argv) {
149091
149173
  return 0;
149092
149174
  }
149093
149175
  }
149094
- await client2.fetch(`/v1/edge-cache/dangerously-delete-by-tags?${query}`, {
149176
+ await client2.fetch(`${postUrl}?projectIdOrName=${project.id}`, {
149095
149177
  method: "POST",
149096
- headers: {
149097
- "Content-Type": "application/json"
149098
- },
149099
- body: JSON.stringify({
149100
- tags: tag,
149101
- revalidationDeadlineSeconds: revalidate
149102
- })
149178
+ headers: { "Content-Type": "application/json" },
149179
+ body: JSON.stringify(postBody)
149103
149180
  });
149104
149181
  output_manager_default.print(
149105
149182
  prependEmoji(
149106
- `Successfully deleted all cached content associated with ${tagsDesc} ${tag}`,
149183
+ `Successfully deleted all cached content associated with ${itemName} ${itemValue}`,
149107
149184
  emoji("success")
149108
149185
  ) + `
149109
149186
  `
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vercel",
3
- "version": "48.6.7",
3
+ "version": "48.7.0",
4
4
  "preferGlobal": true,
5
5
  "license": "Apache-2.0",
6
6
  "description": "The command-line interface for Vercel",
@@ -168,9 +168,9 @@
168
168
  "write-json-file": "2.2.0",
169
169
  "xdg-app-paths": "5.1.0",
170
170
  "yauzl-promise": "2.1.3",
171
+ "@vercel-internals/get-package-json": "1.0.0",
171
172
  "@vercel-internals/constants": "1.0.4",
172
- "@vercel-internals/types": "3.0.6",
173
- "@vercel-internals/get-package-json": "1.0.0"
173
+ "@vercel-internals/types": "3.0.6"
174
174
  },
175
175
  "scripts": {
176
176
  "test": "jest --reporters=default --reporters=jest-junit --env node --verbose --bail",