@mimik/init 5.0.2 → 5.1.0

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.
Files changed (2) hide show
  1. package/index.js +23 -2
  2. package/package.json +11 -12
package/index.js CHANGED
@@ -96,6 +96,7 @@ module.exports = (app, rootDir, config, validates, cluster, options) => {
96
96
  const buildRequire = pathLib.join(buildDirectory, BUILD_FILENAME);
97
97
  const extractName = options ? options.extractName : null;
98
98
  const metrics = options ? options.metrics : null;
99
+ const oidcOps = options ? options.oidcOps : null;
99
100
  let apiFilename = serverSettings.api;
100
101
  let registration = false;
101
102
 
@@ -127,6 +128,9 @@ module.exports = (app, rootDir, config, validates, cluster, options) => {
127
128
  app.get(METRICS_ROUTE, metricsRoute(options));
128
129
  app.use(startHrTimeSet(metrics.APIRequestDuration));
129
130
  }
131
+ if (oidcOps && typeof oidcOps === 'function') {
132
+ oidcOps();
133
+ }
130
134
  if (extractName) { app.use(extractLogs(config, extractName, options)); }
131
135
  if (apiFilename[0] !== '/') apiFilename = pathLib.join(rootDir, apiFilename);
132
136
  logger.debug('location of the api file', { apiFilename }, correlationIdStart);
@@ -152,8 +156,25 @@ module.exports = (app, rootDir, config, validates, cluster, options) => {
152
156
  .then(() => {
153
157
  server.listen(serverPort, () => {
154
158
  startupHealthInfo(config, correlationIdStart);
155
- if (registration) register(correlationIdStart);
156
- if (options && options.postOps) options.postOps.forEach((ops) => ops(correlationIdStart, config, server));
159
+ const afterPostOps = config.registration.afterPostOpsSet === SET_ON;
160
+
161
+ return Promise.resolve()
162
+ .then(() => {
163
+ if (afterPostOps) {
164
+ if (options && options.postOps) return Promise.each(options.postOps, (ops) => ops(correlationIdStart, config, server));
165
+ return null;
166
+ }
167
+ if (registration) return register(correlationIdStart);
168
+ return null;
169
+ })
170
+ .then(() => {
171
+ if (afterPostOps) {
172
+ if (registration) return register(correlationIdStart);
173
+ return null;
174
+ }
175
+ if (options && options.postOps) return Promise.each(options.postOps, (ops) => ops(correlationIdStart, config, server));
176
+ return null;
177
+ });
157
178
  });
158
179
  });
159
180
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mimik/init",
3
- "version": "5.0.2",
3
+ "version": "5.1.0",
4
4
  "description": "Init process for micro-service",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -30,29 +30,28 @@
30
30
  },
31
31
  "dependencies": {
32
32
  "@mimik/address-helper": "^1.6.10",
33
- "@mimik/api-helper": "^1.0.2",
33
+ "@mimik/api-helper": "^1.0.3",
34
34
  "@mimik/healthcheck": "^1.5.11",
35
35
  "@mimik/oauth-helper": "^3.0.1",
36
36
  "@mimik/public-helper": "^2.0.1",
37
37
  "@mimik/request-helper": "^1.7.10",
38
- "@mimik/response-helper": "^3.0.1",
39
- "@mimik/sumologic-winston-logger": "^1.6.20",
38
+ "@mimik/response-helper": "^3.1.0",
39
+ "@mimik/sumologic-winston-logger": "^1.6.21",
40
40
  "@mimik/systeminfo": "^3.0.1",
41
41
  "bluebird": "3.7.2",
42
42
  "cors": "2.8.5",
43
- "helmet": "7.1.0",
44
- "swagger-tools": "0.10.4"
43
+ "helmet": "7.1.0"
45
44
  },
46
45
  "devDependencies": {
47
46
  "@mimik/eslint-plugin-dependencies": "^2.4.6",
48
47
  "@mimik/eslint-plugin-document-env": "^1.0.6",
49
- "eslint": "8.55.0",
48
+ "eslint": "8.57.0",
50
49
  "eslint-config-airbnb": "19.0.4",
51
- "eslint-plugin-import": "2.29.0",
50
+ "eslint-plugin-import": "2.29.1",
52
51
  "eslint-plugin-jsx-a11y": "6.8.0",
53
- "eslint-plugin-react": "7.33.2",
54
- "eslint-plugin-react-hooks": "4.6.0",
55
- "husky": "8.0.3",
56
- "jsdoc-to-markdown": "8.0.0"
52
+ "eslint-plugin-react": "7.34.2",
53
+ "eslint-plugin-react-hooks": "4.6.2",
54
+ "husky": "9.0.11",
55
+ "jsdoc-to-markdown": "8.0.1"
57
56
  }
58
57
  }