@spinajs/configuration 2.0.85 → 2.0.87
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/lib/{config → cjs/config}/configuration.d.ts +0 -0
- package/lib/cjs/config/configuration.d.ts.map +1 -0
- package/lib/cjs/config/configuration.js +10 -0
- package/lib/cjs/config/configuration.js.map +1 -0
- package/lib/{configuration.d.ts → cjs/configuration.d.ts} +10 -2
- package/lib/cjs/configuration.d.ts.map +1 -0
- package/lib/cjs/configuration.js +272 -0
- package/lib/cjs/configuration.js.map +1 -0
- package/lib/{decorators.d.ts → cjs/decorators.d.ts} +0 -0
- package/lib/cjs/decorators.d.ts.map +1 -0
- package/lib/cjs/decorators.js +94 -0
- package/lib/cjs/decorators.js.map +1 -0
- package/lib/{exception.d.ts → cjs/exception.d.ts} +0 -0
- package/lib/cjs/exception.d.ts.map +1 -0
- package/lib/cjs/exception.js +11 -0
- package/lib/cjs/exception.js.map +1 -0
- package/lib/{index.d.ts → cjs/index.d.ts} +0 -0
- package/lib/cjs/index.d.ts.map +1 -0
- package/lib/cjs/index.js +26 -0
- package/lib/cjs/index.js.map +1 -0
- package/lib/{sources.d.ts → cjs/sources.d.ts} +0 -0
- package/lib/cjs/sources.d.ts.map +1 -0
- package/lib/cjs/sources.js +156 -0
- package/lib/cjs/sources.js.map +1 -0
- package/lib/{util.d.ts → cjs/util.d.ts} +0 -0
- package/lib/cjs/util.d.ts.map +1 -0
- package/lib/cjs/util.js +89 -0
- package/lib/cjs/util.js.map +1 -0
- package/lib/mjs/config/configuration.d.ts +8 -0
- package/lib/mjs/config/configuration.d.ts.map +1 -0
- package/lib/{config → mjs/config}/configuration.js +0 -0
- package/lib/mjs/config/configuration.js.map +1 -0
- package/lib/mjs/configuration.d.ts +82 -0
- package/lib/mjs/configuration.d.ts.map +1 -0
- package/lib/{configuration.js → mjs/configuration.js} +23 -3
- package/lib/mjs/configuration.js.map +1 -0
- package/lib/mjs/decorators.d.ts +22 -0
- package/lib/mjs/decorators.d.ts.map +1 -0
- package/lib/{decorators.js → mjs/decorators.js} +0 -0
- package/lib/mjs/decorators.js.map +1 -0
- package/lib/mjs/exception.d.ts +6 -0
- package/lib/mjs/exception.d.ts.map +1 -0
- package/lib/{exception.js → mjs/exception.js} +0 -0
- package/lib/mjs/exception.js.map +1 -0
- package/lib/mjs/index.d.ts +10 -0
- package/lib/mjs/index.d.ts.map +1 -0
- package/lib/{index.js → mjs/index.js} +0 -0
- package/lib/mjs/index.js.map +1 -0
- package/lib/mjs/sources.d.ts +22 -0
- package/lib/mjs/sources.d.ts.map +1 -0
- package/lib/{sources.js → mjs/sources.js} +0 -0
- package/lib/mjs/sources.js.map +1 -0
- package/lib/mjs/util.d.ts +7 -0
- package/lib/mjs/util.d.ts.map +1 -0
- package/lib/{util.js → mjs/util.js} +0 -0
- package/lib/mjs/util.js.map +1 -0
- package/lib/tsconfig.cjs.tsbuildinfo +1 -0
- package/lib/tsconfig.tsbuildinfo +1 -0
- package/package.json +16 -7
- package/lib/config/configuration.d.ts.map +0 -1
- package/lib/config/configuration.js.map +0 -1
- package/lib/configuration.d.ts.map +0 -1
- package/lib/configuration.js.map +0 -1
- package/lib/decorators.d.ts.map +0 -1
- package/lib/decorators.js.map +0 -1
- package/lib/exception.d.ts.map +0 -1
- package/lib/exception.js.map +0 -1
- package/lib/index.d.ts.map +0 -1
- package/lib/index.js.map +0 -1
- package/lib/sources.d.ts.map +0 -1
- package/lib/sources.js.map +0 -1
- package/lib/util.d.ts.map +0 -1
- package/lib/util.js.map +0 -1
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"configuration.d.ts","sourceRoot":"","sources":["../../../src/config/configuration.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,MAAM;;;;;CAKX,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const config = {
|
|
4
|
+
configuration: {
|
|
5
|
+
isDevelopment: process.env.NODE_ENV === 'development',
|
|
6
|
+
isProduction: process.env.NODE_ENV === 'production',
|
|
7
|
+
},
|
|
8
|
+
};
|
|
9
|
+
exports.default = config;
|
|
10
|
+
//# sourceMappingURL=configuration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"configuration.js","sourceRoot":"","sources":["../../../src/config/configuration.ts"],"names":[],"mappings":";;AAAA,MAAM,MAAM,GAAG;IACb,aAAa,EAAE;QACb,aAAa,EAAE,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,aAAa;QACrD,YAAY,EAAE,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY;KACpD;CACF,CAAC;AAEF,kBAAe,MAAM,CAAC"}
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
import Ajv from 'ajv';
|
|
2
1
|
import { ConfigurationSource, Configuration, ConfigurationOptions, IConfigurationSchema } from '@spinajs/configuration-common';
|
|
3
2
|
import { Class, Container } from '@spinajs/di';
|
|
4
3
|
import './sources.js';
|
|
4
|
+
/**
|
|
5
|
+
* HACK:
|
|
6
|
+
* Becouse of ajv not supporting esm default exports we need to
|
|
7
|
+
* check for default export module property and if not provided use module itself
|
|
8
|
+
*/
|
|
5
9
|
export declare class FrameworkConfiguration extends Configuration {
|
|
6
10
|
/**
|
|
7
11
|
* Apps configuration base dir, where to look for app config
|
|
@@ -17,7 +21,11 @@ export declare class FrameworkConfiguration extends Configuration {
|
|
|
17
21
|
protected Config: Record<string, unknown>;
|
|
18
22
|
protected CustomConfigPaths: string[];
|
|
19
23
|
protected Sources: ConfigurationSource[];
|
|
20
|
-
|
|
24
|
+
/**
|
|
25
|
+
* We ignore this error because ajv have problems with
|
|
26
|
+
* commonjs / esm default exports
|
|
27
|
+
*/
|
|
28
|
+
protected Validator: any;
|
|
21
29
|
protected ValidationSchemas: IConfigurationSchema[];
|
|
22
30
|
get RootConfig(): Record<string, unknown>;
|
|
23
31
|
protected Container: Container;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"configuration.d.ts","sourceRoot":"","sources":["../../src/configuration.ts"],"names":[],"mappings":"AAYA,OAAO,EACL,mBAAmB,EAEnB,aAAa,EACb,oBAAoB,EAEpB,oBAAoB,EACrB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAc,KAAK,EAAE,SAAS,EAAc,MAAM,aAAa,CAAC;AAKvE,OAAO,cAAc,CAAC;AAOtB;;;;GAIG;AAEH,qBACa,sBAAuB,SAAQ,aAAa;IACvD;;OAEG;IACI,UAAU,SAAQ;IAEzB;;OAEG;IACI,MAAM,SAAM;IAEnB;;OAEG;IACH,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAM;IAE/C,SAAS,CAAC,iBAAiB,EAAE,MAAM,EAAE,CAAC;IAEtC,SAAS,CAAC,OAAO,EAAE,mBAAmB,EAAE,CAAC;IAEzC;;;OAGG;IAEH,SAAS,CAAC,SAAS,EAAE,GAAG,CAAC;IAEzB,SAAS,CAAC,iBAAiB,EAAE,oBAAoB,EAAE,CAAC;IAEpD,IAAW,UAAU,4BAEpB;IAGD,SAAS,CAAC,SAAS,EAAE,SAAS,CAAC;IAE/B;;;;;OAKG;gBACS,OAAO,CAAC,EAAE,oBAAoB;IAQ1C;;;;;OAKG;IACI,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,YAAY,CAAC,EAAE,CAAC,GAAG,CAAC;IAI3D;;;;;;OAMG;IACI,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,KAAK,EAAE,OAAO;IAIlD;;;;;OAKG;IACI,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,KAAK,EAAE,OAAO;IAIvC,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAuDxB,WAAW,CAAC,KAAK,EAAE,KAAK,CAAC,mBAAmB,CAAC;IAW1D;;OAEG;IACU,IAAI;IAcjB,SAAS,CAAC,MAAM,IAAI,OAAO;IAI3B,SAAS,CAAC,WAAW;IAarB,SAAS,CAAC,QAAQ;IAmClB,SAAS,CAAC,aAAa;IAqDvB,SAAS,CAAC,GAAG,CAAC,MAAM,EAAE,MAAM;IAI5B;;OAEG;IACH,SAAS,CAAC,YAAY;IAUtB;;;OAGG;IACH,SAAS,CAAC,SAAS;CASpB"}
|
|
@@ -0,0 +1,272 @@
|
|
|
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 __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.FrameworkConfiguration = void 0;
|
|
16
|
+
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
|
17
|
+
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
|
18
|
+
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
|
19
|
+
/* eslint-disable @typescript-eslint/ban-ts-comment */
|
|
20
|
+
/* eslint-disable prettier/prettier */
|
|
21
|
+
/* eslint-disable @typescript-eslint/no-var-requires */
|
|
22
|
+
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
|
23
|
+
const path_1 = require("path");
|
|
24
|
+
const ajv_1 = __importDefault(require("ajv"));
|
|
25
|
+
const lodash_1 = __importDefault(require("lodash"));
|
|
26
|
+
const internal_logger_1 = require("@spinajs/internal-logger");
|
|
27
|
+
const exceptions_1 = require("@spinajs/exceptions");
|
|
28
|
+
const configuration_common_1 = require("@spinajs/configuration-common");
|
|
29
|
+
const di_1 = require("@spinajs/di");
|
|
30
|
+
const exception_js_1 = require("./exception.js");
|
|
31
|
+
const util_js_1 = require("./util.js");
|
|
32
|
+
const configuration_js_1 = __importDefault(require("./config/configuration.js"));
|
|
33
|
+
require("./sources.js");
|
|
34
|
+
const ajv_merge_patch_1 = __importDefault(require("ajv-merge-patch"));
|
|
35
|
+
const ajv_formats_1 = __importDefault(require("ajv-formats"));
|
|
36
|
+
const ajv_keywords_1 = __importDefault(require("ajv-keywords"));
|
|
37
|
+
/**
|
|
38
|
+
* HACK:
|
|
39
|
+
* Becouse of ajv not supporting esm default exports we need to
|
|
40
|
+
* check for default export module property and if not provided use module itself
|
|
41
|
+
*/
|
|
42
|
+
let FrameworkConfiguration = class FrameworkConfiguration extends configuration_common_1.Configuration {
|
|
43
|
+
get RootConfig() {
|
|
44
|
+
return this.Config;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
*
|
|
48
|
+
* @param app - application name, pass it when you run in application mode
|
|
49
|
+
* @param baseDir - configuration base dir, where to look for application configs
|
|
50
|
+
* @param cfgCustomPaths - custom cfg paths eg. to load config from non standard folders ( usefull in tests )
|
|
51
|
+
*/
|
|
52
|
+
constructor(options) {
|
|
53
|
+
super();
|
|
54
|
+
/**
|
|
55
|
+
* Apps configuration base dir, where to look for app config
|
|
56
|
+
*/
|
|
57
|
+
this.AppBaseDir = './';
|
|
58
|
+
/**
|
|
59
|
+
* Current running app name
|
|
60
|
+
*/
|
|
61
|
+
this.RunApp = '';
|
|
62
|
+
/**
|
|
63
|
+
* Loaded & merged configuration
|
|
64
|
+
*/
|
|
65
|
+
this.Config = {};
|
|
66
|
+
this.CustomConfigPaths = options?.cfgCustomPaths ?? [];
|
|
67
|
+
this.RunApp = options?.app ?? (0, util_js_1.parseArgv)('--app');
|
|
68
|
+
this.AppBaseDir = options?.appBaseDir ?? (0, util_js_1.parseArgv)('--apppath') ?? (0, path_1.join)(process.cwd(), '../apps/');
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Get config value for given property. If value not exists it returns default value, if default value is not provided returns undefined
|
|
72
|
+
*
|
|
73
|
+
* @param path - path to property eg. ["system","dirs"]
|
|
74
|
+
* @param defaultValue - optional, if value at specified path not exists returns default value
|
|
75
|
+
*/
|
|
76
|
+
get(path, defaultValue) {
|
|
77
|
+
return lodash_1.default.get(this.Config, path, defaultValue);
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Sets at given path configuration value. Use when you want to override config
|
|
81
|
+
* loaded from files programatically
|
|
82
|
+
*
|
|
83
|
+
* @param path - config path
|
|
84
|
+
* @param value - value to set
|
|
85
|
+
*/
|
|
86
|
+
set(path, value) {
|
|
87
|
+
this.Config = lodash_1.default.set(this.Config, path, value);
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Merge existing config value with new options instead overriding
|
|
91
|
+
*
|
|
92
|
+
* @param path - cfg path
|
|
93
|
+
* @param value - value to merge
|
|
94
|
+
*/
|
|
95
|
+
merge(path, value) {
|
|
96
|
+
lodash_1.default.mergeWith(this.get(path), value, util_js_1.mergeArrays);
|
|
97
|
+
}
|
|
98
|
+
async resolve() {
|
|
99
|
+
if (!this.Container.hasRegistered(configuration_common_1.ConfigurationSource)) {
|
|
100
|
+
throw new exceptions_1.InvalidOperation('No configuration sources configured. Please ensure that config module have any source to read from !');
|
|
101
|
+
}
|
|
102
|
+
if (this.CustomConfigPaths) {
|
|
103
|
+
// when using DI for resolving, options are injected and not type checked
|
|
104
|
+
// double check for this
|
|
105
|
+
if (!Array.isArray(this.CustomConfigPaths)) {
|
|
106
|
+
throw new exceptions_1.InvalidArgument(`ConfigurationConfigPaths should be an array`);
|
|
107
|
+
}
|
|
108
|
+
this.CustomConfigPaths.forEach((p) => {
|
|
109
|
+
internal_logger_1.InternalLogger.trace(`Custom config path at: ${p}`, 'Configuration');
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
if (this.RunApp) {
|
|
113
|
+
internal_logger_1.InternalLogger.trace(`Run app is ${this.RunApp}`, 'Configuration');
|
|
114
|
+
}
|
|
115
|
+
internal_logger_1.InternalLogger.trace(`App base dir is ${this.AppBaseDir}`, 'Configuration');
|
|
116
|
+
this.initValidator();
|
|
117
|
+
this.applyAppDirs();
|
|
118
|
+
// add default configuration of this module
|
|
119
|
+
// so we dont need to import it
|
|
120
|
+
this.set('configuration', configuration_js_1.default);
|
|
121
|
+
/**
|
|
122
|
+
* Load and validate data from cfg sources
|
|
123
|
+
* in proper order
|
|
124
|
+
*/
|
|
125
|
+
this.loadSources();
|
|
126
|
+
await this.load();
|
|
127
|
+
this.validate();
|
|
128
|
+
/**
|
|
129
|
+
* Merge from DI container
|
|
130
|
+
* eg. when custom modules have config and dont want to use files
|
|
131
|
+
* eg. in webpack environment
|
|
132
|
+
*/
|
|
133
|
+
this.Container.resolve(Array.ofType('__configuration__')).forEach((c) => {
|
|
134
|
+
Object.keys(c).forEach((k) => {
|
|
135
|
+
this.merge(k, c[`${k}`]);
|
|
136
|
+
});
|
|
137
|
+
});
|
|
138
|
+
this.configure();
|
|
139
|
+
}
|
|
140
|
+
async mergeSource(sType) {
|
|
141
|
+
const source = this.Container.resolve(sType);
|
|
142
|
+
const sCfg = await source.Load(this);
|
|
143
|
+
this.Sources.push(source);
|
|
144
|
+
if (sCfg) {
|
|
145
|
+
lodash_1.default.mergeWith(sCfg, util_js_1.mergeArrays);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Reloads configuration data
|
|
150
|
+
*/
|
|
151
|
+
async load() {
|
|
152
|
+
this.Config = {};
|
|
153
|
+
lodash_1.default.mergeWith(this.Config, this.onLoad(), util_js_1.mergeArrays);
|
|
154
|
+
for (const source of this.Sources) {
|
|
155
|
+
const rCfg = await source.Load(this);
|
|
156
|
+
if (rCfg) {
|
|
157
|
+
lodash_1.default.mergeWith(this.Config, rCfg, util_js_1.mergeArrays);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
onLoad() {
|
|
162
|
+
return null;
|
|
163
|
+
}
|
|
164
|
+
loadSources() {
|
|
165
|
+
this.Sources = this.Container.resolve(Array.ofType(configuration_common_1.ConfigurationSource), [
|
|
166
|
+
this.RunApp,
|
|
167
|
+
this.CustomConfigPaths,
|
|
168
|
+
this.AppBaseDir,
|
|
169
|
+
]);
|
|
170
|
+
// sort asc sources
|
|
171
|
+
this.Sources.sort((a, b) => {
|
|
172
|
+
return a.Order < b.Order ? -1 : a.Order > b.Order ? 1 : 0;
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
validate() {
|
|
176
|
+
this.ValidationSchemas.forEach((s) => {
|
|
177
|
+
const config = this.get(s.$configurationModule);
|
|
178
|
+
if (!config) {
|
|
179
|
+
internal_logger_1.InternalLogger.warn(`Cannot validate configuration for module ${s.$configurationModule}, configuration is not set`, 'Configuration');
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
182
|
+
const result = this.Validator.validate(s, config);
|
|
183
|
+
if (!result) {
|
|
184
|
+
const error = new exception_js_1.InvalidConfiguration('Validation error', this.Validator.errors);
|
|
185
|
+
// @ts-ignore
|
|
186
|
+
this.Validator.errors.forEach((ve) => {
|
|
187
|
+
internal_logger_1.InternalLogger.error('Invalid configuration ! Message: %s, path: %s, keyword: %s, schemaPath: %s, configuration module: %s', 'Configuration', ve.message, ve.instancePath, ve.keyword, ve.schemaPath, s.$configurationModule);
|
|
188
|
+
});
|
|
189
|
+
throw error;
|
|
190
|
+
}
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
initValidator() {
|
|
194
|
+
const options = {
|
|
195
|
+
logger: {
|
|
196
|
+
log: (msg) => internal_logger_1.InternalLogger.info(msg, 'Configuration'),
|
|
197
|
+
warn: (msg) => internal_logger_1.InternalLogger.warn(msg, 'Configuration'),
|
|
198
|
+
error: (msg) => internal_logger_1.InternalLogger.error(msg, 'Configuration'),
|
|
199
|
+
},
|
|
200
|
+
// enable all errors on validation, not only first one that occurred
|
|
201
|
+
allErrors: true,
|
|
202
|
+
// remove properties that are not defined in schema
|
|
203
|
+
removeAdditional: true,
|
|
204
|
+
// set default values if possible
|
|
205
|
+
useDefaults: true,
|
|
206
|
+
// The option coerceTypes allows you to have your data types coerced to the types specified in your schema type keywords
|
|
207
|
+
coerceTypes: true,
|
|
208
|
+
};
|
|
209
|
+
// @ts-ignore
|
|
210
|
+
if (ajv_1.default.default) {
|
|
211
|
+
// @ts-ignore
|
|
212
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
213
|
+
this.Validator = new ajv_1.default.default(options);
|
|
214
|
+
}
|
|
215
|
+
else {
|
|
216
|
+
// @ts-ignore
|
|
217
|
+
this.Validator = new ajv_1.default(options);
|
|
218
|
+
}
|
|
219
|
+
// add $merge & $patch for json schema
|
|
220
|
+
(0, ajv_merge_patch_1.default)(this.Validator);
|
|
221
|
+
// add common formats validation eg: date time
|
|
222
|
+
ajv_formats_1.default.default(this.Validator);
|
|
223
|
+
// add keywords
|
|
224
|
+
ajv_keywords_1.default.default(this.Validator);
|
|
225
|
+
// in strict mode ajv will throw when
|
|
226
|
+
// unknown keyword in schema is met
|
|
227
|
+
// we use $configurationModule keyword to identify
|
|
228
|
+
// to match config module with config schema
|
|
229
|
+
this.Validator.addKeyword('$configurationModule');
|
|
230
|
+
/**
|
|
231
|
+
* load all registered configuration json schemas
|
|
232
|
+
* for config value validation
|
|
233
|
+
*/
|
|
234
|
+
this.ValidationSchemas = this.Container.get(Array.ofType('__configurationSchema__'), true);
|
|
235
|
+
}
|
|
236
|
+
dir(toJoin) {
|
|
237
|
+
return (0, path_1.normalize)((0, path_1.join)((0, path_1.resolve)(this.AppBaseDir), toJoin));
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* adds app dirs to system.dirs config
|
|
241
|
+
*/
|
|
242
|
+
applyAppDirs() {
|
|
243
|
+
if (!this.RunApp) {
|
|
244
|
+
return;
|
|
245
|
+
}
|
|
246
|
+
for (const prop of Object.keys(this.get(['system', 'dirs'], []))) {
|
|
247
|
+
this.get(['system', 'dirs', prop]).push(this.dir(`/${this.RunApp}/${prop}`));
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
/**
|
|
251
|
+
* runs configuration func on files
|
|
252
|
+
* eg. when you want to configure stuff at beginning eq. external libs
|
|
253
|
+
*/
|
|
254
|
+
configure() {
|
|
255
|
+
for (const prop of Object.keys(this.Config)) {
|
|
256
|
+
const subconfig = this.Config[`${prop}`];
|
|
257
|
+
if (subconfig.configure && typeof subconfig.configure === 'function') {
|
|
258
|
+
subconfig.configure.apply(this);
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
};
|
|
263
|
+
__decorate([
|
|
264
|
+
(0, di_1.Autoinject)(),
|
|
265
|
+
__metadata("design:type", di_1.Container)
|
|
266
|
+
], FrameworkConfiguration.prototype, "Container", void 0);
|
|
267
|
+
FrameworkConfiguration = __decorate([
|
|
268
|
+
(0, di_1.Injectable)(configuration_common_1.Configuration),
|
|
269
|
+
__metadata("design:paramtypes", [Object])
|
|
270
|
+
], FrameworkConfiguration);
|
|
271
|
+
exports.FrameworkConfiguration = FrameworkConfiguration;
|
|
272
|
+
//# sourceMappingURL=configuration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"configuration.js","sourceRoot":"","sources":["../../src/configuration.ts"],"names":[],"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C,CAAC;aACjC;SACF;IACH,CAAC;CACF,CAAA;AA1QC;IAAC,IAAA,eAAU,GAAE;8BACQ,cAAS;yDAAC;AAlCpB,sBAAsB;IADlC,IAAA,eAAU,EAAC,oCAAa,CAAC;;GACb,sBAAsB,CA2SlC;AA3SY,wDAAsB"}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"decorators.d.ts","sourceRoot":"","sources":["../../src/decorators.ts"],"names":[],"mappings":"AAEA,OAAO,EAAiB,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AACnF,OAAO,EAA4B,KAAK,EAAuD,MAAM,aAAa,CAAC;AAEnH;;;;;;GAMG;AACH,wBAAgB,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,mBAAmB,aAC/C,GAAG,QAAQ,MAAM,KAAG,GAAG,CAqBzC;AAED;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,KAAK,CAAC,OAAO,CAAC,OAgDpE"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.AutoinjectService = exports.Config = void 0;
|
|
7
|
+
const lodash_1 = __importDefault(require("lodash"));
|
|
8
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
9
|
+
const configuration_common_1 = require("@spinajs/configuration-common");
|
|
10
|
+
const di_1 = require("@spinajs/di");
|
|
11
|
+
/**
|
|
12
|
+
* Injects configuration value to given class property
|
|
13
|
+
*
|
|
14
|
+
* @param path - path to configuration value eg. "app.dirs.stats"
|
|
15
|
+
* @param dafaultValue - default value if path not exists
|
|
16
|
+
* @returns
|
|
17
|
+
*/
|
|
18
|
+
function Config(path, options) {
|
|
19
|
+
return (target, key) => {
|
|
20
|
+
let config = null;
|
|
21
|
+
// register conf, so we can expose eg. in db if config is set
|
|
22
|
+
di_1.DI.register({ path, options }).asValue('__configuration_property__');
|
|
23
|
+
const getter = () => {
|
|
24
|
+
if (!config) {
|
|
25
|
+
config = di_1.DI.get(configuration_common_1.Configuration);
|
|
26
|
+
}
|
|
27
|
+
// try to return val
|
|
28
|
+
return config.get(path, options ? options.defaultValue ?? undefined : undefined);
|
|
29
|
+
};
|
|
30
|
+
Object.defineProperty(target, key, {
|
|
31
|
+
get: getter,
|
|
32
|
+
enumerable: false,
|
|
33
|
+
configurable: false,
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
exports.Config = Config;
|
|
38
|
+
/**
|
|
39
|
+
* Inject service based on configuration.
|
|
40
|
+
* Configuration could be object or string containing service
|
|
41
|
+
*
|
|
42
|
+
* If array is provided in configuration, service is resolved by name
|
|
43
|
+
* stored in 'service' property and returnes as Map\<serviceName, instance\>
|
|
44
|
+
*
|
|
45
|
+
* @param path - configuration path where service type is stored
|
|
46
|
+
* @param type - if type is provided, it will override type obtain from reflection. Use it specific with arrays and maps, becouse ts reflection module cannot extract array and map type data
|
|
47
|
+
*/
|
|
48
|
+
function AutoinjectService(path, type) {
|
|
49
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
|
50
|
+
return (0, di_1.AddDependencyForProperty)((descriptor, target, propertyKey) => {
|
|
51
|
+
const t = type ?? Reflect.getMetadata('design:type', target, propertyKey);
|
|
52
|
+
descriptor.inject.push({
|
|
53
|
+
autoinject: true,
|
|
54
|
+
autoinjectKey: propertyKey,
|
|
55
|
+
inject: t,
|
|
56
|
+
data: path,
|
|
57
|
+
mapFunc: (x) => {
|
|
58
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-member-access
|
|
59
|
+
return x.ServiceName || x.constructor.name;
|
|
60
|
+
},
|
|
61
|
+
serviceFunc: (path, container) => {
|
|
62
|
+
const cfg = container.get(configuration_common_1.Configuration);
|
|
63
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
64
|
+
const cfgVal = cfg.get(path);
|
|
65
|
+
if (!cfgVal) {
|
|
66
|
+
throw new Error(`Configuration value ${path} is empty`);
|
|
67
|
+
}
|
|
68
|
+
if (lodash_1.default.isString(cfgVal)) {
|
|
69
|
+
return {
|
|
70
|
+
service: cfgVal,
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
if (lodash_1.default.isArray(cfgVal)) {
|
|
74
|
+
return cfgVal.map((x) => {
|
|
75
|
+
return {
|
|
76
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
|
|
77
|
+
service: x.service,
|
|
78
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
79
|
+
options: x,
|
|
80
|
+
};
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
return {
|
|
84
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
|
|
85
|
+
service: cfgVal.service,
|
|
86
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
87
|
+
options: cfgVal,
|
|
88
|
+
};
|
|
89
|
+
},
|
|
90
|
+
});
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
exports.AutoinjectService = AutoinjectService;
|
|
94
|
+
//# sourceMappingURL=decorators.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"decorators.js","sourceRoot":"","sources":["../../src/decorators.ts"],"names":[],"mappings":";;;;;;AAAA,oDAAuB;AACvB,uDAAuD;AACvD,wEAAmF;AACnF,oCAAmH;AAEnH;;;;;;GAMG;AACH,SAAgB,MAAM,CAAC,IAAY,EAAE,OAA6B;IAChE,OAAO,CAAC,MAAY,EAAE,GAAY,EAAO,EAAE;QACzC,IAAI,MA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,EAAE,EAAE;gBACnD,MAAM,GAAG,GAAG,SAAS,CAAC,GAAG,CAAC,oCAAa,CAAC,CAAC;gBACzC,mEAAmE;gBACnE,MAAM,MAAM,GAAG,GAAG,CAAC,GAAG,CAAM,IAAI,CAAC,CAAC;gBAElC,IAAI,CAAC,MAAM,EAAE;oBACX,MAAM,IAAI,KAAK,CAAC,uBAAuB,IAAI,WAAW,CAAC,CAAC;iBACzD;gBAED,IAAI,gBAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE;oBACtB,OAAO;wBACL,OAAO,EAAE,MAAM;qBAChB,CAAC;iBACH;gBAED,IAAI,gBAAC,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE;oBACrB,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE;wBACtB,OAAO;4BACL,+GAA+G;4BAC/G,OAAO,EAAE,CAAC,CAAC,OAAiB;4BAC5B,mEAAmE;4BACnE,OAAO,EAAE,CAAC;yBACX,CAAC;oBACJ,CAAC,CAAC,CAAC;iBACJ;gBAED,OAAO;oBACL,+GAA+G;oBAC/G,OAAO,EAAE,MAAM,CAAC,OAAiB;oBACjC,mEAAmE;oBACnE,OAAO,EAAE,MAAM;iBAChB,CAAC;YACJ,CAAC;SACF,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC;AAhDD,8CAgDC"}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exception.d.ts","sourceRoot":"","sources":["../../src/exception.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,KAAK,CAAC;AAElC,qBAAa,oBAAqB,SAAQ,KAAK;IACT,oBAAoB,CAAC,EAAE,WAAW,EAAE;gBAA5D,OAAO,EAAE,MAAM,EAAS,oBAAoB,CAAC,EAAE,WAAW,EAAE;CAGzE"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.InvalidConfiguration = void 0;
|
|
4
|
+
class InvalidConfiguration extends Error {
|
|
5
|
+
constructor(message, validationExceptions) {
|
|
6
|
+
super(message);
|
|
7
|
+
this.validationExceptions = validationExceptions;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
exports.InvalidConfiguration = InvalidConfiguration;
|
|
11
|
+
//# sourceMappingURL=exception.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exception.js","sourceRoot":"","sources":["../../src/exception.ts"],"names":[],"mappings":";;;AAEA,MAAa,oBAAqB,SAAQ,KAAK;IAC7C,YAAY,OAAe,EAAS,oBAAoC;QACtE,KAAK,CAAC,OAAO,CAAC,CAAC;QADmB,yBAAoB,GAApB,oBAAoB,CAAgB;IAExE,CAAC;CACF;AAJD,oDAIC"}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,cAAc,+BAA+B,CAAC;AAC9C,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC"}
|
package/lib/cjs/index.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
/**
|
|
18
|
+
* Reexport for simplicity, we dont need to import configuration-common
|
|
19
|
+
* and remember all this packages :)
|
|
20
|
+
*/
|
|
21
|
+
__exportStar(require("@spinajs/configuration-common"), exports);
|
|
22
|
+
__exportStar(require("./sources.js"), exports);
|
|
23
|
+
__exportStar(require("./decorators.js"), exports);
|
|
24
|
+
__exportStar(require("./configuration.js"), exports);
|
|
25
|
+
__exportStar(require("./exception.js"), exports);
|
|
26
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA;;;GAGG;AACH,gEAA8C;AAC9C,+CAA6B;AAC7B,kDAAgC;AAChC,qDAAmC;AACnC,iDAA+B"}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sources.d.ts","sourceRoot":"","sources":["../../src/sources.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,mBAAmB,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAMjF,8BAAsB,cAAe,SAAQ,mBAAmB;IA0BlD,SAAS,CAAC,MAAM,CAAC,EAAE,MAAM;IAAE,SAAS,CAAC,iBAAiB,CAAC,EAAE,MAAM,EAAE;IAAE,SAAS,CAAC,UAAU,CAAC,EAAE,MAAM;IAzB5G;;OAEG;IACI,OAAO,SAAQ;IAEtB,SAAS,CAAC,UAAU,WAYlB;IAEF,SAAS,CAAC,QAAQ,SAAM;IAExB,IAAW,KAAK,WAEf;gBAEqB,MAAM,CAAC,EAAE,MAAM,EAAY,iBAAiB,CAAC,EAAE,MAAM,EAAE,EAAY,UAAU,CAAC,EAAE,MAAM;cAqB5F,IAAI,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC;CA0BrF;AAED,qBACa,YAAa,SAAQ,cAAc;IACjC,IAAI,IAAI,OAAO,CAAC,WAAW,CAAC;CAmB1C;AAED,qBACa,cAAe,SAAQ,cAAc;IACnC,IAAI,IAAI,OAAO,CAAC,WAAW,CAAC;CAkB1C"}
|