ddd-node 13.0.0 → 14.0.1

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.
Files changed (104) hide show
  1. package/.editorconfig +12 -0
  2. package/dist/core/aggregate/base.d.ts +12 -0
  3. package/dist/core/aggregate/base.js +15 -0
  4. package/dist/core/aggregate/event-sourced-aggregate.d.ts +48 -0
  5. package/dist/core/{aggregate.js → aggregate/event-sourced-aggregate.js} +28 -77
  6. package/dist/core/aggregate/index.d.ts +3 -0
  7. package/dist/core/aggregate/index.js +3 -0
  8. package/dist/core/aggregate/state-aggregate.d.ts +22 -0
  9. package/dist/core/aggregate/state-aggregate.js +35 -0
  10. package/dist/core/aggregate/types.d.ts +4 -0
  11. package/dist/core/aggregate/types.js +1 -0
  12. package/dist/core/entity.d.ts +4 -4
  13. package/dist/core/entity.js +2 -6
  14. package/dist/core/enum.d.ts +3 -2
  15. package/dist/core/enum.js +9 -22
  16. package/dist/core/id/common/index.d.ts +2 -0
  17. package/dist/core/id/common/index.js +2 -0
  18. package/dist/core/id/common/snowflake.d.ts +9 -0
  19. package/dist/core/id/common/snowflake.js +13 -0
  20. package/dist/core/id/common/uuid4.d.ts +6 -0
  21. package/dist/core/id/common/uuid4.js +17 -0
  22. package/dist/core/id/id.d.ts +7 -5
  23. package/dist/core/id/id.js +13 -8
  24. package/dist/core/id/index.d.ts +2 -2
  25. package/dist/core/id/index.js +3 -19
  26. package/dist/core/id/interface.d.ts +10 -0
  27. package/dist/core/id/interface.js +1 -0
  28. package/dist/core/index.d.ts +0 -1
  29. package/dist/core/index.js +8 -25
  30. package/dist/core/message/command.d.ts +8 -5
  31. package/dist/core/message/command.js +10 -9
  32. package/dist/core/message/event.d.ts +9 -7
  33. package/dist/core/message/event.js +9 -11
  34. package/dist/core/message/index.js +3 -19
  35. package/dist/core/message/message.d.ts +6 -2
  36. package/dist/core/message/message.js +13 -14
  37. package/dist/core/model/errors.d.ts +3 -0
  38. package/dist/core/model/errors.js +5 -0
  39. package/dist/core/model/index.js +2 -18
  40. package/dist/core/model/model-with-id.d.ts +7 -7
  41. package/dist/core/model/model-with-id.js +8 -12
  42. package/dist/core/model/model.d.ts +16 -14
  43. package/dist/core/model/model.js +24 -33
  44. package/dist/core/repository.d.ts +2 -2
  45. package/dist/core/repository.js +1 -2
  46. package/dist/core/value-object.d.ts +4 -3
  47. package/dist/core/value-object.js +8 -12
  48. package/dist/decorators/{aggregate → aggregate-es}/handle.d.ts +1 -1
  49. package/dist/decorators/aggregate-es/handle.js +9 -0
  50. package/dist/decorators/aggregate-es/index.js +2 -0
  51. package/dist/decorators/{aggregate → aggregate-es}/when.d.ts +1 -1
  52. package/dist/decorators/aggregate-es/when.js +9 -0
  53. package/dist/decorators/id.d.ts +2 -2
  54. package/dist/decorators/id.js +3 -7
  55. package/dist/decorators/index.d.ts +1 -1
  56. package/dist/decorators/index.js +3 -19
  57. package/dist/decorators/model/enum.d.ts +2 -2
  58. package/dist/decorators/model/enum.js +3 -7
  59. package/dist/decorators/model/index.js +5 -21
  60. package/dist/decorators/model/model-name.d.ts +2 -2
  61. package/dist/decorators/model/model-name.js +3 -7
  62. package/dist/decorators/model/prop.d.ts +1 -1
  63. package/dist/decorators/model/prop.js +3 -7
  64. package/dist/decorators/model/static.d.ts +3 -3
  65. package/dist/decorators/model/static.js +4 -8
  66. package/dist/decorators/model/validator.d.ts +3 -3
  67. package/dist/decorators/model/validator.js +3 -7
  68. package/dist/decorators/type.js +1 -2
  69. package/dist/index.js +5 -21
  70. package/dist/meta/aggregate.metadata.d.ts +5 -5
  71. package/dist/meta/aggregate.metadata.js +19 -22
  72. package/dist/meta/helpers/index.js +1 -17
  73. package/dist/meta/helpers/static-value.d.ts +1 -1
  74. package/dist/meta/helpers/static-value.js +1 -5
  75. package/dist/meta/id.metadata.d.ts +4 -4
  76. package/dist/meta/id.metadata.js +10 -10
  77. package/dist/meta/index.js +4 -20
  78. package/dist/meta/model.metadata.d.ts +1 -1
  79. package/dist/meta/model.metadata.js +22 -37
  80. package/dist/types/class-static.js +1 -2
  81. package/dist/types/class.js +1 -2
  82. package/dist/types/index.js +2 -18
  83. package/dist/utils/index.js +1 -17
  84. package/dist/utils/to-array.js +2 -8
  85. package/package.json +27 -3
  86. package/ts-loader.js +4 -0
  87. package/tsconfig.json +29 -22
  88. package/tsconfig.spec.json +5 -0
  89. package/dist/core/aggregate.d.ts +0 -71
  90. package/dist/core/error.d.ts +0 -4
  91. package/dist/core/error.js +0 -9
  92. package/dist/core/id/built/index.d.ts +0 -2
  93. package/dist/core/id/built/index.js +0 -18
  94. package/dist/core/id/built/snowflake.generator.d.ts +0 -8
  95. package/dist/core/id/built/snowflake.generator.js +0 -16
  96. package/dist/core/id/built/uuid4.generator.d.ts +0 -5
  97. package/dist/core/id/built/uuid4.generator.js +0 -16
  98. package/dist/core/id/id-generator.d.ts +0 -8
  99. package/dist/core/id/id-generator.js +0 -17
  100. package/dist/decorators/aggregate/handle.js +0 -13
  101. package/dist/decorators/aggregate/index.js +0 -18
  102. package/dist/decorators/aggregate/when.js +0 -13
  103. package/tsconfig.build.json +0 -7
  104. /package/dist/decorators/{aggregate → aggregate-es}/index.d.ts +0 -0
package/tsconfig.json CHANGED
@@ -1,17 +1,22 @@
1
1
  {
2
+ "ts-node": {
3
+ // Do not forget to `npm i -D tsconfig-paths`
4
+ "require": ["tsconfig-paths/register"]
5
+ },
2
6
  "compilerOptions": {
3
7
  /* Visit https://aka.ms/tsconfig to read more about this file */
4
8
 
5
9
  /* Projects */
6
10
  // "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */
7
- // "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
11
+ // "composite": true /* Enable constraints that allow a TypeScript project to be used with project references. */,
8
12
  // "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */
9
13
  // "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */
14
+ // "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */
10
15
  // "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
11
16
  // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
12
17
 
13
18
  /* Language and Environment */
14
- "target": "es2016" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */,
19
+ "target": "ES2021" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */,
15
20
  // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
16
21
  // "jsx": "preserve", /* Specify what JSX code is generated. */
17
22
  "experimentalDecorators": true /* Enable experimental support for legacy experimental decorators. */,
@@ -22,48 +27,48 @@
22
27
  // "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */
23
28
  // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
24
29
  // "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
25
- // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */
30
+ // "moduleDetection": "auto" /* Control what method is used to detect module-format JS files. */,
26
31
 
27
32
  /* Modules */
28
- "module": "commonjs" /* Specify what module code is generated. */,
29
- // "rootDir": "./", /* Specify the root folder within your source files. */
30
- // "moduleResolution": "node10", /* Specify how TypeScript looks up a file from a given module specifier. */
33
+ "module": "ES6" /* Specify what module code is generated. */,
34
+ "rootDir": "./" /* Specify the root folder within your source files. */,
35
+ "moduleResolution": "Node" /* Specify how TypeScript looks up a file from a given module specifier. */,
31
36
  "baseUrl": "./" /* Specify the base directory to resolve non-relative module names. */,
32
- "paths": {
33
- "#core": ["src/core/index"],
34
- "#meta": ["src/meta/index"],
35
- "#decorators": ["src/decorators/index"],
36
- "#utils": ["src/utils/index"],
37
- "#types": ["src/types/index"]
38
- } /* Specify a set of entries that re-map imports to additional lookup locations. */,
37
+ // "paths": {
38
+ // "@ddd-node/core": ["./src/core"],
39
+ // "@ddd-node/meta": ["./src/meta"],
40
+ // "@ddd-node/decorators": ["./src/decorators"],
41
+ // "@ddd-node/types": ["./src/types"],
42
+ // "@ddd-node/utils": ["./src/utils"]
43
+ // } /* Specify a set of entries that re-map imports to additional lookup locations. */,
39
44
  // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
40
45
  // "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */
41
46
  // "types": [], /* Specify type package names to be included without being referenced in a source file. */
42
47
  // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
43
48
  // "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */
44
- // "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set. */
49
+ // "allowImportingTsExtensions": true /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set. */,
45
50
  // "resolvePackageJsonExports": true, /* Use the package.json 'exports' field when resolving package imports. */
46
51
  // "resolvePackageJsonImports": true, /* Use the package.json 'imports' field when resolving imports. */
47
52
  // "customConditions": [], /* Conditions to set in addition to the resolver-specific defaults when resolving imports. */
48
- // "resolveJsonModule": true, /* Enable importing .json files. */
53
+ "resolveJsonModule": true /* Enable importing .json files. */,
49
54
  // "allowArbitraryExtensions": true, /* Enable importing files with any extension, provided a declaration file is present. */
50
55
  // "noResolve": true, /* Disallow 'import's, 'require's or '<reference>'s from expanding the number of files TypeScript should add to a project. */
51
56
 
52
57
  /* JavaScript Support */
53
- // "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */
58
+ // "allowJs": true /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */,
54
59
  // "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */
55
60
  // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */
56
61
 
57
62
  /* Emit */
58
63
  "declaration": true /* Generate .d.ts files from TypeScript and JavaScript files in your project. */,
59
64
  // "declarationMap": true, /* Create sourcemaps for d.ts files. */
60
- // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
61
- // "sourceMap": true, /* Create source map files for emitted JavaScript files. */
65
+ // "emitDeclarationOnly": true /* Only output d.ts files and not JavaScript files. */,
66
+ // "sourceMap": true /* Create source map files for emitted JavaScript files. */,
62
67
  // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
63
68
  // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
64
- "outDir": "./dist" /* Specify an output folder for all emitted files. */,
69
+ // "outDir": "dist" /* Specify an output folder for all emitted files. */,
65
70
  // "removeComments": true, /* Disable emitting comments. */
66
- // "noEmit": true, /* Disable emitting files from a compilation. */
71
+ // "noEmit": true /* Disable emitting files from a compilation. */,
67
72
  // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
68
73
  // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types. */
69
74
  // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
@@ -82,7 +87,7 @@
82
87
  /* Interop Constraints */
83
88
  // "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */
84
89
  // "verbatimModuleSyntax": true, /* Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting. */
85
- // "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
90
+ // "allowSyntheticDefaultImports": true /* Allow 'import x from y' when a module doesn't have a default export. */,
86
91
  "esModuleInterop": true /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */,
87
92
  // "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
88
93
  "forceConsistentCasingInFileNames": true /* Ensure that casing is correct in imports. */,
@@ -111,5 +116,7 @@
111
116
  /* Completeness */
112
117
  // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
113
118
  "skipLibCheck": true /* Skip type checking all .d.ts files. */
114
- }
119
+ },
120
+ "include": ["src/**/*", "tsconfig.build.json"],
121
+ "exclude": ["node_modules", "test/**/*"]
115
122
  }
@@ -0,0 +1,5 @@
1
+ {
2
+ "extends": "./tsconfig.json",
3
+ "include": ["test/**/*"],
4
+ "exclude": ["node_modules", "dist"]
5
+ }
@@ -1,71 +0,0 @@
1
- import { ClassStatic } from "../types/index";
2
- import { Class } from "type-fest";
3
- import { EntityBase, EntityMetadata } from "./entity";
4
- import { Id } from "./id";
5
- import { AnyCommand, AnyEvent, EventClass, EventClassWithTypedConstructor } from "./message";
6
- import { Props, PropsOf } from "./model";
7
- export interface AggregateBaseMetadata extends EntityMetadata {
8
- version: number;
9
- }
10
- export declare abstract class AggregateCore<P extends Props> extends EntityBase<P> {
11
- protected readonly _version: number;
12
- constructor(metadata: AggregateBaseMetadata, props?: P);
13
- abstract getVersion(): number;
14
- protected newEvent<E extends AnyEvent>(eventClass: EventClassWithTypedConstructor<E>, props: PropsOf<E>): E;
15
- }
16
- export declare abstract class AggregateBase<P extends Props> extends AggregateCore<P> {
17
- private _events;
18
- constructor(metadata: AggregateBaseMetadata, props: P);
19
- static newAggregate<T extends AnyAggregate>(this: AggregateClassWithTypedConstructor<T>, props: PropsOf<T>, id?: Id): T;
20
- getVersion(): number;
21
- getEvents(): AnyEvent[];
22
- protected recordEvent<E extends AnyEvent>(event: E): void;
23
- protected recordEvent<E extends AnyEvent>(eventClass: EventClass<E>, props: PropsOf<E>): void;
24
- clearEvents(): void;
25
- }
26
- export interface SnapshotMetadata extends AggregateBaseMetadata {
27
- }
28
- export interface Snapshot<T extends AnyAggregateES> {
29
- metadata: SnapshotMetadata;
30
- props: PropsOf<T>;
31
- }
32
- export declare abstract class AggregateESBase<P extends Props> extends AggregateCore<P> {
33
- private _handledCommands;
34
- private _pastEvents;
35
- private _events;
36
- constructor(metadata: AggregateBaseMetadata, props?: P);
37
- static newStream<T extends AnyAggregateES>(this: AggregateESClassWithTypedConstructor<T>, id?: Id): T;
38
- static fromStream<T extends AnyAggregateES>(this: AggregateESClassWithTypedConstructor<T>, id: Id, events?: AnyEvent[]): T;
39
- static fromSnapshot<T extends AnyAggregateES>(this: AggregateESClassWithTypedConstructor<T>, snapshot: Snapshot<T>, events?: AnyEvent[]): T;
40
- static eventAppliersMap<T extends AnyAggregateES>(this: AggregateESClass<T>): Map<string, EventApplier>;
41
- static commandHandlersMap<T extends AnyAggregateES>(this: AggregateESClass<T>): Map<string, CommandHandler>;
42
- getVersion(): number;
43
- getPastEvents(): AnyEvent[];
44
- getEvents(): AnyEvent[];
45
- getHandledCommands(): AnyCommand[];
46
- eventAppliersMap(): Map<string, EventApplier>;
47
- hasEvent(): boolean;
48
- getApplierForEvent<E extends AnyEvent>(event: E): EventApplier<E>;
49
- private validateEventBeforeApply;
50
- private _applyEvent;
51
- private applyPastEvent;
52
- private applyPastEvents;
53
- applyEvent<E extends AnyEvent>(event: E): void;
54
- applyEvents(events: AnyEvent[]): void;
55
- commandHandlersMap(): Map<string, CommandHandler>;
56
- getHandlerForCommand<C extends AnyCommand>(command: C): CommandHandler<C, AnyEvent>;
57
- handleCommand<C extends AnyCommand>(command: C): AnyEvent[];
58
- snap(): Snapshot<this>;
59
- }
60
- export type AnyAggregate = AggregateBase<any>;
61
- export interface AggregateClass<T extends AnyAggregate = AnyAggregate, Arguments extends unknown[] = any[]> extends Class<T, Arguments>, ClassStatic<typeof AggregateBase<PropsOf<T>>> {
62
- }
63
- export interface AggregateClassWithTypedConstructor<T extends AnyAggregate = AnyAggregate> extends AggregateClass<T, ConstructorParameters<typeof AggregateBase<PropsOf<T>>>> {
64
- }
65
- export type AnyAggregateES = AggregateESBase<any>;
66
- export interface AggregateESClass<T extends AnyAggregateES = AnyAggregateES, Arguments extends unknown[] = any[]> extends Class<T, Arguments>, ClassStatic<typeof AggregateESBase<PropsOf<T>>> {
67
- }
68
- export interface AggregateESClassWithTypedConstructor<T extends AnyAggregateES = AnyAggregateES> extends AggregateESClass<T, ConstructorParameters<typeof AggregateESBase<PropsOf<T>>>> {
69
- }
70
- export type EventApplier<T extends AnyEvent = AnyEvent> = (event: T) => void;
71
- export type CommandHandler<T extends AnyCommand = AnyCommand, U extends AnyEvent | AnyEvent[] = AnyEvent> = (command: T) => U;
@@ -1,4 +0,0 @@
1
- import { AnyModel } from "./model";
2
- export declare class ModelError extends Error {
3
- constructor(model: AnyModel, message: string);
4
- }
@@ -1,9 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ModelError = void 0;
4
- class ModelError extends Error {
5
- constructor(model, message) {
6
- super(`[${model.modelName()}] ${message}`);
7
- }
8
- }
9
- exports.ModelError = ModelError;
@@ -1,2 +0,0 @@
1
- export * from "./snowflake.generator";
2
- export * from "./uuid4.generator";
@@ -1,18 +0,0 @@
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("./snowflake.generator"), exports);
18
- __exportStar(require("./uuid4.generator"), exports);
@@ -1,8 +0,0 @@
1
- import { SnowflakeOpts } from "nodejs-snowflake";
2
- import { IdGeneratorBase } from "../id-generator";
3
- export declare class SnowflakeGenerator extends IdGeneratorBase {
4
- private snowflake;
5
- constructor(options?: SnowflakeOpts);
6
- generateValue(): string;
7
- validateValue(value: string): void;
8
- }
@@ -1,16 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SnowflakeGenerator = void 0;
4
- const nodejs_snowflake_1 = require("nodejs-snowflake");
5
- const id_generator_1 = require("../id-generator");
6
- class SnowflakeGenerator extends id_generator_1.IdGeneratorBase {
7
- constructor(options) {
8
- super();
9
- this.snowflake = new nodejs_snowflake_1.Snowflake(options);
10
- }
11
- generateValue() {
12
- return this.snowflake.getUniqueID().toString(16);
13
- }
14
- validateValue(value) { }
15
- }
16
- exports.SnowflakeGenerator = SnowflakeGenerator;
@@ -1,5 +0,0 @@
1
- import { IdGeneratorBase } from "../id-generator";
2
- export declare class Uuid4Generator extends IdGeneratorBase {
3
- generateValue(): string;
4
- validateValue(value: string): boolean;
5
- }
@@ -1,16 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Uuid4Generator = void 0;
4
- const uuid_1 = require("uuid");
5
- const id_generator_1 = require("../id-generator");
6
- class Uuid4Generator extends id_generator_1.IdGeneratorBase {
7
- generateValue() {
8
- return (0, uuid_1.v4)();
9
- }
10
- validateValue(value) {
11
- const isUuid = (0, uuid_1.validate)(value);
12
- const isV4 = (0, uuid_1.version)(value) === 4;
13
- return isUuid && isV4;
14
- }
15
- }
16
- exports.Uuid4Generator = Uuid4Generator;
@@ -1,8 +0,0 @@
1
- import { Id } from "./id";
2
- export declare abstract class IdGeneratorBase {
3
- abstract generateValue(): string;
4
- abstract validateValue(value: string): void;
5
- fromValue(value: string): Id;
6
- fromId(id: Id): Id;
7
- newId(): Id;
8
- }
@@ -1,17 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.IdGeneratorBase = void 0;
4
- const id_1 = require("./id");
5
- class IdGeneratorBase {
6
- fromValue(value) {
7
- this.validateValue(value);
8
- return new id_1.Id(value);
9
- }
10
- fromId(id) {
11
- return this.fromValue(id.value);
12
- }
13
- newId() {
14
- return this.fromValue(this.generateValue());
15
- }
16
- }
17
- exports.IdGeneratorBase = IdGeneratorBase;
@@ -1,13 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Handle = void 0;
4
- const _meta_1 = require("../../meta/index");
5
- const Handle = (commandClass) => {
6
- return (target, propertyKey, descriptor) => {
7
- if (typeof descriptor.value === "function") {
8
- const commandName = (0, _meta_1.getModelName)(commandClass);
9
- (0, _meta_1.defineCommandHandler)(target, commandName, descriptor.value);
10
- }
11
- };
12
- };
13
- exports.Handle = Handle;
@@ -1,18 +0,0 @@
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("./handle"), exports);
18
- __exportStar(require("./when"), exports);
@@ -1,13 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.When = void 0;
4
- const _meta_1 = require("../../meta/index");
5
- const When = (eventClass) => {
6
- return (target, propertyKey, descriptor) => {
7
- if (typeof descriptor.value === "function") {
8
- const eventName = (0, _meta_1.getModelName)(eventClass);
9
- (0, _meta_1.defineEventApplier)(target, eventName, descriptor.value);
10
- }
11
- };
12
- };
13
- exports.When = When;
@@ -1,7 +0,0 @@
1
- {
2
- "extends": "./tsconfig.json",
3
- // 👇️ this may vary depending on how you
4
- // name your test files
5
- "include": ["src/**/*"],
6
- "exclude": ["test/**/*"]
7
- }