@onlineapps/service-wrapper 3.0.10 → 3.0.12

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onlineapps/service-wrapper",
3
- "version": "3.0.10",
3
+ "version": "3.0.12",
4
4
  "description": "Thin orchestration layer for microservices - delegates all infrastructure concerns to specialized connectors",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -93,31 +93,31 @@ class ErrorMapper {
93
93
  if (err instanceof ValidationError) {
94
94
  if (err.phase === 'output') {
95
95
  this._logger.error(
96
- { err, operation, correlation_id, code: 'INTERNAL_ERROR', status: 500 },
97
- 'output schema validation failed - server bug'
96
+ 'output schema validation failed - server bug',
97
+ { err, operation, correlation_id, code: 'INTERNAL_ERROR', status: 500 }
98
98
  );
99
99
  return this._buildError(500, 'INTERNAL_ERROR', 'Internal validation error', undefined, correlation_id);
100
100
  }
101
101
 
102
102
  this._logger.info(
103
- { err, operation, correlation_id, code: 'VALIDATION_FAILED', status: 400 },
104
- 'input schema validation failed'
103
+ 'input schema validation failed',
104
+ { err, operation, correlation_id, code: 'VALIDATION_FAILED', status: 400 }
105
105
  );
106
106
  return this._buildError(400, 'VALIDATION_FAILED', err.message, err.details, correlation_id);
107
107
  }
108
108
 
109
109
  if (err instanceof UnknownOperationError) {
110
110
  this._logger.warn(
111
- { err, operation, correlation_id, code: 'UNKNOWN_OPERATION', status: 404 },
112
- 'unknown operation requested'
111
+ 'unknown operation requested',
112
+ { err, operation, correlation_id, code: 'UNKNOWN_OPERATION', status: 404 }
113
113
  );
114
114
  return this._buildError(404, 'UNKNOWN_OPERATION', err.message, undefined, correlation_id);
115
115
  }
116
116
 
117
117
  if (err instanceof BusinessError) {
118
118
  this._logger.info(
119
- { err, operation, correlation_id, code: err.code, status: err.status },
120
- 'handler raised BusinessError'
119
+ 'handler raised BusinessError',
120
+ { err, operation, correlation_id, code: err.code, status: err.status }
121
121
  );
122
122
  return this._buildError(err.status, err.code, err.message, err.details, correlation_id);
123
123
  }
@@ -125,15 +125,15 @@ class ErrorMapper {
125
125
  if (err instanceof AbortError || (err && err.name === 'AbortError')) {
126
126
  const message = err && err.message ? err.message : 'Invocation aborted';
127
127
  this._logger.info(
128
- { err, operation, correlation_id, code: 'CLIENT_CANCELLED', status: 499 },
129
- 'invocation aborted by client'
128
+ 'invocation aborted by client',
129
+ { err, operation, correlation_id, code: 'CLIENT_CANCELLED', status: 499 }
130
130
  );
131
131
  return this._buildError(499, 'CLIENT_CANCELLED', message, undefined, correlation_id);
132
132
  }
133
133
 
134
134
  this._logger.error(
135
- { err, operation, correlation_id, code: 'INTERNAL_ERROR', status: 500, stack: err && err.stack },
136
- 'unhandled error during operation invocation'
135
+ 'unhandled error during operation invocation',
136
+ { err, operation, correlation_id, code: 'INTERNAL_ERROR', status: 500, stack: err && err.stack }
137
137
  );
138
138
  return this._buildError(500, 'INTERNAL_ERROR', 'An internal error occurred', undefined, correlation_id);
139
139
  }
@@ -2067,12 +2067,13 @@ class ServiceWrapper {
2067
2067
 
2068
2068
  this._contextBuilder = new ContextBuilder({
2069
2069
  connectors: {
2070
- storage: this.stateConnector || null,
2070
+ storage: null,
2071
2071
  cache: this.cacheConnector || null,
2072
2072
  http: null,
2073
2073
  secrets: null,
2074
2074
  monitoring: this.monitoring || null,
2075
- mq: this.mqClient || null
2075
+ mq: this.mqClient || null,
2076
+ state: this.stateConnector || null
2076
2077
  },
2077
2078
  config: this.config,
2078
2079
  logger