@pactflow/openapi-pact-comparator 1.0.0 → 1.2.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.mjs CHANGED
@@ -3536,7 +3536,7 @@ const baseMockDetails = (interaction) => ({
3536
3536
  interactionState: interaction.providerState || "[none]",
3537
3537
  });
3538
3538
 
3539
- const unescape$1 = (subpath) => subpath.replaceAll("~1", "/").replaceAll("~0", "~");
3539
+ const unescape$1 = (subpath) => decodeURI(subpath.replaceAll("~1", "/").replaceAll("~0", "~"));
3540
3540
  const splitPath = (path) => {
3541
3541
  if (path.startsWith("#/")) {
3542
3542
  return path.substring(2).split("/").map(unescape$1);
@@ -36338,10 +36338,10 @@ function requireHttpMethod () {
36338
36338
  httpMethod = {
36339
36339
  name: '__fmw_internal_strategy_merged_tree_http_method__',
36340
36340
  storage: function () {
36341
- const handlers = {};
36341
+ const handlers = new Map();
36342
36342
  return {
36343
- get: (type) => { return handlers[type] || null },
36344
- set: (type, store) => { handlers[type] = store; }
36343
+ get: (type) => { return handlers.get(type) || null },
36344
+ set: (type, store) => { handlers.set(type, store); }
36345
36345
  }
36346
36346
  },
36347
36347
  /* c8 ignore next 1 */
@@ -36975,8 +36975,7 @@ function requireAcceptVersion () {
36975
36975
  return new SemVerStore()
36976
36976
  }
36977
36977
 
36978
- this.store = {};
36979
-
36978
+ this.store = new Map();
36980
36979
  this.maxMajor = 0;
36981
36980
  this.maxMinors = {};
36982
36981
  this.maxPatches = {};
@@ -36998,29 +36997,29 @@ function requireAcceptVersion () {
36998
36997
 
36999
36998
  if (major >= this.maxMajor) {
37000
36999
  this.maxMajor = major;
37001
- this.store.x = store;
37002
- this.store['*'] = store;
37003
- this.store['x.x'] = store;
37004
- this.store['x.x.x'] = store;
37000
+ this.store.set('x', store);
37001
+ this.store.set('*', store);
37002
+ this.store.set('x.x', store);
37003
+ this.store.set('x.x.x', store);
37005
37004
  }
37006
37005
 
37007
37006
  if (minor >= (this.maxMinors[major] || 0)) {
37008
37007
  this.maxMinors[major] = minor;
37009
- this.store[`${major}.x`] = store;
37010
- this.store[`${major}.x.x`] = store;
37008
+ this.store.set(`${major}.x`, store);
37009
+ this.store.set(`${major}.x.x`, store);
37011
37010
  }
37012
37011
 
37013
37012
  if (patch >= (this.maxPatches[`${major}.${minor}`] || 0)) {
37014
37013
  this.maxPatches[`${major}.${minor}`] = patch;
37015
- this.store[`${major}.${minor}.x`] = store;
37014
+ this.store.set(`${major}.${minor}.x`, store);
37016
37015
  }
37017
37016
 
37018
- this.store[`${major}.${minor}.${patch}`] = store;
37017
+ this.store.set(`${major}.${minor}.${patch}`, store);
37019
37018
  return this
37020
37019
  };
37021
37020
 
37022
37021
  SemVerStore.prototype.get = function (version) {
37023
- return this.store[version]
37022
+ return this.store.get(version)
37024
37023
  };
37025
37024
 
37026
37025
  acceptVersion = {
@@ -37043,11 +37042,11 @@ function requireAcceptHost () {
37043
37042
  const assert = require$$0$5;
37044
37043
 
37045
37044
  function HostStorage () {
37046
- const hosts = {};
37045
+ const hosts = new Map();
37047
37046
  const regexHosts = [];
37048
37047
  return {
37049
37048
  get: (host) => {
37050
- const exact = hosts[host];
37049
+ const exact = hosts.get(host);
37051
37050
  if (exact) {
37052
37051
  return exact
37053
37052
  }
@@ -37061,7 +37060,7 @@ function requireAcceptHost () {
37061
37060
  if (host instanceof RegExp) {
37062
37061
  regexHosts.push({ host, value });
37063
37062
  } else {
37064
- hosts[host] = value;
37063
+ hosts.set(host, value);
37065
37064
  }
37066
37065
  }
37067
37066
  }
@@ -37426,6 +37425,8 @@ function requireFindMyWay () {
37426
37425
 
37427
37426
  const FULL_PATH_REGEXP = /^https?:\/\/.*?\//;
37428
37427
  const OPTIONAL_PARAM_REGEXP = /(\/:[^/()]*?)\?(\/?)/;
37428
+ const ESCAPE_REGEXP = /[.*+?^${}()|[\]\\]/g;
37429
+ const REMOVE_DUPLICATE_SLASHES_REGEXP = /\/\/+/g;
37429
37430
 
37430
37431
  if (!isRegexSafe(FULL_PATH_REGEXP)) {
37431
37432
  throw new Error('the FULL_PATH_REGEXP is not safe, update this module')
@@ -37435,6 +37436,14 @@ function requireFindMyWay () {
37435
37436
  throw new Error('the OPTIONAL_PARAM_REGEXP is not safe, update this module')
37436
37437
  }
37437
37438
 
37439
+ if (!isRegexSafe(ESCAPE_REGEXP)) {
37440
+ throw new Error('the ESCAPE_REGEXP is not safe, update this module')
37441
+ }
37442
+
37443
+ if (!isRegexSafe(REMOVE_DUPLICATE_SLASHES_REGEXP)) {
37444
+ throw new Error('the REMOVE_DUPLICATE_SLASHES_REGEXP is not safe, update this module')
37445
+ }
37446
+
37438
37447
  function Router (opts) {
37439
37448
  if (!(this instanceof Router)) {
37440
37449
  return new Router(opts)
@@ -38138,11 +38147,11 @@ function requireFindMyWay () {
38138
38147
  findMyWay = Router;
38139
38148
 
38140
38149
  function escapeRegExp (string) {
38141
- return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
38150
+ return string.replace(ESCAPE_REGEXP, '\\$&')
38142
38151
  }
38143
38152
 
38144
38153
  function removeDuplicateSlashes (path) {
38145
- return path.replace(/\/\/+/g, '/')
38154
+ return path.indexOf('//') !== -1 ? path.replace(REMOVE_DUPLICATE_SLASHES_REGEXP, '/') : path
38146
38155
  }
38147
38156
 
38148
38157
  function trimLastSlash (path) {
@@ -38233,7 +38242,10 @@ function setupRouter(oas, config) {
38233
38242
  });
38234
38243
  for (const oasPath in oas.paths) {
38235
38244
  // NB: all path parameters are required in OAS
38236
- const path = (oas.basePath || "") +
38245
+ const basePath = oas.info["x-opc-config-base-path"] ||
38246
+ oas.basePath ||
38247
+ "";
38248
+ const path = basePath +
38237
38249
  oasPath
38238
38250
  .replaceAll(/{.*?}/g, cleanPathParameter)
38239
38251
  .replaceAll(/{([.;]?)([^*]+?)\*?}/g, "$1:$2(.+)");