@orval/core 7.0.1 → 7.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -3229,10 +3229,10 @@ var require_lodash = __commonJS({
3229
3229
  case stringTag:
3230
3230
  return object == other + "";
3231
3231
  case mapTag:
3232
- var convert3 = mapToArray;
3232
+ var convert2 = mapToArray;
3233
3233
  case setTag:
3234
3234
  var isPartial = bitmask & COMPARE_PARTIAL_FLAG;
3235
- convert3 || (convert3 = setToArray);
3235
+ convert2 || (convert2 = setToArray);
3236
3236
  if (object.size != other.size && !isPartial) {
3237
3237
  return false;
3238
3238
  }
@@ -3242,7 +3242,7 @@ var require_lodash = __commonJS({
3242
3242
  }
3243
3243
  bitmask |= COMPARE_UNORDERED_FLAG;
3244
3244
  stack.set(object, other);
3245
- var result2 = equalArrays(convert3(object), convert3(other), bitmask, customizer, equalFunc, stack);
3245
+ var result2 = equalArrays(convert2(object), convert2(other), bitmask, customizer, equalFunc, stack);
3246
3246
  stack["delete"](object);
3247
3247
  return result2;
3248
3248
  case symbolTag:
@@ -4176,15 +4176,15 @@ var require_lodash = __commonJS({
4176
4176
  function wrapperPlant(value) {
4177
4177
  var result2, parent2 = this;
4178
4178
  while (parent2 instanceof baseLodash) {
4179
- var clone4 = wrapperClone(parent2);
4180
- clone4.__index__ = 0;
4181
- clone4.__values__ = undefined2;
4179
+ var clone3 = wrapperClone(parent2);
4180
+ clone3.__index__ = 0;
4181
+ clone3.__values__ = undefined2;
4182
4182
  if (result2) {
4183
- previous.__wrapped__ = clone4;
4183
+ previous.__wrapped__ = clone3;
4184
4184
  } else {
4185
- result2 = clone4;
4185
+ result2 = clone3;
4186
4186
  }
4187
- var previous = clone4;
4187
+ var previous = clone3;
4188
4188
  parent2 = parent2.__wrapped__;
4189
4189
  }
4190
4190
  previous.__wrapped__ = value;
@@ -4228,7 +4228,7 @@ var require_lodash = __commonJS({
4228
4228
  var func = isArray(collection) ? arrayFilter : baseFilter;
4229
4229
  return func(collection, getIteratee(predicate, 3));
4230
4230
  }
4231
- var find3 = createFind(findIndex);
4231
+ var find2 = createFind(findIndex);
4232
4232
  var findLast = createFind(findLastIndex);
4233
4233
  function flatMap(collection, iteratee2) {
4234
4234
  return baseFlatten(map2(collection, iteratee2), 1);
@@ -4619,7 +4619,7 @@ var require_lodash = __commonJS({
4619
4619
  var value = arguments[0];
4620
4620
  return isArray(value) ? value : [value];
4621
4621
  }
4622
- function clone3(value) {
4622
+ function clone2(value) {
4623
4623
  return baseClone(value, CLONE_SYMBOLS_FLAG);
4624
4624
  }
4625
4625
  function cloneWith(value, customizer) {
@@ -5751,7 +5751,7 @@ var require_lodash = __commonJS({
5751
5751
  lodash.capitalize = capitalize;
5752
5752
  lodash.ceil = ceil;
5753
5753
  lodash.clamp = clamp;
5754
- lodash.clone = clone3;
5754
+ lodash.clone = clone2;
5755
5755
  lodash.cloneDeep = cloneDeep;
5756
5756
  lodash.cloneDeepWith = cloneDeepWith;
5757
5757
  lodash.cloneWith = cloneWith;
@@ -5764,7 +5764,7 @@ var require_lodash = __commonJS({
5764
5764
  lodash.escape = escape3;
5765
5765
  lodash.escapeRegExp = escapeRegExp;
5766
5766
  lodash.every = every;
5767
- lodash.find = find3;
5767
+ lodash.find = find2;
5768
5768
  lodash.findIndex = findIndex;
5769
5769
  lodash.findKey = findKey;
5770
5770
  lodash.findLast = findLast;
@@ -16489,7 +16489,7 @@ var require_URL = __commonJS({
16489
16489
  return;
16490
16490
  }
16491
16491
  const ctorRegistry = utils.initCtorRegistry(globalObject);
16492
- class URL4 {
16492
+ class URL3 {
16493
16493
  constructor(url) {
16494
16494
  if (arguments.length < 1) {
16495
16495
  throw new globalObject.TypeError(
@@ -16755,7 +16755,7 @@ var require_URL = __commonJS({
16755
16755
  return Impl.implementation.canParse(...args);
16756
16756
  }
16757
16757
  }
16758
- Object.defineProperties(URL4.prototype, {
16758
+ Object.defineProperties(URL3.prototype, {
16759
16759
  toJSON: { enumerable: true },
16760
16760
  href: { enumerable: true },
16761
16761
  toString: { enumerable: true },
@@ -16772,18 +16772,18 @@ var require_URL = __commonJS({
16772
16772
  hash: { enumerable: true },
16773
16773
  [Symbol.toStringTag]: { value: "URL", configurable: true }
16774
16774
  });
16775
- Object.defineProperties(URL4, { canParse: { enumerable: true } });
16776
- ctorRegistry[interfaceName] = URL4;
16775
+ Object.defineProperties(URL3, { canParse: { enumerable: true } });
16776
+ ctorRegistry[interfaceName] = URL3;
16777
16777
  Object.defineProperty(globalObject, interfaceName, {
16778
16778
  configurable: true,
16779
16779
  writable: true,
16780
- value: URL4
16780
+ value: URL3
16781
16781
  });
16782
16782
  if (globalNames.includes("Window")) {
16783
16783
  Object.defineProperty(globalObject, "webkitURL", {
16784
16784
  configurable: true,
16785
16785
  writable: true,
16786
- value: URL4
16786
+ value: URL3
16787
16787
  });
16788
16788
  }
16789
16789
  };
@@ -16795,9 +16795,9 @@ var require_URL = __commonJS({
16795
16795
  var require_webidl2js_wrapper = __commonJS({
16796
16796
  "../../node_modules/whatwg-url/webidl2js-wrapper.js"(exports2) {
16797
16797
  "use strict";
16798
- var URL4 = require_URL();
16798
+ var URL3 = require_URL();
16799
16799
  var URLSearchParams = require_URLSearchParams();
16800
- exports2.URL = URL4;
16800
+ exports2.URL = URL3;
16801
16801
  exports2.URLSearchParams = URLSearchParams;
16802
16802
  }
16803
16803
  });
@@ -16806,11 +16806,11 @@ var require_webidl2js_wrapper = __commonJS({
16806
16806
  var require_whatwg_url = __commonJS({
16807
16807
  "../../node_modules/whatwg-url/index.js"(exports2) {
16808
16808
  "use strict";
16809
- var { URL: URL4, URLSearchParams } = require_webidl2js_wrapper();
16809
+ var { URL: URL3, URLSearchParams } = require_webidl2js_wrapper();
16810
16810
  var urlStateMachine = require_url_state_machine();
16811
16811
  var percentEncoding = require_percent_encoding();
16812
16812
  var sharedGlobalObject = { Array, Object, Promise, String, TypeError };
16813
- URL4.install(sharedGlobalObject, ["Window"]);
16813
+ URL3.install(sharedGlobalObject, ["Window"]);
16814
16814
  URLSearchParams.install(sharedGlobalObject, ["Window"]);
16815
16815
  exports2.URL = sharedGlobalObject.URL;
16816
16816
  exports2.URLSearchParams = sharedGlobalObject.URLSearchParams;
@@ -20471,8 +20471,8 @@ var require_encoding2 = __commonJS({
20471
20471
  "../../node_modules/encoding/lib/encoding.js"(exports2, module2) {
20472
20472
  "use strict";
20473
20473
  var iconvLite = require_lib2();
20474
- module2.exports.convert = convert3;
20475
- function convert3(str, to, from) {
20474
+ module2.exports.convert = convert2;
20475
+ function convert2(str, to, from) {
20476
20476
  from = checkEncoding(from || "UTF-8");
20477
20477
  to = checkEncoding(to || "UTF-8");
20478
20478
  str = str || "";
@@ -20514,7 +20514,7 @@ var require_encoding2 = __commonJS({
20514
20514
  }
20515
20515
  });
20516
20516
 
20517
- // ../../node_modules/@stoplight/json-ref-readers/node_modules/node-fetch/lib/index.mjs
20517
+ // ../../node_modules/node-fetch/lib/index.mjs
20518
20518
  var lib_exports = {};
20519
20519
  __export(lib_exports, {
20520
20520
  AbortError: () => AbortError,
@@ -21116,7 +21116,7 @@ function destroyStream(stream, err) {
21116
21116
  }
21117
21117
  var import_stream, import_http, import_url2, import_whatwg_url, import_https, import_zlib, Readable, BUFFER, TYPE, Blob, convert, INTERNALS, PassThrough, invalidTokenRegex, invalidHeaderCharRegex, MAP, Headers, INTERNAL, HeadersIteratorPrototype, INTERNALS$1, STATUS_CODES, Response, INTERNALS$2, URL2, parse_url, format_url, streamDestructionSupported, Request, URL$1, PassThrough$1, isDomainOrSubdomain, isSameProtocol, lib_default;
21118
21118
  var init_lib = __esm({
21119
- "../../node_modules/@stoplight/json-ref-readers/node_modules/node-fetch/lib/index.mjs"() {
21119
+ "../../node_modules/node-fetch/lib/index.mjs"() {
21120
21120
  "use strict";
21121
21121
  import_stream = __toESM(require("stream"), 1);
21122
21122
  import_http = __toESM(require("http"), 1);
@@ -27702,17 +27702,17 @@ var require_utils3 = __commonJS({
27702
27702
  "use strict";
27703
27703
  Object.defineProperty(exports2, "__esModule", { value: true });
27704
27704
  exports2.uriIsJSONPointer = exports2.uriToJSONPointer = exports2.addToJSONPointer = void 0;
27705
- var replace = (str, find3, repl) => {
27705
+ var replace = (str, find2, repl) => {
27706
27706
  const orig = str.toString();
27707
27707
  let res = "";
27708
27708
  let rem = orig;
27709
27709
  let beg = 0;
27710
- let end = rem.indexOf(find3);
27710
+ let end = rem.indexOf(find2);
27711
27711
  while (end > -1) {
27712
27712
  res += orig.substring(beg, beg + end) + repl;
27713
- rem = rem.substring(end + find3.length, rem.length);
27714
- beg += end + find3.length;
27715
- end = rem.indexOf(find3);
27713
+ rem = rem.substring(end + find2.length, rem.length);
27714
+ beg += end + find2.length;
27715
+ end = rem.indexOf(find2);
27716
27716
  }
27717
27717
  if (rem.length > 0) {
27718
27718
  res += orig.substring(orig.length - rem.length, orig.length);
@@ -28647,1243 +28647,6 @@ var require_utils4 = __commonJS({
28647
28647
  }
28648
28648
  });
28649
28649
 
28650
- // ../../node_modules/@stoplight/spectral-runtime/node_modules/node-fetch/lib/index.mjs
28651
- var lib_exports2 = {};
28652
- __export(lib_exports2, {
28653
- AbortError: () => AbortError2,
28654
- FetchError: () => FetchError2,
28655
- Headers: () => Headers2,
28656
- Request: () => Request2,
28657
- Response: () => Response2,
28658
- default: () => lib_default2
28659
- });
28660
- function FetchError2(message, type, systemError) {
28661
- Error.call(this, message);
28662
- this.message = message;
28663
- this.type = type;
28664
- if (systemError) {
28665
- this.code = this.errno = systemError.code;
28666
- }
28667
- Error.captureStackTrace(this, this.constructor);
28668
- }
28669
- function Body2(body) {
28670
- var _this = this;
28671
- var _ref = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, _ref$size = _ref.size;
28672
- let size = _ref$size === void 0 ? 0 : _ref$size;
28673
- var _ref$timeout = _ref.timeout;
28674
- let timeout = _ref$timeout === void 0 ? 0 : _ref$timeout;
28675
- if (body == null) {
28676
- body = null;
28677
- } else if (isURLSearchParams2(body)) {
28678
- body = Buffer.from(body.toString());
28679
- } else if (isBlob2(body)) ;
28680
- else if (Buffer.isBuffer(body)) ;
28681
- else if (Object.prototype.toString.call(body) === "[object ArrayBuffer]") {
28682
- body = Buffer.from(body);
28683
- } else if (ArrayBuffer.isView(body)) {
28684
- body = Buffer.from(body.buffer, body.byteOffset, body.byteLength);
28685
- } else if (body instanceof import_stream2.default) ;
28686
- else {
28687
- body = Buffer.from(String(body));
28688
- }
28689
- this[INTERNALS2] = {
28690
- body,
28691
- disturbed: false,
28692
- error: null
28693
- };
28694
- this.size = size;
28695
- this.timeout = timeout;
28696
- if (body instanceof import_stream2.default) {
28697
- body.on("error", function(err) {
28698
- const error2 = err.name === "AbortError" ? err : new FetchError2(`Invalid response body while trying to fetch ${_this.url}: ${err.message}`, "system", err);
28699
- _this[INTERNALS2].error = error2;
28700
- });
28701
- }
28702
- }
28703
- function consumeBody2() {
28704
- var _this4 = this;
28705
- if (this[INTERNALS2].disturbed) {
28706
- return Body2.Promise.reject(new TypeError(`body used already for: ${this.url}`));
28707
- }
28708
- this[INTERNALS2].disturbed = true;
28709
- if (this[INTERNALS2].error) {
28710
- return Body2.Promise.reject(this[INTERNALS2].error);
28711
- }
28712
- let body = this.body;
28713
- if (body === null) {
28714
- return Body2.Promise.resolve(Buffer.alloc(0));
28715
- }
28716
- if (isBlob2(body)) {
28717
- body = body.stream();
28718
- }
28719
- if (Buffer.isBuffer(body)) {
28720
- return Body2.Promise.resolve(body);
28721
- }
28722
- if (!(body instanceof import_stream2.default)) {
28723
- return Body2.Promise.resolve(Buffer.alloc(0));
28724
- }
28725
- let accum = [];
28726
- let accumBytes = 0;
28727
- let abort = false;
28728
- return new Body2.Promise(function(resolve3, reject) {
28729
- let resTimeout;
28730
- if (_this4.timeout) {
28731
- resTimeout = setTimeout(function() {
28732
- abort = true;
28733
- reject(new FetchError2(`Response timeout while trying to fetch ${_this4.url} (over ${_this4.timeout}ms)`, "body-timeout"));
28734
- }, _this4.timeout);
28735
- }
28736
- body.on("error", function(err) {
28737
- if (err.name === "AbortError") {
28738
- abort = true;
28739
- reject(err);
28740
- } else {
28741
- reject(new FetchError2(`Invalid response body while trying to fetch ${_this4.url}: ${err.message}`, "system", err));
28742
- }
28743
- });
28744
- body.on("data", function(chunk) {
28745
- if (abort || chunk === null) {
28746
- return;
28747
- }
28748
- if (_this4.size && accumBytes + chunk.length > _this4.size) {
28749
- abort = true;
28750
- reject(new FetchError2(`content size at ${_this4.url} over limit: ${_this4.size}`, "max-size"));
28751
- return;
28752
- }
28753
- accumBytes += chunk.length;
28754
- accum.push(chunk);
28755
- });
28756
- body.on("end", function() {
28757
- if (abort) {
28758
- return;
28759
- }
28760
- clearTimeout(resTimeout);
28761
- try {
28762
- resolve3(Buffer.concat(accum, accumBytes));
28763
- } catch (err) {
28764
- reject(new FetchError2(`Could not create Buffer from response body for ${_this4.url}: ${err.message}`, "system", err));
28765
- }
28766
- });
28767
- });
28768
- }
28769
- function convertBody2(buffer, headers) {
28770
- if (typeof convert2 !== "function") {
28771
- throw new Error("The package `encoding` must be installed to use the textConverted() function");
28772
- }
28773
- const ct = headers.get("content-type");
28774
- let charset = "utf-8";
28775
- let res, str;
28776
- if (ct) {
28777
- res = /charset=([^;]*)/i.exec(ct);
28778
- }
28779
- str = buffer.slice(0, 1024).toString();
28780
- if (!res && str) {
28781
- res = /<meta.+?charset=(['"])(.+?)\1/i.exec(str);
28782
- }
28783
- if (!res && str) {
28784
- res = /<meta[\s]+?http-equiv=(['"])content-type\1[\s]+?content=(['"])(.+?)\2/i.exec(str);
28785
- if (!res) {
28786
- res = /<meta[\s]+?content=(['"])(.+?)\1[\s]+?http-equiv=(['"])content-type\3/i.exec(str);
28787
- if (res) {
28788
- res.pop();
28789
- }
28790
- }
28791
- if (res) {
28792
- res = /charset=(.*)/i.exec(res.pop());
28793
- }
28794
- }
28795
- if (!res && str) {
28796
- res = /<\?xml.+?encoding=(['"])(.+?)\1/i.exec(str);
28797
- }
28798
- if (res) {
28799
- charset = res.pop();
28800
- if (charset === "gb2312" || charset === "gbk") {
28801
- charset = "gb18030";
28802
- }
28803
- }
28804
- return convert2(buffer, "UTF-8", charset).toString();
28805
- }
28806
- function isURLSearchParams2(obj) {
28807
- if (typeof obj !== "object" || typeof obj.append !== "function" || typeof obj.delete !== "function" || typeof obj.get !== "function" || typeof obj.getAll !== "function" || typeof obj.has !== "function" || typeof obj.set !== "function") {
28808
- return false;
28809
- }
28810
- return obj.constructor.name === "URLSearchParams" || Object.prototype.toString.call(obj) === "[object URLSearchParams]" || typeof obj.sort === "function";
28811
- }
28812
- function isBlob2(obj) {
28813
- return typeof obj === "object" && typeof obj.arrayBuffer === "function" && typeof obj.type === "string" && typeof obj.stream === "function" && typeof obj.constructor === "function" && typeof obj.constructor.name === "string" && /^(Blob|File)$/.test(obj.constructor.name) && /^(Blob|File)$/.test(obj[Symbol.toStringTag]);
28814
- }
28815
- function clone2(instance) {
28816
- let p1, p2;
28817
- let body = instance.body;
28818
- if (instance.bodyUsed) {
28819
- throw new Error("cannot clone body after it is used");
28820
- }
28821
- if (body instanceof import_stream2.default && typeof body.getBoundary !== "function") {
28822
- p1 = new PassThrough2();
28823
- p2 = new PassThrough2();
28824
- body.pipe(p1);
28825
- body.pipe(p2);
28826
- instance[INTERNALS2].body = p1;
28827
- body = p2;
28828
- }
28829
- return body;
28830
- }
28831
- function extractContentType2(body) {
28832
- if (body === null) {
28833
- return null;
28834
- } else if (typeof body === "string") {
28835
- return "text/plain;charset=UTF-8";
28836
- } else if (isURLSearchParams2(body)) {
28837
- return "application/x-www-form-urlencoded;charset=UTF-8";
28838
- } else if (isBlob2(body)) {
28839
- return body.type || null;
28840
- } else if (Buffer.isBuffer(body)) {
28841
- return null;
28842
- } else if (Object.prototype.toString.call(body) === "[object ArrayBuffer]") {
28843
- return null;
28844
- } else if (ArrayBuffer.isView(body)) {
28845
- return null;
28846
- } else if (typeof body.getBoundary === "function") {
28847
- return `multipart/form-data;boundary=${body.getBoundary()}`;
28848
- } else if (body instanceof import_stream2.default) {
28849
- return null;
28850
- } else {
28851
- return "text/plain;charset=UTF-8";
28852
- }
28853
- }
28854
- function getTotalBytes2(instance) {
28855
- const body = instance.body;
28856
- if (body === null) {
28857
- return 0;
28858
- } else if (isBlob2(body)) {
28859
- return body.size;
28860
- } else if (Buffer.isBuffer(body)) {
28861
- return body.length;
28862
- } else if (body && typeof body.getLengthSync === "function") {
28863
- if (body._lengthRetrievers && body._lengthRetrievers.length == 0 || // 1.x
28864
- body.hasKnownLength && body.hasKnownLength()) {
28865
- return body.getLengthSync();
28866
- }
28867
- return null;
28868
- } else {
28869
- return null;
28870
- }
28871
- }
28872
- function writeToStream2(dest, instance) {
28873
- const body = instance.body;
28874
- if (body === null) {
28875
- dest.end();
28876
- } else if (isBlob2(body)) {
28877
- body.stream().pipe(dest);
28878
- } else if (Buffer.isBuffer(body)) {
28879
- dest.write(body);
28880
- dest.end();
28881
- } else {
28882
- body.pipe(dest);
28883
- }
28884
- }
28885
- function validateName2(name) {
28886
- name = `${name}`;
28887
- if (invalidTokenRegex2.test(name) || name === "") {
28888
- throw new TypeError(`${name} is not a legal HTTP header name`);
28889
- }
28890
- }
28891
- function validateValue2(value) {
28892
- value = `${value}`;
28893
- if (invalidHeaderCharRegex2.test(value)) {
28894
- throw new TypeError(`${value} is not a legal HTTP header value`);
28895
- }
28896
- }
28897
- function find2(map2, name) {
28898
- name = name.toLowerCase();
28899
- for (const key in map2) {
28900
- if (key.toLowerCase() === name) {
28901
- return key;
28902
- }
28903
- }
28904
- return void 0;
28905
- }
28906
- function getHeaders2(headers) {
28907
- let kind = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "key+value";
28908
- const keys = Object.keys(headers[MAP2]).sort();
28909
- return keys.map(kind === "key" ? function(k2) {
28910
- return k2.toLowerCase();
28911
- } : kind === "value" ? function(k2) {
28912
- return headers[MAP2][k2].join(", ");
28913
- } : function(k2) {
28914
- return [k2.toLowerCase(), headers[MAP2][k2].join(", ")];
28915
- });
28916
- }
28917
- function createHeadersIterator2(target, kind) {
28918
- const iterator = Object.create(HeadersIteratorPrototype2);
28919
- iterator[INTERNAL2] = {
28920
- target,
28921
- kind,
28922
- index: 0
28923
- };
28924
- return iterator;
28925
- }
28926
- function exportNodeCompatibleHeaders2(headers) {
28927
- const obj = Object.assign({ __proto__: null }, headers[MAP2]);
28928
- const hostHeaderKey = find2(headers[MAP2], "Host");
28929
- if (hostHeaderKey !== void 0) {
28930
- obj[hostHeaderKey] = obj[hostHeaderKey][0];
28931
- }
28932
- return obj;
28933
- }
28934
- function createHeadersLenient2(obj) {
28935
- const headers = new Headers2();
28936
- for (const name of Object.keys(obj)) {
28937
- if (invalidTokenRegex2.test(name)) {
28938
- continue;
28939
- }
28940
- if (Array.isArray(obj[name])) {
28941
- for (const val of obj[name]) {
28942
- if (invalidHeaderCharRegex2.test(val)) {
28943
- continue;
28944
- }
28945
- if (headers[MAP2][name] === void 0) {
28946
- headers[MAP2][name] = [val];
28947
- } else {
28948
- headers[MAP2][name].push(val);
28949
- }
28950
- }
28951
- } else if (!invalidHeaderCharRegex2.test(obj[name])) {
28952
- headers[MAP2][name] = [obj[name]];
28953
- }
28954
- }
28955
- return headers;
28956
- }
28957
- function parseURL2(urlStr) {
28958
- if (/^[a-zA-Z][a-zA-Z\d+\-.]*:/.exec(urlStr)) {
28959
- urlStr = new URL3(urlStr).toString();
28960
- }
28961
- return parse_url2(urlStr);
28962
- }
28963
- function isRequest2(input) {
28964
- return typeof input === "object" && typeof input[INTERNALS$22] === "object";
28965
- }
28966
- function isAbortSignal2(signal) {
28967
- const proto = signal && typeof signal === "object" && Object.getPrototypeOf(signal);
28968
- return !!(proto && proto.constructor.name === "AbortSignal");
28969
- }
28970
- function getNodeRequestOptions2(request) {
28971
- const parsedURL = request[INTERNALS$22].parsedURL;
28972
- const headers = new Headers2(request[INTERNALS$22].headers);
28973
- if (!headers.has("Accept")) {
28974
- headers.set("Accept", "*/*");
28975
- }
28976
- if (!parsedURL.protocol || !parsedURL.hostname) {
28977
- throw new TypeError("Only absolute URLs are supported");
28978
- }
28979
- if (!/^https?:$/.test(parsedURL.protocol)) {
28980
- throw new TypeError("Only HTTP(S) protocols are supported");
28981
- }
28982
- if (request.signal && request.body instanceof import_stream2.default.Readable && !streamDestructionSupported2) {
28983
- throw new Error("Cancellation of streamed requests with AbortSignal is not supported in node < 8");
28984
- }
28985
- let contentLengthValue = null;
28986
- if (request.body == null && /^(POST|PUT)$/i.test(request.method)) {
28987
- contentLengthValue = "0";
28988
- }
28989
- if (request.body != null) {
28990
- const totalBytes = getTotalBytes2(request);
28991
- if (typeof totalBytes === "number") {
28992
- contentLengthValue = String(totalBytes);
28993
- }
28994
- }
28995
- if (contentLengthValue) {
28996
- headers.set("Content-Length", contentLengthValue);
28997
- }
28998
- if (!headers.has("User-Agent")) {
28999
- headers.set("User-Agent", "node-fetch/1.0 (+https://github.com/bitinn/node-fetch)");
29000
- }
29001
- if (request.compress && !headers.has("Accept-Encoding")) {
29002
- headers.set("Accept-Encoding", "gzip,deflate");
29003
- }
29004
- let agent = request.agent;
29005
- if (typeof agent === "function") {
29006
- agent = agent(parsedURL);
29007
- }
29008
- return Object.assign({}, parsedURL, {
29009
- method: request.method,
29010
- headers: exportNodeCompatibleHeaders2(headers),
29011
- agent
29012
- });
29013
- }
29014
- function AbortError2(message) {
29015
- Error.call(this, message);
29016
- this.type = "aborted";
29017
- this.message = message;
29018
- Error.captureStackTrace(this, this.constructor);
29019
- }
29020
- function fetch2(url, opts) {
29021
- if (!fetch2.Promise) {
29022
- throw new Error("native promise missing, set fetch.Promise to your favorite alternative");
29023
- }
29024
- Body2.Promise = fetch2.Promise;
29025
- return new fetch2.Promise(function(resolve3, reject) {
29026
- const request = new Request2(url, opts);
29027
- const options = getNodeRequestOptions2(request);
29028
- const send = (options.protocol === "https:" ? import_https2.default : import_http2.default).request;
29029
- const signal = request.signal;
29030
- let response = null;
29031
- const abort = function abort2() {
29032
- let error2 = new AbortError2("The user aborted a request.");
29033
- reject(error2);
29034
- if (request.body && request.body instanceof import_stream2.default.Readable) {
29035
- destroyStream2(request.body, error2);
29036
- }
29037
- if (!response || !response.body) return;
29038
- response.body.emit("error", error2);
29039
- };
29040
- if (signal && signal.aborted) {
29041
- abort();
29042
- return;
29043
- }
29044
- const abortAndFinalize = function abortAndFinalize2() {
29045
- abort();
29046
- finalize();
29047
- };
29048
- const req = send(options);
29049
- let reqTimeout;
29050
- if (signal) {
29051
- signal.addEventListener("abort", abortAndFinalize);
29052
- }
29053
- function finalize() {
29054
- req.abort();
29055
- if (signal) signal.removeEventListener("abort", abortAndFinalize);
29056
- clearTimeout(reqTimeout);
29057
- }
29058
- if (request.timeout) {
29059
- req.once("socket", function(socket) {
29060
- reqTimeout = setTimeout(function() {
29061
- reject(new FetchError2(`network timeout at: ${request.url}`, "request-timeout"));
29062
- finalize();
29063
- }, request.timeout);
29064
- });
29065
- }
29066
- req.on("error", function(err) {
29067
- reject(new FetchError2(`request to ${request.url} failed, reason: ${err.message}`, "system", err));
29068
- if (response && response.body) {
29069
- destroyStream2(response.body, err);
29070
- }
29071
- finalize();
29072
- });
29073
- fixResponseChunkedTransferBadEnding2(req, function(err) {
29074
- if (signal && signal.aborted) {
29075
- return;
29076
- }
29077
- if (response && response.body) {
29078
- destroyStream2(response.body, err);
29079
- }
29080
- });
29081
- if (parseInt(process.version.substring(1)) < 14) {
29082
- req.on("socket", function(s2) {
29083
- s2.addListener("close", function(hadError) {
29084
- const hasDataListener = s2.listenerCount("data") > 0;
29085
- if (response && hasDataListener && !hadError && !(signal && signal.aborted)) {
29086
- const err = new Error("Premature close");
29087
- err.code = "ERR_STREAM_PREMATURE_CLOSE";
29088
- response.body.emit("error", err);
29089
- }
29090
- });
29091
- });
29092
- }
29093
- req.on("response", function(res) {
29094
- clearTimeout(reqTimeout);
29095
- const headers = createHeadersLenient2(res.headers);
29096
- if (fetch2.isRedirect(res.statusCode)) {
29097
- const location2 = headers.get("Location");
29098
- let locationURL = null;
29099
- try {
29100
- locationURL = location2 === null ? null : new URL$12(location2, request.url).toString();
29101
- } catch (err) {
29102
- if (request.redirect !== "manual") {
29103
- reject(new FetchError2(`uri requested responds with an invalid redirect URL: ${location2}`, "invalid-redirect"));
29104
- finalize();
29105
- return;
29106
- }
29107
- }
29108
- switch (request.redirect) {
29109
- case "error":
29110
- reject(new FetchError2(`uri requested responds with a redirect, redirect mode is set to error: ${request.url}`, "no-redirect"));
29111
- finalize();
29112
- return;
29113
- case "manual":
29114
- if (locationURL !== null) {
29115
- try {
29116
- headers.set("Location", locationURL);
29117
- } catch (err) {
29118
- reject(err);
29119
- }
29120
- }
29121
- break;
29122
- case "follow":
29123
- if (locationURL === null) {
29124
- break;
29125
- }
29126
- if (request.counter >= request.follow) {
29127
- reject(new FetchError2(`maximum redirect reached at: ${request.url}`, "max-redirect"));
29128
- finalize();
29129
- return;
29130
- }
29131
- const requestOpts = {
29132
- headers: new Headers2(request.headers),
29133
- follow: request.follow,
29134
- counter: request.counter + 1,
29135
- agent: request.agent,
29136
- compress: request.compress,
29137
- method: request.method,
29138
- body: request.body,
29139
- signal: request.signal,
29140
- timeout: request.timeout,
29141
- size: request.size
29142
- };
29143
- if (!isDomainOrSubdomain3(request.url, locationURL) || !isSameProtocol3(request.url, locationURL)) {
29144
- for (const name of ["authorization", "www-authenticate", "cookie", "cookie2"]) {
29145
- requestOpts.headers.delete(name);
29146
- }
29147
- }
29148
- if (res.statusCode !== 303 && request.body && getTotalBytes2(request) === null) {
29149
- reject(new FetchError2("Cannot follow redirect with body being a readable stream", "unsupported-redirect"));
29150
- finalize();
29151
- return;
29152
- }
29153
- if (res.statusCode === 303 || (res.statusCode === 301 || res.statusCode === 302) && request.method === "POST") {
29154
- requestOpts.method = "GET";
29155
- requestOpts.body = void 0;
29156
- requestOpts.headers.delete("content-length");
29157
- }
29158
- resolve3(fetch2(new Request2(locationURL, requestOpts)));
29159
- finalize();
29160
- return;
29161
- }
29162
- }
29163
- res.once("end", function() {
29164
- if (signal) signal.removeEventListener("abort", abortAndFinalize);
29165
- });
29166
- let body = res.pipe(new PassThrough$12());
29167
- const response_options = {
29168
- url: request.url,
29169
- status: res.statusCode,
29170
- statusText: res.statusMessage,
29171
- headers,
29172
- size: request.size,
29173
- timeout: request.timeout,
29174
- counter: request.counter
29175
- };
29176
- const codings = headers.get("Content-Encoding");
29177
- if (!request.compress || request.method === "HEAD" || codings === null || res.statusCode === 204 || res.statusCode === 304) {
29178
- response = new Response2(body, response_options);
29179
- resolve3(response);
29180
- return;
29181
- }
29182
- const zlibOptions = {
29183
- flush: import_zlib2.default.Z_SYNC_FLUSH,
29184
- finishFlush: import_zlib2.default.Z_SYNC_FLUSH
29185
- };
29186
- if (codings == "gzip" || codings == "x-gzip") {
29187
- body = body.pipe(import_zlib2.default.createGunzip(zlibOptions));
29188
- response = new Response2(body, response_options);
29189
- resolve3(response);
29190
- return;
29191
- }
29192
- if (codings == "deflate" || codings == "x-deflate") {
29193
- const raw = res.pipe(new PassThrough$12());
29194
- raw.once("data", function(chunk) {
29195
- if ((chunk[0] & 15) === 8) {
29196
- body = body.pipe(import_zlib2.default.createInflate());
29197
- } else {
29198
- body = body.pipe(import_zlib2.default.createInflateRaw());
29199
- }
29200
- response = new Response2(body, response_options);
29201
- resolve3(response);
29202
- });
29203
- raw.on("end", function() {
29204
- if (!response) {
29205
- response = new Response2(body, response_options);
29206
- resolve3(response);
29207
- }
29208
- });
29209
- return;
29210
- }
29211
- if (codings == "br" && typeof import_zlib2.default.createBrotliDecompress === "function") {
29212
- body = body.pipe(import_zlib2.default.createBrotliDecompress());
29213
- response = new Response2(body, response_options);
29214
- resolve3(response);
29215
- return;
29216
- }
29217
- response = new Response2(body, response_options);
29218
- resolve3(response);
29219
- });
29220
- writeToStream2(req, request);
29221
- });
29222
- }
29223
- function fixResponseChunkedTransferBadEnding2(request, errorCallback) {
29224
- let socket;
29225
- request.on("socket", function(s2) {
29226
- socket = s2;
29227
- });
29228
- request.on("response", function(response) {
29229
- const headers = response.headers;
29230
- if (headers["transfer-encoding"] === "chunked" && !headers["content-length"]) {
29231
- response.once("close", function(hadError) {
29232
- const hasDataListener = socket && socket.listenerCount("data") > 0;
29233
- if (hasDataListener && !hadError) {
29234
- const err = new Error("Premature close");
29235
- err.code = "ERR_STREAM_PREMATURE_CLOSE";
29236
- errorCallback(err);
29237
- }
29238
- });
29239
- }
29240
- });
29241
- }
29242
- function destroyStream2(stream, err) {
29243
- if (stream.destroy) {
29244
- stream.destroy(err);
29245
- } else {
29246
- stream.emit("error", err);
29247
- stream.end();
29248
- }
29249
- }
29250
- var import_stream2, import_http2, import_url3, import_whatwg_url2, import_https2, import_zlib2, Readable2, BUFFER2, TYPE2, Blob2, convert2, INTERNALS2, PassThrough2, invalidTokenRegex2, invalidHeaderCharRegex2, MAP2, Headers2, INTERNAL2, HeadersIteratorPrototype2, INTERNALS$12, STATUS_CODES2, Response2, INTERNALS$22, URL3, parse_url2, format_url2, streamDestructionSupported2, Request2, URL$12, PassThrough$12, isDomainOrSubdomain3, isSameProtocol3, lib_default2;
29251
- var init_lib2 = __esm({
29252
- "../../node_modules/@stoplight/spectral-runtime/node_modules/node-fetch/lib/index.mjs"() {
29253
- "use strict";
29254
- import_stream2 = __toESM(require("stream"), 1);
29255
- import_http2 = __toESM(require("http"), 1);
29256
- import_url3 = __toESM(require("url"), 1);
29257
- import_whatwg_url2 = __toESM(require_whatwg_url(), 1);
29258
- import_https2 = __toESM(require("https"), 1);
29259
- import_zlib2 = __toESM(require("zlib"), 1);
29260
- Readable2 = import_stream2.default.Readable;
29261
- BUFFER2 = Symbol("buffer");
29262
- TYPE2 = Symbol("type");
29263
- Blob2 = class _Blob {
29264
- constructor() {
29265
- this[TYPE2] = "";
29266
- const blobParts = arguments[0];
29267
- const options = arguments[1];
29268
- const buffers = [];
29269
- let size = 0;
29270
- if (blobParts) {
29271
- const a3 = blobParts;
29272
- const length = Number(a3.length);
29273
- for (let i3 = 0; i3 < length; i3++) {
29274
- const element = a3[i3];
29275
- let buffer;
29276
- if (element instanceof Buffer) {
29277
- buffer = element;
29278
- } else if (ArrayBuffer.isView(element)) {
29279
- buffer = Buffer.from(element.buffer, element.byteOffset, element.byteLength);
29280
- } else if (element instanceof ArrayBuffer) {
29281
- buffer = Buffer.from(element);
29282
- } else if (element instanceof _Blob) {
29283
- buffer = element[BUFFER2];
29284
- } else {
29285
- buffer = Buffer.from(typeof element === "string" ? element : String(element));
29286
- }
29287
- size += buffer.length;
29288
- buffers.push(buffer);
29289
- }
29290
- }
29291
- this[BUFFER2] = Buffer.concat(buffers);
29292
- let type = options && options.type !== void 0 && String(options.type).toLowerCase();
29293
- if (type && !/[^\u0020-\u007E]/.test(type)) {
29294
- this[TYPE2] = type;
29295
- }
29296
- }
29297
- get size() {
29298
- return this[BUFFER2].length;
29299
- }
29300
- get type() {
29301
- return this[TYPE2];
29302
- }
29303
- text() {
29304
- return Promise.resolve(this[BUFFER2].toString());
29305
- }
29306
- arrayBuffer() {
29307
- const buf = this[BUFFER2];
29308
- const ab = buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength);
29309
- return Promise.resolve(ab);
29310
- }
29311
- stream() {
29312
- const readable = new Readable2();
29313
- readable._read = function() {
29314
- };
29315
- readable.push(this[BUFFER2]);
29316
- readable.push(null);
29317
- return readable;
29318
- }
29319
- toString() {
29320
- return "[object Blob]";
29321
- }
29322
- slice() {
29323
- const size = this.size;
29324
- const start = arguments[0];
29325
- const end = arguments[1];
29326
- let relativeStart, relativeEnd;
29327
- if (start === void 0) {
29328
- relativeStart = 0;
29329
- } else if (start < 0) {
29330
- relativeStart = Math.max(size + start, 0);
29331
- } else {
29332
- relativeStart = Math.min(start, size);
29333
- }
29334
- if (end === void 0) {
29335
- relativeEnd = size;
29336
- } else if (end < 0) {
29337
- relativeEnd = Math.max(size + end, 0);
29338
- } else {
29339
- relativeEnd = Math.min(end, size);
29340
- }
29341
- const span = Math.max(relativeEnd - relativeStart, 0);
29342
- const buffer = this[BUFFER2];
29343
- const slicedBuffer = buffer.slice(relativeStart, relativeStart + span);
29344
- const blob = new _Blob([], { type: arguments[2] });
29345
- blob[BUFFER2] = slicedBuffer;
29346
- return blob;
29347
- }
29348
- };
29349
- Object.defineProperties(Blob2.prototype, {
29350
- size: { enumerable: true },
29351
- type: { enumerable: true },
29352
- slice: { enumerable: true }
29353
- });
29354
- Object.defineProperty(Blob2.prototype, Symbol.toStringTag, {
29355
- value: "Blob",
29356
- writable: false,
29357
- enumerable: false,
29358
- configurable: true
29359
- });
29360
- FetchError2.prototype = Object.create(Error.prototype);
29361
- FetchError2.prototype.constructor = FetchError2;
29362
- FetchError2.prototype.name = "FetchError";
29363
- try {
29364
- convert2 = require_encoding2().convert;
29365
- } catch (e3) {
29366
- }
29367
- INTERNALS2 = Symbol("Body internals");
29368
- PassThrough2 = import_stream2.default.PassThrough;
29369
- Body2.prototype = {
29370
- get body() {
29371
- return this[INTERNALS2].body;
29372
- },
29373
- get bodyUsed() {
29374
- return this[INTERNALS2].disturbed;
29375
- },
29376
- /**
29377
- * Decode response as ArrayBuffer
29378
- *
29379
- * @return Promise
29380
- */
29381
- arrayBuffer() {
29382
- return consumeBody2.call(this).then(function(buf) {
29383
- return buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength);
29384
- });
29385
- },
29386
- /**
29387
- * Return raw response as Blob
29388
- *
29389
- * @return Promise
29390
- */
29391
- blob() {
29392
- let ct = this.headers && this.headers.get("content-type") || "";
29393
- return consumeBody2.call(this).then(function(buf) {
29394
- return Object.assign(
29395
- // Prevent copying
29396
- new Blob2([], {
29397
- type: ct.toLowerCase()
29398
- }),
29399
- {
29400
- [BUFFER2]: buf
29401
- }
29402
- );
29403
- });
29404
- },
29405
- /**
29406
- * Decode response as json
29407
- *
29408
- * @return Promise
29409
- */
29410
- json() {
29411
- var _this2 = this;
29412
- return consumeBody2.call(this).then(function(buffer) {
29413
- try {
29414
- return JSON.parse(buffer.toString());
29415
- } catch (err) {
29416
- return Body2.Promise.reject(new FetchError2(`invalid json response body at ${_this2.url} reason: ${err.message}`, "invalid-json"));
29417
- }
29418
- });
29419
- },
29420
- /**
29421
- * Decode response as text
29422
- *
29423
- * @return Promise
29424
- */
29425
- text() {
29426
- return consumeBody2.call(this).then(function(buffer) {
29427
- return buffer.toString();
29428
- });
29429
- },
29430
- /**
29431
- * Decode response as buffer (non-spec api)
29432
- *
29433
- * @return Promise
29434
- */
29435
- buffer() {
29436
- return consumeBody2.call(this);
29437
- },
29438
- /**
29439
- * Decode response as text, while automatically detecting the encoding and
29440
- * trying to decode to UTF-8 (non-spec api)
29441
- *
29442
- * @return Promise
29443
- */
29444
- textConverted() {
29445
- var _this3 = this;
29446
- return consumeBody2.call(this).then(function(buffer) {
29447
- return convertBody2(buffer, _this3.headers);
29448
- });
29449
- }
29450
- };
29451
- Object.defineProperties(Body2.prototype, {
29452
- body: { enumerable: true },
29453
- bodyUsed: { enumerable: true },
29454
- arrayBuffer: { enumerable: true },
29455
- blob: { enumerable: true },
29456
- json: { enumerable: true },
29457
- text: { enumerable: true }
29458
- });
29459
- Body2.mixIn = function(proto) {
29460
- for (const name of Object.getOwnPropertyNames(Body2.prototype)) {
29461
- if (!(name in proto)) {
29462
- const desc = Object.getOwnPropertyDescriptor(Body2.prototype, name);
29463
- Object.defineProperty(proto, name, desc);
29464
- }
29465
- }
29466
- };
29467
- Body2.Promise = global.Promise;
29468
- invalidTokenRegex2 = /[^\^_`a-zA-Z\-0-9!#$%&'*+.|~]/;
29469
- invalidHeaderCharRegex2 = /[^\t\x20-\x7e\x80-\xff]/;
29470
- MAP2 = Symbol("map");
29471
- Headers2 = class _Headers {
29472
- /**
29473
- * Headers class
29474
- *
29475
- * @param Object headers Response headers
29476
- * @return Void
29477
- */
29478
- constructor() {
29479
- let init = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : void 0;
29480
- this[MAP2] = /* @__PURE__ */ Object.create(null);
29481
- if (init instanceof _Headers) {
29482
- const rawHeaders = init.raw();
29483
- const headerNames = Object.keys(rawHeaders);
29484
- for (const headerName of headerNames) {
29485
- for (const value of rawHeaders[headerName]) {
29486
- this.append(headerName, value);
29487
- }
29488
- }
29489
- return;
29490
- }
29491
- if (init == null) ;
29492
- else if (typeof init === "object") {
29493
- const method = init[Symbol.iterator];
29494
- if (method != null) {
29495
- if (typeof method !== "function") {
29496
- throw new TypeError("Header pairs must be iterable");
29497
- }
29498
- const pairs = [];
29499
- for (const pair of init) {
29500
- if (typeof pair !== "object" || typeof pair[Symbol.iterator] !== "function") {
29501
- throw new TypeError("Each header pair must be iterable");
29502
- }
29503
- pairs.push(Array.from(pair));
29504
- }
29505
- for (const pair of pairs) {
29506
- if (pair.length !== 2) {
29507
- throw new TypeError("Each header pair must be a name/value tuple");
29508
- }
29509
- this.append(pair[0], pair[1]);
29510
- }
29511
- } else {
29512
- for (const key of Object.keys(init)) {
29513
- const value = init[key];
29514
- this.append(key, value);
29515
- }
29516
- }
29517
- } else {
29518
- throw new TypeError("Provided initializer must be an object");
29519
- }
29520
- }
29521
- /**
29522
- * Return combined header value given name
29523
- *
29524
- * @param String name Header name
29525
- * @return Mixed
29526
- */
29527
- get(name) {
29528
- name = `${name}`;
29529
- validateName2(name);
29530
- const key = find2(this[MAP2], name);
29531
- if (key === void 0) {
29532
- return null;
29533
- }
29534
- return this[MAP2][key].join(", ");
29535
- }
29536
- /**
29537
- * Iterate over all headers
29538
- *
29539
- * @param Function callback Executed for each item with parameters (value, name, thisArg)
29540
- * @param Boolean thisArg `this` context for callback function
29541
- * @return Void
29542
- */
29543
- forEach(callback) {
29544
- let thisArg = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : void 0;
29545
- let pairs = getHeaders2(this);
29546
- let i3 = 0;
29547
- while (i3 < pairs.length) {
29548
- var _pairs$i = pairs[i3];
29549
- const name = _pairs$i[0], value = _pairs$i[1];
29550
- callback.call(thisArg, value, name, this);
29551
- pairs = getHeaders2(this);
29552
- i3++;
29553
- }
29554
- }
29555
- /**
29556
- * Overwrite header values given name
29557
- *
29558
- * @param String name Header name
29559
- * @param String value Header value
29560
- * @return Void
29561
- */
29562
- set(name, value) {
29563
- name = `${name}`;
29564
- value = `${value}`;
29565
- validateName2(name);
29566
- validateValue2(value);
29567
- const key = find2(this[MAP2], name);
29568
- this[MAP2][key !== void 0 ? key : name] = [value];
29569
- }
29570
- /**
29571
- * Append a value onto existing header
29572
- *
29573
- * @param String name Header name
29574
- * @param String value Header value
29575
- * @return Void
29576
- */
29577
- append(name, value) {
29578
- name = `${name}`;
29579
- value = `${value}`;
29580
- validateName2(name);
29581
- validateValue2(value);
29582
- const key = find2(this[MAP2], name);
29583
- if (key !== void 0) {
29584
- this[MAP2][key].push(value);
29585
- } else {
29586
- this[MAP2][name] = [value];
29587
- }
29588
- }
29589
- /**
29590
- * Check for header name existence
29591
- *
29592
- * @param String name Header name
29593
- * @return Boolean
29594
- */
29595
- has(name) {
29596
- name = `${name}`;
29597
- validateName2(name);
29598
- return find2(this[MAP2], name) !== void 0;
29599
- }
29600
- /**
29601
- * Delete all header values given name
29602
- *
29603
- * @param String name Header name
29604
- * @return Void
29605
- */
29606
- delete(name) {
29607
- name = `${name}`;
29608
- validateName2(name);
29609
- const key = find2(this[MAP2], name);
29610
- if (key !== void 0) {
29611
- delete this[MAP2][key];
29612
- }
29613
- }
29614
- /**
29615
- * Return raw headers (non-spec api)
29616
- *
29617
- * @return Object
29618
- */
29619
- raw() {
29620
- return this[MAP2];
29621
- }
29622
- /**
29623
- * Get an iterator on keys.
29624
- *
29625
- * @return Iterator
29626
- */
29627
- keys() {
29628
- return createHeadersIterator2(this, "key");
29629
- }
29630
- /**
29631
- * Get an iterator on values.
29632
- *
29633
- * @return Iterator
29634
- */
29635
- values() {
29636
- return createHeadersIterator2(this, "value");
29637
- }
29638
- /**
29639
- * Get an iterator on entries.
29640
- *
29641
- * This is the default iterator of the Headers object.
29642
- *
29643
- * @return Iterator
29644
- */
29645
- [Symbol.iterator]() {
29646
- return createHeadersIterator2(this, "key+value");
29647
- }
29648
- };
29649
- Headers2.prototype.entries = Headers2.prototype[Symbol.iterator];
29650
- Object.defineProperty(Headers2.prototype, Symbol.toStringTag, {
29651
- value: "Headers",
29652
- writable: false,
29653
- enumerable: false,
29654
- configurable: true
29655
- });
29656
- Object.defineProperties(Headers2.prototype, {
29657
- get: { enumerable: true },
29658
- forEach: { enumerable: true },
29659
- set: { enumerable: true },
29660
- append: { enumerable: true },
29661
- has: { enumerable: true },
29662
- delete: { enumerable: true },
29663
- keys: { enumerable: true },
29664
- values: { enumerable: true },
29665
- entries: { enumerable: true }
29666
- });
29667
- INTERNAL2 = Symbol("internal");
29668
- HeadersIteratorPrototype2 = Object.setPrototypeOf({
29669
- next() {
29670
- if (!this || Object.getPrototypeOf(this) !== HeadersIteratorPrototype2) {
29671
- throw new TypeError("Value of `this` is not a HeadersIterator");
29672
- }
29673
- var _INTERNAL = this[INTERNAL2];
29674
- const target = _INTERNAL.target, kind = _INTERNAL.kind, index3 = _INTERNAL.index;
29675
- const values = getHeaders2(target, kind);
29676
- const len = values.length;
29677
- if (index3 >= len) {
29678
- return {
29679
- value: void 0,
29680
- done: true
29681
- };
29682
- }
29683
- this[INTERNAL2].index = index3 + 1;
29684
- return {
29685
- value: values[index3],
29686
- done: false
29687
- };
29688
- }
29689
- }, Object.getPrototypeOf(Object.getPrototypeOf([][Symbol.iterator]())));
29690
- Object.defineProperty(HeadersIteratorPrototype2, Symbol.toStringTag, {
29691
- value: "HeadersIterator",
29692
- writable: false,
29693
- enumerable: false,
29694
- configurable: true
29695
- });
29696
- INTERNALS$12 = Symbol("Response internals");
29697
- STATUS_CODES2 = import_http2.default.STATUS_CODES;
29698
- Response2 = class _Response {
29699
- constructor() {
29700
- let body = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : null;
29701
- let opts = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
29702
- Body2.call(this, body, opts);
29703
- const status = opts.status || 200;
29704
- const headers = new Headers2(opts.headers);
29705
- if (body != null && !headers.has("Content-Type")) {
29706
- const contentType = extractContentType2(body);
29707
- if (contentType) {
29708
- headers.append("Content-Type", contentType);
29709
- }
29710
- }
29711
- this[INTERNALS$12] = {
29712
- url: opts.url,
29713
- status,
29714
- statusText: opts.statusText || STATUS_CODES2[status],
29715
- headers,
29716
- counter: opts.counter
29717
- };
29718
- }
29719
- get url() {
29720
- return this[INTERNALS$12].url || "";
29721
- }
29722
- get status() {
29723
- return this[INTERNALS$12].status;
29724
- }
29725
- /**
29726
- * Convenience property representing if the request ended normally
29727
- */
29728
- get ok() {
29729
- return this[INTERNALS$12].status >= 200 && this[INTERNALS$12].status < 300;
29730
- }
29731
- get redirected() {
29732
- return this[INTERNALS$12].counter > 0;
29733
- }
29734
- get statusText() {
29735
- return this[INTERNALS$12].statusText;
29736
- }
29737
- get headers() {
29738
- return this[INTERNALS$12].headers;
29739
- }
29740
- /**
29741
- * Clone this response
29742
- *
29743
- * @return Response
29744
- */
29745
- clone() {
29746
- return new _Response(clone2(this), {
29747
- url: this.url,
29748
- status: this.status,
29749
- statusText: this.statusText,
29750
- headers: this.headers,
29751
- ok: this.ok,
29752
- redirected: this.redirected
29753
- });
29754
- }
29755
- };
29756
- Body2.mixIn(Response2.prototype);
29757
- Object.defineProperties(Response2.prototype, {
29758
- url: { enumerable: true },
29759
- status: { enumerable: true },
29760
- ok: { enumerable: true },
29761
- redirected: { enumerable: true },
29762
- statusText: { enumerable: true },
29763
- headers: { enumerable: true },
29764
- clone: { enumerable: true }
29765
- });
29766
- Object.defineProperty(Response2.prototype, Symbol.toStringTag, {
29767
- value: "Response",
29768
- writable: false,
29769
- enumerable: false,
29770
- configurable: true
29771
- });
29772
- INTERNALS$22 = Symbol("Request internals");
29773
- URL3 = import_url3.default.URL || import_whatwg_url2.default.URL;
29774
- parse_url2 = import_url3.default.parse;
29775
- format_url2 = import_url3.default.format;
29776
- streamDestructionSupported2 = "destroy" in import_stream2.default.Readable.prototype;
29777
- Request2 = class _Request {
29778
- constructor(input) {
29779
- let init = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
29780
- let parsedURL;
29781
- if (!isRequest2(input)) {
29782
- if (input && input.href) {
29783
- parsedURL = parseURL2(input.href);
29784
- } else {
29785
- parsedURL = parseURL2(`${input}`);
29786
- }
29787
- input = {};
29788
- } else {
29789
- parsedURL = parseURL2(input.url);
29790
- }
29791
- let method = init.method || input.method || "GET";
29792
- method = method.toUpperCase();
29793
- if ((init.body != null || isRequest2(input) && input.body !== null) && (method === "GET" || method === "HEAD")) {
29794
- throw new TypeError("Request with GET/HEAD method cannot have body");
29795
- }
29796
- let inputBody = init.body != null ? init.body : isRequest2(input) && input.body !== null ? clone2(input) : null;
29797
- Body2.call(this, inputBody, {
29798
- timeout: init.timeout || input.timeout || 0,
29799
- size: init.size || input.size || 0
29800
- });
29801
- const headers = new Headers2(init.headers || input.headers || {});
29802
- if (inputBody != null && !headers.has("Content-Type")) {
29803
- const contentType = extractContentType2(inputBody);
29804
- if (contentType) {
29805
- headers.append("Content-Type", contentType);
29806
- }
29807
- }
29808
- let signal = isRequest2(input) ? input.signal : null;
29809
- if ("signal" in init) signal = init.signal;
29810
- if (signal != null && !isAbortSignal2(signal)) {
29811
- throw new TypeError("Expected signal to be an instanceof AbortSignal");
29812
- }
29813
- this[INTERNALS$22] = {
29814
- method,
29815
- redirect: init.redirect || input.redirect || "follow",
29816
- headers,
29817
- parsedURL,
29818
- signal
29819
- };
29820
- this.follow = init.follow !== void 0 ? init.follow : input.follow !== void 0 ? input.follow : 20;
29821
- this.compress = init.compress !== void 0 ? init.compress : input.compress !== void 0 ? input.compress : true;
29822
- this.counter = init.counter || input.counter || 0;
29823
- this.agent = init.agent || input.agent;
29824
- }
29825
- get method() {
29826
- return this[INTERNALS$22].method;
29827
- }
29828
- get url() {
29829
- return format_url2(this[INTERNALS$22].parsedURL);
29830
- }
29831
- get headers() {
29832
- return this[INTERNALS$22].headers;
29833
- }
29834
- get redirect() {
29835
- return this[INTERNALS$22].redirect;
29836
- }
29837
- get signal() {
29838
- return this[INTERNALS$22].signal;
29839
- }
29840
- /**
29841
- * Clone this request
29842
- *
29843
- * @return Request
29844
- */
29845
- clone() {
29846
- return new _Request(this);
29847
- }
29848
- };
29849
- Body2.mixIn(Request2.prototype);
29850
- Object.defineProperty(Request2.prototype, Symbol.toStringTag, {
29851
- value: "Request",
29852
- writable: false,
29853
- enumerable: false,
29854
- configurable: true
29855
- });
29856
- Object.defineProperties(Request2.prototype, {
29857
- method: { enumerable: true },
29858
- url: { enumerable: true },
29859
- headers: { enumerable: true },
29860
- redirect: { enumerable: true },
29861
- clone: { enumerable: true },
29862
- signal: { enumerable: true }
29863
- });
29864
- AbortError2.prototype = Object.create(Error.prototype);
29865
- AbortError2.prototype.constructor = AbortError2;
29866
- AbortError2.prototype.name = "AbortError";
29867
- URL$12 = import_url3.default.URL || import_whatwg_url2.default.URL;
29868
- PassThrough$12 = import_stream2.default.PassThrough;
29869
- isDomainOrSubdomain3 = function isDomainOrSubdomain4(destination, original) {
29870
- const orig = new URL$12(original).hostname;
29871
- const dest = new URL$12(destination).hostname;
29872
- return orig === dest || orig[orig.length - dest.length - 1] === "." && orig.endsWith(dest);
29873
- };
29874
- isSameProtocol3 = function isSameProtocol4(destination, original) {
29875
- const orig = new URL$12(original).protocol;
29876
- const dest = new URL$12(destination).protocol;
29877
- return orig === dest;
29878
- };
29879
- fetch2.isRedirect = function(code) {
29880
- return code === 301 || code === 302 || code === 303 || code === 307 || code === 308;
29881
- };
29882
- fetch2.Promise = global.Promise;
29883
- lib_default2 = fetch2;
29884
- }
29885
- });
29886
-
29887
28650
  // ../../node_modules/@stoplight/spectral-runtime/dist/fetch.js
29888
28651
  var require_fetch = __commonJS({
29889
28652
  "../../node_modules/@stoplight/spectral-runtime/dist/fetch.js"(exports2) {
@@ -29891,7 +28654,7 @@ var require_fetch = __commonJS({
29891
28654
  Object.defineProperty(exports2, "__esModule", { value: true });
29892
28655
  exports2.DEFAULT_REQUEST_OPTIONS = void 0;
29893
28656
  var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports));
29894
- var node_fetch_1 = (0, tslib_1.__importDefault)((init_lib2(), __toCommonJS(lib_exports2)));
28657
+ var node_fetch_1 = (0, tslib_1.__importDefault)((init_lib(), __toCommonJS(lib_exports)));
29895
28658
  exports2.DEFAULT_REQUEST_OPTIONS = {};
29896
28659
  exports2.default = async (uri, opts = {}) => {
29897
28660
  return (0, node_fetch_1.default)(uri, { ...opts, ...exports2.DEFAULT_REQUEST_OPTIONS });
@@ -35204,7 +33967,7 @@ var require_astring = __commonJS({
35204
33967
  }
35205
33968
  }, {
35206
33969
  key: "writeToStream",
35207
- value: function writeToStream3(code) {
33970
+ value: function writeToStream2(code) {
35208
33971
  this.output.write(code);
35209
33972
  }
35210
33973
  }, {
@@ -46806,14 +45569,14 @@ var ibmOpenapiValidatorWarnings = (warnings) => {
46806
45569
  log(import_chalk.default.yellow("(!) Warnings"));
46807
45570
  warnings.forEach(
46808
45571
  (i3) => log(import_chalk.default.yellow(`Message : ${i3.message}
46809
- Path : ${i3.path}`))
45572
+ Path : ${i3.path.join(", ")}`))
46810
45573
  );
46811
45574
  };
46812
45575
  var ibmOpenapiValidatorErrors = (errors2) => {
46813
45576
  log(import_chalk.default.red("(!) Errors"));
46814
45577
  errors2.forEach(
46815
45578
  (i3) => log(import_chalk.default.red(`Message : ${i3.message}
46816
- Path : ${i3.path}`))
45579
+ Path : ${i3.path.join(", ")}`))
46817
45580
  );
46818
45581
  };
46819
45582
  var LogLevels = {
@@ -47057,10 +45820,10 @@ async function bundleFile(fileName, mjs = false, workspace, alias, compilerOptio
47057
45820
  (key) => id.startsWith(key) || import_micromatch.default.isMatch(id, matchKeys)
47058
45821
  );
47059
45822
  if (match) {
47060
- const find3 = import_micromatch.default.scan(match);
45823
+ const find2 = import_micromatch.default.scan(match);
47061
45824
  const replacement2 = import_micromatch.default.scan(alias[match]);
47062
45825
  const base2 = (0, import_path.resolve)(workspace, replacement2.base);
47063
- const newPath = find3.base ? id.replace(find3.base, base2) : joinSafe(base2, id);
45826
+ const newPath = find2.base ? id.replace(find2.base, base2) : joinSafe(base2, id);
47064
45827
  const ext = (0, import_path.extname)(newPath);
47065
45828
  const aliased = ext ? newPath : `${newPath}.ts`;
47066
45829
  if (!import_fs.default.existsSync(aliased)) {
@@ -47077,12 +45840,12 @@ async function bundleFile(fileName, mjs = false, workspace, alias, compilerOptio
47077
45840
  (key) => id.startsWith(key) || import_micromatch.default.isMatch(id, matchKeys)
47078
45841
  );
47079
45842
  if (match) {
47080
- const find3 = import_micromatch.default.scan(match);
45843
+ const find2 = import_micromatch.default.scan(match);
47081
45844
  const replacement2 = import_micromatch.default.scan(
47082
45845
  compilerOptions?.paths[match][0]
47083
45846
  );
47084
45847
  const base2 = (0, import_path.resolve)(workspace, replacement2.base);
47085
- const newPath = find3.base ? id.replace(find3.base, base2) : joinSafe(base2, id);
45848
+ const newPath = find2.base ? id.replace(find2.base, base2) : joinSafe(base2, id);
47086
45849
  const ext = (0, import_path.extname)(newPath);
47087
45850
  const aliased = ext ? newPath : `${newPath}.ts`;
47088
45851
  if (!import_fs.default.existsSync(aliased)) {
@@ -47761,12 +46524,26 @@ var { Spectral } = require_dist10();
47761
46524
  var ibmOpenapiValidator = async (specs) => {
47762
46525
  const spectral = new Spectral();
47763
46526
  spectral.setRuleset(ibmOpenapiRuleset);
47764
- const { errors: errors2, warnings } = await spectral.run(specs);
47765
- if (warnings && warnings.length) {
46527
+ const results = await spectral.run(specs);
46528
+ const errors2 = [];
46529
+ const warnings = [];
46530
+ for (const { severity, message, path: path2 } of results) {
46531
+ const entry = { message, path: path2 };
46532
+ switch (severity) {
46533
+ case 0:
46534
+ errors2.push(entry);
46535
+ break;
46536
+ case 1:
46537
+ warnings.push(entry);
46538
+ break;
46539
+ }
46540
+ }
46541
+ if (warnings.length) {
47766
46542
  ibmOpenapiValidatorWarnings(warnings);
47767
46543
  }
47768
- if (errors2 && errors2.length) {
46544
+ if (errors2.length) {
47769
46545
  ibmOpenapiValidatorErrors(errors2);
46546
+ process.exit(1);
47770
46547
  }
47771
46548
  };
47772
46549