@cloudsnorkel/cdk-github-runners 0.10.3 → 0.10.5

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 (52) hide show
  1. package/.gitattributes +1 -1
  2. package/.jsii +69 -30
  3. package/API.md +42 -7
  4. package/SETUP_GITHUB.md +16 -12
  5. package/TESTING.md +61 -0
  6. package/assets/{delete-runner.lambda → delete-failed-runner.lambda}/index.js +2031 -518
  7. package/assets/idle-runner-repear.lambda/index.js +2052 -522
  8. package/assets/image-builders/aws-image-builder/versioner.lambda/index.js +1 -1
  9. package/assets/setup.lambda/index.html +1 -1
  10. package/assets/setup.lambda/index.js +577 -159
  11. package/assets/status.lambda/index.js +1652 -473
  12. package/assets/token-retriever.lambda/index.js +2025 -521
  13. package/lib/access.d.ts +4 -2
  14. package/lib/access.js +7 -5
  15. package/lib/delete-failed-runner-function.d.ts +13 -0
  16. package/lib/delete-failed-runner-function.js +23 -0
  17. package/lib/delete-failed-runner.lambda.js +51 -0
  18. package/lib/idle-runner-repear.lambda.js +43 -10
  19. package/lib/image-builders/api.js +1 -1
  20. package/lib/image-builders/aws-image-builder/builder.js +1 -1
  21. package/lib/image-builders/aws-image-builder/deprecated/ami.js +1 -1
  22. package/lib/image-builders/aws-image-builder/deprecated/container.js +1 -1
  23. package/lib/image-builders/aws-image-builder/deprecated/linux-components.js +1 -1
  24. package/lib/image-builders/aws-image-builder/deprecated/windows-components.js +1 -1
  25. package/lib/image-builders/codebuild-deprecated.js +1 -1
  26. package/lib/image-builders/components.js +1 -1
  27. package/lib/image-builders/static.js +1 -1
  28. package/lib/lambda-github.d.ts +8 -4
  29. package/lib/lambda-github.js +23 -2
  30. package/lib/lambda-helpers.d.ts +5 -1
  31. package/lib/lambda-helpers.js +1 -1
  32. package/lib/providers/codebuild.js +2 -2
  33. package/lib/providers/common.d.ts +2 -0
  34. package/lib/providers/common.js +4 -4
  35. package/lib/providers/ec2.js +2 -2
  36. package/lib/providers/ecs.d.ts +1 -1
  37. package/lib/providers/ecs.js +14 -5
  38. package/lib/providers/fargate.js +2 -2
  39. package/lib/providers/lambda.js +2 -2
  40. package/lib/runner.d.ts +1 -1
  41. package/lib/runner.js +26 -25
  42. package/lib/secrets.d.ts +2 -2
  43. package/lib/secrets.js +2 -2
  44. package/lib/setup.lambda.js +2 -2
  45. package/lib/status.lambda.js +4 -4
  46. package/lib/token-retriever.lambda.js +2 -2
  47. package/lib/webhook.js +2 -2
  48. package/package.json +14 -14
  49. package/lib/delete-runner-function.d.ts +0 -13
  50. package/lib/delete-runner-function.js +0 -23
  51. package/lib/delete-runner.lambda.js +0 -41
  52. /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({
@@ -7249,42 +7267,76 @@ var require_dist_node4 = __commonJS({
7249
7267
 
7250
7268
  // node_modules/@octokit/request/dist-node/index.js
7251
7269
  var require_dist_node5 = __commonJS({
7252
- "node_modules/@octokit/request/dist-node/index.js"(exports2) {
7270
+ "node_modules/@octokit/request/dist-node/index.js"(exports2, module2) {
7253
7271
  "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";
7272
+ var __create2 = Object.create;
7273
+ var __defProp2 = Object.defineProperty;
7274
+ var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
7275
+ var __getOwnPropNames2 = Object.getOwnPropertyNames;
7276
+ var __getProtoOf2 = Object.getPrototypeOf;
7277
+ var __hasOwnProp2 = Object.prototype.hasOwnProperty;
7278
+ var __export = (target, all) => {
7279
+ for (var name in all)
7280
+ __defProp2(target, name, { get: all[name], enumerable: true });
7281
+ };
7282
+ var __copyProps2 = (to, from, except, desc) => {
7283
+ if (from && typeof from === "object" || typeof from === "function") {
7284
+ for (let key of __getOwnPropNames2(from))
7285
+ if (!__hasOwnProp2.call(to, key) && key !== except)
7286
+ __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
7287
+ }
7288
+ return to;
7289
+ };
7290
+ var __toESM2 = (mod, isNodeMode, target) => (target = mod != null ? __create2(__getProtoOf2(mod)) : {}, __copyProps2(
7291
+ // If the importer is in node compatibility mode or this is not an ESM
7292
+ // file that has been converted to a CommonJS file using a Babel-
7293
+ // compatible transform (i.e. "__esModule" has not been set), then set
7294
+ // "default" to the CommonJS "module.exports" for node compatibility.
7295
+ isNodeMode || !mod || !mod.__esModule ? __defProp2(target, "default", { value: mod, enumerable: true }) : target,
7296
+ mod
7297
+ ));
7298
+ var __toCommonJS = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
7299
+ var dist_src_exports = {};
7300
+ __export(dist_src_exports, {
7301
+ request: () => request
7302
+ });
7303
+ module2.exports = __toCommonJS(dist_src_exports);
7304
+ var import_endpoint = require_dist_node2();
7305
+ var import_universal_user_agent = require_dist_node();
7306
+ var VERSION = "6.2.5";
7307
+ var import_is_plain_object = require_is_plain_object();
7308
+ var import_node_fetch = __toESM2(require_lib3());
7309
+ var import_request_error = require_dist_node4();
7264
7310
  function getBufferResponse(response) {
7265
7311
  return response.arrayBuffer();
7266
7312
  }
7267
7313
  function fetchWrapper(requestOptions) {
7268
7314
  const log = requestOptions.request && requestOptions.request.log ? requestOptions.request.log : console;
7269
- if (isPlainObject.isPlainObject(requestOptions.body) || Array.isArray(requestOptions.body)) {
7315
+ if ((0, import_is_plain_object.isPlainObject)(requestOptions.body) || Array.isArray(requestOptions.body)) {
7270
7316
  requestOptions.body = JSON.stringify(requestOptions.body);
7271
7317
  }
7272
7318
  let headers = {};
7273
7319
  let status;
7274
7320
  let url;
7275
7321
  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) => {
7322
+ import_node_fetch.default;
7323
+ return fetch(
7324
+ requestOptions.url,
7325
+ Object.assign(
7326
+ {
7327
+ method: requestOptions.method,
7328
+ body: requestOptions.body,
7329
+ headers: requestOptions.headers,
7330
+ redirect: requestOptions.redirect,
7331
+ // duplex must be set if request.body is ReadableStream or Async Iterables.
7332
+ // See https://fetch.spec.whatwg.org/#dom-requestinit-duplex.
7333
+ ...requestOptions.body && { duplex: "half" }
7334
+ },
7335
+ // `requestOptions.request.agent` type is incompatible
7336
+ // see https://github.com/octokit/types.ts/pull/264
7337
+ requestOptions.request
7338
+ )
7339
+ ).then(async (response) => {
7288
7340
  url = response.url;
7289
7341
  status = response.status;
7290
7342
  for (const keyAndValue of response.headers) {
@@ -7293,7 +7345,9 @@ var require_dist_node5 = __commonJS({
7293
7345
  if ("deprecation" in headers) {
7294
7346
  const matches = headers.link && headers.link.match(/<([^>]+)>; rel="deprecation"/);
7295
7347
  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}` : ""}`);
7348
+ log.warn(
7349
+ `[@octokit/request] "${requestOptions.method} ${requestOptions.url}" is deprecated. It is scheduled to be removed on ${headers.sunset}${deprecationLink ? `. See ${deprecationLink}` : ""}`
7350
+ );
7297
7351
  }
7298
7352
  if (status === 204 || status === 205) {
7299
7353
  return;
@@ -7302,7 +7356,7 @@ var require_dist_node5 = __commonJS({
7302
7356
  if (status < 400) {
7303
7357
  return;
7304
7358
  }
7305
- throw new requestError.RequestError(response.statusText, status, {
7359
+ throw new import_request_error.RequestError(response.statusText, status, {
7306
7360
  response: {
7307
7361
  url,
7308
7362
  status,
@@ -7313,7 +7367,7 @@ var require_dist_node5 = __commonJS({
7313
7367
  });
7314
7368
  }
7315
7369
  if (status === 304) {
7316
- throw new requestError.RequestError("Not modified", status, {
7370
+ throw new import_request_error.RequestError("Not modified", status, {
7317
7371
  response: {
7318
7372
  url,
7319
7373
  status,
@@ -7325,7 +7379,7 @@ var require_dist_node5 = __commonJS({
7325
7379
  }
7326
7380
  if (status >= 400) {
7327
7381
  const data = await getResponseData(response);
7328
- const error = new requestError.RequestError(toErrorMessage(data), status, {
7382
+ const error = new import_request_error.RequestError(toErrorMessage(data), status, {
7329
7383
  response: {
7330
7384
  url,
7331
7385
  status,
@@ -7345,11 +7399,11 @@ var require_dist_node5 = __commonJS({
7345
7399
  data
7346
7400
  };
7347
7401
  }).catch((error) => {
7348
- if (error instanceof requestError.RequestError)
7402
+ if (error instanceof import_request_error.RequestError)
7349
7403
  throw error;
7350
7404
  else if (error.name === "AbortError")
7351
7405
  throw error;
7352
- throw new requestError.RequestError(error.message, 500, {
7406
+ throw new import_request_error.RequestError(error.message, 500, {
7353
7407
  request: requestOptions
7354
7408
  });
7355
7409
  });
@@ -7383,7 +7437,9 @@ var require_dist_node5 = __commonJS({
7383
7437
  return fetchWrapper(endpoint2.parse(endpointOptions));
7384
7438
  }
7385
7439
  const request2 = (route2, parameters2) => {
7386
- return fetchWrapper(endpoint2.parse(endpoint2.merge(route2, parameters2)));
7440
+ return fetchWrapper(
7441
+ endpoint2.parse(endpoint2.merge(route2, parameters2))
7442
+ );
7387
7443
  };
7388
7444
  Object.assign(request2, {
7389
7445
  endpoint: endpoint2,
@@ -7396,12 +7452,11 @@ var require_dist_node5 = __commonJS({
7396
7452
  defaults: withDefaults.bind(null, endpoint2)
7397
7453
  });
7398
7454
  }
7399
- var request = withDefaults(endpoint.endpoint, {
7455
+ var request = withDefaults(import_endpoint.endpoint, {
7400
7456
  headers: {
7401
- "user-agent": `octokit-request.js/${VERSION} ${universalUserAgent.getUserAgent()}`
7457
+ "user-agent": `octokit-request.js/${VERSION} ${(0, import_universal_user_agent.getUserAgent)()}`
7402
7458
  }
7403
7459
  });
7404
- exports2.request = request;
7405
7460
  }
7406
7461
  });
7407
7462
 
@@ -8049,7 +8104,7 @@ var require_dist_node9 = __commonJS({
8049
8104
  endpoint.headers.authorization = "token " + token;
8050
8105
  return request2(endpoint);
8051
8106
  }
8052
- function createOAuthUserAuth({
8107
+ function createOAuthUserAuth2({
8053
8108
  clientId,
8054
8109
  clientSecret,
8055
8110
  clientType = "oauth-app",
@@ -8074,8 +8129,8 @@ var require_dist_node9 = __commonJS({
8074
8129
  hook: hook.bind(null, state)
8075
8130
  });
8076
8131
  }
8077
- createOAuthUserAuth.VERSION = VERSION;
8078
- exports2.createOAuthUserAuth = createOAuthUserAuth;
8132
+ createOAuthUserAuth2.VERSION = VERSION;
8133
+ exports2.createOAuthUserAuth = createOAuthUserAuth2;
8079
8134
  exports2.requiresBasicAuth = requiresBasicAuth;
8080
8135
  }
8081
8136
  });
@@ -9292,7 +9347,7 @@ var require_semver = __commonJS({
9292
9347
  version = version.version;
9293
9348
  }
9294
9349
  } else if (typeof version !== "string") {
9295
- throw new TypeError(`Invalid Version: ${require("util").inspect(version)}`);
9350
+ throw new TypeError(`Invalid version. Must be a string. Got type "${typeof version}".`);
9296
9351
  }
9297
9352
  if (version.length > MAX_LENGTH) {
9298
9353
  throw new TypeError(
@@ -12555,10 +12610,10 @@ var require_lodash = __commonJS({
12555
12610
  }();
12556
12611
  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
12612
  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();
12613
+ 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");
12614
+ var metaMap = WeakMap2 && new WeakMap2();
12560
12615
  var realNames = {};
12561
- var dataViewCtorString = toSource(DataView), mapCtorString = toSource(Map2), promiseCtorString = toSource(Promise2), setCtorString = toSource(Set2), weakMapCtorString = toSource(WeakMap);
12616
+ var dataViewCtorString = toSource(DataView), mapCtorString = toSource(Map2), promiseCtorString = toSource(Promise2), setCtorString = toSource(Set2), weakMapCtorString = toSource(WeakMap2);
12562
12617
  var symbolProto = Symbol2 ? Symbol2.prototype : undefined2, symbolValueOf = symbolProto ? symbolProto.valueOf : undefined2, symbolToString = symbolProto ? symbolProto.toString : undefined2;
12563
12618
  function lodash(value) {
12564
12619
  if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) {
@@ -14612,7 +14667,7 @@ var require_lodash = __commonJS({
14612
14667
  return result2;
14613
14668
  };
14614
14669
  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) {
14670
+ 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
14671
  getTag = function(value) {
14617
14672
  var result2 = baseGetTag(value), Ctor = result2 == objectTag ? value.constructor : undefined2, ctorString = Ctor ? toSource(Ctor) : "";
14618
14673
  if (ctorString) {
@@ -17596,298 +17651,1290 @@ var require_dist_node11 = __commonJS({
17596
17651
  }
17597
17652
  });
17598
17653
 
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) {
17654
+ // node_modules/@octokit/auth-app/node_modules/lru-cache/dist/cjs/index.js
17655
+ var require_cjs = __commonJS({
17656
+ "node_modules/@octokit/auth-app/node_modules/lru-cache/dist/cjs/index.js"(exports2) {
17602
17657
  "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;
17615
- var LRUCache = class {
17616
- 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();
17634
- }
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);
17641
- }
17642
- get max() {
17643
- return this[MAX];
17644
- }
17645
- set allowStale(allowStale) {
17646
- this[ALLOW_STALE] = !!allowStale;
17647
- }
17648
- get allowStale() {
17649
- return this[ALLOW_STALE];
17650
- }
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);
17658
+ Object.defineProperty(exports2, "__esModule", { value: true });
17659
+ exports2.LRUCache = void 0;
17660
+ var perf = typeof performance === "object" && performance && typeof performance.now === "function" ? performance : Date;
17661
+ var warned = /* @__PURE__ */ new Set();
17662
+ var PROCESS = typeof process === "object" && !!process ? process : {};
17663
+ var emitWarning = (msg, type, code, fn) => {
17664
+ typeof PROCESS.emitWarning === "function" ? PROCESS.emitWarning(msg, type, code, fn) : console.error(`[${code}] ${type}: ${msg}`);
17665
+ };
17666
+ var AC = globalThis.AbortController;
17667
+ var AS = globalThis.AbortSignal;
17668
+ var _a;
17669
+ if (typeof AC === "undefined") {
17670
+ AS = class AbortSignal {
17671
+ onabort;
17672
+ _onabort = [];
17673
+ reason;
17674
+ aborted = false;
17675
+ addEventListener(_, fn) {
17676
+ this._onabort.push(fn);
17677
+ }
17678
+ };
17679
+ AC = class AbortController {
17680
+ constructor() {
17681
+ warnACPolyfill();
17682
+ }
17683
+ signal = new AS();
17684
+ abort(reason) {
17685
+ var _a2, _b;
17686
+ if (this.signal.aborted)
17687
+ return;
17688
+ this.signal.reason = reason;
17689
+ this.signal.aborted = true;
17690
+ for (const fn of this.signal._onabort) {
17691
+ fn(reason);
17692
+ }
17693
+ (_b = (_a2 = this.signal).onabort) == null ? void 0 : _b.call(_a2, reason);
17694
+ }
17695
+ };
17696
+ let printACPolyfillWarning = ((_a = PROCESS.env) == null ? void 0 : _a.LRU_CACHE_IGNORE_AC_WARNING) !== "1";
17697
+ const warnACPolyfill = () => {
17698
+ if (!printACPolyfillWarning)
17699
+ return;
17700
+ printACPolyfillWarning = false;
17701
+ 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);
17702
+ };
17703
+ }
17704
+ var shouldWarn = (code) => !warned.has(code);
17705
+ var TYPE = Symbol("type");
17706
+ var isPosInt = (n) => n && n === Math.floor(n) && n > 0 && isFinite(n);
17707
+ 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;
17708
+ var ZeroArray = class extends Array {
17709
+ constructor(size) {
17710
+ super(size);
17711
+ this.fill(0);
17656
17712
  }
17657
- get maxAge() {
17658
- return this[MAX_AGE];
17713
+ };
17714
+ var _constructing;
17715
+ var _Stack = class {
17716
+ heap;
17717
+ length;
17718
+ static create(max) {
17719
+ const HeapCls = getUintArray(max);
17720
+ if (!HeapCls)
17721
+ return [];
17722
+ __privateSet(_Stack, _constructing, true);
17723
+ const s = new _Stack(max, HeapCls);
17724
+ __privateSet(_Stack, _constructing, false);
17725
+ return s;
17659
17726
  }
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
- });
17727
+ constructor(max, HeapCls) {
17728
+ if (!__privateGet(_Stack, _constructing)) {
17729
+ throw new TypeError("instantiate Stack using Stack.create(n)");
17671
17730
  }
17672
- trim(this);
17731
+ this.heap = new HeapCls(max);
17732
+ this.length = 0;
17673
17733
  }
17674
- get lengthCalculator() {
17675
- return this[LENGTH_CALCULATOR];
17734
+ push(n) {
17735
+ this.heap[this.length++] = n;
17676
17736
  }
17677
- get length() {
17678
- return this[LENGTH];
17737
+ pop() {
17738
+ return this.heap[--this.length];
17679
17739
  }
17680
- get itemCount() {
17681
- return this[LRU_LIST].length;
17740
+ };
17741
+ var Stack = _Stack;
17742
+ _constructing = new WeakMap();
17743
+ // private constructor
17744
+ __privateAdd(Stack, _constructing, false);
17745
+ var LRUCache = class {
17746
+ // properties coming in from the options of these, only max and maxSize
17747
+ // really *need* to be protected. The rest can be modified, as they just
17748
+ // set defaults for various methods.
17749
+ #max;
17750
+ #maxSize;
17751
+ #dispose;
17752
+ #disposeAfter;
17753
+ #fetchMethod;
17754
+ /**
17755
+ * {@link LRUCache.OptionsBase.ttl}
17756
+ */
17757
+ ttl;
17758
+ /**
17759
+ * {@link LRUCache.OptionsBase.ttlResolution}
17760
+ */
17761
+ ttlResolution;
17762
+ /**
17763
+ * {@link LRUCache.OptionsBase.ttlAutopurge}
17764
+ */
17765
+ ttlAutopurge;
17766
+ /**
17767
+ * {@link LRUCache.OptionsBase.updateAgeOnGet}
17768
+ */
17769
+ updateAgeOnGet;
17770
+ /**
17771
+ * {@link LRUCache.OptionsBase.updateAgeOnHas}
17772
+ */
17773
+ updateAgeOnHas;
17774
+ /**
17775
+ * {@link LRUCache.OptionsBase.allowStale}
17776
+ */
17777
+ allowStale;
17778
+ /**
17779
+ * {@link LRUCache.OptionsBase.noDisposeOnSet}
17780
+ */
17781
+ noDisposeOnSet;
17782
+ /**
17783
+ * {@link LRUCache.OptionsBase.noUpdateTTL}
17784
+ */
17785
+ noUpdateTTL;
17786
+ /**
17787
+ * {@link LRUCache.OptionsBase.maxEntrySize}
17788
+ */
17789
+ maxEntrySize;
17790
+ /**
17791
+ * {@link LRUCache.OptionsBase.sizeCalculation}
17792
+ */
17793
+ sizeCalculation;
17794
+ /**
17795
+ * {@link LRUCache.OptionsBase.noDeleteOnFetchRejection}
17796
+ */
17797
+ noDeleteOnFetchRejection;
17798
+ /**
17799
+ * {@link LRUCache.OptionsBase.noDeleteOnStaleGet}
17800
+ */
17801
+ noDeleteOnStaleGet;
17802
+ /**
17803
+ * {@link LRUCache.OptionsBase.allowStaleOnFetchAbort}
17804
+ */
17805
+ allowStaleOnFetchAbort;
17806
+ /**
17807
+ * {@link LRUCache.OptionsBase.allowStaleOnFetchRejection}
17808
+ */
17809
+ allowStaleOnFetchRejection;
17810
+ /**
17811
+ * {@link LRUCache.OptionsBase.ignoreFetchAbort}
17812
+ */
17813
+ ignoreFetchAbort;
17814
+ // computed properties
17815
+ #size;
17816
+ #calculatedSize;
17817
+ #keyMap;
17818
+ #keyList;
17819
+ #valList;
17820
+ #next;
17821
+ #prev;
17822
+ #head;
17823
+ #tail;
17824
+ #free;
17825
+ #disposed;
17826
+ #sizes;
17827
+ #starts;
17828
+ #ttls;
17829
+ #hasDispose;
17830
+ #hasFetchMethod;
17831
+ #hasDisposeAfter;
17832
+ /**
17833
+ * Do not call this method unless you need to inspect the
17834
+ * inner workings of the cache. If anything returned by this
17835
+ * object is modified in any way, strange breakage may occur.
17836
+ *
17837
+ * These fields are private for a reason!
17838
+ *
17839
+ * @internal
17840
+ */
17841
+ static unsafeExposeInternals(c) {
17842
+ return {
17843
+ // properties
17844
+ starts: c.#starts,
17845
+ ttls: c.#ttls,
17846
+ sizes: c.#sizes,
17847
+ keyMap: c.#keyMap,
17848
+ keyList: c.#keyList,
17849
+ valList: c.#valList,
17850
+ next: c.#next,
17851
+ prev: c.#prev,
17852
+ get head() {
17853
+ return c.#head;
17854
+ },
17855
+ get tail() {
17856
+ return c.#tail;
17857
+ },
17858
+ free: c.#free,
17859
+ // methods
17860
+ isBackgroundFetch: (p) => c.#isBackgroundFetch(p),
17861
+ backgroundFetch: (k, index, options, context) => c.#backgroundFetch(k, index, options, context),
17862
+ moveToTail: (index) => c.#moveToTail(index),
17863
+ indexes: (options) => c.#indexes(options),
17864
+ rindexes: (options) => c.#rindexes(options),
17865
+ isStale: (index) => c.#isStale(index)
17866
+ };
17682
17867
  }
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;
17689
- }
17868
+ // Protected read-only members
17869
+ /**
17870
+ * {@link LRUCache.OptionsBase.max} (read-only)
17871
+ */
17872
+ get max() {
17873
+ return this.#max;
17690
17874
  }
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;
17697
- }
17875
+ /**
17876
+ * {@link LRUCache.OptionsBase.maxSize} (read-only)
17877
+ */
17878
+ get maxSize() {
17879
+ return this.#maxSize;
17698
17880
  }
17699
- keys() {
17700
- return this[LRU_LIST].toArray().map((k) => k.key);
17881
+ /**
17882
+ * The total computed size of items in the cache (read-only)
17883
+ */
17884
+ get calculatedSize() {
17885
+ return this.#calculatedSize;
17701
17886
  }
17702
- values() {
17703
- return this[LRU_LIST].toArray().map((k) => k.value);
17887
+ /**
17888
+ * The number of items stored in the cache (read-only)
17889
+ */
17890
+ get size() {
17891
+ return this.#size;
17704
17892
  }
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));
17708
- }
17709
- this[CACHE] = /* @__PURE__ */ new Map();
17710
- this[LRU_LIST] = new Yallist();
17711
- this[LENGTH] = 0;
17893
+ /**
17894
+ * {@link LRUCache.OptionsBase.fetchMethod} (read-only)
17895
+ */
17896
+ get fetchMethod() {
17897
+ return this.#fetchMethod;
17712
17898
  }
17713
- 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);
17899
+ /**
17900
+ * {@link LRUCache.OptionsBase.dispose} (read-only)
17901
+ */
17902
+ get dispose() {
17903
+ return this.#dispose;
17719
17904
  }
17720
- dumpLru() {
17721
- return this[LRU_LIST];
17905
+ /**
17906
+ * {@link LRUCache.OptionsBase.disposeAfter} (read-only)
17907
+ */
17908
+ get disposeAfter() {
17909
+ return this.#disposeAfter;
17722
17910
  }
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;
17911
+ constructor(options) {
17912
+ 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;
17913
+ if (max !== 0 && !isPosInt(max)) {
17914
+ throw new TypeError("max option must be a nonnegative integer");
17915
+ }
17916
+ const UintArray = max ? getUintArray(max) : Array;
17917
+ if (!UintArray) {
17918
+ throw new Error("invalid max value: " + max);
17919
+ }
17920
+ this.#max = max;
17921
+ this.#maxSize = maxSize;
17922
+ this.maxEntrySize = maxEntrySize || this.#maxSize;
17923
+ this.sizeCalculation = sizeCalculation;
17924
+ if (this.sizeCalculation) {
17925
+ if (!this.#maxSize && !this.maxEntrySize) {
17926
+ throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");
17927
+ }
17928
+ if (typeof this.sizeCalculation !== "function") {
17929
+ throw new TypeError("sizeCalculation set to non-function");
17930
+ }
17931
+ }
17932
+ if (fetchMethod !== void 0 && typeof fetchMethod !== "function") {
17933
+ throw new TypeError("fetchMethod must be a function if specified");
17934
+ }
17935
+ this.#fetchMethod = fetchMethod;
17936
+ this.#hasFetchMethod = !!fetchMethod;
17937
+ this.#keyMap = /* @__PURE__ */ new Map();
17938
+ this.#keyList = new Array(max).fill(void 0);
17939
+ this.#valList = new Array(max).fill(void 0);
17940
+ this.#next = new UintArray(max);
17941
+ this.#prev = new UintArray(max);
17942
+ this.#head = 0;
17943
+ this.#tail = 0;
17944
+ this.#free = Stack.create(max);
17945
+ this.#size = 0;
17946
+ this.#calculatedSize = 0;
17947
+ if (typeof dispose === "function") {
17948
+ this.#dispose = dispose;
17949
+ }
17950
+ if (typeof disposeAfter === "function") {
17951
+ this.#disposeAfter = disposeAfter;
17952
+ this.#disposed = [];
17953
+ } else {
17954
+ this.#disposeAfter = void 0;
17955
+ this.#disposed = void 0;
17956
+ }
17957
+ this.#hasDispose = !!this.#dispose;
17958
+ this.#hasDisposeAfter = !!this.#disposeAfter;
17959
+ this.noDisposeOnSet = !!noDisposeOnSet;
17960
+ this.noUpdateTTL = !!noUpdateTTL;
17961
+ this.noDeleteOnFetchRejection = !!noDeleteOnFetchRejection;
17962
+ this.allowStaleOnFetchRejection = !!allowStaleOnFetchRejection;
17963
+ this.allowStaleOnFetchAbort = !!allowStaleOnFetchAbort;
17964
+ this.ignoreFetchAbort = !!ignoreFetchAbort;
17965
+ if (this.maxEntrySize !== 0) {
17966
+ if (this.#maxSize !== 0) {
17967
+ if (!isPosInt(this.#maxSize)) {
17968
+ throw new TypeError("maxSize must be a positive integer if specified");
17969
+ }
17733
17970
  }
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);
17971
+ if (!isPosInt(this.maxEntrySize)) {
17972
+ throw new TypeError("maxEntrySize must be a positive integer if specified");
17739
17973
  }
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;
17974
+ this.#initializeSizeTracking();
17748
17975
  }
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;
17976
+ this.allowStale = !!allowStale;
17977
+ this.noDeleteOnStaleGet = !!noDeleteOnStaleGet;
17978
+ this.updateAgeOnGet = !!updateAgeOnGet;
17979
+ this.updateAgeOnHas = !!updateAgeOnHas;
17980
+ this.ttlResolution = isPosInt(ttlResolution) || ttlResolution === 0 ? ttlResolution : 1;
17981
+ this.ttlAutopurge = !!ttlAutopurge;
17982
+ this.ttl = ttl || 0;
17983
+ if (this.ttl) {
17984
+ if (!isPosInt(this.ttl)) {
17985
+ throw new TypeError("ttl must be a positive integer if specified");
17986
+ }
17987
+ this.#initializeTTLTracking();
17988
+ }
17989
+ if (this.#max === 0 && this.ttl === 0 && this.#maxSize === 0) {
17990
+ throw new TypeError("At least one of max, maxSize, or ttl is required");
17991
+ }
17992
+ if (!this.ttlAutopurge && !this.#max && !this.#maxSize) {
17993
+ const code = "LRU_CACHE_UNBOUNDED";
17994
+ if (shouldWarn(code)) {
17995
+ warned.add(code);
17996
+ const msg = "TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.";
17997
+ emitWarning(msg, "UnboundedCacheWarning", code, LRUCache);
17998
+ }
17754
17999
  }
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;
17760
- }
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);
17766
- }
17767
- get(key) {
17768
- return get(this, key, true);
17769
- }
17770
- peek(key) {
17771
- return get(this, key, false);
17772
- }
17773
- pop() {
17774
- const node = this[LRU_LIST].tail;
17775
- if (!node)
17776
- return null;
17777
- del(this, node);
17778
- return node.value;
17779
18000
  }
17780
- del(key) {
17781
- del(this, this[CACHE].get(key));
18001
+ /**
18002
+ * Return the remaining TTL time for a given entry key
18003
+ */
18004
+ getRemainingTTL(key) {
18005
+ return this.#keyMap.has(key) ? Infinity : 0;
18006
+ }
18007
+ #initializeTTLTracking() {
18008
+ const ttls = new ZeroArray(this.#max);
18009
+ const starts = new ZeroArray(this.#max);
18010
+ this.#ttls = ttls;
18011
+ this.#starts = starts;
18012
+ this.#setItemTTL = (index, ttl, start = perf.now()) => {
18013
+ starts[index] = ttl !== 0 ? start : 0;
18014
+ ttls[index] = ttl;
18015
+ if (ttl !== 0 && this.ttlAutopurge) {
18016
+ const t = setTimeout(() => {
18017
+ if (this.#isStale(index)) {
18018
+ this.delete(this.#keyList[index]);
18019
+ }
18020
+ }, ttl + 1);
18021
+ if (t.unref) {
18022
+ t.unref();
18023
+ }
18024
+ }
18025
+ };
18026
+ this.#updateItemAge = (index) => {
18027
+ starts[index] = ttls[index] !== 0 ? perf.now() : 0;
18028
+ };
18029
+ this.#statusTTL = (status, index) => {
18030
+ if (ttls[index]) {
18031
+ const ttl = ttls[index];
18032
+ const start = starts[index];
18033
+ status.ttl = ttl;
18034
+ status.start = start;
18035
+ status.now = cachedNow || getNow();
18036
+ const age = status.now - start;
18037
+ status.remainingTTL = ttl - age;
18038
+ }
18039
+ };
18040
+ let cachedNow = 0;
18041
+ const getNow = () => {
18042
+ const n = perf.now();
18043
+ if (this.ttlResolution > 0) {
18044
+ cachedNow = n;
18045
+ const t = setTimeout(() => cachedNow = 0, this.ttlResolution);
18046
+ if (t.unref) {
18047
+ t.unref();
18048
+ }
18049
+ }
18050
+ return n;
18051
+ };
18052
+ this.getRemainingTTL = (key) => {
18053
+ const index = this.#keyMap.get(key);
18054
+ if (index === void 0) {
18055
+ return 0;
18056
+ }
18057
+ const ttl = ttls[index];
18058
+ const start = starts[index];
18059
+ if (ttl === 0 || start === 0) {
18060
+ return Infinity;
18061
+ }
18062
+ const age = (cachedNow || getNow()) - start;
18063
+ return ttl - age;
18064
+ };
18065
+ this.#isStale = (index) => {
18066
+ return ttls[index] !== 0 && starts[index] !== 0 && (cachedNow || getNow()) - starts[index] > ttls[index];
18067
+ };
18068
+ }
18069
+ // conditionally set private methods related to TTL
18070
+ #updateItemAge = () => {
18071
+ };
18072
+ #statusTTL = () => {
18073
+ };
18074
+ #setItemTTL = () => {
18075
+ };
18076
+ /* c8 ignore stop */
18077
+ #isStale = () => false;
18078
+ #initializeSizeTracking() {
18079
+ const sizes = new ZeroArray(this.#max);
18080
+ this.#calculatedSize = 0;
18081
+ this.#sizes = sizes;
18082
+ this.#removeItemSize = (index) => {
18083
+ this.#calculatedSize -= sizes[index];
18084
+ sizes[index] = 0;
18085
+ };
18086
+ this.#requireSize = (k, v, size, sizeCalculation) => {
18087
+ if (this.#isBackgroundFetch(v)) {
18088
+ return 0;
18089
+ }
18090
+ if (!isPosInt(size)) {
18091
+ if (sizeCalculation) {
18092
+ if (typeof sizeCalculation !== "function") {
18093
+ throw new TypeError("sizeCalculation must be a function");
18094
+ }
18095
+ size = sizeCalculation(v, k);
18096
+ if (!isPosInt(size)) {
18097
+ throw new TypeError("sizeCalculation return invalid (expect positive integer)");
18098
+ }
18099
+ } else {
18100
+ throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");
18101
+ }
18102
+ }
18103
+ return size;
18104
+ };
18105
+ this.#addItemSize = (index, size, status) => {
18106
+ sizes[index] = size;
18107
+ if (this.#maxSize) {
18108
+ const maxSize = this.#maxSize - sizes[index];
18109
+ while (this.#calculatedSize > maxSize) {
18110
+ this.#evict(true);
18111
+ }
18112
+ }
18113
+ this.#calculatedSize += sizes[index];
18114
+ if (status) {
18115
+ status.entrySize = size;
18116
+ status.totalCalculatedSize = this.#calculatedSize;
18117
+ }
18118
+ };
18119
+ }
18120
+ #removeItemSize = (_i) => {
18121
+ };
18122
+ #addItemSize = (_i, _s, _st) => {
18123
+ };
18124
+ #requireSize = (_k, _v, size, sizeCalculation) => {
18125
+ if (size || sizeCalculation) {
18126
+ throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");
18127
+ }
18128
+ return 0;
18129
+ };
18130
+ *#indexes({ allowStale = this.allowStale } = {}) {
18131
+ if (this.#size) {
18132
+ for (let i = this.#tail; true; ) {
18133
+ if (!this.#isValidIndex(i)) {
18134
+ break;
18135
+ }
18136
+ if (allowStale || !this.#isStale(i)) {
18137
+ yield i;
18138
+ }
18139
+ if (i === this.#head) {
18140
+ break;
18141
+ } else {
18142
+ i = this.#prev[i];
18143
+ }
18144
+ }
18145
+ }
18146
+ }
18147
+ *#rindexes({ allowStale = this.allowStale } = {}) {
18148
+ if (this.#size) {
18149
+ for (let i = this.#head; true; ) {
18150
+ if (!this.#isValidIndex(i)) {
18151
+ break;
18152
+ }
18153
+ if (allowStale || !this.#isStale(i)) {
18154
+ yield i;
18155
+ }
18156
+ if (i === this.#tail) {
18157
+ break;
18158
+ } else {
18159
+ i = this.#next[i];
18160
+ }
18161
+ }
18162
+ }
18163
+ }
18164
+ #isValidIndex(index) {
18165
+ return index !== void 0 && this.#keyMap.get(this.#keyList[index]) === index;
18166
+ }
18167
+ /**
18168
+ * Return a generator yielding `[key, value]` pairs,
18169
+ * in order from most recently used to least recently used.
18170
+ */
18171
+ *entries() {
18172
+ for (const i of this.#indexes()) {
18173
+ if (this.#valList[i] !== void 0 && this.#keyList[i] !== void 0 && !this.#isBackgroundFetch(this.#valList[i])) {
18174
+ yield [this.#keyList[i], this.#valList[i]];
18175
+ }
18176
+ }
17782
18177
  }
18178
+ /**
18179
+ * Inverse order version of {@link LRUCache.entries}
18180
+ *
18181
+ * Return a generator yielding `[key, value]` pairs,
18182
+ * in order from least recently used to most recently used.
18183
+ */
18184
+ *rentries() {
18185
+ for (const i of this.#rindexes()) {
18186
+ if (this.#valList[i] !== void 0 && this.#keyList[i] !== void 0 && !this.#isBackgroundFetch(this.#valList[i])) {
18187
+ yield [this.#keyList[i], this.#valList[i]];
18188
+ }
18189
+ }
18190
+ }
18191
+ /**
18192
+ * Return a generator yielding the keys in the cache,
18193
+ * in order from most recently used to least recently used.
18194
+ */
18195
+ *keys() {
18196
+ for (const i of this.#indexes()) {
18197
+ const k = this.#keyList[i];
18198
+ if (k !== void 0 && !this.#isBackgroundFetch(this.#valList[i])) {
18199
+ yield k;
18200
+ }
18201
+ }
18202
+ }
18203
+ /**
18204
+ * Inverse order version of {@link LRUCache.keys}
18205
+ *
18206
+ * Return a generator yielding the keys in the cache,
18207
+ * in order from least recently used to most recently used.
18208
+ */
18209
+ *rkeys() {
18210
+ for (const i of this.#rindexes()) {
18211
+ const k = this.#keyList[i];
18212
+ if (k !== void 0 && !this.#isBackgroundFetch(this.#valList[i])) {
18213
+ yield k;
18214
+ }
18215
+ }
18216
+ }
18217
+ /**
18218
+ * Return a generator yielding the values in the cache,
18219
+ * in order from most recently used to least recently used.
18220
+ */
18221
+ *values() {
18222
+ for (const i of this.#indexes()) {
18223
+ const v = this.#valList[i];
18224
+ if (v !== void 0 && !this.#isBackgroundFetch(this.#valList[i])) {
18225
+ yield this.#valList[i];
18226
+ }
18227
+ }
18228
+ }
18229
+ /**
18230
+ * Inverse order version of {@link LRUCache.values}
18231
+ *
18232
+ * Return a generator yielding the values in the cache,
18233
+ * in order from least recently used to most recently used.
18234
+ */
18235
+ *rvalues() {
18236
+ for (const i of this.#rindexes()) {
18237
+ const v = this.#valList[i];
18238
+ if (v !== void 0 && !this.#isBackgroundFetch(this.#valList[i])) {
18239
+ yield this.#valList[i];
18240
+ }
18241
+ }
18242
+ }
18243
+ /**
18244
+ * Iterating over the cache itself yields the same results as
18245
+ * {@link LRUCache.entries}
18246
+ */
18247
+ [Symbol.iterator]() {
18248
+ return this.entries();
18249
+ }
18250
+ /**
18251
+ * Find a value for which the supplied fn method returns a truthy value,
18252
+ * similar to Array.find(). fn is called as fn(value, key, cache).
18253
+ */
18254
+ find(fn, getOptions = {}) {
18255
+ for (const i of this.#indexes()) {
18256
+ const v = this.#valList[i];
18257
+ const value = this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v;
18258
+ if (value === void 0)
18259
+ continue;
18260
+ if (fn(value, this.#keyList[i], this)) {
18261
+ return this.get(this.#keyList[i], getOptions);
18262
+ }
18263
+ }
18264
+ }
18265
+ /**
18266
+ * Call the supplied function on each item in the cache, in order from
18267
+ * most recently used to least recently used. fn is called as
18268
+ * fn(value, key, cache). Does not update age or recenty of use.
18269
+ * Does not iterate over stale values.
18270
+ */
18271
+ forEach(fn, thisp = this) {
18272
+ for (const i of this.#indexes()) {
18273
+ const v = this.#valList[i];
18274
+ const value = this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v;
18275
+ if (value === void 0)
18276
+ continue;
18277
+ fn.call(thisp, value, this.#keyList[i], this);
18278
+ }
18279
+ }
18280
+ /**
18281
+ * The same as {@link LRUCache.forEach} but items are iterated over in
18282
+ * reverse order. (ie, less recently used items are iterated over first.)
18283
+ */
18284
+ rforEach(fn, thisp = this) {
18285
+ for (const i of this.#rindexes()) {
18286
+ const v = this.#valList[i];
18287
+ const value = this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v;
18288
+ if (value === void 0)
18289
+ continue;
18290
+ fn.call(thisp, value, this.#keyList[i], this);
18291
+ }
18292
+ }
18293
+ /**
18294
+ * Delete any stale entries. Returns true if anything was removed,
18295
+ * false otherwise.
18296
+ */
18297
+ purgeStale() {
18298
+ let deleted = false;
18299
+ for (const i of this.#rindexes({ allowStale: true })) {
18300
+ if (this.#isStale(i)) {
18301
+ this.delete(this.#keyList[i]);
18302
+ deleted = true;
18303
+ }
18304
+ }
18305
+ return deleted;
18306
+ }
18307
+ /**
18308
+ * Return an array of [key, {@link LRUCache.Entry}] tuples which can be
18309
+ * passed to cache.load()
18310
+ */
18311
+ dump() {
18312
+ const arr = [];
18313
+ for (const i of this.#indexes({ allowStale: true })) {
18314
+ const key = this.#keyList[i];
18315
+ const v = this.#valList[i];
18316
+ const value = this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v;
18317
+ if (value === void 0 || key === void 0)
18318
+ continue;
18319
+ const entry = { value };
18320
+ if (this.#ttls && this.#starts) {
18321
+ entry.ttl = this.#ttls[i];
18322
+ const age = perf.now() - this.#starts[i];
18323
+ entry.start = Math.floor(Date.now() - age);
18324
+ }
18325
+ if (this.#sizes) {
18326
+ entry.size = this.#sizes[i];
18327
+ }
18328
+ arr.unshift([key, entry]);
18329
+ }
18330
+ return arr;
18331
+ }
18332
+ /**
18333
+ * Reset the cache and load in the items in entries in the order listed.
18334
+ * Note that the shape of the resulting cache may be different if the
18335
+ * same options are not used in both caches.
18336
+ */
17783
18337
  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);
18338
+ this.clear();
18339
+ for (const [key, entry] of arr) {
18340
+ if (entry.start) {
18341
+ const age = Date.now() - entry.start;
18342
+ entry.start = perf.now() - age;
18343
+ }
18344
+ this.set(key, entry.value, entry);
18345
+ }
18346
+ }
18347
+ /**
18348
+ * Add a value to the cache.
18349
+ *
18350
+ * Note: if `undefined` is specified as a value, this is an alias for
18351
+ * {@link LRUCache#delete}
18352
+ */
18353
+ set(k, v, setOptions = {}) {
18354
+ var _a2, _b, _c;
18355
+ if (v === void 0) {
18356
+ this.delete(k);
18357
+ return this;
18358
+ }
18359
+ const { ttl = this.ttl, start, noDisposeOnSet = this.noDisposeOnSet, sizeCalculation = this.sizeCalculation, status } = setOptions;
18360
+ let { noUpdateTTL = this.noUpdateTTL } = setOptions;
18361
+ const size = this.#requireSize(k, v, setOptions.size || 0, sizeCalculation);
18362
+ if (this.maxEntrySize && size > this.maxEntrySize) {
18363
+ if (status) {
18364
+ status.set = "miss";
18365
+ status.maxEntrySizeExceeded = true;
18366
+ }
18367
+ this.delete(k);
18368
+ return this;
18369
+ }
18370
+ let index = this.#size === 0 ? void 0 : this.#keyMap.get(k);
18371
+ if (index === void 0) {
18372
+ index = this.#size === 0 ? this.#tail : this.#free.length !== 0 ? this.#free.pop() : this.#size === this.#max ? this.#evict(false) : this.#size;
18373
+ this.#keyList[index] = k;
18374
+ this.#valList[index] = v;
18375
+ this.#keyMap.set(k, index);
18376
+ this.#next[this.#tail] = index;
18377
+ this.#prev[index] = this.#tail;
18378
+ this.#tail = index;
18379
+ this.#size++;
18380
+ this.#addItemSize(index, size, status);
18381
+ if (status)
18382
+ status.set = "add";
18383
+ noUpdateTTL = false;
18384
+ } else {
18385
+ this.#moveToTail(index);
18386
+ const oldVal = this.#valList[index];
18387
+ if (v !== oldVal) {
18388
+ if (this.#hasFetchMethod && this.#isBackgroundFetch(oldVal)) {
18389
+ oldVal.__abortController.abort(new Error("replaced"));
18390
+ } else if (!noDisposeOnSet) {
18391
+ if (this.#hasDispose) {
18392
+ (_a2 = this.#dispose) == null ? void 0 : _a2.call(this, oldVal, k, "set");
18393
+ }
18394
+ if (this.#hasDisposeAfter) {
18395
+ (_b = this.#disposed) == null ? void 0 : _b.push([oldVal, k, "set"]);
18396
+ }
17795
18397
  }
18398
+ this.#removeItemSize(index);
18399
+ this.#addItemSize(index, size, status);
18400
+ this.#valList[index] = v;
18401
+ if (status) {
18402
+ status.set = "replace";
18403
+ const oldValue = oldVal && this.#isBackgroundFetch(oldVal) ? oldVal.__staleWhileFetching : oldVal;
18404
+ if (oldValue !== void 0)
18405
+ status.oldValue = oldValue;
18406
+ }
18407
+ } else if (status) {
18408
+ status.set = "update";
18409
+ }
18410
+ }
18411
+ if (ttl !== 0 && !this.#ttls) {
18412
+ this.#initializeTTLTracking();
18413
+ }
18414
+ if (this.#ttls) {
18415
+ if (!noUpdateTTL) {
18416
+ this.#setItemTTL(index, ttl, start);
18417
+ }
18418
+ if (status)
18419
+ this.#statusTTL(status, index);
18420
+ }
18421
+ if (!noDisposeOnSet && this.#hasDisposeAfter && this.#disposed) {
18422
+ const dt = this.#disposed;
18423
+ let task;
18424
+ while (task = dt == null ? void 0 : dt.shift()) {
18425
+ (_c = this.#disposeAfter) == null ? void 0 : _c.call(this, ...task);
17796
18426
  }
17797
18427
  }
18428
+ return this;
17798
18429
  }
17799
- prune() {
17800
- this[CACHE].forEach((value, key) => get(this, key, false));
18430
+ /**
18431
+ * Evict the least recently used item, returning its value or
18432
+ * `undefined` if cache is empty.
18433
+ */
18434
+ pop() {
18435
+ var _a2;
18436
+ try {
18437
+ while (this.#size) {
18438
+ const val = this.#valList[this.#head];
18439
+ this.#evict(true);
18440
+ if (this.#isBackgroundFetch(val)) {
18441
+ if (val.__staleWhileFetching) {
18442
+ return val.__staleWhileFetching;
18443
+ }
18444
+ } else if (val !== void 0) {
18445
+ return val;
18446
+ }
18447
+ }
18448
+ } finally {
18449
+ if (this.#hasDisposeAfter && this.#disposed) {
18450
+ const dt = this.#disposed;
18451
+ let task;
18452
+ while (task = dt == null ? void 0 : dt.shift()) {
18453
+ (_a2 = this.#disposeAfter) == null ? void 0 : _a2.call(this, ...task);
18454
+ }
18455
+ }
18456
+ }
17801
18457
  }
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;
18458
+ #evict(free) {
18459
+ var _a2, _b;
18460
+ const head = this.#head;
18461
+ const k = this.#keyList[head];
18462
+ const v = this.#valList[head];
18463
+ if (this.#hasFetchMethod && this.#isBackgroundFetch(v)) {
18464
+ v.__abortController.abort(new Error("evicted"));
18465
+ } else if (this.#hasDispose || this.#hasDisposeAfter) {
18466
+ if (this.#hasDispose) {
18467
+ (_a2 = this.#dispose) == null ? void 0 : _a2.call(this, v, k, "evict");
18468
+ }
18469
+ if (this.#hasDisposeAfter) {
18470
+ (_b = this.#disposed) == null ? void 0 : _b.push([v, k, "evict"]);
18471
+ }
18472
+ }
18473
+ this.#removeItemSize(head);
18474
+ if (free) {
18475
+ this.#keyList[head] = void 0;
18476
+ this.#valList[head] = void 0;
18477
+ this.#free.push(head);
18478
+ }
18479
+ if (this.#size === 1) {
18480
+ this.#head = this.#tail = 0;
18481
+ this.#free.length = 0;
17811
18482
  } else {
17812
- if (doUse) {
17813
- if (self2[UPDATE_AGE_ON_GET])
17814
- node.value.now = Date.now();
17815
- self2[LRU_LIST].unshiftNode(node);
18483
+ this.#head = this.#next[head];
18484
+ }
18485
+ this.#keyMap.delete(k);
18486
+ this.#size--;
18487
+ return head;
18488
+ }
18489
+ /**
18490
+ * Check if a key is in the cache, without updating the recency of use.
18491
+ * Will return false if the item is stale, even though it is technically
18492
+ * in the cache.
18493
+ *
18494
+ * Will not update item age unless
18495
+ * {@link LRUCache.OptionsBase.updateAgeOnHas} is set.
18496
+ */
18497
+ has(k, hasOptions = {}) {
18498
+ const { updateAgeOnHas = this.updateAgeOnHas, status } = hasOptions;
18499
+ const index = this.#keyMap.get(k);
18500
+ if (index !== void 0) {
18501
+ const v = this.#valList[index];
18502
+ if (this.#isBackgroundFetch(v) && v.__staleWhileFetching === void 0) {
18503
+ return false;
18504
+ }
18505
+ if (!this.#isStale(index)) {
18506
+ if (updateAgeOnHas) {
18507
+ this.#updateItemAge(index);
18508
+ }
18509
+ if (status) {
18510
+ status.has = "hit";
18511
+ this.#statusTTL(status, index);
18512
+ }
18513
+ return true;
18514
+ } else if (status) {
18515
+ status.has = "stale";
18516
+ this.#statusTTL(status, index);
18517
+ }
18518
+ } else if (status) {
18519
+ status.has = "miss";
18520
+ }
18521
+ return false;
18522
+ }
18523
+ /**
18524
+ * Like {@link LRUCache#get} but doesn't update recency or delete stale
18525
+ * items.
18526
+ *
18527
+ * Returns `undefined` if the item is stale, unless
18528
+ * {@link LRUCache.OptionsBase.allowStale} is set.
18529
+ */
18530
+ peek(k, peekOptions = {}) {
18531
+ const { allowStale = this.allowStale } = peekOptions;
18532
+ const index = this.#keyMap.get(k);
18533
+ if (index !== void 0 && (allowStale || !this.#isStale(index))) {
18534
+ const v = this.#valList[index];
18535
+ return this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v;
18536
+ }
18537
+ }
18538
+ #backgroundFetch(k, index, options, context) {
18539
+ const v = index === void 0 ? void 0 : this.#valList[index];
18540
+ if (this.#isBackgroundFetch(v)) {
18541
+ return v;
18542
+ }
18543
+ const ac = new AC();
18544
+ const { signal } = options;
18545
+ signal == null ? void 0 : signal.addEventListener("abort", () => ac.abort(signal.reason), {
18546
+ signal: ac.signal
18547
+ });
18548
+ const fetchOpts = {
18549
+ signal: ac.signal,
18550
+ options,
18551
+ context
18552
+ };
18553
+ const cb = (v2, updateCache = false) => {
18554
+ const { aborted } = ac.signal;
18555
+ const ignoreAbort = options.ignoreFetchAbort && v2 !== void 0;
18556
+ if (options.status) {
18557
+ if (aborted && !updateCache) {
18558
+ options.status.fetchAborted = true;
18559
+ options.status.fetchError = ac.signal.reason;
18560
+ if (ignoreAbort)
18561
+ options.status.fetchAbortIgnored = true;
18562
+ } else {
18563
+ options.status.fetchResolved = true;
18564
+ }
18565
+ }
18566
+ if (aborted && !ignoreAbort && !updateCache) {
18567
+ return fetchFail(ac.signal.reason);
18568
+ }
18569
+ const bf2 = p;
18570
+ if (this.#valList[index] === p) {
18571
+ if (v2 === void 0) {
18572
+ if (bf2.__staleWhileFetching) {
18573
+ this.#valList[index] = bf2.__staleWhileFetching;
18574
+ } else {
18575
+ this.delete(k);
18576
+ }
18577
+ } else {
18578
+ if (options.status)
18579
+ options.status.fetchUpdated = true;
18580
+ this.set(k, v2, fetchOpts.options);
18581
+ }
18582
+ }
18583
+ return v2;
18584
+ };
18585
+ const eb = (er) => {
18586
+ if (options.status) {
18587
+ options.status.fetchRejected = true;
18588
+ options.status.fetchError = er;
18589
+ }
18590
+ return fetchFail(er);
18591
+ };
18592
+ const fetchFail = (er) => {
18593
+ const { aborted } = ac.signal;
18594
+ const allowStaleAborted = aborted && options.allowStaleOnFetchAbort;
18595
+ const allowStale = allowStaleAborted || options.allowStaleOnFetchRejection;
18596
+ const noDelete = allowStale || options.noDeleteOnFetchRejection;
18597
+ const bf2 = p;
18598
+ if (this.#valList[index] === p) {
18599
+ const del = !noDelete || bf2.__staleWhileFetching === void 0;
18600
+ if (del) {
18601
+ this.delete(k);
18602
+ } else if (!allowStaleAborted) {
18603
+ this.#valList[index] = bf2.__staleWhileFetching;
18604
+ }
18605
+ }
18606
+ if (allowStale) {
18607
+ if (options.status && bf2.__staleWhileFetching !== void 0) {
18608
+ options.status.returnedStale = true;
18609
+ }
18610
+ return bf2.__staleWhileFetching;
18611
+ } else if (bf2.__returned === bf2) {
18612
+ throw er;
18613
+ }
18614
+ };
18615
+ const pcall = (res, rej) => {
18616
+ var _a2;
18617
+ const fmp = (_a2 = this.#fetchMethod) == null ? void 0 : _a2.call(this, k, v, fetchOpts);
18618
+ if (fmp && fmp instanceof Promise) {
18619
+ fmp.then((v2) => res(v2), rej);
18620
+ }
18621
+ ac.signal.addEventListener("abort", () => {
18622
+ if (!options.ignoreFetchAbort || options.allowStaleOnFetchAbort) {
18623
+ res();
18624
+ if (options.allowStaleOnFetchAbort) {
18625
+ res = (v2) => cb(v2, true);
18626
+ }
18627
+ }
18628
+ });
18629
+ };
18630
+ if (options.status)
18631
+ options.status.fetchDispatched = true;
18632
+ const p = new Promise(pcall).then(cb, eb);
18633
+ const bf = Object.assign(p, {
18634
+ __abortController: ac,
18635
+ __staleWhileFetching: v,
18636
+ __returned: void 0
18637
+ });
18638
+ if (index === void 0) {
18639
+ this.set(k, bf, { ...fetchOpts.options, status: void 0 });
18640
+ index = this.#keyMap.get(k);
18641
+ } else {
18642
+ this.#valList[index] = bf;
18643
+ }
18644
+ return bf;
18645
+ }
18646
+ #isBackgroundFetch(p) {
18647
+ if (!this.#hasFetchMethod)
18648
+ return false;
18649
+ const b = p;
18650
+ return !!b && b instanceof Promise && b.hasOwnProperty("__staleWhileFetching") && b.__abortController instanceof AC;
18651
+ }
18652
+ async fetch(k, fetchOptions = {}) {
18653
+ const {
18654
+ // get options
18655
+ allowStale = this.allowStale,
18656
+ updateAgeOnGet = this.updateAgeOnGet,
18657
+ noDeleteOnStaleGet = this.noDeleteOnStaleGet,
18658
+ // set options
18659
+ ttl = this.ttl,
18660
+ noDisposeOnSet = this.noDisposeOnSet,
18661
+ size = 0,
18662
+ sizeCalculation = this.sizeCalculation,
18663
+ noUpdateTTL = this.noUpdateTTL,
18664
+ // fetch exclusive options
18665
+ noDeleteOnFetchRejection = this.noDeleteOnFetchRejection,
18666
+ allowStaleOnFetchRejection = this.allowStaleOnFetchRejection,
18667
+ ignoreFetchAbort = this.ignoreFetchAbort,
18668
+ allowStaleOnFetchAbort = this.allowStaleOnFetchAbort,
18669
+ context,
18670
+ forceRefresh = false,
18671
+ status,
18672
+ signal
18673
+ } = fetchOptions;
18674
+ if (!this.#hasFetchMethod) {
18675
+ if (status)
18676
+ status.fetch = "get";
18677
+ return this.get(k, {
18678
+ allowStale,
18679
+ updateAgeOnGet,
18680
+ noDeleteOnStaleGet,
18681
+ status
18682
+ });
18683
+ }
18684
+ const options = {
18685
+ allowStale,
18686
+ updateAgeOnGet,
18687
+ noDeleteOnStaleGet,
18688
+ ttl,
18689
+ noDisposeOnSet,
18690
+ size,
18691
+ sizeCalculation,
18692
+ noUpdateTTL,
18693
+ noDeleteOnFetchRejection,
18694
+ allowStaleOnFetchRejection,
18695
+ allowStaleOnFetchAbort,
18696
+ ignoreFetchAbort,
18697
+ status,
18698
+ signal
18699
+ };
18700
+ let index = this.#keyMap.get(k);
18701
+ if (index === void 0) {
18702
+ if (status)
18703
+ status.fetch = "miss";
18704
+ const p = this.#backgroundFetch(k, index, options, context);
18705
+ return p.__returned = p;
18706
+ } else {
18707
+ const v = this.#valList[index];
18708
+ if (this.#isBackgroundFetch(v)) {
18709
+ const stale = allowStale && v.__staleWhileFetching !== void 0;
18710
+ if (status) {
18711
+ status.fetch = "inflight";
18712
+ if (stale)
18713
+ status.returnedStale = true;
18714
+ }
18715
+ return stale ? v.__staleWhileFetching : v.__returned = v;
18716
+ }
18717
+ const isStale = this.#isStale(index);
18718
+ if (!forceRefresh && !isStale) {
18719
+ if (status)
18720
+ status.fetch = "hit";
18721
+ this.#moveToTail(index);
18722
+ if (updateAgeOnGet) {
18723
+ this.#updateItemAge(index);
18724
+ }
18725
+ if (status)
18726
+ this.#statusTTL(status, index);
18727
+ return v;
18728
+ }
18729
+ const p = this.#backgroundFetch(k, index, options, context);
18730
+ const hasStale = p.__staleWhileFetching !== void 0;
18731
+ const staleVal = hasStale && allowStale;
18732
+ if (status) {
18733
+ status.fetch = isStale ? "stale" : "refresh";
18734
+ if (staleVal && isStale)
18735
+ status.returnedStale = true;
18736
+ }
18737
+ return staleVal ? p.__staleWhileFetching : p.__returned = p;
18738
+ }
18739
+ }
18740
+ /**
18741
+ * Return a value from the cache. Will update the recency of the cache
18742
+ * entry found.
18743
+ *
18744
+ * If the key is not found, get() will return `undefined`.
18745
+ */
18746
+ get(k, getOptions = {}) {
18747
+ const { allowStale = this.allowStale, updateAgeOnGet = this.updateAgeOnGet, noDeleteOnStaleGet = this.noDeleteOnStaleGet, status } = getOptions;
18748
+ const index = this.#keyMap.get(k);
18749
+ if (index !== void 0) {
18750
+ const value = this.#valList[index];
18751
+ const fetching = this.#isBackgroundFetch(value);
18752
+ if (status)
18753
+ this.#statusTTL(status, index);
18754
+ if (this.#isStale(index)) {
18755
+ if (status)
18756
+ status.get = "stale";
18757
+ if (!fetching) {
18758
+ if (!noDeleteOnStaleGet) {
18759
+ this.delete(k);
18760
+ }
18761
+ if (status && allowStale)
18762
+ status.returnedStale = true;
18763
+ return allowStale ? value : void 0;
18764
+ } else {
18765
+ if (status && allowStale && value.__staleWhileFetching !== void 0) {
18766
+ status.returnedStale = true;
18767
+ }
18768
+ return allowStale ? value.__staleWhileFetching : void 0;
18769
+ }
18770
+ } else {
18771
+ if (status)
18772
+ status.get = "hit";
18773
+ if (fetching) {
18774
+ return value.__staleWhileFetching;
18775
+ }
18776
+ this.#moveToTail(index);
18777
+ if (updateAgeOnGet) {
18778
+ this.#updateItemAge(index);
18779
+ }
18780
+ return value;
17816
18781
  }
18782
+ } else if (status) {
18783
+ status.get = "miss";
17817
18784
  }
17818
- return hit.value;
17819
18785
  }
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;
17833
- }
18786
+ #connect(p, n) {
18787
+ this.#prev[n] = p;
18788
+ this.#next[p] = n;
17834
18789
  }
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);
18790
+ #moveToTail(index) {
18791
+ if (index !== this.#tail) {
18792
+ if (index === this.#head) {
18793
+ this.#head = this.#next[index];
18794
+ } else {
18795
+ this.#connect(this.#prev[index], this.#next[index]);
18796
+ }
18797
+ this.#connect(this.#tail, index);
18798
+ this.#tail = index;
18799
+ }
17844
18800
  }
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;
18801
+ /**
18802
+ * Deletes a key out of the cache.
18803
+ * Returns true if the key was deleted, false otherwise.
18804
+ */
18805
+ delete(k) {
18806
+ var _a2, _b, _c, _d;
18807
+ let deleted = false;
18808
+ if (this.#size !== 0) {
18809
+ const index = this.#keyMap.get(k);
18810
+ if (index !== void 0) {
18811
+ deleted = true;
18812
+ if (this.#size === 1) {
18813
+ this.clear();
18814
+ } else {
18815
+ this.#removeItemSize(index);
18816
+ const v = this.#valList[index];
18817
+ if (this.#isBackgroundFetch(v)) {
18818
+ v.__abortController.abort(new Error("deleted"));
18819
+ } else if (this.#hasDispose || this.#hasDisposeAfter) {
18820
+ if (this.#hasDispose) {
18821
+ (_a2 = this.#dispose) == null ? void 0 : _a2.call(this, v, k, "delete");
18822
+ }
18823
+ if (this.#hasDisposeAfter) {
18824
+ (_b = this.#disposed) == null ? void 0 : _b.push([v, k, "delete"]);
18825
+ }
18826
+ }
18827
+ this.#keyMap.delete(k);
18828
+ this.#keyList[index] = void 0;
18829
+ this.#valList[index] = void 0;
18830
+ if (index === this.#tail) {
18831
+ this.#tail = this.#prev[index];
18832
+ } else if (index === this.#head) {
18833
+ this.#head = this.#next[index];
18834
+ } else {
18835
+ this.#next[this.#prev[index]] = this.#next[index];
18836
+ this.#prev[this.#next[index]] = this.#prev[index];
18837
+ }
18838
+ this.#size--;
18839
+ this.#free.push(index);
18840
+ }
18841
+ }
18842
+ }
18843
+ if (this.#hasDisposeAfter && ((_c = this.#disposed) == null ? void 0 : _c.length)) {
18844
+ const dt = this.#disposed;
18845
+ let task;
18846
+ while (task = dt == null ? void 0 : dt.shift()) {
18847
+ (_d = this.#disposeAfter) == null ? void 0 : _d.call(this, ...task);
18848
+ }
18849
+ }
18850
+ return deleted;
17853
18851
  }
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;
18852
+ /**
18853
+ * Clear the cache entirely, throwing away all values.
18854
+ */
18855
+ clear() {
18856
+ var _a2, _b, _c;
18857
+ for (const index of this.#rindexes({ allowStale: true })) {
18858
+ const v = this.#valList[index];
18859
+ if (this.#isBackgroundFetch(v)) {
18860
+ v.__abortController.abort(new Error("deleted"));
18861
+ } else {
18862
+ const k = this.#keyList[index];
18863
+ if (this.#hasDispose) {
18864
+ (_a2 = this.#dispose) == null ? void 0 : _a2.call(this, v, k, "delete");
18865
+ }
18866
+ if (this.#hasDisposeAfter) {
18867
+ (_b = this.#disposed) == null ? void 0 : _b.push([v, k, "delete"]);
18868
+ }
18869
+ }
18870
+ }
18871
+ this.#keyMap.clear();
18872
+ this.#valList.fill(void 0);
18873
+ this.#keyList.fill(void 0);
18874
+ if (this.#ttls && this.#starts) {
18875
+ this.#ttls.fill(0);
18876
+ this.#starts.fill(0);
18877
+ }
18878
+ if (this.#sizes) {
18879
+ this.#sizes.fill(0);
18880
+ }
18881
+ this.#head = 0;
18882
+ this.#tail = 0;
18883
+ this.#free.length = 0;
18884
+ this.#calculatedSize = 0;
18885
+ this.#size = 0;
18886
+ if (this.#hasDisposeAfter && this.#disposed) {
18887
+ const dt = this.#disposed;
18888
+ let task;
18889
+ while (task = dt == null ? void 0 : dt.shift()) {
18890
+ (_c = this.#disposeAfter) == null ? void 0 : _c.call(this, ...task);
18891
+ }
18892
+ }
17861
18893
  }
17862
- if (hit)
17863
- fn.call(thisp, hit.value, hit.key, self2);
17864
18894
  };
17865
- module2.exports = LRUCache;
18895
+ exports2.LRUCache = LRUCache;
17866
18896
  }
17867
18897
  });
17868
18898
 
17869
18899
  // node_modules/@octokit/auth-app/dist-node/index.js
17870
18900
  var require_dist_node12 = __commonJS({
17871
- "node_modules/@octokit/auth-app/dist-node/index.js"(exports2) {
18901
+ "node_modules/@octokit/auth-app/dist-node/index.js"(exports2, module2) {
17872
18902
  "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();
18903
+ var __defProp2 = Object.defineProperty;
18904
+ var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
18905
+ var __getOwnPropNames2 = Object.getOwnPropertyNames;
18906
+ var __hasOwnProp2 = Object.prototype.hasOwnProperty;
18907
+ var __export = (target, all) => {
18908
+ for (var name in all)
18909
+ __defProp2(target, name, { get: all[name], enumerable: true });
18910
+ };
18911
+ var __copyProps2 = (to, from, except, desc) => {
18912
+ if (from && typeof from === "object" || typeof from === "function") {
18913
+ for (let key of __getOwnPropNames2(from))
18914
+ if (!__hasOwnProp2.call(to, key) && key !== except)
18915
+ __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
18916
+ }
18917
+ return to;
18918
+ };
18919
+ var __toCommonJS = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
18920
+ var dist_src_exports = {};
18921
+ __export(dist_src_exports, {
18922
+ createAppAuth: () => createAppAuth2,
18923
+ createOAuthUserAuth: () => import_auth_oauth_user2.createOAuthUserAuth
18924
+ });
18925
+ module2.exports = __toCommonJS(dist_src_exports);
18926
+ var import_universal_user_agent = require_dist_node();
18927
+ var import_request = require_dist_node5();
18928
+ var import_auth_oauth_app = require_dist_node10();
18929
+ var import_deprecation = require_dist_node3();
18930
+ var import_universal_github_app_jwt = require_dist_node11();
17884
18931
  async function getAppAuthentication({
17885
18932
  appId,
17886
18933
  privateKey,
17887
18934
  timeDifference
17888
18935
  }) {
17889
18936
  try {
17890
- const appAuthentication = await universalGithubAppJwt.githubAppJwt({
18937
+ const appAuthentication = await (0, import_universal_github_app_jwt.githubAppJwt)({
17891
18938
  id: +appId,
17892
18939
  privateKey,
17893
18940
  now: timeDifference && Math.floor(Date.now() / 1e3) + timeDifference
@@ -17900,18 +18947,21 @@ var require_dist_node12 = __commonJS({
17900
18947
  };
17901
18948
  } catch (error) {
17902
18949
  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'");
18950
+ throw new Error(
18951
+ "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'"
18952
+ );
17904
18953
  } else {
17905
18954
  throw error;
17906
18955
  }
17907
18956
  }
17908
18957
  }
18958
+ var import_lru_cache = require_cjs();
17909
18959
  function getCache() {
17910
- return new LRU({
18960
+ return new import_lru_cache.LRUCache({
17911
18961
  // cache max. 15000 tokens, that will use less than 10mb memory
17912
18962
  max: 15e3,
17913
18963
  // Cache for 1 minute less than GitHub expiry
17914
- maxAge: 1e3 * 60 * 59
18964
+ ttl: 1e3 * 60 * 59
17915
18965
  });
17916
18966
  }
17917
18967
  async function get(cache, options) {
@@ -17920,7 +18970,14 @@ var require_dist_node12 = __commonJS({
17920
18970
  if (!result) {
17921
18971
  return;
17922
18972
  }
17923
- const [token, createdAt, expiresAt, repositorySelection, permissionsString, singleFileName] = result.split("|");
18973
+ const [
18974
+ token,
18975
+ createdAt,
18976
+ expiresAt,
18977
+ repositorySelection,
18978
+ permissionsString,
18979
+ singleFileName
18980
+ ] = result.split("|");
17924
18981
  const permissions = options.permissions || permissionsString.split(/,/).reduce((permissions2, string) => {
17925
18982
  if (/!$/.test(string)) {
17926
18983
  permissions2[string.slice(0, -1)] = "write";
@@ -17942,8 +18999,17 @@ var require_dist_node12 = __commonJS({
17942
18999
  }
17943
19000
  async function set(cache, options, data) {
17944
19001
  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("|");
19002
+ const permissionsString = options.permissions ? "" : Object.keys(data.permissions).map(
19003
+ (name) => `${name}${data.permissions[name] === "write" ? "!" : ""}`
19004
+ ).join(",");
19005
+ const value = [
19006
+ data.token,
19007
+ data.createdAt,
19008
+ data.expiresAt,
19009
+ data.repositorySelection,
19010
+ permissionsString,
19011
+ data.singleFileName
19012
+ ].join("|");
17947
19013
  await cache.set(key, value);
17948
19014
  }
17949
19015
  function optionsToCacheKey({
@@ -17955,7 +19021,12 @@ var require_dist_node12 = __commonJS({
17955
19021
  const permissionsString = Object.keys(permissions).sort().map((name) => permissions[name] === "read" ? name : `${name}!`).join(",");
17956
19022
  const repositoryIdsString = repositoryIds.sort().join(",");
17957
19023
  const repositoryNamesString = repositoryNames.join(",");
17958
- return [installationId, repositoryIdsString, repositoryNamesString, permissionsString].filter(Boolean).join("|");
19024
+ return [
19025
+ installationId,
19026
+ repositoryIdsString,
19027
+ repositoryNamesString,
19028
+ permissionsString
19029
+ ].filter(Boolean).join("|");
17959
19030
  }
17960
19031
  function toTokenAuthentication({
17961
19032
  installationId,
@@ -17968,45 +19039,45 @@ var require_dist_node12 = __commonJS({
17968
19039
  repositoryNames,
17969
19040
  singleFileName
17970
19041
  }) {
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);
19042
+ return Object.assign(
19043
+ {
19044
+ type: "token",
19045
+ tokenType: "installation",
19046
+ token,
19047
+ installationId,
19048
+ permissions,
19049
+ createdAt,
19050
+ expiresAt,
19051
+ repositorySelection
19052
+ },
19053
+ repositoryIds ? { repositoryIds } : null,
19054
+ repositoryNames ? { repositoryNames } : null,
19055
+ singleFileName ? { singleFileName } : null
19056
+ );
17987
19057
  }
17988
19058
  async function getInstallationAuthentication(state, options, customRequest) {
17989
19059
  const installationId = Number(options.installationId || state.installationId);
17990
19060
  if (!installationId) {
17991
- throw new Error("[@octokit/auth-app] installationId option is required for installation authentication.");
19061
+ throw new Error(
19062
+ "[@octokit/auth-app] installationId option is required for installation authentication."
19063
+ );
17992
19064
  }
17993
19065
  if (options.factory) {
17994
- const {
17995
- type,
17996
- factory,
17997
- oauthApp,
17998
- ...factoryAuthOptions
17999
- } = {
19066
+ const { type, factory, oauthApp, ...factoryAuthOptions } = {
18000
19067
  ...state,
18001
19068
  ...options
18002
19069
  };
18003
19070
  return factory(factoryAuthOptions);
18004
19071
  }
18005
- const optionsWithInstallationTokenFromState = Object.assign({
18006
- installationId
18007
- }, options);
19072
+ const optionsWithInstallationTokenFromState = Object.assign(
19073
+ { installationId },
19074
+ options
19075
+ );
18008
19076
  if (!options.refresh) {
18009
- const result = await get(state.cache, optionsWithInstallationTokenFromState);
19077
+ const result = await get(
19078
+ state.cache,
19079
+ optionsWithInstallationTokenFromState
19080
+ );
18010
19081
  if (result) {
18011
19082
  const {
18012
19083
  token: token2,
@@ -18032,7 +19103,7 @@ var require_dist_node12 = __commonJS({
18032
19103
  }
18033
19104
  }
18034
19105
  const appAuthentication = await getAppAuthentication(state);
18035
- const request2 = customRequest || state.request;
19106
+ const request = customRequest || state.request;
18036
19107
  const {
18037
19108
  data: {
18038
19109
  token,
@@ -18042,7 +19113,7 @@ var require_dist_node12 = __commonJS({
18042
19113
  repository_selection: repositorySelectionOptional,
18043
19114
  single_file: singleFileName
18044
19115
  }
18045
- } = await request2("POST /app/installations/{installation_id}/access_tokens", {
19116
+ } = await request("POST /app/installations/{installation_id}/access_tokens", {
18046
19117
  installation_id: installationId,
18047
19118
  repository_ids: options.repositoryIds,
18048
19119
  repositories: options.repositoryNames,
@@ -18088,13 +19159,14 @@ var require_dist_node12 = __commonJS({
18088
19159
  case "oauth":
18089
19160
  state.log.warn(
18090
19161
  // @ts-expect-error `log.warn()` expects string
18091
- new deprecation.Deprecation(`[@octokit/auth-app] {type: "oauth"} is deprecated. Use {type: "oauth-app"} instead`)
19162
+ new import_deprecation.Deprecation(
19163
+ `[@octokit/auth-app] {type: "oauth"} is deprecated. Use {type: "oauth-app"} instead`
19164
+ )
18092
19165
  );
18093
19166
  case "oauth-app":
18094
- return state.oauthApp({
18095
- type: "oauth-app"
18096
- });
19167
+ return state.oauthApp({ type: "oauth-app" });
18097
19168
  case "installation":
19169
+ authOptions;
18098
19170
  return getInstallationAuthentication(state, {
18099
19171
  ...authOptions,
18100
19172
  type: "installation"
@@ -18105,34 +19177,60 @@ var require_dist_node12 = __commonJS({
18105
19177
  throw new Error(`Invalid auth type: ${authOptions.type}`);
18106
19178
  }
18107
19179
  }
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"];
19180
+ var import_auth_oauth_user = require_dist_node9();
19181
+ var PATHS = [
19182
+ "/app",
19183
+ "/app/hook/config",
19184
+ "/app/hook/deliveries",
19185
+ "/app/hook/deliveries/{delivery_id}",
19186
+ "/app/hook/deliveries/{delivery_id}/attempts",
19187
+ "/app/installations",
19188
+ "/app/installations/{installation_id}",
19189
+ "/app/installations/{installation_id}/access_tokens",
19190
+ "/app/installations/{installation_id}/suspended",
19191
+ "/marketplace_listing/accounts/{account_id}",
19192
+ "/marketplace_listing/plan",
19193
+ "/marketplace_listing/plans",
19194
+ "/marketplace_listing/plans/{plan_id}/accounts",
19195
+ "/marketplace_listing/stubbed/accounts/{account_id}",
19196
+ "/marketplace_listing/stubbed/plan",
19197
+ "/marketplace_listing/stubbed/plans",
19198
+ "/marketplace_listing/stubbed/plans/{plan_id}/accounts",
19199
+ "/orgs/{org}/installation",
19200
+ "/repos/{owner}/{repo}/installation",
19201
+ "/users/{username}/installation"
19202
+ ];
18109
19203
  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("|")})[^/]*$`;
19204
+ const regexes = paths.map(
19205
+ (p) => p.split("/").map((c) => c.startsWith("{") ? "(?:.+?)" : c).join("/")
19206
+ );
19207
+ const regex = `^(?:${regexes.map((r) => `(?:${r})`).join("|")})$`;
18112
19208
  return new RegExp(regex, "i");
18113
19209
  }
18114
19210
  var REGEX = routeMatcher(PATHS);
18115
19211
  function requiresAppAuth(url) {
18116
- return !!url && REGEX.test(url);
19212
+ return !!url && REGEX.test(url.split("?")[0]);
18117
19213
  }
18118
19214
  var FIVE_SECONDS_IN_MS = 5 * 1e3;
18119
19215
  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/));
19216
+ return !(error.message.match(
19217
+ /'Expiration time' claim \('exp'\) must be a numeric value representing the future time at which the assertion expires/
19218
+ ) || error.message.match(
19219
+ /'Issued at' claim \('iat'\) must be an Integer representing the time that the assertion was issued/
19220
+ ));
18121
19221
  }
18122
- async function hook(state, request2, route, parameters) {
18123
- const endpoint = request2.endpoint.merge(route, parameters);
19222
+ async function hook(state, request, route, parameters) {
19223
+ const endpoint = request.endpoint.merge(route, parameters);
18124
19224
  const url = endpoint.url;
18125
19225
  if (/\/login\/oauth\/access_token$/.test(url)) {
18126
- return request2(endpoint);
19226
+ return request(endpoint);
18127
19227
  }
18128
- if (requiresAppAuth(url.replace(request2.endpoint.DEFAULTS.baseUrl, ""))) {
18129
- const {
18130
- token: token2
18131
- } = await getAppAuthentication(state);
19228
+ if (requiresAppAuth(url.replace(request.endpoint.DEFAULTS.baseUrl, ""))) {
19229
+ const { token: token2 } = await getAppAuthentication(state);
18132
19230
  endpoint.headers.authorization = `bearer ${token2}`;
18133
19231
  let response;
18134
19232
  try {
18135
- response = await request2(endpoint);
19233
+ response = await request(endpoint);
18136
19234
  } catch (error) {
18137
19235
  if (isNotTimeSkewError(error)) {
18138
19236
  throw error;
@@ -18140,43 +19238,45 @@ var require_dist_node12 = __commonJS({
18140
19238
  if (typeof error.response.headers.date === "undefined") {
18141
19239
  throw error;
18142
19240
  }
18143
- const diff = Math.floor((Date.parse(error.response.headers.date) - Date.parse((/* @__PURE__ */ new Date()).toString())) / 1e3);
19241
+ const diff = Math.floor(
19242
+ (Date.parse(error.response.headers.date) - Date.parse((/* @__PURE__ */ new Date()).toString())) / 1e3
19243
+ );
18144
19244
  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({
19245
+ state.log.warn(
19246
+ `[@octokit/auth-app] GitHub API time and system time are different by ${diff} seconds. Retrying request with the difference accounted for.`
19247
+ );
19248
+ const { token: token3 } = await getAppAuthentication({
18149
19249
  ...state,
18150
19250
  timeDifference: diff
18151
19251
  });
18152
19252
  endpoint.headers.authorization = `bearer ${token3}`;
18153
- return request2(endpoint);
19253
+ return request(endpoint);
18154
19254
  }
18155
19255
  return response;
18156
19256
  }
18157
- if (authOauthUser.requiresBasicAuth(url)) {
18158
- const authentication = await state.oauthApp({
18159
- type: "oauth-app"
18160
- });
19257
+ if ((0, import_auth_oauth_user.requiresBasicAuth)(url)) {
19258
+ const authentication = await state.oauthApp({ type: "oauth-app" });
18161
19259
  endpoint.headers.authorization = authentication.headers.authorization;
18162
- return request2(endpoint);
19260
+ return request(endpoint);
18163
19261
  }
18164
- const {
18165
- token,
18166
- createdAt
18167
- } = await getInstallationAuthentication(
19262
+ const { token, createdAt } = await getInstallationAuthentication(
18168
19263
  state,
18169
19264
  // @ts-expect-error TBD
18170
19265
  {},
18171
- request2
19266
+ request
18172
19267
  );
18173
19268
  endpoint.headers.authorization = `token ${token}`;
18174
- return sendRequestWithRetries(state, request2, endpoint, createdAt);
19269
+ return sendRequestWithRetries(
19270
+ state,
19271
+ request,
19272
+ endpoint,
19273
+ createdAt
19274
+ );
18175
19275
  }
18176
- async function sendRequestWithRetries(state, request2, options, createdAt, retries = 0) {
19276
+ async function sendRequestWithRetries(state, request, options, createdAt, retries = 0) {
18177
19277
  const timeSinceTokenCreationInMs = +/* @__PURE__ */ new Date() - +new Date(createdAt);
18178
19278
  try {
18179
- return await request2(options);
19279
+ return await request(options);
18180
19280
  } catch (error) {
18181
19281
  if (error.status !== 401) {
18182
19282
  throw error;
@@ -18189,58 +19289,64 @@ var require_dist_node12 = __commonJS({
18189
19289
  }
18190
19290
  ++retries;
18191
19291
  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)`);
19292
+ state.log.warn(
19293
+ `[@octokit/auth-app] Retrying after 401 response to account for token replication delay (retry: ${retries}, wait: ${awaitTime / 1e3}s)`
19294
+ );
18193
19295
  await new Promise((resolve) => setTimeout(resolve, awaitTime));
18194
- return sendRequestWithRetries(state, request2, options, createdAt, retries);
19296
+ return sendRequestWithRetries(state, request, options, createdAt, retries);
18195
19297
  }
18196
19298
  }
18197
- var VERSION = "4.0.9";
19299
+ var VERSION = "4.0.13";
19300
+ var import_auth_oauth_user2 = require_dist_node9();
18198
19301
  function createAppAuth2(options) {
18199
19302
  if (!options.appId) {
18200
19303
  throw new Error("[@octokit/auth-app] appId option is required");
18201
19304
  }
18202
19305
  if (!Number.isFinite(+options.appId)) {
18203
- throw new Error("[@octokit/auth-app] appId option must be a number or numeric string");
19306
+ throw new Error(
19307
+ "[@octokit/auth-app] appId option must be a number or numeric string"
19308
+ );
18204
19309
  }
18205
19310
  if (!options.privateKey) {
18206
19311
  throw new Error("[@octokit/auth-app] privateKey option is required");
18207
19312
  }
18208
19313
  if ("installationId" in options && !options.installationId) {
18209
- throw new Error("[@octokit/auth-app] installationId is set to a falsy value");
19314
+ throw new Error(
19315
+ "[@octokit/auth-app] installationId is set to a falsy value"
19316
+ );
18210
19317
  }
18211
- const log = Object.assign({
18212
- warn: console.warn.bind(console)
18213
- }, options.log);
18214
- const request$1 = options.request || request.request.defaults({
19318
+ const log = Object.assign(
19319
+ {
19320
+ warn: console.warn.bind(console)
19321
+ },
19322
+ options.log
19323
+ );
19324
+ const request = options.request || import_request.request.defaults({
18215
19325
  headers: {
18216
- "user-agent": `octokit-auth-app.js/${VERSION} ${universalUserAgent.getUserAgent()}`
19326
+ "user-agent": `octokit-auth-app.js/${VERSION} ${(0, import_universal_user_agent.getUserAgent)()}`
18217
19327
  }
18218
19328
  });
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
- });
19329
+ const state = Object.assign(
19330
+ {
19331
+ request,
19332
+ cache: getCache()
19333
+ },
19334
+ options,
19335
+ options.installationId ? { installationId: Number(options.installationId) } : {},
19336
+ {
19337
+ log,
19338
+ oauthApp: (0, import_auth_oauth_app.createOAuthAppAuth)({
19339
+ clientType: "github-app",
19340
+ clientId: options.clientId || "",
19341
+ clientSecret: options.clientSecret || "",
19342
+ request
19343
+ })
19344
+ }
19345
+ );
18233
19346
  return Object.assign(auth.bind(null, state), {
18234
19347
  hook: hook.bind(null, state)
18235
19348
  });
18236
19349
  }
18237
- Object.defineProperty(exports2, "createOAuthUserAuth", {
18238
- enumerable: true,
18239
- get: function() {
18240
- return authOauthUser.createOAuthUserAuth;
18241
- }
18242
- });
18243
- exports2.createAppAuth = createAppAuth2;
18244
19350
  }
18245
19351
  });
18246
19352
 
@@ -18389,12 +19495,35 @@ var require_before_after_hook = __commonJS({
18389
19495
 
18390
19496
  // node_modules/@octokit/graphql/dist-node/index.js
18391
19497
  var require_dist_node13 = __commonJS({
18392
- "node_modules/@octokit/graphql/dist-node/index.js"(exports2) {
19498
+ "node_modules/@octokit/graphql/dist-node/index.js"(exports2, module2) {
18393
19499
  "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";
19500
+ var __defProp2 = Object.defineProperty;
19501
+ var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
19502
+ var __getOwnPropNames2 = Object.getOwnPropertyNames;
19503
+ var __hasOwnProp2 = Object.prototype.hasOwnProperty;
19504
+ var __export = (target, all) => {
19505
+ for (var name in all)
19506
+ __defProp2(target, name, { get: all[name], enumerable: true });
19507
+ };
19508
+ var __copyProps2 = (to, from, except, desc) => {
19509
+ if (from && typeof from === "object" || typeof from === "function") {
19510
+ for (let key of __getOwnPropNames2(from))
19511
+ if (!__hasOwnProp2.call(to, key) && key !== except)
19512
+ __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
19513
+ }
19514
+ return to;
19515
+ };
19516
+ var __toCommonJS = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
19517
+ var dist_src_exports = {};
19518
+ __export(dist_src_exports, {
19519
+ GraphqlResponseError: () => GraphqlResponseError,
19520
+ graphql: () => graphql2,
19521
+ withCustomRequest: () => withCustomRequest
19522
+ });
19523
+ module2.exports = __toCommonJS(dist_src_exports);
19524
+ var import_request = require_dist_node5();
19525
+ var import_universal_user_agent = require_dist_node();
19526
+ var VERSION = "5.0.6";
18398
19527
  function _buildMessageForResponseErrors(data) {
18399
19528
  return `Request failed due to following response errors:
18400
19529
  ` + data.errors.map((e) => ` - ${e.message}`).join("\n");
@@ -18413,24 +19542,36 @@ var require_dist_node13 = __commonJS({
18413
19542
  }
18414
19543
  }
18415
19544
  };
18416
- var NON_VARIABLE_OPTIONS = ["method", "baseUrl", "url", "headers", "request", "query", "mediaType"];
19545
+ var NON_VARIABLE_OPTIONS = [
19546
+ "method",
19547
+ "baseUrl",
19548
+ "url",
19549
+ "headers",
19550
+ "request",
19551
+ "query",
19552
+ "mediaType"
19553
+ ];
18417
19554
  var FORBIDDEN_VARIABLE_OPTIONS = ["query", "method", "url"];
18418
19555
  var GHES_V3_SUFFIX_REGEX = /\/api\/v3\/?$/;
18419
19556
  function graphql(request2, query, options) {
18420
19557
  if (options) {
18421
19558
  if (typeof query === "string" && "query" in options) {
18422
- return Promise.reject(new Error(`[@octokit/graphql] "query" cannot be used as variable name`));
19559
+ return Promise.reject(
19560
+ new Error(`[@octokit/graphql] "query" cannot be used as variable name`)
19561
+ );
18423
19562
  }
18424
19563
  for (const key in options) {
18425
19564
  if (!FORBIDDEN_VARIABLE_OPTIONS.includes(key))
18426
19565
  continue;
18427
- return Promise.reject(new Error(`[@octokit/graphql] "${key}" cannot be used as variable name`));
19566
+ return Promise.reject(
19567
+ new Error(`[@octokit/graphql] "${key}" cannot be used as variable name`)
19568
+ );
18428
19569
  }
18429
19570
  }
18430
- const parsedOptions = typeof query === "string" ? Object.assign({
18431
- query
18432
- }, options) : query;
18433
- const requestOptions = Object.keys(parsedOptions).reduce((result, key) => {
19571
+ const parsedOptions = typeof query === "string" ? Object.assign({ query }, options) : query;
19572
+ const requestOptions = Object.keys(
19573
+ parsedOptions
19574
+ ).reduce((result, key) => {
18434
19575
  if (NON_VARIABLE_OPTIONS.includes(key)) {
18435
19576
  result[key] = parsedOptions[key];
18436
19577
  return result;
@@ -18451,7 +19592,11 @@ var require_dist_node13 = __commonJS({
18451
19592
  for (const key of Object.keys(response.headers)) {
18452
19593
  headers[key] = response.headers[key];
18453
19594
  }
18454
- throw new GraphqlResponseError(requestOptions, headers, response.data);
19595
+ throw new GraphqlResponseError(
19596
+ requestOptions,
19597
+ headers,
19598
+ response.data
19599
+ );
18455
19600
  }
18456
19601
  return response.data.data;
18457
19602
  });
@@ -18466,9 +19611,9 @@ var require_dist_node13 = __commonJS({
18466
19611
  endpoint: newRequest.endpoint
18467
19612
  });
18468
19613
  }
18469
- var graphql$1 = withDefaults(request.request, {
19614
+ var graphql2 = withDefaults(import_request.request, {
18470
19615
  headers: {
18471
- "user-agent": `octokit-graphql.js/${VERSION} ${universalUserAgent.getUserAgent()}`
19616
+ "user-agent": `octokit-graphql.js/${VERSION} ${(0, import_universal_user_agent.getUserAgent)()}`
18472
19617
  },
18473
19618
  method: "POST",
18474
19619
  url: "/graphql"
@@ -18479,9 +19624,6 @@ var require_dist_node13 = __commonJS({
18479
19624
  url: "/graphql"
18480
19625
  });
18481
19626
  }
18482
- exports2.GraphqlResponseError = GraphqlResponseError;
18483
- exports2.graphql = graphql$1;
18484
- exports2.withCustomRequest = withCustomRequest;
18485
19627
  }
18486
19628
  });
18487
19629
 
@@ -18533,20 +19675,78 @@ var require_dist_node14 = __commonJS({
18533
19675
 
18534
19676
  // node_modules/@octokit/core/dist-node/index.js
18535
19677
  var require_dist_node15 = __commonJS({
18536
- "node_modules/@octokit/core/dist-node/index.js"(exports2) {
19678
+ "node_modules/@octokit/core/dist-node/index.js"(exports2, module2) {
18537
19679
  "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";
19680
+ var __defProp2 = Object.defineProperty;
19681
+ var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
19682
+ var __getOwnPropNames2 = Object.getOwnPropertyNames;
19683
+ var __hasOwnProp2 = Object.prototype.hasOwnProperty;
19684
+ var __export = (target, all) => {
19685
+ for (var name in all)
19686
+ __defProp2(target, name, { get: all[name], enumerable: true });
19687
+ };
19688
+ var __copyProps2 = (to, from, except, desc) => {
19689
+ if (from && typeof from === "object" || typeof from === "function") {
19690
+ for (let key of __getOwnPropNames2(from))
19691
+ if (!__hasOwnProp2.call(to, key) && key !== except)
19692
+ __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
19693
+ }
19694
+ return to;
19695
+ };
19696
+ var __toCommonJS = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
19697
+ var dist_src_exports = {};
19698
+ __export(dist_src_exports, {
19699
+ Octokit: () => Octokit2
19700
+ });
19701
+ module2.exports = __toCommonJS(dist_src_exports);
19702
+ var import_universal_user_agent = require_dist_node();
19703
+ var import_before_after_hook = require_before_after_hook();
19704
+ var import_request = require_dist_node5();
19705
+ var import_graphql = require_dist_node13();
19706
+ var import_auth_token = require_dist_node14();
19707
+ var VERSION = "4.2.1";
18545
19708
  var Octokit2 = class {
19709
+ static defaults(defaults) {
19710
+ const OctokitWithDefaults = class extends this {
19711
+ constructor(...args) {
19712
+ const options = args[0] || {};
19713
+ if (typeof defaults === "function") {
19714
+ super(defaults(options));
19715
+ return;
19716
+ }
19717
+ super(
19718
+ Object.assign(
19719
+ {},
19720
+ defaults,
19721
+ options,
19722
+ options.userAgent && defaults.userAgent ? {
19723
+ userAgent: `${options.userAgent} ${defaults.userAgent}`
19724
+ } : null
19725
+ )
19726
+ );
19727
+ }
19728
+ };
19729
+ return OctokitWithDefaults;
19730
+ }
19731
+ /**
19732
+ * Attach a plugin (or many) to your Octokit instance.
19733
+ *
19734
+ * @example
19735
+ * const API = Octokit.plugin(plugin1, plugin2, plugin3, ...)
19736
+ */
19737
+ static plugin(...newPlugins) {
19738
+ var _a;
19739
+ const currentPlugins = this.plugins;
19740
+ const NewOctokit = (_a = class extends this {
19741
+ }, _a.plugins = currentPlugins.concat(
19742
+ newPlugins.filter((plugin) => !currentPlugins.includes(plugin))
19743
+ ), _a);
19744
+ return NewOctokit;
19745
+ }
18546
19746
  constructor(options = {}) {
18547
- const hook = new beforeAfterHook.Collection();
19747
+ const hook = new import_before_after_hook.Collection();
18548
19748
  const requestDefaults = {
18549
- baseUrl: request.request.endpoint.DEFAULTS.baseUrl,
19749
+ baseUrl: import_request.request.endpoint.DEFAULTS.baseUrl,
18550
19750
  headers: {},
18551
19751
  request: Object.assign({}, options.request, {
18552
19752
  // @ts-ignore internal usage only, no need to type
@@ -18557,7 +19757,10 @@ var require_dist_node15 = __commonJS({
18557
19757
  format: ""
18558
19758
  }
18559
19759
  };
18560
- requestDefaults.headers["user-agent"] = [options.userAgent, `octokit-core.js/${VERSION} ${universalUserAgent.getUserAgent()}`].filter(Boolean).join(" ");
19760
+ requestDefaults.headers["user-agent"] = [
19761
+ options.userAgent,
19762
+ `octokit-core.js/${VERSION} ${(0, import_universal_user_agent.getUserAgent)()}`
19763
+ ].filter(Boolean).join(" ");
18561
19764
  if (options.baseUrl) {
18562
19765
  requestDefaults.baseUrl = options.baseUrl;
18563
19766
  }
@@ -18567,16 +19770,19 @@ var require_dist_node15 = __commonJS({
18567
19770
  if (options.timeZone) {
18568
19771
  requestDefaults.headers["time-zone"] = options.timeZone;
18569
19772
  }
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: () => {
19773
+ this.request = import_request.request.defaults(requestDefaults);
19774
+ this.graphql = (0, import_graphql.withCustomRequest)(this.request).defaults(requestDefaults);
19775
+ this.log = Object.assign(
19776
+ {
19777
+ debug: () => {
19778
+ },
19779
+ info: () => {
19780
+ },
19781
+ warn: console.warn.bind(console),
19782
+ error: console.error.bind(console)
18576
19783
  },
18577
- warn: console.warn.bind(console),
18578
- error: console.error.bind(console)
18579
- }, options.log);
19784
+ options.log
19785
+ );
18580
19786
  this.hook = hook;
18581
19787
  if (!options.authStrategy) {
18582
19788
  if (!options.auth) {
@@ -18584,26 +19790,28 @@ var require_dist_node15 = __commonJS({
18584
19790
  type: "unauthenticated"
18585
19791
  });
18586
19792
  } else {
18587
- const auth = authToken.createTokenAuth(options.auth);
19793
+ const auth = (0, import_auth_token.createTokenAuth)(options.auth);
18588
19794
  hook.wrap("request", auth.hook);
18589
19795
  this.auth = auth;
18590
19796
  }
18591
19797
  } 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));
19798
+ const { authStrategy, ...otherOptions } = options;
19799
+ const auth = authStrategy(
19800
+ Object.assign(
19801
+ {
19802
+ request: this.request,
19803
+ log: this.log,
19804
+ // we pass the current octokit instance as well as its constructor options
19805
+ // to allow for authentication strategies that return a new octokit instance
19806
+ // that shares the same internal state as the current one. The original
19807
+ // requirement for this was the "event-octokit" authentication strategy
19808
+ // of https://github.com/probot/octokit-auth-probot.
19809
+ octokit: this,
19810
+ octokitOptions: otherOptions
19811
+ },
19812
+ options.auth
19813
+ )
19814
+ );
18607
19815
  hook.wrap("request", auth.hook);
18608
19816
  this.auth = auth;
18609
19817
  }
@@ -18612,38 +19820,9 @@ var require_dist_node15 = __commonJS({
18612
19820
  Object.assign(this, plugin(this, options));
18613
19821
  });
18614
19822
  }
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
19823
  };
18644
19824
  Octokit2.VERSION = VERSION;
18645
19825
  Octokit2.plugins = [];
18646
- exports2.Octokit = Octokit2;
18647
19826
  }
18648
19827
  });
18649
19828
 
@@ -18675,10 +19854,34 @@ var require_dist_node16 = __commonJS({
18675
19854
 
18676
19855
  // node_modules/@octokit/plugin-paginate-rest/dist-node/index.js
18677
19856
  var require_dist_node17 = __commonJS({
18678
- "node_modules/@octokit/plugin-paginate-rest/dist-node/index.js"(exports2) {
19857
+ "node_modules/@octokit/plugin-paginate-rest/dist-node/index.js"(exports2, module2) {
18679
19858
  "use strict";
18680
- Object.defineProperty(exports2, "__esModule", { value: true });
18681
- var VERSION = "6.0.0";
19859
+ var __defProp2 = Object.defineProperty;
19860
+ var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
19861
+ var __getOwnPropNames2 = Object.getOwnPropertyNames;
19862
+ var __hasOwnProp2 = Object.prototype.hasOwnProperty;
19863
+ var __export = (target, all) => {
19864
+ for (var name in all)
19865
+ __defProp2(target, name, { get: all[name], enumerable: true });
19866
+ };
19867
+ var __copyProps2 = (to, from, except, desc) => {
19868
+ if (from && typeof from === "object" || typeof from === "function") {
19869
+ for (let key of __getOwnPropNames2(from))
19870
+ if (!__hasOwnProp2.call(to, key) && key !== except)
19871
+ __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
19872
+ }
19873
+ return to;
19874
+ };
19875
+ var __toCommonJS = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
19876
+ var dist_src_exports = {};
19877
+ __export(dist_src_exports, {
19878
+ composePaginateRest: () => composePaginateRest,
19879
+ isPaginatingEndpoint: () => isPaginatingEndpoint,
19880
+ paginateRest: () => paginateRest,
19881
+ paginatingEndpoints: () => paginatingEndpoints
19882
+ });
19883
+ module2.exports = __toCommonJS(dist_src_exports);
19884
+ var VERSION = "6.1.2";
18682
19885
  function normalizePaginatedListResponse(response) {
18683
19886
  if (!response.data) {
18684
19887
  return {
@@ -18717,20 +19920,14 @@ var require_dist_node17 = __commonJS({
18717
19920
  [Symbol.asyncIterator]: () => ({
18718
19921
  async next() {
18719
19922
  if (!url)
18720
- return {
18721
- done: true
18722
- };
19923
+ return { done: true };
18723
19924
  try {
18724
- const response = await requestMethod({
18725
- method,
18726
- url,
18727
- headers
18728
- });
19925
+ const response = await requestMethod({ method, url, headers });
18729
19926
  const normalizedResponse = normalizePaginatedListResponse(response);
18730
- url = ((normalizedResponse.headers.link || "").match(/<([^>]+)>;\s*rel="next"/) || [])[1];
18731
- return {
18732
- value: normalizedResponse
18733
- };
19927
+ url = ((normalizedResponse.headers.link || "").match(
19928
+ /<([^>]+)>;\s*rel="next"/
19929
+ ) || [])[1];
19930
+ return { value: normalizedResponse };
18734
19931
  } catch (error) {
18735
19932
  if (error.status !== 409)
18736
19933
  throw error;
@@ -18752,7 +19949,12 @@ var require_dist_node17 = __commonJS({
18752
19949
  mapFn = parameters;
18753
19950
  parameters = void 0;
18754
19951
  }
18755
- return gather(octokit, [], iterator(octokit, route, parameters)[Symbol.asyncIterator](), mapFn);
19952
+ return gather(
19953
+ octokit,
19954
+ [],
19955
+ iterator(octokit, route, parameters)[Symbol.asyncIterator](),
19956
+ mapFn
19957
+ );
18756
19958
  }
18757
19959
  function gather(octokit, results, iterator2, mapFn) {
18758
19960
  return iterator2.next().then((result) => {
@@ -18763,7 +19965,9 @@ var require_dist_node17 = __commonJS({
18763
19965
  function done() {
18764
19966
  earlyExit = true;
18765
19967
  }
18766
- results = results.concat(mapFn ? mapFn(result.value, done) : result.value.data);
19968
+ results = results.concat(
19969
+ mapFn ? mapFn(result.value, done) : result.value.data
19970
+ );
18767
19971
  if (earlyExit) {
18768
19972
  return results;
18769
19973
  }
@@ -18773,7 +19977,230 @@ var require_dist_node17 = __commonJS({
18773
19977
  var composePaginateRest = Object.assign(paginate, {
18774
19978
  iterator
18775
19979
  });
18776
- var paginatingEndpoints = ["GET /app/hook/deliveries", "GET /app/installations", "GET /enterprises/{enterprise}/actions/runner-groups", "GET /enterprises/{enterprise}/dependabot/alerts", "GET /enterprises/{enterprise}/secret-scanning/alerts", "GET /events", "GET /gists", "GET /gists/public", "GET /gists/starred", "GET /gists/{gist_id}/comments", "GET /gists/{gist_id}/commits", "GET /gists/{gist_id}/forks", "GET /installation/repositories", "GET /issues", "GET /licenses", "GET /marketplace_listing/plans", "GET /marketplace_listing/plans/{plan_id}/accounts", "GET /marketplace_listing/stubbed/plans", "GET /marketplace_listing/stubbed/plans/{plan_id}/accounts", "GET /networks/{owner}/{repo}/events", "GET /notifications", "GET /organizations", "GET /orgs/{org}/actions/cache/usage-by-repository", "GET /orgs/{org}/actions/permissions/repositories", "GET /orgs/{org}/actions/required_workflows", "GET /orgs/{org}/actions/runner-groups", "GET /orgs/{org}/actions/runner-groups/{runner_group_id}/repositories", "GET /orgs/{org}/actions/runner-groups/{runner_group_id}/runners", "GET /orgs/{org}/actions/runners", "GET /orgs/{org}/actions/secrets", "GET /orgs/{org}/actions/secrets/{secret_name}/repositories", "GET /orgs/{org}/actions/variables", "GET /orgs/{org}/actions/variables/{name}/repositories", "GET /orgs/{org}/blocks", "GET /orgs/{org}/code-scanning/alerts", "GET /orgs/{org}/codespaces", "GET /orgs/{org}/codespaces/secrets", "GET /orgs/{org}/codespaces/secrets/{secret_name}/repositories", "GET /orgs/{org}/dependabot/alerts", "GET /orgs/{org}/dependabot/secrets", "GET /orgs/{org}/dependabot/secrets/{secret_name}/repositories", "GET /orgs/{org}/events", "GET /orgs/{org}/failed_invitations", "GET /orgs/{org}/hooks", "GET /orgs/{org}/hooks/{hook_id}/deliveries", "GET /orgs/{org}/installations", "GET /orgs/{org}/invitations", "GET /orgs/{org}/invitations/{invitation_id}/teams", "GET /orgs/{org}/issues", "GET /orgs/{org}/members", "GET /orgs/{org}/members/{username}/codespaces", "GET /orgs/{org}/migrations", "GET /orgs/{org}/migrations/{migration_id}/repositories", "GET /orgs/{org}/outside_collaborators", "GET /orgs/{org}/packages", "GET /orgs/{org}/packages/{package_type}/{package_name}/versions", "GET /orgs/{org}/projects", "GET /orgs/{org}/public_members", "GET /orgs/{org}/repos", "GET /orgs/{org}/secret-scanning/alerts", "GET /orgs/{org}/teams", "GET /orgs/{org}/teams/{team_slug}/discussions", "GET /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments", "GET /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number}/reactions", "GET /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/reactions", "GET /orgs/{org}/teams/{team_slug}/invitations", "GET /orgs/{org}/teams/{team_slug}/members", "GET /orgs/{org}/teams/{team_slug}/projects", "GET /orgs/{org}/teams/{team_slug}/repos", "GET /orgs/{org}/teams/{team_slug}/teams", "GET /projects/columns/{column_id}/cards", "GET /projects/{project_id}/collaborators", "GET /projects/{project_id}/columns", "GET /repos/{org}/{repo}/actions/required_workflows", "GET /repos/{owner}/{repo}/actions/artifacts", "GET /repos/{owner}/{repo}/actions/caches", "GET /repos/{owner}/{repo}/actions/required_workflows/{required_workflow_id_for_repo}/runs", "GET /repos/{owner}/{repo}/actions/runners", "GET /repos/{owner}/{repo}/actions/runs", "GET /repos/{owner}/{repo}/actions/runs/{run_id}/artifacts", "GET /repos/{owner}/{repo}/actions/runs/{run_id}/attempts/{attempt_number}/jobs", "GET /repos/{owner}/{repo}/actions/runs/{run_id}/jobs", "GET /repos/{owner}/{repo}/actions/secrets", "GET /repos/{owner}/{repo}/actions/variables", "GET /repos/{owner}/{repo}/actions/workflows", "GET /repos/{owner}/{repo}/actions/workflows/{workflow_id}/runs", "GET /repos/{owner}/{repo}/assignees", "GET /repos/{owner}/{repo}/branches", "GET /repos/{owner}/{repo}/check-runs/{check_run_id}/annotations", "GET /repos/{owner}/{repo}/check-suites/{check_suite_id}/check-runs", "GET /repos/{owner}/{repo}/code-scanning/alerts", "GET /repos/{owner}/{repo}/code-scanning/alerts/{alert_number}/instances", "GET /repos/{owner}/{repo}/code-scanning/analyses", "GET /repos/{owner}/{repo}/codespaces", "GET /repos/{owner}/{repo}/codespaces/devcontainers", "GET /repos/{owner}/{repo}/codespaces/secrets", "GET /repos/{owner}/{repo}/collaborators", "GET /repos/{owner}/{repo}/comments", "GET /repos/{owner}/{repo}/comments/{comment_id}/reactions", "GET /repos/{owner}/{repo}/commits", "GET /repos/{owner}/{repo}/commits/{commit_sha}/comments", "GET /repos/{owner}/{repo}/commits/{commit_sha}/pulls", "GET /repos/{owner}/{repo}/commits/{ref}/check-runs", "GET /repos/{owner}/{repo}/commits/{ref}/check-suites", "GET /repos/{owner}/{repo}/commits/{ref}/status", "GET /repos/{owner}/{repo}/commits/{ref}/statuses", "GET /repos/{owner}/{repo}/contributors", "GET /repos/{owner}/{repo}/dependabot/alerts", "GET /repos/{owner}/{repo}/dependabot/secrets", "GET /repos/{owner}/{repo}/deployments", "GET /repos/{owner}/{repo}/deployments/{deployment_id}/statuses", "GET /repos/{owner}/{repo}/environments", "GET /repos/{owner}/{repo}/environments/{environment_name}/deployment-branch-policies", "GET /repos/{owner}/{repo}/events", "GET /repos/{owner}/{repo}/forks", "GET /repos/{owner}/{repo}/hooks", "GET /repos/{owner}/{repo}/hooks/{hook_id}/deliveries", "GET /repos/{owner}/{repo}/invitations", "GET /repos/{owner}/{repo}/issues", "GET /repos/{owner}/{repo}/issues/comments", "GET /repos/{owner}/{repo}/issues/comments/{comment_id}/reactions", "GET /repos/{owner}/{repo}/issues/events", "GET /repos/{owner}/{repo}/issues/{issue_number}/comments", "GET /repos/{owner}/{repo}/issues/{issue_number}/events", "GET /repos/{owner}/{repo}/issues/{issue_number}/labels", "GET /repos/{owner}/{repo}/issues/{issue_number}/reactions", "GET /repos/{owner}/{repo}/issues/{issue_number}/timeline", "GET /repos/{owner}/{repo}/keys", "GET /repos/{owner}/{repo}/labels", "GET /repos/{owner}/{repo}/milestones", "GET /repos/{owner}/{repo}/milestones/{milestone_number}/labels", "GET /repos/{owner}/{repo}/notifications", "GET /repos/{owner}/{repo}/pages/builds", "GET /repos/{owner}/{repo}/projects", "GET /repos/{owner}/{repo}/pulls", "GET /repos/{owner}/{repo}/pulls/comments", "GET /repos/{owner}/{repo}/pulls/comments/{comment_id}/reactions", "GET /repos/{owner}/{repo}/pulls/{pull_number}/comments", "GET /repos/{owner}/{repo}/pulls/{pull_number}/commits", "GET /repos/{owner}/{repo}/pulls/{pull_number}/files", "GET /repos/{owner}/{repo}/pulls/{pull_number}/reviews", "GET /repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id}/comments", "GET /repos/{owner}/{repo}/releases", "GET /repos/{owner}/{repo}/releases/{release_id}/assets", "GET /repos/{owner}/{repo}/releases/{release_id}/reactions", "GET /repos/{owner}/{repo}/secret-scanning/alerts", "GET /repos/{owner}/{repo}/secret-scanning/alerts/{alert_number}/locations", "GET /repos/{owner}/{repo}/stargazers", "GET /repos/{owner}/{repo}/subscribers", "GET /repos/{owner}/{repo}/tags", "GET /repos/{owner}/{repo}/teams", "GET /repos/{owner}/{repo}/topics", "GET /repositories", "GET /repositories/{repository_id}/environments/{environment_name}/secrets", "GET /repositories/{repository_id}/environments/{environment_name}/variables", "GET /search/code", "GET /search/commits", "GET /search/issues", "GET /search/labels", "GET /search/repositories", "GET /search/topics", "GET /search/users", "GET /teams/{team_id}/discussions", "GET /teams/{team_id}/discussions/{discussion_number}/comments", "GET /teams/{team_id}/discussions/{discussion_number}/comments/{comment_number}/reactions", "GET /teams/{team_id}/discussions/{discussion_number}/reactions", "GET /teams/{team_id}/invitations", "GET /teams/{team_id}/members", "GET /teams/{team_id}/projects", "GET /teams/{team_id}/repos", "GET /teams/{team_id}/teams", "GET /user/blocks", "GET /user/codespaces", "GET /user/codespaces/secrets", "GET /user/emails", "GET /user/followers", "GET /user/following", "GET /user/gpg_keys", "GET /user/installations", "GET /user/installations/{installation_id}/repositories", "GET /user/issues", "GET /user/keys", "GET /user/marketplace_purchases", "GET /user/marketplace_purchases/stubbed", "GET /user/memberships/orgs", "GET /user/migrations", "GET /user/migrations/{migration_id}/repositories", "GET /user/orgs", "GET /user/packages", "GET /user/packages/{package_type}/{package_name}/versions", "GET /user/public_emails", "GET /user/repos", "GET /user/repository_invitations", "GET /user/ssh_signing_keys", "GET /user/starred", "GET /user/subscriptions", "GET /user/teams", "GET /users", "GET /users/{username}/events", "GET /users/{username}/events/orgs/{org}", "GET /users/{username}/events/public", "GET /users/{username}/followers", "GET /users/{username}/following", "GET /users/{username}/gists", "GET /users/{username}/gpg_keys", "GET /users/{username}/keys", "GET /users/{username}/orgs", "GET /users/{username}/packages", "GET /users/{username}/projects", "GET /users/{username}/received_events", "GET /users/{username}/received_events/public", "GET /users/{username}/repos", "GET /users/{username}/ssh_signing_keys", "GET /users/{username}/starred", "GET /users/{username}/subscriptions"];
19980
+ var paginatingEndpoints = [
19981
+ "GET /app/hook/deliveries",
19982
+ "GET /app/installation-requests",
19983
+ "GET /app/installations",
19984
+ "GET /enterprises/{enterprise}/dependabot/alerts",
19985
+ "GET /enterprises/{enterprise}/secret-scanning/alerts",
19986
+ "GET /events",
19987
+ "GET /gists",
19988
+ "GET /gists/public",
19989
+ "GET /gists/starred",
19990
+ "GET /gists/{gist_id}/comments",
19991
+ "GET /gists/{gist_id}/commits",
19992
+ "GET /gists/{gist_id}/forks",
19993
+ "GET /installation/repositories",
19994
+ "GET /issues",
19995
+ "GET /licenses",
19996
+ "GET /marketplace_listing/plans",
19997
+ "GET /marketplace_listing/plans/{plan_id}/accounts",
19998
+ "GET /marketplace_listing/stubbed/plans",
19999
+ "GET /marketplace_listing/stubbed/plans/{plan_id}/accounts",
20000
+ "GET /networks/{owner}/{repo}/events",
20001
+ "GET /notifications",
20002
+ "GET /organizations",
20003
+ "GET /organizations/{org}/personal-access-token-requests",
20004
+ "GET /organizations/{org}/personal-access-token-requests/{pat_request_id}/repositories",
20005
+ "GET /organizations/{org}/personal-access-tokens",
20006
+ "GET /organizations/{org}/personal-access-tokens/{pat_id}/repositories",
20007
+ "GET /orgs/{org}/actions/cache/usage-by-repository",
20008
+ "GET /orgs/{org}/actions/permissions/repositories",
20009
+ "GET /orgs/{org}/actions/required_workflows",
20010
+ "GET /orgs/{org}/actions/runners",
20011
+ "GET /orgs/{org}/actions/secrets",
20012
+ "GET /orgs/{org}/actions/secrets/{secret_name}/repositories",
20013
+ "GET /orgs/{org}/actions/variables",
20014
+ "GET /orgs/{org}/actions/variables/{name}/repositories",
20015
+ "GET /orgs/{org}/blocks",
20016
+ "GET /orgs/{org}/code-scanning/alerts",
20017
+ "GET /orgs/{org}/codespaces",
20018
+ "GET /orgs/{org}/codespaces/secrets",
20019
+ "GET /orgs/{org}/codespaces/secrets/{secret_name}/repositories",
20020
+ "GET /orgs/{org}/dependabot/alerts",
20021
+ "GET /orgs/{org}/dependabot/secrets",
20022
+ "GET /orgs/{org}/dependabot/secrets/{secret_name}/repositories",
20023
+ "GET /orgs/{org}/events",
20024
+ "GET /orgs/{org}/failed_invitations",
20025
+ "GET /orgs/{org}/hooks",
20026
+ "GET /orgs/{org}/hooks/{hook_id}/deliveries",
20027
+ "GET /orgs/{org}/installations",
20028
+ "GET /orgs/{org}/invitations",
20029
+ "GET /orgs/{org}/invitations/{invitation_id}/teams",
20030
+ "GET /orgs/{org}/issues",
20031
+ "GET /orgs/{org}/members",
20032
+ "GET /orgs/{org}/members/{username}/codespaces",
20033
+ "GET /orgs/{org}/migrations",
20034
+ "GET /orgs/{org}/migrations/{migration_id}/repositories",
20035
+ "GET /orgs/{org}/outside_collaborators",
20036
+ "GET /orgs/{org}/packages",
20037
+ "GET /orgs/{org}/packages/{package_type}/{package_name}/versions",
20038
+ "GET /orgs/{org}/projects",
20039
+ "GET /orgs/{org}/public_members",
20040
+ "GET /orgs/{org}/repos",
20041
+ "GET /orgs/{org}/secret-scanning/alerts",
20042
+ "GET /orgs/{org}/teams",
20043
+ "GET /orgs/{org}/teams/{team_slug}/discussions",
20044
+ "GET /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments",
20045
+ "GET /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number}/reactions",
20046
+ "GET /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/reactions",
20047
+ "GET /orgs/{org}/teams/{team_slug}/invitations",
20048
+ "GET /orgs/{org}/teams/{team_slug}/members",
20049
+ "GET /orgs/{org}/teams/{team_slug}/projects",
20050
+ "GET /orgs/{org}/teams/{team_slug}/repos",
20051
+ "GET /orgs/{org}/teams/{team_slug}/teams",
20052
+ "GET /projects/columns/{column_id}/cards",
20053
+ "GET /projects/{project_id}/collaborators",
20054
+ "GET /projects/{project_id}/columns",
20055
+ "GET /repos/{org}/{repo}/actions/required_workflows",
20056
+ "GET /repos/{owner}/{repo}/actions/artifacts",
20057
+ "GET /repos/{owner}/{repo}/actions/caches",
20058
+ "GET /repos/{owner}/{repo}/actions/organization-secrets",
20059
+ "GET /repos/{owner}/{repo}/actions/organization-variables",
20060
+ "GET /repos/{owner}/{repo}/actions/required_workflows/{required_workflow_id_for_repo}/runs",
20061
+ "GET /repos/{owner}/{repo}/actions/runners",
20062
+ "GET /repos/{owner}/{repo}/actions/runs",
20063
+ "GET /repos/{owner}/{repo}/actions/runs/{run_id}/artifacts",
20064
+ "GET /repos/{owner}/{repo}/actions/runs/{run_id}/attempts/{attempt_number}/jobs",
20065
+ "GET /repos/{owner}/{repo}/actions/runs/{run_id}/jobs",
20066
+ "GET /repos/{owner}/{repo}/actions/secrets",
20067
+ "GET /repos/{owner}/{repo}/actions/variables",
20068
+ "GET /repos/{owner}/{repo}/actions/workflows",
20069
+ "GET /repos/{owner}/{repo}/actions/workflows/{workflow_id}/runs",
20070
+ "GET /repos/{owner}/{repo}/assignees",
20071
+ "GET /repos/{owner}/{repo}/branches",
20072
+ "GET /repos/{owner}/{repo}/check-runs/{check_run_id}/annotations",
20073
+ "GET /repos/{owner}/{repo}/check-suites/{check_suite_id}/check-runs",
20074
+ "GET /repos/{owner}/{repo}/code-scanning/alerts",
20075
+ "GET /repos/{owner}/{repo}/code-scanning/alerts/{alert_number}/instances",
20076
+ "GET /repos/{owner}/{repo}/code-scanning/analyses",
20077
+ "GET /repos/{owner}/{repo}/codespaces",
20078
+ "GET /repos/{owner}/{repo}/codespaces/devcontainers",
20079
+ "GET /repos/{owner}/{repo}/codespaces/secrets",
20080
+ "GET /repos/{owner}/{repo}/collaborators",
20081
+ "GET /repos/{owner}/{repo}/comments",
20082
+ "GET /repos/{owner}/{repo}/comments/{comment_id}/reactions",
20083
+ "GET /repos/{owner}/{repo}/commits",
20084
+ "GET /repos/{owner}/{repo}/commits/{commit_sha}/comments",
20085
+ "GET /repos/{owner}/{repo}/commits/{commit_sha}/pulls",
20086
+ "GET /repos/{owner}/{repo}/commits/{ref}/check-runs",
20087
+ "GET /repos/{owner}/{repo}/commits/{ref}/check-suites",
20088
+ "GET /repos/{owner}/{repo}/commits/{ref}/status",
20089
+ "GET /repos/{owner}/{repo}/commits/{ref}/statuses",
20090
+ "GET /repos/{owner}/{repo}/contributors",
20091
+ "GET /repos/{owner}/{repo}/dependabot/alerts",
20092
+ "GET /repos/{owner}/{repo}/dependabot/secrets",
20093
+ "GET /repos/{owner}/{repo}/deployments",
20094
+ "GET /repos/{owner}/{repo}/deployments/{deployment_id}/statuses",
20095
+ "GET /repos/{owner}/{repo}/environments",
20096
+ "GET /repos/{owner}/{repo}/environments/{environment_name}/deployment-branch-policies",
20097
+ "GET /repos/{owner}/{repo}/environments/{environment_name}/deployment_protection_rules/apps",
20098
+ "GET /repos/{owner}/{repo}/events",
20099
+ "GET /repos/{owner}/{repo}/forks",
20100
+ "GET /repos/{owner}/{repo}/hooks",
20101
+ "GET /repos/{owner}/{repo}/hooks/{hook_id}/deliveries",
20102
+ "GET /repos/{owner}/{repo}/invitations",
20103
+ "GET /repos/{owner}/{repo}/issues",
20104
+ "GET /repos/{owner}/{repo}/issues/comments",
20105
+ "GET /repos/{owner}/{repo}/issues/comments/{comment_id}/reactions",
20106
+ "GET /repos/{owner}/{repo}/issues/events",
20107
+ "GET /repos/{owner}/{repo}/issues/{issue_number}/comments",
20108
+ "GET /repos/{owner}/{repo}/issues/{issue_number}/events",
20109
+ "GET /repos/{owner}/{repo}/issues/{issue_number}/labels",
20110
+ "GET /repos/{owner}/{repo}/issues/{issue_number}/reactions",
20111
+ "GET /repos/{owner}/{repo}/issues/{issue_number}/timeline",
20112
+ "GET /repos/{owner}/{repo}/keys",
20113
+ "GET /repos/{owner}/{repo}/labels",
20114
+ "GET /repos/{owner}/{repo}/milestones",
20115
+ "GET /repos/{owner}/{repo}/milestones/{milestone_number}/labels",
20116
+ "GET /repos/{owner}/{repo}/notifications",
20117
+ "GET /repos/{owner}/{repo}/pages/builds",
20118
+ "GET /repos/{owner}/{repo}/projects",
20119
+ "GET /repos/{owner}/{repo}/pulls",
20120
+ "GET /repos/{owner}/{repo}/pulls/comments",
20121
+ "GET /repos/{owner}/{repo}/pulls/comments/{comment_id}/reactions",
20122
+ "GET /repos/{owner}/{repo}/pulls/{pull_number}/comments",
20123
+ "GET /repos/{owner}/{repo}/pulls/{pull_number}/commits",
20124
+ "GET /repos/{owner}/{repo}/pulls/{pull_number}/files",
20125
+ "GET /repos/{owner}/{repo}/pulls/{pull_number}/reviews",
20126
+ "GET /repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id}/comments",
20127
+ "GET /repos/{owner}/{repo}/releases",
20128
+ "GET /repos/{owner}/{repo}/releases/{release_id}/assets",
20129
+ "GET /repos/{owner}/{repo}/releases/{release_id}/reactions",
20130
+ "GET /repos/{owner}/{repo}/secret-scanning/alerts",
20131
+ "GET /repos/{owner}/{repo}/secret-scanning/alerts/{alert_number}/locations",
20132
+ "GET /repos/{owner}/{repo}/security-advisories",
20133
+ "GET /repos/{owner}/{repo}/stargazers",
20134
+ "GET /repos/{owner}/{repo}/subscribers",
20135
+ "GET /repos/{owner}/{repo}/tags",
20136
+ "GET /repos/{owner}/{repo}/teams",
20137
+ "GET /repos/{owner}/{repo}/topics",
20138
+ "GET /repositories",
20139
+ "GET /repositories/{repository_id}/environments/{environment_name}/secrets",
20140
+ "GET /repositories/{repository_id}/environments/{environment_name}/variables",
20141
+ "GET /search/code",
20142
+ "GET /search/commits",
20143
+ "GET /search/issues",
20144
+ "GET /search/labels",
20145
+ "GET /search/repositories",
20146
+ "GET /search/topics",
20147
+ "GET /search/users",
20148
+ "GET /teams/{team_id}/discussions",
20149
+ "GET /teams/{team_id}/discussions/{discussion_number}/comments",
20150
+ "GET /teams/{team_id}/discussions/{discussion_number}/comments/{comment_number}/reactions",
20151
+ "GET /teams/{team_id}/discussions/{discussion_number}/reactions",
20152
+ "GET /teams/{team_id}/invitations",
20153
+ "GET /teams/{team_id}/members",
20154
+ "GET /teams/{team_id}/projects",
20155
+ "GET /teams/{team_id}/repos",
20156
+ "GET /teams/{team_id}/teams",
20157
+ "GET /user/blocks",
20158
+ "GET /user/codespaces",
20159
+ "GET /user/codespaces/secrets",
20160
+ "GET /user/emails",
20161
+ "GET /user/followers",
20162
+ "GET /user/following",
20163
+ "GET /user/gpg_keys",
20164
+ "GET /user/installations",
20165
+ "GET /user/installations/{installation_id}/repositories",
20166
+ "GET /user/issues",
20167
+ "GET /user/keys",
20168
+ "GET /user/marketplace_purchases",
20169
+ "GET /user/marketplace_purchases/stubbed",
20170
+ "GET /user/memberships/orgs",
20171
+ "GET /user/migrations",
20172
+ "GET /user/migrations/{migration_id}/repositories",
20173
+ "GET /user/orgs",
20174
+ "GET /user/packages",
20175
+ "GET /user/packages/{package_type}/{package_name}/versions",
20176
+ "GET /user/public_emails",
20177
+ "GET /user/repos",
20178
+ "GET /user/repository_invitations",
20179
+ "GET /user/social_accounts",
20180
+ "GET /user/ssh_signing_keys",
20181
+ "GET /user/starred",
20182
+ "GET /user/subscriptions",
20183
+ "GET /user/teams",
20184
+ "GET /users",
20185
+ "GET /users/{username}/events",
20186
+ "GET /users/{username}/events/orgs/{org}",
20187
+ "GET /users/{username}/events/public",
20188
+ "GET /users/{username}/followers",
20189
+ "GET /users/{username}/following",
20190
+ "GET /users/{username}/gists",
20191
+ "GET /users/{username}/gpg_keys",
20192
+ "GET /users/{username}/keys",
20193
+ "GET /users/{username}/orgs",
20194
+ "GET /users/{username}/packages",
20195
+ "GET /users/{username}/projects",
20196
+ "GET /users/{username}/received_events",
20197
+ "GET /users/{username}/received_events/public",
20198
+ "GET /users/{username}/repos",
20199
+ "GET /users/{username}/social_accounts",
20200
+ "GET /users/{username}/ssh_signing_keys",
20201
+ "GET /users/{username}/starred",
20202
+ "GET /users/{username}/subscriptions"
20203
+ ];
18777
20204
  function isPaginatingEndpoint(arg) {
18778
20205
  if (typeof arg === "string") {
18779
20206
  return paginatingEndpoints.includes(arg);
@@ -18789,10 +20216,6 @@ var require_dist_node17 = __commonJS({
18789
20216
  };
18790
20217
  }
18791
20218
  paginateRest.VERSION = VERSION;
18792
- exports2.composePaginateRest = composePaginateRest;
18793
- exports2.isPaginatingEndpoint = isPaginatingEndpoint;
18794
- exports2.paginateRest = paginateRest;
18795
- exports2.paginatingEndpoints = paginatingEndpoints;
18796
20219
  }
18797
20220
  });
18798
20221
 
@@ -18890,6 +20313,8 @@ var require_dist_node18 = __commonJS({
18890
20313
  listLabelsForSelfHostedRunnerForRepo: ["GET /repos/{owner}/{repo}/actions/runners/{runner_id}/labels"],
18891
20314
  listOrgSecrets: ["GET /orgs/{org}/actions/secrets"],
18892
20315
  listOrgVariables: ["GET /orgs/{org}/actions/variables"],
20316
+ listRepoOrganizationSecrets: ["GET /repos/{owner}/{repo}/actions/organization-secrets"],
20317
+ listRepoOrganizationVariables: ["GET /repos/{owner}/{repo}/actions/organization-variables"],
18893
20318
  listRepoRequiredWorkflows: ["GET /repos/{org}/{repo}/actions/required_workflows"],
18894
20319
  listRepoSecrets: ["GET /repos/{owner}/{repo}/actions/secrets"],
18895
20320
  listRepoVariables: ["GET /repos/{owner}/{repo}/actions/variables"],
@@ -18917,6 +20342,7 @@ var require_dist_node18 = __commonJS({
18917
20342
  removeSelectedRepoFromOrgSecret: ["DELETE /orgs/{org}/actions/secrets/{secret_name}/repositories/{repository_id}"],
18918
20343
  removeSelectedRepoFromOrgVariable: ["DELETE /orgs/{org}/actions/variables/{name}/repositories/{repository_id}"],
18919
20344
  removeSelectedRepoFromRequiredWorkflow: ["DELETE /orgs/{org}/actions/required_workflows/{required_workflow_id}/repositories/{repository_id}"],
20345
+ reviewCustomGatesForRun: ["POST /repos/{owner}/{repo}/actions/runs/{run_id}/deployment_protection_rule"],
18920
20346
  reviewPendingDeploymentsForRun: ["POST /repos/{owner}/{repo}/actions/runs/{run_id}/pending_deployments"],
18921
20347
  setAllowedActionsOrganization: ["PUT /orgs/{org}/actions/permissions/selected-actions"],
18922
20348
  setAllowedActionsRepository: ["PUT /repos/{owner}/{repo}/actions/permissions/selected-actions"],
@@ -18993,6 +20419,7 @@ var require_dist_node18 = __commonJS({
18993
20419
  listAccountsForPlan: ["GET /marketplace_listing/plans/{plan_id}/accounts"],
18994
20420
  listAccountsForPlanStubbed: ["GET /marketplace_listing/stubbed/plans/{plan_id}/accounts"],
18995
20421
  listInstallationReposForAuthenticatedUser: ["GET /user/installations/{installation_id}/repositories"],
20422
+ listInstallationRequestsForAuthenticatedApp: ["GET /app/installation-requests"],
18996
20423
  listInstallations: ["GET /app/installations"],
18997
20424
  listInstallationsForAuthenticatedUser: ["GET /user/installations"],
18998
20425
  listPlans: ["GET /marketplace_listing/plans"],
@@ -19044,6 +20471,7 @@ var require_dist_node18 = __commonJS({
19044
20471
  }],
19045
20472
  getAnalysis: ["GET /repos/{owner}/{repo}/code-scanning/analyses/{analysis_id}"],
19046
20473
  getCodeqlDatabase: ["GET /repos/{owner}/{repo}/code-scanning/codeql/databases/{language}"],
20474
+ getDefaultSetup: ["GET /repos/{owner}/{repo}/code-scanning/default-setup"],
19047
20475
  getSarif: ["GET /repos/{owner}/{repo}/code-scanning/sarifs/{sarif_id}"],
19048
20476
  listAlertInstances: ["GET /repos/{owner}/{repo}/code-scanning/alerts/{alert_number}/instances"],
19049
20477
  listAlertsForOrg: ["GET /orgs/{org}/code-scanning/alerts"],
@@ -19054,6 +20482,7 @@ var require_dist_node18 = __commonJS({
19054
20482
  listCodeqlDatabases: ["GET /repos/{owner}/{repo}/code-scanning/codeql/databases"],
19055
20483
  listRecentAnalyses: ["GET /repos/{owner}/{repo}/code-scanning/analyses"],
19056
20484
  updateAlert: ["PATCH /repos/{owner}/{repo}/code-scanning/alerts/{alert_number}"],
20485
+ updateDefaultSetup: ["PATCH /repos/{owner}/{repo}/code-scanning/default-setup"],
19057
20486
  uploadSarif: ["POST /repos/{owner}/{repo}/code-scanning/sarifs"]
19058
20487
  },
19059
20488
  codesOfConduct: {
@@ -19070,6 +20499,7 @@ var require_dist_node18 = __commonJS({
19070
20499
  createOrUpdateSecretForAuthenticatedUser: ["PUT /user/codespaces/secrets/{secret_name}"],
19071
20500
  createWithPrForAuthenticatedUser: ["POST /repos/{owner}/{repo}/pulls/{pull_number}/codespaces"],
19072
20501
  createWithRepoForAuthenticatedUser: ["POST /repos/{owner}/{repo}/codespaces"],
20502
+ deleteCodespacesBillingUsers: ["DELETE /orgs/{org}/codespaces/billing/selected_users"],
19073
20503
  deleteForAuthenticatedUser: ["DELETE /user/codespaces/{codespace_name}"],
19074
20504
  deleteFromOrganization: ["DELETE /orgs/{org}/members/{username}/codespaces/{codespace_name}"],
19075
20505
  deleteOrgSecret: ["DELETE /orgs/{org}/codespaces/secrets/{secret_name}"],
@@ -19104,6 +20534,7 @@ var require_dist_node18 = __commonJS({
19104
20534
  removeSelectedRepoFromOrgSecret: ["DELETE /orgs/{org}/codespaces/secrets/{secret_name}/repositories/{repository_id}"],
19105
20535
  repoMachinesForAuthenticatedUser: ["GET /repos/{owner}/{repo}/codespaces/machines"],
19106
20536
  setCodespacesBilling: ["PUT /orgs/{org}/codespaces/billing"],
20537
+ setCodespacesBillingUsers: ["POST /orgs/{org}/codespaces/billing/selected_users"],
19107
20538
  setRepositoriesForSecretForAuthenticatedUser: ["PUT /user/codespaces/secrets/{secret_name}/repositories"],
19108
20539
  setSelectedReposForOrgSecret: ["PUT /orgs/{org}/codespaces/secrets/{secret_name}/repositories"],
19109
20540
  startForAuthenticatedUser: ["POST /user/codespaces/{codespace_name}/start"],
@@ -19134,16 +20565,12 @@ var require_dist_node18 = __commonJS({
19134
20565
  },
19135
20566
  dependencyGraph: {
19136
20567
  createRepositorySnapshot: ["POST /repos/{owner}/{repo}/dependency-graph/snapshots"],
19137
- diffRange: ["GET /repos/{owner}/{repo}/dependency-graph/compare/{basehead}"]
20568
+ diffRange: ["GET /repos/{owner}/{repo}/dependency-graph/compare/{basehead}"],
20569
+ exportSbom: ["GET /repos/{owner}/{repo}/dependency-graph/sbom"]
19138
20570
  },
19139
20571
  emojis: {
19140
20572
  get: ["GET /emojis"]
19141
20573
  },
19142
- enterpriseAdmin: {
19143
- addCustomLabelsToSelfHostedRunnerForEnterprise: ["POST /enterprises/{enterprise}/actions/runners/{runner_id}/labels"],
19144
- enableSelectedOrganizationGithubActionsEnterprise: ["PUT /enterprises/{enterprise}/actions/permissions/organizations/{org_id}"],
19145
- listLabelsForSelfHostedRunnerForEnterprise: ["GET /enterprises/{enterprise}/actions/runners/{runner_id}/labels"]
19146
- },
19147
20574
  gists: {
19148
20575
  checkIsStarred: ["GET /gists/{gist_id}/star"],
19149
20576
  create: ["POST /gists"],
@@ -19304,6 +20731,7 @@ var require_dist_node18 = __commonJS({
19304
20731
  convertMemberToOutsideCollaborator: ["PUT /orgs/{org}/outside_collaborators/{username}"],
19305
20732
  createInvitation: ["POST /orgs/{org}/invitations"],
19306
20733
  createWebhook: ["POST /orgs/{org}/hooks"],
20734
+ delete: ["DELETE /orgs/{org}"],
19307
20735
  deleteWebhook: ["DELETE /orgs/{org}/hooks/{hook_id}"],
19308
20736
  enableOrDisableSecurityProductOnAllOrgRepos: ["POST /orgs/{org}/{security_product}/{enablement}"],
19309
20737
  get: ["GET /orgs/{org}"],
@@ -19322,6 +20750,10 @@ var require_dist_node18 = __commonJS({
19322
20750
  listMembers: ["GET /orgs/{org}/members"],
19323
20751
  listMembershipsForAuthenticatedUser: ["GET /user/memberships/orgs"],
19324
20752
  listOutsideCollaborators: ["GET /orgs/{org}/outside_collaborators"],
20753
+ listPatGrantRepositories: ["GET /organizations/{org}/personal-access-tokens/{pat_id}/repositories"],
20754
+ listPatGrantRequestRepositories: ["GET /organizations/{org}/personal-access-token-requests/{pat_request_id}/repositories"],
20755
+ listPatGrantRequests: ["GET /organizations/{org}/personal-access-token-requests"],
20756
+ listPatGrants: ["GET /organizations/{org}/personal-access-tokens"],
19325
20757
  listPendingInvitations: ["GET /orgs/{org}/invitations"],
19326
20758
  listPublicMembers: ["GET /orgs/{org}/public_members"],
19327
20759
  listSecurityManagerTeams: ["GET /orgs/{org}/security-managers"],
@@ -19334,11 +20766,15 @@ var require_dist_node18 = __commonJS({
19334
20766
  removeOutsideCollaborator: ["DELETE /orgs/{org}/outside_collaborators/{username}"],
19335
20767
  removePublicMembershipForAuthenticatedUser: ["DELETE /orgs/{org}/public_members/{username}"],
19336
20768
  removeSecurityManagerTeam: ["DELETE /orgs/{org}/security-managers/teams/{team_slug}"],
20769
+ reviewPatGrantRequest: ["POST /organizations/{org}/personal-access-token-requests/{pat_request_id}"],
20770
+ reviewPatGrantRequestsInBulk: ["POST /organizations/{org}/personal-access-token-requests"],
19337
20771
  setMembershipForUser: ["PUT /orgs/{org}/memberships/{username}"],
19338
20772
  setPublicMembershipForAuthenticatedUser: ["PUT /orgs/{org}/public_members/{username}"],
19339
20773
  unblockUser: ["DELETE /orgs/{org}/blocks/{username}"],
19340
20774
  update: ["PATCH /orgs/{org}"],
19341
20775
  updateMembershipForAuthenticatedUser: ["PATCH /user/memberships/orgs/{org}"],
20776
+ updatePatAccess: ["POST /organizations/{org}/personal-access-tokens/{pat_id}"],
20777
+ updatePatAccesses: ["POST /organizations/{org}/personal-access-tokens"],
19342
20778
  updateWebhook: ["PATCH /orgs/{org}/hooks/{hook_id}"],
19343
20779
  updateWebhookConfigForOrg: ["PATCH /orgs/{org}/hooks/{hook_id}/config"]
19344
20780
  },
@@ -19364,6 +20800,9 @@ var require_dist_node18 = __commonJS({
19364
20800
  getPackageVersionForAuthenticatedUser: ["GET /user/packages/{package_type}/{package_name}/versions/{package_version_id}"],
19365
20801
  getPackageVersionForOrganization: ["GET /orgs/{org}/packages/{package_type}/{package_name}/versions/{package_version_id}"],
19366
20802
  getPackageVersionForUser: ["GET /users/{username}/packages/{package_type}/{package_name}/versions/{package_version_id}"],
20803
+ listDockerMigrationConflictingPackagesForAuthenticatedUser: ["GET /user/docker/conflicts"],
20804
+ listDockerMigrationConflictingPackagesForOrganization: ["GET /orgs/{org}/docker/conflicts"],
20805
+ listDockerMigrationConflictingPackagesForUser: ["GET /users/{username}/docker/conflicts"],
19367
20806
  listPackagesForAuthenticatedUser: ["GET /user/packages"],
19368
20807
  listPackagesForOrganization: ["GET /orgs/{org}/packages"],
19369
20808
  listPackagesForUser: ["GET /users/{username}/packages"],
@@ -19486,6 +20925,7 @@ var require_dist_node18 = __commonJS({
19486
20925
  createDeployKey: ["POST /repos/{owner}/{repo}/keys"],
19487
20926
  createDeployment: ["POST /repos/{owner}/{repo}/deployments"],
19488
20927
  createDeploymentBranchPolicy: ["POST /repos/{owner}/{repo}/environments/{environment_name}/deployment-branch-policies"],
20928
+ createDeploymentProtectionRule: ["POST /repos/{owner}/{repo}/environments/{environment_name}/deployment_protection_rules"],
19489
20929
  createDeploymentStatus: ["POST /repos/{owner}/{repo}/deployments/{deployment_id}/statuses"],
19490
20930
  createDispatchEvent: ["POST /repos/{owner}/{repo}/dispatches"],
19491
20931
  createForAuthenticatedUser: ["POST /user/repos"],
@@ -19493,9 +20933,11 @@ var require_dist_node18 = __commonJS({
19493
20933
  createInOrg: ["POST /orgs/{org}/repos"],
19494
20934
  createOrUpdateEnvironment: ["PUT /repos/{owner}/{repo}/environments/{environment_name}"],
19495
20935
  createOrUpdateFileContents: ["PUT /repos/{owner}/{repo}/contents/{path}"],
20936
+ createOrgRuleset: ["POST /orgs/{org}/rulesets"],
19496
20937
  createPagesDeployment: ["POST /repos/{owner}/{repo}/pages/deployment"],
19497
20938
  createPagesSite: ["POST /repos/{owner}/{repo}/pages"],
19498
20939
  createRelease: ["POST /repos/{owner}/{repo}/releases"],
20940
+ createRepoRuleset: ["POST /repos/{owner}/{repo}/rulesets"],
19499
20941
  createTagProtection: ["POST /repos/{owner}/{repo}/tags/protection"],
19500
20942
  createUsingTemplate: ["POST /repos/{template_owner}/{template_repo}/generate"],
19501
20943
  createWebhook: ["POST /repos/{owner}/{repo}/hooks"],
@@ -19516,13 +20958,16 @@ var require_dist_node18 = __commonJS({
19516
20958
  deleteDeploymentBranchPolicy: ["DELETE /repos/{owner}/{repo}/environments/{environment_name}/deployment-branch-policies/{branch_policy_id}"],
19517
20959
  deleteFile: ["DELETE /repos/{owner}/{repo}/contents/{path}"],
19518
20960
  deleteInvitation: ["DELETE /repos/{owner}/{repo}/invitations/{invitation_id}"],
20961
+ deleteOrgRuleset: ["DELETE /orgs/{org}/rulesets/{ruleset_id}"],
19519
20962
  deletePagesSite: ["DELETE /repos/{owner}/{repo}/pages"],
19520
20963
  deletePullRequestReviewProtection: ["DELETE /repos/{owner}/{repo}/branches/{branch}/protection/required_pull_request_reviews"],
19521
20964
  deleteRelease: ["DELETE /repos/{owner}/{repo}/releases/{release_id}"],
19522
20965
  deleteReleaseAsset: ["DELETE /repos/{owner}/{repo}/releases/assets/{asset_id}"],
20966
+ deleteRepoRuleset: ["DELETE /repos/{owner}/{repo}/rulesets/{ruleset_id}"],
19523
20967
  deleteTagProtection: ["DELETE /repos/{owner}/{repo}/tags/protection/{tag_protection_id}"],
19524
20968
  deleteWebhook: ["DELETE /repos/{owner}/{repo}/hooks/{hook_id}"],
19525
20969
  disableAutomatedSecurityFixes: ["DELETE /repos/{owner}/{repo}/automated-security-fixes"],
20970
+ disableDeploymentProtectionRule: ["DELETE /repos/{owner}/{repo}/environments/{environment_name}/deployment_protection_rules/{protection_rule_id}"],
19526
20971
  disableLfsForRepo: ["DELETE /repos/{owner}/{repo}/lfs"],
19527
20972
  disableVulnerabilityAlerts: ["DELETE /repos/{owner}/{repo}/vulnerability-alerts"],
19528
20973
  downloadArchive: ["GET /repos/{owner}/{repo}/zipball/{ref}", {}, {
@@ -19537,6 +20982,7 @@ var require_dist_node18 = __commonJS({
19537
20982
  get: ["GET /repos/{owner}/{repo}"],
19538
20983
  getAccessRestrictions: ["GET /repos/{owner}/{repo}/branches/{branch}/protection/restrictions"],
19539
20984
  getAdminBranchProtection: ["GET /repos/{owner}/{repo}/branches/{branch}/protection/enforce_admins"],
20985
+ getAllDeploymentProtectionRules: ["GET /repos/{owner}/{repo}/environments/{environment_name}/deployment_protection_rules"],
19540
20986
  getAllEnvironments: ["GET /repos/{owner}/{repo}/environments"],
19541
20987
  getAllStatusCheckContexts: ["GET /repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks/contexts"],
19542
20988
  getAllTopics: ["GET /repos/{owner}/{repo}/topics"],
@@ -19544,6 +20990,7 @@ var require_dist_node18 = __commonJS({
19544
20990
  getAutolink: ["GET /repos/{owner}/{repo}/autolinks/{autolink_id}"],
19545
20991
  getBranch: ["GET /repos/{owner}/{repo}/branches/{branch}"],
19546
20992
  getBranchProtection: ["GET /repos/{owner}/{repo}/branches/{branch}/protection"],
20993
+ getBranchRules: ["GET /repos/{owner}/{repo}/rules/branches/{branch}"],
19547
20994
  getClones: ["GET /repos/{owner}/{repo}/traffic/clones"],
19548
20995
  getCodeFrequencyStats: ["GET /repos/{owner}/{repo}/stats/code_frequency"],
19549
20996
  getCollaboratorPermissionLevel: ["GET /repos/{owner}/{repo}/collaborators/{username}/permission"],
@@ -19555,6 +21002,7 @@ var require_dist_node18 = __commonJS({
19555
21002
  getCommunityProfileMetrics: ["GET /repos/{owner}/{repo}/community/profile"],
19556
21003
  getContent: ["GET /repos/{owner}/{repo}/contents/{path}"],
19557
21004
  getContributorsStats: ["GET /repos/{owner}/{repo}/stats/contributors"],
21005
+ getCustomDeploymentProtectionRule: ["GET /repos/{owner}/{repo}/environments/{environment_name}/deployment_protection_rules/{protection_rule_id}"],
19558
21006
  getDeployKey: ["GET /repos/{owner}/{repo}/keys/{key_id}"],
19559
21007
  getDeployment: ["GET /repos/{owner}/{repo}/deployments/{deployment_id}"],
19560
21008
  getDeploymentBranchPolicy: ["GET /repos/{owner}/{repo}/environments/{environment_name}/deployment-branch-policies/{branch_policy_id}"],
@@ -19562,6 +21010,8 @@ var require_dist_node18 = __commonJS({
19562
21010
  getEnvironment: ["GET /repos/{owner}/{repo}/environments/{environment_name}"],
19563
21011
  getLatestPagesBuild: ["GET /repos/{owner}/{repo}/pages/builds/latest"],
19564
21012
  getLatestRelease: ["GET /repos/{owner}/{repo}/releases/latest"],
21013
+ getOrgRuleset: ["GET /orgs/{org}/rulesets/{ruleset_id}"],
21014
+ getOrgRulesets: ["GET /orgs/{org}/rulesets"],
19565
21015
  getPages: ["GET /repos/{owner}/{repo}/pages"],
19566
21016
  getPagesBuild: ["GET /repos/{owner}/{repo}/pages/builds/{build_id}"],
19567
21017
  getPagesHealthCheck: ["GET /repos/{owner}/{repo}/pages/health"],
@@ -19573,6 +21023,8 @@ var require_dist_node18 = __commonJS({
19573
21023
  getRelease: ["GET /repos/{owner}/{repo}/releases/{release_id}"],
19574
21024
  getReleaseAsset: ["GET /repos/{owner}/{repo}/releases/assets/{asset_id}"],
19575
21025
  getReleaseByTag: ["GET /repos/{owner}/{repo}/releases/tags/{tag}"],
21026
+ getRepoRuleset: ["GET /repos/{owner}/{repo}/rulesets/{ruleset_id}"],
21027
+ getRepoRulesets: ["GET /repos/{owner}/{repo}/rulesets"],
19576
21028
  getStatusChecksProtection: ["GET /repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks"],
19577
21029
  getTeamsWithAccessToProtectedBranch: ["GET /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/teams"],
19578
21030
  getTopPaths: ["GET /repos/{owner}/{repo}/traffic/popular/paths"],
@@ -19591,6 +21043,7 @@ var require_dist_node18 = __commonJS({
19591
21043
  listCommitStatusesForRef: ["GET /repos/{owner}/{repo}/commits/{ref}/statuses"],
19592
21044
  listCommits: ["GET /repos/{owner}/{repo}/commits"],
19593
21045
  listContributors: ["GET /repos/{owner}/{repo}/contributors"],
21046
+ listCustomDeploymentRuleIntegrations: ["GET /repos/{owner}/{repo}/environments/{environment_name}/deployment_protection_rules/apps"],
19594
21047
  listDeployKeys: ["GET /repos/{owner}/{repo}/keys"],
19595
21048
  listDeploymentBranchPolicies: ["GET /repos/{owner}/{repo}/environments/{environment_name}/deployment-branch-policies"],
19596
21049
  listDeploymentStatuses: ["GET /repos/{owner}/{repo}/deployments/{deployment_id}/statuses"],
@@ -19654,9 +21107,11 @@ var require_dist_node18 = __commonJS({
19654
21107
  updateDeploymentBranchPolicy: ["PUT /repos/{owner}/{repo}/environments/{environment_name}/deployment-branch-policies/{branch_policy_id}"],
19655
21108
  updateInformationAboutPagesSite: ["PUT /repos/{owner}/{repo}/pages"],
19656
21109
  updateInvitation: ["PATCH /repos/{owner}/{repo}/invitations/{invitation_id}"],
21110
+ updateOrgRuleset: ["PUT /orgs/{org}/rulesets/{ruleset_id}"],
19657
21111
  updatePullRequestReviewProtection: ["PATCH /repos/{owner}/{repo}/branches/{branch}/protection/required_pull_request_reviews"],
19658
21112
  updateRelease: ["PATCH /repos/{owner}/{repo}/releases/{release_id}"],
19659
21113
  updateReleaseAsset: ["PATCH /repos/{owner}/{repo}/releases/assets/{asset_id}"],
21114
+ updateRepoRuleset: ["PUT /repos/{owner}/{repo}/rulesets/{ruleset_id}"],
19660
21115
  updateStatusCheckPotection: ["PATCH /repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks", {}, {
19661
21116
  renamed: ["repos", "updateStatusCheckProtection"]
19662
21117
  }],
@@ -19678,15 +21133,19 @@ var require_dist_node18 = __commonJS({
19678
21133
  },
19679
21134
  secretScanning: {
19680
21135
  getAlert: ["GET /repos/{owner}/{repo}/secret-scanning/alerts/{alert_number}"],
19681
- getSecurityAnalysisSettingsForEnterprise: ["GET /enterprises/{enterprise}/code_security_and_analysis"],
19682
21136
  listAlertsForEnterprise: ["GET /enterprises/{enterprise}/secret-scanning/alerts"],
19683
21137
  listAlertsForOrg: ["GET /orgs/{org}/secret-scanning/alerts"],
19684
21138
  listAlertsForRepo: ["GET /repos/{owner}/{repo}/secret-scanning/alerts"],
19685
21139
  listLocationsForAlert: ["GET /repos/{owner}/{repo}/secret-scanning/alerts/{alert_number}/locations"],
19686
- patchSecurityAnalysisSettingsForEnterprise: ["PATCH /enterprises/{enterprise}/code_security_and_analysis"],
19687
- postSecurityProductEnablementForEnterprise: ["POST /enterprises/{enterprise}/{security_product}/{enablement}"],
19688
21140
  updateAlert: ["PATCH /repos/{owner}/{repo}/secret-scanning/alerts/{alert_number}"]
19689
21141
  },
21142
+ securityAdvisories: {
21143
+ createPrivateVulnerabilityReport: ["POST /repos/{owner}/{repo}/security-advisories/reports"],
21144
+ createRepositoryAdvisory: ["POST /repos/{owner}/{repo}/security-advisories"],
21145
+ getRepositoryAdvisory: ["GET /repos/{owner}/{repo}/security-advisories/{ghsa_id}"],
21146
+ listRepositoryAdvisories: ["GET /repos/{owner}/{repo}/security-advisories"],
21147
+ updateRepositoryAdvisory: ["PATCH /repos/{owner}/{repo}/security-advisories/{ghsa_id}"]
21148
+ },
19690
21149
  teams: {
19691
21150
  addOrUpdateMembershipForUserInOrg: ["PUT /orgs/{org}/teams/{team_slug}/memberships/{username}"],
19692
21151
  addOrUpdateProjectPermissionsInOrg: ["PUT /orgs/{org}/teams/{team_slug}/projects/{project_id}"],
@@ -19724,6 +21183,7 @@ var require_dist_node18 = __commonJS({
19724
21183
  renamed: ["users", "addEmailForAuthenticatedUser"]
19725
21184
  }],
19726
21185
  addEmailForAuthenticatedUser: ["POST /user/emails"],
21186
+ addSocialAccountForAuthenticatedUser: ["POST /user/social_accounts"],
19727
21187
  block: ["PUT /user/blocks/{username}"],
19728
21188
  checkBlocked: ["GET /user/blocks/{username}"],
19729
21189
  checkFollowingForUser: ["GET /users/{username}/following/{target_user}"],
@@ -19749,6 +21209,7 @@ var require_dist_node18 = __commonJS({
19749
21209
  renamed: ["users", "deletePublicSshKeyForAuthenticatedUser"]
19750
21210
  }],
19751
21211
  deletePublicSshKeyForAuthenticatedUser: ["DELETE /user/keys/{key_id}"],
21212
+ deleteSocialAccountForAuthenticatedUser: ["DELETE /user/social_accounts"],
19752
21213
  deleteSshSigningKeyForAuthenticatedUser: ["DELETE /user/ssh_signing_keys/{ssh_signing_key_id}"],
19753
21214
  follow: ["PUT /user/following/{username}"],
19754
21215
  getAuthenticated: ["GET /user"],
@@ -19793,6 +21254,8 @@ var require_dist_node18 = __commonJS({
19793
21254
  renamed: ["users", "listPublicSshKeysForAuthenticatedUser"]
19794
21255
  }],
19795
21256
  listPublicSshKeysForAuthenticatedUser: ["GET /user/keys"],
21257
+ listSocialAccountsForAuthenticatedUser: ["GET /user/social_accounts"],
21258
+ listSocialAccountsForUser: ["GET /users/{username}/social_accounts"],
19796
21259
  listSshSigningKeysForAuthenticatedUser: ["GET /user/ssh_signing_keys"],
19797
21260
  listSshSigningKeysForUser: ["GET /users/{username}/ssh_signing_keys"],
19798
21261
  setPrimaryEmailVisibilityForAuthenticated: ["PATCH /user/email/visibility", {}, {
@@ -19804,7 +21267,7 @@ var require_dist_node18 = __commonJS({
19804
21267
  updateAuthenticated: ["PATCH /user"]
19805
21268
  }
19806
21269
  };
19807
- var VERSION = "7.0.1";
21270
+ var VERSION = "7.1.2";
19808
21271
  function endpointsToMethods(octokit, endpointsMap) {
19809
21272
  const newMethods = {};
19810
21273
  for (const [scope, endpoints] of Object.entries(endpointsMap)) {
@@ -19885,18 +21348,42 @@ var require_dist_node18 = __commonJS({
19885
21348
 
19886
21349
  // node_modules/@octokit/rest/dist-node/index.js
19887
21350
  var require_dist_node19 = __commonJS({
19888
- "node_modules/@octokit/rest/dist-node/index.js"(exports2) {
21351
+ "node_modules/@octokit/rest/dist-node/index.js"(exports2, module2) {
19889
21352
  "use strict";
19890
- Object.defineProperty(exports2, "__esModule", { value: true });
19891
- var core = require_dist_node15();
19892
- var pluginRequestLog = require_dist_node16();
19893
- var pluginPaginateRest = require_dist_node17();
19894
- var pluginRestEndpointMethods = require_dist_node18();
19895
- var VERSION = "19.0.7";
19896
- var Octokit2 = core.Octokit.plugin(pluginRequestLog.requestLog, pluginRestEndpointMethods.legacyRestEndpointMethods, pluginPaginateRest.paginateRest).defaults({
21353
+ var __defProp2 = Object.defineProperty;
21354
+ var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
21355
+ var __getOwnPropNames2 = Object.getOwnPropertyNames;
21356
+ var __hasOwnProp2 = Object.prototype.hasOwnProperty;
21357
+ var __export = (target, all) => {
21358
+ for (var name in all)
21359
+ __defProp2(target, name, { get: all[name], enumerable: true });
21360
+ };
21361
+ var __copyProps2 = (to, from, except, desc) => {
21362
+ if (from && typeof from === "object" || typeof from === "function") {
21363
+ for (let key of __getOwnPropNames2(from))
21364
+ if (!__hasOwnProp2.call(to, key) && key !== except)
21365
+ __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
21366
+ }
21367
+ return to;
21368
+ };
21369
+ var __toCommonJS = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
21370
+ var dist_src_exports = {};
21371
+ __export(dist_src_exports, {
21372
+ Octokit: () => Octokit2
21373
+ });
21374
+ module2.exports = __toCommonJS(dist_src_exports);
21375
+ var import_core = require_dist_node15();
21376
+ var import_plugin_request_log = require_dist_node16();
21377
+ var import_plugin_paginate_rest = require_dist_node17();
21378
+ var import_plugin_rest_endpoint_methods = require_dist_node18();
21379
+ var VERSION = "19.0.11";
21380
+ var Octokit2 = import_core.Octokit.plugin(
21381
+ import_plugin_request_log.requestLog,
21382
+ import_plugin_rest_endpoint_methods.legacyRestEndpointMethods,
21383
+ import_plugin_paginate_rest.paginateRest
21384
+ ).defaults({
19897
21385
  userAgent: `octokit-rest.js/${VERSION}`
19898
21386
  });
19899
- exports2.Octokit = Octokit2;
19900
21387
  }
19901
21388
  });
19902
21389
 
@@ -19928,11 +21415,25 @@ function baseUrlFromDomain(domain) {
19928
21415
  }
19929
21416
  return `https://${domain}/api/v3`;
19930
21417
  }
21418
+ var octokitCache = {};
19931
21419
  async function getOctokit(installationId) {
19932
21420
  if (!process.env.GITHUB_SECRET_ARN || !process.env.GITHUB_PRIVATE_KEY_SECRET_ARN) {
19933
21421
  throw new Error("Missing environment variables");
19934
21422
  }
19935
21423
  const githubSecrets = await getSecretJsonValue(process.env.GITHUB_SECRET_ARN);
21424
+ if (octokitCache.octokit && octokitCache.installationId == installationId && octokitCache.secrets && octokitCache.secrets.domain == githubSecrets.domain && octokitCache.secrets.appId == githubSecrets.appId && octokitCache.secrets.personalAuthToken == githubSecrets.personalAuthToken) {
21425
+ try {
21426
+ await octokitCache.octokit.rest.meta.getOctocat();
21427
+ console.log("Using cached octokit");
21428
+ return {
21429
+ octokit: octokitCache.octokit,
21430
+ githubSecrets: octokitCache.secrets
21431
+ };
21432
+ } catch (e) {
21433
+ console.log("Octokit cache is invalid", e);
21434
+ octokitCache.octokit = void 0;
21435
+ }
21436
+ }
19936
21437
  let baseUrl = baseUrlFromDomain(githubSecrets.domain);
19937
21438
  let token;
19938
21439
  if (githubSecrets.personalAuthToken) {
@@ -19956,9 +21457,12 @@ async function getOctokit(installationId) {
19956
21457
  baseUrl,
19957
21458
  auth: token
19958
21459
  });
21460
+ octokitCache.octokit = octokit;
21461
+ octokitCache.installationId = installationId;
21462
+ octokitCache.secrets = githubSecrets;
19959
21463
  return {
19960
- githubSecrets,
19961
- octokit
21464
+ octokit,
21465
+ githubSecrets
19962
21466
  };
19963
21467
  }
19964
21468
  async function getRunner(octokit, owner, repo, name) {
@@ -19981,7 +21485,7 @@ async function getRunner(octokit, owner, repo, name) {
19981
21485
  }
19982
21486
  }
19983
21487
 
19984
- // src/delete-runner.lambda.ts
21488
+ // src/delete-failed-runner.lambda.ts
19985
21489
  var RunnerBusy = class extends Error {
19986
21490
  constructor(msg) {
19987
21491
  super(msg);
@@ -19989,12 +21493,20 @@ var RunnerBusy = class extends Error {
19989
21493
  Object.setPrototypeOf(this, RunnerBusy.prototype);
19990
21494
  }
19991
21495
  };
21496
+ var ReraisedError = class extends Error {
21497
+ constructor(event) {
21498
+ super(event.error.Cause);
21499
+ this.name = event.error.Error;
21500
+ this.message = event.error.Cause;
21501
+ Object.setPrototypeOf(this, ReraisedError.prototype);
21502
+ }
21503
+ };
19992
21504
  exports.handler = async function(event) {
19993
21505
  const { octokit } = await getOctokit(event.installationId);
19994
21506
  const runner = await getRunner(octokit, event.owner, event.repo, event.runnerName);
19995
21507
  if (!runner) {
19996
21508
  console.error(`Unable to find runner id for ${event.owner}/${event.repo}:${event.runnerName}`);
19997
- return;
21509
+ throw new ReraisedError(event);
19998
21510
  }
19999
21511
  console.log(`Runner ${event.runnerName} has id #${runner.id}`);
20000
21512
  try {
@@ -20008,9 +21520,10 @@ exports.handler = async function(event) {
20008
21520
  if (reqError.message.includes("is still running a job")) {
20009
21521
  throw new RunnerBusy(reqError.message);
20010
21522
  } else {
20011
- throw e;
21523
+ console.error("Unable to delete runner", e);
20012
21524
  }
20013
21525
  }
21526
+ throw new ReraisedError(event);
20014
21527
  };
20015
21528
  /*! Bundled license information:
20016
21529