@ezpaarse-project/ezreeport-sdk-js 1.0.0-beta.1 → 1.0.0-beta.2
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/dist/browser/ezreeport-sdk-js.mjs +50 -49
- package/dist/browser/ezreeport-sdk-js.mjs.map +1 -1
- package/dist/browser/ezreeport-sdk-js.umd.js +2 -2
- package/dist/browser/ezreeport-sdk-js.umd.js.map +1 -1
- package/dist/node/index.js +38 -0
- package/dist/node/index.js.map +1 -0
- package/dist/node/lib/axios.js +91 -0
- package/dist/node/lib/axios.js.map +1 -0
- package/dist/node/lib/promises.js +26 -0
- package/dist/node/lib/promises.js.map +1 -0
- package/dist/node/lib/utils.js +24 -0
- package/dist/node/lib/utils.js.map +1 -0
- package/dist/node/modules/auth.js +61 -0
- package/dist/node/modules/auth.js.map +1 -0
- package/dist/node/modules/crons.js +105 -0
- package/dist/node/modules/crons.js.map +1 -0
- package/dist/node/modules/health.js +52 -0
- package/dist/node/modules/health.js.map +1 -0
- package/dist/node/modules/history.js +60 -0
- package/dist/node/modules/history.js.map +1 -0
- package/dist/node/modules/institutions.js +61 -0
- package/dist/node/modules/institutions.js.map +1 -0
- package/dist/node/modules/queues.js +128 -0
- package/dist/node/modules/queues.js.map +1 -0
- package/dist/node/modules/reports.js +261 -0
- package/dist/node/modules/reports.js.map +1 -0
- package/dist/node/modules/setup.js +35 -0
- package/dist/node/modules/setup.js.map +1 -0
- package/dist/node/modules/tasks.js +187 -0
- package/dist/node/modules/tasks.js.map +1 -0
- package/dist/node/modules/templates.js +28 -0
- package/dist/node/modules/templates.js.map +1 -0
- package/dist/node/package.json +2 -2
- package/dist/node/src/index.js +39 -0
- package/dist/node/src/index.js.map +1 -0
- package/dist/node/src/lib/axios.js +91 -0
- package/dist/node/src/lib/axios.js.map +1 -0
- package/dist/node/src/lib/promises.js +41 -0
- package/dist/node/src/lib/promises.js.map +1 -0
- package/dist/node/src/lib/utils.js +24 -0
- package/dist/node/src/lib/utils.js.map +1 -0
- package/dist/node/src/modules/auth.js +111 -0
- package/dist/node/src/modules/auth.js.map +1 -0
- package/dist/node/src/modules/auth.public.js +11 -0
- package/dist/node/src/modules/auth.public.js.map +1 -0
- package/dist/node/src/modules/crons.js +105 -0
- package/dist/node/src/modules/crons.js.map +1 -0
- package/dist/node/src/modules/crons.public.js +10 -0
- package/dist/node/src/modules/crons.public.js.map +1 -0
- package/dist/node/src/modules/health.js +60 -0
- package/dist/node/src/modules/health.js.map +1 -0
- package/dist/node/src/modules/health.public.js +9 -0
- package/dist/node/src/modules/health.public.js.map +1 -0
- package/dist/node/src/modules/history.js +62 -0
- package/dist/node/src/modules/history.js.map +1 -0
- package/dist/node/src/modules/history.public.js +6 -0
- package/dist/node/src/modules/history.public.js.map +1 -0
- package/dist/node/src/modules/namespaces.js +16 -0
- package/dist/node/src/modules/namespaces.js.map +1 -0
- package/dist/node/src/modules/namespaces.public.js +3 -0
- package/dist/node/src/modules/namespaces.public.js.map +1 -0
- package/dist/node/src/modules/queues.js +136 -0
- package/dist/node/src/modules/queues.js.map +1 -0
- package/dist/node/src/modules/queues.public.js +11 -0
- package/dist/node/src/modules/queues.public.js.map +1 -0
- package/dist/node/src/modules/reports.js +266 -0
- package/dist/node/src/modules/reports.js.map +1 -0
- package/dist/node/src/modules/reports.public.js +13 -0
- package/dist/node/src/modules/reports.public.js.map +1 -0
- package/dist/node/src/modules/setup.js +35 -0
- package/dist/node/src/modules/setup.js.map +1 -0
- package/dist/node/src/modules/setup.public.js +12 -0
- package/dist/node/src/modules/setup.public.js.map +1 -0
- package/dist/node/src/modules/tasks.base.js +51 -0
- package/dist/node/src/modules/tasks.base.js.map +1 -0
- package/dist/node/src/modules/tasks.js +183 -0
- package/dist/node/src/modules/tasks.js.map +1 -0
- package/dist/node/src/modules/tasks.public.js +15 -0
- package/dist/node/src/modules/tasks.public.js.map +1 -0
- package/dist/node/src/modules/templates.js +135 -0
- package/dist/node/src/modules/templates.js.map +1 -0
- package/dist/node/src/modules/templates.public.js +11 -0
- package/dist/node/src/modules/templates.public.js.map +1 -0
- package/dist/types/lib/promises.d.ts +9 -7
- package/dist/types/modules/reports.d.ts +5 -1
- package/package.json +1 -1
- package/CHANGELOG.md +0 -42
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"history.public.js","sourceRoot":"","sources":["../../../../src/modules/history.public.ts"],"names":[],"mappings":";;;AAAA,qCAImB;AADjB,wGAAA,aAAa,OAAA"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseNamespace = void 0;
|
|
4
|
+
const date_fns_1 = require("date-fns");
|
|
5
|
+
// Private export
|
|
6
|
+
/**
|
|
7
|
+
* Transform raw data from JSON, to JS usable data
|
|
8
|
+
*
|
|
9
|
+
* @param namespace Raw namespace
|
|
10
|
+
*
|
|
11
|
+
* @returns Parsed namespace
|
|
12
|
+
*/
|
|
13
|
+
const parseNamespace = (namespace) => (Object.assign(Object.assign({}, namespace), { createdAt: (0, date_fns_1.parseISO)(namespace.createdAt), updatedAt: namespace.updatedAt ? (0, date_fns_1.parseISO)(namespace.updatedAt) : undefined }));
|
|
14
|
+
exports.parseNamespace = parseNamespace;
|
|
15
|
+
// TODO: API-KEY (ONLY IN NODE !)
|
|
16
|
+
//# sourceMappingURL=namespaces.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"namespaces.js","sourceRoot":"","sources":["../../../../src/modules/namespaces.ts"],"names":[],"mappings":";;;AAAA,uCAAoC;AAiBpC,iBAAiB;AACjB;;;;;;GAMG;AACI,MAAM,cAAc,GAAG,CAAC,SAAuB,EAAa,EAAE,CAAC,iCACjE,SAAS,KAEZ,SAAS,EAAE,IAAA,mBAAQ,EAAC,SAAS,CAAC,SAAS,CAAC,EACxC,SAAS,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC,CAAC,IAAA,mBAAQ,EAAC,SAAS,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS,IAC1E,CAAC;AALU,QAAA,cAAc,kBAKxB;AAEH,iCAAiC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"namespaces.public.js","sourceRoot":"","sources":["../../../../src/modules/namespaces.public.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
29
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
30
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
31
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
35
|
+
var t = {};
|
|
36
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
37
|
+
t[p] = s[p];
|
|
38
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
39
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
40
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
41
|
+
t[p[i]] = s[p[i]];
|
|
42
|
+
}
|
|
43
|
+
return t;
|
|
44
|
+
};
|
|
45
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
46
|
+
exports.retryJob = exports.getJob = exports.getQueueJobs = exports.resumeQueue = exports.pauseQueue = exports.getAllQueues = void 0;
|
|
47
|
+
const date_fns_1 = require("date-fns");
|
|
48
|
+
const axios_1 = __importStar(require("../lib/axios"));
|
|
49
|
+
/**
|
|
50
|
+
* Transform raw data from JSON, to JS usable data
|
|
51
|
+
*
|
|
52
|
+
* @param job Raw job
|
|
53
|
+
*
|
|
54
|
+
* @returns Parsed job
|
|
55
|
+
*/
|
|
56
|
+
const parseFullJob = (job) => (Object.assign(Object.assign({}, job), { added: (0, date_fns_1.parseISO)(job.added), started: job.started ? (0, date_fns_1.parseISO)(job.started) : undefined, ended: job.ended ? (0, date_fns_1.parseISO)(job.ended) : undefined }));
|
|
57
|
+
/**
|
|
58
|
+
* Get all available queues
|
|
59
|
+
*
|
|
60
|
+
* Needs `general.queues-get` permission
|
|
61
|
+
*
|
|
62
|
+
* @returns All queues' names
|
|
63
|
+
*/
|
|
64
|
+
const getAllQueues = () => axios_1.default.$get('/queues');
|
|
65
|
+
exports.getAllQueues = getAllQueues;
|
|
66
|
+
/**
|
|
67
|
+
* Pause queue
|
|
68
|
+
*
|
|
69
|
+
* Needs `general.queues-put-queue-pause` permission
|
|
70
|
+
*
|
|
71
|
+
* @param queueName Name of the queue
|
|
72
|
+
*
|
|
73
|
+
* @returns queue info
|
|
74
|
+
*/
|
|
75
|
+
const pauseQueue = (queueName) => __awaiter(void 0, void 0, void 0, function* () { return axios_1.default.$put(`/queues/${queueName}/pause`); });
|
|
76
|
+
exports.pauseQueue = pauseQueue;
|
|
77
|
+
/**
|
|
78
|
+
* Resume queue
|
|
79
|
+
*
|
|
80
|
+
* Needs `general.queues-put-queue-resume` permission
|
|
81
|
+
*
|
|
82
|
+
* @param queueName Name of the queue
|
|
83
|
+
*
|
|
84
|
+
* @returns queue info
|
|
85
|
+
*/
|
|
86
|
+
const resumeQueue = (queueName) => __awaiter(void 0, void 0, void 0, function* () { return axios_1.default.$put(`/queues/${queueName}/resume`); });
|
|
87
|
+
exports.resumeQueue = resumeQueue;
|
|
88
|
+
/**
|
|
89
|
+
* Get queue info
|
|
90
|
+
*
|
|
91
|
+
* Needs `general.queues-get-queue-jobs` permission
|
|
92
|
+
*
|
|
93
|
+
* @param queueName Name of the queue
|
|
94
|
+
*
|
|
95
|
+
* @returns queue info
|
|
96
|
+
*/
|
|
97
|
+
const getQueueJobs = (queueName, paginationOpts) => __awaiter(void 0, void 0, void 0, function* () {
|
|
98
|
+
const _a = (yield (0, axios_1.axiosWithErrorFormatter)('get', `/queues/${queueName}/jobs`, {
|
|
99
|
+
params: paginationOpts,
|
|
100
|
+
})).data, { content } = _a, response = __rest(_a, ["content"]);
|
|
101
|
+
return Object.assign(Object.assign({}, response), { content: content.map(parseFullJob) });
|
|
102
|
+
});
|
|
103
|
+
exports.getQueueJobs = getQueueJobs;
|
|
104
|
+
/**
|
|
105
|
+
* Get job info
|
|
106
|
+
*
|
|
107
|
+
* Needs `namespaces[namespaceId].queues-get-queue-jobs-jobId` permission
|
|
108
|
+
*
|
|
109
|
+
* @param queueName Name of queue where job is
|
|
110
|
+
* @param jobId Id of the job in queue
|
|
111
|
+
* @param namespaces
|
|
112
|
+
*
|
|
113
|
+
* @returns Job full info
|
|
114
|
+
*/
|
|
115
|
+
const getJob = (queueName, jobId, namespaces) => __awaiter(void 0, void 0, void 0, function* () {
|
|
116
|
+
const _b = yield axios_1.default.$get(`/queues/${queueName}/jobs/${jobId}`, { params: { namespaces } }), { content } = _b, response = __rest(_b, ["content"]);
|
|
117
|
+
return Object.assign(Object.assign({}, response), { content: parseFullJob(content) });
|
|
118
|
+
});
|
|
119
|
+
exports.getJob = getJob;
|
|
120
|
+
/**
|
|
121
|
+
* Retry job that failed
|
|
122
|
+
*
|
|
123
|
+
* Needs `namespaces[namespaceId].queues-post-queue-jobs-jobId-retry` permission
|
|
124
|
+
*
|
|
125
|
+
* @param queueName Name of queue where job is
|
|
126
|
+
* @param jobId Id of the job in queue
|
|
127
|
+
* @param namespaces
|
|
128
|
+
*
|
|
129
|
+
* @returns queue info
|
|
130
|
+
*/
|
|
131
|
+
const retryJob = (queueName, jobId, namespaces) => __awaiter(void 0, void 0, void 0, function* () {
|
|
132
|
+
const _c = yield axios_1.default.$post(`/queues/${queueName}/jobs/${jobId}/retry`, { params: { namespaces } }), { content } = _c, response = __rest(_c, ["content"]);
|
|
133
|
+
return Object.assign(Object.assign({}, response), { content: parseFullJob(content) });
|
|
134
|
+
});
|
|
135
|
+
exports.retryJob = retryJob;
|
|
136
|
+
//# sourceMappingURL=queues.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"queues.js","sourceRoot":"","sources":["../../../../src/modules/queues.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAoC;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O,CAAC,GAAG,CAAC,YAAY,CAAC,IAClC;AACJ,CAAC,CAAA,CAAC;AAhBW,QAAA,YAAY,gBAgBvB;AAEF;;;;;;;;;;GAUG;AACI,MAAM,MAAM,GAAG,CACpB,SAA6B,EAC7B,KAAsB,EACtB,UAAqB,EACwB,EAAE;IAC/C,MAAM,KAA2B,MAAM,eAAK,CAAC,IAAI,CAA2B,WAAW,SAAS,SAAS,KAAK,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,UAAU,EAAE,EAAE,CAAC,EAAvI,EAAE,OAAO,OAA8H,EAAzH,QAAQ,cAAtB,WAAwB,CAA+G,CAAC;IAC9I,uCACK,QAAQ,KACX,OAAO,EAAE,YAAY,CAAC,OAAO,CAAC,IAC9B;AACJ,CAAC,CAAA,CAAC;AAVW,QAAA,MAAM,UAUjB;AAEF;;;;;;;;;;GAUG;AACI,MAAM,QAAQ,GAAG,CACtB,SAA6B,EAC7B,KAAsB,EACtB,UAAqB,EACwB,EAAE;IAC/C,MAAM,KAA2B,MAAM,eAAK,CAAC,KAAK,CAA2B,WAAW,SAAS,SAAS,KAAK,QAAQ,EAAE,EAAE,MAAM,EAAE,EAAE,UAAU,EAAE,EAAE,CAAC,EAA9I,EAAE,OAAO,OAAqI,EAAhI,QAAQ,cAAtB,WAAwB,CAAsH,CAAC;IACrJ,uCACK,QAAQ,KACX,OAAO,EAAE,YAAY,CAAC,OAAO,CAAC,IAC9B;AACJ,CAAC,CAAA,CAAC;AAVW,QAAA,QAAQ,YAUnB"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.retryJob = exports.getJob = exports.getQueueJobs = exports.resumeQueue = exports.pauseQueue = exports.getAllQueues = void 0;
|
|
4
|
+
var queues_1 = require("./queues");
|
|
5
|
+
Object.defineProperty(exports, "getAllQueues", { enumerable: true, get: function () { return queues_1.getAllQueues; } });
|
|
6
|
+
Object.defineProperty(exports, "pauseQueue", { enumerable: true, get: function () { return queues_1.pauseQueue; } });
|
|
7
|
+
Object.defineProperty(exports, "resumeQueue", { enumerable: true, get: function () { return queues_1.resumeQueue; } });
|
|
8
|
+
Object.defineProperty(exports, "getQueueJobs", { enumerable: true, get: function () { return queues_1.getQueueJobs; } });
|
|
9
|
+
Object.defineProperty(exports, "getJob", { enumerable: true, get: function () { return queues_1.getJob; } });
|
|
10
|
+
Object.defineProperty(exports, "retryJob", { enumerable: true, get: function () { return queues_1.retryJob; } });
|
|
11
|
+
//# sourceMappingURL=queues.public.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"queues.public.js","sourceRoot":"","sources":["../../../../src/modules/queues.public.ts"],"names":[],"mappings":";;;AAAA,mCAUkB;AANhB,sGAAA,YAAY,OAAA;AACZ,oGAAA,UAAU,OAAA;AACV,qGAAA,WAAW,OAAA;AACX,sGAAA,YAAY,OAAA;AACZ,gGAAA,MAAM,OAAA;AACN,kGAAA,QAAQ,OAAA"}
|
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
29
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
30
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
31
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
35
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
36
|
+
};
|
|
37
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
|
+
exports.getReportDebugByJob = exports.getReportDebugByName = exports.getReportDetailByJob = exports.getReportDetailByName = exports.getReportFileByJob = exports.getReportFileByName = exports.startAndListenGeneration = exports.startGeneration = void 0;
|
|
39
|
+
const date_fns_1 = require("date-fns");
|
|
40
|
+
const axios_1 = __importStar(require("../lib/axios"));
|
|
41
|
+
const promises_1 = __importDefault(require("../lib/promises"));
|
|
42
|
+
const utils_1 = require("../lib/utils");
|
|
43
|
+
const queues_1 = require("./queues");
|
|
44
|
+
/**
|
|
45
|
+
* Transform raw data from JSON, to JS usable data
|
|
46
|
+
*
|
|
47
|
+
* @param detail Raw result detail
|
|
48
|
+
*
|
|
49
|
+
* @returns Parsed result detail
|
|
50
|
+
*/
|
|
51
|
+
const parseReportResultDetail = (detail) => (Object.assign(Object.assign({}, detail), { createdAt: (0, date_fns_1.parseISO)(detail.createdAt), destroyAt: (0, date_fns_1.parseISO)(detail.destroyAt), period: detail.period ? (0, utils_1.parsePeriod)(detail.period) : undefined }));
|
|
52
|
+
/**
|
|
53
|
+
* Transform raw data from JSON, to JS usable data
|
|
54
|
+
*
|
|
55
|
+
* @param result Raw result
|
|
56
|
+
*
|
|
57
|
+
* @returns Parsed result
|
|
58
|
+
*/
|
|
59
|
+
const parseReportResult = (result) => (Object.assign(Object.assign({}, result), { detail: parseReportResultDetail(result.detail) }));
|
|
60
|
+
/**
|
|
61
|
+
* Start generation of a report
|
|
62
|
+
*
|
|
63
|
+
* Needs `namespaces[namespaceId].tasks-post-task-run` permission
|
|
64
|
+
*
|
|
65
|
+
* @param taskId Id of the task
|
|
66
|
+
* @param params Other params for overriding default
|
|
67
|
+
* @param namespaces
|
|
68
|
+
*
|
|
69
|
+
* @returns Job info to track progress
|
|
70
|
+
*/
|
|
71
|
+
const startGeneration = (taskId, params, namespaces) => {
|
|
72
|
+
var _a, _b;
|
|
73
|
+
return axios_1.default.$post(`/tasks/${taskId}/run`, null, {
|
|
74
|
+
params: {
|
|
75
|
+
test_emails: params === null || params === void 0 ? void 0 : params.testEmails,
|
|
76
|
+
period_start: (_a = params === null || params === void 0 ? void 0 : params.period) === null || _a === void 0 ? void 0 : _a.start,
|
|
77
|
+
period_end: (_b = params === null || params === void 0 ? void 0 : params.period) === null || _b === void 0 ? void 0 : _b.end,
|
|
78
|
+
namespaces,
|
|
79
|
+
},
|
|
80
|
+
});
|
|
81
|
+
};
|
|
82
|
+
exports.startGeneration = startGeneration;
|
|
83
|
+
/**
|
|
84
|
+
* Start generation of a report and track progress
|
|
85
|
+
*
|
|
86
|
+
* Needs `namespaces[namespaceId].tasks-post-task-run`
|
|
87
|
+
* & `namespaces[namespaceId].queues-get-queue-jobs-jobId` permissions
|
|
88
|
+
*
|
|
89
|
+
* @param taskId Id of the task
|
|
90
|
+
* @param params Other params for overriding default
|
|
91
|
+
* @param namespaces
|
|
92
|
+
*
|
|
93
|
+
* @fires #started When generation started. See `GenerationStartedEvent`.
|
|
94
|
+
* @fires #progress When generation progress. See `GenerationProgressEvent`. Job's progress is
|
|
95
|
+
* between 0 and 1
|
|
96
|
+
*
|
|
97
|
+
* @throws If job's fails. **Not if generation fails !**
|
|
98
|
+
*
|
|
99
|
+
* @returns When generation ends, with detail
|
|
100
|
+
*/
|
|
101
|
+
const startAndListenGeneration = (...p) => (0, promises_1.default)((events) => __awaiter(void 0, void 0, void 0, function* () {
|
|
102
|
+
const { content: { id, queue } } = yield (0, exports.startGeneration)(...p);
|
|
103
|
+
events.emit('started', { id, queue });
|
|
104
|
+
// Pulling updates
|
|
105
|
+
// TODO[feat]: WS ?
|
|
106
|
+
let last;
|
|
107
|
+
do {
|
|
108
|
+
const { content: { progress, status, result, },
|
|
109
|
+
// FIXME: What if param order changes ?
|
|
110
|
+
// eslint-disable-next-line no-await-in-loop
|
|
111
|
+
} = yield (0, queues_1.getJob)(queue, id, p[2]);
|
|
112
|
+
last = { progress, status, result };
|
|
113
|
+
events.emit('progress', { progress, status });
|
|
114
|
+
let sleepDuration = 1000;
|
|
115
|
+
if (last.status === 'active') {
|
|
116
|
+
sleepDuration = 250;
|
|
117
|
+
}
|
|
118
|
+
// eslint-disable-next-line no-await-in-loop
|
|
119
|
+
yield (0, utils_1.setTimeoutAsync)(sleepDuration);
|
|
120
|
+
} while ((['completed', 'failed', 'stuck']).includes(last.status) === false);
|
|
121
|
+
if (!last.result) {
|
|
122
|
+
throw new Error('Generation failed with weird error');
|
|
123
|
+
}
|
|
124
|
+
return parseReportResult(last.result);
|
|
125
|
+
}));
|
|
126
|
+
exports.startAndListenGeneration = startAndListenGeneration;
|
|
127
|
+
/**
|
|
128
|
+
* Get report's related file
|
|
129
|
+
*
|
|
130
|
+
* Needs `namespaces[namespaceId].reports-get-year-yearMonth-filename` permission
|
|
131
|
+
*
|
|
132
|
+
* @param pathName Path to the file
|
|
133
|
+
* @param namespaces
|
|
134
|
+
* @param responseType Wanted response type
|
|
135
|
+
*
|
|
136
|
+
* @returns The file's content
|
|
137
|
+
*/
|
|
138
|
+
const getFile = (pathName, namespaces, responseType) => __awaiter(void 0, void 0, void 0, function* () {
|
|
139
|
+
return (yield (0, axios_1.axiosWithErrorFormatter)('get', `/reports/${pathName}`, {
|
|
140
|
+
responseType,
|
|
141
|
+
params: { namespaces },
|
|
142
|
+
})).data;
|
|
143
|
+
});
|
|
144
|
+
/**
|
|
145
|
+
* Get report main file (the result) by giving the report's name
|
|
146
|
+
*
|
|
147
|
+
* Needs `namespaces[namespaceId].reports-get-year-yearMonth-filename` permission
|
|
148
|
+
*
|
|
149
|
+
* @param name Name of the report
|
|
150
|
+
* @param ext The extension of the result (renderer dependent)
|
|
151
|
+
* @param namespaces
|
|
152
|
+
* @param responseType Wanted response type
|
|
153
|
+
*
|
|
154
|
+
* @returns The report's content
|
|
155
|
+
*/
|
|
156
|
+
const getReportFileByName = (name, namespaces, responseType, ext = 'pdf') => getFile(`${name}.rep.${ext}`, namespaces, responseType);
|
|
157
|
+
exports.getReportFileByName = getReportFileByName;
|
|
158
|
+
/**
|
|
159
|
+
* Get report main file (the result) by giving job's info
|
|
160
|
+
*
|
|
161
|
+
* Needs `namespaces[namespaceId].reports-get-year-yearMonth-filename`
|
|
162
|
+
* & `namespaces[namespaceId].queues-get-queue-jobs-jobId ` permission
|
|
163
|
+
*
|
|
164
|
+
* @param queueName Name of queue where job is
|
|
165
|
+
* @param jobId Id of the job in queue
|
|
166
|
+
* @param namespaces
|
|
167
|
+
* @param responseType Wanted response type
|
|
168
|
+
*
|
|
169
|
+
* @returns The report's content
|
|
170
|
+
*/
|
|
171
|
+
const getReportFileByJob = (queueName, jobId, namespaces, responseType) => __awaiter(void 0, void 0, void 0, function* () {
|
|
172
|
+
var _a, _b;
|
|
173
|
+
const { content: { result } } = yield (0, queues_1.getJob)(queueName, jobId, namespaces);
|
|
174
|
+
if (!result) {
|
|
175
|
+
throw new Error('Job have no result');
|
|
176
|
+
}
|
|
177
|
+
return getFile((_b = (_a = result.detail) === null || _a === void 0 ? void 0 : _a.files.report) !== null && _b !== void 0 ? _b : '', namespaces, responseType);
|
|
178
|
+
});
|
|
179
|
+
exports.getReportFileByJob = getReportFileByJob;
|
|
180
|
+
/**
|
|
181
|
+
* Get report detail by giving the report's name
|
|
182
|
+
*
|
|
183
|
+
* Needs `namespaces[namespaceId].reports-get-year-yearMonth-filename` permission
|
|
184
|
+
*
|
|
185
|
+
* @param name Name of the report
|
|
186
|
+
* @param namespaces
|
|
187
|
+
* @param responseType Wanted response type. **If provided with anything but `json` you will have to
|
|
188
|
+
* cast in your type to avoid auto-completion issues.**
|
|
189
|
+
*
|
|
190
|
+
* @returns The detail's content
|
|
191
|
+
*/
|
|
192
|
+
const getReportDetailByName = (name, namespaces, responseType) => __awaiter(void 0, void 0, void 0, function* () {
|
|
193
|
+
const res = yield getFile(`${name}.det.json`, namespaces, responseType);
|
|
194
|
+
if (!responseType || responseType === 'json') {
|
|
195
|
+
return parseReportResult(res);
|
|
196
|
+
}
|
|
197
|
+
// Allowing user to ask for other response type (and then cast in wanted type)
|
|
198
|
+
// while not breaking auto-completion
|
|
199
|
+
return res;
|
|
200
|
+
});
|
|
201
|
+
exports.getReportDetailByName = getReportDetailByName;
|
|
202
|
+
/**
|
|
203
|
+
* Get report detail by giving job's info
|
|
204
|
+
*
|
|
205
|
+
* Needs `namespaces[namespaceId].reports-get-year-yearMonth-filename`
|
|
206
|
+
* & `namespaces[namespaceId].queues-get-queue-jobs-jobId` permission
|
|
207
|
+
*
|
|
208
|
+
* @param queueName Name of queue where job is
|
|
209
|
+
* @param jobId Id of the job in queue
|
|
210
|
+
* @param namespaces
|
|
211
|
+
* @param responseType Wanted response type. **If provided with anything but `json` you will have to
|
|
212
|
+
* cast in your type to avoid auto-completion issues.**
|
|
213
|
+
*
|
|
214
|
+
* @returns The detail's content
|
|
215
|
+
*/
|
|
216
|
+
const getReportDetailByJob = (queueName, jobId, namespaces, responseType) => __awaiter(void 0, void 0, void 0, function* () {
|
|
217
|
+
var _c, _d;
|
|
218
|
+
const { content: { result } } = yield (0, queues_1.getJob)(queueName, jobId, namespaces);
|
|
219
|
+
if (!result) {
|
|
220
|
+
throw new Error('Job have no result');
|
|
221
|
+
}
|
|
222
|
+
const res = yield getFile((_d = (_c = result.detail) === null || _c === void 0 ? void 0 : _c.files.detail) !== null && _d !== void 0 ? _d : '', namespaces, responseType);
|
|
223
|
+
if (!responseType || responseType === 'json') {
|
|
224
|
+
return parseReportResult(res);
|
|
225
|
+
}
|
|
226
|
+
// Allowing user to ask for other response type (and then use `as`)
|
|
227
|
+
// while not breaking auto-completion
|
|
228
|
+
return res;
|
|
229
|
+
});
|
|
230
|
+
exports.getReportDetailByJob = getReportDetailByJob;
|
|
231
|
+
/**
|
|
232
|
+
* Get report debug file by giving the report's name
|
|
233
|
+
*
|
|
234
|
+
* Needs `namespaces[namespaceId].reports-get-year-yearMonth-filename` permission
|
|
235
|
+
*
|
|
236
|
+
* @param name Name of the report
|
|
237
|
+
* @param namespaces
|
|
238
|
+
* @param responseType Wanted response type
|
|
239
|
+
*
|
|
240
|
+
* @returns The debug's content
|
|
241
|
+
*/
|
|
242
|
+
const getReportDebugByName = (name, namespaces, responseType) => getFile(`${name}.deb.json`, namespaces, responseType);
|
|
243
|
+
exports.getReportDebugByName = getReportDebugByName;
|
|
244
|
+
/**
|
|
245
|
+
* Get report debug file by giving job's info
|
|
246
|
+
*
|
|
247
|
+
* Needs `namespaces[namespaceId].reports-get-year-yearMonth-filename`
|
|
248
|
+
* & `namespaces[namespaceId].queues-get-queue-jobs-jobId ` permission
|
|
249
|
+
*
|
|
250
|
+
* @param queueName Name of queue where job is
|
|
251
|
+
* @param jobId Id of the job in queue
|
|
252
|
+
* @param namespaces
|
|
253
|
+
* @param responseType Wanted response type
|
|
254
|
+
*
|
|
255
|
+
* @returns The debug's content
|
|
256
|
+
*/
|
|
257
|
+
const getReportDebugByJob = (queueName, jobId, namespaces, responseType) => __awaiter(void 0, void 0, void 0, function* () {
|
|
258
|
+
var _e, _f;
|
|
259
|
+
const { content: { result } } = yield (0, queues_1.getJob)(queueName, jobId, namespaces);
|
|
260
|
+
if (!result) {
|
|
261
|
+
throw new Error('Job have no result');
|
|
262
|
+
}
|
|
263
|
+
return getFile((_f = (_e = result.detail) === null || _e === void 0 ? void 0 : _e.files.debug) !== null && _f !== void 0 ? _f : '', namespaces, responseType);
|
|
264
|
+
});
|
|
265
|
+
exports.getReportDebugByJob = getReportDebugByJob;
|
|
266
|
+
//# sourceMappingURL=reports.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reports.js","sourceRoot":"","sources":["../../../../src/modules/reports.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAoC;AAGpC,sDAA8D;AAC9D,+DAAoD;AACpD,wCAKsB;AACtB,qCAA0D;AA8B1D;;;;;;GAMG;AACH,MAAM,uBAAuB,GAAG,CAAC,MAA6B,EAAsB,EAAE,CAAC,iCAClF,MAAM,KACT,SAAS,EAAE,IAAA,mBAAQ,EAAC,MAAM,CAAC,SAAS,CAAC,EACrC,SAAS,EAAE,IAAA,mBAAQ,EAAC,MAAM,CAAC,SAAS,CAAC,EACrC,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,IAAA,mBAAW,EAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS,IAC9D,CAAC;AAWH;;;;;;GAMG;AACH,MAAM,iBAAiB,GAAG,CAAC,MAAuB,EAAgB,EAAE,CAAC,iCAChE,MAAM,KACT,MAAM,EAAE,uBAAuB,CAAC,MAAM,CAAC,MAAM,CAAC,IAC9C,CAAC;AAaH;;;;;;;;;;GAUG;AACI,MAAM,eAAe,GAAG,C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iB,CAAC,GAAG,CAAC,CAAC;KAC/B;IACD,mEAAmE;IACnE,qCAAqC;IACrC,OAAO,GAA8B,CAAC;AACxC,CAAC,CAAA,CAAC;AArBW,QAAA,oBAAoB,wBAqB/B;AAEF;;;;;;;;;;GAUG;AACI,MAAM,oBAAoB,GAAG,CAClC,IAAY,EACZ,UAAqB,EACrB,YAAqB,EACrB,EAAE,CAAC,OAAO,CAA0B,GAAG,IAAI,WAAW,EAAE,UAAU,EAAE,YAAY,CAAC,CAAC;AAJvE,QAAA,oBAAoB,wBAImD;AAEpF;;;;;;;;;;;;GAYG;AACI,MAAM,mBAAmB,GAAG,CACjC,SAA0B,EAC1B,KAAsB,EACtB,UAA4B,EAC5B,YAAqB,EACrB,EAAE;;IACF,MAAM,EAAE,OAAO,EAAE,EAAE,MAAM,EAAE,EAAE,GAAG,MAAM,IAAA,eAAM,EAC1C,SAAS,EACT,KAAK,EACL,UAAU,CACX,CAAC;IACF,IAAI,CAAC,MAAM,EAAE;QACX,MAAM,IAAI,KAAK,CAAC,oBAAoB,CAAC,CAAC;KACvC;IACD,OAAO,OAAO,CAA0B,MAAA,MAAA,MAAM,CAAC,MAAM,0CAAE,KAAK,CAAC,KAAK,mCAAI,EAAE,EAAE,UAAU,EAAE,YAAY,CAAC,CAAC;AACtG,CAAC,CAAA,CAAC;AAfW,QAAA,mBAAmB,uBAe9B"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getReportDebugByJob = exports.getReportDebugByName = exports.getReportDetailByJob = exports.getReportDetailByName = exports.getReportFileByJob = exports.getReportFileByName = exports.startAndListenGeneration = exports.startGeneration = void 0;
|
|
4
|
+
var reports_1 = require("./reports");
|
|
5
|
+
Object.defineProperty(exports, "startGeneration", { enumerable: true, get: function () { return reports_1.startGeneration; } });
|
|
6
|
+
Object.defineProperty(exports, "startAndListenGeneration", { enumerable: true, get: function () { return reports_1.startAndListenGeneration; } });
|
|
7
|
+
Object.defineProperty(exports, "getReportFileByName", { enumerable: true, get: function () { return reports_1.getReportFileByName; } });
|
|
8
|
+
Object.defineProperty(exports, "getReportFileByJob", { enumerable: true, get: function () { return reports_1.getReportFileByJob; } });
|
|
9
|
+
Object.defineProperty(exports, "getReportDetailByName", { enumerable: true, get: function () { return reports_1.getReportDetailByName; } });
|
|
10
|
+
Object.defineProperty(exports, "getReportDetailByJob", { enumerable: true, get: function () { return reports_1.getReportDetailByJob; } });
|
|
11
|
+
Object.defineProperty(exports, "getReportDebugByName", { enumerable: true, get: function () { return reports_1.getReportDebugByName; } });
|
|
12
|
+
Object.defineProperty(exports, "getReportDebugByJob", { enumerable: true, get: function () { return reports_1.getReportDebugByJob; } });
|
|
13
|
+
//# sourceMappingURL=reports.public.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reports.public.js","sourceRoot":"","sources":["../../../../src/modules/reports.public.ts"],"names":[],"mappings":";;;AAAA,qCAamB;AARjB,0GAAA,eAAe,OAAA;AACf,mHAAA,wBAAwB,OAAA;AACxB,8GAAA,mBAAmB,OAAA;AACnB,6GAAA,kBAAkB,OAAA;AAClB,gHAAA,qBAAqB,OAAA;AACrB,+GAAA,oBAAoB,OAAA;AACpB,+GAAA,oBAAoB,OAAA;AACpB,8GAAA,mBAAmB,OAAA"}
|
|
@@ -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.isURLset = exports.unsetURL = exports.setURL = exports.logout = exports.login = exports.isLogged = void 0;
|
|
7
|
+
const axios_1 = __importDefault(require("../lib/axios"));
|
|
8
|
+
var auth_1 = require("./auth");
|
|
9
|
+
Object.defineProperty(exports, "isLogged", { enumerable: true, get: function () { return auth_1.isLogged; } });
|
|
10
|
+
Object.defineProperty(exports, "login", { enumerable: true, get: function () { return auth_1.login; } });
|
|
11
|
+
Object.defineProperty(exports, "logout", { enumerable: true, get: function () { return auth_1.logout; } });
|
|
12
|
+
/**
|
|
13
|
+
* Set API url to axios
|
|
14
|
+
*
|
|
15
|
+
* @param url The url
|
|
16
|
+
*/
|
|
17
|
+
const setURL = (url) => {
|
|
18
|
+
axios_1.default.defaults.baseURL = url;
|
|
19
|
+
};
|
|
20
|
+
exports.setURL = setURL;
|
|
21
|
+
/**
|
|
22
|
+
* Unset API url from axios
|
|
23
|
+
*/
|
|
24
|
+
const unsetURL = () => {
|
|
25
|
+
axios_1.default.defaults.baseURL = undefined;
|
|
26
|
+
};
|
|
27
|
+
exports.unsetURL = unsetURL;
|
|
28
|
+
/**
|
|
29
|
+
* Check if API url is setup in axios
|
|
30
|
+
*
|
|
31
|
+
* @returns If API url is setup
|
|
32
|
+
*/
|
|
33
|
+
const isURLset = () => !!axios_1.default.defaults.baseURL;
|
|
34
|
+
exports.isURLset = isURLset;
|
|
35
|
+
//# sourceMappingURL=setup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setup.js","sourceRoot":"","sources":["../../../../src/modules/setup.ts"],"names":[],"mappings":";;;;;;AAAA,yDAAiC;AAEjC,+BAAiD;AAAxC,gGAAA,QAAQ,OAAA;AAAE,6FAAA,KAAK,OAAA;AAAE,8FAAA,MAAM,OAAA;AAEhC;;;;GAIG;AACI,MAAM,MAAM,GAAG,CAAC,GAAW,EAAE,EAAE;IACpC,eAAK,CAAC,QAAQ,CAAC,OAAO,GAAG,GAAG,CAAC;AAC/B,CAAC,CAAC;AAFW,QAAA,MAAM,UAEjB;AAEF;;GAEG;AACI,MAAM,QAAQ,GAAG,GAAG,EAAE;IAC3B,eAAK,CAAC,QAAQ,CAAC,OAAO,GAAG,SAAS,CAAC;AACrC,CAAC,CAAC;AAFW,QAAA,QAAQ,YAEnB;AAEF;;;;GAIG;AACI,MAAM,QAAQ,GAAG,GAAG,EAAE,CAAC,CAAC,CAAC,eAAK,CAAC,QAAQ,CAAC,OAAO,CAAC;AAA1C,QAAA,QAAQ,YAAkC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.logout = exports.login = exports.isLogged = exports.isURLset = exports.unsetURL = exports.setURL = void 0;
|
|
4
|
+
var setup_1 = require("./setup");
|
|
5
|
+
Object.defineProperty(exports, "setURL", { enumerable: true, get: function () { return setup_1.setURL; } });
|
|
6
|
+
Object.defineProperty(exports, "unsetURL", { enumerable: true, get: function () { return setup_1.unsetURL; } });
|
|
7
|
+
Object.defineProperty(exports, "isURLset", { enumerable: true, get: function () { return setup_1.isURLset; } });
|
|
8
|
+
var auth_1 = require("./auth");
|
|
9
|
+
Object.defineProperty(exports, "isLogged", { enumerable: true, get: function () { return auth_1.isLogged; } });
|
|
10
|
+
Object.defineProperty(exports, "login", { enumerable: true, get: function () { return auth_1.login; } });
|
|
11
|
+
Object.defineProperty(exports, "logout", { enumerable: true, get: function () { return auth_1.logout; } });
|
|
12
|
+
//# sourceMappingURL=setup.public.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setup.public.js","sourceRoot":"","sources":["../../../../src/modules/setup.public.ts"],"names":[],"mappings":";;;AAAA,iCAIiB;AAHf,+FAAA,MAAM,OAAA;AACN,iGAAA,QAAQ,OAAA;AACR,iGAAA,QAAQ,OAAA;AAGV,+BAIgB;AAHd,gGAAA,QAAQ,OAAA;AACR,6FAAA,KAAK,OAAA;AACL,8FAAA,MAAM,OAAA"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.parseTaskWithNamespace = exports.parseTask = exports.Recurrence = void 0;
|
|
15
|
+
const date_fns_1 = require("date-fns");
|
|
16
|
+
const namespaces_1 = require("./namespaces");
|
|
17
|
+
var Recurrence;
|
|
18
|
+
(function (Recurrence) {
|
|
19
|
+
Recurrence["DAILY"] = "DAILY";
|
|
20
|
+
Recurrence["WEEKLY"] = "WEEKLY";
|
|
21
|
+
Recurrence["MONTHLY"] = "MONTHLY";
|
|
22
|
+
Recurrence["QUARTERLY"] = "QUARTERLY";
|
|
23
|
+
Recurrence["BIENNIAL"] = "BIENNIAL";
|
|
24
|
+
Recurrence["YEARLY"] = "YEARLY";
|
|
25
|
+
})(Recurrence = exports.Recurrence || (exports.Recurrence = {}));
|
|
26
|
+
// Private export
|
|
27
|
+
/**
|
|
28
|
+
* Transform raw data from JSON, to JS usable data
|
|
29
|
+
*
|
|
30
|
+
* @param task Raw task
|
|
31
|
+
*
|
|
32
|
+
* @returns Parsed task
|
|
33
|
+
*/
|
|
34
|
+
const parseTask = (task) => (Object.assign(Object.assign({}, task), { nextRun: (0, date_fns_1.parseISO)(task.nextRun), lastRun: task.lastRun ? (0, date_fns_1.parseISO)(task.lastRun) : undefined, createdAt: (0, date_fns_1.parseISO)(task.createdAt), updatedAt: task.updatedAt ? (0, date_fns_1.parseISO)(task.updatedAt) : undefined }));
|
|
35
|
+
exports.parseTask = parseTask;
|
|
36
|
+
// Private export
|
|
37
|
+
/**
|
|
38
|
+
* Transform raw data from JSON, to JS usable data
|
|
39
|
+
*
|
|
40
|
+
* @param task Raw task with namespace
|
|
41
|
+
*
|
|
42
|
+
* @returns Parsed task with namespace
|
|
43
|
+
*/
|
|
44
|
+
const parseTaskWithNamespace = (task) => {
|
|
45
|
+
const { namespace } = task, rawTask = __rest(task, ["namespace"]);
|
|
46
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
47
|
+
const _a = (0, exports.parseTask)(Object.assign({ namespaceId: namespace.id }, rawTask)), { namespaceId } = _a, parsedTask = __rest(_a, ["namespaceId"]);
|
|
48
|
+
return Object.assign(Object.assign({}, parsedTask), { namespace: (0, namespaces_1.parseNamespace)(namespace) });
|
|
49
|
+
};
|
|
50
|
+
exports.parseTaskWithNamespace = parseTaskWithNamespace;
|
|
51
|
+
//# sourceMappingURL=tasks.base.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tasks.base.js","sourceRoot":"","sources":["../../../../src/modules/tasks.base.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,uCAAoC;AACpC,6CAAiF;AAEjF,IAAY,UAOX;AAPD,WAAY,UAAU;IACpB,6BAAe,CAAA;IACf,+BAAiB,CAAA;IACjB,iCAAmB,CAAA;IACnB,qCAAuB,CAAA;IACvB,mCAAqB,CAAA;IACrB,+BAAiB,CAAA;AACnB,CAAC,EAPW,UAAU,GAAV,kBAAU,KAAV,kBAAU,QAOrB;AAwBD,iBAAiB;AACjB;;;;;;GAMG;AACI,MAAM,SAAS,GAAG,CAAC,IAAa,EAAQ,EAAE,CAAC,iCAC7C,IAAI,KACP,OAAO,EAAE,IAAA,mBAAQ,EAAC,IAAI,CAAC,OAAO,CAAC,EAC/B,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,IAAA,mBAAQ,EAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,SAAS,EAE1D,SAAS,EAAE,IAAA,mBAAQ,EAAC,IAAI,CAAC,SAAS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