@speclynx/apidom-parser-adapter-openapi-json-2 2.13.1 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -20074,7 +20074,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
20074
20074
|
* @public
|
|
20075
20075
|
*/
|
|
20076
20076
|
const emptyElement = element => {
|
|
20077
|
-
const meta = !element.isMetaEmpty ?
|
|
20077
|
+
const meta = !element.isMetaEmpty ? element.meta.cloneDeep() : undefined;
|
|
20078
20078
|
const attributes = !element.isAttributesEmpty ? (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.cloneDeep)(element.attributes) : undefined;
|
|
20079
20079
|
|
|
20080
20080
|
// @ts-ignore
|
|
@@ -20090,7 +20090,7 @@ const getMergeFunction = (keyElement, options) => {
|
|
|
20090
20090
|
};
|
|
20091
20091
|
const getMetaMergeFunction = options => {
|
|
20092
20092
|
if (typeof options.customMetaMerge !== 'function') {
|
|
20093
|
-
return targetMeta =>
|
|
20093
|
+
return targetMeta => targetMeta.cloneDeep();
|
|
20094
20094
|
}
|
|
20095
20095
|
return options.customMetaMerge;
|
|
20096
20096
|
};
|
|
@@ -20162,8 +20162,20 @@ const deepmerge = (targetElement, sourceElement, options) => {
|
|
|
20162
20162
|
const mergedElement = sourceIsArrayElement && typeof mergedOptions.arrayElementMerge === 'function' ? mergedOptions.arrayElementMerge(targetElement, sourceElement, mergedOptions) : mergedOptions.objectElementMerge(targetElement, sourceElement, mergedOptions);
|
|
20163
20163
|
|
|
20164
20164
|
// merging meta & attributes
|
|
20165
|
-
|
|
20166
|
-
|
|
20165
|
+
if (!targetElement.isMetaEmpty && !sourceElement.isMetaEmpty) {
|
|
20166
|
+
mergedElement.meta = getMetaMergeFunction(mergedOptions)(targetElement.meta, sourceElement.meta);
|
|
20167
|
+
} else if (!targetElement.isMetaEmpty) {
|
|
20168
|
+
mergedElement.meta = targetElement.meta.cloneDeep();
|
|
20169
|
+
} else if (!sourceElement.isMetaEmpty) {
|
|
20170
|
+
mergedElement.meta = sourceElement.meta.cloneDeep();
|
|
20171
|
+
}
|
|
20172
|
+
if (!targetElement.isAttributesEmpty && !sourceElement.isAttributesEmpty) {
|
|
20173
|
+
mergedElement.attributes = getAttributesMergeFunction(mergedOptions)(targetElement.attributes, sourceElement.attributes);
|
|
20174
|
+
} else if (!targetElement.isAttributesEmpty) {
|
|
20175
|
+
mergedElement.attributes = (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.cloneDeep)(targetElement.attributes);
|
|
20176
|
+
} else if (!sourceElement.isAttributesEmpty) {
|
|
20177
|
+
mergedElement.attributes = (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.cloneDeep)(sourceElement.attributes);
|
|
20178
|
+
}
|
|
20167
20179
|
return mergedElement;
|
|
20168
20180
|
};
|
|
20169
20181
|
deepmerge.all = (list, options) => {
|
|
@@ -20502,6 +20514,105 @@ class KeyValuePair {
|
|
|
20502
20514
|
|
|
20503
20515
|
/***/ },
|
|
20504
20516
|
|
|
20517
|
+
/***/ 1844
|
|
20518
|
+
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
20519
|
+
|
|
20520
|
+
"use strict";
|
|
20521
|
+
__webpack_require__.r(__webpack_exports__);
|
|
20522
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
20523
|
+
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
20524
|
+
/* harmony export */ });
|
|
20525
|
+
/* harmony import */ var ramda__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(8138);
|
|
20526
|
+
|
|
20527
|
+
/**
|
|
20528
|
+
* Lightweight meta container for Element metadata.
|
|
20529
|
+
*
|
|
20530
|
+
* Data is stored as own properties on the instance; methods live on the prototype.
|
|
20531
|
+
* `Object.keys()`, `Object.entries()`, etc. only see data properties.
|
|
20532
|
+
*
|
|
20533
|
+
* @public
|
|
20534
|
+
*/
|
|
20535
|
+
class Metadata {
|
|
20536
|
+
// Set via prototype assignment in registration.ts to avoid circular dependency
|
|
20537
|
+
|
|
20538
|
+
get(name) {
|
|
20539
|
+
return this[name];
|
|
20540
|
+
}
|
|
20541
|
+
set(name, value) {
|
|
20542
|
+
this[name] = value;
|
|
20543
|
+
}
|
|
20544
|
+
hasKey(name) {
|
|
20545
|
+
return Object.hasOwn(this, name);
|
|
20546
|
+
}
|
|
20547
|
+
keys() {
|
|
20548
|
+
return Object.keys(this);
|
|
20549
|
+
}
|
|
20550
|
+
remove(name) {
|
|
20551
|
+
delete this[name];
|
|
20552
|
+
}
|
|
20553
|
+
get isEmpty() {
|
|
20554
|
+
return Object.keys(this).length === 0;
|
|
20555
|
+
}
|
|
20556
|
+
get isFrozen() {
|
|
20557
|
+
return Object.isFrozen(this);
|
|
20558
|
+
}
|
|
20559
|
+
freeze() {
|
|
20560
|
+
for (const value of Object.values(this)) {
|
|
20561
|
+
if (value instanceof this.Element) {
|
|
20562
|
+
value.freeze();
|
|
20563
|
+
} else if (Array.isArray(value) || value !== null && typeof value === 'object') {
|
|
20564
|
+
Object.freeze(value);
|
|
20565
|
+
}
|
|
20566
|
+
}
|
|
20567
|
+
Object.freeze(this);
|
|
20568
|
+
}
|
|
20569
|
+
|
|
20570
|
+
/**
|
|
20571
|
+
* Creates a shallow clone. Same references, new container.
|
|
20572
|
+
*/
|
|
20573
|
+
cloneShallow() {
|
|
20574
|
+
const clone = new Metadata();
|
|
20575
|
+
Object.assign(clone, this);
|
|
20576
|
+
return clone;
|
|
20577
|
+
}
|
|
20578
|
+
|
|
20579
|
+
/**
|
|
20580
|
+
* Merges another Metadata into a new instance.
|
|
20581
|
+
* Arrays are concatenated, all other values are overwritten by source.
|
|
20582
|
+
*/
|
|
20583
|
+
merge(source) {
|
|
20584
|
+
const result = this.cloneShallow();
|
|
20585
|
+
for (const [key, value] of Object.entries(source)) {
|
|
20586
|
+
const existing = result.get(key);
|
|
20587
|
+
if (Array.isArray(existing) && Array.isArray(value)) {
|
|
20588
|
+
result.set(key, [...existing, ...value]);
|
|
20589
|
+
} else {
|
|
20590
|
+
result.set(key, value);
|
|
20591
|
+
}
|
|
20592
|
+
}
|
|
20593
|
+
return result;
|
|
20594
|
+
}
|
|
20595
|
+
|
|
20596
|
+
/**
|
|
20597
|
+
* Creates a deep clone. Elements are deep cloned,
|
|
20598
|
+
* all other values are deep cloned via ramda clone.
|
|
20599
|
+
*/
|
|
20600
|
+
cloneDeep() {
|
|
20601
|
+
const copy = new Metadata();
|
|
20602
|
+
for (const [key, value] of Object.entries(this)) {
|
|
20603
|
+
if (value instanceof this.Element) {
|
|
20604
|
+
copy.set(key, this.cloneDeepElement(value));
|
|
20605
|
+
} else {
|
|
20606
|
+
copy.set(key, (0,ramda__WEBPACK_IMPORTED_MODULE_0__["default"])(value));
|
|
20607
|
+
}
|
|
20608
|
+
}
|
|
20609
|
+
return copy;
|
|
20610
|
+
}
|
|
20611
|
+
}
|
|
20612
|
+
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Metadata);
|
|
20613
|
+
|
|
20614
|
+
/***/ },
|
|
20615
|
+
|
|
20505
20616
|
/***/ 5156
|
|
20506
20617
|
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
20507
20618
|
|
|
@@ -21148,7 +21259,7 @@ const cloneShallowElement = element => {
|
|
|
21148
21259
|
const copy = new Ctor();
|
|
21149
21260
|
copy.element = element.element;
|
|
21150
21261
|
if (!element.isMetaEmpty) {
|
|
21151
|
-
copy.meta =
|
|
21262
|
+
copy.meta = element.meta.cloneDeep();
|
|
21152
21263
|
}
|
|
21153
21264
|
if (!element.isAttributesEmpty) {
|
|
21154
21265
|
copy.attributes = cloneDeep(element.attributes);
|
|
@@ -21176,8 +21287,8 @@ const cloneShallowElement = element => {
|
|
|
21176
21287
|
|
|
21177
21288
|
/**
|
|
21178
21289
|
* Creates a shallow clone of an ApiDOM Element, KeyValuePair, or ObjectSlice.
|
|
21179
|
-
* The element itself is cloned, but content references are shared
|
|
21180
|
-
*
|
|
21290
|
+
* The element itself is cloned, but content references are shared.
|
|
21291
|
+
* Meta and attributes are deep cloned to preserve semantic information.
|
|
21181
21292
|
* @public
|
|
21182
21293
|
*/
|
|
21183
21294
|
const cloneShallow = value => {
|
|
@@ -22252,7 +22363,7 @@ class CollectionElement extends _Element_mjs__WEBPACK_IMPORTED_MODULE_0__["defau
|
|
|
22252
22363
|
* Search the tree recursively and find the element with the matching ID.
|
|
22253
22364
|
*/
|
|
22254
22365
|
getById(id) {
|
|
22255
|
-
return this.find(item => item.id
|
|
22366
|
+
return this.find(item => item.id === id).first;
|
|
22256
22367
|
}
|
|
22257
22368
|
|
|
22258
22369
|
/**
|
|
@@ -22282,18 +22393,24 @@ class CollectionElement extends _Element_mjs__WEBPACK_IMPORTED_MODULE_0__["defau
|
|
|
22282
22393
|
"use strict";
|
|
22283
22394
|
__webpack_require__.r(__webpack_exports__);
|
|
22284
22395
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
22396
|
+
/* harmony export */ Metadata: () => (/* reexport safe */ _Metadata_mjs__WEBPACK_IMPORTED_MODULE_1__["default"]),
|
|
22285
22397
|
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
22286
22398
|
/* harmony export */ });
|
|
22287
22399
|
/* harmony import */ var ramda__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(3654);
|
|
22288
|
-
/* harmony import */ var
|
|
22289
|
-
/* harmony import */ var
|
|
22400
|
+
/* harmony import */ var _Metadata_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(1844);
|
|
22401
|
+
/* harmony import */ var _KeyValuePair_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(6663);
|
|
22402
|
+
/* harmony import */ var _ObjectSlice_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(8504);
|
|
22290
22403
|
|
|
22291
22404
|
|
|
22292
22405
|
|
|
22406
|
+
// shared singleton for frozen elements with no meta — avoids allocation on every access
|
|
22407
|
+
const FROZEN_EMPTY_METADATA = Object.freeze(new _Metadata_mjs__WEBPACK_IMPORTED_MODULE_1__["default"]());
|
|
22408
|
+
|
|
22293
22409
|
/**
|
|
22294
22410
|
* Valid content types for an Element.
|
|
22295
22411
|
* @public
|
|
22296
22412
|
*/
|
|
22413
|
+
|
|
22297
22414
|
/**
|
|
22298
22415
|
* Base Element class that all ApiDOM elements extend.
|
|
22299
22416
|
*
|
|
@@ -22391,7 +22508,7 @@ class Element {
|
|
|
22391
22508
|
_attributes;
|
|
22392
22509
|
|
|
22393
22510
|
// ============================================================
|
|
22394
|
-
// Prototype-assigned properties (set in
|
|
22511
|
+
// Prototype-assigned properties (set in registration.ts)
|
|
22395
22512
|
// Using 'declare' allows TypeScript to know about these
|
|
22396
22513
|
// without generating runtime code.
|
|
22397
22514
|
// ============================================================
|
|
@@ -22452,13 +22569,13 @@ class Element {
|
|
|
22452
22569
|
}
|
|
22453
22570
|
|
|
22454
22571
|
// KeyValuePair
|
|
22455
|
-
if (value instanceof
|
|
22572
|
+
if (value instanceof _KeyValuePair_mjs__WEBPACK_IMPORTED_MODULE_2__["default"]) {
|
|
22456
22573
|
this._content = value;
|
|
22457
22574
|
return;
|
|
22458
22575
|
}
|
|
22459
22576
|
|
|
22460
22577
|
// ObjectSlice - extract elements array
|
|
22461
|
-
if (value instanceof
|
|
22578
|
+
if (value instanceof _ObjectSlice_mjs__WEBPACK_IMPORTED_MODULE_3__["default"]) {
|
|
22462
22579
|
this._content = value.elements;
|
|
22463
22580
|
return;
|
|
22464
22581
|
}
|
|
@@ -22479,24 +22596,22 @@ class Element {
|
|
|
22479
22596
|
|
|
22480
22597
|
/**
|
|
22481
22598
|
* Metadata about this element (id, classes, title, description, links).
|
|
22482
|
-
* Lazily creates
|
|
22599
|
+
* Lazily creates a Metadata instance if not set.
|
|
22483
22600
|
*/
|
|
22484
22601
|
get meta() {
|
|
22485
22602
|
if (!this._meta) {
|
|
22486
|
-
if (this.isFrozen)
|
|
22487
|
-
|
|
22488
|
-
meta.freeze();
|
|
22489
|
-
return meta;
|
|
22490
|
-
}
|
|
22491
|
-
this._meta = new this.ObjectElement();
|
|
22603
|
+
if (this.isFrozen) return FROZEN_EMPTY_METADATA;
|
|
22604
|
+
this._meta = new _Metadata_mjs__WEBPACK_IMPORTED_MODULE_1__["default"]();
|
|
22492
22605
|
}
|
|
22493
22606
|
return this._meta;
|
|
22494
22607
|
}
|
|
22495
22608
|
set meta(value) {
|
|
22496
|
-
if (value instanceof
|
|
22609
|
+
if (value instanceof _Metadata_mjs__WEBPACK_IMPORTED_MODULE_1__["default"]) {
|
|
22497
22610
|
this._meta = value;
|
|
22498
|
-
} else {
|
|
22499
|
-
|
|
22611
|
+
} else if (value && typeof value === 'object') {
|
|
22612
|
+
const meta = new _Metadata_mjs__WEBPACK_IMPORTED_MODULE_1__["default"]();
|
|
22613
|
+
Object.assign(meta, value);
|
|
22614
|
+
this._meta = meta;
|
|
22500
22615
|
}
|
|
22501
22616
|
}
|
|
22502
22617
|
|
|
@@ -22529,10 +22644,8 @@ class Element {
|
|
|
22529
22644
|
|
|
22530
22645
|
/** Unique identifier for this element. */
|
|
22531
22646
|
get id() {
|
|
22532
|
-
if (this.isFrozen) {
|
|
22533
|
-
return this.getMetaProperty('id', '');
|
|
22534
|
-
}
|
|
22535
22647
|
if (!this.hasMetaProperty('id')) {
|
|
22648
|
+
if (this.isFrozen) return '';
|
|
22536
22649
|
this.setMetaProperty('id', '');
|
|
22537
22650
|
}
|
|
22538
22651
|
return this.meta.get('id');
|
|
@@ -22543,10 +22656,8 @@ class Element {
|
|
|
22543
22656
|
|
|
22544
22657
|
/** CSS-like class names. */
|
|
22545
22658
|
get classes() {
|
|
22546
|
-
if (this.isFrozen) {
|
|
22547
|
-
return this.getMetaProperty('classes', []);
|
|
22548
|
-
}
|
|
22549
22659
|
if (!this.hasMetaProperty('classes')) {
|
|
22660
|
+
if (this.isFrozen) return [];
|
|
22550
22661
|
this.setMetaProperty('classes', []);
|
|
22551
22662
|
}
|
|
22552
22663
|
return this.meta.get('classes');
|
|
@@ -22557,11 +22668,13 @@ class Element {
|
|
|
22557
22668
|
|
|
22558
22669
|
/** Hyperlinks associated with this element. */
|
|
22559
22670
|
get links() {
|
|
22560
|
-
if (this.isFrozen) {
|
|
22561
|
-
return this.getMetaProperty('links', []);
|
|
22562
|
-
}
|
|
22563
22671
|
if (!this.hasMetaProperty('links')) {
|
|
22564
|
-
this.
|
|
22672
|
+
if (this.isFrozen) {
|
|
22673
|
+
const empty = new this.ArrayElement();
|
|
22674
|
+
empty.freeze();
|
|
22675
|
+
return empty;
|
|
22676
|
+
}
|
|
22677
|
+
this.setMetaProperty('links', new this.ArrayElement());
|
|
22565
22678
|
}
|
|
22566
22679
|
return this.meta.get('links');
|
|
22567
22680
|
}
|
|
@@ -22581,7 +22694,7 @@ class Element {
|
|
|
22581
22694
|
if (Array.isArray(content)) {
|
|
22582
22695
|
return content;
|
|
22583
22696
|
}
|
|
22584
|
-
if (content instanceof
|
|
22697
|
+
if (content instanceof _KeyValuePair_mjs__WEBPACK_IMPORTED_MODULE_2__["default"]) {
|
|
22585
22698
|
const children = [];
|
|
22586
22699
|
if (content.key) children.push(content.key);
|
|
22587
22700
|
if (content.value) children.push(content.value);
|
|
@@ -22611,7 +22724,6 @@ class Element {
|
|
|
22611
22724
|
|
|
22612
22725
|
// Freeze meta and attributes
|
|
22613
22726
|
if (this._meta) {
|
|
22614
|
-
this._meta.parent = this;
|
|
22615
22727
|
this._meta.freeze();
|
|
22616
22728
|
}
|
|
22617
22729
|
if (this._attributes) {
|
|
@@ -22646,7 +22758,7 @@ class Element {
|
|
|
22646
22758
|
if (_content instanceof Element) {
|
|
22647
22759
|
return _content.toValue();
|
|
22648
22760
|
}
|
|
22649
|
-
if (_content instanceof
|
|
22761
|
+
if (_content instanceof _KeyValuePair_mjs__WEBPACK_IMPORTED_MODULE_2__["default"]) {
|
|
22650
22762
|
return _content.toValue();
|
|
22651
22763
|
}
|
|
22652
22764
|
if (Array.isArray(_content)) {
|
|
@@ -22702,7 +22814,7 @@ class Element {
|
|
|
22702
22814
|
* @throws Error if this element has no ID
|
|
22703
22815
|
*/
|
|
22704
22816
|
toRef(path) {
|
|
22705
|
-
const idValue = this.id
|
|
22817
|
+
const idValue = this.id;
|
|
22706
22818
|
if (idValue === '') {
|
|
22707
22819
|
throw new Error('Cannot create reference to an element without an ID');
|
|
22708
22820
|
}
|
|
@@ -22714,26 +22826,16 @@ class Element {
|
|
|
22714
22826
|
}
|
|
22715
22827
|
|
|
22716
22828
|
/**
|
|
22717
|
-
* Gets a meta property.
|
|
22829
|
+
* Gets a meta property value.
|
|
22718
22830
|
*
|
|
22719
22831
|
* When the property doesn't exist:
|
|
22720
|
-
* - With defaultValue: returns
|
|
22832
|
+
* - With defaultValue: returns the provided default value
|
|
22721
22833
|
* - Without defaultValue: returns undefined
|
|
22722
|
-
*
|
|
22723
|
-
* Note: Each call with a default creates a new instance. Use setMetaProperty
|
|
22724
|
-
* first if you need reference equality across multiple accesses.
|
|
22725
22834
|
*/
|
|
22726
22835
|
|
|
22727
22836
|
getMetaProperty(name, defaultValue) {
|
|
22728
22837
|
if (!this.hasMetaProperty(name)) {
|
|
22729
|
-
|
|
22730
|
-
return undefined;
|
|
22731
|
-
}
|
|
22732
|
-
const element = this.refract(defaultValue);
|
|
22733
|
-
if (element && this.isFrozen) {
|
|
22734
|
-
element.freeze();
|
|
22735
|
-
}
|
|
22736
|
-
return element;
|
|
22838
|
+
return defaultValue;
|
|
22737
22839
|
}
|
|
22738
22840
|
return this.meta.get(name);
|
|
22739
22841
|
}
|
|
@@ -22746,20 +22848,17 @@ class Element {
|
|
|
22746
22848
|
}
|
|
22747
22849
|
|
|
22748
22850
|
/**
|
|
22749
|
-
*
|
|
22851
|
+
* Checks whether a meta property exists.
|
|
22750
22852
|
*/
|
|
22751
22853
|
hasMetaProperty(name) {
|
|
22752
|
-
|
|
22753
|
-
return this.meta.hasKey(name);
|
|
22754
|
-
}
|
|
22755
|
-
return false;
|
|
22854
|
+
return this._meta !== undefined && this._meta.hasKey(name);
|
|
22756
22855
|
}
|
|
22757
22856
|
|
|
22758
22857
|
/**
|
|
22759
22858
|
* Checks if meta is empty.
|
|
22760
22859
|
*/
|
|
22761
22860
|
get isMetaEmpty() {
|
|
22762
|
-
return this._meta === undefined || this.
|
|
22861
|
+
return this._meta === undefined || this._meta.isEmpty;
|
|
22763
22862
|
}
|
|
22764
22863
|
|
|
22765
22864
|
/**
|
|
@@ -22785,7 +22884,7 @@ class Element {
|
|
|
22785
22884
|
}
|
|
22786
22885
|
|
|
22787
22886
|
/**
|
|
22788
|
-
*
|
|
22887
|
+
* Checks whether an attributes property exists.
|
|
22789
22888
|
*/
|
|
22790
22889
|
hasAttributesProperty(name) {
|
|
22791
22890
|
if (!this.isAttributesEmpty) {
|
|
@@ -22804,6 +22903,7 @@ class Element {
|
|
|
22804
22903
|
|
|
22805
22904
|
// Re-export types for convenience
|
|
22806
22905
|
|
|
22906
|
+
|
|
22807
22907
|
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Element);
|
|
22808
22908
|
|
|
22809
22909
|
/***/ },
|
|
@@ -23242,6 +23342,10 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
23242
23342
|
/* harmony import */ var _elements_Style_mjs__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(9686);
|
|
23243
23343
|
/* harmony import */ var _ObjectSlice_mjs__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(8504);
|
|
23244
23344
|
/* harmony import */ var _KeyValuePair_mjs__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(6663);
|
|
23345
|
+
/* harmony import */ var _Metadata_mjs__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(1844);
|
|
23346
|
+
/* harmony import */ var _clone_index_mjs__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(2111);
|
|
23347
|
+
|
|
23348
|
+
|
|
23245
23349
|
|
|
23246
23350
|
|
|
23247
23351
|
|
|
@@ -23301,14 +23405,16 @@ function refract(value) {
|
|
|
23301
23405
|
}
|
|
23302
23406
|
|
|
23303
23407
|
// Set up prototype assignments for circular dependency resolution.
|
|
23304
|
-
// These allow Element instances to
|
|
23305
|
-
//
|
|
23408
|
+
// These allow Element and Metadata instances to reference classes they can't import
|
|
23409
|
+
// directly (which would cause circular imports).
|
|
23306
23410
|
// Using 'declare' in the class definitions enables type-safe access to these properties.
|
|
23307
23411
|
_primitives_Element_mjs__WEBPACK_IMPORTED_MODULE_0__["default"].prototype.ObjectElement = _primitives_ObjectElement_mjs__WEBPACK_IMPORTED_MODULE_8__["default"];
|
|
23308
23412
|
_primitives_Element_mjs__WEBPACK_IMPORTED_MODULE_0__["default"].prototype.ArrayElement = _primitives_ArrayElement_mjs__WEBPACK_IMPORTED_MODULE_6__["default"];
|
|
23309
23413
|
_primitives_Element_mjs__WEBPACK_IMPORTED_MODULE_0__["default"].prototype.RefElement = _elements_RefElement_mjs__WEBPACK_IMPORTED_MODULE_10__["default"];
|
|
23310
23414
|
_primitives_Element_mjs__WEBPACK_IMPORTED_MODULE_0__["default"].prototype.MemberElement = _primitives_MemberElement_mjs__WEBPACK_IMPORTED_MODULE_7__["default"];
|
|
23311
23415
|
_primitives_Element_mjs__WEBPACK_IMPORTED_MODULE_0__["default"].prototype.refract = refract;
|
|
23416
|
+
_Metadata_mjs__WEBPACK_IMPORTED_MODULE_18__["default"].prototype.Element = _primitives_Element_mjs__WEBPACK_IMPORTED_MODULE_0__["default"];
|
|
23417
|
+
_Metadata_mjs__WEBPACK_IMPORTED_MODULE_18__["default"].prototype.cloneDeepElement = element => (0,_clone_index_mjs__WEBPACK_IMPORTED_MODULE_19__.cloneDeep)(element);
|
|
23312
23418
|
|
|
23313
23419
|
/**
|
|
23314
23420
|
* Contains all of the element classes, and related structures and methods
|
|
@@ -23373,7 +23479,13 @@ class JSONSerialiser {
|
|
|
23373
23479
|
element: element.element
|
|
23374
23480
|
};
|
|
23375
23481
|
if (!element.isMetaEmpty) {
|
|
23376
|
-
|
|
23482
|
+
const serialisedMeta = this.serialiseMeta(element);
|
|
23483
|
+
if (serialisedMeta) {
|
|
23484
|
+
payload.meta = serialisedMeta.meta;
|
|
23485
|
+
if (serialisedMeta.rawKeys.length > 0) {
|
|
23486
|
+
payload.__meta_raw__ = serialisedMeta.rawKeys;
|
|
23487
|
+
}
|
|
23488
|
+
}
|
|
23377
23489
|
}
|
|
23378
23490
|
if (!element.isAttributesEmpty) {
|
|
23379
23491
|
payload.attributes = this.serialiseObject(element.attributes);
|
|
@@ -23420,7 +23532,7 @@ class JSONSerialiser {
|
|
|
23420
23532
|
element.element = value.element;
|
|
23421
23533
|
}
|
|
23422
23534
|
|
|
23423
|
-
// Extract
|
|
23535
|
+
// Extract special meta keys without mutating input, filter remaining meta
|
|
23424
23536
|
let mappingsDoc;
|
|
23425
23537
|
let stylesDoc;
|
|
23426
23538
|
let metaToDeserialize = value.meta;
|
|
@@ -23434,8 +23546,15 @@ class JSONSerialiser {
|
|
|
23434
23546
|
stylesDoc = __styles__;
|
|
23435
23547
|
metaToDeserialize = Object.keys(rest).length > 0 ? rest : undefined;
|
|
23436
23548
|
}
|
|
23549
|
+
|
|
23550
|
+
// determine which meta keys were raw primitives before serialization
|
|
23551
|
+
const rawKeys = value.__meta_raw__ ? new Set(value.__meta_raw__) : undefined;
|
|
23437
23552
|
if (metaToDeserialize) {
|
|
23438
|
-
|
|
23553
|
+
for (const [key, doc] of Object.entries(metaToDeserialize)) {
|
|
23554
|
+
const deserialized = this.deserialise(doc);
|
|
23555
|
+
// unwrap keys that were raw primitives before serialization
|
|
23556
|
+
element.setMetaProperty(key, rawKeys?.has(key) ? deserialized.toValue() : deserialized);
|
|
23557
|
+
}
|
|
23439
23558
|
}
|
|
23440
23559
|
|
|
23441
23560
|
// Restore source position from __mappings__
|
|
@@ -23498,6 +23617,27 @@ class JSONSerialiser {
|
|
|
23498
23617
|
}
|
|
23499
23618
|
return content;
|
|
23500
23619
|
}
|
|
23620
|
+
serialiseMeta(element) {
|
|
23621
|
+
const meta = {};
|
|
23622
|
+
const rawKeys = [];
|
|
23623
|
+
let hasEntries = false;
|
|
23624
|
+
for (const [key, value] of Object.entries(element.meta)) {
|
|
23625
|
+
if (value instanceof this.namespace.elements.Element) {
|
|
23626
|
+
meta[key] = this.serialise(value);
|
|
23627
|
+
hasEntries = true;
|
|
23628
|
+
} else if (value !== undefined) {
|
|
23629
|
+
// refract primitives to maintain JSON Refract spec compatibility
|
|
23630
|
+
const refracted = element.refract(value);
|
|
23631
|
+
meta[key] = this.serialise(refracted);
|
|
23632
|
+
rawKeys.push(key);
|
|
23633
|
+
hasEntries = true;
|
|
23634
|
+
}
|
|
23635
|
+
}
|
|
23636
|
+
return hasEntries ? {
|
|
23637
|
+
meta,
|
|
23638
|
+
rawKeys
|
|
23639
|
+
} : undefined;
|
|
23640
|
+
}
|
|
23501
23641
|
serialiseObject(obj) {
|
|
23502
23642
|
const result = {};
|
|
23503
23643
|
obj.forEach((value, key) => {
|
|
@@ -24466,7 +24606,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
24466
24606
|
*/
|
|
24467
24607
|
class FallbackVisitor extends _Visitor_mjs__WEBPACK_IMPORTED_MODULE_1__["default"] {
|
|
24468
24608
|
enter(path) {
|
|
24469
|
-
this.element = (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_0__.cloneDeep)(path.node);
|
|
24609
|
+
this.element = this.consume ? path.node : (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_0__.cloneDeep)(path.node);
|
|
24470
24610
|
path.stop();
|
|
24471
24611
|
}
|
|
24472
24612
|
}
|
|
@@ -24506,7 +24646,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
24506
24646
|
*/
|
|
24507
24647
|
class SpecificationVisitor extends _Visitor_mjs__WEBPACK_IMPORTED_MODULE_6__["default"] {
|
|
24508
24648
|
specObj;
|
|
24509
|
-
passingOptionsNames = ['specObj', 'parent'];
|
|
24649
|
+
passingOptionsNames = ['specObj', 'parent', 'consume'];
|
|
24510
24650
|
constructor({
|
|
24511
24651
|
specObj,
|
|
24512
24652
|
...rest
|
|
@@ -24552,7 +24692,7 @@ class SpecificationVisitor extends _Visitor_mjs__WEBPACK_IMPORTED_MODULE_6__["de
|
|
|
24552
24692
|
*/
|
|
24553
24693
|
const visitor = this.retrieveVisitorInstance(specPath, options);
|
|
24554
24694
|
if (visitor instanceof _FallbackVisitor_mjs__WEBPACK_IMPORTED_MODULE_7__["default"] && visitor?.constructor === _FallbackVisitor_mjs__WEBPACK_IMPORTED_MODULE_7__["default"]) {
|
|
24555
|
-
return (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_4__.cloneDeep)(element);
|
|
24695
|
+
return this.consume ? element : (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_4__.cloneDeep)(element);
|
|
24556
24696
|
}
|
|
24557
24697
|
(0,_speclynx_apidom_traverse__WEBPACK_IMPORTED_MODULE_5__.traverse)(element, visitor, options);
|
|
24558
24698
|
return visitor.element;
|
|
@@ -24571,7 +24711,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
24571
24711
|
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
24572
24712
|
/* harmony export */ });
|
|
24573
24713
|
/* harmony import */ var _speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(8400);
|
|
24574
|
-
/* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(
|
|
24714
|
+
/* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(2111);
|
|
24575
24715
|
/* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(5810);
|
|
24576
24716
|
/* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(9686);
|
|
24577
24717
|
|
|
@@ -24586,19 +24726,21 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
24586
24726
|
*/
|
|
24587
24727
|
class Visitor {
|
|
24588
24728
|
element;
|
|
24729
|
+
consume = false;
|
|
24730
|
+
consumeSafe = false;
|
|
24589
24731
|
constructor(options) {
|
|
24590
24732
|
Object.assign(this, options);
|
|
24591
24733
|
}
|
|
24592
24734
|
copyMetaAndAttributes(from, to) {
|
|
24593
|
-
if (!from.isMetaEmpty
|
|
24594
|
-
|
|
24595
|
-
|
|
24596
|
-
to.meta = (
|
|
24735
|
+
if (!from.isMetaEmpty && !to.isMetaEmpty) {
|
|
24736
|
+
to.meta = to.meta.merge(from.meta);
|
|
24737
|
+
} else if (!from.isMetaEmpty) {
|
|
24738
|
+
to.meta = from.meta.cloneDeep();
|
|
24597
24739
|
}
|
|
24598
|
-
if (!from.isAttributesEmpty
|
|
24599
|
-
|
|
24600
|
-
|
|
24601
|
-
to.attributes = (0,
|
|
24740
|
+
if (!from.isAttributesEmpty && !to.isAttributesEmpty) {
|
|
24741
|
+
to.attributes = (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_0__["default"])(to.attributes, from.attributes);
|
|
24742
|
+
} else if (!from.isAttributesEmpty) {
|
|
24743
|
+
to.attributes = (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.cloneDeep)(from.attributes);
|
|
24602
24744
|
}
|
|
24603
24745
|
_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__["default"].transfer(from, to);
|
|
24604
24746
|
_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_3__["default"].transfer(from, to);
|
|
@@ -24708,12 +24850,13 @@ class FixedFieldsVisitor extends _SpecificationVisitor_mjs__WEBPACK_IMPORTED_MOD
|
|
|
24708
24850
|
const keyValue = (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_3__["default"])(key);
|
|
24709
24851
|
if ((0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_0__.isStringElement)(key) && fields.includes(keyValue) && !this.ignoredFields.includes(keyValue)) {
|
|
24710
24852
|
const fixedFieldElement = this.toRefractedElement([...specPath, 'fixedFields', keyValue], value);
|
|
24711
|
-
const newMemberElement = new _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__["default"]((0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.cloneDeep)(key), fixedFieldElement);
|
|
24853
|
+
const newMemberElement = new _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__["default"](this.consume ? key : (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.cloneDeep)(key), fixedFieldElement);
|
|
24712
24854
|
this.copyMetaAndAttributes(memberElement, newMemberElement);
|
|
24713
|
-
newMemberElement.classes.push('fixed-field');
|
|
24714
24855
|
this.element.content.push(newMemberElement);
|
|
24856
|
+
// consume: release processed generic subtree
|
|
24857
|
+
if (this.consume && this.consumeSafe && !memberElement.isFrozen) memberElement.value = undefined;
|
|
24715
24858
|
} else if (!this.ignoredFields.includes(keyValue)) {
|
|
24716
|
-
this.element.content.push((0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.cloneDeep)(memberElement));
|
|
24859
|
+
this.element.content.push(this.consume ? memberElement : (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.cloneDeep)(memberElement));
|
|
24717
24860
|
}
|
|
24718
24861
|
});
|
|
24719
24862
|
this.copyMetaAndAttributes(objectElement, this.element);
|
|
@@ -24802,12 +24945,14 @@ class PatternedFieldsVisitor extends _SpecificationVisitor_mjs__WEBPACK_IMPORTED
|
|
|
24802
24945
|
if (!this.ignoredFields.includes(keyValue) && this.fieldPatternPredicate(keyValue)) {
|
|
24803
24946
|
const specPath = this.specPath(value);
|
|
24804
24947
|
const patternedFieldElement = this.toRefractedElement(specPath, value);
|
|
24805
|
-
const newMemberElement = new _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__["default"]((0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.cloneDeep)(key), patternedFieldElement);
|
|
24948
|
+
const newMemberElement = new _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__["default"](this.consume ? key : (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.cloneDeep)(key), patternedFieldElement);
|
|
24806
24949
|
this.copyMetaAndAttributes(memberElement, newMemberElement);
|
|
24807
24950
|
newMemberElement.classes.push('patterned-field');
|
|
24808
24951
|
this.element.content.push(newMemberElement);
|
|
24952
|
+
// consume: release processed generic subtree
|
|
24953
|
+
if (this.consume && this.consumeSafe && !memberElement.isFrozen) memberElement.value = undefined;
|
|
24809
24954
|
} else if (!this.ignoredFields.includes(keyValue)) {
|
|
24810
|
-
this.element.content.push((0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.cloneDeep)(memberElement));
|
|
24955
|
+
this.element.content.push(this.consume ? memberElement : (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.cloneDeep)(memberElement));
|
|
24811
24956
|
}
|
|
24812
24957
|
});
|
|
24813
24958
|
this.copyMetaAndAttributes(objectElement, this.element);
|
|
@@ -25365,13 +25510,11 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
25365
25510
|
/* harmony import */ var ramda_adjunct__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(3031);
|
|
25366
25511
|
/* harmony import */ var ramda_adjunct__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(6513);
|
|
25367
25512
|
/* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(5162);
|
|
25368
|
-
/* harmony import */ var
|
|
25369
|
-
/* harmony import */ var
|
|
25370
|
-
/* harmony import */ var
|
|
25371
|
-
/* harmony import */ var
|
|
25372
|
-
/* harmony import */ var
|
|
25373
|
-
/* harmony import */ var _elements_JSONSchema_mjs__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(4686);
|
|
25374
|
-
/* harmony import */ var _predicates_mjs__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(6059);
|
|
25513
|
+
/* harmony import */ var _speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(4673);
|
|
25514
|
+
/* harmony import */ var _generics_FixedFieldsVisitor_mjs__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(5320);
|
|
25515
|
+
/* harmony import */ var _bases_mjs__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(9033);
|
|
25516
|
+
/* harmony import */ var _elements_JSONSchema_mjs__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(4686);
|
|
25517
|
+
/* harmony import */ var _predicates_mjs__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(6059);
|
|
25375
25518
|
|
|
25376
25519
|
|
|
25377
25520
|
|
|
@@ -25386,10 +25529,11 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
25386
25529
|
/**
|
|
25387
25530
|
* @public
|
|
25388
25531
|
*/
|
|
25389
|
-
class JSONSchemaVisitor extends
|
|
25532
|
+
class JSONSchemaVisitor extends _bases_mjs__WEBPACK_IMPORTED_MODULE_7__.JSONSchemaVisitorBase {
|
|
25390
25533
|
constructor(options) {
|
|
25391
25534
|
super(options);
|
|
25392
|
-
this.element = new
|
|
25535
|
+
this.element = new _elements_JSONSchema_mjs__WEBPACK_IMPORTED_MODULE_8__["default"]();
|
|
25536
|
+
this.consumeSafe = true;
|
|
25393
25537
|
this.specPath = (0,ramda__WEBPACK_IMPORTED_MODULE_0__["default"])(['document', 'objects', 'JSONSchema']);
|
|
25394
25538
|
}
|
|
25395
25539
|
get defaultDialectIdentifier() {
|
|
@@ -25402,27 +25546,27 @@ class JSONSchemaVisitor extends _bases_mjs__WEBPACK_IMPORTED_MODULE_9__.JSONSche
|
|
|
25402
25546
|
|
|
25403
25547
|
// for further processing consider this JSONSchema Element as parent for all sub-schemas
|
|
25404
25548
|
this.parent = this.element;
|
|
25405
|
-
return
|
|
25549
|
+
return _generics_FixedFieldsVisitor_mjs__WEBPACK_IMPORTED_MODULE_6__["default"].prototype.ObjectElement.call(this, path);
|
|
25406
25550
|
}
|
|
25407
25551
|
handleDialectIdentifier(objectElement) {
|
|
25408
25552
|
// handle $schema keyword in embedded resources
|
|
25409
25553
|
if ((0,ramda_adjunct__WEBPACK_IMPORTED_MODULE_2__["default"])(this.parent) && !(0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_4__.isStringElement)(objectElement.get('$schema'))) {
|
|
25410
25554
|
// no parent available and no $schema is defined, set default $schema
|
|
25411
25555
|
this.element.meta.set('inheritedDialectIdentifier', this.defaultDialectIdentifier);
|
|
25412
|
-
} else if ((0,
|
|
25556
|
+
} else if ((0,_predicates_mjs__WEBPACK_IMPORTED_MODULE_9__.isJSONSchemaElement)(this.parent) && !(0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_4__.isStringElement)(objectElement.get('$schema'))) {
|
|
25413
25557
|
// parent is available and no $schema is defined, set parent $schema
|
|
25414
|
-
const inheritedDialectIdentifier = (0,ramda__WEBPACK_IMPORTED_MODULE_1__["default"])(
|
|
25558
|
+
const inheritedDialectIdentifier = (0,ramda__WEBPACK_IMPORTED_MODULE_1__["default"])(this.parent.meta.get('inheritedDialectIdentifier'), (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_5__["default"])(this.parent.$schema));
|
|
25415
25559
|
this.element.meta.set('inheritedDialectIdentifier', inheritedDialectIdentifier);
|
|
25416
25560
|
}
|
|
25417
25561
|
}
|
|
25418
25562
|
handleSchemaIdentifier(objectElement, identifierKeyword = 'id') {
|
|
25419
25563
|
// handle schema identifier in embedded resources
|
|
25420
|
-
// fetch parent's ancestorsSchemaIdentifiers
|
|
25421
|
-
const ancestorsSchemaIdentifiers = this.parent !== undefined ? (
|
|
25564
|
+
// fetch parent's ancestorsSchemaIdentifiers (stored as plain string[])
|
|
25565
|
+
const ancestorsSchemaIdentifiers = this.parent !== undefined ? [...(this.parent.meta.get('ancestorsSchemaIdentifiers') ?? [])] : [];
|
|
25422
25566
|
// get current schema identifier
|
|
25423
|
-
const schemaIdentifier = (0,
|
|
25567
|
+
const schemaIdentifier = (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_5__["default"])(objectElement.get(identifierKeyword));
|
|
25424
25568
|
|
|
25425
|
-
// remember schema identifier if it's a non-empty
|
|
25569
|
+
// remember schema identifier if it's a non-empty string
|
|
25426
25570
|
if ((0,ramda_adjunct__WEBPACK_IMPORTED_MODULE_3__["default"])(schemaIdentifier)) {
|
|
25427
25571
|
ancestorsSchemaIdentifiers.push(schemaIdentifier);
|
|
25428
25572
|
}
|
|
@@ -28060,7 +28204,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
28060
28204
|
const refract = (value, {
|
|
28061
28205
|
element = 'swagger',
|
|
28062
28206
|
plugins = [],
|
|
28063
|
-
specificationObj = _specification_mjs__WEBPACK_IMPORTED_MODULE_5__["default"]
|
|
28207
|
+
specificationObj = _specification_mjs__WEBPACK_IMPORTED_MODULE_5__["default"],
|
|
28208
|
+
consume = false
|
|
28064
28209
|
} = {}) => {
|
|
28065
28210
|
const genericElement = (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__.refract)(value);
|
|
28066
28211
|
const resolvedSpec = (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_1__.resolveSpecification)(specificationObj);
|
|
@@ -28077,7 +28222,8 @@ const refract = (value, {
|
|
|
28077
28222
|
*/
|
|
28078
28223
|
const RootVisitorClass = (0,ramda__WEBPACK_IMPORTED_MODULE_4__["default"])(specPath, resolvedSpec);
|
|
28079
28224
|
const rootVisitor = new RootVisitorClass({
|
|
28080
|
-
specObj: resolvedSpec
|
|
28225
|
+
specObj: resolvedSpec,
|
|
28226
|
+
consume
|
|
28081
28227
|
});
|
|
28082
28228
|
(0,_speclynx_apidom_traverse__WEBPACK_IMPORTED_MODULE_3__.traverse)(genericElement, rootVisitor);
|
|
28083
28229
|
|
|
@@ -28998,7 +29144,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
28998
29144
|
*/
|
|
28999
29145
|
class FallbackVisitor extends _Visitor_mjs__WEBPACK_IMPORTED_MODULE_1__["default"] {
|
|
29000
29146
|
enter(path) {
|
|
29001
|
-
this.element = (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_0__.cloneDeep)(path.node);
|
|
29147
|
+
this.element = this.consume ? path.node : (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_0__.cloneDeep)(path.node);
|
|
29002
29148
|
path.stop();
|
|
29003
29149
|
}
|
|
29004
29150
|
}
|
|
@@ -29064,7 +29210,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
29064
29210
|
*/
|
|
29065
29211
|
class SpecificationVisitor extends _Visitor_mjs__WEBPACK_IMPORTED_MODULE_6__["default"] {
|
|
29066
29212
|
specObj;
|
|
29067
|
-
passingOptionsNames = ['specObj'];
|
|
29213
|
+
passingOptionsNames = ['specObj', 'consume'];
|
|
29068
29214
|
constructor({
|
|
29069
29215
|
specObj,
|
|
29070
29216
|
...rest
|
|
@@ -29110,7 +29256,7 @@ class SpecificationVisitor extends _Visitor_mjs__WEBPACK_IMPORTED_MODULE_6__["de
|
|
|
29110
29256
|
*/
|
|
29111
29257
|
const visitor = this.retrieveVisitorInstance(specPath, options);
|
|
29112
29258
|
if (visitor instanceof _FallbackVisitor_mjs__WEBPACK_IMPORTED_MODULE_7__["default"] && visitor?.constructor === _FallbackVisitor_mjs__WEBPACK_IMPORTED_MODULE_7__["default"]) {
|
|
29113
|
-
return (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_4__.cloneDeep)(element);
|
|
29259
|
+
return this.consume ? element : (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_4__.cloneDeep)(element);
|
|
29114
29260
|
}
|
|
29115
29261
|
(0,_speclynx_apidom_traverse__WEBPACK_IMPORTED_MODULE_5__.traverse)(element, visitor);
|
|
29116
29262
|
return visitor.element;
|
|
@@ -29129,7 +29275,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
29129
29275
|
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
29130
29276
|
/* harmony export */ });
|
|
29131
29277
|
/* harmony import */ var _speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(8400);
|
|
29132
|
-
/* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(
|
|
29278
|
+
/* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(2111);
|
|
29133
29279
|
/* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(5810);
|
|
29134
29280
|
/* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(9686);
|
|
29135
29281
|
|
|
@@ -29144,19 +29290,21 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
29144
29290
|
*/
|
|
29145
29291
|
class Visitor {
|
|
29146
29292
|
element;
|
|
29293
|
+
consume = false;
|
|
29294
|
+
consumeSafe = false;
|
|
29147
29295
|
constructor(options = {}) {
|
|
29148
29296
|
Object.assign(this, options);
|
|
29149
29297
|
}
|
|
29150
29298
|
copyMetaAndAttributes(from, to) {
|
|
29151
|
-
if (!from.isMetaEmpty
|
|
29152
|
-
|
|
29153
|
-
|
|
29154
|
-
to.meta = (
|
|
29299
|
+
if (!from.isMetaEmpty && !to.isMetaEmpty) {
|
|
29300
|
+
to.meta = to.meta.merge(from.meta);
|
|
29301
|
+
} else if (!from.isMetaEmpty) {
|
|
29302
|
+
to.meta = from.meta.cloneDeep();
|
|
29155
29303
|
}
|
|
29156
|
-
if (!from.isAttributesEmpty
|
|
29157
|
-
|
|
29158
|
-
|
|
29159
|
-
to.attributes = (0,
|
|
29304
|
+
if (!from.isAttributesEmpty && !to.isAttributesEmpty) {
|
|
29305
|
+
to.attributes = (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_0__["default"])(to.attributes, from.attributes);
|
|
29306
|
+
} else if (!from.isAttributesEmpty) {
|
|
29307
|
+
to.attributes = (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.cloneDeep)(from.attributes);
|
|
29160
29308
|
}
|
|
29161
29309
|
_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__["default"].transfer(from, to);
|
|
29162
29310
|
_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_3__["default"].transfer(from, to);
|
|
@@ -29278,15 +29426,18 @@ class FixedFieldsVisitor extends _SpecificationVisitor_mjs__WEBPACK_IMPORTED_MOD
|
|
|
29278
29426
|
const keyValue = (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_3__["default"])(key);
|
|
29279
29427
|
if ((0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_0__.isStringElement)(key) && fields.includes(keyValue) && !this.ignoredFields.includes(keyValue)) {
|
|
29280
29428
|
const fixedFieldElement = this.toRefractedElement([...specPath, 'fixedFields', keyValue], value);
|
|
29281
|
-
const newMemberElement = new _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__["default"]((0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.cloneDeep)(key), fixedFieldElement);
|
|
29429
|
+
const newMemberElement = new _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__["default"](this.consume ? key : (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.cloneDeep)(key), fixedFieldElement);
|
|
29282
29430
|
this.copyMetaAndAttributes(memberElement, newMemberElement);
|
|
29283
|
-
newMemberElement.classes.push('fixed-field');
|
|
29284
29431
|
this.element.content.push(newMemberElement);
|
|
29432
|
+
// consume: release processed generic subtree
|
|
29433
|
+
if (this.consume && this.consumeSafe && !memberElement.isFrozen) memberElement.value = undefined;
|
|
29285
29434
|
} else if (this.canSupportSpecificationExtensions && this.specificationExtensionPredicate(memberElement)) {
|
|
29286
29435
|
const extensionElement = this.toRefractedElement(['document', 'extension'], memberElement);
|
|
29287
29436
|
this.element.content.push(extensionElement);
|
|
29437
|
+
// consume: release processed generic subtree
|
|
29438
|
+
if (this.consume && this.consumeSafe && !memberElement.isFrozen) memberElement.value = undefined;
|
|
29288
29439
|
} else if (!this.ignoredFields.includes(keyValue)) {
|
|
29289
|
-
this.element.content.push((0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.cloneDeep)(memberElement));
|
|
29440
|
+
this.element.content.push(this.consume ? memberElement : (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.cloneDeep)(memberElement));
|
|
29290
29441
|
}
|
|
29291
29442
|
});
|
|
29292
29443
|
this.copyMetaAndAttributes(objectElement, this.element);
|
|
@@ -29468,12 +29619,14 @@ class PatternedFieldsVisitor extends _SpecificationVisitor_mjs__WEBPACK_IMPORTED
|
|
|
29468
29619
|
} else if (!this.ignoredFields.includes(keyValue) && this.fieldPatternPredicate(keyValue)) {
|
|
29469
29620
|
const specPath = this.specPath(value);
|
|
29470
29621
|
const patternedFieldElement = this.toRefractedElement(specPath, value);
|
|
29471
|
-
const newMemberElement = new _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__["default"]((0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.cloneDeep)(key), patternedFieldElement);
|
|
29622
|
+
const newMemberElement = new _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__["default"](this.consume ? key : (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.cloneDeep)(key), patternedFieldElement);
|
|
29472
29623
|
this.copyMetaAndAttributes(memberElement, newMemberElement);
|
|
29473
29624
|
newMemberElement.classes.push('patterned-field');
|
|
29474
29625
|
this.element.content.push(newMemberElement);
|
|
29626
|
+
// consume: release processed generic subtree
|
|
29627
|
+
if (this.consume && this.consumeSafe && !memberElement.isFrozen) memberElement.value = undefined;
|
|
29475
29628
|
} else if (!this.ignoredFields.includes(keyValue)) {
|
|
29476
|
-
this.element.content.push((0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.cloneDeep)(memberElement));
|
|
29629
|
+
this.element.content.push(this.consume ? memberElement : (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.cloneDeep)(memberElement));
|
|
29477
29630
|
}
|
|
29478
29631
|
});
|
|
29479
29632
|
this.copyMetaAndAttributes(objectElement, this.element);
|
|
@@ -30024,6 +30177,7 @@ class SwaggerVisitor extends _bases_mjs__WEBPACK_IMPORTED_MODULE_2__.BaseFixedFi
|
|
|
30024
30177
|
constructor(options) {
|
|
30025
30178
|
super(options);
|
|
30026
30179
|
this.element = new _elements_Swagger_mjs__WEBPACK_IMPORTED_MODULE_1__["default"]();
|
|
30180
|
+
this.consumeSafe = true;
|
|
30027
30181
|
this.specPath = (0,ramda__WEBPACK_IMPORTED_MODULE_0__["default"])(['document', 'objects', 'Swagger']);
|
|
30028
30182
|
this.canSupportSpecificationExtensions = true;
|
|
30029
30183
|
}
|
|
@@ -30528,6 +30682,7 @@ class PathItemVisitor extends _bases_mjs__WEBPACK_IMPORTED_MODULE_6__.BaseFixedF
|
|
|
30528
30682
|
constructor(options) {
|
|
30529
30683
|
super(options);
|
|
30530
30684
|
this.element = new _elements_PathItem_mjs__WEBPACK_IMPORTED_MODULE_4__["default"]();
|
|
30685
|
+
this.consumeSafe = true;
|
|
30531
30686
|
this.specPath = (0,ramda__WEBPACK_IMPORTED_MODULE_0__["default"])(['document', 'objects', 'PathItem']);
|
|
30532
30687
|
}
|
|
30533
30688
|
ObjectElement(path) {
|
|
@@ -30579,6 +30734,7 @@ class PathsVisitor extends _bases_mjs__WEBPACK_IMPORTED_MODULE_5__.BasePatterned
|
|
|
30579
30734
|
constructor(options) {
|
|
30580
30735
|
super(options);
|
|
30581
30736
|
this.element = new _elements_Paths_mjs__WEBPACK_IMPORTED_MODULE_3__["default"]();
|
|
30737
|
+
this.consumeSafe = true;
|
|
30582
30738
|
this.specPath = (0,ramda__WEBPACK_IMPORTED_MODULE_1__["default"])(['document', 'objects', 'PathItem']);
|
|
30583
30739
|
this.canSupportSpecificationExtensions = true;
|
|
30584
30740
|
this.fieldPatternPredicate = ramda__WEBPACK_IMPORTED_MODULE_0__["default"];
|
|
@@ -31317,8 +31473,9 @@ const parse = async source => {
|
|
|
31317
31473
|
if (source.trim().length === 0) {
|
|
31318
31474
|
return parseResult;
|
|
31319
31475
|
}
|
|
31320
|
-
|
|
31476
|
+
let pojo = JSON.parse(source);
|
|
31321
31477
|
const element = (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_0__.refract)(pojo);
|
|
31478
|
+
pojo = null; // allow GC to reclaim POJO
|
|
31322
31479
|
element.classes.push('result');
|
|
31323
31480
|
parseResult.push(element);
|
|
31324
31481
|
return parseResult;
|
|
@@ -33292,7 +33449,10 @@ const parse = async (source, options = {}) => {
|
|
|
33292
33449
|
result
|
|
33293
33450
|
} = parseResultElement;
|
|
33294
33451
|
if ((0,ramda_adjunct__WEBPACK_IMPORTED_MODULE_2__["default"])(result)) {
|
|
33295
|
-
const swaggerElement = (0,_speclynx_apidom_ns_openapi_2__WEBPACK_IMPORTED_MODULE_6__.refractSwagger)(result,
|
|
33452
|
+
const swaggerElement = (0,_speclynx_apidom_ns_openapi_2__WEBPACK_IMPORTED_MODULE_6__.refractSwagger)(result, {
|
|
33453
|
+
consume: true,
|
|
33454
|
+
...refractorOpts
|
|
33455
|
+
});
|
|
33296
33456
|
swaggerElement.classes.push('result');
|
|
33297
33457
|
parseResultElement.replaceResult(swaggerElement);
|
|
33298
33458
|
}
|