@adaas/a-concept 0.0.20 → 0.0.21
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/src/base/A-Config/A-Config.context.js +3 -1
- package/dist/src/base/A-Config/A-Config.context.js.map +1 -1
- package/dist/src/base/A-Config/A-Config.types.d.ts +4 -0
- package/package.json +1 -1
- package/src/base/A-Config/A-Config.context.ts +4 -1
- package/src/base/A-Config/A-Config.types.ts +6 -1
|
@@ -25,6 +25,7 @@ class A_Config extends A_Fragment_class_1.A_Fragment {
|
|
|
25
25
|
];
|
|
26
26
|
this.config = a_utils_1.A_CommonHelper.deepCloneAndMerge(config, {
|
|
27
27
|
name: this.name,
|
|
28
|
+
strict: false,
|
|
28
29
|
defaults: {},
|
|
29
30
|
variables: []
|
|
30
31
|
});
|
|
@@ -45,7 +46,8 @@ class A_Config extends A_Fragment_class_1.A_Fragment {
|
|
|
45
46
|
*/
|
|
46
47
|
get(property) {
|
|
47
48
|
if (this.CONFIG_PROPERTIES.includes(property)
|
|
48
|
-
|| this.DEFAULT_ALLOWED_TO_READ_PROPERTIES.includes(property)
|
|
49
|
+
|| this.DEFAULT_ALLOWED_TO_READ_PROPERTIES.includes(property)
|
|
50
|
+
|| !(this.config.strict))
|
|
49
51
|
return this.VARIABLES.get(property);
|
|
50
52
|
throw new Error('Property not exists or not allowed to read');
|
|
51
53
|
// return this.concept.Errors.throw(A_SDK_CONSTANTS__ERROR_CODES.CONFIGURATION_PROPERTY_NOT_EXISTS_OR_NOT_ALLOWED_TO_READ) as never;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"A-Config.context.js","sourceRoot":"","sources":["../../../../src/base/A-Config/A-Config.context.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,4CAAmE;AAEnE,0FAAiF;AAGjF,MAAa,QAEX,SAAQ,6BAAU;IAgBhB,YACI,MAAyF;QAEzF,KAAK,CAAC,MAAM,CAAC,CAAC;QAflB,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AAC,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;gBACvB,CAAC,CAAC,MAAM;qBACH,IAAI,CAAC,QAAQ,CAAC;qBACd,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;oBACX,QAAQ,EAAE,GAAG;oBACb,KAAK,EAAE,QAAQ,CAAC,GAAG,CAAC;iBACvB,CAAC,CAAC,CAAC;QAEhB,KAAK,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,IAAI,KAAK,EAAE,CAAC;YAEtC,IAAI,WAAW,GAAG,KAAK;gBACnB,CAAC,CAAC,KAAK;gBACP,CAAC,CAAC,CAAA,MAAA,IAAI,CAAC,MAAM,0CAAE,QAAQ;oBACnB,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAa,CAAC;oBACrC,CAAC,CAAC,SAAS,CAAC;YAEpB,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,QAAkB,EAAE,WAAW,CAAC,CAAC;QACxD,CAAC;IACL,CAAC;CACJ;AA9GD,4BA8GC"}
|
|
@@ -2,6 +2,10 @@ import { A_TYPES__FragmentConstructor } from "../../global/A-Fragment/A-Fragment
|
|
|
2
2
|
export declare enum A_TYPES__ConfigFeature {
|
|
3
3
|
}
|
|
4
4
|
export type A_TYPES__ConfigContainerConstructor<T extends string> = {
|
|
5
|
+
/**
|
|
6
|
+
* If set to true, the SDK will throw an error if the variable is not defined OR not presented in the defaults
|
|
7
|
+
*/
|
|
8
|
+
strict: boolean;
|
|
5
9
|
/**
|
|
6
10
|
* Allows to define the names of variable to be loaded
|
|
7
11
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adaas/a-concept",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.21",
|
|
4
4
|
"description": "A-Concept is a framework to build new Applications within or outside the ADAAS ecosystem. This framework is designed to be modular structure regardless environment and program goal.",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -28,6 +28,7 @@ export class A_Config<
|
|
|
28
28
|
|
|
29
29
|
this.config = A_CommonHelper.deepCloneAndMerge<A_TYPES__ConfigContainerConstructor<T>>(config as any, {
|
|
30
30
|
name: this.name,
|
|
31
|
+
strict: false,
|
|
31
32
|
defaults: {} as Record<T, any>,
|
|
32
33
|
variables: [] as T[]
|
|
33
34
|
});
|
|
@@ -52,7 +53,9 @@ export class A_Config<
|
|
|
52
53
|
property: T | typeof this.DEFAULT_ALLOWED_TO_READ_PROPERTIES[number]
|
|
53
54
|
): _OutType {
|
|
54
55
|
if (this.CONFIG_PROPERTIES.includes(property as any)
|
|
55
|
-
|| this.DEFAULT_ALLOWED_TO_READ_PROPERTIES.includes(property as any)
|
|
56
|
+
|| this.DEFAULT_ALLOWED_TO_READ_PROPERTIES.includes(property as any)
|
|
57
|
+
|| !(this.config.strict)
|
|
58
|
+
)
|
|
56
59
|
return this.VARIABLES.get(property as string) as _OutType;
|
|
57
60
|
|
|
58
61
|
throw new Error('Property not exists or not allowed to read') as never;
|
|
@@ -2,11 +2,16 @@ import { A_TYPES__FragmentConstructor } from "@adaas/a-concept/global/A-Fragment
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
export enum A_TYPES__ConfigFeature {
|
|
5
|
-
|
|
5
|
+
|
|
6
6
|
}
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
export type A_TYPES__ConfigContainerConstructor<T extends string> = {
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* If set to true, the SDK will throw an error if the variable is not defined OR not presented in the defaults
|
|
13
|
+
*/
|
|
14
|
+
strict: boolean
|
|
10
15
|
|
|
11
16
|
/**
|
|
12
17
|
* Allows to define the names of variable to be loaded
|