swagger-client 3.29.2 → 3.29.4

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.
@@ -41,10 +41,11 @@ __webpack_require__.r(__webpack_exports__);
41
41
  /* harmony export */ self: () => (/* binding */ self)
42
42
  /* harmony export */ });
43
43
  /* harmony import */ var cookie__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(57427);
44
+ /* harmony import */ var ramda__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(43628);
44
45
  /* harmony import */ var ramda_adjunct__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(24955);
45
46
  /* harmony import */ var openapi_server_url_templating__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(29646);
46
47
  /* harmony import */ var _swagger_api_apidom_error__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(19500);
47
- /* harmony import */ var _swagger_api_apidom_reference_configuration_empty__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(83748);
48
+ /* harmony import */ var _swagger_api_apidom_reference_configuration_empty__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(83748);
48
49
  /* harmony import */ var _constants_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(3832);
49
50
  /* harmony import */ var _http_index_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(51670);
50
51
  /* harmony import */ var _http_serializers_request_index_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(29382);
@@ -69,6 +70,7 @@ __webpack_require__.r(__webpack_exports__);
69
70
 
70
71
 
71
72
 
73
+
72
74
  const arrayOrEmpty = ar => Array.isArray(ar) ? ar : [];
73
75
 
74
76
  /**
@@ -173,7 +175,8 @@ function buildRequest(options) {
173
175
  server,
174
176
  serverVariables,
175
177
  http,
176
- signal
178
+ signal,
179
+ serverVariableEncoder
177
180
  } = options;
178
181
  let {
179
182
  parameters,
@@ -227,7 +230,8 @@ function buildRequest(options) {
227
230
  server,
228
231
  serverVariables,
229
232
  pathName,
230
- method
233
+ method,
234
+ serverVariableEncoder
231
235
  });
232
236
  req.url += baseURL;
233
237
 
@@ -346,7 +350,8 @@ function oas3BaseUrl({
346
350
  method,
347
351
  server,
348
352
  contextUrl,
349
- serverVariables = {}
353
+ serverVariables = {},
354
+ serverVariableEncoder
350
355
  }) {
351
356
  let servers = [];
352
357
  let selectedServerUrl = '';
@@ -383,13 +388,15 @@ function oas3BaseUrl({
383
388
  selectedServerUrl = (0,openapi_server_url_templating__WEBPACK_IMPORTED_MODULE_1__.substitute)(selectedServerUrl, {
384
389
  ...selectedServerVariables,
385
390
  ...serverVariables
391
+ }, {
392
+ encoder: typeof serverVariableEncoder === 'function' ? serverVariableEncoder : ramda__WEBPACK_IMPORTED_MODULE_14__["default"]
386
393
  });
387
394
  }
388
395
  return buildOas3UrlWithContext(selectedServerUrl, contextUrl);
389
396
  }
390
397
  function buildOas3UrlWithContext(ourUrl = '', contextUrl = '') {
391
398
  // relative server url should be resolved against contextUrl
392
- const parsedUrl = ourUrl && contextUrl ? parseURIReference(_swagger_api_apidom_reference_configuration_empty__WEBPACK_IMPORTED_MODULE_14__.resolve(contextUrl, ourUrl)) : parseURIReference(ourUrl);
399
+ const parsedUrl = ourUrl && contextUrl ? parseURIReference(_swagger_api_apidom_reference_configuration_empty__WEBPACK_IMPORTED_MODULE_15__.resolve(contextUrl, ourUrl)) : parseURIReference(ourUrl);
393
400
  const parsedContextUrl = parseURIReference(contextUrl);
394
401
  const computedScheme = stripNonAlpha(parsedUrl.protocol) || stripNonAlpha(parsedContextUrl.protocol);
395
402
  const computedHost = parsedUrl.host || parsedContextUrl.host;
@@ -6186,16 +6193,69 @@ exports.serialize = serialize;
6186
6193
  */
6187
6194
 
6188
6195
  var __toString = Object.prototype.toString
6196
+ var __hasOwnProperty = Object.prototype.hasOwnProperty
6197
+
6198
+ /**
6199
+ * RegExp to match cookie-name in RFC 6265 sec 4.1.1
6200
+ * This refers out to the obsoleted definition of token in RFC 2616 sec 2.2
6201
+ * which has been replaced by the token definition in RFC 7230 appendix B.
6202
+ *
6203
+ * cookie-name = token
6204
+ * token = 1*tchar
6205
+ * tchar = "!" / "#" / "$" / "%" / "&" / "'" /
6206
+ * "*" / "+" / "-" / "." / "^" / "_" /
6207
+ * "`" / "|" / "~" / DIGIT / ALPHA
6208
+ */
6209
+
6210
+ var cookieNameRegExp = /^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/;
6211
+
6212
+ /**
6213
+ * RegExp to match cookie-value in RFC 6265 sec 4.1.1
6214
+ *
6215
+ * cookie-value = *cookie-octet / ( DQUOTE *cookie-octet DQUOTE )
6216
+ * cookie-octet = %x21 / %x23-2B / %x2D-3A / %x3C-5B / %x5D-7E
6217
+ * ; US-ASCII characters excluding CTLs,
6218
+ * ; whitespace DQUOTE, comma, semicolon,
6219
+ * ; and backslash
6220
+ */
6221
+
6222
+ var cookieValueRegExp = /^("?)[\u0021\u0023-\u002B\u002D-\u003A\u003C-\u005B\u005D-\u007E]*\1$/;
6223
+
6224
+ /**
6225
+ * RegExp to match domain-value in RFC 6265 sec 4.1.1
6226
+ *
6227
+ * domain-value = <subdomain>
6228
+ * ; defined in [RFC1034], Section 3.5, as
6229
+ * ; enhanced by [RFC1123], Section 2.1
6230
+ * <subdomain> = <label> | <subdomain> "." <label>
6231
+ * <label> = <let-dig> [ [ <ldh-str> ] <let-dig> ]
6232
+ * Labels must be 63 characters or less.
6233
+ * 'let-dig' not 'letter' in the first char, per RFC1123
6234
+ * <ldh-str> = <let-dig-hyp> | <let-dig-hyp> <ldh-str>
6235
+ * <let-dig-hyp> = <let-dig> | "-"
6236
+ * <let-dig> = <letter> | <digit>
6237
+ * <letter> = any one of the 52 alphabetic characters A through Z in
6238
+ * upper case and a through z in lower case
6239
+ * <digit> = any one of the ten digits 0 through 9
6240
+ *
6241
+ * Keep support for leading dot: https://github.com/jshttp/cookie/issues/173
6242
+ *
6243
+ * > (Note that a leading %x2E ("."), if present, is ignored even though that
6244
+ * character is not permitted, but a trailing %x2E ("."), if present, will
6245
+ * cause the user agent to ignore the attribute.)
6246
+ */
6247
+
6248
+ var domainValueRegExp = /^([.]?[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)([.][a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*$/i;
6189
6249
 
6190
6250
  /**
6191
- * RegExp to match field-content in RFC 7230 sec 3.2
6251
+ * RegExp to match path-value in RFC 6265 sec 4.1.1
6192
6252
  *
6193
- * field-content = field-vchar [ 1*( SP / HTAB ) field-vchar ]
6194
- * field-vchar = VCHAR / obs-text
6195
- * obs-text = %x80-FF
6253
+ * path-value = <any CHAR except CTLs or ";">
6254
+ * CHAR = %x01-7F
6255
+ * ; defined in RFC 5234 appendix B.1
6196
6256
  */
6197
6257
 
6198
- var fieldContentRegExp = /^[\u0009\u0020-\u007e\u0080-\u00ff]+$/;
6258
+ var pathValueRegExp = /^[\u0020-\u003A\u003D-\u007E]*$/;
6199
6259
 
6200
6260
  /**
6201
6261
  * Parse a cookie header.
@@ -6204,107 +6264,128 @@ var fieldContentRegExp = /^[\u0009\u0020-\u007e\u0080-\u00ff]+$/;
6204
6264
  * The object has the various cookies as keys(names) => values
6205
6265
  *
6206
6266
  * @param {string} str
6207
- * @param {object} [options]
6267
+ * @param {object} [opt]
6208
6268
  * @return {object}
6209
6269
  * @public
6210
6270
  */
6211
6271
 
6212
- function parse(str, options) {
6272
+ function parse(str, opt) {
6213
6273
  if (typeof str !== 'string') {
6214
6274
  throw new TypeError('argument str must be a string');
6215
6275
  }
6216
6276
 
6217
- var obj = {}
6218
- var opt = options || {};
6219
- var dec = opt.decode || decode;
6277
+ var obj = {};
6278
+ var len = str.length;
6279
+ // RFC 6265 sec 4.1.1, RFC 2616 2.2 defines a cookie name consists of one char minimum, plus '='.
6280
+ if (len < 2) return obj;
6220
6281
 
6221
- var index = 0
6222
- while (index < str.length) {
6223
- var eqIdx = str.indexOf('=', index)
6282
+ var dec = (opt && opt.decode) || decode;
6283
+ var index = 0;
6284
+ var eqIdx = 0;
6285
+ var endIdx = 0;
6224
6286
 
6225
- // no more cookie pairs
6226
- if (eqIdx === -1) {
6227
- break
6228
- }
6287
+ do {
6288
+ eqIdx = str.indexOf('=', index);
6289
+ if (eqIdx === -1) break; // No more cookie pairs.
6229
6290
 
6230
- var endIdx = str.indexOf(';', index)
6291
+ endIdx = str.indexOf(';', index);
6231
6292
 
6232
6293
  if (endIdx === -1) {
6233
- endIdx = str.length
6234
- } else if (endIdx < eqIdx) {
6294
+ endIdx = len;
6295
+ } else if (eqIdx > endIdx) {
6235
6296
  // backtrack on prior semicolon
6236
- index = str.lastIndexOf(';', eqIdx - 1) + 1
6237
- continue
6297
+ index = str.lastIndexOf(';', eqIdx - 1) + 1;
6298
+ continue;
6238
6299
  }
6239
6300
 
6240
- var key = str.slice(index, eqIdx).trim()
6301
+ var keyStartIdx = startIndex(str, index, eqIdx);
6302
+ var keyEndIdx = endIndex(str, eqIdx, keyStartIdx);
6303
+ var key = str.slice(keyStartIdx, keyEndIdx);
6241
6304
 
6242
6305
  // only assign once
6243
- if (undefined === obj[key]) {
6244
- var val = str.slice(eqIdx + 1, endIdx).trim()
6306
+ if (!__hasOwnProperty.call(obj, key)) {
6307
+ var valStartIdx = startIndex(str, eqIdx + 1, endIdx);
6308
+ var valEndIdx = endIndex(str, endIdx, valStartIdx);
6245
6309
 
6246
- // quoted values
6247
- if (val.charCodeAt(0) === 0x22) {
6248
- val = val.slice(1, -1)
6310
+ if (str.charCodeAt(valStartIdx) === 0x22 /* " */ && str.charCodeAt(valEndIdx - 1) === 0x22 /* " */) {
6311
+ valStartIdx++;
6312
+ valEndIdx--;
6249
6313
  }
6250
6314
 
6315
+ var val = str.slice(valStartIdx, valEndIdx);
6251
6316
  obj[key] = tryDecode(val, dec);
6252
6317
  }
6253
6318
 
6254
6319
  index = endIdx + 1
6255
- }
6320
+ } while (index < len);
6256
6321
 
6257
6322
  return obj;
6258
6323
  }
6259
6324
 
6325
+ function startIndex(str, index, max) {
6326
+ do {
6327
+ var code = str.charCodeAt(index);
6328
+ if (code !== 0x20 /* */ && code !== 0x09 /* \t */) return index;
6329
+ } while (++index < max);
6330
+ return max;
6331
+ }
6332
+
6333
+ function endIndex(str, index, min) {
6334
+ while (index > min) {
6335
+ var code = str.charCodeAt(--index);
6336
+ if (code !== 0x20 /* */ && code !== 0x09 /* \t */) return index + 1;
6337
+ }
6338
+ return min;
6339
+ }
6340
+
6260
6341
  /**
6261
6342
  * Serialize data into a cookie header.
6262
6343
  *
6263
- * Serialize the a name value pair into a cookie string suitable for
6264
- * http headers. An optional options object specified cookie parameters.
6344
+ * Serialize a name value pair into a cookie string suitable for
6345
+ * http headers. An optional options object specifies cookie parameters.
6265
6346
  *
6266
6347
  * serialize('foo', 'bar', { httpOnly: true })
6267
6348
  * => "foo=bar; httpOnly"
6268
6349
  *
6269
6350
  * @param {string} name
6270
6351
  * @param {string} val
6271
- * @param {object} [options]
6352
+ * @param {object} [opt]
6272
6353
  * @return {string}
6273
6354
  * @public
6274
6355
  */
6275
6356
 
6276
- function serialize(name, val, options) {
6277
- var opt = options || {};
6278
- var enc = opt.encode || encode;
6357
+ function serialize(name, val, opt) {
6358
+ var enc = (opt && opt.encode) || encodeURIComponent;
6279
6359
 
6280
6360
  if (typeof enc !== 'function') {
6281
6361
  throw new TypeError('option encode is invalid');
6282
6362
  }
6283
6363
 
6284
- if (!fieldContentRegExp.test(name)) {
6364
+ if (!cookieNameRegExp.test(name)) {
6285
6365
  throw new TypeError('argument name is invalid');
6286
6366
  }
6287
6367
 
6288
6368
  var value = enc(val);
6289
6369
 
6290
- if (value && !fieldContentRegExp.test(value)) {
6370
+ if (!cookieValueRegExp.test(value)) {
6291
6371
  throw new TypeError('argument val is invalid');
6292
6372
  }
6293
6373
 
6294
6374
  var str = name + '=' + value;
6375
+ if (!opt) return str;
6295
6376
 
6296
6377
  if (null != opt.maxAge) {
6297
- var maxAge = opt.maxAge - 0;
6378
+ var maxAge = Math.floor(opt.maxAge);
6298
6379
 
6299
- if (isNaN(maxAge) || !isFinite(maxAge)) {
6380
+ if (!isFinite(maxAge)) {
6300
6381
  throw new TypeError('option maxAge is invalid')
6301
6382
  }
6302
6383
 
6303
- str += '; Max-Age=' + Math.floor(maxAge);
6384
+ str += '; Max-Age=' + maxAge;
6304
6385
  }
6305
6386
 
6306
6387
  if (opt.domain) {
6307
- if (!fieldContentRegExp.test(opt.domain)) {
6388
+ if (!domainValueRegExp.test(opt.domain)) {
6308
6389
  throw new TypeError('option domain is invalid');
6309
6390
  }
6310
6391
 
@@ -6312,7 +6393,7 @@ function serialize(name, val, options) {
6312
6393
  }
6313
6394
 
6314
6395
  if (opt.path) {
6315
- if (!fieldContentRegExp.test(opt.path)) {
6396
+ if (!pathValueRegExp.test(opt.path)) {
6316
6397
  throw new TypeError('option path is invalid');
6317
6398
  }
6318
6399
 
@@ -6343,8 +6424,7 @@ function serialize(name, val, options) {
6343
6424
 
6344
6425
  if (opt.priority) {
6345
6426
  var priority = typeof opt.priority === 'string'
6346
- ? opt.priority.toLowerCase()
6347
- : opt.priority
6427
+ ? opt.priority.toLowerCase() : opt.priority;
6348
6428
 
6349
6429
  switch (priority) {
6350
6430
  case 'low':
@@ -6399,17 +6479,6 @@ function decode (str) {
6399
6479
  : str
6400
6480
  }
6401
6481
 
6402
- /**
6403
- * URL-encode value.
6404
- *
6405
- * @param {string} val
6406
- * @returns {string}
6407
- */
6408
-
6409
- function encode (val) {
6410
- return encodeURIComponent(val)
6411
- }
6412
-
6413
6482
  /**
6414
6483
  * Determine if value is a Date.
6415
6484
  *
@@ -6418,8 +6487,7 @@ function encode (val) {
6418
6487
  */
6419
6488
 
6420
6489
  function isDate (val) {
6421
- return __toString.call(val) === '[object Date]' ||
6422
- val instanceof Date
6490
+ return __toString.call(val) === '[object Date]';
6423
6491
  }
6424
6492
 
6425
6493
  /**