@thzero/library_server 0.18.10 → 0.18.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/boot/index.js +61 -15
- package/package.json +2 -2
- package/service/utility.js +5 -3
package/boot/index.js
CHANGED
|
@@ -75,6 +75,7 @@ class BootMain {
|
|
|
75
75
|
// https://github.com/lorenwest/node-config/wiki
|
|
76
76
|
this._appConfig = new configService(config.get('app'));
|
|
77
77
|
|
|
78
|
+
this._repositoriesPost = new Map();
|
|
78
79
|
this._servicesPost = new Map();
|
|
79
80
|
|
|
80
81
|
const plugins = this._determinePlugins(args);
|
|
@@ -153,15 +154,39 @@ class BootMain {
|
|
|
153
154
|
// this.address = await internalIpV4();
|
|
154
155
|
|
|
155
156
|
await this._initServer(results.server);
|
|
157
|
+
|
|
158
|
+
console.log('----repositories.init.post-------------');
|
|
159
|
+
|
|
160
|
+
for (const [key, value] of this._repositoriesPost) {
|
|
161
|
+
if (value.initPost) {
|
|
162
|
+
console.log(`repositories.init.post - ${key}`);
|
|
163
|
+
await value.initPost();
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
console.log('----repositories.init.post.complete----');
|
|
168
|
+
console.log();
|
|
169
|
+
|
|
170
|
+
console.log('----services.init.post-----------------');
|
|
156
171
|
|
|
157
172
|
for (const [key, value] of this._servicesPost) {
|
|
158
|
-
|
|
159
|
-
|
|
173
|
+
if (value.initPost) {
|
|
174
|
+
console.log(`services.init.post - ${key}`);
|
|
160
175
|
await value.initPost();
|
|
176
|
+
}
|
|
161
177
|
}
|
|
162
|
-
|
|
178
|
+
|
|
179
|
+
console.log('----services.init.post.complete--------');
|
|
180
|
+
console.log();
|
|
181
|
+
|
|
182
|
+
console.log('----services.init.app.post-------------');
|
|
163
183
|
|
|
184
|
+
this._initAppPost(results.app, args);
|
|
185
|
+
|
|
186
|
+
console.log('----services.init.app.post.complete----');
|
|
164
187
|
console.log();
|
|
188
|
+
|
|
189
|
+
console.log('----server.startup.config--------------');
|
|
165
190
|
this.ip = this._appConfig.get('ip', null);
|
|
166
191
|
console.log(`config.ip.override: ${this.ip}`);
|
|
167
192
|
this.port = this._appConfig.get('port');
|
|
@@ -169,7 +194,6 @@ class BootMain {
|
|
|
169
194
|
console.log(`process.env.PORT: ${process.env.PORT}`);
|
|
170
195
|
this.port = process.env.PORT || this.port;
|
|
171
196
|
console.log(`selected.port: ${this.port}`);
|
|
172
|
-
console.log();
|
|
173
197
|
|
|
174
198
|
const self = this;
|
|
175
199
|
const listen = async (port, address) => new Promise((resolve, reject) => {
|
|
@@ -190,6 +214,9 @@ class BootMain {
|
|
|
190
214
|
console.log();
|
|
191
215
|
console.log(`Starting HTTP on: ${this.address}:${this.port}`);
|
|
192
216
|
|
|
217
|
+
console.log('----server.startup.config.complete-----');
|
|
218
|
+
console.log();
|
|
219
|
+
|
|
193
220
|
await this._initServerDiscovery();
|
|
194
221
|
|
|
195
222
|
await this._initServerStart(injector);
|
|
@@ -241,14 +268,21 @@ class BootMain {
|
|
|
241
268
|
|
|
242
269
|
this._repositories = new Map();
|
|
243
270
|
|
|
271
|
+
console.log();
|
|
272
|
+
console.log('----repository.injection-------------------------');
|
|
244
273
|
for (const pluginRepository of plugins)
|
|
245
274
|
await pluginRepository.initRepositories(this._repositories);
|
|
246
275
|
|
|
247
276
|
await this._initRepositories();
|
|
277
|
+
|
|
248
278
|
this._injectRepository(LibraryServerConstants.InjectorKeys.REPOSITORY_USAGE_METRIC, this._initRepositoriesUsageMetrics());
|
|
249
279
|
|
|
280
|
+
console.log('----repository.injection.complete----------------');
|
|
281
|
+
console.log();
|
|
282
|
+
|
|
250
283
|
this._services = new Map();
|
|
251
284
|
|
|
285
|
+
console.log('----services.injection---------------------------');
|
|
252
286
|
this.loggerServiceI = this._initServicesLogger();
|
|
253
287
|
this._initServicesLoggers();
|
|
254
288
|
this._injectService(LibraryCommonServiceConstants.InjectorKeys.SERVICE_LOGGER, this.loggerServiceI);
|
|
@@ -274,11 +308,21 @@ class BootMain {
|
|
|
274
308
|
|
|
275
309
|
await this._initServices();
|
|
276
310
|
|
|
311
|
+
console.log('----services.injection.complete------------------');
|
|
312
|
+
console.log();
|
|
313
|
+
|
|
314
|
+
console.log('----repositories.injection.init------------------');
|
|
277
315
|
for (const [key, value] of this._repositories) {
|
|
278
316
|
console.log(`repositories.init - ${key}`);
|
|
279
317
|
await value.init(injector);
|
|
318
|
+
|
|
319
|
+
this._repositoriesPost.set(key, value);
|
|
280
320
|
}
|
|
281
321
|
|
|
322
|
+
console.log('----repositories.injection.init.complete---------');
|
|
323
|
+
console.log();
|
|
324
|
+
|
|
325
|
+
console.log('----services.injection.init----------------------');
|
|
282
326
|
for (const [key, value] of this._services) {
|
|
283
327
|
console.log(`services.init - ${key}`);
|
|
284
328
|
await value.init(injector);
|
|
@@ -286,13 +330,22 @@ class BootMain {
|
|
|
286
330
|
this._servicesPost.set(key, value);
|
|
287
331
|
}
|
|
288
332
|
|
|
333
|
+
console.log('----services.injection.init.complete-------------');
|
|
334
|
+
console.log();
|
|
335
|
+
|
|
289
336
|
this._services = new Map();
|
|
290
337
|
|
|
338
|
+
console.log('----services.injection.secondary-----------------');
|
|
291
339
|
await this._initServicesSecondary();
|
|
292
340
|
|
|
293
341
|
for (const pluginService of plugins)
|
|
294
342
|
await pluginService.initServicesSecondary(this._services);
|
|
295
343
|
|
|
344
|
+
console.log('----services.injection.secondary.complete--------');
|
|
345
|
+
console.log();
|
|
346
|
+
|
|
347
|
+
console.log('----services.injection.initsecondary-------------');
|
|
348
|
+
|
|
296
349
|
for (const [key, value] of this._services) {
|
|
297
350
|
if (value.initialized)
|
|
298
351
|
continue;
|
|
@@ -303,6 +356,9 @@ class BootMain {
|
|
|
303
356
|
this._servicesPost.set(key, value);
|
|
304
357
|
}
|
|
305
358
|
|
|
359
|
+
console.log('----services.injection.initsecondary.complete----');
|
|
360
|
+
console.log();
|
|
361
|
+
|
|
306
362
|
LibraryMomentUtility.initDateTime();
|
|
307
363
|
}
|
|
308
364
|
finally {
|
|
@@ -435,17 +491,7 @@ class BootMain {
|
|
|
435
491
|
await this.resourceDiscoveryServiceI.initializeDiscovery(await this._initServerDiscoveryOptsResources(opts));
|
|
436
492
|
}
|
|
437
493
|
|
|
438
|
-
async _initServerStart() {
|
|
439
|
-
for(const service of injector.getServices()) {
|
|
440
|
-
if (service.dependency) {
|
|
441
|
-
if (service.dependency && service.dependency.initialize) {
|
|
442
|
-
if (service.dependency.initialize.length === 0) {
|
|
443
|
-
console.log(`services.initialize - ${service.key}`);
|
|
444
|
-
await service.dependency.initialize();
|
|
445
|
-
}
|
|
446
|
-
}
|
|
447
|
-
}
|
|
448
|
-
}
|
|
494
|
+
async _initServerStart(injector) {
|
|
449
495
|
}
|
|
450
496
|
|
|
451
497
|
_injectRepository(key, repository) {
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thzero/library_server",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.18.
|
|
4
|
+
"version": "0.18.11",
|
|
5
5
|
"version_major": 0,
|
|
6
6
|
"version_minor": 18,
|
|
7
|
-
"version_patch":
|
|
7
|
+
"version_patch": 11,
|
|
8
8
|
"version_date": "04/23/2024",
|
|
9
9
|
"description": "An opinionated library of common functionality to bootstrap an API using either Fastify or Koa as the web server.",
|
|
10
10
|
"author": "thZero",
|
package/service/utility.js
CHANGED
|
@@ -129,7 +129,8 @@ class UtilityService extends Service {
|
|
|
129
129
|
const dir = path.join(path.resolve(__dirname), 'node_modules', '@thzero');
|
|
130
130
|
const dirs = await fs.promises.readdir(dir);
|
|
131
131
|
|
|
132
|
-
console.log(
|
|
132
|
+
console.log();
|
|
133
|
+
console.log('\t----open.source.initialization-----------------');
|
|
133
134
|
|
|
134
135
|
let file;
|
|
135
136
|
let importPath;
|
|
@@ -145,7 +146,7 @@ class UtilityService extends Service {
|
|
|
145
146
|
}
|
|
146
147
|
|
|
147
148
|
importPath = ['@thzero', item, 'openSource.js'].join('/');
|
|
148
|
-
console.log(`\t${importPath}...`);
|
|
149
|
+
console.log(`\t\t${importPath}...`);
|
|
149
150
|
fileI = await import(importPath);
|
|
150
151
|
if (!fileI.default) {
|
|
151
152
|
console.log(`\t...failed to load.`);
|
|
@@ -172,7 +173,8 @@ class UtilityService extends Service {
|
|
|
172
173
|
this._logger.warn('UtilityService', '_initializeOopenSource', null, err, correlationId);
|
|
173
174
|
}
|
|
174
175
|
finally {
|
|
175
|
-
console.log(
|
|
176
|
+
console.log('\t----open.source.initialization.complete--------');
|
|
177
|
+
console.log();
|
|
176
178
|
}
|
|
177
179
|
|
|
178
180
|
// response.results = await this._openSourceServer(correlationId);
|