@adaas/a-concept 0.0.60 → 0.0.61
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/dist/index.d.ts +4 -4
- package/dist/index.js +5 -5
- package/dist/index.js.map +1 -1
- package/dist/src/decorators/A-Feature/A-Feature-Define.decorator.d.ts +2 -1
- package/dist/src/decorators/A-Feature/A-Feature-Define.decorator.js +9 -2
- package/dist/src/decorators/A-Feature/A-Feature-Define.decorator.js.map +1 -1
- package/dist/src/{base/A-Command/A_Command.entity.d.ts → global/A-Command/A-Command.class.d.ts} +72 -10
- package/dist/src/{base/A-Command/A_Command.entity.js → global/A-Command/A-Command.class.js} +119 -46
- package/dist/src/global/A-Command/A-Command.class.js.map +1 -0
- package/dist/src/{base/A-Command/A_Command.constants.js → global/A-Command/A-Command.constants.js} +1 -1
- package/dist/src/global/A-Command/A-Command.constants.js.map +1 -0
- package/dist/src/global/A-Command/A-Command.meta.d.ts +11 -0
- package/dist/src/global/A-Command/A-Command.meta.js +18 -0
- package/dist/src/global/A-Command/A-Command.meta.js.map +1 -0
- package/dist/src/global/A-Command/A-Command.types.d.ts +43 -0
- package/dist/src/global/A-Command/A-Command.types.js +10 -0
- package/dist/src/global/A-Command/A-Command.types.js.map +1 -0
- package/dist/src/{base → global}/A-Command/context/A_Command.context.d.ts +1 -1
- package/dist/src/{base → global}/A-Command/context/A_Command.context.js +1 -1
- package/dist/src/global/A-Command/context/A_Command.context.js.map +1 -0
- package/dist/src/global/A-Concept/A_Concept.class.js +2 -0
- package/dist/src/global/A-Concept/A_Concept.class.js.map +1 -1
- package/dist/src/global/A-Concept/A_Concept.types.d.ts +10 -0
- package/dist/src/global/A-Concept/A_Concept.types.js.map +1 -1
- package/dist/src/global/A-Context/A-Context.class.d.ts +3 -1
- package/dist/src/global/A-Context/A-Context.class.js +16 -6
- package/dist/src/global/A-Context/A-Context.class.js.map +1 -1
- package/dist/src/global/A-Entity/A-Entity.class.js +1 -4
- package/dist/src/global/A-Entity/A-Entity.class.js.map +1 -1
- package/dist/src/global/A-Feature/A-FeatureCaller.class.d.ts +4 -3
- package/dist/src/global/A-Feature/A-FeatureCaller.class.js.map +1 -1
- package/dist/src/global/A-Scope/A-Scope.class.d.ts +15 -1
- package/dist/src/global/A-Scope/A-Scope.class.js +62 -5
- package/dist/src/global/A-Scope/A-Scope.class.js.map +1 -1
- package/dist/src/global/A-Scope/A-Scope.types.d.ts +7 -0
- package/dist/src/global/A-Stage/A-Stage.class.d.ts +1 -1
- package/index.ts +4 -4
- package/package.json +2 -2
- package/src/decorators/A-Feature/A-Feature-Define.decorator.ts +13 -6
- package/src/{base/A-Command/A_Command.entity.ts → global/A-Command/A-Command.class.ts} +149 -35
- package/src/global/A-Command/A-Command.meta.ts +22 -0
- package/src/global/A-Command/A-Command.types.ts +71 -0
- package/src/global/A-Concept/A_Concept.class.ts +3 -0
- package/src/global/A-Concept/A_Concept.types.ts +10 -0
- package/src/global/A-Context/A-Context.class.ts +23 -5
- package/src/global/A-Entity/A-Entity.class.ts +1 -4
- package/src/global/A-Feature/A-FeatureCaller.class.ts +4 -3
- package/src/global/A-Scope/A-Scope.class.ts +81 -9
- package/src/global/A-Scope/A-Scope.types.ts +7 -0
- package/tests/A-Command.test.ts +15 -11
- package/tests/A-Concept.test.ts +110 -0
- package/tests/A-Scope.test.ts +45 -4
- package/dist/src/base/A-Command/A_Command.constants.js.map +0 -1
- package/dist/src/base/A-Command/A_Command.entity.js.map +0 -1
- package/dist/src/base/A-Command/A_Command.types.d.ts +0 -15
- package/dist/src/base/A-Command/A_Command.types.js +0 -3
- package/dist/src/base/A-Command/A_Command.types.js.map +0 -1
- package/dist/src/base/A-Command/context/A_Command.context.js.map +0 -1
- package/src/base/A-Command/A_Command.types.ts +0 -34
- /package/dist/src/{base/A-Command/A_Command.constants.d.ts → global/A-Command/A-Command.constants.d.ts} +0 -0
- /package/src/{base/A-Command/A_Command.constants.ts → global/A-Command/A-Command.constants.ts} +0 -0
- /package/src/{base → global}/A-Command/context/A_Command.context.ts +0 -0
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
A_TYPES__A_InjectDecorator_EntityInjectionQuery,
|
|
13
13
|
A_TYPES__A_InjectDecorator_Injectable
|
|
14
14
|
} from "@adaas/a-concept/decorators/A-Inject/A-Inject.decorator.types";
|
|
15
|
+
import { A_Command } from "../A-Command/A-Command.class";
|
|
15
16
|
|
|
16
17
|
|
|
17
18
|
/**
|
|
@@ -33,6 +34,7 @@ export class A_Scope {
|
|
|
33
34
|
|
|
34
35
|
private _components: WeakMap<typeof A_Component.constructor, any> = new WeakMap();
|
|
35
36
|
private _fragments: WeakMap<typeof A_Fragment.constructor, any> = new WeakMap();
|
|
37
|
+
private _commands: Map<string, A_Command> = new Map();
|
|
36
38
|
private _entities: Map<string, A_Entity> = new Map();
|
|
37
39
|
|
|
38
40
|
private _parent?: A_Scope;
|
|
@@ -52,6 +54,7 @@ export class A_Scope {
|
|
|
52
54
|
components: [],
|
|
53
55
|
fragments: [],
|
|
54
56
|
entities: [],
|
|
57
|
+
commands: [],
|
|
55
58
|
};
|
|
56
59
|
|
|
57
60
|
|
|
@@ -90,6 +93,10 @@ export class A_Scope {
|
|
|
90
93
|
return this.params.components || [];
|
|
91
94
|
}
|
|
92
95
|
|
|
96
|
+
get commands() {
|
|
97
|
+
return this.params.commands || [];
|
|
98
|
+
}
|
|
99
|
+
|
|
93
100
|
get fragments() {
|
|
94
101
|
return this.params.fragments || [];
|
|
95
102
|
}
|
|
@@ -189,7 +196,7 @@ export class A_Scope {
|
|
|
189
196
|
has(
|
|
190
197
|
constructor: string
|
|
191
198
|
): boolean
|
|
192
|
-
has<T extends A_Fragment | A_Component | A_Entity>(
|
|
199
|
+
has<T extends A_Fragment | A_Component | A_Entity | A_Command>(
|
|
193
200
|
entity: T | string | (new (...args: any[]) => T)
|
|
194
201
|
): boolean {
|
|
195
202
|
|
|
@@ -221,7 +228,7 @@ export class A_Scope {
|
|
|
221
228
|
|
|
222
229
|
case typeof entity === 'function'
|
|
223
230
|
&& A_CommonHelper.isInheritedFrom(entity, A_Component): {
|
|
224
|
-
const found = this.
|
|
231
|
+
const found = this.components.includes(entity as { new(...args: any[]): A_Component });
|
|
225
232
|
|
|
226
233
|
if (!found && !!this._parent) {
|
|
227
234
|
return this._parent.has(entity as any);
|
|
@@ -248,6 +255,16 @@ export class A_Scope {
|
|
|
248
255
|
|
|
249
256
|
return found;
|
|
250
257
|
}
|
|
258
|
+
case typeof entity === 'function'
|
|
259
|
+
&& A_CommonHelper.isInheritedFrom(entity, A_Command): {
|
|
260
|
+
const found = this.commands.includes(entity as { new(...args: any[]): A_Command });
|
|
261
|
+
|
|
262
|
+
if (!found && !!this._parent)
|
|
263
|
+
return this._parent.has(entity as any);
|
|
264
|
+
|
|
265
|
+
return found;
|
|
266
|
+
}
|
|
267
|
+
|
|
251
268
|
|
|
252
269
|
default: {
|
|
253
270
|
return false;
|
|
@@ -295,24 +312,42 @@ export class A_Scope {
|
|
|
295
312
|
/**
|
|
296
313
|
* Allows to retrieve the constructor of the component or entity by its name
|
|
297
314
|
*
|
|
315
|
+
* [!] Notes:
|
|
316
|
+
* - In case of search for A-Entity please ensure that provided string corresponds to the static entity property of the class. [!] By default it's the kebab-case of the class name
|
|
317
|
+
* - In case of search for A_Command please ensure that provided string corresponds to the static code property of the class. [!] By default it's the kebab-case of the class name
|
|
318
|
+
* - In case of search for A_Component please ensure that provided string corresponds to the class name in PascalCase
|
|
298
319
|
*
|
|
299
320
|
* @param name
|
|
300
321
|
* @returns
|
|
301
322
|
*/
|
|
302
323
|
resolveConstructor<T extends A_Component | A_Entity>(name: string): new (...args: any[]) => T {
|
|
303
324
|
// Check components
|
|
304
|
-
const component = this.params.components.find(c => c.name === name);
|
|
325
|
+
const component = this.params.components.find(c => c.name === A_CommonHelper.toPascalCase(name));
|
|
305
326
|
if (component) return component as any;
|
|
306
327
|
|
|
307
328
|
// Check entities
|
|
308
|
-
const entity = this.params.entities.find(e => e.constructor.
|
|
329
|
+
const entity = this.params.entities.find(e => (e.constructor as any).entity === name
|
|
330
|
+
|| (e.constructor as any).name === A_CommonHelper.toPascalCase(name)
|
|
331
|
+
|| (e.constructor as any).entity === A_CommonHelper.toKebabCase(name)
|
|
332
|
+
);
|
|
309
333
|
if (entity) return entity.constructor as any;
|
|
310
334
|
|
|
335
|
+
// Check commands
|
|
336
|
+
const command = this.params.commands.find(c => (c as any).code === name
|
|
337
|
+
|| (c as any).name === A_CommonHelper.toPascalCase(name)
|
|
338
|
+
|| (c as any).code === A_CommonHelper.toKebabCase(name)
|
|
339
|
+
);
|
|
340
|
+
if (command) return command as any;
|
|
341
|
+
|
|
311
342
|
// If not found in current scope, check parent scope
|
|
312
343
|
if (!!this._parent) {
|
|
313
344
|
return this._parent.resolveConstructor(name);
|
|
314
345
|
}
|
|
315
346
|
|
|
347
|
+
console.log('this.params.components', this.params.components);
|
|
348
|
+
console.log('this.params.entities', this.params.entities);
|
|
349
|
+
console.log('this.params.commands', this.params.commands);
|
|
350
|
+
|
|
316
351
|
throw new Error(`Component or Entity with name ${name} not found in the scope ${this.name}`);
|
|
317
352
|
}
|
|
318
353
|
|
|
@@ -371,6 +406,10 @@ export class A_Scope {
|
|
|
371
406
|
const component = this.params.components.find(c => c.name === name);
|
|
372
407
|
if (component) return this.resolveComponent(component);
|
|
373
408
|
|
|
409
|
+
// Check commands
|
|
410
|
+
const command = this.params.commands.find(c => c.name === name);
|
|
411
|
+
if (command) return this.resolveComponent(command);
|
|
412
|
+
|
|
374
413
|
// Check fragments
|
|
375
414
|
const fragment = this.params.fragments.find(f => f.constructor.name === name);
|
|
376
415
|
if (fragment) return this.resolveFragment(fragment.constructor as any);
|
|
@@ -436,10 +475,8 @@ export class A_Scope {
|
|
|
436
475
|
|
|
437
476
|
switch (true) {
|
|
438
477
|
case !instructions: {
|
|
439
|
-
|
|
440
478
|
const entities = Array.from(this._entities.values());
|
|
441
479
|
|
|
442
|
-
|
|
443
480
|
const found = entities.find(e => e instanceof entity);
|
|
444
481
|
|
|
445
482
|
switch (true) {
|
|
@@ -593,6 +630,31 @@ export class A_Scope {
|
|
|
593
630
|
}
|
|
594
631
|
|
|
595
632
|
|
|
633
|
+
/**
|
|
634
|
+
* Should be similar to resolveEntity but for commands
|
|
635
|
+
*
|
|
636
|
+
* @param command
|
|
637
|
+
*/
|
|
638
|
+
private resolveCommand<T extends A_Command>(command: {
|
|
639
|
+
new(...args: any[]): T
|
|
640
|
+
}): T {
|
|
641
|
+
const commands = Array.from(this._commands.values());
|
|
642
|
+
|
|
643
|
+
const found = commands.find(e => e instanceof command);
|
|
644
|
+
|
|
645
|
+
switch (true) {
|
|
646
|
+
case !!found:
|
|
647
|
+
return found as T;
|
|
648
|
+
|
|
649
|
+
case !found && !!this._parent:
|
|
650
|
+
return this._parent.resolveCommand(command);
|
|
651
|
+
|
|
652
|
+
default:
|
|
653
|
+
throw new Error(`Command ${command.name} not found in the scope ${this.name}`);
|
|
654
|
+
}
|
|
655
|
+
}
|
|
656
|
+
|
|
657
|
+
|
|
596
658
|
|
|
597
659
|
/**
|
|
598
660
|
* This method is used to register the component in the scope
|
|
@@ -600,7 +662,8 @@ export class A_Scope {
|
|
|
600
662
|
* @param fragment
|
|
601
663
|
*/
|
|
602
664
|
register<T extends A_Component>(component: new (...args: any[]) => T): void
|
|
603
|
-
register<T extends A_Entity>(
|
|
665
|
+
register<T extends A_Entity>(entity: new (...args: any[]) => T): void
|
|
666
|
+
register<T extends A_Command>(command: new (...args: any[]) => T): void
|
|
604
667
|
register(entity: A_Entity): void
|
|
605
668
|
register(component: A_Component): void
|
|
606
669
|
register(fragment: A_Fragment): void
|
|
@@ -610,6 +673,7 @@ export class A_Scope {
|
|
|
610
673
|
| A_Entity
|
|
611
674
|
| (new (...args: any[]) => A_Component)
|
|
612
675
|
| (new (...args: any[]) => A_Entity)
|
|
676
|
+
| (new (...args: any[]) => A_Command)
|
|
613
677
|
): void {
|
|
614
678
|
switch (true) {
|
|
615
679
|
case param1 instanceof A_Component && !this._components.has(param1.constructor): {
|
|
@@ -664,13 +728,21 @@ export class A_Scope {
|
|
|
664
728
|
break;
|
|
665
729
|
}
|
|
666
730
|
case typeof param1 === 'function' && A_CommonHelper.isInheritedFrom(param1, A_Entity): {
|
|
667
|
-
const
|
|
731
|
+
const allowedEntity = this.params.entities.find(e => e.constructor === param1);
|
|
668
732
|
|
|
669
|
-
if (!
|
|
733
|
+
if (!allowedEntity) {
|
|
670
734
|
this.params.entities.push(new (param1 as any)());
|
|
671
735
|
}
|
|
672
736
|
break;
|
|
673
737
|
}
|
|
738
|
+
case typeof param1 === 'function' && A_CommonHelper.isInheritedFrom(param1, A_Command): {
|
|
739
|
+
const allowedCommand = this.commands.find(c => c === param1);
|
|
740
|
+
|
|
741
|
+
if (!allowedCommand) {
|
|
742
|
+
this.commands.push(param1 as any);
|
|
743
|
+
}
|
|
744
|
+
break;
|
|
745
|
+
}
|
|
674
746
|
|
|
675
747
|
default:
|
|
676
748
|
if (param1 instanceof A_Entity)
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { A_Command } from "../A-Command/A-Command.class"
|
|
1
2
|
import { A_Component } from "../A-Component/A-Component.class"
|
|
2
3
|
import { A_Entity } from "../A-Entity/A-Entity.class"
|
|
3
4
|
import { A_Fragment } from "../A-Fragment/A-Fragment.class"
|
|
@@ -25,6 +26,12 @@ export type A_TYPES__ScopeConstructor = {
|
|
|
25
26
|
*/
|
|
26
27
|
entities: Array<A_Entity>
|
|
27
28
|
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* A set of Commands available in the Scope
|
|
32
|
+
*/
|
|
33
|
+
commands: Array<{ new(...args: any[]): A_Command }>
|
|
34
|
+
|
|
28
35
|
/**
|
|
29
36
|
* A list of Features/Lifecycle Hooks available in the Scope
|
|
30
37
|
*/
|
package/tests/A-Command.test.ts
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
import { A_CONSTANTS__A_Command_Status, A_CONSTANTS_A_Command_Features } from "@adaas/a-concept/
|
|
5
|
-
import { A_Command } from "@adaas/a-concept/
|
|
6
|
-
import { A_CommandContext } from "@adaas/a-concept/
|
|
4
|
+
import { A_CONSTANTS__A_Command_Status, A_CONSTANTS_A_Command_Features } from "@adaas/a-concept/global/A-Command/A-Command.constants";
|
|
5
|
+
import { A_Command } from "@adaas/a-concept/global/A-Command/A-Command.class";
|
|
6
|
+
import { A_CommandContext } from "@adaas/a-concept/global/A-Command/context/A_Command.context";
|
|
7
7
|
import { A_Inject } from "@adaas/a-concept/decorators/A-Inject/A-Inject.decorator";
|
|
8
8
|
import { A_Component } from "@adaas/a-concept/global/A-Component/A-Component.class";
|
|
9
9
|
import { A_Feature } from "@adaas/a-concept/global/A-Feature/A-Feature.class";
|
|
10
10
|
import { A_Scope } from "@adaas/a-concept/global/A-Scope/A-Scope.class";
|
|
11
11
|
import { A_Error } from "@adaas/a-utils";
|
|
12
|
+
import { A_Context } from "@adaas/a-concept/global/A-Context/A-Context.class";
|
|
12
13
|
|
|
13
14
|
jest.retryTimes(0);
|
|
14
15
|
|
|
@@ -17,7 +18,7 @@ describe('A-Command tests', () => {
|
|
|
17
18
|
it('Should Allow to create a command', async () => {
|
|
18
19
|
const command = new A_Command({});
|
|
19
20
|
expect(command).toBeInstanceOf(A_Command);
|
|
20
|
-
expect(command.Code).toBe('
|
|
21
|
+
expect(command.Code).toBe('a-command');
|
|
21
22
|
expect(command.id).toBeDefined();
|
|
22
23
|
expect(command.aseid).toBeDefined();
|
|
23
24
|
expect(command.Status).toBe(A_CONSTANTS__A_Command_Status.INITIALIZED);
|
|
@@ -58,12 +59,15 @@ describe('A-Command tests', () => {
|
|
|
58
59
|
it('Should allow to execute a command with custom logic', async () => {
|
|
59
60
|
|
|
60
61
|
// 1) create a scope
|
|
61
|
-
|
|
62
|
+
A_Context.reset();
|
|
63
|
+
|
|
62
64
|
// 2) create a new command
|
|
63
65
|
type resultType = { bar: string };
|
|
64
66
|
type invokeType = { foo: string };
|
|
65
67
|
class MyCommand extends A_Command<invokeType, resultType> { }
|
|
66
68
|
|
|
69
|
+
A_Context.root.register(MyCommand);
|
|
70
|
+
|
|
67
71
|
// 3) create a custom component with custom logic
|
|
68
72
|
class MyComponent extends A_Component {
|
|
69
73
|
|
|
@@ -76,11 +80,10 @@ describe('A-Command tests', () => {
|
|
|
76
80
|
}
|
|
77
81
|
|
|
78
82
|
// 4) register component in the scope
|
|
79
|
-
|
|
83
|
+
A_Context.root.register(MyComponent);
|
|
80
84
|
|
|
81
85
|
// 5) create a new command instance within the scope
|
|
82
86
|
const command = new MyCommand({ foo: 'bar' });
|
|
83
|
-
scope.register(command);
|
|
84
87
|
|
|
85
88
|
// 6) execute the command
|
|
86
89
|
await command.execute();
|
|
@@ -91,14 +94,16 @@ describe('A-Command tests', () => {
|
|
|
91
94
|
expect(command.Result).toEqual({ bar: 'baz' });
|
|
92
95
|
})
|
|
93
96
|
it('Should allow to fail a command with custom logic', async () => {
|
|
97
|
+
// 1) reset context to have a clean scope
|
|
98
|
+
A_Context.reset();
|
|
94
99
|
|
|
95
|
-
// 1) create a scope
|
|
96
|
-
const scope = new A_Scope({ name: 'TestScope' });
|
|
97
100
|
// 2) create a new command
|
|
98
101
|
type resultType = { bar: string };
|
|
99
102
|
type invokeType = { foo: string };
|
|
100
103
|
class MyCommand extends A_Command<invokeType, resultType> { }
|
|
101
104
|
|
|
105
|
+
A_Context.root.register(MyCommand);
|
|
106
|
+
|
|
102
107
|
// 3) create a custom component with custom logic
|
|
103
108
|
class MyComponent extends A_Component {
|
|
104
109
|
|
|
@@ -113,10 +118,9 @@ describe('A-Command tests', () => {
|
|
|
113
118
|
}
|
|
114
119
|
|
|
115
120
|
// 4) register component in the scope
|
|
116
|
-
|
|
121
|
+
A_Context.root.register(MyComponent);
|
|
117
122
|
// 5) create a new command instance within the scope
|
|
118
123
|
const command = new MyCommand({ foo: 'bar' });
|
|
119
|
-
scope.register(command);
|
|
120
124
|
|
|
121
125
|
// 6) execute the command
|
|
122
126
|
await command.execute();
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { A_Command } from "@adaas/a-concept/global/A-Command/A-Command.class";
|
|
2
|
+
import { A_Component } from "@adaas/a-concept/global/A-Component/A-Component.class";
|
|
3
|
+
import { A_Concept } from "@adaas/a-concept/global/A-Concept/A_Concept.class";
|
|
4
|
+
import { A_Container } from "@adaas/a-concept/global/A-Container/A-Container.class";
|
|
5
|
+
import { A_Context } from "@adaas/a-concept/global/A-Context/A-Context.class";
|
|
6
|
+
import { A_Entity } from "@adaas/a-concept/global/A-Entity/A-Entity.class";
|
|
7
|
+
import { A_Fragment } from "@adaas/a-concept/global/A-Fragment/A-Fragment.class";
|
|
8
|
+
import { A_Scope } from "@adaas/a-concept/global/A-Scope/A-Scope.class";
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
jest.retryTimes(0);
|
|
12
|
+
|
|
13
|
+
describe('A-Concept tests', () => {
|
|
14
|
+
|
|
15
|
+
it('Should Allow to create a concept', async () => {
|
|
16
|
+
const concept = new A_Concept({ name: 'TestConcept' });
|
|
17
|
+
expect(concept).toBeInstanceOf(A_Concept);
|
|
18
|
+
expect(concept.Scope).toBeDefined();
|
|
19
|
+
expect(concept.Scope).toBeInstanceOf(A_Scope);
|
|
20
|
+
});
|
|
21
|
+
it('Should allow to load a concept', async () => {
|
|
22
|
+
const concept = new A_Concept({ name: 'TestConcept' });
|
|
23
|
+
await concept.load();
|
|
24
|
+
});
|
|
25
|
+
it('Should allow to run concept abstractions', async () => {
|
|
26
|
+
const concept = new A_Concept({ name: 'TestConcept' });
|
|
27
|
+
await concept.load();
|
|
28
|
+
await concept.start();
|
|
29
|
+
await concept.deploy();
|
|
30
|
+
await concept.build();
|
|
31
|
+
await concept.publish();
|
|
32
|
+
await concept.stop();
|
|
33
|
+
});
|
|
34
|
+
it('Should allow to provide all base entities to the concept', async () => {
|
|
35
|
+
A_Context.reset();
|
|
36
|
+
|
|
37
|
+
class MyCommand extends A_Command { }
|
|
38
|
+
class MyEntity extends A_Entity { }
|
|
39
|
+
class MyComponent extends A_Component { }
|
|
40
|
+
class MyContainer extends A_Container { }
|
|
41
|
+
class MyContext extends A_Fragment { }
|
|
42
|
+
|
|
43
|
+
const concept = new A_Concept({
|
|
44
|
+
name: 'TestConcept',
|
|
45
|
+
commands: [MyCommand],
|
|
46
|
+
entities: [new MyEntity()],
|
|
47
|
+
components: [MyComponent],
|
|
48
|
+
containers: [new MyContainer({ name: 'test' })],
|
|
49
|
+
fragments: [new MyContext({ name: 'test' })]
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
expect(concept.Scope.resolveConstructor('MyCommand')).toBe(MyCommand);
|
|
54
|
+
expect(concept.Scope.resolve(MyEntity)).toBeInstanceOf(MyEntity);
|
|
55
|
+
expect(concept.Scope.resolve(MyComponent)).toBeInstanceOf(MyComponent);
|
|
56
|
+
expect(concept.Scope.resolve(MyContext)).toBeInstanceOf(MyContext);
|
|
57
|
+
});
|
|
58
|
+
it('Should allow to separate entities by containers', async () => {
|
|
59
|
+
A_Context.reset();
|
|
60
|
+
|
|
61
|
+
class MyCommandA extends A_Command { }
|
|
62
|
+
class MyCommandB extends A_Command { }
|
|
63
|
+
class MyComponentA extends A_Component { }
|
|
64
|
+
class MyComponentB extends A_Component { }
|
|
65
|
+
class MyContainer extends A_Container { }
|
|
66
|
+
class MyContext extends A_Fragment { }
|
|
67
|
+
|
|
68
|
+
const containerA = new MyContainer({
|
|
69
|
+
name: 'test',
|
|
70
|
+
commands: [MyCommandA],
|
|
71
|
+
components: [MyComponentA]
|
|
72
|
+
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
const containerB = new MyContainer({
|
|
76
|
+
name: 'test2',
|
|
77
|
+
commands: [MyCommandB],
|
|
78
|
+
components: [MyComponentB]
|
|
79
|
+
})
|
|
80
|
+
|
|
81
|
+
const sharedContext = new MyContext({ name: 'test' })
|
|
82
|
+
|
|
83
|
+
const concept = new A_Concept({
|
|
84
|
+
name: 'TestConcept',
|
|
85
|
+
containers: [
|
|
86
|
+
containerA,
|
|
87
|
+
containerB
|
|
88
|
+
|
|
89
|
+
],
|
|
90
|
+
fragments: [sharedContext]
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
const containerAScope = A_Context.scope(containerA)
|
|
94
|
+
const containerBScope = A_Context.scope(containerB)
|
|
95
|
+
|
|
96
|
+
expect(containerAScope.resolveConstructor('MyCommandA')).toBe(MyCommandA);
|
|
97
|
+
expect(() => {
|
|
98
|
+
containerAScope.resolveConstructor('MyCommandB');
|
|
99
|
+
}).toThrow();
|
|
100
|
+
|
|
101
|
+
expect(containerBScope.resolveConstructor('MyCommandB')).toBe(MyCommandB);
|
|
102
|
+
expect(() => {
|
|
103
|
+
containerBScope.resolveConstructor('MyCommandA');
|
|
104
|
+
}).toThrow();
|
|
105
|
+
|
|
106
|
+
expect(concept.Scope.resolve(MyContext)).toEqual(sharedContext);
|
|
107
|
+
expect(concept.Scope.resolve(MyContext)).toEqual(sharedContext);
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
});
|
package/tests/A-Scope.test.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A_Command } from "@adaas/a-concept/
|
|
1
|
+
import { A_Command } from "@adaas/a-concept/global/A-Command/A-Command.class";
|
|
2
2
|
import { A_Component } from "@adaas/a-concept/global/A-Component/A-Component.class";
|
|
3
3
|
import { A_Entity } from "@adaas/a-concept/global/A-Entity/A-Entity.class";
|
|
4
4
|
import { A_Scope } from "@adaas/a-concept/global/A-Scope/A-Scope.class";
|
|
@@ -161,22 +161,63 @@ describe('A-Scope tests', () => {
|
|
|
161
161
|
|
|
162
162
|
});
|
|
163
163
|
it('Should allow to resolve A-Entity by classname', async () => {
|
|
164
|
-
class
|
|
164
|
+
class MyEntity extends A_Entity<{ foo: string }> {
|
|
165
165
|
public foo!: string;
|
|
166
166
|
|
|
167
167
|
fromUndefined(): void {
|
|
168
168
|
super.fromUndefined();
|
|
169
169
|
this.foo = 'bar';
|
|
170
170
|
}
|
|
171
|
+
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
const scope = new A_Scope({ name: 'TestScope' });
|
|
175
|
+
scope.register(MyEntity);
|
|
176
|
+
|
|
177
|
+
const resolved = scope.resolveConstructor<MyEntity>('my_entity');
|
|
178
|
+
const resolved2 = scope.resolveConstructor<MyEntity>('my-entity');
|
|
179
|
+
const resolved3 = scope.resolveConstructor<MyEntity>('MyEntity');
|
|
180
|
+
expect(resolved).toBe(MyEntity);
|
|
181
|
+
expect(resolved2).toBe(MyEntity);
|
|
182
|
+
expect(resolved3).toBe(MyEntity);
|
|
183
|
+
|
|
184
|
+
expect(() => {
|
|
185
|
+
scope.resolveConstructor<MyEntity>('my__entity');
|
|
186
|
+
}).toThrow();
|
|
187
|
+
|
|
188
|
+
const instance = new resolved();
|
|
189
|
+
|
|
190
|
+
expect(instance).toBeInstanceOf(MyEntity);
|
|
191
|
+
expect(instance.foo).toBe('bar');
|
|
192
|
+
|
|
193
|
+
});
|
|
194
|
+
it('Should allow to resolve A-Command by classname', async () => {
|
|
195
|
+
class MyCommand extends A_Command<{ foo: string }, { bar: string }> {
|
|
196
|
+
public foo!: string;
|
|
197
|
+
|
|
198
|
+
fromNew(newCommand: { foo: string; }): void {
|
|
199
|
+
super.fromNew(newCommand);
|
|
200
|
+
this.foo = newCommand.foo;
|
|
201
|
+
}
|
|
202
|
+
|
|
171
203
|
}
|
|
172
204
|
|
|
173
205
|
const scope = new A_Scope({ name: 'TestScope' });
|
|
174
206
|
scope.register(MyCommand);
|
|
175
207
|
|
|
176
|
-
const resolved = scope.resolveConstructor<MyCommand>('
|
|
208
|
+
const resolved = scope.resolveConstructor<MyCommand>('my-command');
|
|
209
|
+
const resolved2 = scope.resolveConstructor<MyCommand>('my_command');
|
|
210
|
+
const resolved3 = scope.resolveConstructor<MyCommand>('MyCommand');
|
|
177
211
|
expect(resolved).toBe(MyCommand);
|
|
212
|
+
expect(resolved2).toBe(MyCommand);
|
|
213
|
+
expect(resolved3).toBe(MyCommand);
|
|
178
214
|
|
|
179
|
-
|
|
215
|
+
expect(() => {
|
|
216
|
+
scope.resolveConstructor<MyCommand>('my--command');
|
|
217
|
+
}).toThrow();
|
|
218
|
+
|
|
219
|
+
|
|
220
|
+
const instance = new resolved({ foo: 'bar' });
|
|
180
221
|
|
|
181
222
|
expect(instance).toBeInstanceOf(MyCommand);
|
|
182
223
|
expect(instance.foo).toBe('bar');
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"A_Command.constants.js","sourceRoot":"","sources":["../../../../src/base/A-Command/A_Command.constants.ts"],"names":[],"mappings":";;;AAEA,IAAY,6BAKX;AALD,WAAY,6BAA6B;IACrC,4DAA2B,CAAA;IAC3B,4DAA2B,CAAA;IAC3B,wDAAuB,CAAA;IACvB,kDAAiB,CAAA;AACrB,CAAC,EALW,6BAA6B,6CAA7B,6BAA6B,QAKxC;AAED,IAAY,8BAIX;AAJD,WAAY,8BAA8B;IACtC,qDAAmB,CAAA;IACnB,uDAAqB,CAAA;IACrB,+CAAa,CAAA;AACjB,CAAC,EAJW,8BAA8B,8CAA9B,8BAA8B,QAIzC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"A_Command.entity.js","sourceRoot":"","sources":["../../../../src/base/A-Command/A_Command.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AAAA,oFAA2E;AAE3E,4CAAyC;AACzC,iFAAwE;AACxE,uFAA8E;AAC9E,mEAA+D;AAC/D,+DAAoI;AAGpI,MAAa,SAGX,SAAQ,yBAGT;IAcG;;OAEG;IACH,IAAI,QAAQ;QACR,OAAO,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,UAAU;YACnC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,UAA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AAM,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,IACrF;IACL,CAAC;IAAA,CAAC;CAEL;AArRD,8BAqRC;AAhKS;IADL,2BAAS,CAAC,MAAM,EAAE;iCAUlB;AAMK;IADL,2BAAS,CAAC,MAAM,EAAE;iCAOlB;AAOK;IADL,2BAAS,CAAC,MAAM,EAAE;iCAOlB"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { A_TYPES__Entity_JSON } from "../../global/A-Entity/A-Entity.types";
|
|
2
|
-
import { A_Command } from "./A_Command.entity";
|
|
3
|
-
import { A_CONSTANTS__A_Command_Status } from "./A_Command.constants";
|
|
4
|
-
import { A_TYPES__Error } from "@adaas/a-utils";
|
|
5
|
-
export type A_TYPES__Command_Constructor = {};
|
|
6
|
-
export type A_TYPES__Command_Serialized<ResultType extends Record<string, any> = Record<string, any>> = {
|
|
7
|
-
code: string;
|
|
8
|
-
status: A_CONSTANTS__A_Command_Status;
|
|
9
|
-
startedAt?: string;
|
|
10
|
-
endedAt?: string;
|
|
11
|
-
duration?: number;
|
|
12
|
-
result?: ResultType;
|
|
13
|
-
errors?: Array<A_TYPES__Error>;
|
|
14
|
-
} & A_TYPES__Entity_JSON;
|
|
15
|
-
export type A_TYPES__Command_Listener<T extends Record<string, any> = Record<string, any>> = (command?: A_Command<any, T>) => void;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"A_Command.types.js","sourceRoot":"","sources":["../../../../src/base/A-Command/A_Command.types.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"A_Command.context.js","sourceRoot":"","sources":["../../../../../src/base/A-Command/context/A_Command.context.ts"],"names":[],"mappings":";;;AAAA,0FAAiF;AAIjF,MAAa,gBAEX,S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IAAI,KAAK,KAAK,IAAI,IAAI,QAAQ,IAAI,KAAK,IAAI,OAAO,KAAK,CAAC,MAAM,KAAK,UAAU;oBAClG,CAAC,CAAC,KAAK,CAAC,MAAM,EAAE;oBAChB,CAAC,CAAC,KAAK,CAAC;QACpB,CAAC,CAAC,CAAA;QAEF,OAAO,GAAG,CAAC;IACf,CAAC;CACJ;AA7GD,4CA6GC"}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { A_TYPES__Entity_JSON } from "@adaas/a-concept/global/A-Entity/A-Entity.types";
|
|
2
|
-
import { A_CommandContext } from "./context/A_Command.context";
|
|
3
|
-
import { A_Command } from "./A_Command.entity";
|
|
4
|
-
import { A_CONSTANTS__A_Command_Status } from "./A_Command.constants";
|
|
5
|
-
import { A_Error, A_TYPES__Error } from "@adaas/a-utils";
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
export type A_TYPES__Command_Constructor = {
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
export type A_TYPES__Command_Serialized<
|
|
15
|
-
ResultType extends Record<string, any> = Record<string, any>
|
|
16
|
-
> = {
|
|
17
|
-
code: string;
|
|
18
|
-
status: A_CONSTANTS__A_Command_Status;
|
|
19
|
-
|
|
20
|
-
startedAt?: string;
|
|
21
|
-
endedAt?: string;
|
|
22
|
-
duration?: number;
|
|
23
|
-
|
|
24
|
-
result?: ResultType;
|
|
25
|
-
errors?: Array<A_TYPES__Error>;
|
|
26
|
-
|
|
27
|
-
} & A_TYPES__Entity_JSON
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
export type A_TYPES__Command_Listener<
|
|
33
|
-
T extends Record<string, any> = Record<string, any>
|
|
34
|
-
> = (command?: A_Command<any, T>) => void;
|
|
File without changes
|
/package/src/{base/A-Command/A_Command.constants.ts → global/A-Command/A-Command.constants.ts}
RENAMED
|
File without changes
|
|
File without changes
|