swagger-client 3.24.3 → 3.24.5
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/swagger-client.browser.js +1007 -344
- package/dist/swagger-client.browser.min.js +1 -1
- package/dist/swagger-client.browser.min.js.map +1 -1
- package/es/execute/index.js +1 -1
- package/es/resolver/apidom/reference/dereference/strategies/openapi-3-1-swagger-client/visitors/dereference.js +62 -23
- package/es/resolver/strategies/openapi-3-1-apidom/resolve.js +1 -1
- package/lib/execute/index.js +1 -1
- package/lib/resolver/apidom/reference/dereference/strategies/openapi-3-1-swagger-client/visitors/dereference.js +61 -22
- package/lib/resolver/strategies/openapi-3-1-apidom/resolve.js +1 -1
- package/package.json +6 -5
|
@@ -368,7 +368,7 @@ function oas3BaseUrl(_ref2) {
|
|
|
368
368
|
|
|
369
369
|
// default to the first server if we don't have one by now
|
|
370
370
|
if (!selectedServerUrl) {
|
|
371
|
-
selectedServerObj = servers
|
|
371
|
+
[selectedServerObj] = servers;
|
|
372
372
|
selectedServerUrl = selectedServerObj.url;
|
|
373
373
|
}
|
|
374
374
|
if (selectedServerUrl.includes('{')) {
|
|
@@ -2550,25 +2550,27 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
2550
2550
|
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
2551
2551
|
/* harmony export */ });
|
|
2552
2552
|
/* harmony import */ var _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(87395);
|
|
2553
|
-
/* harmony import */ var
|
|
2554
|
-
/* harmony import */ var
|
|
2555
|
-
/* harmony import */ var
|
|
2556
|
-
/* harmony import */ var
|
|
2557
|
-
/* harmony import */ var
|
|
2558
|
-
/* harmony import */ var
|
|
2559
|
-
/* harmony import */ var
|
|
2560
|
-
/* harmony import */ var
|
|
2561
|
-
/* harmony import */ var
|
|
2562
|
-
/* harmony import */ var
|
|
2563
|
-
/* harmony import */ var
|
|
2564
|
-
/* harmony import */ var
|
|
2565
|
-
/* harmony import */ var
|
|
2566
|
-
/* harmony import */ var
|
|
2567
|
-
/* harmony import */ var
|
|
2568
|
-
/* harmony import */ var
|
|
2569
|
-
/* harmony import */ var
|
|
2570
|
-
/* harmony import */ var
|
|
2571
|
-
/* harmony import */ var
|
|
2553
|
+
/* harmony import */ var _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(47644);
|
|
2554
|
+
/* harmony import */ var _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(50334);
|
|
2555
|
+
/* harmony import */ var _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(28552);
|
|
2556
|
+
/* harmony import */ var _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(50308);
|
|
2557
|
+
/* harmony import */ var _swagger_api_apidom_error__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(42455);
|
|
2558
|
+
/* harmony import */ var _swagger_api_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(66316);
|
|
2559
|
+
/* harmony import */ var _swagger_api_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(74144);
|
|
2560
|
+
/* harmony import */ var _swagger_api_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(94481);
|
|
2561
|
+
/* harmony import */ var _swagger_api_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(84714);
|
|
2562
|
+
/* harmony import */ var _swagger_api_apidom_json_pointer__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(3608);
|
|
2563
|
+
/* harmony import */ var _swagger_api_apidom_json_pointer__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(8647);
|
|
2564
|
+
/* harmony import */ var _swagger_api_apidom_reference_configuration_empty__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(69239);
|
|
2565
|
+
/* harmony import */ var _swagger_api_apidom_reference_configuration_empty__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(67625);
|
|
2566
|
+
/* harmony import */ var _swagger_api_apidom_reference_configuration_empty__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(35059);
|
|
2567
|
+
/* harmony import */ var _swagger_api_apidom_reference_dereference_strategies_openapi_3_1__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(71550);
|
|
2568
|
+
/* harmony import */ var _swagger_api_apidom_reference_dereference_strategies_openapi_3_1__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(77079);
|
|
2569
|
+
/* harmony import */ var _swagger_api_apidom_reference_dereference_strategies_openapi_3_1_selectors_$anchor__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(90609);
|
|
2570
|
+
/* harmony import */ var _swagger_api_apidom_reference_dereference_strategies_openapi_3_1_selectors_uri__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(14726);
|
|
2571
|
+
/* harmony import */ var _swagger_api_apidom_reference_dereference_strategies_openapi_3_1_selectors_uri__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(552);
|
|
2572
|
+
/* harmony import */ var _utils_to_path_js__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(21352);
|
|
2573
|
+
/* harmony import */ var _utils_get_root_cause_js__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(28495);
|
|
2572
2574
|
/* harmony import */ var _specmap_lib_refs_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(58569);
|
|
2573
2575
|
/* harmony import */ var _errors_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(75754);
|
|
2574
2576
|
/* eslint-disable camelcase */
|
|
@@ -2583,11 +2585,21 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
2583
2585
|
|
|
2584
2586
|
|
|
2585
2587
|
|
|
2588
|
+
|
|
2586
2589
|
const {
|
|
2587
2590
|
wrapError
|
|
2588
2591
|
} = _specmap_lib_refs_js__WEBPACK_IMPORTED_MODULE_0__["default"];
|
|
2589
2592
|
const visitAsync = _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_2__.visit[Symbol.for('nodejs.util.promisify.custom')];
|
|
2590
|
-
|
|
2593
|
+
|
|
2594
|
+
// initialize element identity manager
|
|
2595
|
+
const identityManager = (0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_3__.IdentityManager)();
|
|
2596
|
+
|
|
2597
|
+
/**
|
|
2598
|
+
* Predicate for detecting if element was created by merging referencing
|
|
2599
|
+
* element with particular element identity with a referenced element.
|
|
2600
|
+
*/
|
|
2601
|
+
const wasReferencedBy = referencingElement => element => element.meta.hasKey('ref-referencing-element-id') && element.meta.get('ref-referencing-element-id').equals((0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_4__["default"])(identityManager.identify(referencingElement)));
|
|
2602
|
+
const OpenApi3_1SwaggerClientDereferenceVisitor = _swagger_api_apidom_reference_dereference_strategies_openapi_3_1__WEBPACK_IMPORTED_MODULE_5__["default"].compose({
|
|
2591
2603
|
props: {
|
|
2592
2604
|
useCircularStructures: true,
|
|
2593
2605
|
allowMetaPatches: false,
|
|
@@ -2608,32 +2620,37 @@ const OpenApi3_1SwaggerClientDereferenceVisitor = _swagger_api_apidom_reference_
|
|
|
2608
2620
|
try {
|
|
2609
2621
|
const [ancestorsLineage, directAncestors] = this.toAncestorLineage([...ancestors, parent]);
|
|
2610
2622
|
|
|
2623
|
+
// skip already identified cycled Path Item Objects
|
|
2624
|
+
if ((0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_6__.includesClasses)(['cycle'], referencingElement.$ref)) {
|
|
2625
|
+
return false;
|
|
2626
|
+
}
|
|
2627
|
+
|
|
2611
2628
|
// detect possible cycle in traversal and avoid it
|
|
2612
2629
|
if (ancestorsLineage.includesCycle(referencingElement)) {
|
|
2613
2630
|
return false;
|
|
2614
2631
|
}
|
|
2615
2632
|
|
|
2616
2633
|
// ignore resolving external Reference Objects
|
|
2617
|
-
if (!this.options.resolve.external && (0,
|
|
2634
|
+
if (!this.options.resolve.external && (0,_swagger_api_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_7__.isReferenceElementExternal)(referencingElement)) {
|
|
2618
2635
|
return false;
|
|
2619
2636
|
}
|
|
2620
|
-
const reference = await this.toReference((0,
|
|
2637
|
+
const reference = await this.toReference((0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_4__["default"])(referencingElement.$ref));
|
|
2621
2638
|
const {
|
|
2622
2639
|
uri: retrievalURI
|
|
2623
2640
|
} = reference;
|
|
2624
|
-
const $refBaseURI =
|
|
2641
|
+
const $refBaseURI = _swagger_api_apidom_reference_configuration_empty__WEBPACK_IMPORTED_MODULE_8__.resolve(retrievalURI, (0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_4__["default"])(referencingElement.$ref));
|
|
2625
2642
|
this.indirections.push(referencingElement);
|
|
2626
|
-
const jsonPointer = (0,
|
|
2643
|
+
const jsonPointer = (0,_swagger_api_apidom_json_pointer__WEBPACK_IMPORTED_MODULE_9__.uriToPointer)($refBaseURI);
|
|
2627
2644
|
|
|
2628
2645
|
// possibly non-semantic fragment
|
|
2629
|
-
let referencedElement = (0,
|
|
2646
|
+
let referencedElement = (0,_swagger_api_apidom_json_pointer__WEBPACK_IMPORTED_MODULE_10__["default"])(jsonPointer, reference.value.result);
|
|
2630
2647
|
|
|
2631
2648
|
// applying semantics to a fragment
|
|
2632
|
-
if ((0,
|
|
2633
|
-
const referencedElementType = (0,
|
|
2634
|
-
if ((0,
|
|
2649
|
+
if ((0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_6__.isPrimitiveElement)(referencedElement)) {
|
|
2650
|
+
const referencedElementType = (0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_4__["default"])(referencingElement.meta.get('referenced-element'));
|
|
2651
|
+
if ((0,_swagger_api_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_11__.isReferenceLikeElement)(referencedElement)) {
|
|
2635
2652
|
// handling indirect references
|
|
2636
|
-
referencedElement =
|
|
2653
|
+
referencedElement = _swagger_api_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_12__.ReferenceElement.refract(referencedElement);
|
|
2637
2654
|
referencedElement.setMetaProperty('referenced-element', referencedElementType);
|
|
2638
2655
|
} else {
|
|
2639
2656
|
// handling direct references
|
|
@@ -2644,21 +2661,23 @@ const OpenApi3_1SwaggerClientDereferenceVisitor = _swagger_api_apidom_reference_
|
|
|
2644
2661
|
|
|
2645
2662
|
// detect direct or indirect reference
|
|
2646
2663
|
if (this.indirections.includes(referencedElement)) {
|
|
2647
|
-
throw new
|
|
2664
|
+
throw new _swagger_api_apidom_error__WEBPACK_IMPORTED_MODULE_13__["default"]('Recursive JSON Pointer detected');
|
|
2648
2665
|
}
|
|
2649
2666
|
|
|
2650
2667
|
// detect maximum depth of dereferencing
|
|
2651
2668
|
if (this.indirections.length > this.options.dereference.maxDepth) {
|
|
2652
|
-
throw new
|
|
2669
|
+
throw new _swagger_api_apidom_reference_configuration_empty__WEBPACK_IMPORTED_MODULE_14__["default"](`Maximum dereference depth of "${this.options.dereference.maxDepth}" has been exceeded in file "${this.reference.uri}"`);
|
|
2653
2670
|
}
|
|
2654
2671
|
if (!this.useCircularStructures) {
|
|
2655
2672
|
const hasCycles = ancestorsLineage.includes(referencedElement);
|
|
2656
2673
|
if (hasCycles) {
|
|
2657
|
-
if (
|
|
2674
|
+
if (_swagger_api_apidom_reference_configuration_empty__WEBPACK_IMPORTED_MODULE_8__.isHttpUrl(retrievalURI) || _swagger_api_apidom_reference_configuration_empty__WEBPACK_IMPORTED_MODULE_8__.isFileSystemPath(retrievalURI)) {
|
|
2658
2675
|
// make the referencing URL or file system path absolute
|
|
2659
|
-
|
|
2676
|
+
const cycledReferenceElement = new _swagger_api_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_12__.ReferenceElement({
|
|
2660
2677
|
$ref: $refBaseURI
|
|
2661
|
-
}, (0,
|
|
2678
|
+
}, (0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_15__.cloneDeep)(referencingElement.meta), (0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_15__.cloneDeep)(referencingElement.attributes));
|
|
2679
|
+
cycledReferenceElement.get('$ref').classes.push('cycle');
|
|
2680
|
+
return cycledReferenceElement;
|
|
2662
2681
|
}
|
|
2663
2682
|
// skip processing this reference
|
|
2664
2683
|
return false;
|
|
@@ -2677,51 +2696,47 @@ const OpenApi3_1SwaggerClientDereferenceVisitor = _swagger_api_apidom_reference_
|
|
|
2677
2696
|
ancestors: ancestorsLineage,
|
|
2678
2697
|
allowMetaPatches: this.allowMetaPatches,
|
|
2679
2698
|
useCircularStructures: this.useCircularStructures,
|
|
2680
|
-
basePath: this.basePath ?? [...(0,
|
|
2699
|
+
basePath: this.basePath ?? [...(0,_utils_to_path_js__WEBPACK_IMPORTED_MODULE_16__["default"])([...ancestors, parent, referencingElement]), '$ref']
|
|
2681
2700
|
});
|
|
2682
2701
|
referencedElement = await visitAsync(referencedElement, visitor, {
|
|
2683
|
-
keyMap:
|
|
2684
|
-
nodeTypeGetter:
|
|
2702
|
+
keyMap: _swagger_api_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_17__.keyMap,
|
|
2703
|
+
nodeTypeGetter: _swagger_api_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_17__.getNodeType
|
|
2685
2704
|
});
|
|
2686
2705
|
|
|
2687
2706
|
// remove referencing schema from ancestors lineage
|
|
2688
2707
|
directAncestors.delete(referencingElement);
|
|
2689
2708
|
this.indirections.pop();
|
|
2690
2709
|
const mergeAndAnnotateReferencedElement = refedElement => {
|
|
2691
|
-
const copy = (0,
|
|
2710
|
+
const copy = (0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_15__.cloneShallow)(refedElement);
|
|
2692
2711
|
|
|
2693
2712
|
// annotate fragment with info about original Reference element
|
|
2694
2713
|
copy.setMetaProperty('ref-fields', {
|
|
2695
|
-
$ref: (0,
|
|
2696
|
-
|
|
2697
|
-
|
|
2698
|
-
// @ts-ignore
|
|
2699
|
-
summary: (0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_5__["default"])(referencingElement.summary)
|
|
2714
|
+
$ref: (0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_4__["default"])(referencingElement.$ref),
|
|
2715
|
+
description: (0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_4__["default"])(referencingElement.description),
|
|
2716
|
+
summary: (0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_4__["default"])(referencingElement.summary)
|
|
2700
2717
|
});
|
|
2701
2718
|
// annotate fragment with info about origin
|
|
2702
2719
|
copy.setMetaProperty('ref-origin', reference.uri);
|
|
2720
|
+
// annotate fragment with info about referencing element
|
|
2721
|
+
copy.setMetaProperty('ref-referencing-element-id', (0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_15__.cloneDeep)(identityManager.identify(referencingElement)));
|
|
2703
2722
|
|
|
2704
2723
|
// override description and summary (outer has higher priority then inner)
|
|
2705
|
-
if ((0,
|
|
2724
|
+
if ((0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_6__.isObjectElement)(refedElement)) {
|
|
2706
2725
|
if (referencingElement.hasKey('description') && 'description' in refedElement) {
|
|
2707
|
-
// @ts-ignore
|
|
2708
2726
|
copy.remove('description');
|
|
2709
|
-
// @ts-ignore
|
|
2710
2727
|
copy.set('description', referencingElement.get('description'));
|
|
2711
2728
|
}
|
|
2712
2729
|
if (referencingElement.hasKey('summary') && 'summary' in refedElement) {
|
|
2713
|
-
// @ts-ignore
|
|
2714
2730
|
copy.remove('summary');
|
|
2715
|
-
// @ts-ignore
|
|
2716
2731
|
copy.set('summary', referencingElement.get('summary'));
|
|
2717
2732
|
}
|
|
2718
2733
|
}
|
|
2719
2734
|
|
|
2720
2735
|
// apply meta patches
|
|
2721
|
-
if (this.allowMetaPatches && (0,
|
|
2736
|
+
if (this.allowMetaPatches && (0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_6__.isObjectElement)(copy)) {
|
|
2722
2737
|
// apply meta patch only when not already applied
|
|
2723
2738
|
if (!copy.hasKey('$$ref')) {
|
|
2724
|
-
const baseURI =
|
|
2739
|
+
const baseURI = _swagger_api_apidom_reference_configuration_empty__WEBPACK_IMPORTED_MODULE_8__.resolve(retrievalURI, $refBaseURI);
|
|
2725
2740
|
copy.set('$$ref', baseURI);
|
|
2726
2741
|
}
|
|
2727
2742
|
}
|
|
@@ -2729,11 +2744,12 @@ const OpenApi3_1SwaggerClientDereferenceVisitor = _swagger_api_apidom_reference_
|
|
|
2729
2744
|
};
|
|
2730
2745
|
|
|
2731
2746
|
// attempting to create cycle
|
|
2732
|
-
if (ancestorsLineage.includes(referencedElement)) {
|
|
2733
|
-
|
|
2734
|
-
|
|
2747
|
+
if (ancestorsLineage.includes(referencingElement) || ancestorsLineage.includes(referencedElement)) {
|
|
2748
|
+
const replaceWith = ancestorsLineage.findItem(wasReferencedBy(referencingElement)) ?? mergeAndAnnotateReferencedElement(referencedElement);
|
|
2749
|
+
if ((0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_6__.isMemberElement)(parent)) {
|
|
2750
|
+
parent.value = replaceWith; // eslint-disable-line no-param-reassign
|
|
2735
2751
|
} else if (Array.isArray(parent)) {
|
|
2736
|
-
parent[key] =
|
|
2752
|
+
parent[key] = replaceWith; // eslint-disable-line no-param-reassign
|
|
2737
2753
|
}
|
|
2738
2754
|
|
|
2739
2755
|
return false;
|
|
@@ -2742,12 +2758,12 @@ const OpenApi3_1SwaggerClientDereferenceVisitor = _swagger_api_apidom_reference_
|
|
|
2742
2758
|
// transclude the element for a fragment
|
|
2743
2759
|
return mergeAndAnnotateReferencedElement(referencedElement);
|
|
2744
2760
|
} catch (error) {
|
|
2745
|
-
const rootCause = (0,
|
|
2761
|
+
const rootCause = (0,_utils_get_root_cause_js__WEBPACK_IMPORTED_MODULE_18__["default"])(error);
|
|
2746
2762
|
const wrappedError = wrapError(rootCause, {
|
|
2747
2763
|
baseDoc: this.reference.uri,
|
|
2748
|
-
$ref: (0,
|
|
2749
|
-
pointer: (0,
|
|
2750
|
-
fullPath: this.basePath ?? [...(0,
|
|
2764
|
+
$ref: (0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_4__["default"])(referencingElement.$ref),
|
|
2765
|
+
pointer: (0,_swagger_api_apidom_json_pointer__WEBPACK_IMPORTED_MODULE_9__.uriToPointer)((0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_4__["default"])(referencingElement.$ref)),
|
|
2766
|
+
fullPath: this.basePath ?? [...(0,_utils_to_path_js__WEBPACK_IMPORTED_MODULE_16__["default"])([...ancestors, parent, referencingElement]), '$ref']
|
|
2751
2767
|
});
|
|
2752
2768
|
this.options.dereference.dereferenceOpts?.errors?.push?.(wrappedError);
|
|
2753
2769
|
return undefined;
|
|
@@ -2758,52 +2774,59 @@ const OpenApi3_1SwaggerClientDereferenceVisitor = _swagger_api_apidom_reference_
|
|
|
2758
2774
|
const [ancestorsLineage, directAncestors] = this.toAncestorLineage([...ancestors, parent]);
|
|
2759
2775
|
|
|
2760
2776
|
// ignore PathItemElement without $ref field
|
|
2761
|
-
if (!(0,
|
|
2777
|
+
if (!(0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_6__.isStringElement)(pathItemElement.$ref)) {
|
|
2762
2778
|
return undefined;
|
|
2763
2779
|
}
|
|
2764
2780
|
|
|
2781
|
+
// skip already identified cycled Path Item Objects
|
|
2782
|
+
if ((0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_6__.includesClasses)(['cycle'], pathItemElement.$ref)) {
|
|
2783
|
+
return false;
|
|
2784
|
+
}
|
|
2785
|
+
|
|
2765
2786
|
// detect possible cycle in traversal and avoid it
|
|
2766
2787
|
if (ancestorsLineage.includesCycle(pathItemElement)) {
|
|
2767
2788
|
return false;
|
|
2768
2789
|
}
|
|
2769
2790
|
|
|
2770
2791
|
// ignore resolving external Path Item Elements
|
|
2771
|
-
if (!this.options.resolve.external && (0,
|
|
2792
|
+
if (!this.options.resolve.external && (0,_swagger_api_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_7__.isPathItemElementExternal)(pathItemElement)) {
|
|
2772
2793
|
return undefined;
|
|
2773
2794
|
}
|
|
2774
|
-
const reference = await this.toReference((0,
|
|
2795
|
+
const reference = await this.toReference((0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_4__["default"])(pathItemElement.$ref));
|
|
2775
2796
|
const {
|
|
2776
2797
|
uri: retrievalURI
|
|
2777
2798
|
} = reference;
|
|
2778
|
-
const $refBaseURI =
|
|
2799
|
+
const $refBaseURI = _swagger_api_apidom_reference_configuration_empty__WEBPACK_IMPORTED_MODULE_8__.resolve(retrievalURI, (0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_4__["default"])(pathItemElement.$ref));
|
|
2779
2800
|
this.indirections.push(pathItemElement);
|
|
2780
|
-
const jsonPointer = (0,
|
|
2801
|
+
const jsonPointer = (0,_swagger_api_apidom_json_pointer__WEBPACK_IMPORTED_MODULE_9__.uriToPointer)($refBaseURI);
|
|
2781
2802
|
|
|
2782
2803
|
// possibly non-semantic referenced element
|
|
2783
|
-
let referencedElement = (0,
|
|
2804
|
+
let referencedElement = (0,_swagger_api_apidom_json_pointer__WEBPACK_IMPORTED_MODULE_10__["default"])(jsonPointer, reference.value.result);
|
|
2784
2805
|
|
|
2785
2806
|
// applying semantics to a referenced element
|
|
2786
|
-
if ((0,
|
|
2787
|
-
referencedElement =
|
|
2807
|
+
if ((0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_6__.isPrimitiveElement)(referencedElement)) {
|
|
2808
|
+
referencedElement = _swagger_api_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_12__.PathItemElement.refract(referencedElement);
|
|
2788
2809
|
}
|
|
2789
2810
|
|
|
2790
2811
|
// detect direct or indirect reference
|
|
2791
2812
|
if (this.indirections.includes(referencedElement)) {
|
|
2792
|
-
throw new
|
|
2813
|
+
throw new _swagger_api_apidom_error__WEBPACK_IMPORTED_MODULE_13__["default"]('Recursive JSON Pointer detected');
|
|
2793
2814
|
}
|
|
2794
2815
|
|
|
2795
2816
|
// detect maximum depth of dereferencing
|
|
2796
2817
|
if (this.indirections.length > this.options.dereference.maxDepth) {
|
|
2797
|
-
throw new
|
|
2818
|
+
throw new _swagger_api_apidom_reference_configuration_empty__WEBPACK_IMPORTED_MODULE_14__["default"](`Maximum dereference depth of "${this.options.dereference.maxDepth}" has been exceeded in file "${this.reference.uri}"`);
|
|
2798
2819
|
}
|
|
2799
2820
|
if (!this.useCircularStructures) {
|
|
2800
2821
|
const hasCycles = ancestorsLineage.includes(referencedElement);
|
|
2801
2822
|
if (hasCycles) {
|
|
2802
|
-
if (
|
|
2823
|
+
if (_swagger_api_apidom_reference_configuration_empty__WEBPACK_IMPORTED_MODULE_8__.isHttpUrl(retrievalURI) || _swagger_api_apidom_reference_configuration_empty__WEBPACK_IMPORTED_MODULE_8__.isFileSystemPath(retrievalURI)) {
|
|
2803
2824
|
// make the referencing URL or file system path absolute
|
|
2804
|
-
|
|
2825
|
+
const cycledPathItemElement = new _swagger_api_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_12__.PathItemElement({
|
|
2805
2826
|
$ref: $refBaseURI
|
|
2806
|
-
}, (0,
|
|
2827
|
+
}, (0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_15__.cloneDeep)(pathItemElement.meta), (0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_15__.cloneDeep)(pathItemElement.attributes));
|
|
2828
|
+
cycledPathItemElement.get('$ref').classes.push('cycle');
|
|
2829
|
+
return cycledPathItemElement;
|
|
2807
2830
|
}
|
|
2808
2831
|
// skip processing this path item and all it's child elements
|
|
2809
2832
|
return false;
|
|
@@ -2822,11 +2845,11 @@ const OpenApi3_1SwaggerClientDereferenceVisitor = _swagger_api_apidom_reference_
|
|
|
2822
2845
|
ancestors: ancestorsLineage,
|
|
2823
2846
|
allowMetaPatches: this.allowMetaPatches,
|
|
2824
2847
|
useCircularStructures: this.useCircularStructures,
|
|
2825
|
-
basePath: this.basePath ?? [...(0,
|
|
2848
|
+
basePath: this.basePath ?? [...(0,_utils_to_path_js__WEBPACK_IMPORTED_MODULE_16__["default"])([...ancestors, parent, pathItemElement]), '$ref']
|
|
2826
2849
|
});
|
|
2827
2850
|
referencedElement = await visitAsync(referencedElement, visitor, {
|
|
2828
|
-
keyMap:
|
|
2829
|
-
nodeTypeGetter:
|
|
2851
|
+
keyMap: _swagger_api_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_17__.keyMap,
|
|
2852
|
+
nodeTypeGetter: _swagger_api_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_17__.getNodeType
|
|
2830
2853
|
});
|
|
2831
2854
|
|
|
2832
2855
|
// remove referencing schema from ancestors lineage
|
|
@@ -2834,26 +2857,28 @@ const OpenApi3_1SwaggerClientDereferenceVisitor = _swagger_api_apidom_reference_
|
|
|
2834
2857
|
this.indirections.pop();
|
|
2835
2858
|
const mergeAndAnnotateReferencedElement = refedElement => {
|
|
2836
2859
|
// merge fields from referenced Path Item with referencing one
|
|
2837
|
-
const mergedElement = new
|
|
2860
|
+
const mergedElement = new _swagger_api_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_12__.PathItemElement([...refedElement.content], (0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_15__.cloneDeep)(refedElement.meta), (0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_15__.cloneDeep)(refedElement.attributes));
|
|
2838
2861
|
// existing keywords from referencing PathItemElement overrides ones from referenced element
|
|
2839
2862
|
pathItemElement.forEach((value, keyElement, item) => {
|
|
2840
|
-
mergedElement.remove((0,
|
|
2863
|
+
mergedElement.remove((0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_4__["default"])(keyElement));
|
|
2841
2864
|
mergedElement.content.push(item);
|
|
2842
2865
|
});
|
|
2843
2866
|
mergedElement.remove('$ref');
|
|
2844
2867
|
|
|
2845
2868
|
// annotate referenced element with info about original referencing element
|
|
2846
2869
|
mergedElement.setMetaProperty('ref-fields', {
|
|
2847
|
-
$ref: (0,
|
|
2870
|
+
$ref: (0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_4__["default"])(pathItemElement.$ref)
|
|
2848
2871
|
});
|
|
2849
2872
|
// annotate referenced element with info about origin
|
|
2850
2873
|
mergedElement.setMetaProperty('ref-origin', reference.uri);
|
|
2874
|
+
// annotate fragment with info about referencing element
|
|
2875
|
+
mergedElement.setMetaProperty('ref-referencing-element-id', (0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_15__.cloneDeep)(identityManager.identify(pathItemElement)));
|
|
2851
2876
|
|
|
2852
2877
|
// apply meta patches
|
|
2853
2878
|
if (this.allowMetaPatches) {
|
|
2854
2879
|
// apply meta patch only when not already applied
|
|
2855
2880
|
if (typeof mergedElement.get('$$ref') === 'undefined') {
|
|
2856
|
-
const baseURI =
|
|
2881
|
+
const baseURI = _swagger_api_apidom_reference_configuration_empty__WEBPACK_IMPORTED_MODULE_8__.resolve(retrievalURI, $refBaseURI);
|
|
2857
2882
|
mergedElement.set('$$ref', baseURI);
|
|
2858
2883
|
}
|
|
2859
2884
|
}
|
|
@@ -2861,11 +2886,12 @@ const OpenApi3_1SwaggerClientDereferenceVisitor = _swagger_api_apidom_reference_
|
|
|
2861
2886
|
};
|
|
2862
2887
|
|
|
2863
2888
|
// attempting to create cycle
|
|
2864
|
-
if (ancestorsLineage.includes(referencedElement)) {
|
|
2865
|
-
|
|
2866
|
-
|
|
2889
|
+
if (ancestorsLineage.includes(pathItemElement) || ancestorsLineage.includes(referencedElement)) {
|
|
2890
|
+
const replaceWith = ancestorsLineage.findItem(wasReferencedBy(pathItemElement)) ?? mergeAndAnnotateReferencedElement(referencedElement);
|
|
2891
|
+
if ((0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_6__.isMemberElement)(parent)) {
|
|
2892
|
+
parent.value = replaceWith; // eslint-disable-line no-param-reassign
|
|
2867
2893
|
} else if (Array.isArray(parent)) {
|
|
2868
|
-
parent[key] =
|
|
2894
|
+
parent[key] = replaceWith; // eslint-disable-line no-param-reassign
|
|
2869
2895
|
}
|
|
2870
2896
|
|
|
2871
2897
|
return false;
|
|
@@ -2874,12 +2900,12 @@ const OpenApi3_1SwaggerClientDereferenceVisitor = _swagger_api_apidom_reference_
|
|
|
2874
2900
|
// transclude referencing element with merged referenced element
|
|
2875
2901
|
return mergeAndAnnotateReferencedElement(referencedElement);
|
|
2876
2902
|
} catch (error) {
|
|
2877
|
-
const rootCause = (0,
|
|
2903
|
+
const rootCause = (0,_utils_get_root_cause_js__WEBPACK_IMPORTED_MODULE_18__["default"])(error);
|
|
2878
2904
|
const wrappedError = wrapError(rootCause, {
|
|
2879
2905
|
baseDoc: this.reference.uri,
|
|
2880
|
-
$ref: (0,
|
|
2881
|
-
pointer: (0,
|
|
2882
|
-
fullPath: this.basePath ?? [...(0,
|
|
2906
|
+
$ref: (0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_4__["default"])(pathItemElement.$ref),
|
|
2907
|
+
pointer: (0,_swagger_api_apidom_json_pointer__WEBPACK_IMPORTED_MODULE_9__.uriToPointer)((0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_4__["default"])(pathItemElement.$ref)),
|
|
2908
|
+
fullPath: this.basePath ?? [...(0,_utils_to_path_js__WEBPACK_IMPORTED_MODULE_16__["default"])([...ancestors, parent, pathItemElement]), '$ref']
|
|
2883
2909
|
});
|
|
2884
2910
|
this.options.dereference.dereferenceOpts?.errors?.push?.(wrappedError);
|
|
2885
2911
|
return undefined;
|
|
@@ -2890,24 +2916,29 @@ const OpenApi3_1SwaggerClientDereferenceVisitor = _swagger_api_apidom_reference_
|
|
|
2890
2916
|
const [ancestorsLineage, directAncestors] = this.toAncestorLineage([...ancestors, parent]);
|
|
2891
2917
|
|
|
2892
2918
|
// skip current referencing schema as $ref keyword was not defined
|
|
2893
|
-
if (!(0,
|
|
2919
|
+
if (!(0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_6__.isStringElement)(referencingElement.$ref)) {
|
|
2894
2920
|
// skip traversing this schema but traverse all it's child schemas
|
|
2895
2921
|
return undefined;
|
|
2896
2922
|
}
|
|
2897
2923
|
|
|
2924
|
+
// skip already identified cycled Path Item Objects
|
|
2925
|
+
if ((0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_6__.includesClasses)(['cycle'], referencingElement.$ref)) {
|
|
2926
|
+
return false;
|
|
2927
|
+
}
|
|
2928
|
+
|
|
2898
2929
|
// detect possible cycle in traversal and avoid it
|
|
2899
2930
|
if (ancestorsLineage.includesCycle(referencingElement)) {
|
|
2900
2931
|
return false;
|
|
2901
2932
|
}
|
|
2902
2933
|
|
|
2903
2934
|
// compute baseURI using rules around $id and $ref keywords
|
|
2904
|
-
let reference = await this.toReference(
|
|
2935
|
+
let reference = await this.toReference(_swagger_api_apidom_reference_configuration_empty__WEBPACK_IMPORTED_MODULE_8__.unsanitize(this.reference.uri));
|
|
2905
2936
|
let {
|
|
2906
2937
|
uri: retrievalURI
|
|
2907
2938
|
} = reference;
|
|
2908
|
-
const $refBaseURI = (0,
|
|
2909
|
-
const $refBaseURIStrippedHash =
|
|
2910
|
-
const file = (0,
|
|
2939
|
+
const $refBaseURI = (0,_swagger_api_apidom_reference_dereference_strategies_openapi_3_1__WEBPACK_IMPORTED_MODULE_19__.resolveSchema$refField)(retrievalURI, referencingElement);
|
|
2940
|
+
const $refBaseURIStrippedHash = _swagger_api_apidom_reference_configuration_empty__WEBPACK_IMPORTED_MODULE_8__.stripHash($refBaseURI);
|
|
2941
|
+
const file = (0,_swagger_api_apidom_reference_configuration_empty__WEBPACK_IMPORTED_MODULE_20__["default"])({
|
|
2911
2942
|
uri: $refBaseURIStrippedHash
|
|
2912
2943
|
});
|
|
2913
2944
|
const isUnknownURI = !this.options.resolve.resolvers.some(r => r.canRead(file));
|
|
@@ -2927,32 +2958,32 @@ const OpenApi3_1SwaggerClientDereferenceVisitor = _swagger_api_apidom_reference_
|
|
|
2927
2958
|
if (isUnknownURI || isURL) {
|
|
2928
2959
|
// we're dealing with canonical URI or URL with possible fragment
|
|
2929
2960
|
const selector = $refBaseURI;
|
|
2930
|
-
referencedElement = (0,
|
|
2961
|
+
referencedElement = (0,_swagger_api_apidom_reference_dereference_strategies_openapi_3_1_selectors_uri__WEBPACK_IMPORTED_MODULE_21__.evaluate)(selector, (0,_swagger_api_apidom_reference_dereference_strategies_openapi_3_1__WEBPACK_IMPORTED_MODULE_19__.maybeRefractToSchemaElement)(reference.value.result));
|
|
2931
2962
|
} else {
|
|
2932
2963
|
// we're assuming here that we're dealing with JSON Pointer here
|
|
2933
|
-
reference = await this.toReference(
|
|
2964
|
+
reference = await this.toReference(_swagger_api_apidom_reference_configuration_empty__WEBPACK_IMPORTED_MODULE_8__.unsanitize($refBaseURI));
|
|
2934
2965
|
retrievalURI = reference.uri;
|
|
2935
|
-
const selector = (0,
|
|
2936
|
-
referencedElement = (0,
|
|
2966
|
+
const selector = (0,_swagger_api_apidom_json_pointer__WEBPACK_IMPORTED_MODULE_9__.uriToPointer)($refBaseURI);
|
|
2967
|
+
referencedElement = (0,_swagger_api_apidom_reference_dereference_strategies_openapi_3_1__WEBPACK_IMPORTED_MODULE_19__.maybeRefractToSchemaElement)((0,_swagger_api_apidom_json_pointer__WEBPACK_IMPORTED_MODULE_10__["default"])(selector, reference.value.result));
|
|
2937
2968
|
}
|
|
2938
2969
|
} catch (error) {
|
|
2939
2970
|
/**
|
|
2940
2971
|
* No SchemaElement($id=URL) was not found, so we're going to try to resolve
|
|
2941
2972
|
* the URL and assume the returned response is a JSON Schema.
|
|
2942
2973
|
*/
|
|
2943
|
-
if (isURL && error instanceof
|
|
2944
|
-
if ((0,_swagger_api_apidom_reference_dereference_strategies_openapi_3_1_selectors_$
|
|
2974
|
+
if (isURL && error instanceof _swagger_api_apidom_reference_dereference_strategies_openapi_3_1_selectors_uri__WEBPACK_IMPORTED_MODULE_22__["default"]) {
|
|
2975
|
+
if ((0,_swagger_api_apidom_reference_dereference_strategies_openapi_3_1_selectors_$anchor__WEBPACK_IMPORTED_MODULE_23__.isAnchor)((0,_swagger_api_apidom_reference_dereference_strategies_openapi_3_1_selectors_$anchor__WEBPACK_IMPORTED_MODULE_23__.uriToAnchor)($refBaseURI))) {
|
|
2945
2976
|
// we're dealing with JSON Schema $anchor here
|
|
2946
|
-
reference = await this.toReference(
|
|
2977
|
+
reference = await this.toReference(_swagger_api_apidom_reference_configuration_empty__WEBPACK_IMPORTED_MODULE_8__.unsanitize($refBaseURI));
|
|
2947
2978
|
retrievalURI = reference.uri;
|
|
2948
|
-
const selector = (0,_swagger_api_apidom_reference_dereference_strategies_openapi_3_1_selectors_$
|
|
2949
|
-
referencedElement = (0,_swagger_api_apidom_reference_dereference_strategies_openapi_3_1_selectors_$
|
|
2979
|
+
const selector = (0,_swagger_api_apidom_reference_dereference_strategies_openapi_3_1_selectors_$anchor__WEBPACK_IMPORTED_MODULE_23__.uriToAnchor)($refBaseURI);
|
|
2980
|
+
referencedElement = (0,_swagger_api_apidom_reference_dereference_strategies_openapi_3_1_selectors_$anchor__WEBPACK_IMPORTED_MODULE_23__.evaluate)(selector, (0,_swagger_api_apidom_reference_dereference_strategies_openapi_3_1__WEBPACK_IMPORTED_MODULE_19__.maybeRefractToSchemaElement)(reference.value.result));
|
|
2950
2981
|
} else {
|
|
2951
2982
|
// we're assuming here that we're dealing with JSON Pointer here
|
|
2952
|
-
reference = await this.toReference(
|
|
2983
|
+
reference = await this.toReference(_swagger_api_apidom_reference_configuration_empty__WEBPACK_IMPORTED_MODULE_8__.unsanitize($refBaseURI));
|
|
2953
2984
|
retrievalURI = reference.uri;
|
|
2954
|
-
const selector = (0,
|
|
2955
|
-
referencedElement = (0,
|
|
2985
|
+
const selector = (0,_swagger_api_apidom_json_pointer__WEBPACK_IMPORTED_MODULE_9__.uriToPointer)($refBaseURI);
|
|
2986
|
+
referencedElement = (0,_swagger_api_apidom_reference_dereference_strategies_openapi_3_1__WEBPACK_IMPORTED_MODULE_19__.maybeRefractToSchemaElement)((0,_swagger_api_apidom_json_pointer__WEBPACK_IMPORTED_MODULE_10__["default"])(selector, reference.value.result));
|
|
2956
2987
|
}
|
|
2957
2988
|
} else {
|
|
2958
2989
|
throw error;
|
|
@@ -2961,24 +2992,26 @@ const OpenApi3_1SwaggerClientDereferenceVisitor = _swagger_api_apidom_reference_
|
|
|
2961
2992
|
|
|
2962
2993
|
// detect direct or indirect reference
|
|
2963
2994
|
if (this.indirections.includes(referencedElement)) {
|
|
2964
|
-
throw new
|
|
2995
|
+
throw new _swagger_api_apidom_error__WEBPACK_IMPORTED_MODULE_13__["default"]('Recursive Schema Object reference detected');
|
|
2965
2996
|
}
|
|
2966
2997
|
|
|
2967
2998
|
// detect maximum depth of dereferencing
|
|
2968
2999
|
if (this.indirections.length > this.options.dereference.maxDepth) {
|
|
2969
|
-
throw new
|
|
3000
|
+
throw new _swagger_api_apidom_reference_configuration_empty__WEBPACK_IMPORTED_MODULE_14__["default"](`Maximum dereference depth of "${this.options.dereference.maxDepth}" has been exceeded in file "${this.reference.uri}"`);
|
|
2970
3001
|
}
|
|
2971
3002
|
|
|
2972
3003
|
// useCircularStructures option processing
|
|
2973
3004
|
if (!this.useCircularStructures) {
|
|
2974
|
-
const hasCycles = ancestorsLineage.
|
|
3005
|
+
const hasCycles = ancestorsLineage.includes(referencedElement);
|
|
2975
3006
|
if (hasCycles) {
|
|
2976
|
-
if (
|
|
3007
|
+
if (_swagger_api_apidom_reference_configuration_empty__WEBPACK_IMPORTED_MODULE_8__.isHttpUrl(retrievalURI) || _swagger_api_apidom_reference_configuration_empty__WEBPACK_IMPORTED_MODULE_8__.isFileSystemPath(retrievalURI)) {
|
|
2977
3008
|
// make the referencing URL or file system path absolute
|
|
2978
|
-
const baseURI =
|
|
2979
|
-
|
|
3009
|
+
const baseURI = _swagger_api_apidom_reference_configuration_empty__WEBPACK_IMPORTED_MODULE_8__.resolve(retrievalURI, $refBaseURI);
|
|
3010
|
+
const cycledSchemaElement = new _swagger_api_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_12__.SchemaElement({
|
|
2980
3011
|
$ref: baseURI
|
|
2981
|
-
}, (0,
|
|
3012
|
+
}, (0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_15__.cloneDeep)(referencingElement.meta), (0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_15__.cloneDeep)(referencingElement.attributes));
|
|
3013
|
+
cycledSchemaElement.get('$ref').classes.push('cycle');
|
|
3014
|
+
return cycledSchemaElement;
|
|
2982
3015
|
}
|
|
2983
3016
|
// skip processing this schema and all it's child schemas
|
|
2984
3017
|
return false;
|
|
@@ -2997,47 +3030,51 @@ const OpenApi3_1SwaggerClientDereferenceVisitor = _swagger_api_apidom_reference_
|
|
|
2997
3030
|
useCircularStructures: this.useCircularStructures,
|
|
2998
3031
|
allowMetaPatches: this.allowMetaPatches,
|
|
2999
3032
|
ancestors: ancestorsLineage,
|
|
3000
|
-
basePath: this.basePath ?? [...(0,
|
|
3033
|
+
basePath: this.basePath ?? [...(0,_utils_to_path_js__WEBPACK_IMPORTED_MODULE_16__["default"])([...ancestors, parent, referencingElement]), '$ref']
|
|
3001
3034
|
});
|
|
3002
3035
|
referencedElement = await visitAsync(referencedElement, mergeVisitor, {
|
|
3003
|
-
keyMap:
|
|
3004
|
-
nodeTypeGetter:
|
|
3036
|
+
keyMap: _swagger_api_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_17__.keyMap,
|
|
3037
|
+
nodeTypeGetter: _swagger_api_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_17__.getNodeType
|
|
3005
3038
|
});
|
|
3006
3039
|
|
|
3007
3040
|
// remove referencing schema from ancestors lineage
|
|
3008
3041
|
directAncestors.delete(referencingElement);
|
|
3009
3042
|
this.indirections.pop();
|
|
3010
|
-
if ((0,
|
|
3011
|
-
const booleanJsonSchemaElement = (0,
|
|
3043
|
+
if ((0,_swagger_api_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_7__.isBooleanJsonSchemaElement)(referencedElement)) {
|
|
3044
|
+
const booleanJsonSchemaElement = (0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_15__.cloneDeep)(referencedElement);
|
|
3012
3045
|
// annotate referenced element with info about original referencing element
|
|
3013
3046
|
booleanJsonSchemaElement.setMetaProperty('ref-fields', {
|
|
3014
|
-
$ref: (0,
|
|
3047
|
+
$ref: (0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_4__["default"])(referencingElement.$ref)
|
|
3015
3048
|
});
|
|
3016
3049
|
// annotate referenced element with info about origin
|
|
3017
3050
|
booleanJsonSchemaElement.setMetaProperty('ref-origin', reference.uri);
|
|
3051
|
+
// annotate fragment with info about referencing element
|
|
3052
|
+
booleanJsonSchemaElement.setMetaProperty('ref-referencing-element-id', (0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_15__.cloneDeep)(identityManager.identify(referencingElement)));
|
|
3018
3053
|
return booleanJsonSchemaElement;
|
|
3019
3054
|
}
|
|
3020
3055
|
const mergeAndAnnotateReferencedElement = refedElement => {
|
|
3021
3056
|
// Schema Object - merge keywords from referenced schema with referencing schema
|
|
3022
|
-
const mergedElement = new
|
|
3057
|
+
const mergedElement = new _swagger_api_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_12__.SchemaElement([...refedElement.content], (0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_15__.cloneDeep)(refedElement.meta), (0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_15__.cloneDeep)(refedElement.attributes));
|
|
3023
3058
|
// existing keywords from referencing schema overrides ones from referenced schema
|
|
3024
3059
|
referencingElement.forEach((value, keyElement, item) => {
|
|
3025
|
-
mergedElement.remove((0,
|
|
3060
|
+
mergedElement.remove((0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_4__["default"])(keyElement));
|
|
3026
3061
|
mergedElement.content.push(item);
|
|
3027
3062
|
});
|
|
3028
3063
|
mergedElement.remove('$ref');
|
|
3029
3064
|
// annotate referenced element with info about original referencing element
|
|
3030
3065
|
mergedElement.setMetaProperty('ref-fields', {
|
|
3031
|
-
$ref: (0,
|
|
3066
|
+
$ref: (0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_4__["default"])(referencingElement.$ref)
|
|
3032
3067
|
});
|
|
3033
3068
|
// annotate fragment with info about origin
|
|
3034
3069
|
mergedElement.setMetaProperty('ref-origin', reference.uri);
|
|
3070
|
+
// annotate fragment with info about referencing element
|
|
3071
|
+
mergedElement.setMetaProperty('ref-referencing-element-id', (0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_15__.cloneDeep)(identityManager.identify(referencingElement)));
|
|
3035
3072
|
|
|
3036
3073
|
// allowMetaPatches option processing
|
|
3037
3074
|
if (this.allowMetaPatches) {
|
|
3038
3075
|
// apply meta patch only when not already applied
|
|
3039
3076
|
if (typeof mergedElement.get('$$ref') === 'undefined') {
|
|
3040
|
-
const baseURI =
|
|
3077
|
+
const baseURI = _swagger_api_apidom_reference_configuration_empty__WEBPACK_IMPORTED_MODULE_8__.resolve(retrievalURI, $refBaseURI);
|
|
3041
3078
|
mergedElement.set('$$ref', baseURI);
|
|
3042
3079
|
}
|
|
3043
3080
|
}
|
|
@@ -3045,11 +3082,12 @@ const OpenApi3_1SwaggerClientDereferenceVisitor = _swagger_api_apidom_reference_
|
|
|
3045
3082
|
};
|
|
3046
3083
|
|
|
3047
3084
|
// attempting to create cycle
|
|
3048
|
-
if (ancestorsLineage.includes(referencedElement)) {
|
|
3049
|
-
|
|
3050
|
-
|
|
3085
|
+
if (ancestorsLineage.includes(referencingElement) || ancestorsLineage.includes(referencedElement)) {
|
|
3086
|
+
const replaceWith = ancestorsLineage.findItem(wasReferencedBy(referencingElement)) ?? mergeAndAnnotateReferencedElement(referencedElement);
|
|
3087
|
+
if ((0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_6__.isMemberElement)(parent)) {
|
|
3088
|
+
parent.value = replaceWith; // eslint-disable-line no-param-reassign
|
|
3051
3089
|
} else if (Array.isArray(parent)) {
|
|
3052
|
-
parent[key] =
|
|
3090
|
+
parent[key] = replaceWith; // eslint-disable-line no-param-reassign
|
|
3053
3091
|
}
|
|
3054
3092
|
|
|
3055
3093
|
return false;
|
|
@@ -3058,11 +3096,11 @@ const OpenApi3_1SwaggerClientDereferenceVisitor = _swagger_api_apidom_reference_
|
|
|
3058
3096
|
// transclude referencing element with merged referenced element
|
|
3059
3097
|
return mergeAndAnnotateReferencedElement(referencedElement);
|
|
3060
3098
|
} catch (error) {
|
|
3061
|
-
const rootCause = (0,
|
|
3099
|
+
const rootCause = (0,_utils_get_root_cause_js__WEBPACK_IMPORTED_MODULE_18__["default"])(error);
|
|
3062
3100
|
const wrappedError = new _errors_index_js__WEBPACK_IMPORTED_MODULE_1__.SchemaRefError(`Could not resolve reference: ${rootCause.message}`, {
|
|
3063
3101
|
baseDoc: this.reference.uri,
|
|
3064
|
-
$ref: (0,
|
|
3065
|
-
fullPath: this.basePath ?? [...(0,
|
|
3102
|
+
$ref: (0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_4__["default"])(referencingElement.$ref),
|
|
3103
|
+
fullPath: this.basePath ?? [...(0,_utils_to_path_js__WEBPACK_IMPORTED_MODULE_16__["default"])([...ancestors, parent, referencingElement]), '$ref']
|
|
3066
3104
|
}, rootCause);
|
|
3067
3105
|
this.options.dereference.dereferenceOpts?.errors?.push?.(wrappedError);
|
|
3068
3106
|
return undefined;
|
|
@@ -3078,13 +3116,13 @@ const OpenApi3_1SwaggerClientDereferenceVisitor = _swagger_api_apidom_reference_
|
|
|
3078
3116
|
},
|
|
3079
3117
|
async ExampleElement(exampleElement, key, parent, path, ancestors) {
|
|
3080
3118
|
try {
|
|
3081
|
-
return await
|
|
3119
|
+
return await _swagger_api_apidom_reference_dereference_strategies_openapi_3_1__WEBPACK_IMPORTED_MODULE_5__["default"].compose.methods.ExampleElement.call(this, exampleElement, key, parent, path, ancestors);
|
|
3082
3120
|
} catch (error) {
|
|
3083
|
-
const rootCause = (0,
|
|
3121
|
+
const rootCause = (0,_utils_get_root_cause_js__WEBPACK_IMPORTED_MODULE_18__["default"])(error);
|
|
3084
3122
|
const wrappedError = wrapError(rootCause, {
|
|
3085
3123
|
baseDoc: this.reference.uri,
|
|
3086
|
-
externalValue: (0,
|
|
3087
|
-
fullPath: this.basePath ?? [...(0,
|
|
3124
|
+
externalValue: (0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_4__["default"])(exampleElement.externalValue),
|
|
3125
|
+
fullPath: this.basePath ?? [...(0,_utils_to_path_js__WEBPACK_IMPORTED_MODULE_16__["default"])([...ancestors, parent, exampleElement]), 'externalValue']
|
|
3088
3126
|
});
|
|
3089
3127
|
this.options.dereference.dereferenceOpts?.errors?.push?.(wrappedError);
|
|
3090
3128
|
return undefined;
|
|
@@ -4166,7 +4204,7 @@ const resolveOpenAPI31Strategy = async options => {
|
|
|
4166
4204
|
if (jsonPointer !== '') refSet.rootRef = null; // reset root reference as we want fragment to become the root reference
|
|
4167
4205
|
|
|
4168
4206
|
// prepare ancestors; needed for cases where fragment is not OpenAPI element
|
|
4169
|
-
const ancestors = [new
|
|
4207
|
+
const ancestors = [new Set([fragmentElement])];
|
|
4170
4208
|
const errors = [];
|
|
4171
4209
|
const dereferenced = await (0,_swagger_api_apidom_reference_configuration_empty__WEBPACK_IMPORTED_MODULE_16__.dereferenceApiDOM)(fragmentElement, {
|
|
4172
4210
|
resolve: {
|
|
@@ -18827,6 +18865,480 @@ var trimCharsStart = (0,ramda__WEBPACK_IMPORTED_MODULE_0__.curry)(function (char
|
|
|
18827
18865
|
|
|
18828
18866
|
/***/ }),
|
|
18829
18867
|
|
|
18868
|
+
/***/ 77913:
|
|
18869
|
+
/***/ ((module) => {
|
|
18870
|
+
|
|
18871
|
+
"use strict";
|
|
18872
|
+
|
|
18873
|
+
var ShortUniqueId = (() => {
|
|
18874
|
+
var __defProp = Object.defineProperty;
|
|
18875
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
18876
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
18877
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
18878
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
18879
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
18880
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
18881
|
+
var __spreadValues = (a, b) => {
|
|
18882
|
+
for (var prop in b || (b = {}))
|
|
18883
|
+
if (__hasOwnProp.call(b, prop))
|
|
18884
|
+
__defNormalProp(a, prop, b[prop]);
|
|
18885
|
+
if (__getOwnPropSymbols)
|
|
18886
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
18887
|
+
if (__propIsEnum.call(b, prop))
|
|
18888
|
+
__defNormalProp(a, prop, b[prop]);
|
|
18889
|
+
}
|
|
18890
|
+
return a;
|
|
18891
|
+
};
|
|
18892
|
+
var __export = (target, all) => {
|
|
18893
|
+
for (var name in all)
|
|
18894
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
18895
|
+
};
|
|
18896
|
+
var __copyProps = (to, from, except, desc) => {
|
|
18897
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
18898
|
+
for (let key of __getOwnPropNames(from))
|
|
18899
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
18900
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
18901
|
+
}
|
|
18902
|
+
return to;
|
|
18903
|
+
};
|
|
18904
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18905
|
+
var __publicField = (obj, key, value) => {
|
|
18906
|
+
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
18907
|
+
return value;
|
|
18908
|
+
};
|
|
18909
|
+
|
|
18910
|
+
// src/index.ts
|
|
18911
|
+
var src_exports = {};
|
|
18912
|
+
__export(src_exports, {
|
|
18913
|
+
DEFAULT_OPTIONS: () => DEFAULT_OPTIONS,
|
|
18914
|
+
DEFAULT_UUID_LENGTH: () => DEFAULT_UUID_LENGTH,
|
|
18915
|
+
default: () => ShortUniqueId
|
|
18916
|
+
});
|
|
18917
|
+
|
|
18918
|
+
// package.json
|
|
18919
|
+
var version = "5.0.2";
|
|
18920
|
+
|
|
18921
|
+
// src/index.ts
|
|
18922
|
+
var DEFAULT_UUID_LENGTH = 6;
|
|
18923
|
+
var DEFAULT_OPTIONS = {
|
|
18924
|
+
dictionary: "alphanum",
|
|
18925
|
+
shuffle: true,
|
|
18926
|
+
debug: false,
|
|
18927
|
+
length: DEFAULT_UUID_LENGTH,
|
|
18928
|
+
counter: 0
|
|
18929
|
+
};
|
|
18930
|
+
var _ShortUniqueId = class _ShortUniqueId {
|
|
18931
|
+
constructor(argOptions = {}) {
|
|
18932
|
+
__publicField(this, "counter");
|
|
18933
|
+
__publicField(this, "debug");
|
|
18934
|
+
__publicField(this, "dict");
|
|
18935
|
+
__publicField(this, "version");
|
|
18936
|
+
__publicField(this, "dictIndex", 0);
|
|
18937
|
+
__publicField(this, "dictRange", []);
|
|
18938
|
+
__publicField(this, "lowerBound", 0);
|
|
18939
|
+
__publicField(this, "upperBound", 0);
|
|
18940
|
+
__publicField(this, "dictLength", 0);
|
|
18941
|
+
__publicField(this, "uuidLength");
|
|
18942
|
+
__publicField(this, "_digit_first_ascii", 48);
|
|
18943
|
+
__publicField(this, "_digit_last_ascii", 58);
|
|
18944
|
+
__publicField(this, "_alpha_lower_first_ascii", 97);
|
|
18945
|
+
__publicField(this, "_alpha_lower_last_ascii", 123);
|
|
18946
|
+
__publicField(this, "_hex_last_ascii", 103);
|
|
18947
|
+
__publicField(this, "_alpha_upper_first_ascii", 65);
|
|
18948
|
+
__publicField(this, "_alpha_upper_last_ascii", 91);
|
|
18949
|
+
__publicField(this, "_number_dict_ranges", {
|
|
18950
|
+
digits: [this._digit_first_ascii, this._digit_last_ascii]
|
|
18951
|
+
});
|
|
18952
|
+
__publicField(this, "_alpha_dict_ranges", {
|
|
18953
|
+
lowerCase: [this._alpha_lower_first_ascii, this._alpha_lower_last_ascii],
|
|
18954
|
+
upperCase: [this._alpha_upper_first_ascii, this._alpha_upper_last_ascii]
|
|
18955
|
+
});
|
|
18956
|
+
__publicField(this, "_alpha_lower_dict_ranges", {
|
|
18957
|
+
lowerCase: [this._alpha_lower_first_ascii, this._alpha_lower_last_ascii]
|
|
18958
|
+
});
|
|
18959
|
+
__publicField(this, "_alpha_upper_dict_ranges", {
|
|
18960
|
+
upperCase: [this._alpha_upper_first_ascii, this._alpha_upper_last_ascii]
|
|
18961
|
+
});
|
|
18962
|
+
__publicField(this, "_alphanum_dict_ranges", {
|
|
18963
|
+
digits: [this._digit_first_ascii, this._digit_last_ascii],
|
|
18964
|
+
lowerCase: [this._alpha_lower_first_ascii, this._alpha_lower_last_ascii],
|
|
18965
|
+
upperCase: [this._alpha_upper_first_ascii, this._alpha_upper_last_ascii]
|
|
18966
|
+
});
|
|
18967
|
+
__publicField(this, "_alphanum_lower_dict_ranges", {
|
|
18968
|
+
digits: [this._digit_first_ascii, this._digit_last_ascii],
|
|
18969
|
+
lowerCase: [this._alpha_lower_first_ascii, this._alpha_lower_last_ascii]
|
|
18970
|
+
});
|
|
18971
|
+
__publicField(this, "_alphanum_upper_dict_ranges", {
|
|
18972
|
+
digits: [this._digit_first_ascii, this._digit_last_ascii],
|
|
18973
|
+
upperCase: [this._alpha_upper_first_ascii, this._alpha_upper_last_ascii]
|
|
18974
|
+
});
|
|
18975
|
+
__publicField(this, "_hex_dict_ranges", {
|
|
18976
|
+
decDigits: [this._digit_first_ascii, this._digit_last_ascii],
|
|
18977
|
+
alphaDigits: [this._alpha_lower_first_ascii, this._hex_last_ascii]
|
|
18978
|
+
});
|
|
18979
|
+
__publicField(this, "_dict_ranges", {
|
|
18980
|
+
_number_dict_ranges: this._number_dict_ranges,
|
|
18981
|
+
_alpha_dict_ranges: this._alpha_dict_ranges,
|
|
18982
|
+
_alpha_lower_dict_ranges: this._alpha_lower_dict_ranges,
|
|
18983
|
+
_alpha_upper_dict_ranges: this._alpha_upper_dict_ranges,
|
|
18984
|
+
_alphanum_dict_ranges: this._alphanum_dict_ranges,
|
|
18985
|
+
_alphanum_lower_dict_ranges: this._alphanum_lower_dict_ranges,
|
|
18986
|
+
_alphanum_upper_dict_ranges: this._alphanum_upper_dict_ranges,
|
|
18987
|
+
_hex_dict_ranges: this._hex_dict_ranges
|
|
18988
|
+
});
|
|
18989
|
+
/* tslint:disable consistent-return */
|
|
18990
|
+
__publicField(this, "log", (...args) => {
|
|
18991
|
+
const finalArgs = [...args];
|
|
18992
|
+
finalArgs[0] = `[short-unique-id] ${args[0]}`;
|
|
18993
|
+
if (this.debug === true) {
|
|
18994
|
+
if (typeof console !== "undefined" && console !== null) {
|
|
18995
|
+
return console.log(...finalArgs);
|
|
18996
|
+
}
|
|
18997
|
+
}
|
|
18998
|
+
});
|
|
18999
|
+
/* tslint:enable consistent-return */
|
|
19000
|
+
/** Change the dictionary after initialization. */
|
|
19001
|
+
__publicField(this, "setDictionary", (dictionary, shuffle) => {
|
|
19002
|
+
let finalDict;
|
|
19003
|
+
if (dictionary && Array.isArray(dictionary) && dictionary.length > 1) {
|
|
19004
|
+
finalDict = dictionary;
|
|
19005
|
+
} else {
|
|
19006
|
+
finalDict = [];
|
|
19007
|
+
let i;
|
|
19008
|
+
this.dictIndex = i = 0;
|
|
19009
|
+
const rangesName = `_${dictionary}_dict_ranges`;
|
|
19010
|
+
const ranges = this._dict_ranges[rangesName];
|
|
19011
|
+
Object.keys(ranges).forEach((rangeType) => {
|
|
19012
|
+
const rangeTypeKey = rangeType;
|
|
19013
|
+
this.dictRange = ranges[rangeTypeKey];
|
|
19014
|
+
this.lowerBound = this.dictRange[0];
|
|
19015
|
+
this.upperBound = this.dictRange[1];
|
|
19016
|
+
for (this.dictIndex = i = this.lowerBound; this.lowerBound <= this.upperBound ? i < this.upperBound : i > this.upperBound; this.dictIndex = this.lowerBound <= this.upperBound ? i += 1 : i -= 1) {
|
|
19017
|
+
finalDict.push(String.fromCharCode(this.dictIndex));
|
|
19018
|
+
}
|
|
19019
|
+
});
|
|
19020
|
+
}
|
|
19021
|
+
if (shuffle) {
|
|
19022
|
+
const PROBABILITY = 0.5;
|
|
19023
|
+
finalDict = finalDict.sort(() => Math.random() - PROBABILITY);
|
|
19024
|
+
}
|
|
19025
|
+
this.dict = finalDict;
|
|
19026
|
+
this.dictLength = this.dict.length;
|
|
19027
|
+
this.setCounter(0);
|
|
19028
|
+
});
|
|
19029
|
+
__publicField(this, "seq", () => {
|
|
19030
|
+
return this.sequentialUUID();
|
|
19031
|
+
});
|
|
19032
|
+
/**
|
|
19033
|
+
* Generates UUID based on internal counter that's incremented after each ID generation.
|
|
19034
|
+
* @alias `const uid = new ShortUniqueId(); uid.seq();`
|
|
19035
|
+
*/
|
|
19036
|
+
__publicField(this, "sequentialUUID", () => {
|
|
19037
|
+
let counterDiv;
|
|
19038
|
+
let counterRem;
|
|
19039
|
+
let id = "";
|
|
19040
|
+
counterDiv = this.counter;
|
|
19041
|
+
do {
|
|
19042
|
+
counterRem = counterDiv % this.dictLength;
|
|
19043
|
+
counterDiv = Math.trunc(counterDiv / this.dictLength);
|
|
19044
|
+
id += this.dict[counterRem];
|
|
19045
|
+
} while (counterDiv !== 0);
|
|
19046
|
+
this.counter += 1;
|
|
19047
|
+
return id;
|
|
19048
|
+
});
|
|
19049
|
+
__publicField(this, "rnd", (uuidLength = this.uuidLength || DEFAULT_UUID_LENGTH) => {
|
|
19050
|
+
return this.randomUUID(uuidLength);
|
|
19051
|
+
});
|
|
19052
|
+
/**
|
|
19053
|
+
* Generates UUID by creating each part randomly.
|
|
19054
|
+
* @alias `const uid = new ShortUniqueId(); uid.rnd(uuidLength: number);`
|
|
19055
|
+
*/
|
|
19056
|
+
__publicField(this, "randomUUID", (uuidLength = this.uuidLength || DEFAULT_UUID_LENGTH) => {
|
|
19057
|
+
let id;
|
|
19058
|
+
let randomPartIdx;
|
|
19059
|
+
let j;
|
|
19060
|
+
if (uuidLength === null || typeof uuidLength === "undefined" || uuidLength < 1) {
|
|
19061
|
+
throw new Error("Invalid UUID Length Provided");
|
|
19062
|
+
}
|
|
19063
|
+
const isPositive = uuidLength >= 0;
|
|
19064
|
+
id = "";
|
|
19065
|
+
for (j = 0; j < uuidLength; j += 1) {
|
|
19066
|
+
randomPartIdx = parseInt(
|
|
19067
|
+
(Math.random() * this.dictLength).toFixed(0),
|
|
19068
|
+
10
|
|
19069
|
+
) % this.dictLength;
|
|
19070
|
+
id += this.dict[randomPartIdx];
|
|
19071
|
+
}
|
|
19072
|
+
return id;
|
|
19073
|
+
});
|
|
19074
|
+
__publicField(this, "fmt", (format, date) => {
|
|
19075
|
+
return this.formattedUUID(format, date);
|
|
19076
|
+
});
|
|
19077
|
+
/**
|
|
19078
|
+
* Generates custom UUID with the provided format string.
|
|
19079
|
+
* @alias `const uid = new ShortUniqueId(); uid.fmt(format: string);`
|
|
19080
|
+
*/
|
|
19081
|
+
__publicField(this, "formattedUUID", (format, date) => {
|
|
19082
|
+
const fnMap = {
|
|
19083
|
+
"$r": this.randomUUID,
|
|
19084
|
+
"$s": this.sequentialUUID,
|
|
19085
|
+
"$t": this.stamp
|
|
19086
|
+
};
|
|
19087
|
+
const result = format.replace(
|
|
19088
|
+
/\$[rs]\d{0,}|\$t0|\$t[1-9]\d{1,}/g,
|
|
19089
|
+
(m) => {
|
|
19090
|
+
const fn = m.slice(0, 2);
|
|
19091
|
+
const len = parseInt(m.slice(2), 10);
|
|
19092
|
+
if (fn === "$s") {
|
|
19093
|
+
return fnMap[fn]().padStart(len, "0");
|
|
19094
|
+
}
|
|
19095
|
+
if (fn === "$t" && date) {
|
|
19096
|
+
return fnMap[fn](len, date);
|
|
19097
|
+
}
|
|
19098
|
+
return fnMap[fn](len);
|
|
19099
|
+
}
|
|
19100
|
+
);
|
|
19101
|
+
return result;
|
|
19102
|
+
});
|
|
19103
|
+
/**
|
|
19104
|
+
* Calculates total number of possible UUIDs.
|
|
19105
|
+
*
|
|
19106
|
+
* Given that:
|
|
19107
|
+
*
|
|
19108
|
+
* - `H` is the total number of possible UUIDs
|
|
19109
|
+
* - `n` is the number of unique characters in the dictionary
|
|
19110
|
+
* - `l` is the UUID length
|
|
19111
|
+
*
|
|
19112
|
+
* Then `H` is defined as `n` to the power of `l`:
|
|
19113
|
+
*
|
|
19114
|
+
* <div style="background: white; padding: 5px; border-radius: 5px; overflow: hidden;">
|
|
19115
|
+
* <img src="https://render.githubusercontent.com/render/math?math=%5CHuge%20H=n%5El"/>
|
|
19116
|
+
* </div>
|
|
19117
|
+
*
|
|
19118
|
+
* This function returns `H`.
|
|
19119
|
+
*/
|
|
19120
|
+
__publicField(this, "availableUUIDs", (uuidLength = this.uuidLength) => {
|
|
19121
|
+
return parseFloat(
|
|
19122
|
+
Math.pow([...new Set(this.dict)].length, uuidLength).toFixed(0)
|
|
19123
|
+
);
|
|
19124
|
+
});
|
|
19125
|
+
/**
|
|
19126
|
+
* Calculates approximate number of hashes before first collision.
|
|
19127
|
+
*
|
|
19128
|
+
* Given that:
|
|
19129
|
+
*
|
|
19130
|
+
* - `H` is the total number of possible UUIDs, or in terms of this library,
|
|
19131
|
+
* the result of running `availableUUIDs()`
|
|
19132
|
+
* - the expected number of values we have to choose before finding the
|
|
19133
|
+
* first collision can be expressed as the quantity `Q(H)`
|
|
19134
|
+
*
|
|
19135
|
+
* Then `Q(H)` can be approximated as the square root of the product of half
|
|
19136
|
+
* of pi times `H`:
|
|
19137
|
+
*
|
|
19138
|
+
* <div style="background: white; padding: 5px; border-radius: 5px; overflow: hidden;">
|
|
19139
|
+
* <img src="https://render.githubusercontent.com/render/math?math=%5CHuge%20Q(H)%5Capprox%5Csqrt%7B%5Cfrac%7B%5Cpi%7D%7B2%7DH%7D"/>
|
|
19140
|
+
* </div>
|
|
19141
|
+
*
|
|
19142
|
+
* This function returns `Q(H)`.
|
|
19143
|
+
*
|
|
19144
|
+
* (see [Poisson distribution](https://en.wikipedia.org/wiki/Poisson_distribution))
|
|
19145
|
+
*/
|
|
19146
|
+
__publicField(this, "approxMaxBeforeCollision", (rounds = this.availableUUIDs(this.uuidLength)) => {
|
|
19147
|
+
return parseFloat(
|
|
19148
|
+
Math.sqrt(Math.PI / 2 * rounds).toFixed(20)
|
|
19149
|
+
);
|
|
19150
|
+
});
|
|
19151
|
+
/**
|
|
19152
|
+
* Calculates probability of generating duplicate UUIDs (a collision) in a
|
|
19153
|
+
* given number of UUID generation rounds.
|
|
19154
|
+
*
|
|
19155
|
+
* Given that:
|
|
19156
|
+
*
|
|
19157
|
+
* - `r` is the maximum number of times that `randomUUID()` will be called,
|
|
19158
|
+
* or better said the number of _rounds_
|
|
19159
|
+
* - `H` is the total number of possible UUIDs, or in terms of this library,
|
|
19160
|
+
* the result of running `availableUUIDs()`
|
|
19161
|
+
*
|
|
19162
|
+
* Then the probability of collision `p(r; H)` can be approximated as the result
|
|
19163
|
+
* of dividing the square root of the product of half of pi times `r` by `H`:
|
|
19164
|
+
*
|
|
19165
|
+
* <div style="background: white; padding: 5px; border-radius: 5px; overflow: hidden;">
|
|
19166
|
+
* <img src="https://render.githubusercontent.com/render/math?math=%5CHuge%20p(r%3B%20H)%5Capprox%5Cfrac%7B%5Csqrt%7B%5Cfrac%7B%5Cpi%7D%7B2%7Dr%7D%7D%7BH%7D"/>
|
|
19167
|
+
* </div>
|
|
19168
|
+
*
|
|
19169
|
+
* This function returns `p(r; H)`.
|
|
19170
|
+
*
|
|
19171
|
+
* (see [Poisson distribution](https://en.wikipedia.org/wiki/Poisson_distribution))
|
|
19172
|
+
*
|
|
19173
|
+
* (Useful if you are wondering _"If I use this lib and expect to perform at most
|
|
19174
|
+
* `r` rounds of UUID generations, what is the probability that I will hit a duplicate UUID?"_.)
|
|
19175
|
+
*/
|
|
19176
|
+
__publicField(this, "collisionProbability", (rounds = this.availableUUIDs(this.uuidLength), uuidLength = this.uuidLength) => {
|
|
19177
|
+
return parseFloat(
|
|
19178
|
+
(this.approxMaxBeforeCollision(rounds) / this.availableUUIDs(uuidLength)).toFixed(20)
|
|
19179
|
+
);
|
|
19180
|
+
});
|
|
19181
|
+
/**
|
|
19182
|
+
* Calculate a "uniqueness" score (from 0 to 1) of UUIDs based on size of
|
|
19183
|
+
* dictionary and chosen UUID length.
|
|
19184
|
+
*
|
|
19185
|
+
* Given that:
|
|
19186
|
+
*
|
|
19187
|
+
* - `H` is the total number of possible UUIDs, or in terms of this library,
|
|
19188
|
+
* the result of running `availableUUIDs()`
|
|
19189
|
+
* - `Q(H)` is the approximate number of hashes before first collision,
|
|
19190
|
+
* or in terms of this library, the result of running `approxMaxBeforeCollision()`
|
|
19191
|
+
*
|
|
19192
|
+
* Then `uniqueness` can be expressed as the additive inverse of the probability of
|
|
19193
|
+
* generating a "word" I had previously generated (a duplicate) at any given iteration
|
|
19194
|
+
* up to the the total number of possible UUIDs expressed as the quotiend of `Q(H)` and `H`:
|
|
19195
|
+
*
|
|
19196
|
+
* <div style="background: white; padding: 5px; border-radius: 5px; overflow: hidden;">
|
|
19197
|
+
* <img src="https://render.githubusercontent.com/render/math?math=%5CHuge%201-%5Cfrac%7BQ(H)%7D%7BH%7D"/>
|
|
19198
|
+
* </div>
|
|
19199
|
+
*
|
|
19200
|
+
* (Useful if you need a value to rate the "quality" of the combination of given dictionary
|
|
19201
|
+
* and UUID length. The closer to 1, higher the uniqueness and thus better the quality.)
|
|
19202
|
+
*/
|
|
19203
|
+
__publicField(this, "uniqueness", (rounds = this.availableUUIDs(this.uuidLength)) => {
|
|
19204
|
+
const score = parseFloat(
|
|
19205
|
+
(1 - this.approxMaxBeforeCollision(rounds) / rounds).toFixed(20)
|
|
19206
|
+
);
|
|
19207
|
+
return score > 1 ? 1 : score < 0 ? 0 : score;
|
|
19208
|
+
});
|
|
19209
|
+
/**
|
|
19210
|
+
* Return the version of this module.
|
|
19211
|
+
*/
|
|
19212
|
+
__publicField(this, "getVersion", () => {
|
|
19213
|
+
return this.version;
|
|
19214
|
+
});
|
|
19215
|
+
/**
|
|
19216
|
+
* Generates a UUID with a timestamp that can be extracted using `uid.parseStamp(stampString);`.
|
|
19217
|
+
*
|
|
19218
|
+
* ```js
|
|
19219
|
+
* const uidWithTimestamp = uid.stamp(32);
|
|
19220
|
+
* console.log(uidWithTimestamp);
|
|
19221
|
+
* // GDa608f973aRCHLXQYPTbKDbjDeVsSb3
|
|
19222
|
+
*
|
|
19223
|
+
* console.log(uid.parseStamp(uidWithTimestamp));
|
|
19224
|
+
* // 2021-05-03T06:24:58.000Z
|
|
19225
|
+
* ```
|
|
19226
|
+
*/
|
|
19227
|
+
__publicField(this, "stamp", (finalLength, date) => {
|
|
19228
|
+
const hexStamp = Math.floor(+(date || /* @__PURE__ */ new Date()) / 1e3).toString(16);
|
|
19229
|
+
if (typeof finalLength === "number" && finalLength === 0) {
|
|
19230
|
+
return hexStamp;
|
|
19231
|
+
}
|
|
19232
|
+
if (typeof finalLength !== "number" || finalLength < 10) {
|
|
19233
|
+
throw new Error(
|
|
19234
|
+
[
|
|
19235
|
+
"Param finalLength must be a number greater than or equal to 10,",
|
|
19236
|
+
"or 0 if you want the raw hexadecimal timestamp"
|
|
19237
|
+
].join("\n")
|
|
19238
|
+
);
|
|
19239
|
+
}
|
|
19240
|
+
const idLength = finalLength - 9;
|
|
19241
|
+
const rndIdx = Math.round(Math.random() * (idLength > 15 ? 15 : idLength));
|
|
19242
|
+
const id = this.randomUUID(idLength);
|
|
19243
|
+
return `${id.substring(0, rndIdx)}${hexStamp}${id.substring(rndIdx)}${rndIdx.toString(16)}`;
|
|
19244
|
+
});
|
|
19245
|
+
/**
|
|
19246
|
+
* Extracts the date embeded in a UUID generated using the `uid.stamp(finalLength);` method.
|
|
19247
|
+
*
|
|
19248
|
+
* ```js
|
|
19249
|
+
* const uidWithTimestamp = uid.stamp(32);
|
|
19250
|
+
* console.log(uidWithTimestamp);
|
|
19251
|
+
* // GDa608f973aRCHLXQYPTbKDbjDeVsSb3
|
|
19252
|
+
*
|
|
19253
|
+
* console.log(uid.parseStamp(uidWithTimestamp));
|
|
19254
|
+
* // 2021-05-03T06:24:58.000Z
|
|
19255
|
+
* ```
|
|
19256
|
+
*/
|
|
19257
|
+
__publicField(this, "parseStamp", (suid, format) => {
|
|
19258
|
+
if (format && !/t0|t[1-9]\d{1,}/.test(format)) {
|
|
19259
|
+
throw new Error("Cannot extract date from a formated UUID with no timestamp in the format");
|
|
19260
|
+
}
|
|
19261
|
+
const stamp = format ? format.replace(
|
|
19262
|
+
/\$[rs]\d{0,}|\$t0|\$t[1-9]\d{1,}/g,
|
|
19263
|
+
(m) => {
|
|
19264
|
+
const fnMap = {
|
|
19265
|
+
"$r": (len2) => [...Array(len2)].map(() => "r").join(""),
|
|
19266
|
+
"$s": (len2) => [...Array(len2)].map(() => "s").join(""),
|
|
19267
|
+
"$t": (len2) => [...Array(len2)].map(() => "t").join("")
|
|
19268
|
+
};
|
|
19269
|
+
const fn = m.slice(0, 2);
|
|
19270
|
+
const len = parseInt(m.slice(2), 10);
|
|
19271
|
+
return fnMap[fn](len);
|
|
19272
|
+
}
|
|
19273
|
+
).replace(
|
|
19274
|
+
/^(.*?)(t{8,})(.*)$/g,
|
|
19275
|
+
(_m, p1, p2) => {
|
|
19276
|
+
return suid.substring(p1.length, p1.length + p2.length);
|
|
19277
|
+
}
|
|
19278
|
+
) : suid;
|
|
19279
|
+
if (stamp.length === 8) {
|
|
19280
|
+
return new Date(parseInt(stamp, 16) * 1e3);
|
|
19281
|
+
}
|
|
19282
|
+
if (stamp.length < 10) {
|
|
19283
|
+
throw new Error("Stamp length invalid");
|
|
19284
|
+
}
|
|
19285
|
+
const rndIdx = parseInt(stamp.substring(stamp.length - 1), 16);
|
|
19286
|
+
return new Date(parseInt(stamp.substring(rndIdx, rndIdx + 8), 16) * 1e3);
|
|
19287
|
+
});
|
|
19288
|
+
/**
|
|
19289
|
+
* Set the counter to a specific value.
|
|
19290
|
+
*/
|
|
19291
|
+
__publicField(this, "setCounter", (counter) => {
|
|
19292
|
+
this.counter = counter;
|
|
19293
|
+
});
|
|
19294
|
+
const options = __spreadValues(__spreadValues({}, DEFAULT_OPTIONS), argOptions);
|
|
19295
|
+
this.counter = 0;
|
|
19296
|
+
this.debug = false;
|
|
19297
|
+
this.dict = [];
|
|
19298
|
+
this.version = version;
|
|
19299
|
+
const {
|
|
19300
|
+
dictionary,
|
|
19301
|
+
shuffle,
|
|
19302
|
+
length,
|
|
19303
|
+
counter
|
|
19304
|
+
} = options;
|
|
19305
|
+
this.uuidLength = length;
|
|
19306
|
+
this.setDictionary(dictionary, shuffle);
|
|
19307
|
+
this.setCounter(counter);
|
|
19308
|
+
this.debug = options.debug;
|
|
19309
|
+
this.log(this.dict);
|
|
19310
|
+
this.log(
|
|
19311
|
+
`Generator instantiated with Dictionary Size ${this.dictLength} and counter set to ${this.counter}`
|
|
19312
|
+
);
|
|
19313
|
+
this.log = this.log.bind(this);
|
|
19314
|
+
this.setDictionary = this.setDictionary.bind(this);
|
|
19315
|
+
this.setCounter = this.setCounter.bind(this);
|
|
19316
|
+
this.seq = this.seq.bind(this);
|
|
19317
|
+
this.sequentialUUID = this.sequentialUUID.bind(this);
|
|
19318
|
+
this.rnd = this.rnd.bind(this);
|
|
19319
|
+
this.randomUUID = this.randomUUID.bind(this);
|
|
19320
|
+
this.fmt = this.fmt.bind(this);
|
|
19321
|
+
this.formattedUUID = this.formattedUUID.bind(this);
|
|
19322
|
+
this.availableUUIDs = this.availableUUIDs.bind(this);
|
|
19323
|
+
this.approxMaxBeforeCollision = this.approxMaxBeforeCollision.bind(this);
|
|
19324
|
+
this.collisionProbability = this.collisionProbability.bind(this);
|
|
19325
|
+
this.uniqueness = this.uniqueness.bind(this);
|
|
19326
|
+
this.getVersion = this.getVersion.bind(this);
|
|
19327
|
+
this.stamp = this.stamp.bind(this);
|
|
19328
|
+
this.parseStamp = this.parseStamp.bind(this);
|
|
19329
|
+
return this;
|
|
19330
|
+
}
|
|
19331
|
+
};
|
|
19332
|
+
/** @hidden */
|
|
19333
|
+
__publicField(_ShortUniqueId, "default", _ShortUniqueId);
|
|
19334
|
+
var ShortUniqueId = _ShortUniqueId;
|
|
19335
|
+
return __toCommonJS(src_exports);
|
|
19336
|
+
})();
|
|
19337
|
+
//# sourceMappingURL=short-unique-id.js.map
|
|
19338
|
+
true&&(module.exports=ShortUniqueId.default),'undefined'!=typeof window&&(ShortUniqueId=ShortUniqueId.default);
|
|
19339
|
+
|
|
19340
|
+
/***/ }),
|
|
19341
|
+
|
|
18830
19342
|
/***/ 37478:
|
|
18831
19343
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
18832
19344
|
|
|
@@ -19648,8 +20160,9 @@ visitor, {
|
|
|
19648
20160
|
}
|
|
19649
20161
|
} while (stack !== undefined);
|
|
19650
20162
|
if (edits.length !== 0) {
|
|
19651
|
-
return edits.
|
|
20163
|
+
return edits[edits.length - 1][1]; // @TODO(vladimir.gorej@gmail.com): can be replaced by Array.prototype.at in future
|
|
19652
20164
|
}
|
|
20165
|
+
|
|
19653
20166
|
return root;
|
|
19654
20167
|
};
|
|
19655
20168
|
|
|
@@ -19800,8 +20313,9 @@ visitor, {
|
|
|
19800
20313
|
}
|
|
19801
20314
|
} while (stack !== undefined);
|
|
19802
20315
|
if (edits.length !== 0) {
|
|
19803
|
-
return edits.
|
|
20316
|
+
return edits[edits.length - 1][1]; // @TODO(vladimir.gorej@gmail.com): can be replaced by Array.prototype.at in future
|
|
19804
20317
|
}
|
|
20318
|
+
|
|
19805
20319
|
return root;
|
|
19806
20320
|
};
|
|
19807
20321
|
|
|
@@ -19823,7 +20337,7 @@ class CloneError extends _swagger_api_apidom_error__WEBPACK_IMPORTED_MODULE_0__[
|
|
|
19823
20337
|
constructor(message, structuredOptions) {
|
|
19824
20338
|
super(message, structuredOptions);
|
|
19825
20339
|
if (typeof structuredOptions !== 'undefined') {
|
|
19826
|
-
this.value = structuredOptions.
|
|
20340
|
+
this.value = structuredOptions.value;
|
|
19827
20341
|
}
|
|
19828
20342
|
}
|
|
19829
20343
|
}
|
|
@@ -20258,6 +20772,103 @@ class SourceMap extends minim__WEBPACK_IMPORTED_MODULE_0__.ArrayElement {
|
|
|
20258
20772
|
|
|
20259
20773
|
/***/ }),
|
|
20260
20774
|
|
|
20775
|
+
/***/ 66398:
|
|
20776
|
+
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
|
20777
|
+
|
|
20778
|
+
"use strict";
|
|
20779
|
+
__webpack_require__.r(__webpack_exports__);
|
|
20780
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
20781
|
+
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
20782
|
+
/* harmony export */ });
|
|
20783
|
+
/* harmony import */ var _swagger_api_apidom_error__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(29096);
|
|
20784
|
+
|
|
20785
|
+
class ElementIdentityError extends _swagger_api_apidom_error__WEBPACK_IMPORTED_MODULE_0__["default"] {
|
|
20786
|
+
constructor(message, structuredOptions) {
|
|
20787
|
+
super(message, structuredOptions);
|
|
20788
|
+
if (typeof structuredOptions !== 'undefined') {
|
|
20789
|
+
this.value = structuredOptions.value;
|
|
20790
|
+
}
|
|
20791
|
+
}
|
|
20792
|
+
}
|
|
20793
|
+
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (ElementIdentityError);
|
|
20794
|
+
|
|
20795
|
+
/***/ }),
|
|
20796
|
+
|
|
20797
|
+
/***/ 47644:
|
|
20798
|
+
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
|
20799
|
+
|
|
20800
|
+
"use strict";
|
|
20801
|
+
__webpack_require__.r(__webpack_exports__);
|
|
20802
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
20803
|
+
/* harmony export */ IdentityManager: () => (/* binding */ IdentityManager),
|
|
20804
|
+
/* harmony export */ defaultIdentityManager: () => (/* binding */ defaultIdentityManager)
|
|
20805
|
+
/* harmony export */ });
|
|
20806
|
+
/* harmony import */ var minim__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(43500);
|
|
20807
|
+
/* harmony import */ var stampit__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(43992);
|
|
20808
|
+
/* harmony import */ var short_unique_id__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(77913);
|
|
20809
|
+
/* harmony import */ var _errors_ElementIdentityError_mjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(66398);
|
|
20810
|
+
/* harmony import */ var _predicates_index_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(28552);
|
|
20811
|
+
|
|
20812
|
+
|
|
20813
|
+
|
|
20814
|
+
|
|
20815
|
+
|
|
20816
|
+
const IdentityManager = stampit__WEBPACK_IMPORTED_MODULE_1__({
|
|
20817
|
+
props: {
|
|
20818
|
+
uuid: null,
|
|
20819
|
+
length: null,
|
|
20820
|
+
identityMap: null
|
|
20821
|
+
},
|
|
20822
|
+
init({
|
|
20823
|
+
length = 6
|
|
20824
|
+
} = {}) {
|
|
20825
|
+
this.length = 6;
|
|
20826
|
+
this.uuid = new short_unique_id__WEBPACK_IMPORTED_MODULE_2__({
|
|
20827
|
+
length
|
|
20828
|
+
});
|
|
20829
|
+
this.identityMap = new WeakMap();
|
|
20830
|
+
},
|
|
20831
|
+
methods: {
|
|
20832
|
+
identify(element) {
|
|
20833
|
+
if (!(0,_predicates_index_mjs__WEBPACK_IMPORTED_MODULE_3__.isElement)(element)) {
|
|
20834
|
+
throw new _errors_ElementIdentityError_mjs__WEBPACK_IMPORTED_MODULE_4__["default"]('Cannot not identify the element. `element` is neither structurally compatible nor a subclass of an Element class.', {
|
|
20835
|
+
value: element
|
|
20836
|
+
});
|
|
20837
|
+
}
|
|
20838
|
+
|
|
20839
|
+
// use already assigned identity
|
|
20840
|
+
if (element.meta.hasKey('id') && (0,_predicates_index_mjs__WEBPACK_IMPORTED_MODULE_3__.isStringElement)(element.meta.id) && !element.meta.id.equals('')) {
|
|
20841
|
+
return element.id;
|
|
20842
|
+
}
|
|
20843
|
+
|
|
20844
|
+
// assign identity in immutable way
|
|
20845
|
+
if (this.identityMap.has(element)) {
|
|
20846
|
+
return this.identityMap.get(element);
|
|
20847
|
+
}
|
|
20848
|
+
|
|
20849
|
+
// return element identity
|
|
20850
|
+
const id = new minim__WEBPACK_IMPORTED_MODULE_0__.StringElement(this.generateId());
|
|
20851
|
+
this.identityMap.set(element, id);
|
|
20852
|
+
return id;
|
|
20853
|
+
},
|
|
20854
|
+
forget(element) {
|
|
20855
|
+
if (this.identityMap.has(element)) {
|
|
20856
|
+
this.identityMap.delete(element);
|
|
20857
|
+
return true;
|
|
20858
|
+
}
|
|
20859
|
+
return false;
|
|
20860
|
+
},
|
|
20861
|
+
generateId() {
|
|
20862
|
+
return this.uuid.randomUUID();
|
|
20863
|
+
}
|
|
20864
|
+
}
|
|
20865
|
+
});
|
|
20866
|
+
const defaultIdentityManager = IdentityManager({
|
|
20867
|
+
length: 6
|
|
20868
|
+
});
|
|
20869
|
+
|
|
20870
|
+
/***/ }),
|
|
20871
|
+
|
|
20261
20872
|
/***/ 63244:
|
|
20262
20873
|
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
|
20263
20874
|
|
|
@@ -21299,10 +21910,6 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
21299
21910
|
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
21300
21911
|
/* harmony export */ });
|
|
21301
21912
|
/* harmony import */ var _babel_runtime_corejs3_core_js_aggregate_error__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(30538);
|
|
21302
|
-
/* harmony import */ var ramda_adjunct__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(38074);
|
|
21303
|
-
/* harmony import */ var ramda__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(25546);
|
|
21304
|
-
|
|
21305
|
-
|
|
21306
21913
|
|
|
21307
21914
|
class ApiDOMAggregateError extends _babel_runtime_corejs3_core_js_aggregate_error__WEBPACK_IMPORTED_MODULE_0__ {
|
|
21308
21915
|
constructor(errors, message, options) {
|
|
@@ -21319,15 +21926,15 @@ class ApiDOMAggregateError extends _babel_runtime_corejs3_core_js_aggregate_erro
|
|
|
21319
21926
|
|
|
21320
21927
|
/**
|
|
21321
21928
|
* This needs to stay here until our minimum supported version of Node.js is >= 16.9.0.
|
|
21322
|
-
* Node.js
|
|
21929
|
+
* Node.js >= 16.9.0 supports error causes natively.
|
|
21323
21930
|
*/
|
|
21324
|
-
if (
|
|
21931
|
+
if (options != null && typeof options === 'object' && Object.hasOwn(options, 'cause') && !('cause' in this)) {
|
|
21325
21932
|
const {
|
|
21326
21933
|
cause
|
|
21327
21934
|
} = options;
|
|
21328
21935
|
this.cause = cause;
|
|
21329
|
-
if (cause instanceof Error &&
|
|
21330
|
-
this.stack = `${this.stack}\nCAUSE: ${cause
|
|
21936
|
+
if (cause instanceof Error && 'stack' in cause) {
|
|
21937
|
+
this.stack = `${this.stack}\nCAUSE: ${cause.stack}`;
|
|
21331
21938
|
}
|
|
21332
21939
|
}
|
|
21333
21940
|
}
|
|
@@ -21344,16 +21951,12 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
21344
21951
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
21345
21952
|
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
21346
21953
|
/* harmony export */ });
|
|
21347
|
-
/* harmony import */ var
|
|
21348
|
-
/* harmony import */ var ramda_adjunct__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(38074);
|
|
21349
|
-
/* harmony import */ var _ApiDOMAggregateError_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(84039);
|
|
21350
|
-
|
|
21351
|
-
|
|
21954
|
+
/* harmony import */ var _ApiDOMAggregateError_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(84039);
|
|
21352
21955
|
|
|
21353
21956
|
class ApiDOMError extends Error {
|
|
21354
21957
|
static [Symbol.hasInstance](instance) {
|
|
21355
21958
|
// we want to ApiDOMAggregateError to act as if ApiDOMError was its superclass
|
|
21356
|
-
return super[Symbol.hasInstance](instance) || Function.prototype[Symbol.hasInstance].call(
|
|
21959
|
+
return super[Symbol.hasInstance](instance) || Function.prototype[Symbol.hasInstance].call(_ApiDOMAggregateError_mjs__WEBPACK_IMPORTED_MODULE_0__["default"], instance);
|
|
21357
21960
|
}
|
|
21358
21961
|
constructor(message, options) {
|
|
21359
21962
|
super(message, options);
|
|
@@ -21371,13 +21974,13 @@ class ApiDOMError extends Error {
|
|
|
21371
21974
|
* This needs to stay here until our minimum supported version of Node.js is >= 16.9.0.
|
|
21372
21975
|
* Node.js is >= 16.9.0 supports error causes natively.
|
|
21373
21976
|
*/
|
|
21374
|
-
if (
|
|
21977
|
+
if (options != null && typeof options === 'object' && Object.hasOwn(options, 'cause') && !('cause' in this)) {
|
|
21375
21978
|
const {
|
|
21376
21979
|
cause
|
|
21377
21980
|
} = options;
|
|
21378
21981
|
this.cause = cause;
|
|
21379
|
-
if (cause instanceof Error &&
|
|
21380
|
-
this.stack = `${this.stack}\nCAUSE: ${cause
|
|
21982
|
+
if (cause instanceof Error && 'stack' in cause) {
|
|
21983
|
+
this.stack = `${this.stack}\nCAUSE: ${cause.stack}`;
|
|
21381
21984
|
}
|
|
21382
21985
|
}
|
|
21383
21986
|
}
|
|
@@ -21394,15 +21997,17 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
21394
21997
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
21395
21998
|
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
21396
21999
|
/* harmony export */ });
|
|
21397
|
-
/* harmony import */ var
|
|
21398
|
-
/* harmony import */ var _ApiDOMError_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(42455);
|
|
21399
|
-
|
|
22000
|
+
/* harmony import */ var _ApiDOMError_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(42455);
|
|
21400
22001
|
|
|
21401
|
-
class ApiDOMStructuredError extends
|
|
22002
|
+
class ApiDOMStructuredError extends _ApiDOMError_mjs__WEBPACK_IMPORTED_MODULE_0__["default"] {
|
|
21402
22003
|
constructor(message, structuredOptions) {
|
|
21403
22004
|
super(message, structuredOptions);
|
|
21404
|
-
if (typeof structuredOptions
|
|
21405
|
-
|
|
22005
|
+
if (structuredOptions != null && typeof structuredOptions === 'object') {
|
|
22006
|
+
const {
|
|
22007
|
+
cause,
|
|
22008
|
+
...causelessOptions
|
|
22009
|
+
} = structuredOptions;
|
|
22010
|
+
Object.assign(this, causelessOptions);
|
|
21406
22011
|
}
|
|
21407
22012
|
}
|
|
21408
22013
|
}
|
|
@@ -26593,7 +27198,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
26593
27198
|
/* harmony export */ isSchemaElement: () => (/* binding */ isSchemaElement),
|
|
26594
27199
|
/* harmony export */ isSecurityRequirementElement: () => (/* binding */ isSecurityRequirementElement),
|
|
26595
27200
|
/* harmony export */ isServerElement: () => (/* binding */ isServerElement),
|
|
26596
|
-
/* harmony export */ isServerVariableElement: () => (/* binding */ isServerVariableElement)
|
|
27201
|
+
/* harmony export */ isServerVariableElement: () => (/* binding */ isServerVariableElement),
|
|
27202
|
+
/* harmony export */ isServersElement: () => (/* binding */ isServersElement)
|
|
26597
27203
|
/* harmony export */ });
|
|
26598
27204
|
/* harmony import */ var _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(32333);
|
|
26599
27205
|
/* harmony import */ var _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(28552);
|
|
@@ -26622,6 +27228,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
26622
27228
|
/* harmony import */ var _elements_Server_mjs__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(12802);
|
|
26623
27229
|
/* harmony import */ var _elements_ServerVariable_mjs__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__(33651);
|
|
26624
27230
|
/* harmony import */ var _elements_MediaType_mjs__WEBPACK_IMPORTED_MODULE_26__ = __webpack_require__(45821);
|
|
27231
|
+
/* harmony import */ var _elements_nces_Servers_mjs__WEBPACK_IMPORTED_MODULE_27__ = __webpack_require__(26357);
|
|
26625
27232
|
|
|
26626
27233
|
|
|
26627
27234
|
|
|
@@ -26646,6 +27253,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
26646
27253
|
|
|
26647
27254
|
|
|
26648
27255
|
|
|
27256
|
+
// NCE types
|
|
26649
27257
|
|
|
26650
27258
|
const isCallbackElement = (0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_0__["default"])(({
|
|
26651
27259
|
hasBasicElementProps,
|
|
@@ -26851,6 +27459,14 @@ const isMediaTypeElement = (0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_
|
|
|
26851
27459
|
}) => {
|
|
26852
27460
|
return element => element instanceof _elements_MediaType_mjs__WEBPACK_IMPORTED_MODULE_26__["default"] || hasBasicElementProps(element) && isElementType('mediaType', element) && primitiveEq('object', element);
|
|
26853
27461
|
});
|
|
27462
|
+
const isServersElement = (0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_0__["default"])(({
|
|
27463
|
+
hasBasicElementProps,
|
|
27464
|
+
isElementType,
|
|
27465
|
+
primitiveEq,
|
|
27466
|
+
hasClass
|
|
27467
|
+
}) => {
|
|
27468
|
+
return element => element instanceof _elements_nces_Servers_mjs__WEBPACK_IMPORTED_MODULE_27__["default"] || hasBasicElementProps(element) && isElementType('array', element) && primitiveEq('array', element) && hasClass('servers', element);
|
|
27469
|
+
});
|
|
26854
27470
|
|
|
26855
27471
|
/***/ }),
|
|
26856
27472
|
|
|
@@ -34834,11 +35450,10 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
34834
35450
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
34835
35451
|
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
34836
35452
|
/* harmony export */ });
|
|
34837
|
-
/* harmony import */ var
|
|
35453
|
+
/* harmony import */ var _swagger_api_apidom_ns_openapi_3_0__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(26357);
|
|
34838
35454
|
/* harmony import */ var _swagger_api_apidom_ns_openapi_3_0__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(29351);
|
|
34839
35455
|
/* harmony import */ var _swagger_api_apidom_ns_openapi_3_0__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(60526);
|
|
34840
35456
|
|
|
34841
|
-
|
|
34842
35457
|
/**
|
|
34843
35458
|
* Override of Server Objects.
|
|
34844
35459
|
*
|
|
@@ -34853,60 +35468,70 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
34853
35468
|
*/
|
|
34854
35469
|
/* eslint-disable no-param-reassign */
|
|
34855
35470
|
const plugin = () => ({
|
|
34856
|
-
predicates
|
|
35471
|
+
predicates,
|
|
35472
|
+
namespace
|
|
34857
35473
|
}) => {
|
|
34858
|
-
let openAPIServers;
|
|
34859
|
-
const pathItemServers = [];
|
|
34860
35474
|
return {
|
|
34861
35475
|
visitor: {
|
|
34862
|
-
OpenApi3_1Element
|
|
34863
|
-
|
|
34864
|
-
|
|
34865
|
-
|
|
34866
|
-
|
|
34867
|
-
|
|
34868
|
-
|
|
34869
|
-
|
|
34870
|
-
|
|
35476
|
+
OpenApi3_1Element(openapiElement) {
|
|
35477
|
+
const isServersUndefined = typeof openapiElement.servers === 'undefined';
|
|
35478
|
+
const isServersArrayElement = predicates.isArrayElement(openapiElement.servers);
|
|
35479
|
+
const isServersEmpty = isServersArrayElement && openapiElement.servers.length === 0;
|
|
35480
|
+
// @ts-ignore
|
|
35481
|
+
const defaultServer = namespace.elements.Server.refract({
|
|
35482
|
+
url: '/'
|
|
35483
|
+
});
|
|
35484
|
+
if (isServersUndefined || !isServersArrayElement) {
|
|
35485
|
+
openapiElement.servers = new _swagger_api_apidom_ns_openapi_3_0__WEBPACK_IMPORTED_MODULE_0__["default"]([defaultServer]);
|
|
35486
|
+
} else if (isServersArrayElement && isServersEmpty) {
|
|
35487
|
+
openapiElement.servers.push(defaultServer);
|
|
34871
35488
|
}
|
|
34872
35489
|
},
|
|
34873
|
-
PathItemElement
|
|
34874
|
-
|
|
34875
|
-
|
|
34876
|
-
|
|
34877
|
-
|
|
34878
|
-
|
|
34879
|
-
|
|
34880
|
-
|
|
34881
|
-
|
|
34882
|
-
|
|
34883
|
-
|
|
34884
|
-
|
|
34885
|
-
|
|
34886
|
-
const
|
|
34887
|
-
|
|
34888
|
-
|
|
34889
|
-
if (
|
|
34890
|
-
|
|
34891
|
-
|
|
34892
|
-
|
|
35490
|
+
PathItemElement(pathItemElement, key, parent, path, ancestors) {
|
|
35491
|
+
// skip visiting this Path Item
|
|
35492
|
+
if (ancestors.some(predicates.isComponentsElement)) return;
|
|
35493
|
+
if (!ancestors.some(predicates.isOpenApi3_1Element)) return;
|
|
35494
|
+
const parentOpenapiElement = ancestors.find(predicates.isOpenApi3_1Element);
|
|
35495
|
+
const isServersUndefined = typeof pathItemElement.servers === 'undefined';
|
|
35496
|
+
const isServersArrayElement = predicates.isArrayElement(pathItemElement.servers);
|
|
35497
|
+
const isServersEmpty = isServersArrayElement && pathItemElement.servers.length === 0;
|
|
35498
|
+
|
|
35499
|
+
// duplicate OpenAPI.servers into this Path Item object
|
|
35500
|
+
if (predicates.isOpenApi3_1Element(parentOpenapiElement)) {
|
|
35501
|
+
var _parentOpenapiElement;
|
|
35502
|
+
const openapiServersContent = (_parentOpenapiElement = parentOpenapiElement.servers) === null || _parentOpenapiElement === void 0 ? void 0 : _parentOpenapiElement.content;
|
|
35503
|
+
const openapiServers = openapiServersContent !== null && openapiServersContent !== void 0 ? openapiServersContent : [];
|
|
35504
|
+
if (isServersUndefined || !isServersArrayElement) {
|
|
35505
|
+
pathItemElement.servers = new _swagger_api_apidom_ns_openapi_3_0__WEBPACK_IMPORTED_MODULE_1__["default"](openapiServers);
|
|
35506
|
+
} else if (isServersArrayElement && isServersEmpty) {
|
|
35507
|
+
openapiServers.forEach(server => {
|
|
35508
|
+
pathItemElement.servers.push(server);
|
|
35509
|
+
});
|
|
34893
35510
|
}
|
|
34894
|
-
},
|
|
34895
|
-
leave() {
|
|
34896
|
-
pathItemServers.pop();
|
|
34897
35511
|
}
|
|
34898
35512
|
},
|
|
34899
|
-
OperationElement
|
|
34900
|
-
|
|
34901
|
-
|
|
34902
|
-
|
|
34903
|
-
|
|
34904
|
-
|
|
34905
|
-
|
|
34906
|
-
|
|
34907
|
-
|
|
34908
|
-
|
|
34909
|
-
|
|
35513
|
+
OperationElement(operationElement, key, parent, path, ancestors) {
|
|
35514
|
+
// skip visiting this Operation
|
|
35515
|
+
if (ancestors.some(predicates.isComponentsElement)) return;
|
|
35516
|
+
if (!ancestors.some(predicates.isOpenApi3_1Element)) return;
|
|
35517
|
+
|
|
35518
|
+
// @TODO(vladimir.gorej@gmail.com): can be replaced by Array.prototype.findLast in future
|
|
35519
|
+
const parentPathItemElement = [...ancestors].reverse().find(predicates.isPathItemElement);
|
|
35520
|
+
const isServersUndefined = typeof operationElement.servers === 'undefined';
|
|
35521
|
+
const isServersArrayElement = predicates.isArrayElement(operationElement.servers);
|
|
35522
|
+
const isServersEmpty = isServersArrayElement && operationElement.servers.length === 0;
|
|
35523
|
+
if (predicates.isPathItemElement(parentPathItemElement)) {
|
|
35524
|
+
var _parentPathItemElemen;
|
|
35525
|
+
const pathItemServersContent = (_parentPathItemElemen = parentPathItemElement.servers) === null || _parentPathItemElemen === void 0 ? void 0 : _parentPathItemElemen.content;
|
|
35526
|
+
const pathItemServers = pathItemServersContent !== null && pathItemServersContent !== void 0 ? pathItemServersContent : [];
|
|
35527
|
+
if (isServersUndefined || !isServersArrayElement) {
|
|
35528
|
+
// duplicate parent PathItem.servers into this Operation object
|
|
35529
|
+
operationElement.servers = new _swagger_api_apidom_ns_openapi_3_0__WEBPACK_IMPORTED_MODULE_2__["default"](pathItemServers);
|
|
35530
|
+
} else if (isServersArrayElement && isServersEmpty) {
|
|
35531
|
+
pathItemServers.forEach(server => {
|
|
35532
|
+
operationElement.servers.push(server);
|
|
35533
|
+
});
|
|
35534
|
+
}
|
|
34910
35535
|
}
|
|
34911
35536
|
}
|
|
34912
35537
|
}
|
|
@@ -35717,11 +36342,13 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
35717
36342
|
/* harmony export */ });
|
|
35718
36343
|
/* harmony import */ var _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(85040);
|
|
35719
36344
|
/* harmony import */ var _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(28552);
|
|
36345
|
+
/* harmony import */ var _swagger_api_apidom_ns_openapi_3_0__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(75999);
|
|
35720
36346
|
/* harmony import */ var _predicates_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(66316);
|
|
35721
36347
|
/* harmony import */ var _namespace_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(93315);
|
|
35722
36348
|
|
|
35723
36349
|
|
|
35724
36350
|
|
|
36351
|
+
|
|
35725
36352
|
const createToolbox = () => {
|
|
35726
36353
|
const namespace = (0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_0__.createNamespace)(_namespace_mjs__WEBPACK_IMPORTED_MODULE_1__["default"]);
|
|
35727
36354
|
const predicates = {
|
|
@@ -35729,6 +36356,7 @@ const createToolbox = () => {
|
|
|
35729
36356
|
isStringElement: _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_3__.isStringElement,
|
|
35730
36357
|
isArrayElement: _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_3__.isArrayElement,
|
|
35731
36358
|
isObjectElement: _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_3__.isObjectElement,
|
|
36359
|
+
isServersElement: _swagger_api_apidom_ns_openapi_3_0__WEBPACK_IMPORTED_MODULE_4__.isServersElement,
|
|
35732
36360
|
includesClasses: _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_3__.includesClasses
|
|
35733
36361
|
};
|
|
35734
36362
|
return {
|
|
@@ -38646,30 +39274,31 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
38646
39274
|
/* harmony export */ });
|
|
38647
39275
|
/* harmony import */ var stampit__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(43992);
|
|
38648
39276
|
/* harmony import */ var ramda__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(25546);
|
|
38649
|
-
/* harmony import */ var
|
|
39277
|
+
/* harmony import */ var ramda_adjunct__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(4926);
|
|
38650
39278
|
/* harmony import */ var _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(87395);
|
|
38651
|
-
/* harmony import */ var
|
|
38652
|
-
/* harmony import */ var
|
|
38653
|
-
/* harmony import */ var
|
|
38654
|
-
/* harmony import */ var _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(
|
|
38655
|
-
/* harmony import */ var
|
|
38656
|
-
/* harmony import */ var
|
|
38657
|
-
/* harmony import */ var _swagger_api_apidom_json_pointer__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(
|
|
38658
|
-
/* harmony import */ var
|
|
38659
|
-
/* harmony import */ var
|
|
38660
|
-
/* harmony import */ var _swagger_api_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(
|
|
38661
|
-
/* harmony import */ var
|
|
38662
|
-
/* harmony import */ var
|
|
38663
|
-
/* harmony import */ var
|
|
38664
|
-
/* harmony import */ var
|
|
38665
|
-
/* harmony import */ var
|
|
38666
|
-
/* harmony import */ var
|
|
38667
|
-
/* harmony import */ var
|
|
38668
|
-
/* harmony import */ var
|
|
38669
|
-
/* harmony import */ var
|
|
38670
|
-
/* harmony import */ var
|
|
38671
|
-
/* harmony import */ var
|
|
38672
|
-
/* harmony import */ var
|
|
39279
|
+
/* harmony import */ var _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(47644);
|
|
39280
|
+
/* harmony import */ var _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(50334);
|
|
39281
|
+
/* harmony import */ var _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(28552);
|
|
39282
|
+
/* harmony import */ var _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(50308);
|
|
39283
|
+
/* harmony import */ var _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(44344);
|
|
39284
|
+
/* harmony import */ var _swagger_api_apidom_error__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(42455);
|
|
39285
|
+
/* harmony import */ var _swagger_api_apidom_json_pointer__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(3608);
|
|
39286
|
+
/* harmony import */ var _swagger_api_apidom_json_pointer__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(8647);
|
|
39287
|
+
/* harmony import */ var _swagger_api_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(66316);
|
|
39288
|
+
/* harmony import */ var _swagger_api_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(74144);
|
|
39289
|
+
/* harmony import */ var _swagger_api_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(94481);
|
|
39290
|
+
/* harmony import */ var _swagger_api_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(84714);
|
|
39291
|
+
/* harmony import */ var _selectors_$anchor_mjs__WEBPACK_IMPORTED_MODULE_26__ = __webpack_require__(90609);
|
|
39292
|
+
/* harmony import */ var _selectors_uri_mjs__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(14726);
|
|
39293
|
+
/* harmony import */ var _errors_MaximumDereferenceDepthError_mjs__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(67625);
|
|
39294
|
+
/* harmony import */ var _errors_MaximumResolverDepthError_mjs__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(58496);
|
|
39295
|
+
/* harmony import */ var _util_url_mjs__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(69239);
|
|
39296
|
+
/* harmony import */ var _parse_index_mjs__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(42215);
|
|
39297
|
+
/* harmony import */ var _Reference_mjs__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(68488);
|
|
39298
|
+
/* harmony import */ var _util_File_mjs__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(35059);
|
|
39299
|
+
/* harmony import */ var _resolve_strategies_openapi_3_1_util_mjs__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(77079);
|
|
39300
|
+
/* harmony import */ var _util_mjs__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(90719);
|
|
39301
|
+
/* harmony import */ var _errors_EvaluationJsonSchemaUriError_mjs__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__(552);
|
|
38673
39302
|
|
|
38674
39303
|
|
|
38675
39304
|
|
|
@@ -38690,6 +39319,15 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
38690
39319
|
// @ts-ignore
|
|
38691
39320
|
const visitAsync = _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_2__.visit[Symbol.for('nodejs.util.promisify.custom')];
|
|
38692
39321
|
|
|
39322
|
+
// initialize element identity manager
|
|
39323
|
+
const identityManager = (0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_3__.IdentityManager)();
|
|
39324
|
+
|
|
39325
|
+
/**
|
|
39326
|
+
* Predicate for detecting if element was created by merging referencing
|
|
39327
|
+
* element with particular element identity with a referenced element.
|
|
39328
|
+
*/
|
|
39329
|
+
const wasReferencedBy = referencingElement => element => element.meta.hasKey('ref-referencing-element-id') && element.meta.get('ref-referencing-element-id').equals((0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_4__["default"])(identityManager.identify(referencingElement)));
|
|
39330
|
+
|
|
38693
39331
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
38694
39332
|
const OpenApi3_1DereferenceVisitor = stampit__WEBPACK_IMPORTED_MODULE_0__({
|
|
38695
39333
|
props: {
|
|
@@ -38704,22 +39342,22 @@ const OpenApi3_1DereferenceVisitor = stampit__WEBPACK_IMPORTED_MODULE_0__({
|
|
|
38704
39342
|
reference,
|
|
38705
39343
|
namespace,
|
|
38706
39344
|
options,
|
|
38707
|
-
ancestors = new
|
|
39345
|
+
ancestors = new _util_mjs__WEBPACK_IMPORTED_MODULE_5__.AncestorLineage()
|
|
38708
39346
|
}) {
|
|
38709
39347
|
this.indirections = indirections;
|
|
38710
39348
|
this.namespace = namespace;
|
|
38711
39349
|
this.reference = reference;
|
|
38712
39350
|
this.options = options;
|
|
38713
|
-
this.ancestors = new
|
|
39351
|
+
this.ancestors = new _util_mjs__WEBPACK_IMPORTED_MODULE_5__.AncestorLineage(...ancestors);
|
|
38714
39352
|
},
|
|
38715
39353
|
methods: {
|
|
38716
39354
|
toBaseURI(uri) {
|
|
38717
|
-
return
|
|
39355
|
+
return _util_url_mjs__WEBPACK_IMPORTED_MODULE_6__.resolve(this.reference.uri, _util_url_mjs__WEBPACK_IMPORTED_MODULE_6__.sanitize(_util_url_mjs__WEBPACK_IMPORTED_MODULE_6__.stripHash(uri)));
|
|
38718
39356
|
},
|
|
38719
39357
|
async toReference(uri) {
|
|
38720
39358
|
// detect maximum depth of resolution
|
|
38721
39359
|
if (this.reference.depth >= this.options.resolve.maxDepth) {
|
|
38722
|
-
throw new
|
|
39360
|
+
throw new _errors_MaximumResolverDepthError_mjs__WEBPACK_IMPORTED_MODULE_7__["default"](`Maximum resolution depth of ${this.options.resolve.maxDepth} has been exceeded by file "${this.reference.uri}"`);
|
|
38723
39361
|
}
|
|
38724
39362
|
const baseURI = this.toBaseURI(uri);
|
|
38725
39363
|
const {
|
|
@@ -38730,7 +39368,7 @@ const OpenApi3_1DereferenceVisitor = stampit__WEBPACK_IMPORTED_MODULE_0__({
|
|
|
38730
39368
|
if (refSet.has(baseURI)) {
|
|
38731
39369
|
return refSet.find((0,ramda__WEBPACK_IMPORTED_MODULE_1__.propEq)(baseURI, 'uri'));
|
|
38732
39370
|
}
|
|
38733
|
-
const parseResult = await (0,
|
|
39371
|
+
const parseResult = await (0,_parse_index_mjs__WEBPACK_IMPORTED_MODULE_8__["default"])(_util_url_mjs__WEBPACK_IMPORTED_MODULE_6__.unsanitize(baseURI), {
|
|
38734
39372
|
...this.options,
|
|
38735
39373
|
parse: {
|
|
38736
39374
|
...this.options.parse,
|
|
@@ -38739,7 +39377,7 @@ const OpenApi3_1DereferenceVisitor = stampit__WEBPACK_IMPORTED_MODULE_0__({
|
|
|
38739
39377
|
});
|
|
38740
39378
|
|
|
38741
39379
|
// register new Reference with ReferenceSet
|
|
38742
|
-
const reference = (0,
|
|
39380
|
+
const reference = (0,_Reference_mjs__WEBPACK_IMPORTED_MODULE_9__["default"])({
|
|
38743
39381
|
uri: baseURI,
|
|
38744
39382
|
value: parseResult,
|
|
38745
39383
|
depth: this.reference.depth + 1
|
|
@@ -38752,8 +39390,8 @@ const OpenApi3_1DereferenceVisitor = stampit__WEBPACK_IMPORTED_MODULE_0__({
|
|
|
38752
39390
|
* Compute full ancestors lineage.
|
|
38753
39391
|
* Ancestors are flatten to unwrap all Element instances.
|
|
38754
39392
|
*/
|
|
38755
|
-
const directAncestors = new
|
|
38756
|
-
const ancestorsLineage = new
|
|
39393
|
+
const directAncestors = new Set(ancestors.filter(_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_10__.isElement));
|
|
39394
|
+
const ancestorsLineage = new _util_mjs__WEBPACK_IMPORTED_MODULE_5__.AncestorLineage(...this.ancestors, directAncestors);
|
|
38757
39395
|
return [ancestorsLineage, directAncestors];
|
|
38758
39396
|
},
|
|
38759
39397
|
async ReferenceElement(referencingElement, key, parent, path, ancestors) {
|
|
@@ -38765,26 +39403,26 @@ const OpenApi3_1DereferenceVisitor = stampit__WEBPACK_IMPORTED_MODULE_0__({
|
|
|
38765
39403
|
}
|
|
38766
39404
|
|
|
38767
39405
|
// ignore resolving external Reference Objects
|
|
38768
|
-
if (!this.options.resolve.external && (0,
|
|
39406
|
+
if (!this.options.resolve.external && (0,_swagger_api_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_11__.isReferenceElementExternal)(referencingElement)) {
|
|
38769
39407
|
return false;
|
|
38770
39408
|
}
|
|
38771
|
-
const reference = await this.toReference((0,
|
|
39409
|
+
const reference = await this.toReference((0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_4__["default"])(referencingElement.$ref));
|
|
38772
39410
|
const {
|
|
38773
39411
|
uri: retrievalURI
|
|
38774
39412
|
} = reference;
|
|
38775
|
-
const $refBaseURI =
|
|
39413
|
+
const $refBaseURI = _util_url_mjs__WEBPACK_IMPORTED_MODULE_6__.resolve(retrievalURI, (0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_4__["default"])(referencingElement.$ref));
|
|
38776
39414
|
this.indirections.push(referencingElement);
|
|
38777
|
-
const jsonPointer = (0,
|
|
39415
|
+
const jsonPointer = (0,_swagger_api_apidom_json_pointer__WEBPACK_IMPORTED_MODULE_12__.uriToPointer)($refBaseURI);
|
|
38778
39416
|
|
|
38779
39417
|
// possibly non-semantic fragment
|
|
38780
|
-
let referencedElement = (0,
|
|
39418
|
+
let referencedElement = (0,_swagger_api_apidom_json_pointer__WEBPACK_IMPORTED_MODULE_13__["default"])(jsonPointer, reference.value.result);
|
|
38781
39419
|
|
|
38782
39420
|
// applying semantics to a fragment
|
|
38783
|
-
if ((0,
|
|
38784
|
-
const referencedElementType = (0,
|
|
38785
|
-
if ((0,
|
|
39421
|
+
if ((0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_10__.isPrimitiveElement)(referencedElement)) {
|
|
39422
|
+
const referencedElementType = (0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_4__["default"])(referencingElement.meta.get('referenced-element'));
|
|
39423
|
+
if ((0,_swagger_api_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_14__.isReferenceLikeElement)(referencedElement)) {
|
|
38786
39424
|
// handling indirect references
|
|
38787
|
-
referencedElement =
|
|
39425
|
+
referencedElement = _swagger_api_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_15__.ReferenceElement.refract(referencedElement);
|
|
38788
39426
|
referencedElement.setMetaProperty('referenced-element', referencedElementType);
|
|
38789
39427
|
} else {
|
|
38790
39428
|
// handling direct references
|
|
@@ -38795,12 +39433,12 @@ const OpenApi3_1DereferenceVisitor = stampit__WEBPACK_IMPORTED_MODULE_0__({
|
|
|
38795
39433
|
|
|
38796
39434
|
// detect direct or indirect reference
|
|
38797
39435
|
if (this.indirections.includes(referencedElement)) {
|
|
38798
|
-
throw new
|
|
39436
|
+
throw new _swagger_api_apidom_error__WEBPACK_IMPORTED_MODULE_16__["default"]('Recursive Reference Object detected');
|
|
38799
39437
|
}
|
|
38800
39438
|
|
|
38801
39439
|
// detect maximum depth of dereferencing
|
|
38802
39440
|
if (this.indirections.length > this.options.dereference.maxDepth) {
|
|
38803
|
-
throw new
|
|
39441
|
+
throw new _errors_MaximumDereferenceDepthError_mjs__WEBPACK_IMPORTED_MODULE_17__["default"](`Maximum dereference depth of "${this.options.dereference.maxDepth}" has been exceeded in file "${this.reference.uri}"`);
|
|
38804
39442
|
}
|
|
38805
39443
|
|
|
38806
39444
|
// append referencing reference to ancestors lineage
|
|
@@ -38815,29 +39453,31 @@ const OpenApi3_1DereferenceVisitor = stampit__WEBPACK_IMPORTED_MODULE_0__({
|
|
|
38815
39453
|
ancestors: ancestorsLineage
|
|
38816
39454
|
});
|
|
38817
39455
|
referencedElement = await visitAsync(referencedElement, visitor, {
|
|
38818
|
-
keyMap:
|
|
38819
|
-
nodeTypeGetter:
|
|
39456
|
+
keyMap: _swagger_api_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_18__.keyMap,
|
|
39457
|
+
nodeTypeGetter: _swagger_api_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_18__.getNodeType
|
|
38820
39458
|
});
|
|
38821
39459
|
|
|
38822
39460
|
// remove referencing reference from ancestors lineage
|
|
38823
39461
|
directAncestors.delete(referencingElement);
|
|
38824
39462
|
this.indirections.pop();
|
|
38825
39463
|
const mergeAndAnnotateReferencedElement = refedElement => {
|
|
38826
|
-
const copy = (0,
|
|
39464
|
+
const copy = (0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_19__.cloneShallow)(refedElement);
|
|
38827
39465
|
|
|
38828
39466
|
// annotate fragment with info about original Reference element
|
|
38829
39467
|
copy.setMetaProperty('ref-fields', {
|
|
38830
|
-
$ref: (0,
|
|
39468
|
+
$ref: (0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_4__["default"])(referencingElement.$ref),
|
|
38831
39469
|
// @ts-ignore
|
|
38832
|
-
description: (0,
|
|
39470
|
+
description: (0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_4__["default"])(referencingElement.description),
|
|
38833
39471
|
// @ts-ignore
|
|
38834
|
-
summary: (0,
|
|
39472
|
+
summary: (0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_4__["default"])(referencingElement.summary)
|
|
38835
39473
|
});
|
|
38836
39474
|
// annotate fragment with info about origin
|
|
38837
39475
|
copy.setMetaProperty('ref-origin', reference.uri);
|
|
39476
|
+
// annotate fragment with info about referencing element
|
|
39477
|
+
copy.setMetaProperty('ref-referencing-element-id', (0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_19__.cloneDeep)(identityManager.identify(referencingElement)));
|
|
38838
39478
|
|
|
38839
39479
|
// override description and summary (outer has higher priority then inner)
|
|
38840
|
-
if ((0,
|
|
39480
|
+
if ((0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_10__.isObjectElement)(refedElement)) {
|
|
38841
39481
|
if (referencingElement.hasKey('description') && 'description' in refedElement) {
|
|
38842
39482
|
// @ts-ignore
|
|
38843
39483
|
copy.remove('description');
|
|
@@ -38855,11 +39495,13 @@ const OpenApi3_1DereferenceVisitor = stampit__WEBPACK_IMPORTED_MODULE_0__({
|
|
|
38855
39495
|
};
|
|
38856
39496
|
|
|
38857
39497
|
// attempting to create cycle
|
|
38858
|
-
if (ancestorsLineage.includes(referencedElement)) {
|
|
38859
|
-
|
|
38860
|
-
|
|
39498
|
+
if (ancestorsLineage.includes(referencingElement) || ancestorsLineage.includes(referencedElement)) {
|
|
39499
|
+
var _ancestorsLineage$fin;
|
|
39500
|
+
const replaceWith = (_ancestorsLineage$fin = ancestorsLineage.findItem(wasReferencedBy(referencingElement))) !== null && _ancestorsLineage$fin !== void 0 ? _ancestorsLineage$fin : mergeAndAnnotateReferencedElement(referencedElement);
|
|
39501
|
+
if ((0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_10__.isMemberElement)(parent)) {
|
|
39502
|
+
parent.value = replaceWith; // eslint-disable-line no-param-reassign
|
|
38861
39503
|
} else if (Array.isArray(parent)) {
|
|
38862
|
-
parent[key] =
|
|
39504
|
+
parent[key] = replaceWith; // eslint-disable-line no-param-reassign
|
|
38863
39505
|
}
|
|
38864
39506
|
|
|
38865
39507
|
return false;
|
|
@@ -38872,7 +39514,7 @@ const OpenApi3_1DereferenceVisitor = stampit__WEBPACK_IMPORTED_MODULE_0__({
|
|
|
38872
39514
|
const [ancestorsLineage, directAncestors] = this.toAncestorLineage([...ancestors, parent]);
|
|
38873
39515
|
|
|
38874
39516
|
// ignore PathItemElement without $ref field
|
|
38875
|
-
if (!(0,
|
|
39517
|
+
if (!(0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_10__.isStringElement)(referencingElement.$ref)) {
|
|
38876
39518
|
return undefined;
|
|
38877
39519
|
}
|
|
38878
39520
|
|
|
@@ -38882,33 +39524,33 @@ const OpenApi3_1DereferenceVisitor = stampit__WEBPACK_IMPORTED_MODULE_0__({
|
|
|
38882
39524
|
}
|
|
38883
39525
|
|
|
38884
39526
|
// ignore resolving external Path Item Elements
|
|
38885
|
-
if (!this.options.resolve.external && (0,
|
|
39527
|
+
if (!this.options.resolve.external && (0,_swagger_api_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_11__.isPathItemElementExternal)(referencingElement)) {
|
|
38886
39528
|
return undefined;
|
|
38887
39529
|
}
|
|
38888
|
-
const reference = await this.toReference((0,
|
|
39530
|
+
const reference = await this.toReference((0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_4__["default"])(referencingElement.$ref));
|
|
38889
39531
|
const {
|
|
38890
39532
|
uri: retrievalURI
|
|
38891
39533
|
} = reference;
|
|
38892
|
-
const $refBaseURI =
|
|
39534
|
+
const $refBaseURI = _util_url_mjs__WEBPACK_IMPORTED_MODULE_6__.resolve(retrievalURI, (0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_4__["default"])(referencingElement.$ref));
|
|
38893
39535
|
this.indirections.push(referencingElement);
|
|
38894
|
-
const jsonPointer = (0,
|
|
39536
|
+
const jsonPointer = (0,_swagger_api_apidom_json_pointer__WEBPACK_IMPORTED_MODULE_12__.uriToPointer)($refBaseURI);
|
|
38895
39537
|
|
|
38896
39538
|
// possibly non-semantic referenced element
|
|
38897
|
-
let referencedElement = (0,
|
|
39539
|
+
let referencedElement = (0,_swagger_api_apidom_json_pointer__WEBPACK_IMPORTED_MODULE_13__["default"])(jsonPointer, reference.value.result);
|
|
38898
39540
|
|
|
38899
39541
|
// applying semantics to a referenced element
|
|
38900
|
-
if ((0,
|
|
38901
|
-
referencedElement =
|
|
39542
|
+
if ((0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_10__.isPrimitiveElement)(referencedElement)) {
|
|
39543
|
+
referencedElement = _swagger_api_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_15__.PathItemElement.refract(referencedElement);
|
|
38902
39544
|
}
|
|
38903
39545
|
|
|
38904
39546
|
// detect direct or indirect reference
|
|
38905
39547
|
if (this.indirections.includes(referencedElement)) {
|
|
38906
|
-
throw new
|
|
39548
|
+
throw new _swagger_api_apidom_error__WEBPACK_IMPORTED_MODULE_16__["default"]('Recursive Path Item Object reference detected');
|
|
38907
39549
|
}
|
|
38908
39550
|
|
|
38909
39551
|
// detect maximum depth of dereferencing
|
|
38910
39552
|
if (this.indirections.length > this.options.dereference.maxDepth) {
|
|
38911
|
-
throw new
|
|
39553
|
+
throw new _errors_MaximumDereferenceDepthError_mjs__WEBPACK_IMPORTED_MODULE_17__["default"](`Maximum dereference depth of "${this.options.dereference.maxDepth}" has been exceeded in file "${this.reference.uri}"`);
|
|
38912
39554
|
}
|
|
38913
39555
|
|
|
38914
39556
|
// append referencing path item to ancestors lineage
|
|
@@ -38923,8 +39565,8 @@ const OpenApi3_1DereferenceVisitor = stampit__WEBPACK_IMPORTED_MODULE_0__({
|
|
|
38923
39565
|
ancestors: ancestorsLineage
|
|
38924
39566
|
});
|
|
38925
39567
|
referencedElement = await visitAsync(referencedElement, visitor, {
|
|
38926
|
-
keyMap:
|
|
38927
|
-
nodeTypeGetter:
|
|
39568
|
+
keyMap: _swagger_api_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_18__.keyMap,
|
|
39569
|
+
nodeTypeGetter: _swagger_api_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_18__.getNodeType
|
|
38928
39570
|
});
|
|
38929
39571
|
|
|
38930
39572
|
// remove referencing path item from ancestors lineage
|
|
@@ -38932,29 +39574,33 @@ const OpenApi3_1DereferenceVisitor = stampit__WEBPACK_IMPORTED_MODULE_0__({
|
|
|
38932
39574
|
this.indirections.pop();
|
|
38933
39575
|
const mergeAndAnnotateReferencedElement = refedElement => {
|
|
38934
39576
|
// merge fields from referenced Path Item with referencing one
|
|
38935
|
-
const mergedElement = new
|
|
39577
|
+
const mergedElement = new _swagger_api_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_15__.PathItemElement([...refedElement.content], (0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_19__.cloneDeep)(refedElement.meta), (0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_19__.cloneDeep)(refedElement.attributes));
|
|
38936
39578
|
// existing keywords from referencing PathItemElement overrides ones from referenced element
|
|
38937
39579
|
referencingElement.forEach((value, keyElement, item) => {
|
|
38938
|
-
mergedElement.remove((0,
|
|
39580
|
+
mergedElement.remove((0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_4__["default"])(keyElement));
|
|
38939
39581
|
mergedElement.content.push(item);
|
|
38940
39582
|
});
|
|
38941
39583
|
mergedElement.remove('$ref');
|
|
38942
39584
|
|
|
38943
39585
|
// annotate referenced element with info about original referencing element
|
|
38944
39586
|
mergedElement.setMetaProperty('ref-fields', {
|
|
38945
|
-
$ref: (0,
|
|
39587
|
+
$ref: (0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_4__["default"])(referencingElement.$ref)
|
|
38946
39588
|
});
|
|
38947
39589
|
// annotate referenced element with info about origin
|
|
38948
39590
|
mergedElement.setMetaProperty('ref-origin', reference.uri);
|
|
39591
|
+
// annotate fragment with info about referencing element
|
|
39592
|
+
mergedElement.setMetaProperty('ref-referencing-element-id', (0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_19__.cloneDeep)(identityManager.identify(referencingElement)));
|
|
38949
39593
|
return mergedElement;
|
|
38950
39594
|
};
|
|
38951
39595
|
|
|
38952
39596
|
// attempting to create cycle
|
|
38953
|
-
if (ancestorsLineage.includes(referencedElement)) {
|
|
38954
|
-
|
|
38955
|
-
|
|
39597
|
+
if (ancestorsLineage.includes(referencingElement) || ancestorsLineage.includes(referencedElement)) {
|
|
39598
|
+
var _ancestorsLineage$fin2;
|
|
39599
|
+
const replaceWith = (_ancestorsLineage$fin2 = ancestorsLineage.findItem(wasReferencedBy(referencingElement))) !== null && _ancestorsLineage$fin2 !== void 0 ? _ancestorsLineage$fin2 : mergeAndAnnotateReferencedElement(referencedElement);
|
|
39600
|
+
if ((0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_10__.isMemberElement)(parent)) {
|
|
39601
|
+
parent.value = replaceWith; // eslint-disable-line no-param-reassign
|
|
38956
39602
|
} else if (Array.isArray(parent)) {
|
|
38957
|
-
parent[key] =
|
|
39603
|
+
parent[key] = replaceWith; // eslint-disable-line no-param-reassign
|
|
38958
39604
|
}
|
|
38959
39605
|
|
|
38960
39606
|
return false;
|
|
@@ -38965,48 +39611,48 @@ const OpenApi3_1DereferenceVisitor = stampit__WEBPACK_IMPORTED_MODULE_0__({
|
|
|
38965
39611
|
},
|
|
38966
39612
|
async LinkElement(linkElement) {
|
|
38967
39613
|
// ignore LinkElement without operationRef or operationId field
|
|
38968
|
-
if (!(0,
|
|
39614
|
+
if (!(0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_10__.isStringElement)(linkElement.operationRef) && !(0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_10__.isStringElement)(linkElement.operationId)) {
|
|
38969
39615
|
return undefined;
|
|
38970
39616
|
}
|
|
38971
39617
|
|
|
38972
39618
|
// ignore resolving external Path Item Elements
|
|
38973
|
-
if (!this.options.resolve.external && (0,
|
|
39619
|
+
if (!this.options.resolve.external && (0,_swagger_api_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_11__.isLinkElementExternal)(linkElement)) {
|
|
38974
39620
|
return undefined;
|
|
38975
39621
|
}
|
|
38976
39622
|
|
|
38977
39623
|
// operationRef and operationId fields are mutually exclusive
|
|
38978
|
-
if ((0,
|
|
38979
|
-
throw new
|
|
39624
|
+
if ((0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_10__.isStringElement)(linkElement.operationRef) && (0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_10__.isStringElement)(linkElement.operationId)) {
|
|
39625
|
+
throw new _swagger_api_apidom_error__WEBPACK_IMPORTED_MODULE_16__["default"]('LinkElement operationRef and operationId fields are mutually exclusive.');
|
|
38980
39626
|
}
|
|
38981
39627
|
let operationElement;
|
|
38982
|
-
if ((0,
|
|
39628
|
+
if ((0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_10__.isStringElement)(linkElement.operationRef)) {
|
|
38983
39629
|
var _linkElementCopy$oper;
|
|
38984
39630
|
// possibly non-semantic referenced element
|
|
38985
|
-
const jsonPointer = (0,
|
|
38986
|
-
const reference = await this.toReference((0,
|
|
38987
|
-
operationElement = (0,
|
|
39631
|
+
const jsonPointer = (0,_swagger_api_apidom_json_pointer__WEBPACK_IMPORTED_MODULE_12__.uriToPointer)((0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_4__["default"])(linkElement.operationRef));
|
|
39632
|
+
const reference = await this.toReference((0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_4__["default"])(linkElement.operationRef));
|
|
39633
|
+
operationElement = (0,_swagger_api_apidom_json_pointer__WEBPACK_IMPORTED_MODULE_13__["default"])(jsonPointer, reference.value.result);
|
|
38988
39634
|
// applying semantics to a referenced element
|
|
38989
|
-
if ((0,
|
|
38990
|
-
operationElement =
|
|
39635
|
+
if ((0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_10__.isPrimitiveElement)(operationElement)) {
|
|
39636
|
+
operationElement = _swagger_api_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_15__.OperationElement.refract(operationElement);
|
|
38991
39637
|
}
|
|
38992
39638
|
// create shallow clone to be able to annotate with metadata
|
|
38993
|
-
operationElement = (0,
|
|
39639
|
+
operationElement = (0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_19__.cloneShallow)(operationElement);
|
|
38994
39640
|
// annotate operation element with info about origin
|
|
38995
39641
|
operationElement.setMetaProperty('ref-origin', reference.uri);
|
|
38996
|
-
const linkElementCopy = (0,
|
|
39642
|
+
const linkElementCopy = (0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_19__.cloneShallow)(linkElement);
|
|
38997
39643
|
(_linkElementCopy$oper = linkElementCopy.operationRef) === null || _linkElementCopy$oper === void 0 || _linkElementCopy$oper.meta.set('operation', operationElement);
|
|
38998
39644
|
return linkElementCopy;
|
|
38999
39645
|
}
|
|
39000
|
-
if ((0,
|
|
39646
|
+
if ((0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_10__.isStringElement)(linkElement.operationId)) {
|
|
39001
39647
|
var _linkElementCopy$oper2;
|
|
39002
|
-
const operationId = (0,
|
|
39003
|
-
const reference = await this.toReference(
|
|
39004
|
-
operationElement = (0,
|
|
39648
|
+
const operationId = (0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_4__["default"])(linkElement.operationId);
|
|
39649
|
+
const reference = await this.toReference(_util_url_mjs__WEBPACK_IMPORTED_MODULE_6__.unsanitize(this.reference.uri));
|
|
39650
|
+
operationElement = (0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_20__["default"])(e => (0,_swagger_api_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_11__.isOperationElement)(e) && (0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_10__.isElement)(e.operationId) && e.operationId.equals(operationId), reference.value.result);
|
|
39005
39651
|
// OperationElement not found by its operationId
|
|
39006
|
-
if ((0,
|
|
39007
|
-
throw new
|
|
39652
|
+
if ((0,ramda_adjunct__WEBPACK_IMPORTED_MODULE_21__["default"])(operationElement)) {
|
|
39653
|
+
throw new _swagger_api_apidom_error__WEBPACK_IMPORTED_MODULE_16__["default"](`OperationElement(operationId=${operationId}) not found.`);
|
|
39008
39654
|
}
|
|
39009
|
-
const linkElementCopy = (0,
|
|
39655
|
+
const linkElementCopy = (0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_19__.cloneShallow)(linkElement);
|
|
39010
39656
|
(_linkElementCopy$oper2 = linkElementCopy.operationId) === null || _linkElementCopy$oper2 === void 0 || _linkElementCopy$oper2.meta.set('operation', operationElement);
|
|
39011
39657
|
return linkElementCopy;
|
|
39012
39658
|
}
|
|
@@ -39016,7 +39662,7 @@ const OpenApi3_1DereferenceVisitor = stampit__WEBPACK_IMPORTED_MODULE_0__({
|
|
|
39016
39662
|
const [ancestorsLineage] = this.toAncestorLineage([...ancestors, parent]);
|
|
39017
39663
|
|
|
39018
39664
|
// ignore ExampleElement without externalValue field
|
|
39019
|
-
if (!(0,
|
|
39665
|
+
if (!(0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_10__.isStringElement)(exampleElement.externalValue)) {
|
|
39020
39666
|
return undefined;
|
|
39021
39667
|
}
|
|
39022
39668
|
|
|
@@ -39026,21 +39672,21 @@ const OpenApi3_1DereferenceVisitor = stampit__WEBPACK_IMPORTED_MODULE_0__({
|
|
|
39026
39672
|
}
|
|
39027
39673
|
|
|
39028
39674
|
// ignore resolving ExampleElement externalValue
|
|
39029
|
-
if (!this.options.resolve.external && (0,
|
|
39675
|
+
if (!this.options.resolve.external && (0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_10__.isStringElement)(exampleElement.externalValue)) {
|
|
39030
39676
|
return undefined;
|
|
39031
39677
|
}
|
|
39032
39678
|
|
|
39033
39679
|
// value and externalValue fields are mutually exclusive
|
|
39034
|
-
if (exampleElement.hasKey('value') && (0,
|
|
39035
|
-
throw new
|
|
39680
|
+
if (exampleElement.hasKey('value') && (0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_10__.isStringElement)(exampleElement.externalValue)) {
|
|
39681
|
+
throw new _swagger_api_apidom_error__WEBPACK_IMPORTED_MODULE_16__["default"]('ExampleElement value and externalValue fields are mutually exclusive.');
|
|
39036
39682
|
}
|
|
39037
|
-
const reference = await this.toReference((0,
|
|
39683
|
+
const reference = await this.toReference((0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_4__["default"])(exampleElement.externalValue));
|
|
39038
39684
|
|
|
39039
39685
|
// shallow clone of the referenced element
|
|
39040
|
-
const valueElement = (0,
|
|
39686
|
+
const valueElement = (0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_19__.cloneShallow)(reference.value.result);
|
|
39041
39687
|
// annotate operation element with info about origin
|
|
39042
39688
|
valueElement.setMetaProperty('ref-origin', reference.uri);
|
|
39043
|
-
const exampleElementCopy = (0,
|
|
39689
|
+
const exampleElementCopy = (0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_19__.cloneShallow)(exampleElement);
|
|
39044
39690
|
exampleElementCopy.value = valueElement;
|
|
39045
39691
|
return exampleElementCopy;
|
|
39046
39692
|
},
|
|
@@ -39048,7 +39694,7 @@ const OpenApi3_1DereferenceVisitor = stampit__WEBPACK_IMPORTED_MODULE_0__({
|
|
|
39048
39694
|
const [ancestorsLineage, directAncestors] = this.toAncestorLineage([...ancestors, parent]);
|
|
39049
39695
|
|
|
39050
39696
|
// skip current referencing schema as $ref keyword was not defined
|
|
39051
|
-
if (!(0,
|
|
39697
|
+
if (!(0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_10__.isStringElement)(referencingElement.$ref)) {
|
|
39052
39698
|
// skip traversing this schema but traverse all it's child schemas
|
|
39053
39699
|
return undefined;
|
|
39054
39700
|
}
|
|
@@ -39059,13 +39705,13 @@ const OpenApi3_1DereferenceVisitor = stampit__WEBPACK_IMPORTED_MODULE_0__({
|
|
|
39059
39705
|
}
|
|
39060
39706
|
|
|
39061
39707
|
// compute baseURI using rules around $id and $ref keywords
|
|
39062
|
-
let reference = await this.toReference(
|
|
39708
|
+
let reference = await this.toReference(_util_url_mjs__WEBPACK_IMPORTED_MODULE_6__.unsanitize(this.reference.uri));
|
|
39063
39709
|
let {
|
|
39064
39710
|
uri: retrievalURI
|
|
39065
39711
|
} = reference;
|
|
39066
|
-
const $refBaseURI = (0,
|
|
39067
|
-
const $refBaseURIStrippedHash =
|
|
39068
|
-
const file = (0,
|
|
39712
|
+
const $refBaseURI = (0,_resolve_strategies_openapi_3_1_util_mjs__WEBPACK_IMPORTED_MODULE_22__.resolveSchema$refField)(retrievalURI, referencingElement);
|
|
39713
|
+
const $refBaseURIStrippedHash = _util_url_mjs__WEBPACK_IMPORTED_MODULE_6__.stripHash($refBaseURI);
|
|
39714
|
+
const file = (0,_util_File_mjs__WEBPACK_IMPORTED_MODULE_23__["default"])({
|
|
39069
39715
|
uri: $refBaseURIStrippedHash
|
|
39070
39716
|
});
|
|
39071
39717
|
const isUnknownURI = (0,ramda__WEBPACK_IMPORTED_MODULE_1__.none)(r => r.canRead(file), this.options.resolve.resolvers);
|
|
@@ -39085,39 +39731,39 @@ const OpenApi3_1DereferenceVisitor = stampit__WEBPACK_IMPORTED_MODULE_0__({
|
|
|
39085
39731
|
if (isUnknownURI || isURL) {
|
|
39086
39732
|
// we're dealing with canonical URI or URL with possible fragment
|
|
39087
39733
|
const selector = $refBaseURI;
|
|
39088
|
-
referencedElement = (0,
|
|
39734
|
+
referencedElement = (0,_selectors_uri_mjs__WEBPACK_IMPORTED_MODULE_24__.evaluate)(selector,
|
|
39089
39735
|
// @ts-ignore
|
|
39090
|
-
(0,
|
|
39736
|
+
(0,_resolve_strategies_openapi_3_1_util_mjs__WEBPACK_IMPORTED_MODULE_22__.maybeRefractToSchemaElement)(reference.value.result));
|
|
39091
39737
|
} else {
|
|
39092
39738
|
// we're assuming here that we're dealing with JSON Pointer here
|
|
39093
|
-
reference = await this.toReference(
|
|
39094
|
-
const selector = (0,
|
|
39095
|
-
referencedElement = (0,
|
|
39739
|
+
reference = await this.toReference(_util_url_mjs__WEBPACK_IMPORTED_MODULE_6__.unsanitize($refBaseURI));
|
|
39740
|
+
const selector = (0,_swagger_api_apidom_json_pointer__WEBPACK_IMPORTED_MODULE_12__.uriToPointer)($refBaseURI);
|
|
39741
|
+
referencedElement = (0,_resolve_strategies_openapi_3_1_util_mjs__WEBPACK_IMPORTED_MODULE_22__.maybeRefractToSchemaElement)(
|
|
39096
39742
|
// @ts-ignore
|
|
39097
|
-
(0,
|
|
39743
|
+
(0,_swagger_api_apidom_json_pointer__WEBPACK_IMPORTED_MODULE_13__["default"])(selector, reference.value.result));
|
|
39098
39744
|
}
|
|
39099
39745
|
} catch (error) {
|
|
39100
39746
|
/**
|
|
39101
39747
|
* No SchemaElement($id=URL) was not found, so we're going to try to resolve
|
|
39102
39748
|
* the URL and assume the returned response is a JSON Schema.
|
|
39103
39749
|
*/
|
|
39104
|
-
if (isURL && error instanceof
|
|
39105
|
-
if ((0,_selectors_$
|
|
39750
|
+
if (isURL && error instanceof _errors_EvaluationJsonSchemaUriError_mjs__WEBPACK_IMPORTED_MODULE_25__["default"]) {
|
|
39751
|
+
if ((0,_selectors_$anchor_mjs__WEBPACK_IMPORTED_MODULE_26__.isAnchor)((0,_selectors_$anchor_mjs__WEBPACK_IMPORTED_MODULE_26__.uriToAnchor)($refBaseURI))) {
|
|
39106
39752
|
// we're dealing with JSON Schema $anchor here
|
|
39107
|
-
reference = await this.toReference(
|
|
39753
|
+
reference = await this.toReference(_util_url_mjs__WEBPACK_IMPORTED_MODULE_6__.unsanitize($refBaseURI));
|
|
39108
39754
|
retrievalURI = reference.uri;
|
|
39109
|
-
const selector = (0,_selectors_$
|
|
39110
|
-
referencedElement = (0,_selectors_$
|
|
39755
|
+
const selector = (0,_selectors_$anchor_mjs__WEBPACK_IMPORTED_MODULE_26__.uriToAnchor)($refBaseURI);
|
|
39756
|
+
referencedElement = (0,_selectors_$anchor_mjs__WEBPACK_IMPORTED_MODULE_26__.evaluate)(selector,
|
|
39111
39757
|
// @ts-ignore
|
|
39112
|
-
(0,
|
|
39758
|
+
(0,_resolve_strategies_openapi_3_1_util_mjs__WEBPACK_IMPORTED_MODULE_22__.maybeRefractToSchemaElement)(reference.value.result));
|
|
39113
39759
|
} else {
|
|
39114
39760
|
// we're assuming here that we're dealing with JSON Pointer here
|
|
39115
|
-
reference = await this.toReference(
|
|
39761
|
+
reference = await this.toReference(_util_url_mjs__WEBPACK_IMPORTED_MODULE_6__.unsanitize($refBaseURI));
|
|
39116
39762
|
retrievalURI = reference.uri;
|
|
39117
|
-
const selector = (0,
|
|
39118
|
-
referencedElement = (0,
|
|
39763
|
+
const selector = (0,_swagger_api_apidom_json_pointer__WEBPACK_IMPORTED_MODULE_12__.uriToPointer)($refBaseURI);
|
|
39764
|
+
referencedElement = (0,_resolve_strategies_openapi_3_1_util_mjs__WEBPACK_IMPORTED_MODULE_22__.maybeRefractToSchemaElement)(
|
|
39119
39765
|
// @ts-ignore
|
|
39120
|
-
(0,
|
|
39766
|
+
(0,_swagger_api_apidom_json_pointer__WEBPACK_IMPORTED_MODULE_13__["default"])(selector, reference.value.result));
|
|
39121
39767
|
}
|
|
39122
39768
|
} else {
|
|
39123
39769
|
throw error;
|
|
@@ -39126,12 +39772,12 @@ const OpenApi3_1DereferenceVisitor = stampit__WEBPACK_IMPORTED_MODULE_0__({
|
|
|
39126
39772
|
|
|
39127
39773
|
// detect direct or indirect reference
|
|
39128
39774
|
if (this.indirections.includes(referencedElement)) {
|
|
39129
|
-
throw new
|
|
39775
|
+
throw new _swagger_api_apidom_error__WEBPACK_IMPORTED_MODULE_16__["default"]('Recursive Schema Object reference detected');
|
|
39130
39776
|
}
|
|
39131
39777
|
|
|
39132
39778
|
// detect maximum depth of dereferencing
|
|
39133
39779
|
if (this.indirections.length > this.options.dereference.maxDepth) {
|
|
39134
|
-
throw new
|
|
39780
|
+
throw new _errors_MaximumDereferenceDepthError_mjs__WEBPACK_IMPORTED_MODULE_17__["default"](`Maximum dereference depth of "${this.options.dereference.maxDepth}" has been exceeded in file "${this.reference.uri}"`);
|
|
39135
39781
|
}
|
|
39136
39782
|
|
|
39137
39783
|
// append referencing schema to ancestors lineage
|
|
@@ -39146,8 +39792,8 @@ const OpenApi3_1DereferenceVisitor = stampit__WEBPACK_IMPORTED_MODULE_0__({
|
|
|
39146
39792
|
ancestors: ancestorsLineage
|
|
39147
39793
|
});
|
|
39148
39794
|
referencedElement = await visitAsync(referencedElement, visitor, {
|
|
39149
|
-
keyMap:
|
|
39150
|
-
nodeTypeGetter:
|
|
39795
|
+
keyMap: _swagger_api_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_18__.keyMap,
|
|
39796
|
+
nodeTypeGetter: _swagger_api_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_18__.getNodeType
|
|
39151
39797
|
});
|
|
39152
39798
|
|
|
39153
39799
|
// remove referencing schema from ancestors lineage
|
|
@@ -39155,46 +39801,50 @@ const OpenApi3_1DereferenceVisitor = stampit__WEBPACK_IMPORTED_MODULE_0__({
|
|
|
39155
39801
|
this.indirections.pop();
|
|
39156
39802
|
|
|
39157
39803
|
// Boolean JSON Schemas
|
|
39158
|
-
if ((0,
|
|
39159
|
-
const booleanJsonSchemaElement = (0,
|
|
39804
|
+
if ((0,_swagger_api_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_11__.isBooleanJsonSchemaElement)(referencedElement)) {
|
|
39805
|
+
const booleanJsonSchemaElement = (0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_19__.cloneDeep)(referencedElement);
|
|
39160
39806
|
// annotate referenced element with info about original referencing element
|
|
39161
39807
|
booleanJsonSchemaElement.setMetaProperty('ref-fields', {
|
|
39162
|
-
$ref: (0,
|
|
39808
|
+
$ref: (0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_4__["default"])(referencingElement.$ref)
|
|
39163
39809
|
});
|
|
39164
39810
|
// annotate referenced element with info about origin
|
|
39165
39811
|
booleanJsonSchemaElement.setMetaProperty('ref-origin', reference.uri);
|
|
39812
|
+
// annotate fragment with info about referencing element
|
|
39813
|
+
booleanJsonSchemaElement.setMetaProperty('ref-referencing-element-id', (0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_19__.cloneDeep)(identityManager.identify(referencingElement)));
|
|
39166
39814
|
return booleanJsonSchemaElement;
|
|
39167
39815
|
}
|
|
39168
39816
|
const mergeAndAnnotateReferencedElement = refedElement => {
|
|
39169
39817
|
// Schema Object - merge keywords from referenced schema with referencing schema
|
|
39170
|
-
const mergedElement = new
|
|
39818
|
+
const mergedElement = new _swagger_api_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_15__.SchemaElement([...refedElement.content], (0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_19__.cloneDeep)(refedElement.meta), (0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_19__.cloneDeep)(refedElement.attributes));
|
|
39171
39819
|
// existing keywords from referencing schema overrides ones from referenced schema
|
|
39172
39820
|
referencingElement.forEach((value, keyElement, item) => {
|
|
39173
|
-
mergedElement.remove((0,
|
|
39821
|
+
mergedElement.remove((0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_4__["default"])(keyElement));
|
|
39174
39822
|
mergedElement.content.push(item);
|
|
39175
39823
|
});
|
|
39176
39824
|
mergedElement.remove('$ref');
|
|
39177
39825
|
// annotate referenced element with info about original referencing element
|
|
39178
39826
|
mergedElement.setMetaProperty('ref-fields', {
|
|
39179
|
-
$ref: (0,
|
|
39827
|
+
$ref: (0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_4__["default"])(referencingElement.$ref)
|
|
39180
39828
|
});
|
|
39181
39829
|
// annotate fragment with info about origin
|
|
39182
39830
|
mergedElement.setMetaProperty('ref-origin', reference.uri);
|
|
39831
|
+
// annotate fragment with info about referencing element
|
|
39832
|
+
mergedElement.setMetaProperty('ref-referencing-element-id', (0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_19__.cloneDeep)(identityManager.identify(referencingElement)));
|
|
39183
39833
|
return mergedElement;
|
|
39184
39834
|
};
|
|
39185
39835
|
|
|
39186
39836
|
// attempting to create cycle
|
|
39187
|
-
if (ancestorsLineage.includes(referencedElement)) {
|
|
39188
|
-
|
|
39189
|
-
|
|
39837
|
+
if (ancestorsLineage.includes(referencingElement) || ancestorsLineage.includes(referencedElement)) {
|
|
39838
|
+
var _ancestorsLineage$fin3;
|
|
39839
|
+
const replaceWith = (_ancestorsLineage$fin3 = ancestorsLineage.findItem(wasReferencedBy(referencingElement))) !== null && _ancestorsLineage$fin3 !== void 0 ? _ancestorsLineage$fin3 : mergeAndAnnotateReferencedElement(referencedElement);
|
|
39840
|
+
if ((0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_10__.isMemberElement)(parent)) {
|
|
39841
|
+
parent.value = replaceWith; // eslint-disable-line no-param-reassign
|
|
39190
39842
|
} else if (Array.isArray(parent)) {
|
|
39191
|
-
parent[key] =
|
|
39843
|
+
parent[key] = replaceWith; // eslint-disable-line no-param-reassign
|
|
39192
39844
|
}
|
|
39193
39845
|
|
|
39194
39846
|
return false;
|
|
39195
39847
|
}
|
|
39196
|
-
|
|
39197
|
-
// transclude referencing element with merged referenced element
|
|
39198
39848
|
return mergeAndAnnotateReferencedElement(referencedElement);
|
|
39199
39849
|
}
|
|
39200
39850
|
}
|
|
@@ -39211,17 +39861,30 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
39211
39861
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
39212
39862
|
/* harmony export */ AncestorLineage: () => (/* binding */ AncestorLineage)
|
|
39213
39863
|
/* harmony export */ });
|
|
39864
|
+
/* harmony import */ var _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(28552);
|
|
39865
|
+
|
|
39866
|
+
|
|
39214
39867
|
// eslint-disable-next-line import/prefer-default-export
|
|
39215
39868
|
class AncestorLineage extends Array {
|
|
39216
39869
|
includesCycle(element) {
|
|
39217
39870
|
return this.filter(ancestors => ancestors.has(element)).length > 1;
|
|
39218
39871
|
}
|
|
39219
39872
|
includes(searchElement, fromIndex) {
|
|
39220
|
-
if (searchElement instanceof
|
|
39873
|
+
if (searchElement instanceof Set) {
|
|
39221
39874
|
return super.includes(searchElement, fromIndex);
|
|
39222
39875
|
}
|
|
39223
39876
|
return this.some(ancestors => ancestors.has(searchElement));
|
|
39224
39877
|
}
|
|
39878
|
+
findItem(predicate) {
|
|
39879
|
+
for (const set of this) {
|
|
39880
|
+
for (const item of set) {
|
|
39881
|
+
if ((0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_0__.isElement)(item) && predicate(item)) {
|
|
39882
|
+
return item;
|
|
39883
|
+
}
|
|
39884
|
+
}
|
|
39885
|
+
}
|
|
39886
|
+
return undefined;
|
|
39887
|
+
}
|
|
39225
39888
|
}
|
|
39226
39889
|
|
|
39227
39890
|
/***/ }),
|