@wix/cli 1.1.61 → 1.1.62

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 (104) hide show
  1. package/build/{DevCommand-3CEY3HPC.js → DevCommand-NWZ75YTP.js} +11 -12
  2. package/build/{DevCommand-3CEY3HPC.js.map → DevCommand-NWZ75YTP.js.map} +1 -1
  3. package/build/{DevCommand-NPVKUDPR.js → DevCommand-ZNHBPCVV.js} +13 -14
  4. package/build/{DevCommand-NPVKUDPR.js.map → DevCommand-ZNHBPCVV.js.map} +1 -1
  5. package/build/{LoginCommand-RTNDZF77.js → LoginCommand-AQIYGH36.js} +9 -9
  6. package/build/{LogoutCommand-CUOS2BUH.js → LogoutCommand-LPI7NUZJ.js} +6 -6
  7. package/build/{PreviewCommand-5GAG7MBS.js → PreviewCommand-666UOTAN.js} +12 -12
  8. package/build/{WhoamiCommand-VZ6KKOVQ.js → WhoamiCommand-BWXA3TXF.js} +3 -3
  9. package/build/{chunk-DP2BL2V4.js → chunk-45UEHUOD.js} +6 -6
  10. package/build/{chunk-J573TQNU.js → chunk-4YD2W3LA.js} +2 -2
  11. package/build/{chunk-332V5RP4.js → chunk-4ZQFECEW.js} +41 -14
  12. package/build/{chunk-332V5RP4.js.map → chunk-4ZQFECEW.js.map} +1 -1
  13. package/build/{chunk-HV2IEAOB.js → chunk-55EFTE5M.js} +2 -2
  14. package/build/{chunk-N3OHN3MH.js → chunk-A6TCWKZD.js} +4 -4
  15. package/build/{chunk-N3OHN3MH.js.map → chunk-A6TCWKZD.js.map} +1 -1
  16. package/build/{chunk-2KK3GKES.js → chunk-D6HNYFE6.js} +5 -5
  17. package/build/{chunk-HMGX4HL2.js → chunk-DTRL25IG.js} +6 -6
  18. package/build/{chunk-XFEYPXEY.js → chunk-DVR2CMCO.js} +3 -3
  19. package/build/{chunk-3UE73ERL.js → chunk-ETAVRPIY.js} +2 -2
  20. package/build/{chunk-G4NFI3XC.js → chunk-G34I4OXF.js} +3 -3
  21. package/build/{chunk-3NEXZN7N.js → chunk-IPI4IXDD.js} +8 -8
  22. package/build/chunk-IPI4IXDD.js.map +1 -0
  23. package/build/{chunk-Q3GS63B5.js → chunk-JIH3GSZJ.js} +2 -2
  24. package/build/{chunk-PTIE2TCP.js → chunk-LWQGSEXR.js} +2 -2
  25. package/build/{chunk-P4UAXEEN.js → chunk-NLMXNKQO.js} +8 -8
  26. package/build/{chunk-M34KVUTA.js → chunk-OEYFKLWJ.js} +2 -2
  27. package/build/{chunk-B5A3CFP2.js → chunk-OOWNEBOM.js} +2 -2
  28. package/build/{chunk-6K6VPM3T.js → chunk-OSWRZGLN.js} +4 -4
  29. package/build/{chunk-DEO7G3RD.js → chunk-PF4VD6IT.js} +5 -5
  30. package/build/{chunk-6YVNZGPU.js → chunk-TCSPCAZI.js} +2 -2
  31. package/build/{chunk-V7JWKPQI.js → chunk-WJQFCMN3.js} +4 -4
  32. package/build/{chunk-77YDQA7O.js → chunk-XOFZJ3JQ.js} +5 -5
  33. package/build/{chunk-L53ZVQB7.js → chunk-Y5LMYOCJ.js} +472 -7
  34. package/build/chunk-Y5LMYOCJ.js.map +1 -0
  35. package/build/{chunk-H6BDO22X.js → chunk-YQW75RJ5.js} +9 -5
  36. package/build/{chunk-H6BDO22X.js.map → chunk-YQW75RJ5.js.map} +1 -1
  37. package/build/{chunk-KOGQSQ4I.js → chunk-YYH6VZI3.js} +3 -14
  38. package/build/{chunk-KOGQSQ4I.js.map → chunk-YYH6VZI3.js.map} +1 -1
  39. package/build/{chunk-ZVHSVTAJ.js → chunk-ZIXYUOVJ.js} +3 -3
  40. package/build/{chunk-2WA6TGDO.js → chunk-ZR5EKZZ3.js} +4 -4
  41. package/build/{dev-FOGJASYZ.js → dev-B7FMRZWG.js} +19 -20
  42. package/build/dev-B7FMRZWG.js.map +1 -0
  43. package/build/index.js +3549 -10598
  44. package/build/index.js.map +1 -1
  45. package/build/{install-NSVJU2EB.js → install-B37NJYMG.js} +13 -13
  46. package/build/{preview-RQ5CLHV5.js → preview-W5ZYLI5U.js} +16 -16
  47. package/build/{publish-YWESFDVY.js → publish-KZKBMTND.js} +16 -16
  48. package/build/{render-command-E3JPPTZA.js → render-command-FWDU3W5M.js} +9 -9
  49. package/build/{render-command-4GOKWOT7.js → render-command-S7D3MWYC.js} +8 -8
  50. package/build/{render-command-WMEIFR3G.js → render-command-TKO7PYVO.js} +9 -9
  51. package/build/{run-command-D54S2NI5.js → run-command-YYML7BJX.js} +6 -6
  52. package/build/{src-IIEVMGC3.js → src-5VO6B75Q.js} +16 -16
  53. package/build/{src-NGHHXRWJ.js → src-DVFFJLN5.js} +2 -2
  54. package/build/{src-HA6XHM2E.js → src-GQFPGSHL.js} +6 -6
  55. package/build/{src-4W7XB5DS.js → src-IMPYJZRW.js} +7 -7
  56. package/build/{src-OIVJ4AKD.js → src-SCGDSQRH.js} +4 -4
  57. package/build/{src-NS46VL23.js → src-WV4RZ4FT.js} +5 -5
  58. package/build/{sync-types-SQEHJPEG.js → sync-types-M76E2RFC.js} +11 -12
  59. package/build/{uninstall-ASZ55QZA.js → uninstall-LDNBVTQR.js} +13 -13
  60. package/package.json +2 -2
  61. package/build/chunk-3NEXZN7N.js.map +0 -1
  62. package/build/chunk-L53ZVQB7.js.map +0 -1
  63. package/build/chunk-YXFEXGAH.js +0 -479
  64. package/build/chunk-YXFEXGAH.js.map +0 -1
  65. package/build/dev-FOGJASYZ.js.map +0 -1
  66. /package/build/{LoginCommand-RTNDZF77.js.map → LoginCommand-AQIYGH36.js.map} +0 -0
  67. /package/build/{LogoutCommand-CUOS2BUH.js.map → LogoutCommand-LPI7NUZJ.js.map} +0 -0
  68. /package/build/{PreviewCommand-5GAG7MBS.js.map → PreviewCommand-666UOTAN.js.map} +0 -0
  69. /package/build/{WhoamiCommand-VZ6KKOVQ.js.map → WhoamiCommand-BWXA3TXF.js.map} +0 -0
  70. /package/build/{chunk-DP2BL2V4.js.map → chunk-45UEHUOD.js.map} +0 -0
  71. /package/build/{chunk-J573TQNU.js.map → chunk-4YD2W3LA.js.map} +0 -0
  72. /package/build/{chunk-HV2IEAOB.js.map → chunk-55EFTE5M.js.map} +0 -0
  73. /package/build/{chunk-2KK3GKES.js.map → chunk-D6HNYFE6.js.map} +0 -0
  74. /package/build/{chunk-HMGX4HL2.js.map → chunk-DTRL25IG.js.map} +0 -0
  75. /package/build/{chunk-XFEYPXEY.js.map → chunk-DVR2CMCO.js.map} +0 -0
  76. /package/build/{chunk-3UE73ERL.js.map → chunk-ETAVRPIY.js.map} +0 -0
  77. /package/build/{chunk-G4NFI3XC.js.map → chunk-G34I4OXF.js.map} +0 -0
  78. /package/build/{chunk-Q3GS63B5.js.map → chunk-JIH3GSZJ.js.map} +0 -0
  79. /package/build/{chunk-PTIE2TCP.js.map → chunk-LWQGSEXR.js.map} +0 -0
  80. /package/build/{chunk-P4UAXEEN.js.map → chunk-NLMXNKQO.js.map} +0 -0
  81. /package/build/{chunk-M34KVUTA.js.map → chunk-OEYFKLWJ.js.map} +0 -0
  82. /package/build/{chunk-B5A3CFP2.js.map → chunk-OOWNEBOM.js.map} +0 -0
  83. /package/build/{chunk-6K6VPM3T.js.map → chunk-OSWRZGLN.js.map} +0 -0
  84. /package/build/{chunk-DEO7G3RD.js.map → chunk-PF4VD6IT.js.map} +0 -0
  85. /package/build/{chunk-6YVNZGPU.js.map → chunk-TCSPCAZI.js.map} +0 -0
  86. /package/build/{chunk-V7JWKPQI.js.map → chunk-WJQFCMN3.js.map} +0 -0
  87. /package/build/{chunk-77YDQA7O.js.map → chunk-XOFZJ3JQ.js.map} +0 -0
  88. /package/build/{chunk-ZVHSVTAJ.js.map → chunk-ZIXYUOVJ.js.map} +0 -0
  89. /package/build/{chunk-2WA6TGDO.js.map → chunk-ZR5EKZZ3.js.map} +0 -0
  90. /package/build/{install-NSVJU2EB.js.map → install-B37NJYMG.js.map} +0 -0
  91. /package/build/{preview-RQ5CLHV5.js.map → preview-W5ZYLI5U.js.map} +0 -0
  92. /package/build/{publish-YWESFDVY.js.map → publish-KZKBMTND.js.map} +0 -0
  93. /package/build/{render-command-E3JPPTZA.js.map → render-command-FWDU3W5M.js.map} +0 -0
  94. /package/build/{render-command-4GOKWOT7.js.map → render-command-S7D3MWYC.js.map} +0 -0
  95. /package/build/{render-command-WMEIFR3G.js.map → render-command-TKO7PYVO.js.map} +0 -0
  96. /package/build/{run-command-D54S2NI5.js.map → run-command-YYML7BJX.js.map} +0 -0
  97. /package/build/{src-IIEVMGC3.js.map → src-5VO6B75Q.js.map} +0 -0
  98. /package/build/{src-HA6XHM2E.js.map → src-DVFFJLN5.js.map} +0 -0
  99. /package/build/{src-NGHHXRWJ.js.map → src-GQFPGSHL.js.map} +0 -0
  100. /package/build/{src-4W7XB5DS.js.map → src-IMPYJZRW.js.map} +0 -0
  101. /package/build/{src-OIVJ4AKD.js.map → src-SCGDSQRH.js.map} +0 -0
  102. /package/build/{src-NS46VL23.js.map → src-WV4RZ4FT.js.map} +0 -0
  103. /package/build/{sync-types-SQEHJPEG.js.map → sync-types-M76E2RFC.js.map} +0 -0
  104. /package/build/{uninstall-ASZ55QZA.js.map → uninstall-LDNBVTQR.js.map} +0 -0
@@ -6,20 +6,17 @@ import {
6
6
  import {
7
7
  GridAppLayout
8
8
  } from "./chunk-6LI4WGAW.js";
9
- import {
10
- require_http_cache_semantics
11
- } from "./chunk-YXFEXGAH.js";
12
9
  import {
13
10
  resolveUrl,
14
11
  serializer,
15
12
  toURLSearchParams
16
- } from "./chunk-77YDQA7O.js";
13
+ } from "./chunk-XOFZJ3JQ.js";
17
14
  import {
18
15
  require_clean,
19
16
  require_is_core_module,
20
17
  require_semver,
21
18
  require_valid
22
- } from "./chunk-332V5RP4.js";
19
+ } from "./chunk-4ZQFECEW.js";
23
20
  import {
24
21
  require_index_node,
25
22
  require_ms,
@@ -30,7 +27,7 @@ import {
30
27
  } from "./chunk-PX2L3CCA.js";
31
28
  import {
32
29
  require_verror
33
- } from "./chunk-H6BDO22X.js";
30
+ } from "./chunk-YQW75RJ5.js";
34
31
  import {
35
32
  __commonJS,
36
33
  __dirname,
@@ -34884,6 +34881,474 @@ var require_options = __commonJS({
34884
34881
  }
34885
34882
  });
34886
34883
 
34884
+ // ../../node_modules/http-cache-semantics/index.js
34885
+ var require_http_cache_semantics = __commonJS({
34886
+ "../../node_modules/http-cache-semantics/index.js"(exports2, module2) {
34887
+ "use strict";
34888
+ init_esm_shims();
34889
+ var statusCodeCacheableByDefault = /* @__PURE__ */ new Set([
34890
+ 200,
34891
+ 203,
34892
+ 204,
34893
+ 206,
34894
+ 300,
34895
+ 301,
34896
+ 308,
34897
+ 404,
34898
+ 405,
34899
+ 410,
34900
+ 414,
34901
+ 501
34902
+ ]);
34903
+ var understoodStatuses = /* @__PURE__ */ new Set([
34904
+ 200,
34905
+ 203,
34906
+ 204,
34907
+ 300,
34908
+ 301,
34909
+ 302,
34910
+ 303,
34911
+ 307,
34912
+ 308,
34913
+ 404,
34914
+ 405,
34915
+ 410,
34916
+ 414,
34917
+ 501
34918
+ ]);
34919
+ var errorStatusCodes = /* @__PURE__ */ new Set([
34920
+ 500,
34921
+ 502,
34922
+ 503,
34923
+ 504
34924
+ ]);
34925
+ var hopByHopHeaders = {
34926
+ date: true,
34927
+ // included, because we add Age update Date
34928
+ connection: true,
34929
+ "keep-alive": true,
34930
+ "proxy-authenticate": true,
34931
+ "proxy-authorization": true,
34932
+ te: true,
34933
+ trailer: true,
34934
+ "transfer-encoding": true,
34935
+ upgrade: true
34936
+ };
34937
+ var excludedFromRevalidationUpdate = {
34938
+ // Since the old body is reused, it doesn't make sense to change properties of the body
34939
+ "content-length": true,
34940
+ "content-encoding": true,
34941
+ "transfer-encoding": true,
34942
+ "content-range": true
34943
+ };
34944
+ function toNumberOrZero(s) {
34945
+ const n = parseInt(s, 10);
34946
+ return isFinite(n) ? n : 0;
34947
+ }
34948
+ function isErrorResponse(response) {
34949
+ if (!response) {
34950
+ return true;
34951
+ }
34952
+ return errorStatusCodes.has(response.status);
34953
+ }
34954
+ function parseCacheControl(header) {
34955
+ const cc = {};
34956
+ if (!header) return cc;
34957
+ const parts = header.trim().split(/,/);
34958
+ for (const part of parts) {
34959
+ const [k, v] = part.split(/=/, 2);
34960
+ cc[k.trim()] = v === void 0 ? true : v.trim().replace(/^"|"$/g, "");
34961
+ }
34962
+ return cc;
34963
+ }
34964
+ function formatCacheControl(cc) {
34965
+ let parts = [];
34966
+ for (const k in cc) {
34967
+ const v = cc[k];
34968
+ parts.push(v === true ? k : k + "=" + v);
34969
+ }
34970
+ if (!parts.length) {
34971
+ return void 0;
34972
+ }
34973
+ return parts.join(", ");
34974
+ }
34975
+ module2.exports = class CachePolicy {
34976
+ constructor(req, res, {
34977
+ shared,
34978
+ cacheHeuristic,
34979
+ immutableMinTimeToLive,
34980
+ ignoreCargoCult,
34981
+ _fromObject
34982
+ } = {}) {
34983
+ if (_fromObject) {
34984
+ this._fromObject(_fromObject);
34985
+ return;
34986
+ }
34987
+ if (!res || !res.headers) {
34988
+ throw Error("Response headers missing");
34989
+ }
34990
+ this._assertRequestHasHeaders(req);
34991
+ this._responseTime = this.now();
34992
+ this._isShared = shared !== false;
34993
+ this._cacheHeuristic = void 0 !== cacheHeuristic ? cacheHeuristic : 0.1;
34994
+ this._immutableMinTtl = void 0 !== immutableMinTimeToLive ? immutableMinTimeToLive : 24 * 3600 * 1e3;
34995
+ this._status = "status" in res ? res.status : 200;
34996
+ this._resHeaders = res.headers;
34997
+ this._rescc = parseCacheControl(res.headers["cache-control"]);
34998
+ this._method = "method" in req ? req.method : "GET";
34999
+ this._url = req.url;
35000
+ this._host = req.headers.host;
35001
+ this._noAuthorization = !req.headers.authorization;
35002
+ this._reqHeaders = res.headers.vary ? req.headers : null;
35003
+ this._reqcc = parseCacheControl(req.headers["cache-control"]);
35004
+ if (ignoreCargoCult && "pre-check" in this._rescc && "post-check" in this._rescc) {
35005
+ delete this._rescc["pre-check"];
35006
+ delete this._rescc["post-check"];
35007
+ delete this._rescc["no-cache"];
35008
+ delete this._rescc["no-store"];
35009
+ delete this._rescc["must-revalidate"];
35010
+ this._resHeaders = Object.assign({}, this._resHeaders, {
35011
+ "cache-control": formatCacheControl(this._rescc)
35012
+ });
35013
+ delete this._resHeaders.expires;
35014
+ delete this._resHeaders.pragma;
35015
+ }
35016
+ if (res.headers["cache-control"] == null && /no-cache/.test(res.headers.pragma)) {
35017
+ this._rescc["no-cache"] = true;
35018
+ }
35019
+ }
35020
+ now() {
35021
+ return Date.now();
35022
+ }
35023
+ storable() {
35024
+ return !!(!this._reqcc["no-store"] && // A cache MUST NOT store a response to any request, unless:
35025
+ // The request method is understood by the cache and defined as being cacheable, and
35026
+ ("GET" === this._method || "HEAD" === this._method || "POST" === this._method && this._hasExplicitExpiration()) && // the response status code is understood by the cache, and
35027
+ understoodStatuses.has(this._status) && // the "no-store" cache directive does not appear in request or response header fields, and
35028
+ !this._rescc["no-store"] && // the "private" response directive does not appear in the response, if the cache is shared, and
35029
+ (!this._isShared || !this._rescc.private) && // the Authorization header field does not appear in the request, if the cache is shared,
35030
+ (!this._isShared || this._noAuthorization || this._allowsStoringAuthenticated()) && // the response either:
35031
+ // contains an Expires header field, or
35032
+ (this._resHeaders.expires || // contains a max-age response directive, or
35033
+ // contains a s-maxage response directive and the cache is shared, or
35034
+ // contains a public response directive.
35035
+ this._rescc["max-age"] || this._isShared && this._rescc["s-maxage"] || this._rescc.public || // has a status code that is defined as cacheable by default
35036
+ statusCodeCacheableByDefault.has(this._status)));
35037
+ }
35038
+ _hasExplicitExpiration() {
35039
+ return this._isShared && this._rescc["s-maxage"] || this._rescc["max-age"] || this._resHeaders.expires;
35040
+ }
35041
+ _assertRequestHasHeaders(req) {
35042
+ if (!req || !req.headers) {
35043
+ throw Error("Request headers missing");
35044
+ }
35045
+ }
35046
+ satisfiesWithoutRevalidation(req) {
35047
+ this._assertRequestHasHeaders(req);
35048
+ const requestCC = parseCacheControl(req.headers["cache-control"]);
35049
+ if (requestCC["no-cache"] || /no-cache/.test(req.headers.pragma)) {
35050
+ return false;
35051
+ }
35052
+ if (requestCC["max-age"] && this.age() > requestCC["max-age"]) {
35053
+ return false;
35054
+ }
35055
+ if (requestCC["min-fresh"] && this.timeToLive() < 1e3 * requestCC["min-fresh"]) {
35056
+ return false;
35057
+ }
35058
+ if (this.stale()) {
35059
+ const allowsStale = requestCC["max-stale"] && !this._rescc["must-revalidate"] && (true === requestCC["max-stale"] || requestCC["max-stale"] > this.age() - this.maxAge());
35060
+ if (!allowsStale) {
35061
+ return false;
35062
+ }
35063
+ }
35064
+ return this._requestMatches(req, false);
35065
+ }
35066
+ _requestMatches(req, allowHeadMethod) {
35067
+ return (!this._url || this._url === req.url) && this._host === req.headers.host && // the request method associated with the stored response allows it to be used for the presented request, and
35068
+ (!req.method || this._method === req.method || allowHeadMethod && "HEAD" === req.method) && // selecting header fields nominated by the stored response (if any) match those presented, and
35069
+ this._varyMatches(req);
35070
+ }
35071
+ _allowsStoringAuthenticated() {
35072
+ return this._rescc["must-revalidate"] || this._rescc.public || this._rescc["s-maxage"];
35073
+ }
35074
+ _varyMatches(req) {
35075
+ if (!this._resHeaders.vary) {
35076
+ return true;
35077
+ }
35078
+ if (this._resHeaders.vary === "*") {
35079
+ return false;
35080
+ }
35081
+ const fields = this._resHeaders.vary.trim().toLowerCase().split(/\s*,\s*/);
35082
+ for (const name of fields) {
35083
+ if (req.headers[name] !== this._reqHeaders[name]) return false;
35084
+ }
35085
+ return true;
35086
+ }
35087
+ _copyWithoutHopByHopHeaders(inHeaders) {
35088
+ const headers = {};
35089
+ for (const name in inHeaders) {
35090
+ if (hopByHopHeaders[name]) continue;
35091
+ headers[name] = inHeaders[name];
35092
+ }
35093
+ if (inHeaders.connection) {
35094
+ const tokens = inHeaders.connection.trim().split(/\s*,\s*/);
35095
+ for (const name of tokens) {
35096
+ delete headers[name];
35097
+ }
35098
+ }
35099
+ if (headers.warning) {
35100
+ const warnings = headers.warning.split(/,/).filter((warning) => {
35101
+ return !/^\s*1[0-9][0-9]/.test(warning);
35102
+ });
35103
+ if (!warnings.length) {
35104
+ delete headers.warning;
35105
+ } else {
35106
+ headers.warning = warnings.join(",").trim();
35107
+ }
35108
+ }
35109
+ return headers;
35110
+ }
35111
+ responseHeaders() {
35112
+ const headers = this._copyWithoutHopByHopHeaders(this._resHeaders);
35113
+ const age = this.age();
35114
+ if (age > 3600 * 24 && !this._hasExplicitExpiration() && this.maxAge() > 3600 * 24) {
35115
+ headers.warning = (headers.warning ? `${headers.warning}, ` : "") + '113 - "rfc7234 5.5.4"';
35116
+ }
35117
+ headers.age = `${Math.round(age)}`;
35118
+ headers.date = new Date(this.now()).toUTCString();
35119
+ return headers;
35120
+ }
35121
+ /**
35122
+ * Value of the Date response header or current time if Date was invalid
35123
+ * @return timestamp
35124
+ */
35125
+ date() {
35126
+ const serverDate = Date.parse(this._resHeaders.date);
35127
+ if (isFinite(serverDate)) {
35128
+ return serverDate;
35129
+ }
35130
+ return this._responseTime;
35131
+ }
35132
+ /**
35133
+ * Value of the Age header, in seconds, updated for the current time.
35134
+ * May be fractional.
35135
+ *
35136
+ * @return Number
35137
+ */
35138
+ age() {
35139
+ let age = this._ageValue();
35140
+ const residentTime = (this.now() - this._responseTime) / 1e3;
35141
+ return age + residentTime;
35142
+ }
35143
+ _ageValue() {
35144
+ return toNumberOrZero(this._resHeaders.age);
35145
+ }
35146
+ /**
35147
+ * Value of applicable max-age (or heuristic equivalent) in seconds. This counts since response's `Date`.
35148
+ *
35149
+ * For an up-to-date value, see `timeToLive()`.
35150
+ *
35151
+ * @return Number
35152
+ */
35153
+ maxAge() {
35154
+ if (!this.storable() || this._rescc["no-cache"]) {
35155
+ return 0;
35156
+ }
35157
+ if (this._isShared && (this._resHeaders["set-cookie"] && !this._rescc.public && !this._rescc.immutable)) {
35158
+ return 0;
35159
+ }
35160
+ if (this._resHeaders.vary === "*") {
35161
+ return 0;
35162
+ }
35163
+ if (this._isShared) {
35164
+ if (this._rescc["proxy-revalidate"]) {
35165
+ return 0;
35166
+ }
35167
+ if (this._rescc["s-maxage"]) {
35168
+ return toNumberOrZero(this._rescc["s-maxage"]);
35169
+ }
35170
+ }
35171
+ if (this._rescc["max-age"]) {
35172
+ return toNumberOrZero(this._rescc["max-age"]);
35173
+ }
35174
+ const defaultMinTtl = this._rescc.immutable ? this._immutableMinTtl : 0;
35175
+ const serverDate = this.date();
35176
+ if (this._resHeaders.expires) {
35177
+ const expires = Date.parse(this._resHeaders.expires);
35178
+ if (Number.isNaN(expires) || expires < serverDate) {
35179
+ return 0;
35180
+ }
35181
+ return Math.max(defaultMinTtl, (expires - serverDate) / 1e3);
35182
+ }
35183
+ if (this._resHeaders["last-modified"]) {
35184
+ const lastModified = Date.parse(this._resHeaders["last-modified"]);
35185
+ if (isFinite(lastModified) && serverDate > lastModified) {
35186
+ return Math.max(
35187
+ defaultMinTtl,
35188
+ (serverDate - lastModified) / 1e3 * this._cacheHeuristic
35189
+ );
35190
+ }
35191
+ }
35192
+ return defaultMinTtl;
35193
+ }
35194
+ timeToLive() {
35195
+ const age = this.maxAge() - this.age();
35196
+ const staleIfErrorAge = age + toNumberOrZero(this._rescc["stale-if-error"]);
35197
+ const staleWhileRevalidateAge = age + toNumberOrZero(this._rescc["stale-while-revalidate"]);
35198
+ return Math.max(0, age, staleIfErrorAge, staleWhileRevalidateAge) * 1e3;
35199
+ }
35200
+ stale() {
35201
+ return this.maxAge() <= this.age();
35202
+ }
35203
+ _useStaleIfError() {
35204
+ return this.maxAge() + toNumberOrZero(this._rescc["stale-if-error"]) > this.age();
35205
+ }
35206
+ useStaleWhileRevalidate() {
35207
+ return this.maxAge() + toNumberOrZero(this._rescc["stale-while-revalidate"]) > this.age();
35208
+ }
35209
+ static fromObject(obj) {
35210
+ return new this(void 0, void 0, { _fromObject: obj });
35211
+ }
35212
+ _fromObject(obj) {
35213
+ if (this._responseTime) throw Error("Reinitialized");
35214
+ if (!obj || obj.v !== 1) throw Error("Invalid serialization");
35215
+ this._responseTime = obj.t;
35216
+ this._isShared = obj.sh;
35217
+ this._cacheHeuristic = obj.ch;
35218
+ this._immutableMinTtl = obj.imm !== void 0 ? obj.imm : 24 * 3600 * 1e3;
35219
+ this._status = obj.st;
35220
+ this._resHeaders = obj.resh;
35221
+ this._rescc = obj.rescc;
35222
+ this._method = obj.m;
35223
+ this._url = obj.u;
35224
+ this._host = obj.h;
35225
+ this._noAuthorization = obj.a;
35226
+ this._reqHeaders = obj.reqh;
35227
+ this._reqcc = obj.reqcc;
35228
+ }
35229
+ toObject() {
35230
+ return {
35231
+ v: 1,
35232
+ t: this._responseTime,
35233
+ sh: this._isShared,
35234
+ ch: this._cacheHeuristic,
35235
+ imm: this._immutableMinTtl,
35236
+ st: this._status,
35237
+ resh: this._resHeaders,
35238
+ rescc: this._rescc,
35239
+ m: this._method,
35240
+ u: this._url,
35241
+ h: this._host,
35242
+ a: this._noAuthorization,
35243
+ reqh: this._reqHeaders,
35244
+ reqcc: this._reqcc
35245
+ };
35246
+ }
35247
+ /**
35248
+ * Headers for sending to the origin server to revalidate stale response.
35249
+ * Allows server to return 304 to allow reuse of the previous response.
35250
+ *
35251
+ * Hop by hop headers are always stripped.
35252
+ * Revalidation headers may be added or removed, depending on request.
35253
+ */
35254
+ revalidationHeaders(incomingReq) {
35255
+ this._assertRequestHasHeaders(incomingReq);
35256
+ const headers = this._copyWithoutHopByHopHeaders(incomingReq.headers);
35257
+ delete headers["if-range"];
35258
+ if (!this._requestMatches(incomingReq, true) || !this.storable()) {
35259
+ delete headers["if-none-match"];
35260
+ delete headers["if-modified-since"];
35261
+ return headers;
35262
+ }
35263
+ if (this._resHeaders.etag) {
35264
+ headers["if-none-match"] = headers["if-none-match"] ? `${headers["if-none-match"]}, ${this._resHeaders.etag}` : this._resHeaders.etag;
35265
+ }
35266
+ const forbidsWeakValidators = headers["accept-ranges"] || headers["if-match"] || headers["if-unmodified-since"] || this._method && this._method != "GET";
35267
+ if (forbidsWeakValidators) {
35268
+ delete headers["if-modified-since"];
35269
+ if (headers["if-none-match"]) {
35270
+ const etags = headers["if-none-match"].split(/,/).filter((etag) => {
35271
+ return !/^\s*W\//.test(etag);
35272
+ });
35273
+ if (!etags.length) {
35274
+ delete headers["if-none-match"];
35275
+ } else {
35276
+ headers["if-none-match"] = etags.join(",").trim();
35277
+ }
35278
+ }
35279
+ } else if (this._resHeaders["last-modified"] && !headers["if-modified-since"]) {
35280
+ headers["if-modified-since"] = this._resHeaders["last-modified"];
35281
+ }
35282
+ return headers;
35283
+ }
35284
+ /**
35285
+ * Creates new CachePolicy with information combined from the previews response,
35286
+ * and the new revalidation response.
35287
+ *
35288
+ * Returns {policy, modified} where modified is a boolean indicating
35289
+ * whether the response body has been modified, and old cached body can't be used.
35290
+ *
35291
+ * @return {Object} {policy: CachePolicy, modified: Boolean}
35292
+ */
35293
+ revalidatedPolicy(request, response) {
35294
+ this._assertRequestHasHeaders(request);
35295
+ if (this._useStaleIfError() && isErrorResponse(response)) {
35296
+ return {
35297
+ modified: false,
35298
+ matches: false,
35299
+ policy: this
35300
+ };
35301
+ }
35302
+ if (!response || !response.headers) {
35303
+ throw Error("Response headers missing");
35304
+ }
35305
+ let matches = false;
35306
+ if (response.status !== void 0 && response.status != 304) {
35307
+ matches = false;
35308
+ } else if (response.headers.etag && !/^\s*W\//.test(response.headers.etag)) {
35309
+ matches = this._resHeaders.etag && this._resHeaders.etag.replace(/^\s*W\//, "") === response.headers.etag;
35310
+ } else if (this._resHeaders.etag && response.headers.etag) {
35311
+ matches = this._resHeaders.etag.replace(/^\s*W\//, "") === response.headers.etag.replace(/^\s*W\//, "");
35312
+ } else if (this._resHeaders["last-modified"]) {
35313
+ matches = this._resHeaders["last-modified"] === response.headers["last-modified"];
35314
+ } else {
35315
+ if (!this._resHeaders.etag && !this._resHeaders["last-modified"] && !response.headers.etag && !response.headers["last-modified"]) {
35316
+ matches = true;
35317
+ }
35318
+ }
35319
+ if (!matches) {
35320
+ return {
35321
+ policy: new this.constructor(request, response),
35322
+ // Client receiving 304 without body, even if it's invalid/mismatched has no option
35323
+ // but to reuse a cached body. We don't have a good way to tell clients to do
35324
+ // error recovery in such case.
35325
+ modified: response.status != 304,
35326
+ matches: false
35327
+ };
35328
+ }
35329
+ const headers = {};
35330
+ for (const k in this._resHeaders) {
35331
+ headers[k] = k in response.headers && !excludedFromRevalidationUpdate[k] ? response.headers[k] : this._resHeaders[k];
35332
+ }
35333
+ const newResponse = Object.assign({}, response, {
35334
+ status: this._status,
35335
+ method: this._method,
35336
+ headers
35337
+ });
35338
+ return {
35339
+ policy: new this.constructor(request, newResponse, {
35340
+ shared: this._isShared,
35341
+ cacheHeuristic: this._cacheHeuristic,
35342
+ immutableMinTimeToLive: this._immutableMinTtl
35343
+ }),
35344
+ modified: false,
35345
+ matches: true
35346
+ };
35347
+ }
35348
+ };
35349
+ }
35350
+ });
35351
+
34887
35352
  // ../../node_modules/negotiator/lib/charset.js
34888
35353
  var require_charset = __commonJS({
34889
35354
  "../../node_modules/negotiator/lib/charset.js"(exports2, module2) {
@@ -50909,4 +51374,4 @@ make-fetch-happen/lib/fetch.js:
50909
51374
  * governing permissions and limitations under the License.
50910
51375
  *)
50911
51376
  */
50912
- //# sourceMappingURL=chunk-L53ZVQB7.js.map
51377
+ //# sourceMappingURL=chunk-Y5LMYOCJ.js.map