Socket
Socket
Sign inDemoInstall

@swagger-api/apidom-core

Package Overview
Dependencies
Maintainers
1
Versions
52
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@swagger-api/apidom-core - npm Package Compare versions

Comparing version 0.76.2 to 0.77.0

cjs/clone/errors/CloneError.cjs

11

CHANGELOG.md

@@ -6,2 +6,13 @@ # Change Log

# [0.77.0](https://github.com/swagger-api/apidom/compare/v0.76.2...v0.77.0) (2023-10-03)
### Bug Fixes
- **core:** always perform immutable async traversal ([#3164](https://github.com/swagger-api/apidom/issues/3164)) ([a47f870](https://github.com/swagger-api/apidom/commit/a47f87018fcca235bd1490e1f014bcdd2430b2d5)), closes [#3110](https://github.com/swagger-api/apidom/issues/3110)
- **core:** always perform immutable traversal ([#3163](https://github.com/swagger-api/apidom/issues/3163)) ([f2fcab0](https://github.com/swagger-api/apidom/commit/f2fcab0c7a68ca0c39fae6165ff9b5fdf0f12e52)), closes [#3110](https://github.com/swagger-api/apidom/issues/3110)
### Features
- **core:** introduce functions for shallow and deep cloning ([#3158](https://github.com/swagger-api/apidom/issues/3158)) ([549a7ff](https://github.com/swagger-api/apidom/commit/549a7ff01396a0a9ecb02171c9f817bcfe0f4af6)), closes [#3110](https://github.com/swagger-api/apidom/issues/3110)
## [0.76.2](https://github.com/swagger-api/apidom/compare/v0.76.1...v0.76.2) (2023-09-08)

@@ -8,0 +19,0 @@

8

package.json
{
"name": "@swagger-api/apidom-core",
"version": "0.76.2",
"version": "0.77.0",
"description": "Tools for manipulating ApiDOM structures.",

@@ -45,4 +45,4 @@ "publishConfig": {

"@babel/runtime-corejs3": "^7.20.7",
"@swagger-api/apidom-ast": "^0.76.2",
"@swagger-api/apidom-error": "^0.76.2",
"@swagger-api/apidom-ast": "^0.77.0",
"@swagger-api/apidom-error": "^0.77.0",
"@types/ramda": "~0.29.3",

@@ -66,3 +66,3 @@ "minim": "~0.23.8",

],
"gitHead": "8c6c02f813a663cfaf0ac0963f2b4fd25b8dffe8"
"gitHead": "cd8a9d7d2ea8bb8c335c23cd4632830a79c426c9"
}

@@ -563,12 +563,33 @@ # @swagger-api/apidom-core

#### ObjectElement example
```js
import { ObjectElement, parents } from '@swagger-api/apidom-core';
import { parents, ObjectElement } from '@swagger-api/apidom-core';
const objectElement = new ObjectElement({
a: [1, 2, { b: 'c', d: 'e' }],
});
const objectElement = new ObjectElement({ key: 'value' });
const memberElement = objectElement.getMember('key');
const { key: keyElement, value: valueElement } = memberElement;
const parentEdges = parents(objectElement); // => WeakMap<childElement, parentElement>
const parentEdges = parents(objectElement); // => WeakMap<ChildElement, ParentElement>
parentEdges.get(memberElement) === objectElement; // => true
parentEdges.get(keyElement) === memberElement; // => true
parentEdges.get(valueElement) === memberElement; // => true
```
#### ArrayElement example
```js
import { parents, ArrayElement, StringElement } from '@swagger-api/apidom-core';
const itemElement1 = new StringElement('item1');
const itemElement2 = new StringElement('item2');
const arrayElement = new ArrayElement([itemElement1, itemElement2]);
const parentEdges = parents(arrayElement); // => WeakMap<ChildElement, ParentElement>
parentEdges.get(itemElement1) === arrayElement; // => true
parentEdges.get(itemElement2) === arrayElement; // => true
```
---

@@ -681,1 +702,28 @@

```
## Cloning
Following functions provide mechanism for creating shallow and deep copies of ApiDOM elements.
### Shallow cloning
Creates shallow clone of ApiDOM element.
```js
import { cloneShallow, ObjectElement } from '@swagger-api/apidom-core';
const objectElement = new ObjectElement({ a: 'b' });
const objectElementShallowClone = cloneShallow(objectElement);
```
### Deep cloning
Creates deep clone of ApiDOM Element.
```js
import { cloneDeep, ObjectElement } from '@swagger-api/apidom-core';
const objectElement = new ObjectElement({ a: 'b' });
const objectElementDeepClone = cloneDeep(objectElement);
```
/// <reference path="./minim.d.ts" />
import { Element, ArrayElement, Meta, Attributes, Namespace as Namespace$1, NamespacePlugin, StringElement, ArraySlice, ObjectElement } from 'minim';
import { Element, ArrayElement, Meta, Attributes, Namespace as Namespace$1, NamespacePlugin, StringElement, ArraySlice, KeyValuePair, ObjectSlice, ObjectElement } from 'minim';
export { ArrayElement, ArraySlice, Attributes, BooleanElement, Element, KeyValuePair, LinkElement, MemberElement, Meta, NamespacePluginOptions, NullElement, NumberElement, ObjectElement, ObjectSlice, RefElement, StringElement, refract } from 'minim';
import { Pred } from 'ramda';
import stampit from 'stampit';
import { ApiDOMStructuredError } from '@swagger-api/apidom-error';
export { BREAK, mergeAllVisitors } from '@swagger-api/apidom-ast';

@@ -149,2 +150,3 @@

declare const getNodeType: <T extends Element>(element: T) => string | undefined;
declare const cloneNode: <T>(node: T) => T;
declare const keyMapDefault: {

@@ -204,2 +206,45 @@ ObjectElement: string[];

type FinalCloneTypes = KeyValuePair | ArraySlice | ObjectSlice;
declare const cloneDeep: {
<T extends Element | FinalCloneTypes>(value: T): T;
safe<T_1>(value: T_1): T_1;
};
declare const cloneShallow: {
<T extends Element | FinalCloneTypes>(value: T): T;
safe<T_1>(value: T_1): T_1;
};
declare class CloneError extends ApiDOMStructuredError {
}
declare class DeepCloneError extends CloneError {
}
declare class ShallowCloneError extends CloneError {
}
/**
* Transforms data to an Element from a particular namespace.
*/
declare const from: (data: any, namespace?: Namespace$1) => Element;
declare const serializer$2: <T extends unknown>(element: T) => any;
declare const serializer$1: (element: Element, replacer?: ((this: any, key: string, value: any) => any) | undefined, space?: string | number) => string;
declare const serializer: (element: Element, { directive }?: {
directive?: boolean | undefined;
}) => string;
/**
* Creates a refract representation of an Element.
* https://github.com/refractproject/refract-spec
*/
declare const dehydrate: (element: Element, namespace?: Namespace$1) => any;
/**
* Create a refracted string representation of an Element.
*/
declare const toString: (element: Element, namespace?: Namespace$1) => string;
declare const sexprs: (element: Element) => string;

@@ -232,32 +277,2 @@

/**
* Transforms data to an Element from a particular namespace.
*/
declare const from: (data: any, namespace?: Namespace$1) => Element;
/**
* Transforms the ApiDOM into JavaScript POJO.
* This POJO would be the result of interpreting the ApiDOM
* into JavaScript structure.
*/
declare const toValue: <T extends Element>(element: T) => any;
/**
* Transforms the ApiDOM into JSON string.
*/
declare const toJSON: (element: Element, replacer?: ((this: any, key: string, value: any) => any) | undefined, space?: string | number | undefined) => string;
/**
* Transforms the ApiDOM into YAML string.
*/
declare const toYAML: (element: Element, { directive }?: {
directive?: boolean | undefined;
}) => string;
/**
* Creates a refract representation of an Element.
* https://github.com/refractproject/refract-spec
*/
declare const dehydrate: (element: Element, namespace?: Namespace$1) => any;
/**
* Create a refracted string representation of an Element.
*/
declare const toString: (element: Element, namespace?: Namespace$1) => string;
export { Annotation as AnnotationElement, Comment as CommentElement, MediaTypes, Namespace, ParseResult as ParseResultElement, Position, PositionRange, SourceMap as SourceMapElement, Transcluder, createNamespace, createPredicate, deepmerge, dehydrate, dereference, dispatchPlugins as dispatchRefractorPlugins, filter, find, findAtOffset, from, getNodeType, hasElementSourceMap, includesClasses, includesSymbols, isAnnotationElement, isArrayElement, isBooleanElement, isElement, isLinkElement, isMemberElement, isNullElement, isNumberElement, isObjectElement, isParseResultElement, isPrimitiveElement, isRefElement, isSourceMapElement, isStringElement, keyMapDefault as keyMap, namespace, parents, plugin$1 as refractorPluginElementIdentity, plugin as refractorPluginSemanticElementIdentity, reject, sexprs, some, toJSON, toString, toValue, toYAML, transclude, traverse, visit };
export { Annotation as AnnotationElement, CloneError, Comment as CommentElement, DeepCloneError, MediaTypes, Namespace, ParseResult as ParseResultElement, Position, PositionRange, ShallowCloneError, SourceMap as SourceMapElement, Transcluder, cloneDeep, cloneNode, cloneShallow, createNamespace, createPredicate, deepmerge, dehydrate, dereference, dispatchPlugins as dispatchRefractorPlugins, filter, find, findAtOffset, from, getNodeType, hasElementSourceMap, includesClasses, includesSymbols, isAnnotationElement, isArrayElement, isBooleanElement, isElement, isLinkElement, isMemberElement, isNullElement, isNumberElement, isObjectElement, isParseResultElement, isPrimitiveElement, isRefElement, isSourceMapElement, isStringElement, keyMapDefault as keyMap, namespace, parents, plugin$1 as refractorPluginElementIdentity, plugin as refractorPluginSemanticElementIdentity, reject, sexprs, some, serializer$1 as toJSON, toString, serializer$2 as toValue, serializer as toYAML, transclude, traverse, visit };

@@ -217,7 +217,19 @@ /* eslint-disable spaced-comment, max-classes-per-file */

toValue(): any;
clone(): ArraySlice;
}
export class ObjectSlice extends ArraySlice {}
export class ObjectSlice extends ArraySlice {
clone(): ObjectSlice;
}
export class KeyValuePair {}
export class KeyValuePair {
public key: Element | undefined;
public value: Element | undefined;
constructor(key?: Element, value?: Element);
clone(): KeyValuePair;
}
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc