@swagger-api/apidom-core 0.99.1 → 1.0.0-alpha.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,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
+ # [1.0.0-alpha.0](https://github.com/swagger-api/apidom/compare/v0.99.2...v1.0.0-alpha.0) (2024-05-14)
7
+
8
+ ### Features
9
+
10
+ - **core:** change from stamps to TypeScript classes ([#4095](https://github.com/swagger-api/apidom/issues/4095)) ([3bb7131](https://github.com/swagger-api/apidom/commit/3bb71317420583b0b5e56ca9a6e55bbca9596bfc)), closes [#3481](https://github.com/swagger-api/apidom/issues/3481)
11
+
12
+ ### BREAKING CHANGES
13
+
14
+ - **core:** IdentityManager from apidom-core package became a class and requires to be instantiated with new operator.
15
+
16
+ ## [0.99.2](https://github.com/swagger-api/apidom/compare/v0.99.1...v0.99.2) (2024-04-30)
17
+
18
+ **Note:** Version bump only for package @swagger-api/apidom-core
19
+
6
20
  ## [0.99.1](https://github.com/swagger-api/apidom/compare/v0.99.0...v0.99.1) (2024-04-05)
7
21
 
8
22
  **Note:** Version bump only for package @swagger-api/apidom-core
@@ -4,61 +4,52 @@ var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequ
4
4
  exports.__esModule = true;
5
5
  exports.defaultIdentityManager = exports.IdentityManager = void 0;
6
6
  var _minim = require("minim");
7
- var _stampit = _interopRequireDefault(require("stampit"));
8
7
  var _shortUniqueId = _interopRequireDefault(require("short-unique-id"));
9
8
  var _ElementIdentityError = _interopRequireDefault(require("./errors/ElementIdentityError.cjs"));
10
9
  var _index = require("../predicates/index.cjs");
11
- // @TODO(oliwia.rogala@smartbear.com): transforming this stamp to class will break backward compatibility
12
- const IdentityManager = exports.IdentityManager = (0, _stampit.default)({
13
- props: {
14
- uuid: null,
15
- length: null,
16
- identityMap: null
17
- },
18
- init({
10
+ class IdentityManager {
11
+ uuid;
12
+ identityMap;
13
+ constructor({
19
14
  length = 6
20
15
  } = {}) {
21
- this.length = 6;
22
16
  this.uuid = new _shortUniqueId.default({
23
17
  length
24
18
  });
25
19
  this.identityMap = new WeakMap();
26
- },
27
- methods: {
28
- identify(element) {
29
- if (!(0, _index.isElement)(element)) {
30
- throw new _ElementIdentityError.default('Cannot not identify the element. `element` is neither structurally compatible nor a subclass of an Element class.', {
31
- value: element
32
- });
33
- }
20
+ }
21
+ identify(element) {
22
+ if (!(0, _index.isElement)(element)) {
23
+ throw new _ElementIdentityError.default('Cannot not identify the element. `element` is neither structurally compatible nor a subclass of an Element class.', {
24
+ value: element
25
+ });
26
+ }
34
27
 
35
- // use already assigned identity
36
- if (element.meta.hasKey('id') && (0, _index.isStringElement)(element.meta.get('id')) && !element.meta.get('id').equals('')) {
37
- return element.id;
38
- }
28
+ // use already assigned identity
29
+ if (element.meta.hasKey('id') && (0, _index.isStringElement)(element.meta.get('id')) && !element.meta.get('id').equals('')) {
30
+ return element.id;
31
+ }
39
32
 
40
- // assign identity in immutable way
41
- if (this.identityMap.has(element)) {
42
- return this.identityMap.get(element);
43
- }
33
+ // assign identity in immutable way
34
+ if (this.identityMap.has(element)) {
35
+ return this.identityMap.get(element);
36
+ }
44
37
 
45
- // return element identity
46
- const id = new _minim.StringElement(this.generateId());
47
- this.identityMap.set(element, id);
48
- return id;
49
- },
50
- forget(element) {
51
- if (this.identityMap.has(element)) {
52
- this.identityMap.delete(element);
53
- return true;
54
- }
55
- return false;
56
- },
57
- generateId() {
58
- return this.uuid.randomUUID();
38
+ // return element identity
39
+ const id = new _minim.StringElement(this.generateId());
40
+ this.identityMap.set(element, id);
41
+ return id;
42
+ }
43
+ forget(element) {
44
+ if (this.identityMap.has(element)) {
45
+ this.identityMap.delete(element);
46
+ return true;
59
47
  }
48
+ return false;
49
+ }
50
+ generateId() {
51
+ return this.uuid.randomUUID();
60
52
  }
61
- });
62
- const defaultIdentityManager = exports.defaultIdentityManager = IdentityManager({
63
- length: 6
64
- });
53
+ }
54
+ exports.IdentityManager = IdentityManager;
55
+ const defaultIdentityManager = exports.defaultIdentityManager = new IdentityManager();
@@ -13,7 +13,7 @@ const plugin = ({
13
13
  let identityManager;
14
14
  return {
15
15
  pre() {
16
- identityManager = (0, _index.IdentityManager)({
16
+ identityManager = new _index.IdentityManager({
17
17
  length
18
18
  });
19
19
  },
@@ -15,7 +15,7 @@ const plugin = ({
15
15
  let identityManager;
16
16
  return {
17
17
  pre() {
18
- identityManager = (0, _index.IdentityManager)({
18
+ identityManager = new _index.IdentityManager({
19
19
  length
20
20
  });
21
21
  },