@adaas/a-concept 0.3.3 → 0.3.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adaas/a-concept",
3
- "version": "0.3.3",
3
+ "version": "0.3.4",
4
4
  "description": "A-Concept is a framework of the new generation that is tailored to use AI, enabling developers to create AI-powered applications with ease. It provides a structured approach to building, managing, and deploying AI-driven solutions.",
5
5
  "license": "Apache-2.0",
6
6
  "author": {
@@ -65,7 +65,7 @@ export function A_Abstraction_Extend(
65
65
  }
66
66
 
67
67
  let metaKey;
68
- const meta: A_ContainerMeta | A_ComponentMeta = A_Context.meta(target);
68
+ const meta: A_Meta = A_Context.meta(target);
69
69
 
70
70
  switch (true) {
71
71
  case A_TypeGuards.isContainerConstructor(target) || A_TypeGuards.isContainerInstance(target):
@@ -13,7 +13,7 @@ import { A_TYPES__FeatureDefineDecoratorMeta } from "@adaas/a-concept/a-feature"
13
13
 
14
14
 
15
15
 
16
- export class A_ContainerMeta extends A_Meta<A_TYPES__ContainerMeta> {
16
+ export class A_ContainerMeta<T extends A_TYPES__ContainerMeta = A_TYPES__ContainerMeta> extends A_Meta<T> {
17
17
 
18
18
 
19
19
 
@@ -8,6 +8,7 @@ import {
8
8
  } from "@adaas/a-concept/a-scope";
9
9
  import {
10
10
  A_Meta,
11
+ A_TYPES__Meta_Constructor,
11
12
  A_TYPES__MetaLinkedComponentConstructors,
12
13
  A_TYPES__MetaLinkedComponents
13
14
  } from "@adaas/a-concept/a-meta";
@@ -376,7 +377,7 @@ export class A_Context {
376
377
  */
377
378
  component: A_TYPES__Component_Constructor,
378
379
  ): T
379
- static meta<T extends A_ComponentMeta, S extends A_Component>(
380
+ static meta<T extends A_ComponentMeta<any>, S extends A_Component>(
380
381
  /**
381
382
  * Get meta for the specific component instance.
382
383
  */
@@ -442,7 +443,7 @@ export class A_Context {
442
443
  ) throw new A_ContextError(A_ContextError.InvalidMetaParameterError, `Invalid parameter provided to get meta. Component of type ${componentName} is not allowed for meta storage. Only A_Container, A_Component and A_Entity are allowed.`);
443
444
 
444
445
  let property: A_TYPES__MetaLinkedComponentConstructors;
445
- let metaType: typeof A_Meta<T> | typeof A_ContainerMeta | typeof A_ComponentMeta | typeof A_EntityMeta
446
+ let metaType: A_TYPES__Meta_Constructor<A_Meta<any>>
446
447
 
447
448
  switch (true) {
448
449
  // 1) If param1 is instance of A_Container
@@ -5,14 +5,15 @@ import {
5
5
  A_TYPES__IEntity,
6
6
  } from "./A-Entity.types";
7
7
  import { A_Scope } from "@adaas/a-concept/a-scope";
8
- import { A_FormatterHelper} from "@adaas/a-concept/helpers/A_Formatter.helper";
9
- import { A_IdentityHelper} from "@adaas/a-concept/helpers/A_Identity.helper";
8
+ import { A_FormatterHelper } from "@adaas/a-concept/helpers/A_Formatter.helper";
9
+ import { A_IdentityHelper } from "@adaas/a-concept/helpers/A_Identity.helper";
10
10
  import {
11
11
  ASEID,
12
12
  A_TYPES__ASEID_Constructor
13
13
  } from "@adaas/a-concept/aseid";
14
14
  import { A_EntityError } from "./A-Entity.error";
15
15
  import { A_Feature } from "@adaas/a-concept/a-feature";
16
+ import { A_TYPES__EntityFeatures } from "./A-Entity.constants";
16
17
 
17
18
 
18
19
  /**
@@ -289,24 +290,24 @@ export class A_Entity<
289
290
  /**
290
291
  * The default method that can be called and extended to load entity data.
291
292
  */
292
- async load(
293
+ load(
293
294
  scope?: A_Scope,
294
- ) {
295
- return this.call('load', scope);
295
+ ): Promise<void> | void {
296
+ return this.call(A_TYPES__EntityFeatures.LOAD, scope);
296
297
  }
297
298
 
298
299
  /**
299
300
  * The default method that can be called and extended to destroy entity data.
300
301
  */
301
- async destroy(scope?: A_Scope) {
302
- return this.call('destroy', scope);
302
+ destroy(scope?: A_Scope): Promise<void> | void {
303
+ return this.call(A_TYPES__EntityFeatures.DESTROY, scope);
303
304
  }
304
305
 
305
306
  /**
306
307
  * The default method that can be called and extended to save entity data.
307
308
  */
308
- async save(scope?: A_Scope) {
309
- return this.call('save', scope);
309
+ save(scope?: A_Scope): Promise<void> | void {
310
+ return this.call(A_TYPES__EntityFeatures.SAVE, scope);
310
311
  }
311
312
 
312
313
 
@@ -5,8 +5,8 @@ export enum A_TYPES__EntityMetaKey {
5
5
  INJECTIONS = 'a-component-injections',
6
6
  }
7
7
 
8
- export enum A_TYPES__EntityFeatures {
9
- SAVE = 'save',
10
- DESTROY = 'destroy',
11
- LOAD = 'load'
12
- }
8
+ export const A_TYPES__EntityFeatures = {
9
+ SAVE: '_A_Entity__Save',
10
+ DESTROY: '_A_Entity__Destroy',
11
+ LOAD: '_A_Entity__Load'
12
+ } as const;
@@ -5,7 +5,7 @@ import { A_TYPES__FeatureDefineDecoratorMeta } from "@adaas/a-concept/a-feature"
5
5
  import { A_TYPES__A_InjectDecorator_Meta } from "@adaas/a-concept/a-inject";
6
6
 
7
7
 
8
- export class A_EntityMeta extends A_Meta<A_TYPES__EntityMeta> {
8
+ export class A_EntityMeta<T extends A_TYPES__EntityMeta = A_TYPES__EntityMeta> extends A_Meta<T> {
9
9
 
10
10
  /**
11
11
  * Returns all features defined in the Container
@@ -1,7 +1,7 @@
1
1
  import { A_Meta } from "@adaas/a-concept/a-meta";
2
2
  import { A_Entity } from "./A-Entity.class";
3
3
  import { ASEID } from "@adaas/a-concept/aseid";
4
- import { A_TYPES__EntityMetaKey } from "./A-Entity.constants";
4
+ import { A_TYPES__EntityFeatures, A_TYPES__EntityMetaKey } from "./A-Entity.constants";
5
5
  import { A_TYPES__FeatureDefineDecoratorMeta, A_TYPES__FeatureExtendDecoratorMeta } from "@adaas/a-concept/a-feature";
6
6
  import { A_TYPES__A_InjectDecorator_Meta } from "@adaas/a-concept/a-inject";
7
7
  import { A_TYPES__Ctor } from "@adaas/a-concept/types";
@@ -88,3 +88,4 @@ export type A_TYPES__EntityMeta = {
88
88
 
89
89
 
90
90
 
91
+ export type A_TYPES__EntityFeatureNames = typeof A_TYPES__EntityFeatures[keyof typeof A_TYPES__EntityFeatures];
@@ -843,7 +843,7 @@ export class A_Scope<
843
843
  /**
844
844
  * Provide the component constructor or its name to retrieve its constructor
845
845
  */
846
- component: A_TYPES__Ctor<T>
846
+ component: A_TYPES__Ctor<T>
847
847
  ): A_TYPES__Component_Constructor<T> | undefined
848
848
  resolveConstructor<T extends A_Entity>(
849
849
  /**
@@ -888,7 +888,7 @@ export class A_Scope<
888
888
  .find((e) => A_CommonHelper.isInheritedFrom(e, name)) as A_TYPES__Error_Constructor<T> | undefined;
889
889
  }
890
890
 
891
- if(!A_TypeGuards.isString(name))
891
+ if (!A_TypeGuards.isString(name))
892
892
  throw new A_ScopeError(
893
893
  A_ScopeError.ResolutionError,
894
894
  `Invalid constructor name provided: ${name}`
@@ -1865,7 +1865,12 @@ export class A_Scope<
1865
1865
  */
1866
1866
  entity: A_Entity
1867
1867
  ): void
1868
-
1868
+ deregister<T extends A_TYPES__A_DependencyInjectable>(
1869
+ /**
1870
+ * Provide an entity instance to register it in the scope
1871
+ */
1872
+ component: T
1873
+ ): void
1869
1874
  deregister(
1870
1875
  param1: unknown
1871
1876
  ): void {