@hahnpro/flow-sdk 4.25.0 → 4.26.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.
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import 'reflect-metadata';
|
|
2
|
-
import { API } from '@hahnpro/hpc-api';
|
|
2
|
+
import { API, MockAPI } from '@hahnpro/hpc-api';
|
|
3
3
|
import { ConsumeMessage } from 'amqplib';
|
|
4
4
|
import { AmqpConnectionManager } from 'amqp-connection-manager';
|
|
5
5
|
import { PartialObserver } from 'rxjs';
|
|
@@ -14,6 +14,7 @@ interface FlowAppConfig {
|
|
|
14
14
|
amqpConnection?: AmqpConnectionManager;
|
|
15
15
|
skipApi?: boolean;
|
|
16
16
|
explicitInit?: boolean;
|
|
17
|
+
mockApi?: MockAPI;
|
|
17
18
|
}
|
|
18
19
|
export declare class FlowApplication {
|
|
19
20
|
private modules;
|
package/dist/FlowApplication.js
CHANGED
|
@@ -19,7 +19,7 @@ const MAX_EVENT_SIZE_BYTES = +process.env.MAX_EVENT_SIZE_BYTES || 512 * 1024;
|
|
|
19
19
|
const WARN_EVENT_PROCESSING_SEC = +process.env.WARN_EVENT_PROCESSING_SEC || 60;
|
|
20
20
|
const WARN_EVENT_QUEUE_SIZE = +process.env.WARN_EVENT_QUEUE_SIZE || 100;
|
|
21
21
|
class FlowApplication {
|
|
22
|
-
constructor(modules, flow, baseLoggerOrConfig, amqpConnection, skipApi, explicitInit) {
|
|
22
|
+
constructor(modules, flow, baseLoggerOrConfig, amqpConnection, skipApi, explicitInit, mockApi) {
|
|
23
23
|
this.modules = modules;
|
|
24
24
|
this.flow = flow;
|
|
25
25
|
this.declarations = {};
|
|
@@ -207,12 +207,14 @@ class FlowApplication {
|
|
|
207
207
|
this.amqpConnection = config.amqpConnection || (0, amqp_1.createAmqpConnection)(config.amqpConfig);
|
|
208
208
|
this.skipApi = config.skipApi || false;
|
|
209
209
|
explicitInit = config.explicitInit || false;
|
|
210
|
+
this._api = config.mockApi || null;
|
|
210
211
|
}
|
|
211
212
|
else {
|
|
212
213
|
this.baseLogger = baseLoggerOrConfig;
|
|
213
214
|
this.amqpConnection = amqpConnection === null || amqpConnection === void 0 ? void 0 : amqpConnection.managedConnection;
|
|
214
215
|
this.skipApi = skipApi || false;
|
|
215
216
|
explicitInit = explicitInit || false;
|
|
217
|
+
this._api = mockApi || null;
|
|
216
218
|
}
|
|
217
219
|
this.logger = new FlowLogger_1.FlowLogger(Object.assign({ id: 'none', functionFqn: 'FlowApplication' }, flow === null || flow === void 0 ? void 0 : flow.context), this.baseLogger || undefined, this.publishEvent);
|
|
218
220
|
process.once('uncaughtException', (err) => {
|
|
@@ -248,7 +250,7 @@ class FlowApplication {
|
|
|
248
250
|
this.context = Object.assign({}, this.flow.context);
|
|
249
251
|
this.properties = this.flow.properties || {};
|
|
250
252
|
try {
|
|
251
|
-
if (!this.skipApi) {
|
|
253
|
+
if (!this.skipApi && !(this._api instanceof hpc_api_1.MockAPI)) {
|
|
252
254
|
this._api = new hpc_api_1.API();
|
|
253
255
|
}
|
|
254
256
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hahnpro/flow-sdk",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.26.0",
|
|
4
4
|
"description": "SDK for building Flow Modules",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": {
|
|
@@ -39,12 +39,12 @@
|
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@types/amqplib": "^0.10.1",
|
|
42
|
-
"@types/jest": "^29.5.
|
|
43
|
-
"@types/lodash": "^4.14.
|
|
44
|
-
"@types/node": "^18.
|
|
42
|
+
"@types/jest": "^29.5.1",
|
|
43
|
+
"@types/lodash": "^4.14.194",
|
|
44
|
+
"@types/node": "^18.16.0",
|
|
45
45
|
"class-validator-jsonschema": "^5.0.0",
|
|
46
46
|
"jest": "^29.5.0",
|
|
47
|
-
"typescript": "^
|
|
47
|
+
"typescript": "^5.0.4"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
50
|
"axios": "1.x",
|