@swagger-api/apidom-ns-openapi-3-0 0.78.0 → 0.80.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 CHANGED
@@ -3,6 +3,16 @@
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
+ # [0.80.0](https://github.com/swagger-api/apidom/compare/v0.79.0...v0.80.0) (2023-10-26)
7
+
8
+ **Note:** Version bump only for package @swagger-api/apidom-ns-openapi-3-0
9
+
10
+ # [0.79.0](https://github.com/swagger-api/apidom/compare/v0.78.0...v0.79.0) (2023-10-24)
11
+
12
+ ### Features
13
+
14
+ - **predicates:** implement TypeScript type guards ([#3289](https://github.com/swagger-api/apidom/issues/3289)) ([0cae70a](https://github.com/swagger-api/apidom/commit/0cae70aa3edc17ecc628c21e30a6b2ac1e992372)), closes [#3280](https://github.com/swagger-api/apidom/issues/3280)
15
+
6
16
  # [0.78.0](https://github.com/swagger-api/apidom/compare/v0.77.0...v0.78.0) (2023-10-17)
7
17
 
8
18
  ### Bug Fixes
@@ -24629,7 +24629,7 @@ __webpack_require__.r(__webpack_exports__);
24629
24629
  /* harmony export */ mergeAll: () => (/* binding */ mergeAll),
24630
24630
  /* harmony export */ visit: () => (/* binding */ visit)
24631
24631
  /* harmony export */ });
24632
- /* harmony import */ var _swagger_api_apidom_error__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(7471);
24632
+ /* harmony import */ var _swagger_api_apidom_error__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(69985);
24633
24633
 
24634
24634
 
24635
24635
  /**
@@ -24900,7 +24900,9 @@ visitor, {
24900
24900
  let result;
24901
24901
  if (!Array.isArray(node)) {
24902
24902
  if (!nodePredicate(node)) {
24903
- throw new _swagger_api_apidom_error__WEBPACK_IMPORTED_MODULE_0__["default"](`Invalid AST Node: ${JSON.stringify(node)}`);
24903
+ throw new _swagger_api_apidom_error__WEBPACK_IMPORTED_MODULE_0__["default"](`Invalid AST Node: ${String(node)}`, {
24904
+ node
24905
+ });
24904
24906
  }
24905
24907
 
24906
24908
  // cycle detected; skipping over a sub-tree to avoid recursion
@@ -25049,7 +25051,9 @@ visitor, {
25049
25051
  let result;
25050
25052
  if (!Array.isArray(node)) {
25051
25053
  if (!nodePredicate(node)) {
25052
- throw new _swagger_api_apidom_error__WEBPACK_IMPORTED_MODULE_0__["default"](`Invalid AST Node: ${JSON.stringify(node)}`);
25054
+ throw new _swagger_api_apidom_error__WEBPACK_IMPORTED_MODULE_0__["default"](`Invalid AST Node: ${String(node)}`, {
25055
+ node
25056
+ });
25053
25057
  }
25054
25058
 
25055
25059
  // cycle detected; skipping over a sub-tree to avoid recursion
@@ -25131,7 +25135,14 @@ __webpack_require__.r(__webpack_exports__);
25131
25135
  /* harmony export */ });
25132
25136
  /* harmony import */ var _swagger_api_apidom_error__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(69985);
25133
25137
 
25134
- class CloneError extends _swagger_api_apidom_error__WEBPACK_IMPORTED_MODULE_0__["default"] {}
25138
+ class CloneError extends _swagger_api_apidom_error__WEBPACK_IMPORTED_MODULE_0__["default"] {
25139
+ constructor(message, structuredOptions) {
25140
+ super(message, structuredOptions);
25141
+ if (typeof structuredOptions !== 'undefined') {
25142
+ this.value = structuredOptions.source;
25143
+ }
25144
+ }
25145
+ }
25135
25146
  /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (CloneError);
25136
25147
 
25137
25148
  /***/ }),
@@ -25176,32 +25187,72 @@ __webpack_require__.r(__webpack_exports__);
25176
25187
  /* harmony export */ cloneShallow: () => (/* binding */ cloneShallow)
25177
25188
  /* harmony export */ });
25178
25189
  /* harmony import */ var minim__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(67952);
25179
- /* harmony import */ var _predicates_index_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(36903);
25180
- /* harmony import */ var _errors_DeepCloneError_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(34646);
25190
+ /* harmony import */ var _predicates_index_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(36903);
25191
+ /* harmony import */ var _errors_DeepCloneError_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(34646);
25181
25192
  /* harmony import */ var _errors_ShallowCloneError_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(10219);
25182
25193
 
25183
25194
 
25184
25195
 
25185
25196
 
25186
- const invokeClone = value => {
25187
- if (typeof (value === null || value === void 0 ? void 0 : value.clone) === 'function') {
25188
- return value.clone();
25197
+ const cloneDeep = (value, options = {}) => {
25198
+ const {
25199
+ visited = new WeakMap()
25200
+ } = options;
25201
+ const passThroughOptions = {
25202
+ ...options,
25203
+ visited
25204
+ };
25205
+
25206
+ // detect cycle and return memoized value
25207
+ if (visited.has(value)) {
25208
+ return visited.get(value);
25209
+ }
25210
+ if (value instanceof minim__WEBPACK_IMPORTED_MODULE_0__.KeyValuePair) {
25211
+ const {
25212
+ key,
25213
+ value: val
25214
+ } = value;
25215
+ const keyCopy = (0,_predicates_index_mjs__WEBPACK_IMPORTED_MODULE_1__.isElement)(key) ? cloneDeep(key, passThroughOptions) : key;
25216
+ const valueCopy = (0,_predicates_index_mjs__WEBPACK_IMPORTED_MODULE_1__.isElement)(val) ? cloneDeep(val, passThroughOptions) : val;
25217
+ const copy = new minim__WEBPACK_IMPORTED_MODULE_0__.KeyValuePair(keyCopy, valueCopy);
25218
+ visited.set(value, copy);
25219
+ return copy;
25189
25220
  }
25190
- return value;
25191
- };
25192
- const cloneDeep = value => {
25193
25221
  if (value instanceof minim__WEBPACK_IMPORTED_MODULE_0__.ObjectSlice) {
25194
- const items = [...value].map(invokeClone);
25195
- return new minim__WEBPACK_IMPORTED_MODULE_0__.ObjectSlice(items);
25222
+ const mapper = element => cloneDeep(element, passThroughOptions);
25223
+ const items = [...value].map(mapper);
25224
+ const copy = new minim__WEBPACK_IMPORTED_MODULE_0__.ObjectSlice(items);
25225
+ visited.set(value, copy);
25226
+ return copy;
25196
25227
  }
25197
25228
  if (value instanceof minim__WEBPACK_IMPORTED_MODULE_0__.ArraySlice) {
25198
- const items = [...value].map(invokeClone);
25199
- return new minim__WEBPACK_IMPORTED_MODULE_0__.ArraySlice(items);
25229
+ const mapper = element => cloneDeep(element, passThroughOptions);
25230
+ const items = [...value].map(mapper);
25231
+ const copy = new minim__WEBPACK_IMPORTED_MODULE_0__.ArraySlice(items);
25232
+ visited.set(value, copy);
25233
+ return copy;
25200
25234
  }
25201
- if (typeof (value === null || value === void 0 ? void 0 : value.clone) === 'function') {
25202
- return value.clone();
25235
+ if ((0,_predicates_index_mjs__WEBPACK_IMPORTED_MODULE_1__.isElement)(value)) {
25236
+ const copy = cloneShallow(value); // eslint-disable-line @typescript-eslint/no-use-before-define
25237
+
25238
+ visited.set(value, copy);
25239
+ if (value.content) {
25240
+ if ((0,_predicates_index_mjs__WEBPACK_IMPORTED_MODULE_1__.isElement)(value.content)) {
25241
+ copy.content = cloneDeep(value.content, passThroughOptions);
25242
+ } else if (value.content instanceof minim__WEBPACK_IMPORTED_MODULE_0__.KeyValuePair) {
25243
+ copy.content = cloneDeep(value.content, passThroughOptions);
25244
+ } else if (Array.isArray(value.content)) {
25245
+ const mapper = element => cloneDeep(element, passThroughOptions);
25246
+ copy.content = value.content.map(mapper);
25247
+ } else {
25248
+ copy.content = value.content;
25249
+ }
25250
+ } else {
25251
+ copy.content = value.content;
25252
+ }
25253
+ return copy;
25203
25254
  }
25204
- throw new _errors_DeepCloneError_mjs__WEBPACK_IMPORTED_MODULE_1__["default"]("Value provided to cloneDeep function couldn't be cloned", {
25255
+ throw new _errors_DeepCloneError_mjs__WEBPACK_IMPORTED_MODULE_2__["default"]("Value provided to cloneDeep function couldn't be cloned", {
25205
25256
  value
25206
25257
  });
25207
25258
  };
@@ -25239,7 +25290,7 @@ const cloneShallowElement = element => {
25239
25290
  if (element.attributes.length > 0) {
25240
25291
  copy._attributes = cloneDeep(element.attributes);
25241
25292
  }
25242
- if ((0,_predicates_index_mjs__WEBPACK_IMPORTED_MODULE_2__.isElement)(element.content)) {
25293
+ if ((0,_predicates_index_mjs__WEBPACK_IMPORTED_MODULE_1__.isElement)(element.content)) {
25243
25294
  const content = element.content;
25244
25295
  copy.content = cloneShallowElement(content);
25245
25296
  } else if (Array.isArray(element.content)) {
@@ -25263,7 +25314,7 @@ const cloneShallow = value => {
25263
25314
  if (value instanceof minim__WEBPACK_IMPORTED_MODULE_0__.ArraySlice) {
25264
25315
  return cloneShallowArraySlice(value);
25265
25316
  }
25266
- if ((0,_predicates_index_mjs__WEBPACK_IMPORTED_MODULE_2__.isElement)(value)) {
25317
+ if ((0,_predicates_index_mjs__WEBPACK_IMPORTED_MODULE_1__.isElement)(value)) {
25267
25318
  return cloneShallowElement(value);
25268
25319
  }
25269
25320
  throw new _errors_ShallowCloneError_mjs__WEBPACK_IMPORTED_MODULE_3__["default"]("Value provided to cloneShallow function couldn't be cloned", {
@@ -25507,19 +25558,25 @@ __webpack_require__.r(__webpack_exports__);
25507
25558
  /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__),
25508
25559
  /* harmony export */ isElementType: () => (/* binding */ isElementType)
25509
25560
  /* harmony export */ });
25510
- const hasMethod = (name, obj) => typeof (obj === null || obj === void 0 ? void 0 : obj[name]) === 'function';
25511
- const hasBasicElementProps = element => element != null && Object.prototype.hasOwnProperty.call(element, '_storedElement') && Object.prototype.hasOwnProperty.call(element, '_content');
25512
- const primitiveEq = (val, obj) => {
25513
- var _obj$primitive;
25514
- return (obj === null || obj === void 0 || (_obj$primitive = obj.primitive) === null || _obj$primitive === void 0 ? void 0 : _obj$primitive.call(obj)) === val;
25561
+ /* harmony import */ var minim__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(67952);
25562
+
25563
+ const hasMethod = (name, element) => {
25564
+ return typeof element === 'object' && element !== null && name in element && typeof element[name] === 'function';
25515
25565
  };
25516
- const hasClass = (cls, obj) => {
25517
- var _obj$classes, _obj$classes$includes;
25518
- return (obj === null || obj === void 0 || (_obj$classes = obj.classes) === null || _obj$classes === void 0 || (_obj$classes$includes = _obj$classes.includes) === null || _obj$classes$includes === void 0 ? void 0 : _obj$classes$includes.call(_obj$classes, cls)) || false;
25566
+ const hasBasicElementProps = element => typeof element === 'object' && element != null && '_storedElement' in element && typeof element._storedElement === 'string' &&
25567
+ // eslint-disable-line no-underscore-dangle
25568
+ '_content' in element;
25569
+ const primitiveEq = (val, element) => {
25570
+ if (typeof element === 'object' && element !== null && 'primitive' in element) {
25571
+ return typeof element.primitive === 'function' && element.primitive() === val;
25572
+ }
25573
+ return false;
25519
25574
  };
25520
- const isElementType = (name, element) => (element === null || element === void 0 ? void 0 : element.element) === name;
25575
+ const hasClass = (cls, element) => {
25576
+ return typeof element === 'object' && element !== null && 'classes' in element && (Array.isArray(element.classes) || element.classes instanceof minim__WEBPACK_IMPORTED_MODULE_0__.ArrayElement) && element.classes.includes(cls);
25577
+ };
25578
+ const isElementType = (name, element) => typeof element === 'object' && element !== null && 'element' in element && element.element === name;
25521
25579
  const createPredicate = predicateCreator => {
25522
- // @ts-ignore
25523
25580
  return predicateCreator({
25524
25581
  hasMethod,
25525
25582
  hasBasicElementProps,
@@ -25670,8 +25727,7 @@ const isPrimitiveElement = element => {
25670
25727
  return (0,_helpers_mjs__WEBPACK_IMPORTED_MODULE_1__.isElementType)('object', element) || (0,_helpers_mjs__WEBPACK_IMPORTED_MODULE_1__.isElementType)('array', element) || (0,_helpers_mjs__WEBPACK_IMPORTED_MODULE_1__.isElementType)('boolean', element) || (0,_helpers_mjs__WEBPACK_IMPORTED_MODULE_1__.isElementType)('number', element) || (0,_helpers_mjs__WEBPACK_IMPORTED_MODULE_1__.isElementType)('string', element) || (0,_helpers_mjs__WEBPACK_IMPORTED_MODULE_1__.isElementType)('null', element) || (0,_helpers_mjs__WEBPACK_IMPORTED_MODULE_1__.isElementType)('member', element);
25671
25728
  };
25672
25729
  const hasElementSourceMap = element => {
25673
- var _element$meta, _element$meta$get;
25674
- return isSourceMapElement(element === null || element === void 0 || (_element$meta = element.meta) === null || _element$meta === void 0 || (_element$meta$get = _element$meta.get) === null || _element$meta$get === void 0 ? void 0 : _element$meta$get.call(_element$meta, 'sourceMap'));
25730
+ return isSourceMapElement(element.meta.get('sourceMap'));
25675
25731
  };
25676
25732
  const includesSymbols = (symbols, element) => {
25677
25733
  if (symbols.length === 0) {