@adaas/a-utils 0.1.10 → 0.1.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/index.d.mts +914 -0
- package/dist/index.d.ts +914 -27
- package/dist/index.js +1760 -90
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1738 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +5 -3
- package/src/index.ts +70 -0
- package/src/lib/A-Logger/A-Logger.component.ts +10 -3
- package/src/lib/A-Polyfill/A-Polyfill.component.ts +153 -15
- package/src/lib/A-Polyfill/A-Polyfill.types.ts +54 -0
- package/src/lib/A-Polyfill/classes/A-Buffer-Polyfill.class.ts +85 -0
- package/src/lib/A-Polyfill/classes/A-Crypto-Polyfill.class.ts +87 -0
- package/src/lib/A-Polyfill/classes/A-FS-Polyfill.class.ts +61 -0
- package/src/lib/A-Polyfill/classes/A-Http-Polyfill.class.ts +100 -0
- package/src/lib/A-Polyfill/classes/A-Https-Polyfill.class.ts +100 -0
- package/src/lib/A-Polyfill/classes/A-Path-Polyfill.class.ts +97 -0
- package/src/lib/A-Polyfill/classes/A-Process-Polyfill.class.ts +73 -0
- package/src/lib/A-Polyfill/classes/A-Url-Polyfill.class.ts +88 -0
- package/tests/A-Config.test.ts +5 -5
- package/tests/A-Polyfill.test.ts +446 -29
- package/tsconfig.json +1 -1
- package/tsup.config.ts +15 -0
- package/dist/src/constants/errors.constants.d.ts +0 -0
- package/dist/src/constants/errors.constants.js +0 -2
- package/dist/src/constants/errors.constants.js.map +0 -1
- package/dist/src/lib/A-Channel/A-Channel.component.d.ts +0 -22
- package/dist/src/lib/A-Channel/A-Channel.component.js +0 -84
- package/dist/src/lib/A-Channel/A-Channel.component.js.map +0 -1
- package/dist/src/lib/A-Channel/A-Channel.error.d.ts +0 -4
- package/dist/src/lib/A-Channel/A-Channel.error.js +0 -9
- package/dist/src/lib/A-Channel/A-Channel.error.js.map +0 -1
- package/dist/src/lib/A-Channel/A-Channel.types.d.ts +0 -0
- package/dist/src/lib/A-Channel/A-Channel.types.js +0 -2
- package/dist/src/lib/A-Channel/A-Channel.types.js.map +0 -1
- package/dist/src/lib/A-Command/A-Command.constants.d.ts +0 -22
- package/dist/src/lib/A-Command/A-Command.constants.js +0 -28
- package/dist/src/lib/A-Command/A-Command.constants.js.map +0 -1
- package/dist/src/lib/A-Command/A-Command.entity.d.ts +0 -133
- package/dist/src/lib/A-Command/A-Command.entity.js +0 -273
- package/dist/src/lib/A-Command/A-Command.entity.js.map +0 -1
- package/dist/src/lib/A-Command/A-Command.error.d.ts +0 -3
- package/dist/src/lib/A-Command/A-Command.error.js +0 -8
- package/dist/src/lib/A-Command/A-Command.error.js.map +0 -1
- package/dist/src/lib/A-Command/A-Command.types.d.ts +0 -73
- package/dist/src/lib/A-Command/A-Command.types.js +0 -4
- package/dist/src/lib/A-Command/A-Command.types.js.map +0 -1
- package/dist/src/lib/A-Config/A-Config.constants.d.ts +0 -3
- package/dist/src/lib/A-Config/A-Config.constants.js +0 -6
- package/dist/src/lib/A-Config/A-Config.constants.js.map +0 -1
- package/dist/src/lib/A-Config/A-Config.container.d.ts +0 -6
- package/dist/src/lib/A-Config/A-Config.container.js +0 -77
- package/dist/src/lib/A-Config/A-Config.container.js.map +0 -1
- package/dist/src/lib/A-Config/A-Config.context.d.ts +0 -29
- package/dist/src/lib/A-Config/A-Config.context.js +0 -63
- package/dist/src/lib/A-Config/A-Config.context.js.map +0 -1
- package/dist/src/lib/A-Config/A-Config.error.d.ts +0 -4
- package/dist/src/lib/A-Config/A-Config.error.js +0 -9
- package/dist/src/lib/A-Config/A-Config.error.js.map +0 -1
- package/dist/src/lib/A-Config/A-Config.types.d.ts +0 -19
- package/dist/src/lib/A-Config/A-Config.types.js +0 -7
- package/dist/src/lib/A-Config/A-Config.types.js.map +0 -1
- package/dist/src/lib/A-Config/components/ConfigReader.component.d.ts +0 -30
- package/dist/src/lib/A-Config/components/ConfigReader.component.js +0 -103
- package/dist/src/lib/A-Config/components/ConfigReader.component.js.map +0 -1
- package/dist/src/lib/A-Config/components/ENVConfigReader.component.d.ts +0 -14
- package/dist/src/lib/A-Config/components/ENVConfigReader.component.js +0 -72
- package/dist/src/lib/A-Config/components/ENVConfigReader.component.js.map +0 -1
- package/dist/src/lib/A-Config/components/FileConfigReader.component.d.ts +0 -11
- package/dist/src/lib/A-Config/components/FileConfigReader.component.js +0 -47
- package/dist/src/lib/A-Config/components/FileConfigReader.component.js.map +0 -1
- package/dist/src/lib/A-Logger/A-Logger.component.d.ts +0 -29
- package/dist/src/lib/A-Logger/A-Logger.component.js +0 -152
- package/dist/src/lib/A-Logger/A-Logger.component.js.map +0 -1
- package/dist/src/lib/A-Logger/A-Logger.types.d.ts +0 -0
- package/dist/src/lib/A-Logger/A-Logger.types.js +0 -2
- package/dist/src/lib/A-Logger/A-Logger.types.js.map +0 -1
- package/dist/src/lib/A-Manifest/A-Manifest.context.d.ts +0 -52
- package/dist/src/lib/A-Manifest/A-Manifest.context.js +0 -154
- package/dist/src/lib/A-Manifest/A-Manifest.context.js.map +0 -1
- package/dist/src/lib/A-Manifest/A-Manifest.error.d.ts +0 -4
- package/dist/src/lib/A-Manifest/A-Manifest.error.js +0 -9
- package/dist/src/lib/A-Manifest/A-Manifest.error.js.map +0 -1
- package/dist/src/lib/A-Manifest/A-Manifest.types.d.ts +0 -43
- package/dist/src/lib/A-Manifest/A-Manifest.types.js +0 -3
- package/dist/src/lib/A-Manifest/A-Manifest.types.js.map +0 -1
- package/dist/src/lib/A-Manifest/classes/A-ManifestChecker.class.d.ts +0 -14
- package/dist/src/lib/A-Manifest/classes/A-ManifestChecker.class.js +0 -24
- package/dist/src/lib/A-Manifest/classes/A-ManifestChecker.class.js.map +0 -1
- package/dist/src/lib/A-Memory/A-Memory.context.d.ts +0 -64
- package/dist/src/lib/A-Memory/A-Memory.context.js +0 -105
- package/dist/src/lib/A-Memory/A-Memory.context.js.map +0 -1
- package/dist/src/lib/A-Polyfill/A-Polyfill.component.d.ts +0 -20
- package/dist/src/lib/A-Polyfill/A-Polyfill.component.js +0 -53
- package/dist/src/lib/A-Polyfill/A-Polyfill.component.js.map +0 -1
- package/dist/src/lib/A-Polyfill/A-Polyfill.types.d.ts +0 -9
- package/dist/src/lib/A-Polyfill/A-Polyfill.types.js +0 -3
- package/dist/src/lib/A-Polyfill/A-Polyfill.types.js.map +0 -1
- package/dist/src/lib/A-Polyfill/A-Polyfills.class.d.ts +0 -11
- package/dist/src/lib/A-Polyfill/A-Polyfills.class.js +0 -123
- package/dist/src/lib/A-Polyfill/A-Polyfills.class.js.map +0 -1
- package/dist/src/lib/A-Schedule/A-Deferred.class.d.ts +0 -12
- package/dist/src/lib/A-Schedule/A-Deferred.class.js +0 -23
- package/dist/src/lib/A-Schedule/A-Deferred.class.js.map +0 -1
- package/dist/src/lib/A-Schedule/A-Schedule.component.d.ts +0 -57
- package/dist/src/lib/A-Schedule/A-Schedule.component.js +0 -49
- package/dist/src/lib/A-Schedule/A-Schedule.component.js.map +0 -1
- package/dist/src/lib/A-Schedule/A-Schedule.types.d.ts +0 -10
- package/dist/src/lib/A-Schedule/A-Schedule.types.js +0 -3
- package/dist/src/lib/A-Schedule/A-Schedule.types.js.map +0 -1
- package/dist/src/lib/A-Schedule/A-ScheduleObject.class.d.ts +0 -29
- package/dist/src/lib/A-Schedule/A-ScheduleObject.class.js +0 -58
- package/dist/src/lib/A-Schedule/A-ScheduleObject.class.js.map +0 -1
- package/index.ts +0 -71
- package/src/lib/A-Polyfill/A-Polyfills.class.ts +0 -99
- package/tsconfig.build.json +0 -56
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
9
|
-
return function (target, key) { decorator(target, key, paramIndex); }
|
|
10
|
-
};
|
|
11
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
12
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
13
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
14
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
15
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
16
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
17
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
18
|
-
});
|
|
19
|
-
};
|
|
20
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
-
exports.A_ConfigLoader = void 0;
|
|
22
|
-
const a_concept_1 = require("@adaas/a-concept");
|
|
23
|
-
const A_Config_context_1 = require("./A-Config.context");
|
|
24
|
-
const A_Polyfill_component_1 = require("../A-Polyfill/A-Polyfill.component");
|
|
25
|
-
const A_Config_error_1 = require("./A-Config.error");
|
|
26
|
-
const FileConfigReader_component_1 = require("./components/FileConfigReader.component");
|
|
27
|
-
const ENVConfigReader_component_1 = require("./components/ENVConfigReader.component");
|
|
28
|
-
const A_Config_constants_1 = require("./A-Config.constants");
|
|
29
|
-
class A_ConfigLoader extends a_concept_1.A_Container {
|
|
30
|
-
prepare(polyfill) {
|
|
31
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
32
|
-
if (!this.scope.has(A_Config_context_1.A_Config)) {
|
|
33
|
-
const newConfig = new A_Config_context_1.A_Config({
|
|
34
|
-
variables: [
|
|
35
|
-
...a_concept_1.A_CONSTANTS__DEFAULT_ENV_VARIABLES_ARRAY,
|
|
36
|
-
...A_Config_constants_1.A_CONSTANTS__CONFIG_ENV_VARIABLES_ARRAY
|
|
37
|
-
],
|
|
38
|
-
defaults: {}
|
|
39
|
-
});
|
|
40
|
-
this.scope.register(newConfig);
|
|
41
|
-
}
|
|
42
|
-
const fs = yield polyfill.fs();
|
|
43
|
-
try {
|
|
44
|
-
switch (true) {
|
|
45
|
-
case a_concept_1.A_Context.environment === 'server' && !!fs.existsSync(`${a_concept_1.A_Context.concept}.conf.json`):
|
|
46
|
-
this.reader = this.scope.resolve(FileConfigReader_component_1.FileConfigReader);
|
|
47
|
-
break;
|
|
48
|
-
case a_concept_1.A_Context.environment === 'server' && !fs.existsSync(`${a_concept_1.A_Context.concept}.conf.json`):
|
|
49
|
-
this.reader = this.scope.resolve(ENVConfigReader_component_1.ENVConfigReader);
|
|
50
|
-
break;
|
|
51
|
-
case a_concept_1.A_Context.environment === 'browser':
|
|
52
|
-
this.reader = this.scope.resolve(ENVConfigReader_component_1.ENVConfigReader);
|
|
53
|
-
break;
|
|
54
|
-
default:
|
|
55
|
-
throw new A_Config_error_1.A_ConfigError(A_Config_error_1.A_ConfigError.InitializationError, `Environment ${a_concept_1.A_Context.environment} is not supported`);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
catch (error) {
|
|
59
|
-
if (error instanceof a_concept_1.A_ScopeError) {
|
|
60
|
-
throw new A_Config_error_1.A_ConfigError({
|
|
61
|
-
title: A_Config_error_1.A_ConfigError.InitializationError,
|
|
62
|
-
description: `Failed to initialize A_ConfigLoader. Reader not found for environment ${a_concept_1.A_Context.environment}`,
|
|
63
|
-
originalError: error,
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
exports.A_ConfigLoader = A_ConfigLoader;
|
|
71
|
-
__decorate([
|
|
72
|
-
a_concept_1.A_Concept.Load({
|
|
73
|
-
before: /.*/
|
|
74
|
-
}),
|
|
75
|
-
__param(0, (0, a_concept_1.A_Inject)(A_Polyfill_component_1.A_Polyfill))
|
|
76
|
-
], A_ConfigLoader.prototype, "prepare", null);
|
|
77
|
-
//# sourceMappingURL=A-Config.container.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"A-Config.container.js","sourceRoot":"","sources":["../../../../src/lib/A-Config/A-Config.container.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,gDAA0J;AAE1J,yDAA8C;AAC9C,6EAAgE;AAChE,qDAAiD;AACjD,wFAA2E;AAC3E,sFAAyE;AACzE,6DAA+E;AAG/E,MAAa,cAAe,SAAQ,uBAAW;IAQrC,OAAO,CACa,QAAoB;;YAE1C,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,2BAAQ,CAAC,EAAE,CAAC;gBAC5B,MAAM,SAAS,GAAG,IAAI,2BAAQ,CAAC;oBAC3B,SAAS,EAAE;wBACP,GAAG,oDAAwC;wBAC3C,GAAG,4DAAuC;qBACpC;oBACV,QAAQ,EAAE,EAAE;iBACf,CAAC,CAAC;gBAEH,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;YACnC,CAAC;YAGD,MAAM,EAAE,GAAG,MAAM,QAAQ,CAAC,EAAE,EAAE,CAAC;YAE/B,IAAI,CAAC;gBACD,QAAQ,IAAI,EAAE,CAAC;oBAEX,KAAK,qBAAS,CAAC,WAAW,KAAK,QAAQ,IAAI,CAAC,CAAC,EAAE,CAAC,UAAU,CAAC,GAAG,qBAAS,CAAC,OAAO,YAAY,CAAC;wBACxF,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAe,6CAAgB,CAAC,CAAC;wBACjE,MAAM;oBAEV,KAAK,qBAAS,CAAC,WAAW,KAAK,QAAQ,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,GAAG,qBAAS,CAAC,OAAO,YAAY,CAAC;wBACvF,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAe,2CAAe,CAAC,CAAC;wBAChE,MAAM;oBAEV,KAAK,qBAAS,CAAC,WAAW,KAAK,SAAS;wBACpC,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAe,2CAAe,CAAC,CAAC;wBAChE,MAAM;oBAEV;wBACI,MAAM,IAAI,8BAAa,CACnB,8BAAa,CAAC,mBAAmB,EACjC,eAAe,qBAAS,CAAC,WAAW,mBAAmB,CAC1D,CAAC;gBACV,CAAC;YACL,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACb,IAAI,KAAK,YAAY,wBAAY,EAAE,CAAC;oBAChC,MAAM,IAAI,8BAAa,CAAC;wBACpB,KAAK,EAAE,8BAAa,CAAC,mBAAmB;wBACxC,WAAW,EAAE,yEAAyE,qBAAS,CAAC,WAAW,EAAE;wBAC7G,aAAa,EAAE,KAAK;qBACvB,CAAC,CAAA;gBACN,CAAC;YACL,CAAC;QACL,CAAC;KAAA;CACJ;AAzDD,wCAyDC;AAjDS;IAHL,qBAAS,CAAC,IAAI,CAAC;QACZ,MAAM,EAAE,IAAI;KACf,CAAC;IAEG,WAAA,IAAA,oBAAQ,EAAC,iCAAU,CAAC,CAAA;6CA+CxB"}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { A_Fragment, A_TYPES__ConceptENVVariables } from "@adaas/a-concept";
|
|
2
|
-
import { A_TYPES__ConfigContainerConstructor } from "./A-Config.types";
|
|
3
|
-
export declare class A_Config<T extends Array<string | A_TYPES__ConceptENVVariables[number]> = any[]> extends A_Fragment {
|
|
4
|
-
config: A_TYPES__ConfigContainerConstructor<T>;
|
|
5
|
-
private VARIABLES;
|
|
6
|
-
CONFIG_PROPERTIES: T;
|
|
7
|
-
protected DEFAULT_ALLOWED_TO_READ_PROPERTIES: ("A_CONCEPT_NAME" | "A_CONCEPT_ROOT_SCOPE" | "A_CONCEPT_ENVIRONMENT" | "A_CONCEPT_ROOT_FOLDER" | "A_ERROR_DEFAULT_DESCRIPTION")[];
|
|
8
|
-
constructor(config: Partial<A_TYPES__ConfigContainerConstructor<T>>);
|
|
9
|
-
/**
|
|
10
|
-
* This method is used to get the configuration property by name
|
|
11
|
-
*
|
|
12
|
-
* @param property
|
|
13
|
-
* @returns
|
|
14
|
-
*/
|
|
15
|
-
get<_OutType = any>(property: T[number] | typeof this.DEFAULT_ALLOWED_TO_READ_PROPERTIES[number]): _OutType;
|
|
16
|
-
/**
|
|
17
|
-
*
|
|
18
|
-
* This method is used to set the configuration property by name
|
|
19
|
-
* OR set multiple properties at once by passing an array of objects
|
|
20
|
-
*
|
|
21
|
-
* @param variables
|
|
22
|
-
*/
|
|
23
|
-
set(variables: Array<{
|
|
24
|
-
property: T[number] | A_TYPES__ConceptENVVariables[number];
|
|
25
|
-
value: any;
|
|
26
|
-
}>): any;
|
|
27
|
-
set(variables: Partial<Record<T[number] | A_TYPES__ConceptENVVariables[number], any>>): any;
|
|
28
|
-
set(property: T[number] | A_TYPES__ConceptENVVariables[number], value: any): any;
|
|
29
|
-
}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.A_Config = void 0;
|
|
4
|
-
const a_concept_1 = require("@adaas/a-concept");
|
|
5
|
-
const A_Config_constants_1 = require("./A-Config.constants");
|
|
6
|
-
class A_Config extends a_concept_1.A_Fragment {
|
|
7
|
-
constructor(config) {
|
|
8
|
-
super({
|
|
9
|
-
name: 'A_Config'
|
|
10
|
-
});
|
|
11
|
-
this.VARIABLES = new Map();
|
|
12
|
-
this.DEFAULT_ALLOWED_TO_READ_PROPERTIES = [
|
|
13
|
-
...a_concept_1.A_CONSTANTS__DEFAULT_ENV_VARIABLES_ARRAY,
|
|
14
|
-
...A_Config_constants_1.A_CONSTANTS__CONFIG_ENV_VARIABLES_ARRAY
|
|
15
|
-
];
|
|
16
|
-
this.config = a_concept_1.A_CommonHelper.deepCloneAndMerge(config, {
|
|
17
|
-
strict: false,
|
|
18
|
-
defaults: {},
|
|
19
|
-
variables: a_concept_1.A_CONSTANTS__DEFAULT_ENV_VARIABLES_ARRAY
|
|
20
|
-
});
|
|
21
|
-
this.CONFIG_PROPERTIES = this.config.variables ? this.config.variables : [];
|
|
22
|
-
this.config.variables.forEach((variable) => {
|
|
23
|
-
this.VARIABLES.set(a_concept_1.A_FormatterHelper.toUpperSnakeCase(variable), this.config.defaults[variable]);
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* This method is used to get the configuration property by name
|
|
28
|
-
*
|
|
29
|
-
* @param property
|
|
30
|
-
* @returns
|
|
31
|
-
*/
|
|
32
|
-
get(property) {
|
|
33
|
-
if (this.CONFIG_PROPERTIES.includes(property)
|
|
34
|
-
|| this.DEFAULT_ALLOWED_TO_READ_PROPERTIES.includes(property)
|
|
35
|
-
|| !(this.config.strict))
|
|
36
|
-
return this.VARIABLES.get(a_concept_1.A_FormatterHelper.toUpperSnakeCase(property));
|
|
37
|
-
throw new Error('Property not exists or not allowed to read');
|
|
38
|
-
// return this.concept.Errors.throw(A_SDK_CONSTANTS__ERROR_CODES.CONFIGURATION_PROPERTY_NOT_EXISTS_OR_NOT_ALLOWED_TO_READ) as never;
|
|
39
|
-
}
|
|
40
|
-
set(property, value) {
|
|
41
|
-
var _a;
|
|
42
|
-
const array = Array.isArray(property)
|
|
43
|
-
? property
|
|
44
|
-
: typeof property === 'string'
|
|
45
|
-
? [{ property, value }]
|
|
46
|
-
: Object
|
|
47
|
-
.keys(property)
|
|
48
|
-
.map((key) => ({
|
|
49
|
-
property: key,
|
|
50
|
-
value: property[key]
|
|
51
|
-
}));
|
|
52
|
-
for (const { property, value } of array) {
|
|
53
|
-
let targetValue = value
|
|
54
|
-
? value
|
|
55
|
-
: ((_a = this.config) === null || _a === void 0 ? void 0 : _a.defaults)
|
|
56
|
-
? this.config.defaults[property]
|
|
57
|
-
: undefined;
|
|
58
|
-
this.VARIABLES.set(a_concept_1.A_FormatterHelper.toUpperSnakeCase(property), targetValue);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
exports.A_Config = A_Config;
|
|
63
|
-
//# sourceMappingURL=A-Config.context.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"A-Config.context.js","sourceRoot":"","sources":["../../../../src/lib/A-Config/A-Config.context.ts"],"names":[],"mappings":";;;AAAA,gDAAyJ;AAEzJ,6DAA+E;AAG/E,MAAa,QAEX,SAAQ,sBAAU;IAehB,YACI,MAAuD;QAEvD,KAAK,CAAC;YACF,IAAI,EAAE,UAAU;SACnB,CAAC,CAAC;QAfC,cAAS,GAAwB,IAAI,GAAG,EAAkB,CAAC;QAIzD,uCAAkC,GAAG;YAC3C,GAAG,oDAAwC;YAC3C,GAAG,4DAAuC;SAC7C,CAAC;QAUE,IAAI,CAAC,MAAM,GAAG,0BAAc,CAAC,iBAAiB,CAAyC,MAAa,EAAE;YAClG,MAAM,EAAE,KAAK;YACb,QAAQ,EAAE,EAAE;YACZ,SAAS,EAAE,oDAAoD;SAC3D,CAAC,CAAC;QAEV,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,EAAc,CAAC;QAExF,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE;YACvC,IAAI,CAAC,SAAS,CAAC,GAAG,CACd,6BAAiB,CAAC,gBAAgB,CAAC,QAAQ,CAAC,EAC5C,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,CACjC,CAAC;QACN,CAAC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,CAAC,EAAE,WAAW,CAAC,CAAC;QAClF,CAAC;IACL,CAAC;CACJ;AA/GD,4BA+GC"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.A_ConfigError = void 0;
|
|
4
|
-
const a_concept_1 = require("@adaas/a-concept");
|
|
5
|
-
class A_ConfigError extends a_concept_1.A_Error {
|
|
6
|
-
}
|
|
7
|
-
exports.A_ConfigError = A_ConfigError;
|
|
8
|
-
A_ConfigError.InitializationError = 'A-Config Initialization Error';
|
|
9
|
-
//# sourceMappingURL=A-Config.error.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"A-Config.error.js","sourceRoot":"","sources":["../../../../src/lib/A-Config/A-Config.error.ts"],"names":[],"mappings":";;;AAAA,gDAA2C;AAG3C,MAAa,aAAc,SAAQ,mBAAO;;AAA1C,sCAGC;AADmB,iCAAmB,GAAG,+BAA+B,CAAC"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { A_TYPES__ConceptENVVariables, A_TYPES__Fragment_Constructor } from "@adaas/a-concept";
|
|
2
|
-
export declare enum A_TYPES__ConfigFeature {
|
|
3
|
-
}
|
|
4
|
-
export type A_TYPES__ConfigContainerConstructor<T extends Array<string | A_TYPES__ConceptENVVariables[number]>> = {
|
|
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;
|
|
9
|
-
/**
|
|
10
|
-
* Allows to define the names of variable to be loaded
|
|
11
|
-
*/
|
|
12
|
-
variables: T;
|
|
13
|
-
/**
|
|
14
|
-
* Allows to set the default values for the variables
|
|
15
|
-
*/
|
|
16
|
-
defaults: {
|
|
17
|
-
[key in T[number]]?: any;
|
|
18
|
-
};
|
|
19
|
-
} & A_TYPES__Fragment_Constructor;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.A_TYPES__ConfigFeature = void 0;
|
|
4
|
-
var A_TYPES__ConfigFeature;
|
|
5
|
-
(function (A_TYPES__ConfigFeature) {
|
|
6
|
-
})(A_TYPES__ConfigFeature || (exports.A_TYPES__ConfigFeature = A_TYPES__ConfigFeature = {}));
|
|
7
|
-
//# sourceMappingURL=A-Config.types.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"A-Config.types.js","sourceRoot":"","sources":["../../../../src/lib/A-Config/A-Config.types.ts"],"names":[],"mappings":";;;AAEA,IAAY,sBAEX;AAFD,WAAY,sBAAsB;AAElC,CAAC,EAFW,sBAAsB,sCAAtB,sBAAsB,QAEjC"}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { A_Component, A_Container, A_Feature } from "@adaas/a-concept";
|
|
2
|
-
import { A_Config } from "../A-Config.context";
|
|
3
|
-
import { A_Polyfill } from "../../A-Polyfill/A-Polyfill.component";
|
|
4
|
-
/**
|
|
5
|
-
* Config Reader
|
|
6
|
-
*/
|
|
7
|
-
export declare class ConfigReader extends A_Component {
|
|
8
|
-
protected polyfill: A_Polyfill;
|
|
9
|
-
constructor(polyfill: A_Polyfill);
|
|
10
|
-
attachContext(container: A_Container, feature: A_Feature): Promise<void>;
|
|
11
|
-
initialize(config: A_Config): Promise<void>;
|
|
12
|
-
/**
|
|
13
|
-
* Get the configuration property by Name
|
|
14
|
-
* @param property
|
|
15
|
-
*/
|
|
16
|
-
resolve<_ReturnType = any>(property: string): _ReturnType;
|
|
17
|
-
/**
|
|
18
|
-
* This method reads the configuration and sets the values to the context
|
|
19
|
-
*
|
|
20
|
-
* @returns
|
|
21
|
-
*/
|
|
22
|
-
read<T extends string>(variables?: Array<T>): Promise<Record<T, any>>;
|
|
23
|
-
/**
|
|
24
|
-
* Finds the root directory of the project by locating the folder containing package.json
|
|
25
|
-
*
|
|
26
|
-
* @param {string} startPath - The initial directory to start searching from (default is __dirname)
|
|
27
|
-
* @returns {string|null} - The path to the root directory or null if package.json is not found
|
|
28
|
-
*/
|
|
29
|
-
protected getProjectRoot(startPath?: string): Promise<string>;
|
|
30
|
-
}
|
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
9
|
-
return function (target, key) { decorator(target, key, paramIndex); }
|
|
10
|
-
};
|
|
11
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
12
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
13
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
14
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
15
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
16
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
17
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
18
|
-
});
|
|
19
|
-
};
|
|
20
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
-
exports.ConfigReader = void 0;
|
|
22
|
-
const a_concept_1 = require("@adaas/a-concept");
|
|
23
|
-
const A_Config_context_1 = require("../A-Config.context");
|
|
24
|
-
const A_Config_constants_1 = require("../A-Config.constants");
|
|
25
|
-
const A_Polyfill_component_1 = require("../../A-Polyfill/A-Polyfill.component");
|
|
26
|
-
/**
|
|
27
|
-
* Config Reader
|
|
28
|
-
*/
|
|
29
|
-
let ConfigReader = class ConfigReader extends a_concept_1.A_Component {
|
|
30
|
-
constructor(polyfill) {
|
|
31
|
-
super();
|
|
32
|
-
this.polyfill = polyfill;
|
|
33
|
-
}
|
|
34
|
-
attachContext(container, feature) {
|
|
35
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
36
|
-
if (!container.scope.has(A_Config_context_1.A_Config)) {
|
|
37
|
-
const newConfig = new A_Config_context_1.A_Config({
|
|
38
|
-
variables: [
|
|
39
|
-
...a_concept_1.A_CONSTANTS__DEFAULT_ENV_VARIABLES_ARRAY,
|
|
40
|
-
...A_Config_constants_1.A_CONSTANTS__CONFIG_ENV_VARIABLES_ARRAY
|
|
41
|
-
],
|
|
42
|
-
defaults: {}
|
|
43
|
-
});
|
|
44
|
-
container.scope.register(newConfig);
|
|
45
|
-
}
|
|
46
|
-
const config = container.scope.resolve(A_Config_context_1.A_Config);
|
|
47
|
-
const rootDir = yield this.getProjectRoot();
|
|
48
|
-
config.set('A_CONCEPT_ROOT_FOLDER', rootDir);
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
initialize(config) {
|
|
52
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
53
|
-
const data = yield this.read([
|
|
54
|
-
...config.CONFIG_PROPERTIES,
|
|
55
|
-
...a_concept_1.A_CONSTANTS__DEFAULT_ENV_VARIABLES_ARRAY,
|
|
56
|
-
...A_Config_constants_1.A_CONSTANTS__CONFIG_ENV_VARIABLES_ARRAY
|
|
57
|
-
]);
|
|
58
|
-
config.set(data);
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* Get the configuration property by Name
|
|
63
|
-
* @param property
|
|
64
|
-
*/
|
|
65
|
-
resolve(property) {
|
|
66
|
-
return property;
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* This method reads the configuration and sets the values to the context
|
|
70
|
-
*
|
|
71
|
-
* @returns
|
|
72
|
-
*/
|
|
73
|
-
read() {
|
|
74
|
-
return __awaiter(this, arguments, void 0, function* (variables = []) {
|
|
75
|
-
return {};
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
/**
|
|
79
|
-
* Finds the root directory of the project by locating the folder containing package.json
|
|
80
|
-
*
|
|
81
|
-
* @param {string} startPath - The initial directory to start searching from (default is __dirname)
|
|
82
|
-
* @returns {string|null} - The path to the root directory or null if package.json is not found
|
|
83
|
-
*/
|
|
84
|
-
getProjectRoot() {
|
|
85
|
-
return __awaiter(this, arguments, void 0, function* (startPath = __dirname) {
|
|
86
|
-
return process.cwd();
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
};
|
|
90
|
-
exports.ConfigReader = ConfigReader;
|
|
91
|
-
__decorate([
|
|
92
|
-
a_concept_1.A_Concept.Load(),
|
|
93
|
-
__param(0, (0, a_concept_1.A_Inject)(a_concept_1.A_Container)),
|
|
94
|
-
__param(1, (0, a_concept_1.A_Inject)(a_concept_1.A_Feature))
|
|
95
|
-
], ConfigReader.prototype, "attachContext", null);
|
|
96
|
-
__decorate([
|
|
97
|
-
a_concept_1.A_Concept.Load(),
|
|
98
|
-
__param(0, (0, a_concept_1.A_Inject)(A_Config_context_1.A_Config))
|
|
99
|
-
], ConfigReader.prototype, "initialize", null);
|
|
100
|
-
exports.ConfigReader = ConfigReader = __decorate([
|
|
101
|
-
__param(0, (0, a_concept_1.A_Inject)(A_Polyfill_component_1.A_Polyfill))
|
|
102
|
-
], ConfigReader);
|
|
103
|
-
//# sourceMappingURL=ConfigReader.component.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ConfigReader.component.js","sourceRoot":"","sources":["../../../../../src/lib/A-Config/components/ConfigReader.component.ts"],"names":[],"mappings":";;;;;;;;;;;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KG;IACa,cAAc;6DAAC,SAAS,GAAG,SAAS;YAChD,OAAO,OAAO,CAAC,GAAG,EAAE,CAAC;QACzB,CAAC;KAAA;CACJ,CAAA;AA7EY,oCAAY;AASf;IADL,qBAAS,CAAC,IAAI,EAAE;IAEZ,WAAA,IAAA,oBAAQ,EAAC,uBAAW,CAAC,CAAA;IACrB,WAAA,IAAA,oBAAQ,EAAC,qBAAS,CAAC,CAAA;iDAoBvB;AAGK;IADL,qBAAS,CAAC,IAAI,EAAE;IAEZ,WAAA,IAAA,oBAAQ,EAAC,2BAAQ,CAAC,CAAA;8CAStB;uBA5CQ,YAAY;IAGhB,WAAA,IAAA,oBAAQ,EAAC,iCAAU,CAAC,CAAA;GAHhB,YAAY,CA6ExB"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { A_Feature, A_TYPES__ConceptENVVariables } from "@adaas/a-concept";
|
|
2
|
-
import { ConfigReader } from "./ConfigReader.component";
|
|
3
|
-
import { A_Config } from "../A-Config.context";
|
|
4
|
-
import { A_Polyfill } from "../../A-Polyfill/A-Polyfill.component";
|
|
5
|
-
export declare class ENVConfigReader extends ConfigReader {
|
|
6
|
-
readEnvFile(config: A_Config<A_TYPES__ConceptENVVariables>, polyfill: A_Polyfill, feature: A_Feature): Promise<void>;
|
|
7
|
-
/**
|
|
8
|
-
* Get the configuration property Name
|
|
9
|
-
* @param property
|
|
10
|
-
*/
|
|
11
|
-
getConfigurationProperty_ENV_Alias(property: string): string;
|
|
12
|
-
resolve<_ReturnType = any>(property: string): _ReturnType;
|
|
13
|
-
read<T extends string>(variables?: Array<T>): Promise<Record<T, any>>;
|
|
14
|
-
}
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
9
|
-
return function (target, key) { decorator(target, key, paramIndex); }
|
|
10
|
-
};
|
|
11
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
12
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
13
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
14
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
15
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
16
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
17
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
18
|
-
});
|
|
19
|
-
};
|
|
20
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
-
exports.ENVConfigReader = void 0;
|
|
22
|
-
const a_concept_1 = require("@adaas/a-concept");
|
|
23
|
-
const ConfigReader_component_1 = require("./ConfigReader.component");
|
|
24
|
-
const A_Config_context_1 = require("../A-Config.context");
|
|
25
|
-
const A_Polyfill_component_1 = require("../../A-Polyfill/A-Polyfill.component");
|
|
26
|
-
class ENVConfigReader extends ConfigReader_component_1.ConfigReader {
|
|
27
|
-
readEnvFile(config, polyfill, feature) {
|
|
28
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
29
|
-
const fs = yield polyfill.fs();
|
|
30
|
-
if (fs.existsSync('.env'))
|
|
31
|
-
fs.readFileSync(`${config.get('A_CONCEPT_ROOT_FOLDER')}/.env`, 'utf-8').split('\n').forEach(line => {
|
|
32
|
-
const [key, value] = line.split('=');
|
|
33
|
-
if (key && value) {
|
|
34
|
-
process.env[key.trim()] = value.trim();
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Get the configuration property Name
|
|
41
|
-
* @param property
|
|
42
|
-
*/
|
|
43
|
-
getConfigurationProperty_ENV_Alias(property) {
|
|
44
|
-
return a_concept_1.A_FormatterHelper.toUpperSnakeCase(property);
|
|
45
|
-
}
|
|
46
|
-
resolve(property) {
|
|
47
|
-
return process.env[this.getConfigurationProperty_ENV_Alias(property)];
|
|
48
|
-
}
|
|
49
|
-
read() {
|
|
50
|
-
return __awaiter(this, arguments, void 0, function* (variables = []) {
|
|
51
|
-
const allVariables = [
|
|
52
|
-
...variables,
|
|
53
|
-
...Object.keys(process.env),
|
|
54
|
-
];
|
|
55
|
-
const config = {};
|
|
56
|
-
allVariables.forEach(variable => {
|
|
57
|
-
config[variable] = this.resolve(variable);
|
|
58
|
-
});
|
|
59
|
-
return config;
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
exports.ENVConfigReader = ENVConfigReader;
|
|
64
|
-
__decorate([
|
|
65
|
-
a_concept_1.A_Concept.Load({
|
|
66
|
-
before: ['ENVConfigReader.initialize']
|
|
67
|
-
}),
|
|
68
|
-
__param(0, (0, a_concept_1.A_Inject)(A_Config_context_1.A_Config)),
|
|
69
|
-
__param(1, (0, a_concept_1.A_Inject)(A_Polyfill_component_1.A_Polyfill)),
|
|
70
|
-
__param(2, (0, a_concept_1.A_Inject)(a_concept_1.A_Feature))
|
|
71
|
-
], ENVConfigReader.prototype, "readEnvFile", null);
|
|
72
|
-
//# sourceMappingURL=ENVConfigReader.component.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ENVConfigReader.component.js","sourceRoot":"","sources":["../../../../../src/lib/A-Config/components/ENVConfigReader.component.ts"],"names":[],"mappings":";;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CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;YAC9C,CAAC,CAAC,CAAC;YAEH,OAAO,MAAM,CAAC;QAClB,CAAC;KAAA;CACJ;AApDD,0CAoDC;AA9CS;IAHL,qBAAS,CAAC,IAAI,CAAC;QACZ,MAAM,EAAE,CAAC,4BAA4B,CAAC;KACzC,CAAC;IAEG,WAAA,IAAA,oBAAQ,EAAC,2BAAQ,CAAC,CAAA;IAClB,WAAA,IAAA,oBAAQ,EAAC,iCAAU,CAAC,CAAA;IACpB,WAAA,IAAA,oBAAQ,EAAC,qBAAS,CAAC,CAAA;kDAYvB"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { ConfigReader } from "./ConfigReader.component";
|
|
2
|
-
export declare class FileConfigReader extends ConfigReader {
|
|
3
|
-
private FileData;
|
|
4
|
-
/**
|
|
5
|
-
* Get the configuration property Name
|
|
6
|
-
* @param property
|
|
7
|
-
*/
|
|
8
|
-
getConfigurationProperty_File_Alias(property: string): string;
|
|
9
|
-
resolve<_ReturnType = any>(property: string): _ReturnType;
|
|
10
|
-
read<T extends string>(variables?: Array<T>): Promise<Record<T, any>>;
|
|
11
|
-
}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.FileConfigReader = void 0;
|
|
13
|
-
const a_concept_1 = require("@adaas/a-concept");
|
|
14
|
-
const ConfigReader_component_1 = require("./ConfigReader.component");
|
|
15
|
-
class FileConfigReader extends ConfigReader_component_1.ConfigReader {
|
|
16
|
-
constructor() {
|
|
17
|
-
super(...arguments);
|
|
18
|
-
this.FileData = new Map();
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Get the configuration property Name
|
|
22
|
-
* @param property
|
|
23
|
-
*/
|
|
24
|
-
getConfigurationProperty_File_Alias(property) {
|
|
25
|
-
return a_concept_1.A_FormatterHelper.toCamelCase(property);
|
|
26
|
-
}
|
|
27
|
-
resolve(property) {
|
|
28
|
-
return this.FileData.get(this.getConfigurationProperty_File_Alias(property));
|
|
29
|
-
}
|
|
30
|
-
read(variables) {
|
|
31
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
32
|
-
const fs = yield this.polyfill.fs();
|
|
33
|
-
try {
|
|
34
|
-
const data = fs.readFileSync(`${a_concept_1.A_Context.concept}.conf.json`, 'utf8');
|
|
35
|
-
const config = JSON.parse(data);
|
|
36
|
-
this.FileData = new Map(Object.entries(config));
|
|
37
|
-
return config;
|
|
38
|
-
}
|
|
39
|
-
catch (error) {
|
|
40
|
-
// this.context.Logger.error(error);
|
|
41
|
-
return {};
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
exports.FileConfigReader = FileConfigReader;
|
|
47
|
-
//# sourceMappingURL=FileConfigReader.component.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"FileConfigReader.component.js","sourceRoot":"","sources":["../../../../../src/lib/A-Config/components/FileConfigReader.component.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,gDAAgE;AAChE,qEAAwD;AAExD,MAAa,gBAAiB,SAAQ,qCAAY;IAAlD;;QAEY,aAAQ,GAAqB,IAAI,GAAG,EAAe,CAAC;IAoChE,CAAC;IAlCG;;;OAGG;IACH,mCAAmC,CAAC,QAAgB;QAChD,OAAO,6BAAiB,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;IACnD,CAAC;IAGD,OAAO,CAAoB,QAAgB;QACvC,OAAO,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,mCAAmC,CAAC,QAAQ,CAAC,CAAgB,CAAC;IAChG,CAAC;IAGK,IAAI,CACN,SAAoB;;YAGpB,MAAM,EAAE,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;YAEpC,IAAI,CAAC;gBACD,MAAM,IAAI,GAAG,EAAE,CAAC,YAAY,CAAC,GAAG,qBAAS,CAAC,OAAO,YAAY,EAAE,MAAM,CAAC,CAAC;gBAEvE,MAAM,MAAM,GAAmB,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;gBAEhD,IAAI,CAAC,QAAQ,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;gBAEhD,OAAO,MAAM,CAAC;YAElB,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACb,oCAAoC;gBACpC,OAAO,EAAoB,CAAC;YAChC,CAAC;QACL,CAAC;KAAA;CACJ;AAtCD,4CAsCC"}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { A_Component, A_Error, A_Scope } from "@adaas/a-concept";
|
|
2
|
-
import { A_Config } from "../A-Config/A-Config.context";
|
|
3
|
-
export declare class A_Logger extends A_Component {
|
|
4
|
-
protected scope: A_Scope;
|
|
5
|
-
protected config: A_Config;
|
|
6
|
-
constructor(scope: A_Scope, config: A_Config);
|
|
7
|
-
readonly colors: {
|
|
8
|
-
readonly green: "32";
|
|
9
|
-
readonly blue: "34";
|
|
10
|
-
readonly red: "31";
|
|
11
|
-
readonly yellow: "33";
|
|
12
|
-
readonly gray: "90";
|
|
13
|
-
readonly magenta: "35";
|
|
14
|
-
readonly cyan: "36";
|
|
15
|
-
readonly white: "37";
|
|
16
|
-
readonly pink: "95";
|
|
17
|
-
};
|
|
18
|
-
get scopeLength(): number;
|
|
19
|
-
compile(color: keyof typeof this.colors, ...args: any[]): Array<string>;
|
|
20
|
-
protected get allowedToLog(): boolean;
|
|
21
|
-
log(color: keyof typeof this.colors, ...args: any[]): any;
|
|
22
|
-
log(...args: any[]): any;
|
|
23
|
-
warning(...args: any[]): void;
|
|
24
|
-
error(...args: any[]): void;
|
|
25
|
-
protected log_A_Error(error: A_Error): void;
|
|
26
|
-
protected compile_A_Error(error: A_Error): string;
|
|
27
|
-
protected compile_Error(error: Error): string;
|
|
28
|
-
protected getTime(): string;
|
|
29
|
-
}
|