@speclynx/apidom-parser-adapter-asyncapi-json-2 2.13.1 → 3.0.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.
|
@@ -20092,7 +20092,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
20092
20092
|
* @public
|
|
20093
20093
|
*/
|
|
20094
20094
|
const emptyElement = element => {
|
|
20095
|
-
const meta = !element.isMetaEmpty ?
|
|
20095
|
+
const meta = !element.isMetaEmpty ? element.meta.cloneDeep() : undefined;
|
|
20096
20096
|
const attributes = !element.isAttributesEmpty ? (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.cloneDeep)(element.attributes) : undefined;
|
|
20097
20097
|
|
|
20098
20098
|
// @ts-ignore
|
|
@@ -20108,7 +20108,7 @@ const getMergeFunction = (keyElement, options) => {
|
|
|
20108
20108
|
};
|
|
20109
20109
|
const getMetaMergeFunction = options => {
|
|
20110
20110
|
if (typeof options.customMetaMerge !== 'function') {
|
|
20111
|
-
return targetMeta =>
|
|
20111
|
+
return targetMeta => targetMeta.cloneDeep();
|
|
20112
20112
|
}
|
|
20113
20113
|
return options.customMetaMerge;
|
|
20114
20114
|
};
|
|
@@ -20180,8 +20180,20 @@ const deepmerge = (targetElement, sourceElement, options) => {
|
|
|
20180
20180
|
const mergedElement = sourceIsArrayElement && typeof mergedOptions.arrayElementMerge === 'function' ? mergedOptions.arrayElementMerge(targetElement, sourceElement, mergedOptions) : mergedOptions.objectElementMerge(targetElement, sourceElement, mergedOptions);
|
|
20181
20181
|
|
|
20182
20182
|
// merging meta & attributes
|
|
20183
|
-
|
|
20184
|
-
|
|
20183
|
+
if (!targetElement.isMetaEmpty && !sourceElement.isMetaEmpty) {
|
|
20184
|
+
mergedElement.meta = getMetaMergeFunction(mergedOptions)(targetElement.meta, sourceElement.meta);
|
|
20185
|
+
} else if (!targetElement.isMetaEmpty) {
|
|
20186
|
+
mergedElement.meta = targetElement.meta.cloneDeep();
|
|
20187
|
+
} else if (!sourceElement.isMetaEmpty) {
|
|
20188
|
+
mergedElement.meta = sourceElement.meta.cloneDeep();
|
|
20189
|
+
}
|
|
20190
|
+
if (!targetElement.isAttributesEmpty && !sourceElement.isAttributesEmpty) {
|
|
20191
|
+
mergedElement.attributes = getAttributesMergeFunction(mergedOptions)(targetElement.attributes, sourceElement.attributes);
|
|
20192
|
+
} else if (!targetElement.isAttributesEmpty) {
|
|
20193
|
+
mergedElement.attributes = (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.cloneDeep)(targetElement.attributes);
|
|
20194
|
+
} else if (!sourceElement.isAttributesEmpty) {
|
|
20195
|
+
mergedElement.attributes = (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.cloneDeep)(sourceElement.attributes);
|
|
20196
|
+
}
|
|
20185
20197
|
return mergedElement;
|
|
20186
20198
|
};
|
|
20187
20199
|
deepmerge.all = (list, options) => {
|
|
@@ -20520,6 +20532,105 @@ class KeyValuePair {
|
|
|
20520
20532
|
|
|
20521
20533
|
/***/ },
|
|
20522
20534
|
|
|
20535
|
+
/***/ 51844
|
|
20536
|
+
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
20537
|
+
|
|
20538
|
+
"use strict";
|
|
20539
|
+
__webpack_require__.r(__webpack_exports__);
|
|
20540
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
20541
|
+
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
20542
|
+
/* harmony export */ });
|
|
20543
|
+
/* harmony import */ var ramda__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(8138);
|
|
20544
|
+
|
|
20545
|
+
/**
|
|
20546
|
+
* Lightweight meta container for Element metadata.
|
|
20547
|
+
*
|
|
20548
|
+
* Data is stored as own properties on the instance; methods live on the prototype.
|
|
20549
|
+
* `Object.keys()`, `Object.entries()`, etc. only see data properties.
|
|
20550
|
+
*
|
|
20551
|
+
* @public
|
|
20552
|
+
*/
|
|
20553
|
+
class Metadata {
|
|
20554
|
+
// Set via prototype assignment in registration.ts to avoid circular dependency
|
|
20555
|
+
|
|
20556
|
+
get(name) {
|
|
20557
|
+
return this[name];
|
|
20558
|
+
}
|
|
20559
|
+
set(name, value) {
|
|
20560
|
+
this[name] = value;
|
|
20561
|
+
}
|
|
20562
|
+
hasKey(name) {
|
|
20563
|
+
return Object.hasOwn(this, name);
|
|
20564
|
+
}
|
|
20565
|
+
keys() {
|
|
20566
|
+
return Object.keys(this);
|
|
20567
|
+
}
|
|
20568
|
+
remove(name) {
|
|
20569
|
+
delete this[name];
|
|
20570
|
+
}
|
|
20571
|
+
get isEmpty() {
|
|
20572
|
+
return Object.keys(this).length === 0;
|
|
20573
|
+
}
|
|
20574
|
+
get isFrozen() {
|
|
20575
|
+
return Object.isFrozen(this);
|
|
20576
|
+
}
|
|
20577
|
+
freeze() {
|
|
20578
|
+
for (const value of Object.values(this)) {
|
|
20579
|
+
if (value instanceof this.Element) {
|
|
20580
|
+
value.freeze();
|
|
20581
|
+
} else if (Array.isArray(value) || value !== null && typeof value === 'object') {
|
|
20582
|
+
Object.freeze(value);
|
|
20583
|
+
}
|
|
20584
|
+
}
|
|
20585
|
+
Object.freeze(this);
|
|
20586
|
+
}
|
|
20587
|
+
|
|
20588
|
+
/**
|
|
20589
|
+
* Creates a shallow clone. Same references, new container.
|
|
20590
|
+
*/
|
|
20591
|
+
cloneShallow() {
|
|
20592
|
+
const clone = new Metadata();
|
|
20593
|
+
Object.assign(clone, this);
|
|
20594
|
+
return clone;
|
|
20595
|
+
}
|
|
20596
|
+
|
|
20597
|
+
/**
|
|
20598
|
+
* Merges another Metadata into a new instance.
|
|
20599
|
+
* Arrays are concatenated, all other values are overwritten by source.
|
|
20600
|
+
*/
|
|
20601
|
+
merge(source) {
|
|
20602
|
+
const result = this.cloneShallow();
|
|
20603
|
+
for (const [key, value] of Object.entries(source)) {
|
|
20604
|
+
const existing = result.get(key);
|
|
20605
|
+
if (Array.isArray(existing) && Array.isArray(value)) {
|
|
20606
|
+
result.set(key, [...existing, ...value]);
|
|
20607
|
+
} else {
|
|
20608
|
+
result.set(key, value);
|
|
20609
|
+
}
|
|
20610
|
+
}
|
|
20611
|
+
return result;
|
|
20612
|
+
}
|
|
20613
|
+
|
|
20614
|
+
/**
|
|
20615
|
+
* Creates a deep clone. Elements are deep cloned,
|
|
20616
|
+
* all other values are deep cloned via ramda clone.
|
|
20617
|
+
*/
|
|
20618
|
+
cloneDeep() {
|
|
20619
|
+
const copy = new Metadata();
|
|
20620
|
+
for (const [key, value] of Object.entries(this)) {
|
|
20621
|
+
if (value instanceof this.Element) {
|
|
20622
|
+
copy.set(key, this.cloneDeepElement(value));
|
|
20623
|
+
} else {
|
|
20624
|
+
copy.set(key, (0,ramda__WEBPACK_IMPORTED_MODULE_0__["default"])(value));
|
|
20625
|
+
}
|
|
20626
|
+
}
|
|
20627
|
+
return copy;
|
|
20628
|
+
}
|
|
20629
|
+
}
|
|
20630
|
+
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Metadata);
|
|
20631
|
+
|
|
20632
|
+
/***/ },
|
|
20633
|
+
|
|
20523
20634
|
/***/ 55156
|
|
20524
20635
|
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
20525
20636
|
|
|
@@ -21166,7 +21277,7 @@ const cloneShallowElement = element => {
|
|
|
21166
21277
|
const copy = new Ctor();
|
|
21167
21278
|
copy.element = element.element;
|
|
21168
21279
|
if (!element.isMetaEmpty) {
|
|
21169
|
-
copy.meta =
|
|
21280
|
+
copy.meta = element.meta.cloneDeep();
|
|
21170
21281
|
}
|
|
21171
21282
|
if (!element.isAttributesEmpty) {
|
|
21172
21283
|
copy.attributes = cloneDeep(element.attributes);
|
|
@@ -21194,8 +21305,8 @@ const cloneShallowElement = element => {
|
|
|
21194
21305
|
|
|
21195
21306
|
/**
|
|
21196
21307
|
* Creates a shallow clone of an ApiDOM Element, KeyValuePair, or ObjectSlice.
|
|
21197
|
-
* The element itself is cloned, but content references are shared
|
|
21198
|
-
*
|
|
21308
|
+
* The element itself is cloned, but content references are shared.
|
|
21309
|
+
* Meta and attributes are deep cloned to preserve semantic information.
|
|
21199
21310
|
* @public
|
|
21200
21311
|
*/
|
|
21201
21312
|
const cloneShallow = value => {
|
|
@@ -22270,7 +22381,7 @@ class CollectionElement extends _Element_mjs__WEBPACK_IMPORTED_MODULE_0__["defau
|
|
|
22270
22381
|
* Search the tree recursively and find the element with the matching ID.
|
|
22271
22382
|
*/
|
|
22272
22383
|
getById(id) {
|
|
22273
|
-
return this.find(item => item.id
|
|
22384
|
+
return this.find(item => item.id === id).first;
|
|
22274
22385
|
}
|
|
22275
22386
|
|
|
22276
22387
|
/**
|
|
@@ -22300,18 +22411,24 @@ class CollectionElement extends _Element_mjs__WEBPACK_IMPORTED_MODULE_0__["defau
|
|
|
22300
22411
|
"use strict";
|
|
22301
22412
|
__webpack_require__.r(__webpack_exports__);
|
|
22302
22413
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
22414
|
+
/* harmony export */ Metadata: () => (/* reexport safe */ _Metadata_mjs__WEBPACK_IMPORTED_MODULE_1__["default"]),
|
|
22303
22415
|
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
22304
22416
|
/* harmony export */ });
|
|
22305
22417
|
/* harmony import */ var ramda__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(53654);
|
|
22306
|
-
/* harmony import */ var
|
|
22307
|
-
/* harmony import */ var
|
|
22418
|
+
/* harmony import */ var _Metadata_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(51844);
|
|
22419
|
+
/* harmony import */ var _KeyValuePair_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(36663);
|
|
22420
|
+
/* harmony import */ var _ObjectSlice_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(38504);
|
|
22421
|
+
|
|
22308
22422
|
|
|
22309
22423
|
|
|
22424
|
+
// shared singleton for frozen elements with no meta — avoids allocation on every access
|
|
22425
|
+
const FROZEN_EMPTY_METADATA = Object.freeze(new _Metadata_mjs__WEBPACK_IMPORTED_MODULE_1__["default"]());
|
|
22310
22426
|
|
|
22311
22427
|
/**
|
|
22312
22428
|
* Valid content types for an Element.
|
|
22313
22429
|
* @public
|
|
22314
22430
|
*/
|
|
22431
|
+
|
|
22315
22432
|
/**
|
|
22316
22433
|
* Base Element class that all ApiDOM elements extend.
|
|
22317
22434
|
*
|
|
@@ -22409,7 +22526,7 @@ class Element {
|
|
|
22409
22526
|
_attributes;
|
|
22410
22527
|
|
|
22411
22528
|
// ============================================================
|
|
22412
|
-
// Prototype-assigned properties (set in
|
|
22529
|
+
// Prototype-assigned properties (set in registration.ts)
|
|
22413
22530
|
// Using 'declare' allows TypeScript to know about these
|
|
22414
22531
|
// without generating runtime code.
|
|
22415
22532
|
// ============================================================
|
|
@@ -22470,13 +22587,13 @@ class Element {
|
|
|
22470
22587
|
}
|
|
22471
22588
|
|
|
22472
22589
|
// KeyValuePair
|
|
22473
|
-
if (value instanceof
|
|
22590
|
+
if (value instanceof _KeyValuePair_mjs__WEBPACK_IMPORTED_MODULE_2__["default"]) {
|
|
22474
22591
|
this._content = value;
|
|
22475
22592
|
return;
|
|
22476
22593
|
}
|
|
22477
22594
|
|
|
22478
22595
|
// ObjectSlice - extract elements array
|
|
22479
|
-
if (value instanceof
|
|
22596
|
+
if (value instanceof _ObjectSlice_mjs__WEBPACK_IMPORTED_MODULE_3__["default"]) {
|
|
22480
22597
|
this._content = value.elements;
|
|
22481
22598
|
return;
|
|
22482
22599
|
}
|
|
@@ -22497,24 +22614,22 @@ class Element {
|
|
|
22497
22614
|
|
|
22498
22615
|
/**
|
|
22499
22616
|
* Metadata about this element (id, classes, title, description, links).
|
|
22500
|
-
* Lazily creates
|
|
22617
|
+
* Lazily creates a Metadata instance if not set.
|
|
22501
22618
|
*/
|
|
22502
22619
|
get meta() {
|
|
22503
22620
|
if (!this._meta) {
|
|
22504
|
-
if (this.isFrozen)
|
|
22505
|
-
|
|
22506
|
-
meta.freeze();
|
|
22507
|
-
return meta;
|
|
22508
|
-
}
|
|
22509
|
-
this._meta = new this.ObjectElement();
|
|
22621
|
+
if (this.isFrozen) return FROZEN_EMPTY_METADATA;
|
|
22622
|
+
this._meta = new _Metadata_mjs__WEBPACK_IMPORTED_MODULE_1__["default"]();
|
|
22510
22623
|
}
|
|
22511
22624
|
return this._meta;
|
|
22512
22625
|
}
|
|
22513
22626
|
set meta(value) {
|
|
22514
|
-
if (value instanceof
|
|
22627
|
+
if (value instanceof _Metadata_mjs__WEBPACK_IMPORTED_MODULE_1__["default"]) {
|
|
22515
22628
|
this._meta = value;
|
|
22516
|
-
} else {
|
|
22517
|
-
|
|
22629
|
+
} else if (value && typeof value === 'object') {
|
|
22630
|
+
const meta = new _Metadata_mjs__WEBPACK_IMPORTED_MODULE_1__["default"]();
|
|
22631
|
+
Object.assign(meta, value);
|
|
22632
|
+
this._meta = meta;
|
|
22518
22633
|
}
|
|
22519
22634
|
}
|
|
22520
22635
|
|
|
@@ -22547,10 +22662,8 @@ class Element {
|
|
|
22547
22662
|
|
|
22548
22663
|
/** Unique identifier for this element. */
|
|
22549
22664
|
get id() {
|
|
22550
|
-
if (this.isFrozen) {
|
|
22551
|
-
return this.getMetaProperty('id', '');
|
|
22552
|
-
}
|
|
22553
22665
|
if (!this.hasMetaProperty('id')) {
|
|
22666
|
+
if (this.isFrozen) return '';
|
|
22554
22667
|
this.setMetaProperty('id', '');
|
|
22555
22668
|
}
|
|
22556
22669
|
return this.meta.get('id');
|
|
@@ -22561,10 +22674,8 @@ class Element {
|
|
|
22561
22674
|
|
|
22562
22675
|
/** CSS-like class names. */
|
|
22563
22676
|
get classes() {
|
|
22564
|
-
if (this.isFrozen) {
|
|
22565
|
-
return this.getMetaProperty('classes', []);
|
|
22566
|
-
}
|
|
22567
22677
|
if (!this.hasMetaProperty('classes')) {
|
|
22678
|
+
if (this.isFrozen) return [];
|
|
22568
22679
|
this.setMetaProperty('classes', []);
|
|
22569
22680
|
}
|
|
22570
22681
|
return this.meta.get('classes');
|
|
@@ -22575,11 +22686,13 @@ class Element {
|
|
|
22575
22686
|
|
|
22576
22687
|
/** Hyperlinks associated with this element. */
|
|
22577
22688
|
get links() {
|
|
22578
|
-
if (this.isFrozen) {
|
|
22579
|
-
return this.getMetaProperty('links', []);
|
|
22580
|
-
}
|
|
22581
22689
|
if (!this.hasMetaProperty('links')) {
|
|
22582
|
-
this.
|
|
22690
|
+
if (this.isFrozen) {
|
|
22691
|
+
const empty = new this.ArrayElement();
|
|
22692
|
+
empty.freeze();
|
|
22693
|
+
return empty;
|
|
22694
|
+
}
|
|
22695
|
+
this.setMetaProperty('links', new this.ArrayElement());
|
|
22583
22696
|
}
|
|
22584
22697
|
return this.meta.get('links');
|
|
22585
22698
|
}
|
|
@@ -22599,7 +22712,7 @@ class Element {
|
|
|
22599
22712
|
if (Array.isArray(content)) {
|
|
22600
22713
|
return content;
|
|
22601
22714
|
}
|
|
22602
|
-
if (content instanceof
|
|
22715
|
+
if (content instanceof _KeyValuePair_mjs__WEBPACK_IMPORTED_MODULE_2__["default"]) {
|
|
22603
22716
|
const children = [];
|
|
22604
22717
|
if (content.key) children.push(content.key);
|
|
22605
22718
|
if (content.value) children.push(content.value);
|
|
@@ -22629,7 +22742,6 @@ class Element {
|
|
|
22629
22742
|
|
|
22630
22743
|
// Freeze meta and attributes
|
|
22631
22744
|
if (this._meta) {
|
|
22632
|
-
this._meta.parent = this;
|
|
22633
22745
|
this._meta.freeze();
|
|
22634
22746
|
}
|
|
22635
22747
|
if (this._attributes) {
|
|
@@ -22664,7 +22776,7 @@ class Element {
|
|
|
22664
22776
|
if (_content instanceof Element) {
|
|
22665
22777
|
return _content.toValue();
|
|
22666
22778
|
}
|
|
22667
|
-
if (_content instanceof
|
|
22779
|
+
if (_content instanceof _KeyValuePair_mjs__WEBPACK_IMPORTED_MODULE_2__["default"]) {
|
|
22668
22780
|
return _content.toValue();
|
|
22669
22781
|
}
|
|
22670
22782
|
if (Array.isArray(_content)) {
|
|
@@ -22720,7 +22832,7 @@ class Element {
|
|
|
22720
22832
|
* @throws Error if this element has no ID
|
|
22721
22833
|
*/
|
|
22722
22834
|
toRef(path) {
|
|
22723
|
-
const idValue = this.id
|
|
22835
|
+
const idValue = this.id;
|
|
22724
22836
|
if (idValue === '') {
|
|
22725
22837
|
throw new Error('Cannot create reference to an element without an ID');
|
|
22726
22838
|
}
|
|
@@ -22732,26 +22844,16 @@ class Element {
|
|
|
22732
22844
|
}
|
|
22733
22845
|
|
|
22734
22846
|
/**
|
|
22735
|
-
* Gets a meta property.
|
|
22847
|
+
* Gets a meta property value.
|
|
22736
22848
|
*
|
|
22737
22849
|
* When the property doesn't exist:
|
|
22738
|
-
* - With defaultValue: returns
|
|
22850
|
+
* - With defaultValue: returns the provided default value
|
|
22739
22851
|
* - Without defaultValue: returns undefined
|
|
22740
|
-
*
|
|
22741
|
-
* Note: Each call with a default creates a new instance. Use setMetaProperty
|
|
22742
|
-
* first if you need reference equality across multiple accesses.
|
|
22743
22852
|
*/
|
|
22744
22853
|
|
|
22745
22854
|
getMetaProperty(name, defaultValue) {
|
|
22746
22855
|
if (!this.hasMetaProperty(name)) {
|
|
22747
|
-
|
|
22748
|
-
return undefined;
|
|
22749
|
-
}
|
|
22750
|
-
const element = this.refract(defaultValue);
|
|
22751
|
-
if (element && this.isFrozen) {
|
|
22752
|
-
element.freeze();
|
|
22753
|
-
}
|
|
22754
|
-
return element;
|
|
22856
|
+
return defaultValue;
|
|
22755
22857
|
}
|
|
22756
22858
|
return this.meta.get(name);
|
|
22757
22859
|
}
|
|
@@ -22764,20 +22866,17 @@ class Element {
|
|
|
22764
22866
|
}
|
|
22765
22867
|
|
|
22766
22868
|
/**
|
|
22767
|
-
*
|
|
22869
|
+
* Checks whether a meta property exists.
|
|
22768
22870
|
*/
|
|
22769
22871
|
hasMetaProperty(name) {
|
|
22770
|
-
|
|
22771
|
-
return this.meta.hasKey(name);
|
|
22772
|
-
}
|
|
22773
|
-
return false;
|
|
22872
|
+
return this._meta !== undefined && this._meta.hasKey(name);
|
|
22774
22873
|
}
|
|
22775
22874
|
|
|
22776
22875
|
/**
|
|
22777
22876
|
* Checks if meta is empty.
|
|
22778
22877
|
*/
|
|
22779
22878
|
get isMetaEmpty() {
|
|
22780
|
-
return this._meta === undefined || this.
|
|
22879
|
+
return this._meta === undefined || this._meta.isEmpty;
|
|
22781
22880
|
}
|
|
22782
22881
|
|
|
22783
22882
|
/**
|
|
@@ -22803,7 +22902,7 @@ class Element {
|
|
|
22803
22902
|
}
|
|
22804
22903
|
|
|
22805
22904
|
/**
|
|
22806
|
-
*
|
|
22905
|
+
* Checks whether an attributes property exists.
|
|
22807
22906
|
*/
|
|
22808
22907
|
hasAttributesProperty(name) {
|
|
22809
22908
|
if (!this.isAttributesEmpty) {
|
|
@@ -22822,6 +22921,7 @@ class Element {
|
|
|
22822
22921
|
|
|
22823
22922
|
// Re-export types for convenience
|
|
22824
22923
|
|
|
22924
|
+
|
|
22825
22925
|
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Element);
|
|
22826
22926
|
|
|
22827
22927
|
/***/ },
|
|
@@ -23260,6 +23360,10 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
23260
23360
|
/* harmony import */ var _elements_Style_mjs__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(49686);
|
|
23261
23361
|
/* harmony import */ var _ObjectSlice_mjs__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(38504);
|
|
23262
23362
|
/* harmony import */ var _KeyValuePair_mjs__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(36663);
|
|
23363
|
+
/* harmony import */ var _Metadata_mjs__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(51844);
|
|
23364
|
+
/* harmony import */ var _clone_index_mjs__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(12111);
|
|
23365
|
+
|
|
23366
|
+
|
|
23263
23367
|
|
|
23264
23368
|
|
|
23265
23369
|
|
|
@@ -23319,14 +23423,16 @@ function refract(value) {
|
|
|
23319
23423
|
}
|
|
23320
23424
|
|
|
23321
23425
|
// Set up prototype assignments for circular dependency resolution.
|
|
23322
|
-
// These allow Element instances to
|
|
23323
|
-
//
|
|
23426
|
+
// These allow Element and Metadata instances to reference classes they can't import
|
|
23427
|
+
// directly (which would cause circular imports).
|
|
23324
23428
|
// Using 'declare' in the class definitions enables type-safe access to these properties.
|
|
23325
23429
|
_primitives_Element_mjs__WEBPACK_IMPORTED_MODULE_0__["default"].prototype.ObjectElement = _primitives_ObjectElement_mjs__WEBPACK_IMPORTED_MODULE_8__["default"];
|
|
23326
23430
|
_primitives_Element_mjs__WEBPACK_IMPORTED_MODULE_0__["default"].prototype.ArrayElement = _primitives_ArrayElement_mjs__WEBPACK_IMPORTED_MODULE_6__["default"];
|
|
23327
23431
|
_primitives_Element_mjs__WEBPACK_IMPORTED_MODULE_0__["default"].prototype.RefElement = _elements_RefElement_mjs__WEBPACK_IMPORTED_MODULE_10__["default"];
|
|
23328
23432
|
_primitives_Element_mjs__WEBPACK_IMPORTED_MODULE_0__["default"].prototype.MemberElement = _primitives_MemberElement_mjs__WEBPACK_IMPORTED_MODULE_7__["default"];
|
|
23329
23433
|
_primitives_Element_mjs__WEBPACK_IMPORTED_MODULE_0__["default"].prototype.refract = refract;
|
|
23434
|
+
_Metadata_mjs__WEBPACK_IMPORTED_MODULE_18__["default"].prototype.Element = _primitives_Element_mjs__WEBPACK_IMPORTED_MODULE_0__["default"];
|
|
23435
|
+
_Metadata_mjs__WEBPACK_IMPORTED_MODULE_18__["default"].prototype.cloneDeepElement = element => (0,_clone_index_mjs__WEBPACK_IMPORTED_MODULE_19__.cloneDeep)(element);
|
|
23330
23436
|
|
|
23331
23437
|
/**
|
|
23332
23438
|
* Contains all of the element classes, and related structures and methods
|
|
@@ -23391,7 +23497,13 @@ class JSONSerialiser {
|
|
|
23391
23497
|
element: element.element
|
|
23392
23498
|
};
|
|
23393
23499
|
if (!element.isMetaEmpty) {
|
|
23394
|
-
|
|
23500
|
+
const serialisedMeta = this.serialiseMeta(element);
|
|
23501
|
+
if (serialisedMeta) {
|
|
23502
|
+
payload.meta = serialisedMeta.meta;
|
|
23503
|
+
if (serialisedMeta.rawKeys.length > 0) {
|
|
23504
|
+
payload.__meta_raw__ = serialisedMeta.rawKeys;
|
|
23505
|
+
}
|
|
23506
|
+
}
|
|
23395
23507
|
}
|
|
23396
23508
|
if (!element.isAttributesEmpty) {
|
|
23397
23509
|
payload.attributes = this.serialiseObject(element.attributes);
|
|
@@ -23438,7 +23550,7 @@ class JSONSerialiser {
|
|
|
23438
23550
|
element.element = value.element;
|
|
23439
23551
|
}
|
|
23440
23552
|
|
|
23441
|
-
// Extract
|
|
23553
|
+
// Extract special meta keys without mutating input, filter remaining meta
|
|
23442
23554
|
let mappingsDoc;
|
|
23443
23555
|
let stylesDoc;
|
|
23444
23556
|
let metaToDeserialize = value.meta;
|
|
@@ -23452,8 +23564,15 @@ class JSONSerialiser {
|
|
|
23452
23564
|
stylesDoc = __styles__;
|
|
23453
23565
|
metaToDeserialize = Object.keys(rest).length > 0 ? rest : undefined;
|
|
23454
23566
|
}
|
|
23567
|
+
|
|
23568
|
+
// determine which meta keys were raw primitives before serialization
|
|
23569
|
+
const rawKeys = value.__meta_raw__ ? new Set(value.__meta_raw__) : undefined;
|
|
23455
23570
|
if (metaToDeserialize) {
|
|
23456
|
-
|
|
23571
|
+
for (const [key, doc] of Object.entries(metaToDeserialize)) {
|
|
23572
|
+
const deserialized = this.deserialise(doc);
|
|
23573
|
+
// unwrap keys that were raw primitives before serialization
|
|
23574
|
+
element.setMetaProperty(key, rawKeys?.has(key) ? deserialized.toValue() : deserialized);
|
|
23575
|
+
}
|
|
23457
23576
|
}
|
|
23458
23577
|
|
|
23459
23578
|
// Restore source position from __mappings__
|
|
@@ -23516,6 +23635,27 @@ class JSONSerialiser {
|
|
|
23516
23635
|
}
|
|
23517
23636
|
return content;
|
|
23518
23637
|
}
|
|
23638
|
+
serialiseMeta(element) {
|
|
23639
|
+
const meta = {};
|
|
23640
|
+
const rawKeys = [];
|
|
23641
|
+
let hasEntries = false;
|
|
23642
|
+
for (const [key, value] of Object.entries(element.meta)) {
|
|
23643
|
+
if (value instanceof this.namespace.elements.Element) {
|
|
23644
|
+
meta[key] = this.serialise(value);
|
|
23645
|
+
hasEntries = true;
|
|
23646
|
+
} else if (value !== undefined) {
|
|
23647
|
+
// refract primitives to maintain JSON Refract spec compatibility
|
|
23648
|
+
const refracted = element.refract(value);
|
|
23649
|
+
meta[key] = this.serialise(refracted);
|
|
23650
|
+
rawKeys.push(key);
|
|
23651
|
+
hasEntries = true;
|
|
23652
|
+
}
|
|
23653
|
+
}
|
|
23654
|
+
return hasEntries ? {
|
|
23655
|
+
meta,
|
|
23656
|
+
rawKeys
|
|
23657
|
+
} : undefined;
|
|
23658
|
+
}
|
|
23519
23659
|
serialiseObject(obj) {
|
|
23520
23660
|
const result = {};
|
|
23521
23661
|
obj.forEach((value, key) => {
|
|
@@ -29669,7 +29809,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
29669
29809
|
const refract = (value, {
|
|
29670
29810
|
element = 'asyncApi2',
|
|
29671
29811
|
plugins = [],
|
|
29672
|
-
specificationObj = _specification_mjs__WEBPACK_IMPORTED_MODULE_5__["default"]
|
|
29812
|
+
specificationObj = _specification_mjs__WEBPACK_IMPORTED_MODULE_5__["default"],
|
|
29813
|
+
consume = false
|
|
29673
29814
|
} = {}) => {
|
|
29674
29815
|
const genericElement = (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_0__.refract)(value);
|
|
29675
29816
|
const resolvedSpec = (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_2__.resolveSpecification)(specificationObj);
|
|
@@ -29686,7 +29827,8 @@ const refract = (value, {
|
|
|
29686
29827
|
*/
|
|
29687
29828
|
const RootVisitorClass = (0,ramda__WEBPACK_IMPORTED_MODULE_4__["default"])(specPath, resolvedSpec);
|
|
29688
29829
|
const rootVisitor = new RootVisitorClass({
|
|
29689
|
-
specObj: resolvedSpec
|
|
29830
|
+
specObj: resolvedSpec,
|
|
29831
|
+
consume
|
|
29690
29832
|
});
|
|
29691
29833
|
(0,_speclynx_apidom_traverse__WEBPACK_IMPORTED_MODULE_3__.traverse)(genericElement, rootVisitor);
|
|
29692
29834
|
|
|
@@ -32500,7 +32642,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
32500
32642
|
*/
|
|
32501
32643
|
class FallbackVisitor extends _Visitor_mjs__WEBPACK_IMPORTED_MODULE_1__["default"] {
|
|
32502
32644
|
enter(path) {
|
|
32503
|
-
this.element = (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_0__.cloneDeep)(path.node);
|
|
32645
|
+
this.element = this.consume ? path.node : (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_0__.cloneDeep)(path.node);
|
|
32504
32646
|
path.stop();
|
|
32505
32647
|
}
|
|
32506
32648
|
}
|
|
@@ -32567,7 +32709,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
32567
32709
|
*/
|
|
32568
32710
|
class SpecificationVisitor extends _Visitor_mjs__WEBPACK_IMPORTED_MODULE_6__["default"] {
|
|
32569
32711
|
specObj;
|
|
32570
|
-
passingOptionsNames = ['specObj'];
|
|
32712
|
+
passingOptionsNames = ['specObj', 'consume'];
|
|
32571
32713
|
constructor({
|
|
32572
32714
|
specObj,
|
|
32573
32715
|
...rest
|
|
@@ -32613,7 +32755,7 @@ class SpecificationVisitor extends _Visitor_mjs__WEBPACK_IMPORTED_MODULE_6__["de
|
|
|
32613
32755
|
*/
|
|
32614
32756
|
const visitor = this.retrieveVisitorInstance(specPath, options);
|
|
32615
32757
|
if (visitor instanceof _FallbackVisitor_mjs__WEBPACK_IMPORTED_MODULE_7__["default"] && visitor?.constructor === _FallbackVisitor_mjs__WEBPACK_IMPORTED_MODULE_7__["default"]) {
|
|
32616
|
-
return (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_4__.cloneDeep)(element);
|
|
32758
|
+
return this.consume ? element : (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_4__.cloneDeep)(element);
|
|
32617
32759
|
}
|
|
32618
32760
|
(0,_speclynx_apidom_traverse__WEBPACK_IMPORTED_MODULE_5__.traverse)(element, visitor);
|
|
32619
32761
|
return visitor.element;
|
|
@@ -32632,7 +32774,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
32632
32774
|
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
32633
32775
|
/* harmony export */ });
|
|
32634
32776
|
/* harmony import */ var _speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(28400);
|
|
32635
|
-
/* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(
|
|
32777
|
+
/* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(12111);
|
|
32636
32778
|
/* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(25810);
|
|
32637
32779
|
/* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(49686);
|
|
32638
32780
|
|
|
@@ -32647,19 +32789,21 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
32647
32789
|
*/
|
|
32648
32790
|
class Visitor {
|
|
32649
32791
|
element;
|
|
32792
|
+
consume = false;
|
|
32793
|
+
consumeSafe = false;
|
|
32650
32794
|
constructor(options) {
|
|
32651
32795
|
Object.assign(this, options);
|
|
32652
32796
|
}
|
|
32653
32797
|
copyMetaAndAttributes(from, to) {
|
|
32654
|
-
if (!from.isMetaEmpty
|
|
32655
|
-
|
|
32656
|
-
|
|
32657
|
-
to.meta = (
|
|
32798
|
+
if (!from.isMetaEmpty && !to.isMetaEmpty) {
|
|
32799
|
+
to.meta = to.meta.merge(from.meta);
|
|
32800
|
+
} else if (!from.isMetaEmpty) {
|
|
32801
|
+
to.meta = from.meta.cloneDeep();
|
|
32658
32802
|
}
|
|
32659
|
-
if (!from.isAttributesEmpty
|
|
32660
|
-
|
|
32661
|
-
|
|
32662
|
-
to.attributes = (0,
|
|
32803
|
+
if (!from.isAttributesEmpty && !to.isAttributesEmpty) {
|
|
32804
|
+
to.attributes = (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_0__["default"])(to.attributes, from.attributes);
|
|
32805
|
+
} else if (!from.isAttributesEmpty) {
|
|
32806
|
+
to.attributes = (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.cloneDeep)(from.attributes);
|
|
32663
32807
|
}
|
|
32664
32808
|
_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__["default"].transfer(from, to);
|
|
32665
32809
|
_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_3__["default"].transfer(from, to);
|
|
@@ -36223,6 +36367,7 @@ class AsyncApi2Visitor extends _bases_mjs__WEBPACK_IMPORTED_MODULE_2__.BaseFixed
|
|
|
36223
36367
|
constructor(options) {
|
|
36224
36368
|
super(options);
|
|
36225
36369
|
this.element = new _elements_AsyncApi2_mjs__WEBPACK_IMPORTED_MODULE_1__["default"]();
|
|
36370
|
+
this.consumeSafe = true;
|
|
36226
36371
|
this.specPath = (0,ramda__WEBPACK_IMPORTED_MODULE_0__["default"])(['document', 'objects', 'AsyncApi']);
|
|
36227
36372
|
this.canSupportSpecificationExtensions = true;
|
|
36228
36373
|
}
|
|
@@ -38429,15 +38574,18 @@ class FixedFieldsVisitor extends _SpecificationVisitor_mjs__WEBPACK_IMPORTED_MOD
|
|
|
38429
38574
|
const keyValue = (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_3__["default"])(key);
|
|
38430
38575
|
if ((0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_0__.isStringElement)(key) && fields.includes(keyValue) && !this.ignoredFields.includes(keyValue)) {
|
|
38431
38576
|
const fixedFieldElement = this.toRefractedElement([...specPath, 'fixedFields', keyValue], value);
|
|
38432
|
-
const newMemberElement = new _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__["default"]((0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.cloneDeep)(key), fixedFieldElement);
|
|
38433
|
-
newMemberElement.classes.push('fixed-field');
|
|
38577
|
+
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);
|
|
38434
38578
|
this.copyMetaAndAttributes(memberElement, newMemberElement);
|
|
38435
38579
|
this.element.content.push(newMemberElement);
|
|
38580
|
+
// consume: release processed generic subtree
|
|
38581
|
+
if (this.consume && this.consumeSafe && !memberElement.isFrozen) memberElement.value = undefined;
|
|
38436
38582
|
} else if (this.canSupportSpecificationExtensions && this.specificationExtensionPredicate(memberElement)) {
|
|
38437
38583
|
const extensionElement = this.toRefractedElement(['document', 'extension'], memberElement);
|
|
38438
38584
|
this.element.content.push(extensionElement);
|
|
38585
|
+
// consume: release processed generic subtree
|
|
38586
|
+
if (this.consume && this.consumeSafe && !memberElement.isFrozen) memberElement.value = undefined;
|
|
38439
38587
|
} else if (!this.ignoredFields.includes(keyValue)) {
|
|
38440
|
-
this.element.content.push((0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.cloneDeep)(memberElement));
|
|
38588
|
+
this.element.content.push(this.consume ? memberElement : (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.cloneDeep)(memberElement));
|
|
38441
38589
|
}
|
|
38442
38590
|
});
|
|
38443
38591
|
this.copyMetaAndAttributes(objectElement, this.element);
|
|
@@ -38541,12 +38689,14 @@ class PatternedFieldsVisitor extends _SpecificationVisitor_mjs__WEBPACK_IMPORTED
|
|
|
38541
38689
|
} else if (!this.ignoredFields.includes(keyValue) && this.fieldPatternPredicate(keyValue)) {
|
|
38542
38690
|
const specPath = this.specPath(value);
|
|
38543
38691
|
const patternedFieldElement = this.toRefractedElement(specPath, value);
|
|
38544
|
-
const newMemberElement = new _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__["default"]((0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.cloneDeep)(key), patternedFieldElement);
|
|
38692
|
+
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);
|
|
38545
38693
|
this.copyMetaAndAttributes(memberElement, newMemberElement);
|
|
38546
38694
|
newMemberElement.classes.push('patterned-field');
|
|
38547
38695
|
this.element.content.push(newMemberElement);
|
|
38696
|
+
// consume: release processed generic subtree
|
|
38697
|
+
if (this.consume && this.consumeSafe && !memberElement.isFrozen) memberElement.value = undefined;
|
|
38548
38698
|
} else if (!this.ignoredFields.includes(keyValue)) {
|
|
38549
|
-
this.element.content.push((0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.cloneDeep)(memberElement));
|
|
38699
|
+
this.element.content.push(this.consume ? memberElement : (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.cloneDeep)(memberElement));
|
|
38550
38700
|
}
|
|
38551
38701
|
});
|
|
38552
38702
|
this.copyMetaAndAttributes(objectElement, this.element);
|
|
@@ -39383,7 +39533,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
39383
39533
|
*/
|
|
39384
39534
|
class FallbackVisitor extends _Visitor_mjs__WEBPACK_IMPORTED_MODULE_1__["default"] {
|
|
39385
39535
|
enter(path) {
|
|
39386
|
-
this.element = (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_0__.cloneDeep)(path.node);
|
|
39536
|
+
this.element = this.consume ? path.node : (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_0__.cloneDeep)(path.node);
|
|
39387
39537
|
path.stop();
|
|
39388
39538
|
}
|
|
39389
39539
|
}
|
|
@@ -39423,7 +39573,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
39423
39573
|
*/
|
|
39424
39574
|
class SpecificationVisitor extends _Visitor_mjs__WEBPACK_IMPORTED_MODULE_6__["default"] {
|
|
39425
39575
|
specObj;
|
|
39426
|
-
passingOptionsNames = ['specObj', 'parent'];
|
|
39576
|
+
passingOptionsNames = ['specObj', 'parent', 'consume'];
|
|
39427
39577
|
constructor({
|
|
39428
39578
|
specObj,
|
|
39429
39579
|
...rest
|
|
@@ -39469,7 +39619,7 @@ class SpecificationVisitor extends _Visitor_mjs__WEBPACK_IMPORTED_MODULE_6__["de
|
|
|
39469
39619
|
*/
|
|
39470
39620
|
const visitor = this.retrieveVisitorInstance(specPath, options);
|
|
39471
39621
|
if (visitor instanceof _FallbackVisitor_mjs__WEBPACK_IMPORTED_MODULE_7__["default"] && visitor?.constructor === _FallbackVisitor_mjs__WEBPACK_IMPORTED_MODULE_7__["default"]) {
|
|
39472
|
-
return (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_4__.cloneDeep)(element);
|
|
39622
|
+
return this.consume ? element : (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_4__.cloneDeep)(element);
|
|
39473
39623
|
}
|
|
39474
39624
|
(0,_speclynx_apidom_traverse__WEBPACK_IMPORTED_MODULE_5__.traverse)(element, visitor, options);
|
|
39475
39625
|
return visitor.element;
|
|
@@ -39488,7 +39638,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
39488
39638
|
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
39489
39639
|
/* harmony export */ });
|
|
39490
39640
|
/* harmony import */ var _speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(28400);
|
|
39491
|
-
/* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(
|
|
39641
|
+
/* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(12111);
|
|
39492
39642
|
/* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(25810);
|
|
39493
39643
|
/* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(49686);
|
|
39494
39644
|
|
|
@@ -39503,19 +39653,21 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
39503
39653
|
*/
|
|
39504
39654
|
class Visitor {
|
|
39505
39655
|
element;
|
|
39656
|
+
consume = false;
|
|
39657
|
+
consumeSafe = false;
|
|
39506
39658
|
constructor(options) {
|
|
39507
39659
|
Object.assign(this, options);
|
|
39508
39660
|
}
|
|
39509
39661
|
copyMetaAndAttributes(from, to) {
|
|
39510
|
-
if (!from.isMetaEmpty
|
|
39511
|
-
|
|
39512
|
-
|
|
39513
|
-
to.meta = (
|
|
39662
|
+
if (!from.isMetaEmpty && !to.isMetaEmpty) {
|
|
39663
|
+
to.meta = to.meta.merge(from.meta);
|
|
39664
|
+
} else if (!from.isMetaEmpty) {
|
|
39665
|
+
to.meta = from.meta.cloneDeep();
|
|
39514
39666
|
}
|
|
39515
|
-
if (!from.isAttributesEmpty
|
|
39516
|
-
|
|
39517
|
-
|
|
39518
|
-
to.attributes = (0,
|
|
39667
|
+
if (!from.isAttributesEmpty && !to.isAttributesEmpty) {
|
|
39668
|
+
to.attributes = (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_0__["default"])(to.attributes, from.attributes);
|
|
39669
|
+
} else if (!from.isAttributesEmpty) {
|
|
39670
|
+
to.attributes = (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.cloneDeep)(from.attributes);
|
|
39519
39671
|
}
|
|
39520
39672
|
_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__["default"].transfer(from, to);
|
|
39521
39673
|
_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_3__["default"].transfer(from, to);
|
|
@@ -39625,12 +39777,13 @@ class FixedFieldsVisitor extends _SpecificationVisitor_mjs__WEBPACK_IMPORTED_MOD
|
|
|
39625
39777
|
const keyValue = (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_3__["default"])(key);
|
|
39626
39778
|
if ((0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_0__.isStringElement)(key) && fields.includes(keyValue) && !this.ignoredFields.includes(keyValue)) {
|
|
39627
39779
|
const fixedFieldElement = this.toRefractedElement([...specPath, 'fixedFields', keyValue], value);
|
|
39628
|
-
const newMemberElement = new _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__["default"]((0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.cloneDeep)(key), fixedFieldElement);
|
|
39780
|
+
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);
|
|
39629
39781
|
this.copyMetaAndAttributes(memberElement, newMemberElement);
|
|
39630
|
-
newMemberElement.classes.push('fixed-field');
|
|
39631
39782
|
this.element.content.push(newMemberElement);
|
|
39783
|
+
// consume: release processed generic subtree
|
|
39784
|
+
if (this.consume && this.consumeSafe && !memberElement.isFrozen) memberElement.value = undefined;
|
|
39632
39785
|
} else if (!this.ignoredFields.includes(keyValue)) {
|
|
39633
|
-
this.element.content.push((0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.cloneDeep)(memberElement));
|
|
39786
|
+
this.element.content.push(this.consume ? memberElement : (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.cloneDeep)(memberElement));
|
|
39634
39787
|
}
|
|
39635
39788
|
});
|
|
39636
39789
|
this.copyMetaAndAttributes(objectElement, this.element);
|
|
@@ -39719,12 +39872,14 @@ class PatternedFieldsVisitor extends _SpecificationVisitor_mjs__WEBPACK_IMPORTED
|
|
|
39719
39872
|
if (!this.ignoredFields.includes(keyValue) && this.fieldPatternPredicate(keyValue)) {
|
|
39720
39873
|
const specPath = this.specPath(value);
|
|
39721
39874
|
const patternedFieldElement = this.toRefractedElement(specPath, value);
|
|
39722
|
-
const newMemberElement = new _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__["default"]((0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.cloneDeep)(key), patternedFieldElement);
|
|
39875
|
+
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);
|
|
39723
39876
|
this.copyMetaAndAttributes(memberElement, newMemberElement);
|
|
39724
39877
|
newMemberElement.classes.push('patterned-field');
|
|
39725
39878
|
this.element.content.push(newMemberElement);
|
|
39879
|
+
// consume: release processed generic subtree
|
|
39880
|
+
if (this.consume && this.consumeSafe && !memberElement.isFrozen) memberElement.value = undefined;
|
|
39726
39881
|
} else if (!this.ignoredFields.includes(keyValue)) {
|
|
39727
|
-
this.element.content.push((0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.cloneDeep)(memberElement));
|
|
39882
|
+
this.element.content.push(this.consume ? memberElement : (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.cloneDeep)(memberElement));
|
|
39728
39883
|
}
|
|
39729
39884
|
});
|
|
39730
39885
|
this.copyMetaAndAttributes(objectElement, this.element);
|
|
@@ -40282,13 +40437,11 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
40282
40437
|
/* harmony import */ var ramda_adjunct__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(33031);
|
|
40283
40438
|
/* harmony import */ var ramda_adjunct__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(68894);
|
|
40284
40439
|
/* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(25162);
|
|
40285
|
-
/* harmony import */ var
|
|
40286
|
-
/* harmony import */ var
|
|
40287
|
-
/* harmony import */ var
|
|
40288
|
-
/* harmony import */ var
|
|
40289
|
-
/* harmony import */ var
|
|
40290
|
-
/* harmony import */ var _elements_JSONSchema_mjs__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(94686);
|
|
40291
|
-
/* harmony import */ var _predicates_mjs__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(86059);
|
|
40440
|
+
/* harmony import */ var _speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(44673);
|
|
40441
|
+
/* harmony import */ var _generics_FixedFieldsVisitor_mjs__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(55320);
|
|
40442
|
+
/* harmony import */ var _bases_mjs__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(89033);
|
|
40443
|
+
/* harmony import */ var _elements_JSONSchema_mjs__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(94686);
|
|
40444
|
+
/* harmony import */ var _predicates_mjs__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(86059);
|
|
40292
40445
|
|
|
40293
40446
|
|
|
40294
40447
|
|
|
@@ -40303,10 +40456,11 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
40303
40456
|
/**
|
|
40304
40457
|
* @public
|
|
40305
40458
|
*/
|
|
40306
|
-
class JSONSchemaVisitor extends
|
|
40459
|
+
class JSONSchemaVisitor extends _bases_mjs__WEBPACK_IMPORTED_MODULE_7__.JSONSchemaVisitorBase {
|
|
40307
40460
|
constructor(options) {
|
|
40308
40461
|
super(options);
|
|
40309
|
-
this.element = new
|
|
40462
|
+
this.element = new _elements_JSONSchema_mjs__WEBPACK_IMPORTED_MODULE_8__["default"]();
|
|
40463
|
+
this.consumeSafe = true;
|
|
40310
40464
|
this.specPath = (0,ramda__WEBPACK_IMPORTED_MODULE_0__["default"])(['document', 'objects', 'JSONSchema']);
|
|
40311
40465
|
}
|
|
40312
40466
|
get defaultDialectIdentifier() {
|
|
@@ -40319,27 +40473,27 @@ class JSONSchemaVisitor extends _bases_mjs__WEBPACK_IMPORTED_MODULE_9__.JSONSche
|
|
|
40319
40473
|
|
|
40320
40474
|
// for further processing consider this JSONSchema Element as parent for all sub-schemas
|
|
40321
40475
|
this.parent = this.element;
|
|
40322
|
-
return
|
|
40476
|
+
return _generics_FixedFieldsVisitor_mjs__WEBPACK_IMPORTED_MODULE_6__["default"].prototype.ObjectElement.call(this, path);
|
|
40323
40477
|
}
|
|
40324
40478
|
handleDialectIdentifier(objectElement) {
|
|
40325
40479
|
// handle $schema keyword in embedded resources
|
|
40326
40480
|
if ((0,ramda_adjunct__WEBPACK_IMPORTED_MODULE_2__["default"])(this.parent) && !(0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_4__.isStringElement)(objectElement.get('$schema'))) {
|
|
40327
40481
|
// no parent available and no $schema is defined, set default $schema
|
|
40328
40482
|
this.element.meta.set('inheritedDialectIdentifier', this.defaultDialectIdentifier);
|
|
40329
|
-
} else if ((0,
|
|
40483
|
+
} else if ((0,_predicates_mjs__WEBPACK_IMPORTED_MODULE_9__.isJSONSchemaElement)(this.parent) && !(0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_4__.isStringElement)(objectElement.get('$schema'))) {
|
|
40330
40484
|
// parent is available and no $schema is defined, set parent $schema
|
|
40331
|
-
const inheritedDialectIdentifier = (0,ramda__WEBPACK_IMPORTED_MODULE_1__["default"])(
|
|
40485
|
+
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));
|
|
40332
40486
|
this.element.meta.set('inheritedDialectIdentifier', inheritedDialectIdentifier);
|
|
40333
40487
|
}
|
|
40334
40488
|
}
|
|
40335
40489
|
handleSchemaIdentifier(objectElement, identifierKeyword = 'id') {
|
|
40336
40490
|
// handle schema identifier in embedded resources
|
|
40337
|
-
// fetch parent's ancestorsSchemaIdentifiers
|
|
40338
|
-
const ancestorsSchemaIdentifiers = this.parent !== undefined ? (
|
|
40491
|
+
// fetch parent's ancestorsSchemaIdentifiers (stored as plain string[])
|
|
40492
|
+
const ancestorsSchemaIdentifiers = this.parent !== undefined ? [...(this.parent.meta.get('ancestorsSchemaIdentifiers') ?? [])] : [];
|
|
40339
40493
|
// get current schema identifier
|
|
40340
|
-
const schemaIdentifier = (0,
|
|
40494
|
+
const schemaIdentifier = (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_5__["default"])(objectElement.get(identifierKeyword));
|
|
40341
40495
|
|
|
40342
|
-
// remember schema identifier if it's a non-empty
|
|
40496
|
+
// remember schema identifier if it's a non-empty string
|
|
40343
40497
|
if ((0,ramda_adjunct__WEBPACK_IMPORTED_MODULE_3__["default"])(schemaIdentifier)) {
|
|
40344
40498
|
ancestorsSchemaIdentifiers.push(schemaIdentifier);
|
|
40345
40499
|
}
|
|
@@ -41501,8 +41655,9 @@ const parse = async source => {
|
|
|
41501
41655
|
if (source.trim().length === 0) {
|
|
41502
41656
|
return parseResult;
|
|
41503
41657
|
}
|
|
41504
|
-
|
|
41658
|
+
let pojo = JSON.parse(source);
|
|
41505
41659
|
const element = (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_0__.refract)(pojo);
|
|
41660
|
+
pojo = null; // allow GC to reclaim POJO
|
|
41506
41661
|
element.classes.push('result');
|
|
41507
41662
|
parseResult.push(element);
|
|
41508
41663
|
return parseResult;
|
|
@@ -43476,7 +43631,10 @@ const parse = async (source, options = {}) => {
|
|
|
43476
43631
|
result
|
|
43477
43632
|
} = parseResultElement;
|
|
43478
43633
|
if ((0,ramda_adjunct__WEBPACK_IMPORTED_MODULE_2__["default"])(result)) {
|
|
43479
|
-
const asyncApiElement = (0,_speclynx_apidom_ns_asyncapi_2__WEBPACK_IMPORTED_MODULE_6__.refractAsyncApi2)(result,
|
|
43634
|
+
const asyncApiElement = (0,_speclynx_apidom_ns_asyncapi_2__WEBPACK_IMPORTED_MODULE_6__.refractAsyncApi2)(result, {
|
|
43635
|
+
consume: true,
|
|
43636
|
+
...refractorOpts
|
|
43637
|
+
});
|
|
43480
43638
|
asyncApiElement.classes.push('result');
|
|
43481
43639
|
parseResultElement.replaceResult(asyncApiElement);
|
|
43482
43640
|
}
|