swagger-client 3.35.7 → 3.36.1

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.
@@ -1353,33 +1353,29 @@ __webpack_require__.r(__webpack_exports__);
1353
1353
  /* harmony export */ ObjectElement: () => (/* reexport safe */ minim__WEBPACK_IMPORTED_MODULE_0__.ObjectElement),
1354
1354
  /* harmony export */ ParseResultElement: () => (/* reexport safe */ _elements_ParseResult_mjs__WEBPACK_IMPORTED_MODULE_3__["default"]),
1355
1355
  /* harmony export */ RefElement: () => (/* reexport safe */ minim__WEBPACK_IMPORTED_MODULE_0__.RefElement),
1356
- /* harmony export */ SourceMapElement: () => (/* reexport safe */ _elements_SourceMap_mjs__WEBPACK_IMPORTED_MODULE_4__["default"]),
1357
1356
  /* harmony export */ StringElement: () => (/* reexport safe */ minim__WEBPACK_IMPORTED_MODULE_0__.StringElement)
1358
1357
  /* harmony export */ });
1359
1358
  /* harmony import */ var minim__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(34035);
1360
1359
  /* harmony import */ var _elements_Annotation_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(5443);
1361
1360
  /* harmony import */ var _elements_Comment_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(6127);
1362
1361
  /* harmony import */ var _elements_ParseResult_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(59110);
1363
- /* harmony import */ var _elements_SourceMap_mjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(36863);
1364
- /* harmony import */ var _index_mjs__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(5869);
1362
+ /* harmony import */ var _index_mjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(5869);
1365
1363
 
1366
1364
 
1367
1365
 
1368
1366
 
1369
1367
 
1370
-
1371
- minim__WEBPACK_IMPORTED_MODULE_0__.ObjectElement.refract = (0,_index_mjs__WEBPACK_IMPORTED_MODULE_5__.createRefractor)(minim__WEBPACK_IMPORTED_MODULE_0__.ObjectElement);
1372
- minim__WEBPACK_IMPORTED_MODULE_0__.ArrayElement.refract = (0,_index_mjs__WEBPACK_IMPORTED_MODULE_5__.createRefractor)(minim__WEBPACK_IMPORTED_MODULE_0__.ArrayElement);
1373
- minim__WEBPACK_IMPORTED_MODULE_0__.StringElement.refract = (0,_index_mjs__WEBPACK_IMPORTED_MODULE_5__.createRefractor)(minim__WEBPACK_IMPORTED_MODULE_0__.StringElement);
1374
- minim__WEBPACK_IMPORTED_MODULE_0__.BooleanElement.refract = (0,_index_mjs__WEBPACK_IMPORTED_MODULE_5__.createRefractor)(minim__WEBPACK_IMPORTED_MODULE_0__.BooleanElement);
1375
- minim__WEBPACK_IMPORTED_MODULE_0__.NullElement.refract = (0,_index_mjs__WEBPACK_IMPORTED_MODULE_5__.createRefractor)(minim__WEBPACK_IMPORTED_MODULE_0__.NullElement);
1376
- minim__WEBPACK_IMPORTED_MODULE_0__.NumberElement.refract = (0,_index_mjs__WEBPACK_IMPORTED_MODULE_5__.createRefractor)(minim__WEBPACK_IMPORTED_MODULE_0__.NumberElement);
1377
- minim__WEBPACK_IMPORTED_MODULE_0__.LinkElement.refract = (0,_index_mjs__WEBPACK_IMPORTED_MODULE_5__.createRefractor)(minim__WEBPACK_IMPORTED_MODULE_0__.LinkElement);
1378
- minim__WEBPACK_IMPORTED_MODULE_0__.RefElement.refract = (0,_index_mjs__WEBPACK_IMPORTED_MODULE_5__.createRefractor)(minim__WEBPACK_IMPORTED_MODULE_0__.RefElement);
1379
- _elements_Annotation_mjs__WEBPACK_IMPORTED_MODULE_1__["default"].refract = (0,_index_mjs__WEBPACK_IMPORTED_MODULE_5__.createRefractor)(_elements_Annotation_mjs__WEBPACK_IMPORTED_MODULE_1__["default"]);
1380
- _elements_Comment_mjs__WEBPACK_IMPORTED_MODULE_2__["default"].refract = (0,_index_mjs__WEBPACK_IMPORTED_MODULE_5__.createRefractor)(_elements_Comment_mjs__WEBPACK_IMPORTED_MODULE_2__["default"]);
1381
- _elements_ParseResult_mjs__WEBPACK_IMPORTED_MODULE_3__["default"].refract = (0,_index_mjs__WEBPACK_IMPORTED_MODULE_5__.createRefractor)(_elements_ParseResult_mjs__WEBPACK_IMPORTED_MODULE_3__["default"]);
1382
- _elements_SourceMap_mjs__WEBPACK_IMPORTED_MODULE_4__["default"].refract = (0,_index_mjs__WEBPACK_IMPORTED_MODULE_5__.createRefractor)(_elements_SourceMap_mjs__WEBPACK_IMPORTED_MODULE_4__["default"]);
1368
+ minim__WEBPACK_IMPORTED_MODULE_0__.ObjectElement.refract = (0,_index_mjs__WEBPACK_IMPORTED_MODULE_4__.createRefractor)(minim__WEBPACK_IMPORTED_MODULE_0__.ObjectElement);
1369
+ minim__WEBPACK_IMPORTED_MODULE_0__.ArrayElement.refract = (0,_index_mjs__WEBPACK_IMPORTED_MODULE_4__.createRefractor)(minim__WEBPACK_IMPORTED_MODULE_0__.ArrayElement);
1370
+ minim__WEBPACK_IMPORTED_MODULE_0__.StringElement.refract = (0,_index_mjs__WEBPACK_IMPORTED_MODULE_4__.createRefractor)(minim__WEBPACK_IMPORTED_MODULE_0__.StringElement);
1371
+ minim__WEBPACK_IMPORTED_MODULE_0__.BooleanElement.refract = (0,_index_mjs__WEBPACK_IMPORTED_MODULE_4__.createRefractor)(minim__WEBPACK_IMPORTED_MODULE_0__.BooleanElement);
1372
+ minim__WEBPACK_IMPORTED_MODULE_0__.NullElement.refract = (0,_index_mjs__WEBPACK_IMPORTED_MODULE_4__.createRefractor)(minim__WEBPACK_IMPORTED_MODULE_0__.NullElement);
1373
+ minim__WEBPACK_IMPORTED_MODULE_0__.NumberElement.refract = (0,_index_mjs__WEBPACK_IMPORTED_MODULE_4__.createRefractor)(minim__WEBPACK_IMPORTED_MODULE_0__.NumberElement);
1374
+ minim__WEBPACK_IMPORTED_MODULE_0__.LinkElement.refract = (0,_index_mjs__WEBPACK_IMPORTED_MODULE_4__.createRefractor)(minim__WEBPACK_IMPORTED_MODULE_0__.LinkElement);
1375
+ minim__WEBPACK_IMPORTED_MODULE_0__.RefElement.refract = (0,_index_mjs__WEBPACK_IMPORTED_MODULE_4__.createRefractor)(minim__WEBPACK_IMPORTED_MODULE_0__.RefElement);
1376
+ _elements_Annotation_mjs__WEBPACK_IMPORTED_MODULE_1__["default"].refract = (0,_index_mjs__WEBPACK_IMPORTED_MODULE_4__.createRefractor)(_elements_Annotation_mjs__WEBPACK_IMPORTED_MODULE_1__["default"]);
1377
+ _elements_Comment_mjs__WEBPACK_IMPORTED_MODULE_2__["default"].refract = (0,_index_mjs__WEBPACK_IMPORTED_MODULE_4__.createRefractor)(_elements_Comment_mjs__WEBPACK_IMPORTED_MODULE_2__["default"]);
1378
+ _elements_ParseResult_mjs__WEBPACK_IMPORTED_MODULE_3__["default"].refract = (0,_index_mjs__WEBPACK_IMPORTED_MODULE_4__.createRefractor)(_elements_ParseResult_mjs__WEBPACK_IMPORTED_MODULE_3__["default"]);
1383
1379
 
1384
1380
 
1385
1381
  /***/ }),
@@ -2929,6 +2925,7 @@ class FileWithData extends File {
2929
2925
  "use strict";
2930
2926
  __webpack_require__.r(__webpack_exports__);
2931
2927
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
2928
+ /* harmony export */ assignSourceMap: () => (/* binding */ assignSourceMap),
2932
2929
  /* harmony export */ dereference: () => (/* binding */ dereference)
2933
2930
  /* harmony export */ });
2934
2931
  /* harmony import */ var ramda__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(37012);
@@ -2963,6 +2960,20 @@ const dereference = (object, root) => {
2963
2960
  return val;
2964
2961
  }, object);
2965
2962
  };
2963
+ /**
2964
+ * @public
2965
+ */
2966
+ /* eslint-disable no-param-reassign */
2967
+ const assignSourceMap = (to, from) => {
2968
+ to.startPositionRow = from === null || from === void 0 ? void 0 : from.startPositionRow;
2969
+ to.startPositionColumn = from === null || from === void 0 ? void 0 : from.startPositionColumn;
2970
+ to.startIndex = from === null || from === void 0 ? void 0 : from.startIndex;
2971
+ to.endPositionRow = from === null || from === void 0 ? void 0 : from.endPositionRow;
2972
+ to.endPositionColumn = from === null || from === void 0 ? void 0 : from.endPositionColumn;
2973
+ to.endIndex = from === null || from === void 0 ? void 0 : from.endIndex;
2974
+ return to;
2975
+ };
2976
+ /* eslint-enable no-param-reassign */
2966
2977
 
2967
2978
  /***/ }),
2968
2979
 
@@ -15556,6 +15567,45 @@ class OpenAPI3_1DereferenceVisitor {
15556
15567
  this.refractCache = refractCache;
15557
15568
  this.allOfDiscriminatorMapping = allOfDiscriminatorMapping;
15558
15569
  }
15570
+ handleDereferenceError(error, refEl, directAncestors) {
15571
+ var _this$options$derefer;
15572
+ if ((_this$options$derefer = this.options.dereference.dereferenceOpts) !== null && _this$options$derefer !== void 0 && _this$options$derefer.continueOnError) {
15573
+ var _this$options$derefer3;
15574
+ if (directAncestors) {
15575
+ const ancestorWithRef = [...directAncestors].find(ancestor => (0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_5__.isObjectElement)(ancestor) && ancestor.getMetaProperty('ref-referencing-element'));
15576
+ if (ancestorWithRef) {
15577
+ var _this$options$derefer2;
15578
+ (_this$options$derefer2 = this.options.dereference.dereferenceOpts) === null || _this$options$derefer2 === void 0 || _this$options$derefer2.errors.push({
15579
+ error,
15580
+ refEl: ancestorWithRef.getMetaProperty('ref-referencing-element')
15581
+ });
15582
+ }
15583
+ }
15584
+ (_this$options$derefer3 = this.options.dereference.dereferenceOpts) === null || _this$options$derefer3 === void 0 || _this$options$derefer3.errors.push({
15585
+ error,
15586
+ refEl
15587
+ });
15588
+ return undefined;
15589
+ }
15590
+ throw error;
15591
+ }
15592
+ getNestedVisitorOptions(referencingElement) {
15593
+ var _this$options$derefer4, _this$options$derefer5;
15594
+ return {
15595
+ ...this.options,
15596
+ resolve: {
15597
+ ...this.options.resolve,
15598
+ external: (_this$options$derefer4 = this.options.dereference) !== null && _this$options$derefer4 !== void 0 && (_this$options$derefer4 = _this$options$derefer4.dereferenceOpts) !== null && _this$options$derefer4 !== void 0 && _this$options$derefer4.skipNestedExternal && (0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_9__["default"])(referencingElement.get('$ref')).startsWith('#') ? false : this.options.resolve.external
15599
+ },
15600
+ dereference: {
15601
+ ...this.options.dereference,
15602
+ dereferenceOpts: {
15603
+ ...((_this$options$derefer5 = this.options.dereference) === null || _this$options$derefer5 === void 0 ? void 0 : _this$options$derefer5.dereferenceOpts),
15604
+ continueOnError: false
15605
+ }
15606
+ }
15607
+ };
15608
+ }
15559
15609
  toBaseURI(uri) {
15560
15610
  return _util_url_mjs__WEBPACK_IMPORTED_MODULE_21__.resolve(this.reference.uri, _util_url_mjs__WEBPACK_IMPORTED_MODULE_21__.sanitize(_util_url_mjs__WEBPACK_IMPORTED_MODULE_21__.stripHash(uri)));
15561
15611
  }
@@ -15610,8 +15660,8 @@ class OpenAPI3_1DereferenceVisitor {
15610
15660
  }
15611
15661
  OpenApi3_1Element = {
15612
15662
  leave: (openApi3_1Element, key, parent, path, ancestors, link) => {
15613
- var _this$options$derefer;
15614
- if (!((_this$options$derefer = this.options.dereference.strategyOpts['openapi-3-1']) !== null && _this$options$derefer !== void 0 && _this$options$derefer.dereferenceDiscriminatorMapping)) {
15663
+ var _this$options$derefer6;
15664
+ if (!((_this$options$derefer6 = this.options.dereference.strategyOpts['openapi-3-1']) !== null && _this$options$derefer6 !== void 0 && _this$options$derefer6.dereferenceDiscriminatorMapping)) {
15615
15665
  return undefined;
15616
15666
  }
15617
15667
  const openApi3_1ElementCopy = (0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_7__.cloneShallow)(openApi3_1Element);
@@ -15621,6 +15671,7 @@ class OpenAPI3_1DereferenceVisitor {
15621
15671
  }
15622
15672
  };
15623
15673
  async ReferenceElement(referencingElement, key, parent, path, ancestors, link) {
15674
+ var _this$options$derefer9, _this$options$derefer0;
15624
15675
  // skip current referencing element as it's already been access
15625
15676
  if (this.indirections.includes(referencingElement)) {
15626
15677
  return false;
@@ -15640,13 +15691,23 @@ class OpenAPI3_1DereferenceVisitor {
15640
15691
  // skip traversing this reference element and all it's child elements
15641
15692
  return false;
15642
15693
  }
15643
- const reference = await this.toReference((0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_9__["default"])(referencingElement.$ref));
15694
+ let reference;
15695
+ try {
15696
+ reference = await this.toReference((0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_9__["default"])(referencingElement.$ref));
15697
+ } catch (error) {
15698
+ return this.handleDereferenceError(error, referencingElement, directAncestors);
15699
+ }
15644
15700
  const $refBaseURI = _util_url_mjs__WEBPACK_IMPORTED_MODULE_21__.resolve(retrievalURI, (0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_9__["default"])(referencingElement.$ref));
15645
15701
  this.indirections.push(referencingElement);
15646
15702
  const jsonPointer = _swagger_api_apidom_json_pointer_modern__WEBPACK_IMPORTED_MODULE_11__.URIFragmentIdentifier.fromURIReference($refBaseURI);
15647
-
15648
- // possibly non-semantic fragment
15649
- let referencedElement = (0,_swagger_api_apidom_json_pointer_modern__WEBPACK_IMPORTED_MODULE_12__.evaluate)(reference.value.result, jsonPointer);
15703
+ let referencedElement;
15704
+ try {
15705
+ // possibly non-semantic fragment
15706
+ referencedElement = (0,_swagger_api_apidom_json_pointer_modern__WEBPACK_IMPORTED_MODULE_12__.evaluate)(reference.value.result, jsonPointer);
15707
+ } catch (error) {
15708
+ this.indirections.pop();
15709
+ return this.handleDereferenceError(error, referencingElement, directAncestors);
15710
+ }
15650
15711
  referencedElement.id = identityManager.identify(referencedElement);
15651
15712
 
15652
15713
  // applying semantics to a fragment
@@ -15670,27 +15731,34 @@ class OpenAPI3_1DereferenceVisitor {
15670
15731
 
15671
15732
  // detect direct or indirect reference
15672
15733
  if (referencingElement === referencedElement) {
15673
- throw new _swagger_api_apidom_error__WEBPACK_IMPORTED_MODULE_10__["default"]('Recursive Reference Object detected');
15734
+ const error = new _swagger_api_apidom_error__WEBPACK_IMPORTED_MODULE_10__["default"]('Recursive Reference Object detected');
15735
+ this.indirections.pop();
15736
+ return this.handleDereferenceError(error, referencingElement, directAncestors);
15674
15737
  }
15675
15738
 
15676
15739
  // detect maximum depth of dereferencing
15677
15740
  if (this.indirections.length > this.options.dereference.maxDepth) {
15678
- throw new _errors_MaximumDereferenceDepthError_mjs__WEBPACK_IMPORTED_MODULE_19__["default"](`Maximum dereference depth of "${this.options.dereference.maxDepth}" has been exceeded in file "${this.reference.uri}"`);
15741
+ const error = new _errors_MaximumDereferenceDepthError_mjs__WEBPACK_IMPORTED_MODULE_19__["default"](`Maximum dereference depth of "${this.options.dereference.maxDepth}" has been exceeded in file "${this.reference.uri}"`);
15742
+ this.indirections.pop();
15743
+ return this.handleDereferenceError(error, referencingElement, directAncestors);
15679
15744
  }
15680
15745
 
15681
15746
  // detect second deep dive into the same fragment and avoid it
15682
15747
  if (ancestorsLineage.includes(referencedElement)) {
15683
15748
  reference.refSet.circular = true;
15684
15749
  if (this.options.dereference.circular === 'error') {
15685
- throw new _swagger_api_apidom_error__WEBPACK_IMPORTED_MODULE_10__["default"]('Circular reference detected');
15686
- } else if (this.options.dereference.circular === 'replace') {
15687
- var _this$options$derefer2, _this$options$derefer3;
15750
+ const error = new _swagger_api_apidom_error__WEBPACK_IMPORTED_MODULE_10__["default"]('Circular reference detected');
15751
+ this.indirections.pop();
15752
+ return this.handleDereferenceError(error, referencingElement, directAncestors);
15753
+ }
15754
+ if (this.options.dereference.circular === 'replace') {
15755
+ var _this$options$derefer7, _this$options$derefer8;
15688
15756
  const refElement = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_4__.RefElement(referencedElement.id, {
15689
15757
  type: 'reference',
15690
15758
  uri: reference.uri,
15691
15759
  $ref: (0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_9__["default"])(referencingElement.$ref)
15692
15760
  });
15693
- const replacer = (_this$options$derefer2 = (_this$options$derefer3 = this.options.dereference.strategyOpts['openapi-3-1']) === null || _this$options$derefer3 === void 0 ? void 0 : _this$options$derefer3.circularReplacer) !== null && _this$options$derefer2 !== void 0 ? _this$options$derefer2 : this.options.dereference.circularReplacer;
15761
+ const replacer = (_this$options$derefer7 = (_this$options$derefer8 = this.options.dereference.strategyOpts['openapi-3-1']) === null || _this$options$derefer8 === void 0 ? void 0 : _this$options$derefer8.circularReplacer) !== null && _this$options$derefer7 !== void 0 ? _this$options$derefer7 : this.options.dereference.circularReplacer;
15694
15762
  const replacement = replacer(refElement);
15695
15763
  link.replaceWith(replacement, mutationReplacer);
15696
15764
  return !parent ? replacement : false;
@@ -15708,22 +15776,27 @@ class OpenAPI3_1DereferenceVisitor {
15708
15776
  */
15709
15777
  const isNonRootDocument = _util_url_mjs__WEBPACK_IMPORTED_MODULE_21__.stripHash(reference.refSet.rootRef.uri) !== reference.uri;
15710
15778
  const shouldDetectCircular = ['error', 'replace'].includes(this.options.dereference.circular);
15711
- if ((isExternalReference || isNonRootDocument || (0,_swagger_api_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_14__.isReferenceElement)(referencedElement) || shouldDetectCircular) && !ancestorsLineage.includesCycle(referencedElement)) {
15779
+ if ((isExternalReference || isNonRootDocument || (0,_swagger_api_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_14__.isReferenceElement)(referencedElement) || shouldDetectCircular || (_this$options$derefer9 = this.options.dereference.dereferenceOpts) !== null && _this$options$derefer9 !== void 0 && _this$options$derefer9.continueOnError) && !ancestorsLineage.includesCycle(referencedElement)) {
15712
15780
  // append referencing reference to ancestors lineage
15713
15781
  directAncestors.add(referencingElement);
15714
15782
  const visitor = new OpenAPI3_1DereferenceVisitor({
15715
15783
  reference,
15716
15784
  namespace: this.namespace,
15717
15785
  indirections: [...this.indirections],
15718
- options: this.options,
15786
+ options: this.getNestedVisitorOptions(referencingElement),
15719
15787
  refractCache: this.refractCache,
15720
15788
  ancestors: ancestorsLineage,
15721
15789
  allOfDiscriminatorMapping: this.allOfDiscriminatorMapping
15722
15790
  });
15723
- referencedElement = await visitAsync(referencedElement, visitor, {
15724
- keyMap: _swagger_api_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_15__.keyMap,
15725
- nodeTypeGetter: _swagger_api_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_15__.getNodeType
15726
- });
15791
+ try {
15792
+ referencedElement = await visitAsync(referencedElement, visitor, {
15793
+ keyMap: _swagger_api_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_15__.keyMap,
15794
+ nodeTypeGetter: _swagger_api_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_15__.getNodeType
15795
+ });
15796
+ } catch (error) {
15797
+ this.indirections.pop();
15798
+ return this.handleDereferenceError(error, referencingElement, directAncestors);
15799
+ }
15727
15800
 
15728
15801
  // remove referencing reference from ancestors lineage
15729
15802
  directAncestors.delete(referencingElement);
@@ -15748,6 +15821,9 @@ class OpenAPI3_1DereferenceVisitor {
15748
15821
  mergedElement.setMetaProperty('ref-origin', reference.uri);
15749
15822
  // annotate fragment with info about referencing element
15750
15823
  mergedElement.setMetaProperty('ref-referencing-element-id', (0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_7__.cloneDeep)(identityManager.identify(referencingElement)));
15824
+ if ((_this$options$derefer0 = this.options.dereference.dereferenceOpts) !== null && _this$options$derefer0 !== void 0 && _this$options$derefer0.continueOnError) {
15825
+ mergedElement.setMetaProperty('ref-referencing-element', referencingElement);
15826
+ }
15751
15827
 
15752
15828
  // override description and summary (outer has higher priority then inner)
15753
15829
  if ((0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_5__.isObjectElement)(referencedElement) && (0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_5__.isObjectElement)(mergedElement)) {
@@ -15772,6 +15848,7 @@ class OpenAPI3_1DereferenceVisitor {
15772
15848
  return !parent ? mergedElement : false;
15773
15849
  }
15774
15850
  async PathItemElement(referencingElement, key, parent, path, ancestors, link) {
15851
+ var _this$options$derefer11;
15775
15852
  // ignore PathItemElement without $ref field
15776
15853
  if (!(0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_5__.isStringElement)(referencingElement.$ref)) {
15777
15854
  return undefined;
@@ -15796,13 +15873,23 @@ class OpenAPI3_1DereferenceVisitor {
15796
15873
  // skip traversing this Path Item element but traverse all it's child elements
15797
15874
  return undefined;
15798
15875
  }
15799
- const reference = await this.toReference((0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_9__["default"])(referencingElement.$ref));
15876
+ let reference;
15877
+ try {
15878
+ reference = await this.toReference((0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_9__["default"])(referencingElement.$ref));
15879
+ } catch (error) {
15880
+ return this.handleDereferenceError(error, referencingElement, directAncestors);
15881
+ }
15800
15882
  const $refBaseURI = _util_url_mjs__WEBPACK_IMPORTED_MODULE_21__.resolve(retrievalURI, (0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_9__["default"])(referencingElement.$ref));
15801
15883
  this.indirections.push(referencingElement);
15802
15884
  const jsonPointer = _swagger_api_apidom_json_pointer_modern__WEBPACK_IMPORTED_MODULE_11__.URIFragmentIdentifier.fromURIReference($refBaseURI);
15803
-
15804
- // possibly non-semantic referenced element
15805
- let referencedElement = (0,_swagger_api_apidom_json_pointer_modern__WEBPACK_IMPORTED_MODULE_12__.evaluate)(reference.value.result, jsonPointer);
15885
+ let referencedElement;
15886
+ try {
15887
+ // possibly non-semantic referenced element
15888
+ referencedElement = (0,_swagger_api_apidom_json_pointer_modern__WEBPACK_IMPORTED_MODULE_12__.evaluate)(reference.value.result, jsonPointer);
15889
+ } catch (error) {
15890
+ this.indirections.pop();
15891
+ return this.handleDereferenceError(error, referencingElement, directAncestors);
15892
+ }
15806
15893
  referencedElement.id = identityManager.identify(referencedElement);
15807
15894
 
15808
15895
  /**
@@ -15820,27 +15907,34 @@ class OpenAPI3_1DereferenceVisitor {
15820
15907
 
15821
15908
  // detect direct or indirect reference
15822
15909
  if (referencingElement === referencedElement) {
15823
- throw new _swagger_api_apidom_error__WEBPACK_IMPORTED_MODULE_10__["default"]('Recursive Path Item Object reference detected');
15910
+ const error = new _swagger_api_apidom_error__WEBPACK_IMPORTED_MODULE_10__["default"]('Recursive Path Item Object reference detected');
15911
+ this.indirections.pop();
15912
+ return this.handleDereferenceError(error, referencingElement, directAncestors);
15824
15913
  }
15825
15914
 
15826
15915
  // detect maximum depth of dereferencing
15827
15916
  if (this.indirections.length > this.options.dereference.maxDepth) {
15828
- throw new _errors_MaximumDereferenceDepthError_mjs__WEBPACK_IMPORTED_MODULE_19__["default"](`Maximum dereference depth of "${this.options.dereference.maxDepth}" has been exceeded in file "${this.reference.uri}"`);
15917
+ const error = new _errors_MaximumDereferenceDepthError_mjs__WEBPACK_IMPORTED_MODULE_19__["default"](`Maximum dereference depth of "${this.options.dereference.maxDepth}" has been exceeded in file "${this.reference.uri}"`);
15918
+ this.indirections.pop();
15919
+ return this.handleDereferenceError(error, referencingElement, directAncestors);
15829
15920
  }
15830
15921
 
15831
15922
  // detect second deep dive into the same fragment and avoid it
15832
15923
  if (ancestorsLineage.includes(referencedElement)) {
15833
15924
  reference.refSet.circular = true;
15834
15925
  if (this.options.dereference.circular === 'error') {
15835
- throw new _swagger_api_apidom_error__WEBPACK_IMPORTED_MODULE_10__["default"]('Circular reference detected');
15836
- } else if (this.options.dereference.circular === 'replace') {
15837
- var _this$options$derefer4, _this$options$derefer5;
15926
+ const error = new _swagger_api_apidom_error__WEBPACK_IMPORTED_MODULE_10__["default"]('Circular reference detected');
15927
+ this.indirections.pop();
15928
+ return this.handleDereferenceError(error, referencingElement, directAncestors);
15929
+ }
15930
+ if (this.options.dereference.circular === 'replace') {
15931
+ var _this$options$derefer1, _this$options$derefer10;
15838
15932
  const refElement = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_4__.RefElement(referencedElement.id, {
15839
15933
  type: 'path-item',
15840
15934
  uri: reference.uri,
15841
15935
  $ref: (0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_9__["default"])(referencingElement.$ref)
15842
15936
  });
15843
- const replacer = (_this$options$derefer4 = (_this$options$derefer5 = this.options.dereference.strategyOpts['openapi-3-1']) === null || _this$options$derefer5 === void 0 ? void 0 : _this$options$derefer5.circularReplacer) !== null && _this$options$derefer4 !== void 0 ? _this$options$derefer4 : this.options.dereference.circularReplacer;
15937
+ const replacer = (_this$options$derefer1 = (_this$options$derefer10 = this.options.dereference.strategyOpts['openapi-3-1']) === null || _this$options$derefer10 === void 0 ? void 0 : _this$options$derefer10.circularReplacer) !== null && _this$options$derefer1 !== void 0 ? _this$options$derefer1 : this.options.dereference.circularReplacer;
15844
15938
  const replacement = replacer(refElement);
15845
15939
  link.replaceWith(replacement, mutationReplacer);
15846
15940
  return !parent ? replacement : false;
@@ -15858,22 +15952,27 @@ class OpenAPI3_1DereferenceVisitor {
15858
15952
  */
15859
15953
  const isNonRootDocument = _util_url_mjs__WEBPACK_IMPORTED_MODULE_21__.stripHash(reference.refSet.rootRef.uri) !== reference.uri;
15860
15954
  const shouldDetectCircular = ['error', 'replace'].includes(this.options.dereference.circular);
15861
- if ((isExternalReference || isNonRootDocument || (0,_swagger_api_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_14__.isPathItemElement)(referencedElement) && (0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_5__.isStringElement)(referencedElement.$ref) || shouldDetectCircular) && !ancestorsLineage.includesCycle(referencedElement)) {
15955
+ if ((isExternalReference || isNonRootDocument || (0,_swagger_api_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_14__.isPathItemElement)(referencedElement) && (0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_5__.isStringElement)(referencedElement.$ref) || shouldDetectCircular || (_this$options$derefer11 = this.options.dereference.dereferenceOpts) !== null && _this$options$derefer11 !== void 0 && _this$options$derefer11.continueOnError) && !ancestorsLineage.includesCycle(referencedElement)) {
15862
15956
  // append referencing reference to ancestors lineage
15863
15957
  directAncestors.add(referencingElement);
15864
15958
  const visitor = new OpenAPI3_1DereferenceVisitor({
15865
15959
  reference,
15866
15960
  namespace: this.namespace,
15867
15961
  indirections: [...this.indirections],
15868
- options: this.options,
15962
+ options: this.getNestedVisitorOptions(referencingElement),
15869
15963
  refractCache: this.refractCache,
15870
15964
  ancestors: ancestorsLineage,
15871
15965
  allOfDiscriminatorMapping: this.allOfDiscriminatorMapping
15872
15966
  });
15873
- referencedElement = await visitAsync(referencedElement, visitor, {
15874
- keyMap: _swagger_api_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_15__.keyMap,
15875
- nodeTypeGetter: _swagger_api_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_15__.getNodeType
15876
- });
15967
+ try {
15968
+ referencedElement = await visitAsync(referencedElement, visitor, {
15969
+ keyMap: _swagger_api_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_15__.keyMap,
15970
+ nodeTypeGetter: _swagger_api_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_15__.getNodeType
15971
+ });
15972
+ } catch (error) {
15973
+ this.indirections.pop();
15974
+ return this.handleDereferenceError(error, referencingElement, directAncestors);
15975
+ }
15877
15976
 
15878
15977
  // remove referencing reference from ancestors lineage
15879
15978
  directAncestors.delete(referencingElement);
@@ -15884,6 +15983,7 @@ class OpenAPI3_1DereferenceVisitor {
15884
15983
  * Creating a new version of Path Item by merging fields from referenced Path Item with referencing one.
15885
15984
  */
15886
15985
  if ((0,_swagger_api_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_14__.isPathItemElement)(referencedElement)) {
15986
+ var _this$options$derefer12;
15887
15987
  const mergedElement = new _swagger_api_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_16__.PathItemElement([...referencedElement.content], (0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_7__.cloneDeep)(referencedElement.meta), (0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_7__.cloneDeep)(referencedElement.attributes));
15888
15988
  // assign unique id to merged element
15889
15989
  mergedElement.setMetaProperty('id', identityManager.generateId());
@@ -15902,6 +16002,9 @@ class OpenAPI3_1DereferenceVisitor {
15902
16002
  mergedElement.setMetaProperty('ref-origin', reference.uri);
15903
16003
  // annotate fragment with info about referencing element
15904
16004
  mergedElement.setMetaProperty('ref-referencing-element-id', (0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_7__.cloneDeep)(identityManager.identify(referencingElement)));
16005
+ if ((_this$options$derefer12 = this.options.dereference.dereferenceOpts) !== null && _this$options$derefer12 !== void 0 && _this$options$derefer12.continueOnError) {
16006
+ mergedElement.setMetaProperty('ref-referencing-element', referencingElement);
16007
+ }
15905
16008
  referencedElement = mergedElement;
15906
16009
  }
15907
16010
 
@@ -15923,7 +16026,8 @@ class OpenAPI3_1DereferenceVisitor {
15923
16026
 
15924
16027
  // operationRef and operationId fields are mutually exclusive
15925
16028
  if ((0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_5__.isStringElement)(linkElement.operationRef) && (0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_5__.isStringElement)(linkElement.operationId)) {
15926
- throw new _swagger_api_apidom_error__WEBPACK_IMPORTED_MODULE_10__["default"]('LinkElement operationRef and operationId fields are mutually exclusive.');
16029
+ const error = new _swagger_api_apidom_error__WEBPACK_IMPORTED_MODULE_10__["default"]('LinkElement operationRef and operationId fields are mutually exclusive.');
16030
+ return this.handleDereferenceError(error, linkElement);
15927
16031
  }
15928
16032
  let operationElement;
15929
16033
  if ((0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_5__.isStringElement)(linkElement.operationRef)) {
@@ -15944,8 +16048,14 @@ class OpenAPI3_1DereferenceVisitor {
15944
16048
  // skip traversing this Link element but traverse all it's child elements
15945
16049
  return undefined;
15946
16050
  }
15947
- const reference = await this.toReference((0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_9__["default"])(linkElement.operationRef));
15948
- operationElement = (0,_swagger_api_apidom_json_pointer_modern__WEBPACK_IMPORTED_MODULE_12__.evaluate)(reference.value.result, jsonPointer);
16051
+ let reference;
16052
+ try {
16053
+ reference = await this.toReference((0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_9__["default"])(linkElement.operationRef));
16054
+ operationElement = (0,_swagger_api_apidom_json_pointer_modern__WEBPACK_IMPORTED_MODULE_12__.evaluate)(reference.value.result, jsonPointer);
16055
+ } catch (error) {
16056
+ return this.handleDereferenceError(error, linkElement);
16057
+ }
16058
+
15949
16059
  // applying semantics to a referenced element
15950
16060
  if ((0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_5__.isPrimitiveElement)(operationElement)) {
15951
16061
  const cacheKey = `operation-${(0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_9__["default"])(identityManager.identify(operationElement))}`;
@@ -15976,11 +16086,17 @@ class OpenAPI3_1DereferenceVisitor {
15976
16086
  if ((0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_5__.isStringElement)(linkElement.operationId)) {
15977
16087
  var _linkElementCopy$oper2;
15978
16088
  const operationId = (0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_9__["default"])(linkElement.operationId);
15979
- const reference = await this.toReference(_util_url_mjs__WEBPACK_IMPORTED_MODULE_21__.unsanitize(this.reference.uri));
16089
+ let reference;
16090
+ try {
16091
+ reference = await this.toReference(_util_url_mjs__WEBPACK_IMPORTED_MODULE_21__.unsanitize(this.reference.uri));
16092
+ } catch (error) {
16093
+ return this.handleDereferenceError(error, linkElement);
16094
+ }
15980
16095
  operationElement = (0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_3__["default"])(e => (0,_swagger_api_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_14__.isOperationElement)(e) && (0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_5__.isElement)(e.operationId) && e.operationId.equals(operationId), reference.value.result);
15981
16096
  // OperationElement not found by its operationId
15982
16097
  if ((0,ramda_adjunct__WEBPACK_IMPORTED_MODULE_2__["default"])(operationElement)) {
15983
- throw new _swagger_api_apidom_error__WEBPACK_IMPORTED_MODULE_10__["default"](`OperationElement(operationId=${operationId}) not found.`);
16098
+ const error = new _swagger_api_apidom_error__WEBPACK_IMPORTED_MODULE_10__["default"](`OperationElement(operationId=${operationId}) not found.`);
16099
+ return this.handleDereferenceError(error, linkElement);
15984
16100
  }
15985
16101
  const linkElementCopy = (0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_7__.cloneShallow)(linkElement);
15986
16102
  (_linkElementCopy$oper2 = linkElementCopy.operationId) === null || _linkElementCopy$oper2 === void 0 || _linkElementCopy$oper2.meta.set('operation', operationElement);
@@ -16005,7 +16121,8 @@ class OpenAPI3_1DereferenceVisitor {
16005
16121
 
16006
16122
  // value and externalValue fields are mutually exclusive
16007
16123
  if (exampleElement.hasKey('value') && (0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_5__.isStringElement)(exampleElement.externalValue)) {
16008
- throw new _swagger_api_apidom_error__WEBPACK_IMPORTED_MODULE_10__["default"]('ExampleElement value and externalValue fields are mutually exclusive.');
16124
+ const error = new _swagger_api_apidom_error__WEBPACK_IMPORTED_MODULE_10__["default"]('ExampleElement value and externalValue fields are mutually exclusive.');
16125
+ return this.handleDereferenceError(error, exampleElement);
16009
16126
  }
16010
16127
  const retrievalURI = this.toBaseURI((0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_9__["default"])(exampleElement.externalValue));
16011
16128
  const isInternalReference = _util_url_mjs__WEBPACK_IMPORTED_MODULE_21__.stripHash(this.reference.uri) === retrievalURI;
@@ -16021,7 +16138,12 @@ class OpenAPI3_1DereferenceVisitor {
16021
16138
  // skip traversing this Example element but traverse all it's child elements
16022
16139
  return undefined;
16023
16140
  }
16024
- const reference = await this.toReference((0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_9__["default"])(exampleElement.externalValue));
16141
+ let reference;
16142
+ try {
16143
+ reference = await this.toReference((0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_9__["default"])(exampleElement.externalValue));
16144
+ } catch (error) {
16145
+ return this.handleDereferenceError(error, exampleElement);
16146
+ }
16025
16147
 
16026
16148
  // shallow clone of the referenced element
16027
16149
  const valueElement = (0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_7__.cloneShallow)(reference.value.result);
@@ -16041,7 +16163,7 @@ class OpenAPI3_1DereferenceVisitor {
16041
16163
  return !parent ? exampleElementCopy : undefined;
16042
16164
  }
16043
16165
  async MemberElement(memberElement, key, parent, path, ancestors, link) {
16044
- var _this$options$derefer6;
16166
+ var _this$options$derefer13;
16045
16167
  const parentElement = ancestors[ancestors.length - 1];
16046
16168
 
16047
16169
  // skip current MemberElement if its parent is not a DiscriminatorElement
@@ -16050,7 +16172,7 @@ class OpenAPI3_1DereferenceVisitor {
16050
16172
  }
16051
16173
 
16052
16174
  // skip current MemberElement if discriminator mapping dereferencing option is not enabled
16053
- if (!((_this$options$derefer6 = this.options.dereference.strategyOpts['openapi-3-1']) !== null && _this$options$derefer6 !== void 0 && _this$options$derefer6.dereferenceDiscriminatorMapping)) {
16175
+ if (!((_this$options$derefer13 = this.options.dereference.strategyOpts['openapi-3-1']) !== null && _this$options$derefer13 !== void 0 && _this$options$derefer13.dereferenceDiscriminatorMapping)) {
16054
16176
  return false;
16055
16177
  }
16056
16178
 
@@ -16085,15 +16207,20 @@ class OpenAPI3_1DereferenceVisitor {
16085
16207
  reference: this.reference,
16086
16208
  namespace: this.namespace,
16087
16209
  indirections: [...this.indirections],
16088
- options: this.options,
16210
+ options: this.getNestedVisitorOptions(schemaElement),
16089
16211
  refractCache: this.refractCache,
16090
16212
  ancestors: ancestorsLineage,
16091
16213
  allOfDiscriminatorMapping: this.allOfDiscriminatorMapping
16092
16214
  });
16093
- const referencedElement = await visitAsync(schemaElement, visitor, {
16094
- keyMap: _swagger_api_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_15__.keyMap,
16095
- nodeTypeGetter: _swagger_api_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_15__.getNodeType
16096
- });
16215
+ let referencedElement;
16216
+ try {
16217
+ referencedElement = await visitAsync(schemaElement, visitor, {
16218
+ keyMap: _swagger_api_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_15__.keyMap,
16219
+ nodeTypeGetter: _swagger_api_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_15__.getNodeType
16220
+ });
16221
+ } catch (error) {
16222
+ return this.handleDereferenceError(error, schemaElement, directAncestors);
16223
+ }
16097
16224
 
16098
16225
  // remove referencing reference from ancestors lineage
16099
16226
  directAncestors.delete(schemaElement);
@@ -16114,6 +16241,7 @@ class OpenAPI3_1DereferenceVisitor {
16114
16241
  return !parent ? memberElementCopy : undefined;
16115
16242
  }
16116
16243
  async SchemaElement(referencingElement, key, parent, path, ancestors, link) {
16244
+ var _this$options$derefer16;
16117
16245
  // skip current referencing schema as $ref keyword was not defined
16118
16246
  if (!(0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_5__.isStringElement)(referencingElement.$ref)) {
16119
16247
  return undefined;
@@ -16126,7 +16254,12 @@ class OpenAPI3_1DereferenceVisitor {
16126
16254
  const [ancestorsLineage, directAncestors] = this.toAncestorLineage([...ancestors, parent]);
16127
16255
 
16128
16256
  // compute baseURI using rules around $id and $ref keywords
16129
- let reference = await this.toReference(_util_url_mjs__WEBPACK_IMPORTED_MODULE_21__.unsanitize(this.reference.uri));
16257
+ let reference;
16258
+ try {
16259
+ reference = await this.toReference(_util_url_mjs__WEBPACK_IMPORTED_MODULE_21__.unsanitize(this.reference.uri));
16260
+ } catch (error) {
16261
+ return this.handleDereferenceError(error, referencingElement, directAncestors);
16262
+ }
16130
16263
  let {
16131
16264
  uri: retrievalURI
16132
16265
  } = reference;
@@ -16207,10 +16340,20 @@ class OpenAPI3_1DereferenceVisitor {
16207
16340
  // skip traversing this schema element but traverse all it's child elements
16208
16341
  return undefined;
16209
16342
  }
16210
- reference = await this.toReference(_util_url_mjs__WEBPACK_IMPORTED_MODULE_21__.unsanitize($refBaseURI));
16343
+ try {
16344
+ reference = await this.toReference(_util_url_mjs__WEBPACK_IMPORTED_MODULE_21__.unsanitize($refBaseURI));
16345
+ } catch (toReferenceError) {
16346
+ this.indirections.pop();
16347
+ return this.handleDereferenceError(toReferenceError, referencingElement, directAncestors);
16348
+ }
16211
16349
  const selector = (0,_selectors_$anchor_mjs__WEBPACK_IMPORTED_MODULE_17__.uriToAnchor)($refBaseURI);
16212
16350
  const referenceAsSchema = (0,_util_mjs__WEBPACK_IMPORTED_MODULE_25__.maybeRefractToSchemaElement)(reference.value.result);
16213
- referencedElement = (0,_selectors_$anchor_mjs__WEBPACK_IMPORTED_MODULE_17__.evaluate)(selector, referenceAsSchema);
16351
+ try {
16352
+ referencedElement = (0,_selectors_$anchor_mjs__WEBPACK_IMPORTED_MODULE_17__.evaluate)(selector, referenceAsSchema);
16353
+ } catch (evaluateError) {
16354
+ this.indirections.pop();
16355
+ return this.handleDereferenceError(evaluateError, referencingElement, directAncestors);
16356
+ }
16214
16357
  referencedElement = (0,_util_mjs__WEBPACK_IMPORTED_MODULE_25__.maybeRefractToSchemaElement)(referencedElement);
16215
16358
  referencedElement.id = identityManager.identify(referencedElement);
16216
16359
  } else {
@@ -16229,41 +16372,59 @@ class OpenAPI3_1DereferenceVisitor {
16229
16372
  // skip traversing this schema element but traverse all it's child elements
16230
16373
  return undefined;
16231
16374
  }
16232
- reference = await this.toReference(_util_url_mjs__WEBPACK_IMPORTED_MODULE_21__.unsanitize($refBaseURI));
16375
+ try {
16376
+ reference = await this.toReference(_util_url_mjs__WEBPACK_IMPORTED_MODULE_21__.unsanitize($refBaseURI));
16377
+ } catch (toReferenceError) {
16378
+ this.indirections.pop();
16379
+ return this.handleDereferenceError(toReferenceError, referencingElement, directAncestors);
16380
+ }
16233
16381
  const selector = _swagger_api_apidom_json_pointer_modern__WEBPACK_IMPORTED_MODULE_11__.URIFragmentIdentifier.fromURIReference($refBaseURI);
16234
16382
  const referenceAsSchema = (0,_util_mjs__WEBPACK_IMPORTED_MODULE_25__.maybeRefractToSchemaElement)(reference.value.result);
16235
- referencedElement = (0,_swagger_api_apidom_json_pointer_modern__WEBPACK_IMPORTED_MODULE_12__.evaluate)(referenceAsSchema, selector);
16383
+ try {
16384
+ referencedElement = (0,_swagger_api_apidom_json_pointer_modern__WEBPACK_IMPORTED_MODULE_12__.evaluate)(referenceAsSchema, selector);
16385
+ } catch (evaluateError) {
16386
+ this.indirections.pop();
16387
+ return this.handleDereferenceError(evaluateError, referencingElement, directAncestors);
16388
+ }
16236
16389
  referencedElement = (0,_util_mjs__WEBPACK_IMPORTED_MODULE_25__.maybeRefractToSchemaElement)(referencedElement);
16237
16390
  referencedElement.id = identityManager.identify(referencedElement);
16238
16391
  }
16239
16392
  } else {
16240
- throw error;
16393
+ this.indirections.pop();
16394
+ return this.handleDereferenceError(error, referencingElement, directAncestors);
16241
16395
  }
16242
16396
  }
16243
16397
 
16244
16398
  // detect direct or indirect reference
16245
16399
  if (referencingElement === referencedElement) {
16246
- throw new _swagger_api_apidom_error__WEBPACK_IMPORTED_MODULE_10__["default"]('Recursive Schema Object reference detected');
16400
+ const error = new _swagger_api_apidom_error__WEBPACK_IMPORTED_MODULE_10__["default"]('Recursive Schema Object reference detected');
16401
+ this.indirections.pop();
16402
+ return this.handleDereferenceError(error, referencingElement, directAncestors);
16247
16403
  }
16248
16404
 
16249
16405
  // detect maximum depth of dereferencing
16250
16406
  if (this.indirections.length > this.options.dereference.maxDepth) {
16251
- throw new _errors_MaximumDereferenceDepthError_mjs__WEBPACK_IMPORTED_MODULE_19__["default"](`Maximum dereference depth of "${this.options.dereference.maxDepth}" has been exceeded in file "${this.reference.uri}"`);
16407
+ const error = new _errors_MaximumDereferenceDepthError_mjs__WEBPACK_IMPORTED_MODULE_19__["default"](`Maximum dereference depth of "${this.options.dereference.maxDepth}" has been exceeded in file "${this.reference.uri}"`);
16408
+ this.indirections.pop();
16409
+ return this.handleDereferenceError(error, referencingElement, directAncestors);
16252
16410
  }
16253
16411
 
16254
16412
  // detect second deep dive into the same fragment and avoid it
16255
16413
  if (ancestorsLineage.includes(referencedElement)) {
16256
16414
  reference.refSet.circular = true;
16257
16415
  if (this.options.dereference.circular === 'error') {
16258
- throw new _swagger_api_apidom_error__WEBPACK_IMPORTED_MODULE_10__["default"]('Circular reference detected');
16259
- } else if (this.options.dereference.circular === 'replace') {
16260
- var _this$options$derefer7, _this$options$derefer8;
16416
+ const error = new _swagger_api_apidom_error__WEBPACK_IMPORTED_MODULE_10__["default"]('Circular reference detected');
16417
+ this.indirections.pop();
16418
+ return this.handleDereferenceError(error, referencingElement, directAncestors);
16419
+ }
16420
+ if (this.options.dereference.circular === 'replace') {
16421
+ var _this$options$derefer14, _this$options$derefer15;
16261
16422
  const refElement = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_4__.RefElement(referencedElement.id, {
16262
16423
  type: 'json-schema',
16263
16424
  uri: reference.uri,
16264
16425
  $ref: (0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_9__["default"])(referencingElement.$ref)
16265
16426
  });
16266
- const replacer = (_this$options$derefer7 = (_this$options$derefer8 = this.options.dereference.strategyOpts['openapi-3-1']) === null || _this$options$derefer8 === void 0 ? void 0 : _this$options$derefer8.circularReplacer) !== null && _this$options$derefer7 !== void 0 ? _this$options$derefer7 : this.options.dereference.circularReplacer;
16427
+ const replacer = (_this$options$derefer14 = (_this$options$derefer15 = this.options.dereference.strategyOpts['openapi-3-1']) === null || _this$options$derefer15 === void 0 ? void 0 : _this$options$derefer15.circularReplacer) !== null && _this$options$derefer14 !== void 0 ? _this$options$derefer14 : this.options.dereference.circularReplacer;
16267
16428
  const replacement = replacer(refElement);
16268
16429
  link.replaceWith(replacement, mutationReplacer);
16269
16430
  return !parent ? replacement : false;
@@ -16281,22 +16442,27 @@ class OpenAPI3_1DereferenceVisitor {
16281
16442
  */
16282
16443
  const isNonRootDocument = _util_url_mjs__WEBPACK_IMPORTED_MODULE_21__.stripHash(reference.refSet.rootRef.uri) !== reference.uri;
16283
16444
  const shouldDetectCircular = ['error', 'replace'].includes(this.options.dereference.circular);
16284
- if ((isExternalReference || isNonRootDocument || (0,_swagger_api_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_14__.isSchemaElement)(referencedElement) && (0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_5__.isStringElement)(referencedElement.$ref) || shouldDetectCircular) && !ancestorsLineage.includesCycle(referencedElement)) {
16445
+ if ((isExternalReference || isNonRootDocument || (0,_swagger_api_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_14__.isSchemaElement)(referencedElement) && (0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_5__.isStringElement)(referencedElement.$ref) || shouldDetectCircular || (_this$options$derefer16 = this.options.dereference.dereferenceOpts) !== null && _this$options$derefer16 !== void 0 && _this$options$derefer16.continueOnError) && !ancestorsLineage.includesCycle(referencedElement)) {
16285
16446
  // append referencing reference to ancestors lineage
16286
16447
  directAncestors.add(referencingElement);
16287
16448
  const visitor = new OpenAPI3_1DereferenceVisitor({
16288
16449
  reference,
16289
16450
  namespace: this.namespace,
16290
16451
  indirections: [...this.indirections],
16291
- options: this.options,
16452
+ options: this.getNestedVisitorOptions(referencingElement),
16292
16453
  refractCache: this.refractCache,
16293
16454
  ancestors: ancestorsLineage,
16294
16455
  allOfDiscriminatorMapping: this.allOfDiscriminatorMapping
16295
16456
  });
16296
- referencedElement = await visitAsync(referencedElement, visitor, {
16297
- keyMap: _swagger_api_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_15__.keyMap,
16298
- nodeTypeGetter: _swagger_api_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_15__.getNodeType
16299
- });
16457
+ try {
16458
+ referencedElement = await visitAsync(referencedElement, visitor, {
16459
+ keyMap: _swagger_api_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_15__.keyMap,
16460
+ nodeTypeGetter: _swagger_api_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_15__.getNodeType
16461
+ });
16462
+ } catch (error) {
16463
+ this.indirections.pop();
16464
+ return this.handleDereferenceError(error, referencingElement, directAncestors);
16465
+ }
16300
16466
 
16301
16467
  // remove referencing reference from ancestors lineage
16302
16468
  directAncestors.delete(referencingElement);
@@ -16325,7 +16491,7 @@ class OpenAPI3_1DereferenceVisitor {
16325
16491
  * Creating a new version of Schema Object by merging fields from referenced Schema Object with referencing one.
16326
16492
  */
16327
16493
  if ((0,_swagger_api_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_14__.isSchemaElement)(referencedElement)) {
16328
- var _this$options$derefer9;
16494
+ var _this$options$derefer17, _this$options$derefer18;
16329
16495
  const mergedElement = new _swagger_api_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_16__.SchemaElement([...referencedElement.content], (0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_7__.cloneDeep)(referencedElement.meta), (0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_7__.cloneDeep)(referencedElement.attributes));
16330
16496
  // assign unique id to merged element
16331
16497
  mergedElement.setMetaProperty('id', identityManager.generateId());
@@ -16344,9 +16510,12 @@ class OpenAPI3_1DereferenceVisitor {
16344
16510
  mergedElement.setMetaProperty('ref-origin', reference.uri);
16345
16511
  // annotate fragment with info about referencing element
16346
16512
  mergedElement.setMetaProperty('ref-referencing-element-id', (0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_7__.cloneDeep)(identityManager.identify(referencingElement)));
16513
+ if ((_this$options$derefer17 = this.options.dereference.dereferenceOpts) !== null && _this$options$derefer17 !== void 0 && _this$options$derefer17.continueOnError) {
16514
+ mergedElement.setMetaProperty('ref-referencing-element', referencingElement);
16515
+ }
16347
16516
 
16348
16517
  // creating mapping for allOf discriminator
16349
- if ((_this$options$derefer9 = this.options.dereference.strategyOpts['openapi-3-1']) !== null && _this$options$derefer9 !== void 0 && _this$options$derefer9.dereferenceDiscriminatorMapping) {
16518
+ if ((_this$options$derefer18 = this.options.dereference.strategyOpts['openapi-3-1']) !== null && _this$options$derefer18 !== void 0 && _this$options$derefer18.dereferenceDiscriminatorMapping) {
16350
16519
  var _parentElement$classe;
16351
16520
  const parentElement = ancestors[ancestors.length - 1];
16352
16521
  const parentSchemaElement = [...directAncestors].findLast(_swagger_api_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_14__.isSchemaElement);
@@ -16538,7 +16707,7 @@ __webpack_require__.r(__webpack_exports__);
16538
16707
  /* harmony export */ Schema: () => (/* binding */ Schema),
16539
16708
  /* harmony export */ Type: () => (/* binding */ Type),
16540
16709
  /* harmony export */ YAMLException: () => (/* binding */ YAMLException),
16541
- /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__),
16710
+ /* harmony export */ "default": () => (/* binding */ jsYaml),
16542
16711
  /* harmony export */ dump: () => (/* binding */ dump),
16543
16712
  /* harmony export */ load: () => (/* binding */ load),
16544
16713
  /* harmony export */ loadAll: () => (/* binding */ loadAll),
@@ -16548,7 +16717,7 @@ __webpack_require__.r(__webpack_exports__);
16548
16717
  /* harmony export */ types: () => (/* binding */ types)
16549
16718
  /* harmony export */ });
16550
16719
 
16551
- /*! js-yaml 4.1.0 https://github.com/nodeca/js-yaml @license MIT */
16720
+ /*! js-yaml 4.1.1 https://github.com/nodeca/js-yaml @license MIT */
16552
16721
  function isNothing(subject) {
16553
16722
  return (typeof subject === 'undefined') || (subject === null);
16554
16723
  }
@@ -17759,6 +17928,22 @@ function charFromCodepoint(c) {
17759
17928
  );
17760
17929
  }
17761
17930
 
17931
+ // set a property of a literal object, while protecting against prototype pollution,
17932
+ // see https://github.com/nodeca/js-yaml/issues/164 for more details
17933
+ function setProperty(object, key, value) {
17934
+ // used for this specific key only because Object.defineProperty is slow
17935
+ if (key === '__proto__') {
17936
+ Object.defineProperty(object, key, {
17937
+ configurable: true,
17938
+ enumerable: true,
17939
+ writable: true,
17940
+ value: value
17941
+ });
17942
+ } else {
17943
+ object[key] = value;
17944
+ }
17945
+ }
17946
+
17762
17947
  var simpleEscapeCheck = new Array(256); // integer, for fast access
17763
17948
  var simpleEscapeMap = new Array(256);
17764
17949
  for (var i = 0; i < 256; i++) {
@@ -17937,7 +18122,7 @@ function mergeMappings(state, destination, source, overridableKeys) {
17937
18122
  key = sourceKeys[index];
17938
18123
 
17939
18124
  if (!_hasOwnProperty$1.call(destination, key)) {
17940
- destination[key] = source[key];
18125
+ setProperty(destination, key, source[key]);
17941
18126
  overridableKeys[key] = true;
17942
18127
  }
17943
18128
  }
@@ -17997,17 +18182,7 @@ function storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valu
17997
18182
  throwError(state, 'duplicated mapping key');
17998
18183
  }
17999
18184
 
18000
- // used for this specific key only because Object.defineProperty is slow
18001
- if (keyNode === '__proto__') {
18002
- Object.defineProperty(_result, keyNode, {
18003
- configurable: true,
18004
- enumerable: true,
18005
- writable: true,
18006
- value: valueNode
18007
- });
18008
- } else {
18009
- _result[keyNode] = valueNode;
18010
- }
18185
+ setProperty(_result, keyNode, valueNode);
18011
18186
  delete overridableKeys[keyNode];
18012
18187
  }
18013
18188
 
@@ -20396,7 +20571,6 @@ var jsYaml = {
20396
20571
  safeDump: safeDump
20397
20572
  };
20398
20573
 
20399
- /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (jsYaml);
20400
20574
 
20401
20575
 
20402
20576
 
@@ -23333,7 +23507,6 @@ __webpack_require__.r(__webpack_exports__);
23333
23507
  /* harmony export */ isParseResultElement: () => (/* binding */ isParseResultElement),
23334
23508
  /* harmony export */ isPrimitiveElement: () => (/* binding */ isPrimitiveElement),
23335
23509
  /* harmony export */ isRefElement: () => (/* binding */ isRefElement),
23336
- /* harmony export */ isSourceMapElement: () => (/* binding */ isSourceMapElement),
23337
23510
  /* harmony export */ isStringElement: () => (/* binding */ isStringElement)
23338
23511
  /* harmony export */ });
23339
23512
  /* harmony import */ var minim__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(34035);
@@ -23342,9 +23515,7 @@ __webpack_require__.r(__webpack_exports__);
23342
23515
  /* harmony import */ var _elements_Annotation_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(5443);
23343
23516
  /* harmony import */ var _elements_Comment_mjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(6127);
23344
23517
  /* harmony import */ var _elements_ParseResult_mjs__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(59110);
23345
- /* harmony import */ var _elements_SourceMap_mjs__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(36863);
23346
- /* harmony import */ var _helpers_mjs__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(46902);
23347
-
23518
+ /* harmony import */ var _helpers_mjs__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(46902);
23348
23519
 
23349
23520
 
23350
23521
 
@@ -23355,7 +23526,7 @@ __webpack_require__.r(__webpack_exports__);
23355
23526
  /**
23356
23527
  * @public
23357
23528
  */
23358
- const isElement = (0,_helpers_mjs__WEBPACK_IMPORTED_MODULE_7__["default"])(({
23529
+ const isElement = (0,_helpers_mjs__WEBPACK_IMPORTED_MODULE_6__["default"])(({
23359
23530
  hasBasicElementProps,
23360
23531
  primitiveEq
23361
23532
  }) => {
@@ -23365,7 +23536,7 @@ const isElement = (0,_helpers_mjs__WEBPACK_IMPORTED_MODULE_7__["default"])(({
23365
23536
  /**
23366
23537
  * @public
23367
23538
  */
23368
- const isStringElement = (0,_helpers_mjs__WEBPACK_IMPORTED_MODULE_7__["default"])(({
23539
+ const isStringElement = (0,_helpers_mjs__WEBPACK_IMPORTED_MODULE_6__["default"])(({
23369
23540
  hasBasicElementProps,
23370
23541
  primitiveEq
23371
23542
  }) => {
@@ -23375,7 +23546,7 @@ const isStringElement = (0,_helpers_mjs__WEBPACK_IMPORTED_MODULE_7__["default"])
23375
23546
  /**
23376
23547
  * @public
23377
23548
  */
23378
- const isNumberElement = (0,_helpers_mjs__WEBPACK_IMPORTED_MODULE_7__["default"])(({
23549
+ const isNumberElement = (0,_helpers_mjs__WEBPACK_IMPORTED_MODULE_6__["default"])(({
23379
23550
  hasBasicElementProps,
23380
23551
  primitiveEq
23381
23552
  }) => {
@@ -23385,7 +23556,7 @@ const isNumberElement = (0,_helpers_mjs__WEBPACK_IMPORTED_MODULE_7__["default"])
23385
23556
  /**
23386
23557
  * @public
23387
23558
  */
23388
- const isNullElement = (0,_helpers_mjs__WEBPACK_IMPORTED_MODULE_7__["default"])(({
23559
+ const isNullElement = (0,_helpers_mjs__WEBPACK_IMPORTED_MODULE_6__["default"])(({
23389
23560
  hasBasicElementProps,
23390
23561
  primitiveEq
23391
23562
  }) => {
@@ -23395,7 +23566,7 @@ const isNullElement = (0,_helpers_mjs__WEBPACK_IMPORTED_MODULE_7__["default"])((
23395
23566
  /**
23396
23567
  * @public
23397
23568
  */
23398
- const isBooleanElement = (0,_helpers_mjs__WEBPACK_IMPORTED_MODULE_7__["default"])(({
23569
+ const isBooleanElement = (0,_helpers_mjs__WEBPACK_IMPORTED_MODULE_6__["default"])(({
23399
23570
  hasBasicElementProps,
23400
23571
  primitiveEq
23401
23572
  }) => {
@@ -23405,7 +23576,7 @@ const isBooleanElement = (0,_helpers_mjs__WEBPACK_IMPORTED_MODULE_7__["default"]
23405
23576
  /**
23406
23577
  * @public
23407
23578
  */
23408
- const isObjectElement = (0,_helpers_mjs__WEBPACK_IMPORTED_MODULE_7__["default"])(({
23579
+ const isObjectElement = (0,_helpers_mjs__WEBPACK_IMPORTED_MODULE_6__["default"])(({
23409
23580
  hasBasicElementProps,
23410
23581
  primitiveEq,
23411
23582
  hasMethod
@@ -23416,7 +23587,7 @@ const isObjectElement = (0,_helpers_mjs__WEBPACK_IMPORTED_MODULE_7__["default"])
23416
23587
  /**
23417
23588
  * @public
23418
23589
  */
23419
- const isArrayElement = (0,_helpers_mjs__WEBPACK_IMPORTED_MODULE_7__["default"])(({
23590
+ const isArrayElement = (0,_helpers_mjs__WEBPACK_IMPORTED_MODULE_6__["default"])(({
23420
23591
  hasBasicElementProps,
23421
23592
  primitiveEq,
23422
23593
  hasMethod
@@ -23427,7 +23598,7 @@ const isArrayElement = (0,_helpers_mjs__WEBPACK_IMPORTED_MODULE_7__["default"])(
23427
23598
  /**
23428
23599
  * @public
23429
23600
  */
23430
- const isMemberElement = (0,_helpers_mjs__WEBPACK_IMPORTED_MODULE_7__["default"])(({
23601
+ const isMemberElement = (0,_helpers_mjs__WEBPACK_IMPORTED_MODULE_6__["default"])(({
23431
23602
  hasBasicElementProps,
23432
23603
  isElementType,
23433
23604
  primitiveEq
@@ -23438,7 +23609,7 @@ const isMemberElement = (0,_helpers_mjs__WEBPACK_IMPORTED_MODULE_7__["default"])
23438
23609
  /**
23439
23610
  * @public
23440
23611
  */
23441
- const isLinkElement = (0,_helpers_mjs__WEBPACK_IMPORTED_MODULE_7__["default"])(({
23612
+ const isLinkElement = (0,_helpers_mjs__WEBPACK_IMPORTED_MODULE_6__["default"])(({
23442
23613
  hasBasicElementProps,
23443
23614
  isElementType,
23444
23615
  primitiveEq
@@ -23449,7 +23620,7 @@ const isLinkElement = (0,_helpers_mjs__WEBPACK_IMPORTED_MODULE_7__["default"])((
23449
23620
  /**
23450
23621
  * @public
23451
23622
  */
23452
- const isRefElement = (0,_helpers_mjs__WEBPACK_IMPORTED_MODULE_7__["default"])(({
23623
+ const isRefElement = (0,_helpers_mjs__WEBPACK_IMPORTED_MODULE_6__["default"])(({
23453
23624
  hasBasicElementProps,
23454
23625
  isElementType,
23455
23626
  primitiveEq
@@ -23460,7 +23631,7 @@ const isRefElement = (0,_helpers_mjs__WEBPACK_IMPORTED_MODULE_7__["default"])(({
23460
23631
  /**
23461
23632
  * @public
23462
23633
  */
23463
- const isAnnotationElement = (0,_helpers_mjs__WEBPACK_IMPORTED_MODULE_7__["default"])(({
23634
+ const isAnnotationElement = (0,_helpers_mjs__WEBPACK_IMPORTED_MODULE_6__["default"])(({
23464
23635
  hasBasicElementProps,
23465
23636
  isElementType,
23466
23637
  primitiveEq
@@ -23471,7 +23642,7 @@ const isAnnotationElement = (0,_helpers_mjs__WEBPACK_IMPORTED_MODULE_7__["defaul
23471
23642
  /**
23472
23643
  * @public
23473
23644
  */
23474
- const isCommentElement = (0,_helpers_mjs__WEBPACK_IMPORTED_MODULE_7__["default"])(({
23645
+ const isCommentElement = (0,_helpers_mjs__WEBPACK_IMPORTED_MODULE_6__["default"])(({
23475
23646
  hasBasicElementProps,
23476
23647
  isElementType,
23477
23648
  primitiveEq
@@ -23482,7 +23653,7 @@ const isCommentElement = (0,_helpers_mjs__WEBPACK_IMPORTED_MODULE_7__["default"]
23482
23653
  /**
23483
23654
  * @public
23484
23655
  */
23485
- const isParseResultElement = (0,_helpers_mjs__WEBPACK_IMPORTED_MODULE_7__["default"])(({
23656
+ const isParseResultElement = (0,_helpers_mjs__WEBPACK_IMPORTED_MODULE_6__["default"])(({
23486
23657
  hasBasicElementProps,
23487
23658
  isElementType,
23488
23659
  primitiveEq
@@ -23490,17 +23661,6 @@ const isParseResultElement = (0,_helpers_mjs__WEBPACK_IMPORTED_MODULE_7__["defau
23490
23661
  return element => element instanceof _elements_ParseResult_mjs__WEBPACK_IMPORTED_MODULE_5__["default"] || hasBasicElementProps(element) && isElementType('parseResult', element) && primitiveEq('array', element);
23491
23662
  });
23492
23663
 
23493
- /**
23494
- * @public
23495
- */
23496
- const isSourceMapElement = (0,_helpers_mjs__WEBPACK_IMPORTED_MODULE_7__["default"])(({
23497
- hasBasicElementProps,
23498
- isElementType,
23499
- primitiveEq
23500
- }) => {
23501
- return element => element instanceof _elements_SourceMap_mjs__WEBPACK_IMPORTED_MODULE_6__["default"] || hasBasicElementProps(element) && isElementType('sourceMap', element) && primitiveEq('array', element);
23502
- });
23503
-
23504
23664
  /**
23505
23665
  * @public
23506
23666
  */
@@ -23509,14 +23669,17 @@ const isSourceMapElement = (0,_helpers_mjs__WEBPACK_IMPORTED_MODULE_7__["default
23509
23669
  * @public
23510
23670
  */
23511
23671
  const isPrimitiveElement = element => {
23512
- return (0,_helpers_mjs__WEBPACK_IMPORTED_MODULE_7__.isElementType)('object', element) || (0,_helpers_mjs__WEBPACK_IMPORTED_MODULE_7__.isElementType)('array', element) || (0,_helpers_mjs__WEBPACK_IMPORTED_MODULE_7__.isElementType)('boolean', element) || (0,_helpers_mjs__WEBPACK_IMPORTED_MODULE_7__.isElementType)('number', element) || (0,_helpers_mjs__WEBPACK_IMPORTED_MODULE_7__.isElementType)('string', element) || (0,_helpers_mjs__WEBPACK_IMPORTED_MODULE_7__.isElementType)('null', element) || (0,_helpers_mjs__WEBPACK_IMPORTED_MODULE_7__.isElementType)('member', element);
23672
+ return (0,_helpers_mjs__WEBPACK_IMPORTED_MODULE_6__.isElementType)('object', element) || (0,_helpers_mjs__WEBPACK_IMPORTED_MODULE_6__.isElementType)('array', element) || (0,_helpers_mjs__WEBPACK_IMPORTED_MODULE_6__.isElementType)('boolean', element) || (0,_helpers_mjs__WEBPACK_IMPORTED_MODULE_6__.isElementType)('number', element) || (0,_helpers_mjs__WEBPACK_IMPORTED_MODULE_6__.isElementType)('string', element) || (0,_helpers_mjs__WEBPACK_IMPORTED_MODULE_6__.isElementType)('null', element) || (0,_helpers_mjs__WEBPACK_IMPORTED_MODULE_6__.isElementType)('member', element);
23513
23673
  };
23514
23674
 
23515
23675
  /**
23516
23676
  * @public
23517
23677
  */
23518
23678
  const hasElementSourceMap = element => {
23519
- return isSourceMapElement(element.meta.get('sourceMap'));
23679
+ if (!isElement(element)) {
23680
+ return false;
23681
+ }
23682
+ return Number.isInteger(element.startPositionRow) && Number.isInteger(element.startPositionColumn) && Number.isInteger(element.startIndex) && Number.isInteger(element.endPositionRow) && Number.isInteger(element.endPositionColumn) && Number.isInteger(element.endIndex);
23520
23683
  };
23521
23684
 
23522
23685
  /**
@@ -28271,54 +28434,6 @@ module.exports = {
28271
28434
  };
28272
28435
 
28273
28436
 
28274
- /***/ }),
28275
-
28276
- /***/ 36863:
28277
- /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
28278
-
28279
- "use strict";
28280
- __webpack_require__.r(__webpack_exports__);
28281
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
28282
- /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
28283
- /* harmony export */ });
28284
- /* harmony import */ var minim__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(34035);
28285
-
28286
-
28287
- /**
28288
- * @public
28289
- */
28290
-
28291
- /**
28292
- * @public
28293
- */
28294
-
28295
- /**
28296
- * @public
28297
- */
28298
- class SourceMap extends minim__WEBPACK_IMPORTED_MODULE_0__.ArrayElement {
28299
- constructor(content, meta, attributes) {
28300
- super(content, meta, attributes);
28301
- this.element = 'sourceMap';
28302
- }
28303
- get positionStart() {
28304
- return this.children.filter(item => item.classes.contains('position')).get(0);
28305
- }
28306
- get positionEnd() {
28307
- return this.children.filter(item => item.classes.contains('position')).get(1);
28308
- }
28309
- set position(position) {
28310
- if (typeof position === 'undefined') {
28311
- return;
28312
- }
28313
- const start = new minim__WEBPACK_IMPORTED_MODULE_0__.ArrayElement([position.start.row, position.start.column, position.start.char]);
28314
- const end = new minim__WEBPACK_IMPORTED_MODULE_0__.ArrayElement([position.end.row, position.end.column, position.end.char]);
28315
- start.classes.push('position');
28316
- end.classes.push('position');
28317
- this.push(start).push(end);
28318
- }
28319
- }
28320
- /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (SourceMap);
28321
-
28322
28437
  /***/ }),
28323
28438
 
28324
28439
  /***/ 36892:
@@ -31691,8 +31806,7 @@ const keyMapDefault = {
31691
31806
  LinkElement: [],
31692
31807
  Annotation: [],
31693
31808
  Comment: [],
31694
- ParseResultElement: ['content'],
31695
- SourceMap: ['content']
31809
+ ParseResultElement: ['content']
31696
31810
  };
31697
31811
  class PredicateVisitor {
31698
31812
  result;
@@ -38429,7 +38543,8 @@ __webpack_require__.r(__webpack_exports__);
38429
38543
  /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
38430
38544
  /* harmony export */ });
38431
38545
  /* harmony import */ var _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(27121);
38432
- /* harmony import */ var _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(95233);
38546
+ /* harmony import */ var _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(3510);
38547
+ /* harmony import */ var _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(95233);
38433
38548
 
38434
38549
 
38435
38550
  /**
@@ -38448,14 +38563,13 @@ class Visitor {
38448
38563
  /* eslint-disable class-methods-use-this, no-param-reassign */
38449
38564
  copyMetaAndAttributes(from, to) {
38450
38565
  if (from.meta.length > 0 || to.meta.length > 0) {
38451
- to.meta = (0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_1__["default"])(to.meta, from.meta);
38452
- if ((0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_0__.hasElementSourceMap)(from)) {
38453
- // avoid deep merging of source maps
38454
- to.meta.set('sourceMap', from.meta.get('sourceMap'));
38455
- }
38566
+ to.meta = (0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_2__["default"])(to.meta, from.meta);
38567
+ }
38568
+ if ((0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_0__.hasElementSourceMap)(from)) {
38569
+ (0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_1__.assignSourceMap)(to, from);
38456
38570
  }
38457
38571
  if (from.attributes.length > 0 || from.meta.length > 0) {
38458
- to.attributes = (0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_1__["default"])(to.attributes, from.attributes); // eslint-disable-line no-param-reassign
38572
+ to.attributes = (0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_2__["default"])(to.attributes, from.attributes); // eslint-disable-line no-param-reassign
38459
38573
  }
38460
38574
  }
38461
38575
  /* eslint-enable class-methods-use-this, no-param-reassign */
@@ -48003,8 +48117,6 @@ __webpack_require__.r(__webpack_exports__);
48003
48117
  /* harmony import */ var _elements_Annotation_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(5443);
48004
48118
  /* harmony import */ var _elements_Comment_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(6127);
48005
48119
  /* harmony import */ var _elements_ParseResult_mjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(59110);
48006
- /* harmony import */ var _elements_SourceMap_mjs__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(36863);
48007
-
48008
48120
 
48009
48121
 
48010
48122
 
@@ -48019,7 +48131,6 @@ class Namespace extends minim__WEBPACK_IMPORTED_MODULE_0__.Namespace {
48019
48131
  this.register('annotation', _elements_Annotation_mjs__WEBPACK_IMPORTED_MODULE_2__["default"]);
48020
48132
  this.register('comment', _elements_Comment_mjs__WEBPACK_IMPORTED_MODULE_3__["default"]);
48021
48133
  this.register('parseResult', _elements_ParseResult_mjs__WEBPACK_IMPORTED_MODULE_4__["default"]);
48022
- this.register('sourceMap', _elements_SourceMap_mjs__WEBPACK_IMPORTED_MODULE_5__["default"]);
48023
48134
  }
48024
48135
  }
48025
48136
 
@@ -50747,35 +50858,145 @@ __webpack_require__.r(__webpack_exports__);
50747
50858
  /* harmony export */ readFile: () => (/* binding */ readFile)
50748
50859
  /* harmony export */ });
50749
50860
  /* harmony import */ var ramda__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(23557);
50750
- /* harmony import */ var _util_plugins_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(17955);
50751
- /* harmony import */ var _errors_ResolveError_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(35416);
50752
- /* harmony import */ var _errors_UnmatchedResolverError_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(12207);
50861
+ /* harmony import */ var _File_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(38396);
50862
+ /* harmony import */ var _util_plugins_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(17955);
50863
+ /* harmony import */ var _errors_ResolveError_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(35416);
50864
+ /* harmony import */ var _errors_UnmatchedResolverError_mjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(12207);
50865
+
50753
50866
 
50754
50867
 
50755
50868
 
50756
50869
 
50870
+ const CACHE_NAME = 'apidom-file-cache';
50871
+ const getCacheFileResult = async ({
50872
+ cacheKey,
50873
+ cacheTTL
50874
+ }) => {
50875
+ if (cacheTTL === 0) {
50876
+ return {
50877
+ cachedResult: null,
50878
+ cachedError: null
50879
+ };
50880
+ }
50881
+ try {
50882
+ const cache = await caches.open(CACHE_NAME);
50883
+ const response = await cache.match(cacheKey);
50884
+ if (response) {
50885
+ const {
50886
+ cachedResult,
50887
+ cachedError,
50888
+ timestamp
50889
+ } = await response.json();
50890
+ const now = Date.now();
50891
+
50892
+ // Check if the cache is still valid
50893
+ if (now - timestamp < cacheTTL) {
50894
+ return {
50895
+ cachedResult,
50896
+ cachedError
50897
+ };
50898
+ }
50899
+ await cache.delete(cacheKey);
50900
+ }
50901
+ } catch (error) {
50902
+ // If parsing cache fails, continue with normal parsing
50903
+ console.log('There was an error parsing the response');
50904
+ return {
50905
+ cachedResult: null,
50906
+ cachedError: null
50907
+ };
50908
+ }
50909
+ return {
50910
+ cachedResult: null,
50911
+ cachedError: null
50912
+ };
50913
+ };
50914
+ const setCacheFileResult = async ({
50915
+ cacheKey,
50916
+ result,
50917
+ error,
50918
+ cacheTTL
50919
+ }) => {
50920
+ if (cacheTTL === 0) {
50921
+ return;
50922
+ }
50923
+ try {
50924
+ const cacheData = {
50925
+ cachedResult: result,
50926
+ cachedError: error,
50927
+ timestamp: Date.now()
50928
+ };
50929
+ const cache = await caches.open(CACHE_NAME);
50930
+ const response = new Response(JSON.stringify(cacheData), {
50931
+ headers: {
50932
+ 'Content-Type': 'application/json'
50933
+ }
50934
+ });
50935
+ await cache.put(cacheKey, response);
50936
+ } catch (err) {
50937
+ // Silently fail if CacheStorage is not available
50938
+ console.error('CacheStorage is not available');
50939
+ }
50940
+ };
50941
+
50757
50942
  /**
50758
50943
  * Reads the given file, using the configured resolver plugins.
50759
50944
  */
50760
50945
  // eslint-disable-next-line import/prefer-default-export
50761
50946
  const readFile = async (file, options) => {
50947
+ const {
50948
+ cacheTTL = 0
50949
+ } = options.resolve.resolverOpts;
50950
+ const cacheKey = `read_${file.uri}`;
50951
+ const {
50952
+ cachedResult,
50953
+ cachedError
50954
+ } = await getCacheFileResult({
50955
+ cacheKey,
50956
+ cacheTTL
50957
+ });
50958
+ if (cachedResult !== null) {
50959
+ return cachedResult;
50960
+ }
50961
+ if (cachedError !== null) {
50962
+ throw new _errors_ResolveError_mjs__WEBPACK_IMPORTED_MODULE_3__["default"](`Error while reading file "${file.uri}"`, {
50963
+ cause: cachedError
50964
+ });
50965
+ }
50762
50966
  const optsBoundResolvers = options.resolve.resolvers.map(resolver => {
50763
50967
  const clonedResolver = Object.create(resolver);
50764
50968
  return Object.assign(clonedResolver, options.resolve.resolverOpts);
50765
50969
  });
50766
- const resolvers = await _util_plugins_mjs__WEBPACK_IMPORTED_MODULE_1__.filter('canRead', [file, options], optsBoundResolvers);
50970
+ const resolvers = await _util_plugins_mjs__WEBPACK_IMPORTED_MODULE_2__.filter('canRead', [file, options], optsBoundResolvers);
50767
50971
 
50768
50972
  // we couldn't find any resolver for this File
50769
50973
  if ((0,ramda__WEBPACK_IMPORTED_MODULE_0__["default"])(resolvers)) {
50770
- throw new _errors_UnmatchedResolverError_mjs__WEBPACK_IMPORTED_MODULE_3__["default"](file.uri);
50974
+ throw new _errors_UnmatchedResolverError_mjs__WEBPACK_IMPORTED_MODULE_4__["default"](file.uri);
50771
50975
  }
50772
50976
  try {
50773
50977
  const {
50774
50978
  result
50775
- } = await _util_plugins_mjs__WEBPACK_IMPORTED_MODULE_1__.run('read', [file], resolvers);
50979
+ } = await _util_plugins_mjs__WEBPACK_IMPORTED_MODULE_2__.run('read', [file], resolvers);
50980
+ const stringifiedData = new _File_mjs__WEBPACK_IMPORTED_MODULE_1__["default"]({
50981
+ ...file,
50982
+ data: result
50983
+ }).toString();
50984
+ await setCacheFileResult({
50985
+ cacheKey,
50986
+ result: stringifiedData,
50987
+ error: null,
50988
+ cacheTTL
50989
+ });
50776
50990
  return result;
50777
50991
  } catch (error) {
50778
- throw new _errors_ResolveError_mjs__WEBPACK_IMPORTED_MODULE_2__["default"](`Error while reading file "${file.uri}"`, {
50992
+ var _ref, _error$cause$cause, _error$cause;
50993
+ await setCacheFileResult({
50994
+ cacheKey,
50995
+ result: null,
50996
+ error: (_ref = (_error$cause$cause = error === null || error === void 0 || (_error$cause = error.cause) === null || _error$cause === void 0 ? void 0 : _error$cause.cause) !== null && _error$cause$cause !== void 0 ? _error$cause$cause : error === null || error === void 0 ? void 0 : error.cause) !== null && _ref !== void 0 ? _ref : error,
50997
+ cacheTTL
50998
+ });
50999
+ throw new _errors_ResolveError_mjs__WEBPACK_IMPORTED_MODULE_3__["default"](`Error while reading file "${file.uri}"`, {
50779
51000
  cause: error
50780
51001
  });
50781
51002
  }
@@ -53977,7 +54198,11 @@ const defaultOptions = {
53977
54198
  * true - the dereferencing process will be immutable (deep cloning of ApiDOM is involved)
53978
54199
  * false - the dereferencing process will be mutable
53979
54200
  */
53980
- immutable: true
54201
+ immutable: true,
54202
+ /**
54203
+ * These options are available in dereference strategy visitors.
54204
+ */
54205
+ dereferenceOpts: {}
53981
54206
  },
53982
54207
  bundle: {
53983
54208
  /**
@@ -55610,6 +55835,8 @@ __webpack_require__.r(__webpack_exports__);
55610
55835
  /* harmony import */ var _predicates_index_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(27121);
55611
55836
  /* harmony import */ var _errors_DeepCloneError_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(17673);
55612
55837
  /* harmony import */ var _errors_ShallowCloneError_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(69563);
55838
+ /* harmony import */ var _util_mjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(3510);
55839
+
55613
55840
 
55614
55841
 
55615
55842
 
@@ -55713,6 +55940,9 @@ const cloneShallowElement = element => {
55713
55940
  // @ts-ignore
55714
55941
  const copy = new element.constructor();
55715
55942
  copy.element = element.element;
55943
+ if ((0,_predicates_index_mjs__WEBPACK_IMPORTED_MODULE_1__.hasElementSourceMap)(element)) {
55944
+ (0,_util_mjs__WEBPACK_IMPORTED_MODULE_4__.assignSourceMap)(copy, element);
55945
+ }
55716
55946
  if (element.meta.length > 0) {
55717
55947
  copy._meta = cloneDeep(element.meta);
55718
55948
  }
@@ -55772,7 +56002,8 @@ __webpack_require__.r(__webpack_exports__);
55772
56002
  /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
55773
56003
  /* harmony export */ });
55774
56004
  /* harmony import */ var _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(27121);
55775
- /* harmony import */ var _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(95233);
56005
+ /* harmony import */ var _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(3510);
56006
+ /* harmony import */ var _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(95233);
55776
56007
 
55777
56008
 
55778
56009
  /**
@@ -55788,21 +56019,19 @@ class Visitor {
55788
56019
  Object.assign(this, options);
55789
56020
  }
55790
56021
 
55791
- // eslint-disable-next-line class-methods-use-this
56022
+ /* eslint-disable class-methods-use-this, no-param-reassign */
55792
56023
  copyMetaAndAttributes(from, to) {
55793
56024
  if (from.meta.length > 0 || to.meta.length > 0) {
55794
- // eslint-disable-next-line no-param-reassign
55795
- to.meta = (0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_1__["default"])(to.meta, from.meta);
55796
- if ((0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_0__.hasElementSourceMap)(from)) {
55797
- // avoid deep merging of source maps
55798
- to.meta.set('sourceMap', from.meta.get('sourceMap'));
55799
- }
56025
+ to.meta = (0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_2__["default"])(to.meta, from.meta);
56026
+ }
56027
+ if ((0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_0__.hasElementSourceMap)(from)) {
56028
+ (0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_1__.assignSourceMap)(to, from);
55800
56029
  }
55801
56030
  if (from.attributes.length > 0 || from.meta.length > 0) {
55802
- // eslint-disable-next-line no-param-reassign
55803
- to.attributes = (0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_1__["default"])(to.attributes, from.attributes);
56031
+ to.attributes = (0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_2__["default"])(to.attributes, from.attributes);
55804
56032
  }
55805
56033
  }
56034
+ /* eslint-enable class-methods-use-this, no-param-reassign */
55806
56035
  }
55807
56036
  /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Visitor);
55808
56037