@cloudsnorkel/cdk-github-runners 0.10.4 → 0.10.6

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 (60) hide show
  1. package/.gitattributes +1 -1
  2. package/.jsii +164 -125
  3. package/API.md +42 -7
  4. package/README.md +1 -1
  5. package/SETUP_GITHUB.md +16 -12
  6. package/TESTING.md +61 -0
  7. package/assets/{delete-runner.lambda → delete-failed-runner.lambda}/index.js +3972 -1334
  8. package/assets/idle-runner-repear.lambda/index.js +3994 -1339
  9. package/assets/image-builders/aws-image-builder/versioner.lambda/index.js +45 -1
  10. package/assets/setup.lambda/index.html +13 -13
  11. package/assets/setup.lambda/index.js +2057 -724
  12. package/assets/status.lambda/index.js +2236 -788
  13. package/assets/token-retriever.lambda/index.js +3962 -1333
  14. package/lib/access.d.ts +4 -2
  15. package/lib/access.js +7 -5
  16. package/lib/delete-failed-runner-function.d.ts +13 -0
  17. package/lib/delete-failed-runner-function.js +23 -0
  18. package/lib/delete-failed-runner.lambda.js +51 -0
  19. package/lib/idle-runner-repear.lambda.js +43 -10
  20. package/lib/image-builders/api.js +1 -1
  21. package/lib/image-builders/aws-image-builder/ami.d.ts +1 -1
  22. package/lib/image-builders/aws-image-builder/ami.js +9 -9
  23. package/lib/image-builders/aws-image-builder/builder.js +1 -1
  24. package/lib/image-builders/aws-image-builder/deprecated/ami.d.ts +1 -1
  25. package/lib/image-builders/aws-image-builder/deprecated/ami.js +9 -9
  26. package/lib/image-builders/aws-image-builder/deprecated/common.d.ts +1 -1
  27. package/lib/image-builders/aws-image-builder/deprecated/common.js +10 -10
  28. package/lib/image-builders/aws-image-builder/deprecated/container.js +1 -1
  29. package/lib/image-builders/aws-image-builder/deprecated/linux-components.js +1 -1
  30. package/lib/image-builders/aws-image-builder/deprecated/windows-components.js +1 -1
  31. package/lib/image-builders/codebuild-deprecated.js +1 -1
  32. package/lib/image-builders/components.js +1 -1
  33. package/lib/image-builders/static.js +1 -1
  34. package/lib/lambda-github.d.ts +8 -4
  35. package/lib/lambda-github.js +23 -2
  36. package/lib/lambda-helpers.d.ts +5 -1
  37. package/lib/lambda-helpers.js +1 -1
  38. package/lib/providers/codebuild.js +7 -5
  39. package/lib/providers/common.d.ts +4 -1
  40. package/lib/providers/common.js +5 -6
  41. package/lib/providers/ec2.d.ts +1 -0
  42. package/lib/providers/ec2.js +16 -11
  43. package/lib/providers/ecs.js +12 -5
  44. package/lib/providers/fargate.js +6 -3
  45. package/lib/providers/lambda.js +2 -2
  46. package/lib/runner.d.ts +1 -1
  47. package/lib/runner.js +26 -25
  48. package/lib/secrets.d.ts +2 -2
  49. package/lib/secrets.js +2 -2
  50. package/lib/setup.lambda.js +2 -2
  51. package/lib/status.lambda.js +4 -4
  52. package/lib/token-retriever.lambda.js +2 -2
  53. package/lib/utils.d.ts +19 -1
  54. package/lib/utils.js +48 -2
  55. package/lib/webhook.js +2 -2
  56. package/package.json +16 -15
  57. package/lib/delete-runner-function.d.ts +0 -13
  58. package/lib/delete-runner-function.js +0 -23
  59. package/lib/delete-runner.lambda.js +0 -41
  60. /package/lib/{delete-runner.lambda.d.ts → delete-failed-runner.lambda.d.ts} +0 -0
@@ -24,6 +24,24 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
24
24
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
25
  mod
26
26
  ));
27
+ var __accessCheck = (obj, member, msg) => {
28
+ if (!member.has(obj))
29
+ throw TypeError("Cannot " + msg);
30
+ };
31
+ var __privateGet = (obj, member, getter) => {
32
+ __accessCheck(obj, member, "read from private field");
33
+ return getter ? getter.call(obj) : member.get(obj);
34
+ };
35
+ var __privateAdd = (obj, member, value) => {
36
+ if (member.has(obj))
37
+ throw TypeError("Cannot add the same private member more than once");
38
+ member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
39
+ };
40
+ var __privateSet = (obj, member, value, setter) => {
41
+ __accessCheck(obj, member, "write to private field");
42
+ setter ? setter.call(obj, value) : member.set(obj, value);
43
+ return value;
44
+ };
27
45
 
28
46
  // node_modules/universal-user-agent/dist-node/index.js
29
47
  var require_dist_node = __commonJS({
@@ -72,11 +90,30 @@ var require_is_plain_object = __commonJS({
72
90
 
73
91
  // node_modules/@octokit/endpoint/dist-node/index.js
74
92
  var require_dist_node2 = __commonJS({
75
- "node_modules/@octokit/endpoint/dist-node/index.js"(exports2) {
93
+ "node_modules/@octokit/endpoint/dist-node/index.js"(exports2, module2) {
76
94
  "use strict";
77
- Object.defineProperty(exports2, "__esModule", { value: true });
78
- var isPlainObject = require_is_plain_object();
79
- var universalUserAgent = require_dist_node();
95
+ var __defProp2 = Object.defineProperty;
96
+ var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
97
+ var __getOwnPropNames2 = Object.getOwnPropertyNames;
98
+ var __hasOwnProp2 = Object.prototype.hasOwnProperty;
99
+ var __export = (target, all) => {
100
+ for (var name in all)
101
+ __defProp2(target, name, { get: all[name], enumerable: true });
102
+ };
103
+ var __copyProps2 = (to, from, except, desc) => {
104
+ if (from && typeof from === "object" || typeof from === "function") {
105
+ for (let key of __getOwnPropNames2(from))
106
+ if (!__hasOwnProp2.call(to, key) && key !== except)
107
+ __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
108
+ }
109
+ return to;
110
+ };
111
+ var __toCommonJS = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
112
+ var dist_src_exports = {};
113
+ __export(dist_src_exports, {
114
+ endpoint: () => endpoint
115
+ });
116
+ module2.exports = __toCommonJS(dist_src_exports);
80
117
  function lowercaseKeys(object) {
81
118
  if (!object) {
82
119
  return {};
@@ -86,20 +123,17 @@ var require_dist_node2 = __commonJS({
86
123
  return newObj;
87
124
  }, {});
88
125
  }
126
+ var import_is_plain_object = require_is_plain_object();
89
127
  function mergeDeep(defaults, options) {
90
128
  const result = Object.assign({}, defaults);
91
129
  Object.keys(options).forEach((key) => {
92
- if (isPlainObject.isPlainObject(options[key])) {
130
+ if ((0, import_is_plain_object.isPlainObject)(options[key])) {
93
131
  if (!(key in defaults))
94
- Object.assign(result, {
95
- [key]: options[key]
96
- });
132
+ Object.assign(result, { [key]: options[key] });
97
133
  else
98
134
  result[key] = mergeDeep(defaults[key], options[key]);
99
135
  } else {
100
- Object.assign(result, {
101
- [key]: options[key]
102
- });
136
+ Object.assign(result, { [key]: options[key] });
103
137
  }
104
138
  });
105
139
  return result;
@@ -115,12 +149,7 @@ var require_dist_node2 = __commonJS({
115
149
  function merge(defaults, route, options) {
116
150
  if (typeof route === "string") {
117
151
  let [method, url] = route.split(" ");
118
- options = Object.assign(url ? {
119
- method,
120
- url
121
- } : {
122
- url: method
123
- }, options);
152
+ options = Object.assign(url ? { method, url } : { url: method }, options);
124
153
  } else {
125
154
  options = Object.assign({}, route);
126
155
  }
@@ -131,7 +160,9 @@ var require_dist_node2 = __commonJS({
131
160
  if (defaults && defaults.mediaType.previews.length) {
132
161
  mergedOptions.mediaType.previews = defaults.mediaType.previews.filter((preview) => !mergedOptions.mediaType.previews.includes(preview)).concat(mergedOptions.mediaType.previews);
133
162
  }
134
- mergedOptions.mediaType.previews = mergedOptions.mediaType.previews.map((preview) => preview.replace(/-preview/, ""));
163
+ mergedOptions.mediaType.previews = mergedOptions.mediaType.previews.map(
164
+ (preview) => preview.replace(/-preview/, "")
165
+ );
135
166
  return mergedOptions;
136
167
  }
137
168
  function addQueryParameters(url, parameters) {
@@ -199,12 +230,16 @@ var require_dist_node2 = __commonJS({
199
230
  if (modifier && modifier !== "*") {
200
231
  value = value.substring(0, parseInt(modifier, 10));
201
232
  }
202
- result.push(encodeValue(operator, value, isKeyOperator(operator) ? key : ""));
233
+ result.push(
234
+ encodeValue(operator, value, isKeyOperator(operator) ? key : "")
235
+ );
203
236
  } else {
204
237
  if (modifier === "*") {
205
238
  if (Array.isArray(value)) {
206
239
  value.filter(isDefined).forEach(function(value2) {
207
- result.push(encodeValue(operator, value2, isKeyOperator(operator) ? key : ""));
240
+ result.push(
241
+ encodeValue(operator, value2, isKeyOperator(operator) ? key : "")
242
+ );
208
243
  });
209
244
  } else {
210
245
  Object.keys(value).forEach(function(k) {
@@ -254,40 +289,50 @@ var require_dist_node2 = __commonJS({
254
289
  }
255
290
  function expand(template, context) {
256
291
  var operators = ["+", "#", ".", "/", ";", "?", "&"];
257
- return template.replace(/\{([^\{\}]+)\}|([^\{\}]+)/g, function(_, expression, literal) {
258
- if (expression) {
259
- let operator = "";
260
- const values = [];
261
- if (operators.indexOf(expression.charAt(0)) !== -1) {
262
- operator = expression.charAt(0);
263
- expression = expression.substr(1);
264
- }
265
- expression.split(/,/g).forEach(function(variable) {
266
- var tmp = /([^:\*]*)(?::(\d+)|(\*))?/.exec(variable);
267
- values.push(getValues(context, operator, tmp[1], tmp[2] || tmp[3]));
268
- });
269
- if (operator && operator !== "+") {
270
- var separator = ",";
271
- if (operator === "?") {
272
- separator = "&";
273
- } else if (operator !== "#") {
274
- separator = operator;
292
+ return template.replace(
293
+ /\{([^\{\}]+)\}|([^\{\}]+)/g,
294
+ function(_, expression, literal) {
295
+ if (expression) {
296
+ let operator = "";
297
+ const values = [];
298
+ if (operators.indexOf(expression.charAt(0)) !== -1) {
299
+ operator = expression.charAt(0);
300
+ expression = expression.substr(1);
301
+ }
302
+ expression.split(/,/g).forEach(function(variable) {
303
+ var tmp = /([^:\*]*)(?::(\d+)|(\*))?/.exec(variable);
304
+ values.push(getValues(context, operator, tmp[1], tmp[2] || tmp[3]));
305
+ });
306
+ if (operator && operator !== "+") {
307
+ var separator = ",";
308
+ if (operator === "?") {
309
+ separator = "&";
310
+ } else if (operator !== "#") {
311
+ separator = operator;
312
+ }
313
+ return (values.length !== 0 ? operator : "") + values.join(separator);
314
+ } else {
315
+ return values.join(",");
275
316
  }
276
- return (values.length !== 0 ? operator : "") + values.join(separator);
277
317
  } else {
278
- return values.join(",");
318
+ return encodeReserved(literal);
279
319
  }
280
- } else {
281
- return encodeReserved(literal);
282
320
  }
283
- });
321
+ );
284
322
  }
285
323
  function parse(options) {
286
324
  let method = options.method.toUpperCase();
287
325
  let url = (options.url || "/").replace(/:([a-z]\w+)/g, "{$1}");
288
326
  let headers = Object.assign({}, options.headers);
289
327
  let body;
290
- let parameters = omit(options, ["method", "baseUrl", "url", "headers", "request", "mediaType"]);
328
+ let parameters = omit(options, [
329
+ "method",
330
+ "baseUrl",
331
+ "url",
332
+ "headers",
333
+ "request",
334
+ "mediaType"
335
+ ]);
291
336
  const urlVariableNames = extractUrlVariableNames(url);
292
337
  url = parseUrl(url).expand(parameters);
293
338
  if (!/^http/.test(url)) {
@@ -298,7 +343,12 @@ var require_dist_node2 = __commonJS({
298
343
  const isBinaryRequest = /application\/octet-stream/i.test(headers.accept);
299
344
  if (!isBinaryRequest) {
300
345
  if (options.mediaType.format) {
301
- headers.accept = headers.accept.split(/,/).map((preview) => preview.replace(/application\/vnd(\.\w+)(\.v3)?(\.\w+)?(\+json)?$/, `application/vnd$1$2.${options.mediaType.format}`)).join(",");
346
+ headers.accept = headers.accept.split(/,/).map(
347
+ (preview) => preview.replace(
348
+ /application\/vnd(\.\w+)(\.v3)?(\.\w+)?(\+json)?$/,
349
+ `application/vnd$1$2.${options.mediaType.format}`
350
+ )
351
+ ).join(",");
302
352
  }
303
353
  if (options.mediaType.previews.length) {
304
354
  const previewsFromAcceptHeader = headers.accept.match(/[\w-]+(?=-preview)/g) || [];
@@ -325,15 +375,11 @@ var require_dist_node2 = __commonJS({
325
375
  if (["PATCH", "PUT"].includes(method) && typeof body === "undefined") {
326
376
  body = "";
327
377
  }
328
- return Object.assign({
329
- method,
330
- url,
331
- headers
332
- }, typeof body !== "undefined" ? {
333
- body
334
- } : null, options.request ? {
335
- request: options.request
336
- } : null);
378
+ return Object.assign(
379
+ { method, url, headers },
380
+ typeof body !== "undefined" ? { body } : null,
381
+ options.request ? { request: options.request } : null
382
+ );
337
383
  }
338
384
  function endpointWithDefaults(defaults, route, options) {
339
385
  return parse(merge(defaults, route, options));
@@ -348,8 +394,9 @@ var require_dist_node2 = __commonJS({
348
394
  parse
349
395
  });
350
396
  }
351
- var VERSION = "7.0.5";
352
- var userAgent = `octokit-endpoint.js/${VERSION} ${universalUserAgent.getUserAgent()}`;
397
+ var import_universal_user_agent = require_dist_node();
398
+ var VERSION = "7.0.6";
399
+ var userAgent = `octokit-endpoint.js/${VERSION} ${(0, import_universal_user_agent.getUserAgent)()}`;
353
400
  var DEFAULTS = {
354
401
  method: "GET",
355
402
  baseUrl: "https://api.github.com",
@@ -363,7 +410,6 @@ var require_dist_node2 = __commonJS({
363
410
  }
364
411
  };
365
412
  var endpoint = withDefaults(null, DEFAULTS);
366
- exports2.endpoint = endpoint;
367
413
  }
368
414
  });
369
415
 
@@ -7120,6 +7166,7 @@ var require_dist_node3 = __commonJS({
7120
7166
  // node_modules/wrappy/wrappy.js
7121
7167
  var require_wrappy = __commonJS({
7122
7168
  "node_modules/wrappy/wrappy.js"(exports2, module2) {
7169
+ "use strict";
7123
7170
  module2.exports = wrappy;
7124
7171
  function wrappy(fn, cb) {
7125
7172
  if (fn && cb)
@@ -7151,6 +7198,7 @@ var require_wrappy = __commonJS({
7151
7198
  // node_modules/once/once.js
7152
7199
  var require_once = __commonJS({
7153
7200
  "node_modules/once/once.js"(exports2, module2) {
7201
+ "use strict";
7154
7202
  var wrappy = require_wrappy();
7155
7203
  module2.exports = wrappy(once);
7156
7204
  module2.exports.strict = wrappy(onceStrict);
@@ -7249,42 +7297,76 @@ var require_dist_node4 = __commonJS({
7249
7297
 
7250
7298
  // node_modules/@octokit/request/dist-node/index.js
7251
7299
  var require_dist_node5 = __commonJS({
7252
- "node_modules/@octokit/request/dist-node/index.js"(exports2) {
7300
+ "node_modules/@octokit/request/dist-node/index.js"(exports2, module2) {
7253
7301
  "use strict";
7254
- Object.defineProperty(exports2, "__esModule", { value: true });
7255
- function _interopDefault(ex) {
7256
- return ex && typeof ex === "object" && "default" in ex ? ex["default"] : ex;
7257
- }
7258
- var endpoint = require_dist_node2();
7259
- var universalUserAgent = require_dist_node();
7260
- var isPlainObject = require_is_plain_object();
7261
- var nodeFetch = _interopDefault(require_lib3());
7262
- var requestError = require_dist_node4();
7263
- var VERSION = "6.2.3";
7302
+ var __create2 = Object.create;
7303
+ var __defProp2 = Object.defineProperty;
7304
+ var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
7305
+ var __getOwnPropNames2 = Object.getOwnPropertyNames;
7306
+ var __getProtoOf2 = Object.getPrototypeOf;
7307
+ var __hasOwnProp2 = Object.prototype.hasOwnProperty;
7308
+ var __export = (target, all) => {
7309
+ for (var name in all)
7310
+ __defProp2(target, name, { get: all[name], enumerable: true });
7311
+ };
7312
+ var __copyProps2 = (to, from, except, desc) => {
7313
+ if (from && typeof from === "object" || typeof from === "function") {
7314
+ for (let key of __getOwnPropNames2(from))
7315
+ if (!__hasOwnProp2.call(to, key) && key !== except)
7316
+ __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
7317
+ }
7318
+ return to;
7319
+ };
7320
+ var __toESM2 = (mod, isNodeMode, target) => (target = mod != null ? __create2(__getProtoOf2(mod)) : {}, __copyProps2(
7321
+ // If the importer is in node compatibility mode or this is not an ESM
7322
+ // file that has been converted to a CommonJS file using a Babel-
7323
+ // compatible transform (i.e. "__esModule" has not been set), then set
7324
+ // "default" to the CommonJS "module.exports" for node compatibility.
7325
+ isNodeMode || !mod || !mod.__esModule ? __defProp2(target, "default", { value: mod, enumerable: true }) : target,
7326
+ mod
7327
+ ));
7328
+ var __toCommonJS = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
7329
+ var dist_src_exports = {};
7330
+ __export(dist_src_exports, {
7331
+ request: () => request
7332
+ });
7333
+ module2.exports = __toCommonJS(dist_src_exports);
7334
+ var import_endpoint = require_dist_node2();
7335
+ var import_universal_user_agent = require_dist_node();
7336
+ var VERSION = "6.2.5";
7337
+ var import_is_plain_object = require_is_plain_object();
7338
+ var import_node_fetch = __toESM2(require_lib3());
7339
+ var import_request_error = require_dist_node4();
7264
7340
  function getBufferResponse(response) {
7265
7341
  return response.arrayBuffer();
7266
7342
  }
7267
7343
  function fetchWrapper(requestOptions) {
7268
7344
  const log = requestOptions.request && requestOptions.request.log ? requestOptions.request.log : console;
7269
- if (isPlainObject.isPlainObject(requestOptions.body) || Array.isArray(requestOptions.body)) {
7345
+ if ((0, import_is_plain_object.isPlainObject)(requestOptions.body) || Array.isArray(requestOptions.body)) {
7270
7346
  requestOptions.body = JSON.stringify(requestOptions.body);
7271
7347
  }
7272
7348
  let headers = {};
7273
7349
  let status;
7274
7350
  let url;
7275
7351
  const fetch = requestOptions.request && requestOptions.request.fetch || globalThis.fetch || /* istanbul ignore next */
7276
- nodeFetch;
7277
- return fetch(requestOptions.url, Object.assign(
7278
- {
7279
- method: requestOptions.method,
7280
- body: requestOptions.body,
7281
- headers: requestOptions.headers,
7282
- redirect: requestOptions.redirect
7283
- },
7284
- // `requestOptions.request.agent` type is incompatible
7285
- // see https://github.com/octokit/types.ts/pull/264
7286
- requestOptions.request
7287
- )).then(async (response) => {
7352
+ import_node_fetch.default;
7353
+ return fetch(
7354
+ requestOptions.url,
7355
+ Object.assign(
7356
+ {
7357
+ method: requestOptions.method,
7358
+ body: requestOptions.body,
7359
+ headers: requestOptions.headers,
7360
+ redirect: requestOptions.redirect,
7361
+ // duplex must be set if request.body is ReadableStream or Async Iterables.
7362
+ // See https://fetch.spec.whatwg.org/#dom-requestinit-duplex.
7363
+ ...requestOptions.body && { duplex: "half" }
7364
+ },
7365
+ // `requestOptions.request.agent` type is incompatible
7366
+ // see https://github.com/octokit/types.ts/pull/264
7367
+ requestOptions.request
7368
+ )
7369
+ ).then(async (response) => {
7288
7370
  url = response.url;
7289
7371
  status = response.status;
7290
7372
  for (const keyAndValue of response.headers) {
@@ -7293,7 +7375,9 @@ var require_dist_node5 = __commonJS({
7293
7375
  if ("deprecation" in headers) {
7294
7376
  const matches = headers.link && headers.link.match(/<([^>]+)>; rel="deprecation"/);
7295
7377
  const deprecationLink = matches && matches.pop();
7296
- log.warn(`[@octokit/request] "${requestOptions.method} ${requestOptions.url}" is deprecated. It is scheduled to be removed on ${headers.sunset}${deprecationLink ? `. See ${deprecationLink}` : ""}`);
7378
+ log.warn(
7379
+ `[@octokit/request] "${requestOptions.method} ${requestOptions.url}" is deprecated. It is scheduled to be removed on ${headers.sunset}${deprecationLink ? `. See ${deprecationLink}` : ""}`
7380
+ );
7297
7381
  }
7298
7382
  if (status === 204 || status === 205) {
7299
7383
  return;
@@ -7302,7 +7386,7 @@ var require_dist_node5 = __commonJS({
7302
7386
  if (status < 400) {
7303
7387
  return;
7304
7388
  }
7305
- throw new requestError.RequestError(response.statusText, status, {
7389
+ throw new import_request_error.RequestError(response.statusText, status, {
7306
7390
  response: {
7307
7391
  url,
7308
7392
  status,
@@ -7313,7 +7397,7 @@ var require_dist_node5 = __commonJS({
7313
7397
  });
7314
7398
  }
7315
7399
  if (status === 304) {
7316
- throw new requestError.RequestError("Not modified", status, {
7400
+ throw new import_request_error.RequestError("Not modified", status, {
7317
7401
  response: {
7318
7402
  url,
7319
7403
  status,
@@ -7325,7 +7409,7 @@ var require_dist_node5 = __commonJS({
7325
7409
  }
7326
7410
  if (status >= 400) {
7327
7411
  const data = await getResponseData(response);
7328
- const error = new requestError.RequestError(toErrorMessage(data), status, {
7412
+ const error = new import_request_error.RequestError(toErrorMessage(data), status, {
7329
7413
  response: {
7330
7414
  url,
7331
7415
  status,
@@ -7345,11 +7429,11 @@ var require_dist_node5 = __commonJS({
7345
7429
  data
7346
7430
  };
7347
7431
  }).catch((error) => {
7348
- if (error instanceof requestError.RequestError)
7432
+ if (error instanceof import_request_error.RequestError)
7349
7433
  throw error;
7350
7434
  else if (error.name === "AbortError")
7351
7435
  throw error;
7352
- throw new requestError.RequestError(error.message, 500, {
7436
+ throw new import_request_error.RequestError(error.message, 500, {
7353
7437
  request: requestOptions
7354
7438
  });
7355
7439
  });
@@ -7383,7 +7467,9 @@ var require_dist_node5 = __commonJS({
7383
7467
  return fetchWrapper(endpoint2.parse(endpointOptions));
7384
7468
  }
7385
7469
  const request2 = (route2, parameters2) => {
7386
- return fetchWrapper(endpoint2.parse(endpoint2.merge(route2, parameters2)));
7470
+ return fetchWrapper(
7471
+ endpoint2.parse(endpoint2.merge(route2, parameters2))
7472
+ );
7387
7473
  };
7388
7474
  Object.assign(request2, {
7389
7475
  endpoint: endpoint2,
@@ -7396,18 +7482,18 @@ var require_dist_node5 = __commonJS({
7396
7482
  defaults: withDefaults.bind(null, endpoint2)
7397
7483
  });
7398
7484
  }
7399
- var request = withDefaults(endpoint.endpoint, {
7485
+ var request = withDefaults(import_endpoint.endpoint, {
7400
7486
  headers: {
7401
- "user-agent": `octokit-request.js/${VERSION} ${universalUserAgent.getUserAgent()}`
7487
+ "user-agent": `octokit-request.js/${VERSION} ${(0, import_universal_user_agent.getUserAgent)()}`
7402
7488
  }
7403
7489
  });
7404
- exports2.request = request;
7405
7490
  }
7406
7491
  });
7407
7492
 
7408
7493
  // node_modules/btoa-lite/btoa-node.js
7409
7494
  var require_btoa_node = __commonJS({
7410
7495
  "node_modules/btoa-lite/btoa-node.js"(exports2, module2) {
7496
+ "use strict";
7411
7497
  module2.exports = function btoa(str) {
7412
7498
  return new Buffer(str).toString("base64");
7413
7499
  };
@@ -7466,59 +7552,108 @@ var require_dist_node6 = __commonJS({
7466
7552
 
7467
7553
  // node_modules/@octokit/oauth-methods/dist-node/index.js
7468
7554
  var require_dist_node7 = __commonJS({
7469
- "node_modules/@octokit/oauth-methods/dist-node/index.js"(exports2) {
7555
+ "node_modules/@octokit/oauth-methods/dist-node/index.js"(exports2, module2) {
7470
7556
  "use strict";
7471
- Object.defineProperty(exports2, "__esModule", { value: true });
7472
- function _interopDefault(ex) {
7473
- return ex && typeof ex === "object" && "default" in ex ? ex["default"] : ex;
7474
- }
7475
- var oauthAuthorizationUrl = require_dist_node6();
7476
- var request = require_dist_node5();
7477
- var requestError = require_dist_node4();
7478
- var btoa = _interopDefault(require_btoa_node());
7479
- var VERSION = "2.0.5";
7480
- function requestToOAuthBaseUrl(request2) {
7481
- const endpointDefaults = request2.endpoint.DEFAULTS;
7557
+ var __create2 = Object.create;
7558
+ var __defProp2 = Object.defineProperty;
7559
+ var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
7560
+ var __getOwnPropNames2 = Object.getOwnPropertyNames;
7561
+ var __getProtoOf2 = Object.getPrototypeOf;
7562
+ var __hasOwnProp2 = Object.prototype.hasOwnProperty;
7563
+ var __export = (target, all) => {
7564
+ for (var name in all)
7565
+ __defProp2(target, name, { get: all[name], enumerable: true });
7566
+ };
7567
+ var __copyProps2 = (to, from, except, desc) => {
7568
+ if (from && typeof from === "object" || typeof from === "function") {
7569
+ for (let key of __getOwnPropNames2(from))
7570
+ if (!__hasOwnProp2.call(to, key) && key !== except)
7571
+ __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
7572
+ }
7573
+ return to;
7574
+ };
7575
+ var __toESM2 = (mod, isNodeMode, target) => (target = mod != null ? __create2(__getProtoOf2(mod)) : {}, __copyProps2(
7576
+ // If the importer is in node compatibility mode or this is not an ESM
7577
+ // file that has been converted to a CommonJS file using a Babel-
7578
+ // compatible transform (i.e. "__esModule" has not been set), then set
7579
+ // "default" to the CommonJS "module.exports" for node compatibility.
7580
+ isNodeMode || !mod || !mod.__esModule ? __defProp2(target, "default", { value: mod, enumerable: true }) : target,
7581
+ mod
7582
+ ));
7583
+ var __toCommonJS = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
7584
+ var dist_src_exports = {};
7585
+ __export(dist_src_exports, {
7586
+ VERSION: () => VERSION,
7587
+ checkToken: () => checkToken,
7588
+ createDeviceCode: () => createDeviceCode,
7589
+ deleteAuthorization: () => deleteAuthorization,
7590
+ deleteToken: () => deleteToken,
7591
+ exchangeDeviceCode: () => exchangeDeviceCode,
7592
+ exchangeWebFlowCode: () => exchangeWebFlowCode,
7593
+ getWebFlowAuthorizationUrl: () => getWebFlowAuthorizationUrl,
7594
+ refreshToken: () => refreshToken,
7595
+ resetToken: () => resetToken,
7596
+ scopeToken: () => scopeToken
7597
+ });
7598
+ module2.exports = __toCommonJS(dist_src_exports);
7599
+ var VERSION = "2.0.6";
7600
+ var import_oauth_authorization_url = require_dist_node6();
7601
+ var import_request = require_dist_node5();
7602
+ var import_request_error = require_dist_node4();
7603
+ function requestToOAuthBaseUrl(request) {
7604
+ const endpointDefaults = request.endpoint.DEFAULTS;
7482
7605
  return /^https:\/\/(api\.)?github\.com$/.test(endpointDefaults.baseUrl) ? "https://github.com" : endpointDefaults.baseUrl.replace("/api/v3", "");
7483
7606
  }
7484
- async function oauthRequest(request2, route, parameters) {
7607
+ async function oauthRequest(request, route, parameters) {
7485
7608
  const withOAuthParameters = {
7486
- baseUrl: requestToOAuthBaseUrl(request2),
7609
+ baseUrl: requestToOAuthBaseUrl(request),
7487
7610
  headers: {
7488
7611
  accept: "application/json"
7489
7612
  },
7490
7613
  ...parameters
7491
7614
  };
7492
- const response = await request2(route, withOAuthParameters);
7615
+ const response = await request(route, withOAuthParameters);
7493
7616
  if ("error" in response.data) {
7494
- const error = new requestError.RequestError(`${response.data.error_description} (${response.data.error}, ${response.data.error_uri})`, 400, {
7495
- request: request2.endpoint.merge(route, withOAuthParameters),
7496
- headers: response.headers
7497
- });
7617
+ const error = new import_request_error.RequestError(
7618
+ `${response.data.error_description} (${response.data.error}, ${response.data.error_uri})`,
7619
+ 400,
7620
+ {
7621
+ request: request.endpoint.merge(
7622
+ route,
7623
+ withOAuthParameters
7624
+ ),
7625
+ headers: response.headers
7626
+ }
7627
+ );
7498
7628
  error.response = response;
7499
7629
  throw error;
7500
7630
  }
7501
7631
  return response;
7502
7632
  }
7503
7633
  function getWebFlowAuthorizationUrl({
7504
- request: request$1 = request.request,
7634
+ request = import_request.request,
7505
7635
  ...options
7506
7636
  }) {
7507
- const baseUrl = requestToOAuthBaseUrl(request$1);
7508
- return oauthAuthorizationUrl.oauthAuthorizationUrl({
7637
+ const baseUrl = requestToOAuthBaseUrl(request);
7638
+ return (0, import_oauth_authorization_url.oauthAuthorizationUrl)({
7509
7639
  ...options,
7510
7640
  baseUrl
7511
7641
  });
7512
7642
  }
7643
+ var import_request2 = require_dist_node5();
7513
7644
  async function exchangeWebFlowCode(options) {
7514
- const request$1 = options.request || /* istanbul ignore next: we always pass a custom request in tests */
7515
- request.request;
7516
- const response = await oauthRequest(request$1, "POST /login/oauth/access_token", {
7517
- client_id: options.clientId,
7518
- client_secret: options.clientSecret,
7519
- code: options.code,
7520
- redirect_uri: options.redirectUrl
7521
- });
7645
+ const request = options.request || /* istanbul ignore next: we always pass a custom request in tests */
7646
+ import_request2.request;
7647
+ const response = await oauthRequest(
7648
+ request,
7649
+ "POST /login/oauth/access_token",
7650
+ {
7651
+ client_id: options.clientId,
7652
+ client_secret: options.clientSecret,
7653
+ code: options.code,
7654
+ redirect_uri: options.redirectUrl
7655
+ }
7656
+ );
7522
7657
  const authentication = {
7523
7658
  clientType: options.clientType,
7524
7659
  clientId: options.clientId,
@@ -7529,37 +7664,46 @@ var require_dist_node7 = __commonJS({
7529
7664
  if (options.clientType === "github-app") {
7530
7665
  if ("refresh_token" in response.data) {
7531
7666
  const apiTimeInMs = new Date(response.headers.date).getTime();
7532
- authentication.refreshToken = response.data.refresh_token, authentication.expiresAt = toTimestamp(apiTimeInMs, response.data.expires_in), authentication.refreshTokenExpiresAt = toTimestamp(apiTimeInMs, response.data.refresh_token_expires_in);
7667
+ authentication.refreshToken = response.data.refresh_token, authentication.expiresAt = toTimestamp(
7668
+ apiTimeInMs,
7669
+ response.data.expires_in
7670
+ ), authentication.refreshTokenExpiresAt = toTimestamp(
7671
+ apiTimeInMs,
7672
+ response.data.refresh_token_expires_in
7673
+ );
7533
7674
  }
7534
7675
  delete authentication.scopes;
7535
7676
  }
7536
- return {
7537
- ...response,
7538
- authentication
7539
- };
7677
+ return { ...response, authentication };
7540
7678
  }
7541
7679
  function toTimestamp(apiTimeInMs, expirationInSeconds) {
7542
7680
  return new Date(apiTimeInMs + expirationInSeconds * 1e3).toISOString();
7543
7681
  }
7682
+ var import_request3 = require_dist_node5();
7544
7683
  async function createDeviceCode(options) {
7545
- const request$1 = options.request || /* istanbul ignore next: we always pass a custom request in tests */
7546
- request.request;
7684
+ const request = options.request || /* istanbul ignore next: we always pass a custom request in tests */
7685
+ import_request3.request;
7547
7686
  const parameters = {
7548
7687
  client_id: options.clientId
7549
7688
  };
7550
7689
  if ("scopes" in options && Array.isArray(options.scopes)) {
7551
7690
  parameters.scope = options.scopes.join(" ");
7552
7691
  }
7553
- return oauthRequest(request$1, "POST /login/device/code", parameters);
7692
+ return oauthRequest(request, "POST /login/device/code", parameters);
7554
7693
  }
7694
+ var import_request4 = require_dist_node5();
7555
7695
  async function exchangeDeviceCode(options) {
7556
- const request$1 = options.request || /* istanbul ignore next: we always pass a custom request in tests */
7557
- request.request;
7558
- const response = await oauthRequest(request$1, "POST /login/oauth/access_token", {
7559
- client_id: options.clientId,
7560
- device_code: options.code,
7561
- grant_type: "urn:ietf:params:oauth:grant-type:device_code"
7562
- });
7696
+ const request = options.request || /* istanbul ignore next: we always pass a custom request in tests */
7697
+ import_request4.request;
7698
+ const response = await oauthRequest(
7699
+ request,
7700
+ "POST /login/oauth/access_token",
7701
+ {
7702
+ client_id: options.clientId,
7703
+ device_code: options.code,
7704
+ grant_type: "urn:ietf:params:oauth:grant-type:device_code"
7705
+ }
7706
+ );
7563
7707
  const authentication = {
7564
7708
  clientType: options.clientType,
7565
7709
  clientId: options.clientId,
@@ -7572,24 +7716,31 @@ var require_dist_node7 = __commonJS({
7572
7716
  if (options.clientType === "github-app") {
7573
7717
  if ("refresh_token" in response.data) {
7574
7718
  const apiTimeInMs = new Date(response.headers.date).getTime();
7575
- authentication.refreshToken = response.data.refresh_token, authentication.expiresAt = toTimestamp$1(apiTimeInMs, response.data.expires_in), authentication.refreshTokenExpiresAt = toTimestamp$1(apiTimeInMs, response.data.refresh_token_expires_in);
7719
+ authentication.refreshToken = response.data.refresh_token, authentication.expiresAt = toTimestamp2(
7720
+ apiTimeInMs,
7721
+ response.data.expires_in
7722
+ ), authentication.refreshTokenExpiresAt = toTimestamp2(
7723
+ apiTimeInMs,
7724
+ response.data.refresh_token_expires_in
7725
+ );
7576
7726
  }
7577
7727
  delete authentication.scopes;
7578
7728
  }
7579
- return {
7580
- ...response,
7581
- authentication
7582
- };
7729
+ return { ...response, authentication };
7583
7730
  }
7584
- function toTimestamp$1(apiTimeInMs, expirationInSeconds) {
7731
+ function toTimestamp2(apiTimeInMs, expirationInSeconds) {
7585
7732
  return new Date(apiTimeInMs + expirationInSeconds * 1e3).toISOString();
7586
7733
  }
7734
+ var import_request5 = require_dist_node5();
7735
+ var import_btoa_lite = __toESM2(require_btoa_node());
7587
7736
  async function checkToken(options) {
7588
- const request$1 = options.request || /* istanbul ignore next: we always pass a custom request in tests */
7589
- request.request;
7590
- const response = await request$1("POST /applications/{client_id}/token", {
7737
+ const request = options.request || /* istanbul ignore next: we always pass a custom request in tests */
7738
+ import_request5.request;
7739
+ const response = await request("POST /applications/{client_id}/token", {
7591
7740
  headers: {
7592
- authorization: `basic ${btoa(`${options.clientId}:${options.clientSecret}`)}`
7741
+ authorization: `basic ${(0, import_btoa_lite.default)(
7742
+ `${options.clientId}:${options.clientSecret}`
7743
+ )}`
7593
7744
  },
7594
7745
  client_id: options.clientId,
7595
7746
  access_token: options.token
@@ -7606,20 +7757,22 @@ var require_dist_node7 = __commonJS({
7606
7757
  if (options.clientType === "github-app") {
7607
7758
  delete authentication.scopes;
7608
7759
  }
7609
- return {
7610
- ...response,
7611
- authentication
7612
- };
7760
+ return { ...response, authentication };
7613
7761
  }
7762
+ var import_request6 = require_dist_node5();
7614
7763
  async function refreshToken(options) {
7615
- const request$1 = options.request || /* istanbul ignore next: we always pass a custom request in tests */
7616
- request.request;
7617
- const response = await oauthRequest(request$1, "POST /login/oauth/access_token", {
7618
- client_id: options.clientId,
7619
- client_secret: options.clientSecret,
7620
- grant_type: "refresh_token",
7621
- refresh_token: options.refreshToken
7622
- });
7764
+ const request = options.request || /* istanbul ignore next: we always pass a custom request in tests */
7765
+ import_request6.request;
7766
+ const response = await oauthRequest(
7767
+ request,
7768
+ "POST /login/oauth/access_token",
7769
+ {
7770
+ client_id: options.clientId,
7771
+ client_secret: options.clientSecret,
7772
+ grant_type: "refresh_token",
7773
+ refresh_token: options.refreshToken
7774
+ }
7775
+ );
7623
7776
  const apiTimeInMs = new Date(response.headers.date).getTime();
7624
7777
  const authentication = {
7625
7778
  clientType: "github-app",
@@ -7627,17 +7780,19 @@ var require_dist_node7 = __commonJS({
7627
7780
  clientSecret: options.clientSecret,
7628
7781
  token: response.data.access_token,
7629
7782
  refreshToken: response.data.refresh_token,
7630
- expiresAt: toTimestamp$2(apiTimeInMs, response.data.expires_in),
7631
- refreshTokenExpiresAt: toTimestamp$2(apiTimeInMs, response.data.refresh_token_expires_in)
7632
- };
7633
- return {
7634
- ...response,
7635
- authentication
7783
+ expiresAt: toTimestamp3(apiTimeInMs, response.data.expires_in),
7784
+ refreshTokenExpiresAt: toTimestamp3(
7785
+ apiTimeInMs,
7786
+ response.data.refresh_token_expires_in
7787
+ )
7636
7788
  };
7789
+ return { ...response, authentication };
7637
7790
  }
7638
- function toTimestamp$2(apiTimeInMs, expirationInSeconds) {
7791
+ function toTimestamp3(apiTimeInMs, expirationInSeconds) {
7639
7792
  return new Date(apiTimeInMs + expirationInSeconds * 1e3).toISOString();
7640
7793
  }
7794
+ var import_request7 = require_dist_node5();
7795
+ var import_btoa_lite2 = __toESM2(require_btoa_node());
7641
7796
  async function scopeToken(options) {
7642
7797
  const {
7643
7798
  request: optionsRequest,
@@ -7647,40 +7802,46 @@ var require_dist_node7 = __commonJS({
7647
7802
  token,
7648
7803
  ...requestOptions
7649
7804
  } = options;
7650
- const request$1 = optionsRequest || /* istanbul ignore next: we always pass a custom request in tests */
7651
- request.request;
7652
- const response = await request$1("POST /applications/{client_id}/token/scoped", {
7653
- headers: {
7654
- authorization: `basic ${btoa(`${clientId}:${clientSecret}`)}`
7805
+ const request = optionsRequest || /* istanbul ignore next: we always pass a custom request in tests */
7806
+ import_request7.request;
7807
+ const response = await request(
7808
+ "POST /applications/{client_id}/token/scoped",
7809
+ {
7810
+ headers: {
7811
+ authorization: `basic ${(0, import_btoa_lite2.default)(`${clientId}:${clientSecret}`)}`
7812
+ },
7813
+ client_id: clientId,
7814
+ access_token: token,
7815
+ ...requestOptions
7816
+ }
7817
+ );
7818
+ const authentication = Object.assign(
7819
+ {
7820
+ clientType,
7821
+ clientId,
7822
+ clientSecret,
7823
+ token: response.data.token
7655
7824
  },
7656
- client_id: clientId,
7657
- access_token: token,
7658
- ...requestOptions
7659
- });
7660
- const authentication = Object.assign({
7661
- clientType,
7662
- clientId,
7663
- clientSecret,
7664
- token: response.data.token
7665
- }, response.data.expires_at ? {
7666
- expiresAt: response.data.expires_at
7667
- } : {});
7668
- return {
7669
- ...response,
7670
- authentication
7671
- };
7825
+ response.data.expires_at ? { expiresAt: response.data.expires_at } : {}
7826
+ );
7827
+ return { ...response, authentication };
7672
7828
  }
7829
+ var import_request8 = require_dist_node5();
7830
+ var import_btoa_lite3 = __toESM2(require_btoa_node());
7673
7831
  async function resetToken(options) {
7674
- const request$1 = options.request || /* istanbul ignore next: we always pass a custom request in tests */
7675
- request.request;
7676
- const auth = btoa(`${options.clientId}:${options.clientSecret}`);
7677
- const response = await request$1("PATCH /applications/{client_id}/token", {
7678
- headers: {
7679
- authorization: `basic ${auth}`
7680
- },
7681
- client_id: options.clientId,
7682
- access_token: options.token
7683
- });
7832
+ const request = options.request || /* istanbul ignore next: we always pass a custom request in tests */
7833
+ import_request8.request;
7834
+ const auth = (0, import_btoa_lite3.default)(`${options.clientId}:${options.clientSecret}`);
7835
+ const response = await request(
7836
+ "PATCH /applications/{client_id}/token",
7837
+ {
7838
+ headers: {
7839
+ authorization: `basic ${auth}`
7840
+ },
7841
+ client_id: options.clientId,
7842
+ access_token: options.token
7843
+ }
7844
+ );
7684
7845
  const authentication = {
7685
7846
  clientType: options.clientType,
7686
7847
  clientId: options.clientId,
@@ -7693,64 +7854,79 @@ var require_dist_node7 = __commonJS({
7693
7854
  if (options.clientType === "github-app") {
7694
7855
  delete authentication.scopes;
7695
7856
  }
7696
- return {
7697
- ...response,
7698
- authentication
7699
- };
7857
+ return { ...response, authentication };
7700
7858
  }
7859
+ var import_request9 = require_dist_node5();
7860
+ var import_btoa_lite4 = __toESM2(require_btoa_node());
7701
7861
  async function deleteToken(options) {
7702
- const request$1 = options.request || /* istanbul ignore next: we always pass a custom request in tests */
7703
- request.request;
7704
- const auth = btoa(`${options.clientId}:${options.clientSecret}`);
7705
- return request$1("DELETE /applications/{client_id}/token", {
7706
- headers: {
7707
- authorization: `basic ${auth}`
7708
- },
7709
- client_id: options.clientId,
7710
- access_token: options.token
7711
- });
7862
+ const request = options.request || /* istanbul ignore next: we always pass a custom request in tests */
7863
+ import_request9.request;
7864
+ const auth = (0, import_btoa_lite4.default)(`${options.clientId}:${options.clientSecret}`);
7865
+ return request(
7866
+ "DELETE /applications/{client_id}/token",
7867
+ {
7868
+ headers: {
7869
+ authorization: `basic ${auth}`
7870
+ },
7871
+ client_id: options.clientId,
7872
+ access_token: options.token
7873
+ }
7874
+ );
7712
7875
  }
7876
+ var import_request10 = require_dist_node5();
7877
+ var import_btoa_lite5 = __toESM2(require_btoa_node());
7713
7878
  async function deleteAuthorization(options) {
7714
- const request$1 = options.request || /* istanbul ignore next: we always pass a custom request in tests */
7715
- request.request;
7716
- const auth = btoa(`${options.clientId}:${options.clientSecret}`);
7717
- return request$1("DELETE /applications/{client_id}/grant", {
7718
- headers: {
7719
- authorization: `basic ${auth}`
7720
- },
7721
- client_id: options.clientId,
7722
- access_token: options.token
7723
- });
7879
+ const request = options.request || /* istanbul ignore next: we always pass a custom request in tests */
7880
+ import_request10.request;
7881
+ const auth = (0, import_btoa_lite5.default)(`${options.clientId}:${options.clientSecret}`);
7882
+ return request(
7883
+ "DELETE /applications/{client_id}/grant",
7884
+ {
7885
+ headers: {
7886
+ authorization: `basic ${auth}`
7887
+ },
7888
+ client_id: options.clientId,
7889
+ access_token: options.token
7890
+ }
7891
+ );
7724
7892
  }
7725
- exports2.VERSION = VERSION;
7726
- exports2.checkToken = checkToken;
7727
- exports2.createDeviceCode = createDeviceCode;
7728
- exports2.deleteAuthorization = deleteAuthorization;
7729
- exports2.deleteToken = deleteToken;
7730
- exports2.exchangeDeviceCode = exchangeDeviceCode;
7731
- exports2.exchangeWebFlowCode = exchangeWebFlowCode;
7732
- exports2.getWebFlowAuthorizationUrl = getWebFlowAuthorizationUrl;
7733
- exports2.refreshToken = refreshToken;
7734
- exports2.resetToken = resetToken;
7735
- exports2.scopeToken = scopeToken;
7736
7893
  }
7737
7894
  });
7738
7895
 
7739
7896
  // node_modules/@octokit/auth-oauth-device/dist-node/index.js
7740
7897
  var require_dist_node8 = __commonJS({
7741
- "node_modules/@octokit/auth-oauth-device/dist-node/index.js"(exports2) {
7898
+ "node_modules/@octokit/auth-oauth-device/dist-node/index.js"(exports2, module2) {
7742
7899
  "use strict";
7743
- Object.defineProperty(exports2, "__esModule", { value: true });
7744
- var universalUserAgent = require_dist_node();
7745
- var request = require_dist_node5();
7746
- var oauthMethods = require_dist_node7();
7900
+ var __defProp2 = Object.defineProperty;
7901
+ var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
7902
+ var __getOwnPropNames2 = Object.getOwnPropertyNames;
7903
+ var __hasOwnProp2 = Object.prototype.hasOwnProperty;
7904
+ var __export = (target, all) => {
7905
+ for (var name in all)
7906
+ __defProp2(target, name, { get: all[name], enumerable: true });
7907
+ };
7908
+ var __copyProps2 = (to, from, except, desc) => {
7909
+ if (from && typeof from === "object" || typeof from === "function") {
7910
+ for (let key of __getOwnPropNames2(from))
7911
+ if (!__hasOwnProp2.call(to, key) && key !== except)
7912
+ __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
7913
+ }
7914
+ return to;
7915
+ };
7916
+ var __toCommonJS = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
7917
+ var dist_src_exports = {};
7918
+ __export(dist_src_exports, {
7919
+ createOAuthDeviceAuth: () => createOAuthDeviceAuth
7920
+ });
7921
+ module2.exports = __toCommonJS(dist_src_exports);
7922
+ var import_universal_user_agent = require_dist_node();
7923
+ var import_request = require_dist_node5();
7924
+ var import_oauth_methods = require_dist_node7();
7747
7925
  async function getOAuthAccessToken(state, options) {
7748
7926
  const cachedAuthentication = getCachedAuthentication(state, options.auth);
7749
7927
  if (cachedAuthentication)
7750
7928
  return cachedAuthentication;
7751
- const {
7752
- data: verification
7753
- } = await oauthMethods.createDeviceCode({
7929
+ const { data: verification } = await (0, import_oauth_methods.createDeviceCode)({
7754
7930
  clientType: state.clientType,
7755
7931
  clientId: state.clientId,
7756
7932
  request: options.request || state.request,
@@ -7758,7 +7934,12 @@ var require_dist_node8 = __commonJS({
7758
7934
  scopes: options.auth.scopes || state.scopes
7759
7935
  });
7760
7936
  await state.onVerification(verification);
7761
- const authentication = await waitForAccessToken(options.request || state.request, state.clientId, state.clientType, verification);
7937
+ const authentication = await waitForAccessToken(
7938
+ options.request || state.request,
7939
+ state.clientId,
7940
+ state.clientType,
7941
+ verification
7942
+ );
7762
7943
  state.authentication = authentication;
7763
7944
  return authentication;
7764
7945
  }
@@ -7771,26 +7952,26 @@ var require_dist_node8 = __commonJS({
7771
7952
  return state.authentication;
7772
7953
  }
7773
7954
  const authentication = state.authentication;
7774
- const newScope = ("scopes" in auth2 && auth2.scopes || state.scopes).join(" ");
7955
+ const newScope = ("scopes" in auth2 && auth2.scopes || state.scopes).join(
7956
+ " "
7957
+ );
7775
7958
  const currentScope = authentication.scopes.join(" ");
7776
7959
  return newScope === currentScope ? authentication : false;
7777
7960
  }
7778
7961
  async function wait(seconds) {
7779
7962
  await new Promise((resolve) => setTimeout(resolve, seconds * 1e3));
7780
7963
  }
7781
- async function waitForAccessToken(request2, clientId, clientType, verification) {
7964
+ async function waitForAccessToken(request, clientId, clientType, verification) {
7782
7965
  try {
7783
7966
  const options = {
7784
7967
  clientId,
7785
- request: request2,
7968
+ request,
7786
7969
  code: verification.device_code
7787
7970
  };
7788
- const {
7789
- authentication
7790
- } = clientType === "oauth-app" ? await oauthMethods.exchangeDeviceCode({
7971
+ const { authentication } = clientType === "oauth-app" ? await (0, import_oauth_methods.exchangeDeviceCode)({
7791
7972
  ...options,
7792
7973
  clientType: "oauth-app"
7793
- }) : await oauthMethods.exchangeDeviceCode({
7974
+ }) : await (0, import_oauth_methods.exchangeDeviceCode)({
7794
7975
  ...options,
7795
7976
  clientType: "github-app"
7796
7977
  });
@@ -7805,11 +7986,11 @@ var require_dist_node8 = __commonJS({
7805
7986
  const errorType = error.response.data.error;
7806
7987
  if (errorType === "authorization_pending") {
7807
7988
  await wait(verification.interval);
7808
- return waitForAccessToken(request2, clientId, clientType, verification);
7989
+ return waitForAccessToken(request, clientId, clientType, verification);
7809
7990
  }
7810
7991
  if (errorType === "slow_down") {
7811
7992
  await wait(verification.interval + 5);
7812
- return waitForAccessToken(request2, clientId, clientType, verification);
7993
+ return waitForAccessToken(request, clientId, clientType, verification);
7813
7994
  }
7814
7995
  throw error;
7815
7996
  }
@@ -7819,76 +8000,101 @@ var require_dist_node8 = __commonJS({
7819
8000
  auth: authOptions
7820
8001
  });
7821
8002
  }
7822
- async function hook(state, request2, route, parameters) {
7823
- let endpoint = request2.endpoint.merge(route, parameters);
8003
+ async function hook(state, request, route, parameters) {
8004
+ let endpoint = request.endpoint.merge(
8005
+ route,
8006
+ parameters
8007
+ );
7824
8008
  if (/\/login\/(oauth\/access_token|device\/code)$/.test(endpoint.url)) {
7825
- return request2(endpoint);
8009
+ return request(endpoint);
7826
8010
  }
7827
- const {
7828
- token
7829
- } = await getOAuthAccessToken(state, {
7830
- request: request2,
7831
- auth: {
7832
- type: "oauth"
7833
- }
8011
+ const { token } = await getOAuthAccessToken(state, {
8012
+ request,
8013
+ auth: { type: "oauth" }
7834
8014
  });
7835
8015
  endpoint.headers.authorization = `token ${token}`;
7836
- return request2(endpoint);
8016
+ return request(endpoint);
7837
8017
  }
7838
- var VERSION = "4.0.4";
8018
+ var VERSION = "4.0.5";
7839
8019
  function createOAuthDeviceAuth(options) {
7840
- const requestWithDefaults = options.request || request.request.defaults({
8020
+ const requestWithDefaults = options.request || import_request.request.defaults({
7841
8021
  headers: {
7842
- "user-agent": `octokit-auth-oauth-device.js/${VERSION} ${universalUserAgent.getUserAgent()}`
8022
+ "user-agent": `octokit-auth-oauth-device.js/${VERSION} ${(0, import_universal_user_agent.getUserAgent)()}`
7843
8023
  }
7844
8024
  });
7845
- const {
7846
- request: request$1 = requestWithDefaults,
7847
- ...otherOptions
7848
- } = options;
8025
+ const { request = requestWithDefaults, ...otherOptions } = options;
7849
8026
  const state = options.clientType === "github-app" ? {
7850
8027
  ...otherOptions,
7851
8028
  clientType: "github-app",
7852
- request: request$1
8029
+ request
7853
8030
  } : {
7854
8031
  ...otherOptions,
7855
8032
  clientType: "oauth-app",
7856
- request: request$1,
8033
+ request,
7857
8034
  scopes: options.scopes || []
7858
8035
  };
7859
8036
  if (!options.clientId) {
7860
- throw new Error('[@octokit/auth-oauth-device] "clientId" option must be set (https://github.com/octokit/auth-oauth-device.js#usage)');
8037
+ throw new Error(
8038
+ '[@octokit/auth-oauth-device] "clientId" option must be set (https://github.com/octokit/auth-oauth-device.js#usage)'
8039
+ );
7861
8040
  }
7862
8041
  if (!options.onVerification) {
7863
- throw new Error('[@octokit/auth-oauth-device] "onVerification" option must be a function (https://github.com/octokit/auth-oauth-device.js#usage)');
8042
+ throw new Error(
8043
+ '[@octokit/auth-oauth-device] "onVerification" option must be a function (https://github.com/octokit/auth-oauth-device.js#usage)'
8044
+ );
7864
8045
  }
7865
8046
  return Object.assign(auth.bind(null, state), {
7866
8047
  hook: hook.bind(null, state)
7867
8048
  });
7868
8049
  }
7869
- exports2.createOAuthDeviceAuth = createOAuthDeviceAuth;
7870
8050
  }
7871
8051
  });
7872
8052
 
7873
8053
  // node_modules/@octokit/auth-oauth-user/dist-node/index.js
7874
8054
  var require_dist_node9 = __commonJS({
7875
- "node_modules/@octokit/auth-oauth-user/dist-node/index.js"(exports2) {
8055
+ "node_modules/@octokit/auth-oauth-user/dist-node/index.js"(exports2, module2) {
7876
8056
  "use strict";
7877
- Object.defineProperty(exports2, "__esModule", { value: true });
7878
- function _interopDefault(ex) {
7879
- return ex && typeof ex === "object" && "default" in ex ? ex["default"] : ex;
7880
- }
7881
- var universalUserAgent = require_dist_node();
7882
- var request = require_dist_node5();
7883
- var authOauthDevice = require_dist_node8();
7884
- var oauthMethods = require_dist_node7();
7885
- var btoa = _interopDefault(require_btoa_node());
7886
- var VERSION = "2.1.1";
8057
+ var __create2 = Object.create;
8058
+ var __defProp2 = Object.defineProperty;
8059
+ var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
8060
+ var __getOwnPropNames2 = Object.getOwnPropertyNames;
8061
+ var __getProtoOf2 = Object.getPrototypeOf;
8062
+ var __hasOwnProp2 = Object.prototype.hasOwnProperty;
8063
+ var __export = (target, all) => {
8064
+ for (var name in all)
8065
+ __defProp2(target, name, { get: all[name], enumerable: true });
8066
+ };
8067
+ var __copyProps2 = (to, from, except, desc) => {
8068
+ if (from && typeof from === "object" || typeof from === "function") {
8069
+ for (let key of __getOwnPropNames2(from))
8070
+ if (!__hasOwnProp2.call(to, key) && key !== except)
8071
+ __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
8072
+ }
8073
+ return to;
8074
+ };
8075
+ var __toESM2 = (mod, isNodeMode, target) => (target = mod != null ? __create2(__getProtoOf2(mod)) : {}, __copyProps2(
8076
+ // If the importer is in node compatibility mode or this is not an ESM
8077
+ // file that has been converted to a CommonJS file using a Babel-
8078
+ // compatible transform (i.e. "__esModule" has not been set), then set
8079
+ // "default" to the CommonJS "module.exports" for node compatibility.
8080
+ isNodeMode || !mod || !mod.__esModule ? __defProp2(target, "default", { value: mod, enumerable: true }) : target,
8081
+ mod
8082
+ ));
8083
+ var __toCommonJS = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
8084
+ var dist_src_exports = {};
8085
+ __export(dist_src_exports, {
8086
+ createOAuthUserAuth: () => createOAuthUserAuth2,
8087
+ requiresBasicAuth: () => requiresBasicAuth
8088
+ });
8089
+ module2.exports = __toCommonJS(dist_src_exports);
8090
+ var import_universal_user_agent = require_dist_node();
8091
+ var import_request = require_dist_node5();
8092
+ var VERSION = "2.1.2";
8093
+ var import_auth_oauth_device = require_dist_node8();
8094
+ var import_oauth_methods = require_dist_node7();
7887
8095
  async function getAuthentication(state) {
7888
8096
  if ("code" in state.strategyOptions) {
7889
- const {
7890
- authentication
7891
- } = await oauthMethods.exchangeWebFlowCode({
8097
+ const { authentication } = await (0, import_oauth_methods.exchangeWebFlowCode)({
7892
8098
  clientId: state.clientId,
7893
8099
  clientSecret: state.clientSecret,
7894
8100
  clientType: state.clientType,
@@ -7903,7 +8109,7 @@ var require_dist_node9 = __commonJS({
7903
8109
  };
7904
8110
  }
7905
8111
  if ("onVerification" in state.strategyOptions) {
7906
- const deviceAuth = authOauthDevice.createOAuthDeviceAuth({
8112
+ const deviceAuth = (0, import_auth_oauth_device.createOAuthDeviceAuth)({
7907
8113
  clientType: state.clientType,
7908
8114
  clientId: state.clientId,
7909
8115
  onTokenCreated: state.onTokenCreated,
@@ -7931,7 +8137,9 @@ var require_dist_node9 = __commonJS({
7931
8137
  }
7932
8138
  throw new Error("[@octokit/auth-oauth-user] Invalid strategy options");
7933
8139
  }
8140
+ var import_oauth_methods2 = require_dist_node7();
7934
8141
  async function auth(state, options = {}) {
8142
+ var _a, _b;
7935
8143
  if (!state.authentication) {
7936
8144
  state.authentication = state.clientType === "oauth-app" ? await getAuthentication(state) : await getAuthentication(state);
7937
8145
  }
@@ -7941,9 +8149,7 @@ var require_dist_node9 = __commonJS({
7941
8149
  const currentAuthentication = state.authentication;
7942
8150
  if ("expiresAt" in currentAuthentication) {
7943
8151
  if (options.type === "refresh" || new Date(currentAuthentication.expiresAt) < /* @__PURE__ */ new Date()) {
7944
- const {
7945
- authentication
7946
- } = await oauthMethods.refreshToken({
8152
+ const { authentication } = await (0, import_oauth_methods2.refreshToken)({
7947
8153
  clientType: "github-app",
7948
8154
  clientId: state.clientId,
7949
8155
  clientSecret: state.clientSecret,
@@ -7958,23 +8164,22 @@ var require_dist_node9 = __commonJS({
7958
8164
  }
7959
8165
  }
7960
8166
  if (options.type === "refresh") {
7961
- var _state$onTokenCreated;
7962
8167
  if (state.clientType === "oauth-app") {
7963
- throw new Error("[@octokit/auth-oauth-user] OAuth Apps do not support expiring tokens");
8168
+ throw new Error(
8169
+ "[@octokit/auth-oauth-user] OAuth Apps do not support expiring tokens"
8170
+ );
7964
8171
  }
7965
8172
  if (!currentAuthentication.hasOwnProperty("expiresAt")) {
7966
8173
  throw new Error("[@octokit/auth-oauth-user] Refresh token missing");
7967
8174
  }
7968
- await ((_state$onTokenCreated = state.onTokenCreated) === null || _state$onTokenCreated === void 0 ? void 0 : _state$onTokenCreated.call(state, state.authentication, {
8175
+ await ((_a = state.onTokenCreated) == null ? void 0 : _a.call(state, state.authentication, {
7969
8176
  type: options.type
7970
8177
  }));
7971
8178
  }
7972
8179
  if (options.type === "check" || options.type === "reset") {
7973
- const method = options.type === "check" ? oauthMethods.checkToken : oauthMethods.resetToken;
8180
+ const method = options.type === "check" ? import_oauth_methods2.checkToken : import_oauth_methods2.resetToken;
7974
8181
  try {
7975
- const {
7976
- authentication
7977
- } = await method({
8182
+ const { authentication } = await method({
7978
8183
  // @ts-expect-error making TS happy would require unnecessary code so no
7979
8184
  clientType: state.clientType,
7980
8185
  clientId: state.clientId,
@@ -7989,8 +8194,7 @@ var require_dist_node9 = __commonJS({
7989
8194
  ...authentication
7990
8195
  };
7991
8196
  if (options.type === "reset") {
7992
- var _state$onTokenCreated2;
7993
- await ((_state$onTokenCreated2 = state.onTokenCreated) === null || _state$onTokenCreated2 === void 0 ? void 0 : _state$onTokenCreated2.call(state, state.authentication, {
8197
+ await ((_b = state.onTokenCreated) == null ? void 0 : _b.call(state, state.authentication, {
7994
8198
  type: options.type
7995
8199
  }));
7996
8200
  }
@@ -8004,7 +8208,7 @@ var require_dist_node9 = __commonJS({
8004
8208
  }
8005
8209
  }
8006
8210
  if (options.type === "delete" || options.type === "deleteAuthorization") {
8007
- const method = options.type === "delete" ? oauthMethods.deleteToken : oauthMethods.deleteAuthorization;
8211
+ const method = options.type === "delete" ? import_oauth_methods2.deleteToken : import_oauth_methods2.deleteAuthorization;
8008
8212
  try {
8009
8213
  await method({
8010
8214
  // @ts-expect-error making TS happy would require unnecessary code so no
@@ -8023,39 +8227,35 @@ var require_dist_node9 = __commonJS({
8023
8227
  }
8024
8228
  return state.authentication;
8025
8229
  }
8230
+ var import_btoa_lite = __toESM2(require_btoa_node());
8026
8231
  var ROUTES_REQUIRING_BASIC_AUTH = /\/applications\/[^/]+\/(token|grant)s?/;
8027
8232
  function requiresBasicAuth(url) {
8028
8233
  return url && ROUTES_REQUIRING_BASIC_AUTH.test(url);
8029
8234
  }
8030
- async function hook(state, request2, route, parameters = {}) {
8031
- const endpoint = request2.endpoint.merge(route, parameters);
8235
+ async function hook(state, request, route, parameters = {}) {
8236
+ const endpoint = request.endpoint.merge(
8237
+ route,
8238
+ parameters
8239
+ );
8032
8240
  if (/\/login\/(oauth\/access_token|device\/code)$/.test(endpoint.url)) {
8033
- return request2(endpoint);
8241
+ return request(endpoint);
8034
8242
  }
8035
8243
  if (requiresBasicAuth(endpoint.url)) {
8036
- const credentials = btoa(`${state.clientId}:${state.clientSecret}`);
8244
+ const credentials = (0, import_btoa_lite.default)(`${state.clientId}:${state.clientSecret}`);
8037
8245
  endpoint.headers.authorization = `basic ${credentials}`;
8038
- return request2(endpoint);
8246
+ return request(endpoint);
8039
8247
  }
8040
- const {
8041
- token
8042
- } = state.clientType === "oauth-app" ? await auth({
8043
- ...state,
8044
- request: request2
8045
- }) : await auth({
8046
- ...state,
8047
- request: request2
8048
- });
8248
+ const { token } = state.clientType === "oauth-app" ? await auth({ ...state, request }) : await auth({ ...state, request });
8049
8249
  endpoint.headers.authorization = "token " + token;
8050
- return request2(endpoint);
8250
+ return request(endpoint);
8051
8251
  }
8052
- function createOAuthUserAuth({
8252
+ function createOAuthUserAuth2({
8053
8253
  clientId,
8054
8254
  clientSecret,
8055
8255
  clientType = "oauth-app",
8056
- request: request$1 = request.request.defaults({
8256
+ request = import_request.request.defaults({
8057
8257
  headers: {
8058
- "user-agent": `octokit-auth-oauth-app.js/${VERSION} ${universalUserAgent.getUserAgent()}`
8258
+ "user-agent": `octokit-auth-oauth-app.js/${VERSION} ${(0, import_universal_user_agent.getUserAgent)()}`
8059
8259
  }
8060
8260
  }),
8061
8261
  onTokenCreated,
@@ -8067,31 +8267,58 @@ var require_dist_node9 = __commonJS({
8067
8267
  clientSecret,
8068
8268
  onTokenCreated,
8069
8269
  strategyOptions,
8070
- request: request$1
8270
+ request
8071
8271
  });
8072
8272
  return Object.assign(auth.bind(null, state), {
8073
8273
  // @ts-expect-error not worth the extra code needed to appease TS
8074
8274
  hook: hook.bind(null, state)
8075
8275
  });
8076
8276
  }
8077
- createOAuthUserAuth.VERSION = VERSION;
8078
- exports2.createOAuthUserAuth = createOAuthUserAuth;
8079
- exports2.requiresBasicAuth = requiresBasicAuth;
8277
+ createOAuthUserAuth2.VERSION = VERSION;
8080
8278
  }
8081
8279
  });
8082
8280
 
8083
8281
  // node_modules/@octokit/auth-oauth-app/dist-node/index.js
8084
8282
  var require_dist_node10 = __commonJS({
8085
- "node_modules/@octokit/auth-oauth-app/dist-node/index.js"(exports2) {
8283
+ "node_modules/@octokit/auth-oauth-app/dist-node/index.js"(exports2, module2) {
8086
8284
  "use strict";
8087
- Object.defineProperty(exports2, "__esModule", { value: true });
8088
- function _interopDefault(ex) {
8089
- return ex && typeof ex === "object" && "default" in ex ? ex["default"] : ex;
8090
- }
8091
- var universalUserAgent = require_dist_node();
8092
- var request = require_dist_node5();
8093
- var btoa = _interopDefault(require_btoa_node());
8094
- var authOauthUser = require_dist_node9();
8285
+ var __create2 = Object.create;
8286
+ var __defProp2 = Object.defineProperty;
8287
+ var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
8288
+ var __getOwnPropNames2 = Object.getOwnPropertyNames;
8289
+ var __getProtoOf2 = Object.getPrototypeOf;
8290
+ var __hasOwnProp2 = Object.prototype.hasOwnProperty;
8291
+ var __export = (target, all) => {
8292
+ for (var name in all)
8293
+ __defProp2(target, name, { get: all[name], enumerable: true });
8294
+ };
8295
+ var __copyProps2 = (to, from, except, desc) => {
8296
+ if (from && typeof from === "object" || typeof from === "function") {
8297
+ for (let key of __getOwnPropNames2(from))
8298
+ if (!__hasOwnProp2.call(to, key) && key !== except)
8299
+ __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
8300
+ }
8301
+ return to;
8302
+ };
8303
+ var __toESM2 = (mod, isNodeMode, target) => (target = mod != null ? __create2(__getProtoOf2(mod)) : {}, __copyProps2(
8304
+ // If the importer is in node compatibility mode or this is not an ESM
8305
+ // file that has been converted to a CommonJS file using a Babel-
8306
+ // compatible transform (i.e. "__esModule" has not been set), then set
8307
+ // "default" to the CommonJS "module.exports" for node compatibility.
8308
+ isNodeMode || !mod || !mod.__esModule ? __defProp2(target, "default", { value: mod, enumerable: true }) : target,
8309
+ mod
8310
+ ));
8311
+ var __toCommonJS = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
8312
+ var dist_src_exports = {};
8313
+ __export(dist_src_exports, {
8314
+ createOAuthAppAuth: () => createOAuthAppAuth,
8315
+ createOAuthUserAuth: () => import_auth_oauth_user3.createOAuthUserAuth
8316
+ });
8317
+ module2.exports = __toCommonJS(dist_src_exports);
8318
+ var import_universal_user_agent = require_dist_node();
8319
+ var import_request = require_dist_node5();
8320
+ var import_btoa_lite = __toESM2(require_btoa_node());
8321
+ var import_auth_oauth_user = require_dist_node9();
8095
8322
  async function auth(state, authOptions) {
8096
8323
  if (authOptions.type === "oauth-app") {
8097
8324
  return {
@@ -8100,15 +8327,14 @@ var require_dist_node10 = __commonJS({
8100
8327
  clientSecret: state.clientSecret,
8101
8328
  clientType: state.clientType,
8102
8329
  headers: {
8103
- authorization: `basic ${btoa(`${state.clientId}:${state.clientSecret}`)}`
8330
+ authorization: `basic ${(0, import_btoa_lite.default)(
8331
+ `${state.clientId}:${state.clientSecret}`
8332
+ )}`
8104
8333
  }
8105
8334
  };
8106
8335
  }
8107
8336
  if ("factory" in authOptions) {
8108
- const {
8109
- type,
8110
- ...options
8111
- } = {
8337
+ const { type, ...options } = {
8112
8338
  ...authOptions,
8113
8339
  ...state
8114
8340
  };
@@ -8120,24 +8346,31 @@ var require_dist_node10 = __commonJS({
8120
8346
  request: state.request,
8121
8347
  ...authOptions
8122
8348
  };
8123
- const userAuth = state.clientType === "oauth-app" ? await authOauthUser.createOAuthUserAuth({
8349
+ const userAuth = state.clientType === "oauth-app" ? await (0, import_auth_oauth_user.createOAuthUserAuth)({
8124
8350
  ...common,
8125
8351
  clientType: state.clientType
8126
- }) : await authOauthUser.createOAuthUserAuth({
8352
+ }) : await (0, import_auth_oauth_user.createOAuthUserAuth)({
8127
8353
  ...common,
8128
8354
  clientType: state.clientType
8129
8355
  });
8130
8356
  return userAuth();
8131
8357
  }
8358
+ var import_btoa_lite2 = __toESM2(require_btoa_node());
8359
+ var import_auth_oauth_user2 = require_dist_node9();
8132
8360
  async function hook(state, request2, route, parameters) {
8133
- let endpoint = request2.endpoint.merge(route, parameters);
8361
+ let endpoint = request2.endpoint.merge(
8362
+ route,
8363
+ parameters
8364
+ );
8134
8365
  if (/\/login\/(oauth\/access_token|device\/code)$/.test(endpoint.url)) {
8135
8366
  return request2(endpoint);
8136
8367
  }
8137
- if (state.clientType === "github-app" && !authOauthUser.requiresBasicAuth(endpoint.url)) {
8138
- throw new Error(`[@octokit/auth-oauth-app] GitHub Apps cannot use their client ID/secret for basic authentication for endpoints other than "/applications/{client_id}/**". "${endpoint.method} ${endpoint.url}" is not supported.`);
8368
+ if (state.clientType === "github-app" && !(0, import_auth_oauth_user2.requiresBasicAuth)(endpoint.url)) {
8369
+ throw new Error(
8370
+ `[@octokit/auth-oauth-app] GitHub Apps cannot use their client ID/secret for basic authentication for endpoints other than "/applications/{client_id}/**". "${endpoint.method} ${endpoint.url}" is not supported.`
8371
+ );
8139
8372
  }
8140
- const credentials = btoa(`${state.clientId}:${state.clientSecret}`);
8373
+ const credentials = (0, import_btoa_lite2.default)(`${state.clientId}:${state.clientSecret}`);
8141
8374
  endpoint.headers.authorization = `basic ${credentials}`;
8142
8375
  try {
8143
8376
  return await request2(endpoint);
@@ -8148,33 +8381,31 @@ var require_dist_node10 = __commonJS({
8148
8381
  throw error;
8149
8382
  }
8150
8383
  }
8151
- var VERSION = "5.0.5";
8384
+ var VERSION = "5.0.6";
8385
+ var import_auth_oauth_user3 = require_dist_node9();
8152
8386
  function createOAuthAppAuth(options) {
8153
- const state = Object.assign({
8154
- request: request.request.defaults({
8155
- headers: {
8156
- "user-agent": `octokit-auth-oauth-app.js/${VERSION} ${universalUserAgent.getUserAgent()}`
8157
- }
8158
- }),
8159
- clientType: "oauth-app"
8160
- }, options);
8387
+ const state = Object.assign(
8388
+ {
8389
+ request: import_request.request.defaults({
8390
+ headers: {
8391
+ "user-agent": `octokit-auth-oauth-app.js/${VERSION} ${(0, import_universal_user_agent.getUserAgent)()}`
8392
+ }
8393
+ }),
8394
+ clientType: "oauth-app"
8395
+ },
8396
+ options
8397
+ );
8161
8398
  return Object.assign(auth.bind(null, state), {
8162
8399
  hook: hook.bind(null, state)
8163
8400
  });
8164
8401
  }
8165
- Object.defineProperty(exports2, "createOAuthUserAuth", {
8166
- enumerable: true,
8167
- get: function() {
8168
- return authOauthUser.createOAuthUserAuth;
8169
- }
8170
- });
8171
- exports2.createOAuthAppAuth = createOAuthAppAuth;
8172
8402
  }
8173
8403
  });
8174
8404
 
8175
8405
  // node_modules/jsonwebtoken/lib/JsonWebTokenError.js
8176
8406
  var require_JsonWebTokenError = __commonJS({
8177
8407
  "node_modules/jsonwebtoken/lib/JsonWebTokenError.js"(exports2, module2) {
8408
+ "use strict";
8178
8409
  var JsonWebTokenError = function(message, error) {
8179
8410
  Error.call(this, message);
8180
8411
  if (Error.captureStackTrace) {
@@ -8194,6 +8425,7 @@ var require_JsonWebTokenError = __commonJS({
8194
8425
  // node_modules/jsonwebtoken/lib/NotBeforeError.js
8195
8426
  var require_NotBeforeError = __commonJS({
8196
8427
  "node_modules/jsonwebtoken/lib/NotBeforeError.js"(exports2, module2) {
8428
+ "use strict";
8197
8429
  var JsonWebTokenError = require_JsonWebTokenError();
8198
8430
  var NotBeforeError = function(message, date) {
8199
8431
  JsonWebTokenError.call(this, message);
@@ -8209,6 +8441,7 @@ var require_NotBeforeError = __commonJS({
8209
8441
  // node_modules/jsonwebtoken/lib/TokenExpiredError.js
8210
8442
  var require_TokenExpiredError = __commonJS({
8211
8443
  "node_modules/jsonwebtoken/lib/TokenExpiredError.js"(exports2, module2) {
8444
+ "use strict";
8212
8445
  var JsonWebTokenError = require_JsonWebTokenError();
8213
8446
  var TokenExpiredError = function(message, expiredAt) {
8214
8447
  JsonWebTokenError.call(this, message);
@@ -8224,6 +8457,7 @@ var require_TokenExpiredError = __commonJS({
8224
8457
  // node_modules/safe-buffer/index.js
8225
8458
  var require_safe_buffer = __commonJS({
8226
8459
  "node_modules/safe-buffer/index.js"(exports2, module2) {
8460
+ "use strict";
8227
8461
  var buffer = require("buffer");
8228
8462
  var Buffer2 = buffer.Buffer;
8229
8463
  function copyProps(src, dst) {
@@ -8282,6 +8516,7 @@ var require_safe_buffer = __commonJS({
8282
8516
  // node_modules/jws/lib/data-stream.js
8283
8517
  var require_data_stream = __commonJS({
8284
8518
  "node_modules/jws/lib/data-stream.js"(exports2, module2) {
8519
+ "use strict";
8285
8520
  var Buffer2 = require_safe_buffer().Buffer;
8286
8521
  var Stream = require("stream");
8287
8522
  var util = require("util");
@@ -8528,6 +8763,7 @@ var require_ecdsa_sig_formatter = __commonJS({
8528
8763
  // node_modules/jwa/index.js
8529
8764
  var require_jwa = __commonJS({
8530
8765
  "node_modules/jwa/index.js"(exports2, module2) {
8766
+ "use strict";
8531
8767
  var bufferEqual = require_buffer_equal_constant_time();
8532
8768
  var Buffer2 = require_safe_buffer().Buffer;
8533
8769
  var crypto = require("crypto");
@@ -8741,6 +8977,7 @@ var require_jwa = __commonJS({
8741
8977
  // node_modules/jws/lib/tostring.js
8742
8978
  var require_tostring = __commonJS({
8743
8979
  "node_modules/jws/lib/tostring.js"(exports2, module2) {
8980
+ "use strict";
8744
8981
  var Buffer2 = require("buffer").Buffer;
8745
8982
  module2.exports = function toString(obj) {
8746
8983
  if (typeof obj === "string")
@@ -8755,6 +8992,7 @@ var require_tostring = __commonJS({
8755
8992
  // node_modules/jws/lib/sign-stream.js
8756
8993
  var require_sign_stream = __commonJS({
8757
8994
  "node_modules/jws/lib/sign-stream.js"(exports2, module2) {
8995
+ "use strict";
8758
8996
  var Buffer2 = require_safe_buffer().Buffer;
8759
8997
  var DataStream = require_data_stream();
8760
8998
  var jwa = require_jwa();
@@ -8825,6 +9063,7 @@ var require_sign_stream = __commonJS({
8825
9063
  // node_modules/jws/lib/verify-stream.js
8826
9064
  var require_verify_stream = __commonJS({
8827
9065
  "node_modules/jws/lib/verify-stream.js"(exports2, module2) {
9066
+ "use strict";
8828
9067
  var Buffer2 = require_safe_buffer().Buffer;
8829
9068
  var DataStream = require_data_stream();
8830
9069
  var jwa = require_jwa();
@@ -8935,6 +9174,7 @@ var require_verify_stream = __commonJS({
8935
9174
  // node_modules/jws/index.js
8936
9175
  var require_jws = __commonJS({
8937
9176
  "node_modules/jws/index.js"(exports2) {
9177
+ "use strict";
8938
9178
  var SignStream = require_sign_stream();
8939
9179
  var VerifyStream = require_verify_stream();
8940
9180
  var ALGORITHMS = [
@@ -8968,6 +9208,7 @@ var require_jws = __commonJS({
8968
9208
  // node_modules/jsonwebtoken/decode.js
8969
9209
  var require_decode = __commonJS({
8970
9210
  "node_modules/jsonwebtoken/decode.js"(exports2, module2) {
9211
+ "use strict";
8971
9212
  var jws = require_jws();
8972
9213
  module2.exports = function(jwt, options) {
8973
9214
  options = options || {};
@@ -9000,6 +9241,7 @@ var require_decode = __commonJS({
9000
9241
  // node_modules/ms/index.js
9001
9242
  var require_ms = __commonJS({
9002
9243
  "node_modules/ms/index.js"(exports2, module2) {
9244
+ "use strict";
9003
9245
  var s = 1e3;
9004
9246
  var m = s * 60;
9005
9247
  var h = m * 60;
@@ -9116,6 +9358,7 @@ var require_ms = __commonJS({
9116
9358
  // node_modules/jsonwebtoken/lib/timespan.js
9117
9359
  var require_timespan = __commonJS({
9118
9360
  "node_modules/jsonwebtoken/lib/timespan.js"(exports2, module2) {
9361
+ "use strict";
9119
9362
  var ms = require_ms();
9120
9363
  module2.exports = function(time, iat) {
9121
9364
  var timestamp = iat || Math.floor(Date.now() / 1e3);
@@ -9137,6 +9380,7 @@ var require_timespan = __commonJS({
9137
9380
  // node_modules/semver/internal/constants.js
9138
9381
  var require_constants = __commonJS({
9139
9382
  "node_modules/semver/internal/constants.js"(exports2, module2) {
9383
+ "use strict";
9140
9384
  var SEMVER_SPEC_VERSION = "2.0.0";
9141
9385
  var MAX_LENGTH = 256;
9142
9386
  var MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || /* istanbul ignore next */
@@ -9166,6 +9410,7 @@ var require_constants = __commonJS({
9166
9410
  // node_modules/semver/internal/debug.js
9167
9411
  var require_debug = __commonJS({
9168
9412
  "node_modules/semver/internal/debug.js"(exports2, module2) {
9413
+ "use strict";
9169
9414
  var debug = typeof process === "object" && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG) ? (...args) => console.error("SEMVER", ...args) : () => {
9170
9415
  };
9171
9416
  module2.exports = debug;
@@ -9175,6 +9420,7 @@ var require_debug = __commonJS({
9175
9420
  // node_modules/semver/internal/re.js
9176
9421
  var require_re = __commonJS({
9177
9422
  "node_modules/semver/internal/re.js"(exports2, module2) {
9423
+ "use strict";
9178
9424
  var { MAX_SAFE_COMPONENT_LENGTH } = require_constants();
9179
9425
  var debug = require_debug();
9180
9426
  exports2 = module2.exports = {};
@@ -9238,6 +9484,7 @@ var require_re = __commonJS({
9238
9484
  // node_modules/semver/internal/parse-options.js
9239
9485
  var require_parse_options = __commonJS({
9240
9486
  "node_modules/semver/internal/parse-options.js"(exports2, module2) {
9487
+ "use strict";
9241
9488
  var looseOption = Object.freeze({ loose: true });
9242
9489
  var emptyOpts = Object.freeze({});
9243
9490
  var parseOptions = (options) => {
@@ -9256,6 +9503,7 @@ var require_parse_options = __commonJS({
9256
9503
  // node_modules/semver/internal/identifiers.js
9257
9504
  var require_identifiers = __commonJS({
9258
9505
  "node_modules/semver/internal/identifiers.js"(exports2, module2) {
9506
+ "use strict";
9259
9507
  var numeric = /^[0-9]+$/;
9260
9508
  var compareIdentifiers = (a, b) => {
9261
9509
  const anum = numeric.test(a);
@@ -9277,6 +9525,7 @@ var require_identifiers = __commonJS({
9277
9525
  // node_modules/semver/classes/semver.js
9278
9526
  var require_semver = __commonJS({
9279
9527
  "node_modules/semver/classes/semver.js"(exports2, module2) {
9528
+ "use strict";
9280
9529
  var debug = require_debug();
9281
9530
  var { MAX_LENGTH, MAX_SAFE_INTEGER } = require_constants();
9282
9531
  var { re, t } = require_re();
@@ -9292,7 +9541,7 @@ var require_semver = __commonJS({
9292
9541
  version = version.version;
9293
9542
  }
9294
9543
  } else if (typeof version !== "string") {
9295
- throw new TypeError(`Invalid Version: ${require("util").inspect(version)}`);
9544
+ throw new TypeError(`Invalid version. Must be a string. Got type "${typeof version}".`);
9296
9545
  }
9297
9546
  if (version.length > MAX_LENGTH) {
9298
9547
  throw new TypeError(
@@ -9517,6 +9766,7 @@ var require_semver = __commonJS({
9517
9766
  // node_modules/semver/functions/parse.js
9518
9767
  var require_parse = __commonJS({
9519
9768
  "node_modules/semver/functions/parse.js"(exports2, module2) {
9769
+ "use strict";
9520
9770
  var SemVer = require_semver();
9521
9771
  var parse = (version, options, throwErrors = false) => {
9522
9772
  if (version instanceof SemVer) {
@@ -9538,6 +9788,7 @@ var require_parse = __commonJS({
9538
9788
  // node_modules/semver/functions/valid.js
9539
9789
  var require_valid = __commonJS({
9540
9790
  "node_modules/semver/functions/valid.js"(exports2, module2) {
9791
+ "use strict";
9541
9792
  var parse = require_parse();
9542
9793
  var valid = (version, options) => {
9543
9794
  const v = parse(version, options);
@@ -9550,6 +9801,7 @@ var require_valid = __commonJS({
9550
9801
  // node_modules/semver/functions/clean.js
9551
9802
  var require_clean = __commonJS({
9552
9803
  "node_modules/semver/functions/clean.js"(exports2, module2) {
9804
+ "use strict";
9553
9805
  var parse = require_parse();
9554
9806
  var clean = (version, options) => {
9555
9807
  const s = parse(version.trim().replace(/^[=v]+/, ""), options);
@@ -9562,6 +9814,7 @@ var require_clean = __commonJS({
9562
9814
  // node_modules/semver/functions/inc.js
9563
9815
  var require_inc = __commonJS({
9564
9816
  "node_modules/semver/functions/inc.js"(exports2, module2) {
9817
+ "use strict";
9565
9818
  var SemVer = require_semver();
9566
9819
  var inc = (version, release, options, identifier, identifierBase) => {
9567
9820
  if (typeof options === "string") {
@@ -9585,6 +9838,7 @@ var require_inc = __commonJS({
9585
9838
  // node_modules/semver/functions/diff.js
9586
9839
  var require_diff = __commonJS({
9587
9840
  "node_modules/semver/functions/diff.js"(exports2, module2) {
9841
+ "use strict";
9588
9842
  var parse = require_parse();
9589
9843
  var diff = (version1, version2) => {
9590
9844
  const v1 = parse(version1, null, true);
@@ -9625,6 +9879,7 @@ var require_diff = __commonJS({
9625
9879
  // node_modules/semver/functions/major.js
9626
9880
  var require_major = __commonJS({
9627
9881
  "node_modules/semver/functions/major.js"(exports2, module2) {
9882
+ "use strict";
9628
9883
  var SemVer = require_semver();
9629
9884
  var major = (a, loose) => new SemVer(a, loose).major;
9630
9885
  module2.exports = major;
@@ -9634,6 +9889,7 @@ var require_major = __commonJS({
9634
9889
  // node_modules/semver/functions/minor.js
9635
9890
  var require_minor = __commonJS({
9636
9891
  "node_modules/semver/functions/minor.js"(exports2, module2) {
9892
+ "use strict";
9637
9893
  var SemVer = require_semver();
9638
9894
  var minor = (a, loose) => new SemVer(a, loose).minor;
9639
9895
  module2.exports = minor;
@@ -9643,6 +9899,7 @@ var require_minor = __commonJS({
9643
9899
  // node_modules/semver/functions/patch.js
9644
9900
  var require_patch = __commonJS({
9645
9901
  "node_modules/semver/functions/patch.js"(exports2, module2) {
9902
+ "use strict";
9646
9903
  var SemVer = require_semver();
9647
9904
  var patch = (a, loose) => new SemVer(a, loose).patch;
9648
9905
  module2.exports = patch;
@@ -9652,6 +9909,7 @@ var require_patch = __commonJS({
9652
9909
  // node_modules/semver/functions/prerelease.js
9653
9910
  var require_prerelease = __commonJS({
9654
9911
  "node_modules/semver/functions/prerelease.js"(exports2, module2) {
9912
+ "use strict";
9655
9913
  var parse = require_parse();
9656
9914
  var prerelease = (version, options) => {
9657
9915
  const parsed = parse(version, options);
@@ -9664,6 +9922,7 @@ var require_prerelease = __commonJS({
9664
9922
  // node_modules/semver/functions/compare.js
9665
9923
  var require_compare = __commonJS({
9666
9924
  "node_modules/semver/functions/compare.js"(exports2, module2) {
9925
+ "use strict";
9667
9926
  var SemVer = require_semver();
9668
9927
  var compare = (a, b, loose) => new SemVer(a, loose).compare(new SemVer(b, loose));
9669
9928
  module2.exports = compare;
@@ -9673,6 +9932,7 @@ var require_compare = __commonJS({
9673
9932
  // node_modules/semver/functions/rcompare.js
9674
9933
  var require_rcompare = __commonJS({
9675
9934
  "node_modules/semver/functions/rcompare.js"(exports2, module2) {
9935
+ "use strict";
9676
9936
  var compare = require_compare();
9677
9937
  var rcompare = (a, b, loose) => compare(b, a, loose);
9678
9938
  module2.exports = rcompare;
@@ -9682,6 +9942,7 @@ var require_rcompare = __commonJS({
9682
9942
  // node_modules/semver/functions/compare-loose.js
9683
9943
  var require_compare_loose = __commonJS({
9684
9944
  "node_modules/semver/functions/compare-loose.js"(exports2, module2) {
9945
+ "use strict";
9685
9946
  var compare = require_compare();
9686
9947
  var compareLoose = (a, b) => compare(a, b, true);
9687
9948
  module2.exports = compareLoose;
@@ -9691,6 +9952,7 @@ var require_compare_loose = __commonJS({
9691
9952
  // node_modules/semver/functions/compare-build.js
9692
9953
  var require_compare_build = __commonJS({
9693
9954
  "node_modules/semver/functions/compare-build.js"(exports2, module2) {
9955
+ "use strict";
9694
9956
  var SemVer = require_semver();
9695
9957
  var compareBuild = (a, b, loose) => {
9696
9958
  const versionA = new SemVer(a, loose);
@@ -9704,6 +9966,7 @@ var require_compare_build = __commonJS({
9704
9966
  // node_modules/semver/functions/sort.js
9705
9967
  var require_sort = __commonJS({
9706
9968
  "node_modules/semver/functions/sort.js"(exports2, module2) {
9969
+ "use strict";
9707
9970
  var compareBuild = require_compare_build();
9708
9971
  var sort = (list, loose) => list.sort((a, b) => compareBuild(a, b, loose));
9709
9972
  module2.exports = sort;
@@ -9713,6 +9976,7 @@ var require_sort = __commonJS({
9713
9976
  // node_modules/semver/functions/rsort.js
9714
9977
  var require_rsort = __commonJS({
9715
9978
  "node_modules/semver/functions/rsort.js"(exports2, module2) {
9979
+ "use strict";
9716
9980
  var compareBuild = require_compare_build();
9717
9981
  var rsort = (list, loose) => list.sort((a, b) => compareBuild(b, a, loose));
9718
9982
  module2.exports = rsort;
@@ -9722,6 +9986,7 @@ var require_rsort = __commonJS({
9722
9986
  // node_modules/semver/functions/gt.js
9723
9987
  var require_gt = __commonJS({
9724
9988
  "node_modules/semver/functions/gt.js"(exports2, module2) {
9989
+ "use strict";
9725
9990
  var compare = require_compare();
9726
9991
  var gt = (a, b, loose) => compare(a, b, loose) > 0;
9727
9992
  module2.exports = gt;
@@ -9731,6 +9996,7 @@ var require_gt = __commonJS({
9731
9996
  // node_modules/semver/functions/lt.js
9732
9997
  var require_lt = __commonJS({
9733
9998
  "node_modules/semver/functions/lt.js"(exports2, module2) {
9999
+ "use strict";
9734
10000
  var compare = require_compare();
9735
10001
  var lt = (a, b, loose) => compare(a, b, loose) < 0;
9736
10002
  module2.exports = lt;
@@ -9740,6 +10006,7 @@ var require_lt = __commonJS({
9740
10006
  // node_modules/semver/functions/eq.js
9741
10007
  var require_eq = __commonJS({
9742
10008
  "node_modules/semver/functions/eq.js"(exports2, module2) {
10009
+ "use strict";
9743
10010
  var compare = require_compare();
9744
10011
  var eq = (a, b, loose) => compare(a, b, loose) === 0;
9745
10012
  module2.exports = eq;
@@ -9749,6 +10016,7 @@ var require_eq = __commonJS({
9749
10016
  // node_modules/semver/functions/neq.js
9750
10017
  var require_neq = __commonJS({
9751
10018
  "node_modules/semver/functions/neq.js"(exports2, module2) {
10019
+ "use strict";
9752
10020
  var compare = require_compare();
9753
10021
  var neq = (a, b, loose) => compare(a, b, loose) !== 0;
9754
10022
  module2.exports = neq;
@@ -9758,6 +10026,7 @@ var require_neq = __commonJS({
9758
10026
  // node_modules/semver/functions/gte.js
9759
10027
  var require_gte = __commonJS({
9760
10028
  "node_modules/semver/functions/gte.js"(exports2, module2) {
10029
+ "use strict";
9761
10030
  var compare = require_compare();
9762
10031
  var gte = (a, b, loose) => compare(a, b, loose) >= 0;
9763
10032
  module2.exports = gte;
@@ -9767,6 +10036,7 @@ var require_gte = __commonJS({
9767
10036
  // node_modules/semver/functions/lte.js
9768
10037
  var require_lte = __commonJS({
9769
10038
  "node_modules/semver/functions/lte.js"(exports2, module2) {
10039
+ "use strict";
9770
10040
  var compare = require_compare();
9771
10041
  var lte = (a, b, loose) => compare(a, b, loose) <= 0;
9772
10042
  module2.exports = lte;
@@ -9776,6 +10046,7 @@ var require_lte = __commonJS({
9776
10046
  // node_modules/semver/functions/cmp.js
9777
10047
  var require_cmp = __commonJS({
9778
10048
  "node_modules/semver/functions/cmp.js"(exports2, module2) {
10049
+ "use strict";
9779
10050
  var eq = require_eq();
9780
10051
  var neq = require_neq();
9781
10052
  var gt = require_gt();
@@ -9825,6 +10096,7 @@ var require_cmp = __commonJS({
9825
10096
  // node_modules/semver/functions/coerce.js
9826
10097
  var require_coerce = __commonJS({
9827
10098
  "node_modules/semver/functions/coerce.js"(exports2, module2) {
10099
+ "use strict";
9828
10100
  var SemVer = require_semver();
9829
10101
  var parse = require_parse();
9830
10102
  var { re, t } = require_re();
@@ -10517,6 +10789,7 @@ var require_lru_cache = __commonJS({
10517
10789
  // node_modules/semver/classes/range.js
10518
10790
  var require_range = __commonJS({
10519
10791
  "node_modules/semver/classes/range.js"(exports2, module2) {
10792
+ "use strict";
10520
10793
  var Range = class {
10521
10794
  constructor(range, options) {
10522
10795
  options = parseOptions(options);
@@ -10878,6 +11151,7 @@ var require_range = __commonJS({
10878
11151
  // node_modules/semver/classes/comparator.js
10879
11152
  var require_comparator = __commonJS({
10880
11153
  "node_modules/semver/classes/comparator.js"(exports2, module2) {
11154
+ "use strict";
10881
11155
  var ANY = Symbol("SemVer ANY");
10882
11156
  var Comparator = class {
10883
11157
  static get ANY() {
@@ -10989,6 +11263,7 @@ var require_comparator = __commonJS({
10989
11263
  // node_modules/semver/functions/satisfies.js
10990
11264
  var require_satisfies = __commonJS({
10991
11265
  "node_modules/semver/functions/satisfies.js"(exports2, module2) {
11266
+ "use strict";
10992
11267
  var Range = require_range();
10993
11268
  var satisfies = (version, range, options) => {
10994
11269
  try {
@@ -11005,6 +11280,7 @@ var require_satisfies = __commonJS({
11005
11280
  // node_modules/semver/ranges/to-comparators.js
11006
11281
  var require_to_comparators = __commonJS({
11007
11282
  "node_modules/semver/ranges/to-comparators.js"(exports2, module2) {
11283
+ "use strict";
11008
11284
  var Range = require_range();
11009
11285
  var toComparators = (range, options) => new Range(range, options).set.map((comp) => comp.map((c) => c.value).join(" ").trim().split(" "));
11010
11286
  module2.exports = toComparators;
@@ -11014,6 +11290,7 @@ var require_to_comparators = __commonJS({
11014
11290
  // node_modules/semver/ranges/max-satisfying.js
11015
11291
  var require_max_satisfying = __commonJS({
11016
11292
  "node_modules/semver/ranges/max-satisfying.js"(exports2, module2) {
11293
+ "use strict";
11017
11294
  var SemVer = require_semver();
11018
11295
  var Range = require_range();
11019
11296
  var maxSatisfying = (versions, range, options) => {
@@ -11042,6 +11319,7 @@ var require_max_satisfying = __commonJS({
11042
11319
  // node_modules/semver/ranges/min-satisfying.js
11043
11320
  var require_min_satisfying = __commonJS({
11044
11321
  "node_modules/semver/ranges/min-satisfying.js"(exports2, module2) {
11322
+ "use strict";
11045
11323
  var SemVer = require_semver();
11046
11324
  var Range = require_range();
11047
11325
  var minSatisfying = (versions, range, options) => {
@@ -11070,6 +11348,7 @@ var require_min_satisfying = __commonJS({
11070
11348
  // node_modules/semver/ranges/min-version.js
11071
11349
  var require_min_version = __commonJS({
11072
11350
  "node_modules/semver/ranges/min-version.js"(exports2, module2) {
11351
+ "use strict";
11073
11352
  var SemVer = require_semver();
11074
11353
  var Range = require_range();
11075
11354
  var gt = require_gt();
@@ -11126,6 +11405,7 @@ var require_min_version = __commonJS({
11126
11405
  // node_modules/semver/ranges/valid.js
11127
11406
  var require_valid2 = __commonJS({
11128
11407
  "node_modules/semver/ranges/valid.js"(exports2, module2) {
11408
+ "use strict";
11129
11409
  var Range = require_range();
11130
11410
  var validRange = (range, options) => {
11131
11411
  try {
@@ -11141,6 +11421,7 @@ var require_valid2 = __commonJS({
11141
11421
  // node_modules/semver/ranges/outside.js
11142
11422
  var require_outside = __commonJS({
11143
11423
  "node_modules/semver/ranges/outside.js"(exports2, module2) {
11424
+ "use strict";
11144
11425
  var SemVer = require_semver();
11145
11426
  var Comparator = require_comparator();
11146
11427
  var { ANY } = Comparator;
@@ -11209,6 +11490,7 @@ var require_outside = __commonJS({
11209
11490
  // node_modules/semver/ranges/gtr.js
11210
11491
  var require_gtr = __commonJS({
11211
11492
  "node_modules/semver/ranges/gtr.js"(exports2, module2) {
11493
+ "use strict";
11212
11494
  var outside = require_outside();
11213
11495
  var gtr = (version, range, options) => outside(version, range, ">", options);
11214
11496
  module2.exports = gtr;
@@ -11218,6 +11500,7 @@ var require_gtr = __commonJS({
11218
11500
  // node_modules/semver/ranges/ltr.js
11219
11501
  var require_ltr = __commonJS({
11220
11502
  "node_modules/semver/ranges/ltr.js"(exports2, module2) {
11503
+ "use strict";
11221
11504
  var outside = require_outside();
11222
11505
  var ltr = (version, range, options) => outside(version, range, "<", options);
11223
11506
  module2.exports = ltr;
@@ -11227,6 +11510,7 @@ var require_ltr = __commonJS({
11227
11510
  // node_modules/semver/ranges/intersects.js
11228
11511
  var require_intersects = __commonJS({
11229
11512
  "node_modules/semver/ranges/intersects.js"(exports2, module2) {
11513
+ "use strict";
11230
11514
  var Range = require_range();
11231
11515
  var intersects = (r1, r2, options) => {
11232
11516
  r1 = new Range(r1, options);
@@ -11240,6 +11524,7 @@ var require_intersects = __commonJS({
11240
11524
  // node_modules/semver/ranges/simplify.js
11241
11525
  var require_simplify = __commonJS({
11242
11526
  "node_modules/semver/ranges/simplify.js"(exports2, module2) {
11527
+ "use strict";
11243
11528
  var satisfies = require_satisfies();
11244
11529
  var compare = require_compare();
11245
11530
  module2.exports = (versions, range, options) => {
@@ -11289,6 +11574,7 @@ var require_simplify = __commonJS({
11289
11574
  // node_modules/semver/ranges/subset.js
11290
11575
  var require_subset = __commonJS({
11291
11576
  "node_modules/semver/ranges/subset.js"(exports2, module2) {
11577
+ "use strict";
11292
11578
  var Range = require_range();
11293
11579
  var Comparator = require_comparator();
11294
11580
  var { ANY } = Comparator;
@@ -11451,6 +11737,7 @@ var require_subset = __commonJS({
11451
11737
  // node_modules/semver/index.js
11452
11738
  var require_semver2 = __commonJS({
11453
11739
  "node_modules/semver/index.js"(exports2, module2) {
11740
+ "use strict";
11454
11741
  var internalRe = require_re();
11455
11742
  var constants = require_constants();
11456
11743
  var SemVer = require_semver();
@@ -11545,6 +11832,7 @@ var require_semver2 = __commonJS({
11545
11832
  // node_modules/jsonwebtoken/lib/asymmetricKeyDetailsSupported.js
11546
11833
  var require_asymmetricKeyDetailsSupported = __commonJS({
11547
11834
  "node_modules/jsonwebtoken/lib/asymmetricKeyDetailsSupported.js"(exports2, module2) {
11835
+ "use strict";
11548
11836
  var semver = require_semver2();
11549
11837
  module2.exports = semver.satisfies(process.version, ">=15.7.0");
11550
11838
  }
@@ -11553,6 +11841,7 @@ var require_asymmetricKeyDetailsSupported = __commonJS({
11553
11841
  // node_modules/jsonwebtoken/lib/rsaPssKeyDetailsSupported.js
11554
11842
  var require_rsaPssKeyDetailsSupported = __commonJS({
11555
11843
  "node_modules/jsonwebtoken/lib/rsaPssKeyDetailsSupported.js"(exports2, module2) {
11844
+ "use strict";
11556
11845
  var semver = require_semver2();
11557
11846
  module2.exports = semver.satisfies(process.version, ">=16.9.0");
11558
11847
  }
@@ -11561,6 +11850,7 @@ var require_rsaPssKeyDetailsSupported = __commonJS({
11561
11850
  // node_modules/jsonwebtoken/lib/validateAsymmetricKey.js
11562
11851
  var require_validateAsymmetricKey = __commonJS({
11563
11852
  "node_modules/jsonwebtoken/lib/validateAsymmetricKey.js"(exports2, module2) {
11853
+ "use strict";
11564
11854
  var ASYMMETRIC_KEY_DETAILS_SUPPORTED = require_asymmetricKeyDetailsSupported();
11565
11855
  var RSA_PSS_KEY_DETAILS_SUPPORTED = require_rsaPssKeyDetailsSupported();
11566
11856
  var allowedAlgorithmsForKeys = {
@@ -11616,6 +11906,7 @@ var require_validateAsymmetricKey = __commonJS({
11616
11906
  // node_modules/jsonwebtoken/lib/psSupported.js
11617
11907
  var require_psSupported = __commonJS({
11618
11908
  "node_modules/jsonwebtoken/lib/psSupported.js"(exports2, module2) {
11909
+ "use strict";
11619
11910
  var semver = require_semver2();
11620
11911
  module2.exports = semver.satisfies(process.version, "^6.12.0 || >=8.0.0");
11621
11912
  }
@@ -11624,6 +11915,7 @@ var require_psSupported = __commonJS({
11624
11915
  // node_modules/jsonwebtoken/verify.js
11625
11916
  var require_verify = __commonJS({
11626
11917
  "node_modules/jsonwebtoken/verify.js"(exports2, module2) {
11918
+ "use strict";
11627
11919
  var JsonWebTokenError = require_JsonWebTokenError();
11628
11920
  var NotBeforeError = require_NotBeforeError();
11629
11921
  var TokenExpiredError = require_TokenExpiredError();
@@ -11840,6 +12132,7 @@ var require_verify = __commonJS({
11840
12132
  // node_modules/lodash/lodash.js
11841
12133
  var require_lodash = __commonJS({
11842
12134
  "node_modules/lodash/lodash.js"(exports2, module2) {
12135
+ "use strict";
11843
12136
  (function() {
11844
12137
  var undefined2;
11845
12138
  var VERSION = "4.17.21";
@@ -12555,10 +12848,10 @@ var require_lodash = __commonJS({
12555
12848
  }();
12556
12849
  var ctxClearTimeout = context.clearTimeout !== root.clearTimeout && context.clearTimeout, ctxNow = Date2 && Date2.now !== root.Date.now && Date2.now, ctxSetTimeout = context.setTimeout !== root.setTimeout && context.setTimeout;
12557
12850
  var nativeCeil = Math2.ceil, nativeFloor = Math2.floor, nativeGetSymbols = Object2.getOwnPropertySymbols, nativeIsBuffer = Buffer2 ? Buffer2.isBuffer : undefined2, nativeIsFinite = context.isFinite, nativeJoin = arrayProto.join, nativeKeys = overArg(Object2.keys, Object2), nativeMax = Math2.max, nativeMin = Math2.min, nativeNow = Date2.now, nativeParseInt = context.parseInt, nativeRandom = Math2.random, nativeReverse = arrayProto.reverse;
12558
- var DataView = getNative(context, "DataView"), Map2 = getNative(context, "Map"), Promise2 = getNative(context, "Promise"), Set2 = getNative(context, "Set"), WeakMap = getNative(context, "WeakMap"), nativeCreate = getNative(Object2, "create");
12559
- var metaMap = WeakMap && new WeakMap();
12851
+ var DataView = getNative(context, "DataView"), Map2 = getNative(context, "Map"), Promise2 = getNative(context, "Promise"), Set2 = getNative(context, "Set"), WeakMap2 = getNative(context, "WeakMap"), nativeCreate = getNative(Object2, "create");
12852
+ var metaMap = WeakMap2 && new WeakMap2();
12560
12853
  var realNames = {};
12561
- var dataViewCtorString = toSource(DataView), mapCtorString = toSource(Map2), promiseCtorString = toSource(Promise2), setCtorString = toSource(Set2), weakMapCtorString = toSource(WeakMap);
12854
+ var dataViewCtorString = toSource(DataView), mapCtorString = toSource(Map2), promiseCtorString = toSource(Promise2), setCtorString = toSource(Set2), weakMapCtorString = toSource(WeakMap2);
12562
12855
  var symbolProto = Symbol2 ? Symbol2.prototype : undefined2, symbolValueOf = symbolProto ? symbolProto.valueOf : undefined2, symbolToString = symbolProto ? symbolProto.toString : undefined2;
12563
12856
  function lodash(value) {
12564
12857
  if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) {
@@ -14612,7 +14905,7 @@ var require_lodash = __commonJS({
14612
14905
  return result2;
14613
14906
  };
14614
14907
  var getTag = baseGetTag;
14615
- if (DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag || Map2 && getTag(new Map2()) != mapTag || Promise2 && getTag(Promise2.resolve()) != promiseTag || Set2 && getTag(new Set2()) != setTag || WeakMap && getTag(new WeakMap()) != weakMapTag) {
14908
+ if (DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag || Map2 && getTag(new Map2()) != mapTag || Promise2 && getTag(Promise2.resolve()) != promiseTag || Set2 && getTag(new Set2()) != setTag || WeakMap2 && getTag(new WeakMap2()) != weakMapTag) {
14616
14909
  getTag = function(value) {
14617
14910
  var result2 = baseGetTag(value), Ctor = result2 == objectTag ? value.constructor : undefined2, ctorString = Ctor ? toSource(Ctor) : "";
14618
14911
  if (ctorString) {
@@ -17320,6 +17613,7 @@ var require_lodash = __commonJS({
17320
17613
  // node_modules/jsonwebtoken/sign.js
17321
17614
  var require_sign = __commonJS({
17322
17615
  "node_modules/jsonwebtoken/sign.js"(exports2, module2) {
17616
+ "use strict";
17323
17617
  var timespan = require_timespan();
17324
17618
  var PS_SUPPORTED = require_psSupported();
17325
17619
  var validateAsymmetricKey = require_validateAsymmetricKey();
@@ -17539,6 +17833,7 @@ var require_sign = __commonJS({
17539
17833
  // node_modules/jsonwebtoken/index.js
17540
17834
  var require_jsonwebtoken = __commonJS({
17541
17835
  "node_modules/jsonwebtoken/index.js"(exports2, module2) {
17836
+ "use strict";
17542
17837
  module2.exports = {
17543
17838
  verify: require_verify(),
17544
17839
  sign: require_sign(),
@@ -17596,298 +17891,1290 @@ var require_dist_node11 = __commonJS({
17596
17891
  }
17597
17892
  });
17598
17893
 
17599
- // node_modules/@octokit/auth-app/node_modules/lru-cache/index.js
17600
- var require_lru_cache2 = __commonJS({
17601
- "node_modules/@octokit/auth-app/node_modules/lru-cache/index.js"(exports2, module2) {
17894
+ // node_modules/@octokit/auth-app/node_modules/lru-cache/dist/cjs/index.js
17895
+ var require_cjs = __commonJS({
17896
+ "node_modules/@octokit/auth-app/node_modules/lru-cache/dist/cjs/index.js"(exports2) {
17602
17897
  "use strict";
17603
- var Yallist = require_yallist();
17604
- var MAX = Symbol("max");
17605
- var LENGTH = Symbol("length");
17606
- var LENGTH_CALCULATOR = Symbol("lengthCalculator");
17607
- var ALLOW_STALE = Symbol("allowStale");
17608
- var MAX_AGE = Symbol("maxAge");
17609
- var DISPOSE = Symbol("dispose");
17610
- var NO_DISPOSE_ON_SET = Symbol("noDisposeOnSet");
17611
- var LRU_LIST = Symbol("lruList");
17612
- var CACHE = Symbol("cache");
17613
- var UPDATE_AGE_ON_GET = Symbol("updateAgeOnGet");
17614
- var naiveLength = () => 1;
17898
+ Object.defineProperty(exports2, "__esModule", { value: true });
17899
+ exports2.LRUCache = void 0;
17900
+ var perf = typeof performance === "object" && performance && typeof performance.now === "function" ? performance : Date;
17901
+ var warned = /* @__PURE__ */ new Set();
17902
+ var PROCESS = typeof process === "object" && !!process ? process : {};
17903
+ var emitWarning = (msg, type, code, fn) => {
17904
+ typeof PROCESS.emitWarning === "function" ? PROCESS.emitWarning(msg, type, code, fn) : console.error(`[${code}] ${type}: ${msg}`);
17905
+ };
17906
+ var AC = globalThis.AbortController;
17907
+ var AS = globalThis.AbortSignal;
17908
+ var _a;
17909
+ if (typeof AC === "undefined") {
17910
+ AS = class AbortSignal {
17911
+ onabort;
17912
+ _onabort = [];
17913
+ reason;
17914
+ aborted = false;
17915
+ addEventListener(_, fn) {
17916
+ this._onabort.push(fn);
17917
+ }
17918
+ };
17919
+ AC = class AbortController {
17920
+ constructor() {
17921
+ warnACPolyfill();
17922
+ }
17923
+ signal = new AS();
17924
+ abort(reason) {
17925
+ var _a2, _b;
17926
+ if (this.signal.aborted)
17927
+ return;
17928
+ this.signal.reason = reason;
17929
+ this.signal.aborted = true;
17930
+ for (const fn of this.signal._onabort) {
17931
+ fn(reason);
17932
+ }
17933
+ (_b = (_a2 = this.signal).onabort) == null ? void 0 : _b.call(_a2, reason);
17934
+ }
17935
+ };
17936
+ let printACPolyfillWarning = ((_a = PROCESS.env) == null ? void 0 : _a.LRU_CACHE_IGNORE_AC_WARNING) !== "1";
17937
+ const warnACPolyfill = () => {
17938
+ if (!printACPolyfillWarning)
17939
+ return;
17940
+ printACPolyfillWarning = false;
17941
+ emitWarning("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.", "NO_ABORT_CONTROLLER", "ENOTSUP", warnACPolyfill);
17942
+ };
17943
+ }
17944
+ var shouldWarn = (code) => !warned.has(code);
17945
+ var TYPE = Symbol("type");
17946
+ var isPosInt = (n) => n && n === Math.floor(n) && n > 0 && isFinite(n);
17947
+ var getUintArray = (max) => !isPosInt(max) ? null : max <= Math.pow(2, 8) ? Uint8Array : max <= Math.pow(2, 16) ? Uint16Array : max <= Math.pow(2, 32) ? Uint32Array : max <= Number.MAX_SAFE_INTEGER ? ZeroArray : null;
17948
+ var ZeroArray = class extends Array {
17949
+ constructor(size) {
17950
+ super(size);
17951
+ this.fill(0);
17952
+ }
17953
+ };
17954
+ var _constructing;
17955
+ var _Stack = class {
17956
+ heap;
17957
+ length;
17958
+ static create(max) {
17959
+ const HeapCls = getUintArray(max);
17960
+ if (!HeapCls)
17961
+ return [];
17962
+ __privateSet(_Stack, _constructing, true);
17963
+ const s = new _Stack(max, HeapCls);
17964
+ __privateSet(_Stack, _constructing, false);
17965
+ return s;
17966
+ }
17967
+ constructor(max, HeapCls) {
17968
+ if (!__privateGet(_Stack, _constructing)) {
17969
+ throw new TypeError("instantiate Stack using Stack.create(n)");
17970
+ }
17971
+ this.heap = new HeapCls(max);
17972
+ this.length = 0;
17973
+ }
17974
+ push(n) {
17975
+ this.heap[this.length++] = n;
17976
+ }
17977
+ pop() {
17978
+ return this.heap[--this.length];
17979
+ }
17980
+ };
17981
+ var Stack = _Stack;
17982
+ _constructing = new WeakMap();
17983
+ // private constructor
17984
+ __privateAdd(Stack, _constructing, false);
17615
17985
  var LRUCache = class {
17986
+ // properties coming in from the options of these, only max and maxSize
17987
+ // really *need* to be protected. The rest can be modified, as they just
17988
+ // set defaults for various methods.
17989
+ #max;
17990
+ #maxSize;
17991
+ #dispose;
17992
+ #disposeAfter;
17993
+ #fetchMethod;
17994
+ /**
17995
+ * {@link LRUCache.OptionsBase.ttl}
17996
+ */
17997
+ ttl;
17998
+ /**
17999
+ * {@link LRUCache.OptionsBase.ttlResolution}
18000
+ */
18001
+ ttlResolution;
18002
+ /**
18003
+ * {@link LRUCache.OptionsBase.ttlAutopurge}
18004
+ */
18005
+ ttlAutopurge;
18006
+ /**
18007
+ * {@link LRUCache.OptionsBase.updateAgeOnGet}
18008
+ */
18009
+ updateAgeOnGet;
18010
+ /**
18011
+ * {@link LRUCache.OptionsBase.updateAgeOnHas}
18012
+ */
18013
+ updateAgeOnHas;
18014
+ /**
18015
+ * {@link LRUCache.OptionsBase.allowStale}
18016
+ */
18017
+ allowStale;
18018
+ /**
18019
+ * {@link LRUCache.OptionsBase.noDisposeOnSet}
18020
+ */
18021
+ noDisposeOnSet;
18022
+ /**
18023
+ * {@link LRUCache.OptionsBase.noUpdateTTL}
18024
+ */
18025
+ noUpdateTTL;
18026
+ /**
18027
+ * {@link LRUCache.OptionsBase.maxEntrySize}
18028
+ */
18029
+ maxEntrySize;
18030
+ /**
18031
+ * {@link LRUCache.OptionsBase.sizeCalculation}
18032
+ */
18033
+ sizeCalculation;
18034
+ /**
18035
+ * {@link LRUCache.OptionsBase.noDeleteOnFetchRejection}
18036
+ */
18037
+ noDeleteOnFetchRejection;
18038
+ /**
18039
+ * {@link LRUCache.OptionsBase.noDeleteOnStaleGet}
18040
+ */
18041
+ noDeleteOnStaleGet;
18042
+ /**
18043
+ * {@link LRUCache.OptionsBase.allowStaleOnFetchAbort}
18044
+ */
18045
+ allowStaleOnFetchAbort;
18046
+ /**
18047
+ * {@link LRUCache.OptionsBase.allowStaleOnFetchRejection}
18048
+ */
18049
+ allowStaleOnFetchRejection;
18050
+ /**
18051
+ * {@link LRUCache.OptionsBase.ignoreFetchAbort}
18052
+ */
18053
+ ignoreFetchAbort;
18054
+ // computed properties
18055
+ #size;
18056
+ #calculatedSize;
18057
+ #keyMap;
18058
+ #keyList;
18059
+ #valList;
18060
+ #next;
18061
+ #prev;
18062
+ #head;
18063
+ #tail;
18064
+ #free;
18065
+ #disposed;
18066
+ #sizes;
18067
+ #starts;
18068
+ #ttls;
18069
+ #hasDispose;
18070
+ #hasFetchMethod;
18071
+ #hasDisposeAfter;
18072
+ /**
18073
+ * Do not call this method unless you need to inspect the
18074
+ * inner workings of the cache. If anything returned by this
18075
+ * object is modified in any way, strange breakage may occur.
18076
+ *
18077
+ * These fields are private for a reason!
18078
+ *
18079
+ * @internal
18080
+ */
18081
+ static unsafeExposeInternals(c) {
18082
+ return {
18083
+ // properties
18084
+ starts: c.#starts,
18085
+ ttls: c.#ttls,
18086
+ sizes: c.#sizes,
18087
+ keyMap: c.#keyMap,
18088
+ keyList: c.#keyList,
18089
+ valList: c.#valList,
18090
+ next: c.#next,
18091
+ prev: c.#prev,
18092
+ get head() {
18093
+ return c.#head;
18094
+ },
18095
+ get tail() {
18096
+ return c.#tail;
18097
+ },
18098
+ free: c.#free,
18099
+ // methods
18100
+ isBackgroundFetch: (p) => c.#isBackgroundFetch(p),
18101
+ backgroundFetch: (k, index, options, context) => c.#backgroundFetch(k, index, options, context),
18102
+ moveToTail: (index) => c.#moveToTail(index),
18103
+ indexes: (options) => c.#indexes(options),
18104
+ rindexes: (options) => c.#rindexes(options),
18105
+ isStale: (index) => c.#isStale(index)
18106
+ };
18107
+ }
18108
+ // Protected read-only members
18109
+ /**
18110
+ * {@link LRUCache.OptionsBase.max} (read-only)
18111
+ */
18112
+ get max() {
18113
+ return this.#max;
18114
+ }
18115
+ /**
18116
+ * {@link LRUCache.OptionsBase.maxSize} (read-only)
18117
+ */
18118
+ get maxSize() {
18119
+ return this.#maxSize;
18120
+ }
18121
+ /**
18122
+ * The total computed size of items in the cache (read-only)
18123
+ */
18124
+ get calculatedSize() {
18125
+ return this.#calculatedSize;
18126
+ }
18127
+ /**
18128
+ * The number of items stored in the cache (read-only)
18129
+ */
18130
+ get size() {
18131
+ return this.#size;
18132
+ }
18133
+ /**
18134
+ * {@link LRUCache.OptionsBase.fetchMethod} (read-only)
18135
+ */
18136
+ get fetchMethod() {
18137
+ return this.#fetchMethod;
18138
+ }
18139
+ /**
18140
+ * {@link LRUCache.OptionsBase.dispose} (read-only)
18141
+ */
18142
+ get dispose() {
18143
+ return this.#dispose;
18144
+ }
18145
+ /**
18146
+ * {@link LRUCache.OptionsBase.disposeAfter} (read-only)
18147
+ */
18148
+ get disposeAfter() {
18149
+ return this.#disposeAfter;
18150
+ }
17616
18151
  constructor(options) {
17617
- if (typeof options === "number")
17618
- options = { max: options };
17619
- if (!options)
17620
- options = {};
17621
- if (options.max && (typeof options.max !== "number" || options.max < 0))
17622
- throw new TypeError("max must be a non-negative number");
17623
- const max = this[MAX] = options.max || Infinity;
17624
- const lc = options.length || naiveLength;
17625
- this[LENGTH_CALCULATOR] = typeof lc !== "function" ? naiveLength : lc;
17626
- this[ALLOW_STALE] = options.stale || false;
17627
- if (options.maxAge && typeof options.maxAge !== "number")
17628
- throw new TypeError("maxAge must be a number");
17629
- this[MAX_AGE] = options.maxAge || 0;
17630
- this[DISPOSE] = options.dispose;
17631
- this[NO_DISPOSE_ON_SET] = options.noDisposeOnSet || false;
17632
- this[UPDATE_AGE_ON_GET] = options.updateAgeOnGet || false;
17633
- this.reset();
18152
+ const { max = 0, ttl, ttlResolution = 1, ttlAutopurge, updateAgeOnGet, updateAgeOnHas, allowStale, dispose, disposeAfter, noDisposeOnSet, noUpdateTTL, maxSize = 0, maxEntrySize = 0, sizeCalculation, fetchMethod, noDeleteOnFetchRejection, noDeleteOnStaleGet, allowStaleOnFetchRejection, allowStaleOnFetchAbort, ignoreFetchAbort } = options;
18153
+ if (max !== 0 && !isPosInt(max)) {
18154
+ throw new TypeError("max option must be a nonnegative integer");
18155
+ }
18156
+ const UintArray = max ? getUintArray(max) : Array;
18157
+ if (!UintArray) {
18158
+ throw new Error("invalid max value: " + max);
18159
+ }
18160
+ this.#max = max;
18161
+ this.#maxSize = maxSize;
18162
+ this.maxEntrySize = maxEntrySize || this.#maxSize;
18163
+ this.sizeCalculation = sizeCalculation;
18164
+ if (this.sizeCalculation) {
18165
+ if (!this.#maxSize && !this.maxEntrySize) {
18166
+ throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");
18167
+ }
18168
+ if (typeof this.sizeCalculation !== "function") {
18169
+ throw new TypeError("sizeCalculation set to non-function");
18170
+ }
18171
+ }
18172
+ if (fetchMethod !== void 0 && typeof fetchMethod !== "function") {
18173
+ throw new TypeError("fetchMethod must be a function if specified");
18174
+ }
18175
+ this.#fetchMethod = fetchMethod;
18176
+ this.#hasFetchMethod = !!fetchMethod;
18177
+ this.#keyMap = /* @__PURE__ */ new Map();
18178
+ this.#keyList = new Array(max).fill(void 0);
18179
+ this.#valList = new Array(max).fill(void 0);
18180
+ this.#next = new UintArray(max);
18181
+ this.#prev = new UintArray(max);
18182
+ this.#head = 0;
18183
+ this.#tail = 0;
18184
+ this.#free = Stack.create(max);
18185
+ this.#size = 0;
18186
+ this.#calculatedSize = 0;
18187
+ if (typeof dispose === "function") {
18188
+ this.#dispose = dispose;
18189
+ }
18190
+ if (typeof disposeAfter === "function") {
18191
+ this.#disposeAfter = disposeAfter;
18192
+ this.#disposed = [];
18193
+ } else {
18194
+ this.#disposeAfter = void 0;
18195
+ this.#disposed = void 0;
18196
+ }
18197
+ this.#hasDispose = !!this.#dispose;
18198
+ this.#hasDisposeAfter = !!this.#disposeAfter;
18199
+ this.noDisposeOnSet = !!noDisposeOnSet;
18200
+ this.noUpdateTTL = !!noUpdateTTL;
18201
+ this.noDeleteOnFetchRejection = !!noDeleteOnFetchRejection;
18202
+ this.allowStaleOnFetchRejection = !!allowStaleOnFetchRejection;
18203
+ this.allowStaleOnFetchAbort = !!allowStaleOnFetchAbort;
18204
+ this.ignoreFetchAbort = !!ignoreFetchAbort;
18205
+ if (this.maxEntrySize !== 0) {
18206
+ if (this.#maxSize !== 0) {
18207
+ if (!isPosInt(this.#maxSize)) {
18208
+ throw new TypeError("maxSize must be a positive integer if specified");
18209
+ }
18210
+ }
18211
+ if (!isPosInt(this.maxEntrySize)) {
18212
+ throw new TypeError("maxEntrySize must be a positive integer if specified");
18213
+ }
18214
+ this.#initializeSizeTracking();
18215
+ }
18216
+ this.allowStale = !!allowStale;
18217
+ this.noDeleteOnStaleGet = !!noDeleteOnStaleGet;
18218
+ this.updateAgeOnGet = !!updateAgeOnGet;
18219
+ this.updateAgeOnHas = !!updateAgeOnHas;
18220
+ this.ttlResolution = isPosInt(ttlResolution) || ttlResolution === 0 ? ttlResolution : 1;
18221
+ this.ttlAutopurge = !!ttlAutopurge;
18222
+ this.ttl = ttl || 0;
18223
+ if (this.ttl) {
18224
+ if (!isPosInt(this.ttl)) {
18225
+ throw new TypeError("ttl must be a positive integer if specified");
18226
+ }
18227
+ this.#initializeTTLTracking();
18228
+ }
18229
+ if (this.#max === 0 && this.ttl === 0 && this.#maxSize === 0) {
18230
+ throw new TypeError("At least one of max, maxSize, or ttl is required");
18231
+ }
18232
+ if (!this.ttlAutopurge && !this.#max && !this.#maxSize) {
18233
+ const code = "LRU_CACHE_UNBOUNDED";
18234
+ if (shouldWarn(code)) {
18235
+ warned.add(code);
18236
+ const msg = "TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.";
18237
+ emitWarning(msg, "UnboundedCacheWarning", code, LRUCache);
18238
+ }
18239
+ }
17634
18240
  }
17635
- // resize the cache when the max changes.
17636
- set max(mL) {
17637
- if (typeof mL !== "number" || mL < 0)
17638
- throw new TypeError("max must be a non-negative number");
17639
- this[MAX] = mL || Infinity;
17640
- trim(this);
18241
+ /**
18242
+ * Return the remaining TTL time for a given entry key
18243
+ */
18244
+ getRemainingTTL(key) {
18245
+ return this.#keyMap.has(key) ? Infinity : 0;
18246
+ }
18247
+ #initializeTTLTracking() {
18248
+ const ttls = new ZeroArray(this.#max);
18249
+ const starts = new ZeroArray(this.#max);
18250
+ this.#ttls = ttls;
18251
+ this.#starts = starts;
18252
+ this.#setItemTTL = (index, ttl, start = perf.now()) => {
18253
+ starts[index] = ttl !== 0 ? start : 0;
18254
+ ttls[index] = ttl;
18255
+ if (ttl !== 0 && this.ttlAutopurge) {
18256
+ const t = setTimeout(() => {
18257
+ if (this.#isStale(index)) {
18258
+ this.delete(this.#keyList[index]);
18259
+ }
18260
+ }, ttl + 1);
18261
+ if (t.unref) {
18262
+ t.unref();
18263
+ }
18264
+ }
18265
+ };
18266
+ this.#updateItemAge = (index) => {
18267
+ starts[index] = ttls[index] !== 0 ? perf.now() : 0;
18268
+ };
18269
+ this.#statusTTL = (status, index) => {
18270
+ if (ttls[index]) {
18271
+ const ttl = ttls[index];
18272
+ const start = starts[index];
18273
+ status.ttl = ttl;
18274
+ status.start = start;
18275
+ status.now = cachedNow || getNow();
18276
+ const age = status.now - start;
18277
+ status.remainingTTL = ttl - age;
18278
+ }
18279
+ };
18280
+ let cachedNow = 0;
18281
+ const getNow = () => {
18282
+ const n = perf.now();
18283
+ if (this.ttlResolution > 0) {
18284
+ cachedNow = n;
18285
+ const t = setTimeout(() => cachedNow = 0, this.ttlResolution);
18286
+ if (t.unref) {
18287
+ t.unref();
18288
+ }
18289
+ }
18290
+ return n;
18291
+ };
18292
+ this.getRemainingTTL = (key) => {
18293
+ const index = this.#keyMap.get(key);
18294
+ if (index === void 0) {
18295
+ return 0;
18296
+ }
18297
+ const ttl = ttls[index];
18298
+ const start = starts[index];
18299
+ if (ttl === 0 || start === 0) {
18300
+ return Infinity;
18301
+ }
18302
+ const age = (cachedNow || getNow()) - start;
18303
+ return ttl - age;
18304
+ };
18305
+ this.#isStale = (index) => {
18306
+ return ttls[index] !== 0 && starts[index] !== 0 && (cachedNow || getNow()) - starts[index] > ttls[index];
18307
+ };
17641
18308
  }
17642
- get max() {
17643
- return this[MAX];
18309
+ // conditionally set private methods related to TTL
18310
+ #updateItemAge = () => {
18311
+ };
18312
+ #statusTTL = () => {
18313
+ };
18314
+ #setItemTTL = () => {
18315
+ };
18316
+ /* c8 ignore stop */
18317
+ #isStale = () => false;
18318
+ #initializeSizeTracking() {
18319
+ const sizes = new ZeroArray(this.#max);
18320
+ this.#calculatedSize = 0;
18321
+ this.#sizes = sizes;
18322
+ this.#removeItemSize = (index) => {
18323
+ this.#calculatedSize -= sizes[index];
18324
+ sizes[index] = 0;
18325
+ };
18326
+ this.#requireSize = (k, v, size, sizeCalculation) => {
18327
+ if (this.#isBackgroundFetch(v)) {
18328
+ return 0;
18329
+ }
18330
+ if (!isPosInt(size)) {
18331
+ if (sizeCalculation) {
18332
+ if (typeof sizeCalculation !== "function") {
18333
+ throw new TypeError("sizeCalculation must be a function");
18334
+ }
18335
+ size = sizeCalculation(v, k);
18336
+ if (!isPosInt(size)) {
18337
+ throw new TypeError("sizeCalculation return invalid (expect positive integer)");
18338
+ }
18339
+ } else {
18340
+ throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");
18341
+ }
18342
+ }
18343
+ return size;
18344
+ };
18345
+ this.#addItemSize = (index, size, status) => {
18346
+ sizes[index] = size;
18347
+ if (this.#maxSize) {
18348
+ const maxSize = this.#maxSize - sizes[index];
18349
+ while (this.#calculatedSize > maxSize) {
18350
+ this.#evict(true);
18351
+ }
18352
+ }
18353
+ this.#calculatedSize += sizes[index];
18354
+ if (status) {
18355
+ status.entrySize = size;
18356
+ status.totalCalculatedSize = this.#calculatedSize;
18357
+ }
18358
+ };
17644
18359
  }
17645
- set allowStale(allowStale) {
17646
- this[ALLOW_STALE] = !!allowStale;
18360
+ #removeItemSize = (_i) => {
18361
+ };
18362
+ #addItemSize = (_i, _s, _st) => {
18363
+ };
18364
+ #requireSize = (_k, _v, size, sizeCalculation) => {
18365
+ if (size || sizeCalculation) {
18366
+ throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");
18367
+ }
18368
+ return 0;
18369
+ };
18370
+ *#indexes({ allowStale = this.allowStale } = {}) {
18371
+ if (this.#size) {
18372
+ for (let i = this.#tail; true; ) {
18373
+ if (!this.#isValidIndex(i)) {
18374
+ break;
18375
+ }
18376
+ if (allowStale || !this.#isStale(i)) {
18377
+ yield i;
18378
+ }
18379
+ if (i === this.#head) {
18380
+ break;
18381
+ } else {
18382
+ i = this.#prev[i];
18383
+ }
18384
+ }
18385
+ }
17647
18386
  }
17648
- get allowStale() {
17649
- return this[ALLOW_STALE];
18387
+ *#rindexes({ allowStale = this.allowStale } = {}) {
18388
+ if (this.#size) {
18389
+ for (let i = this.#head; true; ) {
18390
+ if (!this.#isValidIndex(i)) {
18391
+ break;
18392
+ }
18393
+ if (allowStale || !this.#isStale(i)) {
18394
+ yield i;
18395
+ }
18396
+ if (i === this.#tail) {
18397
+ break;
18398
+ } else {
18399
+ i = this.#next[i];
18400
+ }
18401
+ }
18402
+ }
17650
18403
  }
17651
- set maxAge(mA) {
17652
- if (typeof mA !== "number")
17653
- throw new TypeError("maxAge must be a non-negative number");
17654
- this[MAX_AGE] = mA;
17655
- trim(this);
18404
+ #isValidIndex(index) {
18405
+ return index !== void 0 && this.#keyMap.get(this.#keyList[index]) === index;
17656
18406
  }
17657
- get maxAge() {
17658
- return this[MAX_AGE];
18407
+ /**
18408
+ * Return a generator yielding `[key, value]` pairs,
18409
+ * in order from most recently used to least recently used.
18410
+ */
18411
+ *entries() {
18412
+ for (const i of this.#indexes()) {
18413
+ if (this.#valList[i] !== void 0 && this.#keyList[i] !== void 0 && !this.#isBackgroundFetch(this.#valList[i])) {
18414
+ yield [this.#keyList[i], this.#valList[i]];
18415
+ }
18416
+ }
17659
18417
  }
17660
- // resize the cache when the lengthCalculator changes.
17661
- set lengthCalculator(lC) {
17662
- if (typeof lC !== "function")
17663
- lC = naiveLength;
17664
- if (lC !== this[LENGTH_CALCULATOR]) {
17665
- this[LENGTH_CALCULATOR] = lC;
17666
- this[LENGTH] = 0;
17667
- this[LRU_LIST].forEach((hit) => {
17668
- hit.length = this[LENGTH_CALCULATOR](hit.value, hit.key);
17669
- this[LENGTH] += hit.length;
17670
- });
18418
+ /**
18419
+ * Inverse order version of {@link LRUCache.entries}
18420
+ *
18421
+ * Return a generator yielding `[key, value]` pairs,
18422
+ * in order from least recently used to most recently used.
18423
+ */
18424
+ *rentries() {
18425
+ for (const i of this.#rindexes()) {
18426
+ if (this.#valList[i] !== void 0 && this.#keyList[i] !== void 0 && !this.#isBackgroundFetch(this.#valList[i])) {
18427
+ yield [this.#keyList[i], this.#valList[i]];
18428
+ }
17671
18429
  }
17672
- trim(this);
17673
18430
  }
17674
- get lengthCalculator() {
17675
- return this[LENGTH_CALCULATOR];
18431
+ /**
18432
+ * Return a generator yielding the keys in the cache,
18433
+ * in order from most recently used to least recently used.
18434
+ */
18435
+ *keys() {
18436
+ for (const i of this.#indexes()) {
18437
+ const k = this.#keyList[i];
18438
+ if (k !== void 0 && !this.#isBackgroundFetch(this.#valList[i])) {
18439
+ yield k;
18440
+ }
18441
+ }
17676
18442
  }
17677
- get length() {
17678
- return this[LENGTH];
18443
+ /**
18444
+ * Inverse order version of {@link LRUCache.keys}
18445
+ *
18446
+ * Return a generator yielding the keys in the cache,
18447
+ * in order from least recently used to most recently used.
18448
+ */
18449
+ *rkeys() {
18450
+ for (const i of this.#rindexes()) {
18451
+ const k = this.#keyList[i];
18452
+ if (k !== void 0 && !this.#isBackgroundFetch(this.#valList[i])) {
18453
+ yield k;
18454
+ }
18455
+ }
17679
18456
  }
17680
- get itemCount() {
17681
- return this[LRU_LIST].length;
18457
+ /**
18458
+ * Return a generator yielding the values in the cache,
18459
+ * in order from most recently used to least recently used.
18460
+ */
18461
+ *values() {
18462
+ for (const i of this.#indexes()) {
18463
+ const v = this.#valList[i];
18464
+ if (v !== void 0 && !this.#isBackgroundFetch(this.#valList[i])) {
18465
+ yield this.#valList[i];
18466
+ }
18467
+ }
17682
18468
  }
17683
- rforEach(fn, thisp) {
17684
- thisp = thisp || this;
17685
- for (let walker = this[LRU_LIST].tail; walker !== null; ) {
17686
- const prev = walker.prev;
17687
- forEachStep(this, fn, walker, thisp);
17688
- walker = prev;
18469
+ /**
18470
+ * Inverse order version of {@link LRUCache.values}
18471
+ *
18472
+ * Return a generator yielding the values in the cache,
18473
+ * in order from least recently used to most recently used.
18474
+ */
18475
+ *rvalues() {
18476
+ for (const i of this.#rindexes()) {
18477
+ const v = this.#valList[i];
18478
+ if (v !== void 0 && !this.#isBackgroundFetch(this.#valList[i])) {
18479
+ yield this.#valList[i];
18480
+ }
17689
18481
  }
17690
18482
  }
17691
- forEach(fn, thisp) {
17692
- thisp = thisp || this;
17693
- for (let walker = this[LRU_LIST].head; walker !== null; ) {
17694
- const next = walker.next;
17695
- forEachStep(this, fn, walker, thisp);
17696
- walker = next;
18483
+ /**
18484
+ * Iterating over the cache itself yields the same results as
18485
+ * {@link LRUCache.entries}
18486
+ */
18487
+ [Symbol.iterator]() {
18488
+ return this.entries();
18489
+ }
18490
+ /**
18491
+ * Find a value for which the supplied fn method returns a truthy value,
18492
+ * similar to Array.find(). fn is called as fn(value, key, cache).
18493
+ */
18494
+ find(fn, getOptions = {}) {
18495
+ for (const i of this.#indexes()) {
18496
+ const v = this.#valList[i];
18497
+ const value = this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v;
18498
+ if (value === void 0)
18499
+ continue;
18500
+ if (fn(value, this.#keyList[i], this)) {
18501
+ return this.get(this.#keyList[i], getOptions);
18502
+ }
17697
18503
  }
17698
18504
  }
17699
- keys() {
17700
- return this[LRU_LIST].toArray().map((k) => k.key);
18505
+ /**
18506
+ * Call the supplied function on each item in the cache, in order from
18507
+ * most recently used to least recently used. fn is called as
18508
+ * fn(value, key, cache). Does not update age or recenty of use.
18509
+ * Does not iterate over stale values.
18510
+ */
18511
+ forEach(fn, thisp = this) {
18512
+ for (const i of this.#indexes()) {
18513
+ const v = this.#valList[i];
18514
+ const value = this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v;
18515
+ if (value === void 0)
18516
+ continue;
18517
+ fn.call(thisp, value, this.#keyList[i], this);
18518
+ }
17701
18519
  }
17702
- values() {
17703
- return this[LRU_LIST].toArray().map((k) => k.value);
18520
+ /**
18521
+ * The same as {@link LRUCache.forEach} but items are iterated over in
18522
+ * reverse order. (ie, less recently used items are iterated over first.)
18523
+ */
18524
+ rforEach(fn, thisp = this) {
18525
+ for (const i of this.#rindexes()) {
18526
+ const v = this.#valList[i];
18527
+ const value = this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v;
18528
+ if (value === void 0)
18529
+ continue;
18530
+ fn.call(thisp, value, this.#keyList[i], this);
18531
+ }
17704
18532
  }
17705
- reset() {
17706
- if (this[DISPOSE] && this[LRU_LIST] && this[LRU_LIST].length) {
17707
- this[LRU_LIST].forEach((hit) => this[DISPOSE](hit.key, hit.value));
18533
+ /**
18534
+ * Delete any stale entries. Returns true if anything was removed,
18535
+ * false otherwise.
18536
+ */
18537
+ purgeStale() {
18538
+ let deleted = false;
18539
+ for (const i of this.#rindexes({ allowStale: true })) {
18540
+ if (this.#isStale(i)) {
18541
+ this.delete(this.#keyList[i]);
18542
+ deleted = true;
18543
+ }
17708
18544
  }
17709
- this[CACHE] = /* @__PURE__ */ new Map();
17710
- this[LRU_LIST] = new Yallist();
17711
- this[LENGTH] = 0;
18545
+ return deleted;
17712
18546
  }
18547
+ /**
18548
+ * Return an array of [key, {@link LRUCache.Entry}] tuples which can be
18549
+ * passed to cache.load()
18550
+ */
17713
18551
  dump() {
17714
- return this[LRU_LIST].map((hit) => isStale(this, hit) ? false : {
17715
- k: hit.key,
17716
- v: hit.value,
17717
- e: hit.now + (hit.maxAge || 0)
17718
- }).toArray().filter((h) => h);
18552
+ const arr = [];
18553
+ for (const i of this.#indexes({ allowStale: true })) {
18554
+ const key = this.#keyList[i];
18555
+ const v = this.#valList[i];
18556
+ const value = this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v;
18557
+ if (value === void 0 || key === void 0)
18558
+ continue;
18559
+ const entry = { value };
18560
+ if (this.#ttls && this.#starts) {
18561
+ entry.ttl = this.#ttls[i];
18562
+ const age = perf.now() - this.#starts[i];
18563
+ entry.start = Math.floor(Date.now() - age);
18564
+ }
18565
+ if (this.#sizes) {
18566
+ entry.size = this.#sizes[i];
18567
+ }
18568
+ arr.unshift([key, entry]);
18569
+ }
18570
+ return arr;
17719
18571
  }
17720
- dumpLru() {
17721
- return this[LRU_LIST];
18572
+ /**
18573
+ * Reset the cache and load in the items in entries in the order listed.
18574
+ * Note that the shape of the resulting cache may be different if the
18575
+ * same options are not used in both caches.
18576
+ */
18577
+ load(arr) {
18578
+ this.clear();
18579
+ for (const [key, entry] of arr) {
18580
+ if (entry.start) {
18581
+ const age = Date.now() - entry.start;
18582
+ entry.start = perf.now() - age;
18583
+ }
18584
+ this.set(key, entry.value, entry);
18585
+ }
17722
18586
  }
17723
- set(key, value, maxAge) {
17724
- maxAge = maxAge || this[MAX_AGE];
17725
- if (maxAge && typeof maxAge !== "number")
17726
- throw new TypeError("maxAge must be a number");
17727
- const now = maxAge ? Date.now() : 0;
17728
- const len = this[LENGTH_CALCULATOR](value, key);
17729
- if (this[CACHE].has(key)) {
17730
- if (len > this[MAX]) {
17731
- del(this, this[CACHE].get(key));
17732
- return false;
18587
+ /**
18588
+ * Add a value to the cache.
18589
+ *
18590
+ * Note: if `undefined` is specified as a value, this is an alias for
18591
+ * {@link LRUCache#delete}
18592
+ */
18593
+ set(k, v, setOptions = {}) {
18594
+ var _a2, _b, _c;
18595
+ if (v === void 0) {
18596
+ this.delete(k);
18597
+ return this;
18598
+ }
18599
+ const { ttl = this.ttl, start, noDisposeOnSet = this.noDisposeOnSet, sizeCalculation = this.sizeCalculation, status } = setOptions;
18600
+ let { noUpdateTTL = this.noUpdateTTL } = setOptions;
18601
+ const size = this.#requireSize(k, v, setOptions.size || 0, sizeCalculation);
18602
+ if (this.maxEntrySize && size > this.maxEntrySize) {
18603
+ if (status) {
18604
+ status.set = "miss";
18605
+ status.maxEntrySizeExceeded = true;
17733
18606
  }
17734
- const node = this[CACHE].get(key);
17735
- const item = node.value;
17736
- if (this[DISPOSE]) {
17737
- if (!this[NO_DISPOSE_ON_SET])
17738
- this[DISPOSE](key, item.value);
18607
+ this.delete(k);
18608
+ return this;
18609
+ }
18610
+ let index = this.#size === 0 ? void 0 : this.#keyMap.get(k);
18611
+ if (index === void 0) {
18612
+ index = this.#size === 0 ? this.#tail : this.#free.length !== 0 ? this.#free.pop() : this.#size === this.#max ? this.#evict(false) : this.#size;
18613
+ this.#keyList[index] = k;
18614
+ this.#valList[index] = v;
18615
+ this.#keyMap.set(k, index);
18616
+ this.#next[this.#tail] = index;
18617
+ this.#prev[index] = this.#tail;
18618
+ this.#tail = index;
18619
+ this.#size++;
18620
+ this.#addItemSize(index, size, status);
18621
+ if (status)
18622
+ status.set = "add";
18623
+ noUpdateTTL = false;
18624
+ } else {
18625
+ this.#moveToTail(index);
18626
+ const oldVal = this.#valList[index];
18627
+ if (v !== oldVal) {
18628
+ if (this.#hasFetchMethod && this.#isBackgroundFetch(oldVal)) {
18629
+ oldVal.__abortController.abort(new Error("replaced"));
18630
+ } else if (!noDisposeOnSet) {
18631
+ if (this.#hasDispose) {
18632
+ (_a2 = this.#dispose) == null ? void 0 : _a2.call(this, oldVal, k, "set");
18633
+ }
18634
+ if (this.#hasDisposeAfter) {
18635
+ (_b = this.#disposed) == null ? void 0 : _b.push([oldVal, k, "set"]);
18636
+ }
18637
+ }
18638
+ this.#removeItemSize(index);
18639
+ this.#addItemSize(index, size, status);
18640
+ this.#valList[index] = v;
18641
+ if (status) {
18642
+ status.set = "replace";
18643
+ const oldValue = oldVal && this.#isBackgroundFetch(oldVal) ? oldVal.__staleWhileFetching : oldVal;
18644
+ if (oldValue !== void 0)
18645
+ status.oldValue = oldValue;
18646
+ }
18647
+ } else if (status) {
18648
+ status.set = "update";
17739
18649
  }
17740
- item.now = now;
17741
- item.maxAge = maxAge;
17742
- item.value = value;
17743
- this[LENGTH] += len - item.length;
17744
- item.length = len;
17745
- this.get(key);
17746
- trim(this);
17747
- return true;
17748
18650
  }
17749
- const hit = new Entry(key, value, len, now, maxAge);
17750
- if (hit.length > this[MAX]) {
17751
- if (this[DISPOSE])
17752
- this[DISPOSE](key, value);
17753
- return false;
18651
+ if (ttl !== 0 && !this.#ttls) {
18652
+ this.#initializeTTLTracking();
17754
18653
  }
17755
- this[LENGTH] += hit.length;
17756
- this[LRU_LIST].unshift(hit);
17757
- this[CACHE].set(key, this[LRU_LIST].head);
17758
- trim(this);
17759
- return true;
18654
+ if (this.#ttls) {
18655
+ if (!noUpdateTTL) {
18656
+ this.#setItemTTL(index, ttl, start);
18657
+ }
18658
+ if (status)
18659
+ this.#statusTTL(status, index);
18660
+ }
18661
+ if (!noDisposeOnSet && this.#hasDisposeAfter && this.#disposed) {
18662
+ const dt = this.#disposed;
18663
+ let task;
18664
+ while (task = dt == null ? void 0 : dt.shift()) {
18665
+ (_c = this.#disposeAfter) == null ? void 0 : _c.call(this, ...task);
18666
+ }
18667
+ }
18668
+ return this;
17760
18669
  }
17761
- has(key) {
17762
- if (!this[CACHE].has(key))
17763
- return false;
17764
- const hit = this[CACHE].get(key).value;
17765
- return !isStale(this, hit);
18670
+ /**
18671
+ * Evict the least recently used item, returning its value or
18672
+ * `undefined` if cache is empty.
18673
+ */
18674
+ pop() {
18675
+ var _a2;
18676
+ try {
18677
+ while (this.#size) {
18678
+ const val = this.#valList[this.#head];
18679
+ this.#evict(true);
18680
+ if (this.#isBackgroundFetch(val)) {
18681
+ if (val.__staleWhileFetching) {
18682
+ return val.__staleWhileFetching;
18683
+ }
18684
+ } else if (val !== void 0) {
18685
+ return val;
18686
+ }
18687
+ }
18688
+ } finally {
18689
+ if (this.#hasDisposeAfter && this.#disposed) {
18690
+ const dt = this.#disposed;
18691
+ let task;
18692
+ while (task = dt == null ? void 0 : dt.shift()) {
18693
+ (_a2 = this.#disposeAfter) == null ? void 0 : _a2.call(this, ...task);
18694
+ }
18695
+ }
18696
+ }
17766
18697
  }
17767
- get(key) {
17768
- return get(this, key, true);
18698
+ #evict(free) {
18699
+ var _a2, _b;
18700
+ const head = this.#head;
18701
+ const k = this.#keyList[head];
18702
+ const v = this.#valList[head];
18703
+ if (this.#hasFetchMethod && this.#isBackgroundFetch(v)) {
18704
+ v.__abortController.abort(new Error("evicted"));
18705
+ } else if (this.#hasDispose || this.#hasDisposeAfter) {
18706
+ if (this.#hasDispose) {
18707
+ (_a2 = this.#dispose) == null ? void 0 : _a2.call(this, v, k, "evict");
18708
+ }
18709
+ if (this.#hasDisposeAfter) {
18710
+ (_b = this.#disposed) == null ? void 0 : _b.push([v, k, "evict"]);
18711
+ }
18712
+ }
18713
+ this.#removeItemSize(head);
18714
+ if (free) {
18715
+ this.#keyList[head] = void 0;
18716
+ this.#valList[head] = void 0;
18717
+ this.#free.push(head);
18718
+ }
18719
+ if (this.#size === 1) {
18720
+ this.#head = this.#tail = 0;
18721
+ this.#free.length = 0;
18722
+ } else {
18723
+ this.#head = this.#next[head];
18724
+ }
18725
+ this.#keyMap.delete(k);
18726
+ this.#size--;
18727
+ return head;
17769
18728
  }
17770
- peek(key) {
17771
- return get(this, key, false);
18729
+ /**
18730
+ * Check if a key is in the cache, without updating the recency of use.
18731
+ * Will return false if the item is stale, even though it is technically
18732
+ * in the cache.
18733
+ *
18734
+ * Will not update item age unless
18735
+ * {@link LRUCache.OptionsBase.updateAgeOnHas} is set.
18736
+ */
18737
+ has(k, hasOptions = {}) {
18738
+ const { updateAgeOnHas = this.updateAgeOnHas, status } = hasOptions;
18739
+ const index = this.#keyMap.get(k);
18740
+ if (index !== void 0) {
18741
+ const v = this.#valList[index];
18742
+ if (this.#isBackgroundFetch(v) && v.__staleWhileFetching === void 0) {
18743
+ return false;
18744
+ }
18745
+ if (!this.#isStale(index)) {
18746
+ if (updateAgeOnHas) {
18747
+ this.#updateItemAge(index);
18748
+ }
18749
+ if (status) {
18750
+ status.has = "hit";
18751
+ this.#statusTTL(status, index);
18752
+ }
18753
+ return true;
18754
+ } else if (status) {
18755
+ status.has = "stale";
18756
+ this.#statusTTL(status, index);
18757
+ }
18758
+ } else if (status) {
18759
+ status.has = "miss";
18760
+ }
18761
+ return false;
17772
18762
  }
17773
- pop() {
17774
- const node = this[LRU_LIST].tail;
17775
- if (!node)
17776
- return null;
17777
- del(this, node);
17778
- return node.value;
18763
+ /**
18764
+ * Like {@link LRUCache#get} but doesn't update recency or delete stale
18765
+ * items.
18766
+ *
18767
+ * Returns `undefined` if the item is stale, unless
18768
+ * {@link LRUCache.OptionsBase.allowStale} is set.
18769
+ */
18770
+ peek(k, peekOptions = {}) {
18771
+ const { allowStale = this.allowStale } = peekOptions;
18772
+ const index = this.#keyMap.get(k);
18773
+ if (index !== void 0 && (allowStale || !this.#isStale(index))) {
18774
+ const v = this.#valList[index];
18775
+ return this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v;
18776
+ }
18777
+ }
18778
+ #backgroundFetch(k, index, options, context) {
18779
+ const v = index === void 0 ? void 0 : this.#valList[index];
18780
+ if (this.#isBackgroundFetch(v)) {
18781
+ return v;
18782
+ }
18783
+ const ac = new AC();
18784
+ const { signal } = options;
18785
+ signal == null ? void 0 : signal.addEventListener("abort", () => ac.abort(signal.reason), {
18786
+ signal: ac.signal
18787
+ });
18788
+ const fetchOpts = {
18789
+ signal: ac.signal,
18790
+ options,
18791
+ context
18792
+ };
18793
+ const cb = (v2, updateCache = false) => {
18794
+ const { aborted } = ac.signal;
18795
+ const ignoreAbort = options.ignoreFetchAbort && v2 !== void 0;
18796
+ if (options.status) {
18797
+ if (aborted && !updateCache) {
18798
+ options.status.fetchAborted = true;
18799
+ options.status.fetchError = ac.signal.reason;
18800
+ if (ignoreAbort)
18801
+ options.status.fetchAbortIgnored = true;
18802
+ } else {
18803
+ options.status.fetchResolved = true;
18804
+ }
18805
+ }
18806
+ if (aborted && !ignoreAbort && !updateCache) {
18807
+ return fetchFail(ac.signal.reason);
18808
+ }
18809
+ const bf2 = p;
18810
+ if (this.#valList[index] === p) {
18811
+ if (v2 === void 0) {
18812
+ if (bf2.__staleWhileFetching) {
18813
+ this.#valList[index] = bf2.__staleWhileFetching;
18814
+ } else {
18815
+ this.delete(k);
18816
+ }
18817
+ } else {
18818
+ if (options.status)
18819
+ options.status.fetchUpdated = true;
18820
+ this.set(k, v2, fetchOpts.options);
18821
+ }
18822
+ }
18823
+ return v2;
18824
+ };
18825
+ const eb = (er) => {
18826
+ if (options.status) {
18827
+ options.status.fetchRejected = true;
18828
+ options.status.fetchError = er;
18829
+ }
18830
+ return fetchFail(er);
18831
+ };
18832
+ const fetchFail = (er) => {
18833
+ const { aborted } = ac.signal;
18834
+ const allowStaleAborted = aborted && options.allowStaleOnFetchAbort;
18835
+ const allowStale = allowStaleAborted || options.allowStaleOnFetchRejection;
18836
+ const noDelete = allowStale || options.noDeleteOnFetchRejection;
18837
+ const bf2 = p;
18838
+ if (this.#valList[index] === p) {
18839
+ const del = !noDelete || bf2.__staleWhileFetching === void 0;
18840
+ if (del) {
18841
+ this.delete(k);
18842
+ } else if (!allowStaleAborted) {
18843
+ this.#valList[index] = bf2.__staleWhileFetching;
18844
+ }
18845
+ }
18846
+ if (allowStale) {
18847
+ if (options.status && bf2.__staleWhileFetching !== void 0) {
18848
+ options.status.returnedStale = true;
18849
+ }
18850
+ return bf2.__staleWhileFetching;
18851
+ } else if (bf2.__returned === bf2) {
18852
+ throw er;
18853
+ }
18854
+ };
18855
+ const pcall = (res, rej) => {
18856
+ var _a2;
18857
+ const fmp = (_a2 = this.#fetchMethod) == null ? void 0 : _a2.call(this, k, v, fetchOpts);
18858
+ if (fmp && fmp instanceof Promise) {
18859
+ fmp.then((v2) => res(v2), rej);
18860
+ }
18861
+ ac.signal.addEventListener("abort", () => {
18862
+ if (!options.ignoreFetchAbort || options.allowStaleOnFetchAbort) {
18863
+ res();
18864
+ if (options.allowStaleOnFetchAbort) {
18865
+ res = (v2) => cb(v2, true);
18866
+ }
18867
+ }
18868
+ });
18869
+ };
18870
+ if (options.status)
18871
+ options.status.fetchDispatched = true;
18872
+ const p = new Promise(pcall).then(cb, eb);
18873
+ const bf = Object.assign(p, {
18874
+ __abortController: ac,
18875
+ __staleWhileFetching: v,
18876
+ __returned: void 0
18877
+ });
18878
+ if (index === void 0) {
18879
+ this.set(k, bf, { ...fetchOpts.options, status: void 0 });
18880
+ index = this.#keyMap.get(k);
18881
+ } else {
18882
+ this.#valList[index] = bf;
18883
+ }
18884
+ return bf;
17779
18885
  }
17780
- del(key) {
17781
- del(this, this[CACHE].get(key));
18886
+ #isBackgroundFetch(p) {
18887
+ if (!this.#hasFetchMethod)
18888
+ return false;
18889
+ const b = p;
18890
+ return !!b && b instanceof Promise && b.hasOwnProperty("__staleWhileFetching") && b.__abortController instanceof AC;
18891
+ }
18892
+ async fetch(k, fetchOptions = {}) {
18893
+ const {
18894
+ // get options
18895
+ allowStale = this.allowStale,
18896
+ updateAgeOnGet = this.updateAgeOnGet,
18897
+ noDeleteOnStaleGet = this.noDeleteOnStaleGet,
18898
+ // set options
18899
+ ttl = this.ttl,
18900
+ noDisposeOnSet = this.noDisposeOnSet,
18901
+ size = 0,
18902
+ sizeCalculation = this.sizeCalculation,
18903
+ noUpdateTTL = this.noUpdateTTL,
18904
+ // fetch exclusive options
18905
+ noDeleteOnFetchRejection = this.noDeleteOnFetchRejection,
18906
+ allowStaleOnFetchRejection = this.allowStaleOnFetchRejection,
18907
+ ignoreFetchAbort = this.ignoreFetchAbort,
18908
+ allowStaleOnFetchAbort = this.allowStaleOnFetchAbort,
18909
+ context,
18910
+ forceRefresh = false,
18911
+ status,
18912
+ signal
18913
+ } = fetchOptions;
18914
+ if (!this.#hasFetchMethod) {
18915
+ if (status)
18916
+ status.fetch = "get";
18917
+ return this.get(k, {
18918
+ allowStale,
18919
+ updateAgeOnGet,
18920
+ noDeleteOnStaleGet,
18921
+ status
18922
+ });
18923
+ }
18924
+ const options = {
18925
+ allowStale,
18926
+ updateAgeOnGet,
18927
+ noDeleteOnStaleGet,
18928
+ ttl,
18929
+ noDisposeOnSet,
18930
+ size,
18931
+ sizeCalculation,
18932
+ noUpdateTTL,
18933
+ noDeleteOnFetchRejection,
18934
+ allowStaleOnFetchRejection,
18935
+ allowStaleOnFetchAbort,
18936
+ ignoreFetchAbort,
18937
+ status,
18938
+ signal
18939
+ };
18940
+ let index = this.#keyMap.get(k);
18941
+ if (index === void 0) {
18942
+ if (status)
18943
+ status.fetch = "miss";
18944
+ const p = this.#backgroundFetch(k, index, options, context);
18945
+ return p.__returned = p;
18946
+ } else {
18947
+ const v = this.#valList[index];
18948
+ if (this.#isBackgroundFetch(v)) {
18949
+ const stale = allowStale && v.__staleWhileFetching !== void 0;
18950
+ if (status) {
18951
+ status.fetch = "inflight";
18952
+ if (stale)
18953
+ status.returnedStale = true;
18954
+ }
18955
+ return stale ? v.__staleWhileFetching : v.__returned = v;
18956
+ }
18957
+ const isStale = this.#isStale(index);
18958
+ if (!forceRefresh && !isStale) {
18959
+ if (status)
18960
+ status.fetch = "hit";
18961
+ this.#moveToTail(index);
18962
+ if (updateAgeOnGet) {
18963
+ this.#updateItemAge(index);
18964
+ }
18965
+ if (status)
18966
+ this.#statusTTL(status, index);
18967
+ return v;
18968
+ }
18969
+ const p = this.#backgroundFetch(k, index, options, context);
18970
+ const hasStale = p.__staleWhileFetching !== void 0;
18971
+ const staleVal = hasStale && allowStale;
18972
+ if (status) {
18973
+ status.fetch = isStale ? "stale" : "refresh";
18974
+ if (staleVal && isStale)
18975
+ status.returnedStale = true;
18976
+ }
18977
+ return staleVal ? p.__staleWhileFetching : p.__returned = p;
18978
+ }
17782
18979
  }
17783
- load(arr) {
17784
- this.reset();
17785
- const now = Date.now();
17786
- for (let l = arr.length - 1; l >= 0; l--) {
17787
- const hit = arr[l];
17788
- const expiresAt = hit.e || 0;
17789
- if (expiresAt === 0)
17790
- this.set(hit.k, hit.v);
17791
- else {
17792
- const maxAge = expiresAt - now;
17793
- if (maxAge > 0) {
17794
- this.set(hit.k, hit.v, maxAge);
18980
+ /**
18981
+ * Return a value from the cache. Will update the recency of the cache
18982
+ * entry found.
18983
+ *
18984
+ * If the key is not found, get() will return `undefined`.
18985
+ */
18986
+ get(k, getOptions = {}) {
18987
+ const { allowStale = this.allowStale, updateAgeOnGet = this.updateAgeOnGet, noDeleteOnStaleGet = this.noDeleteOnStaleGet, status } = getOptions;
18988
+ const index = this.#keyMap.get(k);
18989
+ if (index !== void 0) {
18990
+ const value = this.#valList[index];
18991
+ const fetching = this.#isBackgroundFetch(value);
18992
+ if (status)
18993
+ this.#statusTTL(status, index);
18994
+ if (this.#isStale(index)) {
18995
+ if (status)
18996
+ status.get = "stale";
18997
+ if (!fetching) {
18998
+ if (!noDeleteOnStaleGet) {
18999
+ this.delete(k);
19000
+ }
19001
+ if (status && allowStale)
19002
+ status.returnedStale = true;
19003
+ return allowStale ? value : void 0;
19004
+ } else {
19005
+ if (status && allowStale && value.__staleWhileFetching !== void 0) {
19006
+ status.returnedStale = true;
19007
+ }
19008
+ return allowStale ? value.__staleWhileFetching : void 0;
19009
+ }
19010
+ } else {
19011
+ if (status)
19012
+ status.get = "hit";
19013
+ if (fetching) {
19014
+ return value.__staleWhileFetching;
19015
+ }
19016
+ this.#moveToTail(index);
19017
+ if (updateAgeOnGet) {
19018
+ this.#updateItemAge(index);
17795
19019
  }
19020
+ return value;
17796
19021
  }
19022
+ } else if (status) {
19023
+ status.get = "miss";
17797
19024
  }
17798
19025
  }
17799
- prune() {
17800
- this[CACHE].forEach((value, key) => get(this, key, false));
19026
+ #connect(p, n) {
19027
+ this.#prev[n] = p;
19028
+ this.#next[p] = n;
17801
19029
  }
17802
- };
17803
- var get = (self2, key, doUse) => {
17804
- const node = self2[CACHE].get(key);
17805
- if (node) {
17806
- const hit = node.value;
17807
- if (isStale(self2, hit)) {
17808
- del(self2, node);
17809
- if (!self2[ALLOW_STALE])
17810
- return void 0;
17811
- } else {
17812
- if (doUse) {
17813
- if (self2[UPDATE_AGE_ON_GET])
17814
- node.value.now = Date.now();
17815
- self2[LRU_LIST].unshiftNode(node);
19030
+ #moveToTail(index) {
19031
+ if (index !== this.#tail) {
19032
+ if (index === this.#head) {
19033
+ this.#head = this.#next[index];
19034
+ } else {
19035
+ this.#connect(this.#prev[index], this.#next[index]);
17816
19036
  }
19037
+ this.#connect(this.#tail, index);
19038
+ this.#tail = index;
17817
19039
  }
17818
- return hit.value;
17819
19040
  }
17820
- };
17821
- var isStale = (self2, hit) => {
17822
- if (!hit || !hit.maxAge && !self2[MAX_AGE])
17823
- return false;
17824
- const diff = Date.now() - hit.now;
17825
- return hit.maxAge ? diff > hit.maxAge : self2[MAX_AGE] && diff > self2[MAX_AGE];
17826
- };
17827
- var trim = (self2) => {
17828
- if (self2[LENGTH] > self2[MAX]) {
17829
- for (let walker = self2[LRU_LIST].tail; self2[LENGTH] > self2[MAX] && walker !== null; ) {
17830
- const prev = walker.prev;
17831
- del(self2, walker);
17832
- walker = prev;
19041
+ /**
19042
+ * Deletes a key out of the cache.
19043
+ * Returns true if the key was deleted, false otherwise.
19044
+ */
19045
+ delete(k) {
19046
+ var _a2, _b, _c, _d;
19047
+ let deleted = false;
19048
+ if (this.#size !== 0) {
19049
+ const index = this.#keyMap.get(k);
19050
+ if (index !== void 0) {
19051
+ deleted = true;
19052
+ if (this.#size === 1) {
19053
+ this.clear();
19054
+ } else {
19055
+ this.#removeItemSize(index);
19056
+ const v = this.#valList[index];
19057
+ if (this.#isBackgroundFetch(v)) {
19058
+ v.__abortController.abort(new Error("deleted"));
19059
+ } else if (this.#hasDispose || this.#hasDisposeAfter) {
19060
+ if (this.#hasDispose) {
19061
+ (_a2 = this.#dispose) == null ? void 0 : _a2.call(this, v, k, "delete");
19062
+ }
19063
+ if (this.#hasDisposeAfter) {
19064
+ (_b = this.#disposed) == null ? void 0 : _b.push([v, k, "delete"]);
19065
+ }
19066
+ }
19067
+ this.#keyMap.delete(k);
19068
+ this.#keyList[index] = void 0;
19069
+ this.#valList[index] = void 0;
19070
+ if (index === this.#tail) {
19071
+ this.#tail = this.#prev[index];
19072
+ } else if (index === this.#head) {
19073
+ this.#head = this.#next[index];
19074
+ } else {
19075
+ this.#next[this.#prev[index]] = this.#next[index];
19076
+ this.#prev[this.#next[index]] = this.#prev[index];
19077
+ }
19078
+ this.#size--;
19079
+ this.#free.push(index);
19080
+ }
19081
+ }
17833
19082
  }
19083
+ if (this.#hasDisposeAfter && ((_c = this.#disposed) == null ? void 0 : _c.length)) {
19084
+ const dt = this.#disposed;
19085
+ let task;
19086
+ while (task = dt == null ? void 0 : dt.shift()) {
19087
+ (_d = this.#disposeAfter) == null ? void 0 : _d.call(this, ...task);
19088
+ }
19089
+ }
19090
+ return deleted;
17834
19091
  }
17835
- };
17836
- var del = (self2, node) => {
17837
- if (node) {
17838
- const hit = node.value;
17839
- if (self2[DISPOSE])
17840
- self2[DISPOSE](hit.key, hit.value);
17841
- self2[LENGTH] -= hit.length;
17842
- self2[CACHE].delete(hit.key);
17843
- self2[LRU_LIST].removeNode(node);
17844
- }
17845
- };
17846
- var Entry = class {
17847
- constructor(key, value, length, now, maxAge) {
17848
- this.key = key;
17849
- this.value = value;
17850
- this.length = length;
17851
- this.now = now;
17852
- this.maxAge = maxAge || 0;
17853
- }
17854
- };
17855
- var forEachStep = (self2, fn, node, thisp) => {
17856
- let hit = node.value;
17857
- if (isStale(self2, hit)) {
17858
- del(self2, node);
17859
- if (!self2[ALLOW_STALE])
17860
- hit = void 0;
19092
+ /**
19093
+ * Clear the cache entirely, throwing away all values.
19094
+ */
19095
+ clear() {
19096
+ var _a2, _b, _c;
19097
+ for (const index of this.#rindexes({ allowStale: true })) {
19098
+ const v = this.#valList[index];
19099
+ if (this.#isBackgroundFetch(v)) {
19100
+ v.__abortController.abort(new Error("deleted"));
19101
+ } else {
19102
+ const k = this.#keyList[index];
19103
+ if (this.#hasDispose) {
19104
+ (_a2 = this.#dispose) == null ? void 0 : _a2.call(this, v, k, "delete");
19105
+ }
19106
+ if (this.#hasDisposeAfter) {
19107
+ (_b = this.#disposed) == null ? void 0 : _b.push([v, k, "delete"]);
19108
+ }
19109
+ }
19110
+ }
19111
+ this.#keyMap.clear();
19112
+ this.#valList.fill(void 0);
19113
+ this.#keyList.fill(void 0);
19114
+ if (this.#ttls && this.#starts) {
19115
+ this.#ttls.fill(0);
19116
+ this.#starts.fill(0);
19117
+ }
19118
+ if (this.#sizes) {
19119
+ this.#sizes.fill(0);
19120
+ }
19121
+ this.#head = 0;
19122
+ this.#tail = 0;
19123
+ this.#free.length = 0;
19124
+ this.#calculatedSize = 0;
19125
+ this.#size = 0;
19126
+ if (this.#hasDisposeAfter && this.#disposed) {
19127
+ const dt = this.#disposed;
19128
+ let task;
19129
+ while (task = dt == null ? void 0 : dt.shift()) {
19130
+ (_c = this.#disposeAfter) == null ? void 0 : _c.call(this, ...task);
19131
+ }
19132
+ }
17861
19133
  }
17862
- if (hit)
17863
- fn.call(thisp, hit.value, hit.key, self2);
17864
19134
  };
17865
- module2.exports = LRUCache;
19135
+ exports2.LRUCache = LRUCache;
17866
19136
  }
17867
19137
  });
17868
19138
 
17869
19139
  // node_modules/@octokit/auth-app/dist-node/index.js
17870
19140
  var require_dist_node12 = __commonJS({
17871
- "node_modules/@octokit/auth-app/dist-node/index.js"(exports2) {
19141
+ "node_modules/@octokit/auth-app/dist-node/index.js"(exports2, module2) {
17872
19142
  "use strict";
17873
- Object.defineProperty(exports2, "__esModule", { value: true });
17874
- function _interopDefault(ex) {
17875
- return ex && typeof ex === "object" && "default" in ex ? ex["default"] : ex;
17876
- }
17877
- var universalUserAgent = require_dist_node();
17878
- var request = require_dist_node5();
17879
- var authOauthApp = require_dist_node10();
17880
- var deprecation = require_dist_node3();
17881
- var universalGithubAppJwt = require_dist_node11();
17882
- var LRU = _interopDefault(require_lru_cache2());
17883
- var authOauthUser = require_dist_node9();
19143
+ var __defProp2 = Object.defineProperty;
19144
+ var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
19145
+ var __getOwnPropNames2 = Object.getOwnPropertyNames;
19146
+ var __hasOwnProp2 = Object.prototype.hasOwnProperty;
19147
+ var __export = (target, all) => {
19148
+ for (var name in all)
19149
+ __defProp2(target, name, { get: all[name], enumerable: true });
19150
+ };
19151
+ var __copyProps2 = (to, from, except, desc) => {
19152
+ if (from && typeof from === "object" || typeof from === "function") {
19153
+ for (let key of __getOwnPropNames2(from))
19154
+ if (!__hasOwnProp2.call(to, key) && key !== except)
19155
+ __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
19156
+ }
19157
+ return to;
19158
+ };
19159
+ var __toCommonJS = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
19160
+ var dist_src_exports = {};
19161
+ __export(dist_src_exports, {
19162
+ createAppAuth: () => createAppAuth2,
19163
+ createOAuthUserAuth: () => import_auth_oauth_user2.createOAuthUserAuth
19164
+ });
19165
+ module2.exports = __toCommonJS(dist_src_exports);
19166
+ var import_universal_user_agent = require_dist_node();
19167
+ var import_request = require_dist_node5();
19168
+ var import_auth_oauth_app = require_dist_node10();
19169
+ var import_deprecation = require_dist_node3();
19170
+ var import_universal_github_app_jwt = require_dist_node11();
17884
19171
  async function getAppAuthentication({
17885
19172
  appId,
17886
19173
  privateKey,
17887
19174
  timeDifference
17888
19175
  }) {
17889
19176
  try {
17890
- const appAuthentication = await universalGithubAppJwt.githubAppJwt({
19177
+ const appAuthentication = await (0, import_universal_github_app_jwt.githubAppJwt)({
17891
19178
  id: +appId,
17892
19179
  privateKey,
17893
19180
  now: timeDifference && Math.floor(Date.now() / 1e3) + timeDifference
@@ -17900,18 +19187,21 @@ var require_dist_node12 = __commonJS({
17900
19187
  };
17901
19188
  } catch (error) {
17902
19189
  if (privateKey === "-----BEGIN RSA PRIVATE KEY-----") {
17903
- throw new Error("The 'privateKey` option contains only the first line '-----BEGIN RSA PRIVATE KEY-----'. If you are setting it using a `.env` file, make sure it is set on a single line with newlines replaced by '\n'");
19190
+ throw new Error(
19191
+ "The 'privateKey` option contains only the first line '-----BEGIN RSA PRIVATE KEY-----'. If you are setting it using a `.env` file, make sure it is set on a single line with newlines replaced by '\n'"
19192
+ );
17904
19193
  } else {
17905
19194
  throw error;
17906
19195
  }
17907
19196
  }
17908
19197
  }
19198
+ var import_lru_cache = require_cjs();
17909
19199
  function getCache() {
17910
- return new LRU({
19200
+ return new import_lru_cache.LRUCache({
17911
19201
  // cache max. 15000 tokens, that will use less than 10mb memory
17912
19202
  max: 15e3,
17913
19203
  // Cache for 1 minute less than GitHub expiry
17914
- maxAge: 1e3 * 60 * 59
19204
+ ttl: 1e3 * 60 * 59
17915
19205
  });
17916
19206
  }
17917
19207
  async function get(cache, options) {
@@ -17920,7 +19210,14 @@ var require_dist_node12 = __commonJS({
17920
19210
  if (!result) {
17921
19211
  return;
17922
19212
  }
17923
- const [token, createdAt, expiresAt, repositorySelection, permissionsString, singleFileName] = result.split("|");
19213
+ const [
19214
+ token,
19215
+ createdAt,
19216
+ expiresAt,
19217
+ repositorySelection,
19218
+ permissionsString,
19219
+ singleFileName
19220
+ ] = result.split("|");
17924
19221
  const permissions = options.permissions || permissionsString.split(/,/).reduce((permissions2, string) => {
17925
19222
  if (/!$/.test(string)) {
17926
19223
  permissions2[string.slice(0, -1)] = "write";
@@ -17942,8 +19239,17 @@ var require_dist_node12 = __commonJS({
17942
19239
  }
17943
19240
  async function set(cache, options, data) {
17944
19241
  const key = optionsToCacheKey(options);
17945
- const permissionsString = options.permissions ? "" : Object.keys(data.permissions).map((name) => `${name}${data.permissions[name] === "write" ? "!" : ""}`).join(",");
17946
- const value = [data.token, data.createdAt, data.expiresAt, data.repositorySelection, permissionsString, data.singleFileName].join("|");
19242
+ const permissionsString = options.permissions ? "" : Object.keys(data.permissions).map(
19243
+ (name) => `${name}${data.permissions[name] === "write" ? "!" : ""}`
19244
+ ).join(",");
19245
+ const value = [
19246
+ data.token,
19247
+ data.createdAt,
19248
+ data.expiresAt,
19249
+ data.repositorySelection,
19250
+ permissionsString,
19251
+ data.singleFileName
19252
+ ].join("|");
17947
19253
  await cache.set(key, value);
17948
19254
  }
17949
19255
  function optionsToCacheKey({
@@ -17955,7 +19261,12 @@ var require_dist_node12 = __commonJS({
17955
19261
  const permissionsString = Object.keys(permissions).sort().map((name) => permissions[name] === "read" ? name : `${name}!`).join(",");
17956
19262
  const repositoryIdsString = repositoryIds.sort().join(",");
17957
19263
  const repositoryNamesString = repositoryNames.join(",");
17958
- return [installationId, repositoryIdsString, repositoryNamesString, permissionsString].filter(Boolean).join("|");
19264
+ return [
19265
+ installationId,
19266
+ repositoryIdsString,
19267
+ repositoryNamesString,
19268
+ permissionsString
19269
+ ].filter(Boolean).join("|");
17959
19270
  }
17960
19271
  function toTokenAuthentication({
17961
19272
  installationId,
@@ -17968,45 +19279,45 @@ var require_dist_node12 = __commonJS({
17968
19279
  repositoryNames,
17969
19280
  singleFileName
17970
19281
  }) {
17971
- return Object.assign({
17972
- type: "token",
17973
- tokenType: "installation",
17974
- token,
17975
- installationId,
17976
- permissions,
17977
- createdAt,
17978
- expiresAt,
17979
- repositorySelection
17980
- }, repositoryIds ? {
17981
- repositoryIds
17982
- } : null, repositoryNames ? {
17983
- repositoryNames
17984
- } : null, singleFileName ? {
17985
- singleFileName
17986
- } : null);
19282
+ return Object.assign(
19283
+ {
19284
+ type: "token",
19285
+ tokenType: "installation",
19286
+ token,
19287
+ installationId,
19288
+ permissions,
19289
+ createdAt,
19290
+ expiresAt,
19291
+ repositorySelection
19292
+ },
19293
+ repositoryIds ? { repositoryIds } : null,
19294
+ repositoryNames ? { repositoryNames } : null,
19295
+ singleFileName ? { singleFileName } : null
19296
+ );
17987
19297
  }
17988
19298
  async function getInstallationAuthentication(state, options, customRequest) {
17989
19299
  const installationId = Number(options.installationId || state.installationId);
17990
19300
  if (!installationId) {
17991
- throw new Error("[@octokit/auth-app] installationId option is required for installation authentication.");
19301
+ throw new Error(
19302
+ "[@octokit/auth-app] installationId option is required for installation authentication."
19303
+ );
17992
19304
  }
17993
19305
  if (options.factory) {
17994
- const {
17995
- type,
17996
- factory,
17997
- oauthApp,
17998
- ...factoryAuthOptions
17999
- } = {
19306
+ const { type, factory, oauthApp, ...factoryAuthOptions } = {
18000
19307
  ...state,
18001
19308
  ...options
18002
19309
  };
18003
19310
  return factory(factoryAuthOptions);
18004
19311
  }
18005
- const optionsWithInstallationTokenFromState = Object.assign({
18006
- installationId
18007
- }, options);
19312
+ const optionsWithInstallationTokenFromState = Object.assign(
19313
+ { installationId },
19314
+ options
19315
+ );
18008
19316
  if (!options.refresh) {
18009
- const result = await get(state.cache, optionsWithInstallationTokenFromState);
19317
+ const result = await get(
19318
+ state.cache,
19319
+ optionsWithInstallationTokenFromState
19320
+ );
18010
19321
  if (result) {
18011
19322
  const {
18012
19323
  token: token2,
@@ -18032,7 +19343,7 @@ var require_dist_node12 = __commonJS({
18032
19343
  }
18033
19344
  }
18034
19345
  const appAuthentication = await getAppAuthentication(state);
18035
- const request2 = customRequest || state.request;
19346
+ const request = customRequest || state.request;
18036
19347
  const {
18037
19348
  data: {
18038
19349
  token,
@@ -18042,7 +19353,7 @@ var require_dist_node12 = __commonJS({
18042
19353
  repository_selection: repositorySelectionOptional,
18043
19354
  single_file: singleFileName
18044
19355
  }
18045
- } = await request2("POST /app/installations/{installation_id}/access_tokens", {
19356
+ } = await request("POST /app/installations/{installation_id}/access_tokens", {
18046
19357
  installation_id: installationId,
18047
19358
  repository_ids: options.repositoryIds,
18048
19359
  repositories: options.repositoryNames,
@@ -18088,13 +19399,14 @@ var require_dist_node12 = __commonJS({
18088
19399
  case "oauth":
18089
19400
  state.log.warn(
18090
19401
  // @ts-expect-error `log.warn()` expects string
18091
- new deprecation.Deprecation(`[@octokit/auth-app] {type: "oauth"} is deprecated. Use {type: "oauth-app"} instead`)
19402
+ new import_deprecation.Deprecation(
19403
+ `[@octokit/auth-app] {type: "oauth"} is deprecated. Use {type: "oauth-app"} instead`
19404
+ )
18092
19405
  );
18093
19406
  case "oauth-app":
18094
- return state.oauthApp({
18095
- type: "oauth-app"
18096
- });
19407
+ return state.oauthApp({ type: "oauth-app" });
18097
19408
  case "installation":
19409
+ authOptions;
18098
19410
  return getInstallationAuthentication(state, {
18099
19411
  ...authOptions,
18100
19412
  type: "installation"
@@ -18105,34 +19417,60 @@ var require_dist_node12 = __commonJS({
18105
19417
  throw new Error(`Invalid auth type: ${authOptions.type}`);
18106
19418
  }
18107
19419
  }
18108
- var PATHS = ["/app", "/app/hook/config", "/app/hook/deliveries", "/app/hook/deliveries/{delivery_id}", "/app/hook/deliveries/{delivery_id}/attempts", "/app/installations", "/app/installations/{installation_id}", "/app/installations/{installation_id}/access_tokens", "/app/installations/{installation_id}/suspended", "/marketplace_listing/accounts/{account_id}", "/marketplace_listing/plan", "/marketplace_listing/plans", "/marketplace_listing/plans/{plan_id}/accounts", "/marketplace_listing/stubbed/accounts/{account_id}", "/marketplace_listing/stubbed/plan", "/marketplace_listing/stubbed/plans", "/marketplace_listing/stubbed/plans/{plan_id}/accounts", "/orgs/{org}/installation", "/repos/{owner}/{repo}/installation", "/users/{username}/installation"];
19420
+ var import_auth_oauth_user = require_dist_node9();
19421
+ var PATHS = [
19422
+ "/app",
19423
+ "/app/hook/config",
19424
+ "/app/hook/deliveries",
19425
+ "/app/hook/deliveries/{delivery_id}",
19426
+ "/app/hook/deliveries/{delivery_id}/attempts",
19427
+ "/app/installations",
19428
+ "/app/installations/{installation_id}",
19429
+ "/app/installations/{installation_id}/access_tokens",
19430
+ "/app/installations/{installation_id}/suspended",
19431
+ "/marketplace_listing/accounts/{account_id}",
19432
+ "/marketplace_listing/plan",
19433
+ "/marketplace_listing/plans",
19434
+ "/marketplace_listing/plans/{plan_id}/accounts",
19435
+ "/marketplace_listing/stubbed/accounts/{account_id}",
19436
+ "/marketplace_listing/stubbed/plan",
19437
+ "/marketplace_listing/stubbed/plans",
19438
+ "/marketplace_listing/stubbed/plans/{plan_id}/accounts",
19439
+ "/orgs/{org}/installation",
19440
+ "/repos/{owner}/{repo}/installation",
19441
+ "/users/{username}/installation"
19442
+ ];
18109
19443
  function routeMatcher(paths) {
18110
- const regexes = paths.map((p) => p.split("/").map((c) => c.startsWith("{") ? "(?:.+?)" : c).join("/"));
18111
- const regex = `^(?:${regexes.map((r) => `(?:${r})`).join("|")})[^/]*$`;
19444
+ const regexes = paths.map(
19445
+ (p) => p.split("/").map((c) => c.startsWith("{") ? "(?:.+?)" : c).join("/")
19446
+ );
19447
+ const regex = `^(?:${regexes.map((r) => `(?:${r})`).join("|")})$`;
18112
19448
  return new RegExp(regex, "i");
18113
19449
  }
18114
19450
  var REGEX = routeMatcher(PATHS);
18115
19451
  function requiresAppAuth(url) {
18116
- return !!url && REGEX.test(url);
19452
+ return !!url && REGEX.test(url.split("?")[0]);
18117
19453
  }
18118
19454
  var FIVE_SECONDS_IN_MS = 5 * 1e3;
18119
19455
  function isNotTimeSkewError(error) {
18120
- return !(error.message.match(/'Expiration time' claim \('exp'\) must be a numeric value representing the future time at which the assertion expires/) || error.message.match(/'Issued at' claim \('iat'\) must be an Integer representing the time that the assertion was issued/));
19456
+ return !(error.message.match(
19457
+ /'Expiration time' claim \('exp'\) must be a numeric value representing the future time at which the assertion expires/
19458
+ ) || error.message.match(
19459
+ /'Issued at' claim \('iat'\) must be an Integer representing the time that the assertion was issued/
19460
+ ));
18121
19461
  }
18122
- async function hook(state, request2, route, parameters) {
18123
- const endpoint = request2.endpoint.merge(route, parameters);
19462
+ async function hook(state, request, route, parameters) {
19463
+ const endpoint = request.endpoint.merge(route, parameters);
18124
19464
  const url = endpoint.url;
18125
19465
  if (/\/login\/oauth\/access_token$/.test(url)) {
18126
- return request2(endpoint);
19466
+ return request(endpoint);
18127
19467
  }
18128
- if (requiresAppAuth(url.replace(request2.endpoint.DEFAULTS.baseUrl, ""))) {
18129
- const {
18130
- token: token2
18131
- } = await getAppAuthentication(state);
19468
+ if (requiresAppAuth(url.replace(request.endpoint.DEFAULTS.baseUrl, ""))) {
19469
+ const { token: token2 } = await getAppAuthentication(state);
18132
19470
  endpoint.headers.authorization = `bearer ${token2}`;
18133
19471
  let response;
18134
19472
  try {
18135
- response = await request2(endpoint);
19473
+ response = await request(endpoint);
18136
19474
  } catch (error) {
18137
19475
  if (isNotTimeSkewError(error)) {
18138
19476
  throw error;
@@ -18140,43 +19478,45 @@ var require_dist_node12 = __commonJS({
18140
19478
  if (typeof error.response.headers.date === "undefined") {
18141
19479
  throw error;
18142
19480
  }
18143
- const diff = Math.floor((Date.parse(error.response.headers.date) - Date.parse((/* @__PURE__ */ new Date()).toString())) / 1e3);
19481
+ const diff = Math.floor(
19482
+ (Date.parse(error.response.headers.date) - Date.parse((/* @__PURE__ */ new Date()).toString())) / 1e3
19483
+ );
18144
19484
  state.log.warn(error.message);
18145
- state.log.warn(`[@octokit/auth-app] GitHub API time and system time are different by ${diff} seconds. Retrying request with the difference accounted for.`);
18146
- const {
18147
- token: token3
18148
- } = await getAppAuthentication({
19485
+ state.log.warn(
19486
+ `[@octokit/auth-app] GitHub API time and system time are different by ${diff} seconds. Retrying request with the difference accounted for.`
19487
+ );
19488
+ const { token: token3 } = await getAppAuthentication({
18149
19489
  ...state,
18150
19490
  timeDifference: diff
18151
19491
  });
18152
19492
  endpoint.headers.authorization = `bearer ${token3}`;
18153
- return request2(endpoint);
19493
+ return request(endpoint);
18154
19494
  }
18155
19495
  return response;
18156
19496
  }
18157
- if (authOauthUser.requiresBasicAuth(url)) {
18158
- const authentication = await state.oauthApp({
18159
- type: "oauth-app"
18160
- });
19497
+ if ((0, import_auth_oauth_user.requiresBasicAuth)(url)) {
19498
+ const authentication = await state.oauthApp({ type: "oauth-app" });
18161
19499
  endpoint.headers.authorization = authentication.headers.authorization;
18162
- return request2(endpoint);
19500
+ return request(endpoint);
18163
19501
  }
18164
- const {
18165
- token,
18166
- createdAt
18167
- } = await getInstallationAuthentication(
19502
+ const { token, createdAt } = await getInstallationAuthentication(
18168
19503
  state,
18169
19504
  // @ts-expect-error TBD
18170
19505
  {},
18171
- request2
19506
+ request
18172
19507
  );
18173
19508
  endpoint.headers.authorization = `token ${token}`;
18174
- return sendRequestWithRetries(state, request2, endpoint, createdAt);
19509
+ return sendRequestWithRetries(
19510
+ state,
19511
+ request,
19512
+ endpoint,
19513
+ createdAt
19514
+ );
18175
19515
  }
18176
- async function sendRequestWithRetries(state, request2, options, createdAt, retries = 0) {
19516
+ async function sendRequestWithRetries(state, request, options, createdAt, retries = 0) {
18177
19517
  const timeSinceTokenCreationInMs = +/* @__PURE__ */ new Date() - +new Date(createdAt);
18178
19518
  try {
18179
- return await request2(options);
19519
+ return await request(options);
18180
19520
  } catch (error) {
18181
19521
  if (error.status !== 401) {
18182
19522
  throw error;
@@ -18189,64 +19529,71 @@ var require_dist_node12 = __commonJS({
18189
19529
  }
18190
19530
  ++retries;
18191
19531
  const awaitTime = retries * 1e3;
18192
- state.log.warn(`[@octokit/auth-app] Retrying after 401 response to account for token replication delay (retry: ${retries}, wait: ${awaitTime / 1e3}s)`);
19532
+ state.log.warn(
19533
+ `[@octokit/auth-app] Retrying after 401 response to account for token replication delay (retry: ${retries}, wait: ${awaitTime / 1e3}s)`
19534
+ );
18193
19535
  await new Promise((resolve) => setTimeout(resolve, awaitTime));
18194
- return sendRequestWithRetries(state, request2, options, createdAt, retries);
19536
+ return sendRequestWithRetries(state, request, options, createdAt, retries);
18195
19537
  }
18196
19538
  }
18197
- var VERSION = "4.0.9";
19539
+ var VERSION = "4.0.13";
19540
+ var import_auth_oauth_user2 = require_dist_node9();
18198
19541
  function createAppAuth2(options) {
18199
19542
  if (!options.appId) {
18200
19543
  throw new Error("[@octokit/auth-app] appId option is required");
18201
19544
  }
18202
19545
  if (!Number.isFinite(+options.appId)) {
18203
- throw new Error("[@octokit/auth-app] appId option must be a number or numeric string");
19546
+ throw new Error(
19547
+ "[@octokit/auth-app] appId option must be a number or numeric string"
19548
+ );
18204
19549
  }
18205
19550
  if (!options.privateKey) {
18206
19551
  throw new Error("[@octokit/auth-app] privateKey option is required");
18207
19552
  }
18208
19553
  if ("installationId" in options && !options.installationId) {
18209
- throw new Error("[@octokit/auth-app] installationId is set to a falsy value");
19554
+ throw new Error(
19555
+ "[@octokit/auth-app] installationId is set to a falsy value"
19556
+ );
18210
19557
  }
18211
- const log = Object.assign({
18212
- warn: console.warn.bind(console)
18213
- }, options.log);
18214
- const request$1 = options.request || request.request.defaults({
19558
+ const log = Object.assign(
19559
+ {
19560
+ warn: console.warn.bind(console)
19561
+ },
19562
+ options.log
19563
+ );
19564
+ const request = options.request || import_request.request.defaults({
18215
19565
  headers: {
18216
- "user-agent": `octokit-auth-app.js/${VERSION} ${universalUserAgent.getUserAgent()}`
19566
+ "user-agent": `octokit-auth-app.js/${VERSION} ${(0, import_universal_user_agent.getUserAgent)()}`
18217
19567
  }
18218
19568
  });
18219
- const state = Object.assign({
18220
- request: request$1,
18221
- cache: getCache()
18222
- }, options, options.installationId ? {
18223
- installationId: Number(options.installationId)
18224
- } : {}, {
18225
- log,
18226
- oauthApp: authOauthApp.createOAuthAppAuth({
18227
- clientType: "github-app",
18228
- clientId: options.clientId || "",
18229
- clientSecret: options.clientSecret || "",
18230
- request: request$1
18231
- })
18232
- });
19569
+ const state = Object.assign(
19570
+ {
19571
+ request,
19572
+ cache: getCache()
19573
+ },
19574
+ options,
19575
+ options.installationId ? { installationId: Number(options.installationId) } : {},
19576
+ {
19577
+ log,
19578
+ oauthApp: (0, import_auth_oauth_app.createOAuthAppAuth)({
19579
+ clientType: "github-app",
19580
+ clientId: options.clientId || "",
19581
+ clientSecret: options.clientSecret || "",
19582
+ request
19583
+ })
19584
+ }
19585
+ );
18233
19586
  return Object.assign(auth.bind(null, state), {
18234
19587
  hook: hook.bind(null, state)
18235
19588
  });
18236
19589
  }
18237
- Object.defineProperty(exports2, "createOAuthUserAuth", {
18238
- enumerable: true,
18239
- get: function() {
18240
- return authOauthUser.createOAuthUserAuth;
18241
- }
18242
- });
18243
- exports2.createAppAuth = createAppAuth2;
18244
19590
  }
18245
19591
  });
18246
19592
 
18247
19593
  // node_modules/before-after-hook/lib/register.js
18248
19594
  var require_register = __commonJS({
18249
19595
  "node_modules/before-after-hook/lib/register.js"(exports2, module2) {
19596
+ "use strict";
18250
19597
  module2.exports = register;
18251
19598
  function register(state, name, method, options) {
18252
19599
  if (typeof method !== "function") {
@@ -18275,6 +19622,7 @@ var require_register = __commonJS({
18275
19622
  // node_modules/before-after-hook/lib/add.js
18276
19623
  var require_add = __commonJS({
18277
19624
  "node_modules/before-after-hook/lib/add.js"(exports2, module2) {
19625
+ "use strict";
18278
19626
  module2.exports = addHook;
18279
19627
  function addHook(state, kind, name, hook) {
18280
19628
  var orig = hook;
@@ -18315,6 +19663,7 @@ var require_add = __commonJS({
18315
19663
  // node_modules/before-after-hook/lib/remove.js
18316
19664
  var require_remove = __commonJS({
18317
19665
  "node_modules/before-after-hook/lib/remove.js"(exports2, module2) {
19666
+ "use strict";
18318
19667
  module2.exports = removeHook;
18319
19668
  function removeHook(state, name, method) {
18320
19669
  if (!state.registry[name]) {
@@ -18334,6 +19683,7 @@ var require_remove = __commonJS({
18334
19683
  // node_modules/before-after-hook/index.js
18335
19684
  var require_before_after_hook = __commonJS({
18336
19685
  "node_modules/before-after-hook/index.js"(exports2, module2) {
19686
+ "use strict";
18337
19687
  var register = require_register();
18338
19688
  var addHook = require_add();
18339
19689
  var removeHook = require_remove();
@@ -18389,12 +19739,35 @@ var require_before_after_hook = __commonJS({
18389
19739
 
18390
19740
  // node_modules/@octokit/graphql/dist-node/index.js
18391
19741
  var require_dist_node13 = __commonJS({
18392
- "node_modules/@octokit/graphql/dist-node/index.js"(exports2) {
19742
+ "node_modules/@octokit/graphql/dist-node/index.js"(exports2, module2) {
18393
19743
  "use strict";
18394
- Object.defineProperty(exports2, "__esModule", { value: true });
18395
- var request = require_dist_node5();
18396
- var universalUserAgent = require_dist_node();
18397
- var VERSION = "5.0.5";
19744
+ var __defProp2 = Object.defineProperty;
19745
+ var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
19746
+ var __getOwnPropNames2 = Object.getOwnPropertyNames;
19747
+ var __hasOwnProp2 = Object.prototype.hasOwnProperty;
19748
+ var __export = (target, all) => {
19749
+ for (var name in all)
19750
+ __defProp2(target, name, { get: all[name], enumerable: true });
19751
+ };
19752
+ var __copyProps2 = (to, from, except, desc) => {
19753
+ if (from && typeof from === "object" || typeof from === "function") {
19754
+ for (let key of __getOwnPropNames2(from))
19755
+ if (!__hasOwnProp2.call(to, key) && key !== except)
19756
+ __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
19757
+ }
19758
+ return to;
19759
+ };
19760
+ var __toCommonJS = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
19761
+ var dist_src_exports = {};
19762
+ __export(dist_src_exports, {
19763
+ GraphqlResponseError: () => GraphqlResponseError,
19764
+ graphql: () => graphql2,
19765
+ withCustomRequest: () => withCustomRequest
19766
+ });
19767
+ module2.exports = __toCommonJS(dist_src_exports);
19768
+ var import_request = require_dist_node5();
19769
+ var import_universal_user_agent = require_dist_node();
19770
+ var VERSION = "5.0.6";
18398
19771
  function _buildMessageForResponseErrors(data) {
18399
19772
  return `Request failed due to following response errors:
18400
19773
  ` + data.errors.map((e) => ` - ${e.message}`).join("\n");
@@ -18413,24 +19786,36 @@ var require_dist_node13 = __commonJS({
18413
19786
  }
18414
19787
  }
18415
19788
  };
18416
- var NON_VARIABLE_OPTIONS = ["method", "baseUrl", "url", "headers", "request", "query", "mediaType"];
19789
+ var NON_VARIABLE_OPTIONS = [
19790
+ "method",
19791
+ "baseUrl",
19792
+ "url",
19793
+ "headers",
19794
+ "request",
19795
+ "query",
19796
+ "mediaType"
19797
+ ];
18417
19798
  var FORBIDDEN_VARIABLE_OPTIONS = ["query", "method", "url"];
18418
19799
  var GHES_V3_SUFFIX_REGEX = /\/api\/v3\/?$/;
18419
19800
  function graphql(request2, query, options) {
18420
19801
  if (options) {
18421
19802
  if (typeof query === "string" && "query" in options) {
18422
- return Promise.reject(new Error(`[@octokit/graphql] "query" cannot be used as variable name`));
19803
+ return Promise.reject(
19804
+ new Error(`[@octokit/graphql] "query" cannot be used as variable name`)
19805
+ );
18423
19806
  }
18424
19807
  for (const key in options) {
18425
19808
  if (!FORBIDDEN_VARIABLE_OPTIONS.includes(key))
18426
19809
  continue;
18427
- return Promise.reject(new Error(`[@octokit/graphql] "${key}" cannot be used as variable name`));
19810
+ return Promise.reject(
19811
+ new Error(`[@octokit/graphql] "${key}" cannot be used as variable name`)
19812
+ );
18428
19813
  }
18429
19814
  }
18430
- const parsedOptions = typeof query === "string" ? Object.assign({
18431
- query
18432
- }, options) : query;
18433
- const requestOptions = Object.keys(parsedOptions).reduce((result, key) => {
19815
+ const parsedOptions = typeof query === "string" ? Object.assign({ query }, options) : query;
19816
+ const requestOptions = Object.keys(
19817
+ parsedOptions
19818
+ ).reduce((result, key) => {
18434
19819
  if (NON_VARIABLE_OPTIONS.includes(key)) {
18435
19820
  result[key] = parsedOptions[key];
18436
19821
  return result;
@@ -18451,7 +19836,11 @@ var require_dist_node13 = __commonJS({
18451
19836
  for (const key of Object.keys(response.headers)) {
18452
19837
  headers[key] = response.headers[key];
18453
19838
  }
18454
- throw new GraphqlResponseError(requestOptions, headers, response.data);
19839
+ throw new GraphqlResponseError(
19840
+ requestOptions,
19841
+ headers,
19842
+ response.data
19843
+ );
18455
19844
  }
18456
19845
  return response.data.data;
18457
19846
  });
@@ -18466,9 +19855,9 @@ var require_dist_node13 = __commonJS({
18466
19855
  endpoint: newRequest.endpoint
18467
19856
  });
18468
19857
  }
18469
- var graphql$1 = withDefaults(request.request, {
19858
+ var graphql2 = withDefaults(import_request.request, {
18470
19859
  headers: {
18471
- "user-agent": `octokit-graphql.js/${VERSION} ${universalUserAgent.getUserAgent()}`
19860
+ "user-agent": `octokit-graphql.js/${VERSION} ${(0, import_universal_user_agent.getUserAgent)()}`
18472
19861
  },
18473
19862
  method: "POST",
18474
19863
  url: "/graphql"
@@ -18479,17 +19868,35 @@ var require_dist_node13 = __commonJS({
18479
19868
  url: "/graphql"
18480
19869
  });
18481
19870
  }
18482
- exports2.GraphqlResponseError = GraphqlResponseError;
18483
- exports2.graphql = graphql$1;
18484
- exports2.withCustomRequest = withCustomRequest;
18485
19871
  }
18486
19872
  });
18487
19873
 
18488
19874
  // node_modules/@octokit/auth-token/dist-node/index.js
18489
19875
  var require_dist_node14 = __commonJS({
18490
- "node_modules/@octokit/auth-token/dist-node/index.js"(exports2) {
19876
+ "node_modules/@octokit/auth-token/dist-node/index.js"(exports2, module2) {
18491
19877
  "use strict";
18492
- Object.defineProperty(exports2, "__esModule", { value: true });
19878
+ var __defProp2 = Object.defineProperty;
19879
+ var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
19880
+ var __getOwnPropNames2 = Object.getOwnPropertyNames;
19881
+ var __hasOwnProp2 = Object.prototype.hasOwnProperty;
19882
+ var __export = (target, all) => {
19883
+ for (var name in all)
19884
+ __defProp2(target, name, { get: all[name], enumerable: true });
19885
+ };
19886
+ var __copyProps2 = (to, from, except, desc) => {
19887
+ if (from && typeof from === "object" || typeof from === "function") {
19888
+ for (let key of __getOwnPropNames2(from))
19889
+ if (!__hasOwnProp2.call(to, key) && key !== except)
19890
+ __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
19891
+ }
19892
+ return to;
19893
+ };
19894
+ var __toCommonJS = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
19895
+ var dist_src_exports = {};
19896
+ __export(dist_src_exports, {
19897
+ createTokenAuth: () => createTokenAuth
19898
+ });
19899
+ module2.exports = __toCommonJS(dist_src_exports);
18493
19900
  var REGEX_IS_INSTALLATION_LEGACY = /^v1\./;
18494
19901
  var REGEX_IS_INSTALLATION = /^ghs_/;
18495
19902
  var REGEX_IS_USER_TO_SERVER = /^ghu_/;
@@ -18511,7 +19918,10 @@ var require_dist_node14 = __commonJS({
18511
19918
  return `token ${token}`;
18512
19919
  }
18513
19920
  async function hook(token, request, route, parameters) {
18514
- const endpoint = request.endpoint.merge(route, parameters);
19921
+ const endpoint = request.endpoint.merge(
19922
+ route,
19923
+ parameters
19924
+ );
18515
19925
  endpoint.headers.authorization = withAuthorizationPrefix(token);
18516
19926
  return request(endpoint);
18517
19927
  }
@@ -18520,33 +19930,92 @@ var require_dist_node14 = __commonJS({
18520
19930
  throw new Error("[@octokit/auth-token] No token passed to createTokenAuth");
18521
19931
  }
18522
19932
  if (typeof token !== "string") {
18523
- throw new Error("[@octokit/auth-token] Token passed to createTokenAuth is not a string");
19933
+ throw new Error(
19934
+ "[@octokit/auth-token] Token passed to createTokenAuth is not a string"
19935
+ );
18524
19936
  }
18525
19937
  token = token.replace(/^(token|bearer) +/i, "");
18526
19938
  return Object.assign(auth.bind(null, token), {
18527
19939
  hook: hook.bind(null, token)
18528
19940
  });
18529
19941
  };
18530
- exports2.createTokenAuth = createTokenAuth;
18531
19942
  }
18532
19943
  });
18533
19944
 
18534
19945
  // node_modules/@octokit/core/dist-node/index.js
18535
19946
  var require_dist_node15 = __commonJS({
18536
- "node_modules/@octokit/core/dist-node/index.js"(exports2) {
19947
+ "node_modules/@octokit/core/dist-node/index.js"(exports2, module2) {
18537
19948
  "use strict";
18538
- Object.defineProperty(exports2, "__esModule", { value: true });
18539
- var universalUserAgent = require_dist_node();
18540
- var beforeAfterHook = require_before_after_hook();
18541
- var request = require_dist_node5();
18542
- var graphql = require_dist_node13();
18543
- var authToken = require_dist_node14();
18544
- var VERSION = "4.2.0";
19949
+ var __defProp2 = Object.defineProperty;
19950
+ var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
19951
+ var __getOwnPropNames2 = Object.getOwnPropertyNames;
19952
+ var __hasOwnProp2 = Object.prototype.hasOwnProperty;
19953
+ var __export = (target, all) => {
19954
+ for (var name in all)
19955
+ __defProp2(target, name, { get: all[name], enumerable: true });
19956
+ };
19957
+ var __copyProps2 = (to, from, except, desc) => {
19958
+ if (from && typeof from === "object" || typeof from === "function") {
19959
+ for (let key of __getOwnPropNames2(from))
19960
+ if (!__hasOwnProp2.call(to, key) && key !== except)
19961
+ __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
19962
+ }
19963
+ return to;
19964
+ };
19965
+ var __toCommonJS = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
19966
+ var dist_src_exports = {};
19967
+ __export(dist_src_exports, {
19968
+ Octokit: () => Octokit2
19969
+ });
19970
+ module2.exports = __toCommonJS(dist_src_exports);
19971
+ var import_universal_user_agent = require_dist_node();
19972
+ var import_before_after_hook = require_before_after_hook();
19973
+ var import_request = require_dist_node5();
19974
+ var import_graphql = require_dist_node13();
19975
+ var import_auth_token = require_dist_node14();
19976
+ var VERSION = "4.2.1";
18545
19977
  var Octokit2 = class {
19978
+ static defaults(defaults) {
19979
+ const OctokitWithDefaults = class extends this {
19980
+ constructor(...args) {
19981
+ const options = args[0] || {};
19982
+ if (typeof defaults === "function") {
19983
+ super(defaults(options));
19984
+ return;
19985
+ }
19986
+ super(
19987
+ Object.assign(
19988
+ {},
19989
+ defaults,
19990
+ options,
19991
+ options.userAgent && defaults.userAgent ? {
19992
+ userAgent: `${options.userAgent} ${defaults.userAgent}`
19993
+ } : null
19994
+ )
19995
+ );
19996
+ }
19997
+ };
19998
+ return OctokitWithDefaults;
19999
+ }
20000
+ /**
20001
+ * Attach a plugin (or many) to your Octokit instance.
20002
+ *
20003
+ * @example
20004
+ * const API = Octokit.plugin(plugin1, plugin2, plugin3, ...)
20005
+ */
20006
+ static plugin(...newPlugins) {
20007
+ var _a;
20008
+ const currentPlugins = this.plugins;
20009
+ const NewOctokit = (_a = class extends this {
20010
+ }, _a.plugins = currentPlugins.concat(
20011
+ newPlugins.filter((plugin) => !currentPlugins.includes(plugin))
20012
+ ), _a);
20013
+ return NewOctokit;
20014
+ }
18546
20015
  constructor(options = {}) {
18547
- const hook = new beforeAfterHook.Collection();
20016
+ const hook = new import_before_after_hook.Collection();
18548
20017
  const requestDefaults = {
18549
- baseUrl: request.request.endpoint.DEFAULTS.baseUrl,
20018
+ baseUrl: import_request.request.endpoint.DEFAULTS.baseUrl,
18550
20019
  headers: {},
18551
20020
  request: Object.assign({}, options.request, {
18552
20021
  // @ts-ignore internal usage only, no need to type
@@ -18557,7 +20026,10 @@ var require_dist_node15 = __commonJS({
18557
20026
  format: ""
18558
20027
  }
18559
20028
  };
18560
- requestDefaults.headers["user-agent"] = [options.userAgent, `octokit-core.js/${VERSION} ${universalUserAgent.getUserAgent()}`].filter(Boolean).join(" ");
20029
+ requestDefaults.headers["user-agent"] = [
20030
+ options.userAgent,
20031
+ `octokit-core.js/${VERSION} ${(0, import_universal_user_agent.getUserAgent)()}`
20032
+ ].filter(Boolean).join(" ");
18561
20033
  if (options.baseUrl) {
18562
20034
  requestDefaults.baseUrl = options.baseUrl;
18563
20035
  }
@@ -18567,16 +20039,19 @@ var require_dist_node15 = __commonJS({
18567
20039
  if (options.timeZone) {
18568
20040
  requestDefaults.headers["time-zone"] = options.timeZone;
18569
20041
  }
18570
- this.request = request.request.defaults(requestDefaults);
18571
- this.graphql = graphql.withCustomRequest(this.request).defaults(requestDefaults);
18572
- this.log = Object.assign({
18573
- debug: () => {
18574
- },
18575
- info: () => {
20042
+ this.request = import_request.request.defaults(requestDefaults);
20043
+ this.graphql = (0, import_graphql.withCustomRequest)(this.request).defaults(requestDefaults);
20044
+ this.log = Object.assign(
20045
+ {
20046
+ debug: () => {
20047
+ },
20048
+ info: () => {
20049
+ },
20050
+ warn: console.warn.bind(console),
20051
+ error: console.error.bind(console)
18576
20052
  },
18577
- warn: console.warn.bind(console),
18578
- error: console.error.bind(console)
18579
- }, options.log);
20053
+ options.log
20054
+ );
18580
20055
  this.hook = hook;
18581
20056
  if (!options.authStrategy) {
18582
20057
  if (!options.auth) {
@@ -18584,26 +20059,28 @@ var require_dist_node15 = __commonJS({
18584
20059
  type: "unauthenticated"
18585
20060
  });
18586
20061
  } else {
18587
- const auth = authToken.createTokenAuth(options.auth);
20062
+ const auth = (0, import_auth_token.createTokenAuth)(options.auth);
18588
20063
  hook.wrap("request", auth.hook);
18589
20064
  this.auth = auth;
18590
20065
  }
18591
20066
  } else {
18592
- const {
18593
- authStrategy,
18594
- ...otherOptions
18595
- } = options;
18596
- const auth = authStrategy(Object.assign({
18597
- request: this.request,
18598
- log: this.log,
18599
- // we pass the current octokit instance as well as its constructor options
18600
- // to allow for authentication strategies that return a new octokit instance
18601
- // that shares the same internal state as the current one. The original
18602
- // requirement for this was the "event-octokit" authentication strategy
18603
- // of https://github.com/probot/octokit-auth-probot.
18604
- octokit: this,
18605
- octokitOptions: otherOptions
18606
- }, options.auth));
20067
+ const { authStrategy, ...otherOptions } = options;
20068
+ const auth = authStrategy(
20069
+ Object.assign(
20070
+ {
20071
+ request: this.request,
20072
+ log: this.log,
20073
+ // we pass the current octokit instance as well as its constructor options
20074
+ // to allow for authentication strategies that return a new octokit instance
20075
+ // that shares the same internal state as the current one. The original
20076
+ // requirement for this was the "event-octokit" authentication strategy
20077
+ // of https://github.com/probot/octokit-auth-probot.
20078
+ octokit: this,
20079
+ octokitOptions: otherOptions
20080
+ },
20081
+ options.auth
20082
+ )
20083
+ );
18607
20084
  hook.wrap("request", auth.hook);
18608
20085
  this.auth = auth;
18609
20086
  }
@@ -18612,38 +20089,9 @@ var require_dist_node15 = __commonJS({
18612
20089
  Object.assign(this, plugin(this, options));
18613
20090
  });
18614
20091
  }
18615
- static defaults(defaults) {
18616
- const OctokitWithDefaults = class extends this {
18617
- constructor(...args) {
18618
- const options = args[0] || {};
18619
- if (typeof defaults === "function") {
18620
- super(defaults(options));
18621
- return;
18622
- }
18623
- super(Object.assign({}, defaults, options, options.userAgent && defaults.userAgent ? {
18624
- userAgent: `${options.userAgent} ${defaults.userAgent}`
18625
- } : null));
18626
- }
18627
- };
18628
- return OctokitWithDefaults;
18629
- }
18630
- /**
18631
- * Attach a plugin (or many) to your Octokit instance.
18632
- *
18633
- * @example
18634
- * const API = Octokit.plugin(plugin1, plugin2, plugin3, ...)
18635
- */
18636
- static plugin(...newPlugins) {
18637
- var _a;
18638
- const currentPlugins = this.plugins;
18639
- const NewOctokit = (_a = class extends this {
18640
- }, _a.plugins = currentPlugins.concat(newPlugins.filter((plugin) => !currentPlugins.includes(plugin))), _a);
18641
- return NewOctokit;
18642
- }
18643
20092
  };
18644
20093
  Octokit2.VERSION = VERSION;
18645
20094
  Octokit2.plugins = [];
18646
- exports2.Octokit = Octokit2;
18647
20095
  }
18648
20096
  });
18649
20097
 
@@ -18776,7 +20224,7 @@ exports.handler = async function(event) {
18776
20224
  privateKeySecretArn: process.env.GITHUB_PRIVATE_KEY_SECRET_ARN,
18777
20225
  privateKeySecretUrl: secretArnToUrl(process.env.GITHUB_PRIVATE_KEY_SECRET_ARN),
18778
20226
  app: {
18779
- id: "",
20227
+ id: -1,
18780
20228
  url: "",
18781
20229
  installations: []
18782
20230
  },
@@ -18838,7 +20286,7 @@ exports.handler = async function(event) {
18838
20286
  let baseUrl = baseUrlFromDomain(githubSecrets.domain);
18839
20287
  status.github.domain = githubSecrets.domain;
18840
20288
  if (githubSecrets.personalAuthToken) {
18841
- status.github.auth.type = "Personal Auth Token";
20289
+ status.github.auth.type = "Personal Access Token";
18842
20290
  status.github.auth.personalAuthToken = "*redacted*";
18843
20291
  let octokit;
18844
20292
  try {