@golemio/core 1.2.7-dev.527897314 → 1.2.7
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/README.md +1 -6
- package/dist/input-gateway/connectors/AMQPConnector.js +1 -5
- package/dist/input-gateway/connectors/AMQPConnector.js.map +1 -1
- package/dist/integration-engine/connectors/AMQPConnector.js +3 -8
- package/dist/integration-engine/connectors/AMQPConnector.js.map +1 -1
- package/dist/integration-engine/helpers/GeocodeApi.d.ts +1 -1
- package/dist/integration-engine/queueprocessors/QueueProcessor.d.ts +1 -1
- package/dist/integration-engine/queueprocessors/QueueProcessor.js +2 -9
- package/dist/integration-engine/queueprocessors/QueueProcessor.js.map +1 -1
- package/dist/integration-engine/workers/BaseWorker.js +2 -9
- package/dist/integration-engine/workers/BaseWorker.js.map +1 -1
- package/package.json +133 -133
- package/tsconfig.base.json +2 -1
- package/dist/helpers/data-access/amqp/AlternateExchangeCreator.d.ts +0 -7
- package/dist/helpers/data-access/amqp/AlternateExchangeCreator.js +0 -31
- package/dist/helpers/data-access/amqp/AlternateExchangeCreator.js.map +0 -1
package/README.md
CHANGED
|
@@ -80,6 +80,7 @@ yarn dev-start
|
|
|
80
80
|
|
|
81
81
|
Now you can change code and immediately see the results.
|
|
82
82
|
|
|
83
|
+
|
|
83
84
|
## Tests
|
|
84
85
|
|
|
85
86
|
To run all test defined in /test directory simply run this command:
|
|
@@ -91,12 +92,6 @@ yarn test
|
|
|
91
92
|
from the application's root directory. All tests should pass.
|
|
92
93
|
|
|
93
94
|
|
|
94
|
-
## Rabbit MQ
|
|
95
|
-
|
|
96
|
-
Core module defines main exchange in rabbit mq and its name is dependent on .env setting. Also it contains definition of queue for dead messages. All other queues are defined in separate modules and loaded dynamically by `QueueProcessor.ts`.
|
|
97
|
-
|
|
98
|
-
Core module also defines alternate exchange for messages that are unroutable. Name of the exchage is created from name of the main one with suffix `-alt` and it contains 1 queue named `alt-routes`.
|
|
99
|
-
|
|
100
95
|
## Contribution guidelines
|
|
101
96
|
|
|
102
97
|
Please read `CONTRIBUTING.md`.
|
|
@@ -17,7 +17,6 @@ const errors_1 = require("@golemio/errors");
|
|
|
17
17
|
const amqplib_1 = __importDefault(require("amqplib"));
|
|
18
18
|
const config_1 = require("../config");
|
|
19
19
|
const helpers_1 = require("../helpers");
|
|
20
|
-
const AlternateExchangeCreator_1 = __importDefault(require("../../helpers/data-access/amqp/AlternateExchangeCreator"));
|
|
21
20
|
/**
|
|
22
21
|
* Class for connecting to RabbitMQ. Using amqplib https://www.npmjs.com/package/amqplib
|
|
23
22
|
*/
|
|
@@ -100,10 +99,7 @@ class MyAMQP {
|
|
|
100
99
|
*/
|
|
101
100
|
assertDeadQueue(channel) {
|
|
102
101
|
return __awaiter(this, void 0, void 0, function* () {
|
|
103
|
-
yield channel.assertExchange(config_1.config.rabbit_exchange_name, "topic", {
|
|
104
|
-
durable: false,
|
|
105
|
-
alternateExchange: AlternateExchangeCreator_1.default.getAltExchangeName(config_1.config.rabbit_exchange_name),
|
|
106
|
-
});
|
|
102
|
+
yield channel.assertExchange(config_1.config.rabbit_exchange_name, "topic", { durable: false });
|
|
107
103
|
const q = yield channel.assertQueue(config_1.config.rabbit_exchange_name + ".deadqueue", {
|
|
108
104
|
durable: true,
|
|
109
105
|
messageTtl: 3 * 24 * 60 * 60 * 1000, // 3 days in milliseconds
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AMQPConnector.js","sourceRoot":"","sources":["../../../src/input-gateway/connectors/AMQPConnector.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,4CAA4D;AAC5D,sDAA8B;AAC9B,sCAAoC;AACpC,wCAAkC;
|
|
1
|
+
{"version":3,"file":"AMQPConnector.js","sourceRoot":"","sources":["../../../src/input-gateway/connectors/AMQPConnector.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,4CAA4D;AAC5D,sDAA8B;AAC9B,sCAAoC;AACpC,wCAAkC;AAElC;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OAAwB;;YAClD,MAAM,OAAO,CAAC,cAAc,CAAC,eAAM,CAAC,oBAA8B,EAAE,OAAO,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC;YACjG,MAAM,CAAC,GAAG,MAAM,OAAO,CAAC,WAAW,CAAC,eAAM,CAAC,oBAAoB,GAAG,YAAY,EAAE;gBAC5E,OAAO,EAAE,IAAI;gBACb,UAAU,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,EAAE,yBAAyB;aACjE,CAAC,CAAC;YACH,MAAM,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,EAAE,eAAM,CAAC,oBAA8B,EAAE,MAAM,CAAC,CAAC;QACpF,CAAC;KAAA;CAYJ;AAED,MAAM,aAAa,GAAG,IAAI,MAAM,EAAE,CAAC;AAE1B,sCAAa"}
|
|
@@ -13,11 +13,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.AMQPConnector = void 0;
|
|
16
|
-
const AlternateExchangeCreator_1 = __importDefault(require("../../helpers/data-access/amqp/AlternateExchangeCreator"));
|
|
17
|
-
const config_1 = require("../config");
|
|
18
|
-
const helpers_1 = require("../helpers");
|
|
19
16
|
const errors_1 = require("@golemio/errors");
|
|
20
17
|
const amqplib_1 = __importDefault(require("amqplib"));
|
|
18
|
+
const config_1 = require("../config");
|
|
19
|
+
const helpers_1 = require("../helpers");
|
|
21
20
|
class MyAMQP {
|
|
22
21
|
constructor() {
|
|
23
22
|
this.connect = () => __awaiter(this, void 0, void 0, function* () {
|
|
@@ -52,7 +51,6 @@ class MyAMQP {
|
|
|
52
51
|
}
|
|
53
52
|
});
|
|
54
53
|
helpers_1.log.info("[AMQP] Connected to Queue!");
|
|
55
|
-
yield AlternateExchangeCreator_1.default.createAlternateExchange(this.channel, config_1.config.RABBIT_EXCHANGE_NAME);
|
|
56
54
|
yield this.assertDeadQueue(this.channel);
|
|
57
55
|
return this.channel;
|
|
58
56
|
}
|
|
@@ -70,10 +68,7 @@ class MyAMQP {
|
|
|
70
68
|
if (!config_1.config.RABBIT_EXCHANGE_NAME) {
|
|
71
69
|
throw new errors_1.CustomError("[AMQP] The ENV variable RABBIT_EXCHANGE_NAME cannot be undefined.", true, this.constructor.name, 6003);
|
|
72
70
|
}
|
|
73
|
-
yield channel.assertExchange(config_1.config.RABBIT_EXCHANGE_NAME, "topic", {
|
|
74
|
-
durable: false,
|
|
75
|
-
alternateExchange: AlternateExchangeCreator_1.default.getAltExchangeName(config_1.config.RABBIT_EXCHANGE_NAME),
|
|
76
|
-
});
|
|
71
|
+
yield channel.assertExchange(config_1.config.RABBIT_EXCHANGE_NAME, "topic", { durable: false });
|
|
77
72
|
const q = yield channel.assertQueue(config_1.config.RABBIT_EXCHANGE_NAME + ".deadqueue", {
|
|
78
73
|
durable: true,
|
|
79
74
|
messageTtl: 3 * 24 * 60 * 60 * 1000, // 3 days in milliseconds
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AMQPConnector.js","sourceRoot":"","sources":["../../../src/integration-engine/connectors/AMQPConnector.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"AMQPConnector.js","sourceRoot":"","sources":["../../../src/integration-engine/connectors/AMQPConnector.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,4CAA4D;AAC5D,sDAA8C;AAC9C,sCAAoC;AACpC,wCAAkC;AAElC,MAAM,MAAM;IAKR;QAIO,YAAO,GAAG,GAAmC,EAAE;YAClD,IAAI;gBACA,IAAI,IAAI,CAAC,OAAO,EAAE;oBACd,OAAO,IAAI,CAAC,OAAO,CAAC;iBACvB;gBAED,IAAI,CAAC,eAAM,CAAC,WAAW,EAAE;oBACrB,MAAM,IAAI,oBAAW,CACjB,0DAA0D,EAC1D,IAAI,EACJ,IAAI,CAAC,WAAW,C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,CAAC,CAAC;QAC/E,CAAC,CAAA,CAAC;QAEK,eAAU,GAAG,GAAwB,EAAE;;YAC1C,aAAG,CAAC,IAAI,CAAC,0BAA0B,CAAC,CAAC;YACrC,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC;YAC7B,MAAM,CAAA,MAAA,IAAI,CAAC,OAAO,0CAAE,KAAK,EAAE,CAAA,CAAC;YAC5B,MAAM,CAAA,MAAA,IAAI,CAAC,UAAU,0CAAE,KAAK,EAAE,CAAA,CAAC;QACnC,CAAC,CAAA,CAAC;QA7FE,IAAI,CAAC,gBAAgB,GAAG,KAAK,CAAC;IAClC,CAAC;CA6FJ;AAED,MAAM,aAAa,GAAG,IAAI,MAAM,EAAE,CAAC;AAE1B,sCAAa"}
|
|
@@ -8,16 +8,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
12
|
exports.QueueProcessor = void 0;
|
|
16
|
-
const
|
|
13
|
+
const errors_1 = require("@golemio/errors");
|
|
17
14
|
const config_1 = require("../config");
|
|
18
15
|
const helpers_1 = require("../helpers");
|
|
19
16
|
const sentry_transactions_1 = require("../../monitoring/sentry/sentry-transactions");
|
|
20
|
-
const errors_1 = require("@golemio/errors");
|
|
21
17
|
class QueueProcessor {
|
|
22
18
|
constructor(channel, definition) {
|
|
23
19
|
/**
|
|
@@ -71,10 +67,7 @@ class QueueProcessor {
|
|
|
71
67
|
throw new errors_1.CustomError("[AMQP] The ENV variable RABBIT_EXCHANGE_NAME cannot be undefined.", true, this.constructor.name, 6003);
|
|
72
68
|
}
|
|
73
69
|
// Create exchange if not exists
|
|
74
|
-
yield this.channel.assertExchange(config_1.config.RABBIT_EXCHANGE_NAME, "topic", {
|
|
75
|
-
durable: false,
|
|
76
|
-
alternateExchange: AlternateExchangeCreator_1.default.getAltExchangeName(config_1.config.RABBIT_EXCHANGE_NAME),
|
|
77
|
-
});
|
|
70
|
+
yield this.channel.assertExchange(config_1.config.RABBIT_EXCHANGE_NAME, "topic", { durable: false });
|
|
78
71
|
// Create queue
|
|
79
72
|
const q = yield this.channel.assertQueue(name, Object.assign(Object.assign({}, queueOptions), { durable: true }));
|
|
80
73
|
// This tells RabbitMQ not to give more than one message to a worker at a time.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"QueueProcessor.js","sourceRoot":"","sources":["../../../src/integration-engine/queueprocessors/QueueProcessor.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"QueueProcessor.js","sourceRoot":"","sources":["../../../src/integration-engine/queueprocessors/QueueProcessor.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,4CAA8C;AAE9C,sCAAoC;AACpC,wCAAuF;AAEvF,qFAAiF;AAEjF,MAAa,cAAc;IAIvB,YAAY,OAAwB,EAAE,UAA4B;QAKlE;;WAEG;QACI,mBAAc,GAAG,GAAwB,EAAE;YAC9C,MAAM,QAAQ,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE;gBAC9C,OAAO,IAAI,CAAC,aAAa,CACrB,IAAI,CAAC,UAAU,CAAC,WAAW,GAAG,GAAG,GAAG,CAAC,CAAC,IAAI,EAAE,aAAa;gBACzD,IAAI,GAAG,IAAI,CAAC,UAAU,CAAC,WAAW,GAAG,GAAG,GAAG,CAAC,CAAC,IAAI,EAAE,qBAAqB;gBACxE,CAAC,CAAC,qBAAqB,CAAC,kBAAkB;oBACtC,CAAC,CAAC,CAAC,CAAC,qBAAqB,CAAC,mCAAmC;oBAC7D,CAAC,CAAC,CAAO,GAAG,EAAE,EAAE;wBACV,oBAAoB;wB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AC;QAClE,CAAC,CAAA,CAAC;QArFE,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;IACjC,CAAC;CAoFJ;AA3FD,wCA2FC"}
|
|
@@ -8,25 +8,18 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
12
|
exports.BaseWorker = void 0;
|
|
16
|
-
const
|
|
13
|
+
const errors_1 = require("@golemio/errors");
|
|
17
14
|
const config_1 = require("../config");
|
|
18
15
|
const connectors_1 = require("../connectors");
|
|
19
16
|
const sentry_transactions_1 = require("../../monitoring/sentry/sentry-transactions");
|
|
20
|
-
const errors_1 = require("@golemio/errors");
|
|
21
17
|
class BaseWorker {
|
|
22
18
|
constructor() {
|
|
23
19
|
this.sendMessage = (key, msg, options = {}) => __awaiter(this, void 0, void 0, function* () {
|
|
24
20
|
try {
|
|
25
21
|
const channel = connectors_1.AMQPConnector.getChannel();
|
|
26
|
-
yield channel.assertExchange(config_1.config.RABBIT_EXCHANGE_NAME, "topic", {
|
|
27
|
-
durable: false,
|
|
28
|
-
alternateExchange: AlternateExchangeCreator_1.default.getAltExchangeName(config_1.config.RABBIT_EXCHANGE_NAME),
|
|
29
|
-
});
|
|
22
|
+
yield channel.assertExchange(config_1.config.RABBIT_EXCHANGE_NAME, "topic", { durable: false });
|
|
30
23
|
return channel.publish(config_1.config.RABBIT_EXCHANGE_NAME, key, Buffer.from(msg), options);
|
|
31
24
|
}
|
|
32
25
|
catch (err) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseWorker.js","sourceRoot":"","sources":["../../../src/integration-engine/workers/BaseWorker.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"BaseWorker.js","sourceRoot":"","sources":["../../../src/integration-engine/workers/BaseWorker.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,4CAA8C;AAC9C,sCAAoC;AACpC,8CAA+C;AAE/C,qFAAiF;AAEjF,MAAa,UAAU;IAAvB;QACY,gBAAW,GAAG,CAAO,GAAW,EAAE,GAAW,EAAE,UAAkB,EAAE,EAAoB,EAAE;YAC7F,IAAI;gBACA,MAAM,OAAO,GAAG,0BAAa,CAAC,UAAU,EAAE,CAAC;gBAC3C,MAAM,OAAO,CAAC,cAAc,CAAC,eAAM,CAAC,oBAA8B,EAAE,OAAO,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC;gBACjG,OAAO,OAAO,CAAC,OAAO,CAAC,eAAM,CAAC,oBAA8B,EAAE,GAAG,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC,CAAC;aACjG;YAAC,OAAO,GAAG,EAAE;gBACV,MAAM,IAAI,oBAAW,CAAC,yCAAyC,EAAE,IAAI,EAAE,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,CAAC,CAAC;aAC5G;QACL,CAAC,CAAA,CAAC;QAEQ,0BAAqB,GAAG,IAAA,6CAAuB,EAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QAElE,sBAAiB,GAAG,CAC1B,gBAA2C,EAC3C,cAA4C,EAC/B,EAAE;YACf,IAAI,UAA4B,CAAC;YAEjC,IAAI;gBACA,UAAU,GAAG,MAAM,gBAAgB,CAAC;aACvC;YAAC,OAAO,GAAG,EAAE;gBACV,MAAM,IAAI,oBAAW,CAAC,0BAA0B,EAAE,IAAI,EAAE,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,CAAC,CAAC;aAC7F;YAED,IAAI;gBACA,MAAM,UAAU,CAAC,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77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
2
|
+
"name": "@golemio/core",
|
|
3
|
+
"version": "1.2.7",
|
|
4
|
+
"description": "Golemio Core Module",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"bin": {
|
|
8
|
+
"golemio-import-test-data": "bin/import-test-data.js"
|
|
9
|
+
},
|
|
10
|
+
"scripts": {
|
|
11
|
+
"build": "rimraf ./dist && ttsc -p ./tsconfig.build.json",
|
|
12
|
+
"build-minimal": "run-s 'build --sourceMap false --declaration false'",
|
|
13
|
+
"build-watch": "run-s 'build --watch --preserveWatchOutput'",
|
|
14
|
+
"test": "cross-env NODE_ENV=test TS_NODE_COMPILER='ttypescript' mocha --exit --check-leaks --timeout 120000 -r ts-node/register -r dotenv/config 'test/**/*.test.ts'",
|
|
15
|
+
"test-debug": "run-s 'test --inspect-brk=9230'",
|
|
16
|
+
"code-coverage": "nyc run-s 'test -r source-map-support/register'",
|
|
17
|
+
"generate-docs": "typedoc --out docs/typedoc src",
|
|
18
|
+
"lint": "eslint \"{src,test}/**/*.ts\""
|
|
19
|
+
},
|
|
20
|
+
"keywords": [
|
|
21
|
+
"golemio"
|
|
22
|
+
],
|
|
23
|
+
"author": "Operator ICT, a.s.",
|
|
24
|
+
"license": "MIT",
|
|
25
|
+
"repository": {
|
|
26
|
+
"type": "git",
|
|
27
|
+
"url": "https://gitlab.com/operator-ict/golemio/code/modules/core"
|
|
28
|
+
},
|
|
29
|
+
"devDependencies": {
|
|
30
|
+
"@commitlint/cli": "^16.2.1",
|
|
31
|
+
"@commitlint/config-conventional": "^16.2.1",
|
|
32
|
+
"@golemio/eslint-config": "^1.1.0",
|
|
33
|
+
"@types/amqplib": "^0.5.17",
|
|
34
|
+
"@types/apicache": "^1.2.3",
|
|
35
|
+
"@types/chai": "4.2.3",
|
|
36
|
+
"@types/chai-as-promised": "7.1.2",
|
|
37
|
+
"@types/content-type": "^1.1.3",
|
|
38
|
+
"@types/debug": "0.0.31",
|
|
39
|
+
"@types/decompress": "^4.2.3",
|
|
40
|
+
"@types/ioredis": "^4.17.10",
|
|
41
|
+
"@types/lodash": "^4.14.165",
|
|
42
|
+
"@types/mocha": "^8.2.0",
|
|
43
|
+
"@types/morgan": "^1.9.2",
|
|
44
|
+
"@types/node": "^14.14.20",
|
|
45
|
+
"@types/redis": "^2.8.28",
|
|
46
|
+
"@types/sinon": "7.0.13",
|
|
47
|
+
"@types/ssh2-sftp-client": "^5.3.1",
|
|
48
|
+
"@types/supertest": "^2.0.11",
|
|
49
|
+
"@zerollup/ts-transform-paths": "^1.7.18",
|
|
50
|
+
"chai": "4.2.0",
|
|
51
|
+
"chai-as-promised": "7.1.1",
|
|
52
|
+
"cross-env": "^7.0.3",
|
|
53
|
+
"eslint": "^8.1.1",
|
|
54
|
+
"husky": "^4.3.7",
|
|
55
|
+
"mocha": "^9.1.2",
|
|
56
|
+
"nock": "^13.0.5",
|
|
57
|
+
"npm-run-all": "^4.1.5",
|
|
58
|
+
"nyc": "^15.1.0",
|
|
59
|
+
"prettier": "^2.5.1",
|
|
60
|
+
"pretty-quick": "^3.1.0",
|
|
61
|
+
"rimraf": "^3.0.2",
|
|
62
|
+
"sinon": "7.1.1",
|
|
63
|
+
"source-map-support": "0.5.9",
|
|
64
|
+
"supertest": "^6.1.6",
|
|
65
|
+
"ts-node": "^9.1.1",
|
|
66
|
+
"ttypescript": "^1.5.13",
|
|
67
|
+
"typedoc": "^0.21.4",
|
|
68
|
+
"typescript": "4.4.4"
|
|
69
|
+
},
|
|
70
|
+
"dependencies": {
|
|
71
|
+
"@golemio/errors": "^1.0.1",
|
|
72
|
+
"@golemio/utils": "^1.0.0",
|
|
73
|
+
"@golemio/validator": "0.2.2",
|
|
74
|
+
"@google-cloud/storage": "^5.18.0",
|
|
75
|
+
"@opentelemetry/api": "^1.0.2",
|
|
76
|
+
"@opentelemetry/exporter-jaeger": "^0.24.0",
|
|
77
|
+
"@opentelemetry/instrumentation-express": "^0.24.0",
|
|
78
|
+
"@opentelemetry/instrumentation-http": "^0.24.0",
|
|
79
|
+
"@opentelemetry/instrumentation-ioredis": "^0.24.0",
|
|
80
|
+
"@opentelemetry/instrumentation-redis": "^0.24.0",
|
|
81
|
+
"@opentelemetry/node": "^0.24.0",
|
|
82
|
+
"@opentelemetry/resources": "^0.24.0",
|
|
83
|
+
"@opentelemetry/tracing": "^0.24.0",
|
|
84
|
+
"@sentry/node": "^6.11.0",
|
|
85
|
+
"@sentry/tracing": "^6.11.0",
|
|
86
|
+
"@types/express": "^4.16.0",
|
|
87
|
+
"@types/luxon": "^2.3.1",
|
|
88
|
+
"@types/request-promise": "^4.1.45",
|
|
89
|
+
"ajv": "^8.10.0",
|
|
90
|
+
"amqplib": "^0.7.1",
|
|
91
|
+
"apicache": "^1.6.3",
|
|
92
|
+
"aws-sdk": "^2.823.0",
|
|
93
|
+
"axios": "^0.24.0",
|
|
94
|
+
"basic-ftp": "^4.6.6",
|
|
95
|
+
"content-type": "^1.0.4",
|
|
96
|
+
"debug": "3.1.0",
|
|
97
|
+
"decompress": "^4.2.1",
|
|
98
|
+
"dotenv": "^8.2.0",
|
|
99
|
+
"express": "^4.16.4",
|
|
100
|
+
"express-validator": "^5.3.1",
|
|
101
|
+
"fast-csv": "^4.3.6",
|
|
102
|
+
"fast-glob": "^3.2.5",
|
|
103
|
+
"iconv-lite": "^0.6.2",
|
|
104
|
+
"ioredis": "^4.19.4",
|
|
105
|
+
"lightship": "^6.7.2",
|
|
106
|
+
"lodash": "^4.17.21",
|
|
107
|
+
"luxon": "^2.3.2",
|
|
108
|
+
"moment-timezone": "^0.5.26",
|
|
109
|
+
"mongodb-restore-dump": "1.0.1",
|
|
110
|
+
"mongoose": "^5.3.6",
|
|
111
|
+
"morgan": "^1.10.0",
|
|
112
|
+
"opentelemetry-instrumentation-amqplib": "^0.24.0",
|
|
113
|
+
"opentelemetry-instrumentation-aws-sdk": "^0.24.1",
|
|
114
|
+
"opentelemetry-instrumentation-mongoose": "^0.24.0",
|
|
115
|
+
"opentelemetry-instrumentation-sequelize": "^0.24.0",
|
|
116
|
+
"path-to-regexp": "^6.2.0",
|
|
117
|
+
"pg": "^8.6.0",
|
|
118
|
+
"prom-client": "^14.0.0",
|
|
119
|
+
"redis": "^3.1.1",
|
|
120
|
+
"request": "2.88.0",
|
|
121
|
+
"request-promise": "^4.2.5",
|
|
122
|
+
"sequelize": "^6.6.5",
|
|
123
|
+
"ssh2-sftp-client": "^7.1.0",
|
|
124
|
+
"winston": "^3.3.3",
|
|
125
|
+
"xml2js-es6-promise": "^1.1.1"
|
|
126
|
+
},
|
|
127
|
+
"resolutions": {
|
|
128
|
+
"mpath": "^0.8.4",
|
|
129
|
+
"url-parse": "^1.5.6",
|
|
130
|
+
"minimist": "^1.2.6",
|
|
131
|
+
"moment": "^2.29.2",
|
|
132
|
+
"@google-cloud/storage/**/node-forge": "^1.3.0",
|
|
133
|
+
"**/axios/follow-redirects": "^1.14.7"
|
|
134
|
+
}
|
|
135
135
|
}
|
package/tsconfig.base.json
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
"compileOnSave": true,
|
|
3
3
|
"compilerOptions": {
|
|
4
4
|
"target": "es6",
|
|
5
|
+
"lib": ["ES2021"],
|
|
5
6
|
"module": "commonjs",
|
|
6
7
|
"strict": true,
|
|
7
8
|
"declaration": true,
|
|
@@ -33,7 +34,7 @@
|
|
|
33
34
|
|
|
34
35
|
// Paths for Schema Definitions
|
|
35
36
|
"#sch": ["./src/schema-definitions"],
|
|
36
|
-
"#sch/*": ["./src/schema-definitions/*"]
|
|
37
|
+
"#sch/*": ["./src/schema-definitions/*"]
|
|
37
38
|
}
|
|
38
39
|
}
|
|
39
40
|
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import amqplib from "amqplib";
|
|
2
|
-
export default class AlternateExchangeCreator {
|
|
3
|
-
private static EXCHANGE_NAME_SUFFIX;
|
|
4
|
-
private static EXCHANGE_QUEUE_NAME;
|
|
5
|
-
static createAlternateExchange: (channel: amqplib.Channel, originalExchangeName: string) => Promise<void>;
|
|
6
|
-
static getAltExchangeName: (originalExchangeName: string) => string;
|
|
7
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var _a;
|
|
12
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
class AlternateExchangeCreator {
|
|
14
|
-
}
|
|
15
|
-
exports.default = AlternateExchangeCreator;
|
|
16
|
-
_a = AlternateExchangeCreator;
|
|
17
|
-
AlternateExchangeCreator.EXCHANGE_NAME_SUFFIX = "-alt";
|
|
18
|
-
AlternateExchangeCreator.EXCHANGE_QUEUE_NAME = ".alt-routes";
|
|
19
|
-
AlternateExchangeCreator.createAlternateExchange = (channel, originalExchangeName) => __awaiter(void 0, void 0, void 0, function* () {
|
|
20
|
-
const altExchangeName = _a.getAltExchangeName(originalExchangeName);
|
|
21
|
-
yield channel.assertExchange(altExchangeName, "fanout", { durable: false });
|
|
22
|
-
const q = yield channel.assertQueue(altExchangeName + _a.EXCHANGE_QUEUE_NAME, {
|
|
23
|
-
durable: true,
|
|
24
|
-
messageTtl: 3 * 24 * 60 * 60 * 1000, // 3 days in milliseconds
|
|
25
|
-
});
|
|
26
|
-
channel.bindQueue(q.queue, altExchangeName, "dead");
|
|
27
|
-
});
|
|
28
|
-
AlternateExchangeCreator.getAltExchangeName = (originalExchangeName) => {
|
|
29
|
-
return originalExchangeName.concat(_a.EXCHANGE_NAME_SUFFIX);
|
|
30
|
-
};
|
|
31
|
-
//# sourceMappingURL=AlternateExchangeCreator.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AlternateExchangeCreator.js","sourceRoot":"","sources":["../../../../src/helpers/data-access/amqp/AlternateExchangeCreator.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEA,MAAqB,wBAAwB;;AAA7C,2CAmBC;;AAlBkB,6CAAoB,GAAG,MAAO,CAAA;AAC9B,4CAAmB,GAAG,aAAc,CAAA;AAErC,gDAAuB,GAAG,CAAO,OAAwB,EAAE,oBAA4B,EAAiB,EAAE;IACpH,MAAM,eAAe,GAAG,EAAI,CAAC,kBAAkB,CAAC,oBAAoB,CAAC,CAAC;IACtE,MAAM,OAAO,CAAC,cAAc,CAAC,eAAyB,EAAE,QAAQ,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC;IAEtF,MAAM,CAAC,GAAG,MAAM,OAAO,CAAC,WAAW,CAAC,eAAe,GAAG,EAAI,CAAC,mBAAmB,EAAE;QAC5E,OAAO,EAAE,IAAI;QACb,UAAU,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,EAAE,yBAAyB;KACjE,CAAC,CAAC;IAEH,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,EAAE,eAAe,EAAE,MAAM,CAAC,CAAC;AACxD,CAAC,CAAC,CAAA;AAEY,2CAAkB,GAAG,CAAC,oBAA4B,EAAU,EAAE;IACxE,OAAO,oBAAoB,CAAC,MAAM,CAAC,EAAI,CAAC,oBAAoB,CAAC,CAAC;AAClE,CAAE,CAAA"}
|