@adaas/a-concept 0.2.14 → 0.3.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.
- package/.conf/tsconfig.base.json +91 -0
- package/.conf/tsconfig.browser.json +36 -0
- package/.conf/tsconfig.node.json +40 -0
- package/dist/browser/index.d.mts +4166 -212
- package/dist/browser/index.mjs +2 -67
- package/dist/browser/index.mjs.map +1 -1
- package/dist/node/index.cjs +5757 -383
- package/dist/node/index.cjs.map +1 -1
- package/dist/node/index.d.mts +4193 -212
- package/dist/node/index.d.ts +4193 -212
- package/dist/node/index.mjs +5699 -66
- package/dist/node/index.mjs.map +1 -1
- package/jest.config.ts +30 -15
- package/package.json +19 -16
- package/src/env/env-browser.ts +38 -1
- package/src/env/env-node.ts +26 -2
- package/src/env/env.base.ts +20 -1
- package/src/env/global.browser.d.ts +1 -1
- package/src/helpers/A_BasicTypeGuards.helper.ts +81 -0
- package/src/helpers/A_Common.helper.ts +2 -2
- package/src/helpers/A_Identity.helper.ts +2 -4
- package/src/helpers/A_TypeGuards.helper.ts +45 -30
- package/src/helpers/index.ts +5 -0
- package/src/index.ts +21 -94
- package/src/{global → lib}/A-Abstraction/A-Abstraction-Extend.decorator.ts +18 -13
- package/src/{global → lib}/A-Abstraction/A-Abstraction.class.ts +5 -5
- package/src/{global → lib}/A-Abstraction/A-Abstraction.error.ts +1 -1
- package/src/{global → lib}/A-Abstraction/A-Abstraction.types.ts +5 -5
- package/src/lib/A-Abstraction/index.ts +8 -0
- package/src/{global → lib}/A-Caller/A_Caller.class.ts +3 -4
- package/src/{global → lib}/A-Caller/A_Caller.error.ts +1 -4
- package/src/{global → lib}/A-Caller/A_Caller.types.ts +4 -4
- package/src/lib/A-Caller/index.ts +3 -0
- package/src/{global → lib}/A-Component/A-Component.class.ts +2 -3
- package/src/{global → lib}/A-Component/A-Component.meta.ts +5 -5
- package/src/{global → lib}/A-Component/A-Component.types.ts +5 -5
- package/src/lib/A-Component/index.ts +5 -0
- package/src/{global → lib}/A-Concept/A-Concept.class.ts +9 -7
- package/src/{global → lib}/A-Concept/A-Concept.meta.ts +2 -2
- package/src/{global → lib}/A-Concept/A-Concept.types.ts +7 -7
- package/src/lib/A-Concept/index.ts +4 -0
- package/src/{global → lib}/A-Container/A-Container.class.ts +3 -3
- package/src/{global → lib}/A-Container/A-Container.meta.ts +11 -6
- package/src/{global → lib}/A-Container/A-Container.types.ts +9 -6
- package/src/lib/A-Container/index.ts +5 -0
- package/src/{global → lib}/A-Context/A-Context.class.ts +41 -33
- package/src/{global → lib}/A-Context/A-Context.error.ts +1 -1
- package/src/lib/A-Context/A-Context.types.ts +14 -0
- package/src/lib/A-Context/index.ts +5 -0
- package/src/{global → lib}/A-Dependency/A-Dependency-All.decorator.ts +11 -11
- package/src/{global → lib}/A-Dependency/A-Dependency-Default.decorator.ts +11 -9
- package/src/{global → lib}/A-Dependency/A-Dependency-Flat.decorator.ts +11 -8
- package/src/{global → lib}/A-Dependency/A-Dependency-Load.decorator.ts +11 -9
- package/src/{global → lib}/A-Dependency/A-Dependency-Parent.decorator.ts +11 -9
- package/src/{global → lib}/A-Dependency/A-Dependency-Require.decorator.ts +11 -9
- package/src/{global → lib}/A-Dependency/A-Dependency.class.ts +9 -3
- package/src/{global → lib}/A-Dependency/A-Dependency.error.ts +1 -1
- package/src/{global → lib}/A-Dependency/A-Dependency.types.ts +9 -9
- package/src/lib/A-Dependency/index.ts +17 -0
- package/src/{global → lib}/A-Entity/A-Entity.class.ts +11 -9
- package/src/{global → lib}/A-Entity/A-Entity.error.ts +1 -1
- package/src/{global → lib}/A-Entity/A-Entity.meta.ts +3 -3
- package/src/{global → lib}/A-Entity/A-Entity.types.ts +5 -5
- package/src/lib/A-Entity/index.ts +5 -0
- package/src/{global → lib}/A-Error/A_Error.class.ts +13 -13
- package/src/{global → lib}/A-Error/A_Error.types.ts +2 -2
- package/src/lib/A-Error/index.ts +3 -0
- package/src/{global → lib}/A-Feature/A-Feature-Define.decorator.ts +16 -10
- package/src/{global → lib}/A-Feature/A-Feature-Extend.decorator.ts +13 -9
- package/src/{global → lib}/A-Feature/A-Feature.class.ts +15 -13
- package/src/{global → lib}/A-Feature/A-Feature.error.ts +2 -2
- package/src/{global → lib}/A-Feature/A-Feature.types.ts +21 -12
- package/src/lib/A-Feature/index.ts +13 -0
- package/src/{global → lib}/A-Fragment/A-Fragment.class.ts +0 -2
- package/src/{global → lib}/A-Fragment/A-Fragment.types.ts +1 -1
- package/src/lib/A-Fragment/index.ts +5 -0
- package/src/{global → lib}/A-Inject/A-Inject.decorator.ts +42 -24
- package/src/{global → lib}/A-Inject/A-Inject.error.ts +1 -1
- package/src/{global → lib}/A-Inject/A-Inject.types.ts +3 -9
- package/src/lib/A-Inject/index.ts +3 -0
- package/src/{global → lib}/A-Meta/A-Meta.decorator.ts +2 -2
- package/src/{global → lib}/A-Meta/A-Meta.types.ts +18 -10
- package/src/lib/A-Meta/index.ts +11 -0
- package/src/{global → lib}/A-Scope/A-Scope.class.ts +34 -24
- package/src/{global → lib}/A-Scope/A-Scope.error.ts +1 -1
- package/src/{global → lib}/A-Scope/A-Scope.types.ts +22 -14
- package/src/lib/A-Scope/index.ts +5 -0
- package/src/{global → lib}/A-Stage/A-Stage.class.ts +9 -10
- package/src/{global → lib}/A-Stage/A-Stage.error.ts +1 -1
- package/src/{global → lib}/A-Stage/A-Stage.types.ts +1 -4
- package/src/lib/A-Stage/index.ts +5 -0
- package/src/{global → lib}/A-StepManager/A-StepManager.class.ts +8 -4
- package/src/{global → lib}/A-StepManager/A-StepManager.error.ts +1 -1
- package/src/lib/A-StepManager/index.ts +4 -0
- package/src/{global → lib}/ASEID/ASEID.class.ts +20 -23
- package/src/lib/ASEID/ASEID.error.ts +12 -0
- package/src/lib/ASEID/index.ts +4 -0
- package/src/types/A_identity.types.ts +4 -0
- package/src/types/index.ts +2 -0
- package/tests/A-Abstraction.test.ts +6 -6
- package/tests/A-Common.test.ts +6 -4
- package/tests/A-Component.test.ts +7 -5
- package/tests/A-Concept.test.ts +13 -11
- package/tests/A-Container.test.ts +4 -3
- package/tests/A-Dependency.test.ts +6 -1
- package/tests/A-Entity.test.ts +7 -5
- package/tests/A-Error.test.ts +7 -4
- package/tests/A-Feature.test.ts +12 -8
- package/tests/A-Fragment.test.ts +1 -2
- package/tests/A-Inject.test.ts +4 -1
- package/tests/A-Meta.test.ts +12 -10
- package/tests/A-Scope.test.ts +11 -10
- package/tests/A-StepManager.test.ts +3 -3
- package/tests/ASEID.test.ts +2 -2
- package/tests/jest.setup.ts +23 -23
- package/tsconfig.json +59 -97
- package/tsup.config.ts +18 -13
- package/dist/browser/A-Context.types-BtR_HJ0j.d.mts +0 -3828
- package/dist/browser/env.d.mts +0 -64
- package/dist/browser/env.mjs +0 -3
- package/dist/browser/env.mjs.map +0 -1
- package/dist/node/A-Context.types-BtR_HJ0j.d.mts +0 -3828
- package/dist/node/A-Context.types-BtR_HJ0j.d.ts +0 -3828
- package/dist/node/env.cjs +0 -12
- package/dist/node/env.cjs.map +0 -1
- package/dist/node/env.d.mts +0 -91
- package/dist/node/env.d.ts +0 -91
- package/dist/node/env.js +0 -12
- package/dist/node/env.js.map +0 -1
- package/dist/node/env.mjs +0 -3
- package/dist/node/env.mjs.map +0 -1
- package/dist/node/index.js +0 -387
- package/dist/node/index.js.map +0 -1
- package/src/global/A-Context/A-Context.types.ts +0 -14
- package/src/global/ASEID/ASEID.error.ts +0 -12
- /package/src/{global → lib}/A-Component/A-Component.constants.ts +0 -0
- /package/src/{global → lib}/A-Concept/A-Concept.constants.ts +0 -0
- /package/src/{global → lib}/A-Container/A-Container.constants.ts +0 -0
- /package/src/{global → lib}/A-Entity/A-Entity.constants.ts +0 -0
- /package/src/{global → lib}/A-Error/A_Error.constants.ts +0 -0
- /package/src/{global → lib}/A-Meta/A-Meta.class.ts +0 -0
- /package/src/{global → lib}/ASEID/ASEID.constants.ts +0 -0
- /package/src/{global → lib}/ASEID/ASEID.types.ts +0 -0
package/jest.config.ts
CHANGED
|
@@ -2,22 +2,37 @@ import type { Config } from '@jest/types';
|
|
|
2
2
|
|
|
3
3
|
// Sync object
|
|
4
4
|
const config: Config.InitialOptions = {
|
|
5
|
-
|
|
5
|
+
displayName: 'adaas-a-concept',
|
|
6
|
+
preset: 'ts-jest',
|
|
7
|
+
testEnvironment: 'node',
|
|
8
|
+
resetModules: true,
|
|
9
|
+
rootDir: '.',
|
|
10
|
+
testMatch: ['<rootDir>/tests/**/*.test.ts'],
|
|
6
11
|
setupFilesAfterEnv: ['<rootDir>/tests/jest.setup.ts'],
|
|
7
|
-
roots: ['<rootDir>/tests'],
|
|
8
|
-
transform: {
|
|
9
|
-
'^.+\\.tsx?$': 'ts-jest'
|
|
10
|
-
},
|
|
11
12
|
moduleNameMapper: {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
13
|
+
'^@adaas/a-concept/constants/(.*)$': '<rootDir>/src/constants/$1',
|
|
14
|
+
'^@adaas/a-concept/utils/(.*)$': '<rootDir>/src/utils/$1',
|
|
15
|
+
'^@adaas/a-concept/env$': '<rootDir>/src/env/index.node.ts',
|
|
16
|
+
'^@adaas/a-concept/helpers/(.*)$': '<rootDir>/src/helpers/$1',
|
|
17
|
+
'^@adaas/a-concept/types$': '<rootDir>/src/types',
|
|
18
|
+
'^@adaas/a-concept/a-abstraction$': '<rootDir>/src/lib/A-Abstraction',
|
|
19
|
+
'^@adaas/a-concept/a-caller$': '<rootDir>/src/lib/A-Caller',
|
|
20
|
+
'^@adaas/a-concept/a-component$': '<rootDir>/src/lib/A-Component',
|
|
21
|
+
'^@adaas/a-concept/a-concept$': '<rootDir>/src/lib/A-Concept',
|
|
22
|
+
'^@adaas/a-concept/a-container$': '<rootDir>/src/lib/A-Container',
|
|
23
|
+
'^@adaas/a-concept/a-context$': '<rootDir>/src/lib/A-Context',
|
|
24
|
+
'^@adaas/a-concept/a-dependency$': '<rootDir>/src/lib/A-Dependency',
|
|
25
|
+
'^@adaas/a-concept/a-entity$': '<rootDir>/src/lib/A-Entity',
|
|
26
|
+
'^@adaas/a-concept/a-error$': '<rootDir>/src/lib/A-Error',
|
|
27
|
+
'^@adaas/a-concept/a-feature$': '<rootDir>/src/lib/A-Feature',
|
|
28
|
+
'^@adaas/a-concept/a-fragment$': '<rootDir>/src/lib/A-Fragment',
|
|
29
|
+
'^@adaas/a-concept/a-inject$': '<rootDir>/src/lib/A-Inject',
|
|
30
|
+
'^@adaas/a-concept/a-meta$': '<rootDir>/src/lib/A-Meta',
|
|
31
|
+
'^@adaas/a-concept/a-scope$': '<rootDir>/src/lib/A-Scope',
|
|
32
|
+
'^@adaas/a-concept/a-stage$': '<rootDir>/src/lib/A-Stage',
|
|
33
|
+
'^@adaas/a-concept/a-step-manager$': '<rootDir>/src/lib/A-StepManager',
|
|
34
|
+
'^@adaas/a-concept/aseid$': '<rootDir>/src/lib/ASEID',
|
|
35
|
+
},
|
|
36
|
+
collectCoverageFrom: ['src/**/*.ts', '!src/**/*.d.ts'],
|
|
22
37
|
};
|
|
23
38
|
export default config;
|
package/package.json
CHANGED
|
@@ -1,23 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adaas/a-concept",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.1",
|
|
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
|
-
"main": "./dist/node/index.cjs",
|
|
7
|
-
"module": "./dist/node/index.mjs",
|
|
8
|
-
"types": "./dist/node/index.d.ts",
|
|
9
|
-
"exports": {
|
|
10
|
-
".": {
|
|
11
|
-
"browser": "./dist/browser/index.mjs",
|
|
12
|
-
"import": "./dist/node/index.mjs",
|
|
13
|
-
"require": "./dist/node/index.cjs"
|
|
14
|
-
},
|
|
15
|
-
"./env": {
|
|
16
|
-
"browser": "./dist/browser/env.mjs",
|
|
17
|
-
"import": "./dist/node/env.mjs",
|
|
18
|
-
"require": "./dist/node/env.cjs"
|
|
19
|
-
}
|
|
20
|
-
},
|
|
21
6
|
"author": {
|
|
22
7
|
"name": "ADAAS YAZILIM LİMİTED ŞİRKETİ",
|
|
23
8
|
"email": "contact-us@adaas.org"
|
|
@@ -35,6 +20,24 @@
|
|
|
35
20
|
"bugs": {
|
|
36
21
|
"url": "https://github.com/ADAAS-org/adaas-a-concept/issues"
|
|
37
22
|
},
|
|
23
|
+
"exports": {
|
|
24
|
+
".": {
|
|
25
|
+
"browser": {
|
|
26
|
+
"types": "./dist/browser/index.d.mts",
|
|
27
|
+
"import": "./dist/browser/index.mjs"
|
|
28
|
+
},
|
|
29
|
+
"node": {
|
|
30
|
+
"types": "./dist/node/index.d.ts",
|
|
31
|
+
"import": "./dist/node/index.mjs",
|
|
32
|
+
"require": "./dist/node/index.cjs"
|
|
33
|
+
},
|
|
34
|
+
"default": {
|
|
35
|
+
"types": "./dist/node/index.d.ts",
|
|
36
|
+
"import": "./dist/node/index.mjs",
|
|
37
|
+
"require": "./dist/node/index.cjs"
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
},
|
|
38
41
|
"sideEffects": false,
|
|
39
42
|
"nodemonConfig": {
|
|
40
43
|
"ignore": [
|
package/src/env/env-browser.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { A_TYPES__ContextEnvironment } from "
|
|
1
|
+
import { A_TYPES__ContextEnvironment } from "@adaas/a-concept/a-context";
|
|
2
2
|
import { A_CONCEPT_BASE_ENV } from "./env.base";
|
|
3
|
+
import { A_CONSTANTS__DEFAULT_ENV_VARIABLES_ARRAY } from "../constants/env.constants";
|
|
3
4
|
|
|
4
5
|
|
|
5
6
|
export class A_CONCEPT_ENV extends A_CONCEPT_BASE_ENV {
|
|
@@ -30,4 +31,40 @@ export class A_CONCEPT_ENV extends A_CONCEPT_BASE_ENV {
|
|
|
30
31
|
}
|
|
31
32
|
window.__A_CONCEPT_ENVIRONMENT_ENV__[name] = value;
|
|
32
33
|
}
|
|
34
|
+
|
|
35
|
+
static getAll<T extends Record<string, string>>(): T {
|
|
36
|
+
const allEnv: Record<string, string> = {};
|
|
37
|
+
|
|
38
|
+
// Get all environment variables from the window object
|
|
39
|
+
if (window.__A_CONCEPT_ENVIRONMENT_ENV__) {
|
|
40
|
+
Object.keys(window.__A_CONCEPT_ENVIRONMENT_ENV__).forEach(key => {
|
|
41
|
+
allEnv[key] = window.__A_CONCEPT_ENVIRONMENT_ENV__![key];
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// Get all default environment variables from the class
|
|
46
|
+
A_CONSTANTS__DEFAULT_ENV_VARIABLES_ARRAY.forEach(variable => {
|
|
47
|
+
allEnv[variable] = this.get(variable) as string;
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
return allEnv as T;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
static getAllKeys<T extends Array<string>>(): T {
|
|
54
|
+
const keys = new Set<string>();
|
|
55
|
+
|
|
56
|
+
// Get all keys from the window object
|
|
57
|
+
if (window.__A_CONCEPT_ENVIRONMENT_ENV__) {
|
|
58
|
+
Object.keys(window.__A_CONCEPT_ENVIRONMENT_ENV__).forEach(key => {
|
|
59
|
+
keys.add(key);
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// Get all default environment variable keys from the class
|
|
64
|
+
A_CONSTANTS__DEFAULT_ENV_VARIABLES_ARRAY.forEach(variable => {
|
|
65
|
+
keys.add(variable);
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
return Array.from(keys) as T;
|
|
69
|
+
}
|
|
33
70
|
};
|
package/src/env/env-node.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A_CONSTANTS__DEFAULT_ENV_VARIABLES } from "
|
|
2
|
-
import { A_TYPES__ContextEnvironment } from "
|
|
1
|
+
import { A_CONSTANTS__DEFAULT_ENV_VARIABLES, A_CONSTANTS__DEFAULT_ENV_VARIABLES_ARRAY } from "@adaas/a-concept/constants/env.constants";
|
|
2
|
+
import { A_TYPES__ContextEnvironment } from "@adaas/a-concept/a-context";
|
|
3
3
|
import { A_CONCEPT_BASE_ENV } from "./env.base";
|
|
4
4
|
|
|
5
5
|
export class A_CONCEPT_ENV extends A_CONCEPT_BASE_ENV {
|
|
@@ -63,4 +63,28 @@ export class A_CONCEPT_ENV extends A_CONCEPT_BASE_ENV {
|
|
|
63
63
|
static set(name: string, value: string): void {
|
|
64
64
|
process.env[name] = value;
|
|
65
65
|
}
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
static getAll<T extends Record<string, any>>(): T {
|
|
69
|
+
const allEnv: Record<string, any> = {};
|
|
70
|
+
|
|
71
|
+
// Get all environment variables from process.env
|
|
72
|
+
for (const key in process.env) {
|
|
73
|
+
allEnv[key] = process.env[key];
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// Get all default environment variables defined in A_CONSTANTS__DEFAULT_ENV_VARIABLES_ARRAY
|
|
77
|
+
A_CONSTANTS__DEFAULT_ENV_VARIABLES_ARRAY.forEach((variable) => {
|
|
78
|
+
allEnv[variable] = this.get(variable);
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
return allEnv as T
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
static getAllKeys<T extends Array<string>>(): T {
|
|
85
|
+
return [
|
|
86
|
+
...Object.keys(process.env),
|
|
87
|
+
...A_CONSTANTS__DEFAULT_ENV_VARIABLES_ARRAY
|
|
88
|
+
] as T;
|
|
89
|
+
}
|
|
66
90
|
}
|
package/src/env/env.base.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { A_TYPES__ContextEnvironment } from "
|
|
1
|
+
import { A_TYPES__ContextEnvironment } from "@adaas/a-concept/a-context";
|
|
2
|
+
import { A_CONSTANTS__DEFAULT_ENV_VARIABLES_ARRAY } from "../constants/env.constants";
|
|
2
3
|
|
|
3
4
|
export class A_CONCEPT_BASE_ENV {
|
|
4
5
|
// ----------------------------------------------------------
|
|
@@ -73,4 +74,22 @@ export class A_CONCEPT_BASE_ENV {
|
|
|
73
74
|
(this as any)[name] = value;
|
|
74
75
|
}
|
|
75
76
|
|
|
77
|
+
/**
|
|
78
|
+
* This method returns all the environment variables that are available in the application. It combines the variables from process.env and the default environment variables defined in A_CONSTANTS__DEFAULT_ENV_VARIABLES_ARRAY.
|
|
79
|
+
*
|
|
80
|
+
* @returns
|
|
81
|
+
*/
|
|
82
|
+
static getAll<T extends Record<string, any>>(): T {
|
|
83
|
+
return {} as T;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* This method returns all the keys of the environment variables that are available in the application. It combines the keys from process.env and the default environment variables defined in A_CONSTANTS__DEFAULT_ENV_VARIABLES_ARRAY.
|
|
88
|
+
*
|
|
89
|
+
* @returns
|
|
90
|
+
*/
|
|
91
|
+
static getAllKeys<T extends Array<string>>(): T {
|
|
92
|
+
return [] as any as T;
|
|
93
|
+
}
|
|
94
|
+
|
|
76
95
|
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Basic TypeGuards that don't create circular dependencies
|
|
3
|
+
* These are used by A_Error and other core classes
|
|
4
|
+
*/
|
|
5
|
+
export class A_BasicTypeGuards {
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Check if value is a string
|
|
9
|
+
*
|
|
10
|
+
* @param value
|
|
11
|
+
* @returns
|
|
12
|
+
*/
|
|
13
|
+
static isString(value: any): value is string {
|
|
14
|
+
return typeof value === 'string' || value instanceof String;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Check if value is a number
|
|
19
|
+
*
|
|
20
|
+
* @param value
|
|
21
|
+
* @returns
|
|
22
|
+
*/
|
|
23
|
+
static isNumber(value: any): value is number {
|
|
24
|
+
return typeof value === 'number' && isFinite(value);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Check if value is a boolean
|
|
29
|
+
*
|
|
30
|
+
* @param value
|
|
31
|
+
* @returns
|
|
32
|
+
*/
|
|
33
|
+
static isBoolean(value: any): value is boolean {
|
|
34
|
+
return typeof value === 'boolean';
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Check if value is an object
|
|
39
|
+
*
|
|
40
|
+
* @param value
|
|
41
|
+
* @returns
|
|
42
|
+
*/
|
|
43
|
+
static isObject<T = object>(value: any): value is T {
|
|
44
|
+
return value !== null && typeof value === 'object' && !Array.isArray(value);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Check if value is an array
|
|
49
|
+
*
|
|
50
|
+
* @param value
|
|
51
|
+
* @returns
|
|
52
|
+
*/
|
|
53
|
+
static isArray(value: any): value is any[] {
|
|
54
|
+
return Array.isArray(value);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Allows to check if the provided param is of constructor type.
|
|
59
|
+
*
|
|
60
|
+
* @param param
|
|
61
|
+
* @returns
|
|
62
|
+
*/
|
|
63
|
+
static isErrorConstructorType<T = any>(param: any): param is T {
|
|
64
|
+
return !!param && A_BasicTypeGuards.isObject(param) && !(param instanceof Error) && "title" in param;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
static isErrorSerializedType<T = any>(param: any): param is T {
|
|
68
|
+
return !!param && A_BasicTypeGuards.isObject(param) && !(param instanceof Error) && "aseid" in param && A_BasicTypeGuards.isString((param as any).aseid);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Check if scope is of type A_Scope instance
|
|
73
|
+
*
|
|
74
|
+
* @param scope
|
|
75
|
+
* @returns
|
|
76
|
+
*/
|
|
77
|
+
static isScopeInstance(scope: any): boolean {
|
|
78
|
+
// Basic check without importing A_Scope to avoid circular dependency
|
|
79
|
+
return !!scope && typeof scope === 'object' && 'name' in scope && 'aseid' in scope;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A_TYPES__DeepPartial } from "
|
|
1
|
+
import { A_TYPES__DeepPartial } from "@adaas/a-concept/types";
|
|
2
2
|
|
|
3
3
|
export class A_CommonHelper {
|
|
4
4
|
|
|
@@ -312,7 +312,7 @@ export class A_CommonHelper {
|
|
|
312
312
|
if (fnAny.displayName) return String(fnAny.displayName);
|
|
313
313
|
if (fnAny.name) return String(fnAny.name);
|
|
314
314
|
|
|
315
|
-
if(fnAny.constructor && fnAny.constructor.name) {
|
|
315
|
+
if (fnAny.constructor && fnAny.constructor.name) {
|
|
316
316
|
return String(fnAny.constructor.name);
|
|
317
317
|
}
|
|
318
318
|
|
|
@@ -1,36 +1,51 @@
|
|
|
1
|
+
import { A_CommonHelper } from "./A_Common.helper";
|
|
1
2
|
import {
|
|
2
3
|
A_TYPES__Feature_Constructor,
|
|
3
4
|
A_TYPES__FeatureAvailableComponents,
|
|
4
5
|
A_TYPES__FeatureExtendDecoratorTarget
|
|
5
|
-
} from "
|
|
6
|
+
} from "@adaas/a-concept/a-feature";
|
|
6
7
|
import {
|
|
7
8
|
A_TYPES__Error_Constructor,
|
|
8
9
|
A_TYPES__Error_Init,
|
|
9
10
|
A_TYPES__Error_Serialized
|
|
10
|
-
} from "
|
|
11
|
-
import {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
import {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
import {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
import {
|
|
32
|
-
|
|
33
|
-
|
|
11
|
+
} from "@adaas/a-concept/a-error";
|
|
12
|
+
import {
|
|
13
|
+
A_Component,
|
|
14
|
+
A_ComponentMeta,
|
|
15
|
+
A_TYPES__Component_Constructor
|
|
16
|
+
} from "@adaas/a-concept/a-component";
|
|
17
|
+
import {
|
|
18
|
+
A_Container,
|
|
19
|
+
A_ContainerMeta,
|
|
20
|
+
A_TYPES__Container_Constructor
|
|
21
|
+
} from "@adaas/a-concept/a-container";
|
|
22
|
+
import {
|
|
23
|
+
A_Entity,
|
|
24
|
+
A_EntityMeta,
|
|
25
|
+
A_TYPES__Entity_Constructor
|
|
26
|
+
} from "@adaas/a-concept/a-entity";
|
|
27
|
+
import { A_Feature } from "@adaas/a-concept/a-feature";
|
|
28
|
+
import {
|
|
29
|
+
A_TYPES__Fragment_Constructor,
|
|
30
|
+
A_Fragment
|
|
31
|
+
} from "@adaas/a-concept/a-fragment";
|
|
32
|
+
import {
|
|
33
|
+
A_Scope,
|
|
34
|
+
A_TYPES__Scope_Constructor,
|
|
35
|
+
A_TYPES__ScopeLinkedComponents,
|
|
36
|
+
A_TYPES__ScopeLinkedConstructors
|
|
37
|
+
} from "@adaas/a-concept/a-scope";
|
|
38
|
+
import {
|
|
39
|
+
A_Caller,
|
|
40
|
+
A_TYPES__Caller_Constructor
|
|
41
|
+
} from "@adaas/a-concept/a-caller";
|
|
42
|
+
import { A_TYPES__AbstractionAvailableComponents } from "@adaas/a-concept/a-abstraction";
|
|
43
|
+
import { A_TYPES__InjectableTargets } from "@adaas/a-concept/a-inject";
|
|
44
|
+
import { ASEID } from "@adaas/a-concept/aseid";
|
|
45
|
+
import {
|
|
46
|
+
A_Dependency,
|
|
47
|
+
A_TYPES__A_DependencyInjectable
|
|
48
|
+
} from "@adaas/a-concept/a-dependency";
|
|
34
49
|
|
|
35
50
|
|
|
36
51
|
|
|
@@ -157,7 +172,7 @@ export class A_TypeGuards {
|
|
|
157
172
|
* @returns
|
|
158
173
|
*/
|
|
159
174
|
static isErrorConstructor(ctor: any): ctor is A_TYPES__Error_Constructor {
|
|
160
|
-
return typeof ctor === 'function' && A_CommonHelper.isInheritedFrom(ctor,
|
|
175
|
+
return typeof ctor === 'function' && A_CommonHelper.isInheritedFrom(ctor, Error);
|
|
161
176
|
}
|
|
162
177
|
/**
|
|
163
178
|
* Type guard to check if the constructor is of type A_Feature
|
|
@@ -259,8 +274,8 @@ export class A_TypeGuards {
|
|
|
259
274
|
* @param instance
|
|
260
275
|
* @returns
|
|
261
276
|
*/
|
|
262
|
-
static isErrorInstance(instance: any):
|
|
263
|
-
return instance instanceof
|
|
277
|
+
static isErrorInstance(instance: any): boolean {
|
|
278
|
+
return instance instanceof Error;
|
|
264
279
|
}
|
|
265
280
|
/**
|
|
266
281
|
* Type guard to check if the instance is of type A_ComponentMeta
|
|
@@ -295,8 +310,8 @@ export class A_TypeGuards {
|
|
|
295
310
|
// ==========================================================================
|
|
296
311
|
// ========================= SPECIAL Type Guards =============================
|
|
297
312
|
// ===========================================================================
|
|
298
|
-
static hasASEID(value: any): value is A_Entity |
|
|
299
|
-
return value && typeof value === 'object' && 'aseid' && (A_TypeGuards.isEntityInstance(value) || A_TypeGuards.isErrorInstance(value));
|
|
313
|
+
static hasASEID(value: any): value is A_Entity | { aseid: any } {
|
|
314
|
+
return value && typeof value === 'object' && 'aseid' in value && (A_TypeGuards.isEntityInstance(value) || A_TypeGuards.isErrorInstance(value));
|
|
300
315
|
}
|
|
301
316
|
|
|
302
317
|
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { A_CommonHelper } from './A_Common.helper';
|
|
2
|
+
export { A_FormatterHelper } from './A_Formatter.helper';
|
|
3
|
+
export { A_IdentityHelper } from './A_Identity.helper';
|
|
4
|
+
export { A_TypeGuards } from './A_TypeGuards.helper';
|
|
5
|
+
export { A_BasicTypeGuards } from './A_BasicTypeGuards.helper';
|
package/src/index.ts
CHANGED
|
@@ -1,95 +1,22 @@
|
|
|
1
|
-
// =================================================================================================
|
|
2
|
-
// ============================= Export Framework Components =======================================
|
|
3
|
-
// =================================================================================================
|
|
4
|
-
export * from './constants/env.constants';
|
|
5
|
-
export * from './types/A_Common.types';
|
|
6
|
-
|
|
7
|
-
// ---------------------- Major Components ----------------------
|
|
8
|
-
export { A_Context } from './global/A-Context/A-Context.class';
|
|
9
|
-
export { A_ContextError } from './global/A-Context/A-Context.error';
|
|
10
|
-
export * from './global/A-Context/A-Context.types';
|
|
11
|
-
|
|
12
|
-
export { A_Concept } from './global/A-Concept/A-Concept.class';
|
|
13
|
-
export { A_ConceptMeta } from './global/A-Concept/A-Concept.meta';
|
|
14
|
-
export * from './global/A-Concept/A-Concept.types';
|
|
15
|
-
export * from './global/A-Concept/A-Concept.constants';
|
|
16
|
-
|
|
17
|
-
export { A_Container } from './global/A-Container/A-Container.class';
|
|
18
|
-
export { A_ContainerMeta } from './global/A-Container/A-Container.meta';
|
|
19
|
-
export * from './global/A-Container/A-Container.types';
|
|
20
|
-
export * from './global/A-Container/A-Container.constants';
|
|
21
|
-
|
|
22
|
-
export { A_Component } from './global/A-Component/A-Component.class';
|
|
23
|
-
export { A_ComponentMeta } from './global/A-Component/A-Component.meta';
|
|
24
|
-
export * from './global/A-Component/A-Component.types';
|
|
25
|
-
export * from './global/A-Component/A-Component.constants';
|
|
26
|
-
|
|
27
|
-
export { A_Entity } from './global/A-Entity/A-Entity.class';
|
|
28
|
-
export { A_EntityError } from './global/A-Entity/A-Entity.error';
|
|
29
|
-
export { A_EntityMeta } from './global/A-Entity/A-Entity.meta';
|
|
30
|
-
export * from './global/A-Entity/A-Entity.types';
|
|
31
|
-
export * from './global/A-Entity/A-Entity.constants';
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
// ---------------------- Common Components ----------------------
|
|
35
|
-
export { A_Abstraction } from './global/A-Abstraction/A-Abstraction.class';
|
|
36
|
-
export { A_AbstractionError } from './global/A-Abstraction/A-Abstraction.error';
|
|
37
|
-
export { A_Abstraction_Extend } from './global/A-Abstraction/A-Abstraction-Extend.decorator';
|
|
38
|
-
export * from './global/A-Abstraction/A-Abstraction.types';
|
|
39
|
-
|
|
40
|
-
export { A_Caller } from './global/A-Caller/A_Caller.class';
|
|
41
|
-
export { A_CallerError } from './global/A-Caller/A_Caller.error';
|
|
42
|
-
export * from './global/A-Caller/A_Caller.types';
|
|
43
|
-
|
|
44
|
-
export { A_Error } from './global/A-Error/A_Error.class';
|
|
45
|
-
export * from './global/A-Error/A_Error.types';
|
|
46
|
-
export * from './global/A-Error/A_Error.constants';
|
|
47
|
-
|
|
48
|
-
export { ASEID } from './global/ASEID/ASEID.class';
|
|
49
|
-
export { ASEID_Error } from './global/ASEID/ASEID.error';
|
|
50
|
-
export * from './global/ASEID/ASEID.types';
|
|
51
|
-
// export * from './global/ASEID/ASEID.constants';
|
|
52
|
-
|
|
53
|
-
export { A_Feature } from './global/A-Feature/A-Feature.class';
|
|
54
|
-
export { A_FeatureError } from './global/A-Feature/A-Feature.error';
|
|
55
|
-
export { A_Feature_Define } from './global/A-Feature/A-Feature-Define.decorator';
|
|
56
|
-
export { A_Feature_Extend } from './global/A-Feature/A-Feature-Extend.decorator';
|
|
57
|
-
export * from './global/A-Feature/A-Feature.types';
|
|
58
|
-
|
|
59
|
-
export { A_Stage } from './global/A-Stage/A-Stage.class';
|
|
60
|
-
export { A_StageError } from './global/A-Stage/A-Stage.error';
|
|
61
|
-
export * from './global/A-Stage/A-Stage.types';
|
|
62
|
-
|
|
63
|
-
export { A_Scope } from './global/A-Scope/A-Scope.class';
|
|
64
|
-
export { A_ScopeError } from './global/A-Scope/A-Scope.error';
|
|
65
|
-
export * from './global/A-Scope/A-Scope.types';
|
|
66
|
-
|
|
67
|
-
export { A_Meta } from './global/A-Meta/A-Meta.class';
|
|
68
|
-
export { A_MetaDecorator } from './global/A-Meta/A-Meta.decorator';
|
|
69
|
-
export * from './global/A-Meta/A-Meta.types';
|
|
70
|
-
|
|
71
|
-
export { A_Fragment } from './global/A-Fragment/A-Fragment.class';
|
|
72
|
-
export * from './global/A-Fragment/A-Fragment.types';
|
|
73
|
-
|
|
74
|
-
export { A_Dependency } from './global/A-Dependency/A-Dependency.class';
|
|
75
|
-
export { A_DependencyError } from './global/A-Dependency/A-Dependency.error';
|
|
76
|
-
export { A_Dependency_Require } from './global/A-Dependency/A-Dependency-Require.decorator';
|
|
77
|
-
export { A_Dependency_Load } from './global/A-Dependency/A-Dependency-Load.decorator';
|
|
78
|
-
export { A_Dependency_Default } from './global/A-Dependency/A-Dependency-Default.decorator';
|
|
79
|
-
export * from './global/A-Dependency/A-Dependency.types';
|
|
80
|
-
|
|
81
|
-
export { A_InjectError } from './global/A-Inject/A-Inject.error';
|
|
82
|
-
export { A_Inject } from './global/A-Inject/A-Inject.decorator';
|
|
83
|
-
export * from './global/A-Inject/A-Inject.types';
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
// =================================================================================================
|
|
87
|
-
// =============================== Export Helpers ================================================
|
|
88
|
-
// =================================================================================================
|
|
89
|
-
export { A_CommonHelper } from './helpers/A_Common.helper';
|
|
90
|
-
export { A_FormatterHelper } from './helpers/A_Formatter.helper';
|
|
91
|
-
export { A_IdentityHelper, A_ID_TYPES__TimeId_Parts } from './helpers/A_Identity.helper';
|
|
92
|
-
export { A_StepsManager } from './global/A-StepManager/A-StepManager.class';
|
|
93
|
-
export { A_StepManagerError } from './global/A-StepManager/A-StepManager.error';
|
|
94
|
-
export { A_TypeGuards } from './helpers/A_TypeGuards.helper';
|
|
95
1
|
|
|
2
|
+
export * from '@adaas/a-concept/a-abstraction';
|
|
3
|
+
export * from '@adaas/a-concept/a-component';
|
|
4
|
+
export * from '@adaas/a-concept/a-container';
|
|
5
|
+
export * from '@adaas/a-concept/a-concept';
|
|
6
|
+
export * from '@adaas/a-concept/a-context';
|
|
7
|
+
export * from '@adaas/a-concept/a-dependency';
|
|
8
|
+
export * from '@adaas/a-concept/a-entity';
|
|
9
|
+
export * from '@adaas/a-concept/a-error';
|
|
10
|
+
export * from '@adaas/a-concept/a-inject';
|
|
11
|
+
export * from '@adaas/a-concept/a-meta';
|
|
12
|
+
export * from '@adaas/a-concept/env';
|
|
13
|
+
export * from '@adaas/a-concept/helpers/index';
|
|
14
|
+
export * from '@adaas/a-concept/types';
|
|
15
|
+
export * from '@adaas/a-concept/a-scope';
|
|
16
|
+
export * from '@adaas/a-concept/a-caller';
|
|
17
|
+
export * from '@adaas/a-concept/a-feature';
|
|
18
|
+
export * from '@adaas/a-concept/a-fragment';
|
|
19
|
+
export * from '@adaas/a-concept/a-stage';
|
|
20
|
+
export * from '@adaas/a-concept/a-step-manager';
|
|
21
|
+
export * from '@adaas/a-concept/aseid';
|
|
22
|
+
export * from '@adaas/a-concept/constants/env.constants';
|
|
@@ -2,20 +2,25 @@ import {
|
|
|
2
2
|
A_TYPES__AbstractionDecoratorConfig,
|
|
3
3
|
A_TYPES__AbstractionDecoratorDescriptor
|
|
4
4
|
} from "./A-Abstraction.types";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
import {
|
|
13
|
-
|
|
14
|
-
|
|
5
|
+
import { A_Context } from "@adaas/a-concept/a-context";
|
|
6
|
+
import { A_Meta } from "@adaas/a-concept/a-meta";
|
|
7
|
+
import {
|
|
8
|
+
A_Container,
|
|
9
|
+
A_ContainerMeta,
|
|
10
|
+
A_TYPES__ContainerMetaKey
|
|
11
|
+
} from "@adaas/a-concept/a-container";
|
|
12
|
+
import {
|
|
13
|
+
A_Component,
|
|
14
|
+
A_TYPES__ComponentMetaKey,
|
|
15
|
+
A_ComponentMeta
|
|
16
|
+
} from "@adaas/a-concept/a-component";
|
|
17
|
+
import {
|
|
18
|
+
A_TYPES__ConceptAbstraction,
|
|
19
|
+
A_TYPES__ConceptAbstractions
|
|
20
|
+
} from "@adaas/a-concept/a-concept";
|
|
15
21
|
import { A_AbstractionError } from "./A-Abstraction.error";
|
|
16
|
-
import { A_TypeGuards
|
|
17
|
-
import { A_CommonHelper
|
|
18
|
-
|
|
22
|
+
import { A_TypeGuards} from "@adaas/a-concept/helpers/A_TypeGuards.helper";
|
|
23
|
+
import { A_CommonHelper} from "@adaas/a-concept/helpers/A_Common.helper";
|
|
19
24
|
|
|
20
25
|
/**
|
|
21
26
|
* A-Abstraction Extend decorator allows to extends behavior of each concept abstraction execution.
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { A_Abstraction_Extend } from "
|
|
2
|
-
import { A_Feature } from "
|
|
1
|
+
import { A_Abstraction_Extend } from "./A-Abstraction-Extend.decorator";
|
|
2
|
+
import { A_Feature } from "@adaas/a-concept/a-feature";
|
|
3
3
|
import { A_TYPES__Abstraction_Init } from "./A-Abstraction.types";
|
|
4
|
-
import { A_Scope } from "
|
|
5
|
-
import { A_Context } from "
|
|
6
|
-
import { A_TYPES__ConceptAbstractions } from "
|
|
4
|
+
import { A_Scope } from "@adaas/a-concept/a-scope";
|
|
5
|
+
import { A_Context } from "@adaas/a-concept/a-context";
|
|
6
|
+
import { A_TYPES__ConceptAbstractions } from "@adaas/a-concept/a-concept";
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { A_TYPES__Ctor } from "@adaas/a-concept/types
|
|
2
|
-
import { A_Component } from "
|
|
3
|
-
import { A_TYPES__ConceptAbstractions } from "
|
|
4
|
-
import { A_Container } from "
|
|
5
|
-
import { A_TYPES__FeatureExtendDecoratorConfig } from "
|
|
1
|
+
import { A_TYPES__Ctor } from "@adaas/a-concept/types";
|
|
2
|
+
import { A_Component } from "@adaas/a-concept/a-component";
|
|
3
|
+
import { A_TYPES__ConceptAbstractions } from "@adaas/a-concept/a-concept";
|
|
4
|
+
import { A_Container } from "@adaas/a-concept/a-container";
|
|
5
|
+
import { A_TYPES__FeatureExtendDecoratorConfig } from "@adaas/a-concept/a-feature";
|
|
6
6
|
import { A_Abstraction } from "./A-Abstraction.class";
|
|
7
7
|
|
|
8
8
|
|