@absolutejs/deploy 0.23.0 → 0.25.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 (79) hide show
  1. package/README.md +204 -123
  2. package/dist/appStoreConnect.d.ts +182 -0
  3. package/dist/appStoreConnect.js +587 -0
  4. package/dist/appStoreConnect.js.map +10 -0
  5. package/dist/cloudTarget.d.ts +4 -4
  6. package/dist/cloudflare.d.ts +2 -2
  7. package/dist/cloudflare.js +11 -9
  8. package/dist/cloudflare.js.map +3 -3
  9. package/dist/deployer.d.ts +9 -9
  10. package/dist/digitalocean.d.ts +5 -5
  11. package/dist/digitalocean.js +21 -13
  12. package/dist/digitalocean.js.map +5 -5
  13. package/dist/digitaloceanDns.d.ts +2 -2
  14. package/dist/digitaloceanDns.js +16 -8
  15. package/dist/digitaloceanDns.js.map +6 -6
  16. package/dist/digitaloceanEphemeralInfrastructure.js +16 -8
  17. package/dist/digitaloceanEphemeralInfrastructure.js.map +5 -5
  18. package/dist/digitaloceanInfrastructure.js +16 -8
  19. package/dist/digitaloceanInfrastructure.js.map +6 -6
  20. package/dist/digitaloceanIngress.js +16 -8
  21. package/dist/digitaloceanIngress.js.map +5 -5
  22. package/dist/dns.d.ts +1 -1
  23. package/dist/dns.js +9 -7
  24. package/dist/dns.js.map +3 -3
  25. package/dist/edgeIngress.js +11 -9
  26. package/dist/edgeIngress.js.map +2 -2
  27. package/dist/env.d.ts +1 -1
  28. package/dist/env.js +13 -11
  29. package/dist/env.js.map +3 -3
  30. package/dist/gcp.js +99 -93
  31. package/dist/gcp.js.map +3 -3
  32. package/dist/gcpIngress.js +93 -91
  33. package/dist/gcpIngress.js.map +2 -2
  34. package/dist/googlePlay.d.ts +10 -2
  35. package/dist/googlePlay.js +96 -91
  36. package/dist/googlePlay.js.map +3 -3
  37. package/dist/hetzner.d.ts +3 -3
  38. package/dist/hetzner.js +21 -13
  39. package/dist/hetzner.js.map +5 -5
  40. package/dist/hetznerDns.d.ts +2 -2
  41. package/dist/hetznerDns.js +11 -9
  42. package/dist/hetznerDns.js.map +3 -3
  43. package/dist/hetznerInfrastructure.js +16 -8
  44. package/dist/hetznerInfrastructure.js.map +7 -7
  45. package/dist/index.d.ts +5 -1
  46. package/dist/index.js +1347 -284
  47. package/dist/index.js.map +10 -8
  48. package/dist/linode.d.ts +3 -3
  49. package/dist/linode.js +21 -13
  50. package/dist/linode.js.map +5 -5
  51. package/dist/linodeInfrastructure.js +21 -9
  52. package/dist/linodeInfrastructure.js.map +7 -7
  53. package/dist/managedPreview.js +9 -7
  54. package/dist/managedPreview.js.map +2 -2
  55. package/dist/mobileUpdate.d.ts +109 -0
  56. package/dist/mobileUpdate.js +464 -0
  57. package/dist/mobileUpdate.js.map +10 -0
  58. package/dist/nativeRelease.d.ts +17 -1
  59. package/dist/nativeRelease.js +63 -22
  60. package/dist/nativeRelease.js.map +3 -3
  61. package/dist/preview.d.ts +3 -3
  62. package/dist/preview.js +15 -10
  63. package/dist/preview.js.map +3 -3
  64. package/dist/processManagers.d.ts +4 -4
  65. package/dist/releaseArtifact.js +12 -10
  66. package/dist/releaseArtifact.js.map +2 -2
  67. package/dist/route53.d.ts +2 -2
  68. package/dist/route53.js +9 -7
  69. package/dist/route53.js.map +3 -3
  70. package/dist/targets.d.ts +1 -1
  71. package/dist/tls.d.ts +5 -5
  72. package/dist/tls.js +23 -18
  73. package/dist/tls.js.map +3 -3
  74. package/dist/vultr.d.ts +4 -4
  75. package/dist/vultr.js +21 -13
  76. package/dist/vultr.js.map +5 -5
  77. package/dist/vultrInfrastructure.js +16 -8
  78. package/dist/vultrInfrastructure.js.map +7 -7
  79. package/package.json +12 -2
package/dist/index.js CHANGED
@@ -19,12 +19,14 @@ var __toESM = (mod, isNodeMode, target) => {
19
19
  }
20
20
  target = mod != null ? __create(__getProtoOf(mod)) : {};
21
21
  const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
22
- for (let key of __getOwnPropNames(mod))
23
- if (!__hasOwnProp.call(to, key))
24
- __defProp(to, key, {
25
- get: __accessProp.bind(mod, key),
26
- enumerable: true
27
- });
22
+ if (mod && typeof mod === "object" || typeof mod === "function") {
23
+ for (let key of __getOwnPropNames(mod))
24
+ if (!__hasOwnProp.call(to, key))
25
+ __defProp(to, key, {
26
+ get: __accessProp.bind(mod, key),
27
+ enumerable: true
28
+ });
29
+ }
28
30
  if (canCache)
29
31
  cache.set(mod, to);
30
32
  return to;
@@ -33,7 +35,7 @@ var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports,
33
35
  var __require = import.meta.require;
34
36
 
35
37
  // node_modules/extend/index.js
36
- var require_extend = __commonJS((exports, module) => {
38
+ var require_extend = __commonJS(function(exports, module) {
37
39
  var hasOwn = Object.prototype.hasOwnProperty;
38
40
  var toStr = Object.prototype.toString;
39
41
  var defineProperty = Object.defineProperty;
@@ -120,7 +122,7 @@ var require_extend = __commonJS((exports, module) => {
120
122
  });
121
123
 
122
124
  // node_modules/gaxios/package.json
123
- var require_package = __commonJS((exports, module) => {
125
+ var require_package = __commonJS(function(exports, module) {
124
126
  module.exports = {
125
127
  name: "gaxios",
126
128
  version: "7.2.0",
@@ -229,13 +231,13 @@ var require_package = __commonJS((exports, module) => {
229
231
  });
230
232
 
231
233
  // node_modules/gaxios/build/cjs/src/util.cjs
232
- var require_util = __commonJS((exports, module) => {
234
+ var require_util = __commonJS(function(exports, module) {
233
235
  var pkg = require_package();
234
236
  module.exports = { pkg };
235
237
  });
236
238
 
237
239
  // node_modules/gaxios/build/cjs/src/common.js
238
- var require_common = __commonJS((exports) => {
240
+ var require_common = __commonJS(function(exports) {
239
241
  var __importDefault = exports && exports.__importDefault || function(mod) {
240
242
  return mod && mod.__esModule ? mod : { default: mod };
241
243
  };
@@ -353,8 +355,8 @@ var require_common = __commonJS((exports) => {
353
355
  }
354
356
  function redactString(obj, key) {
355
357
  if (typeof obj === "object" && obj !== null && typeof obj[key] === "string") {
356
- const text = obj[key];
357
- if (/grant_type=/i.test(text) || /assertion=/i.test(text) || /secret/i.test(text)) {
358
+ const text2 = obj[key];
359
+ if (/grant_type=/i.test(text2) || /assertion=/i.test(text2) || /secret/i.test(text2)) {
358
360
  obj[key] = REDACT;
359
361
  }
360
362
  }
@@ -406,7 +408,7 @@ var require_common = __commonJS((exports) => {
406
408
  });
407
409
 
408
410
  // node_modules/gaxios/build/cjs/src/retry.js
409
- var require_retry = __commonJS((exports) => {
411
+ var require_retry = __commonJS(function(exports) {
410
412
  Object.defineProperty(exports, "__esModule", { value: true });
411
413
  exports.getRetryConfig = getRetryConfig;
412
414
  async function getRetryConfig(err) {
@@ -500,7 +502,7 @@ var require_retry = __commonJS((exports) => {
500
502
  });
501
503
 
502
504
  // node_modules/gaxios/build/cjs/src/interceptor.js
503
- var require_interceptor = __commonJS((exports) => {
505
+ var require_interceptor = __commonJS(function(exports) {
504
506
  Object.defineProperty(exports, "__esModule", { value: true });
505
507
  exports.GaxiosInterceptorManager = undefined;
506
508
 
@@ -510,7 +512,7 @@ var require_interceptor = __commonJS((exports) => {
510
512
  });
511
513
 
512
514
  // node_modules/ms/index.js
513
- var require_ms = __commonJS((exports, module) => {
515
+ var require_ms = __commonJS(function(exports, module) {
514
516
  var s = 1000;
515
517
  var m = s * 60;
516
518
  var h = m * 60;
@@ -620,7 +622,7 @@ var require_ms = __commonJS((exports, module) => {
620
622
  });
621
623
 
622
624
  // node_modules/debug/src/common.js
623
- var require_common2 = __commonJS((exports, module) => {
625
+ var require_common2 = __commonJS(function(exports, module) {
624
626
  function setup(env) {
625
627
  createDebug.debug = createDebug;
626
628
  createDebug.default = createDebug;
@@ -795,7 +797,7 @@ var require_common2 = __commonJS((exports, module) => {
795
797
  });
796
798
 
797
799
  // node_modules/debug/src/browser.js
798
- var require_browser = __commonJS((exports, module) => {
800
+ var require_browser = __commonJS(function(exports, module) {
799
801
  exports.formatArgs = formatArgs;
800
802
  exports.save = save;
801
803
  exports.load = load;
@@ -955,7 +957,7 @@ var require_browser = __commonJS((exports, module) => {
955
957
  });
956
958
 
957
959
  // node_modules/debug/src/node.js
958
- var require_node = __commonJS((exports, module) => {
960
+ var require_node = __commonJS(function(exports, module) {
959
961
  var tty = __require("tty");
960
962
  var util = __require("util");
961
963
  exports.init = init;
@@ -1126,7 +1128,7 @@ var require_node = __commonJS((exports, module) => {
1126
1128
  });
1127
1129
 
1128
1130
  // node_modules/debug/src/index.js
1129
- var require_src = __commonJS((exports, module) => {
1131
+ var require_src = __commonJS(function(exports, module) {
1130
1132
  if (typeof process === "undefined" || process.type === "renderer" || false || process.__nwjs) {
1131
1133
  module.exports = require_browser();
1132
1134
  } else {
@@ -1135,7 +1137,7 @@ var require_src = __commonJS((exports, module) => {
1135
1137
  });
1136
1138
 
1137
1139
  // node_modules/agent-base/dist/helpers.js
1138
- var require_helpers = __commonJS((exports) => {
1140
+ var require_helpers = __commonJS(function(exports) {
1139
1141
  var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
1140
1142
  if (k2 === undefined)
1141
1143
  k2 = k;
@@ -1182,7 +1184,7 @@ var require_helpers = __commonJS((exports) => {
1182
1184
  return Buffer.concat(chunks, length);
1183
1185
  }
1184
1186
  exports.toBuffer = toBuffer;
1185
- async function json(stream) {
1187
+ async function json2(stream) {
1186
1188
  const buf = await toBuffer(stream);
1187
1189
  const str = buf.toString("utf8");
1188
1190
  try {
@@ -1193,7 +1195,7 @@ var require_helpers = __commonJS((exports) => {
1193
1195
  throw err;
1194
1196
  }
1195
1197
  }
1196
- exports.json = json;
1198
+ exports.json = json2;
1197
1199
  function req(url, opts = {}) {
1198
1200
  const href = typeof url === "string" ? url : url.href;
1199
1201
  const req2 = (href.startsWith("https:") ? https : http).request(url, opts);
@@ -1207,7 +1209,7 @@ var require_helpers = __commonJS((exports) => {
1207
1209
  });
1208
1210
 
1209
1211
  // node_modules/agent-base/dist/index.js
1210
- var require_dist = __commonJS((exports) => {
1212
+ var require_dist = __commonJS(function(exports) {
1211
1213
  var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
1212
1214
  if (k2 === undefined)
1213
1215
  k2 = k;
@@ -1358,7 +1360,7 @@ var require_dist = __commonJS((exports) => {
1358
1360
  });
1359
1361
 
1360
1362
  // node_modules/https-proxy-agent/dist/parse-proxy-response.js
1361
- var require_parse_proxy_response = __commonJS((exports) => {
1363
+ var require_parse_proxy_response = __commonJS(function(exports) {
1362
1364
  var __importDefault = exports && exports.__importDefault || function(mod) {
1363
1365
  return mod && mod.__esModule ? mod : { default: mod };
1364
1366
  };
@@ -1454,7 +1456,7 @@ var require_parse_proxy_response = __commonJS((exports) => {
1454
1456
  });
1455
1457
 
1456
1458
  // node_modules/https-proxy-agent/dist/index.js
1457
- var require_dist2 = __commonJS((exports) => {
1459
+ var require_dist2 = __commonJS(function(exports) {
1458
1460
  var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
1459
1461
  if (k2 === undefined)
1460
1462
  k2 = k;
@@ -1602,7 +1604,7 @@ var require_dist2 = __commonJS((exports) => {
1602
1604
  });
1603
1605
 
1604
1606
  // node_modules/gaxios/build/cjs/src/gaxios.js
1605
- var require_gaxios = __commonJS((exports) => {
1607
+ var require_gaxios = __commonJS(function(exports) {
1606
1608
  var __importDefault = exports && exports.__importDefault || function(mod) {
1607
1609
  return mod && mod.__esModule ? mod : { default: mod };
1608
1610
  };
@@ -1960,7 +1962,7 @@ Content-Type: ${partContentType}\r
1960
1962
  });
1961
1963
 
1962
1964
  // node_modules/gaxios/build/cjs/src/index.js
1963
- var require_src2 = __commonJS((exports) => {
1965
+ var require_src2 = __commonJS(function(exports) {
1964
1966
  var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
1965
1967
  if (k2 === undefined)
1966
1968
  k2 = k;
@@ -2000,7 +2002,7 @@ var require_src2 = __commonJS((exports) => {
2000
2002
  });
2001
2003
 
2002
2004
  // node_modules/bignumber.js/bignumber.js
2003
- var require_bignumber = __commonJS((exports, module) => {
2005
+ var require_bignumber = __commonJS(function(exports, module) {
2004
2006
  (function(globalObject) {
2005
2007
  var BigNumber, isNumeric = /^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i, mathceil = Math.ceil, mathfloor = Math.floor, bignumberError = "[BigNumber Error] ", tooManyDigits = bignumberError + "Number primitive has more than 15 significant digits: ", BASE = 100000000000000, LOG_BASE = 14, MAX_SAFE_INTEGER = 9007199254740991, POWS_TEN = [1, 10, 100, 1000, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9, 10000000000, 100000000000, 1000000000000, 10000000000000], SQRT_BASE = 1e7, MAX = 1e9;
2006
2008
  function clone(configObject) {
@@ -3454,7 +3456,7 @@ var require_bignumber = __commonJS((exports, module) => {
3454
3456
  });
3455
3457
 
3456
3458
  // node_modules/json-bigint/lib/stringify.js
3457
- var require_stringify = __commonJS((exports, module) => {
3459
+ var require_stringify = __commonJS(function(exports, module) {
3458
3460
  var BigNumber = require_bignumber();
3459
3461
  var JSON2 = exports;
3460
3462
  (function() {
@@ -3566,7 +3568,7 @@ var require_stringify = __commonJS((exports, module) => {
3566
3568
  });
3567
3569
 
3568
3570
  // node_modules/json-bigint/lib/parse.js
3569
- var require_parse = __commonJS((exports, module) => {
3571
+ var require_parse = __commonJS(function(exports, module) {
3570
3572
  var BigNumber = null;
3571
3573
  var suspectProtoRx = /(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])/;
3572
3574
  var suspectConstructorRx = /(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)/;
@@ -3613,18 +3615,18 @@ var require_parse = __commonJS((exports, module) => {
3613
3615
  `,
3614
3616
  r: "\r",
3615
3617
  t: "\t"
3616
- }, text, error = function(m) {
3618
+ }, text2, error = function(m) {
3617
3619
  throw {
3618
3620
  name: "SyntaxError",
3619
3621
  message: m,
3620
3622
  at,
3621
- text
3623
+ text: text2
3622
3624
  };
3623
3625
  }, next = function(c) {
3624
3626
  if (c && c !== ch) {
3625
3627
  error("Expected '" + c + "' instead of '" + ch + "'");
3626
3628
  }
3627
- ch = text.charAt(at);
3629
+ ch = text2.charAt(at);
3628
3630
  at += 1;
3629
3631
  return ch;
3630
3632
  }, number = function() {
@@ -3673,13 +3675,13 @@ var require_parse = __commonJS((exports, module) => {
3673
3675
  while (next()) {
3674
3676
  if (ch === '"') {
3675
3677
  if (at - 1 > startAt)
3676
- string2 += text.substring(startAt, at - 1);
3678
+ string2 += text2.substring(startAt, at - 1);
3677
3679
  next();
3678
3680
  return string2;
3679
3681
  }
3680
3682
  if (ch === "\\") {
3681
3683
  if (at - 1 > startAt)
3682
- string2 += text.substring(startAt, at - 1);
3684
+ string2 += text2.substring(startAt, at - 1);
3683
3685
  next();
3684
3686
  if (ch === "u") {
3685
3687
  uffff = 0;
@@ -3749,20 +3751,20 @@ var require_parse = __commonJS((exports, module) => {
3749
3751
  }
3750
3752
  }
3751
3753
  error("Bad array");
3752
- }, object = function() {
3753
- var key, object2 = Object.create(null);
3754
+ }, object2 = function() {
3755
+ var key, object3 = Object.create(null);
3754
3756
  if (ch === "{") {
3755
3757
  next("{");
3756
3758
  white();
3757
3759
  if (ch === "}") {
3758
3760
  next("}");
3759
- return object2;
3761
+ return object3;
3760
3762
  }
3761
3763
  while (ch) {
3762
3764
  key = string();
3763
3765
  white();
3764
3766
  next(":");
3765
- if (_options.strict === true && Object.hasOwnProperty.call(object2, key)) {
3767
+ if (_options.strict === true && Object.hasOwnProperty.call(object3, key)) {
3766
3768
  error('Duplicate key "' + key + '"');
3767
3769
  }
3768
3770
  if (suspectProtoRx.test(key) === true) {
@@ -3771,7 +3773,7 @@ var require_parse = __commonJS((exports, module) => {
3771
3773
  } else if (_options.protoAction === "ignore") {
3772
3774
  value();
3773
3775
  } else {
3774
- object2[key] = value();
3776
+ object3[key] = value();
3775
3777
  }
3776
3778
  } else if (suspectConstructorRx.test(key) === true) {
3777
3779
  if (_options.constructorAction === "error") {
@@ -3779,15 +3781,15 @@ var require_parse = __commonJS((exports, module) => {
3779
3781
  } else if (_options.constructorAction === "ignore") {
3780
3782
  value();
3781
3783
  } else {
3782
- object2[key] = value();
3784
+ object3[key] = value();
3783
3785
  }
3784
3786
  } else {
3785
- object2[key] = value();
3787
+ object3[key] = value();
3786
3788
  }
3787
3789
  white();
3788
3790
  if (ch === "}") {
3789
3791
  next("}");
3790
- return object2;
3792
+ return object3;
3791
3793
  }
3792
3794
  next(",");
3793
3795
  white();
@@ -3799,7 +3801,7 @@ var require_parse = __commonJS((exports, module) => {
3799
3801
  white();
3800
3802
  switch (ch) {
3801
3803
  case "{":
3802
- return object();
3804
+ return object2();
3803
3805
  case "[":
3804
3806
  return array();
3805
3807
  case '"':
@@ -3812,7 +3814,7 @@ var require_parse = __commonJS((exports, module) => {
3812
3814
  };
3813
3815
  return function(source, reviver) {
3814
3816
  var result;
3815
- text = source + "";
3817
+ text2 = source + "";
3816
3818
  at = 0;
3817
3819
  ch = " ";
3818
3820
  result = value();
@@ -3840,7 +3842,7 @@ var require_parse = __commonJS((exports, module) => {
3840
3842
  });
3841
3843
 
3842
3844
  // node_modules/json-bigint/index.js
3843
- var require_json_bigint = __commonJS((exports, module) => {
3845
+ var require_json_bigint = __commonJS(function(exports, module) {
3844
3846
  var json_stringify = require_stringify().stringify;
3845
3847
  var json_parse = require_parse();
3846
3848
  module.exports = function(options) {
@@ -3854,7 +3856,7 @@ var require_json_bigint = __commonJS((exports, module) => {
3854
3856
  });
3855
3857
 
3856
3858
  // node_modules/gcp-metadata/build/src/gcp-residency.js
3857
- var require_gcp_residency = __commonJS((exports) => {
3859
+ var require_gcp_residency = __commonJS(function(exports) {
3858
3860
  Object.defineProperty(exports, "__esModule", { value: true });
3859
3861
  exports.GCE_LINUX_BIOS_PATHS = undefined;
3860
3862
  exports.isGoogleCloudServerless = isGoogleCloudServerless;
@@ -3906,7 +3908,7 @@ var require_gcp_residency = __commonJS((exports) => {
3906
3908
  });
3907
3909
 
3908
3910
  // node_modules/google-logging-utils/build/src/colours.js
3909
- var require_colours = __commonJS((exports) => {
3911
+ var require_colours = __commonJS(function(exports) {
3910
3912
  Object.defineProperty(exports, "__esModule", { value: true });
3911
3913
  exports.Colours = undefined;
3912
3914
 
@@ -3960,7 +3962,7 @@ var require_colours = __commonJS((exports) => {
3960
3962
  });
3961
3963
 
3962
3964
  // node_modules/google-logging-utils/build/src/logging-utils.js
3963
- var require_logging_utils = __commonJS((exports) => {
3965
+ var require_logging_utils = __commonJS(function(exports) {
3964
3966
  var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
3965
3967
  if (k2 === undefined)
3966
3968
  k2 = k;
@@ -4170,11 +4172,11 @@ var require_logging_utils = __commonJS((exports) => {
4170
4172
  return (fields, ...args) => {
4171
4173
  var _a2;
4172
4174
  const severity = (_a2 = fields.severity) !== null && _a2 !== undefined ? _a2 : LogSeverity.INFO;
4173
- const json = Object.assign({
4175
+ const json2 = Object.assign({
4174
4176
  severity,
4175
4177
  message: util.format(...args)
4176
4178
  }, fields);
4177
- const jsonString = JSON.stringify(json);
4179
+ const jsonString = JSON.stringify(json2);
4178
4180
  if (debugLogger) {
4179
4181
  debugLogger(fields, jsonString);
4180
4182
  } else {
@@ -4242,7 +4244,7 @@ var require_logging_utils = __commonJS((exports) => {
4242
4244
  });
4243
4245
 
4244
4246
  // node_modules/google-logging-utils/build/src/index.js
4245
- var require_src3 = __commonJS((exports) => {
4247
+ var require_src3 = __commonJS(function(exports) {
4246
4248
  var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
4247
4249
  if (k2 === undefined)
4248
4250
  k2 = k;
@@ -4268,7 +4270,7 @@ var require_src3 = __commonJS((exports) => {
4268
4270
  });
4269
4271
 
4270
4272
  // node_modules/gcp-metadata/build/src/index.js
4271
- var require_src4 = __commonJS((exports) => {
4273
+ var require_src4 = __commonJS(function(exports) {
4272
4274
  var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
4273
4275
  if (k2 === undefined)
4274
4276
  k2 = k;
@@ -4519,7 +4521,7 @@ var require_src4 = __commonJS((exports) => {
4519
4521
  });
4520
4522
 
4521
4523
  // node_modules/base64-js/index.js
4522
- var require_base64_js = __commonJS((exports) => {
4524
+ var require_base64_js = __commonJS(function(exports) {
4523
4525
  exports.byteLength = byteLength;
4524
4526
  exports.toByteArray = toByteArray;
4525
4527
  exports.fromByteArray = fromByteArray;
@@ -4614,7 +4616,7 @@ var require_base64_js = __commonJS((exports) => {
4614
4616
  });
4615
4617
 
4616
4618
  // node_modules/google-auth-library/build/src/crypto/shared.js
4617
- var require_shared = __commonJS((exports) => {
4619
+ var require_shared = __commonJS(function(exports) {
4618
4620
  Object.defineProperty(exports, "__esModule", { value: true });
4619
4621
  exports.fromArrayBufferToHex = fromArrayBufferToHex;
4620
4622
  function fromArrayBufferToHex(arrayBuffer) {
@@ -4626,7 +4628,7 @@ var require_shared = __commonJS((exports) => {
4626
4628
  });
4627
4629
 
4628
4630
  // node_modules/google-auth-library/build/src/crypto/browser/crypto.js
4629
- var require_crypto = __commonJS((exports) => {
4631
+ var require_crypto = __commonJS(function(exports) {
4630
4632
  Object.defineProperty(exports, "__esModule", { value: true });
4631
4633
  exports.BrowserCrypto = undefined;
4632
4634
  var base64js = require_base64_js();
@@ -4680,8 +4682,8 @@ var require_crypto = __commonJS((exports) => {
4680
4682
  const result = new TextDecoder().decode(uint8array);
4681
4683
  return result;
4682
4684
  }
4683
- encodeBase64StringUtf8(text) {
4684
- const uint8array = new TextEncoder().encode(text);
4685
+ encodeBase64StringUtf8(text2) {
4686
+ const uint8array = new TextEncoder().encode(text2);
4685
4687
  const result = base64js.fromByteArray(uint8array);
4686
4688
  return result;
4687
4689
  }
@@ -4706,7 +4708,7 @@ var require_crypto = __commonJS((exports) => {
4706
4708
  });
4707
4709
 
4708
4710
  // node_modules/google-auth-library/build/src/crypto/node/crypto.js
4709
- var require_crypto2 = __commonJS((exports) => {
4711
+ var require_crypto2 = __commonJS(function(exports) {
4710
4712
  Object.defineProperty(exports, "__esModule", { value: true });
4711
4713
  exports.NodeCrypto = undefined;
4712
4714
  var crypto2 = __require("crypto");
@@ -4733,8 +4735,8 @@ var require_crypto2 = __commonJS((exports) => {
4733
4735
  decodeBase64StringUtf8(base64) {
4734
4736
  return Buffer.from(base64, "base64").toString("utf-8");
4735
4737
  }
4736
- encodeBase64StringUtf8(text) {
4737
- return Buffer.from(text, "utf-8").toString("base64");
4738
+ encodeBase64StringUtf8(text2) {
4739
+ return Buffer.from(text2, "utf-8").toString("base64");
4738
4740
  }
4739
4741
  async sha256DigestHex(str) {
4740
4742
  return crypto2.createHash("sha256").update(str).digest("hex");
@@ -4759,7 +4761,7 @@ var require_crypto2 = __commonJS((exports) => {
4759
4761
  });
4760
4762
 
4761
4763
  // node_modules/google-auth-library/build/src/crypto/crypto.js
4762
- var require_crypto3 = __commonJS((exports) => {
4764
+ var require_crypto3 = __commonJS(function(exports) {
4763
4765
  var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
4764
4766
  if (k2 === undefined)
4765
4767
  k2 = k;
@@ -4798,7 +4800,7 @@ var require_crypto3 = __commonJS((exports) => {
4798
4800
  });
4799
4801
 
4800
4802
  // node_modules/safe-buffer/index.js
4801
- var require_safe_buffer = __commonJS((exports, module) => {
4803
+ var require_safe_buffer = __commonJS(function(exports, module) {
4802
4804
  /*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
4803
4805
  var buffer = __require("buffer");
4804
4806
  var Buffer2 = buffer.Buffer;
@@ -4855,7 +4857,7 @@ var require_safe_buffer = __commonJS((exports, module) => {
4855
4857
  });
4856
4858
 
4857
4859
  // node_modules/ecdsa-sig-formatter/src/param-bytes-for-alg.js
4858
- var require_param_bytes_for_alg = __commonJS((exports, module) => {
4860
+ var require_param_bytes_for_alg = __commonJS(function(exports, module) {
4859
4861
  function getParamSize(keySize) {
4860
4862
  var result = (keySize / 8 | 0) + (keySize % 8 === 0 ? 0 : 1);
4861
4863
  return result;
@@ -4876,7 +4878,7 @@ var require_param_bytes_for_alg = __commonJS((exports, module) => {
4876
4878
  });
4877
4879
 
4878
4880
  // node_modules/ecdsa-sig-formatter/src/ecdsa-sig-formatter.js
4879
- var require_ecdsa_sig_formatter = __commonJS((exports, module) => {
4881
+ var require_ecdsa_sig_formatter = __commonJS(function(exports, module) {
4880
4882
  var Buffer2 = require_safe_buffer().Buffer;
4881
4883
  var getParamBytesForAlg = require_param_bytes_for_alg();
4882
4884
  var MAX_OCTET = 128;
@@ -5013,7 +5015,7 @@ var require_ecdsa_sig_formatter = __commonJS((exports, module) => {
5013
5015
  });
5014
5016
 
5015
5017
  // node_modules/google-auth-library/build/src/util.js
5016
- var require_util2 = __commonJS((exports) => {
5018
+ var require_util2 = __commonJS(function(exports) {
5017
5019
  Object.defineProperty(exports, "__esModule", { value: true });
5018
5020
  exports.LRUCache = undefined;
5019
5021
  exports.snakeToCamel = snakeToCamel;
@@ -5023,7 +5025,7 @@ var require_util2 = __commonJS((exports) => {
5023
5025
  exports.getWellKnownCertificateConfigFileLocation = getWellKnownCertificateConfigFileLocation;
5024
5026
  var fs = __require("fs");
5025
5027
  var os = __require("os");
5026
- var path3 = __require("path");
5028
+ var path4 = __require("path");
5027
5029
  var WELL_KNOWN_CERTIFICATE_CONFIG_FILE = "certificate_config.json";
5028
5030
  var CLOUDSDK_CONFIG_DIRECTORY = "gcloud";
5029
5031
  function snakeToCamel(str) {
@@ -5074,13 +5076,13 @@ var require_util2 = __commonJS((exports) => {
5074
5076
  }
5075
5077
  }
5076
5078
  exports.LRUCache = LRUCache;
5077
- function removeUndefinedValuesInObject(object) {
5078
- Object.entries(object).forEach(([key, value]) => {
5079
+ function removeUndefinedValuesInObject(object2) {
5080
+ Object.entries(object2).forEach(([key, value]) => {
5079
5081
  if (value === undefined || value === "undefined") {
5080
- delete object[key];
5082
+ delete object2[key];
5081
5083
  }
5082
5084
  });
5083
- return object;
5085
+ return object2;
5084
5086
  }
5085
5087
  async function isValidFile(filePath) {
5086
5088
  try {
@@ -5091,8 +5093,8 @@ var require_util2 = __commonJS((exports) => {
5091
5093
  }
5092
5094
  }
5093
5095
  function getWellKnownCertificateConfigFileLocation() {
5094
- const configDir = process.env.CLOUDSDK_CONFIG || (_isWindows() ? path3.join(process.env.APPDATA || "", CLOUDSDK_CONFIG_DIRECTORY) : path3.join(process.env.HOME || "", ".config", CLOUDSDK_CONFIG_DIRECTORY));
5095
- return path3.join(configDir, WELL_KNOWN_CERTIFICATE_CONFIG_FILE);
5096
+ const configDir = process.env.CLOUDSDK_CONFIG || (_isWindows() ? path4.join(process.env.APPDATA || "", CLOUDSDK_CONFIG_DIRECTORY) : path4.join(process.env.HOME || "", ".config", CLOUDSDK_CONFIG_DIRECTORY));
5097
+ return path4.join(configDir, WELL_KNOWN_CERTIFICATE_CONFIG_FILE);
5096
5098
  }
5097
5099
  function _isWindows() {
5098
5100
  return os.platform().startsWith("win");
@@ -5100,7 +5102,7 @@ var require_util2 = __commonJS((exports) => {
5100
5102
  });
5101
5103
 
5102
5104
  // node_modules/google-auth-library/package.json
5103
- var require_package2 = __commonJS((exports, module) => {
5105
+ var require_package2 = __commonJS(function(exports, module) {
5104
5106
  module.exports = {
5105
5107
  name: "google-auth-library",
5106
5108
  version: "10.9.0",
@@ -5194,7 +5196,7 @@ var require_package2 = __commonJS((exports, module) => {
5194
5196
  });
5195
5197
 
5196
5198
  // node_modules/google-auth-library/build/src/shared.cjs
5197
- var require_shared2 = __commonJS((exports) => {
5199
+ var require_shared2 = __commonJS(function(exports) {
5198
5200
  Object.defineProperty(exports, "__esModule", { value: true });
5199
5201
  exports.USER_AGENT = exports.PRODUCT_NAME = exports.pkg = undefined;
5200
5202
  var pkg = require_package2();
@@ -5206,7 +5208,7 @@ var require_shared2 = __commonJS((exports) => {
5206
5208
  });
5207
5209
 
5208
5210
  // node_modules/google-auth-library/build/src/auth/authclient.js
5209
- var require_authclient = __commonJS((exports) => {
5211
+ var require_authclient = __commonJS(function(exports) {
5210
5212
  Object.defineProperty(exports, "__esModule", { value: true });
5211
5213
  exports.AuthClient = exports.DEFAULT_EAGER_REFRESH_THRESHOLD_MILLIS = exports.DEFAULT_UNIVERSE = undefined;
5212
5214
  var events_1 = __require("events");
@@ -5368,7 +5370,7 @@ var require_authclient = __commonJS((exports) => {
5368
5370
  });
5369
5371
 
5370
5372
  // node_modules/google-auth-library/build/src/auth/loginticket.js
5371
- var require_loginticket = __commonJS((exports) => {
5373
+ var require_loginticket = __commonJS(function(exports) {
5372
5374
  Object.defineProperty(exports, "__esModule", { value: true });
5373
5375
  exports.LoginTicket = undefined;
5374
5376
 
@@ -5400,7 +5402,7 @@ var require_loginticket = __commonJS((exports) => {
5400
5402
  });
5401
5403
 
5402
5404
  // node_modules/google-auth-library/build/src/auth/oauth2client.js
5403
- var require_oauth2client = __commonJS((exports) => {
5405
+ var require_oauth2client = __commonJS(function(exports) {
5404
5406
  Object.defineProperty(exports, "__esModule", { value: true });
5405
5407
  exports.OAuth2Client = exports.ClientAuthentication = exports.CertificateFormat = exports.CodeChallengeMethod = undefined;
5406
5408
  var gaxios_1 = require_src2();
@@ -5996,7 +5998,7 @@ var require_oauth2client = __commonJS((exports) => {
5996
5998
  });
5997
5999
 
5998
6000
  // node_modules/google-auth-library/build/src/auth/computeclient.js
5999
- var require_computeclient = __commonJS((exports) => {
6001
+ var require_computeclient = __commonJS(function(exports) {
6000
6002
  Object.defineProperty(exports, "__esModule", { value: true });
6001
6003
  exports.Compute = undefined;
6002
6004
  var gaxios_1 = require_src2();
@@ -6072,7 +6074,7 @@ var require_computeclient = __commonJS((exports) => {
6072
6074
  });
6073
6075
 
6074
6076
  // node_modules/google-auth-library/build/src/auth/idtokenclient.js
6075
- var require_idtokenclient = __commonJS((exports) => {
6077
+ var require_idtokenclient = __commonJS(function(exports) {
6076
6078
  Object.defineProperty(exports, "__esModule", { value: true });
6077
6079
  exports.IdTokenClient = undefined;
6078
6080
  var oauth2client_1 = require_oauth2client();
@@ -6110,7 +6112,7 @@ var require_idtokenclient = __commonJS((exports) => {
6110
6112
  });
6111
6113
 
6112
6114
  // node_modules/google-auth-library/build/src/auth/envDetect.js
6113
- var require_envDetect = __commonJS((exports) => {
6115
+ var require_envDetect = __commonJS(function(exports) {
6114
6116
  Object.defineProperty(exports, "__esModule", { value: true });
6115
6117
  exports.GCPEnv = undefined;
6116
6118
  exports.clear = clear;
@@ -6184,7 +6186,7 @@ var require_envDetect = __commonJS((exports) => {
6184
6186
  });
6185
6187
 
6186
6188
  // node_modules/jws/lib/data-stream.js
6187
- var require_data_stream = __commonJS((exports, module) => {
6189
+ var require_data_stream = __commonJS(function(exports, module) {
6188
6190
  var Buffer2 = require_safe_buffer().Buffer;
6189
6191
  var Stream = __require("stream");
6190
6192
  var util = __require("util");
@@ -6230,7 +6232,7 @@ var require_data_stream = __commonJS((exports, module) => {
6230
6232
  });
6231
6233
 
6232
6234
  // node_modules/buffer-equal-constant-time/index.js
6233
- var require_buffer_equal_constant_time = __commonJS((exports, module) => {
6235
+ var require_buffer_equal_constant_time = __commonJS(function(exports, module) {
6234
6236
  var Buffer2 = __require("buffer").Buffer;
6235
6237
  var SlowBuffer = __require("buffer").SlowBuffer;
6236
6238
  module.exports = bufferEq;
@@ -6261,7 +6263,7 @@ var require_buffer_equal_constant_time = __commonJS((exports, module) => {
6261
6263
  });
6262
6264
 
6263
6265
  // node_modules/jwa/index.js
6264
- var require_jwa = __commonJS((exports, module) => {
6266
+ var require_jwa = __commonJS(function(exports, module) {
6265
6267
  var Buffer2 = require_safe_buffer().Buffer;
6266
6268
  var crypto2 = __require("crypto");
6267
6269
  var formatEcdsa = require_ecdsa_sig_formatter();
@@ -6380,7 +6382,7 @@ var require_jwa = __commonJS((exports, module) => {
6380
6382
  return bufferEqual(a, b);
6381
6383
  };
6382
6384
  function createHmacVerifier(bits) {
6383
- return function verify(thing, signature, secret) {
6385
+ return function verify2(thing, signature, secret) {
6384
6386
  var computedSig = createHmacSigner(bits)(thing, secret);
6385
6387
  return timingSafeEqual(Buffer2.from(signature), Buffer2.from(computedSig));
6386
6388
  };
@@ -6395,7 +6397,7 @@ var require_jwa = __commonJS((exports, module) => {
6395
6397
  };
6396
6398
  }
6397
6399
  function createKeyVerifier(bits) {
6398
- return function verify(thing, signature, publicKey) {
6400
+ return function verify2(thing, signature, publicKey) {
6399
6401
  checkIsPublicKey(publicKey);
6400
6402
  thing = normalizeInput(thing);
6401
6403
  signature = toBase64(signature);
@@ -6418,7 +6420,7 @@ var require_jwa = __commonJS((exports, module) => {
6418
6420
  };
6419
6421
  }
6420
6422
  function createPSSKeyVerifier(bits) {
6421
- return function verify(thing, signature, publicKey) {
6423
+ return function verify2(thing, signature, publicKey) {
6422
6424
  checkIsPublicKey(publicKey);
6423
6425
  thing = normalizeInput(thing);
6424
6426
  signature = toBase64(signature);
@@ -6441,7 +6443,7 @@ var require_jwa = __commonJS((exports, module) => {
6441
6443
  }
6442
6444
  function createECDSAVerifer(bits) {
6443
6445
  var inner = createKeyVerifier(bits);
6444
- return function verify(thing, signature, publicKey) {
6446
+ return function verify2(thing, signature, publicKey) {
6445
6447
  signature = formatEcdsa.joseToDer(signature, "ES" + bits).toString("base64");
6446
6448
  var result = inner(thing, signature, publicKey);
6447
6449
  return result;
@@ -6453,7 +6455,7 @@ var require_jwa = __commonJS((exports, module) => {
6453
6455
  };
6454
6456
  }
6455
6457
  function createNoneVerifier() {
6456
- return function verify(thing, signature) {
6458
+ return function verify2(thing, signature) {
6457
6459
  return signature === "";
6458
6460
  };
6459
6461
  }
@@ -6485,7 +6487,7 @@ var require_jwa = __commonJS((exports, module) => {
6485
6487
  });
6486
6488
 
6487
6489
  // node_modules/jws/lib/tostring.js
6488
- var require_tostring = __commonJS((exports, module) => {
6490
+ var require_tostring = __commonJS(function(exports, module) {
6489
6491
  var Buffer2 = __require("buffer").Buffer;
6490
6492
  module.exports = function toString(obj) {
6491
6493
  if (typeof obj === "string")
@@ -6497,7 +6499,7 @@ var require_tostring = __commonJS((exports, module) => {
6497
6499
  });
6498
6500
 
6499
6501
  // node_modules/jws/lib/sign-stream.js
6500
- var require_sign_stream = __commonJS((exports, module) => {
6502
+ var require_sign_stream = __commonJS(function(exports, module) {
6501
6503
  var Buffer2 = require_safe_buffer().Buffer;
6502
6504
  var DataStream = require_data_stream();
6503
6505
  var jwa = require_jwa();
@@ -6570,7 +6572,7 @@ var require_sign_stream = __commonJS((exports, module) => {
6570
6572
  });
6571
6573
 
6572
6574
  // node_modules/jws/lib/verify-stream.js
6573
- var require_verify_stream = __commonJS((exports, module) => {
6575
+ var require_verify_stream = __commonJS(function(exports, module) {
6574
6576
  var Buffer2 = require_safe_buffer().Buffer;
6575
6577
  var DataStream = require_data_stream();
6576
6578
  var jwa = require_jwa();
@@ -6661,7 +6663,7 @@ var require_verify_stream = __commonJS((exports, module) => {
6661
6663
  }.bind(this));
6662
6664
  }
6663
6665
  util.inherits(VerifyStream, Stream);
6664
- VerifyStream.prototype.verify = function verify() {
6666
+ VerifyStream.prototype.verify = function verify2() {
6665
6667
  try {
6666
6668
  var valid = jwsVerify(this.signature.buffer, this.algorithm, this.key.buffer);
6667
6669
  var obj = jwsDecode(this.signature.buffer, this.encoding);
@@ -6683,7 +6685,7 @@ var require_verify_stream = __commonJS((exports, module) => {
6683
6685
  });
6684
6686
 
6685
6687
  // node_modules/jws/index.js
6686
- var require_jws = __commonJS((exports) => {
6688
+ var require_jws = __commonJS(function(exports) {
6687
6689
  var SignStream = require_sign_stream();
6688
6690
  var VerifyStream = require_verify_stream();
6689
6691
  var ALGORITHMS = [
@@ -6714,7 +6716,7 @@ var require_jws = __commonJS((exports) => {
6714
6716
  });
6715
6717
 
6716
6718
  // node_modules/google-auth-library/build/src/gtoken/jwsSign.js
6717
- var require_jwsSign = __commonJS((exports) => {
6719
+ var require_jwsSign = __commonJS(function(exports) {
6718
6720
  Object.defineProperty(exports, "__esModule", { value: true });
6719
6721
  exports.buildPayloadForJwsSign = buildPayloadForJwsSign;
6720
6722
  exports.getJwsSign = getJwsSign;
@@ -6745,7 +6747,7 @@ var require_jwsSign = __commonJS((exports) => {
6745
6747
  });
6746
6748
 
6747
6749
  // node_modules/google-auth-library/build/src/gtoken/getToken.js
6748
- var require_getToken = __commonJS((exports) => {
6750
+ var require_getToken = __commonJS(function(exports) {
6749
6751
  Object.defineProperty(exports, "__esModule", { value: true });
6750
6752
  exports.getToken = getToken;
6751
6753
  var jwsSign_1 = require_jwsSign();
@@ -6785,7 +6787,7 @@ var require_getToken = __commonJS((exports) => {
6785
6787
  });
6786
6788
 
6787
6789
  // node_modules/google-auth-library/build/src/gtoken/errorWithCode.js
6788
- var require_errorWithCode = __commonJS((exports) => {
6790
+ var require_errorWithCode = __commonJS(function(exports) {
6789
6791
  Object.defineProperty(exports, "__esModule", { value: true });
6790
6792
  exports.ErrorWithCode = undefined;
6791
6793
 
@@ -6800,14 +6802,14 @@ var require_errorWithCode = __commonJS((exports) => {
6800
6802
  });
6801
6803
 
6802
6804
  // node_modules/google-auth-library/build/src/gtoken/getCredentials.js
6803
- var require_getCredentials = __commonJS((exports) => {
6805
+ var require_getCredentials = __commonJS(function(exports) {
6804
6806
  Object.defineProperty(exports, "__esModule", { value: true });
6805
6807
  exports.getCredentials = getCredentials;
6806
- var path3 = __require("path");
6808
+ var path4 = __require("path");
6807
6809
  var fs = __require("fs");
6808
6810
  var util_1 = __require("util");
6809
6811
  var errorWithCode_1 = require_errorWithCode();
6810
- var readFile2 = fs.readFile ? (0, util_1.promisify)(fs.readFile) : async () => {
6812
+ var readFile3 = fs.readFile ? (0, util_1.promisify)(fs.readFile) : async () => {
6811
6813
  throw new errorWithCode_1.ErrorWithCode("use key rather than keyFile.", "MISSING_CREDENTIALS");
6812
6814
  };
6813
6815
  var ExtensionFiles;
@@ -6826,7 +6828,7 @@ var require_getCredentials = __commonJS((exports) => {
6826
6828
  this.keyFilePath = keyFilePath;
6827
6829
  }
6828
6830
  async getCredentials() {
6829
- const key = await readFile2(this.keyFilePath, "utf8");
6831
+ const key = await readFile3(this.keyFilePath, "utf8");
6830
6832
  let body;
6831
6833
  try {
6832
6834
  body = JSON.parse(key);
@@ -6849,7 +6851,7 @@ var require_getCredentials = __commonJS((exports) => {
6849
6851
  this.keyFilePath = keyFilePath;
6850
6852
  }
6851
6853
  async getCredentials() {
6852
- const privateKey = await readFile2(this.keyFilePath, "utf8");
6854
+ const privateKey = await readFile3(this.keyFilePath, "utf8");
6853
6855
  return { privateKey };
6854
6856
  }
6855
6857
  }
@@ -6862,7 +6864,7 @@ var require_getCredentials = __commonJS((exports) => {
6862
6864
 
6863
6865
  class CredentialsProviderFactory {
6864
6866
  static create(keyFilePath) {
6865
- const keyFileExtension = path3.extname(keyFilePath);
6867
+ const keyFileExtension = path4.extname(keyFilePath);
6866
6868
  switch (keyFileExtension) {
6867
6869
  case ExtensionFiles.JSON:
6868
6870
  return new JsonCredentialsProvider(keyFilePath);
@@ -6885,7 +6887,7 @@ var require_getCredentials = __commonJS((exports) => {
6885
6887
  });
6886
6888
 
6887
6889
  // node_modules/google-auth-library/build/src/gtoken/tokenHandler.js
6888
- var require_tokenHandler = __commonJS((exports) => {
6890
+ var require_tokenHandler = __commonJS(function(exports) {
6889
6891
  Object.defineProperty(exports, "__esModule", { value: true });
6890
6892
  exports.TokenHandler = undefined;
6891
6893
  var getToken_1 = require_getToken();
@@ -6948,7 +6950,7 @@ var require_tokenHandler = __commonJS((exports) => {
6948
6950
  });
6949
6951
 
6950
6952
  // node_modules/google-auth-library/build/src/gtoken/revokeToken.js
6951
- var require_revokeToken = __commonJS((exports) => {
6953
+ var require_revokeToken = __commonJS(function(exports) {
6952
6954
  Object.defineProperty(exports, "__esModule", { value: true });
6953
6955
  exports.revokeToken = revokeToken;
6954
6956
  var GOOGLE_REVOKE_TOKEN_URL = "https://oauth2.googleapis.com/revoke?token=";
@@ -6963,7 +6965,7 @@ var require_revokeToken = __commonJS((exports) => {
6963
6965
  });
6964
6966
 
6965
6967
  // node_modules/google-auth-library/build/src/gtoken/googleToken.js
6966
- var require_googleToken = __commonJS((exports) => {
6968
+ var require_googleToken = __commonJS(function(exports) {
6967
6969
  Object.defineProperty(exports, "__esModule", { value: true });
6968
6970
  exports.GoogleToken = undefined;
6969
6971
  var gaxios_1 = require_src2();
@@ -7038,7 +7040,7 @@ var require_googleToken = __commonJS((exports) => {
7038
7040
  });
7039
7041
 
7040
7042
  // node_modules/google-auth-library/build/src/auth/jwtaccess.js
7041
- var require_jwtaccess = __commonJS((exports) => {
7043
+ var require_jwtaccess = __commonJS(function(exports) {
7042
7044
  Object.defineProperty(exports, "__esModule", { value: true });
7043
7045
  exports.JWTAccess = undefined;
7044
7046
  var jws = require_jws();
@@ -7127,20 +7129,20 @@ var require_jwtaccess = __commonJS((exports) => {
7127
7129
  const exp = iat + 3600;
7128
7130
  return exp;
7129
7131
  }
7130
- fromJSON(json) {
7131
- if (!json) {
7132
+ fromJSON(json2) {
7133
+ if (!json2) {
7132
7134
  throw new Error("Must pass in a JSON object containing the service account auth settings.");
7133
7135
  }
7134
- if (!json.client_email) {
7136
+ if (!json2.client_email) {
7135
7137
  throw new Error("The incoming JSON object does not contain a client_email field");
7136
7138
  }
7137
- if (!json.private_key) {
7139
+ if (!json2.private_key) {
7138
7140
  throw new Error("The incoming JSON object does not contain a private_key field");
7139
7141
  }
7140
- this.email = json.client_email;
7141
- this.key = json.private_key;
7142
- this.keyId = json.private_key_id;
7143
- this.projectId = json.project_id;
7142
+ this.email = json2.client_email;
7143
+ this.key = json2.private_key;
7144
+ this.keyId = json2.private_key_id;
7145
+ this.projectId = json2.project_id;
7144
7146
  }
7145
7147
  fromStream(inputStream, callback) {
7146
7148
  if (callback) {
@@ -7171,7 +7173,7 @@ var require_jwtaccess = __commonJS((exports) => {
7171
7173
  });
7172
7174
 
7173
7175
  // node_modules/google-auth-library/build/src/auth/jwtclient.js
7174
- var require_jwtclient = __commonJS((exports) => {
7176
+ var require_jwtclient = __commonJS(function(exports) {
7175
7177
  Object.defineProperty(exports, "__esModule", { value: true });
7176
7178
  exports.JWT = undefined;
7177
7179
  var googleToken_1 = require_googleToken();
@@ -7321,22 +7323,22 @@ var require_jwtclient = __commonJS((exports) => {
7321
7323
  }
7322
7324
  return this.gtoken;
7323
7325
  }
7324
- fromJSON(json) {
7325
- if (!json) {
7326
+ fromJSON(json2) {
7327
+ if (!json2) {
7326
7328
  throw new Error("Must pass in a JSON object containing the service account auth settings.");
7327
7329
  }
7328
- if (!json.client_email) {
7330
+ if (!json2.client_email) {
7329
7331
  throw new Error("The incoming JSON object does not contain a client_email field");
7330
7332
  }
7331
- if (!json.private_key) {
7333
+ if (!json2.private_key) {
7332
7334
  throw new Error("The incoming JSON object does not contain a private_key field");
7333
7335
  }
7334
- this.email = json.client_email;
7335
- this.key = json.private_key;
7336
- this.keyId = json.private_key_id;
7337
- this.projectId = json.project_id;
7338
- this.quotaProjectId = json.quota_project_id;
7339
- this.universeDomain = json.universe_domain || this.universeDomain;
7336
+ this.email = json2.client_email;
7337
+ this.key = json2.private_key;
7338
+ this.keyId = json2.private_key_id;
7339
+ this.projectId = json2.project_id;
7340
+ this.quotaProjectId = json2.quota_project_id;
7341
+ this.universeDomain = json2.universe_domain || this.universeDomain;
7340
7342
  }
7341
7343
  fromStream(inputStream, callback) {
7342
7344
  if (callback) {
@@ -7383,7 +7385,7 @@ var require_jwtclient = __commonJS((exports) => {
7383
7385
  });
7384
7386
 
7385
7387
  // node_modules/google-auth-library/build/src/auth/refreshclient.js
7386
- var require_refreshclient = __commonJS((exports) => {
7388
+ var require_refreshclient = __commonJS(function(exports) {
7387
7389
  Object.defineProperty(exports, "__esModule", { value: true });
7388
7390
  exports.UserRefreshClient = exports.USER_REFRESH_ACCOUNT_TYPE = undefined;
7389
7391
  var oauth2client_1 = require_oauth2client();
@@ -7425,28 +7427,28 @@ var require_refreshclient = __commonJS((exports) => {
7425
7427
  const res = await this.transporter.request(opts);
7426
7428
  return res.data.id_token;
7427
7429
  }
7428
- fromJSON(json) {
7429
- if (!json) {
7430
+ fromJSON(json2) {
7431
+ if (!json2) {
7430
7432
  throw new Error("Must pass in a JSON object containing the user refresh token");
7431
7433
  }
7432
- if (json.type !== "authorized_user") {
7434
+ if (json2.type !== "authorized_user") {
7433
7435
  throw new Error('The incoming JSON object does not have the "authorized_user" type');
7434
7436
  }
7435
- if (!json.client_id) {
7437
+ if (!json2.client_id) {
7436
7438
  throw new Error("The incoming JSON object does not contain a client_id field");
7437
7439
  }
7438
- if (!json.client_secret) {
7440
+ if (!json2.client_secret) {
7439
7441
  throw new Error("The incoming JSON object does not contain a client_secret field");
7440
7442
  }
7441
- if (!json.refresh_token) {
7443
+ if (!json2.refresh_token) {
7442
7444
  throw new Error("The incoming JSON object does not contain a refresh_token field");
7443
7445
  }
7444
- this._clientId = json.client_id;
7445
- this._clientSecret = json.client_secret;
7446
- this._refreshToken = json.refresh_token;
7447
- this.credentials.refresh_token = json.refresh_token;
7448
- this.quotaProjectId = json.quota_project_id;
7449
- this.universeDomain = json.universe_domain || this.universeDomain;
7446
+ this._clientId = json2.client_id;
7447
+ this._clientSecret = json2.client_secret;
7448
+ this._refreshToken = json2.refresh_token;
7449
+ this.credentials.refresh_token = json2.refresh_token;
7450
+ this.quotaProjectId = json2.quota_project_id;
7451
+ this.universeDomain = json2.universe_domain || this.universeDomain;
7450
7452
  }
7451
7453
  fromStream(inputStream, callback) {
7452
7454
  if (callback) {
@@ -7472,9 +7474,9 @@ var require_refreshclient = __commonJS((exports) => {
7472
7474
  });
7473
7475
  });
7474
7476
  }
7475
- static fromJSON(json) {
7477
+ static fromJSON(json2) {
7476
7478
  const client = new UserRefreshClient;
7477
- client.fromJSON(json);
7479
+ client.fromJSON(json2);
7478
7480
  return client;
7479
7481
  }
7480
7482
  }
@@ -7482,7 +7484,7 @@ var require_refreshclient = __commonJS((exports) => {
7482
7484
  });
7483
7485
 
7484
7486
  // node_modules/google-auth-library/build/src/auth/impersonated.js
7485
- var require_impersonated = __commonJS((exports) => {
7487
+ var require_impersonated = __commonJS(function(exports) {
7486
7488
  Object.defineProperty(exports, "__esModule", { value: true });
7487
7489
  exports.Impersonated = exports.IMPERSONATED_ACCOUNT_TYPE = undefined;
7488
7490
  var oauth2client_1 = require_oauth2client();
@@ -7599,7 +7601,7 @@ var require_impersonated = __commonJS((exports) => {
7599
7601
  });
7600
7602
 
7601
7603
  // node_modules/google-auth-library/build/src/auth/oauth2common.js
7602
- var require_oauth2common = __commonJS((exports) => {
7604
+ var require_oauth2common = __commonJS(function(exports) {
7603
7605
  Object.defineProperty(exports, "__esModule", { value: true });
7604
7606
  exports.OAuthClientAuthHandler = undefined;
7605
7607
  exports.getErrorFromOAuthErrorResponse = getErrorFromOAuthErrorResponse;
@@ -7708,7 +7710,7 @@ var require_oauth2common = __commonJS((exports) => {
7708
7710
  });
7709
7711
 
7710
7712
  // node_modules/google-auth-library/build/src/auth/stscredentials.js
7711
- var require_stscredentials = __commonJS((exports) => {
7713
+ var require_stscredentials = __commonJS(function(exports) {
7712
7714
  Object.defineProperty(exports, "__esModule", { value: true });
7713
7715
  exports.StsCredentials = undefined;
7714
7716
  var gaxios_1 = require_src2();
@@ -7770,7 +7772,7 @@ var require_stscredentials = __commonJS((exports) => {
7770
7772
  });
7771
7773
 
7772
7774
  // node_modules/google-auth-library/build/src/auth/baseexternalclient.js
7773
- var require_baseexternalclient = __commonJS((exports) => {
7775
+ var require_baseexternalclient = __commonJS(function(exports) {
7774
7776
  Object.defineProperty(exports, "__esModule", { value: true });
7775
7777
  exports.BaseExternalAccountClient = exports.CLOUD_RESOURCE_MANAGER = exports.EXTERNAL_ACCOUNT_TYPE = exports.EXPIRATION_TIME_OFFSET = undefined;
7776
7778
  var gaxios_1 = require_src2();
@@ -8042,12 +8044,12 @@ var require_baseexternalclient = __commonJS((exports) => {
8042
8044
  });
8043
8045
 
8044
8046
  // node_modules/google-auth-library/build/src/auth/filesubjecttokensupplier.js
8045
- var require_filesubjecttokensupplier = __commonJS((exports) => {
8047
+ var require_filesubjecttokensupplier = __commonJS(function(exports) {
8046
8048
  Object.defineProperty(exports, "__esModule", { value: true });
8047
8049
  exports.FileSubjectTokenSupplier = undefined;
8048
8050
  var util_1 = __require("util");
8049
8051
  var fs = __require("fs");
8050
- var readFile2 = (0, util_1.promisify)(fs.readFile ?? (() => {}));
8052
+ var readFile3 = (0, util_1.promisify)(fs.readFile ?? (() => {}));
8051
8053
  var realpath = (0, util_1.promisify)(fs.realpath ?? (() => {}));
8052
8054
  var lstat = (0, util_1.promisify)(fs.lstat ?? (() => {}));
8053
8055
 
@@ -8074,12 +8076,12 @@ var require_filesubjecttokensupplier = __commonJS((exports) => {
8074
8076
  throw err;
8075
8077
  }
8076
8078
  let subjectToken;
8077
- const rawText = await readFile2(parsedFilePath, { encoding: "utf8" });
8079
+ const rawText = await readFile3(parsedFilePath, { encoding: "utf8" });
8078
8080
  if (this.formatType === "text") {
8079
8081
  subjectToken = rawText;
8080
8082
  } else if (this.formatType === "json" && this.subjectTokenFieldName) {
8081
- const json = JSON.parse(rawText);
8082
- subjectToken = json[this.subjectTokenFieldName];
8083
+ const json2 = JSON.parse(rawText);
8084
+ subjectToken = json2[this.subjectTokenFieldName];
8083
8085
  }
8084
8086
  if (!subjectToken) {
8085
8087
  throw new Error("Unable to parse the subject_token from the credential_source file");
@@ -8091,7 +8093,7 @@ var require_filesubjecttokensupplier = __commonJS((exports) => {
8091
8093
  });
8092
8094
 
8093
8095
  // node_modules/google-auth-library/build/src/auth/urlsubjecttokensupplier.js
8094
- var require_urlsubjecttokensupplier = __commonJS((exports) => {
8096
+ var require_urlsubjecttokensupplier = __commonJS(function(exports) {
8095
8097
  Object.defineProperty(exports, "__esModule", { value: true });
8096
8098
  exports.UrlSubjectTokenSupplier = undefined;
8097
8099
  var authclient_1 = require_authclient();
@@ -8136,7 +8138,7 @@ var require_urlsubjecttokensupplier = __commonJS((exports) => {
8136
8138
  });
8137
8139
 
8138
8140
  // node_modules/google-auth-library/build/src/auth/certificatesubjecttokensupplier.js
8139
- var require_certificatesubjecttokensupplier = __commonJS((exports) => {
8141
+ var require_certificatesubjecttokensupplier = __commonJS(function(exports) {
8140
8142
  Object.defineProperty(exports, "__esModule", { value: true });
8141
8143
  exports.CertificateSubjectTokenSupplier = exports.InvalidConfigurationError = exports.CertificateSourceUnavailableError = exports.CERTIFICATE_CONFIGURATION_ENV_VARIABLE = undefined;
8142
8144
  var util_1 = require_util2();
@@ -8287,7 +8289,7 @@ var require_certificatesubjecttokensupplier = __commonJS((exports) => {
8287
8289
  });
8288
8290
 
8289
8291
  // node_modules/google-auth-library/build/src/auth/identitypoolclient.js
8290
- var require_identitypoolclient = __commonJS((exports) => {
8292
+ var require_identitypoolclient = __commonJS(function(exports) {
8291
8293
  Object.defineProperty(exports, "__esModule", { value: true });
8292
8294
  exports.IdentityPoolClient = undefined;
8293
8295
  var baseexternalclient_1 = require_baseexternalclient();
@@ -8381,7 +8383,7 @@ var require_identitypoolclient = __commonJS((exports) => {
8381
8383
  });
8382
8384
 
8383
8385
  // node_modules/google-auth-library/build/src/auth/awsrequestsigner.js
8384
- var require_awsrequestsigner = __commonJS((exports) => {
8386
+ var require_awsrequestsigner = __commonJS(function(exports) {
8385
8387
  Object.defineProperty(exports, "__esModule", { value: true });
8386
8388
  exports.AwsRequestSigner = undefined;
8387
8389
  var gaxios_1 = require_src2();
@@ -8500,7 +8502,7 @@ var require_awsrequestsigner = __commonJS((exports) => {
8500
8502
  });
8501
8503
 
8502
8504
  // node_modules/google-auth-library/build/src/auth/defaultawssecuritycredentialssupplier.js
8503
- var require_defaultawssecuritycredentialssupplier = __commonJS((exports) => {
8505
+ var require_defaultawssecuritycredentialssupplier = __commonJS(function(exports) {
8504
8506
  Object.defineProperty(exports, "__esModule", { value: true });
8505
8507
  exports.DefaultAwsSecurityCredentialsSupplier = undefined;
8506
8508
  var authclient_1 = require_authclient();
@@ -8610,7 +8612,7 @@ var require_defaultawssecuritycredentialssupplier = __commonJS((exports) => {
8610
8612
  });
8611
8613
 
8612
8614
  // node_modules/google-auth-library/build/src/auth/awsclient.js
8613
- var require_awsclient = __commonJS((exports) => {
8615
+ var require_awsclient = __commonJS(function(exports) {
8614
8616
  Object.defineProperty(exports, "__esModule", { value: true });
8615
8617
  exports.AwsClient = undefined;
8616
8618
  var awsrequestsigner_1 = require_awsrequestsigner();
@@ -8697,7 +8699,7 @@ var require_awsclient = __commonJS((exports) => {
8697
8699
  });
8698
8700
 
8699
8701
  // node_modules/google-auth-library/build/src/auth/executable-response.js
8700
- var require_executable_response = __commonJS((exports) => {
8702
+ var require_executable_response = __commonJS(function(exports) {
8701
8703
  Object.defineProperty(exports, "__esModule", { value: true });
8702
8704
  exports.InvalidSubjectTokenError = exports.InvalidMessageFieldError = exports.InvalidCodeFieldError = exports.InvalidTokenTypeFieldError = exports.InvalidExpirationTimeFieldError = exports.InvalidSuccessFieldError = exports.InvalidVersionFieldError = exports.ExecutableResponseError = exports.ExecutableResponse = undefined;
8703
8705
  var SAML_SUBJECT_TOKEN_TYPE = "urn:ietf:params:oauth:token-type:saml2";
@@ -8796,7 +8798,7 @@ var require_executable_response = __commonJS((exports) => {
8796
8798
  });
8797
8799
 
8798
8800
  // node_modules/google-auth-library/build/src/auth/pluggable-auth-handler.js
8799
- var require_pluggable_auth_handler = __commonJS((exports) => {
8801
+ var require_pluggable_auth_handler = __commonJS(function(exports) {
8800
8802
  Object.defineProperty(exports, "__esModule", { value: true });
8801
8803
  exports.PluggableAuthHandler = exports.ExecutableError = undefined;
8802
8804
  var executable_response_1 = require_executable_response();
@@ -8914,7 +8916,7 @@ var require_pluggable_auth_handler = __commonJS((exports) => {
8914
8916
  });
8915
8917
 
8916
8918
  // node_modules/google-auth-library/build/src/auth/pluggable-auth-client.js
8917
- var require_pluggable_auth_client = __commonJS((exports) => {
8919
+ var require_pluggable_auth_client = __commonJS(function(exports) {
8918
8920
  Object.defineProperty(exports, "__esModule", { value: true });
8919
8921
  exports.PluggableAuthClient = exports.ExecutableError = undefined;
8920
8922
  var baseexternalclient_1 = require_baseexternalclient();
@@ -9003,7 +9005,7 @@ var require_pluggable_auth_client = __commonJS((exports) => {
9003
9005
  });
9004
9006
 
9005
9007
  // node_modules/google-auth-library/build/src/auth/externalclient.js
9006
- var require_externalclient = __commonJS((exports) => {
9008
+ var require_externalclient = __commonJS(function(exports) {
9007
9009
  Object.defineProperty(exports, "__esModule", { value: true });
9008
9010
  exports.ExternalAccountClient = undefined;
9009
9011
  var baseexternalclient_1 = require_baseexternalclient();
@@ -9033,7 +9035,7 @@ var require_externalclient = __commonJS((exports) => {
9033
9035
  });
9034
9036
 
9035
9037
  // node_modules/google-auth-library/build/src/auth/externalAccountAuthorizedUserClient.js
9036
- var require_externalAccountAuthorizedUserClient = __commonJS((exports) => {
9038
+ var require_externalAccountAuthorizedUserClient = __commonJS(function(exports) {
9037
9039
  Object.defineProperty(exports, "__esModule", { value: true });
9038
9040
  exports.ExternalAccountAuthorizedUserClient = exports.EXTERNAL_ACCOUNT_AUTHORIZED_USER_TYPE = undefined;
9039
9041
  var authclient_1 = require_authclient();
@@ -9175,7 +9177,7 @@ var require_externalAccountAuthorizedUserClient = __commonJS((exports) => {
9175
9177
  });
9176
9178
 
9177
9179
  // node_modules/google-auth-library/build/src/auth/gdchclient.js
9178
- var require_gdchclient = __commonJS((exports) => {
9180
+ var require_gdchclient = __commonJS(function(exports) {
9179
9181
  Object.defineProperty(exports, "__esModule", { value: true });
9180
9182
  exports.GdchClient = exports.GDCH_SERVICE_ACCOUNT_TYPE = undefined;
9181
9183
  var crypto2 = __require("crypto");
@@ -9228,45 +9230,45 @@ var require_gdchclient = __commonJS((exports) => {
9228
9230
  apiAudience
9229
9231
  });
9230
9232
  }
9231
- fromJSON(json) {
9232
- if (!json) {
9233
+ fromJSON(json2) {
9234
+ if (!json2) {
9233
9235
  throw new Error("Must pass in a JSON object containing the GDCH credentials settings.");
9234
9236
  }
9235
- if (json.type !== exports.GDCH_SERVICE_ACCOUNT_TYPE) {
9237
+ if (json2.type !== exports.GDCH_SERVICE_ACCOUNT_TYPE) {
9236
9238
  throw new Error(`The incoming JSON object does not have the "${exports.GDCH_SERVICE_ACCOUNT_TYPE}" type`);
9237
9239
  }
9238
- if (json.format_version !== "1") {
9240
+ if (json2.format_version !== "1") {
9239
9241
  throw new Error("Only format version 1 is supported.");
9240
9242
  }
9241
- if (!json.project) {
9243
+ if (!json2.project) {
9242
9244
  throw new Error("The incoming JSON object does not contain a project field");
9243
9245
  }
9244
- if (!json.private_key_id) {
9246
+ if (!json2.private_key_id) {
9245
9247
  throw new Error("The incoming JSON object does not contain a private_key_id field");
9246
9248
  }
9247
- if (!json.private_key) {
9249
+ if (!json2.private_key) {
9248
9250
  throw new Error("The incoming JSON object does not contain a private_key field");
9249
9251
  }
9250
- if (!json.name) {
9252
+ if (!json2.name) {
9251
9253
  throw new Error("The incoming JSON object does not contain a name field");
9252
9254
  }
9253
- if (!json.token_uri) {
9255
+ if (!json2.token_uri) {
9254
9256
  throw new Error("The incoming JSON object does not contain a token_uri field");
9255
9257
  }
9256
- this.projectId = json.project;
9257
- this.privateKeyId = json.private_key_id;
9258
- this.privateKey = json.private_key;
9259
- this.serviceIdentityName = json.name;
9260
- this.tokenServerUri = json.token_uri;
9261
- this.caCertPath = json.ca_cert_path;
9258
+ this.projectId = json2.project;
9259
+ this.privateKeyId = json2.private_key_id;
9260
+ this.privateKey = json2.private_key;
9261
+ this.serviceIdentityName = json2.name;
9262
+ this.tokenServerUri = json2.token_uri;
9263
+ this.caCertPath = json2.ca_cert_path;
9262
9264
  this.gdchOptions = {
9263
9265
  ...this.gdchOptions,
9264
- projectId: json.project,
9265
- privateKeyId: json.private_key_id,
9266
- privateKey: json.private_key,
9267
- serviceIdentityName: json.name,
9268
- tokenServerUri: json.token_uri,
9269
- caCertPath: json.ca_cert_path
9266
+ projectId: json2.project,
9267
+ privateKeyId: json2.private_key_id,
9268
+ privateKey: json2.private_key,
9269
+ serviceIdentityName: json2.name,
9270
+ tokenServerUri: json2.token_uri,
9271
+ caCertPath: json2.ca_cert_path
9270
9272
  };
9271
9273
  }
9272
9274
  async refreshTokenNoCache() {
@@ -9455,7 +9457,7 @@ var require_gdchclient = __commonJS((exports) => {
9455
9457
  });
9456
9458
 
9457
9459
  // node_modules/google-auth-library/build/src/auth/googleauth.js
9458
- var require_googleauth = __commonJS((exports) => {
9460
+ var require_googleauth = __commonJS(function(exports) {
9459
9461
  Object.defineProperty(exports, "__esModule", { value: true });
9460
9462
  exports.GoogleAuth = exports.GoogleAuthExceptionMessages = undefined;
9461
9463
  var child_process_1 = __require("child_process");
@@ -9463,7 +9465,7 @@ var require_googleauth = __commonJS((exports) => {
9463
9465
  var gaxios_1 = require_src2();
9464
9466
  var gcpMetadata = require_src4();
9465
9467
  var os = __require("os");
9466
- var path3 = __require("path");
9468
+ var path4 = __require("path");
9467
9469
  var crypto_1 = require_crypto3();
9468
9470
  var computeclient_1 = require_computeclient();
9469
9471
  var idtokenclient_1 = require_idtokenclient();
@@ -9672,11 +9674,11 @@ var require_googleauth = __commonJS((exports) => {
9672
9674
  } else {
9673
9675
  const home = process.env["HOME"];
9674
9676
  if (home) {
9675
- location = path3.join(home, ".config");
9677
+ location = path4.join(home, ".config");
9676
9678
  }
9677
9679
  }
9678
9680
  if (location) {
9679
- location = path3.join(location, "gcloud", "application_default_credentials.json");
9681
+ location = path4.join(location, "gcloud", "application_default_credentials.json");
9680
9682
  if (!fs.existsSync(location)) {
9681
9683
  location = null;
9682
9684
  }
@@ -9705,71 +9707,71 @@ var require_googleauth = __commonJS((exports) => {
9705
9707
  const readStream = fs.createReadStream(filePath);
9706
9708
  return this.fromStream(readStream, options);
9707
9709
  }
9708
- fromImpersonatedJSON(json) {
9709
- if (!json) {
9710
+ fromImpersonatedJSON(json2) {
9711
+ if (!json2) {
9710
9712
  throw new Error("Must pass in a JSON object containing an impersonated refresh token");
9711
9713
  }
9712
- if (json.type !== impersonated_1.IMPERSONATED_ACCOUNT_TYPE) {
9714
+ if (json2.type !== impersonated_1.IMPERSONATED_ACCOUNT_TYPE) {
9713
9715
  throw new Error(`The incoming JSON object does not have the "${impersonated_1.IMPERSONATED_ACCOUNT_TYPE}" type`);
9714
9716
  }
9715
- if (!json.source_credentials) {
9717
+ if (!json2.source_credentials) {
9716
9718
  throw new Error("The incoming JSON object does not contain a source_credentials field");
9717
9719
  }
9718
- if (!json.service_account_impersonation_url) {
9720
+ if (!json2.service_account_impersonation_url) {
9719
9721
  throw new Error("The incoming JSON object does not contain a service_account_impersonation_url field");
9720
9722
  }
9721
- const sourceClient = this.fromJSON(json.source_credentials);
9722
- if (json.service_account_impersonation_url?.length > 256) {
9723
- throw new RangeError(`Target principal is too long: ${json.service_account_impersonation_url}`);
9723
+ const sourceClient = this.fromJSON(json2.source_credentials);
9724
+ if (json2.service_account_impersonation_url?.length > 256) {
9725
+ throw new RangeError(`Target principal is too long: ${json2.service_account_impersonation_url}`);
9724
9726
  }
9725
- const targetPrincipal = /(?<target>[^/]+):(generateAccessToken|generateIdToken)$/.exec(json.service_account_impersonation_url)?.groups?.target;
9727
+ const targetPrincipal = /(?<target>[^/]+):(generateAccessToken|generateIdToken)$/.exec(json2.service_account_impersonation_url)?.groups?.target;
9726
9728
  if (!targetPrincipal) {
9727
- throw new RangeError(`Cannot extract target principal from ${json.service_account_impersonation_url}`);
9729
+ throw new RangeError(`Cannot extract target principal from ${json2.service_account_impersonation_url}`);
9728
9730
  }
9729
- const targetScopes = (this.scopes || json.scopes || this.defaultScopes) ?? [];
9731
+ const targetScopes = (this.scopes || json2.scopes || this.defaultScopes) ?? [];
9730
9732
  return new impersonated_1.Impersonated({
9731
- ...json,
9733
+ ...json2,
9732
9734
  sourceClient,
9733
9735
  targetPrincipal,
9734
9736
  targetScopes: Array.isArray(targetScopes) ? targetScopes : [targetScopes]
9735
9737
  });
9736
9738
  }
9737
- fromJSON(json, options = {}) {
9739
+ fromJSON(json2, options = {}) {
9738
9740
  let client;
9739
9741
  const preferredUniverseDomain = (0, util_1.originalOrCamelOptions)(options).get("universe_domain");
9740
- if (json.type === refreshclient_1.USER_REFRESH_ACCOUNT_TYPE) {
9742
+ if (json2.type === refreshclient_1.USER_REFRESH_ACCOUNT_TYPE) {
9741
9743
  client = new refreshclient_1.UserRefreshClient(options);
9742
- client.fromJSON(json);
9743
- } else if (json.type === impersonated_1.IMPERSONATED_ACCOUNT_TYPE) {
9744
- client = this.fromImpersonatedJSON(json);
9745
- } else if (json.type === baseexternalclient_1.EXTERNAL_ACCOUNT_TYPE) {
9744
+ client.fromJSON(json2);
9745
+ } else if (json2.type === impersonated_1.IMPERSONATED_ACCOUNT_TYPE) {
9746
+ client = this.fromImpersonatedJSON(json2);
9747
+ } else if (json2.type === baseexternalclient_1.EXTERNAL_ACCOUNT_TYPE) {
9746
9748
  client = externalclient_1.ExternalAccountClient.fromJSON({
9747
- ...json,
9749
+ ...json2,
9748
9750
  ...options
9749
9751
  });
9750
9752
  client.scopes = this.getAnyScopes();
9751
- } else if (json.type === externalAccountAuthorizedUserClient_1.EXTERNAL_ACCOUNT_AUTHORIZED_USER_TYPE) {
9753
+ } else if (json2.type === externalAccountAuthorizedUserClient_1.EXTERNAL_ACCOUNT_AUTHORIZED_USER_TYPE) {
9752
9754
  client = new externalAccountAuthorizedUserClient_1.ExternalAccountAuthorizedUserClient({
9753
- ...json,
9755
+ ...json2,
9754
9756
  ...options
9755
9757
  });
9756
- } else if (json.type === gdchclient_1.GDCH_SERVICE_ACCOUNT_TYPE) {
9758
+ } else if (json2.type === gdchclient_1.GDCH_SERVICE_ACCOUNT_TYPE) {
9757
9759
  client = new gdchclient_1.GdchClient(options);
9758
- client.fromJSON(json);
9760
+ client.fromJSON(json2);
9759
9761
  } else {
9760
9762
  options.scopes = this.scopes;
9761
9763
  client = new jwtclient_1.JWT(options);
9762
9764
  this.setGapicJWTValues(client);
9763
- client.fromJSON(json);
9765
+ client.fromJSON(json2);
9764
9766
  }
9765
9767
  if (preferredUniverseDomain) {
9766
9768
  client.universeDomain = preferredUniverseDomain;
9767
9769
  }
9768
9770
  return client;
9769
9771
  }
9770
- _cacheClientFromJSON(json, options) {
9771
- const client = this.fromJSON(json, options);
9772
- this.jsonContent = json;
9772
+ _cacheClientFromJSON(json2, options) {
9773
+ const client = this.fromJSON(json2, options);
9774
+ this.jsonContent = json2;
9773
9775
  this.cachedCredential = client;
9774
9776
  return client;
9775
9777
  }
@@ -9940,7 +9942,7 @@ var require_googleauth = __commonJS((exports) => {
9940
9942
  if (this.jsonContent) {
9941
9943
  return this._cacheClientFromJSON(this.jsonContent, this.clientOptions);
9942
9944
  } else if (this.keyFilename) {
9943
- const filePath = path3.resolve(this.keyFilename);
9945
+ const filePath = path4.resolve(this.keyFilename);
9944
9946
  const stream = fs.createReadStream(filePath);
9945
9947
  return await this.fromStreamAsync(stream, this.clientOptions);
9946
9948
  } else if (this.apiKey) {
@@ -10025,7 +10027,7 @@ var require_googleauth = __commonJS((exports) => {
10025
10027
  });
10026
10028
 
10027
10029
  // node_modules/google-auth-library/build/src/auth/iam.js
10028
- var require_iam = __commonJS((exports) => {
10030
+ var require_iam = __commonJS(function(exports) {
10029
10031
  Object.defineProperty(exports, "__esModule", { value: true });
10030
10032
  exports.IAMAuth = undefined;
10031
10033
 
@@ -10049,7 +10051,7 @@ var require_iam = __commonJS((exports) => {
10049
10051
  });
10050
10052
 
10051
10053
  // node_modules/google-auth-library/build/src/auth/downscopedclient.js
10052
- var require_downscopedclient = __commonJS((exports) => {
10054
+ var require_downscopedclient = __commonJS(function(exports) {
10053
10055
  Object.defineProperty(exports, "__esModule", { value: true });
10054
10056
  exports.DownscopedClient = exports.EXPIRATION_TIME_OFFSET = exports.MAX_ACCESS_BOUNDARY_RULES_COUNT = undefined;
10055
10057
  var gaxios_1 = require_src2();
@@ -10187,7 +10189,7 @@ var require_downscopedclient = __commonJS((exports) => {
10187
10189
  });
10188
10190
 
10189
10191
  // node_modules/google-auth-library/build/src/auth/passthrough.js
10190
- var require_passthrough = __commonJS((exports) => {
10192
+ var require_passthrough = __commonJS(function(exports) {
10191
10193
  Object.defineProperty(exports, "__esModule", { value: true });
10192
10194
  exports.PassThroughClient = undefined;
10193
10195
  var authclient_1 = require_authclient();
@@ -10207,7 +10209,7 @@ var require_passthrough = __commonJS((exports) => {
10207
10209
  });
10208
10210
 
10209
10211
  // node_modules/google-auth-library/build/src/index.js
10210
- var require_src5 = __commonJS((exports) => {
10212
+ var require_src5 = __commonJS(function(exports) {
10211
10213
  var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
10212
10214
  if (k2 === undefined)
10213
10215
  k2 = k;
@@ -10504,24 +10506,49 @@ var parseMetadata = (value) => {
10504
10506
  throw new NativeReleaseRegistryError("Native release appId is invalid");
10505
10507
  if (!SHA256_PATTERN.test(sha256))
10506
10508
  throw new NativeReleaseRegistryError("Native release sha256 is invalid");
10507
- if (releaseId !== `amobile_android_${sha256}`)
10509
+ if (value.platform !== "android" && value.platform !== "ios")
10510
+ throw new NativeReleaseRegistryError("Native release metadata is invalid");
10511
+ if (releaseId !== `amobile_${value.platform}_${sha256}`)
10508
10512
  throw new NativeReleaseRegistryError("Native release id does not match its artifact digest");
10509
- if (value.artifact !== "app-release.aab" || value.engine !== "capacitor" || value.format !== 1 || value.platform !== "android" || value.type !== "aab" || typeof value.signed !== "boolean" || !Number.isSafeInteger(value.bytes) || Number(value.bytes) < 1 || value.versionCode !== undefined && (!Number.isSafeInteger(value.versionCode) || Number(value.versionCode) < 1 || Number(value.versionCode) > 2100000000))
10513
+ const commonInvalid = value.engine !== "capacitor" || value.format !== 1 || typeof value.signed !== "boolean" || !Number.isSafeInteger(value.bytes) || Number(value.bytes) < 1;
10514
+ if (commonInvalid)
10515
+ throw new NativeReleaseRegistryError("Native release metadata is invalid");
10516
+ if (value.platform === "android") {
10517
+ if (value.artifact !== "app-release.aab" || value.type !== "aab" || value.versionCode !== undefined && (!Number.isSafeInteger(value.versionCode) || Number(value.versionCode) < 1 || Number(value.versionCode) > 2100000000))
10518
+ throw new NativeReleaseRegistryError("Native release metadata is invalid");
10519
+ return {
10520
+ appBuild: requireString(value.appBuild, "appBuild"),
10521
+ appId,
10522
+ artifact: "app-release.aab",
10523
+ bytes: Number(value.bytes),
10524
+ engine: "capacitor",
10525
+ format: 1,
10526
+ platform: "android",
10527
+ releaseId,
10528
+ runtime: requireString(value.runtime, "runtime"),
10529
+ sha256,
10530
+ signed: value.signed === true,
10531
+ type: "aab",
10532
+ ...value.versionCode === undefined ? {} : { versionCode: Number(value.versionCode) }
10533
+ };
10534
+ }
10535
+ if (value.artifact !== "App.ipa" || value.type !== "ipa" || typeof value.marketingVersion !== "string" || !/^\d+(?:\.\d+){0,2}$/.test(value.marketingVersion) || value.buildNumber !== undefined && (!Number.isSafeInteger(value.buildNumber) || Number(value.buildNumber) < 1))
10510
10536
  throw new NativeReleaseRegistryError("Native release metadata is invalid");
10511
10537
  return {
10512
10538
  appBuild: requireString(value.appBuild, "appBuild"),
10513
10539
  appId,
10514
- artifact: "app-release.aab",
10540
+ artifact: "App.ipa",
10541
+ ...value.buildNumber === undefined ? {} : { buildNumber: Number(value.buildNumber) },
10515
10542
  bytes: Number(value.bytes),
10516
10543
  engine: "capacitor",
10517
10544
  format: 1,
10518
- platform: "android",
10545
+ marketingVersion: value.marketingVersion,
10546
+ platform: "ios",
10519
10547
  releaseId,
10520
10548
  runtime: requireString(value.runtime, "runtime"),
10521
10549
  sha256,
10522
- signed: value.signed,
10523
- type: "aab",
10524
- ...value.versionCode === undefined ? {} : { versionCode: Number(value.versionCode) }
10550
+ signed: value.signed === true,
10551
+ type: "ipa"
10525
10552
  };
10526
10553
  };
10527
10554
  var normalizedPrefix = (value) => {
@@ -10563,7 +10590,7 @@ var parseRecord = (value) => {
10563
10590
  };
10564
10591
  };
10565
10592
  var parseChannel = (value) => {
10566
- if (!isRecord(value) || value.format !== NATIVE_RELEASE_REGISTRY_FORMAT || value.platform !== "android" || !isIsoTimestamp(value.promotedAt))
10593
+ if (!isRecord(value) || value.format !== NATIVE_RELEASE_REGISTRY_FORMAT || value.platform !== "android" && value.platform !== "ios" || !isIsoTimestamp(value.promotedAt))
10567
10594
  throw new NativeReleaseRegistryError("Native release channel is invalid");
10568
10595
  const appId = requireString(value.appId, "channel appId");
10569
10596
  const channel = requireChannel(requireString(value.channel, "channel"));
@@ -10571,13 +10598,13 @@ var parseChannel = (value) => {
10571
10598
  const releaseId = requireString(value.releaseId, "channel releaseId");
10572
10599
  if (!APP_ID_PATTERN.test(appId) || !SHA256_PATTERN.test(sha256))
10573
10600
  throw new NativeReleaseRegistryError("Native release channel is invalid");
10574
- if (releaseId !== `amobile_android_${sha256}`)
10601
+ if (releaseId !== `amobile_${value.platform}_${sha256}`)
10575
10602
  throw new NativeReleaseRegistryError("Native release channel identity does not match");
10576
10603
  return {
10577
10604
  appId,
10578
10605
  channel,
10579
10606
  format: NATIVE_RELEASE_REGISTRY_FORMAT,
10580
- platform: "android",
10607
+ platform: value.platform,
10581
10608
  promotedAt: value.promotedAt,
10582
10609
  releaseId,
10583
10610
  sha256
@@ -10602,10 +10629,10 @@ var createNativeReleaseRegistry = (options) => {
10602
10629
  const read = async (input) => {
10603
10630
  if (!APP_ID_PATTERN.test(input.appId))
10604
10631
  throw new NativeReleaseRegistryError("Native release appId is invalid");
10605
- const digest = input.releaseId.replace(/^amobile_android_/, "");
10606
- if (!SHA256_PATTERN.test(digest) || input.releaseId !== `amobile_android_${digest}`)
10632
+ const digest = input.releaseId.replace(new RegExp(`^amobile_${input.platform}_`), "");
10633
+ if (!SHA256_PATTERN.test(digest) || input.releaseId !== `amobile_${input.platform}_${digest}`)
10607
10634
  throw new NativeReleaseRegistryError("Native release id is invalid");
10608
- const identity = {
10635
+ const identity = input.platform === "android" ? {
10609
10636
  appBuild: "lookup",
10610
10637
  appId: input.appId,
10611
10638
  artifact: "app-release.aab",
@@ -10618,6 +10645,20 @@ var createNativeReleaseRegistry = (options) => {
10618
10645
  sha256: digest,
10619
10646
  signed: true,
10620
10647
  type: "aab"
10648
+ } : {
10649
+ appBuild: "lookup",
10650
+ appId: input.appId,
10651
+ artifact: "App.ipa",
10652
+ bytes: 1,
10653
+ engine: "capacitor",
10654
+ format: 1,
10655
+ marketingVersion: "1.0.0",
10656
+ platform: "ios",
10657
+ releaseId: input.releaseId,
10658
+ runtime: "lookup",
10659
+ sha256: digest,
10660
+ signed: true,
10661
+ type: "ipa"
10621
10662
  };
10622
10663
  const key = recordKey(identity);
10623
10664
  const bytes = await options.store.get(key);
@@ -10778,10 +10819,429 @@ var createNativeReleaseRegistry = (options) => {
10778
10819
  };
10779
10820
  };
10780
10821
 
10822
+ // src/mobileUpdate.ts
10823
+ import { createHash as createHash2, createPublicKey, verify } from "crypto";
10824
+ import { readFile as readFile2, stat as stat3 } from "fs/promises";
10825
+ import path3 from "path";
10826
+ var MOBILE_UPDATE_REGISTRY_FORMAT = 1;
10827
+ var DEFAULT_PREFIX2 = "absolutejs/mobile-updates";
10828
+ var MAX_FILE_BYTES = 32 * 1024 * 1024;
10829
+ var MAX_TOTAL_BYTES = 128 * 1024 * 1024;
10830
+ var HASH = /^[a-f0-9]{64}$/;
10831
+ var RELEASE = /^amu_[a-f0-9]{64}$/;
10832
+ var APP_ID = /^[A-Za-z][\w]*(?:\.[A-Za-z][\w]*)+$/;
10833
+ var NAME = /^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$/;
10834
+
10835
+ class MobileUpdateRegistryError extends Error {
10836
+ }
10837
+ var object = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
10838
+ var text = (value, field) => {
10839
+ if (typeof value !== "string" || value.length === 0)
10840
+ throw new MobileUpdateRegistryError(`Mobile update ${field} is invalid`);
10841
+ return value;
10842
+ };
10843
+ var iso = (value) => typeof value === "string" && Number.isFinite(Date.parse(value)) && new Date(value).toISOString() === value;
10844
+ var safePath = (value) => {
10845
+ const file = text(value, "file path").replaceAll("\\", "/");
10846
+ if (file.startsWith("/") || file.split("/").some((segment) => !segment || segment === "." || segment === ".."))
10847
+ throw new MobileUpdateRegistryError("Mobile update file path is invalid");
10848
+ return file;
10849
+ };
10850
+ var parseMobileUpdateManifest = (value) => {
10851
+ if (!object(value) || value.format !== 1)
10852
+ throw new MobileUpdateRegistryError("Mobile update manifest is invalid");
10853
+ const appId = text(value.appId, "appId");
10854
+ const channel = text(value.channel, "channel");
10855
+ const releaseId = text(value.releaseId, "releaseId");
10856
+ const runtimeFingerprint = text(value.runtimeFingerprint, "runtime");
10857
+ if (!APP_ID.test(appId) || !NAME.test(channel) || !RELEASE.test(releaseId))
10858
+ throw new MobileUpdateRegistryError("Mobile update identity is invalid");
10859
+ if (!HASH.test(runtimeFingerprint) || !iso(value.createdAt))
10860
+ throw new MobileUpdateRegistryError("Mobile update runtime or timestamp is invalid");
10861
+ if (value.classification !== "bug-fix" && value.classification !== "content" && value.classification !== "security")
10862
+ throw new MobileUpdateRegistryError("Mobile update classification is invalid");
10863
+ if (value.withinSubmittedPurpose !== true)
10864
+ throw new MobileUpdateRegistryError("Mobile update policy attestation is missing");
10865
+ if (!Array.isArray(value.files) || value.files.length === 0)
10866
+ throw new MobileUpdateRegistryError("Mobile update file inventory is invalid");
10867
+ const files = value.files.map((candidate) => {
10868
+ if (!object(candidate))
10869
+ throw new MobileUpdateRegistryError("Mobile update file is invalid");
10870
+ const filePath = safePath(candidate.path);
10871
+ if (!Number.isSafeInteger(candidate.bytes) || Number(candidate.bytes) < 0 || Number(candidate.bytes) > MAX_FILE_BYTES || typeof candidate.sha256 !== "string" || !HASH.test(candidate.sha256))
10872
+ throw new MobileUpdateRegistryError(`Mobile update file ${filePath} is invalid`);
10873
+ return {
10874
+ bytes: Number(candidate.bytes),
10875
+ path: filePath,
10876
+ sha256: candidate.sha256
10877
+ };
10878
+ });
10879
+ if (files.reduce((total, file) => total + file.bytes, 0) > MAX_TOTAL_BYTES || new Set(files.map((file) => file.path)).size !== files.length || files.some((file, index) => index > 0 ? file.path.localeCompare(files[index - 1]?.path ?? "") <= 0 : false))
10880
+ throw new MobileUpdateRegistryError("Mobile update file inventory is invalid");
10881
+ const signatureKeyId = object(value.signature) ? text(value.signature.keyId, "signature key") : "";
10882
+ const signatureValue = object(value.signature) ? text(value.signature.value, "signature") : "";
10883
+ if (!object(value.signature) || value.signature.algorithm !== "ecdsa-p256-sha256" || !NAME.test(signatureKeyId) || !/^[A-Za-z0-9+/]+={0,2}$/.test(signatureValue) || Buffer.from(signatureValue, "base64").byteLength !== 64 || Buffer.from(signatureValue, "base64").toString("base64") !== signatureValue)
10884
+ throw new MobileUpdateRegistryError("Mobile update signature is invalid");
10885
+ return {
10886
+ appId,
10887
+ channel,
10888
+ classification: value.classification,
10889
+ createdAt: value.createdAt,
10890
+ files,
10891
+ format: 1,
10892
+ releaseId,
10893
+ runtimeFingerprint,
10894
+ signature: {
10895
+ algorithm: "ecdsa-p256-sha256",
10896
+ keyId: signatureKeyId,
10897
+ value: signatureValue
10898
+ },
10899
+ withinSubmittedPurpose: true
10900
+ };
10901
+ };
10902
+ var canonicalValue = (value) => {
10903
+ if (Array.isArray(value))
10904
+ return value.map(canonicalValue);
10905
+ if (!object(value))
10906
+ return value;
10907
+ return Object.fromEntries(Object.keys(value).sort().map((key) => [key, canonicalValue(value[key])]));
10908
+ };
10909
+ var verifyManifestSignature = (manifest, publicKeys) => {
10910
+ const encoded = publicKeys[manifest.signature.keyId];
10911
+ if (!encoded)
10912
+ throw new MobileUpdateRegistryError("Mobile update signing key is not trusted");
10913
+ let publicKey;
10914
+ try {
10915
+ const der = Buffer.from(encoded, "base64");
10916
+ if (der.toString("base64") !== encoded)
10917
+ throw new Error("invalid base64");
10918
+ publicKey = createPublicKey({ format: "der", key: der, type: "spki" });
10919
+ } catch {
10920
+ throw new MobileUpdateRegistryError("Mobile update trusted public key is invalid");
10921
+ }
10922
+ if (publicKey.asymmetricKeyType !== "ec" || publicKey.asymmetricKeyDetails?.namedCurve !== "prime256v1")
10923
+ throw new MobileUpdateRegistryError("Mobile update trusted public key must use ECDSA P-256");
10924
+ const { signature: _signature, ...unsigned } = manifest;
10925
+ if (!verify("sha256", new TextEncoder().encode(JSON.stringify(canonicalValue(unsigned))), { dsaEncoding: "ieee-p1363", key: publicKey }, Buffer.from(manifest.signature.value, "base64")))
10926
+ throw new MobileUpdateRegistryError("Mobile update signature verification failed");
10927
+ };
10928
+ var parseChannel2 = (value) => {
10929
+ if (!object(value) || value.format !== MOBILE_UPDATE_REGISTRY_FORMAT)
10930
+ throw new MobileUpdateRegistryError("Mobile update channel is invalid");
10931
+ const appId = text(value.appId, "channel appId");
10932
+ const channel = text(value.channel, "channel");
10933
+ if (!APP_ID.test(appId) || !NAME.test(channel) || !iso(value.promotedAt) || typeof value.rollout !== "number" || value.rollout < 0 || value.rollout > 1 || value.releaseId !== undefined && (typeof value.releaseId !== "string" || !RELEASE.test(value.releaseId)) || value.fallbackReleaseId !== undefined && (typeof value.fallbackReleaseId !== "string" || !RELEASE.test(value.fallbackReleaseId)))
10934
+ throw new MobileUpdateRegistryError("Mobile update channel is invalid");
10935
+ return {
10936
+ appId,
10937
+ channel,
10938
+ ...value.fallbackReleaseId ? { fallbackReleaseId: value.fallbackReleaseId } : {},
10939
+ format: MOBILE_UPDATE_REGISTRY_FORMAT,
10940
+ promotedAt: value.promotedAt,
10941
+ ...value.releaseId ? { releaseId: value.releaseId } : {},
10942
+ rollout: value.rollout
10943
+ };
10944
+ };
10945
+ var normalizedPrefix2 = (value) => {
10946
+ const prefix = value.replace(/^\/+|\/+$/g, "");
10947
+ if (!prefix || prefix.split("/").some((segment) => segment === "." || segment === ".."))
10948
+ throw new MobileUpdateRegistryError("Mobile update prefix is invalid");
10949
+ return prefix;
10950
+ };
10951
+ var appHash = (appId) => createHash2("sha256").update(appId).digest("hex");
10952
+ var digest = (bytes) => createHash2("sha256").update(bytes).digest("hex");
10953
+ var json = (value) => new TextEncoder().encode(`${JSON.stringify(value, null, 2)}
10954
+ `);
10955
+ var decode = (value) => JSON.parse(new TextDecoder().decode(value));
10956
+ var fileDigest = async (file) => {
10957
+ const hasher = new Bun.CryptoHasher("sha256");
10958
+ for await (const chunk of file.stream())
10959
+ hasher.update(chunk);
10960
+ return hasher.digest("hex");
10961
+ };
10962
+ var rolloutMember = (input) => {
10963
+ if (input.rollout === 0)
10964
+ return false;
10965
+ if (input.rollout === 1)
10966
+ return true;
10967
+ const value = createHash2("sha256").update(`${input.appId}\x00${input.channel}\x00${input.releaseId}\x00${input.installationId}`).digest().readUInt32BE(0);
10968
+ return value / 4294967296 < input.rollout;
10969
+ };
10970
+ var createMobileUpdateRegistry = (options) => {
10971
+ const prefix = normalizedPrefix2(options.prefix ?? DEFAULT_PREFIX2);
10972
+ const clock = options.clock ?? (() => new Date);
10973
+ const root = (appId) => `${prefix}/${appHash(appId)}`;
10974
+ const releaseRoot = (manifest) => `${root(manifest.appId)}/releases/${manifest.releaseId}`;
10975
+ const manifestKey = (manifest) => `${releaseRoot(manifest)}/update.json`;
10976
+ const fileKey = (manifest, file) => `${releaseRoot(manifest)}/files/${file.path}`;
10977
+ const channelKey = (appId, channel) => {
10978
+ if (!APP_ID.test(appId) || !NAME.test(channel))
10979
+ throw new MobileUpdateRegistryError("Mobile update channel identity is invalid");
10980
+ return `${root(appId)}/channels/${channel}.json`;
10981
+ };
10982
+ const readManifest = async (appId, releaseId) => {
10983
+ const key = manifestKey({ appId, releaseId });
10984
+ const bytes = await options.store.get(key);
10985
+ if (!bytes)
10986
+ return null;
10987
+ const head = await options.store.head(key);
10988
+ if (!head || head.size !== bytes.byteLength || head.metadata?.sha256 !== digest(bytes))
10989
+ throw new MobileUpdateRegistryError("Stored mobile update manifest integrity failed");
10990
+ const manifest = parseMobileUpdateManifest(decode(bytes));
10991
+ verifyManifestSignature(manifest, options.publicKeys);
10992
+ if (manifest.appId !== appId || manifest.releaseId !== releaseId)
10993
+ throw new MobileUpdateRegistryError("Stored mobile update identity changed");
10994
+ return { key, manifest };
10995
+ };
10996
+ const readChannel = async (appId, channel) => {
10997
+ const bytes = await options.store.get(channelKey(appId, channel));
10998
+ if (!bytes)
10999
+ return null;
11000
+ const value = parseChannel2(decode(bytes));
11001
+ if (value.appId !== appId || value.channel !== channel)
11002
+ throw new MobileUpdateRegistryError("Stored mobile update channel identity changed");
11003
+ return value;
11004
+ };
11005
+ const writeChannel = async (input, signal) => {
11006
+ const value = {
11007
+ ...input,
11008
+ format: MOBILE_UPDATE_REGISTRY_FORMAT,
11009
+ promotedAt: clock().toISOString()
11010
+ };
11011
+ const bytes = json(value);
11012
+ await options.store.put(channelKey(value.appId, value.channel), bytes, {
11013
+ cacheControl: "no-cache",
11014
+ contentType: "application/json",
11015
+ maxBytes: bytes.byteLength,
11016
+ metadata: {
11017
+ channel: value.channel,
11018
+ ...value.releaseId ? { releaseId: value.releaseId } : {},
11019
+ sha256: digest(bytes)
11020
+ },
11021
+ signal
11022
+ });
11023
+ return value;
11024
+ };
11025
+ const promoteUpdate = async (input) => {
11026
+ input.signal?.throwIfAborted();
11027
+ if (input.rollout <= 0 || input.rollout > 1)
11028
+ throw new MobileUpdateRegistryError("Mobile update rollout is invalid");
11029
+ const release = await readManifest(input.appId, input.releaseId);
11030
+ if (!release || release.manifest.channel !== input.channel)
11031
+ throw new MobileUpdateRegistryError("Mobile update was not published to this channel");
11032
+ const existing = await readChannel(input.appId, input.channel);
11033
+ await writeChannel({
11034
+ appId: input.appId,
11035
+ channel: input.channel,
11036
+ ...existing?.releaseId && existing.releaseId !== input.releaseId ? { fallbackReleaseId: existing.releaseId } : existing?.fallbackReleaseId ? { fallbackReleaseId: existing.fallbackReleaseId } : {},
11037
+ releaseId: input.releaseId,
11038
+ rollout: input.rollout
11039
+ }, input.signal);
11040
+ return {
11041
+ appId: input.appId,
11042
+ channel: input.channel,
11043
+ releaseId: input.releaseId,
11044
+ rollout: input.rollout,
11045
+ stage: "promoted"
11046
+ };
11047
+ };
11048
+ return {
11049
+ publishUpdate: async (input) => {
11050
+ input.signal?.throwIfAborted();
11051
+ const manifest = parseMobileUpdateManifest(input.manifest);
11052
+ verifyManifestSignature(manifest, options.publicKeys);
11053
+ const localRoot = path3.resolve(input.releaseDirectory);
11054
+ const localManifest = parseMobileUpdateManifest(JSON.parse(await readFile2(path3.join(localRoot, "update.json"), "utf8")));
11055
+ if (JSON.stringify(localManifest) !== JSON.stringify(manifest))
11056
+ throw new MobileUpdateRegistryError("Local mobile update manifest changed");
11057
+ const existing = await readManifest(manifest.appId, manifest.releaseId);
11058
+ let reused = existing !== null;
11059
+ if (existing && JSON.stringify(existing.manifest) !== JSON.stringify(manifest))
11060
+ throw new MobileUpdateRegistryError("Published mobile update is immutable");
11061
+ if (!existing) {
11062
+ for (const file of manifest.files) {
11063
+ const local = path3.join(localRoot, "files", file.path);
11064
+ const metadata = await stat3(local).catch(() => null);
11065
+ if (!metadata?.isFile() || metadata.size !== file.bytes)
11066
+ throw new MobileUpdateRegistryError(`Mobile update file ${file.path} size changed`);
11067
+ if (await fileDigest(Bun.file(local)) !== file.sha256)
11068
+ throw new MobileUpdateRegistryError(`Mobile update file ${file.path} integrity failed`);
11069
+ const key = fileKey(manifest, file);
11070
+ const stored = await options.store.head(key);
11071
+ if (!stored) {
11072
+ await options.store.put(key, Bun.file(local).stream(), {
11073
+ cacheControl: "public, max-age=31536000, immutable",
11074
+ contentType: "application/octet-stream",
11075
+ maxBytes: file.bytes,
11076
+ metadata: { releaseId: manifest.releaseId, sha256: file.sha256 },
11077
+ signal: input.signal
11078
+ });
11079
+ } else if (stored.size !== file.bytes || stored.metadata?.sha256 !== file.sha256 || stored.metadata?.releaseId !== manifest.releaseId)
11080
+ throw new MobileUpdateRegistryError("Stored mobile update file identity changed");
11081
+ }
11082
+ const bytes = json(manifest);
11083
+ await options.store.put(manifestKey(manifest), bytes, {
11084
+ cacheControl: "public, max-age=31536000, immutable",
11085
+ contentType: "application/json",
11086
+ maxBytes: bytes.byteLength,
11087
+ metadata: { releaseId: manifest.releaseId, sha256: digest(bytes) },
11088
+ signal: input.signal
11089
+ });
11090
+ if (!await readManifest(manifest.appId, manifest.releaseId))
11091
+ throw new MobileUpdateRegistryError("Mobile update publication verification failed");
11092
+ reused = false;
11093
+ }
11094
+ await promoteUpdate({
11095
+ appId: manifest.appId,
11096
+ channel: manifest.channel,
11097
+ releaseId: manifest.releaseId,
11098
+ rollout: input.rollout,
11099
+ signal: input.signal
11100
+ });
11101
+ return {
11102
+ appId: manifest.appId,
11103
+ channel: manifest.channel,
11104
+ releaseId: manifest.releaseId,
11105
+ reused,
11106
+ rollout: input.rollout,
11107
+ stage: "published"
11108
+ };
11109
+ },
11110
+ promoteUpdate,
11111
+ rollbackUpdate: async (input) => {
11112
+ input.signal?.throwIfAborted();
11113
+ const existing = await readChannel(input.appId, input.channel);
11114
+ if (!existing)
11115
+ throw new MobileUpdateRegistryError("Mobile update channel does not exist");
11116
+ if (input.releaseId) {
11117
+ const release = await readManifest(input.appId, input.releaseId);
11118
+ if (!release || release.manifest.channel !== input.channel)
11119
+ throw new MobileUpdateRegistryError("Mobile rollback release was not published");
11120
+ }
11121
+ await writeChannel({
11122
+ appId: input.appId,
11123
+ channel: input.channel,
11124
+ ...existing.releaseId ? { fallbackReleaseId: existing.releaseId } : {},
11125
+ ...input.releaseId ? { releaseId: input.releaseId } : {},
11126
+ rollout: input.releaseId ? 1 : 0
11127
+ }, input.signal);
11128
+ return {
11129
+ appId: input.appId,
11130
+ channel: input.channel,
11131
+ ...input.releaseId ? { releaseId: input.releaseId } : {},
11132
+ stage: "rolled-back"
11133
+ };
11134
+ },
11135
+ resolveUpdate: async (input) => {
11136
+ const channel = await readChannel(input.appId, input.channel);
11137
+ if (!channel?.releaseId)
11138
+ return null;
11139
+ const selected = rolloutMember({
11140
+ appId: input.appId,
11141
+ channel: input.channel,
11142
+ installationId: input.installationId,
11143
+ releaseId: channel.releaseId,
11144
+ rollout: channel.rollout
11145
+ }) ? channel.releaseId : channel.fallbackReleaseId;
11146
+ if (!selected)
11147
+ return null;
11148
+ const release = await readManifest(input.appId, selected);
11149
+ if (!release || release.manifest.runtimeFingerprint !== input.runtimeFingerprint)
11150
+ return null;
11151
+ return { manifest: release.manifest, manifestKey: release.key };
11152
+ },
11153
+ readUpdateFile: async (input) => {
11154
+ const release = await readManifest(input.appId, input.releaseId);
11155
+ if (!release)
11156
+ return null;
11157
+ const requested = safePath(input.path);
11158
+ const file = release.manifest.files.find((candidate) => candidate.path === requested);
11159
+ if (!file)
11160
+ return null;
11161
+ const key = fileKey(release.manifest, file);
11162
+ const [bytes, head] = await Promise.all([
11163
+ options.store.get(key),
11164
+ options.store.head(key)
11165
+ ]);
11166
+ if (!bytes || !head)
11167
+ return null;
11168
+ if (bytes.byteLength !== file.bytes || head.size !== file.bytes || head.metadata?.sha256 !== file.sha256 || head.metadata?.releaseId !== release.manifest.releaseId || digest(bytes) !== file.sha256)
11169
+ throw new MobileUpdateRegistryError("Stored mobile update file integrity failed");
11170
+ return { bytes, file };
11171
+ }
11172
+ };
11173
+ };
11174
+ var createMobileUpdateHandler = (options) => {
11175
+ const route = (options.route ?? `/__absolute/mobile/updates/${options.channel}`).replace(/^\/+|\/+$/g, "");
11176
+ const allowedOrigins = new Set(options.allowedOrigins ?? ["capacitor://localhost", "https://localhost"]);
11177
+ return async (request) => {
11178
+ const origin = request.headers.get("origin");
11179
+ const cors = origin && allowedOrigins.has(origin) ? { "access-control-allow-origin": origin, vary: "Origin" } : {};
11180
+ if (request.method === "OPTIONS") {
11181
+ if (!origin || !allowedOrigins.has(origin))
11182
+ return new Response(null, { status: 403 });
11183
+ return new Response(null, {
11184
+ headers: {
11185
+ ...cors,
11186
+ "access-control-allow-headers": "x-absolute-mobile-app,x-absolute-mobile-channel,x-absolute-mobile-installation,x-absolute-mobile-release,x-absolute-mobile-runtime",
11187
+ "access-control-allow-methods": "GET,OPTIONS",
11188
+ "access-control-max-age": "600"
11189
+ },
11190
+ status: 204
11191
+ });
11192
+ }
11193
+ if (request.method !== "GET")
11194
+ return new Response(null, { status: 405 });
11195
+ const pathname = new URL(request.url).pathname.replace(/^\/+/, "");
11196
+ const relative = pathname.startsWith(`${route}/`) ? pathname.slice(route.length + 1) : "";
11197
+ if (relative === "update.json") {
11198
+ const appId = request.headers.get("x-absolute-mobile-app");
11199
+ const channel = request.headers.get("x-absolute-mobile-channel");
11200
+ const installationId = request.headers.get("x-absolute-mobile-installation");
11201
+ const runtimeFingerprint = request.headers.get("x-absolute-mobile-runtime");
11202
+ if (appId !== options.appId || channel !== options.channel || !installationId || !runtimeFingerprint)
11203
+ return new Response(null, { status: 400 });
11204
+ const selected = await options.registry.resolveUpdate({
11205
+ appId,
11206
+ channel,
11207
+ installationId,
11208
+ runtimeFingerprint
11209
+ });
11210
+ if (!selected)
11211
+ return new Response(null, { status: 204 });
11212
+ return Response.json(selected.manifest, {
11213
+ headers: {
11214
+ ...cors,
11215
+ "cache-control": "no-store",
11216
+ etag: `"${selected.manifest.releaseId}"`
11217
+ }
11218
+ });
11219
+ }
11220
+ const match = /^(amu_[a-f0-9]{64})\/files\/(.+)$/.exec(relative);
11221
+ if (!match?.[1] || !match[2])
11222
+ return new Response(null, { status: 404 });
11223
+ const file = await options.registry.readUpdateFile({
11224
+ appId: options.appId,
11225
+ path: decodeURIComponent(match[2]),
11226
+ releaseId: match[1]
11227
+ });
11228
+ if (!file)
11229
+ return new Response(null, { status: 404 });
11230
+ return new Response(new Blob([new Uint8Array(file.bytes).buffer]), {
11231
+ headers: {
11232
+ ...cors,
11233
+ "cache-control": "public, max-age=31536000, immutable",
11234
+ "content-length": String(file.file.bytes),
11235
+ etag: `"${file.file.sha256}"`
11236
+ }
11237
+ });
11238
+ };
11239
+ };
11240
+
10781
11241
  // src/googlePlay.ts
10782
11242
  var import_google_auth_library = __toESM(require_src5(), 1);
10783
- import { createHash as createHash2 } from "crypto";
10784
- import path3 from "path";
11243
+ import { createHash as createHash3 } from "crypto";
11244
+ import path4 from "path";
10785
11245
  var ANDROID_PUBLISHER_SCOPE = "https://www.googleapis.com/auth/androidpublisher";
10786
11246
  var API_ROOT = "https://androidpublisher.googleapis.com/androidpublisher/v3";
10787
11247
  var UPLOAD_ROOT = "https://androidpublisher.googleapis.com/upload/androidpublisher/v3";
@@ -10812,15 +11272,15 @@ class GooglePlayReleaseError extends Error {
10812
11272
  var encodedJson2 = (value) => new TextEncoder().encode(`${JSON.stringify(value, null, 2)}
10813
11273
  `);
10814
11274
  var decodedJson2 = (value) => JSON.parse(new TextDecoder().decode(value));
10815
- var sha256Bytes2 = (value) => createHash2("sha256").update(value).digest("hex");
10816
- var hashIdentity = (value) => createHash2("sha256").update(value).digest("hex");
11275
+ var sha256Bytes2 = (value) => createHash3("sha256").update(value).digest("hex");
11276
+ var hashIdentity = (value) => createHash3("sha256").update(value).digest("hex");
10817
11277
  var isRecord2 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
10818
11278
  var isIsoTimestamp2 = (value) => {
10819
11279
  if (typeof value !== "string" || Number.isNaN(Date.parse(value)))
10820
11280
  return false;
10821
11281
  return new Date(value).toISOString() === value;
10822
11282
  };
10823
- var normalizedPrefix2 = (value) => {
11283
+ var normalizedPrefix3 = (value) => {
10824
11284
  const prefix = value.replace(/^\/+|\/+$/g, "");
10825
11285
  if (prefix.length === 0 || prefix.split("/").some((segment) => segment === "." || segment === ".."))
10826
11286
  throw new GooglePlayReleaseError("Google Play receipt prefix is invalid");
@@ -10846,9 +11306,9 @@ var normalizedTarget = (target) => {
10846
11306
  if (target.name !== undefined && target.name.trim().length === 0)
10847
11307
  throw new GooglePlayReleaseError("Google Play release name is invalid");
10848
11308
  const languages = new Set;
10849
- const releaseNotes = [...target.releaseNotes ?? []].map(({ language, text }) => ({
11309
+ const releaseNotes = [...target.releaseNotes ?? []].map(({ language, text: text2 }) => ({
10850
11310
  language: language.trim(),
10851
- text: text.trim()
11311
+ text: text2.trim()
10852
11312
  })).sort((left, right) => left.language.localeCompare(right.language));
10853
11313
  for (const note of releaseNotes) {
10854
11314
  if (note.language.length === 0 || note.text.length === 0 || languages.has(note.language))
@@ -10888,8 +11348,8 @@ var parseReceipt = (value) => {
10888
11348
  };
10889
11349
  };
10890
11350
  var responseError = async (response) => {
10891
- const text = await response.text().catch(() => "");
10892
- return new GooglePlayReleaseError(`Google Play API request failed (${response.status})${text ? `: ${text.slice(0, 500)}` : ""}`, response.status);
11351
+ const text2 = await response.text().catch(() => "");
11352
+ return new GooglePlayReleaseError(`Google Play API request failed (${response.status})${text2 ? `: ${text2.slice(0, 500)}` : ""}`, response.status);
10893
11353
  };
10894
11354
  var headersObject = (headers) => headers instanceof Headers ? Object.fromEntries(headers) : headers;
10895
11355
  var createGooglePlayClient = (dependencies = {}) => {
@@ -11057,7 +11517,7 @@ var updatedTrack = (current, intent, versionCode) => {
11057
11517
  var createGooglePlayReleasePublisher = (options) => {
11058
11518
  const client = options.client ?? createGooglePlayClient();
11059
11519
  const clock = options.clock ?? (() => new Date);
11060
- const prefix = normalizedPrefix2(options.receiptPrefix ?? DEFAULT_RECEIPT_PREFIX);
11520
+ const prefix = normalizedPrefix3(options.receiptPrefix ?? DEFAULT_RECEIPT_PREFIX);
11061
11521
  const receiptKey = (packageName, track, releaseId) => `${prefix}/${hashIdentity(`${packageName}\x00${track}`)}/${releaseId}.json`;
11062
11522
  const preparationKey = (packageName, buildIdentity) => `${prefix}/${hashIdentity(packageName)}/preparations/${hashIdentity(buildIdentity)}.json`;
11063
11523
  const readPreparation = async (packageName, buildIdentity) => {
@@ -11126,6 +11586,7 @@ var createGooglePlayReleasePublisher = (options) => {
11126
11586
  updatedAt: clock().toISOString()
11127
11587
  });
11128
11588
  return {
11589
+ ...options.registry,
11129
11590
  prepareAndroidRelease: async (input) => {
11130
11591
  const target = input.googlePlay ?? options.target;
11131
11592
  if (!target)
@@ -11167,6 +11628,8 @@ var createGooglePlayReleasePublisher = (options) => {
11167
11628
  return publication;
11168
11629
  const intent = normalizedTarget(target);
11169
11630
  const metadata = publication.record.metadata;
11631
+ if (metadata.platform !== "android")
11632
+ throw new GooglePlayReleaseError("Google Play publishing requires an Android App Bundle release");
11170
11633
  if (!metadata.signed)
11171
11634
  throw new GooglePlayReleaseError("Unsigned Android releases cannot be sent to Google Play");
11172
11635
  if (!metadata.versionCode)
@@ -11257,7 +11720,7 @@ var createGooglePlayReleasePublisher = (options) => {
11257
11720
  }));
11258
11721
  }
11259
11722
  const upload = (uploadSession) => client.uploadBundle({
11260
- artifactPath: path3.join(input.releaseRoot, metadata.artifact),
11723
+ artifactPath: path4.join(input.releaseRoot, metadata.artifact),
11261
11724
  bytes: metadata.bytes,
11262
11725
  sessionUrl: uploadSession,
11263
11726
  signal: input.signal
@@ -11320,6 +11783,550 @@ var createGooglePlayReleasePublisher = (options) => {
11320
11783
  };
11321
11784
  };
11322
11785
 
11786
+ // src/appStoreConnect.ts
11787
+ import { createHash as createHash4, createPrivateKey, sign } from "crypto";
11788
+ import path5 from "path";
11789
+ var API_ROOT2 = "https://api.appstoreconnect.apple.com/v1";
11790
+ var DEFAULT_RECEIPT_PREFIX2 = "absolutejs/app-store-connect-receipts";
11791
+ var SHA256_PATTERN3 = /^[a-f0-9]{64}$/;
11792
+
11793
+ class AppStoreConnectReleaseError extends Error {
11794
+ status;
11795
+ constructor(message, status) {
11796
+ super(message);
11797
+ this.name = "AppStoreConnectReleaseError";
11798
+ this.status = status;
11799
+ }
11800
+ }
11801
+ var isRecord3 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
11802
+ var encodedJson3 = (value) => new TextEncoder().encode(`${JSON.stringify(value, null, 2)}
11803
+ `);
11804
+ var decodedJson3 = (value) => JSON.parse(new TextDecoder().decode(value));
11805
+ var sha256Bytes3 = (value) => createHash4("sha256").update(value).digest("hex");
11806
+ var hashIdentity2 = (value) => createHash4("sha256").update(value).digest("hex");
11807
+ var isIsoTimestamp3 = (value) => typeof value === "string" && !Number.isNaN(Date.parse(value)) && new Date(value).toISOString() === value;
11808
+ var normalizedPrefix4 = (value) => {
11809
+ const prefix = value.replace(/^\/+|\/+$/g, "");
11810
+ if (!prefix || prefix.split("/").some((part) => part === "." || part === ".."))
11811
+ throw new AppStoreConnectReleaseError("App Store Connect receipt prefix is invalid");
11812
+ return prefix;
11813
+ };
11814
+ var normalizedIntent = (target = {}) => {
11815
+ const groups = [
11816
+ ...new Set((target.groups ?? []).map((value) => value.trim()))
11817
+ ].sort();
11818
+ if (groups.some((value) => !value))
11819
+ throw new AppStoreConnectReleaseError("TestFlight group names or IDs must not be empty");
11820
+ const locales = new Set;
11821
+ const whatsNew = [...target.whatsNew ?? []].map(({ locale, text: text2 }) => ({ locale: locale.trim(), text: text2.trim() })).sort((left, right) => left.locale.localeCompare(right.locale));
11822
+ for (const item of whatsNew) {
11823
+ if (!item.locale || !item.text || locales.has(item.locale))
11824
+ throw new AppStoreConnectReleaseError("TestFlight notes require unique locales and non-empty text");
11825
+ locales.add(item.locale);
11826
+ }
11827
+ if (target.submitForReview && groups.length === 0)
11828
+ throw new AppStoreConnectReleaseError("TestFlight beta review requires at least one external group");
11829
+ return { groups, submitForReview: target.submitForReview ?? false, whatsNew };
11830
+ };
11831
+ var parseReceipt2 = (value) => {
11832
+ if (!isRecord3(value) || value.format !== 1 || value.provider !== "app-store-connect" || typeof value.appleAppId !== "string" || typeof value.releaseId !== "string" || typeof value.sha256 !== "string" || !SHA256_PATTERN3.test(value.sha256) || !Number.isSafeInteger(value.buildNumber) || Number(value.buildNumber) < 1 || typeof value.marketingVersion !== "string" || !isIsoTimestamp3(value.updatedAt) || ![
11833
+ "preparing",
11834
+ "uploading",
11835
+ "processing",
11836
+ "distributed",
11837
+ "review-submitted"
11838
+ ].includes(String(value.stage)) || !isRecord3(value.intent))
11839
+ throw new AppStoreConnectReleaseError("App Store Connect release receipt is invalid");
11840
+ for (const field of ["buildId", "buildUploadFileId", "buildUploadId"])
11841
+ if (value[field] !== undefined && typeof value[field] !== "string")
11842
+ throw new AppStoreConnectReleaseError("App Store Connect release receipt is invalid");
11843
+ const buildId = typeof value.buildId === "string" ? value.buildId : undefined;
11844
+ const buildUploadFileId = typeof value.buildUploadFileId === "string" ? value.buildUploadFileId : undefined;
11845
+ const buildUploadId = typeof value.buildUploadId === "string" ? value.buildUploadId : undefined;
11846
+ return {
11847
+ appleAppId: value.appleAppId,
11848
+ buildNumber: Number(value.buildNumber),
11849
+ format: 1,
11850
+ intent: normalizedIntent(value.intent),
11851
+ marketingVersion: value.marketingVersion,
11852
+ provider: "app-store-connect",
11853
+ releaseId: value.releaseId,
11854
+ sha256: value.sha256,
11855
+ stage: value.stage,
11856
+ updatedAt: value.updatedAt,
11857
+ ...buildId ? { buildId } : {},
11858
+ ...buildUploadFileId ? { buildUploadFileId } : {},
11859
+ ...buildUploadId ? { buildUploadId } : {}
11860
+ };
11861
+ };
11862
+ var base64url = (value) => Buffer.from(value).toString("base64url");
11863
+ var createTokenProvider = (auth, clock) => {
11864
+ if (!auth.issuerId || !auth.keyId || !auth.privateKey)
11865
+ throw new AppStoreConnectReleaseError("App Store Connect API credentials are incomplete");
11866
+ const key = createPrivateKey(auth.privateKey);
11867
+ return () => {
11868
+ const issuedAt = Math.floor(clock().getTime() / 1000);
11869
+ const header = base64url(JSON.stringify({ alg: "ES256", kid: auth.keyId, typ: "JWT" }));
11870
+ const claims = base64url(JSON.stringify({
11871
+ aud: "appstoreconnect-v1",
11872
+ exp: issuedAt + 1199,
11873
+ iat: issuedAt,
11874
+ iss: auth.issuerId
11875
+ }));
11876
+ const payload = `${header}.${claims}`;
11877
+ return `${payload}.${base64url(sign("sha256", Buffer.from(payload), { dsaEncoding: "ieee-p1363", key }))}`;
11878
+ };
11879
+ };
11880
+ var responseError2 = async (response) => {
11881
+ const body = await response.text().catch(() => "");
11882
+ return new AppStoreConnectReleaseError(`App Store Connect request failed (${response.status})${body ? `: ${body}` : ""}`, response.status);
11883
+ };
11884
+ var createAppStoreConnectClient = (options) => {
11885
+ const requestFetch = options.fetch ?? fetch;
11886
+ const token = createTokenProvider(options.auth, options.clock ?? (() => new Date));
11887
+ const request = async (route, init = {}) => {
11888
+ const response = await requestFetch(`${API_ROOT2}${route}`, {
11889
+ ...init,
11890
+ headers: {
11891
+ Accept: "application/json",
11892
+ Authorization: `Bearer ${token()}`,
11893
+ ...init.body ? { "Content-Type": "application/json" } : {},
11894
+ ...init.headers
11895
+ }
11896
+ });
11897
+ if (!response.ok)
11898
+ throw await responseError2(response);
11899
+ return response.status === 204 ? undefined : await response.json();
11900
+ };
11901
+ const dataList = async (route) => {
11902
+ const result = [];
11903
+ let next = route;
11904
+ while (next) {
11905
+ const page = await request(next.startsWith(API_ROOT2) ? next.slice(API_ROOT2.length) : next);
11906
+ if (Array.isArray(page.data))
11907
+ result.push(...page.data.filter(isRecord3));
11908
+ const links = isRecord3(page.links) ? page.links : undefined;
11909
+ next = typeof links?.next === "string" ? links.next : undefined;
11910
+ }
11911
+ return result;
11912
+ };
11913
+ const buildFrom = (data) => {
11914
+ const attributes = isRecord3(data.attributes) ? data.attributes : {};
11915
+ return {
11916
+ id: String(data.id),
11917
+ processingState: String(attributes.processingState),
11918
+ version: String(attributes.version)
11919
+ };
11920
+ };
11921
+ const uploadFrom = (data) => {
11922
+ const attributes = isRecord3(data.attributes) ? data.attributes : {};
11923
+ const state = isRecord3(attributes.state) ? attributes.state.state : attributes.state;
11924
+ return {
11925
+ id: String(data.id),
11926
+ state: String(state)
11927
+ };
11928
+ };
11929
+ return {
11930
+ findAppId: async ({ bundleId, signal }) => {
11931
+ const items = await dataList(`/apps?filter[bundleId]=${encodeURIComponent(bundleId)}&fields[apps]=bundleId&limit=2`);
11932
+ const exact = items.filter((item) => isRecord3(item.attributes) && item.attributes.bundleId === bundleId);
11933
+ if (exact.length !== 1)
11934
+ throw new AppStoreConnectReleaseError(`Expected one App Store Connect app for bundle ID ${bundleId}`);
11935
+ signal?.throwIfAborted();
11936
+ return String(exact[0].id);
11937
+ },
11938
+ listBuildNumbers: async ({ appId, signal }) => {
11939
+ signal?.throwIfAborted();
11940
+ const items = await dataList(`/builds?filter[app]=${encodeURIComponent(appId)}&fields[builds]=version&limit=200`);
11941
+ return items.map((item) => Number(isRecord3(item.attributes) ? item.attributes.version : NaN)).filter((value) => Number.isSafeInteger(value) && value > 0);
11942
+ },
11943
+ findBuild: async ({ appId, buildNumber, signal }) => {
11944
+ signal?.throwIfAborted();
11945
+ const items = await dataList(`/builds?filter[app]=${encodeURIComponent(appId)}&filter[version]=${buildNumber}&fields[builds]=version,processingState&limit=2`);
11946
+ return items.length ? buildFrom(items[0]) : null;
11947
+ },
11948
+ findBuildUpload: async ({
11949
+ appId,
11950
+ buildNumber,
11951
+ marketingVersion,
11952
+ signal
11953
+ }) => {
11954
+ signal?.throwIfAborted();
11955
+ const items = await dataList(`/apps/${encodeURIComponent(appId)}/buildUploads?filter[cfBundleVersion]=${buildNumber}&filter[cfBundleShortVersionString]=${encodeURIComponent(marketingVersion)}&filter[platform]=IOS&fields[buildUploads]=state,cfBundleVersion,cfBundleShortVersionString&limit=2`);
11956
+ return items.length ? uploadFrom(items[0]) : null;
11957
+ },
11958
+ createBuildUpload: async ({
11959
+ appId,
11960
+ buildNumber,
11961
+ marketingVersion,
11962
+ signal
11963
+ }) => {
11964
+ const response = await request("/buildUploads", {
11965
+ method: "POST",
11966
+ signal,
11967
+ body: JSON.stringify({
11968
+ data: {
11969
+ type: "buildUploads",
11970
+ attributes: {
11971
+ cfBundleVersion: String(buildNumber),
11972
+ cfBundleShortVersionString: marketingVersion,
11973
+ platform: "IOS"
11974
+ },
11975
+ relationships: { app: { data: { type: "apps", id: appId } } }
11976
+ }
11977
+ })
11978
+ });
11979
+ return uploadFrom(response.data);
11980
+ },
11981
+ getBuildUpload: async ({ buildUploadId, signal }) => {
11982
+ const response = await request(`/buildUploads/${encodeURIComponent(buildUploadId)}?fields[buildUploads]=state`, { signal });
11983
+ return uploadFrom(response.data);
11984
+ },
11985
+ createBuildUploadFile: async ({
11986
+ buildUploadId,
11987
+ bytes,
11988
+ fileName,
11989
+ signal
11990
+ }) => {
11991
+ const response = await request("/buildUploadFiles", {
11992
+ method: "POST",
11993
+ signal,
11994
+ body: JSON.stringify({
11995
+ data: {
11996
+ type: "buildUploadFiles",
11997
+ attributes: {
11998
+ assetType: "ASSET",
11999
+ fileName,
12000
+ fileSize: bytes,
12001
+ uti: "com.apple.ipa"
12002
+ },
12003
+ relationships: {
12004
+ buildUpload: {
12005
+ data: { type: "buildUploads", id: buildUploadId }
12006
+ }
12007
+ }
12008
+ }
12009
+ })
12010
+ });
12011
+ return String(response.data.id);
12012
+ },
12013
+ findBuildUploadFile: async ({ buildUploadId, signal }) => {
12014
+ signal?.throwIfAborted();
12015
+ const items = await dataList(`/buildUploads/${encodeURIComponent(buildUploadId)}/buildUploadFiles?fields[buildUploadFiles]=fileName&limit=2`);
12016
+ return items.length ? String(items[0].id) : null;
12017
+ },
12018
+ uploadBuildFile: async ({ artifactPath, fileId, signal }) => {
12019
+ const response = await request(`/buildUploadFiles/${encodeURIComponent(fileId)}?fields[buildUploadFiles]=uploadOperations`, { signal });
12020
+ const data = response.data;
12021
+ const attrs = isRecord3(data.attributes) ? data.attributes : {};
12022
+ const operations = Array.isArray(attrs.uploadOperations) ? attrs.uploadOperations.filter(isRecord3) : [];
12023
+ if (!operations.length)
12024
+ throw new AppStoreConnectReleaseError("App Store Connect returned no IPA upload operations");
12025
+ await Promise.all(operations.map(async (operation) => {
12026
+ const offset = Number(operation.offset);
12027
+ const length = Number(operation.length);
12028
+ const headers = new Headers;
12029
+ if (Array.isArray(operation.requestHeaders)) {
12030
+ for (const entry of operation.requestHeaders)
12031
+ if (isRecord3(entry))
12032
+ headers.set(String(entry.name), String(entry.value));
12033
+ }
12034
+ const upload = await requestFetch(String(operation.url), {
12035
+ method: String(operation.method),
12036
+ headers,
12037
+ body: Bun.file(artifactPath).slice(offset, offset + length),
12038
+ signal
12039
+ });
12040
+ if (!upload.ok)
12041
+ throw await responseError2(upload);
12042
+ }));
12043
+ },
12044
+ commitBuildUploadFile: async ({ fileId, sha256, signal }) => {
12045
+ await request(`/buildUploadFiles/${encodeURIComponent(fileId)}`, {
12046
+ method: "PATCH",
12047
+ signal,
12048
+ body: JSON.stringify({
12049
+ data: {
12050
+ type: "buildUploadFiles",
12051
+ id: fileId,
12052
+ attributes: {
12053
+ uploaded: true,
12054
+ sourceFileChecksums: {
12055
+ file: { algorithm: "SHA_256", hash: sha256 }
12056
+ }
12057
+ }
12058
+ }
12059
+ })
12060
+ });
12061
+ },
12062
+ resolveGroups: async ({ appId, groups, signal }) => {
12063
+ signal?.throwIfAborted();
12064
+ const items = await dataList(`/betaGroups?filter[app]=${encodeURIComponent(appId)}&fields[betaGroups]=name,isInternalGroup&limit=200`);
12065
+ return groups.map((requested) => {
12066
+ const matches = items.filter((item2) => item2.id === requested || isRecord3(item2.attributes) && item2.attributes.name === requested);
12067
+ if (matches.length !== 1)
12068
+ throw new AppStoreConnectReleaseError(`Expected one TestFlight group matching ${requested}`);
12069
+ const item = matches[0];
12070
+ const attributes = item.attributes;
12071
+ return {
12072
+ id: String(item.id),
12073
+ isInternal: attributes.isInternalGroup === true,
12074
+ name: String(attributes.name)
12075
+ };
12076
+ });
12077
+ },
12078
+ addBuildToGroup: async ({ buildId, groupId, signal }) => {
12079
+ await request(`/betaGroups/${encodeURIComponent(groupId)}/relationships/builds`, {
12080
+ method: "POST",
12081
+ signal,
12082
+ body: JSON.stringify({ data: [{ type: "builds", id: buildId }] })
12083
+ });
12084
+ },
12085
+ upsertWhatsNew: async ({ buildId, locale, text: text2, signal }) => {
12086
+ const items = await dataList(`/builds/${encodeURIComponent(buildId)}/betaBuildLocalizations?fields[betaBuildLocalizations]=locale,whatsNew&limit=200`);
12087
+ const existing = items.find((item) => isRecord3(item.attributes) && item.attributes.locale === locale);
12088
+ if (existing) {
12089
+ await request(`/betaBuildLocalizations/${encodeURIComponent(String(existing.id))}`, {
12090
+ method: "PATCH",
12091
+ signal,
12092
+ body: JSON.stringify({
12093
+ data: {
12094
+ type: "betaBuildLocalizations",
12095
+ id: existing.id,
12096
+ attributes: { whatsNew: text2 }
12097
+ }
12098
+ })
12099
+ });
12100
+ } else {
12101
+ await request("/betaBuildLocalizations", {
12102
+ method: "POST",
12103
+ signal,
12104
+ body: JSON.stringify({
12105
+ data: {
12106
+ type: "betaBuildLocalizations",
12107
+ attributes: { locale, whatsNew: text2 },
12108
+ relationships: {
12109
+ build: { data: { type: "builds", id: buildId } }
12110
+ }
12111
+ }
12112
+ })
12113
+ });
12114
+ }
12115
+ },
12116
+ submitBetaReview: async ({ buildId, signal }) => {
12117
+ await request("/betaAppReviewSubmissions", {
12118
+ method: "POST",
12119
+ signal,
12120
+ body: JSON.stringify({
12121
+ data: {
12122
+ type: "betaAppReviewSubmissions",
12123
+ relationships: { build: { data: { type: "builds", id: buildId } } }
12124
+ }
12125
+ })
12126
+ });
12127
+ },
12128
+ hasBetaReviewSubmission: async ({ buildId, signal }) => {
12129
+ const response = await request(`/builds/${encodeURIComponent(buildId)}/relationships/betaAppReviewSubmission`, { signal });
12130
+ return isRecord3(response.data) && typeof response.data.id === "string";
12131
+ }
12132
+ };
12133
+ };
12134
+ var createAppStoreConnectReleasePublisher = (options) => {
12135
+ const clock = options.clock ?? (() => new Date);
12136
+ const client = options.client ?? (options.auth ? createAppStoreConnectClient({ auth: options.auth, clock }) : undefined);
12137
+ if (!client)
12138
+ throw new AppStoreConnectReleaseError("App Store Connect auth or client is required");
12139
+ const prefix = normalizedPrefix4(options.receiptPrefix ?? DEFAULT_RECEIPT_PREFIX2);
12140
+ const maxWaitMs = options.maxWaitMs ?? 20 * 60000;
12141
+ const pollIntervalMs = options.pollIntervalMs ?? 5000;
12142
+ const preparationKey = (bundleId, buildIdentity) => `${prefix}/${hashIdentity2(bundleId)}/preparations/${hashIdentity2(buildIdentity)}.json`;
12143
+ const receiptKey = (appId, releaseId, intent) => `${prefix}/${hashIdentity2(appId)}/${releaseId}/${hashIdentity2(JSON.stringify(intent))}.json`;
12144
+ const readStored = async (key) => {
12145
+ const bytes = await options.receiptStore.get(key);
12146
+ if (!bytes)
12147
+ return null;
12148
+ const head = await options.receiptStore.head(key);
12149
+ if (!head || head.size !== bytes.byteLength || head.metadata?.sha256 !== sha256Bytes3(bytes))
12150
+ throw new AppStoreConnectReleaseError("Stored App Store Connect state failed integrity verification");
12151
+ return decodedJson3(bytes);
12152
+ };
12153
+ const writeStored = async (key, value, type) => {
12154
+ const bytes = encodedJson3(value);
12155
+ await options.receiptStore.put(key, bytes, {
12156
+ cacheControl: "no-cache",
12157
+ contentType: "application/json",
12158
+ maxBytes: bytes.byteLength,
12159
+ metadata: { sha256: sha256Bytes3(bytes), type }
12160
+ });
12161
+ };
12162
+ const waitForBuild = async (appId, buildNumber, buildUploadId, signal) => {
12163
+ const deadline = Date.now() + maxWaitMs;
12164
+ while (Date.now() <= deadline) {
12165
+ signal?.throwIfAborted();
12166
+ const build = await client.findBuild({ appId, buildNumber, signal });
12167
+ if (build?.processingState === "VALID")
12168
+ return build;
12169
+ if (build && (build.processingState === "FAILED" || build.processingState === "INVALID"))
12170
+ throw new AppStoreConnectReleaseError(`Apple rejected build ${buildNumber} during processing (${build.processingState})`);
12171
+ const upload = await client.getBuildUpload({ buildUploadId, signal });
12172
+ if (upload.state === "FAILED")
12173
+ throw new AppStoreConnectReleaseError(`Apple rejected build upload ${buildUploadId}`);
12174
+ await Bun.sleep(pollIntervalMs);
12175
+ }
12176
+ throw new AppStoreConnectReleaseError(`Timed out waiting for Apple to process build ${buildNumber}`);
12177
+ };
12178
+ return {
12179
+ ...options.registry,
12180
+ prepareIosRelease: async ({ buildIdentity, bundleId, signal }) => {
12181
+ if (!buildIdentity)
12182
+ throw new AppStoreConnectReleaseError("App Store Connect build identity is invalid");
12183
+ const key = preparationKey(bundleId, buildIdentity);
12184
+ const stored = await readStored(key);
12185
+ if (isRecord3(stored) && stored.bundleId === bundleId && stored.buildIdentity === buildIdentity && Number.isSafeInteger(stored.buildNumber) && Number(stored.buildNumber) > 0)
12186
+ return { buildNumber: Number(stored.buildNumber) };
12187
+ const appleAppId = await client.findAppId({ bundleId, signal });
12188
+ const numbers = await client.listBuildNumbers({
12189
+ appId: appleAppId,
12190
+ signal
12191
+ });
12192
+ const highest = numbers.reduce((maximum, value) => Math.max(maximum, value), 0);
12193
+ if (!Number.isSafeInteger(highest) || highest >= Number.MAX_SAFE_INTEGER)
12194
+ throw new AppStoreConnectReleaseError("App Store Connect cannot allocate another iOS build number");
12195
+ const buildNumber = highest + 1;
12196
+ await writeStored(key, {
12197
+ appleAppId,
12198
+ buildIdentity,
12199
+ buildNumber,
12200
+ bundleId,
12201
+ format: 1,
12202
+ preparedAt: clock().toISOString()
12203
+ }, "app-store-connect-build-preparation");
12204
+ return { buildNumber };
12205
+ },
12206
+ publish: async (input) => {
12207
+ const publication = await options.registry.publish(input);
12208
+ const metadata = publication.record.metadata;
12209
+ const target = input.appStoreConnect ?? options.target;
12210
+ if (!target)
12211
+ return publication;
12212
+ if (metadata.platform !== "ios" || metadata.type !== "ipa")
12213
+ throw new AppStoreConnectReleaseError("App Store Connect publishing requires an iOS IPA release");
12214
+ if (!metadata.signed || !metadata.buildNumber)
12215
+ throw new AppStoreConnectReleaseError("App Store Connect publishing requires a signed, versioned IPA");
12216
+ const intent = normalizedIntent(target);
12217
+ const appleAppId = await client.findAppId({
12218
+ bundleId: metadata.appId,
12219
+ signal: input.signal
12220
+ });
12221
+ const key = receiptKey(appleAppId, metadata.releaseId, intent);
12222
+ const existingValue = await readStored(key);
12223
+ let receipt = existingValue ? parseReceipt2(existingValue) : {
12224
+ appleAppId,
12225
+ buildNumber: metadata.buildNumber,
12226
+ format: 1,
12227
+ intent,
12228
+ marketingVersion: metadata.marketingVersion,
12229
+ provider: "app-store-connect",
12230
+ releaseId: metadata.releaseId,
12231
+ sha256: metadata.sha256,
12232
+ stage: "preparing",
12233
+ updatedAt: clock().toISOString()
12234
+ };
12235
+ const writeReceipt = async (values) => {
12236
+ receipt = { ...receipt, ...values, updatedAt: clock().toISOString() };
12237
+ await writeStored(key, receipt, "app-store-connect-release-receipt");
12238
+ };
12239
+ if (receipt.stage === "distributed" || receipt.stage === "review-submitted")
12240
+ return { ...publication, appStoreConnect: { receipt, reused: true } };
12241
+ let upload = receipt.buildUploadId ? await client.getBuildUpload({
12242
+ buildUploadId: receipt.buildUploadId,
12243
+ signal: input.signal
12244
+ }) : await client.findBuildUpload({
12245
+ appId: appleAppId,
12246
+ buildNumber: metadata.buildNumber,
12247
+ marketingVersion: metadata.marketingVersion,
12248
+ signal: input.signal
12249
+ });
12250
+ if (!upload)
12251
+ upload = await client.createBuildUpload({
12252
+ appId: appleAppId,
12253
+ buildNumber: metadata.buildNumber,
12254
+ marketingVersion: metadata.marketingVersion,
12255
+ signal: input.signal
12256
+ });
12257
+ await writeReceipt({ buildUploadId: upload.id, stage: "uploading" });
12258
+ let build = await client.findBuild({
12259
+ appId: appleAppId,
12260
+ buildNumber: metadata.buildNumber,
12261
+ signal: input.signal
12262
+ });
12263
+ if (!build || build.processingState !== "VALID") {
12264
+ let fileId = receipt.buildUploadFileId;
12265
+ if (!fileId) {
12266
+ fileId = await client.findBuildUploadFile({
12267
+ buildUploadId: upload.id,
12268
+ signal: input.signal
12269
+ }) ?? await client.createBuildUploadFile({
12270
+ buildUploadId: upload.id,
12271
+ bytes: metadata.bytes,
12272
+ fileName: metadata.artifact,
12273
+ signal: input.signal
12274
+ });
12275
+ await writeReceipt({ buildUploadFileId: fileId });
12276
+ }
12277
+ if (upload.state === "AWAITING_UPLOAD") {
12278
+ const artifactPath = path5.join(input.releaseRoot, metadata.artifact);
12279
+ await client.uploadBuildFile({
12280
+ artifactPath,
12281
+ fileId,
12282
+ signal: input.signal
12283
+ });
12284
+ await client.commitBuildUploadFile({
12285
+ fileId,
12286
+ sha256: metadata.sha256,
12287
+ signal: input.signal
12288
+ });
12289
+ }
12290
+ await writeReceipt({ stage: "processing" });
12291
+ build = await waitForBuild(appleAppId, metadata.buildNumber, upload.id, input.signal);
12292
+ }
12293
+ await writeReceipt({ buildId: build.id });
12294
+ const groups = await client.resolveGroups({
12295
+ appId: appleAppId,
12296
+ groups: intent.groups,
12297
+ signal: input.signal
12298
+ });
12299
+ if (intent.submitForReview && groups.some((group) => group.isInternal))
12300
+ throw new AppStoreConnectReleaseError("TestFlight beta review may only be requested for external groups");
12301
+ for (const note of intent.whatsNew)
12302
+ await client.upsertWhatsNew({
12303
+ buildId: build.id,
12304
+ locale: note.locale,
12305
+ text: note.text,
12306
+ signal: input.signal
12307
+ });
12308
+ for (const group of groups)
12309
+ await client.addBuildToGroup({
12310
+ buildId: build.id,
12311
+ groupId: group.id,
12312
+ signal: input.signal
12313
+ });
12314
+ if (intent.submitForReview && !await client.hasBetaReviewSubmission({
12315
+ buildId: build.id,
12316
+ signal: input.signal
12317
+ }))
12318
+ await client.submitBetaReview({
12319
+ buildId: build.id,
12320
+ signal: input.signal
12321
+ });
12322
+ await writeReceipt({
12323
+ stage: intent.submitForReview ? "review-submitted" : "distributed"
12324
+ });
12325
+ return { ...publication, appStoreConnect: { receipt, reused: false } };
12326
+ }
12327
+ };
12328
+ };
12329
+
11323
12330
  // src/edgeIngress.ts
11324
12331
  var validPort = (port) => Number.isInteger(port) && port >= 1 && port <= 65535;
11325
12332
 
@@ -11515,7 +12522,13 @@ var sshTarget = (options) => {
11515
12522
  }
11516
12523
  return;
11517
12524
  }
11518
- const argv = ["scp", "-r", ...sshBaseFlags(options), localPath, `${remote}:${remotePath}`];
12525
+ const argv = [
12526
+ "scp",
12527
+ "-r",
12528
+ ...sshBaseFlags(options),
12529
+ localPath,
12530
+ `${remote}:${remotePath}`
12531
+ ];
11519
12532
  const result = await runSpawn(argv, { timeoutMs: 600000 });
11520
12533
  if (result.exitCode !== 0) {
11521
12534
  throw new Error(`scp upload failed (exit ${result.exitCode}): ${result.stderr || result.stdout}`);
@@ -11556,11 +12569,17 @@ rm -f ${pidPath(ctx.appName)}
11556
12569
  `.trim();
11557
12570
  return {
11558
12571
  reload: async (target, ctx) => {
11559
- const stop = await target.exec(stopCmd(ctx), { onLog: ctx.onLog, timeoutMs: 30000 });
12572
+ const stop = await target.exec(stopCmd(ctx), {
12573
+ onLog: ctx.onLog,
12574
+ timeoutMs: 30000
12575
+ });
11560
12576
  if (stop.exitCode !== 0) {
11561
12577
  throw new Error(`bareManager.stop failed (exit ${stop.exitCode}): ${stop.stderr}`);
11562
12578
  }
11563
- const start = await target.exec(startCmd(ctx), { onLog: ctx.onLog, timeoutMs: 30000 });
12579
+ const start = await target.exec(startCmd(ctx), {
12580
+ onLog: ctx.onLog,
12581
+ timeoutMs: 30000
12582
+ });
11564
12583
  if (start.exitCode !== 0) {
11565
12584
  throw new Error(`bareManager.start failed (exit ${start.exitCode}): ${start.stderr}`);
11566
12585
  }
@@ -11575,7 +12594,10 @@ rm -f ${pidPath(ctx.appName)}
11575
12594
  return "unknown";
11576
12595
  },
11577
12596
  stop: async (target, ctx) => {
11578
- const result = await target.exec(stopCmd(ctx), { onLog: ctx.onLog, timeoutMs: 30000 });
12597
+ const result = await target.exec(stopCmd(ctx), {
12598
+ onLog: ctx.onLog,
12599
+ timeoutMs: 30000
12600
+ });
11579
12601
  if (result.exitCode !== 0) {
11580
12602
  throw new Error(`bareManager.stop failed (exit ${result.exitCode}): ${result.stderr}`);
11581
12603
  }
@@ -11621,15 +12643,24 @@ var systemdManager = (options = {}) => {
11621
12643
  if (writeUnit.exitCode !== 0) {
11622
12644
  throw new Error(`systemdManager: writing unit failed (exit ${writeUnit.exitCode}): ${writeUnit.stderr}`);
11623
12645
  }
11624
- const reload = await target.exec(`${systemctl} daemon-reload`, { onLog: ctx.onLog, timeoutMs: 15000 });
12646
+ const reload = await target.exec(`${systemctl} daemon-reload`, {
12647
+ onLog: ctx.onLog,
12648
+ timeoutMs: 15000
12649
+ });
11625
12650
  if (reload.exitCode !== 0) {
11626
12651
  throw new Error(`systemdManager: daemon-reload failed (exit ${reload.exitCode}): ${reload.stderr}`);
11627
12652
  }
11628
- const enable = await target.exec(`${systemctl} enable ${name}`, { onLog: ctx.onLog, timeoutMs: 15000 });
12653
+ const enable = await target.exec(`${systemctl} enable ${name}`, {
12654
+ onLog: ctx.onLog,
12655
+ timeoutMs: 15000
12656
+ });
11629
12657
  if (enable.exitCode !== 0) {
11630
12658
  throw new Error(`systemdManager: enable failed (exit ${enable.exitCode}): ${enable.stderr}`);
11631
12659
  }
11632
- const restart = await target.exec(`${systemctl} restart ${name}`, { onLog: ctx.onLog, timeoutMs: 60000 });
12660
+ const restart = await target.exec(`${systemctl} restart ${name}`, {
12661
+ onLog: ctx.onLog,
12662
+ timeoutMs: 60000
12663
+ });
11633
12664
  if (restart.exitCode !== 0) {
11634
12665
  throw new Error(`systemdManager: restart failed (exit ${restart.exitCode}): ${restart.stderr}`);
11635
12666
  }
@@ -11644,7 +12675,10 @@ var systemdManager = (options = {}) => {
11644
12675
  return "unknown";
11645
12676
  },
11646
12677
  stop: async (target, ctx) => {
11647
- const result = await target.exec(`${systemctl} stop ${unitName(ctx)}`, { onLog: ctx.onLog, timeoutMs: 30000 });
12678
+ const result = await target.exec(`${systemctl} stop ${unitName(ctx)}`, {
12679
+ onLog: ctx.onLog,
12680
+ timeoutMs: 30000
12681
+ });
11648
12682
  if (result.exitCode !== 0) {
11649
12683
  throw new Error(`systemdManager: stop failed (exit ${result.exitCode}): ${result.stderr}`);
11650
12684
  }
@@ -11652,7 +12686,14 @@ var systemdManager = (options = {}) => {
11652
12686
  };
11653
12687
  };
11654
12688
  // src/deployer.ts
11655
- var DEFAULT_EXCLUDES = ["node_modules", "dist", "build", ".git", ".DS_Store", "*.log"];
12689
+ var DEFAULT_EXCLUDES = [
12690
+ "node_modules",
12691
+ "dist",
12692
+ "build",
12693
+ ".git",
12694
+ ".DS_Store",
12695
+ "*.log"
12696
+ ];
11656
12697
  var noopHooks = {
11657
12698
  onError: () => {},
11658
12699
  onLog: () => {},
@@ -11680,7 +12721,9 @@ var defaultBunPipeline = () => [
11680
12721
  {
11681
12722
  name: "prepare",
11682
12723
  run: async (ctx) => {
11683
- const result = await ctx.target.exec(`mkdir -p ${ctx.releasePath}`, { onLog: (line, stream) => ctx.hooks.onLog(line, stream, "prepare") });
12724
+ const result = await ctx.target.exec(`mkdir -p ${ctx.releasePath}`, {
12725
+ onLog: (line, stream) => ctx.hooks.onLog(line, stream, "prepare")
12726
+ });
11684
12727
  requireSuccess("prepare: mkdir", result);
11685
12728
  }
11686
12729
  },
@@ -11727,7 +12770,10 @@ var defaultBunPipeline = () => [
11727
12770
  name: "link",
11728
12771
  run: async (ctx) => {
11729
12772
  const tmpLink = `${ctx.currentPath}.next`;
11730
- const result = await ctx.target.exec(`ln -sfn ${ctx.releasePath} ${tmpLink} && mv -Tf ${tmpLink} ${ctx.currentPath}`, { onLog: (line, stream) => ctx.hooks.onLog(line, stream, "link"), timeoutMs: 1e4 });
12773
+ const result = await ctx.target.exec(`ln -sfn ${ctx.releasePath} ${tmpLink} && mv -Tf ${tmpLink} ${ctx.currentPath}`, {
12774
+ onLog: (line, stream) => ctx.hooks.onLog(line, stream, "link"),
12775
+ timeoutMs: 1e4
12776
+ });
11731
12777
  requireSuccess("link", result);
11732
12778
  }
11733
12779
  },
@@ -11792,9 +12838,12 @@ var createDeployer = (options) => {
11792
12838
  const rootPath = options.rootPath ?? `/srv/${options.appName}`;
11793
12839
  const currentPath = `${rootPath}/current`;
11794
12840
  const releasesPath = `${rootPath}/releases`;
11795
- const env = { NODE_ENV: "production", ...options.env };
12841
+ const env = {
12842
+ NODE_ENV: "production",
12843
+ ...options.env
12844
+ };
11796
12845
  const processManager = options.processManager ?? bareManager();
11797
- const verify = options.verify === undefined ? null : options.verify;
12846
+ const verify2 = options.verify === undefined ? null : options.verify;
11798
12847
  let disposed = false;
11799
12848
  const buildCtx = (releaseId, opts) => ({
11800
12849
  annotations: opts.annotations,
@@ -11809,13 +12858,13 @@ var createDeployer = (options) => {
11809
12858
  releasePath: `${releasesPath}/${releaseId}`,
11810
12859
  source: options.source,
11811
12860
  target: options.target,
11812
- verify
12861
+ verify: verify2
11813
12862
  });
11814
12863
  const metaPath = (releaseId) => `${releasesPath}/${releaseId}/.deploy-meta.json`;
11815
12864
  const writeMeta = async (releaseId, record) => {
11816
- const json = JSON.stringify(record);
12865
+ const json2 = JSON.stringify(record);
11817
12866
  const result = await options.target.exec(`cat > ${metaPath(releaseId)}`, {
11818
- stdin: json,
12867
+ stdin: json2,
11819
12868
  timeoutMs: 1e4
11820
12869
  });
11821
12870
  if (result.exitCode !== 0) {
@@ -11826,17 +12875,19 @@ var createDeployer = (options) => {
11826
12875
  const result = await options.target.exec(`cat ${metaPath(releaseId)} 2>/dev/null || true`, {
11827
12876
  timeoutMs: 1e4
11828
12877
  });
11829
- const text = result.stdout.trim();
11830
- if (text.length === 0)
12878
+ const text2 = result.stdout.trim();
12879
+ if (text2.length === 0)
11831
12880
  return null;
11832
12881
  try {
11833
- return JSON.parse(text);
12882
+ return JSON.parse(text2);
11834
12883
  } catch {
11835
12884
  return null;
11836
12885
  }
11837
12886
  };
11838
12887
  const cleanOrphanedSymlink = async () => {
11839
- await options.target.exec(`rm -f ${currentPath}.next`, { timeoutMs: 5000 });
12888
+ await options.target.exec(`rm -f ${currentPath}.next`, {
12889
+ timeoutMs: 5000
12890
+ });
11840
12891
  };
11841
12892
  const runSteps = async (steps, releaseId, runOpts) => {
11842
12893
  const ctx = buildCtx(releaseId, {
@@ -11902,7 +12953,9 @@ var createDeployer = (options) => {
11902
12953
  };
11903
12954
  };
11904
12955
  const ensureRoot = async () => {
11905
- const result = await options.target.exec(`mkdir -p ${releasesPath}`, { timeoutMs: 1e4 });
12956
+ const result = await options.target.exec(`mkdir -p ${releasesPath}`, {
12957
+ timeoutMs: 1e4
12958
+ });
11906
12959
  requireSuccess("ensureRoot", result);
11907
12960
  };
11908
12961
  const activeProcessContext = () => ({
@@ -11966,7 +13019,9 @@ var createDeployer = (options) => {
11966
13019
  return { removed: [] };
11967
13020
  const removed = all.slice(0, all.length - keep);
11968
13021
  for (const releaseId of removed) {
11969
- await options.target.exec(`rm -rf ${releasesPath}/${releaseId}`, { timeoutMs: 60000 });
13022
+ await options.target.exec(`rm -rf ${releasesPath}/${releaseId}`, {
13023
+ timeoutMs: 60000
13024
+ });
11970
13025
  }
11971
13026
  return { removed };
11972
13027
  },
@@ -12006,26 +13061,34 @@ var createDeployer = (options) => {
12006
13061
  };
12007
13062
  };
12008
13063
  export {
12009
- validateEdgeIngressSpec,
12010
- systemdManager,
12011
- sshTarget,
12012
- receiveReleaseArtifact,
12013
- normalizedEdgeIngressBackends,
12014
- localTarget,
12015
- extractReleaseArtifact,
12016
- defaultBunPipeline,
12017
- createReleaseArtifact,
12018
- createNativeReleaseRegistry,
12019
- createGooglePlayReleasePublisher,
12020
- createGooglePlayClient,
12021
- createDeployer,
12022
- bareManager,
12023
- ReleaseArtifactError,
12024
- NativeReleaseRegistryError,
12025
- NATIVE_RELEASE_REGISTRY_FORMAT,
13064
+ AppStoreConnectReleaseError,
13065
+ EdgeIngressValidationError,
12026
13066
  GooglePlayReleaseError,
12027
- EdgeIngressValidationError
13067
+ MOBILE_UPDATE_REGISTRY_FORMAT,
13068
+ MobileUpdateRegistryError,
13069
+ NATIVE_RELEASE_REGISTRY_FORMAT,
13070
+ NativeReleaseRegistryError,
13071
+ ReleaseArtifactError,
13072
+ bareManager,
13073
+ createAppStoreConnectClient,
13074
+ createAppStoreConnectReleasePublisher,
13075
+ createDeployer,
13076
+ createGooglePlayClient,
13077
+ createGooglePlayReleasePublisher,
13078
+ createMobileUpdateHandler,
13079
+ createMobileUpdateRegistry,
13080
+ createNativeReleaseRegistry,
13081
+ createReleaseArtifact,
13082
+ defaultBunPipeline,
13083
+ extractReleaseArtifact,
13084
+ localTarget,
13085
+ normalizedEdgeIngressBackends,
13086
+ parseMobileUpdateManifest,
13087
+ receiveReleaseArtifact,
13088
+ sshTarget,
13089
+ systemdManager,
13090
+ validateEdgeIngressSpec
12028
13091
  };
12029
13092
 
12030
- //# debugId=264DE11EAA0F4C5664756E2164756E21
13093
+ //# debugId=BCD2874CEF74144564756E2164756E21
12031
13094
  //# sourceMappingURL=index.js.map