@vasrefil/api-toolkit 1.6.1 → 1.7.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.
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.JOB = exports.connection = void 0;
|
|
7
|
+
const IORedis = require('ioredis');
|
|
8
|
+
const env_1 = __importDefault(require("../env"));
|
|
9
|
+
exports.connection = new IORedis(env_1.default.BULLMQ_REDIS_URL, { maxRetriesPerRequest: null });
|
|
10
|
+
var JOB;
|
|
11
|
+
(function (JOB) {
|
|
12
|
+
JOB["EMAIL"] = "EMAIL";
|
|
13
|
+
JOB["IN_APP_NOTIFICATION"] = "IN_APP_NOTIFICATION";
|
|
14
|
+
})(JOB || (exports.JOB = JOB = {}));
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.InAppNotificationQueue = exports.EmailQueue = void 0;
|
|
7
|
+
const bullmq_1 = require("bullmq");
|
|
8
|
+
const common_1 = require("./common");
|
|
9
|
+
const common_2 = require("./common");
|
|
10
|
+
const env_1 = __importDefault(require("../env"));
|
|
11
|
+
const attempts = env_1.default.NODE_ENV === env_1.default.NODE_ENVS.PROD ? 10 : 1;
|
|
12
|
+
const removeOnComplete = {
|
|
13
|
+
age: (3600 * 24) * 3, // 3 days
|
|
14
|
+
};
|
|
15
|
+
const backoff = {
|
|
16
|
+
type: 'exponential',
|
|
17
|
+
delay: 10000,
|
|
18
|
+
};
|
|
19
|
+
exports.EmailQueue = new bullmq_1.Queue(common_2.JOB.EMAIL, {
|
|
20
|
+
connection: common_1.connection,
|
|
21
|
+
defaultJobOptions: {
|
|
22
|
+
attempts,
|
|
23
|
+
backoff,
|
|
24
|
+
removeOnComplete
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
exports.InAppNotificationQueue = new bullmq_1.Queue(common_2.JOB.IN_APP_NOTIFICATION, {
|
|
28
|
+
connection: common_1.connection,
|
|
29
|
+
defaultJobOptions: {
|
|
30
|
+
attempts: 1,
|
|
31
|
+
backoff,
|
|
32
|
+
removeOnComplete,
|
|
33
|
+
removeOnFail: removeOnComplete
|
|
34
|
+
},
|
|
35
|
+
});
|
package/dist/env.d.ts
CHANGED
package/dist/env.js
CHANGED
|
@@ -16,6 +16,7 @@ const env = {
|
|
|
16
16
|
API_KEY: process.env.API_KEY,
|
|
17
17
|
SERVICE_NAME: process.env.SERVICE_NAME,
|
|
18
18
|
REDIS_URL: process.env.REDIS_URL,
|
|
19
|
+
BULLMQ_REDIS_URL: process.env.BULLMQ_REDIS_URL,
|
|
19
20
|
ERROR_MESSAGE: 'Sorry an error occured, please try again later',
|
|
20
21
|
VASREFIL: {
|
|
21
22
|
BASEURL: NODE_ENV === NODE_ENVS.PROD ? 'https://api.vasrefil.com' : 'https://api-v2-test.vasrefil.com',
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vasrefil/api-toolkit",
|
|
3
3
|
"description": "This is Vasrefil API toolkit",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.7.0",
|
|
5
5
|
"author": "Sodiq Alabi",
|
|
6
6
|
"main": "dist/public-api.js",
|
|
7
7
|
"types": "dist/public-api.d.ts",
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
"@airbrake/node": "^2.1.8",
|
|
22
22
|
"@types/jsonwebtoken": "^8.5.0",
|
|
23
23
|
"axios": "^1.7.8",
|
|
24
|
+
"bullmq": "^5.64.1",
|
|
24
25
|
"chalk": "^4.1.0",
|
|
25
26
|
"cors": "^2.8.5",
|
|
26
27
|
"date-fns": "^2.29.3",
|