@speclynx/apidom-parser-adapter-openapi-json-3-0 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.
|
@@ -20016,7 +20016,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
20016
20016
|
* @public
|
|
20017
20017
|
*/
|
|
20018
20018
|
const emptyElement = element => {
|
|
20019
|
-
const meta = !element.isMetaEmpty ?
|
|
20019
|
+
const meta = !element.isMetaEmpty ? element.meta.cloneDeep() : undefined;
|
|
20020
20020
|
const attributes = !element.isAttributesEmpty ? (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.cloneDeep)(element.attributes) : undefined;
|
|
20021
20021
|
|
|
20022
20022
|
// @ts-ignore
|
|
@@ -20032,7 +20032,7 @@ const getMergeFunction = (keyElement, options) => {
|
|
|
20032
20032
|
};
|
|
20033
20033
|
const getMetaMergeFunction = options => {
|
|
20034
20034
|
if (typeof options.customMetaMerge !== 'function') {
|
|
20035
|
-
return targetMeta =>
|
|
20035
|
+
return targetMeta => targetMeta.cloneDeep();
|
|
20036
20036
|
}
|
|
20037
20037
|
return options.customMetaMerge;
|
|
20038
20038
|
};
|
|
@@ -20104,8 +20104,20 @@ const deepmerge = (targetElement, sourceElement, options) => {
|
|
|
20104
20104
|
const mergedElement = sourceIsArrayElement && typeof mergedOptions.arrayElementMerge === 'function' ? mergedOptions.arrayElementMerge(targetElement, sourceElement, mergedOptions) : mergedOptions.objectElementMerge(targetElement, sourceElement, mergedOptions);
|
|
20105
20105
|
|
|
20106
20106
|
// merging meta & attributes
|
|
20107
|
-
|
|
20108
|
-
|
|
20107
|
+
if (!targetElement.isMetaEmpty && !sourceElement.isMetaEmpty) {
|
|
20108
|
+
mergedElement.meta = getMetaMergeFunction(mergedOptions)(targetElement.meta, sourceElement.meta);
|
|
20109
|
+
} else if (!targetElement.isMetaEmpty) {
|
|
20110
|
+
mergedElement.meta = targetElement.meta.cloneDeep();
|
|
20111
|
+
} else if (!sourceElement.isMetaEmpty) {
|
|
20112
|
+
mergedElement.meta = sourceElement.meta.cloneDeep();
|
|
20113
|
+
}
|
|
20114
|
+
if (!targetElement.isAttributesEmpty && !sourceElement.isAttributesEmpty) {
|
|
20115
|
+
mergedElement.attributes = getAttributesMergeFunction(mergedOptions)(targetElement.attributes, sourceElement.attributes);
|
|
20116
|
+
} else if (!targetElement.isAttributesEmpty) {
|
|
20117
|
+
mergedElement.attributes = (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.cloneDeep)(targetElement.attributes);
|
|
20118
|
+
} else if (!sourceElement.isAttributesEmpty) {
|
|
20119
|
+
mergedElement.attributes = (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.cloneDeep)(sourceElement.attributes);
|
|
20120
|
+
}
|
|
20109
20121
|
return mergedElement;
|
|
20110
20122
|
};
|
|
20111
20123
|
deepmerge.all = (list, options) => {
|
|
@@ -20444,6 +20456,105 @@ class KeyValuePair {
|
|
|
20444
20456
|
|
|
20445
20457
|
/***/ },
|
|
20446
20458
|
|
|
20459
|
+
/***/ 1844
|
|
20460
|
+
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
20461
|
+
|
|
20462
|
+
"use strict";
|
|
20463
|
+
__webpack_require__.r(__webpack_exports__);
|
|
20464
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
20465
|
+
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
20466
|
+
/* harmony export */ });
|
|
20467
|
+
/* harmony import */ var ramda__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(8138);
|
|
20468
|
+
|
|
20469
|
+
/**
|
|
20470
|
+
* Lightweight meta container for Element metadata.
|
|
20471
|
+
*
|
|
20472
|
+
* Data is stored as own properties on the instance; methods live on the prototype.
|
|
20473
|
+
* `Object.keys()`, `Object.entries()`, etc. only see data properties.
|
|
20474
|
+
*
|
|
20475
|
+
* @public
|
|
20476
|
+
*/
|
|
20477
|
+
class Metadata {
|
|
20478
|
+
// Set via prototype assignment in registration.ts to avoid circular dependency
|
|
20479
|
+
|
|
20480
|
+
get(name) {
|
|
20481
|
+
return this[name];
|
|
20482
|
+
}
|
|
20483
|
+
set(name, value) {
|
|
20484
|
+
this[name] = value;
|
|
20485
|
+
}
|
|
20486
|
+
hasKey(name) {
|
|
20487
|
+
return Object.hasOwn(this, name);
|
|
20488
|
+
}
|
|
20489
|
+
keys() {
|
|
20490
|
+
return Object.keys(this);
|
|
20491
|
+
}
|
|
20492
|
+
remove(name) {
|
|
20493
|
+
delete this[name];
|
|
20494
|
+
}
|
|
20495
|
+
get isEmpty() {
|
|
20496
|
+
return Object.keys(this).length === 0;
|
|
20497
|
+
}
|
|
20498
|
+
get isFrozen() {
|
|
20499
|
+
return Object.isFrozen(this);
|
|
20500
|
+
}
|
|
20501
|
+
freeze() {
|
|
20502
|
+
for (const value of Object.values(this)) {
|
|
20503
|
+
if (value instanceof this.Element) {
|
|
20504
|
+
value.freeze();
|
|
20505
|
+
} else if (Array.isArray(value) || value !== null && typeof value === 'object') {
|
|
20506
|
+
Object.freeze(value);
|
|
20507
|
+
}
|
|
20508
|
+
}
|
|
20509
|
+
Object.freeze(this);
|
|
20510
|
+
}
|
|
20511
|
+
|
|
20512
|
+
/**
|
|
20513
|
+
* Creates a shallow clone. Same references, new container.
|
|
20514
|
+
*/
|
|
20515
|
+
cloneShallow() {
|
|
20516
|
+
const clone = new Metadata();
|
|
20517
|
+
Object.assign(clone, this);
|
|
20518
|
+
return clone;
|
|
20519
|
+
}
|
|
20520
|
+
|
|
20521
|
+
/**
|
|
20522
|
+
* Merges another Metadata into a new instance.
|
|
20523
|
+
* Arrays are concatenated, all other values are overwritten by source.
|
|
20524
|
+
*/
|
|
20525
|
+
merge(source) {
|
|
20526
|
+
const result = this.cloneShallow();
|
|
20527
|
+
for (const [key, value] of Object.entries(source)) {
|
|
20528
|
+
const existing = result.get(key);
|
|
20529
|
+
if (Array.isArray(existing) && Array.isArray(value)) {
|
|
20530
|
+
result.set(key, [...existing, ...value]);
|
|
20531
|
+
} else {
|
|
20532
|
+
result.set(key, value);
|
|
20533
|
+
}
|
|
20534
|
+
}
|
|
20535
|
+
return result;
|
|
20536
|
+
}
|
|
20537
|
+
|
|
20538
|
+
/**
|
|
20539
|
+
* Creates a deep clone. Elements are deep cloned,
|
|
20540
|
+
* all other values are deep cloned via ramda clone.
|
|
20541
|
+
*/
|
|
20542
|
+
cloneDeep() {
|
|
20543
|
+
const copy = new Metadata();
|
|
20544
|
+
for (const [key, value] of Object.entries(this)) {
|
|
20545
|
+
if (value instanceof this.Element) {
|
|
20546
|
+
copy.set(key, this.cloneDeepElement(value));
|
|
20547
|
+
} else {
|
|
20548
|
+
copy.set(key, (0,ramda__WEBPACK_IMPORTED_MODULE_0__["default"])(value));
|
|
20549
|
+
}
|
|
20550
|
+
}
|
|
20551
|
+
return copy;
|
|
20552
|
+
}
|
|
20553
|
+
}
|
|
20554
|
+
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Metadata);
|
|
20555
|
+
|
|
20556
|
+
/***/ },
|
|
20557
|
+
|
|
20447
20558
|
/***/ 5156
|
|
20448
20559
|
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
20449
20560
|
|
|
@@ -21090,7 +21201,7 @@ const cloneShallowElement = element => {
|
|
|
21090
21201
|
const copy = new Ctor();
|
|
21091
21202
|
copy.element = element.element;
|
|
21092
21203
|
if (!element.isMetaEmpty) {
|
|
21093
|
-
copy.meta =
|
|
21204
|
+
copy.meta = element.meta.cloneDeep();
|
|
21094
21205
|
}
|
|
21095
21206
|
if (!element.isAttributesEmpty) {
|
|
21096
21207
|
copy.attributes = cloneDeep(element.attributes);
|
|
@@ -21118,8 +21229,8 @@ const cloneShallowElement = element => {
|
|
|
21118
21229
|
|
|
21119
21230
|
/**
|
|
21120
21231
|
* Creates a shallow clone of an ApiDOM Element, KeyValuePair, or ObjectSlice.
|
|
21121
|
-
* The element itself is cloned, but content references are shared
|
|
21122
|
-
*
|
|
21232
|
+
* The element itself is cloned, but content references are shared.
|
|
21233
|
+
* Meta and attributes are deep cloned to preserve semantic information.
|
|
21123
21234
|
* @public
|
|
21124
21235
|
*/
|
|
21125
21236
|
const cloneShallow = value => {
|
|
@@ -22194,7 +22305,7 @@ class CollectionElement extends _Element_mjs__WEBPACK_IMPORTED_MODULE_0__["defau
|
|
|
22194
22305
|
* Search the tree recursively and find the element with the matching ID.
|
|
22195
22306
|
*/
|
|
22196
22307
|
getById(id) {
|
|
22197
|
-
return this.find(item => item.id
|
|
22308
|
+
return this.find(item => item.id === id).first;
|
|
22198
22309
|
}
|
|
22199
22310
|
|
|
22200
22311
|
/**
|
|
@@ -22224,18 +22335,24 @@ class CollectionElement extends _Element_mjs__WEBPACK_IMPORTED_MODULE_0__["defau
|
|
|
22224
22335
|
"use strict";
|
|
22225
22336
|
__webpack_require__.r(__webpack_exports__);
|
|
22226
22337
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
22338
|
+
/* harmony export */ Metadata: () => (/* reexport safe */ _Metadata_mjs__WEBPACK_IMPORTED_MODULE_1__["default"]),
|
|
22227
22339
|
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
22228
22340
|
/* harmony export */ });
|
|
22229
22341
|
/* harmony import */ var ramda__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(3654);
|
|
22230
|
-
/* harmony import */ var
|
|
22231
|
-
/* harmony import */ var
|
|
22342
|
+
/* harmony import */ var _Metadata_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(1844);
|
|
22343
|
+
/* harmony import */ var _KeyValuePair_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(6663);
|
|
22344
|
+
/* harmony import */ var _ObjectSlice_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(8504);
|
|
22345
|
+
|
|
22232
22346
|
|
|
22233
22347
|
|
|
22348
|
+
// shared singleton for frozen elements with no meta — avoids allocation on every access
|
|
22349
|
+
const FROZEN_EMPTY_METADATA = Object.freeze(new _Metadata_mjs__WEBPACK_IMPORTED_MODULE_1__["default"]());
|
|
22234
22350
|
|
|
22235
22351
|
/**
|
|
22236
22352
|
* Valid content types for an Element.
|
|
22237
22353
|
* @public
|
|
22238
22354
|
*/
|
|
22355
|
+
|
|
22239
22356
|
/**
|
|
22240
22357
|
* Base Element class that all ApiDOM elements extend.
|
|
22241
22358
|
*
|
|
@@ -22333,7 +22450,7 @@ class Element {
|
|
|
22333
22450
|
_attributes;
|
|
22334
22451
|
|
|
22335
22452
|
// ============================================================
|
|
22336
|
-
// Prototype-assigned properties (set in
|
|
22453
|
+
// Prototype-assigned properties (set in registration.ts)
|
|
22337
22454
|
// Using 'declare' allows TypeScript to know about these
|
|
22338
22455
|
// without generating runtime code.
|
|
22339
22456
|
// ============================================================
|
|
@@ -22394,13 +22511,13 @@ class Element {
|
|
|
22394
22511
|
}
|
|
22395
22512
|
|
|
22396
22513
|
// KeyValuePair
|
|
22397
|
-
if (value instanceof
|
|
22514
|
+
if (value instanceof _KeyValuePair_mjs__WEBPACK_IMPORTED_MODULE_2__["default"]) {
|
|
22398
22515
|
this._content = value;
|
|
22399
22516
|
return;
|
|
22400
22517
|
}
|
|
22401
22518
|
|
|
22402
22519
|
// ObjectSlice - extract elements array
|
|
22403
|
-
if (value instanceof
|
|
22520
|
+
if (value instanceof _ObjectSlice_mjs__WEBPACK_IMPORTED_MODULE_3__["default"]) {
|
|
22404
22521
|
this._content = value.elements;
|
|
22405
22522
|
return;
|
|
22406
22523
|
}
|
|
@@ -22421,24 +22538,22 @@ class Element {
|
|
|
22421
22538
|
|
|
22422
22539
|
/**
|
|
22423
22540
|
* Metadata about this element (id, classes, title, description, links).
|
|
22424
|
-
* Lazily creates
|
|
22541
|
+
* Lazily creates a Metadata instance if not set.
|
|
22425
22542
|
*/
|
|
22426
22543
|
get meta() {
|
|
22427
22544
|
if (!this._meta) {
|
|
22428
|
-
if (this.isFrozen)
|
|
22429
|
-
|
|
22430
|
-
meta.freeze();
|
|
22431
|
-
return meta;
|
|
22432
|
-
}
|
|
22433
|
-
this._meta = new this.ObjectElement();
|
|
22545
|
+
if (this.isFrozen) return FROZEN_EMPTY_METADATA;
|
|
22546
|
+
this._meta = new _Metadata_mjs__WEBPACK_IMPORTED_MODULE_1__["default"]();
|
|
22434
22547
|
}
|
|
22435
22548
|
return this._meta;
|
|
22436
22549
|
}
|
|
22437
22550
|
set meta(value) {
|
|
22438
|
-
if (value instanceof
|
|
22551
|
+
if (value instanceof _Metadata_mjs__WEBPACK_IMPORTED_MODULE_1__["default"]) {
|
|
22439
22552
|
this._meta = value;
|
|
22440
|
-
} else {
|
|
22441
|
-
|
|
22553
|
+
} else if (value && typeof value === 'object') {
|
|
22554
|
+
const meta = new _Metadata_mjs__WEBPACK_IMPORTED_MODULE_1__["default"]();
|
|
22555
|
+
Object.assign(meta, value);
|
|
22556
|
+
this._meta = meta;
|
|
22442
22557
|
}
|
|
22443
22558
|
}
|
|
22444
22559
|
|
|
@@ -22471,10 +22586,8 @@ class Element {
|
|
|
22471
22586
|
|
|
22472
22587
|
/** Unique identifier for this element. */
|
|
22473
22588
|
get id() {
|
|
22474
|
-
if (this.isFrozen) {
|
|
22475
|
-
return this.getMetaProperty('id', '');
|
|
22476
|
-
}
|
|
22477
22589
|
if (!this.hasMetaProperty('id')) {
|
|
22590
|
+
if (this.isFrozen) return '';
|
|
22478
22591
|
this.setMetaProperty('id', '');
|
|
22479
22592
|
}
|
|
22480
22593
|
return this.meta.get('id');
|
|
@@ -22485,10 +22598,8 @@ class Element {
|
|
|
22485
22598
|
|
|
22486
22599
|
/** CSS-like class names. */
|
|
22487
22600
|
get classes() {
|
|
22488
|
-
if (this.isFrozen) {
|
|
22489
|
-
return this.getMetaProperty('classes', []);
|
|
22490
|
-
}
|
|
22491
22601
|
if (!this.hasMetaProperty('classes')) {
|
|
22602
|
+
if (this.isFrozen) return [];
|
|
22492
22603
|
this.setMetaProperty('classes', []);
|
|
22493
22604
|
}
|
|
22494
22605
|
return this.meta.get('classes');
|
|
@@ -22499,11 +22610,13 @@ class Element {
|
|
|
22499
22610
|
|
|
22500
22611
|
/** Hyperlinks associated with this element. */
|
|
22501
22612
|
get links() {
|
|
22502
|
-
if (this.isFrozen) {
|
|
22503
|
-
return this.getMetaProperty('links', []);
|
|
22504
|
-
}
|
|
22505
22613
|
if (!this.hasMetaProperty('links')) {
|
|
22506
|
-
this.
|
|
22614
|
+
if (this.isFrozen) {
|
|
22615
|
+
const empty = new this.ArrayElement();
|
|
22616
|
+
empty.freeze();
|
|
22617
|
+
return empty;
|
|
22618
|
+
}
|
|
22619
|
+
this.setMetaProperty('links', new this.ArrayElement());
|
|
22507
22620
|
}
|
|
22508
22621
|
return this.meta.get('links');
|
|
22509
22622
|
}
|
|
@@ -22523,7 +22636,7 @@ class Element {
|
|
|
22523
22636
|
if (Array.isArray(content)) {
|
|
22524
22637
|
return content;
|
|
22525
22638
|
}
|
|
22526
|
-
if (content instanceof
|
|
22639
|
+
if (content instanceof _KeyValuePair_mjs__WEBPACK_IMPORTED_MODULE_2__["default"]) {
|
|
22527
22640
|
const children = [];
|
|
22528
22641
|
if (content.key) children.push(content.key);
|
|
22529
22642
|
if (content.value) children.push(content.value);
|
|
@@ -22553,7 +22666,6 @@ class Element {
|
|
|
22553
22666
|
|
|
22554
22667
|
// Freeze meta and attributes
|
|
22555
22668
|
if (this._meta) {
|
|
22556
|
-
this._meta.parent = this;
|
|
22557
22669
|
this._meta.freeze();
|
|
22558
22670
|
}
|
|
22559
22671
|
if (this._attributes) {
|
|
@@ -22588,7 +22700,7 @@ class Element {
|
|
|
22588
22700
|
if (_content instanceof Element) {
|
|
22589
22701
|
return _content.toValue();
|
|
22590
22702
|
}
|
|
22591
|
-
if (_content instanceof
|
|
22703
|
+
if (_content instanceof _KeyValuePair_mjs__WEBPACK_IMPORTED_MODULE_2__["default"]) {
|
|
22592
22704
|
return _content.toValue();
|
|
22593
22705
|
}
|
|
22594
22706
|
if (Array.isArray(_content)) {
|
|
@@ -22644,7 +22756,7 @@ class Element {
|
|
|
22644
22756
|
* @throws Error if this element has no ID
|
|
22645
22757
|
*/
|
|
22646
22758
|
toRef(path) {
|
|
22647
|
-
const idValue = this.id
|
|
22759
|
+
const idValue = this.id;
|
|
22648
22760
|
if (idValue === '') {
|
|
22649
22761
|
throw new Error('Cannot create reference to an element without an ID');
|
|
22650
22762
|
}
|
|
@@ -22656,26 +22768,16 @@ class Element {
|
|
|
22656
22768
|
}
|
|
22657
22769
|
|
|
22658
22770
|
/**
|
|
22659
|
-
* Gets a meta property.
|
|
22771
|
+
* Gets a meta property value.
|
|
22660
22772
|
*
|
|
22661
22773
|
* When the property doesn't exist:
|
|
22662
|
-
* - With defaultValue: returns
|
|
22774
|
+
* - With defaultValue: returns the provided default value
|
|
22663
22775
|
* - Without defaultValue: returns undefined
|
|
22664
|
-
*
|
|
22665
|
-
* Note: Each call with a default creates a new instance. Use setMetaProperty
|
|
22666
|
-
* first if you need reference equality across multiple accesses.
|
|
22667
22776
|
*/
|
|
22668
22777
|
|
|
22669
22778
|
getMetaProperty(name, defaultValue) {
|
|
22670
22779
|
if (!this.hasMetaProperty(name)) {
|
|
22671
|
-
|
|
22672
|
-
return undefined;
|
|
22673
|
-
}
|
|
22674
|
-
const element = this.refract(defaultValue);
|
|
22675
|
-
if (element && this.isFrozen) {
|
|
22676
|
-
element.freeze();
|
|
22677
|
-
}
|
|
22678
|
-
return element;
|
|
22780
|
+
return defaultValue;
|
|
22679
22781
|
}
|
|
22680
22782
|
return this.meta.get(name);
|
|
22681
22783
|
}
|
|
@@ -22688,20 +22790,17 @@ class Element {
|
|
|
22688
22790
|
}
|
|
22689
22791
|
|
|
22690
22792
|
/**
|
|
22691
|
-
*
|
|
22793
|
+
* Checks whether a meta property exists.
|
|
22692
22794
|
*/
|
|
22693
22795
|
hasMetaProperty(name) {
|
|
22694
|
-
|
|
22695
|
-
return this.meta.hasKey(name);
|
|
22696
|
-
}
|
|
22697
|
-
return false;
|
|
22796
|
+
return this._meta !== undefined && this._meta.hasKey(name);
|
|
22698
22797
|
}
|
|
22699
22798
|
|
|
22700
22799
|
/**
|
|
22701
22800
|
* Checks if meta is empty.
|
|
22702
22801
|
*/
|
|
22703
22802
|
get isMetaEmpty() {
|
|
22704
|
-
return this._meta === undefined || this.
|
|
22803
|
+
return this._meta === undefined || this._meta.isEmpty;
|
|
22705
22804
|
}
|
|
22706
22805
|
|
|
22707
22806
|
/**
|
|
@@ -22727,7 +22826,7 @@ class Element {
|
|
|
22727
22826
|
}
|
|
22728
22827
|
|
|
22729
22828
|
/**
|
|
22730
|
-
*
|
|
22829
|
+
* Checks whether an attributes property exists.
|
|
22731
22830
|
*/
|
|
22732
22831
|
hasAttributesProperty(name) {
|
|
22733
22832
|
if (!this.isAttributesEmpty) {
|
|
@@ -22746,6 +22845,7 @@ class Element {
|
|
|
22746
22845
|
|
|
22747
22846
|
// Re-export types for convenience
|
|
22748
22847
|
|
|
22848
|
+
|
|
22749
22849
|
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Element);
|
|
22750
22850
|
|
|
22751
22851
|
/***/ },
|
|
@@ -23184,6 +23284,10 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
23184
23284
|
/* harmony import */ var _elements_Style_mjs__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(9686);
|
|
23185
23285
|
/* harmony import */ var _ObjectSlice_mjs__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(8504);
|
|
23186
23286
|
/* harmony import */ var _KeyValuePair_mjs__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(6663);
|
|
23287
|
+
/* harmony import */ var _Metadata_mjs__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(1844);
|
|
23288
|
+
/* harmony import */ var _clone_index_mjs__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(2111);
|
|
23289
|
+
|
|
23290
|
+
|
|
23187
23291
|
|
|
23188
23292
|
|
|
23189
23293
|
|
|
@@ -23243,14 +23347,16 @@ function refract(value) {
|
|
|
23243
23347
|
}
|
|
23244
23348
|
|
|
23245
23349
|
// Set up prototype assignments for circular dependency resolution.
|
|
23246
|
-
// These allow Element instances to
|
|
23247
|
-
//
|
|
23350
|
+
// These allow Element and Metadata instances to reference classes they can't import
|
|
23351
|
+
// directly (which would cause circular imports).
|
|
23248
23352
|
// Using 'declare' in the class definitions enables type-safe access to these properties.
|
|
23249
23353
|
_primitives_Element_mjs__WEBPACK_IMPORTED_MODULE_0__["default"].prototype.ObjectElement = _primitives_ObjectElement_mjs__WEBPACK_IMPORTED_MODULE_8__["default"];
|
|
23250
23354
|
_primitives_Element_mjs__WEBPACK_IMPORTED_MODULE_0__["default"].prototype.ArrayElement = _primitives_ArrayElement_mjs__WEBPACK_IMPORTED_MODULE_6__["default"];
|
|
23251
23355
|
_primitives_Element_mjs__WEBPACK_IMPORTED_MODULE_0__["default"].prototype.RefElement = _elements_RefElement_mjs__WEBPACK_IMPORTED_MODULE_10__["default"];
|
|
23252
23356
|
_primitives_Element_mjs__WEBPACK_IMPORTED_MODULE_0__["default"].prototype.MemberElement = _primitives_MemberElement_mjs__WEBPACK_IMPORTED_MODULE_7__["default"];
|
|
23253
23357
|
_primitives_Element_mjs__WEBPACK_IMPORTED_MODULE_0__["default"].prototype.refract = refract;
|
|
23358
|
+
_Metadata_mjs__WEBPACK_IMPORTED_MODULE_18__["default"].prototype.Element = _primitives_Element_mjs__WEBPACK_IMPORTED_MODULE_0__["default"];
|
|
23359
|
+
_Metadata_mjs__WEBPACK_IMPORTED_MODULE_18__["default"].prototype.cloneDeepElement = element => (0,_clone_index_mjs__WEBPACK_IMPORTED_MODULE_19__.cloneDeep)(element);
|
|
23254
23360
|
|
|
23255
23361
|
/**
|
|
23256
23362
|
* Contains all of the element classes, and related structures and methods
|
|
@@ -23315,7 +23421,13 @@ class JSONSerialiser {
|
|
|
23315
23421
|
element: element.element
|
|
23316
23422
|
};
|
|
23317
23423
|
if (!element.isMetaEmpty) {
|
|
23318
|
-
|
|
23424
|
+
const serialisedMeta = this.serialiseMeta(element);
|
|
23425
|
+
if (serialisedMeta) {
|
|
23426
|
+
payload.meta = serialisedMeta.meta;
|
|
23427
|
+
if (serialisedMeta.rawKeys.length > 0) {
|
|
23428
|
+
payload.__meta_raw__ = serialisedMeta.rawKeys;
|
|
23429
|
+
}
|
|
23430
|
+
}
|
|
23319
23431
|
}
|
|
23320
23432
|
if (!element.isAttributesEmpty) {
|
|
23321
23433
|
payload.attributes = this.serialiseObject(element.attributes);
|
|
@@ -23362,7 +23474,7 @@ class JSONSerialiser {
|
|
|
23362
23474
|
element.element = value.element;
|
|
23363
23475
|
}
|
|
23364
23476
|
|
|
23365
|
-
// Extract
|
|
23477
|
+
// Extract special meta keys without mutating input, filter remaining meta
|
|
23366
23478
|
let mappingsDoc;
|
|
23367
23479
|
let stylesDoc;
|
|
23368
23480
|
let metaToDeserialize = value.meta;
|
|
@@ -23376,8 +23488,15 @@ class JSONSerialiser {
|
|
|
23376
23488
|
stylesDoc = __styles__;
|
|
23377
23489
|
metaToDeserialize = Object.keys(rest).length > 0 ? rest : undefined;
|
|
23378
23490
|
}
|
|
23491
|
+
|
|
23492
|
+
// determine which meta keys were raw primitives before serialization
|
|
23493
|
+
const rawKeys = value.__meta_raw__ ? new Set(value.__meta_raw__) : undefined;
|
|
23379
23494
|
if (metaToDeserialize) {
|
|
23380
|
-
|
|
23495
|
+
for (const [key, doc] of Object.entries(metaToDeserialize)) {
|
|
23496
|
+
const deserialized = this.deserialise(doc);
|
|
23497
|
+
// unwrap keys that were raw primitives before serialization
|
|
23498
|
+
element.setMetaProperty(key, rawKeys?.has(key) ? deserialized.toValue() : deserialized);
|
|
23499
|
+
}
|
|
23381
23500
|
}
|
|
23382
23501
|
|
|
23383
23502
|
// Restore source position from __mappings__
|
|
@@ -23440,6 +23559,27 @@ class JSONSerialiser {
|
|
|
23440
23559
|
}
|
|
23441
23560
|
return content;
|
|
23442
23561
|
}
|
|
23562
|
+
serialiseMeta(element) {
|
|
23563
|
+
const meta = {};
|
|
23564
|
+
const rawKeys = [];
|
|
23565
|
+
let hasEntries = false;
|
|
23566
|
+
for (const [key, value] of Object.entries(element.meta)) {
|
|
23567
|
+
if (value instanceof this.namespace.elements.Element) {
|
|
23568
|
+
meta[key] = this.serialise(value);
|
|
23569
|
+
hasEntries = true;
|
|
23570
|
+
} else if (value !== undefined) {
|
|
23571
|
+
// refract primitives to maintain JSON Refract spec compatibility
|
|
23572
|
+
const refracted = element.refract(value);
|
|
23573
|
+
meta[key] = this.serialise(refracted);
|
|
23574
|
+
rawKeys.push(key);
|
|
23575
|
+
hasEntries = true;
|
|
23576
|
+
}
|
|
23577
|
+
}
|
|
23578
|
+
return hasEntries ? {
|
|
23579
|
+
meta,
|
|
23580
|
+
rawKeys
|
|
23581
|
+
} : undefined;
|
|
23582
|
+
}
|
|
23443
23583
|
serialiseObject(obj) {
|
|
23444
23584
|
const result = {};
|
|
23445
23585
|
obj.forEach((value, key) => {
|
|
@@ -24408,7 +24548,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
24408
24548
|
*/
|
|
24409
24549
|
class FallbackVisitor extends _Visitor_mjs__WEBPACK_IMPORTED_MODULE_1__["default"] {
|
|
24410
24550
|
enter(path) {
|
|
24411
|
-
this.element = (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_0__.cloneDeep)(path.node);
|
|
24551
|
+
this.element = this.consume ? path.node : (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_0__.cloneDeep)(path.node);
|
|
24412
24552
|
path.stop();
|
|
24413
24553
|
}
|
|
24414
24554
|
}
|
|
@@ -24448,7 +24588,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
24448
24588
|
*/
|
|
24449
24589
|
class SpecificationVisitor extends _Visitor_mjs__WEBPACK_IMPORTED_MODULE_6__["default"] {
|
|
24450
24590
|
specObj;
|
|
24451
|
-
passingOptionsNames = ['specObj', 'parent'];
|
|
24591
|
+
passingOptionsNames = ['specObj', 'parent', 'consume'];
|
|
24452
24592
|
constructor({
|
|
24453
24593
|
specObj,
|
|
24454
24594
|
...rest
|
|
@@ -24494,7 +24634,7 @@ class SpecificationVisitor extends _Visitor_mjs__WEBPACK_IMPORTED_MODULE_6__["de
|
|
|
24494
24634
|
*/
|
|
24495
24635
|
const visitor = this.retrieveVisitorInstance(specPath, options);
|
|
24496
24636
|
if (visitor instanceof _FallbackVisitor_mjs__WEBPACK_IMPORTED_MODULE_7__["default"] && visitor?.constructor === _FallbackVisitor_mjs__WEBPACK_IMPORTED_MODULE_7__["default"]) {
|
|
24497
|
-
return (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_4__.cloneDeep)(element);
|
|
24637
|
+
return this.consume ? element : (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_4__.cloneDeep)(element);
|
|
24498
24638
|
}
|
|
24499
24639
|
(0,_speclynx_apidom_traverse__WEBPACK_IMPORTED_MODULE_5__.traverse)(element, visitor, options);
|
|
24500
24640
|
return visitor.element;
|
|
@@ -24513,7 +24653,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
24513
24653
|
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
24514
24654
|
/* harmony export */ });
|
|
24515
24655
|
/* harmony import */ var _speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(8400);
|
|
24516
|
-
/* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(
|
|
24656
|
+
/* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(2111);
|
|
24517
24657
|
/* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(5810);
|
|
24518
24658
|
/* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(9686);
|
|
24519
24659
|
|
|
@@ -24528,19 +24668,21 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
24528
24668
|
*/
|
|
24529
24669
|
class Visitor {
|
|
24530
24670
|
element;
|
|
24671
|
+
consume = false;
|
|
24672
|
+
consumeSafe = false;
|
|
24531
24673
|
constructor(options) {
|
|
24532
24674
|
Object.assign(this, options);
|
|
24533
24675
|
}
|
|
24534
24676
|
copyMetaAndAttributes(from, to) {
|
|
24535
|
-
if (!from.isMetaEmpty
|
|
24536
|
-
|
|
24537
|
-
|
|
24538
|
-
to.meta = (
|
|
24677
|
+
if (!from.isMetaEmpty && !to.isMetaEmpty) {
|
|
24678
|
+
to.meta = to.meta.merge(from.meta);
|
|
24679
|
+
} else if (!from.isMetaEmpty) {
|
|
24680
|
+
to.meta = from.meta.cloneDeep();
|
|
24539
24681
|
}
|
|
24540
|
-
if (!from.isAttributesEmpty
|
|
24541
|
-
|
|
24542
|
-
|
|
24543
|
-
to.attributes = (0,
|
|
24682
|
+
if (!from.isAttributesEmpty && !to.isAttributesEmpty) {
|
|
24683
|
+
to.attributes = (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_0__["default"])(to.attributes, from.attributes);
|
|
24684
|
+
} else if (!from.isAttributesEmpty) {
|
|
24685
|
+
to.attributes = (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.cloneDeep)(from.attributes);
|
|
24544
24686
|
}
|
|
24545
24687
|
_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__["default"].transfer(from, to);
|
|
24546
24688
|
_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_3__["default"].transfer(from, to);
|
|
@@ -24650,12 +24792,13 @@ class FixedFieldsVisitor extends _SpecificationVisitor_mjs__WEBPACK_IMPORTED_MOD
|
|
|
24650
24792
|
const keyValue = (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_3__["default"])(key);
|
|
24651
24793
|
if ((0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_0__.isStringElement)(key) && fields.includes(keyValue) && !this.ignoredFields.includes(keyValue)) {
|
|
24652
24794
|
const fixedFieldElement = this.toRefractedElement([...specPath, 'fixedFields', keyValue], value);
|
|
24653
|
-
const newMemberElement = new _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__["default"]((0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.cloneDeep)(key), fixedFieldElement);
|
|
24795
|
+
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);
|
|
24654
24796
|
this.copyMetaAndAttributes(memberElement, newMemberElement);
|
|
24655
|
-
newMemberElement.classes.push('fixed-field');
|
|
24656
24797
|
this.element.content.push(newMemberElement);
|
|
24798
|
+
// consume: release processed generic subtree
|
|
24799
|
+
if (this.consume && this.consumeSafe && !memberElement.isFrozen) memberElement.value = undefined;
|
|
24657
24800
|
} else if (!this.ignoredFields.includes(keyValue)) {
|
|
24658
|
-
this.element.content.push((0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.cloneDeep)(memberElement));
|
|
24801
|
+
this.element.content.push(this.consume ? memberElement : (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.cloneDeep)(memberElement));
|
|
24659
24802
|
}
|
|
24660
24803
|
});
|
|
24661
24804
|
this.copyMetaAndAttributes(objectElement, this.element);
|
|
@@ -24744,12 +24887,14 @@ class PatternedFieldsVisitor extends _SpecificationVisitor_mjs__WEBPACK_IMPORTED
|
|
|
24744
24887
|
if (!this.ignoredFields.includes(keyValue) && this.fieldPatternPredicate(keyValue)) {
|
|
24745
24888
|
const specPath = this.specPath(value);
|
|
24746
24889
|
const patternedFieldElement = this.toRefractedElement(specPath, value);
|
|
24747
|
-
const newMemberElement = new _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__["default"]((0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.cloneDeep)(key), patternedFieldElement);
|
|
24890
|
+
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);
|
|
24748
24891
|
this.copyMetaAndAttributes(memberElement, newMemberElement);
|
|
24749
24892
|
newMemberElement.classes.push('patterned-field');
|
|
24750
24893
|
this.element.content.push(newMemberElement);
|
|
24894
|
+
// consume: release processed generic subtree
|
|
24895
|
+
if (this.consume && this.consumeSafe && !memberElement.isFrozen) memberElement.value = undefined;
|
|
24751
24896
|
} else if (!this.ignoredFields.includes(keyValue)) {
|
|
24752
|
-
this.element.content.push((0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.cloneDeep)(memberElement));
|
|
24897
|
+
this.element.content.push(this.consume ? memberElement : (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.cloneDeep)(memberElement));
|
|
24753
24898
|
}
|
|
24754
24899
|
});
|
|
24755
24900
|
this.copyMetaAndAttributes(objectElement, this.element);
|
|
@@ -25307,13 +25452,11 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
25307
25452
|
/* harmony import */ var ramda_adjunct__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(3031);
|
|
25308
25453
|
/* harmony import */ var ramda_adjunct__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(6513);
|
|
25309
25454
|
/* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(5162);
|
|
25310
|
-
/* harmony import */ var
|
|
25311
|
-
/* harmony import */ var
|
|
25312
|
-
/* harmony import */ var
|
|
25313
|
-
/* harmony import */ var
|
|
25314
|
-
/* harmony import */ var
|
|
25315
|
-
/* harmony import */ var _elements_JSONSchema_mjs__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(4686);
|
|
25316
|
-
/* harmony import */ var _predicates_mjs__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(6059);
|
|
25455
|
+
/* harmony import */ var _speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(4673);
|
|
25456
|
+
/* harmony import */ var _generics_FixedFieldsVisitor_mjs__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(5320);
|
|
25457
|
+
/* harmony import */ var _bases_mjs__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(9033);
|
|
25458
|
+
/* harmony import */ var _elements_JSONSchema_mjs__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(4686);
|
|
25459
|
+
/* harmony import */ var _predicates_mjs__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(6059);
|
|
25317
25460
|
|
|
25318
25461
|
|
|
25319
25462
|
|
|
@@ -25328,10 +25471,11 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
25328
25471
|
/**
|
|
25329
25472
|
* @public
|
|
25330
25473
|
*/
|
|
25331
|
-
class JSONSchemaVisitor extends
|
|
25474
|
+
class JSONSchemaVisitor extends _bases_mjs__WEBPACK_IMPORTED_MODULE_7__.JSONSchemaVisitorBase {
|
|
25332
25475
|
constructor(options) {
|
|
25333
25476
|
super(options);
|
|
25334
|
-
this.element = new
|
|
25477
|
+
this.element = new _elements_JSONSchema_mjs__WEBPACK_IMPORTED_MODULE_8__["default"]();
|
|
25478
|
+
this.consumeSafe = true;
|
|
25335
25479
|
this.specPath = (0,ramda__WEBPACK_IMPORTED_MODULE_0__["default"])(['document', 'objects', 'JSONSchema']);
|
|
25336
25480
|
}
|
|
25337
25481
|
get defaultDialectIdentifier() {
|
|
@@ -25344,27 +25488,27 @@ class JSONSchemaVisitor extends _bases_mjs__WEBPACK_IMPORTED_MODULE_9__.JSONSche
|
|
|
25344
25488
|
|
|
25345
25489
|
// for further processing consider this JSONSchema Element as parent for all sub-schemas
|
|
25346
25490
|
this.parent = this.element;
|
|
25347
|
-
return
|
|
25491
|
+
return _generics_FixedFieldsVisitor_mjs__WEBPACK_IMPORTED_MODULE_6__["default"].prototype.ObjectElement.call(this, path);
|
|
25348
25492
|
}
|
|
25349
25493
|
handleDialectIdentifier(objectElement) {
|
|
25350
25494
|
// handle $schema keyword in embedded resources
|
|
25351
25495
|
if ((0,ramda_adjunct__WEBPACK_IMPORTED_MODULE_2__["default"])(this.parent) && !(0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_4__.isStringElement)(objectElement.get('$schema'))) {
|
|
25352
25496
|
// no parent available and no $schema is defined, set default $schema
|
|
25353
25497
|
this.element.meta.set('inheritedDialectIdentifier', this.defaultDialectIdentifier);
|
|
25354
|
-
} else if ((0,
|
|
25498
|
+
} else if ((0,_predicates_mjs__WEBPACK_IMPORTED_MODULE_9__.isJSONSchemaElement)(this.parent) && !(0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_4__.isStringElement)(objectElement.get('$schema'))) {
|
|
25355
25499
|
// parent is available and no $schema is defined, set parent $schema
|
|
25356
|
-
const inheritedDialectIdentifier = (0,ramda__WEBPACK_IMPORTED_MODULE_1__["default"])(
|
|
25500
|
+
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));
|
|
25357
25501
|
this.element.meta.set('inheritedDialectIdentifier', inheritedDialectIdentifier);
|
|
25358
25502
|
}
|
|
25359
25503
|
}
|
|
25360
25504
|
handleSchemaIdentifier(objectElement, identifierKeyword = 'id') {
|
|
25361
25505
|
// handle schema identifier in embedded resources
|
|
25362
|
-
// fetch parent's ancestorsSchemaIdentifiers
|
|
25363
|
-
const ancestorsSchemaIdentifiers = this.parent !== undefined ? (
|
|
25506
|
+
// fetch parent's ancestorsSchemaIdentifiers (stored as plain string[])
|
|
25507
|
+
const ancestorsSchemaIdentifiers = this.parent !== undefined ? [...(this.parent.meta.get('ancestorsSchemaIdentifiers') ?? [])] : [];
|
|
25364
25508
|
// get current schema identifier
|
|
25365
|
-
const schemaIdentifier = (0,
|
|
25509
|
+
const schemaIdentifier = (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_5__["default"])(objectElement.get(identifierKeyword));
|
|
25366
25510
|
|
|
25367
|
-
// remember schema identifier if it's a non-empty
|
|
25511
|
+
// remember schema identifier if it's a non-empty string
|
|
25368
25512
|
if ((0,ramda_adjunct__WEBPACK_IMPORTED_MODULE_3__["default"])(schemaIdentifier)) {
|
|
25369
25513
|
ancestorsSchemaIdentifiers.push(schemaIdentifier);
|
|
25370
25514
|
}
|
|
@@ -28575,7 +28719,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
28575
28719
|
const refract = (value, {
|
|
28576
28720
|
element = 'openApi3_0',
|
|
28577
28721
|
plugins = [],
|
|
28578
|
-
specificationObj = _specification_mjs__WEBPACK_IMPORTED_MODULE_5__["default"]
|
|
28722
|
+
specificationObj = _specification_mjs__WEBPACK_IMPORTED_MODULE_5__["default"],
|
|
28723
|
+
consume = false
|
|
28579
28724
|
} = {}) => {
|
|
28580
28725
|
const genericElement = (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__.refract)(value);
|
|
28581
28726
|
const resolvedSpec = (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_1__.resolveSpecification)(specificationObj);
|
|
@@ -28592,7 +28737,8 @@ const refract = (value, {
|
|
|
28592
28737
|
*/
|
|
28593
28738
|
const RootVisitorClass = (0,ramda__WEBPACK_IMPORTED_MODULE_4__["default"])(specPath, resolvedSpec);
|
|
28594
28739
|
const rootVisitor = new RootVisitorClass({
|
|
28595
|
-
specObj: resolvedSpec
|
|
28740
|
+
specObj: resolvedSpec,
|
|
28741
|
+
consume
|
|
28596
28742
|
});
|
|
28597
28743
|
(0,_speclynx_apidom_traverse__WEBPACK_IMPORTED_MODULE_3__.traverse)(genericElement, rootVisitor, {
|
|
28598
28744
|
nodeTypeGetter: _speclynx_apidom_traverse__WEBPACK_IMPORTED_MODULE_3__.getNodePrimitiveType
|
|
@@ -29780,7 +29926,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
29780
29926
|
*/
|
|
29781
29927
|
class FallbackVisitor extends _Visitor_mjs__WEBPACK_IMPORTED_MODULE_1__["default"] {
|
|
29782
29928
|
enter(path) {
|
|
29783
|
-
this.element = (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_0__.cloneDeep)(path.node);
|
|
29929
|
+
this.element = this.consume ? path.node : (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_0__.cloneDeep)(path.node);
|
|
29784
29930
|
path.stop();
|
|
29785
29931
|
}
|
|
29786
29932
|
}
|
|
@@ -29846,8 +29992,9 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
29846
29992
|
*/
|
|
29847
29993
|
class SpecificationVisitor extends _Visitor_mjs__WEBPACK_IMPORTED_MODULE_6__["default"] {
|
|
29848
29994
|
specObj;
|
|
29849
|
-
passingOptionsNames = ['specObj', 'openApiGenericElement', 'openApiSemanticElement'];
|
|
29995
|
+
passingOptionsNames = ['specObj', 'openApiGenericElement', 'sourceContext', 'openApiSemanticElement', 'consume'];
|
|
29850
29996
|
openApiGenericElement;
|
|
29997
|
+
sourceContext;
|
|
29851
29998
|
openApiSemanticElement;
|
|
29852
29999
|
constructor({
|
|
29853
30000
|
specObj,
|
|
@@ -29902,7 +30049,7 @@ class SpecificationVisitor extends _Visitor_mjs__WEBPACK_IMPORTED_MODULE_6__["de
|
|
|
29902
30049
|
*/
|
|
29903
30050
|
const visitor = this.retrieveVisitorInstance(specPath, options);
|
|
29904
30051
|
if (visitor instanceof _FallbackVisitor_mjs__WEBPACK_IMPORTED_MODULE_7__["default"] && visitor?.constructor === _FallbackVisitor_mjs__WEBPACK_IMPORTED_MODULE_7__["default"]) {
|
|
29905
|
-
return (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_4__.cloneDeep)(element);
|
|
30052
|
+
return this.consume ? element : (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_4__.cloneDeep)(element);
|
|
29906
30053
|
}
|
|
29907
30054
|
(0,_speclynx_apidom_traverse__WEBPACK_IMPORTED_MODULE_5__.traverse)(element, visitor, {
|
|
29908
30055
|
nodeTypeGetter: _speclynx_apidom_traverse__WEBPACK_IMPORTED_MODULE_5__.getNodePrimitiveType
|
|
@@ -29923,7 +30070,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
29923
30070
|
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
29924
30071
|
/* harmony export */ });
|
|
29925
30072
|
/* harmony import */ var _speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(8400);
|
|
29926
|
-
/* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(
|
|
30073
|
+
/* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(2111);
|
|
29927
30074
|
/* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(5810);
|
|
29928
30075
|
/* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(9686);
|
|
29929
30076
|
|
|
@@ -29938,19 +30085,21 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
29938
30085
|
*/
|
|
29939
30086
|
class Visitor {
|
|
29940
30087
|
element;
|
|
30088
|
+
consume = false;
|
|
30089
|
+
consumeSafe = false;
|
|
29941
30090
|
constructor(options = {}) {
|
|
29942
30091
|
Object.assign(this, options);
|
|
29943
30092
|
}
|
|
29944
30093
|
copyMetaAndAttributes(from, to) {
|
|
29945
|
-
if (!from.isMetaEmpty
|
|
29946
|
-
|
|
29947
|
-
|
|
29948
|
-
to.meta = (
|
|
30094
|
+
if (!from.isMetaEmpty && !to.isMetaEmpty) {
|
|
30095
|
+
to.meta = to.meta.merge(from.meta);
|
|
30096
|
+
} else if (!from.isMetaEmpty) {
|
|
30097
|
+
to.meta = from.meta.cloneDeep();
|
|
29949
30098
|
}
|
|
29950
|
-
if (!from.isAttributesEmpty
|
|
29951
|
-
|
|
29952
|
-
|
|
29953
|
-
to.attributes = (0,
|
|
30099
|
+
if (!from.isAttributesEmpty && !to.isAttributesEmpty) {
|
|
30100
|
+
to.attributes = (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_0__["default"])(to.attributes, from.attributes);
|
|
30101
|
+
} else if (!from.isAttributesEmpty) {
|
|
30102
|
+
to.attributes = (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.cloneDeep)(from.attributes);
|
|
29954
30103
|
}
|
|
29955
30104
|
_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__["default"].transfer(from, to);
|
|
29956
30105
|
_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_3__["default"].transfer(from, to);
|
|
@@ -30072,15 +30221,20 @@ class FixedFieldsVisitor extends _SpecificationVisitor_mjs__WEBPACK_IMPORTED_MOD
|
|
|
30072
30221
|
const keyValue = (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_3__["default"])(key);
|
|
30073
30222
|
if ((0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_0__.isStringElement)(key) && fields.includes(keyValue) && !this.ignoredFields.includes(keyValue)) {
|
|
30074
30223
|
const fixedFieldElement = this.toRefractedElement([...specPath, 'fixedFields', keyValue], value);
|
|
30075
|
-
const newMemberElement = new _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__["default"]((0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.cloneDeep)(key), fixedFieldElement);
|
|
30224
|
+
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);
|
|
30076
30225
|
this.copyMetaAndAttributes(memberElement, newMemberElement);
|
|
30077
|
-
newMemberElement.classes.push('fixed-field');
|
|
30078
30226
|
this.element.content.push(newMemberElement);
|
|
30227
|
+
// consume: release processed generic subtree
|
|
30228
|
+
if (this.consume && this.consumeSafe && !memberElement.isFrozen) memberElement.value = undefined;
|
|
30079
30229
|
} else if (this.canSupportSpecificationExtensions && this.specificationExtensionPredicate(memberElement)) {
|
|
30080
30230
|
const extensionElement = this.toRefractedElement(['document', 'extension'], memberElement);
|
|
30081
30231
|
this.element.content.push(extensionElement);
|
|
30232
|
+
// consume: release processed generic subtree
|
|
30233
|
+
if (this.consume && this.consumeSafe && !memberElement.isFrozen) {
|
|
30234
|
+
memberElement.value = undefined;
|
|
30235
|
+
}
|
|
30082
30236
|
} else if (!this.ignoredFields.includes(keyValue)) {
|
|
30083
|
-
this.element.content.push((0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.cloneDeep)(memberElement));
|
|
30237
|
+
this.element.content.push(this.consume ? memberElement : (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.cloneDeep)(memberElement));
|
|
30084
30238
|
}
|
|
30085
30239
|
});
|
|
30086
30240
|
this.copyMetaAndAttributes(objectElement, this.element);
|
|
@@ -30262,12 +30416,14 @@ class PatternedFieldsVisitor extends _SpecificationVisitor_mjs__WEBPACK_IMPORTED
|
|
|
30262
30416
|
} else if (!this.ignoredFields.includes(keyValue) && this.fieldPatternPredicate(keyValue)) {
|
|
30263
30417
|
const specPath = this.specPath(value);
|
|
30264
30418
|
const patternedFieldElement = this.toRefractedElement(specPath, value);
|
|
30265
|
-
const newMemberElement = new _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__["default"]((0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.cloneDeep)(key), patternedFieldElement);
|
|
30419
|
+
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);
|
|
30266
30420
|
this.copyMetaAndAttributes(memberElement, newMemberElement);
|
|
30267
30421
|
newMemberElement.classes.push('patterned-field');
|
|
30268
30422
|
this.element.content.push(newMemberElement);
|
|
30423
|
+
// consume: release processed generic subtree
|
|
30424
|
+
if (this.consume && this.consumeSafe && !memberElement.isFrozen) memberElement.value = undefined;
|
|
30269
30425
|
} else if (!this.ignoredFields.includes(keyValue)) {
|
|
30270
|
-
this.element.content.push((0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.cloneDeep)(memberElement));
|
|
30426
|
+
this.element.content.push(this.consume ? memberElement : (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.cloneDeep)(memberElement));
|
|
30271
30427
|
}
|
|
30272
30428
|
});
|
|
30273
30429
|
this.copyMetaAndAttributes(objectElement, this.element);
|
|
@@ -31130,6 +31286,7 @@ class ComponentsVisitor extends _bases_mjs__WEBPACK_IMPORTED_MODULE_2__.BaseFixe
|
|
|
31130
31286
|
this.element = new _elements_Components_mjs__WEBPACK_IMPORTED_MODULE_1__["default"]();
|
|
31131
31287
|
this.specPath = (0,ramda__WEBPACK_IMPORTED_MODULE_0__["default"])(['document', 'objects', 'Components']);
|
|
31132
31288
|
this.canSupportSpecificationExtensions = true;
|
|
31289
|
+
this.consumeSafe = true;
|
|
31133
31290
|
}
|
|
31134
31291
|
}
|
|
31135
31292
|
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (ComponentsVisitor);
|
|
@@ -31568,6 +31725,7 @@ class OpenApi3_0Visitor extends _bases_mjs__WEBPACK_IMPORTED_MODULE_1__.BaseFixe
|
|
|
31568
31725
|
this.element = new _elements_OpenApi3_0_mjs__WEBPACK_IMPORTED_MODULE_2__["default"]();
|
|
31569
31726
|
this.specPath = (0,ramda__WEBPACK_IMPORTED_MODULE_0__["default"])(['document', 'objects', 'OpenApi']);
|
|
31570
31727
|
this.canSupportSpecificationExtensions = true;
|
|
31728
|
+
this.consumeSafe = true;
|
|
31571
31729
|
}
|
|
31572
31730
|
ObjectElement(path) {
|
|
31573
31731
|
_bases_mjs__WEBPACK_IMPORTED_MODULE_1__.BaseFixedFieldsVisitor.prototype.ObjectElement.call(this, path);
|
|
@@ -32458,11 +32616,10 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
32458
32616
|
/* harmony export */ });
|
|
32459
32617
|
/* harmony import */ var ramda__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(9498);
|
|
32460
32618
|
/* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(5162);
|
|
32461
|
-
/* harmony import */ var
|
|
32462
|
-
/* harmony import */ var
|
|
32463
|
-
/* harmony import */ var
|
|
32464
|
-
/* harmony import */ var
|
|
32465
|
-
/* harmony import */ var _bases_mjs__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(4367);
|
|
32619
|
+
/* harmony import */ var _speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(4673);
|
|
32620
|
+
/* harmony import */ var _elements_PathItem_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(8557);
|
|
32621
|
+
/* harmony import */ var _predicates_mjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(2131);
|
|
32622
|
+
/* harmony import */ var _bases_mjs__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(4367);
|
|
32466
32623
|
|
|
32467
32624
|
|
|
32468
32625
|
|
|
@@ -32475,22 +32632,21 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
32475
32632
|
/**
|
|
32476
32633
|
* @public
|
|
32477
32634
|
*/
|
|
32478
|
-
class PathItemVisitor extends
|
|
32635
|
+
class PathItemVisitor extends _bases_mjs__WEBPACK_IMPORTED_MODULE_5__.BaseFixedFieldsVisitor {
|
|
32479
32636
|
constructor(options) {
|
|
32480
32637
|
super(options);
|
|
32481
|
-
this.element = new
|
|
32638
|
+
this.element = new _elements_PathItem_mjs__WEBPACK_IMPORTED_MODULE_3__["default"]();
|
|
32482
32639
|
this.specPath = (0,ramda__WEBPACK_IMPORTED_MODULE_0__["default"])(['document', 'objects', 'PathItem']);
|
|
32640
|
+
this.consumeSafe = true;
|
|
32483
32641
|
}
|
|
32484
32642
|
ObjectElement(path) {
|
|
32485
|
-
|
|
32643
|
+
_bases_mjs__WEBPACK_IMPORTED_MODULE_5__.BaseFixedFieldsVisitor.prototype.ObjectElement.call(this, path);
|
|
32486
32644
|
|
|
32487
32645
|
// decorate Operation elements with HTTP method
|
|
32488
|
-
this.element.filter(
|
|
32646
|
+
this.element.filter(_predicates_mjs__WEBPACK_IMPORTED_MODULE_4__.isOperationElement)
|
|
32489
32647
|
// @ts-ignore
|
|
32490
32648
|
.forEach((operationElement, httpMethodElementCI) => {
|
|
32491
|
-
|
|
32492
|
-
httpMethodElementCS.content = (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_3__["default"])(httpMethodElementCS).toUpperCase();
|
|
32493
|
-
operationElement.meta.set('http-method', httpMethodElementCS);
|
|
32649
|
+
operationElement.meta.set('http-method', (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_2__["default"])(httpMethodElementCI).toUpperCase());
|
|
32494
32650
|
});
|
|
32495
32651
|
|
|
32496
32652
|
// mark this PathItemElement with reference metadata
|
|
@@ -32513,7 +32669,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
32513
32669
|
/* harmony export */ });
|
|
32514
32670
|
/* harmony import */ var ramda__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(3679);
|
|
32515
32671
|
/* harmony import */ var ramda__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(9498);
|
|
32516
|
-
/* harmony import */ var
|
|
32672
|
+
/* harmony import */ var _speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(4673);
|
|
32517
32673
|
/* harmony import */ var _elements_Paths_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(8535);
|
|
32518
32674
|
/* harmony import */ var _predicates_mjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(2131);
|
|
32519
32675
|
/* harmony import */ var _bases_mjs__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(4367);
|
|
@@ -32534,6 +32690,7 @@ class PathsVisitor extends _bases_mjs__WEBPACK_IMPORTED_MODULE_5__.BasePatterned
|
|
|
32534
32690
|
this.element = new _elements_Paths_mjs__WEBPACK_IMPORTED_MODULE_3__["default"]();
|
|
32535
32691
|
this.specPath = (0,ramda__WEBPACK_IMPORTED_MODULE_1__["default"])(['document', 'objects', 'PathItem']);
|
|
32536
32692
|
this.canSupportSpecificationExtensions = true;
|
|
32693
|
+
this.consumeSafe = true;
|
|
32537
32694
|
this.fieldPatternPredicate = ramda__WEBPACK_IMPORTED_MODULE_0__["default"];
|
|
32538
32695
|
}
|
|
32539
32696
|
ObjectElement(path) {
|
|
@@ -32545,7 +32702,7 @@ class PathsVisitor extends _bases_mjs__WEBPACK_IMPORTED_MODULE_5__.BasePatterned
|
|
|
32545
32702
|
.forEach((pathItemElement, key) => {
|
|
32546
32703
|
key.classes.push('openapi-path-template');
|
|
32547
32704
|
key.classes.push('path-template');
|
|
32548
|
-
pathItemElement.meta.set('path', (0,
|
|
32705
|
+
pathItemElement.meta.set('path', (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_2__["default"])(key));
|
|
32549
32706
|
});
|
|
32550
32707
|
}
|
|
32551
32708
|
}
|
|
@@ -33620,8 +33777,9 @@ const parse = async source => {
|
|
|
33620
33777
|
if (source.trim().length === 0) {
|
|
33621
33778
|
return parseResult;
|
|
33622
33779
|
}
|
|
33623
|
-
|
|
33780
|
+
let pojo = JSON.parse(source);
|
|
33624
33781
|
const element = (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_0__.refract)(pojo);
|
|
33782
|
+
pojo = null; // allow GC to reclaim POJO
|
|
33625
33783
|
element.classes.push('result');
|
|
33626
33784
|
parseResult.push(element);
|
|
33627
33785
|
return parseResult;
|
|
@@ -35595,7 +35753,10 @@ const parse = async (source, options = {}) => {
|
|
|
35595
35753
|
result
|
|
35596
35754
|
} = parseResultElement;
|
|
35597
35755
|
if ((0,ramda_adjunct__WEBPACK_IMPORTED_MODULE_2__["default"])(result)) {
|
|
35598
|
-
const openApiElement = (0,_speclynx_apidom_ns_openapi_3_0__WEBPACK_IMPORTED_MODULE_6__.refractOpenApi3_0)(result,
|
|
35756
|
+
const openApiElement = (0,_speclynx_apidom_ns_openapi_3_0__WEBPACK_IMPORTED_MODULE_6__.refractOpenApi3_0)(result, {
|
|
35757
|
+
consume: true,
|
|
35758
|
+
...refractorOpts
|
|
35759
|
+
});
|
|
35599
35760
|
openApiElement.classes.push('result');
|
|
35600
35761
|
parseResultElement.replaceResult(openApiElement);
|
|
35601
35762
|
}
|