@pocket-architect/core 0.1.9 → 0.1.11

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/build/Entity.d.ts CHANGED
@@ -1,10 +1,10 @@
1
1
  import { EntityId } from './EntityId';
2
2
  export declare abstract class Entity<T, E, H extends EntityId<E>> {
3
- protected readonly _id: EntityId<E>;
3
+ protected readonly _id: H;
4
4
  protected props: T;
5
5
  protected constructor(props: T, id?: H | E);
6
6
  equals(object?: Entity<T, E, H>): boolean;
7
- get id(): EntityId<E>;
7
+ get id(): H;
8
8
  toPrimitive(): T;
9
9
  toJSON(): T;
10
10
  }
@@ -1,7 +1,6 @@
1
1
  export declare class EntityId<T> {
2
2
  protected _recordId: T | null;
3
3
  protected _uuid: string;
4
- protected _hasValue: boolean;
5
4
  constructor(recordId?: T, uuid?: string);
6
5
  toPrimitive(): T;
7
6
  toString(): string;
package/build/EntityId.js CHANGED
@@ -10,14 +10,13 @@ var EntityId = /** @class */ (function () {
10
10
  if (uuid === void 0) { uuid = null; }
11
11
  this._recordId = null;
12
12
  this._uuid = null;
13
- this._hasValue = false;
14
13
  this._recordId = recordId ? recordId : null;
15
14
  if (!uuid) {
16
15
  this._uuid = (0, uuid_by_string_1.default)(recordId ? recordId.toString() : (0, cuid2_1.createId)(), (0, uuid_by_string_1.default)(this.constructor.name));
17
16
  }
18
17
  }
19
18
  EntityId.prototype.toPrimitive = function () {
20
- return this._hasValue ? this._recordId : null;
19
+ return this._recordId;
21
20
  };
22
21
  EntityId.prototype.toString = function () {
23
22
  return this._uuid;
@@ -1 +1 @@
1
- {"version":3,"file":"EntityId.js","sourceRoot":"","sources":["../src/EntityId.ts"],"names":[],"mappings":";;;;AAAA,0EAAuC;AACvC,8CAA+C;AAE/C;IAKE,kBAAY,QAAkB,EAAE,IAAmB;QAAvC,yBAAA,EAAA,eAAkB;QAAE,qBAAA,EAAA,WAAmB;QAJzC,cAAS,GAAW,IAAI,CAAC;QACzB,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QAAQ,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,IAAA,gBAAQ,GAAE,EAAE,IAAA,wBAAU,EAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC;QAC1G,CAAC;IACH,CAAC;IAED,8BAAW,GAAX;QACE,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IAED,2BAAQ,GAAR;QACE,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;IAED,yBAAM,GAAN,UAAO,EAAe;QACpB,OAAO,IAAI,CAAC,KAAK,KAAK,EAAE,CAAC,KAAK,CAAC;IACjC,CAAC;IACH,eAAC;AAAD,CAAC,AAtBD,IAsBC;AAtBY,4BAAQ"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pocket-architect/core",
3
- "version": "0.1.9",
3
+ "version": "0.1.11",
4
4
  "description": "",
5
5
  "main": "build/index.js",
6
6
  "scripts": {
package/src/Entity.ts CHANGED
@@ -5,7 +5,7 @@ const isEntity = <T, E, M extends EntityId<E>>(v: Entity<T, E, M>): v is Entity<
5
5
  }
6
6
 
7
7
  export abstract class Entity<T, E, H extends EntityId<E>> {
8
- protected readonly _id: EntityId<E>;
8
+ protected readonly _id: H;
9
9
  protected props: T;
10
10
 
11
11
  protected constructor(props: T, id?: H|E) {
@@ -33,7 +33,7 @@ export abstract class Entity<T, E, H extends EntityId<E>> {
33
33
  return this._id.equals(object._id);
34
34
  }
35
35
 
36
- get id(): EntityId<E> {
36
+ get id(): H {
37
37
  return this._id
38
38
  }
39
39
 
package/src/EntityId.ts CHANGED
@@ -4,7 +4,6 @@ import { createId } from '@paralleldrive/cuid2'
4
4
  export class EntityId<T> {
5
5
  protected _recordId: T|null = null;
6
6
  protected _uuid: string = null;
7
- protected _hasValue: boolean = false;
8
7
 
9
8
  constructor(recordId: T = null, uuid: string = null) {
10
9
  this._recordId = recordId ? recordId : null;
@@ -14,7 +13,7 @@ export class EntityId<T> {
14
13
  }
15
14
 
16
15
  toPrimitive(): T {
17
- return this._hasValue ? this._recordId : null;
16
+ return this._recordId;
18
17
  }
19
18
 
20
19
  toString(): string {