@pactflow/openapi-pact-comparator 1.0.0 → 1.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.cjs CHANGED
@@ -36358,10 +36358,10 @@ function requireHttpMethod () {
36358
36358
  httpMethod = {
36359
36359
  name: '__fmw_internal_strategy_merged_tree_http_method__',
36360
36360
  storage: function () {
36361
- const handlers = {};
36361
+ const handlers = new Map();
36362
36362
  return {
36363
- get: (type) => { return handlers[type] || null },
36364
- set: (type, store) => { handlers[type] = store; }
36363
+ get: (type) => { return handlers.get(type) || null },
36364
+ set: (type, store) => { handlers.set(type, store); }
36365
36365
  }
36366
36366
  },
36367
36367
  /* c8 ignore next 1 */
@@ -36995,8 +36995,7 @@ function requireAcceptVersion () {
36995
36995
  return new SemVerStore()
36996
36996
  }
36997
36997
 
36998
- this.store = {};
36999
-
36998
+ this.store = new Map();
37000
36999
  this.maxMajor = 0;
37001
37000
  this.maxMinors = {};
37002
37001
  this.maxPatches = {};
@@ -37018,29 +37017,29 @@ function requireAcceptVersion () {
37018
37017
 
37019
37018
  if (major >= this.maxMajor) {
37020
37019
  this.maxMajor = major;
37021
- this.store.x = store;
37022
- this.store['*'] = store;
37023
- this.store['x.x'] = store;
37024
- this.store['x.x.x'] = store;
37020
+ this.store.set('x', store);
37021
+ this.store.set('*', store);
37022
+ this.store.set('x.x', store);
37023
+ this.store.set('x.x.x', store);
37025
37024
  }
37026
37025
 
37027
37026
  if (minor >= (this.maxMinors[major] || 0)) {
37028
37027
  this.maxMinors[major] = minor;
37029
- this.store[`${major}.x`] = store;
37030
- this.store[`${major}.x.x`] = store;
37028
+ this.store.set(`${major}.x`, store);
37029
+ this.store.set(`${major}.x.x`, store);
37031
37030
  }
37032
37031
 
37033
37032
  if (patch >= (this.maxPatches[`${major}.${minor}`] || 0)) {
37034
37033
  this.maxPatches[`${major}.${minor}`] = patch;
37035
- this.store[`${major}.${minor}.x`] = store;
37034
+ this.store.set(`${major}.${minor}.x`, store);
37036
37035
  }
37037
37036
 
37038
- this.store[`${major}.${minor}.${patch}`] = store;
37037
+ this.store.set(`${major}.${minor}.${patch}`, store);
37039
37038
  return this
37040
37039
  };
37041
37040
 
37042
37041
  SemVerStore.prototype.get = function (version) {
37043
- return this.store[version]
37042
+ return this.store.get(version)
37044
37043
  };
37045
37044
 
37046
37045
  acceptVersion = {
@@ -37063,11 +37062,11 @@ function requireAcceptHost () {
37063
37062
  const assert = require$$0$5;
37064
37063
 
37065
37064
  function HostStorage () {
37066
- const hosts = {};
37065
+ const hosts = new Map();
37067
37066
  const regexHosts = [];
37068
37067
  return {
37069
37068
  get: (host) => {
37070
- const exact = hosts[host];
37069
+ const exact = hosts.get(host);
37071
37070
  if (exact) {
37072
37071
  return exact
37073
37072
  }
@@ -37081,7 +37080,7 @@ function requireAcceptHost () {
37081
37080
  if (host instanceof RegExp) {
37082
37081
  regexHosts.push({ host, value });
37083
37082
  } else {
37084
- hosts[host] = value;
37083
+ hosts.set(host, value);
37085
37084
  }
37086
37085
  }
37087
37086
  }
@@ -37446,6 +37445,8 @@ function requireFindMyWay () {
37446
37445
 
37447
37446
  const FULL_PATH_REGEXP = /^https?:\/\/.*?\//;
37448
37447
  const OPTIONAL_PARAM_REGEXP = /(\/:[^/()]*?)\?(\/?)/;
37448
+ const ESCAPE_REGEXP = /[.*+?^${}()|[\]\\]/g;
37449
+ const REMOVE_DUPLICATE_SLASHES_REGEXP = /\/\/+/g;
37449
37450
 
37450
37451
  if (!isRegexSafe(FULL_PATH_REGEXP)) {
37451
37452
  throw new Error('the FULL_PATH_REGEXP is not safe, update this module')
@@ -37455,6 +37456,14 @@ function requireFindMyWay () {
37455
37456
  throw new Error('the OPTIONAL_PARAM_REGEXP is not safe, update this module')
37456
37457
  }
37457
37458
 
37459
+ if (!isRegexSafe(ESCAPE_REGEXP)) {
37460
+ throw new Error('the ESCAPE_REGEXP is not safe, update this module')
37461
+ }
37462
+
37463
+ if (!isRegexSafe(REMOVE_DUPLICATE_SLASHES_REGEXP)) {
37464
+ throw new Error('the REMOVE_DUPLICATE_SLASHES_REGEXP is not safe, update this module')
37465
+ }
37466
+
37458
37467
  function Router (opts) {
37459
37468
  if (!(this instanceof Router)) {
37460
37469
  return new Router(opts)
@@ -38158,11 +38167,11 @@ function requireFindMyWay () {
38158
38167
  findMyWay = Router;
38159
38168
 
38160
38169
  function escapeRegExp (string) {
38161
- return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
38170
+ return string.replace(ESCAPE_REGEXP, '\\$&')
38162
38171
  }
38163
38172
 
38164
38173
  function removeDuplicateSlashes (path) {
38165
- return path.replace(/\/\/+/g, '/')
38174
+ return path.indexOf('//') !== -1 ? path.replace(REMOVE_DUPLICATE_SLASHES_REGEXP, '/') : path
38166
38175
  }
38167
38176
 
38168
38177
  function trimLastSlash (path) {
@@ -38253,7 +38262,10 @@ function setupRouter(oas, config) {
38253
38262
  });
38254
38263
  for (const oasPath in oas.paths) {
38255
38264
  // NB: all path parameters are required in OAS
38256
- const path = (oas.basePath || "") +
38265
+ const basePath = oas.info["x-opc-config-base-path"] ||
38266
+ oas.basePath ||
38267
+ "";
38268
+ const path = basePath +
38257
38269
  oasPath
38258
38270
  .replaceAll(/{.*?}/g, cleanPathParameter)
38259
38271
  .replaceAll(/{([.;]?)([^*]+?)\*?}/g, "$1:$2(.+)");