@adaas/a-concept 0.2.9 → 0.2.11
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/browser/env.d.mts +23 -7
- package/dist/browser/env.mjs +1 -25
- package/dist/browser/env.mjs.map +1 -1
- package/dist/browser/index.mjs +66 -5529
- package/dist/browser/index.mjs.map +1 -1
- package/dist/node/env.d.mts +18 -2
- package/dist/node/env.d.ts +18 -2
- package/dist/node/env.js +5 -144
- package/dist/node/env.js.map +1 -1
- package/dist/node/env.mjs +1 -1
- package/dist/node/env.mjs.map +1 -1
- package/dist/node/index.js +383 -5635
- package/dist/node/index.js.map +1 -1
- package/dist/node/index.mjs +66 -5426
- package/dist/node/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/env/env-browser.ts +10 -1
- package/src/env/env-node.ts +12 -4
- package/src/env/env.base.ts +21 -1
- package/src/env/global.browser.d.ts +9 -2
- package/src/env/index.browser.ts +1 -1
- package/src/env/index.node.ts +1 -1
- package/src/global/A-Context/A-Context.class.ts +5 -5
- package/src/global/A-Error/A_Error.class.ts +2 -2
- package/tsup.config.ts +4 -0
- package/dist/browser/chunk-5ABP3TCO.mjs +0 -57
- package/dist/browser/chunk-5ABP3TCO.mjs.map +0 -1
- package/dist/browser/env.constants-CgDhS6pf.d.mts +0 -39
- package/dist/index.cjs +0 -3
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.mts +0 -4810
- package/dist/index.d.ts +0 -4810
- package/dist/index.mjs +0 -3
- package/dist/index.mjs.map +0 -1
- package/dist/node/chunk-HIVDZ2X6.mjs +0 -63
- package/dist/node/chunk-HIVDZ2X6.mjs.map +0 -1
- package/dist/node/chunk-LKQAYXTD.mjs +0 -161
- package/dist/node/chunk-LKQAYXTD.mjs.map +0 -1
- package/dist/node/env.constants-CgDhS6pf.d.mts +0 -39
- package/dist/node/env.constants-CgDhS6pf.d.ts +0 -39
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adaas/a-concept",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.11",
|
|
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
|
"main": "./dist/node/index.cjs",
|
package/src/env/env-browser.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { A_TYPES__ContextEnvironment } from "../global/A-Context/A-Context.types
|
|
|
2
2
|
import { A_CONCEPT_BASE_ENV } from "./env.base";
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
export class
|
|
5
|
+
export class A_CONCEPT_ENV extends A_CONCEPT_BASE_ENV {
|
|
6
6
|
static get A_CONCEPT_ENVIRONMENT() {
|
|
7
7
|
return window.__A_CONCEPT_ENVIRONMENT_ENV__?.A_CONCEPT_ENVIRONMENT || super.A_CONCEPT_ENVIRONMENT;
|
|
8
8
|
}
|
|
@@ -21,4 +21,13 @@ export class ENV extends A_CONCEPT_BASE_ENV {
|
|
|
21
21
|
static get A_ERROR_DEFAULT_DESCRIPTION() {
|
|
22
22
|
return window.__A_CONCEPT_ENVIRONMENT_ENV__?.A_ERROR_DEFAULT_DESCRIPTION || super.A_ERROR_DEFAULT_DESCRIPTION;
|
|
23
23
|
}
|
|
24
|
+
static get(name: string) {
|
|
25
|
+
return window.__A_CONCEPT_ENVIRONMENT_ENV__?.[name] || (this as typeof A_CONCEPT_ENV)[name as keyof typeof A_CONCEPT_ENV];
|
|
26
|
+
}
|
|
27
|
+
static set(name: string, value: string) {
|
|
28
|
+
if (!window.__A_CONCEPT_ENVIRONMENT_ENV__) {
|
|
29
|
+
window.__A_CONCEPT_ENVIRONMENT_ENV__ = {};
|
|
30
|
+
}
|
|
31
|
+
window.__A_CONCEPT_ENVIRONMENT_ENV__[name] = value;
|
|
32
|
+
}
|
|
24
33
|
};
|
package/src/env/env-node.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { A_CONSTANTS__DEFAULT_ENV_VARIABLES } from "../constants/env.constants";
|
|
|
2
2
|
import { A_TYPES__ContextEnvironment } from "../global/A-Context/A-Context.types";
|
|
3
3
|
import { A_CONCEPT_BASE_ENV } from "./env.base";
|
|
4
4
|
|
|
5
|
-
export class
|
|
5
|
+
export class A_CONCEPT_ENV extends A_CONCEPT_BASE_ENV {
|
|
6
6
|
// ----------------------------------------------------------
|
|
7
7
|
// A-Concept Core Environment Variables
|
|
8
8
|
// ----------------------------------------------------------
|
|
@@ -37,8 +37,8 @@ export class ENV extends A_CONCEPT_BASE_ENV {
|
|
|
37
37
|
/**
|
|
38
38
|
* Runtime environment of the application e.g. browser, node
|
|
39
39
|
*/
|
|
40
|
-
static get A_CONCEPT_RUNTIME_ENVIRONMENT():A_TYPES__ContextEnvironment {
|
|
41
|
-
return
|
|
40
|
+
static get A_CONCEPT_RUNTIME_ENVIRONMENT(): A_TYPES__ContextEnvironment {
|
|
41
|
+
return 'server';
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
/**
|
|
@@ -46,7 +46,7 @@ export class ENV extends A_CONCEPT_BASE_ENV {
|
|
|
46
46
|
* [!] Automatically set by A-Concept when the application starts
|
|
47
47
|
*/
|
|
48
48
|
static get A_CONCEPT_ROOT_FOLDER() {
|
|
49
|
-
return process.env[A_CONSTANTS__DEFAULT_ENV_VARIABLES.A_CONCEPT_ROOT_FOLDER] ||
|
|
49
|
+
return process.env[A_CONSTANTS__DEFAULT_ENV_VARIABLES.A_CONCEPT_ROOT_FOLDER] || process.cwd();
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
/**
|
|
@@ -55,4 +55,12 @@ export class ENV extends A_CONCEPT_BASE_ENV {
|
|
|
55
55
|
static get A_ERROR_DEFAULT_DESCRIPTION() {
|
|
56
56
|
return process.env[A_CONSTANTS__DEFAULT_ENV_VARIABLES.A_ERROR_DEFAULT_DESCRIPTION] || super.A_ERROR_DEFAULT_DESCRIPTION;
|
|
57
57
|
}
|
|
58
|
+
|
|
59
|
+
static get(name: string) {
|
|
60
|
+
return process.env[name] || (this as A_CONCEPT_ENV)[name as keyof typeof A_CONCEPT_ENV];
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
static set(name: string, value: string): void {
|
|
64
|
+
process.env[name] = value;
|
|
65
|
+
}
|
|
58
66
|
}
|
package/src/env/env.base.ts
CHANGED
|
@@ -35,7 +35,7 @@ export class A_CONCEPT_BASE_ENV {
|
|
|
35
35
|
/**
|
|
36
36
|
* Runtime environment of the application e.g. browser, node
|
|
37
37
|
*/
|
|
38
|
-
static get A_CONCEPT_RUNTIME_ENVIRONMENT():A_TYPES__ContextEnvironment {
|
|
38
|
+
static get A_CONCEPT_RUNTIME_ENVIRONMENT(): A_TYPES__ContextEnvironment {
|
|
39
39
|
return "unknown";
|
|
40
40
|
}
|
|
41
41
|
|
|
@@ -53,4 +53,24 @@ export class A_CONCEPT_BASE_ENV {
|
|
|
53
53
|
static get A_ERROR_DEFAULT_DESCRIPTION() {
|
|
54
54
|
return "If you see this error please let us know.";
|
|
55
55
|
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Generic getter for environment variables. This allows to access environment variables dynamically by name. It will return undefined if the variable does not exist.
|
|
59
|
+
*
|
|
60
|
+
* @param name
|
|
61
|
+
* @returns
|
|
62
|
+
*/
|
|
63
|
+
static get(name: string) {
|
|
64
|
+
return (this as any)[name];
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Generic setter for environment variables. This allows to set environment variables dynamically by name.
|
|
68
|
+
*
|
|
69
|
+
* @param name
|
|
70
|
+
* @param value
|
|
71
|
+
*/
|
|
72
|
+
static set(name: string, value: string) {
|
|
73
|
+
(this as any)[name] = value;
|
|
74
|
+
}
|
|
75
|
+
|
|
56
76
|
}
|
|
@@ -1,8 +1,15 @@
|
|
|
1
|
+
import { A_CONSTANTS__DEFAULT_ENV_VARIABLES, A_TYPES__ConceptENVVariables } from "../constants/env.constants";
|
|
1
2
|
import type { RuntimeEnv } from "./env.base";
|
|
2
3
|
|
|
4
|
+
|
|
5
|
+
type EnvVariablesType = {
|
|
6
|
+
[key in keyof typeof A_CONSTANTS__DEFAULT_ENV_VARIABLES]?: string;
|
|
7
|
+
}
|
|
8
|
+
|
|
3
9
|
declare global {
|
|
4
10
|
interface Window {
|
|
5
|
-
__A_CONCEPT_ENVIRONMENT_ENV__?:
|
|
6
|
-
|
|
11
|
+
__A_CONCEPT_ENVIRONMENT_ENV__?: {
|
|
12
|
+
[key: string]: string
|
|
13
|
+
} & EnvVariablesType
|
|
7
14
|
}
|
|
8
15
|
}
|
package/src/env/index.browser.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { A_CONCEPT_ENV } from "./env-browser";
|
package/src/env/index.node.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { A_CONCEPT_ENV } from "./env-node";
|
|
@@ -39,7 +39,7 @@ import { A_CommonHelper } from "@adaas/a-concept/helpers/A_Common.helper";
|
|
|
39
39
|
import { A_TYPES__Fragment_Constructor } from "../A-Fragment/A-Fragment.types";
|
|
40
40
|
import { A_Dependency } from "../A-Dependency/A-Dependency.class";
|
|
41
41
|
import { A_TYPES__Ctor } from "@adaas/a-concept/types/A_Common.types";
|
|
42
|
-
import {
|
|
42
|
+
import { A_CONCEPT_ENV } from "@adaas/a-concept/env";
|
|
43
43
|
|
|
44
44
|
|
|
45
45
|
|
|
@@ -53,7 +53,7 @@ export class A_Context {
|
|
|
53
53
|
* [!] If environment variable is not set, it will default to 'a-concept'
|
|
54
54
|
*/
|
|
55
55
|
static get concept() {
|
|
56
|
-
return
|
|
56
|
+
return A_CONCEPT_ENV.A_CONCEPT_NAME || 'a-concept';
|
|
57
57
|
}
|
|
58
58
|
/**
|
|
59
59
|
* Root scope of the application from environment variable A_CONCEPT_ROOT_SCOPE
|
|
@@ -69,7 +69,7 @@ export class A_Context {
|
|
|
69
69
|
* [!] Determined by environment variable A_CONCEPT_RUNTIME_ENVIRONMENT that comes from the build tool or is set manually in the environment.
|
|
70
70
|
*/
|
|
71
71
|
static get environment(): A_TYPES__ContextEnvironment {
|
|
72
|
-
return
|
|
72
|
+
return A_CONCEPT_ENV.A_CONCEPT_RUNTIME_ENVIRONMENT
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
/**
|
|
@@ -121,7 +121,7 @@ export class A_Context {
|
|
|
121
121
|
* [!] This class should not be instantiated directly. Use A_Context.getInstance() instead.
|
|
122
122
|
*/
|
|
123
123
|
private constructor() {
|
|
124
|
-
const name = String(
|
|
124
|
+
const name = String(A_CONCEPT_ENV.A_CONCEPT_ROOT_SCOPE) || 'root';
|
|
125
125
|
|
|
126
126
|
this._root = new A_Scope({ name });
|
|
127
127
|
}
|
|
@@ -1049,7 +1049,7 @@ export class A_Context {
|
|
|
1049
1049
|
|
|
1050
1050
|
instance._registry = new WeakMap();
|
|
1051
1051
|
|
|
1052
|
-
const name = String(
|
|
1052
|
+
const name = String(A_CONCEPT_ENV.A_CONCEPT_ROOT_SCOPE) || 'root';
|
|
1053
1053
|
|
|
1054
1054
|
instance._root = new A_Scope({ name });
|
|
1055
1055
|
}
|
|
@@ -10,7 +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 {
|
|
13
|
+
import { A_CONCEPT_ENV } from '@adaas/a-concept/env';
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
export class A_Error<
|
|
@@ -286,7 +286,7 @@ export class A_Error<
|
|
|
286
286
|
* [!] Note: This description is intended to provide more context about the error and can be used for debugging or logging purposes
|
|
287
287
|
*/
|
|
288
288
|
get description(): string {
|
|
289
|
-
return this._description || String(
|
|
289
|
+
return this._description || String(A_CONCEPT_ENV.A_ERROR_DEFAULT_DESCRIPTION) || A_CONSTANTS__ERROR_DESCRIPTION;
|
|
290
290
|
}
|
|
291
291
|
/**
|
|
292
292
|
* Returns the original error if any
|
package/tsup.config.ts
CHANGED
|
@@ -26,6 +26,8 @@ export default defineConfig([
|
|
|
26
26
|
// Output directory for browser bundle
|
|
27
27
|
outDir: "dist/browser",
|
|
28
28
|
|
|
29
|
+
bundle: false, // Bundle for browser consumption
|
|
30
|
+
|
|
29
31
|
// Browser consumers expect ESM
|
|
30
32
|
format: ["esm"],
|
|
31
33
|
|
|
@@ -77,6 +79,8 @@ export default defineConfig([
|
|
|
77
79
|
// Output directory for node bundle
|
|
78
80
|
outDir: "dist/node",
|
|
79
81
|
|
|
82
|
+
bundle: false, // Don't bundle node build, keep imports as-is
|
|
83
|
+
|
|
80
84
|
// Support both module systems
|
|
81
85
|
format: ["esm", "cjs"],
|
|
82
86
|
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
// src/env/env.base.ts
|
|
2
|
-
var A_CONCEPT_BASE_ENV = class {
|
|
3
|
-
// ----------------------------------------------------------
|
|
4
|
-
// A-Concept Core Environment Variables
|
|
5
|
-
// ----------------------------------------------------------
|
|
6
|
-
// These environment variables are used by A-Concept core to configure the application
|
|
7
|
-
// ----------------------------------------------------------
|
|
8
|
-
/**
|
|
9
|
-
* Name of the application
|
|
10
|
-
*
|
|
11
|
-
* DEFAULT value is 'a-concept'
|
|
12
|
-
*
|
|
13
|
-
* [!] Provided name will be used for all aseids in the application by default
|
|
14
|
-
*/
|
|
15
|
-
static get A_CONCEPT_NAME() {
|
|
16
|
-
return "a-concept";
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* Root scope of the application
|
|
20
|
-
*
|
|
21
|
-
* DEFAULT value is 'root'
|
|
22
|
-
*
|
|
23
|
-
* [!] Provided name will be used for all aseids in the application by default
|
|
24
|
-
*/
|
|
25
|
-
static get A_CONCEPT_ROOT_SCOPE() {
|
|
26
|
-
return "root";
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Environment of the application e.g. development, production, staging
|
|
30
|
-
*/
|
|
31
|
-
static get A_CONCEPT_ENVIRONMENT() {
|
|
32
|
-
return "production";
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Runtime environment of the application e.g. browser, node
|
|
36
|
-
*/
|
|
37
|
-
static get A_CONCEPT_RUNTIME_ENVIRONMENT() {
|
|
38
|
-
return "unknown";
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Root folder of the application
|
|
42
|
-
* [!] Automatically set by A-Concept when the application starts
|
|
43
|
-
*/
|
|
44
|
-
static get A_CONCEPT_ROOT_FOLDER() {
|
|
45
|
-
return "/app";
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* Allows to define a default error description for errors thrown without a description
|
|
49
|
-
*/
|
|
50
|
-
static get A_ERROR_DEFAULT_DESCRIPTION() {
|
|
51
|
-
return "If you see this error please let us know.";
|
|
52
|
-
}
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
export { A_CONCEPT_BASE_ENV };
|
|
56
|
-
//# sourceMappingURL=chunk-5ABP3TCO.mjs.map
|
|
57
|
-
//# sourceMappingURL=chunk-5ABP3TCO.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/env/env.base.ts"],"names":[],"mappings":";AAEO,IAAM,qBAAN,MAAyB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAa9B,WAAW,cAAA,GAAiB;AAC1B,IAAA,OAAO,WAAA;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,WAAW,oBAAA,GAAuB;AAChC,IAAA,OAAO,MAAA;AAAA,EACT;AAAA;AAAA;AAAA;AAAA,EAIA,WAAW,qBAAA,GAAwB;AACjC,IAAA,OAAO,YAAA;AAAA,EACT;AAAA;AAAA;AAAA;AAAA,EAIA,WAAW,6BAAA,GAA4D;AACrE,IAAA,OAAO,SAAA;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,WAAW,qBAAA,GAAwB;AACjC,IAAA,OAAO,MAAA;AAAA,EACT;AAAA;AAAA;AAAA;AAAA,EAKA,WAAW,2BAAA,GAA8B;AACvC,IAAA,OAAO,2CAAA;AAAA,EACT;AACF","file":"chunk-5ABP3TCO.mjs","sourcesContent":["import { A_TYPES__ContextEnvironment } from \"../global/A-Context/A-Context.types\";\n\nexport class A_CONCEPT_BASE_ENV {\n // ----------------------------------------------------------\n // A-Concept Core Environment Variables\n // ----------------------------------------------------------\n // These environment variables are used by A-Concept core to configure the application\n // ----------------------------------------------------------\n /**\n * Name of the application\n * \n * DEFAULT value is 'a-concept'\n * \n * [!] Provided name will be used for all aseids in the application by default\n */\n static get A_CONCEPT_NAME() {\n return \"a-concept\";\n }\n /**\n * Root scope of the application\n * \n * DEFAULT value is 'root'\n * \n * [!] Provided name will be used for all aseids in the application by default\n */\n static get A_CONCEPT_ROOT_SCOPE() {\n return \"root\";\n }\n /**\n * Environment of the application e.g. development, production, staging\n */\n static get A_CONCEPT_ENVIRONMENT() {\n return \"production\";\n }\n /**\n * Runtime environment of the application e.g. browser, node\n */\n static get A_CONCEPT_RUNTIME_ENVIRONMENT():A_TYPES__ContextEnvironment {\n return \"unknown\";\n }\n\n /**\n * Root folder of the application\n * [!] Automatically set by A-Concept when the application starts\n */\n static get A_CONCEPT_ROOT_FOLDER() {\n return \"/app\";\n }\n\n /**\n * Allows to define a default error description for errors thrown without a description\n */\n static get A_ERROR_DEFAULT_DESCRIPTION() {\n return \"If you see this error please let us know.\";\n }\n} \n"]}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
declare const A_CONSTANTS__DEFAULT_ENV_VARIABLES: {
|
|
2
|
-
/**
|
|
3
|
-
* Name of the application
|
|
4
|
-
*
|
|
5
|
-
* DEFAULT value is 'a-concept'
|
|
6
|
-
*
|
|
7
|
-
* [!] Provided name will be used for all aseids in the application by default
|
|
8
|
-
*/
|
|
9
|
-
readonly A_CONCEPT_NAME: "A_CONCEPT_NAME";
|
|
10
|
-
/**
|
|
11
|
-
* Root scope of the application
|
|
12
|
-
*
|
|
13
|
-
* DEFAULT value is 'root'
|
|
14
|
-
*
|
|
15
|
-
* [!] Provided name will be used for all aseids in the application by default
|
|
16
|
-
*/
|
|
17
|
-
readonly A_CONCEPT_ROOT_SCOPE: "A_CONCEPT_ROOT_SCOPE";
|
|
18
|
-
/**
|
|
19
|
-
* Environment of the application e.g. development, production, staging
|
|
20
|
-
*/
|
|
21
|
-
readonly A_CONCEPT_ENVIRONMENT: "A_CONCEPT_ENVIRONMENT";
|
|
22
|
-
/**
|
|
23
|
-
* Runtime environment of the application e.g. browser, node
|
|
24
|
-
*/
|
|
25
|
-
readonly A_CONCEPT_RUNTIME_ENVIRONMENT: "A_CONCEPT_RUNTIME_ENVIRONMENT";
|
|
26
|
-
/**
|
|
27
|
-
* Root folder of the application
|
|
28
|
-
* [!] Automatically set by A-Concept when the application starts
|
|
29
|
-
*/
|
|
30
|
-
readonly A_CONCEPT_ROOT_FOLDER: "A_CONCEPT_ROOT_FOLDER";
|
|
31
|
-
/**
|
|
32
|
-
* Allows to define a default error description for errors thrown without a description
|
|
33
|
-
*/
|
|
34
|
-
readonly A_ERROR_DEFAULT_DESCRIPTION: "A_ERROR_DEFAULT_DESCRIPTION";
|
|
35
|
-
};
|
|
36
|
-
type A_TYPES__ConceptENVVariables = (typeof A_CONSTANTS__DEFAULT_ENV_VARIABLES)[keyof typeof A_CONSTANTS__DEFAULT_ENV_VARIABLES][];
|
|
37
|
-
declare const A_CONSTANTS__DEFAULT_ENV_VARIABLES_ARRAY: readonly ["A_CONCEPT_NAME", "A_CONCEPT_ROOT_SCOPE", "A_CONCEPT_ENVIRONMENT", "A_CONCEPT_RUNTIME_ENVIRONMENT", "A_CONCEPT_ROOT_FOLDER", "A_ERROR_DEFAULT_DESCRIPTION"];
|
|
38
|
-
|
|
39
|
-
export { A_CONSTANTS__DEFAULT_ENV_VARIABLES as A, type A_TYPES__ConceptENVVariables as a, A_CONSTANTS__DEFAULT_ENV_VARIABLES_ARRAY as b };
|
package/dist/index.cjs
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
'use strict';var et=Object.defineProperty;var _=(c,e)=>et(c,"name",{value:e,configurable:true});var O={A_CONCEPT_NAME:"A_CONCEPT_NAME",A_CONCEPT_ROOT_SCOPE:"A_CONCEPT_ROOT_SCOPE",A_CONCEPT_ENVIRONMENT:"A_CONCEPT_ENVIRONMENT",A_CONCEPT_ROOT_FOLDER:"A_CONCEPT_ROOT_FOLDER",A_ERROR_DEFAULT_DESCRIPTION:"A_ERROR_DEFAULT_DESCRIPTION"},lt=[O.A_CONCEPT_NAME,O.A_CONCEPT_ROOT_SCOPE,O.A_CONCEPT_ENVIRONMENT,O.A_CONCEPT_ROOT_FOLDER,O.A_ERROR_DEFAULT_DESCRIPTION];var tt=(i=>(i.INITIALIZED="INITIALIZED",i.PROCESSING="PROCESSING",i.COMPLETED="COMPLETED",i.INTERRUPTED="INTERRUPTED",i.FAILED="FAILED",i))(tt||{});function Te(c){return function(e){return p.setMeta(e,new c),e}}_(Te,"A_MetaDecorator");var le=class le{constructor(){this.meta=new Map;}static Define(e){return Te(e)}[Symbol.iterator](){let e=this.meta.entries();return {next:_(()=>e.next(),"next")}}from(e){return this.meta=new Map(e.meta),this}set(e,t){let r=this.meta.get(e)||Array.isArray(t)?[]:t instanceof Map?new Map:{};this.meta.get(e)||Array.isArray(t)?[...r]:t instanceof Map?new Map(r):{...r};this.meta.set(e,t);}get(e){return this.meta.get(e)}delete(e){return this.meta.delete(e)}size(){return this.meta.size}convertToRegExp(e){return e instanceof RegExp?e:new RegExp(e)}find(e){let t=[];for(let[r,n]of this.meta.entries())this.convertToRegExp(String(r)).test(e)&&t.push([r,n]);return t}findByRegex(e){let t=[];for(let[r,n]of this.meta.entries())e.test(String(r))&&t.push([r,n]);return t}has(e){return this.meta.has(e)}entries(){return this.meta.entries()}clear(){this.meta.clear();}toArray(){return Array.from(this.meta.entries())}recursiveToJSON(e){switch(true){case e instanceof le:return e.toJSON();case e instanceof Map:let t={};for(let[n,i]of e.entries())t[String(n)]=this.recursiveToJSON(i);return t;case Array.isArray(e):return e.map(n=>this.recursiveToJSON(n));case(!!e&&typeof e=="object"):let r={};for(let[n,i]of Object.entries(e))r[n]=this.recursiveToJSON(i);return r;default:return e}}toJSON(){let e={};for(let[t,r]of this.meta.entries())e[String(t)]=this.recursiveToJSON(r);return e}};_(le,"A_Meta");var A=le;var rt=(n=>(n.EXTENSIONS="a-component-extensions",n.FEATURES="a-component-features",n.ABSTRACTIONS="a-component-abstractions",n.INJECTIONS="a-component-injections",n))(rt||{}),nt=(r=>(r.SAVE="save",r.DESTROY="destroy",r.LOAD="load",r))(nt||{});var ot=(n=>(n.FEATURES="a-container-features",n.INJECTIONS="a-container-injections",n.ABSTRACTIONS="a-container-abstractions",n.EXTENSIONS="a-container-extensions",n))(ot||{});var it=(n=>(n.EXTENSIONS="a-component-extensions",n.FEATURES="a-component-features",n.INJECTIONS="a-component-injections",n.ABSTRACTIONS="a-component-abstractions",n))(it||{});var Se=class Se extends A{injections(e){return this.get("a-component-injections")?.get(e)||[]}extensions(e){let t=[];return this.get("a-component-extensions")?.find(e).forEach(([n,i])=>{i.forEach(s=>{t.push({name:s.name,handler:s.handler,behavior:s.behavior,before:s.before||"",after:s.after||"",throwOnError:s.throwOnError||true,override:""});});}),t}features(){return this.get("a-component-features")?.toArray().map(([,t])=>t)||[]}abstractions(e){let t=[],r=this.get("a-component-abstractions"),n=this.get("a-component-injections");return r?.find(`CONCEPT_ABSTRACTION::${e}`).forEach(([i,s])=>{s.forEach(a=>{let u=n?.get(a.handler)||[];t.push({...a,args:u});});}),t}};_(Se,"A_ComponentMeta");var j=Se;var he=class he{get name(){return this.config?.name||this.constructor.name}get scope(){return p.scope(this)}constructor(e={}){this.config=e,p.allocate(this,this.config);}async call(e,t){return await new Y({name:e,component:this}).process(t)}};_(he,"A_Container");var z=he;var ye=class ye extends A{injections(e){return this.get("a-container-injections")?.get(e)||[]}features(){return this.get("a-container-features")?.toArray().map(([,t])=>t)||[]}abstractions(e){let t=[],r=this.get("a-container-abstractions"),n=this.get("a-container-injections");return r?.find(`CONCEPT_ABSTRACTION::${e}`).forEach(([i,s])=>{s.forEach(a=>{let u=n?.get(a.handler)||[];t.push({...a,args:u});});}),t}extensions(e){let t=[];return this.get("a-container-extensions")?.find(e).forEach(([n,i])=>{i.forEach(s=>{t.push({name:s.name,handler:s.handler,behavior:s.behavior,before:s.before||"",after:s.after||"",throwOnError:s.throwOnError||true,override:""});});}),t}};_(ye,"A_ContainerMeta");var K=ye;var ge=class ge{static toUpperSnakeCase(e){return e.trim().replace(/([a-z])([A-Z])/g,"$1_$2").replace(/[^a-zA-Z0-9]+/g,"_").replace(/_+/g,"_").replace(/^_|_$/g,"").toUpperCase()}static toCamelCase(e){return e.trim().replace(/[^a-zA-Z0-9]+/g," ").split(" ").filter(Boolean).map((t,r)=>r===0?t.toLowerCase():t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()).join("")}static toPascalCase(e){return e.trim().replace(/([a-z])([A-Z])/g,"$1 $2").replace(/[^a-zA-Z0-9]+/g," ").split(" ").filter(Boolean).map(t=>t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()).join("")}static toKebabCase(e){return e.replace(/[^a-zA-Z0-9]+/g," ").replace(/([a-z0-9])([A-Z])/g,"$1 $2").trim().replace(/\s+/g,"-").toLowerCase()}};_(ge,"A_FormatterHelper");var C=ge;var Ce=class Ce{static generateTimeId(e={timestamp:new Date,random:Math.random().toString(36).slice(2,8)}){let t=e.timestamp.getTime().toString(36),r=e.random;return `${t}-${r}`}static parseTimeId(e){let[t,r]=e.split("-");return {timestamp:new Date(parseInt(t,36)),random:r}}static formatWithLeadingZeros(e,t=10){return String(e).padStart(t+1,"0").slice(-t)}static removeLeadingZeros(e){return String(Number(e))}static hashString(e){let t=0,r,n;if(e.length===0)return t.toString();for(r=0;r<e.length;r++)n=e.charCodeAt(r),t=(t<<5)-t+n,t|=0;return t.toString()}};_(Ce,"A_IdentityHelper");var U=Ce;var ee={UNEXPECTED_ERROR:"A-Error Unexpected Error",VALIDATION_ERROR:"A-Error Validation Error"},He="If you see this error please let us know.";var $=class $ extends Error{static get entity(){return C.toKebabCase(this.name)}static get concept(){return p.concept}static get scope(){return p.root.name}constructor(e,t){switch(true){case e instanceof $:return e;case e instanceof Error:super(e.message);break;case o.isErrorSerializedType(e):super(e.message);break;case(o.isErrorConstructorType(e)&&"description"in e):super(`[${e.title}]: ${e.description}`);break;case(o.isErrorConstructorType(e)&&!("description"in e)):super(e.title);break;case(o.isString(e)&&!t):super(e);break;case(o.isString(e)&&!!t):super(`[${e}]: ${t}`);break;default:super("An unknown error occurred.");}this.getInitializer(e,t).call(this,e,t);}get aseid(){return this._aseid}get title(){return this._title}get message(){return super.message}get code(){return this._code||C.toKebabCase(this.title)}get type(){return this.constructor.entity}get link(){return this._link?this._link:new URL(`https://adaas.support/a-concept/errors/${this.aseid.toString()}`).toString()}get scope(){return this._aseid.scope}get description(){return this._description||process.env[O.A_ERROR_DEFAULT_DESCRIPTION]||He}get originalError(){return this._originalError}getInitializer(e,t){switch(true){case(o.isString(e)&&!t):return this.fromMessage;case(o.isString(e)&&!!t):return this.fromTitle;case e instanceof Error:return this.fromError;case o.isErrorSerializedType(e):return this.fromJSON;case o.isErrorConstructorType(e):return this.fromConstructor;default:throw new $(ee.VALIDATION_ERROR,"Invalid parameters provided to A_Error constructor")}}fromError(e){this._title=ee.UNEXPECTED_ERROR,this._aseid=new I({concept:this.constructor.concept,scope:this.constructor.scope,entity:this.constructor.entity,id:this.code}),this._originalError=e;}fromMessage(e){this._title=ee.UNEXPECTED_ERROR,this._aseid=new I({concept:this.constructor.concept,scope:this._scope||this.constructor.scope,entity:this.constructor.entity,id:this.code}),this._link=void 0,this._originalError=void 0;}fromJSON(e){this._aseid=new I(e.aseid),super.message=e.message,this._title=e.title,this._code=e.code,this._scope=e.scope,this._description=e.description,this._originalError=e.originalError?new $(e.originalError):void 0,this._link=e.link;}fromTitle(e,t){this.validateTitle(e),this._title=e,this._description=t,this._aseid=new I({concept:this.constructor.concept,scope:this._scope||this.constructor.scope,entity:this.constructor.entity,id:this.code}),this._link=void 0,this._originalError=void 0;}fromConstructor(e){if(this.validateTitle(e.title),this._title=e.title,this._code=e.code,this._scope=e.scope?o.isScopeInstance(e.scope)?e.scope.name:e.scope:void 0,this._aseid=new I({concept:this.constructor.concept,scope:this._scope||this.constructor.scope,entity:this.constructor.entity,id:this.code}),this._description=e.description,this._link=e.link,e.originalError instanceof $){let t=e.originalError;for(;t.originalError instanceof $;)t=t.originalError;this._originalError=t.originalError||t;}else this._originalError=e.originalError;}toJSON(){return {aseid:this.aseid.toString(),title:this.title,code:this.code,type:this.type,message:this.message,link:this.link,scope:this.scope,description:this.description,originalError:this.originalError?.message}}validateTitle(e){if(e.length>60)throw new $(ee.VALIDATION_ERROR,"A-Error title exceeds 60 characters limit.");if(e.length===0)throw new $(ee.VALIDATION_ERROR,"A-Error title cannot be empty.")}};_($,"A_Error");var E=$;var se=class se extends E{};_(se,"ASEID_Error"),se.ASEIDInitializationError="ASEID Initialization Error",se.ASEIDValidationError="ASEID Validation Error";var w=se;var N=class N{static isASEID(e){return this.regexp.test(e)}static compare(e,t){if(!e||!t)return false;if(o.isString(e)&&this.isASEID(e)===false)throw new w(w.ASEIDValidationError,`Invalid ASEID format provided: ${e}`);if(o.isString(t)&&this.isASEID(t)===false)throw new w(w.ASEIDValidationError,`Invalid ASEID format provided: ${t}`);let r=e instanceof N?e:new N(e),n=t instanceof N?t:new N(t);return r.toString()===n.toString()}constructor(e){this.verifyInput(e),this.getInitializer(e).call(this,e);}get concept(){return this._concept||p.concept}get scope(){return this._scope||p.root.name}get entity(){return this._entity}get id(){return this._id}get version(){return this._version}get shard(){return this._shard}get hash(){return U.hashString(this.toString())}getInitializer(e){switch(true){case o.isString(e):return this.fromString;case o.isObject(e):return this.fromObject;default:throw new w(w.ASEIDInitializationError,"Invalid parameters provided to ASEID constructor")}}fromString(e){let[t,r,n]=e.split("@"),[i,s,a]=r.split(":"),u=a.includes(".")?a.split(".")[0]:void 0,d=a.includes(".")?a.split(".")[1]:a;this._concept=t||p.root.name,this._scope=i||p.root.name,this._entity=s,this._id=d,this._version=n,this._shard=u;}fromObject(e){this._concept=e.concept?N.isASEID(e.concept)?new N(e.concept).id:e.concept:p.concept,this._scope=e.scope?o.isNumber(e.scope)?U.formatWithLeadingZeros(e.scope):N.isASEID(e.scope)?new N(e.scope).id:e.scope:p.root.name,this._entity=e.entity,this._id=o.isNumber(e.id)?U.formatWithLeadingZeros(e.id):e.id,this._version=e.version,this._shard=e.shard;}toString(){return `${this.concept}@${this.scope}:${this.entity}:${this.shard?this.shard+"."+this.id:this.id}${this.version?"@"+this.version:""}`}toJSON(){return {concept:this._concept,scope:this._scope,entity:this._entity,id:this._id,version:this._version,shard:this._shard}}verifyInput(e){switch(true){case(o.isString(e)&&!N.isASEID(e)):throw new w(w.ASEIDValidationError,"Invalid ASEID format provided");case(o.isObject(e)&&!e.id):throw new w(w.ASEIDValidationError,"ASEID id is required");case(o.isObject(e)&&!e.entity):throw new w(w.ASEIDValidationError,"ASEID entity is required")}}};_(N,"ASEID"),N.regexp=new RegExp("^[a-z|A-Z|0-9|-]+@[a-z|A-Z|0-9|-]+:[a-z|A-Z|0-9|-]+:[a-z|A-Z|0-9|\\.|-]+(@v[0-9|\\.]+|@lts)?$");var I=N;var ue=class ue extends E{};_(ue,"A_EntityError"),ue.ValidationError="A-Entity Validation Error";var te=ue;var Pe=class Pe{static get entity(){return C.toKebabCase(this.name)}static get concept(){return p.concept}static get scope(){return p.root.name}constructor(e){this.getInitializer(e).call(this,e);}get id(){return this.aseid.id}isStringASEID(e){return typeof e=="string"&&I.isASEID(e)}isASEIDInstance(e){return e instanceof I}isSerializedObject(e){return !!e&&typeof e=="object"&&"aseid"in e}isConstructorProps(e){return !!e&&typeof e=="object"&&!("aseid"in e)}getInitializer(e){if(!e)return this.fromUndefined;if(this.isStringASEID(e))return this.fromASEID;if(this.isASEIDInstance(e))return this.fromASEID;if(this.isSerializedObject(e))return this.fromJSON;if(this.isConstructorProps(e))return this.fromNew;throw new te(te.ValidationError,"Unable to determine A-Entity constructor initialization method. Please check the provided parameters.")}generateASEID(e){return new I({concept:e?.concept||this.constructor.concept,scope:e?.scope||this.constructor.scope,entity:e?.entity||this.constructor.entity,id:e?.id||U.generateTimeId()})}async call(e,t){return await new Y({name:e,component:this,scope:t}).process(t)}async load(e){return this.call("load",e)}async destroy(e){return this.call("destroy",e)}async save(e){return this.call("save",e)}fromASEID(e){e instanceof I?this.aseid=e:this.aseid=new I(e);}fromUndefined(){this.aseid=this.generateASEID();}fromNew(e){this.aseid=this.generateASEID();}fromJSON(e){this.aseid=new I(e.aseid);}toJSON(){return {aseid:this.aseid.toString()}}toString(){return this.aseid?this.aseid.toString():this.constructor.name}};_(Pe,"A_Entity");var k=Pe;var Ie=class Ie extends A{features(){return this.get("a-component-features")?.toArray().map(([,t])=>t)||[]}injections(e){return this.get("a-component-injections")?.get(e)||[]}};_(Ie,"A_EntityMeta");var q=Ie;var be=class be{constructor(e={}){this._name=e.name||this.constructor.name;}get name(){return this._name}toJSON(){return {name:this.name}}};_(be,"A_Fragment");var J=be;var Ye=class Ye{static resolve(){return new Promise(e=>e())}static isInheritedFrom(e,t){let r=e;for(;r;){if(r===t)return true;r=Object.getPrototypeOf(r);}return false}static getParentClasses(e){let t=Object.getPrototypeOf(typeof e=="function"?e:e.constructor),r=[];for(;t&&t!==Function.prototype;)r.push(t),t=Object.getPrototypeOf(t);return r}static getClassInheritanceChain(e){let t=Object.getPrototypeOf(typeof e=="function"?e:e.constructor),r=typeof e=="function"?[e]:[e.constructor];for(;t&&t!==Function.prototype;)r.push(t),t=Object.getPrototypeOf(t);return r}static getParentClass(e){return Object.getPrototypeOf(e)}static omitProperties(e,t){let r=JSON.parse(JSON.stringify(e));function n(i,s){let a=s[0];s.length===1?delete i[a]:i[a]!==void 0&&typeof i[a]=="object"&&n(i[a],s.slice(1));}return _(n,"removeProperties"),t.forEach(i=>{let s=i.split(".");n(r,s);}),r}static isObject(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}static deepMerge(e,t,r=new Map){if(this.isObject(e)&&this.isObject(t))for(let n in t)this.isObject(t[n])?(e[n]||(e[n]={}),r.has(t[n])?e[n]=r.get(t[n]):(r.set(t[n],{}),this.deepMerge(e[n],t[n],r))):e[n]=t[n];return e}static deepClone(e){if(e==null||typeof e!="object")return e;if(e instanceof Date)return new Date(e.getTime());if(Array.isArray(e))return e.map(t=>this.deepClone(t));if(typeof e=="function")return e;if(e instanceof Object){let t={};for(let r in e)e.hasOwnProperty(r)&&(t[r]=this.deepClone(e[r]));return t}throw new Error("Unable to clone the object. Unsupported type.")}static deepCloneAndMerge(e,t){if(t==null&&e==null)return e;if(e==null&&t)return this.deepClone(t);if(typeof e!="object")return e;if(e instanceof Date)return new Date(e.getTime());if(Array.isArray(e))return e.map(r=>this.deepCloneAndMerge(r,t));if(typeof e=="function")return e;if(e instanceof Object){let r={};for(let n in e)t[n]!==null&&t[n]!==void 0?r[n]=this.deepCloneAndMerge(e[n],t[n]):r[n]=this.deepClone(e[n]);for(let n in t)e[n]!==void 0&&e[n]!==null?r[n]=this.deepCloneAndMerge(e[n],t[n]):r[n]=this.deepClone(t[n]);return r}throw new Error("Unable to clone the object. Unsupported type.")}static getComponentName(e){let t="Unknown",r="Anonymous";if(e==null)return t;if(typeof e=="string")return e||t;if(typeof e=="symbol")try{return e.toString()}catch{return t}if(Array.isArray(e))return e.length===0?t:this.getComponentName(e[0]);if(typeof e=="function"){let n=e;if(n.displayName)return String(n.displayName);if(n.name)return String(n.name);if(n.constructor&&n.constructor.name)return String(n.constructor.name);try{let s=Function.prototype.toString.call(e).match(/^(?:class\s+([A-Za-z0-9_$]+)|function\s+([A-Za-z0-9_$]+)|([A-Za-z0-9_$]+)\s*=>)/);if(s)return s[1]||s[2]||s[3]||r}catch{}return r}if(typeof e=="object"){let n=e;if(n.type)return this.getComponentName(n.type);if(n.displayName)return String(n.displayName);if(n.name)return String(n.name);if(n.constructor&&n.constructor.name&&n.constructor.name!=="Object")return String(n.constructor.name);try{let i=n.toString();if(typeof i=="string"&&i!=="[object Object]")return i}catch{}return r}try{return String(e)}catch{return t}}};_(Ye,"A_CommonHelper");var m=Ye;var L=class L extends E{};_(L,"A_ScopeError"),L.InitializationError="A-Scope Initialization Error",L.ConstructorError="Unable to construct A-Scope instance",L.ResolutionError="A-Scope Resolution Error",L.RegistrationError="A-Scope Registration Error",L.CircularInheritanceError="A-Scope Circular Inheritance Error",L.CircularImportError="A-Scope Circular Import Error",L.DeregistrationError="A-Scope Deregistration Error";var T=L;var B=class B extends E{};_(B,"A_DependencyError"),B.InvalidDependencyTarget="Invalid Dependency Target",B.InvalidLoadTarget="Invalid Load Target",B.InvalidLoadPath="Invalid Load Path",B.InvalidDefaultTarget="Invalid Default Target",B.ResolutionParametersError="Dependency Resolution Parameters Error";var y=B;function we(...c){return function(e,t,r){let n=m.getComponentName(e);if(!o.isTargetAvailableForInjection(e))throw new y(y.InvalidDefaultTarget,`A-Default cannot be used on the target of type ${typeof e} (${n})`);let i=t?String(t):"constructor",s;switch(true){case(o.isComponentConstructor(e)||o.isComponentInstance(e)):s="a-component-injections";break;case o.isContainerInstance(e):s="a-container-injections";break;case o.isEntityInstance(e):s="a-component-injections";break}let a=p.meta(e).get(s)||new A,u=a.get(i)||[];u[r].resolutionStrategy={create:true,args:c},a.set(i,u),p.meta(e).set(s,a);}}_(we,"A_Dependency_Default");function Ze(){return function(c,e,t){let r=m.getComponentName(c);if(!o.isTargetAvailableForInjection(c))throw new y(y.InvalidDependencyTarget,`A-Dependency cannot be used on the target of type ${typeof c} (${r})`);let n=e?String(e):"constructor",i;switch(true){case(o.isComponentConstructor(c)||o.isComponentInstance(c)):i="a-component-injections";break;case o.isContainerInstance(c):i="a-container-injections";break;case o.isEntityInstance(c):i="a-component-injections";break}let s=p.meta(c).get(i)||new A,a=s.get(n)||[];a[t].resolutionStrategy={flat:true},s.set(n,a),p.meta(c).set(i,s);}}_(Ze,"A_Dependency_Flat");function xe(){return function(c,e,t){let r=m.getComponentName(c);if(!o.isTargetAvailableForInjection(c))throw new y(y.InvalidLoadTarget,`A-Load cannot be used on the target of type ${typeof c} (${r})`);let n=e?String(e):"constructor",i;switch(true){case(o.isComponentConstructor(c)||o.isComponentInstance(c)):i="a-component-injections";break;case o.isContainerInstance(c):i="a-container-injections";break;case o.isEntityInstance(c):i="a-component-injections";break}let s=p.meta(c).get(i)||new A,a=s.get(n)||[];a[t].resolutionStrategy={load:true},s.set(n,a),p.meta(c).set(i,s);}}_(xe,"A_Dependency_Load");function We(c=-1){return function(e,t,r){let n=m.getComponentName(e);if(!o.isTargetAvailableForInjection(e))throw new y(y.InvalidDependencyTarget,`A-Dependency cannot be used on the target of type ${typeof e} (${n})`);let i=t?String(t):"constructor",s;switch(true){case(o.isComponentConstructor(e)||o.isComponentInstance(e)):s="a-component-injections";break;case o.isContainerInstance(e):s="a-container-injections";break;case o.isEntityInstance(e):s="a-component-injections";break}let a=p.meta(e).get(s)||new A,u=a.get(i)||[];u[r].resolutionStrategy={parent:c},a.set(i,u),p.meta(e).set(s,a);}}_(We,"A_Dependency_Parent");function Fe(){return function(c,e,t){let r=m.getComponentName(c);if(!o.isTargetAvailableForInjection(c))throw new y(y.InvalidDependencyTarget,`A-Dependency cannot be used on the target of type ${typeof c} (${r})`);let n=e?String(e):"constructor",i;switch(true){case(o.isComponentConstructor(c)||o.isComponentInstance(c)):i="a-component-injections";break;case o.isContainerInstance(c):i="a-container-injections";break;case o.isEntityInstance(c):i="a-component-injections";break}let s=p.meta(c).get(i)||new A,a=s.get(n)||[];a[t].resolutionStrategy={require:true},s.set(n,a),p.meta(c).set(i,s);}}_(Fe,"A_Dependency_Require");function Xe(){return function(c,e,t){let r=m.getComponentName(c);if(!o.isTargetAvailableForInjection(c))throw new y(y.InvalidDependencyTarget,`A-All cannot be used on the target of type ${typeof c} (${r})`);let n=e?String(e):"constructor",i;switch(true){case(o.isComponentConstructor(c)||o.isComponentInstance(c)):i="a-component-injections";break;case o.isContainerInstance(c):i="a-container-injections";break;case o.isEntityInstance(c):i="a-component-injections";break}let s=p.meta(c).get(i)||new A,a=s.get(n)||[];a[t].resolutionStrategy={pagination:{...a[t].resolutionStrategy.pagination,count:-1}},s.set(n,a),p.meta(c).set(i,s);}}_(Xe,"A_Dependency_All");var De=class De{constructor(e,t){this._defaultPagination={count:1,from:"start"};this._defaultResolutionStrategy={require:false,load:false,parent:0,flat:false,create:false,args:[],query:{},pagination:this._defaultPagination};this._name=typeof e=="string"?e:m.getComponentName(e),this._target=typeof e=="string"?void 0:e,this.resolutionStrategy=t||{},this.initCheck();}static get Required(){return Fe}static get Loaded(){return xe}static get Default(){return we}static get Parent(){return We}static get Flat(){return Ze}static get All(){return Xe}get flat(){return this._resolutionStrategy.flat}get require(){return this._resolutionStrategy.require}get load(){return this._resolutionStrategy.load}get all(){return this._resolutionStrategy.pagination.count!==1||Object.keys(this._resolutionStrategy.query).length>0}get parent(){return this._resolutionStrategy.parent}get create(){return this._resolutionStrategy.create}get args(){return this._resolutionStrategy.args}get query(){return this._resolutionStrategy.query}get pagination(){return this._resolutionStrategy.pagination}get name(){return this._name}get target(){return this._target}get resolutionStrategy(){return this._resolutionStrategy}set resolutionStrategy(e){this._resolutionStrategy={...this._defaultResolutionStrategy,...this._resolutionStrategy,...e,pagination:{...this._defaultPagination,...(this._resolutionStrategy||{}).pagination,...e.pagination||{}}};}initCheck(){if(!this._resolutionStrategy)throw new y(y.ResolutionParametersError,`Resolution strategy parameters are not provided for dependency: ${this._name}`);return this}toJSON(){return {name:this._name,all:this.all,require:this.require,load:this.load,parent:this.parent,flat:this.flat,create:this.create,args:this.args,query:this.query,pagination:this.pagination}}};_(De,"A_Dependency");var D=De;var ve=class ve{constructor(e,t){this._meta=new A;this._allowedComponents=new Set;this._allowedErrors=new Set;this._allowedEntities=new Set;this._allowedFragments=new Set;this._components=new Map;this._errors=new Map;this._entities=new Map;this._fragments=new Map;this._imports=new Set;this.getInitializer(e).call(this,e,t);}get name(){return this._name}get meta(){return this._meta}get allowedComponents(){return this._allowedComponents}get allowedEntities(){return this._allowedEntities}get allowedFragments(){return this._allowedFragments}get allowedErrors(){return this._allowedErrors}get entities(){return Array.from(this._entities.values())}get fragments(){return Array.from(this._fragments.values())}get components(){return Array.from(this._components.values())}get errors(){return Array.from(this._errors.values())}get imports(){return Array.from(this._imports.values())}get parent(){return this._parent}*parents(){let e=this._parent;for(;e;)yield e,e=e._parent;}parentOffset(e){let t=this;for(;e<=-1&&t;)t=t.parent,e++;return t}getInitializer(e,t){switch(true){case(!e&&!t):return this.defaultInitialized;case !!e:return this.defaultInitialized;default:throw new T(T.ConstructorError,"Invalid parameters provided to A_Scope constructor")}}defaultInitialized(e={},t={}){this._name=e.name||this.constructor.name,this.initComponents(e.components),this.initErrors(e.errors),this.initFragments(e.fragments),this.initEntities(e.entities),this.initMeta(e.meta),t.parent&&(this._parent=t.parent);}initComponents(e){e?.forEach(this.register.bind(this));}initErrors(e){e?.forEach(this.register.bind(this));}initEntities(e){e?.forEach(t=>this.register(t));}initFragments(e){e?.forEach(this.register.bind(this));}initMeta(e){e&&Object.entries(e).forEach(([t,r])=>{this._meta.set(t,r);});}destroy(){this._components.forEach(e=>p.deregister(e)),this._fragments.forEach(e=>p.deregister(e)),this._entities.forEach(e=>p.deregister(e)),this._components.clear(),this._errors.clear(),this._fragments.clear(),this._entities.clear(),this._imports.clear(),this.issuer()&&p.deallocate(this);}get(e){return this._meta.get(e)}set(e,t){this._meta.set(e,t);}issuer(){return p.issuer(this)}inherit(e){if(!e)throw new T(T.InitializationError,"Invalid parent scope provided");if(e===this)throw new T(T.CircularInheritanceError,`Unable to inherit scope ${this.name} from itself`);if(e===this._parent)return this;let t=this.checkCircularInheritance(e);if(t)throw new T(T.CircularInheritanceError,`Circular inheritance detected: ${[...t,e.name].join(" -> ")}`);return this._parent=e,this}import(...e){return e.forEach(t=>{if(t===this)throw new T(T.CircularImportError,`Unable to import scope ${this.name} into itself`);this._imports.has(t)||this._imports.add(t);}),this}deimport(...e){return e.forEach(t=>{this._imports.has(t)&&this._imports.delete(t);}),this}has(e){let t=this.hasFlat(e);if(!t&&this._parent)try{return this._parent.has(e)}catch{return false}return t}hasFlat(e){let t=false;switch(true){case o.isScopeConstructor(e):return true;case o.isString(e):{Array.from(this.allowedComponents).find(a=>a.name===e)&&(t=true),Array.from(this.allowedFragments).find(a=>a.name===e)&&(t=true),Array.from(this.allowedEntities).find(a=>a.name===e)&&(t=true),Array.from(this.allowedErrors).find(a=>a.name===e)&&(t=true);break}case o.isComponentConstructor(e):{t=this.isAllowedComponent(e)||!![...this.allowedComponents].find(r=>m.isInheritedFrom(r,e));break}case o.isEntityConstructor(e):{t=this.isAllowedEntity(e)||!![...this.allowedEntities].find(r=>m.isInheritedFrom(r,e));break}case o.isFragmentConstructor(e):{t=this.isAllowedFragment(e)||!![...this.allowedFragments].find(r=>m.isInheritedFrom(r,e));break}case o.isErrorConstructor(e):{t=this.isAllowedError(e)||!![...this.allowedErrors].find(r=>m.isInheritedFrom(r,e));break}case(this.issuer()&&(this.issuer().constructor===e||m.isInheritedFrom(this.issuer().constructor,e))):{t=true;break}}return t}resolveDependency(e){let t=[],r=this.parentOffset(e.parent)||this;switch(true){case(e.flat&&!e.all):{let d=r.resolveFlatOnce(e.target||e.name);d&&(t=[d]);break}case(e.flat&&e.all):{t=r.resolveFlatAll(e.target||e.name);break}case(!e.flat&&!e.all):{let d=r.resolveOnce(e.target||e.name);d&&(t=[d]);break}case(!e.flat&&e.all):{t=r.resolveAll(e.target||e.name);break}default:t=[];}if(e.create&&!t.length&&o.isAllowedForDependencyDefaultCreation(e.target)){let d=new e.target(...e.args);r.register(d),t.push(d);}if(e.require&&!t.length)throw new T(T.ResolutionError,`Dependency ${e.name} is required but could not be resolved in scope ${r.name}`);e.query.aseid?t=t.filter(d=>o.hasASEID(d)&&I.compare(d.aseid,e.query.aseid)):Object.keys(e.query).length>0&&(t=t.filter(d=>{let h=e.query;return h?Object.entries(h).every(([g,F])=>d[g]===F):true}));let n=e.pagination.count,i=e.pagination.from,s=i==="end"?n===-1?0:Math.max(t.length-n,0):0,a=i==="end"||n===-1?t.length:Math.min(n,t.length),u=t.slice(s,a);return u.length===1&&n!==-1?u[0]:u.length?u:void 0}resolveConstructor(e){let t=Array.from(this.allowedComponents).find(i=>i.name===e||i.name===C.toPascalCase(e));if(t)return t;{let i=Array.from(this.allowedComponents).find(s=>{let a=s;for(;a;){if(a.name===e||a.name===C.toPascalCase(e))return true;a=Object.getPrototypeOf(a);}return false});if(i)return i}let r=Array.from(this.allowedEntities).find(i=>i.name===e||i.name===C.toPascalCase(e)||i.entity===e||i.entity===C.toKebabCase(e));if(r)return r;{let i=Array.from(this.allowedEntities).find(s=>m.isInheritedFrom(s,e));if(i)return i}let n=Array.from(this.allowedFragments).find(i=>i.name===e||i.name===C.toPascalCase(e));if(n)return n;{let i=Array.from(this.allowedFragments).find(s=>m.isInheritedFrom(s,e));if(i)return i}for(let i of this._imports){let s=i.resolveConstructor(e);if(s)return s}if(this._parent)return this._parent.resolveConstructor(e)}resolveAll(e){let t=new Set;this.resolveFlatAll(e).forEach(i=>t.add(i)),this._imports.forEach(i=>{i.has(e)&&i.resolveFlatAll(e).forEach(a=>t.add(a));});let n=this._parent;for(;n&&n.has(e);)n.resolveAll(e).forEach(s=>t.add(s)),n=n._parent;return Array.from(t)}resolveFlatAll(e){let t=[];switch(true){case o.isComponentConstructor(e):{this.allowedComponents.forEach(r=>{if(m.isInheritedFrom(r,e)){let n=this.resolveOnce(r);n&&t.push(n);}});break}case o.isFragmentConstructor(e):{this.allowedFragments.forEach(r=>{if(m.isInheritedFrom(r,e)){let n=this.resolveOnce(r);n&&t.push(n);}});break}case o.isEntityConstructor(e):{this.entities.forEach(r=>{m.isInheritedFrom(r.constructor,e)&&t.push(r);});break}case o.isString(e):{let r=this.resolveConstructor(e);if(!o.isComponentConstructor(r)&&!o.isEntityConstructor(r)&&!o.isFragmentConstructor(r))throw new T(T.ResolutionError,`Unable to resolve all instances for name: ${e} in scope ${this.name} as no matching component, entity or fragment constructor found`);if(r){let n=this.resolveAll(r);n&&t.push(...n);}break}default:throw new T(T.ResolutionError,`Invalid parameter provided to resolveAll method: ${e} in scope ${this.name}`)}return t}resolve(e){let t=o.isDependencyInstance(e)?e:new D(e);return this.resolveDependency(t)}resolveOnce(e){let t=this.resolveFlatOnce(e);if(!t){for(let r of this._imports)if(r.has(e)){let n=r.resolveFlatOnce(e);if(n)return n}}return !t&&this.parent?this.parent.resolveOnce(e):t}resolveFlat(e){return this.resolveFlatOnce(e)}resolveFlatOnce(e){let t,r=m.getComponentName(e);if(!(!e||!this.has(e))){switch(true){case o.isString(e):{t=this.resolveByName(e);break}case o.isConstructorAllowedForScopeAllocation(e):{t=this.resolveIssuer(e);break}case o.isScopeConstructor(e):{t=this.resolveScope(e);break}case o.isEntityConstructor(e):{t=this.resolveEntity(e);break}case o.isFragmentConstructor(e):{t=this.resolveFragment(e);break}case o.isComponentConstructor(e):{t=this.resolveComponent(e);break}case o.isErrorConstructor(e):{t=this.resolveError(e);break}default:throw new T(T.ResolutionError,`Injected Component ${r} not found in the scope`)}return t}}resolveByName(e){let t=Array.from(this.allowedComponents).find(s=>s.name===e||s.name===C.toPascalCase(e));if(t)return this.resolveOnce(t);let r=Array.from(this.allowedEntities).find(s=>s.name===e||s.name===C.toPascalCase(e)||s.entity===e||s.entity===C.toKebabCase(e));if(r)return this.resolveOnce(r);let n=Array.from(this.allowedFragments).find(s=>s.name===e||s.name===C.toPascalCase(e));if(n)return this.resolveOnce(n);let i=Array.from(this.allowedErrors).find(s=>s.name===e||s.name===C.toPascalCase(e)||s.code===e||s.code===C.toKebabCase(e));if(i)return this.resolveOnce(i)}resolveIssuer(e){let t=this.issuer();if(t&&(t.constructor===e||m.isInheritedFrom(t?.constructor,e)))return t}resolveEntity(e){return this.entities.find(t=>t instanceof e)}resolveError(e){return this.errors.find(t=>t instanceof e)}resolveFragment(e){let t=this._fragments.get(e);switch(true){case(t&&this._fragments.has(e)):return t;case(!t&&Array.from(this._allowedFragments).some(r=>m.isInheritedFrom(r,e))):{let r=Array.from(this._allowedFragments).find(n=>m.isInheritedFrom(n,e));return this.resolveFragment(r)}default:return}}resolveScope(e){return this}resolveComponent(e){switch(true){case(this.allowedComponents.has(e)&&this._components.has(e)):return this._components.get(e);case(this.allowedComponents.has(e)&&!this._components.has(e)):{let n=(p.meta(e).get("a-component-injections")?.get("constructor")||[]).map(s=>this.resolve(s)),i=new e(...n);return this.register(i),this._components.get(e)}case(!this.allowedComponents.has(e)&&Array.from(this.allowedComponents).some(t=>m.isInheritedFrom(t,e))):{let t=Array.from(this.allowedComponents).find(r=>m.isInheritedFrom(r,e));return this.resolveComponent(t)}default:return}}register(e){switch(true){case e instanceof M:{this.allowedComponents.has(e.constructor)||this.allowedComponents.add(e.constructor),this._components.set(e.constructor,e),p.register(this,e);break}case(o.isEntityInstance(e)&&!this._entities.has(e.aseid.toString())):{this.allowedEntities.has(e.constructor)||this.allowedEntities.add(e.constructor),this._entities.set(e.aseid.toString(),e),p.register(this,e);break}case o.isFragmentInstance(e):{this.allowedFragments.has(e.constructor)||this.allowedFragments.add(e.constructor),this._fragments.set(e.constructor,e),p.register(this,e);break}case o.isErrorInstance(e):{this.allowedErrors.has(e.constructor)||this.allowedErrors.add(e.constructor),this._errors.set(e.code,e),p.register(this,e);break}case o.isComponentConstructor(e):{this.allowedComponents.has(e)||this.allowedComponents.add(e);break}case o.isFragmentConstructor(e):{this.allowedFragments.has(e)||this.allowedFragments.add(e);break}case o.isEntityConstructor(e):{this.allowedEntities.has(e)||this.allowedEntities.add(e);break}case o.isErrorConstructor(e):{this.allowedErrors.has(e)||this.allowedErrors.add(e);break}default:if(e instanceof k)throw new T(T.RegistrationError,`Entity with ASEID ${e.aseid.toString()} is already registered in the scope ${this.name}`);if(e instanceof J)throw new T(T.RegistrationError,`Fragment ${e.constructor.name} is already registered in the scope ${this.name}`);{let t=m.getComponentName(e);throw new T(T.RegistrationError,`Cannot register ${t} in the scope ${this.name}`)}}}deregister(e){switch(true){case e instanceof M:{this._components.delete(e.constructor),p.deregister(e);let r=e.constructor;this._components.has(r)||this.allowedComponents.delete(r);break}case o.isEntityInstance(e):{this._entities.delete(e.aseid.toString()),p.deregister(e);let r=e.constructor;Array.from(this._entities.values()).some(i=>i instanceof r)||this.allowedEntities.delete(r);break}case o.isFragmentInstance(e):{this._fragments.delete(e.constructor),p.deregister(e);let r=e.constructor;Array.from(this._fragments.values()).some(i=>i instanceof r)||this.allowedFragments.delete(r);break}case o.isErrorInstance(e):{this._errors.delete(e.code),p.deregister(e);let r=e.constructor;Array.from(this._errors.values()).some(i=>i instanceof r)||this.allowedErrors.delete(r);break}case o.isComponentConstructor(e):{this.allowedComponents.delete(e);break}case o.isFragmentConstructor(e):{this.allowedFragments.delete(e),Array.from(this._fragments.entries()).forEach(([r,n])=>{m.isInheritedFrom(r,e)&&(this._fragments.delete(r),p.deregister(n));});break}case o.isEntityConstructor(e):{this.allowedEntities.delete(e),Array.from(this._entities.entries()).forEach(([r,n])=>{m.isInheritedFrom(n.constructor,e)&&(this._entities.delete(r),p.deregister(n));});break}case o.isErrorConstructor(e):{this.allowedErrors.delete(e),Array.from(this._errors.entries()).forEach(([r,n])=>{m.isInheritedFrom(n.constructor,e)&&(this._errors.delete(r),p.deregister(n));});break}default:let t=m.getComponentName(e);throw new T(T.DeregistrationError,`Cannot deregister ${t} from the scope ${this.name}`)}}toJSON(){return this.fragments.reduce((e,t)=>{let r=t.toJSON();return {...e,[r.name]:r}},{})}isAllowedComponent(e){return o.isComponentConstructor(e)&&this.allowedComponents.has(e)}isAllowedEntity(e){return o.isEntityConstructor(e)&&this.allowedEntities.has(e)}isAllowedFragment(e){return o.isFragmentConstructor(e)&&this.allowedFragments.has(e)}isAllowedError(e){return o.isErrorConstructor(e)&&this.allowedErrors.has(e)}isInheritedFrom(e){let t=this;for(;t;){if(t===e)return true;t=t._parent;}return false}checkCircularInheritance(e){let t=[],r=this._parent;for(;r;){if(t.push(r.name),r===e)return t;r=r._parent;}return false}printInheritanceChain(){let e=[],t=this;for(;t;)e.push(t.name),t=t._parent;console.log(e.join(" -> "));}};_(ve,"A_Scope");var v=ve;var de=class de extends E{};_(de,"A_CallerError"),de.CallerInitializationError="Unable to initialize A-Caller";var re=de;var Me=class Me{constructor(e){this.validateParams(e),this._component=e;}get component(){return this._component}validateParams(e){if(!o.isAllowedForFeatureCall(e))throw new re(re.CallerInitializationError,`Invalid A-Caller component provided of type: ${typeof e} with value: ${JSON.stringify(e).slice(0,100)}...`)}};_(Me,"A_Caller");var V=Me;var S=class S{static isString(e){return typeof e=="string"||e instanceof String}static isNumber(e){return typeof e=="number"&&isFinite(e)}static isBoolean(e){return typeof e=="boolean"}static isArray(e){return Array.isArray(e)}static isObject(e){return e&&typeof e=="object"&&!Array.isArray(e)}static isFunction(e){return typeof e=="function"}static isUndefined(e){return typeof e>"u"}static isRegExp(e){return e instanceof RegExp}static isContainerConstructor(e){return typeof e=="function"&&m.isInheritedFrom(e,z)}static isComponentConstructor(e){return typeof e=="function"&&m.isInheritedFrom(e,M)}static isFragmentConstructor(e){return typeof e=="function"&&m.isInheritedFrom(e,J)}static isEntityConstructor(e){return typeof e=="function"&&m.isInheritedFrom(e,k)}static isScopeConstructor(e){return typeof e=="function"&&m.isInheritedFrom(e,v)}static isErrorConstructor(e){return typeof e=="function"&&m.isInheritedFrom(e,E)}static isFeatureConstructor(e){return typeof e=="function"&&m.isInheritedFrom(e,Y)}static isCallerConstructor(e){return typeof e=="function"&&m.isInheritedFrom(e,V)}static isDependencyConstructor(e){return typeof e=="function"&&m.isInheritedFrom(e,D)}static isDependencyInstance(e){return e instanceof D}static isContainerInstance(e){return e instanceof z}static isComponentInstance(e){return e instanceof M}static isFeatureInstance(e){return e instanceof Y}static isFragmentInstance(e){return e instanceof J}static isEntityInstance(e){return e instanceof k}static isScopeInstance(e){return e instanceof v}static isErrorInstance(e){return e instanceof E}static isComponentMetaInstance(e){return e instanceof j}static isContainerMetaInstance(e){return e instanceof K}static isEntityMetaInstance(e){return e instanceof q}static hasASEID(e){return e&&typeof e=="object"&&"aseid"&&(S.isEntityInstance(e)||S.isErrorInstance(e))}static isConstructorAllowedForScopeAllocation(e){return S.isContainerConstructor(e)||S.isFeatureConstructor(e)}static isInstanceAllowedForScopeAllocation(e){return S.isContainerInstance(e)||S.isFeatureInstance(e)}static isConstructorAvailableForAbstraction(e){return S.isContainerInstance(e)||S.isComponentInstance(e)}static isTargetAvailableForInjection(e){return S.isComponentConstructor(e)||S.isComponentInstance(e)||S.isContainerInstance(e)||S.isEntityInstance(e)}static isAllowedForFeatureCall(e){return S.isContainerInstance(e)||S.isComponentInstance(e)||S.isEntityInstance(e)}static isAllowedForFeatureDefinition(e){return S.isContainerInstance(e)||S.isComponentInstance(e)||S.isEntityInstance(e)}static isAllowedForFeatureExtension(e){return S.isComponentInstance(e)||S.isContainerInstance(e)||S.isEntityInstance(e)}static isAllowedForAbstractionDefinition(e){return S.isContainerInstance(e)||S.isComponentInstance(e)}static isAllowedForDependencyDefaultCreation(e){return S.isFragmentConstructor(e)||m.isInheritedFrom(e,J)||S.isEntityConstructor(e)||m.isInheritedFrom(e,k)}static isErrorConstructorType(e){return !!e&&S.isObject(e)&&!(e instanceof Error)&&"title"in e}static isErrorSerializedType(e){return !!e&&S.isObject(e)&&!(e instanceof Error)&&"aseid"in e&&I.isASEID(e.aseid)}static isPromiseInstance(e){return e instanceof Promise}};_(S,"A_TypeGuards");var o=S;var G=class G extends E{fromConstructor(e){super.fromConstructor(e),this.stage=e.stage;}};_(G,"A_FeatureError"),G.Interruption="Feature Interrupted",G.FeatureInitializationError="Unable to initialize A-Feature",G.FeatureProcessingError="Error occurred during A-Feature processing",G.FeatureDefinitionError="Unable to define A-Feature",G.FeatureExtensionError="Unable to extend A-Feature";var f=G;function Oe(c={}){return function(e,t,r){let n=m.getComponentName(e);if(!o.isAllowedForFeatureDefinition(e))throw new f(f.FeatureDefinitionError,`A-Feature cannot be defined on the ${n} level`);let i=p.meta(e.constructor),s;switch(true){case o.isEntityInstance(e):s="a-component-features";break;case o.isContainerInstance(e):s="a-container-features";break;case o.isComponentInstance(e):s="a-component-features";break}let a=i.get(s)||new A,u=c.name||t,d=c.invoke||false;a.set(t,{name:`${e.constructor.name}.${u}`,handler:t,invoke:d,template:c.template&&c.template.length?c.template.map(g=>({...g,before:g.before||"",after:g.after||"",behavior:g.behavior||"sync",throwOnError:true,override:g.override||""})):[]}),p.meta(e.constructor).set(s,a);let h=r.value;return r.value=function(...g){if(d)h.apply(this,g);else return h.apply(this,g);if(typeof this.call=="function"&&d)return this.call(u)},r}}_(Oe,"A_Feature_Define");function Ne(c){return function(e,t,r){let n=m.getComponentName(e);if(!o.isAllowedForFeatureExtension(e))throw new f(f.FeatureExtensionError,`A-Feature-Extend cannot be applied on the ${n} level`);let i,s="sync",a="",u="",d="",h=[],g=[],F=true,R;switch(true){case o.isEntityInstance(e):R="a-component-extensions";break;case o.isContainerInstance(e):R="a-container-extensions";break;case o.isComponentInstance(e):R="a-component-extensions";break}switch(true){case o.isRegExp(c):i=c;break;case(!!c&&typeof c=="object"):Array.isArray(c.scope)?h=c.scope:c.scope&&typeof c.scope=="object"&&(Array.isArray(c.scope.include)&&(h=c.scope.include),Array.isArray(c.scope.exclude)&&(g=c.scope.exclude)),i=st(c,h,g,t),s=c.behavior||s,F=c.throwOnError!==void 0?c.throwOnError:F,a=o.isArray(c.before)?new RegExp(`^${c.before.join("|").replace(/\./g,"\\.")}$`).source:c.before instanceof RegExp?c.before.source:"",u=o.isArray(c.after)?new RegExp(`^${c.after.join("|").replace(/\./g,"\\.")}$`).source:c.after instanceof RegExp?c.after.source:"",d=o.isArray(c.override)?new RegExp(`^${c.override.join("|").replace(/\./g,"\\.")}$`).source:c.override instanceof RegExp?c.override.source:"";break;default:i=new RegExp(`^.*${t.replace(/\./g,"\\.")}$`);break}let X=p.meta(e).get(R),qe=p.meta(e),Q=qe.get(R)?new A().from(qe.get(R)):new A;if(X&&X.size()&&X.has(t)&&X.get(t).invoke)throw new f(f.FeatureExtensionError,`A-Feature-Extend cannot be used on the method "${t}" because it is already defined as a Feature with "invoke" set to true. Please remove the A-Feature-Extend decorator or set "invoke" to false in the A-Feature decorator.`);let pe=[...Q.get(i.source)||[]];for(let[ie,me]of Q.entries()){let Ge=me.findIndex(Qe=>Qe.handler===t);ie!==i.source&&Ge!==-1&&(me.splice(Ge,1),me.length===0?Q.delete(ie):Q.set(ie,me));}let Be=pe.findIndex(ie=>ie.handler===t),Ve={name:i.source,handler:t,behavior:s,before:a,after:u,throwOnError:F,override:d};Be!==-1?pe[Be]=Ve:pe.push(Ve),Q.set(i.source,pe),p.meta(e).set(R,Q);}}_(Ne,"A_Feature_Extend");function st(c,e,t,r){let n=e.length?`(${e.map(a=>a.name).join("|")})`:".*",i=t.length?`(?!${t.map(a=>a.name).join("|")})`:"",s=c.scope?`^${i}${n}\\.${c.name||r}$`:`.*\\.${c.name||r}$`;return new RegExp(s)}_(st,"buildTargetRegexp");var at=(s=>(s.PROCESSING="PROCESSING",s.COMPLETED="COMPLETED",s.FAILED="FAILED",s.SKIPPED="SKIPPED",s.INITIALIZED="INITIALIZED",s.ABORTED="ABORTED",s))(at||{});var Ae=class Ae extends E{static get CompileError(){return "Unable to compile A-Stage"}};_(Ae,"A_StageError"),Ae.ArgumentsResolutionError="A-Stage Arguments Resolution Error";var H=Ae;var Re=class Re{constructor(e,t){this._status="INITIALIZED";this._feature=e,this._definition=t;}get name(){return this.toString()}get definition(){return this._definition}get status(){return this._status}get feature(){return this._feature}get isProcessed(){return this._status==="COMPLETED"||this._status==="FAILED"||this._status==="SKIPPED"}get error(){return this._error}getStepArgs(e,t){let r=t.dependency.target||e.resolveConstructor(t.dependency.name);return p.meta(r).injections(t.handler).map(n=>{switch(true){case o.isCallerConstructor(n.target):return this._feature.caller.component;case o.isFeatureConstructor(n.target):return this._feature;default:return e.resolve(n)}})}getStepComponent(e,t){let{dependency:r,handler:n}=t,i=e.resolve(r)||this.feature.scope.resolve(r);if(!i)throw new H(H.CompileError,`Unable to resolve component ${r.name} from scope ${e.name}`);if(!i[n])throw new H(H.CompileError,`Handler ${n} not found in ${i.constructor.name}`);return i}callStepHandler(e,t){let r=this.getStepComponent(t,e),n=this.getStepArgs(t,e);return {handler:r[e.handler].bind(r),params:n}}skip(){this._status="SKIPPED";}process(e){let t=o.isScopeInstance(e)?e:this._feature.scope;if(!this.isProcessed){this._status="PROCESSING";let{handler:r,params:n}=this.callStepHandler(this._definition,t),i=r(...n);if(o.isPromiseInstance(i))return new Promise(async(s,a)=>{try{return await i,this.completed(),s()}catch(u){let d=new E(u);return this.failed(d),this._definition.throwOnError?s():a(d)}});this.completed();}}completed(){this._status="COMPLETED";}failed(e){this._error=new E(e),this._status="FAILED";}toJSON(){return {name:this.name,status:this.status}}toString(){return `A-Stage(${this._feature.name}::${this._definition.behavior}@${this._definition.handler})`}};_(Re,"A_Stage");var ae=Re;var fe=class fe extends E{};_(fe,"A_StepManagerError"),fe.CircularDependencyError="A-StepManager Circular Dependency Error";var ne=fe;var ke=class ke{constructor(e){this._isBuilt=false;this.entities=this.prepareSteps(e),this.graph=new Map,this.visited=new Set,this.tempMark=new Set,this.sortedEntities=[];}prepareSteps(e){return e.map(t=>({...t,behavior:t.behavior||"sync",before:t.before||"",after:t.after||"",override:t.override||"",throwOnError:false}))}ID(e){return `${e.dependency.name}.${e.handler}`}buildGraph(){this._isBuilt||(this._isBuilt=true,this.entities=this.entities.filter((e,t,r)=>!r.some(n=>n.override?new RegExp(n.override).test(this.ID(e)):false)),this.entities.forEach(e=>this.graph.set(this.ID(e),new Set)),this.entities.forEach(e=>{let t=this.ID(e);e.before&&this.matchEntities(t,e.before).forEach(n=>{this.graph.has(n)||this.graph.set(n,new Set),this.graph.get(n).add(t);}),e.after&&this.matchEntities(t,e.after).forEach(n=>{this.graph.has(t)||this.graph.set(t,new Set),this.graph.get(t).add(n);});}));}matchEntities(e,t){let r=new RegExp(t);return this.entities.filter(n=>r.test(this.ID(n))&&this.ID(n)!==e).map(n=>this.ID(n))}visit(e){this.tempMark.has(e)||this.visited.has(e)||(this.tempMark.add(e),(this.graph.get(e)||[]).forEach(t=>this.visit(t)),this.tempMark.delete(e),this.visited.add(e),this.sortedEntities.push(e));}toSortedArray(){return this.buildGraph(),this.entities.forEach(e=>{this.visited.has(this.ID(e))||this.visit(this.ID(e));}),this.sortedEntities}toStages(e){return this.toSortedArray().map(r=>{let n=this.entities.find(i=>this.ID(i)===r);return new ae(e,n)})}};_(ke,"A_StepsManager");var oe=ke;var _e=class _e{constructor(e){this._stages=[];this._index=0;this._state="INITIALIZED";this.validateParams(e),this.getInitializer(e).call(this,e);}static get Define(){return Oe}static get Extend(){return Ne}get name(){return this._name}get error(){return this._error}get state(){return this._state}get index(){return this._index}get stage(){return this._current}get caller(){return this._caller}get scope(){return p.scope(this)}get size(){return this._stages.length}get isDone(){return !this.stage||this._index>=this._stages.length}get isProcessed(){return this.state==="COMPLETED"||this.state==="FAILED"||this.state==="INTERRUPTED"}[Symbol.iterator](){return {next:_(()=>this.isDone?(this._current=void 0,{value:void 0,done:true}):(this._current=this._stages[this._index],this._index++,{value:this._current,done:false}),"next")}}validateParams(e){if(!e||typeof e!="object")throw new f(f.FeatureInitializationError,`Invalid A-Feature initialization parameters of type: ${typeof e} with value: ${JSON.stringify(e).slice(0,100)}...`)}getInitializer(e){switch(true){case !("template"in e):return this.fromComponent;case "template"in e:return this.fromTemplate;default:throw new f(f.FeatureInitializationError,`Invalid A-Feature initialization parameters of type: ${typeof e} with value: ${JSON.stringify(e).slice(0,100)}...`)}}fromTemplate(e){if(!e.template||!Array.isArray(e.template))throw new f(f.FeatureInitializationError,`Invalid A-Feature template provided of type: ${typeof e.template} with value: ${JSON.stringify(e.template).slice(0,100)}...`);if(!e.component&&(!e.scope||!(e.scope instanceof v)))throw new f(f.FeatureInitializationError,`Invalid A-Feature scope provided of type: ${typeof e.scope} with value: ${JSON.stringify(e.scope).slice(0,100)}...`);this._name=e.name;let t,r=e.scope;try{e.component&&(t=p.scope(e.component));}catch(i){if(!r)throw i}t&&r&&!r.isInheritedFrom(t)&&r.inherit(t),this._caller=new V(e.component||new M),p.allocate(this).inherit(t||r),this._SM=new oe(e.template),this._stages=this._SM.toStages(this),this._current=this._stages[0];}fromComponent(e){if(!e.component||!o.isAllowedForFeatureDefinition(e.component))throw new f(f.FeatureInitializationError,`Invalid A-Feature component provided of type: ${typeof e.component} with value: ${JSON.stringify(e.component).slice(0,100)}...`);this._name=e.name;let t,r=e.scope;try{t=p.scope(e.component);}catch(s){if(!r)throw s}t&&r&&!r.isInheritedFrom(t)&&r.inherit(t),this._caller=new V(e.component);let n=p.allocate(this);n.inherit(t||r);let i=p.featureTemplate(this._name,this._caller.component,n);this._SM=new oe(i),this._stages=this._SM.toStages(this),this._current=this._stages[0];}process(e){try{if(this.isProcessed)return;this._state="PROCESSING";let t=Array.from(this);return this.processStagesSequentially(t,e,0)}catch(t){throw this.failed(new f({title:f.FeatureProcessingError,description:`An error occurred while processing the A-Feature: ${this.name}. Failed at stage: ${this.stage?.name||"N/A"}.`,stage:this.stage,originalError:t}))}}processStagesSequentially(e,t,r){try{if(this.state==="INTERRUPTED")return;if(r>=e.length){this.completed();return}let n=e[r],i=n.process(t);return o.isPromiseInstance(i)?i.then(()=>{if(this.state!=="INTERRUPTED")return this.processStagesSequentially(e,t,r+1)}).catch(s=>{throw this.failed(new f({title:f.FeatureProcessingError,description:`An error occurred while processing the A-Feature: ${this.name}. Failed at stage: ${n.name}.`,stage:n,originalError:s}))}):this.processStagesSequentially(e,t,r+1)}catch(n){throw this.failed(new f({title:f.FeatureProcessingError,description:`An error occurred while processing the A-Feature: ${this.name}. Failed at stage: ${this.stage?.name||"N/A"}.`,stage:this.stage,originalError:n}))}}next(e){let t=this._stages.indexOf(e);this._index=t+1,this._index>=this._stages.length&&this.completed();}completed(){this.isProcessed||this.state!=="INTERRUPTED"&&(this._state="COMPLETED",this.scope.destroy());}failed(e){return this.isProcessed?this._error:(this._state="FAILED",this._error=e,this.scope.destroy(),this._error)}interrupt(e){if(this.isProcessed)return this._error;switch(this._state="INTERRUPTED",true){case o.isString(e):this._error=new f(f.Interruption,e);break;case o.isErrorInstance(e):this._error=new f({code:f.Interruption,title:e.title||"Feature Interrupted",description:e.description||e.message,stage:this.stage,originalError:e});break;default:this._error=new f(f.Interruption,"Feature was interrupted");break}return this.scope.destroy(),this._error}chain(e,t,r){let n,i;e instanceof _e?(n=e,i=t instanceof v?t:void 0):(n=new _e({name:t,component:e}),i=r instanceof v?r:void 0);let s=i||this.scope;n._caller=this._caller;let a=n.process(s);return o.isPromiseInstance(a)?a.catch(u=>{throw u}):a}toString(){return `A-Feature(${this.caller.component?.constructor?.name||"Unknown"}::${this.name})`}};_(_e,"A_Feature");var Y=_e;var je=class je{call(e,t){return new Y({name:e,component:this}).process(t)}};_(je,"A_Component");var M=je;var P=class P extends E{};_(P,"A_ContextError"),P.NotAllowedForScopeAllocationError="Component is not allowed for scope allocation",P.ComponentAlreadyHasScopeAllocatedError="Component already has scope allocated",P.InvalidMetaParameterError="Invalid parameter provided to get meta",P.InvalidScopeParameterError="Invalid parameter provided to get scope",P.ScopeNotFoundError="Scope not found",P.InvalidFeatureParameterError="Invalid parameter provided to get feature",P.InvalidFeatureDefinitionParameterError="Invalid parameter provided to define feature",P.InvalidFeatureTemplateParameterError="Invalid parameter provided to get feature template",P.InvalidFeatureExtensionParameterError="Invalid parameter provided to extend feature",P.InvalidAbstractionParameterError="Invalid parameter provided to get abstraction",P.InvalidAbstractionDefinitionParameterError="Invalid parameter provided to define abstraction",P.InvalidAbstractionTemplateParameterError="Invalid parameter provided to get abstraction template",P.InvalidAbstractionExtensionParameterError="Invalid parameter provided to extend abstraction",P.InvalidInjectionParameterError="Invalid parameter provided to get injections",P.InvalidExtensionParameterError="Invalid parameter provided to get extensions",P.InvalidRegisterParameterError="Invalid parameter provided to register component",P.InvalidComponentParameterError="Invalid component provided",P.ComponentNotRegisteredError="Component not registered in the context",P.InvalidDeregisterParameterError="Invalid parameter provided to deregister component";var l=P;var x=class x{constructor(){this._registry=new WeakMap;this._scopeIssuers=new WeakMap;this._scopeStorage=new WeakMap;this._metaStorage=new Map;this._globals=new Map;let e="root";x.environment==="server"&&(e=process.env[O.A_CONCEPT_ROOT_SCOPE]||"root"),x.environment==="browser"&&(e=window[O.A_CONCEPT_ROOT_SCOPE]||"root"),this._root=new v({name:e});}static get concept(){return process.env[O.A_CONCEPT_NAME]||"a-concept"}static get root(){return this.getInstance()._root}static get environment(){let e="browser";try{e=window.location?"browser":"server";}catch{e="server";}return e}static getInstance(){return x._instance||(x._instance=new x),x._instance}static register(e,t){let r=m.getComponentName(t),n=this.getInstance();if(!t)throw new l(l.InvalidRegisterParameterError,"Unable to register component. Component cannot be null or undefined.");if(!e)throw new l(l.InvalidRegisterParameterError,"Unable to register component. Scope cannot be null or undefined.");if(!this.isAllowedToBeRegistered(t))throw new l(l.NotAllowedForScopeAllocationError,`Component ${r} is not allowed for scope allocation.`);return n._scopeStorage.set(t,e),e}static deregister(e){let t=m.getComponentName(e),r=this.getInstance();if(!e)throw new l(l.InvalidDeregisterParameterError,"Unable to deregister component. Component cannot be null or undefined.");if(!r._scopeStorage.has(e))throw new l(l.ComponentNotRegisteredError,`Unable to deregister component. Component ${t} is not registered.`);r._scopeStorage.delete(e);}static allocate(e,t){let r=m.getComponentName(e);if(!this.isAllowedForScopeAllocation(e))throw new l(l.NotAllowedForScopeAllocationError,`Component of type ${r} is not allowed for scope allocation. Only A_Container, A_Feature are allowed.`);let n=this.getInstance();if(n._registry.has(e))throw new l(l.ComponentAlreadyHasScopeAllocatedError,`Component ${r} already has a scope allocated.`);let i=o.isScopeInstance(t)?t:new v(t||{name:r+"-scope"},t);return i.isInheritedFrom(x.root)||i.inherit(x.root),n._registry.set(e,i),n._scopeIssuers.set(i,e),i}static deallocate(e){let t=this.getInstance(),r=o.isScopeInstance(e)?e:t._registry.get(e);if(!r)return;let n=o.isComponentInstance(e)?e:this.issuer(r);n&&t._registry.delete(n),r&&t._scopeIssuers.delete(r);}static meta(e){let t=m.getComponentName(e),r=this.getInstance();if(!e)throw new l(l.InvalidMetaParameterError,"Invalid parameter provided to get meta. Parameter cannot be null or undefined.");if(!(this.isAllowedForMeta(e)||this.isAllowedForMetaConstructor(e)||o.isString(e)||o.isFunction(e)))throw new l(l.InvalidMetaParameterError,`Invalid parameter provided to get meta. Component of type ${t} is not allowed for meta storage. Only A_Container, A_Component and A_Entity are allowed.`);let n,i;switch(true){case o.isContainerInstance(e):{n=e.constructor,i=K;break}case o.isContainerConstructor(e):{n=e,i=K;break}case o.isComponentInstance(e):{n=e.constructor,i=j;break}case o.isComponentConstructor(e):{n=e,i=j;break}case o.isEntityInstance(e):{n=e.constructor,i=j;break}case o.isEntityConstructor(e):{n=e,i=q;break}case o.isFragmentInstance(e):{n=e.constructor,i=j;break}case o.isFragmentConstructor(e):{n=e,i=q;break}case typeof e=="string":{let s=Array.from(r._metaStorage).find(([a])=>a.name===e||a.name===C.toKebabCase(e)||a.name===C.toPascalCase(e));if(!(s&&s.length))throw new l(l.InvalidMetaParameterError,`Invalid parameter provided to get meta. Component with name ${e} not found in the meta storage.`);n=s[0],i=j;break}default:{n=e,i=A;break}}if(!r._metaStorage.has(n)){let s,a=n;for(;!s;){let u=Object.getPrototypeOf(a);if(!u)break;s=r._metaStorage.get(u),a=u;}s||(s=new i),r._metaStorage.set(n,new i().from(s));}return r._metaStorage.get(n)}static setMeta(e,t){let r=x.getInstance(),n=x.meta(e),i=typeof e=="function"?e:e.constructor;r._metaStorage.set(i,n?t.from(n):t);}static issuer(e){let t=this.getInstance();if(!e)throw new l(l.InvalidComponentParameterError,"Invalid parameter provided to get scope issuer. Parameter cannot be null or undefined.");return t._scopeIssuers.get(e)}static scope(e){let t=e?.constructor?.name||String(e),r=this.getInstance();if(!e)throw new l(l.InvalidScopeParameterError,"Invalid parameter provided to get scope. Parameter cannot be null or undefined.");if(!this.isAllowedForScopeAllocation(e)&&!this.isAllowedToBeRegistered(e))throw new l(l.InvalidScopeParameterError,`Invalid parameter provided to get scope. Component of type ${t} is not allowed for scope allocation.`);switch(true){case this.isAllowedForScopeAllocation(e):if(!r._registry.has(e))throw new l(l.ScopeNotFoundError,`Invalid parameter provided to get scope. Component of type ${t} does not have a scope allocated. Make sure to allocate a scope using A_Context.allocate() method before trying to get the scope.`);return r._registry.get(e);case this.isAllowedToBeRegistered(e):if(!r._scopeStorage.has(e))throw new l(l.ScopeNotFoundError,`Invalid parameter provided to get scope. Component of type ${t} does not have a scope registered. Make sure to register the component using A_Context.register() method before trying to get the scope.`);return r._scopeStorage.get(e);default:throw new l(l.InvalidScopeParameterError,`Invalid parameter provided to get scope. Component of type ${t} is not allowed to be registered.`)}}static featureTemplate(e,t,r=this.scope(t)){let n=m.getComponentName(t);if(!t)throw new l(l.InvalidFeatureTemplateParameterError,"Unable to get feature template. Component cannot be null or undefined.");if(!e)throw new l(l.InvalidFeatureTemplateParameterError,"Unable to get feature template. Feature name cannot be null or undefined.");if(!o.isAllowedForFeatureDefinition(t))throw new l(l.InvalidFeatureTemplateParameterError,`Unable to get feature template. Component of type ${n} is not allowed for feature definition.`);return [...this.featureDefinition(e,t),...this.featureExtensions(e,t,r)]}static featureExtensions(e,t,r){let n=this.getInstance(),i=m.getComponentName(t);if(!t)throw new l(l.InvalidFeatureExtensionParameterError,"Unable to get feature template. Component cannot be null or undefined.");if(!e)throw new l(l.InvalidFeatureExtensionParameterError,"Unable to get feature template. Feature name cannot be null or undefined.");if(!o.isAllowedForFeatureDefinition(t))throw new l(l.InvalidFeatureExtensionParameterError,`Unable to get feature template. Component of type ${i} is not allowed for feature definition.`);let s=m.getClassInheritanceChain(t).filter(d=>d!==M&&d!==z&&d!==k).map(d=>`${d.name}.${e}`),a=new Map,u=new Set;for(let d of s)for(let[h,g]of n._metaStorage)r.has(h)&&(o.isComponentMetaInstance(g)||o.isContainerMetaInstance(g))&&(u.add(h),g.extensions(d).forEach(F=>{let R=Array.from(u).reverse().find(X=>m.isInheritedFrom(h,X)&&X!==h);R&&a.delete(`${m.getComponentName(R)}.${F.handler}`),a.set(`${m.getComponentName(h)}.${F.handler}`,{dependency:new D(h),...F});}));return n.filterToMostDerived(r,Array.from(a.values()))}filterToMostDerived(e,t){return t.filter(r=>{let n=e.resolveConstructor(r.dependency.name);return !t.some(s=>{if(s===r)return false;let a=e.resolveConstructor(s.dependency.name);return !n||!a?false:n.prototype.isPrototypeOf(a.prototype)})})}static featureDefinition(e,t){let r;if(!e)throw new l(l.InvalidFeatureTemplateParameterError,"Unable to get feature template. Feature name cannot be null or undefined.");if(!t)throw new l(l.InvalidFeatureTemplateParameterError,"Unable to get feature template. Component cannot be null or undefined.");switch(true){case t instanceof k:r="a-component-features";break;case t instanceof z:r="a-container-features";break;case t instanceof M:r="a-component-features";break;default:throw new l(l.InvalidFeatureTemplateParameterError,`A-Feature cannot be defined on the ${t} level`)}return [...this.meta(t)?.get(r)?.get(e)?.template||[]]}static abstractionTemplate(e,t){let r=m.getComponentName(t);if(!t)throw new l(l.InvalidAbstractionTemplateParameterError,"Unable to get feature template. Component cannot be null or undefined.");if(!e)throw new l(l.InvalidAbstractionTemplateParameterError,"Unable to get feature template. Abstraction stage cannot be null or undefined.");if(!o.isAllowedForAbstractionDefinition(t))throw new l(l.InvalidAbstractionTemplateParameterError,`Unable to get feature template. Component of type ${r} is not allowed for feature definition.`);return [...this.abstractionExtensions(e,t)]}static abstractionExtensions(e,t){let r=this.getInstance(),n=m.getComponentName(t);if(!t)throw new l(l.InvalidAbstractionExtensionParameterError,"Unable to get feature template. Component cannot be null or undefined.");if(!e)throw new l(l.InvalidAbstractionExtensionParameterError,"Unable to get feature template. Abstraction stage cannot be null or undefined.");if(!o.isAllowedForAbstractionDefinition(t))throw new l(l.InvalidAbstractionExtensionParameterError,`Unable to get feature template. Component of type ${n} is not allowed for feature definition.`);let i=new Map,s=this.scope(t),a=new Set;for(let[u,d]of r._metaStorage)s.has(u)&&(o.isComponentMetaInstance(d)||o.isContainerMetaInstance(d))&&(a.add(u),d.abstractions(e).forEach(h=>{let g=Array.from(a).reverse().find(F=>m.isInheritedFrom(u,F)&&F!==u);g&&i.delete(`${m.getComponentName(g)}.${h.handler}`),i.set(`${m.getComponentName(u)}.${h.handler}`,{dependency:new D(u),...h});}));return r.filterToMostDerived(s,Array.from(i.values()))}static reset(){let e=x.getInstance();e._registry=new WeakMap;let t="root";x.environment==="server"&&(t=process.env[O.A_CONCEPT_ROOT_SCOPE]||"root"),x.environment==="browser"&&(t=window[O.A_CONCEPT_ROOT_SCOPE]||"root"),e._root=new v({name:t});}static isAllowedForScopeAllocation(e){return o.isContainerInstance(e)||o.isFeatureInstance(e)}static isAllowedToBeRegistered(e){return o.isEntityInstance(e)||o.isComponentInstance(e)||o.isFragmentInstance(e)||o.isErrorInstance(e)}static isAllowedForMeta(e){return o.isContainerInstance(e)||o.isComponentInstance(e)||o.isEntityInstance(e)}static isAllowedForMetaConstructor(e){return o.isContainerConstructor(e)||o.isComponentConstructor(e)||o.isEntityConstructor(e)}};_(x,"A_Context");var p=x;var Ee=class Ee extends E{};_(Ee,"A_AbstractionError"),Ee.AbstractionExtensionError="Unable to extend abstraction execution";var Z=Ee;function $e(c,e={}){return function(t,r,n){let i=m.getComponentName(t);if(!c)throw new Z(Z.AbstractionExtensionError,`Abstraction name must be provided to extend abstraction for '${i}'.`);if(!o.isConstructorAvailableForAbstraction(t))throw new Z(Z.AbstractionExtensionError,`Unable to extend Abstraction '${c}' for '${i}'. Only A-Containers and A-Components can extend Abstractions.`);let s,a=p.meta(t);switch(true){case(o.isContainerConstructor(t)||o.isContainerInstance(t)):s="a-container-abstractions";break;case(o.isComponentConstructor(t)||o.isComponentInstance(t)):s="a-component-abstractions";break}let u=`CONCEPT_ABSTRACTION::${c}`,d=a.get(s)?new A().from(a.get(s)):new A,h=[...d.get(u)||[]],g=h.findIndex(R=>R.handler===r),F={name:u,handler:r,behavior:e.behavior||"sync",throwOnError:e.throwOnError!==void 0?e.throwOnError:true,before:o.isArray(e.before)?new RegExp(`^${e.before.join("|").replace(/\./g,"\\.")}$`).source:e.before instanceof RegExp?e.before.source:"",after:o.isArray(e.after)?new RegExp(`^${e.after.join("|").replace(/\./g,"\\.")}$`).source:e.after instanceof RegExp?e.after.source:"",override:o.isArray(e.override)?new RegExp(`^${e.override.join("|").replace(/\./g,"\\.")}$`).source:e.after instanceof RegExp?e.after.source:""};g!==-1?h[g]=F:h.push(F),d.set(u,h),p.meta(t).set(s,d);}}_($e,"A_Abstraction_Extend");var Le=class Le{constructor(e){this._features=[];this._index=0;this._name=e.name,this._features=e.containers.map(t=>{let r=p.abstractionTemplate(this._name,t);return new Y({name:this._name,component:t,template:r})}),this._current=this._features[0];}static get Extend(){return $e}get name(){return this._name}get feature(){return this._current}get isDone(){return !this.feature||this._index>=this._features.length}[Symbol.iterator](){return {next:_(()=>this.isDone?(this._current=void 0,{value:void 0,done:true}):(this._current=this._features[this._index],{value:this._current,done:false}),"next")}}next(e){if(this._index>=this._features.length)return;let t=this._features.indexOf(e);this._index=t+1;}async process(e){if(!this.isDone)for(let t of this._features)await t.process(e);}};_(Le,"A_Abstraction");var b=Le;var _t=(a=>(a.Run="run",a.Build="build",a.Publish="publish",a.Deploy="deploy",a.Load="load",a.Start="start",a.Stop="stop",a))(_t||{}),ct=(e=>(e.LIFECYCLE="a-component-extensions",e))(ct||{});var Ue=class Ue{constructor(e){this.props=e;this._name=e.name||p.root.name,e.components&&e.components.length&&e.components.forEach(t=>this.scope.register(t)),e.fragments&&e.fragments.length&&e.fragments.forEach(t=>this.scope.register(t)),e.entities&&e.entities.length&&e.entities.forEach(t=>this.scope.register(t)),this._containers=e.containers||[];}static Load(e){return b.Extend("load",e)}static Publish(e){return b.Extend("publish")}static Deploy(e){return b.Extend("deploy",e)}static Build(e){return b.Extend("build",e)}static Run(e){return b.Extend("run",e)}static Start(e){return b.Extend("start",e)}static Stop(e){return b.Extend("stop",e)}get name(){return p.root.name}get scope(){return p.root}get register(){return this.scope.register.bind(this.scope)}get resolve(){return this.scope.resolve.bind(this.scope)}async load(e){await new b({name:"load",containers:this._containers}).process(e);}async run(e){await new b({name:"run",containers:this._containers}).process(e);}async start(e){await new b({name:"start",containers:this._containers}).process(e);}async stop(e){await new b({name:"stop",containers:this._containers}).process(e);}async build(e){await new b({name:"build",containers:this._containers}).process(e);}async deploy(e){await new b({name:"deploy",containers:this._containers}).process(e);}async publish(e){await new b({name:"publish",containers:this._containers}).process(e);}async call(e,t){return await new Y({name:e,component:t}).process()}};_(Ue,"A_Concept");var ze=Ue;var Ke=class Ke extends A{constructor(t){super();this.containers=t;}};_(Ke,"A_ConceptMeta");var Je=Ke;var ce=class ce extends E{};_(ce,"A_InjectError"),ce.InvalidInjectionTarget="Invalid target for A-Inject decorator",ce.MissingInjectionTarget="Missing target for A-Inject decorator";var W=ce;function pt(c,e){if(!c)throw new W(W.MissingInjectionTarget,"A-Inject decorator is missing the target to inject");return function(t,r,n){let i=m.getComponentName(t);if(!o.isTargetAvailableForInjection(t))throw new W(W.InvalidInjectionTarget,`A-Inject cannot be used on the target of type ${typeof t} (${i})`);let s=r?String(r):"constructor",a;switch(true){case(o.isComponentConstructor(t)||o.isComponentInstance(t)):a="a-component-injections";break;case o.isContainerInstance(t):a="a-container-injections";break;case o.isEntityInstance(t):a="a-component-injections";break}let u=p.meta(t).get(a)||new A,d=u.get(s)||[];d[n]=c instanceof D?c:new D(c,e),u.set(s,d),p.meta(t).set(a,u);}}_(pt,"A_Inject");
|
|
2
|
-
exports.ASEID=I;exports.ASEID_Error=w;exports.A_Abstraction=b;exports.A_AbstractionError=Z;exports.A_Abstraction_Extend=$e;exports.A_CONSTANTS__DEFAULT_ENV_VARIABLES=O;exports.A_CONSTANTS__DEFAULT_ENV_VARIABLES_ARRAY=lt;exports.A_CONSTANTS__ERROR_CODES=ee;exports.A_CONSTANTS__ERROR_DESCRIPTION=He;exports.A_Caller=V;exports.A_CallerError=re;exports.A_CommonHelper=m;exports.A_Component=M;exports.A_ComponentMeta=j;exports.A_Concept=ze;exports.A_ConceptMeta=Je;exports.A_Container=z;exports.A_ContainerMeta=K;exports.A_Context=p;exports.A_ContextError=l;exports.A_Dependency=D;exports.A_DependencyError=y;exports.A_Dependency_Default=we;exports.A_Dependency_Load=xe;exports.A_Dependency_Require=Fe;exports.A_Entity=k;exports.A_EntityError=te;exports.A_EntityMeta=q;exports.A_Error=E;exports.A_Feature=Y;exports.A_FeatureError=f;exports.A_Feature_Define=Oe;exports.A_Feature_Extend=Ne;exports.A_FormatterHelper=C;exports.A_Fragment=J;exports.A_IdentityHelper=U;exports.A_Inject=pt;exports.A_InjectError=W;exports.A_Meta=A;exports.A_MetaDecorator=Te;exports.A_Scope=v;exports.A_ScopeError=T;exports.A_Stage=ae;exports.A_StageError=H;exports.A_StepManagerError=ne;exports.A_StepsManager=oe;exports.A_TYPES__A_Stage_Status=at;exports.A_TYPES__ComponentMetaKey=it;exports.A_TYPES__ConceptAbstractions=_t;exports.A_TYPES__ConceptMetaKey=ct;exports.A_TYPES__ContainerMetaKey=ot;exports.A_TYPES__EntityFeatures=nt;exports.A_TYPES__EntityMetaKey=rt;exports.A_TYPES__FeatureState=tt;exports.A_TypeGuards=o;//# sourceMappingURL=index.cjs.map
|
|
3
|
-
//# sourceMappingURL=index.cjs.map
|