@adaas/a-concept 0.1.8 → 0.1.10

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.
@@ -1 +1 @@
1
- {"version":3,"file":"A_TypeGuards.helper.js","sourceRoot":"","sources":["../../../src/helpers/A_TypeGuards.helper.ts"],"names":[],"mappings":";;;AASA,+EAAsE;AACtE,6EAAyE;AAEzE,+EAAsE;AACtE,6EAAyE;AAEzE,sEAA6D;AAC7D,oEAAgE;AAEhE,yEAAgE;AAChE,4EAAmE;AAEnE,mEAA0D;AAC1D,sEAA6D;AAE7D,mEAA0D;AAC1D,uDAAmD;AAOnD,MAAa,YAAY;IACrB,8EAA8E;IAC9E,8EAA8E;IAC9E,8EAA8E;IAC9E;;;;;OAKG;IACH,MAAM,CAAC,QAAQ,CAAC,KAAU;QACtB,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,YAAY,MAAM,CAAC;IAChE,CAAC;IACD;;;;;OAKG;IACH,MAAM,CAAC,QAAQ,CAAC,KAAU;QACtB,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,QAAQ,CAAC,KAAK,CAAC,CAAC;IACxD,CAAC;IACD;;;;;OAKG;IACH,MAAM,CAAC,SAAS,CAAC,KAAU;QACvB,OAAO,OAAO,KAAK,KAAK,SAAS,CAAC;IACtC,CAAC;IACD;;;;;OAKG;IACH,MAAM,CAAC,OAAO,CAAC,KAAU;QACrB,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IAChC,CAAC;IACD;;;;;OAKG;IACH,MAAM,CAAC,QAAQ,CAA4B,KAAU;QACjD,OAAO,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IACvE,CAAC;IACD;;;;;OAKG;IACH,MAAM,CAAC,UAAU,CAAC,KAAU;QACxB,OAAO,OAAO,KAAK,KAAK,UAAU,CAAC;IACvC,CAAC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;IACpD,CAAC;IAED,MAAM,CAAC,uBAAuB,CAAC,KAAU;QACrC,OAAO,YAAY,CAAC,mBAAmB,CAAC,KAAK,CAAC;eACvC,YAAY,CAAC,mBAAmB,CAAC,KAAK,CAAC;eACvC,YAAY,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC;IAChD,CAAC;IAED,MAAM,CAAC,6BAA6B,CAAC,KAAU;QAC3C,OAAO,YAAY,CAAC,mBAAmB,CAAC,KAAK,CAAC;eACvC,YAAY,CAAC,mBAAmB,CAAC,KAAK,CAAC;eACvC,YAAY,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC;IAChD,CAAC;IAED,MAAM,CAAC,4BAA4B,CAAC,KAAU;QAC1C,OAAO,YAAY,CAAC,mBAAmB,CAAC,KAAK,CAAC,CAAC;IACnD,CAAC;IAED,MAAM,CAAC,iCAAiC,CAAC,KAAU;QAC/C,OAAO,YAAY,CAAC,mBAAmB,CAAC,KAAK,CAAC;eACvC,YAAY,CAAC,mBAAmB,CAAC,KAAK,CAAC,CAAC;IACnD,CAAC;IAED;;;;;OAKG;IACH,MAAM,CAAC,iBAAiB,CAAgC,KAAU;QAC9D,OAAO,CAAC,CAAC,KAAK,IAAI,YAAY,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,KAAK,YAAY,KAAK,CAAC,IAAI,OAAO,IAAI,KAAK,CAAC;IACpG,CAAC;CACJ;AAtSD,oCAsSC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adaas/a-concept",
3
- "version": "0.1.8",
3
+ "version": "0.1.10",
4
4
  "description": "A-Concept is a framework to build new Applications within or outside the ADAAS ecosystem. This framework is designed to be modular structure regardless environment and program goal.",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -20,7 +20,7 @@
20
20
  "ext": "ts, js"
21
21
  },
22
22
  "scripts": {
23
- "test": "jest",
23
+ "test": "jest ",
24
24
  "start": "nodemon ./tests/log.ts",
25
25
  "example:simple": "nodemon ./examples/simple/concept.ts",
26
26
  "example:simple:trace": "node -r tsconfig-paths/register -r ts-node/register -r ./trace-require.js ./examples/simple/concept.ts",
@@ -10,6 +10,7 @@ import { A_FormatterHelper } from '@adaas/a-concept/helpers/A_Formatter.helper';
10
10
  import { A_Context } from '../A-Context/A-Context.class';
11
11
  import { A_TypeGuards } from '@adaas/a-concept/helpers/A_TypeGuards.helper';
12
12
  import { ASEID } from '../ASEID/ASEID.class';
13
+ import { A_CONSTANTS__DEFAULT_ENV_VARIABLES } from '@adaas/a-concept/constants/env.constants';
13
14
 
14
15
 
15
16
  export class A_Error<
@@ -51,6 +52,10 @@ export class A_Error<
51
52
  * ASEID of the error instance
52
53
  */
53
54
  protected _aseid!: ASEID;
55
+ /**
56
+ * Title of the error
57
+ */
58
+ protected _title!: string;
54
59
  /**
55
60
  * Possible Scope if needed to identify the error by it's execution environment
56
61
  */
@@ -133,39 +138,49 @@ export class A_Error<
133
138
  /**
134
139
  * Error message
135
140
  */
136
- message: string,
141
+ title: string,
137
142
  /**
138
143
  * Detailed description of the error
139
144
  */
140
145
  description: string
141
146
  )
142
-
143
147
  constructor(
144
148
  param1: _ConstructorType | Error | string | A_Error,
145
- param2?: string
149
+ param2?: string
146
150
  ) {
147
151
  // to prevent errors accumulation in the stack trace it returns the original error if provided param1 is A_Error
148
- if (param1 instanceof A_Error) {
149
- return param1 as A_Error<_ConstructorType, _SerializedType>;
150
- } else if (A_TypeGuards.isConstructorType<_ConstructorType>(param1)) {
151
- super(param1.message);
152
- } else if (param1 instanceof Error) {
153
- super(param1.message);
154
- } else if (A_TypeGuards.isString(param1)) {
155
- super(param1);
156
- } else {
157
- console.log('INVALID PARAMS PROVIDED TO A_ERROR CONSTRUCTOR: ', param1);
152
+ switch (true) {
153
+ case param1 instanceof A_Error:
154
+ return param1 as A_Error<_ConstructorType, _SerializedType>;
158
155
 
159
- throw new A_Error(
160
- A_CONSTANTS__ERROR_CODES.VALIDATION_ERROR,
161
- 'Invalid parameters provided to A_Error constructor'
162
- );
163
- }
156
+ case param1 instanceof Error:
157
+ super(param1.message);
158
+ break;
159
+
160
+ case A_TypeGuards.isConstructorType<_ConstructorType>(param1) && 'description' in param1:
161
+ super(`[${param1.title}]: ${param1.description}`);
162
+ break;
163
+
164
+ case A_TypeGuards.isConstructorType<_ConstructorType>(param1) && !('description' in param1):
165
+ super(param1.title);
166
+ break;
164
167
 
165
- // check message length
166
- this.validateMessage(this.message);
168
+ case A_TypeGuards.isString(param1) && !param2:
169
+ super(param1);
170
+ break;
171
+
172
+ case A_TypeGuards.isString(param1) && !!param2:
173
+ super(`[${param1}]: ${param2}`);
174
+ break;
175
+
176
+ default:
177
+ throw new A_Error(
178
+ A_CONSTANTS__ERROR_CODES.VALIDATION_ERROR,
179
+ 'Invalid parameters provided to A_Error constructor'
180
+ );
181
+ }
167
182
 
168
- const initializer = this.getInitializer(param1);
183
+ const initializer = this.getInitializer(param1, param2);
169
184
  // the returned initializer is already bound to `this` (we used .bind(this)),
170
185
  // so calling it will run the appropriate logic on this instance:
171
186
  initializer.call(this, param1, param2);
@@ -183,13 +198,20 @@ export class A_Error<
183
198
  return this._aseid;
184
199
  }
185
200
  /**
186
- * Returns an Error message what is a brief title of the error
201
+ * Returns the title of the error
187
202
  *
188
203
  * Example: 'User not found', 'Validation error', 'Unauthorized access', etc.
189
204
  *
190
- * [!] Note: This message should be short and concise, less than 60 characters
191
- * [!] Note: If message exceeds 60 characters, there would be an error thrown
192
- * [!] Note: This message is intended to be human-readable and can be displayed in UI or logs
205
+ * [!] Note: This title should be short and concise, less than 60 characters
206
+ * [!] Note: If title exceeds 60 characters, there would be an error thrown
207
+ * [!] Note: This title is intended to be human-readable and can be displayed in UI or logs
208
+ */
209
+ get title(): string {
210
+ return this._title;
211
+ }
212
+ /**
213
+ * Returns an Error message what is a brief title of the error
214
+ *
193
215
  */
194
216
  get message(): string {
195
217
  return super.message;
@@ -205,7 +227,7 @@ export class A_Error<
205
227
  * [!] Note: If not provided would be used a kebab-case message of the error
206
228
  */
207
229
  get code(): string {
208
- return this._code || A_FormatterHelper.toKebabCase(this.message);
230
+ return this._code || A_FormatterHelper.toKebabCase(this.title);
209
231
  }
210
232
  /**
211
233
  * Returns the type of the error which corresponds to the static entity of the class
@@ -257,7 +279,7 @@ export class A_Error<
257
279
  * [!] Note: This description is intended to provide more context about the error and can be used for debugging or logging purposes
258
280
  */
259
281
  get description(): string {
260
- return this._description || process.env.A_ERROR_DEFAULT_DESCRIPTION || A_CONSTANTS__ERROR_DESCRIPTION;
282
+ return this._description || process.env[A_CONSTANTS__DEFAULT_ENV_VARIABLES.A_ERROR_DEFAULT_DESCRIPTION] || A_CONSTANTS__ERROR_DESCRIPTION;
261
283
  }
262
284
  /**
263
285
  * Returns the original error if any
@@ -280,10 +302,14 @@ export class A_Error<
280
302
  */
281
303
  protected getInitializer(
282
304
  param1: _ConstructorType | Error | string | any,
305
+ param2?: string
283
306
  ): (param1: any, param2: any) => void | (() => void) {
284
307
  switch (true) {
285
- case A_TypeGuards.isString(param1):
286
- return this.fromString;
308
+ case A_TypeGuards.isString(param1) && !param2:
309
+ return this.fromMessage;
310
+
311
+ case A_TypeGuards.isString(param1) && !!param2:
312
+ return this.fromTitle;
287
313
 
288
314
  case param1 instanceof Error:
289
315
  return this.fromError;
@@ -309,7 +335,7 @@ export class A_Error<
309
335
  * @param error
310
336
  */
311
337
  protected fromError(error: Error): void {
312
- this._code = A_CONSTANTS__ERROR_CODES.UNEXPECTED_ERROR;
338
+ this._title = A_CONSTANTS__ERROR_CODES.UNEXPECTED_ERROR;
313
339
 
314
340
  this._aseid = new ASEID({
315
341
  concept: (this.constructor as typeof A_Error).concept,
@@ -318,19 +344,16 @@ export class A_Error<
318
344
  id: this.code
319
345
  });
320
346
 
321
- this._description = 'If you see this error please let us know.';
322
347
  this._originalError = error;
323
348
  }
324
349
  /**
325
- * Initializes the A_Error instance from a string message and optional description.
350
+ * Initializes the A_Error instance from a message.
326
351
  *
327
- * @param message
352
+ * @param title
328
353
  * @param description
329
354
  */
330
- protected fromString(message: string, description?: string ): void {
331
- this._code = A_FormatterHelper.toKebabCase(message);
332
- this._scope = A_TypeGuards.isScopeInstance(description) ? description.name : undefined;
333
-
355
+ protected fromMessage(message: string): void {
356
+ this._title = A_CONSTANTS__ERROR_CODES.UNEXPECTED_ERROR;
334
357
 
335
358
  this._aseid = new ASEID({
336
359
  concept: (this.constructor as typeof A_Error).concept,
@@ -339,7 +362,23 @@ export class A_Error<
339
362
  id: this.code
340
363
  });
341
364
 
342
- this._description = A_TypeGuards.isString(description) ? description : undefined;
365
+ this._link = undefined;
366
+ this._originalError = undefined;
367
+ }
368
+
369
+
370
+ fromTitle(title: string, description: string): void {
371
+ this.validateTitle(title);
372
+
373
+ this._title = title;
374
+ this._description = description;
375
+
376
+ this._aseid = new ASEID({
377
+ concept: (this.constructor as typeof A_Error).concept,
378
+ scope: this._scope || (this.constructor as typeof A_Error).scope,
379
+ entity: (this.constructor as typeof A_Error).entity,
380
+ id: this.code
381
+ });
343
382
 
344
383
  this._link = undefined;
345
384
  this._originalError = undefined;
@@ -350,6 +389,9 @@ export class A_Error<
350
389
  * @param params
351
390
  */
352
391
  protected fromConstructor(params: _ConstructorType): void {
392
+ this.validateTitle(params.title);
393
+
394
+ this._title = params.title;
353
395
  this._code = params.code;
354
396
  this._scope = params.scope ? (A_TypeGuards.isScopeInstance(params.scope) ? params.scope.name : params.scope) : undefined;
355
397
 
@@ -374,6 +416,7 @@ export class A_Error<
374
416
  toJSON(): _SerializedType {
375
417
  return {
376
418
  aseid: this.aseid.toString(),
419
+ title: this.title,
377
420
  code: this.code,
378
421
  type: this.type,
379
422
  message: this.message,
@@ -390,19 +433,32 @@ export class A_Error<
390
433
  // ----------------------- PROTECTED HELPERS --------------------------------
391
434
  // --------------------------------------------------------------------------
392
435
  /**
393
- * Checks if the provided message exceeds 60 characters.
436
+ * Checks if the provided title exceeds 60 characters.
394
437
  * If it does, throws a validation A_Error.
395
438
  *
396
- * @param message
439
+ * @param title
397
440
  */
398
- protected validateMessage(message: string) {
399
- if (message.length > 60) {
400
- throw new A_Error(A_CONSTANTS__ERROR_CODES.VALIDATION_ERROR, 'A-Error message exceeds 60 characters limit.');
441
+ protected validateTitle(title: string) {
442
+ if (title.length > 60) {
443
+ throw new A_Error(
444
+ A_CONSTANTS__ERROR_CODES.VALIDATION_ERROR,
445
+ 'A-Error title exceeds 60 characters limit.'
446
+ );
401
447
  }
402
- if (message.length === 0) {
403
- throw new A_Error(A_CONSTANTS__ERROR_CODES.VALIDATION_ERROR, 'A-Error message cannot be empty.');
448
+ if (title.length === 0) {
449
+ throw new A_Error(
450
+ A_CONSTANTS__ERROR_CODES.VALIDATION_ERROR,
451
+ 'A-Error title cannot be empty.'
452
+ );
404
453
  }
405
454
  }
455
+ }
456
+
457
+
458
+
459
+
406
460
 
461
+ // message = title + description for better printing in the console
462
+ // description = detailed information about the error
463
+ // code = kebabcase (title)
407
464
 
408
- }
@@ -15,12 +15,11 @@ export type A_TYPES__Error_Constructor<T = A_Error> = new (...args: any[]) => T;
15
15
  */
16
16
  export type A_TYPES__Error_Init = {
17
17
  /**
18
- * Error message
18
+ * Error title
19
19
  *
20
20
  * A short description of the error
21
21
  */
22
- message: string;
23
-
22
+ title: string;
24
23
 
25
24
  /**
26
25
  * Error code representing the type of error
@@ -65,6 +64,10 @@ export type A_TYPES__Error_Serialized = {
65
64
  * ASEID of the error
66
65
  */
67
66
  aseid: string,
67
+ /**
68
+ * A brief title of the error
69
+ */
70
+ title: string,
68
71
  /**
69
72
  * Error message
70
73
  */
@@ -378,7 +378,7 @@ export class A_Feature<T extends A_TYPES__FeatureAvailableComponents = A_TYPES__
378
378
  case A_TypeGuards.isErrorInstance(reason):
379
379
  this._error = new A_FeatureError({
380
380
  code: A_FeatureError.Interruption,
381
- message: reason.message,
381
+ title: reason.title,
382
382
  description: reason.description,
383
383
  originalError: reason
384
384
  });
@@ -386,22 +386,29 @@ export class A_Scope<
386
386
  }
387
387
  // 2) Check if it's a Component
388
388
  case A_TypeGuards.isComponentConstructor(ctor): {
389
- found = this.isAllowedComponent(ctor);
389
+ found = this.isAllowedComponent(ctor)
390
+ || !![...this.allowedComponents]
391
+ .find(c => A_CommonHelper.isInheritedFrom(c, ctor));
390
392
 
391
393
  break;
392
394
  }
393
395
  // 3) Check if it's an Entity
394
396
  case A_TypeGuards.isEntityConstructor(ctor): {
395
- found = this.isAllowedEntity(ctor);
397
+ found = this.isAllowedEntity(ctor)
398
+ || !![...this.allowedEntities]
399
+ .find(e => A_CommonHelper.isInheritedFrom(e, ctor));
396
400
 
397
401
  break;
398
402
  }
399
403
  // 4) Check if it's a Fragment
400
404
  case A_TypeGuards.isFragmentConstructor(ctor): {
401
- found = this.isAllowedFragment(ctor);
405
+ found = this.isAllowedFragment(ctor)
406
+ || !![...this.allowedFragments]
407
+ .find(f => A_CommonHelper.isInheritedFrom(f, ctor));
402
408
 
403
409
  break;
404
410
  }
411
+
405
412
  // check scope issuer
406
413
  case this.issuer().constructor === ctor: {
407
414
  found = true;
@@ -672,7 +679,10 @@ export class A_Scope<
672
679
  return this._parent.resolveByName(name) as any;
673
680
  }
674
681
 
675
- throw new Error(`Component or Entity with name ${name} not found in the scope ${this.name}`);
682
+ throw new A_ScopeError(
683
+ A_ScopeError.ResolutionError,
684
+ `Component or Entity with name ${name} not found in the scope ${this.name}`
685
+ );
676
686
  }
677
687
 
678
688
  /**
@@ -687,10 +697,13 @@ export class A_Scope<
687
697
  instructions?: Partial<A_TYPES__A_InjectDecorator_EntityInjectionInstructions>
688
698
  ): A_TYPES__ScopeResolvableComponents | A_Scope | A_TYPES__ScopeLinkedComponents | Array<A_TYPES__ScopeResolvableComponents> {
689
699
 
700
+ const componentName = A_TypeGuards.isFunction(component) ? component.name : component.constructor.name || String(component);
701
+
702
+
690
703
  if (!component || !this.has(component))
691
704
  throw new A_ScopeError(
692
705
  A_ScopeError.ResolutionError,
693
- `Injected Component ${component} not found in the scope`
706
+ `Injected Component ${componentName} not found in the scope`
694
707
  );
695
708
 
696
709
  if (A_TypeGuards.isScopeConstructor(component))
@@ -699,9 +712,6 @@ export class A_Scope<
699
712
  if (typeof component == 'function' && component.name === 'A_Scope')
700
713
  component
701
714
 
702
-
703
-
704
-
705
715
  switch (true) {
706
716
  case A_TypeGuards.isConstructorAllowedForScopeAllocation(component): {
707
717
  return this.resolveIssuer(component);
@@ -721,7 +731,7 @@ export class A_Scope<
721
731
  default:
722
732
  throw new A_ScopeError(
723
733
  A_ScopeError.ResolutionError,
724
- `Injected Component ${component} not found in the scope`
734
+ `Injected Component ${componentName} not found in the scope`
725
735
  );
726
736
  }
727
737
  }
@@ -868,7 +878,10 @@ export class A_Scope<
868
878
  return this._parent.resolveFragment(fragment);
869
879
 
870
880
  default:
871
- throw new Error(`Fragment ${fragment.name} not found in the scope ${this.name}`);
881
+ throw new A_ScopeError(
882
+ A_ScopeError.ResolutionError,
883
+ `Fragment ${fragment.name} not found in the scope ${this.name}`
884
+ );
872
885
  }
873
886
  }
874
887
  /**
@@ -936,7 +949,10 @@ export class A_Scope<
936
949
  }
937
950
 
938
951
  default:
939
- throw new Error(`Component ${component.name} not found in the scope ${this.name}`);
952
+ throw new A_ScopeError(
953
+ A_ScopeError.ResolutionError,
954
+ `Component ${component.name} not found in the scope ${this.name}`
955
+ );
940
956
  }
941
957
  }
942
958
 
@@ -1085,11 +1101,23 @@ export class A_Scope<
1085
1101
 
1086
1102
  default:
1087
1103
  if (param1 instanceof A_Entity)
1088
- throw new Error(`Entity with ASEID ${param1.aseid.toString()} is already registered in the scope ${this.name}`);
1104
+ throw new A_ScopeError(
1105
+ A_ScopeError.RegistrationError,
1106
+ `Entity with ASEID ${param1.aseid.toString()} is already registered in the scope ${this.name}`
1107
+ );
1089
1108
  else if (param1 instanceof A_Fragment)
1090
- throw new Error(`Fragment ${param1.constructor.name} is already registered in the scope ${this.name}`);
1091
- else
1092
- throw new Error(`Cannot register ${param1} in the scope ${this.name}`);
1109
+ throw new A_ScopeError(
1110
+ A_ScopeError.RegistrationError,
1111
+ `Fragment ${param1.constructor.name} is already registered in the scope ${this.name}`
1112
+ );
1113
+ else {
1114
+ const componentName = A_TypeGuards.isFunction(param1) ? param1.name : param1?.constructor?.name || String(param1);
1115
+
1116
+ throw new A_ScopeError(
1117
+ A_ScopeError.RegistrationError,
1118
+ `Cannot register ${componentName} in the scope ${this.name}`
1119
+ );
1120
+ }
1093
1121
  }
1094
1122
  }
1095
1123
 
@@ -9,6 +9,8 @@ export class A_ScopeError extends A_Error {
9
9
 
10
10
  static readonly ResolutionError = 'A-Scope Resolution Error';
11
11
 
12
+ static readonly RegistrationError = 'A-Scope Registration Error';
13
+
12
14
  static readonly CircularInheritanceError = 'A-Scope Circular Inheritance Error';
13
15
 
14
16
  }
@@ -322,6 +322,6 @@ export class A_TypeGuards {
322
322
  * @returns
323
323
  */
324
324
  static isConstructorType<T extends A_TYPES__Error_Init>(param: any): param is T {
325
- return !!param && A_TypeGuards.isObject(param) && !(param instanceof Error) && "message" in param;
325
+ return !!param && A_TypeGuards.isObject(param) && !(param instanceof Error) && "title" in param;
326
326
  }
327
327
  }
@@ -3,6 +3,7 @@ import './test.setup'
3
3
  import { A_Concept } from '@adaas/a-concept/global/A-Concept/A-Concept.class';
4
4
  import { A_Container } from '@adaas/a-concept/global/A-Container/A-Container.class';
5
5
  import { A_Context } from '@adaas/a-concept/global/A-Context/A-Context.class';
6
+ import { A_ScopeError } from '@adaas/a-concept/global/A-Scope/A-Scope.error';
6
7
 
7
8
  jest.retryTimes(0);
8
9
 
@@ -109,5 +110,45 @@ describe('A-Abstraction Tests', () => {
109
110
  expect(containerB._test).toBe(1);
110
111
 
111
112
  })
112
- });
113
+ it('Should allow to define an async abstraction extension', async () => {
114
+ A_Context.reset();
115
+
116
+ class MyContainerA extends A_Container {
117
+ _test: number = 0
118
+
119
+ @A_Concept.Load()
120
+ async myMethod() {
121
+ this._test = 5;
122
+ }
123
+ }
124
+ class MyContainerB extends A_Container {
125
+ _test: number = 0
113
126
 
127
+ @A_Concept.Load()
128
+ myMethod() {
129
+ this._test++;
130
+ }
131
+ }
132
+
133
+
134
+ const containerA = new MyContainerA({ name: 'ContainerA' });
135
+ const containerB = new MyContainerB({ name: 'ContainerB' });
136
+
137
+ const concept = new A_Concept({
138
+ name: 'TestConcept',
139
+ containers: [
140
+ containerA,
141
+ containerB
142
+ ]
143
+ });
144
+
145
+ await concept.load();
146
+
147
+ expect(containerA.scope.resolve(MyContainerA)).toBeInstanceOf(MyContainerA);
148
+ expect(containerB.scope.resolve(MyContainerB)).toBeInstanceOf(MyContainerB);
149
+
150
+ expect(containerA._test).toBe(5);
151
+ expect(containerB._test).toBe(1);
152
+ })
153
+
154
+ });
@@ -3,6 +3,8 @@ import './test.setup';
3
3
 
4
4
  import { A_Component } from "@adaas/a-concept/global/A-Component/A-Component.class";
5
5
  import { A_Context } from '@adaas/a-concept/global/A-Context/A-Context.class';
6
+ import { A_Concept } from '@adaas/a-concept/global/A-Concept/A-Concept.class';
7
+ import { A_TYPES__ComponentMetaKey } from '@adaas/a-concept/global/A-Component/A-Component.constants';
6
8
 
7
9
  jest.retryTimes(0);
8
10
 
@@ -29,4 +31,26 @@ describe('A-Component tests', () => {
29
31
 
30
32
  expect(dependentComponent.dependency).toBeInstanceOf(MyComponent);
31
33
  });
32
- });
34
+ it('Should inherit component meta correctly', async () => {
35
+ class BaseComponent extends A_Component {
36
+ @A_Concept.Load()
37
+ test() {
38
+
39
+ }
40
+ }
41
+
42
+ class ChildComponent extends BaseComponent { }
43
+
44
+ const baseMeta = A_Context.meta(BaseComponent);
45
+ const childMeta = A_Context.meta(ChildComponent);
46
+
47
+ const baseAbstractions = baseMeta.get(A_TYPES__ComponentMetaKey.ABSTRACTIONS)
48
+ const childAbstractions = childMeta.get(A_TYPES__ComponentMetaKey.ABSTRACTIONS)
49
+
50
+ for (const [key, value] of baseAbstractions!) {
51
+ expect(childAbstractions!.has(key)).toBe(true);
52
+ expect(childAbstractions!.get(key)).toBe(value);
53
+ }
54
+ });
55
+
56
+ });