ddd-node 6.0.0 → 6.1.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.
@@ -7,8 +7,8 @@ export declare class ModelType<Prefix extends string = string> {
7
7
  readonly prefix: Prefix;
8
8
  readonly name: string;
9
9
  constructor(prefix: Prefix, name: string);
10
- static fromPattern<Prefix extends string = string>(template: ModelTypePattern<Prefix>): ModelType<Prefix>;
11
- static isModelTypePattern(type: string): type is ModelTypePattern;
10
+ static from<Prefix extends string = string>(value: ModelTypePattern<Prefix>): ModelType<Prefix>;
11
+ static isPattern(type: string): type is ModelTypePattern;
12
12
  get value(): ModelTypePattern<Prefix>;
13
13
  }
14
14
  export type PrefixOf<T extends ModelType> = T extends ModelType<infer Prefix> ? Prefix : never;
@@ -20,8 +20,8 @@ export declare const createPrefixedModelTypeClass: <Prefix extends string = stri
20
20
  readonly name: string;
21
21
  readonly value: `${Prefix}#${string}`;
22
22
  };
23
- fromPattern<Prefix_1 extends string = string>(template: `${Prefix_1}#${string}`): ModelType<Prefix_1>;
24
- isModelTypePattern(type: string): type is `${string}#${string}`;
23
+ from<Prefix_1 extends string = string>(value: `${Prefix_1}#${string}`): ModelType<Prefix_1>;
24
+ isPattern(type: string): type is `${string}#${string}`;
25
25
  };
26
26
  export declare const EntityTypePrefix: "Entity";
27
27
  declare const EntityType_base: {
@@ -30,8 +30,8 @@ declare const EntityType_base: {
30
30
  readonly name: string;
31
31
  readonly value: `Entity#${string}`;
32
32
  };
33
- fromPattern<Prefix extends string = string>(template: `${Prefix}#${string}`): ModelType<Prefix>;
34
- isModelTypePattern(type: string): type is `${string}#${string}`;
33
+ from<Prefix extends string = string>(value: `${Prefix}#${string}`): ModelType<Prefix>;
34
+ isPattern(type: string): type is `${string}#${string}`;
35
35
  };
36
36
  export declare class EntityType extends EntityType_base {
37
37
  }
@@ -42,8 +42,8 @@ declare const AggregateType_base: {
42
42
  readonly name: string;
43
43
  readonly value: `Aggregate#${string}`;
44
44
  };
45
- fromPattern<Prefix extends string = string>(template: `${Prefix}#${string}`): ModelType<Prefix>;
46
- isModelTypePattern(type: string): type is `${string}#${string}`;
45
+ from<Prefix extends string = string>(value: `${Prefix}#${string}`): ModelType<Prefix>;
46
+ isPattern(type: string): type is `${string}#${string}`;
47
47
  };
48
48
  export declare class AggregateType extends AggregateType_base {
49
49
  }
@@ -54,8 +54,8 @@ declare const EventType_base: {
54
54
  readonly name: string;
55
55
  readonly value: `Event#${string}`;
56
56
  };
57
- fromPattern<Prefix extends string = string>(template: `${Prefix}#${string}`): ModelType<Prefix>;
58
- isModelTypePattern(type: string): type is `${string}#${string}`;
57
+ from<Prefix extends string = string>(value: `${Prefix}#${string}`): ModelType<Prefix>;
58
+ isPattern(type: string): type is `${string}#${string}`;
59
59
  };
60
60
  export declare class EventType extends EventType_base {
61
61
  }
@@ -66,8 +66,8 @@ declare const CommandType_base: {
66
66
  readonly name: string;
67
67
  readonly value: `Command#${string}`;
68
68
  };
69
- fromPattern<Prefix extends string = string>(template: `${Prefix}#${string}`): ModelType<Prefix>;
70
- isModelTypePattern(type: string): type is `${string}#${string}`;
69
+ from<Prefix extends string = string>(value: `${Prefix}#${string}`): ModelType<Prefix>;
70
+ isPattern(type: string): type is `${string}#${string}`;
71
71
  };
72
72
  export declare class CommandType extends CommandType_base {
73
73
  }
@@ -78,8 +78,8 @@ declare const ValueObjectType_base: {
78
78
  readonly name: string;
79
79
  readonly value: `ValueObject#${string}`;
80
80
  };
81
- fromPattern<Prefix extends string = string>(template: `${Prefix}#${string}`): ModelType<Prefix>;
82
- isModelTypePattern(type: string): type is `${string}#${string}`;
81
+ from<Prefix extends string = string>(value: `${Prefix}#${string}`): ModelType<Prefix>;
82
+ isPattern(type: string): type is `${string}#${string}`;
83
83
  };
84
84
  export declare class ValueObjectType extends ValueObjectType_base {
85
85
  }
@@ -8,14 +8,14 @@ class ModelType {
8
8
  this.prefix = prefix;
9
9
  this.name = name;
10
10
  }
11
- static fromPattern(template) {
12
- if (!this.isModelTypePattern(template))
13
- throw new Error("Invalid template");
14
- const [prefix, ...names] = template.split(exports.seperator);
11
+ static from(value) {
12
+ if (!this.isPattern(value))
13
+ throw new Error("Invalid value");
14
+ const [prefix, ...names] = value.split(exports.seperator);
15
15
  const name = names.join(exports.seperator);
16
16
  return new ModelType(prefix, name);
17
17
  }
18
- static isModelTypePattern(type) {
18
+ static isPattern(type) {
19
19
  return exports.ModelTypePatternRegex.test(type);
20
20
  }
21
21
  get value() {
@@ -0,0 +1,6 @@
1
+ export * from "./aggregate";
2
+ export * from "./command";
3
+ export * from "./entity";
4
+ export * from "./event";
5
+ export * from "./model";
6
+ export * from "./value-object";
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./aggregate"), exports);
18
+ __exportStar(require("./command"), exports);
19
+ __exportStar(require("./entity"), exports);
20
+ __exportStar(require("./event"), exports);
21
+ __exportStar(require("./model"), exports);
22
+ __exportStar(require("./value-object"), exports);
package/dist/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
1
  export * from "./core";
2
+ export * from "./decorators";
2
3
  export * from "./types";
3
4
  export * from "./utils";
package/dist/index.js CHANGED
@@ -15,5 +15,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./core"), exports);
18
+ __exportStar(require("./decorators"), exports);
18
19
  __exportStar(require("./types"), exports);
19
20
  __exportStar(require("./utils"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ddd-node",
3
- "version": "6.0.0",
3
+ "version": "6.1.0",
4
4
  "description": "Domain Driven Design base for NodeJs",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {