@speclynx/apidom-ns-openapi-3-0 2.13.0 → 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.
- package/CHANGELOG.md +19 -0
- package/dist/apidom-ns-openapi-3-0.browser.js +287 -130
- package/dist/apidom-ns-openapi-3-0.browser.min.js +1 -1
- package/package.json +7 -7
- package/src/refractor/index.cjs +4 -2
- package/src/refractor/index.mjs +4 -2
- package/src/refractor/plugins/replace-empty-element.cjs +3 -2
- package/src/refractor/plugins/replace-empty-element.mjs +3 -2
- package/src/refractor/visitors/FallbackVisitor.cjs +1 -1
- package/src/refractor/visitors/FallbackVisitor.mjs +1 -1
- package/src/refractor/visitors/SpecificationVisitor.cjs +3 -2
- package/src/refractor/visitors/SpecificationVisitor.mjs +3 -2
- package/src/refractor/visitors/Visitor.cjs +10 -8
- package/src/refractor/visitors/Visitor.mjs +11 -9
- package/src/refractor/visitors/generics/FixedFieldsVisitor.cjs +8 -3
- package/src/refractor/visitors/generics/FixedFieldsVisitor.mjs +8 -3
- package/src/refractor/visitors/generics/PatternedFieldsVisitor.cjs +4 -2
- package/src/refractor/visitors/generics/PatternedFieldsVisitor.mjs +4 -2
- package/src/refractor/visitors/open-api-3-0/components/index.cjs +1 -0
- package/src/refractor/visitors/open-api-3-0/components/index.mjs +1 -0
- package/src/refractor/visitors/open-api-3-0/index.cjs +1 -0
- package/src/refractor/visitors/open-api-3-0/index.mjs +1 -0
- package/src/refractor/visitors/open-api-3-0/path-item/index.cjs +2 -3
- package/src/refractor/visitors/open-api-3-0/path-item/index.mjs +3 -4
- package/src/refractor/visitors/open-api-3-0/paths/index.cjs +3 -2
- package/src/refractor/visitors/open-api-3-0/paths/index.mjs +3 -2
- package/types/apidom-ns-openapi-3-0.d.ts +8 -2
|
@@ -3021,7 +3021,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
3021
3021
|
const refract = (value, {
|
|
3022
3022
|
element = 'openApi3_0',
|
|
3023
3023
|
plugins = [],
|
|
3024
|
-
specificationObj = _specification_ts__WEBPACK_IMPORTED_MODULE_5__["default"]
|
|
3024
|
+
specificationObj = _specification_ts__WEBPACK_IMPORTED_MODULE_5__["default"],
|
|
3025
|
+
consume = false
|
|
3025
3026
|
} = {}) => {
|
|
3026
3027
|
const genericElement = (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__.refract)(value);
|
|
3027
3028
|
const resolvedSpec = (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_1__.resolveSpecification)(specificationObj);
|
|
@@ -3038,7 +3039,8 @@ const refract = (value, {
|
|
|
3038
3039
|
*/
|
|
3039
3040
|
const RootVisitorClass = (0,ramda__WEBPACK_IMPORTED_MODULE_4__["default"])(specPath, resolvedSpec);
|
|
3040
3041
|
const rootVisitor = new RootVisitorClass({
|
|
3041
|
-
specObj: resolvedSpec
|
|
3042
|
+
specObj: resolvedSpec,
|
|
3043
|
+
consume
|
|
3042
3044
|
});
|
|
3043
3045
|
(0,_speclynx_apidom_traverse__WEBPACK_IMPORTED_MODULE_3__.traverse)(genericElement, rootVisitor, {
|
|
3044
3046
|
nodeTypeGetter: _speclynx_apidom_traverse__WEBPACK_IMPORTED_MODULE_3__.getNodePrimitiveType
|
|
@@ -3994,7 +3996,8 @@ const schema = {
|
|
|
3994
3996
|
};
|
|
3995
3997
|
const findElementFactory = (ancestor, keyName) => {
|
|
3996
3998
|
const elementType = (0,_speclynx_apidom_traverse__WEBPACK_IMPORTED_MODULE_8__.getNodeType)(ancestor);
|
|
3997
|
-
const
|
|
3999
|
+
const classType = ancestor.isMetaEmpty ? undefined : ancestor.classes.at(0);
|
|
4000
|
+
const keyMapping = schema[elementType] || schema[classType];
|
|
3998
4001
|
return typeof keyMapping === 'undefined' ? undefined : Object.hasOwn(keyMapping, '[key: *]') ? keyMapping['[key: *]'] : keyMapping[keyName];
|
|
3999
4002
|
};
|
|
4000
4003
|
|
|
@@ -4022,7 +4025,7 @@ const plugin = () => () => ({
|
|
|
4022
4025
|
if (typeof elementFactory !== 'function') return;
|
|
4023
4026
|
const newElement = elementFactory.call({
|
|
4024
4027
|
context
|
|
4025
|
-
}, undefined,
|
|
4028
|
+
}, undefined, element.isMetaEmpty ? undefined : element.meta.cloneDeep(), element.isAttributesEmpty ? undefined : (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.cloneDeep)(element.attributes));
|
|
4026
4029
|
_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_5__["default"].transfer(element, newElement);
|
|
4027
4030
|
_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_6__["default"].transfer(element, newElement);
|
|
4028
4031
|
path.replaceWith(newElement);
|
|
@@ -4935,7 +4938,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
4935
4938
|
*/
|
|
4936
4939
|
class FallbackVisitor extends _Visitor_ts__WEBPACK_IMPORTED_MODULE_1__["default"] {
|
|
4937
4940
|
enter(path) {
|
|
4938
|
-
this.element = (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_0__.cloneDeep)(path.node);
|
|
4941
|
+
this.element = this.consume ? path.node : (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_0__.cloneDeep)(path.node);
|
|
4939
4942
|
path.stop();
|
|
4940
4943
|
}
|
|
4941
4944
|
}
|
|
@@ -5001,8 +5004,9 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
5001
5004
|
*/
|
|
5002
5005
|
class SpecificationVisitor extends _Visitor_ts__WEBPACK_IMPORTED_MODULE_6__["default"] {
|
|
5003
5006
|
specObj;
|
|
5004
|
-
passingOptionsNames = ['specObj', 'openApiGenericElement', 'openApiSemanticElement'];
|
|
5007
|
+
passingOptionsNames = ['specObj', 'openApiGenericElement', 'sourceContext', 'openApiSemanticElement', 'consume'];
|
|
5005
5008
|
openApiGenericElement;
|
|
5009
|
+
sourceContext;
|
|
5006
5010
|
openApiSemanticElement;
|
|
5007
5011
|
constructor({
|
|
5008
5012
|
specObj,
|
|
@@ -5057,7 +5061,7 @@ class SpecificationVisitor extends _Visitor_ts__WEBPACK_IMPORTED_MODULE_6__["def
|
|
|
5057
5061
|
*/
|
|
5058
5062
|
const visitor = this.retrieveVisitorInstance(specPath, options);
|
|
5059
5063
|
if (visitor instanceof _FallbackVisitor_ts__WEBPACK_IMPORTED_MODULE_7__["default"] && visitor?.constructor === _FallbackVisitor_ts__WEBPACK_IMPORTED_MODULE_7__["default"]) {
|
|
5060
|
-
return (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_4__.cloneDeep)(element);
|
|
5064
|
+
return this.consume ? element : (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_4__.cloneDeep)(element);
|
|
5061
5065
|
}
|
|
5062
5066
|
(0,_speclynx_apidom_traverse__WEBPACK_IMPORTED_MODULE_5__.traverse)(element, visitor, {
|
|
5063
5067
|
nodeTypeGetter: _speclynx_apidom_traverse__WEBPACK_IMPORTED_MODULE_5__.getNodePrimitiveType
|
|
@@ -5077,7 +5081,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
5077
5081
|
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
5078
5082
|
/* harmony export */ });
|
|
5079
5083
|
/* harmony import */ var _speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(8400);
|
|
5080
|
-
/* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(
|
|
5084
|
+
/* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(2111);
|
|
5081
5085
|
/* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(5810);
|
|
5082
5086
|
/* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(9686);
|
|
5083
5087
|
|
|
@@ -5092,19 +5096,21 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
5092
5096
|
*/
|
|
5093
5097
|
class Visitor {
|
|
5094
5098
|
element;
|
|
5099
|
+
consume = false;
|
|
5100
|
+
consumeSafe = false;
|
|
5095
5101
|
constructor(options = {}) {
|
|
5096
5102
|
Object.assign(this, options);
|
|
5097
5103
|
}
|
|
5098
5104
|
copyMetaAndAttributes(from, to) {
|
|
5099
|
-
if (!from.isMetaEmpty
|
|
5100
|
-
|
|
5101
|
-
|
|
5102
|
-
to.meta = (
|
|
5105
|
+
if (!from.isMetaEmpty && !to.isMetaEmpty) {
|
|
5106
|
+
to.meta = to.meta.merge(from.meta);
|
|
5107
|
+
} else if (!from.isMetaEmpty) {
|
|
5108
|
+
to.meta = from.meta.cloneDeep();
|
|
5103
5109
|
}
|
|
5104
|
-
if (!from.isAttributesEmpty
|
|
5105
|
-
|
|
5106
|
-
|
|
5107
|
-
to.attributes = (0,
|
|
5110
|
+
if (!from.isAttributesEmpty && !to.isAttributesEmpty) {
|
|
5111
|
+
to.attributes = (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_0__["default"])(to.attributes, from.attributes);
|
|
5112
|
+
} else if (!from.isAttributesEmpty) {
|
|
5113
|
+
to.attributes = (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.cloneDeep)(from.attributes);
|
|
5108
5114
|
}
|
|
5109
5115
|
_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__["default"].transfer(from, to);
|
|
5110
5116
|
_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_3__["default"].transfer(from, to);
|
|
@@ -5230,15 +5236,20 @@ class FixedFieldsVisitor extends _SpecificationVisitor_ts__WEBPACK_IMPORTED_MODU
|
|
|
5230
5236
|
const keyValue = (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_3__["default"])(key);
|
|
5231
5237
|
if ((0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_0__.isStringElement)(key) && fields.includes(keyValue) && !this.ignoredFields.includes(keyValue)) {
|
|
5232
5238
|
const fixedFieldElement = this.toRefractedElement([...specPath, 'fixedFields', keyValue], value);
|
|
5233
|
-
const newMemberElement = new _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__["default"]((0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.cloneDeep)(key), fixedFieldElement);
|
|
5239
|
+
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);
|
|
5234
5240
|
this.copyMetaAndAttributes(memberElement, newMemberElement);
|
|
5235
|
-
newMemberElement.classes.push('fixed-field');
|
|
5236
5241
|
this.element.content.push(newMemberElement);
|
|
5242
|
+
// consume: release processed generic subtree
|
|
5243
|
+
if (this.consume && this.consumeSafe && !memberElement.isFrozen) memberElement.value = undefined;
|
|
5237
5244
|
} else if (this.canSupportSpecificationExtensions && this.specificationExtensionPredicate(memberElement)) {
|
|
5238
5245
|
const extensionElement = this.toRefractedElement(['document', 'extension'], memberElement);
|
|
5239
5246
|
this.element.content.push(extensionElement);
|
|
5247
|
+
// consume: release processed generic subtree
|
|
5248
|
+
if (this.consume && this.consumeSafe && !memberElement.isFrozen) {
|
|
5249
|
+
memberElement.value = undefined;
|
|
5250
|
+
}
|
|
5240
5251
|
} else if (!this.ignoredFields.includes(keyValue)) {
|
|
5241
|
-
this.element.content.push((0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.cloneDeep)(memberElement));
|
|
5252
|
+
this.element.content.push(this.consume ? memberElement : (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.cloneDeep)(memberElement));
|
|
5242
5253
|
}
|
|
5243
5254
|
});
|
|
5244
5255
|
this.copyMetaAndAttributes(objectElement, this.element);
|
|
@@ -5423,12 +5434,14 @@ class PatternedFieldsVisitor extends _SpecificationVisitor_ts__WEBPACK_IMPORTED_
|
|
|
5423
5434
|
} else if (!this.ignoredFields.includes(keyValue) && this.fieldPatternPredicate(keyValue)) {
|
|
5424
5435
|
const specPath = this.specPath(value);
|
|
5425
5436
|
const patternedFieldElement = this.toRefractedElement(specPath, value);
|
|
5426
|
-
const newMemberElement = new _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__["default"]((0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.cloneDeep)(key), patternedFieldElement);
|
|
5437
|
+
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);
|
|
5427
5438
|
this.copyMetaAndAttributes(memberElement, newMemberElement);
|
|
5428
5439
|
newMemberElement.classes.push('patterned-field');
|
|
5429
5440
|
this.element.content.push(newMemberElement);
|
|
5441
|
+
// consume: release processed generic subtree
|
|
5442
|
+
if (this.consume && this.consumeSafe && !memberElement.isFrozen) memberElement.value = undefined;
|
|
5430
5443
|
} else if (!this.ignoredFields.includes(keyValue)) {
|
|
5431
|
-
this.element.content.push((0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.cloneDeep)(memberElement));
|
|
5444
|
+
this.element.content.push(this.consume ? memberElement : (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.cloneDeep)(memberElement));
|
|
5432
5445
|
}
|
|
5433
5446
|
});
|
|
5434
5447
|
this.copyMetaAndAttributes(objectElement, this.element);
|
|
@@ -6309,6 +6322,7 @@ class ComponentsVisitor extends _bases_ts__WEBPACK_IMPORTED_MODULE_2__.BaseFixed
|
|
|
6309
6322
|
this.element = new _elements_Components_ts__WEBPACK_IMPORTED_MODULE_1__["default"]();
|
|
6310
6323
|
this.specPath = (0,ramda__WEBPACK_IMPORTED_MODULE_0__["default"])(['document', 'objects', 'Components']);
|
|
6311
6324
|
this.canSupportSpecificationExtensions = true;
|
|
6325
|
+
this.consumeSafe = true;
|
|
6312
6326
|
}
|
|
6313
6327
|
}
|
|
6314
6328
|
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (ComponentsVisitor);
|
|
@@ -6740,6 +6754,7 @@ class OpenApi3_0Visitor extends _bases_ts__WEBPACK_IMPORTED_MODULE_1__.BaseFixed
|
|
|
6740
6754
|
this.element = new _elements_OpenApi3_0_ts__WEBPACK_IMPORTED_MODULE_2__["default"]();
|
|
6741
6755
|
this.specPath = (0,ramda__WEBPACK_IMPORTED_MODULE_0__["default"])(['document', 'objects', 'OpenApi']);
|
|
6742
6756
|
this.canSupportSpecificationExtensions = true;
|
|
6757
|
+
this.consumeSafe = true;
|
|
6743
6758
|
}
|
|
6744
6759
|
ObjectElement(path) {
|
|
6745
6760
|
_bases_ts__WEBPACK_IMPORTED_MODULE_1__.BaseFixedFieldsVisitor.prototype.ObjectElement.call(this, path);
|
|
@@ -7615,11 +7630,10 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
7615
7630
|
/* harmony export */ });
|
|
7616
7631
|
/* harmony import */ var ramda__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(9498);
|
|
7617
7632
|
/* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(5162);
|
|
7618
|
-
/* harmony import */ var
|
|
7619
|
-
/* harmony import */ var
|
|
7620
|
-
/* harmony import */ var
|
|
7621
|
-
/* harmony import */ var
|
|
7622
|
-
/* harmony import */ var _bases_ts__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(4427);
|
|
7633
|
+
/* harmony import */ var _speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(4673);
|
|
7634
|
+
/* harmony import */ var _elements_PathItem_ts__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(6253);
|
|
7635
|
+
/* harmony import */ var _predicates_ts__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(7269);
|
|
7636
|
+
/* harmony import */ var _bases_ts__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(4427);
|
|
7623
7637
|
|
|
7624
7638
|
|
|
7625
7639
|
|
|
@@ -7634,22 +7648,21 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
7634
7648
|
/**
|
|
7635
7649
|
* @public
|
|
7636
7650
|
*/
|
|
7637
|
-
class PathItemVisitor extends
|
|
7651
|
+
class PathItemVisitor extends _bases_ts__WEBPACK_IMPORTED_MODULE_5__.BaseFixedFieldsVisitor {
|
|
7638
7652
|
constructor(options) {
|
|
7639
7653
|
super(options);
|
|
7640
|
-
this.element = new
|
|
7654
|
+
this.element = new _elements_PathItem_ts__WEBPACK_IMPORTED_MODULE_3__["default"]();
|
|
7641
7655
|
this.specPath = (0,ramda__WEBPACK_IMPORTED_MODULE_0__["default"])(['document', 'objects', 'PathItem']);
|
|
7656
|
+
this.consumeSafe = true;
|
|
7642
7657
|
}
|
|
7643
7658
|
ObjectElement(path) {
|
|
7644
|
-
|
|
7659
|
+
_bases_ts__WEBPACK_IMPORTED_MODULE_5__.BaseFixedFieldsVisitor.prototype.ObjectElement.call(this, path);
|
|
7645
7660
|
|
|
7646
7661
|
// decorate Operation elements with HTTP method
|
|
7647
|
-
this.element.filter(
|
|
7662
|
+
this.element.filter(_predicates_ts__WEBPACK_IMPORTED_MODULE_4__.isOperationElement)
|
|
7648
7663
|
// @ts-ignore
|
|
7649
7664
|
.forEach((operationElement, httpMethodElementCI) => {
|
|
7650
|
-
|
|
7651
|
-
httpMethodElementCS.content = (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_3__["default"])(httpMethodElementCS).toUpperCase();
|
|
7652
|
-
operationElement.meta.set('http-method', httpMethodElementCS);
|
|
7665
|
+
operationElement.meta.set('http-method', (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_2__["default"])(httpMethodElementCI).toUpperCase());
|
|
7653
7666
|
});
|
|
7654
7667
|
|
|
7655
7668
|
// mark this PathItemElement with reference metadata
|
|
@@ -7671,7 +7684,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
7671
7684
|
/* harmony export */ });
|
|
7672
7685
|
/* harmony import */ var ramda__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(3679);
|
|
7673
7686
|
/* harmony import */ var ramda__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(9498);
|
|
7674
|
-
/* harmony import */ var
|
|
7687
|
+
/* harmony import */ var _speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(4673);
|
|
7675
7688
|
/* harmony import */ var _elements_Paths_ts__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(5001);
|
|
7676
7689
|
/* harmony import */ var _predicates_ts__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(7269);
|
|
7677
7690
|
/* harmony import */ var _bases_ts__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(4427);
|
|
@@ -7694,6 +7707,7 @@ class PathsVisitor extends _bases_ts__WEBPACK_IMPORTED_MODULE_5__.BasePatternedF
|
|
|
7694
7707
|
this.element = new _elements_Paths_ts__WEBPACK_IMPORTED_MODULE_3__["default"]();
|
|
7695
7708
|
this.specPath = (0,ramda__WEBPACK_IMPORTED_MODULE_1__["default"])(['document', 'objects', 'PathItem']);
|
|
7696
7709
|
this.canSupportSpecificationExtensions = true;
|
|
7710
|
+
this.consumeSafe = true;
|
|
7697
7711
|
this.fieldPatternPredicate = ramda__WEBPACK_IMPORTED_MODULE_0__["default"];
|
|
7698
7712
|
}
|
|
7699
7713
|
ObjectElement(path) {
|
|
@@ -7705,7 +7719,7 @@ class PathsVisitor extends _bases_ts__WEBPACK_IMPORTED_MODULE_5__.BasePatternedF
|
|
|
7705
7719
|
.forEach((pathItemElement, key) => {
|
|
7706
7720
|
key.classes.push('openapi-path-template');
|
|
7707
7721
|
key.classes.push('path-template');
|
|
7708
|
-
pathItemElement.meta.set('path', (0,
|
|
7722
|
+
pathItemElement.meta.set('path', (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_2__["default"])(key));
|
|
7709
7723
|
});
|
|
7710
7724
|
}
|
|
7711
7725
|
}
|
|
@@ -24262,7 +24276,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
24262
24276
|
* @public
|
|
24263
24277
|
*/
|
|
24264
24278
|
const emptyElement = element => {
|
|
24265
|
-
const meta = !element.isMetaEmpty ?
|
|
24279
|
+
const meta = !element.isMetaEmpty ? element.meta.cloneDeep() : undefined;
|
|
24266
24280
|
const attributes = !element.isAttributesEmpty ? (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.cloneDeep)(element.attributes) : undefined;
|
|
24267
24281
|
|
|
24268
24282
|
// @ts-ignore
|
|
@@ -24278,7 +24292,7 @@ const getMergeFunction = (keyElement, options) => {
|
|
|
24278
24292
|
};
|
|
24279
24293
|
const getMetaMergeFunction = options => {
|
|
24280
24294
|
if (typeof options.customMetaMerge !== 'function') {
|
|
24281
|
-
return targetMeta =>
|
|
24295
|
+
return targetMeta => targetMeta.cloneDeep();
|
|
24282
24296
|
}
|
|
24283
24297
|
return options.customMetaMerge;
|
|
24284
24298
|
};
|
|
@@ -24350,8 +24364,20 @@ const deepmerge = (targetElement, sourceElement, options) => {
|
|
|
24350
24364
|
const mergedElement = sourceIsArrayElement && typeof mergedOptions.arrayElementMerge === 'function' ? mergedOptions.arrayElementMerge(targetElement, sourceElement, mergedOptions) : mergedOptions.objectElementMerge(targetElement, sourceElement, mergedOptions);
|
|
24351
24365
|
|
|
24352
24366
|
// merging meta & attributes
|
|
24353
|
-
|
|
24354
|
-
|
|
24367
|
+
if (!targetElement.isMetaEmpty && !sourceElement.isMetaEmpty) {
|
|
24368
|
+
mergedElement.meta = getMetaMergeFunction(mergedOptions)(targetElement.meta, sourceElement.meta);
|
|
24369
|
+
} else if (!targetElement.isMetaEmpty) {
|
|
24370
|
+
mergedElement.meta = targetElement.meta.cloneDeep();
|
|
24371
|
+
} else if (!sourceElement.isMetaEmpty) {
|
|
24372
|
+
mergedElement.meta = sourceElement.meta.cloneDeep();
|
|
24373
|
+
}
|
|
24374
|
+
if (!targetElement.isAttributesEmpty && !sourceElement.isAttributesEmpty) {
|
|
24375
|
+
mergedElement.attributes = getAttributesMergeFunction(mergedOptions)(targetElement.attributes, sourceElement.attributes);
|
|
24376
|
+
} else if (!targetElement.isAttributesEmpty) {
|
|
24377
|
+
mergedElement.attributes = (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.cloneDeep)(targetElement.attributes);
|
|
24378
|
+
} else if (!sourceElement.isAttributesEmpty) {
|
|
24379
|
+
mergedElement.attributes = (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.cloneDeep)(sourceElement.attributes);
|
|
24380
|
+
}
|
|
24355
24381
|
return mergedElement;
|
|
24356
24382
|
};
|
|
24357
24383
|
deepmerge.all = (list, options) => {
|
|
@@ -24684,6 +24710,104 @@ class KeyValuePair {
|
|
|
24684
24710
|
|
|
24685
24711
|
/***/ },
|
|
24686
24712
|
|
|
24713
|
+
/***/ 1844
|
|
24714
|
+
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
24715
|
+
|
|
24716
|
+
__webpack_require__.r(__webpack_exports__);
|
|
24717
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
24718
|
+
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
24719
|
+
/* harmony export */ });
|
|
24720
|
+
/* harmony import */ var ramda__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(8138);
|
|
24721
|
+
|
|
24722
|
+
/**
|
|
24723
|
+
* Lightweight meta container for Element metadata.
|
|
24724
|
+
*
|
|
24725
|
+
* Data is stored as own properties on the instance; methods live on the prototype.
|
|
24726
|
+
* `Object.keys()`, `Object.entries()`, etc. only see data properties.
|
|
24727
|
+
*
|
|
24728
|
+
* @public
|
|
24729
|
+
*/
|
|
24730
|
+
class Metadata {
|
|
24731
|
+
// Set via prototype assignment in registration.ts to avoid circular dependency
|
|
24732
|
+
|
|
24733
|
+
get(name) {
|
|
24734
|
+
return this[name];
|
|
24735
|
+
}
|
|
24736
|
+
set(name, value) {
|
|
24737
|
+
this[name] = value;
|
|
24738
|
+
}
|
|
24739
|
+
hasKey(name) {
|
|
24740
|
+
return Object.hasOwn(this, name);
|
|
24741
|
+
}
|
|
24742
|
+
keys() {
|
|
24743
|
+
return Object.keys(this);
|
|
24744
|
+
}
|
|
24745
|
+
remove(name) {
|
|
24746
|
+
delete this[name];
|
|
24747
|
+
}
|
|
24748
|
+
get isEmpty() {
|
|
24749
|
+
return Object.keys(this).length === 0;
|
|
24750
|
+
}
|
|
24751
|
+
get isFrozen() {
|
|
24752
|
+
return Object.isFrozen(this);
|
|
24753
|
+
}
|
|
24754
|
+
freeze() {
|
|
24755
|
+
for (const value of Object.values(this)) {
|
|
24756
|
+
if (value instanceof this.Element) {
|
|
24757
|
+
value.freeze();
|
|
24758
|
+
} else if (Array.isArray(value) || value !== null && typeof value === 'object') {
|
|
24759
|
+
Object.freeze(value);
|
|
24760
|
+
}
|
|
24761
|
+
}
|
|
24762
|
+
Object.freeze(this);
|
|
24763
|
+
}
|
|
24764
|
+
|
|
24765
|
+
/**
|
|
24766
|
+
* Creates a shallow clone. Same references, new container.
|
|
24767
|
+
*/
|
|
24768
|
+
cloneShallow() {
|
|
24769
|
+
const clone = new Metadata();
|
|
24770
|
+
Object.assign(clone, this);
|
|
24771
|
+
return clone;
|
|
24772
|
+
}
|
|
24773
|
+
|
|
24774
|
+
/**
|
|
24775
|
+
* Merges another Metadata into a new instance.
|
|
24776
|
+
* Arrays are concatenated, all other values are overwritten by source.
|
|
24777
|
+
*/
|
|
24778
|
+
merge(source) {
|
|
24779
|
+
const result = this.cloneShallow();
|
|
24780
|
+
for (const [key, value] of Object.entries(source)) {
|
|
24781
|
+
const existing = result.get(key);
|
|
24782
|
+
if (Array.isArray(existing) && Array.isArray(value)) {
|
|
24783
|
+
result.set(key, [...existing, ...value]);
|
|
24784
|
+
} else {
|
|
24785
|
+
result.set(key, value);
|
|
24786
|
+
}
|
|
24787
|
+
}
|
|
24788
|
+
return result;
|
|
24789
|
+
}
|
|
24790
|
+
|
|
24791
|
+
/**
|
|
24792
|
+
* Creates a deep clone. Elements are deep cloned,
|
|
24793
|
+
* all other values are deep cloned via ramda clone.
|
|
24794
|
+
*/
|
|
24795
|
+
cloneDeep() {
|
|
24796
|
+
const copy = new Metadata();
|
|
24797
|
+
for (const [key, value] of Object.entries(this)) {
|
|
24798
|
+
if (value instanceof this.Element) {
|
|
24799
|
+
copy.set(key, this.cloneDeepElement(value));
|
|
24800
|
+
} else {
|
|
24801
|
+
copy.set(key, (0,ramda__WEBPACK_IMPORTED_MODULE_0__["default"])(value));
|
|
24802
|
+
}
|
|
24803
|
+
}
|
|
24804
|
+
return copy;
|
|
24805
|
+
}
|
|
24806
|
+
}
|
|
24807
|
+
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Metadata);
|
|
24808
|
+
|
|
24809
|
+
/***/ },
|
|
24810
|
+
|
|
24687
24811
|
/***/ 5156
|
|
24688
24812
|
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
24689
24813
|
|
|
@@ -25324,7 +25448,7 @@ const cloneShallowElement = element => {
|
|
|
25324
25448
|
const copy = new Ctor();
|
|
25325
25449
|
copy.element = element.element;
|
|
25326
25450
|
if (!element.isMetaEmpty) {
|
|
25327
|
-
copy.meta =
|
|
25451
|
+
copy.meta = element.meta.cloneDeep();
|
|
25328
25452
|
}
|
|
25329
25453
|
if (!element.isAttributesEmpty) {
|
|
25330
25454
|
copy.attributes = cloneDeep(element.attributes);
|
|
@@ -25352,8 +25476,8 @@ const cloneShallowElement = element => {
|
|
|
25352
25476
|
|
|
25353
25477
|
/**
|
|
25354
25478
|
* Creates a shallow clone of an ApiDOM Element, KeyValuePair, or ObjectSlice.
|
|
25355
|
-
* The element itself is cloned, but content references are shared
|
|
25356
|
-
*
|
|
25479
|
+
* The element itself is cloned, but content references are shared.
|
|
25480
|
+
* Meta and attributes are deep cloned to preserve semantic information.
|
|
25357
25481
|
* @public
|
|
25358
25482
|
*/
|
|
25359
25483
|
const cloneShallow = value => {
|
|
@@ -26415,7 +26539,7 @@ class CollectionElement extends _Element_mjs__WEBPACK_IMPORTED_MODULE_0__["defau
|
|
|
26415
26539
|
* Search the tree recursively and find the element with the matching ID.
|
|
26416
26540
|
*/
|
|
26417
26541
|
getById(id) {
|
|
26418
|
-
return this.find(item => item.id
|
|
26542
|
+
return this.find(item => item.id === id).first;
|
|
26419
26543
|
}
|
|
26420
26544
|
|
|
26421
26545
|
/**
|
|
@@ -26444,18 +26568,24 @@ class CollectionElement extends _Element_mjs__WEBPACK_IMPORTED_MODULE_0__["defau
|
|
|
26444
26568
|
|
|
26445
26569
|
__webpack_require__.r(__webpack_exports__);
|
|
26446
26570
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
26571
|
+
/* harmony export */ Metadata: () => (/* reexport safe */ _Metadata_mjs__WEBPACK_IMPORTED_MODULE_1__["default"]),
|
|
26447
26572
|
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
26448
26573
|
/* harmony export */ });
|
|
26449
26574
|
/* harmony import */ var ramda__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(3654);
|
|
26450
|
-
/* harmony import */ var
|
|
26451
|
-
/* harmony import */ var
|
|
26575
|
+
/* harmony import */ var _Metadata_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(1844);
|
|
26576
|
+
/* harmony import */ var _KeyValuePair_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(6663);
|
|
26577
|
+
/* harmony import */ var _ObjectSlice_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(8504);
|
|
26578
|
+
|
|
26452
26579
|
|
|
26453
26580
|
|
|
26581
|
+
// shared singleton for frozen elements with no meta — avoids allocation on every access
|
|
26582
|
+
const FROZEN_EMPTY_METADATA = Object.freeze(new _Metadata_mjs__WEBPACK_IMPORTED_MODULE_1__["default"]());
|
|
26454
26583
|
|
|
26455
26584
|
/**
|
|
26456
26585
|
* Valid content types for an Element.
|
|
26457
26586
|
* @public
|
|
26458
26587
|
*/
|
|
26588
|
+
|
|
26459
26589
|
/**
|
|
26460
26590
|
* Base Element class that all ApiDOM elements extend.
|
|
26461
26591
|
*
|
|
@@ -26553,7 +26683,7 @@ class Element {
|
|
|
26553
26683
|
_attributes;
|
|
26554
26684
|
|
|
26555
26685
|
// ============================================================
|
|
26556
|
-
// Prototype-assigned properties (set in
|
|
26686
|
+
// Prototype-assigned properties (set in registration.ts)
|
|
26557
26687
|
// Using 'declare' allows TypeScript to know about these
|
|
26558
26688
|
// without generating runtime code.
|
|
26559
26689
|
// ============================================================
|
|
@@ -26614,13 +26744,13 @@ class Element {
|
|
|
26614
26744
|
}
|
|
26615
26745
|
|
|
26616
26746
|
// KeyValuePair
|
|
26617
|
-
if (value instanceof
|
|
26747
|
+
if (value instanceof _KeyValuePair_mjs__WEBPACK_IMPORTED_MODULE_2__["default"]) {
|
|
26618
26748
|
this._content = value;
|
|
26619
26749
|
return;
|
|
26620
26750
|
}
|
|
26621
26751
|
|
|
26622
26752
|
// ObjectSlice - extract elements array
|
|
26623
|
-
if (value instanceof
|
|
26753
|
+
if (value instanceof _ObjectSlice_mjs__WEBPACK_IMPORTED_MODULE_3__["default"]) {
|
|
26624
26754
|
this._content = value.elements;
|
|
26625
26755
|
return;
|
|
26626
26756
|
}
|
|
@@ -26641,24 +26771,22 @@ class Element {
|
|
|
26641
26771
|
|
|
26642
26772
|
/**
|
|
26643
26773
|
* Metadata about this element (id, classes, title, description, links).
|
|
26644
|
-
* Lazily creates
|
|
26774
|
+
* Lazily creates a Metadata instance if not set.
|
|
26645
26775
|
*/
|
|
26646
26776
|
get meta() {
|
|
26647
26777
|
if (!this._meta) {
|
|
26648
|
-
if (this.isFrozen)
|
|
26649
|
-
|
|
26650
|
-
meta.freeze();
|
|
26651
|
-
return meta;
|
|
26652
|
-
}
|
|
26653
|
-
this._meta = new this.ObjectElement();
|
|
26778
|
+
if (this.isFrozen) return FROZEN_EMPTY_METADATA;
|
|
26779
|
+
this._meta = new _Metadata_mjs__WEBPACK_IMPORTED_MODULE_1__["default"]();
|
|
26654
26780
|
}
|
|
26655
26781
|
return this._meta;
|
|
26656
26782
|
}
|
|
26657
26783
|
set meta(value) {
|
|
26658
|
-
if (value instanceof
|
|
26784
|
+
if (value instanceof _Metadata_mjs__WEBPACK_IMPORTED_MODULE_1__["default"]) {
|
|
26659
26785
|
this._meta = value;
|
|
26660
|
-
} else {
|
|
26661
|
-
|
|
26786
|
+
} else if (value && typeof value === 'object') {
|
|
26787
|
+
const meta = new _Metadata_mjs__WEBPACK_IMPORTED_MODULE_1__["default"]();
|
|
26788
|
+
Object.assign(meta, value);
|
|
26789
|
+
this._meta = meta;
|
|
26662
26790
|
}
|
|
26663
26791
|
}
|
|
26664
26792
|
|
|
@@ -26691,10 +26819,8 @@ class Element {
|
|
|
26691
26819
|
|
|
26692
26820
|
/** Unique identifier for this element. */
|
|
26693
26821
|
get id() {
|
|
26694
|
-
if (this.isFrozen) {
|
|
26695
|
-
return this.getMetaProperty('id', '');
|
|
26696
|
-
}
|
|
26697
26822
|
if (!this.hasMetaProperty('id')) {
|
|
26823
|
+
if (this.isFrozen) return '';
|
|
26698
26824
|
this.setMetaProperty('id', '');
|
|
26699
26825
|
}
|
|
26700
26826
|
return this.meta.get('id');
|
|
@@ -26705,10 +26831,8 @@ class Element {
|
|
|
26705
26831
|
|
|
26706
26832
|
/** CSS-like class names. */
|
|
26707
26833
|
get classes() {
|
|
26708
|
-
if (this.isFrozen) {
|
|
26709
|
-
return this.getMetaProperty('classes', []);
|
|
26710
|
-
}
|
|
26711
26834
|
if (!this.hasMetaProperty('classes')) {
|
|
26835
|
+
if (this.isFrozen) return [];
|
|
26712
26836
|
this.setMetaProperty('classes', []);
|
|
26713
26837
|
}
|
|
26714
26838
|
return this.meta.get('classes');
|
|
@@ -26719,11 +26843,13 @@ class Element {
|
|
|
26719
26843
|
|
|
26720
26844
|
/** Hyperlinks associated with this element. */
|
|
26721
26845
|
get links() {
|
|
26722
|
-
if (this.isFrozen) {
|
|
26723
|
-
return this.getMetaProperty('links', []);
|
|
26724
|
-
}
|
|
26725
26846
|
if (!this.hasMetaProperty('links')) {
|
|
26726
|
-
this.
|
|
26847
|
+
if (this.isFrozen) {
|
|
26848
|
+
const empty = new this.ArrayElement();
|
|
26849
|
+
empty.freeze();
|
|
26850
|
+
return empty;
|
|
26851
|
+
}
|
|
26852
|
+
this.setMetaProperty('links', new this.ArrayElement());
|
|
26727
26853
|
}
|
|
26728
26854
|
return this.meta.get('links');
|
|
26729
26855
|
}
|
|
@@ -26743,7 +26869,7 @@ class Element {
|
|
|
26743
26869
|
if (Array.isArray(content)) {
|
|
26744
26870
|
return content;
|
|
26745
26871
|
}
|
|
26746
|
-
if (content instanceof
|
|
26872
|
+
if (content instanceof _KeyValuePair_mjs__WEBPACK_IMPORTED_MODULE_2__["default"]) {
|
|
26747
26873
|
const children = [];
|
|
26748
26874
|
if (content.key) children.push(content.key);
|
|
26749
26875
|
if (content.value) children.push(content.value);
|
|
@@ -26773,7 +26899,6 @@ class Element {
|
|
|
26773
26899
|
|
|
26774
26900
|
// Freeze meta and attributes
|
|
26775
26901
|
if (this._meta) {
|
|
26776
|
-
this._meta.parent = this;
|
|
26777
26902
|
this._meta.freeze();
|
|
26778
26903
|
}
|
|
26779
26904
|
if (this._attributes) {
|
|
@@ -26808,7 +26933,7 @@ class Element {
|
|
|
26808
26933
|
if (_content instanceof Element) {
|
|
26809
26934
|
return _content.toValue();
|
|
26810
26935
|
}
|
|
26811
|
-
if (_content instanceof
|
|
26936
|
+
if (_content instanceof _KeyValuePair_mjs__WEBPACK_IMPORTED_MODULE_2__["default"]) {
|
|
26812
26937
|
return _content.toValue();
|
|
26813
26938
|
}
|
|
26814
26939
|
if (Array.isArray(_content)) {
|
|
@@ -26864,7 +26989,7 @@ class Element {
|
|
|
26864
26989
|
* @throws Error if this element has no ID
|
|
26865
26990
|
*/
|
|
26866
26991
|
toRef(path) {
|
|
26867
|
-
const idValue = this.id
|
|
26992
|
+
const idValue = this.id;
|
|
26868
26993
|
if (idValue === '') {
|
|
26869
26994
|
throw new Error('Cannot create reference to an element without an ID');
|
|
26870
26995
|
}
|
|
@@ -26876,26 +27001,16 @@ class Element {
|
|
|
26876
27001
|
}
|
|
26877
27002
|
|
|
26878
27003
|
/**
|
|
26879
|
-
* Gets a meta property.
|
|
27004
|
+
* Gets a meta property value.
|
|
26880
27005
|
*
|
|
26881
27006
|
* When the property doesn't exist:
|
|
26882
|
-
* - With defaultValue: returns
|
|
27007
|
+
* - With defaultValue: returns the provided default value
|
|
26883
27008
|
* - Without defaultValue: returns undefined
|
|
26884
|
-
*
|
|
26885
|
-
* Note: Each call with a default creates a new instance. Use setMetaProperty
|
|
26886
|
-
* first if you need reference equality across multiple accesses.
|
|
26887
27009
|
*/
|
|
26888
27010
|
|
|
26889
27011
|
getMetaProperty(name, defaultValue) {
|
|
26890
27012
|
if (!this.hasMetaProperty(name)) {
|
|
26891
|
-
|
|
26892
|
-
return undefined;
|
|
26893
|
-
}
|
|
26894
|
-
const element = this.refract(defaultValue);
|
|
26895
|
-
if (element && this.isFrozen) {
|
|
26896
|
-
element.freeze();
|
|
26897
|
-
}
|
|
26898
|
-
return element;
|
|
27013
|
+
return defaultValue;
|
|
26899
27014
|
}
|
|
26900
27015
|
return this.meta.get(name);
|
|
26901
27016
|
}
|
|
@@ -26908,20 +27023,17 @@ class Element {
|
|
|
26908
27023
|
}
|
|
26909
27024
|
|
|
26910
27025
|
/**
|
|
26911
|
-
*
|
|
27026
|
+
* Checks whether a meta property exists.
|
|
26912
27027
|
*/
|
|
26913
27028
|
hasMetaProperty(name) {
|
|
26914
|
-
|
|
26915
|
-
return this.meta.hasKey(name);
|
|
26916
|
-
}
|
|
26917
|
-
return false;
|
|
27029
|
+
return this._meta !== undefined && this._meta.hasKey(name);
|
|
26918
27030
|
}
|
|
26919
27031
|
|
|
26920
27032
|
/**
|
|
26921
27033
|
* Checks if meta is empty.
|
|
26922
27034
|
*/
|
|
26923
27035
|
get isMetaEmpty() {
|
|
26924
|
-
return this._meta === undefined || this.
|
|
27036
|
+
return this._meta === undefined || this._meta.isEmpty;
|
|
26925
27037
|
}
|
|
26926
27038
|
|
|
26927
27039
|
/**
|
|
@@ -26947,7 +27059,7 @@ class Element {
|
|
|
26947
27059
|
}
|
|
26948
27060
|
|
|
26949
27061
|
/**
|
|
26950
|
-
*
|
|
27062
|
+
* Checks whether an attributes property exists.
|
|
26951
27063
|
*/
|
|
26952
27064
|
hasAttributesProperty(name) {
|
|
26953
27065
|
if (!this.isAttributesEmpty) {
|
|
@@ -26966,6 +27078,7 @@ class Element {
|
|
|
26966
27078
|
|
|
26967
27079
|
// Re-export types for convenience
|
|
26968
27080
|
|
|
27081
|
+
|
|
26969
27082
|
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Element);
|
|
26970
27083
|
|
|
26971
27084
|
/***/ },
|
|
@@ -27398,6 +27511,10 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
27398
27511
|
/* harmony import */ var _elements_Style_mjs__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(9686);
|
|
27399
27512
|
/* harmony import */ var _ObjectSlice_mjs__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(8504);
|
|
27400
27513
|
/* harmony import */ var _KeyValuePair_mjs__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(6663);
|
|
27514
|
+
/* harmony import */ var _Metadata_mjs__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(1844);
|
|
27515
|
+
/* harmony import */ var _clone_index_mjs__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(2111);
|
|
27516
|
+
|
|
27517
|
+
|
|
27401
27518
|
|
|
27402
27519
|
|
|
27403
27520
|
|
|
@@ -27457,14 +27574,16 @@ function refract(value) {
|
|
|
27457
27574
|
}
|
|
27458
27575
|
|
|
27459
27576
|
// Set up prototype assignments for circular dependency resolution.
|
|
27460
|
-
// These allow Element instances to
|
|
27461
|
-
//
|
|
27577
|
+
// These allow Element and Metadata instances to reference classes they can't import
|
|
27578
|
+
// directly (which would cause circular imports).
|
|
27462
27579
|
// Using 'declare' in the class definitions enables type-safe access to these properties.
|
|
27463
27580
|
_primitives_Element_mjs__WEBPACK_IMPORTED_MODULE_0__["default"].prototype.ObjectElement = _primitives_ObjectElement_mjs__WEBPACK_IMPORTED_MODULE_8__["default"];
|
|
27464
27581
|
_primitives_Element_mjs__WEBPACK_IMPORTED_MODULE_0__["default"].prototype.ArrayElement = _primitives_ArrayElement_mjs__WEBPACK_IMPORTED_MODULE_6__["default"];
|
|
27465
27582
|
_primitives_Element_mjs__WEBPACK_IMPORTED_MODULE_0__["default"].prototype.RefElement = _elements_RefElement_mjs__WEBPACK_IMPORTED_MODULE_10__["default"];
|
|
27466
27583
|
_primitives_Element_mjs__WEBPACK_IMPORTED_MODULE_0__["default"].prototype.MemberElement = _primitives_MemberElement_mjs__WEBPACK_IMPORTED_MODULE_7__["default"];
|
|
27467
27584
|
_primitives_Element_mjs__WEBPACK_IMPORTED_MODULE_0__["default"].prototype.refract = refract;
|
|
27585
|
+
_Metadata_mjs__WEBPACK_IMPORTED_MODULE_18__["default"].prototype.Element = _primitives_Element_mjs__WEBPACK_IMPORTED_MODULE_0__["default"];
|
|
27586
|
+
_Metadata_mjs__WEBPACK_IMPORTED_MODULE_18__["default"].prototype.cloneDeepElement = element => (0,_clone_index_mjs__WEBPACK_IMPORTED_MODULE_19__.cloneDeep)(element);
|
|
27468
27587
|
|
|
27469
27588
|
/**
|
|
27470
27589
|
* Contains all of the element classes, and related structures and methods
|
|
@@ -27528,7 +27647,13 @@ class JSONSerialiser {
|
|
|
27528
27647
|
element: element.element
|
|
27529
27648
|
};
|
|
27530
27649
|
if (!element.isMetaEmpty) {
|
|
27531
|
-
|
|
27650
|
+
const serialisedMeta = this.serialiseMeta(element);
|
|
27651
|
+
if (serialisedMeta) {
|
|
27652
|
+
payload.meta = serialisedMeta.meta;
|
|
27653
|
+
if (serialisedMeta.rawKeys.length > 0) {
|
|
27654
|
+
payload.__meta_raw__ = serialisedMeta.rawKeys;
|
|
27655
|
+
}
|
|
27656
|
+
}
|
|
27532
27657
|
}
|
|
27533
27658
|
if (!element.isAttributesEmpty) {
|
|
27534
27659
|
payload.attributes = this.serialiseObject(element.attributes);
|
|
@@ -27575,7 +27700,7 @@ class JSONSerialiser {
|
|
|
27575
27700
|
element.element = value.element;
|
|
27576
27701
|
}
|
|
27577
27702
|
|
|
27578
|
-
// Extract
|
|
27703
|
+
// Extract special meta keys without mutating input, filter remaining meta
|
|
27579
27704
|
let mappingsDoc;
|
|
27580
27705
|
let stylesDoc;
|
|
27581
27706
|
let metaToDeserialize = value.meta;
|
|
@@ -27589,8 +27714,15 @@ class JSONSerialiser {
|
|
|
27589
27714
|
stylesDoc = __styles__;
|
|
27590
27715
|
metaToDeserialize = Object.keys(rest).length > 0 ? rest : undefined;
|
|
27591
27716
|
}
|
|
27717
|
+
|
|
27718
|
+
// determine which meta keys were raw primitives before serialization
|
|
27719
|
+
const rawKeys = value.__meta_raw__ ? new Set(value.__meta_raw__) : undefined;
|
|
27592
27720
|
if (metaToDeserialize) {
|
|
27593
|
-
|
|
27721
|
+
for (const [key, doc] of Object.entries(metaToDeserialize)) {
|
|
27722
|
+
const deserialized = this.deserialise(doc);
|
|
27723
|
+
// unwrap keys that were raw primitives before serialization
|
|
27724
|
+
element.setMetaProperty(key, rawKeys?.has(key) ? deserialized.toValue() : deserialized);
|
|
27725
|
+
}
|
|
27594
27726
|
}
|
|
27595
27727
|
|
|
27596
27728
|
// Restore source position from __mappings__
|
|
@@ -27653,6 +27785,27 @@ class JSONSerialiser {
|
|
|
27653
27785
|
}
|
|
27654
27786
|
return content;
|
|
27655
27787
|
}
|
|
27788
|
+
serialiseMeta(element) {
|
|
27789
|
+
const meta = {};
|
|
27790
|
+
const rawKeys = [];
|
|
27791
|
+
let hasEntries = false;
|
|
27792
|
+
for (const [key, value] of Object.entries(element.meta)) {
|
|
27793
|
+
if (value instanceof this.namespace.elements.Element) {
|
|
27794
|
+
meta[key] = this.serialise(value);
|
|
27795
|
+
hasEntries = true;
|
|
27796
|
+
} else if (value !== undefined) {
|
|
27797
|
+
// refract primitives to maintain JSON Refract spec compatibility
|
|
27798
|
+
const refracted = element.refract(value);
|
|
27799
|
+
meta[key] = this.serialise(refracted);
|
|
27800
|
+
rawKeys.push(key);
|
|
27801
|
+
hasEntries = true;
|
|
27802
|
+
}
|
|
27803
|
+
}
|
|
27804
|
+
return hasEntries ? {
|
|
27805
|
+
meta,
|
|
27806
|
+
rawKeys
|
|
27807
|
+
} : undefined;
|
|
27808
|
+
}
|
|
27656
27809
|
serialiseObject(obj) {
|
|
27657
27810
|
const result = {};
|
|
27658
27811
|
obj.forEach((value, key) => {
|
|
@@ -28607,7 +28760,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
28607
28760
|
*/
|
|
28608
28761
|
class FallbackVisitor extends _Visitor_mjs__WEBPACK_IMPORTED_MODULE_1__["default"] {
|
|
28609
28762
|
enter(path) {
|
|
28610
|
-
this.element = (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_0__.cloneDeep)(path.node);
|
|
28763
|
+
this.element = this.consume ? path.node : (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_0__.cloneDeep)(path.node);
|
|
28611
28764
|
path.stop();
|
|
28612
28765
|
}
|
|
28613
28766
|
}
|
|
@@ -28646,7 +28799,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
28646
28799
|
*/
|
|
28647
28800
|
class SpecificationVisitor extends _Visitor_mjs__WEBPACK_IMPORTED_MODULE_6__["default"] {
|
|
28648
28801
|
specObj;
|
|
28649
|
-
passingOptionsNames = ['specObj', 'parent'];
|
|
28802
|
+
passingOptionsNames = ['specObj', 'parent', 'consume'];
|
|
28650
28803
|
constructor({
|
|
28651
28804
|
specObj,
|
|
28652
28805
|
...rest
|
|
@@ -28692,7 +28845,7 @@ class SpecificationVisitor extends _Visitor_mjs__WEBPACK_IMPORTED_MODULE_6__["de
|
|
|
28692
28845
|
*/
|
|
28693
28846
|
const visitor = this.retrieveVisitorInstance(specPath, options);
|
|
28694
28847
|
if (visitor instanceof _FallbackVisitor_mjs__WEBPACK_IMPORTED_MODULE_7__["default"] && visitor?.constructor === _FallbackVisitor_mjs__WEBPACK_IMPORTED_MODULE_7__["default"]) {
|
|
28695
|
-
return (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_4__.cloneDeep)(element);
|
|
28848
|
+
return this.consume ? element : (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_4__.cloneDeep)(element);
|
|
28696
28849
|
}
|
|
28697
28850
|
(0,_speclynx_apidom_traverse__WEBPACK_IMPORTED_MODULE_5__.traverse)(element, visitor, options);
|
|
28698
28851
|
return visitor.element;
|
|
@@ -28710,7 +28863,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
28710
28863
|
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
28711
28864
|
/* harmony export */ });
|
|
28712
28865
|
/* harmony import */ var _speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(8400);
|
|
28713
|
-
/* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(
|
|
28866
|
+
/* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(2111);
|
|
28714
28867
|
/* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(5810);
|
|
28715
28868
|
/* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(9686);
|
|
28716
28869
|
|
|
@@ -28725,19 +28878,21 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
28725
28878
|
*/
|
|
28726
28879
|
class Visitor {
|
|
28727
28880
|
element;
|
|
28881
|
+
consume = false;
|
|
28882
|
+
consumeSafe = false;
|
|
28728
28883
|
constructor(options) {
|
|
28729
28884
|
Object.assign(this, options);
|
|
28730
28885
|
}
|
|
28731
28886
|
copyMetaAndAttributes(from, to) {
|
|
28732
|
-
if (!from.isMetaEmpty
|
|
28733
|
-
|
|
28734
|
-
|
|
28735
|
-
to.meta = (
|
|
28887
|
+
if (!from.isMetaEmpty && !to.isMetaEmpty) {
|
|
28888
|
+
to.meta = to.meta.merge(from.meta);
|
|
28889
|
+
} else if (!from.isMetaEmpty) {
|
|
28890
|
+
to.meta = from.meta.cloneDeep();
|
|
28736
28891
|
}
|
|
28737
|
-
if (!from.isAttributesEmpty
|
|
28738
|
-
|
|
28739
|
-
|
|
28740
|
-
to.attributes = (0,
|
|
28892
|
+
if (!from.isAttributesEmpty && !to.isAttributesEmpty) {
|
|
28893
|
+
to.attributes = (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_0__["default"])(to.attributes, from.attributes);
|
|
28894
|
+
} else if (!from.isAttributesEmpty) {
|
|
28895
|
+
to.attributes = (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.cloneDeep)(from.attributes);
|
|
28741
28896
|
}
|
|
28742
28897
|
_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__["default"].transfer(from, to);
|
|
28743
28898
|
_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_3__["default"].transfer(from, to);
|
|
@@ -28845,12 +29000,13 @@ class FixedFieldsVisitor extends _SpecificationVisitor_mjs__WEBPACK_IMPORTED_MOD
|
|
|
28845
29000
|
const keyValue = (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_3__["default"])(key);
|
|
28846
29001
|
if ((0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_0__.isStringElement)(key) && fields.includes(keyValue) && !this.ignoredFields.includes(keyValue)) {
|
|
28847
29002
|
const fixedFieldElement = this.toRefractedElement([...specPath, 'fixedFields', keyValue], value);
|
|
28848
|
-
const newMemberElement = new _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__["default"]((0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.cloneDeep)(key), fixedFieldElement);
|
|
29003
|
+
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);
|
|
28849
29004
|
this.copyMetaAndAttributes(memberElement, newMemberElement);
|
|
28850
|
-
newMemberElement.classes.push('fixed-field');
|
|
28851
29005
|
this.element.content.push(newMemberElement);
|
|
29006
|
+
// consume: release processed generic subtree
|
|
29007
|
+
if (this.consume && this.consumeSafe && !memberElement.isFrozen) memberElement.value = undefined;
|
|
28852
29008
|
} else if (!this.ignoredFields.includes(keyValue)) {
|
|
28853
|
-
this.element.content.push((0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.cloneDeep)(memberElement));
|
|
29009
|
+
this.element.content.push(this.consume ? memberElement : (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.cloneDeep)(memberElement));
|
|
28854
29010
|
}
|
|
28855
29011
|
});
|
|
28856
29012
|
this.copyMetaAndAttributes(objectElement, this.element);
|
|
@@ -28937,12 +29093,14 @@ class PatternedFieldsVisitor extends _SpecificationVisitor_mjs__WEBPACK_IMPORTED
|
|
|
28937
29093
|
if (!this.ignoredFields.includes(keyValue) && this.fieldPatternPredicate(keyValue)) {
|
|
28938
29094
|
const specPath = this.specPath(value);
|
|
28939
29095
|
const patternedFieldElement = this.toRefractedElement(specPath, value);
|
|
28940
|
-
const newMemberElement = new _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__["default"]((0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.cloneDeep)(key), patternedFieldElement);
|
|
29096
|
+
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);
|
|
28941
29097
|
this.copyMetaAndAttributes(memberElement, newMemberElement);
|
|
28942
29098
|
newMemberElement.classes.push('patterned-field');
|
|
28943
29099
|
this.element.content.push(newMemberElement);
|
|
29100
|
+
// consume: release processed generic subtree
|
|
29101
|
+
if (this.consume && this.consumeSafe && !memberElement.isFrozen) memberElement.value = undefined;
|
|
28944
29102
|
} else if (!this.ignoredFields.includes(keyValue)) {
|
|
28945
|
-
this.element.content.push((0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.cloneDeep)(memberElement));
|
|
29103
|
+
this.element.content.push(this.consume ? memberElement : (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.cloneDeep)(memberElement));
|
|
28946
29104
|
}
|
|
28947
29105
|
});
|
|
28948
29106
|
this.copyMetaAndAttributes(objectElement, this.element);
|
|
@@ -29484,13 +29642,11 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
29484
29642
|
/* harmony import */ var ramda_adjunct__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(3031);
|
|
29485
29643
|
/* harmony import */ var ramda_adjunct__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(6513);
|
|
29486
29644
|
/* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(5162);
|
|
29487
|
-
/* harmony import */ var
|
|
29488
|
-
/* harmony import */ var
|
|
29489
|
-
/* harmony import */ var
|
|
29490
|
-
/* harmony import */ var
|
|
29491
|
-
/* harmony import */ var
|
|
29492
|
-
/* harmony import */ var _elements_JSONSchema_mjs__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(4686);
|
|
29493
|
-
/* harmony import */ var _predicates_mjs__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(6059);
|
|
29645
|
+
/* harmony import */ var _speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(4673);
|
|
29646
|
+
/* harmony import */ var _generics_FixedFieldsVisitor_mjs__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(5320);
|
|
29647
|
+
/* harmony import */ var _bases_mjs__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(9033);
|
|
29648
|
+
/* harmony import */ var _elements_JSONSchema_mjs__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(4686);
|
|
29649
|
+
/* harmony import */ var _predicates_mjs__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(6059);
|
|
29494
29650
|
|
|
29495
29651
|
|
|
29496
29652
|
|
|
@@ -29505,10 +29661,11 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
29505
29661
|
/**
|
|
29506
29662
|
* @public
|
|
29507
29663
|
*/
|
|
29508
|
-
class JSONSchemaVisitor extends
|
|
29664
|
+
class JSONSchemaVisitor extends _bases_mjs__WEBPACK_IMPORTED_MODULE_7__.JSONSchemaVisitorBase {
|
|
29509
29665
|
constructor(options) {
|
|
29510
29666
|
super(options);
|
|
29511
|
-
this.element = new
|
|
29667
|
+
this.element = new _elements_JSONSchema_mjs__WEBPACK_IMPORTED_MODULE_8__["default"]();
|
|
29668
|
+
this.consumeSafe = true;
|
|
29512
29669
|
this.specPath = (0,ramda__WEBPACK_IMPORTED_MODULE_0__["default"])(['document', 'objects', 'JSONSchema']);
|
|
29513
29670
|
}
|
|
29514
29671
|
get defaultDialectIdentifier() {
|
|
@@ -29521,27 +29678,27 @@ class JSONSchemaVisitor extends _bases_mjs__WEBPACK_IMPORTED_MODULE_9__.JSONSche
|
|
|
29521
29678
|
|
|
29522
29679
|
// for further processing consider this JSONSchema Element as parent for all sub-schemas
|
|
29523
29680
|
this.parent = this.element;
|
|
29524
|
-
return
|
|
29681
|
+
return _generics_FixedFieldsVisitor_mjs__WEBPACK_IMPORTED_MODULE_6__["default"].prototype.ObjectElement.call(this, path);
|
|
29525
29682
|
}
|
|
29526
29683
|
handleDialectIdentifier(objectElement) {
|
|
29527
29684
|
// handle $schema keyword in embedded resources
|
|
29528
29685
|
if ((0,ramda_adjunct__WEBPACK_IMPORTED_MODULE_2__["default"])(this.parent) && !(0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_4__.isStringElement)(objectElement.get('$schema'))) {
|
|
29529
29686
|
// no parent available and no $schema is defined, set default $schema
|
|
29530
29687
|
this.element.meta.set('inheritedDialectIdentifier', this.defaultDialectIdentifier);
|
|
29531
|
-
} else if ((0,
|
|
29688
|
+
} else if ((0,_predicates_mjs__WEBPACK_IMPORTED_MODULE_9__.isJSONSchemaElement)(this.parent) && !(0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_4__.isStringElement)(objectElement.get('$schema'))) {
|
|
29532
29689
|
// parent is available and no $schema is defined, set parent $schema
|
|
29533
|
-
const inheritedDialectIdentifier = (0,ramda__WEBPACK_IMPORTED_MODULE_1__["default"])(
|
|
29690
|
+
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));
|
|
29534
29691
|
this.element.meta.set('inheritedDialectIdentifier', inheritedDialectIdentifier);
|
|
29535
29692
|
}
|
|
29536
29693
|
}
|
|
29537
29694
|
handleSchemaIdentifier(objectElement, identifierKeyword = 'id') {
|
|
29538
29695
|
// handle schema identifier in embedded resources
|
|
29539
|
-
// fetch parent's ancestorsSchemaIdentifiers
|
|
29540
|
-
const ancestorsSchemaIdentifiers = this.parent !== undefined ? (
|
|
29696
|
+
// fetch parent's ancestorsSchemaIdentifiers (stored as plain string[])
|
|
29697
|
+
const ancestorsSchemaIdentifiers = this.parent !== undefined ? [...(this.parent.meta.get('ancestorsSchemaIdentifiers') ?? [])] : [];
|
|
29541
29698
|
// get current schema identifier
|
|
29542
|
-
const schemaIdentifier = (0,
|
|
29699
|
+
const schemaIdentifier = (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_5__["default"])(objectElement.get(identifierKeyword));
|
|
29543
29700
|
|
|
29544
|
-
// remember schema identifier if it's a non-empty
|
|
29701
|
+
// remember schema identifier if it's a non-empty string
|
|
29545
29702
|
if ((0,ramda_adjunct__WEBPACK_IMPORTED_MODULE_3__["default"])(schemaIdentifier)) {
|
|
29546
29703
|
ancestorsSchemaIdentifiers.push(schemaIdentifier);
|
|
29547
29704
|
}
|