@spinajs/configuration 2.0.46 → 2.0.48
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/configuration.d.ts +1 -0
- package/lib/config/configuration.d.ts.map +1 -0
- package/lib/config/configuration.js +1 -3
- package/lib/config/configuration.js.map +1 -1
- package/lib/configuration.d.ts +7 -6
- package/lib/configuration.d.ts.map +1 -0
- package/lib/configuration.js +49 -76
- package/lib/configuration.js.map +1 -1
- package/lib/decorators.d.ts +1 -0
- package/lib/decorators.d.ts.map +1 -0
- package/lib/decorators.js +13 -19
- package/lib/decorators.js.map +1 -1
- package/lib/exception.d.ts +1 -0
- package/lib/exception.d.ts.map +1 -0
- package/lib/exception.js +1 -5
- package/lib/exception.js.map +1 -1
- package/lib/index.d.ts +5 -4
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +5 -21
- package/lib/index.js.map +1 -1
- package/lib/sources.d.ts +5 -4
- package/lib/sources.d.ts.map +1 -0
- package/lib/sources.js +54 -96
- package/lib/sources.js.map +1 -1
- package/lib/util.d.ts +1 -0
- package/lib/util.d.ts.map +1 -0
- package/lib/util.js +12 -44
- package/lib/util.js.map +1 -1
- package/package.json +61 -55
|
@@ -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"}
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
1
|
const config = {
|
|
4
2
|
configuration: {
|
|
5
3
|
isDevelopment: process.env.NODE_ENV === 'development',
|
|
6
4
|
isProduction: process.env.NODE_ENV === 'production',
|
|
7
5
|
},
|
|
8
6
|
};
|
|
9
|
-
|
|
7
|
+
export default config;
|
|
10
8
|
//# sourceMappingURL=configuration.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"configuration.js","sourceRoot":"","sources":["../../src/config/configuration.ts"],"names":[],"mappings":"
|
|
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,eAAe,MAAM,CAAC"}
|
package/lib/configuration.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Class, Container } from '@spinajs/di';
|
|
2
|
-
import { ConfigurationSource, Configuration, ConfigurationOptions, IConfigurationSchema } from '@spinajs/configuration-common';
|
|
3
1
|
import Ajv from 'ajv';
|
|
4
|
-
import '
|
|
2
|
+
import { ConfigurationSource, Configuration, ConfigurationOptions, IConfigurationSchema } from '@spinajs/configuration-common';
|
|
3
|
+
import { Class, Container } from '@spinajs/di';
|
|
4
|
+
import './sources.js';
|
|
5
5
|
export declare class FrameworkConfiguration extends Configuration {
|
|
6
6
|
/**
|
|
7
7
|
* Apps configuration base dir, where to look for app config
|
|
@@ -17,7 +17,7 @@ export declare class FrameworkConfiguration extends Configuration {
|
|
|
17
17
|
protected Config: Record<string, unknown>;
|
|
18
18
|
protected CustomConfigPaths: string[];
|
|
19
19
|
protected Sources: ConfigurationSource[];
|
|
20
|
-
protected Validator: Ajv;
|
|
20
|
+
protected Validator: Ajv.default;
|
|
21
21
|
protected ValidationSchemas: IConfigurationSchema[];
|
|
22
22
|
get RootConfig(): Record<string, unknown>;
|
|
23
23
|
protected Container: Container;
|
|
@@ -55,8 +55,8 @@ export declare class FrameworkConfiguration extends Configuration {
|
|
|
55
55
|
/**
|
|
56
56
|
* Reloads configuration data
|
|
57
57
|
*/
|
|
58
|
-
|
|
59
|
-
protected
|
|
58
|
+
load(): Promise<void>;
|
|
59
|
+
protected onLoad(): unknown;
|
|
60
60
|
protected loadSources(): void;
|
|
61
61
|
protected validate(): void;
|
|
62
62
|
protected initValidator(): void;
|
|
@@ -71,3 +71,4 @@ export declare class FrameworkConfiguration extends Configuration {
|
|
|
71
71
|
*/
|
|
72
72
|
protected configure(): void;
|
|
73
73
|
}
|
|
74
|
+
//# sourceMappingURL=configuration.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"configuration.d.ts","sourceRoot":"","sources":["../src/configuration.ts"],"names":[],"mappings":"AAIA,OAAO,GAAG,MAAM,KAAK,CAAC;AAItB,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;AAMtB,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,SAAS,CAAC,SAAS,EAAE,GAAG,CAAC,OAAO,CAAC;IAEjC,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;IAiDxB,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;IAwBlB,SAAS,CAAC,aAAa;IA2CvB,SAAS,CAAC,GAAG,CAAC,MAAM,EAAE,MAAM;IAI5B;;OAEG;IACH,SAAS,CAAC,YAAY;IAUtB;;;OAGG;IACH,SAAS,CAAC,SAAS;CASpB"}
|
package/lib/configuration.js
CHANGED
|
@@ -1,56 +1,33 @@
|
|
|
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
1
|
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
19
2
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
20
3
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
21
4
|
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;
|
|
22
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
23
6
|
};
|
|
24
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
25
|
-
if (mod && mod.__esModule) return mod;
|
|
26
|
-
var result = {};
|
|
27
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
28
|
-
__setModuleDefault(result, mod);
|
|
29
|
-
return result;
|
|
30
|
-
};
|
|
31
7
|
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
32
8
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
33
9
|
};
|
|
34
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
35
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
36
|
-
};
|
|
37
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
|
-
exports.FrameworkConfiguration = void 0;
|
|
39
10
|
/* eslint-disable prettier/prettier */
|
|
40
11
|
/* eslint-disable @typescript-eslint/no-var-requires */
|
|
41
12
|
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
13
|
+
import { join, normalize, resolve } from 'path';
|
|
14
|
+
import Ajv from 'ajv';
|
|
15
|
+
import { default as _ } from 'lodash';
|
|
16
|
+
import { InternalLogger } from '@spinajs/internal-logger';
|
|
17
|
+
import { InvalidOperation } from '@spinajs/exceptions';
|
|
18
|
+
import { ConfigurationSource, Configuration, } from '@spinajs/configuration-common';
|
|
19
|
+
import { Autoinject, Container, Injectable } from '@spinajs/di';
|
|
20
|
+
import { InvalidConfiguration } from './exception.js';
|
|
21
|
+
import { mergeArrays, parseArgv } from './util.js';
|
|
22
|
+
import config from './config/configuration.js';
|
|
23
|
+
import './sources.js';
|
|
24
|
+
import { default as ajvMergePath } from 'ajv-merge-patch';
|
|
25
|
+
import { default as ajvFormats } from 'ajv-formats';
|
|
26
|
+
import { default as ajvKeywords } from 'ajv-keywords';
|
|
27
|
+
let FrameworkConfiguration = class FrameworkConfiguration extends Configuration {
|
|
28
|
+
get RootConfig() {
|
|
29
|
+
return this.Config;
|
|
30
|
+
}
|
|
54
31
|
/**
|
|
55
32
|
*
|
|
56
33
|
* @param app - application name, pass it when you run in application mode
|
|
@@ -58,7 +35,6 @@ let FrameworkConfiguration = class FrameworkConfiguration extends configuration_
|
|
|
58
35
|
* @param cfgCustomPaths - custom cfg paths eg. to load config from non standard folders ( usefull in tests )
|
|
59
36
|
*/
|
|
60
37
|
constructor(options) {
|
|
61
|
-
var _a, _b, _c, _d;
|
|
62
38
|
super();
|
|
63
39
|
/**
|
|
64
40
|
* Apps configuration base dir, where to look for app config
|
|
@@ -72,12 +48,9 @@ let FrameworkConfiguration = class FrameworkConfiguration extends configuration_
|
|
|
72
48
|
* Loaded & merged configuration
|
|
73
49
|
*/
|
|
74
50
|
this.Config = {};
|
|
75
|
-
this.CustomConfigPaths =
|
|
76
|
-
this.RunApp =
|
|
77
|
-
this.AppBaseDir =
|
|
78
|
-
}
|
|
79
|
-
get RootConfig() {
|
|
80
|
-
return this.Config;
|
|
51
|
+
this.CustomConfigPaths = options?.cfgCustomPaths ?? [];
|
|
52
|
+
this.RunApp = options?.app ?? parseArgv('--app');
|
|
53
|
+
this.AppBaseDir = options?.appBaseDir ?? parseArgv('--apppath') ?? join(process.cwd(), '../apps/');
|
|
81
54
|
}
|
|
82
55
|
/**
|
|
83
56
|
* Get config value for given property. If value not exists it returns default value, if default value is not provided returns undefined
|
|
@@ -105,32 +78,32 @@ let FrameworkConfiguration = class FrameworkConfiguration extends configuration_
|
|
|
105
78
|
* @param value - value to merge
|
|
106
79
|
*/
|
|
107
80
|
merge(path, value) {
|
|
108
|
-
_.mergeWith(this.get(path), value,
|
|
81
|
+
_.mergeWith(this.get(path), value, mergeArrays);
|
|
109
82
|
}
|
|
110
83
|
async resolve() {
|
|
111
|
-
if (!this.Container.hasRegistered(
|
|
112
|
-
throw new
|
|
84
|
+
if (!this.Container.hasRegistered(ConfigurationSource)) {
|
|
85
|
+
throw new InvalidOperation('No configuration sources configured. Please ensure that config module have any source to read from !');
|
|
113
86
|
}
|
|
114
87
|
if (this.CustomConfigPaths) {
|
|
115
88
|
this.CustomConfigPaths.forEach((p) => {
|
|
116
|
-
|
|
89
|
+
InternalLogger.trace(`Custom config path at: ${p}`, 'Configuration');
|
|
117
90
|
});
|
|
118
91
|
}
|
|
119
92
|
if (this.RunApp) {
|
|
120
|
-
|
|
93
|
+
InternalLogger.trace(`Run app is ${this.RunApp}`, 'Configuration');
|
|
121
94
|
}
|
|
122
|
-
|
|
95
|
+
InternalLogger.trace(`App base dir is ${this.AppBaseDir}`, 'Configuration');
|
|
123
96
|
this.initValidator();
|
|
124
97
|
this.applyAppDirs();
|
|
125
98
|
// add default configuration of this module
|
|
126
99
|
// so we dont need to import it
|
|
127
|
-
this.set('configuration',
|
|
100
|
+
this.set('configuration', config);
|
|
128
101
|
/**
|
|
129
102
|
* Load and validate data from cfg sources
|
|
130
103
|
* in proper order
|
|
131
104
|
*/
|
|
132
105
|
this.loadSources();
|
|
133
|
-
await this.
|
|
106
|
+
await this.load();
|
|
134
107
|
this.validate();
|
|
135
108
|
/**
|
|
136
109
|
* Merge from DI container
|
|
@@ -149,27 +122,27 @@ let FrameworkConfiguration = class FrameworkConfiguration extends configuration_
|
|
|
149
122
|
const sCfg = await source.Load(this);
|
|
150
123
|
this.Sources.push(source);
|
|
151
124
|
if (sCfg) {
|
|
152
|
-
_.mergeWith(sCfg,
|
|
125
|
+
_.mergeWith(sCfg, mergeArrays);
|
|
153
126
|
}
|
|
154
127
|
}
|
|
155
128
|
/**
|
|
156
129
|
* Reloads configuration data
|
|
157
130
|
*/
|
|
158
|
-
async
|
|
131
|
+
async load() {
|
|
159
132
|
this.Config = {};
|
|
160
|
-
_.mergeWith(this.Config, this.
|
|
133
|
+
_.mergeWith(this.Config, this.onLoad(), mergeArrays);
|
|
161
134
|
for (const source of this.Sources) {
|
|
162
135
|
const rCfg = await source.Load(this);
|
|
163
136
|
if (rCfg) {
|
|
164
|
-
_.mergeWith(this.Config, rCfg,
|
|
137
|
+
_.mergeWith(this.Config, rCfg, mergeArrays);
|
|
165
138
|
}
|
|
166
139
|
}
|
|
167
140
|
}
|
|
168
|
-
|
|
141
|
+
onLoad() {
|
|
169
142
|
return null;
|
|
170
143
|
}
|
|
171
144
|
loadSources() {
|
|
172
|
-
this.Sources = this.Container.resolve(Array.ofType(
|
|
145
|
+
this.Sources = this.Container.resolve(Array.ofType(ConfigurationSource), [
|
|
173
146
|
this.RunApp,
|
|
174
147
|
this.CustomConfigPaths,
|
|
175
148
|
this.AppBaseDir,
|
|
@@ -184,20 +157,20 @@ let FrameworkConfiguration = class FrameworkConfiguration extends configuration_
|
|
|
184
157
|
const config = this.get(s.$configurationModule);
|
|
185
158
|
const result = this.Validator.validate(s, config);
|
|
186
159
|
if (!result) {
|
|
187
|
-
const error = new
|
|
160
|
+
const error = new InvalidConfiguration('Validation error', this.Validator.errors);
|
|
188
161
|
this.Validator.errors.forEach((ve) => {
|
|
189
|
-
|
|
162
|
+
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);
|
|
190
163
|
});
|
|
191
164
|
throw error;
|
|
192
165
|
}
|
|
193
166
|
});
|
|
194
167
|
}
|
|
195
168
|
initValidator() {
|
|
196
|
-
this.Validator = new
|
|
169
|
+
this.Validator = new Ajv.default({
|
|
197
170
|
logger: {
|
|
198
|
-
log: (msg) =>
|
|
199
|
-
warn: (msg) =>
|
|
200
|
-
error: (msg) =>
|
|
171
|
+
log: (msg) => InternalLogger.info(msg, 'Configuration'),
|
|
172
|
+
warn: (msg) => InternalLogger.warn(msg, 'Configuration'),
|
|
173
|
+
error: (msg) => InternalLogger.error(msg, 'Configuration'),
|
|
201
174
|
},
|
|
202
175
|
// enable all errors on validation, not only first one that occurred
|
|
203
176
|
allErrors: true,
|
|
@@ -209,11 +182,11 @@ let FrameworkConfiguration = class FrameworkConfiguration extends configuration_
|
|
|
209
182
|
coerceTypes: true,
|
|
210
183
|
});
|
|
211
184
|
// add $merge & $patch for json schema
|
|
212
|
-
|
|
185
|
+
ajvMergePath(this.Validator);
|
|
213
186
|
// add common formats validation eg: date time
|
|
214
|
-
|
|
187
|
+
ajvFormats.default(this.Validator);
|
|
215
188
|
// add keywords
|
|
216
|
-
|
|
189
|
+
ajvKeywords.default(this.Validator);
|
|
217
190
|
// in strict mode ajv will throw when
|
|
218
191
|
// unknown keyword in schema is met
|
|
219
192
|
// we use $configurationModule keyword to identify
|
|
@@ -226,7 +199,7 @@ let FrameworkConfiguration = class FrameworkConfiguration extends configuration_
|
|
|
226
199
|
this.ValidationSchemas = this.Container.get(Array.ofType('__configurationSchema__'), true);
|
|
227
200
|
}
|
|
228
201
|
dir(toJoin) {
|
|
229
|
-
return
|
|
202
|
+
return normalize(join(resolve(this.AppBaseDir), toJoin));
|
|
230
203
|
}
|
|
231
204
|
/**
|
|
232
205
|
* adds app dirs to system.dirs config
|
|
@@ -253,12 +226,12 @@ let FrameworkConfiguration = class FrameworkConfiguration extends configuration_
|
|
|
253
226
|
}
|
|
254
227
|
};
|
|
255
228
|
__decorate([
|
|
256
|
-
|
|
257
|
-
__metadata("design:type",
|
|
229
|
+
Autoinject(),
|
|
230
|
+
__metadata("design:type", Container)
|
|
258
231
|
], FrameworkConfiguration.prototype, "Container", void 0);
|
|
259
232
|
FrameworkConfiguration = __decorate([
|
|
260
|
-
|
|
233
|
+
Injectable(Configuration),
|
|
261
234
|
__metadata("design:paramtypes", [Object])
|
|
262
235
|
], FrameworkConfiguration);
|
|
263
|
-
|
|
236
|
+
export { FrameworkConfiguration };
|
|
264
237
|
//# sourceMappingURL=configuration.js.map
|
package/lib/configuration.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"configuration.js","sourceRoot":"","sources":["../src/configuration.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"configuration.js","sourceRoot":"","sources":["../src/configuration.ts"],"names":[],"mappings":";;;;;;;;;AAAA,sCAAsC;AACtC,uDAAuD;AACvD,sDAAsD;AACtD,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAChD,OAAO,GAAG,MAAM,KAAK,CAAC;AACtB,OAAO,EAAE,OAAO,IAAI,CAAC,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EACL,mBAAmB,EAEnB,aAAa,GAId,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,UAAU,EAAS,SAAS,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEvE,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,MAAM,MAAM,2BAA2B,CAAC;AAC/C,OAAO,cAAc,CAAC;AAEtB,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC1D,O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CAAC,IAAI,IAAI,CAAC,MAAM,IAAI,IAAI,EAAE,CAAC,CAAC,CAAC;SACxF;IACH,CAAC;IAED;;;OAGG;IACO,SAAS;QACjB,KAAK,MAAM,IAAI,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE;YAC3C,MAAM,SAAS,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,IAAI,EAAE,CAAkB,CAAC;YAE1D,IAAI,SAAS,CAAC,SAAS,IAAI,OAAO,SAAS,CAAC,SAAS,KAAK,UAAU,EAAE;gBACpE,SAAS,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;aACjC;SACF;IACH,CAAC;CACF,CAAA;AA/OC;IAAC,UAAU,EAAE;8BACQ,SAAS;yDAAC;AA7BpB,sBAAsB;IADlC,UAAU,CAAC,aAAa,CAAC;;GACb,sBAAsB,CA2QlC;SA3QY,sBAAsB"}
|
package/lib/decorators.d.ts
CHANGED
|
@@ -19,3 +19,4 @@ export declare function Config(path: string, options?: IConfigEntryOptions): (ta
|
|
|
19
19
|
* @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
|
|
20
20
|
*/
|
|
21
21
|
export declare function AutoinjectService(path: string, type?: Class<unknown>): any;
|
|
22
|
+
//# sourceMappingURL=decorators.d.ts.map
|
|
@@ -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,EAAiB,KAAK,EAAuD,MAAM,aAAa,CAAC;AAExG;;;;;;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"}
|
package/lib/decorators.js
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AutoinjectService = exports.Config = void 0;
|
|
4
|
-
const lodash_1 = require("lodash");
|
|
1
|
+
import _ from 'lodash';
|
|
5
2
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
import { Configuration } from '@spinajs/configuration-common';
|
|
4
|
+
import { AddDependency, DI } from '@spinajs/di';
|
|
8
5
|
/**
|
|
9
6
|
* Injects configuration value to given class property
|
|
10
7
|
*
|
|
@@ -12,18 +9,17 @@ const di_1 = require("@spinajs/di");
|
|
|
12
9
|
* @param dafaultValue - default value if path not exists
|
|
13
10
|
* @returns
|
|
14
11
|
*/
|
|
15
|
-
function Config(path, options) {
|
|
12
|
+
export function Config(path, options) {
|
|
16
13
|
return (target, key) => {
|
|
17
14
|
let config = null;
|
|
18
15
|
// register conf, so we can expose eg. in db if config is set
|
|
19
|
-
|
|
16
|
+
DI.register({ path, options }).asValue('__configuration_property__');
|
|
20
17
|
const getter = () => {
|
|
21
|
-
var _a;
|
|
22
18
|
if (!config) {
|
|
23
|
-
config =
|
|
19
|
+
config = DI.get(Configuration);
|
|
24
20
|
}
|
|
25
21
|
// try to return val
|
|
26
|
-
return config.get(path, options ?
|
|
22
|
+
return config.get(path, options ? options.defaultValue ?? undefined : undefined);
|
|
27
23
|
};
|
|
28
24
|
Object.defineProperty(target, key, {
|
|
29
25
|
get: getter,
|
|
@@ -32,7 +28,6 @@ function Config(path, options) {
|
|
|
32
28
|
});
|
|
33
29
|
};
|
|
34
30
|
}
|
|
35
|
-
exports.Config = Config;
|
|
36
31
|
/**
|
|
37
32
|
* Inject service based on configuration.
|
|
38
33
|
* Configuration could be object or string containing service
|
|
@@ -43,10 +38,10 @@ exports.Config = Config;
|
|
|
43
38
|
* @param path - configuration path where service type is stored
|
|
44
39
|
* @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
|
|
45
40
|
*/
|
|
46
|
-
function AutoinjectService(path, type) {
|
|
41
|
+
export function AutoinjectService(path, type) {
|
|
47
42
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
|
48
|
-
return
|
|
49
|
-
const t = type
|
|
43
|
+
return AddDependency((descriptor, target, propertyKey) => {
|
|
44
|
+
const t = type ?? Reflect.getMetadata('design:type', target, propertyKey);
|
|
50
45
|
descriptor.inject.push({
|
|
51
46
|
autoinject: true,
|
|
52
47
|
autoinjectKey: propertyKey,
|
|
@@ -57,18 +52,18 @@ function AutoinjectService(path, type) {
|
|
|
57
52
|
return x.ServiceName || x.constructor.name;
|
|
58
53
|
},
|
|
59
54
|
serviceFunc: (path, container) => {
|
|
60
|
-
const cfg = container.get(
|
|
55
|
+
const cfg = container.get(Configuration);
|
|
61
56
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
62
57
|
const cfgVal = cfg.get(path);
|
|
63
58
|
if (!cfgVal) {
|
|
64
59
|
throw new Error(`Configuration value ${path} is empty`);
|
|
65
60
|
}
|
|
66
|
-
if (
|
|
61
|
+
if (_.isString(cfgVal)) {
|
|
67
62
|
return {
|
|
68
63
|
service: cfgVal,
|
|
69
64
|
};
|
|
70
65
|
}
|
|
71
|
-
if (
|
|
66
|
+
if (_.isArray(cfgVal)) {
|
|
72
67
|
return cfgVal.map((x) => {
|
|
73
68
|
return {
|
|
74
69
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
|
|
@@ -88,5 +83,4 @@ function AutoinjectService(path, type) {
|
|
|
88
83
|
});
|
|
89
84
|
});
|
|
90
85
|
}
|
|
91
|
-
exports.AutoinjectService = AutoinjectService;
|
|
92
86
|
//# sourceMappingURL=decorators.js.map
|
package/lib/decorators.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decorators.js","sourceRoot":"","sources":["../src/decorators.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"decorators.js","sourceRoot":"","sources":["../src/decorators.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,QAAQ,CAAC;AACvB,uDAAuD;AACvD,OAAO,EAAE,aAAa,EAAuB,MAAM,+BAA+B,CAAC;AACnF,OAAO,EAAE,aAAa,EAAS,EAAE,EAAmD,MAAM,aAAa,CAAC;AAExG;;;;;;GAMG;AACH,MAAM,UAAU,MAAM,CAAC,IAAY,EAAE,OAA6B;IAChE,OAAO,CAAC,MAAY,EAAE,GAAY,EAAO,EAAE;QACzC,IAAI,MAAM,GAAkB,IAAI,CAAC;QAEjC,6DAA6D;QAC7D,EAAE,CAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC,OAAO,CAAC,4BAA4B,CAAC,CAAC;QAErE,MAAM,MAAM,GAAG,GAAG,EAAE;YAClB,IAAI,CAAC,MAAM,EAAE;gBACX,MAAM,GAAG,EAAE,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;aAChC;YAED,oBAAoB;YACpB,OAAO,MAAM,CAAC,GAAG,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,YAAY,IAAI,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;QACnF,CAAC,CAAC;QAEF,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,GAAG,EAAE;YACjC,GAAG,EAAE,MAAM;YACX,UAAU,EAAE,KAAK;YACjB,YAAY,EAAE,KAAK;SACpB,CAAC,CAAC;IACL,CAAC,CAAC;AACJ,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,iBAAiB,CAAC,IAAY,EAAE,IAAqB;IACnE,+DAA+D;IAC/D,OAAO,aAAa,CAAC,CAAC,UAA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B,CAAC;YACJ,CAAC;SACF,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC"}
|
package/lib/exception.d.ts
CHANGED
|
@@ -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"}
|
package/lib/exception.js
CHANGED
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.InvalidConfiguration = void 0;
|
|
4
|
-
class InvalidConfiguration extends Error {
|
|
1
|
+
export class InvalidConfiguration extends Error {
|
|
5
2
|
constructor(message, validationExceptions) {
|
|
6
3
|
super(message);
|
|
7
4
|
this.validationExceptions = validationExceptions;
|
|
8
5
|
}
|
|
9
6
|
}
|
|
10
|
-
exports.InvalidConfiguration = InvalidConfiguration;
|
|
11
7
|
//# sourceMappingURL=exception.js.map
|
package/lib/exception.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exception.js","sourceRoot":"","sources":["../src/exception.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"exception.js","sourceRoot":"","sources":["../src/exception.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,oBAAqB,SAAQ,KAAK;IAC7C,YAAY,OAAe,EAAS,oBAAoC;QACtE,KAAK,CAAC,OAAO,CAAC,CAAC;QADmB,yBAAoB,GAApB,oBAAoB,CAAgB;IAExE,CAAC;CACF"}
|
package/lib/index.d.ts
CHANGED
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
* and remember all this packages :)
|
|
4
4
|
*/
|
|
5
5
|
export * from '@spinajs/configuration-common';
|
|
6
|
-
export * from './sources';
|
|
7
|
-
export * from './decorators';
|
|
8
|
-
export * from './configuration';
|
|
9
|
-
export * from './exception';
|
|
6
|
+
export * from './sources.js';
|
|
7
|
+
export * from './decorators.js';
|
|
8
|
+
export * from './configuration.js';
|
|
9
|
+
export * from './exception.js';
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -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/index.js
CHANGED
|
@@ -1,26 +1,10 @@
|
|
|
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
1
|
/**
|
|
18
2
|
* Reexport for simplicity, we dont need to import configuration-common
|
|
19
3
|
* and remember all this packages :)
|
|
20
4
|
*/
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
5
|
+
export * from '@spinajs/configuration-common';
|
|
6
|
+
export * from './sources.js';
|
|
7
|
+
export * from './decorators.js';
|
|
8
|
+
export * from './configuration.js';
|
|
9
|
+
export * from './exception.js';
|
|
26
10
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","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/sources.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ConfigurationSource } from '@spinajs/configuration-common';
|
|
1
|
+
import { ConfigurationSource, IConfigLike } from '@spinajs/configuration-common';
|
|
2
2
|
export declare abstract class BaseFileSource extends ConfigurationSource {
|
|
3
3
|
protected RunApp?: string;
|
|
4
4
|
protected CustomConfigPaths?: string[];
|
|
@@ -11,11 +11,12 @@ export declare abstract class BaseFileSource extends ConfigurationSource {
|
|
|
11
11
|
protected BasePath: string;
|
|
12
12
|
get Order(): number;
|
|
13
13
|
constructor(RunApp?: string, CustomConfigPaths?: string[], appBaseDir?: string);
|
|
14
|
-
protected load(extension: string, callback: (file: string) =>
|
|
14
|
+
protected load(extension: string, callback: (file: string) => Promise<unknown>): Promise<{}>;
|
|
15
15
|
}
|
|
16
16
|
export declare class JsFileSource extends BaseFileSource {
|
|
17
|
-
Load(): Promise<
|
|
17
|
+
Load(): Promise<IConfigLike>;
|
|
18
18
|
}
|
|
19
19
|
export declare class JsonFileSource extends BaseFileSource {
|
|
20
|
-
Load(): Promise<
|
|
20
|
+
Load(): Promise<IConfigLike>;
|
|
21
21
|
}
|
|
22
|
+
//# sourceMappingURL=sources.d.ts.map
|
|
@@ -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"}
|
package/lib/sources.js
CHANGED
|
@@ -1,51 +1,22 @@
|
|
|
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
1
|
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
19
2
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
20
3
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
21
4
|
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;
|
|
22
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
23
6
|
};
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
|
38
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
39
|
-
const di_1 = require("@spinajs/di");
|
|
40
|
-
const glob_1 = require("glob");
|
|
41
|
-
const _ = __importStar(require("lodash"));
|
|
42
|
-
const path_1 = require("path");
|
|
43
|
-
const util_1 = require("./util");
|
|
44
|
-
const fs = __importStar(require("fs"));
|
|
45
|
-
const path = __importStar(require("path"));
|
|
46
|
-
const internal_logger_1 = require("@spinajs/internal-logger");
|
|
47
|
-
const configuration_common_1 = require("@spinajs/configuration-common");
|
|
48
|
-
class BaseFileSource extends configuration_common_1.ConfigurationSource {
|
|
7
|
+
import { Injectable, DI } from '@spinajs/di';
|
|
8
|
+
import glob from 'glob';
|
|
9
|
+
import { default as _ } from 'lodash';
|
|
10
|
+
import { join, normalize, resolve } from 'path';
|
|
11
|
+
import { findBasePath, mergeArrays } from './util.js';
|
|
12
|
+
import * as fs from 'fs';
|
|
13
|
+
import * as path from 'path';
|
|
14
|
+
import { InternalLogger } from '@spinajs/internal-logger';
|
|
15
|
+
import { ConfigurationSource } from '@spinajs/configuration-common';
|
|
16
|
+
export class BaseFileSource extends ConfigurationSource {
|
|
17
|
+
get Order() {
|
|
18
|
+
return 1;
|
|
19
|
+
}
|
|
49
20
|
constructor(RunApp, CustomConfigPaths, appBaseDir) {
|
|
50
21
|
super();
|
|
51
22
|
this.RunApp = RunApp;
|
|
@@ -56,102 +27,89 @@ class BaseFileSource extends configuration_common_1.ConfigurationSource {
|
|
|
56
27
|
*/
|
|
57
28
|
this.BaseDir = './';
|
|
58
29
|
this.CommonDirs = [
|
|
59
|
-
// this module path
|
|
60
|
-
(0, path_1.normalize)((0, path_1.join)((0, path_1.resolve)(__dirname), '/../config')),
|
|
61
30
|
// for tests, in src dir
|
|
62
|
-
|
|
31
|
+
normalize(join(resolve(process.cwd()), 'src', '/config')),
|
|
63
32
|
// other @spinajs modules paths
|
|
64
|
-
'node_modules/@spinajs/*/lib/config',
|
|
33
|
+
normalize(join(resolve(process.cwd()), 'node_modules/@spinajs/*/lib/config')),
|
|
65
34
|
// project paths - last to allow overwrite @spinajs conf
|
|
66
|
-
'lib/config',
|
|
67
|
-
'dist/config',
|
|
68
|
-
'build/config',
|
|
69
|
-
'config',
|
|
35
|
+
normalize(join(resolve(process.cwd()), 'src', 'lib/config')),
|
|
36
|
+
normalize(join(resolve(process.cwd()), 'src', 'dist/config')),
|
|
37
|
+
normalize(join(resolve(process.cwd()), 'src', 'build/config')),
|
|
38
|
+
normalize(join(resolve(process.cwd()), 'src', 'config')),
|
|
70
39
|
];
|
|
71
40
|
this.BasePath = '';
|
|
72
41
|
// try to find root folder with node_modules
|
|
73
42
|
// on server environment
|
|
74
|
-
const bPath =
|
|
43
|
+
const bPath = findBasePath(process.cwd());
|
|
75
44
|
// if we cannot find node_modules folders and base path
|
|
76
45
|
// assume that process working dir is base path
|
|
77
46
|
// eg. on electron environment
|
|
78
47
|
this.BasePath = bPath === null ? process.cwd() : bPath;
|
|
79
|
-
}
|
|
80
|
-
get Order() {
|
|
81
|
-
return 1;
|
|
82
|
-
}
|
|
83
|
-
load(extension, callback) {
|
|
84
|
-
const config = {};
|
|
85
48
|
if (this.RunApp) {
|
|
86
|
-
this.CommonDirs = this.CommonDirs.concat([
|
|
49
|
+
this.CommonDirs = this.CommonDirs.concat([join(this.appBaseDir, `/${this.RunApp}/config`)]);
|
|
87
50
|
}
|
|
88
51
|
if (this.CustomConfigPaths) {
|
|
89
52
|
this.CommonDirs = this.CommonDirs.concat(this.CustomConfigPaths);
|
|
90
53
|
}
|
|
91
|
-
|
|
54
|
+
}
|
|
55
|
+
async load(extension, callback) {
|
|
56
|
+
const config = {};
|
|
57
|
+
const toResolve = this.CommonDirs.map((f) => (path.isAbsolute(f) ? f : join(this.BasePath, f)))
|
|
92
58
|
// get all config files
|
|
93
|
-
.map((d) =>
|
|
59
|
+
.map((d) => {
|
|
60
|
+
return glob.sync(path.join(d, `/**/${extension}`).replace(/\\/g, '/'));
|
|
61
|
+
})
|
|
94
62
|
// flatten files
|
|
95
63
|
.reduce((prev, current) => {
|
|
96
64
|
return prev.concat(_.flattenDeep(current));
|
|
97
65
|
}, [])
|
|
98
66
|
// normalize & resolve paths to be sure
|
|
99
|
-
.map((f) =>
|
|
67
|
+
.map((f) => normalize(resolve(f)))
|
|
100
68
|
.filter((f, index, self) => self.indexOf(f) === index)
|
|
101
|
-
.map(callback)
|
|
69
|
+
.map(callback);
|
|
70
|
+
const result = await Promise.all(toResolve);
|
|
71
|
+
result
|
|
102
72
|
.filter((v) => v !== null)
|
|
103
73
|
// load & merge configs
|
|
104
|
-
.map((c) =>
|
|
74
|
+
.map((c) => _.mergeWith(config, c.default ?? c, mergeArrays));
|
|
105
75
|
return config;
|
|
106
76
|
}
|
|
107
77
|
}
|
|
108
|
-
exports.BaseFileSource = BaseFileSource;
|
|
109
78
|
let JsFileSource = class JsFileSource extends BaseFileSource {
|
|
110
79
|
async Load() {
|
|
111
|
-
|
|
112
|
-
const
|
|
113
|
-
|
|
114
|
-
const
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
}
|
|
118
|
-
else {
|
|
119
|
-
return _.mergeWith(common, this.load('*.prod.js', _load), util_1.mergeArrays);
|
|
120
|
-
}
|
|
121
|
-
function _load(file) {
|
|
80
|
+
const common = await this.load('!(*.dev|*.prod).{cjs,js}', _load);
|
|
81
|
+
const dEnv = DI.get('process.env') ?? process.env;
|
|
82
|
+
const fExt = dEnv.NODE_ENV && dEnv.NODE_ENV === 'development' ? '*.dev.{cjs,js}' : '*.prod.{cjs,js}';
|
|
83
|
+
const env = await this.load(fExt, _load);
|
|
84
|
+
return _.mergeWith(common, env, mergeArrays);
|
|
85
|
+
async function _load(file) {
|
|
122
86
|
try {
|
|
123
|
-
(
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
return require(file);
|
|
87
|
+
InternalLogger.trace(`Trying to load file ${file}`, 'Configuration');
|
|
88
|
+
const res = (await import(`file://${file}`));
|
|
89
|
+
return res.default;
|
|
127
90
|
}
|
|
128
91
|
catch (err) {
|
|
129
|
-
|
|
92
|
+
InternalLogger.error(err, `error loading configuration file ${file}`, 'configuration');
|
|
130
93
|
return null;
|
|
131
94
|
}
|
|
132
95
|
}
|
|
133
96
|
}
|
|
134
97
|
};
|
|
135
98
|
JsFileSource = __decorate([
|
|
136
|
-
|
|
99
|
+
Injectable(ConfigurationSource)
|
|
137
100
|
], JsFileSource);
|
|
138
|
-
|
|
101
|
+
export { JsFileSource };
|
|
139
102
|
let JsonFileSource = class JsonFileSource extends BaseFileSource {
|
|
140
103
|
async Load() {
|
|
141
|
-
|
|
142
|
-
const
|
|
143
|
-
|
|
144
|
-
const
|
|
145
|
-
|
|
146
|
-
return _.mergeWith(common, this.load('*.dev.json', _load), util_1.mergeArrays);
|
|
147
|
-
}
|
|
148
|
-
else {
|
|
149
|
-
return _.mergeWith(common, this.load('*.prod.json', _load), util_1.mergeArrays);
|
|
150
|
-
}
|
|
104
|
+
const common = await this.load('!(*.dev|*.prod).json', _load);
|
|
105
|
+
const dEnv = DI.get('process.env') ?? process.env;
|
|
106
|
+
const fExt = dEnv.NODE_ENV && dEnv.NODE_ENV === 'development' ? '*.dev.json' : '*.prod.json';
|
|
107
|
+
const env = await this.load(fExt, _load);
|
|
108
|
+
return _.mergeWith(common, env, mergeArrays);
|
|
151
109
|
function _load(file) {
|
|
152
110
|
try {
|
|
153
|
-
|
|
154
|
-
return JSON.parse(fs.readFileSync(file, 'utf-8'));
|
|
111
|
+
InternalLogger.trace(`Trying to load file ${file}`, 'Configuration');
|
|
112
|
+
return Promise.resolve(JSON.parse(fs.readFileSync(file, 'utf-8')));
|
|
155
113
|
}
|
|
156
114
|
catch (err) {
|
|
157
115
|
console.error(`error loading configuration file ${file}, reasoun: ${err.message}`);
|
|
@@ -161,7 +119,7 @@ let JsonFileSource = class JsonFileSource extends BaseFileSource {
|
|
|
161
119
|
}
|
|
162
120
|
};
|
|
163
121
|
JsonFileSource = __decorate([
|
|
164
|
-
|
|
122
|
+
Injectable(ConfigurationSource)
|
|
165
123
|
], JsonFileSource);
|
|
166
|
-
|
|
124
|
+
export { JsonFileSource };
|
|
167
125
|
//# sourceMappingURL=sources.js.map
|
package/lib/sources.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sources.js","sourceRoot":"","sources":["../src/sources.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"sources.js","sourceRoot":"","sources":["../src/sources.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,EAAE,EAAE,MAAM,aA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a,CAAC;QAC7F,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QACzC,OAAO,CAAC,CAAC,SAAS,CAAC,MAAM,EAAE,GAAG,EAAE,WAAW,CAAC,CAAC;QAE7C,SAAS,KAAK,CAAC,IAAY;YACzB,IAAI;gBACF,cAAc,CAAC,KAAK,CAAC,uBAAuB,IAAI,EAAE,EAAE,eAAe,CAAC,CAAC;gBAErE,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,IAAI,EAAE,OAAO,CAAC,CAAY,CAAC,CAAC;aAC/E;YAAC,OAAO,GAAG,EAAE;gBACZ,OAAO,CAAC,KAAK,CAAC,oCAAoC,IAAI,cAAe,GAAa,CAAC,OAAO,EAAE,CAAC,CAAC;gBAC9F,OAAO,IAAI,CAAC;aACb;QACH,CAAC;IACH,CAAC;CACF,CAAA;AAnBY,cAAc;IAD1B,UAAU,CAAC,mBAAmB,CAAC;GACnB,cAAc,CAmB1B;SAnBY,cAAc"}
|
package/lib/util.d.ts
CHANGED
|
@@ -4,3 +4,4 @@ export declare function merge(to: unknown, from: unknown): unknown;
|
|
|
4
4
|
export declare function mergeArrays(target: unknown[], source: unknown[]): unknown;
|
|
5
5
|
export declare function uncache(file: string): string;
|
|
6
6
|
export declare function filterDirs(dir: string): boolean;
|
|
7
|
+
//# sourceMappingURL=util.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../src/util.ts"],"names":[],"mappings":"AAYA,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAQ/C;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAcjD;AAED,wBAAgB,KAAK,CAAC,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,GAAG,OAAO,CAWzD;AAED,wBAAgB,WAAW,CAAC,MAAM,EAAE,OAAO,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,CAIzE;AAID,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,UAGnC;AAED,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,WAKrC"}
|
package/lib/util.js
CHANGED
|
@@ -1,56 +1,28 @@
|
|
|
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.filterDirs = exports.uncache = exports.mergeArrays = exports.merge = exports.findBasePath = exports.parseArgv = void 0;
|
|
27
1
|
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
|
28
2
|
/* eslint-disable @typescript-eslint/unbound-method */
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
function parseArgv(param) {
|
|
3
|
+
import * as fs from 'fs';
|
|
4
|
+
import _ from 'lodash';
|
|
5
|
+
import { dirname, join, resolve } from 'path';
|
|
6
|
+
export function parseArgv(param) {
|
|
33
7
|
const index = process.argv.indexOf(param);
|
|
34
8
|
if (index === -1 || process.argv.length <= index + 1) {
|
|
35
9
|
return undefined;
|
|
36
10
|
}
|
|
37
11
|
return process.argv[index + 1];
|
|
38
12
|
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
if (fs.existsSync((0, path_1.join)(path, 'node_modules'))) {
|
|
13
|
+
export function findBasePath(path) {
|
|
14
|
+
if (fs.existsSync(join(path, 'node_modules'))) {
|
|
42
15
|
return path;
|
|
43
16
|
}
|
|
44
|
-
const parentPath =
|
|
17
|
+
const parentPath = dirname(path);
|
|
45
18
|
// if we reach root eg c:\
|
|
46
19
|
// and nothing is found return null
|
|
47
20
|
if (parentPath === path) {
|
|
48
21
|
return null;
|
|
49
22
|
}
|
|
50
|
-
return findBasePath(
|
|
23
|
+
return findBasePath(resolve(path, '..'));
|
|
51
24
|
}
|
|
52
|
-
|
|
53
|
-
function merge(to, from) {
|
|
25
|
+
export function merge(to, from) {
|
|
54
26
|
_.mergeWith(to, from, (src, dest) => {
|
|
55
27
|
if (_.isArray(src) && _.isArray(dest)) {
|
|
56
28
|
const tmp = src.concat(dest);
|
|
@@ -62,25 +34,21 @@ function merge(to, from) {
|
|
|
62
34
|
});
|
|
63
35
|
return to;
|
|
64
36
|
}
|
|
65
|
-
|
|
66
|
-
function mergeArrays(target, source) {
|
|
37
|
+
export function mergeArrays(target, source) {
|
|
67
38
|
if (_.isArray(target)) {
|
|
68
39
|
return target.concat(source);
|
|
69
40
|
}
|
|
70
41
|
}
|
|
71
|
-
exports.mergeArrays = mergeArrays;
|
|
72
42
|
// clean require cache config
|
|
73
43
|
// http://stackoverflow.com/questions/9210542/node-js-require-cache-possible-to-invalidate
|
|
74
|
-
function uncache(file) {
|
|
44
|
+
export function uncache(file) {
|
|
75
45
|
delete require.cache[`${file}`];
|
|
76
46
|
return file;
|
|
77
47
|
}
|
|
78
|
-
|
|
79
|
-
function filterDirs(dir) {
|
|
48
|
+
export function filterDirs(dir) {
|
|
80
49
|
if (fs.existsSync(dir)) {
|
|
81
50
|
return true;
|
|
82
51
|
}
|
|
83
52
|
return false;
|
|
84
53
|
}
|
|
85
|
-
exports.filterDirs = filterDirs;
|
|
86
54
|
//# sourceMappingURL=util.js.map
|
package/lib/util.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.js","sourceRoot":"","sources":["../src/util.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"util.js","sourceRoot":"","sources":["../src/util.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,sDAAsD;AACtD,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,CAAC,MAAM,QAAQ,CAAC;AACvB,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAQ9C,MAAM,UAAU,SAAS,CAAC,KAAa;IACrC,MAAM,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IAE1C,IAAI,KAAK,KAAK,CAAC,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,MAAM,IAAI,KAAK,GAAG,CAAC,EAAE;QACpD,OAAO,SAAS,CAAC;KAClB;IAED,OAAO,OAAO,CAAC,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;AACjC,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,IAAY;IACvC,IAAI,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,EAAE,cAAc,CAAC,CAAC,EAAE;QAC7C,OAAO,IAAI,CAAC;KACb;IAED,MAAM,UAAU,GAAG,OAAO,CAA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+1,61 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@spinajs/configuration",
|
|
3
|
-
"version": "2.0.
|
|
4
|
-
"description": "framework configuration module",
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
|
|
9
|
-
"
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
"
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
"
|
|
24
|
-
|
|
25
|
-
"
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
"
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
"di"
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
"
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
"@
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
"
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "@spinajs/configuration",
|
|
3
|
+
"version": "2.0.48",
|
|
4
|
+
"description": "framework configuration module",
|
|
5
|
+
"exports": "./lib/index.js",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"private": false,
|
|
8
|
+
"engines": {
|
|
9
|
+
"node": ">=16.11"
|
|
10
|
+
},
|
|
11
|
+
"scripts": {
|
|
12
|
+
"build": "npm run clean && npm run compile",
|
|
13
|
+
"compile": "tsc -b tsconfig.json",
|
|
14
|
+
"rimraf": "./node_modules/rimraf/bin.js",
|
|
15
|
+
"clean": "rimraf lib/ && rimraf tsconfig.tsbuildinfo",
|
|
16
|
+
"test": "ts-mocha -p tsconfig.json test/**/*.test.ts",
|
|
17
|
+
"coverage": "nyc npm run test",
|
|
18
|
+
"build-docs": "rimraf docs && typedoc --options typedoc.json src/",
|
|
19
|
+
"format": "prettier --write \"src/**/*.ts\"",
|
|
20
|
+
"lint": "eslint -c .eslintrc.cjs --ext .ts src --fix",
|
|
21
|
+
"preversion": "npm run lint",
|
|
22
|
+
"version": "npm run format && git add -A src",
|
|
23
|
+
"postinstall": "npm run build"
|
|
24
|
+
},
|
|
25
|
+
"files": [
|
|
26
|
+
"lib/**/*"
|
|
27
|
+
],
|
|
28
|
+
"types": "lib",
|
|
29
|
+
"repository": {
|
|
30
|
+
"type": "git",
|
|
31
|
+
"url": "git+https://github.com/spinajs/configuration.git"
|
|
32
|
+
},
|
|
33
|
+
"keywords": [
|
|
34
|
+
"di",
|
|
35
|
+
"container",
|
|
36
|
+
"spinajs",
|
|
37
|
+
"di"
|
|
38
|
+
],
|
|
39
|
+
"author": "SpinaJS <spinajs@coderush.pl> (https://github.com/spinajs/core)",
|
|
40
|
+
"license": "MIT",
|
|
41
|
+
"bugs": {
|
|
42
|
+
"url": "https://github.com/spinajs/configuration/issues"
|
|
43
|
+
},
|
|
44
|
+
"homepage": "https://github.com/spinajs/configuration#readme",
|
|
45
|
+
"devDependencies": {
|
|
46
|
+
"@types/ajv-merge-patch": "^4.1.2"
|
|
47
|
+
},
|
|
48
|
+
"dependencies": {
|
|
49
|
+
"@spinajs/configuration-common": "^2.0.46",
|
|
50
|
+
"@spinajs/di": "^2.0.46",
|
|
51
|
+
"@spinajs/exceptions": "^2.0.39",
|
|
52
|
+
"@spinajs/internal-logger": "^2.0.46",
|
|
53
|
+
"ajv": "^8.12.0",
|
|
54
|
+
"ajv-formats": "^2.1.1",
|
|
55
|
+
"ajv-keywords": "^5.1.0",
|
|
56
|
+
"ajv-merge-patch": "^5.0.1",
|
|
57
|
+
"glob": "^8.1.0",
|
|
58
|
+
"lodash": "^4.17.21"
|
|
59
|
+
},
|
|
60
|
+
"gitHead": "002dc553b0ffffd72193d0121ac425a4083bc9ee"
|
|
61
|
+
}
|