@cloudsnorkel/cdk-github-runners 0.7.4 → 0.7.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/.jsii +101 -45
  2. package/API.md +30 -1
  3. package/lib/lambdas/aws-image-builder-versioner/index.js +11 -1
  4. package/lib/lambdas/build-image/index.js +4 -0
  5. package/lib/lambdas/delete-ami/index.js +4 -0
  6. package/lib/lambdas/delete-runner/index.js +8626 -2144
  7. package/lib/lambdas/setup/index.html +4 -4
  8. package/lib/lambdas/setup/index.js +283 -4
  9. package/lib/lambdas/status/index.js +8637 -2155
  10. package/lib/lambdas/token-retriever/index.js +8626 -2144
  11. package/lib/lambdas/update-lambda/index.js +216 -1867
  12. package/lib/lambdas/webhook-handler/index.js +5 -0
  13. package/lib/providers/codebuild.js +1 -1
  14. package/lib/providers/common.d.ts +3 -3
  15. package/lib/providers/common.js +4 -4
  16. package/lib/providers/ec2.d.ts +1 -1
  17. package/lib/providers/ec2.js +71 -44
  18. package/lib/providers/fargate.js +1 -1
  19. package/lib/providers/image-builders/ami.d.ts +7 -1
  20. package/lib/providers/image-builders/ami.js +25 -21
  21. package/lib/providers/image-builders/codebuild.js +1 -1
  22. package/lib/providers/image-builders/common.js +1 -1
  23. package/lib/providers/image-builders/container.d.ts +1 -1
  24. package/lib/providers/image-builders/container.js +11 -11
  25. package/lib/providers/image-builders/linux-components.d.ts +1 -1
  26. package/lib/providers/image-builders/linux-components.js +21 -19
  27. package/lib/providers/image-builders/static.js +6 -6
  28. package/lib/providers/image-builders/windows-components.d.ts +1 -1
  29. package/lib/providers/image-builders/windows-components.js +14 -12
  30. package/lib/providers/lambda.js +3 -3
  31. package/lib/runner.d.ts +1 -0
  32. package/lib/runner.js +19 -2
  33. package/lib/secrets.js +1 -1
  34. package/package.json +10 -10
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
17
17
  return to;
18
18
  };
19
19
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
20
24
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
21
25
  mod
22
26
  ));
@@ -1627,7 +1631,9 @@ var require_url_state_machine = __commonJS({
1627
1631
  this.url.fragment = "";
1628
1632
  this.state = "fragment";
1629
1633
  } else {
1630
- if (this.input.length - this.pointer - 1 === 0 || !isWindowsDriveLetterCodePoints(c, this.input[this.pointer + 1]) || this.input.length - this.pointer - 1 >= 2 && !fileOtherwiseCodePoints.has(this.input[this.pointer + 2])) {
1634
+ if (this.input.length - this.pointer - 1 === 0 || // remaining consists of 0 code points
1635
+ !isWindowsDriveLetterCodePoints(c, this.input[this.pointer + 1]) || this.input.length - this.pointer - 1 >= 2 && // remaining has at least 2 code points
1636
+ !fileOtherwiseCodePoints.has(this.input[this.pointer + 2])) {
1631
1637
  this.url.host = this.base.host;
1632
1638
  this.url.path = this.base.path.slice();
1633
1639
  shortenPath(this.url);
@@ -2403,6 +2409,7 @@ var require_internal = __commonJS({
2403
2409
  "use strict";
2404
2410
  var Buffer2 = require_safer().Buffer;
2405
2411
  module2.exports = {
2412
+ // Encodings
2406
2413
  utf8: { type: "_internal", bomAware: true },
2407
2414
  cesu8: { type: "_internal", bomAware: true },
2408
2415
  unicode11utf8: "utf8",
@@ -2411,6 +2418,7 @@ var require_internal = __commonJS({
2411
2418
  binary: { type: "_internal" },
2412
2419
  base64: { type: "_internal" },
2413
2420
  hex: { type: "_internal" },
2421
+ // Codec.
2414
2422
  _internal: InternalCodec
2415
2423
  };
2416
2424
  function InternalCodec(codecOptions, iconv) {
@@ -3174,6 +3182,7 @@ var require_sbcs_data = __commonJS({
3174
3182
  "node_modules/iconv-lite/encodings/sbcs-data.js"(exports2, module2) {
3175
3183
  "use strict";
3176
3184
  module2.exports = {
3185
+ // Not supported by iconv, not sure why.
3177
3186
  "10029": "maccenteuro",
3178
3187
  "maccenteuro": {
3179
3188
  "type": "_sbcs",
@@ -3193,6 +3202,7 @@ var require_sbcs_data = __commonJS({
3193
3202
  "type": "_sbcs",
3194
3203
  "chars": "\x80\x81\xE9\xE2\x84\xE0\x86\xE7\xEA\xEB\xE8\xEF\xEE\x8D\x8E\x8F\x90\u0651\u0652\xF4\xA4\u0640\xFB\xF9\u0621\u0622\u0623\u0624\xA3\u0625\u0626\u0627\u0628\u0629\u062A\u062B\u062C\u062D\u062E\u062F\u0630\u0631\u0632\u0633\u0634\u0635\xAB\xBB\u2591\u2592\u2593\u2502\u2524\u2561\u2562\u2556\u2555\u2563\u2551\u2557\u255D\u255C\u255B\u2510\u2514\u2534\u252C\u251C\u2500\u253C\u255E\u255F\u255A\u2554\u2569\u2566\u2560\u2550\u256C\u2567\u2568\u2564\u2565\u2559\u2558\u2552\u2553\u256B\u256A\u2518\u250C\u2588\u2584\u258C\u2590\u2580\u0636\u0637\u0638\u0639\u063A\u0641\xB5\u0642\u0643\u0644\u0645\u0646\u0647\u0648\u0649\u064A\u2261\u064B\u064C\u064D\u064E\u064F\u0650\u2248\xB0\u2219\xB7\u221A\u207F\xB2\u25A0\xA0"
3195
3204
  },
3205
+ // Aliases of generated encodings.
3196
3206
  "ascii8bit": "ascii",
3197
3207
  "usascii": "ascii",
3198
3208
  "ansix34": "ascii",
@@ -5449,6 +5459,36 @@ var require_dbcs_data = __commonJS({
5449
5459
  "node_modules/iconv-lite/encodings/dbcs-data.js"(exports2, module2) {
5450
5460
  "use strict";
5451
5461
  module2.exports = {
5462
+ // == Japanese/ShiftJIS ====================================================
5463
+ // All japanese encodings are based on JIS X set of standards:
5464
+ // JIS X 0201 - Single-byte encoding of ASCII + ¥ + Kana chars at 0xA1-0xDF.
5465
+ // JIS X 0208 - Main set of 6879 characters, placed in 94x94 plane, to be encoded by 2 bytes.
5466
+ // Has several variations in 1978, 1983, 1990 and 1997.
5467
+ // JIS X 0212 - Supplementary plane of 6067 chars in 94x94 plane. 1990. Effectively dead.
5468
+ // JIS X 0213 - Extension and modern replacement of 0208 and 0212. Total chars: 11233.
5469
+ // 2 planes, first is superset of 0208, second - revised 0212.
5470
+ // Introduced in 2000, revised 2004. Some characters are in Unicode Plane 2 (0x2xxxx)
5471
+ // Byte encodings are:
5472
+ // * Shift_JIS: Compatible with 0201, uses not defined chars in top half as lead bytes for double-byte
5473
+ // encoding of 0208. Lead byte ranges: 0x81-0x9F, 0xE0-0xEF; Trail byte ranges: 0x40-0x7E, 0x80-0x9E, 0x9F-0xFC.
5474
+ // Windows CP932 is a superset of Shift_JIS. Some companies added more chars, notably KDDI.
5475
+ // * EUC-JP: Up to 3 bytes per character. Used mostly on *nixes.
5476
+ // 0x00-0x7F - lower part of 0201
5477
+ // 0x8E, 0xA1-0xDF - upper part of 0201
5478
+ // (0xA1-0xFE)x2 - 0208 plane (94x94).
5479
+ // 0x8F, (0xA1-0xFE)x2 - 0212 plane (94x94).
5480
+ // * JIS X 208: 7-bit, direct encoding of 0208. Byte ranges: 0x21-0x7E (94 values). Uncommon.
5481
+ // Used as-is in ISO2022 family.
5482
+ // * ISO2022-JP: Stateful encoding, with escape sequences to switch between ASCII,
5483
+ // 0201-1976 Roman, 0208-1978, 0208-1983.
5484
+ // * ISO2022-JP-1: Adds esc seq for 0212-1990.
5485
+ // * ISO2022-JP-2: Adds esc seq for GB2313-1980, KSX1001-1992, ISO8859-1, ISO8859-7.
5486
+ // * ISO2022-JP-3: Adds esc seq for 0201-1976 Kana set, 0213-2000 Planes 1, 2.
5487
+ // * ISO2022-JP-2004: Adds 0213-2004 Plane 1.
5488
+ //
5489
+ // After JIS X 0213 appeared, Shift_JIS-2004, EUC-JISX0213 and ISO2022-JP-2004 followed, with just changing the planes.
5490
+ //
5491
+ // Overall, it seems that it's a mess :( http://www8.plala.or.jp/tkubota1/unicode-symbols-map2.html
5452
5492
  "shiftjis": {
5453
5493
  type: "_dbcs",
5454
5494
  table: function() {
@@ -5474,12 +5514,20 @@ var require_dbcs_data = __commonJS({
5474
5514
  },
5475
5515
  encodeAdd: { "\xA5": 92, "\u203E": 126 }
5476
5516
  },
5517
+ // TODO: KDDI extension to Shift_JIS
5518
+ // TODO: IBM CCSID 942 = CP932, but F0-F9 custom chars and other char changes.
5519
+ // TODO: IBM CCSID 943 = Shift_JIS = CP932 with original Shift_JIS lower 128 chars.
5520
+ // == Chinese/GBK ==========================================================
5521
+ // http://en.wikipedia.org/wiki/GBK
5522
+ // We mostly implement W3C recommendation: https://www.w3.org/TR/encoding/#gbk-encoder
5523
+ // Oldest GB2312 (1981, ~7600 chars) is a subset of CP936
5477
5524
  "gb2312": "cp936",
5478
5525
  "gb231280": "cp936",
5479
5526
  "gb23121980": "cp936",
5480
5527
  "csgb2312": "cp936",
5481
5528
  "csiso58gb231280": "cp936",
5482
5529
  "euccn": "cp936",
5530
+ // Microsoft's CP936 is a subset and approximation of GBK.
5483
5531
  "windows936": "cp936",
5484
5532
  "ms936": "cp936",
5485
5533
  "936": "cp936",
@@ -5489,6 +5537,7 @@ var require_dbcs_data = __commonJS({
5489
5537
  return require_cp936();
5490
5538
  }
5491
5539
  },
5540
+ // GBK (~22000 chars) is an extension of CP936 that added user-mapped chars and some other.
5492
5541
  "gbk": {
5493
5542
  type: "_dbcs",
5494
5543
  table: function() {
@@ -5497,6 +5546,11 @@ var require_dbcs_data = __commonJS({
5497
5546
  },
5498
5547
  "xgbk": "gbk",
5499
5548
  "isoir58": "gbk",
5549
+ // GB18030 is an algorithmic extension of GBK.
5550
+ // Main source: https://www.w3.org/TR/encoding/#gbk-encoder
5551
+ // http://icu-project.org/docs/papers/gb18030.html
5552
+ // http://source.icu-project.org/repos/icu/data/trunk/charset/data/xml/gb-18030-2000.xml
5553
+ // http://www.khngai.com/chinese/charmap/tblgbk.php?page=0
5500
5554
  "gb18030": {
5501
5555
  type: "_dbcs",
5502
5556
  table: function() {
@@ -5509,6 +5563,8 @@ var require_dbcs_data = __commonJS({
5509
5563
  encodeAdd: { "\u20AC": 41699 }
5510
5564
  },
5511
5565
  "chinese": "gb18030",
5566
+ // == Korean ===============================================================
5567
+ // EUC-KR, KS_C_5601 and KS X 1001 are exactly the same.
5512
5568
  "windows949": "cp949",
5513
5569
  "ms949": "cp949",
5514
5570
  "949": "cp949",
@@ -5526,6 +5582,28 @@ var require_dbcs_data = __commonJS({
5526
5582
  "ksc56011987": "cp949",
5527
5583
  "ksc56011989": "cp949",
5528
5584
  "ksc5601": "cp949",
5585
+ // == Big5/Taiwan/Hong Kong ================================================
5586
+ // There are lots of tables for Big5 and cp950. Please see the following links for history:
5587
+ // http://moztw.org/docs/big5/ http://www.haible.de/bruno/charsets/conversion-tables/Big5.html
5588
+ // Variations, in roughly number of defined chars:
5589
+ // * Windows CP 950: Microsoft variant of Big5. Canonical: http://www.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WINDOWS/CP950.TXT
5590
+ // * Windows CP 951: Microsoft variant of Big5-HKSCS-2001. Seems to be never public. http://me.abelcheung.org/articles/research/what-is-cp951/
5591
+ // * Big5-2003 (Taiwan standard) almost superset of cp950.
5592
+ // * Unicode-at-on (UAO) / Mozilla 1.8. Falling out of use on the Web. Not supported by other browsers.
5593
+ // * Big5-HKSCS (-2001, -2004, -2008). Hong Kong standard.
5594
+ // many unicode code points moved from PUA to Supplementary plane (U+2XXXX) over the years.
5595
+ // Plus, it has 4 combining sequences.
5596
+ // Seems that Mozilla refused to support it for 10 yrs. https://bugzilla.mozilla.org/show_bug.cgi?id=162431 https://bugzilla.mozilla.org/show_bug.cgi?id=310299
5597
+ // because big5-hkscs is the only encoding to include astral characters in non-algorithmic way.
5598
+ // Implementations are not consistent within browsers; sometimes labeled as just big5.
5599
+ // MS Internet Explorer switches from big5 to big5-hkscs when a patch applied.
5600
+ // Great discussion & recap of what's going on https://bugzilla.mozilla.org/show_bug.cgi?id=912470#c31
5601
+ // In the encoder, it might make sense to support encoding old PUA mappings to Big5 bytes seq-s.
5602
+ // Official spec: http://www.ogcio.gov.hk/en/business/tech_promotion/ccli/terms/doc/2003cmp_2008.txt
5603
+ // http://www.ogcio.gov.hk/tc/business/tech_promotion/ccli/terms/doc/hkscs-2008-big5-iso.txt
5604
+ //
5605
+ // Current understanding of how to deal with Big5(-HKSCS) is in the Encoding Standard, http://encoding.spec.whatwg.org/#big5-encoder
5606
+ // Unicode mapping (http://www.unicode.org/Public/MAPPINGS/OBSOLETE/EASTASIA/OTHER/BIG5.TXT) is said to be wrong.
5529
5607
  "windows950": "cp950",
5530
5608
  "ms950": "cp950",
5531
5609
  "950": "cp950",
@@ -5535,6 +5613,7 @@ var require_dbcs_data = __commonJS({
5535
5613
  return require_cp950();
5536
5614
  }
5537
5615
  },
5616
+ // Big5 has many variations and is an extension of cp950. We use Encoding Standard's as a consensus.
5538
5617
  "big5": "big5hkscs",
5539
5618
  "big5hkscs": {
5540
5619
  type: "_dbcs",
@@ -5542,6 +5621,9 @@ var require_dbcs_data = __commonJS({
5542
5621
  return require_cp950().concat(require_big5_added());
5543
5622
  },
5544
5623
  encodeSkipVals: [
5624
+ // Although Encoding Standard says we should avoid encoding to HKSCS area (See Step 1 of
5625
+ // https://encoding.spec.whatwg.org/#index-big5-pointer), we still do it to increase compatibility with ICU.
5626
+ // But if a single unicode point can be encoded both as HKSCS and regular Big5, we prefer the latter.
5545
5627
  36457,
5546
5628
  36463,
5547
5629
  36478,
@@ -5603,6 +5685,7 @@ var require_dbcs_data = __commonJS({
5603
5685
  37576,
5604
5686
  38468,
5605
5687
  38637,
5688
+ // Step 2 of https://encoding.spec.whatwg.org/#index-big5-pointer: Use last pointer for U+2550, U+255E, U+2561, U+256A, U+5341, or U+5345
5606
5689
  41636,
5607
5690
  41637,
5608
5691
  41639,
@@ -6089,15 +6172,26 @@ var require_lib3 = __commonJS({
6089
6172
  get bodyUsed() {
6090
6173
  return this[INTERNALS].disturbed;
6091
6174
  },
6175
+ /**
6176
+ * Decode response as ArrayBuffer
6177
+ *
6178
+ * @return Promise
6179
+ */
6092
6180
  arrayBuffer() {
6093
6181
  return consumeBody.call(this).then(function(buf) {
6094
6182
  return buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength);
6095
6183
  });
6096
6184
  },
6185
+ /**
6186
+ * Return raw response as Blob
6187
+ *
6188
+ * @return Promise
6189
+ */
6097
6190
  blob() {
6098
6191
  let ct = this.headers && this.headers.get("content-type") || "";
6099
6192
  return consumeBody.call(this).then(function(buf) {
6100
6193
  return Object.assign(
6194
+ // Prevent copying
6101
6195
  new Blob([], {
6102
6196
  type: ct.toLowerCase()
6103
6197
  }),
@@ -6107,6 +6201,11 @@ var require_lib3 = __commonJS({
6107
6201
  );
6108
6202
  });
6109
6203
  },
6204
+ /**
6205
+ * Decode response as json
6206
+ *
6207
+ * @return Promise
6208
+ */
6110
6209
  json() {
6111
6210
  var _this2 = this;
6112
6211
  return consumeBody.call(this).then(function(buffer) {
@@ -6117,14 +6216,30 @@ var require_lib3 = __commonJS({
6117
6216
  }
6118
6217
  });
6119
6218
  },
6219
+ /**
6220
+ * Decode response as text
6221
+ *
6222
+ * @return Promise
6223
+ */
6120
6224
  text() {
6121
6225
  return consumeBody.call(this).then(function(buffer) {
6122
6226
  return buffer.toString();
6123
6227
  });
6124
6228
  },
6229
+ /**
6230
+ * Decode response as buffer (non-spec api)
6231
+ *
6232
+ * @return Promise
6233
+ */
6125
6234
  buffer() {
6126
6235
  return consumeBody.call(this);
6127
6236
  },
6237
+ /**
6238
+ * Decode response as text, while automatically detecting the encoding and
6239
+ * trying to decode to UTF-8 (non-spec api)
6240
+ *
6241
+ * @return Promise
6242
+ */
6128
6243
  textConverted() {
6129
6244
  var _this3 = this;
6130
6245
  return consumeBody.call(this).then(function(buffer) {
@@ -6308,7 +6423,8 @@ var require_lib3 = __commonJS({
6308
6423
  } else if (Buffer.isBuffer(body)) {
6309
6424
  return body.length;
6310
6425
  } else if (body && typeof body.getLengthSync === "function") {
6311
- if (body._lengthRetrievers && body._lengthRetrievers.length == 0 || body.hasKnownLength && body.hasKnownLength()) {
6426
+ if (body._lengthRetrievers && body._lengthRetrievers.length == 0 || // 1.x
6427
+ body.hasKnownLength && body.hasKnownLength()) {
6312
6428
  return body.getLengthSync();
6313
6429
  }
6314
6430
  return null;
@@ -6355,6 +6471,12 @@ var require_lib3 = __commonJS({
6355
6471
  }
6356
6472
  var MAP = Symbol("map");
6357
6473
  var Headers = class {
6474
+ /**
6475
+ * Headers class
6476
+ *
6477
+ * @param Object headers Response headers
6478
+ * @return Void
6479
+ */
6358
6480
  constructor() {
6359
6481
  let init = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : void 0;
6360
6482
  this[MAP] = /* @__PURE__ */ Object.create(null);
@@ -6399,6 +6521,12 @@ var require_lib3 = __commonJS({
6399
6521
  throw new TypeError("Provided initializer must be an object");
6400
6522
  }
6401
6523
  }
6524
+ /**
6525
+ * Return combined header value given name
6526
+ *
6527
+ * @param String name Header name
6528
+ * @return Mixed
6529
+ */
6402
6530
  get(name) {
6403
6531
  name = `${name}`;
6404
6532
  validateName(name);
@@ -6408,6 +6536,13 @@ var require_lib3 = __commonJS({
6408
6536
  }
6409
6537
  return this[MAP][key].join(", ");
6410
6538
  }
6539
+ /**
6540
+ * Iterate over all headers
6541
+ *
6542
+ * @param Function callback Executed for each item with parameters (value, name, thisArg)
6543
+ * @param Boolean thisArg `this` context for callback function
6544
+ * @return Void
6545
+ */
6411
6546
  forEach(callback) {
6412
6547
  let thisArg = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : void 0;
6413
6548
  let pairs = getHeaders(this);
@@ -6420,6 +6555,13 @@ var require_lib3 = __commonJS({
6420
6555
  i++;
6421
6556
  }
6422
6557
  }
6558
+ /**
6559
+ * Overwrite header values given name
6560
+ *
6561
+ * @param String name Header name
6562
+ * @param String value Header value
6563
+ * @return Void
6564
+ */
6423
6565
  set(name, value) {
6424
6566
  name = `${name}`;
6425
6567
  value = `${value}`;
@@ -6428,6 +6570,13 @@ var require_lib3 = __commonJS({
6428
6570
  const key = find(this[MAP], name);
6429
6571
  this[MAP][key !== void 0 ? key : name] = [value];
6430
6572
  }
6573
+ /**
6574
+ * Append a value onto existing header
6575
+ *
6576
+ * @param String name Header name
6577
+ * @param String value Header value
6578
+ * @return Void
6579
+ */
6431
6580
  append(name, value) {
6432
6581
  name = `${name}`;
6433
6582
  value = `${value}`;
@@ -6440,11 +6589,23 @@ var require_lib3 = __commonJS({
6440
6589
  this[MAP][name] = [value];
6441
6590
  }
6442
6591
  }
6592
+ /**
6593
+ * Check for header name existence
6594
+ *
6595
+ * @param String name Header name
6596
+ * @return Boolean
6597
+ */
6443
6598
  has(name) {
6444
6599
  name = `${name}`;
6445
6600
  validateName(name);
6446
6601
  return find(this[MAP], name) !== void 0;
6447
6602
  }
6603
+ /**
6604
+ * Delete all header values given name
6605
+ *
6606
+ * @param String name Header name
6607
+ * @return Void
6608
+ */
6448
6609
  delete(name) {
6449
6610
  name = `${name}`;
6450
6611
  validateName(name);
@@ -6453,15 +6614,37 @@ var require_lib3 = __commonJS({
6453
6614
  delete this[MAP][key];
6454
6615
  }
6455
6616
  }
6617
+ /**
6618
+ * Return raw headers (non-spec api)
6619
+ *
6620
+ * @return Object
6621
+ */
6456
6622
  raw() {
6457
6623
  return this[MAP];
6458
6624
  }
6625
+ /**
6626
+ * Get an iterator on keys.
6627
+ *
6628
+ * @return Iterator
6629
+ */
6459
6630
  keys() {
6460
6631
  return createHeadersIterator(this, "key");
6461
6632
  }
6633
+ /**
6634
+ * Get an iterator on values.
6635
+ *
6636
+ * @return Iterator
6637
+ */
6462
6638
  values() {
6463
6639
  return createHeadersIterator(this, "value");
6464
6640
  }
6641
+ /**
6642
+ * Get an iterator on entries.
6643
+ *
6644
+ * This is the default iterator of the Headers object.
6645
+ *
6646
+ * @return Iterator
6647
+ */
6465
6648
  [Symbol.iterator]() {
6466
6649
  return createHeadersIterator(this, "key+value");
6467
6650
  }
@@ -6593,6 +6776,9 @@ var require_lib3 = __commonJS({
6593
6776
  get status() {
6594
6777
  return this[INTERNALS$1].status;
6595
6778
  }
6779
+ /**
6780
+ * Convenience property representing if the request ended normally
6781
+ */
6596
6782
  get ok() {
6597
6783
  return this[INTERNALS$1].status >= 200 && this[INTERNALS$1].status < 300;
6598
6784
  }
@@ -6605,6 +6791,11 @@ var require_lib3 = __commonJS({
6605
6791
  get headers() {
6606
6792
  return this[INTERNALS$1].headers;
6607
6793
  }
6794
+ /**
6795
+ * Clone this response
6796
+ *
6797
+ * @return Response
6798
+ */
6608
6799
  clone() {
6609
6800
  return new Response(clone(this), {
6610
6801
  url: this.url,
@@ -6714,6 +6905,11 @@ var require_lib3 = __commonJS({
6714
6905
  get signal() {
6715
6906
  return this[INTERNALS$2].signal;
6716
6907
  }
6908
+ /**
6909
+ * Clone this request
6910
+ *
6911
+ * @return Request
6912
+ */
6717
6913
  clone() {
6718
6914
  return new Request(this);
6719
6915
  }
@@ -6796,6 +6992,11 @@ var require_lib3 = __commonJS({
6796
6992
  const dest = new URL$1(destination).hostname;
6797
6993
  return orig === dest || orig[orig.length - dest.length - 1] === "." && orig.endsWith(dest);
6798
6994
  };
6995
+ var isSameProtocol = function isSameProtocol2(destination, original) {
6996
+ const orig = new URL$1(original).protocol;
6997
+ const dest = new URL$1(destination).protocol;
6998
+ return orig === dest;
6999
+ };
6799
7000
  function fetch(url, opts) {
6800
7001
  if (!fetch.Promise) {
6801
7002
  throw new Error("native promise missing, set fetch.Promise to your favorite alternative");
@@ -6811,7 +7012,7 @@ var require_lib3 = __commonJS({
6811
7012
  let error = new AbortError("The user aborted a request.");
6812
7013
  reject(error);
6813
7014
  if (request.body && request.body instanceof Stream.Readable) {
6814
- request.body.destroy(error);
7015
+ destroyStream(request.body, error);
6815
7016
  }
6816
7017
  if (!response2 || !response2.body)
6817
7018
  return;
@@ -6846,8 +7047,29 @@ var require_lib3 = __commonJS({
6846
7047
  }
6847
7048
  req.on("error", function(err) {
6848
7049
  reject(new FetchError(`request to ${request.url} failed, reason: ${err.message}`, "system", err));
7050
+ if (response2 && response2.body) {
7051
+ destroyStream(response2.body, err);
7052
+ }
6849
7053
  finalize();
6850
7054
  });
7055
+ fixResponseChunkedTransferBadEnding(req, function(err) {
7056
+ if (signal && signal.aborted) {
7057
+ return;
7058
+ }
7059
+ destroyStream(response2.body, err);
7060
+ });
7061
+ if (parseInt(process.version.substring(1)) < 14) {
7062
+ req.on("socket", function(s) {
7063
+ s.addListener("close", function(hadError) {
7064
+ const hasDataListener = s.listenerCount("data") > 0;
7065
+ if (response2 && hasDataListener && !hadError && !(signal && signal.aborted)) {
7066
+ const err = new Error("Premature close");
7067
+ err.code = "ERR_STREAM_PREMATURE_CLOSE";
7068
+ response2.body.emit("error", err);
7069
+ }
7070
+ });
7071
+ });
7072
+ }
6851
7073
  req.on("response", function(res) {
6852
7074
  clearTimeout(reqTimeout);
6853
7075
  const headers = createHeadersLenient(res.headers);
@@ -6898,7 +7120,7 @@ var require_lib3 = __commonJS({
6898
7120
  timeout: request.timeout,
6899
7121
  size: request.size
6900
7122
  };
6901
- if (!isDomainOrSubdomain(request.url, locationURL)) {
7123
+ if (!isDomainOrSubdomain(request.url, locationURL) || !isSameProtocol(request.url, locationURL)) {
6902
7124
  for (const name of ["authorization", "www-authenticate", "cookie", "cookie2"]) {
6903
7125
  requestOpts.headers.delete(name);
6904
7126
  }
@@ -6959,6 +7181,12 @@ var require_lib3 = __commonJS({
6959
7181
  response2 = new Response(body, response_options);
6960
7182
  resolve(response2);
6961
7183
  });
7184
+ raw.on("end", function() {
7185
+ if (!response2) {
7186
+ response2 = new Response(body, response_options);
7187
+ resolve(response2);
7188
+ }
7189
+ });
6962
7190
  return;
6963
7191
  }
6964
7192
  if (codings == "br" && typeof zlib.createBrotliDecompress === "function") {
@@ -6973,6 +7201,33 @@ var require_lib3 = __commonJS({
6973
7201
  writeToStream(req, request);
6974
7202
  });
6975
7203
  }
7204
+ function fixResponseChunkedTransferBadEnding(request, errorCallback) {
7205
+ let socket;
7206
+ request.on("socket", function(s) {
7207
+ socket = s;
7208
+ });
7209
+ request.on("response", function(response2) {
7210
+ const headers = response2.headers;
7211
+ if (headers["transfer-encoding"] === "chunked" && !headers["content-length"]) {
7212
+ response2.once("close", function(hadError) {
7213
+ const hasDataListener = socket.listenerCount("data") > 0;
7214
+ if (hasDataListener && !hadError) {
7215
+ const err = new Error("Premature close");
7216
+ err.code = "ERR_STREAM_PREMATURE_CLOSE";
7217
+ errorCallback(err);
7218
+ }
7219
+ });
7220
+ }
7221
+ });
7222
+ }
7223
+ function destroyStream(stream, err) {
7224
+ if (stream.destroy) {
7225
+ stream.destroy(err);
7226
+ } else {
7227
+ stream.emit("error", err);
7228
+ stream.end();
7229
+ }
7230
+ }
6976
7231
  fetch.isRedirect = function(code) {
6977
7232
  return code === 301 || code === 302 || code === 303 || code === 307 || code === 308;
6978
7233
  };
@@ -7168,6 +7423,8 @@ var require_dist_node5 = __commonJS({
7168
7423
  headers: requestOptions.headers,
7169
7424
  redirect: requestOptions.redirect
7170
7425
  },
7426
+ // `requestOptions.request.agent` type is incompatible
7427
+ // see https://github.com/octokit/types.ts/pull/264
7171
7428
  requestOptions.request
7172
7429
  )).then(async (response2) => {
7173
7430
  url = response2.url;
@@ -7483,6 +7740,7 @@ var require_dist_node8 = __commonJS({
7483
7740
  baseUrl: request.request.endpoint.DEFAULTS.baseUrl,
7484
7741
  headers: {},
7485
7742
  request: Object.assign({}, options.request, {
7743
+ // @ts-ignore internal usage only, no need to type
7486
7744
  hook: hook.bind(null, "request")
7487
7745
  }),
7488
7746
  mediaType: {
@@ -7528,6 +7786,11 @@ var require_dist_node8 = __commonJS({
7528
7786
  const auth = authStrategy(Object.assign({
7529
7787
  request: this.request,
7530
7788
  log: this.log,
7789
+ // we pass the current octokit instance as well as its constructor options
7790
+ // to allow for authentication strategies that return a new octokit instance
7791
+ // that shares the same internal state as the current one. The original
7792
+ // requirement for this was the "event-octokit" authentication strategy
7793
+ // of https://github.com/probot/octokit-auth-probot.
7531
7794
  octokit: this,
7532
7795
  octokitOptions: otherOptions
7533
7796
  }, options.auth));
@@ -7554,6 +7817,12 @@ var require_dist_node8 = __commonJS({
7554
7817
  };
7555
7818
  return OctokitWithDefaults;
7556
7819
  }
7820
+ /**
7821
+ * Attach a plugin (or many) to your Octokit instance.
7822
+ *
7823
+ * @example
7824
+ * const API = Octokit.plugin(plugin1, plugin2, plugin3, ...)
7825
+ */
7557
7826
  static plugin(...newPlugins) {
7558
7827
  var _a;
7559
7828
  const currentPlugins = this.plugins;
@@ -9000,3 +9269,13 @@ exports.handler = async function(event) {
9000
9269
  return response(500, `<b>Error:</b> ${e}`);
9001
9270
  }
9002
9271
  };
9272
+ /*! Bundled license information:
9273
+
9274
+ is-plain-object/dist/is-plain-object.js:
9275
+ (*!
9276
+ * is-plain-object <https://github.com/jonschlinkert/is-plain-object>
9277
+ *
9278
+ * Copyright (c) 2014-2017, Jon Schlinkert.
9279
+ * Released under the MIT License.
9280
+ *)
9281
+ */