@speclynx/apidom-ns-openapi-2 5.0.2 → 5.1.1

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.
Files changed (24) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/apidom-ns-openapi-2.browser.js +163 -47
  3. package/dist/apidom-ns-openapi-2.browser.min.js +1 -1
  4. package/package.json +8 -8
  5. package/src/refractor/plugins/normalize-parameters.cjs +16 -1
  6. package/src/refractor/plugins/normalize-parameters.mjs +17 -2
  7. package/src/refractor/plugins/replace-empty-element.cjs +1 -1
  8. package/src/refractor/plugins/replace-empty-element.mjs +1 -1
  9. package/src/refractor/visitors/Visitor.cjs +1 -1
  10. package/src/refractor/visitors/Visitor.mjs +1 -1
  11. package/src/refractor/visitors/open-api-2/ConsumesVisitor.cjs +1 -0
  12. package/src/refractor/visitors/open-api-2/ConsumesVisitor.mjs +1 -0
  13. package/src/refractor/visitors/open-api-2/ProducesVisitor.cjs +1 -0
  14. package/src/refractor/visitors/open-api-2/ProducesVisitor.mjs +1 -0
  15. package/src/refractor/visitors/open-api-2/SchemesVisitor.cjs +1 -0
  16. package/src/refractor/visitors/open-api-2/SchemesVisitor.mjs +1 -0
  17. package/src/refractor/visitors/open-api-2/operation/ConsumesVisitor.cjs +1 -0
  18. package/src/refractor/visitors/open-api-2/operation/ConsumesVisitor.mjs +1 -0
  19. package/src/refractor/visitors/open-api-2/operation/ProducesVisitor.cjs +1 -0
  20. package/src/refractor/visitors/open-api-2/operation/ProducesVisitor.mjs +1 -0
  21. package/src/refractor/visitors/open-api-2/operation/SchemesVisitor.cjs +1 -0
  22. package/src/refractor/visitors/open-api-2/operation/SchemesVisitor.mjs +1 -0
  23. package/src/refractor/visitors/open-api-2/operation/TagsVisitor.cjs +1 -0
  24. package/src/refractor/visitors/open-api-2/operation/TagsVisitor.mjs +1 -0
package/CHANGELOG.md CHANGED
@@ -3,6 +3,20 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [5.1.1](https://github.com/speclynx/apidom/compare/v5.1.0...v5.1.1) (2026-08-19)
7
+
8
+ **Note:** Version bump only for package @speclynx/apidom-ns-openapi-2
9
+
10
+ # [5.1.0](https://github.com/speclynx/apidom/compare/v5.0.2...v5.1.0) (2026-08-09)
11
+
12
+ ### Bug Fixes
13
+
14
+ - **ns:** transfer style in refractor visitors using the concat pattern ([#442](https://github.com/speclynx/apidom/issues/442)) ([dc483cc](https://github.com/speclynx/apidom/commit/dc483ccebb80877d96e1c62b34781a96dd96b403))
15
+
16
+ ### Features
17
+
18
+ - **datamodel:** support Metadata in cloneDeep and cloneShallow ([#443](https://github.com/speclynx/apidom/issues/443)) ([8e7e27a](https://github.com/speclynx/apidom/commit/8e7e27a7b01223bba13e54c9703a0c1da34a47d6)), closes [cloneDeep/#cloneShallow](https://github.com/speclynx/apidom/issues/cloneShallow)
19
+
6
20
  ## [5.0.2](https://github.com/speclynx/apidom/compare/v5.0.1...v5.0.2) (2026-08-04)
7
21
 
8
22
  **Note:** Version bump only for package @speclynx/apidom-ns-openapi-2
@@ -2793,9 +2793,12 @@ __webpack_require__.r(__webpack_exports__);
2793
2793
  /* harmony import */ var ramda__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1942);
2794
2794
  /* harmony import */ var _speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(4673);
2795
2795
  /* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(5162);
2796
- /* harmony import */ var _elements_nces_OperationParameters_ts__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(8748);
2797
- /* harmony import */ var _normalize_storage_index_ts__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(3313);
2798
- /* harmony import */ var _predicates_ts__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(7269);
2796
+ /* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(2111);
2797
+ /* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(5810);
2798
+ /* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(9686);
2799
+ /* harmony import */ var _elements_nces_OperationParameters_ts__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(8748);
2800
+ /* harmony import */ var _normalize_storage_index_ts__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(3313);
2801
+ /* harmony import */ var _predicates_ts__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(7269);
2799
2802
 
2800
2803
 
2801
2804
 
@@ -2824,8 +2827,8 @@ __webpack_require__.r(__webpack_exports__);
2824
2827
  * {@link https://spec.openapis.org/oas/v2.0.html#path-item-object}
2825
2828
  */
2826
2829
  const parameterEquals = (parameter1, parameter2) => {
2827
- if (!(0,_predicates_ts__WEBPACK_IMPORTED_MODULE_5__.isParameterElement)(parameter1)) return false;
2828
- if (!(0,_predicates_ts__WEBPACK_IMPORTED_MODULE_5__.isParameterElement)(parameter2)) return false;
2830
+ if (!(0,_predicates_ts__WEBPACK_IMPORTED_MODULE_8__.isParameterElement)(parameter1)) return false;
2831
+ if (!(0,_predicates_ts__WEBPACK_IMPORTED_MODULE_8__.isParameterElement)(parameter2)) return false;
2829
2832
  if (!(0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__.isStringElement)(parameter1.name)) return false;
2830
2833
  if (!(0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__.isStringElement)(parameter1.in)) return false;
2831
2834
  if (!(0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__.isStringElement)(parameter2.name)) return false;
@@ -2846,7 +2849,22 @@ const inheritParametersToOperation = (operationElement, pathItemElement) => {
2846
2849
 
2847
2850
  // prefers the first item if two items compare equal based on the predicate
2848
2851
  const mergedParameters = (0,ramda__WEBPACK_IMPORTED_MODULE_0__["default"])(parameterEquals, [...operationParams, ...pathItemParams]);
2849
- operationElement.parameters = new _elements_nces_OperationParameters_ts__WEBPACK_IMPORTED_MODULE_3__["default"](mergedParameters);
2852
+ const originalParameters = operationElement.parameters;
2853
+ const mergedElement = new _elements_nces_OperationParameters_ts__WEBPACK_IMPORTED_MODULE_6__["default"](mergedParameters);
2854
+
2855
+ // the merged container may replace an existing source container — carry over
2856
+ // its meta, attributes, source map and style
2857
+ if ((0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__.isArrayElement)(originalParameters)) {
2858
+ if (!originalParameters.isMetaEmpty) {
2859
+ mergedElement.meta = (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_3__.cloneDeep)(originalParameters.meta);
2860
+ }
2861
+ if (!originalParameters.isAttributesEmpty) {
2862
+ mergedElement.attributes = (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_3__.cloneDeep)(originalParameters.attributes);
2863
+ }
2864
+ _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_4__["default"].transfer(originalParameters, mergedElement);
2865
+ _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_5__["default"].transfer(originalParameters, mergedElement);
2866
+ }
2867
+ operationElement.parameters = mergedElement;
2850
2868
  };
2851
2869
 
2852
2870
  /**
@@ -2864,7 +2882,7 @@ const plugin = ({
2864
2882
  SwaggerElement: {
2865
2883
  enter(path) {
2866
2884
  const element = path.node;
2867
- storage = new _normalize_storage_index_ts__WEBPACK_IMPORTED_MODULE_4__["default"](element, storageField, 'parameters');
2885
+ storage = new _normalize_storage_index_ts__WEBPACK_IMPORTED_MODULE_7__["default"](element, storageField, 'parameters');
2868
2886
  },
2869
2887
  leave() {
2870
2888
  storage = undefined;
@@ -3454,7 +3472,7 @@ const plugin = () => () => ({
3454
3472
  if (typeof elementFactory !== 'function') return;
3455
3473
  const replacement = elementFactory.call({
3456
3474
  context
3457
- }, undefined, element.isMetaEmpty ? undefined : element.meta.cloneDeep(), element.isAttributesEmpty ? undefined : (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.cloneDeep)(element.attributes));
3475
+ }, undefined, element.isMetaEmpty ? undefined : (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.cloneDeep)(element.meta), element.isAttributesEmpty ? undefined : (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.cloneDeep)(element.attributes));
3458
3476
  _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_5__["default"].transfer(element, replacement);
3459
3477
  _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_6__["default"].transfer(element, replacement);
3460
3478
  path.replaceWith(replacement);
@@ -4264,7 +4282,7 @@ class SpecificationVisitor extends _Visitor_ts__WEBPACK_IMPORTED_MODULE_6__["def
4264
4282
  if (visitor instanceof _FallbackVisitor_ts__WEBPACK_IMPORTED_MODULE_7__["default"] && visitor?.constructor === _FallbackVisitor_ts__WEBPACK_IMPORTED_MODULE_7__["default"]) {
4265
4283
  return this.consume ? element : (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_4__.cloneDeep)(element);
4266
4284
  }
4267
- (0,_speclynx_apidom_traverse__WEBPACK_IMPORTED_MODULE_5__.traverse)(element, visitor);
4285
+ ;(0,_speclynx_apidom_traverse__WEBPACK_IMPORTED_MODULE_5__.traverse)(element, visitor);
4268
4286
  return visitor.element;
4269
4287
  }
4270
4288
  }
@@ -4305,7 +4323,7 @@ class Visitor {
4305
4323
  if (!from.isMetaEmpty && !to.isMetaEmpty) {
4306
4324
  to.meta = to.meta.merge(from.meta);
4307
4325
  } else if (!from.isMetaEmpty) {
4308
- to.meta = from.meta.cloneDeep();
4326
+ to.meta = (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.cloneDeep)(from.meta);
4309
4327
  }
4310
4328
  if (!from.isAttributesEmpty && !to.isAttributesEmpty) {
4311
4329
  to.attributes = (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_0__["default"])(to.attributes, from.attributes);
@@ -4703,6 +4721,7 @@ class ConsumesVisitor extends _FallbackVisitor_ts__WEBPACK_IMPORTED_MODULE_2__["
4703
4721
  ArrayElement(path) {
4704
4722
  const arrayElement = path.node;
4705
4723
  this.element = this.element.concat((0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_0__.cloneDeep)(arrayElement));
4724
+ this.copyMetaAndAttributes(arrayElement, this.element);
4706
4725
  path.stop();
4707
4726
  }
4708
4727
  }
@@ -4758,6 +4777,7 @@ class ProducesVisitor extends _FallbackVisitor_ts__WEBPACK_IMPORTED_MODULE_2__["
4758
4777
  ArrayElement(path) {
4759
4778
  const arrayElement = path.node;
4760
4779
  this.element = this.element.concat((0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_0__.cloneDeep)(arrayElement));
4780
+ this.copyMetaAndAttributes(arrayElement, this.element);
4761
4781
  path.stop();
4762
4782
  }
4763
4783
  }
@@ -4790,6 +4810,7 @@ class SchemesVisitor extends _FallbackVisitor_ts__WEBPACK_IMPORTED_MODULE_2__["d
4790
4810
  ArrayElement(path) {
4791
4811
  const arrayElement = path.node;
4792
4812
  this.element = this.element.concat((0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_0__.cloneDeep)(arrayElement));
4813
+ this.copyMetaAndAttributes(arrayElement, this.element);
4793
4814
  path.stop();
4794
4815
  }
4795
4816
  }
@@ -5343,6 +5364,7 @@ class ConsumesVisitor extends _FallbackVisitor_ts__WEBPACK_IMPORTED_MODULE_2__["
5343
5364
  ArrayElement(path) {
5344
5365
  const arrayElement = path.node;
5345
5366
  this.element = this.element.concat((0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_0__.cloneDeep)(arrayElement));
5367
+ this.copyMetaAndAttributes(arrayElement, this.element);
5346
5368
  path.stop();
5347
5369
  }
5348
5370
  }
@@ -5417,6 +5439,7 @@ class ProducesVisitor extends _FallbackVisitor_ts__WEBPACK_IMPORTED_MODULE_2__["
5417
5439
  ArrayElement(path) {
5418
5440
  const arrayElement = path.node;
5419
5441
  this.element = this.element.concat((0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_0__.cloneDeep)(arrayElement));
5442
+ this.copyMetaAndAttributes(arrayElement, this.element);
5420
5443
  path.stop();
5421
5444
  }
5422
5445
  }
@@ -5449,6 +5472,7 @@ class SchemesVisitor extends _FallbackVisitor_ts__WEBPACK_IMPORTED_MODULE_2__["d
5449
5472
  ArrayElement(path) {
5450
5473
  const arrayElement = path.node;
5451
5474
  this.element = this.element.concat((0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_0__.cloneDeep)(arrayElement));
5475
+ this.copyMetaAndAttributes(arrayElement, this.element);
5452
5476
  path.stop();
5453
5477
  }
5454
5478
  }
@@ -5516,6 +5540,7 @@ class TagsVisitor extends _FallbackVisitor_ts__WEBPACK_IMPORTED_MODULE_2__["defa
5516
5540
  ArrayElement(path) {
5517
5541
  const arrayElement = path.node;
5518
5542
  this.element = this.element.concat((0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_0__.cloneDeep)(arrayElement));
5543
+ this.copyMetaAndAttributes(arrayElement, this.element);
5519
5544
  path.stop();
5520
5545
  }
5521
5546
  }
@@ -7134,7 +7159,7 @@ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object
7134
7159
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
7135
7160
  function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
7136
7161
  function _assertClassBrand(e, t, n) { if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError("Private element is not present on this object"); }
7137
-
7162
+ ;
7138
7163
 
7139
7164
  var _CompositeEvaluationRealm_brand = /*#__PURE__*/new WeakSet();
7140
7165
  class CompositeEvaluationRealm extends _EvaluationRealm_mjs__WEBPACK_IMPORTED_MODULE_0__["default"] {
@@ -15971,7 +15996,7 @@ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r)
15971
15996
  function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
15972
15997
  function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
15973
15998
  function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
15974
-
15999
+ ;
15975
16000
 
15976
16001
  /**
15977
16002
  * Can be used as a way to compose multiple invokers together to form polymorphic functions,
@@ -22300,7 +22325,7 @@ __webpack_require__.r(__webpack_exports__);
22300
22325
  * @public
22301
22326
  */
22302
22327
  const emptyElement = element => {
22303
- const meta = !element.isMetaEmpty ? element.meta.cloneDeep() : undefined;
22328
+ const meta = !element.isMetaEmpty ? (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.cloneDeep)(element.meta) : undefined;
22304
22329
  const attributes = !element.isAttributesEmpty ? (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.cloneDeep)(element.attributes) : undefined;
22305
22330
 
22306
22331
  // @ts-ignore
@@ -22316,7 +22341,7 @@ const getMergeFunction = (keyElement, options) => {
22316
22341
  };
22317
22342
  const getMetaMergeFunction = options => {
22318
22343
  if (typeof options.customMetaMerge !== 'function') {
22319
- return targetMeta => targetMeta.cloneDeep();
22344
+ return targetMeta => (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.cloneDeep)(targetMeta);
22320
22345
  }
22321
22346
  return options.customMetaMerge;
22322
22347
  };
@@ -22391,9 +22416,9 @@ const deepmerge = (targetElement, sourceElement, options) => {
22391
22416
  if (!targetElement.isMetaEmpty && !sourceElement.isMetaEmpty) {
22392
22417
  mergedElement.meta = getMetaMergeFunction(mergedOptions)(targetElement.meta, sourceElement.meta);
22393
22418
  } else if (!targetElement.isMetaEmpty) {
22394
- mergedElement.meta = targetElement.meta.cloneDeep();
22419
+ mergedElement.meta = (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.cloneDeep)(targetElement.meta);
22395
22420
  } else if (!sourceElement.isMetaEmpty) {
22396
- mergedElement.meta = sourceElement.meta.cloneDeep();
22421
+ mergedElement.meta = (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.cloneDeep)(sourceElement.meta);
22397
22422
  }
22398
22423
  if (!targetElement.isAttributesEmpty && !sourceElement.isAttributesEmpty) {
22399
22424
  mergedElement.attributes = getAttributesMergeFunction(mergedOptions)(targetElement.attributes, sourceElement.attributes);
@@ -22656,6 +22681,7 @@ const resolveSpecification = specification => {
22656
22681
  __webpack_require__.r(__webpack_exports__);
22657
22682
  /* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(5162);
22658
22683
  /* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(6911);
22684
+ /* harmony import */ var _util_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(977);
22659
22685
 
22660
22686
 
22661
22687
  /**
@@ -22683,7 +22709,7 @@ const serializer = element => {
22683
22709
  node.forEach((value, key) => {
22684
22710
  const k = serialize(key);
22685
22711
  const v = serialize(value);
22686
- if (typeof k === 'string') obj[k] = v;
22712
+ if (typeof k === 'string') (0,_util_mjs__WEBPACK_IMPORTED_MODULE_2__["default"])(obj, k, v);
22687
22713
  });
22688
22714
  return obj;
22689
22715
  }
@@ -22708,6 +22734,38 @@ const serializer = element => {
22708
22734
  /* harmony export */ ]);
22709
22735
 
22710
22736
 
22737
+ /***/ },
22738
+
22739
+ /***/ 977
22740
+ (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
22741
+
22742
+ __webpack_require__.r(__webpack_exports__);
22743
+ /**
22744
+ * Defines a key on a plain object being built from an ApiDOM element tree.
22745
+ *
22746
+ * A "__proto__" key must be defined rather than assigned: assignment invokes
22747
+ * the prototype setter, which drops the member from the result and hands
22748
+ * document content to consumers as the object's prototype. Every other key
22749
+ * takes the plain assignment fast path.
22750
+ */
22751
+ const setProperty = (target, key, value) => {
22752
+ if (key === '__proto__') {
22753
+ Object.defineProperty(target, key, {
22754
+ value,
22755
+ enumerable: true,
22756
+ writable: true,
22757
+ configurable: true
22758
+ });
22759
+ } else {
22760
+ target[key] = value;
22761
+ }
22762
+ };
22763
+ /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (setProperty);
22764
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, [
22765
+ /* harmony export */ "default", 0, /* export default binding */ __WEBPACK_DEFAULT_EXPORT__
22766
+ /* harmony export */ ]);
22767
+
22768
+
22711
22769
  /***/ },
22712
22770
 
22713
22771
  /***/ 6663
@@ -22753,6 +22811,8 @@ class KeyValuePair {
22753
22811
 
22754
22812
  __webpack_require__.r(__webpack_exports__);
22755
22813
  /* harmony import */ var ramda__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(8138);
22814
+ /* harmony import */ var _util_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(4883);
22815
+
22756
22816
 
22757
22817
  /**
22758
22818
  * Lightweight meta container for Element metadata.
@@ -22769,7 +22829,7 @@ class Metadata {
22769
22829
  return this[name];
22770
22830
  }
22771
22831
  set(name, value) {
22772
- this[name] = value;
22832
+ ;(0,_util_mjs__WEBPACK_IMPORTED_MODULE_1__["default"])(this, name, value);
22773
22833
  }
22774
22834
  hasKey(name) {
22775
22835
  return Object.hasOwn(this, name);
@@ -22802,7 +22862,19 @@ class Metadata {
22802
22862
  */
22803
22863
  cloneShallow() {
22804
22864
  const clone = new Metadata();
22805
- Object.assign(clone, this);
22865
+
22866
+ // Object.assign is the fast path but invokes the prototype setter for a
22867
+ // "__proto__" key, hijacking the clone's prototype. That key can only come
22868
+ // from untrusted input, so check for it once and fall back to a guarded
22869
+ // copy. Copying property descriptors instead would carry writable:false
22870
+ // over from a frozen source and hand back an unmodifiable clone.
22871
+ if (!Object.hasOwn(this, '__proto__')) {
22872
+ Object.assign(clone, this);
22873
+ } else {
22874
+ for (const key of Object.keys(this)) {
22875
+ (0,_util_mjs__WEBPACK_IMPORTED_MODULE_1__["default"])(clone, key, this[key]);
22876
+ }
22877
+ }
22806
22878
  return clone;
22807
22879
  }
22808
22880
 
@@ -23358,19 +23430,21 @@ class ShallowCloneError extends _CloneError_mjs__WEBPACK_IMPORTED_MODULE_0__["de
23358
23430
 
23359
23431
  __webpack_require__.r(__webpack_exports__);
23360
23432
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
23361
- /* harmony export */ CloneError: () => (/* reexport safe */ _errors_CloneError_mjs__WEBPACK_IMPORTED_MODULE_8__["default"]),
23362
- /* harmony export */ DeepCloneError: () => (/* reexport safe */ _errors_DeepCloneError_mjs__WEBPACK_IMPORTED_MODULE_6__["default"]),
23363
- /* harmony export */ ShallowCloneError: () => (/* reexport safe */ _errors_ShallowCloneError_mjs__WEBPACK_IMPORTED_MODULE_7__["default"])
23433
+ /* harmony export */ CloneError: () => (/* reexport safe */ _errors_CloneError_mjs__WEBPACK_IMPORTED_MODULE_9__["default"]),
23434
+ /* harmony export */ DeepCloneError: () => (/* reexport safe */ _errors_DeepCloneError_mjs__WEBPACK_IMPORTED_MODULE_7__["default"]),
23435
+ /* harmony export */ ShallowCloneError: () => (/* reexport safe */ _errors_ShallowCloneError_mjs__WEBPACK_IMPORTED_MODULE_8__["default"])
23364
23436
  /* harmony export */ });
23365
23437
  /* harmony import */ var ramda__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(8138);
23366
23438
  /* harmony import */ var _ObjectSlice_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(8504);
23367
23439
  /* harmony import */ var _KeyValuePair_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(6663);
23368
- /* harmony import */ var _predicates_index_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(8252);
23369
- /* harmony import */ var _predicates_index_mjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(5162);
23370
- /* harmony import */ var _elements_SourceMap_mjs__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(5810);
23371
- /* harmony import */ var _errors_DeepCloneError_mjs__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(5018);
23372
- /* harmony import */ var _errors_ShallowCloneError_mjs__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(3686);
23373
- /* harmony import */ var _errors_CloneError_mjs__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(3772);
23440
+ /* harmony import */ var _Metadata_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(1844);
23441
+ /* harmony import */ var _predicates_index_mjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(8252);
23442
+ /* harmony import */ var _predicates_index_mjs__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(5162);
23443
+ /* harmony import */ var _elements_SourceMap_mjs__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(5810);
23444
+ /* harmony import */ var _errors_DeepCloneError_mjs__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(5018);
23445
+ /* harmony import */ var _errors_ShallowCloneError_mjs__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(3686);
23446
+ /* harmony import */ var _errors_CloneError_mjs__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(3772);
23447
+
23374
23448
 
23375
23449
 
23376
23450
 
@@ -23404,7 +23478,7 @@ const cloneDeepElement = (element, options) => {
23404
23478
  } = element;
23405
23479
  if (Array.isArray(content)) {
23406
23480
  copy.content = content.map(el => cloneDeepElement(el, passThroughOptions));
23407
- } else if ((0,_predicates_index_mjs__WEBPACK_IMPORTED_MODULE_4__.isElement)(content)) {
23481
+ } else if ((0,_predicates_index_mjs__WEBPACK_IMPORTED_MODULE_5__.isElement)(content)) {
23408
23482
  copy.content = cloneDeepElement(content, passThroughOptions);
23409
23483
  } else if (content instanceof _KeyValuePair_mjs__WEBPACK_IMPORTED_MODULE_2__["default"]) {
23410
23484
  copy.content = cloneDeepKeyValuePair(content, passThroughOptions);
@@ -23452,7 +23526,7 @@ const cloneDeepObjectSlice = (slice, options) => {
23452
23526
  };
23453
23527
 
23454
23528
  /**
23455
- * Creates a deep clone of an ApiDOM Element, KeyValuePair, or ObjectSlice.
23529
+ * Creates a deep clone of an ApiDOM Element, KeyValuePair, ObjectSlice, or Metadata.
23456
23530
  * Handles cycles by memoizing visited objects.
23457
23531
  * @public
23458
23532
  */
@@ -23463,10 +23537,13 @@ const cloneDeep = (value, options = {}) => {
23463
23537
  if (value instanceof _ObjectSlice_mjs__WEBPACK_IMPORTED_MODULE_1__["default"]) {
23464
23538
  return cloneDeepObjectSlice(value, options);
23465
23539
  }
23466
- if ((0,_predicates_index_mjs__WEBPACK_IMPORTED_MODULE_4__.isElement)(value)) {
23540
+ if (value instanceof _Metadata_mjs__WEBPACK_IMPORTED_MODULE_3__["default"]) {
23541
+ return value.cloneDeep();
23542
+ }
23543
+ if ((0,_predicates_index_mjs__WEBPACK_IMPORTED_MODULE_5__.isElement)(value)) {
23467
23544
  return cloneDeepElement(value, options);
23468
23545
  }
23469
- throw new _errors_DeepCloneError_mjs__WEBPACK_IMPORTED_MODULE_6__["default"]("Value provided to cloneDeep function couldn't be cloned", {
23546
+ throw new _errors_DeepCloneError_mjs__WEBPACK_IMPORTED_MODULE_7__["default"]("Value provided to cloneDeep function couldn't be cloned", {
23470
23547
  value
23471
23548
  });
23472
23549
  };
@@ -23493,21 +23570,21 @@ const cloneShallowElement = element => {
23493
23570
  const copy = new Ctor();
23494
23571
  copy.element = element.element;
23495
23572
  if (!element.isMetaEmpty) {
23496
- copy.meta = element.meta.cloneDeep();
23573
+ copy.meta = cloneDeep(element.meta);
23497
23574
  }
23498
23575
  if (!element.isAttributesEmpty) {
23499
23576
  copy.attributes = cloneDeep(element.attributes);
23500
23577
  }
23501
- if ((0,_predicates_index_mjs__WEBPACK_IMPORTED_MODULE_3__.hasElementSourceMap)(element)) {
23502
- _elements_SourceMap_mjs__WEBPACK_IMPORTED_MODULE_5__["default"].transfer(element, copy);
23578
+ if ((0,_predicates_index_mjs__WEBPACK_IMPORTED_MODULE_4__.hasElementSourceMap)(element)) {
23579
+ _elements_SourceMap_mjs__WEBPACK_IMPORTED_MODULE_6__["default"].transfer(element, copy);
23503
23580
  }
23504
- if ((0,_predicates_index_mjs__WEBPACK_IMPORTED_MODULE_3__.hasElementStyle)(element)) {
23581
+ if ((0,_predicates_index_mjs__WEBPACK_IMPORTED_MODULE_4__.hasElementStyle)(element)) {
23505
23582
  copy.style = (0,ramda__WEBPACK_IMPORTED_MODULE_0__["default"])(element.style);
23506
23583
  }
23507
23584
  const {
23508
23585
  content
23509
23586
  } = element;
23510
- if ((0,_predicates_index_mjs__WEBPACK_IMPORTED_MODULE_4__.isElement)(content)) {
23587
+ if ((0,_predicates_index_mjs__WEBPACK_IMPORTED_MODULE_5__.isElement)(content)) {
23511
23588
  copy.content = cloneShallowElement(content);
23512
23589
  } else if (Array.isArray(content)) {
23513
23590
  copy.content = [...content];
@@ -23520,7 +23597,7 @@ const cloneShallowElement = element => {
23520
23597
  };
23521
23598
 
23522
23599
  /**
23523
- * Creates a shallow clone of an ApiDOM Element, KeyValuePair, or ObjectSlice.
23600
+ * Creates a shallow clone of an ApiDOM Element, KeyValuePair, ObjectSlice, or Metadata.
23524
23601
  * The element itself is cloned, but content references are shared.
23525
23602
  * Meta and attributes are deep cloned to preserve semantic information.
23526
23603
  * @public
@@ -23532,10 +23609,13 @@ const cloneShallow = value => {
23532
23609
  if (value instanceof _ObjectSlice_mjs__WEBPACK_IMPORTED_MODULE_1__["default"]) {
23533
23610
  return cloneShallowObjectSlice(value);
23534
23611
  }
23535
- if ((0,_predicates_index_mjs__WEBPACK_IMPORTED_MODULE_4__.isElement)(value)) {
23612
+ if (value instanceof _Metadata_mjs__WEBPACK_IMPORTED_MODULE_3__["default"]) {
23613
+ return value.cloneShallow();
23614
+ }
23615
+ if ((0,_predicates_index_mjs__WEBPACK_IMPORTED_MODULE_5__.isElement)(value)) {
23536
23616
  return cloneShallowElement(value);
23537
23617
  }
23538
- throw new _errors_ShallowCloneError_mjs__WEBPACK_IMPORTED_MODULE_7__["default"]("Value provided to cloneShallow function couldn't be cloned", {
23618
+ throw new _errors_ShallowCloneError_mjs__WEBPACK_IMPORTED_MODULE_8__["default"]("Value provided to cloneShallow function couldn't be cloned", {
23539
23619
  value
23540
23620
  });
23541
23621
  };
@@ -25279,6 +25359,8 @@ __webpack_require__.r(__webpack_exports__);
25279
25359
  /* harmony import */ var _CollectionElement_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(4536);
25280
25360
  /* harmony import */ var _MemberElement_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(1770);
25281
25361
  /* harmony import */ var _ObjectSlice_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(8504);
25362
+ /* harmony import */ var _util_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(4883);
25363
+
25282
25364
 
25283
25365
 
25284
25366
 
@@ -25303,7 +25385,7 @@ class ObjectElement extends _CollectionElement_mjs__WEBPACK_IMPORTED_MODULE_0__[
25303
25385
  }
25304
25386
  toValue() {
25305
25387
  return this._content.reduce((results, el) => {
25306
- results[el.key.toValue()] = el.value ? el.value.toValue() : undefined;
25388
+ ;(0,_util_mjs__WEBPACK_IMPORTED_MODULE_3__["default"])(results, el.key.toValue(), el.value ? el.value.toValue() : undefined);
25307
25389
  return results;
25308
25390
  }, {});
25309
25391
  }
@@ -25667,6 +25749,8 @@ _Metadata_mjs__WEBPACK_IMPORTED_MODULE_18__["default"].prototype.cloneDeepElemen
25667
25749
  __webpack_require__.r(__webpack_exports__);
25668
25750
  /* harmony import */ var _elements_SourceMap_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(5810);
25669
25751
  /* harmony import */ var _elements_Style_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(9686);
25752
+ /* harmony import */ var _util_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(4883);
25753
+
25670
25754
 
25671
25755
 
25672
25756
  /**
@@ -25854,12 +25938,12 @@ class JSONSerialiser {
25854
25938
  let hasEntries = false;
25855
25939
  for (const [key, value] of Object.entries(element.meta)) {
25856
25940
  if (value instanceof this.namespace.elements.Element) {
25857
- meta[key] = this.serialise(value);
25941
+ (0,_util_mjs__WEBPACK_IMPORTED_MODULE_2__["default"])(meta, key, this.serialise(value));
25858
25942
  hasEntries = true;
25859
25943
  } else if (value !== undefined) {
25860
25944
  // refract primitives to maintain JSON Refract spec compatibility
25861
25945
  const refracted = element.refract(value);
25862
- meta[key] = this.serialise(refracted);
25946
+ (0,_util_mjs__WEBPACK_IMPORTED_MODULE_2__["default"])(meta, key, this.serialise(refracted));
25863
25947
  rawKeys.push(key);
25864
25948
  hasEntries = true;
25865
25949
  }
@@ -25873,7 +25957,7 @@ class JSONSerialiser {
25873
25957
  const result = {};
25874
25958
  obj.forEach((value, key) => {
25875
25959
  if (value) {
25876
- result[key.toValue()] = this.serialise(value);
25960
+ (0,_util_mjs__WEBPACK_IMPORTED_MODULE_2__["default"])(result, key.toValue(), this.serialise(value));
25877
25961
  }
25878
25962
  });
25879
25963
  if (Object.keys(result).length === 0) {
@@ -25893,6 +25977,38 @@ class JSONSerialiser {
25893
25977
  /* harmony export */ ]);
25894
25978
 
25895
25979
 
25980
+ /***/ },
25981
+
25982
+ /***/ 4883
25983
+ (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
25984
+
25985
+ __webpack_require__.r(__webpack_exports__);
25986
+ /**
25987
+ * Defines a key on a plain object or class instance built from untrusted input.
25988
+ *
25989
+ * A "__proto__" key must be defined rather than assigned: assignment invokes the
25990
+ * prototype setter, which drops the member from the result and replaces the
25991
+ * target's prototype with the incoming value. Every other key takes the plain
25992
+ * assignment fast path.
25993
+ */
25994
+ const setProperty = (target, key, value) => {
25995
+ if (key === '__proto__') {
25996
+ Object.defineProperty(target, key, {
25997
+ value,
25998
+ enumerable: true,
25999
+ writable: true,
26000
+ configurable: true
26001
+ });
26002
+ } else {
26003
+ target[key] = value;
26004
+ }
26005
+ };
26006
+ /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (setProperty);
26007
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, [
26008
+ /* harmony export */ "default", 0, /* export default binding */ __WEBPACK_DEFAULT_EXPORT__
26009
+ /* harmony export */ ]);
26010
+
26011
+
25896
26012
  /***/ },
25897
26013
 
25898
26014
  /***/ 3437
@@ -27103,7 +27219,7 @@ class SpecificationVisitor extends _Visitor_mjs__WEBPACK_IMPORTED_MODULE_6__["de
27103
27219
  if (visitor instanceof _FallbackVisitor_mjs__WEBPACK_IMPORTED_MODULE_7__["default"] && visitor?.constructor === _FallbackVisitor_mjs__WEBPACK_IMPORTED_MODULE_7__["default"]) {
27104
27220
  return this.consume ? element : (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_4__.cloneDeep)(element);
27105
27221
  }
27106
- (0,_speclynx_apidom_traverse__WEBPACK_IMPORTED_MODULE_5__.traverse)(element, visitor, options);
27222
+ ;(0,_speclynx_apidom_traverse__WEBPACK_IMPORTED_MODULE_5__.traverse)(element, visitor, options);
27107
27223
  return visitor.element;
27108
27224
  }
27109
27225
  }
@@ -27144,7 +27260,7 @@ class Visitor {
27144
27260
  if (!from.isMetaEmpty && !to.isMetaEmpty) {
27145
27261
  to.meta = to.meta.merge(from.meta);
27146
27262
  } else if (!from.isMetaEmpty) {
27147
- to.meta = from.meta.cloneDeep();
27263
+ to.meta = (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.cloneDeep)(from.meta);
27148
27264
  }
27149
27265
  if (!from.isAttributesEmpty && !to.isAttributesEmpty) {
27150
27266
  to.attributes = (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_0__["default"])(to.attributes, from.attributes);
@@ -28672,7 +28788,7 @@ const forEach = (element, options) => {
28672
28788
  callback = options.callback ?? (() => {});
28673
28789
  predicate = options.predicate ?? (() => true);
28674
28790
  }
28675
- (0,_traversal_mjs__WEBPACK_IMPORTED_MODULE_0__.traverse)(element, {
28791
+ ;(0,_traversal_mjs__WEBPACK_IMPORTED_MODULE_0__.traverse)(element, {
28676
28792
  enter(path) {
28677
28793
  if (predicate(path)) {
28678
28794
  callback(path);