@ezpaarse-project/ezreeport-sdk-js 1.0.0-beta.1 → 1.0.0-beta.3
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 +497 -496
- package/dist/browser/ezreeport-sdk-js.mjs.map +1 -1
- package/dist/browser/ezreeport-sdk-js.umd.js +3 -3
- 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 +7 -7
- 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/lib/utils.d.ts +5 -0
- package/dist/types/modules/reports.d.ts +5 -1
- package/dist/types/modules/tasks.d.ts +2 -1
- package/dist/types/modules/templates.d.ts +1 -6
- package/package.json +7 -7
- package/CHANGELOG.md +0 -42
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"templates.js","sourceRoot":"","sources":["../../../src/modules/templates.ts"],"names":[],"mappings":";;;;;;AAAA,yDAAiC;AA+BjC;;;;;;GAMG;AACI,MAAM,eAAe,GAAG,GAAG,EAAE,CAAC,eAAK,CAAC,IAAI,CAAW,YAAY,CAAC,CAAC;AAA3D,QAAA,eAAe,mBAA4C;AAExE;;;;;;;;GAQG;AACI,MAAM,WAAW,GAAG,CAAC,IAAY,EAAE,EAAE,CAAC,eAAK,CAAC,IAAI,CAAe,cAAc,IAAI,EAAE,CAAC,CAAC;AAA/E,QAAA,WAAW,eAAoE"}
|
package/dist/node/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"name": "ezreeport-sdk-js",
|
|
2
|
+
"name": "@ezpaarse-project/ezreeport-sdk-js",
|
|
3
3
|
"version": "1.0.0-beta.3",
|
|
4
4
|
"description": "JS SDK to communicate with ezReeport API",
|
|
5
5
|
"homepage": "https://github.com/ezpaarse-project/ezreeport#readme",
|
|
@@ -40,15 +40,15 @@
|
|
|
40
40
|
]
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"axios": "^1.
|
|
44
|
-
"date-fns": "^2.
|
|
43
|
+
"axios": "^1.4.0",
|
|
44
|
+
"date-fns": "^2.30.0",
|
|
45
45
|
"events": "^3.3.0",
|
|
46
|
-
"typescript": "^5.
|
|
47
|
-
"vite": "^4.
|
|
48
|
-
"vite-plugin-dts": "^2.
|
|
46
|
+
"typescript": "^5.1.3",
|
|
47
|
+
"vite": "^4.3.9",
|
|
48
|
+
"vite-plugin-dts": "^2.3.0"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
|
-
"@types/node": "^
|
|
51
|
+
"@types/node": "^20.2.5"
|
|
52
52
|
},
|
|
53
53
|
"engines": {
|
|
54
54
|
"node": "^16 || ^18"
|
|
@@ -0,0 +1,39 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.version = exports.templates = exports.tasks = exports.setup = exports.reports = exports.queues = exports.namespaces = exports.history = exports.health = exports.crons = exports.auth = void 0;
|
|
27
|
+
exports.auth = __importStar(require("./modules/auth.public"));
|
|
28
|
+
exports.crons = __importStar(require("./modules/crons.public"));
|
|
29
|
+
exports.health = __importStar(require("./modules/health.public"));
|
|
30
|
+
exports.history = __importStar(require("./modules/history.public"));
|
|
31
|
+
exports.namespaces = __importStar(require("./modules/namespaces.public"));
|
|
32
|
+
exports.queues = __importStar(require("./modules/queues.public"));
|
|
33
|
+
exports.reports = __importStar(require("./modules/reports.public"));
|
|
34
|
+
exports.setup = __importStar(require("./modules/setup.public"));
|
|
35
|
+
exports.tasks = __importStar(require("./modules/tasks.public"));
|
|
36
|
+
exports.templates = __importStar(require("./modules/templates.public"));
|
|
37
|
+
var package_json_1 = require("../package.json");
|
|
38
|
+
Object.defineProperty(exports, "version", { enumerable: true, get: function () { return package_json_1.version; } });
|
|
39
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8DAA8C;AAC9C,gEAAgD;AAChD,kEAAkD;AAClD,oEAAoD;AACpD,0EAA0D;AAC1D,kEAAkD;AAClD,oEAAoD;AACpD,gEAAgD;AAChD,gEAAgD;AAChD,wEAAwD;AACxD,gDAA0C;AAAjC,uGAAA,OAAO,OAAA"}
|
|
@@ -0,0 +1,91 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
|
+
exports.axiosWithErrorFormatter = void 0;
|
|
36
|
+
const axios_1 = __importStar(require("axios"));
|
|
37
|
+
const agent = axios_1.default.create({});
|
|
38
|
+
/**
|
|
39
|
+
* Start axios request with basic error handling
|
|
40
|
+
*
|
|
41
|
+
* @param method The request's method
|
|
42
|
+
* @param params The other params of axios
|
|
43
|
+
*
|
|
44
|
+
* @returns Response
|
|
45
|
+
*/
|
|
46
|
+
const axiosWithErrorFormatter = (method, ...params) => __awaiter(void 0, void 0, void 0, function* () {
|
|
47
|
+
try {
|
|
48
|
+
// @ts-expect-error
|
|
49
|
+
return yield agent[method](...params);
|
|
50
|
+
}
|
|
51
|
+
catch (error) {
|
|
52
|
+
if (!(error instanceof axios_1.AxiosError) || !error.response) {
|
|
53
|
+
throw error;
|
|
54
|
+
}
|
|
55
|
+
const res = error.response;
|
|
56
|
+
let message = '';
|
|
57
|
+
switch (res.status) {
|
|
58
|
+
case 400:
|
|
59
|
+
message = 'Check parameters or API token';
|
|
60
|
+
break;
|
|
61
|
+
case 401:
|
|
62
|
+
message = 'You must be logged before using this function, use `auth.login(token)`';
|
|
63
|
+
break;
|
|
64
|
+
case 403:
|
|
65
|
+
message = 'You dont have enough permissions';
|
|
66
|
+
break;
|
|
67
|
+
case 404:
|
|
68
|
+
message = 'Check parameters';
|
|
69
|
+
break;
|
|
70
|
+
case 409:
|
|
71
|
+
message = 'Request conflit with current state';
|
|
72
|
+
break;
|
|
73
|
+
case 500:
|
|
74
|
+
message = 'Something went wrong with server';
|
|
75
|
+
break;
|
|
76
|
+
default:
|
|
77
|
+
break;
|
|
78
|
+
}
|
|
79
|
+
message = `${error.code} (${res.status}) - ${message}: ${res.data.content.message}`;
|
|
80
|
+
throw new Error(message);
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
exports.axiosWithErrorFormatter = axiosWithErrorFormatter;
|
|
84
|
+
exports.default = Object.assign(agent, {
|
|
85
|
+
$get: (...params) => __awaiter(void 0, void 0, void 0, function* () { return (yield (0, exports.axiosWithErrorFormatter)('get', ...params)).data; }),
|
|
86
|
+
$post: (...params) => __awaiter(void 0, void 0, void 0, function* () { return (yield (0, exports.axiosWithErrorFormatter)('post', ...params)).data; }),
|
|
87
|
+
$put: (...params) => __awaiter(void 0, void 0, void 0, function* () { return (yield (0, exports.axiosWithErrorFormatter)('put', ...params)).data; }),
|
|
88
|
+
$patch: (...params) => __awaiter(void 0, void 0, void 0, function* () { return (yield (0, exports.axiosWithErrorFormatter)('patch', ...params)).data; }),
|
|
89
|
+
$delete: (...params) => __awaiter(void 0, void 0, void 0, function* () { return (yield (0, exports.axiosWithErrorFormatter)('delete', ...params)).data; }),
|
|
90
|
+
});
|
|
91
|
+
//# sourceMappingURL=axios.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"axios.js","sourceRoot":"","sources":["../../../../src/lib/axios.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAgE;AAqChE,MAAM,KAAK,GAAG,eAAK,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;AAE/B;;;;;;;GAOG;AACI,MAAM,uBAAuB,GAAG,CACrC,MAAc,EACd,GAAG,MAAiC,EACT,EAAE;IAC7B,IAAI;QACF,mBAAmB;QACnB,OAAO,MAAM,KAAK,CAAC,MAAM,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC;KACvC;IAAC,OAAO,KAAK,EAAE;QACd,IAAI,CAAC,CAAC,KAAK,YAAY,kBAAU,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE;YACrD,MAAM,KAAK,CAAC;SACb;QACD,MAAM,GAAG,GAAuE,KAAK,CAAC,QAAQ,CAAC;QAE/F,IAAI,OAAO,GAAG,EAAE,CAAC;QACjB,QAAQ,GAAG,CAAC,MAAM,EAAE;YAClB,KAAK,GAAG;gBACN,OAAO,GAAG,+BAA+B,CAAC;gBAC1C,MAAM;YACR,KAAK,GAAG;gBACN,OAAO,GAAG,wEAAwE,CAAC;gBACnF,MAAM;YACR,KAAK,GAAG;gBACN,OAAO,GAAG,kCAAkC,CAAC;gBAC7C,MAAM;YACR,KAAK,GAAG;gBACN,OAAO,GAAG,kBAAkB,CAAC;gBAC7B,MAAM;YACR,KAAK,GAAG;gBACN,OAAO,GAAG,oCAAoC,CAAC;gBAC/C,MAAM;YACR,KAAK,GAAG;gBACN,OAAO,GAAG,kCAAkC,CAAC;gBAC7C,MAAM;YAER;gBACE,MAAM;SACT;QACD,OAAO,GAAG,GAAG,KAAK,CAAC,IAAI,KAAK,GAAG,CAAC,MAAM,OAAO,OAAO,KAAK,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;QACpF,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC;KAC1B;AACH,CAAC,CAAA,CAAC;AAxCW,QAAA,uBAAuB,2BAwClC;AAEF,kBAAe,MAAM,CAAC,MAAM,CAC1B,KAAK,EACL;IACE,IAAI,EAAE,CAAU,GAAG,MAAgC,EAAE,EAAE,kDAAC,OAAA,CAAC,MAAM,IAAA,+BAAuB,EAAwB,KAAK,EAAE,GAAG,MAAM,CAAC,CAAC,CAAC,IAAI,CAAA,GAAA;IACrI,KAAK,EAAE,CAAU,GAAG,MAAiC,EAAE,EAAE,kDAAC,OAAA,CAAC,MAAM,IAAA,+BAAuB,EAAyB,MAAM,EAAE,GAAG,MAAM,CAAC,CAAC,CAAC,IAAI,CAAA,GAAA;IACzI,IAAI,EAAE,CAAU,GAAG,MAAgC,EAAE,EAAE,kDAAC,OAAA,CAAC,MAAM,IAAA,+BAAuB,EAAwB,KAAK,EAAE,GAAG,MAAM,CAAC,CAAC,CAAC,IAAI,CAAA,GAAA;IACrI,MAAM,EAAE,CAAU,GAAG,MAAkC,EAAE,EAAE,kDAAC,OAAA,CAAC,MAAM,IAAA,+BAAuB,EAA0B,OAAO,EAAE,GAAG,MAAM,CAAC,CAAC,CAAC,IAAI,CAAA,GAAA;IAC7I,OAAO,EAAE,CAAU,GAAG,MAAmC,EAAE,EAAE,kDAAC,OAAA,CAAC,MAAM,IAAA,+BAAuB,EAA2B,QAAQ,EAAE,GAAG,MAAM,CAAC,CAAC,CAAC,IAAI,CAAA,GAAA;CAClJ,CACF,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
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
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
7
|
+
const events_1 = __importDefault(require("events"));
|
|
8
|
+
/**
|
|
9
|
+
* Attach a `EventEmitter` to a `Promise` returned by the `executor`
|
|
10
|
+
*
|
|
11
|
+
* @param executor Executor returning the promise. The `emitter` is passed to the executor as param.
|
|
12
|
+
* @param emitter `EventEmitter` attached. By default it's a new instance.
|
|
13
|
+
*
|
|
14
|
+
* @returns The EventfulPromise
|
|
15
|
+
*/
|
|
16
|
+
const createEventfulPromise = (executor, emitter = new events_1.default()) => {
|
|
17
|
+
const customEmitter = {
|
|
18
|
+
emit: (eventName, ...args) => {
|
|
19
|
+
emitter.emit(eventName.toString(), ...args);
|
|
20
|
+
return customEmitter;
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
const promise = executor(customEmitter);
|
|
24
|
+
const res = Object.assign(promise, {
|
|
25
|
+
on: (eventName, listener) => {
|
|
26
|
+
emitter.on(eventName.toString(), (...p) => listener(...p));
|
|
27
|
+
return res;
|
|
28
|
+
},
|
|
29
|
+
once: (eventName, listener) => {
|
|
30
|
+
emitter.once(eventName.toString(), (...p) => listener(...p));
|
|
31
|
+
return res;
|
|
32
|
+
},
|
|
33
|
+
off: (eventName, listener) => {
|
|
34
|
+
emitter.off(eventName.toString(), (...p) => listener(...p));
|
|
35
|
+
return res;
|
|
36
|
+
},
|
|
37
|
+
});
|
|
38
|
+
return res;
|
|
39
|
+
};
|
|
40
|
+
exports.default = createEventfulPromise;
|
|
41
|
+
//# sourceMappingURL=promises.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"promises.js","sourceRoot":"","sources":["../../../../src/lib/promises.ts"],"names":[],"mappings":";;;;;AAAA,uDAAuD;AACvD,oDAAkC;AAYlC;;;;;;;GAOG;AACH,MAAM,qBAAqB,GAAG,CAC5B,QAAqD,EACrD,OAAO,GAAG,IAAI,gBAAY,EAAE,EACL,EAAE;I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setTimeoutAsync = void 0;
|
|
4
|
+
const date_fns_1 = require("date-fns");
|
|
5
|
+
/**
|
|
6
|
+
* Async version of `setTimeout`
|
|
7
|
+
*
|
|
8
|
+
* @param ms Time to wait
|
|
9
|
+
*/
|
|
10
|
+
const setTimeoutAsync = (ms) => new Promise((resolve) => { setTimeout(resolve, ms); });
|
|
11
|
+
exports.setTimeoutAsync = setTimeoutAsync;
|
|
12
|
+
/**
|
|
13
|
+
* Transform raw data from JSON, to JS usable data
|
|
14
|
+
*
|
|
15
|
+
* @param period Raw period
|
|
16
|
+
*
|
|
17
|
+
* @returns Parsed period
|
|
18
|
+
*/
|
|
19
|
+
const parsePeriod = (period) => ({
|
|
20
|
+
start: (0, date_fns_1.parseISO)(period.start),
|
|
21
|
+
end: (0, date_fns_1.parseISO)(period.end),
|
|
22
|
+
});
|
|
23
|
+
exports.parsePeriod = parsePeriod;
|
|
24
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../src/lib/utils.ts"],"names":[],"mappings":";;;AAAA,uCAAoC;AAOpC;;;;GAIG;AACI,MAAM,eAAe,GAAG,CAAC,EAAU,EAAE,EAAE,CAAC,IAAI,OAAO,CACxD,CAAC,OAAO,EAAE,EAAE,GAAG,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAC1C,CAAC;AAFW,QAAA,eAAe,mBAE1B;AAYF;;;;;;GAMG;AACI,MAAM,WAAW,GAAG,CAAC,MAAiB,EAAU,EAAE,CAAC,CAAC;IACzD,KAAK,EAAE,IAAA,mBAAQ,EAAC,MAAM,CAAC,KAAK,CAAC;IAC7B,GAAG,EAAE,IAAA,mBAAQ,EAAC,MAAM,CAAC,GAAG,CAAC;CAC1B,CAAC,CAAC;AAHU,QAAA,WAAW,eAGrB"}
|
|
@@ -0,0 +1,111 @@
|
|
|
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 __rest = (this && this.__rest) || function (s, e) {
|
|
12
|
+
var t = {};
|
|
13
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
14
|
+
t[p] = s[p];
|
|
15
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
16
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
17
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
18
|
+
t[p[i]] = s[p[i]];
|
|
19
|
+
}
|
|
20
|
+
return t;
|
|
21
|
+
};
|
|
22
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
23
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.getCurrentNamespaces = exports.getCurrentPermissions = exports.getCurrentUser = exports.isLogged = exports.logout = exports.login = exports.Access = void 0;
|
|
27
|
+
const date_fns_1 = require("date-fns");
|
|
28
|
+
const axios_1 = __importDefault(require("../lib/axios"));
|
|
29
|
+
const namespaces_1 = require("./namespaces");
|
|
30
|
+
var Access;
|
|
31
|
+
(function (Access) {
|
|
32
|
+
Access["READ"] = "READ";
|
|
33
|
+
Access["READ_WRITE"] = "READ_WRITE";
|
|
34
|
+
Access["SUPER_USER"] = "SUPER_USER";
|
|
35
|
+
})(Access || (exports.Access = Access = {}));
|
|
36
|
+
/**
|
|
37
|
+
* Transform raw data from JSON, to JS usable data
|
|
38
|
+
*
|
|
39
|
+
* @param membership Raw membership
|
|
40
|
+
*
|
|
41
|
+
* @returns Parsed membership
|
|
42
|
+
*/
|
|
43
|
+
const parseMembership = (membership) => (Object.assign(Object.assign({}, membership), { namespace: (0, namespaces_1.parseNamespace)(membership.namespace), createdAt: (0, date_fns_1.parseISO)(membership.createdAt), updatedAt: membership.updatedAt ? (0, date_fns_1.parseISO)(membership.updatedAt) : undefined }));
|
|
44
|
+
/**
|
|
45
|
+
* Transform raw data from JSON, to JS usable data
|
|
46
|
+
*
|
|
47
|
+
* @param user Raw user
|
|
48
|
+
*
|
|
49
|
+
* @returns Parsed user
|
|
50
|
+
*/
|
|
51
|
+
const parseUser = (user) => (Object.assign(Object.assign({}, user), { memberships: user.memberships.map(parseMembership), createdAt: (0, date_fns_1.parseISO)(user.createdAt), updatedAt: user.updatedAt ? (0, date_fns_1.parseISO)(user.updatedAt) : undefined }));
|
|
52
|
+
/**
|
|
53
|
+
* Set auth token to axios
|
|
54
|
+
*
|
|
55
|
+
* @param token The auth token
|
|
56
|
+
*/
|
|
57
|
+
const login = (token) => {
|
|
58
|
+
axios_1.default.defaults.headers.common.authorization = `Bearer ${token}`;
|
|
59
|
+
};
|
|
60
|
+
exports.login = login;
|
|
61
|
+
/**
|
|
62
|
+
* Unset auth token from axios
|
|
63
|
+
*/
|
|
64
|
+
const logout = () => {
|
|
65
|
+
axios_1.default.defaults.headers.common.authorization = undefined;
|
|
66
|
+
};
|
|
67
|
+
exports.logout = logout;
|
|
68
|
+
/**
|
|
69
|
+
* Check if auth token is setup in axios. **DOESN'T CHECK IF TOKEN IS VALID !**
|
|
70
|
+
*
|
|
71
|
+
* @returns If auth token is setup
|
|
72
|
+
*/
|
|
73
|
+
const isLogged = () => {
|
|
74
|
+
const bearer = axios_1.default.defaults.headers.common.authorization;
|
|
75
|
+
if (!bearer || typeof bearer !== 'string')
|
|
76
|
+
return false;
|
|
77
|
+
const [, token] = bearer.split('Bearer ');
|
|
78
|
+
return !!token;
|
|
79
|
+
};
|
|
80
|
+
exports.isLogged = isLogged;
|
|
81
|
+
/**
|
|
82
|
+
* Get logged user info
|
|
83
|
+
*
|
|
84
|
+
* Needs `general.auth-get` permission
|
|
85
|
+
*
|
|
86
|
+
* @returns The logged user info
|
|
87
|
+
*/
|
|
88
|
+
const getCurrentUser = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
89
|
+
const _a = yield axios_1.default.$get('/me'), { content } = _a, response = __rest(_a, ["content"]);
|
|
90
|
+
return Object.assign(Object.assign({}, response), { content: parseUser(content) });
|
|
91
|
+
});
|
|
92
|
+
exports.getCurrentUser = getCurrentUser;
|
|
93
|
+
/**
|
|
94
|
+
* Get logged user permissions
|
|
95
|
+
*
|
|
96
|
+
* Needs `namespaces[namespaceId].auth-get-permissions` permission
|
|
97
|
+
*
|
|
98
|
+
* @returns Permissions
|
|
99
|
+
*/
|
|
100
|
+
const getCurrentPermissions = () => axios_1.default.$get('/me/permissions');
|
|
101
|
+
exports.getCurrentPermissions = getCurrentPermissions;
|
|
102
|
+
/**
|
|
103
|
+
* Get logged user accessible namespaces
|
|
104
|
+
*
|
|
105
|
+
* Needs `namespaces[namespaceId].auth-get-namespaces` permission
|
|
106
|
+
*
|
|
107
|
+
* @returns Permissions
|
|
108
|
+
*/
|
|
109
|
+
const getCurrentNamespaces = () => axios_1.default.$get('/me/namespaces');
|
|
110
|
+
exports.getCurrentNamespaces = getCurrentNamespaces;
|
|
111
|
+
//# sourceMappingURL=auth.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../../../src/modules/auth.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAoC;AACpC,yDAAkD;AAClD,6CA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I,MAAM,QAAQ,GAAG,GAAG,EAAE;IAC3B,MAAM,MAAM,GAAG,eAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,aAAa,CAAC;IAC3D,IAAI,CAAC,MAAM,IAAI,OAAO,MAAM,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IACxD,MAAM,CAAC,EAAE,KAAK,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;IAC1C,OAAO,CAAC,CAAC,KAAK,CAAC;AACjB,CAAC,CAAC;AALW,QAAA,QAAQ,YAKnB;AAEF;;;;;;GAMG;AACI,MAAM,cAAc,GAAG,GAAqC,EAAE;IACnE,MAAM,KAA2B,MAAM,eAAK,CAAC,IAAI,CAAU,KAAK,CAAC,EAA3D,EAAE,OAAO,OAAkD,EAA7C,QAAQ,cAAtB,WAAwB,CAAmC,CAAC;IAClE,uCACK,QAAQ,KACX,OAAO,EAAE,SAAS,CAAC,OAAO,CAAC,IAC3B;AACJ,CAAC,CAAA,CAAC;AANW,QAAA,cAAc,kBAMzB;AAEF;;;;;;GAMG;AACI,MAAM,qBAAqB,GAAG,GAAG,EAAE,CAAC,eAAK,CAAC,IAAI,CAAc,iBAAiB,CAAC,CAAC;AAAzE,QAAA,qBAAqB,yBAAoD;AAEtF;;;;;;GAMG;AACI,MAAM,oBAAoB,GAAG,GAAG,EAAE,CAAC,eAAK,CAAC,IAAI,CAAc,gBAAgB,CAAC,CAAC;AAAvE,QAAA,oBAAoB,wBAAmD"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getCurrentPermissions = exports.getCurrentNamespaces = exports.getCurrentUser = exports.isLogged = exports.logout = exports.login = void 0;
|
|
4
|
+
var auth_1 = require("./auth");
|
|
5
|
+
Object.defineProperty(exports, "login", { enumerable: true, get: function () { return auth_1.login; } });
|
|
6
|
+
Object.defineProperty(exports, "logout", { enumerable: true, get: function () { return auth_1.logout; } });
|
|
7
|
+
Object.defineProperty(exports, "isLogged", { enumerable: true, get: function () { return auth_1.isLogged; } });
|
|
8
|
+
Object.defineProperty(exports, "getCurrentUser", { enumerable: true, get: function () { return auth_1.getCurrentUser; } });
|
|
9
|
+
Object.defineProperty(exports, "getCurrentNamespaces", { enumerable: true, get: function () { return auth_1.getCurrentNamespaces; } });
|
|
10
|
+
Object.defineProperty(exports, "getCurrentPermissions", { enumerable: true, get: function () { return auth_1.getCurrentPermissions; } });
|
|
11
|
+
//# sourceMappingURL=auth.public.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.public.js","sourceRoot":"","sources":["../../../../src/modules/auth.public.ts"],"names":[],"mappings":";;;AAAA,+BAWgB;AANd,6FAAA,KAAK,OAAA;AACL,8FAAA,MAAM,OAAA;AACN,gGAAA,QAAQ,OAAA;AACR,sGAAA,cAAc,OAAA;AACd,4GAAA,oBAAoB,OAAA;AACpB,6GAAA,qBAAqB,OAAA"}
|
|
@@ -0,0 +1,105 @@
|
|
|
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 __rest = (this && this.__rest) || function (s, e) {
|
|
12
|
+
var t = {};
|
|
13
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
14
|
+
t[p] = s[p];
|
|
15
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
16
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
17
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
18
|
+
t[p[i]] = s[p[i]];
|
|
19
|
+
}
|
|
20
|
+
return t;
|
|
21
|
+
};
|
|
22
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
23
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.forceCron = exports.stopCron = exports.startCron = exports.getCron = exports.getAllCrons = void 0;
|
|
27
|
+
const date_fns_1 = require("date-fns");
|
|
28
|
+
const axios_1 = __importDefault(require("../lib/axios"));
|
|
29
|
+
/**
|
|
30
|
+
* Transform raw data from JSON, to JS usable data
|
|
31
|
+
*
|
|
32
|
+
* @param cron Raw cron
|
|
33
|
+
*
|
|
34
|
+
* @returns Parsed cron
|
|
35
|
+
*/
|
|
36
|
+
const parseCron = (cron) => (Object.assign(Object.assign({}, cron), { nextRun: cron.nextRun ? (0, date_fns_1.parseISO)(cron.nextRun) : undefined, lastRun: cron.lastRun ? (0, date_fns_1.parseISO)(cron.lastRun) : undefined }));
|
|
37
|
+
/**
|
|
38
|
+
* Get all available crons
|
|
39
|
+
*
|
|
40
|
+
* Needs `general.crons-get` permission
|
|
41
|
+
*
|
|
42
|
+
* @returns All crons' info
|
|
43
|
+
*/
|
|
44
|
+
const getAllCrons = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
45
|
+
const _a = yield axios_1.default.$get('/crons'), { content } = _a, response = __rest(_a, ["content"]);
|
|
46
|
+
return Object.assign(Object.assign({}, response), { content: content.map(parseCron) });
|
|
47
|
+
});
|
|
48
|
+
exports.getAllCrons = getAllCrons;
|
|
49
|
+
/**
|
|
50
|
+
* Get cron info
|
|
51
|
+
*
|
|
52
|
+
* Needs `general.crons-get-cron` permission
|
|
53
|
+
*
|
|
54
|
+
* @param name Cron name
|
|
55
|
+
*
|
|
56
|
+
* @returns Cron's info
|
|
57
|
+
*/
|
|
58
|
+
const getCron = (name) => __awaiter(void 0, void 0, void 0, function* () {
|
|
59
|
+
const _b = yield axios_1.default.$get(`/crons/${name}`), { content } = _b, response = __rest(_b, ["content"]);
|
|
60
|
+
return Object.assign(Object.assign({}, response), { content: parseCron(content) });
|
|
61
|
+
});
|
|
62
|
+
exports.getCron = getCron;
|
|
63
|
+
/**
|
|
64
|
+
* Start cron
|
|
65
|
+
*
|
|
66
|
+
* Needs `general.crons-put-cron-start` permission
|
|
67
|
+
*
|
|
68
|
+
* @param name Cron name
|
|
69
|
+
*
|
|
70
|
+
* @returns Cron's info
|
|
71
|
+
*/
|
|
72
|
+
const startCron = (name) => __awaiter(void 0, void 0, void 0, function* () {
|
|
73
|
+
const _c = yield axios_1.default.$put(`/crons/${name}/start`), { content } = _c, response = __rest(_c, ["content"]);
|
|
74
|
+
return Object.assign(Object.assign({}, response), { content: parseCron(content) });
|
|
75
|
+
});
|
|
76
|
+
exports.startCron = startCron;
|
|
77
|
+
/**
|
|
78
|
+
* Stop cron
|
|
79
|
+
*
|
|
80
|
+
* Needs `general.crons-put-cron-stop` permission
|
|
81
|
+
*
|
|
82
|
+
* @param name Cron name
|
|
83
|
+
*
|
|
84
|
+
* @returns Cron's info
|
|
85
|
+
*/
|
|
86
|
+
const stopCron = (name) => __awaiter(void 0, void 0, void 0, function* () {
|
|
87
|
+
const _d = yield axios_1.default.$put(`/crons/${name}/stop`), { content } = _d, response = __rest(_d, ["content"]);
|
|
88
|
+
return Object.assign(Object.assign({}, response), { content: parseCron(content) });
|
|
89
|
+
});
|
|
90
|
+
exports.stopCron = stopCron;
|
|
91
|
+
/**
|
|
92
|
+
* Force cron to run
|
|
93
|
+
*
|
|
94
|
+
* Needs `general.crons-post-cron-force` permission
|
|
95
|
+
*
|
|
96
|
+
* @param name Cron name
|
|
97
|
+
*
|
|
98
|
+
* @returns Cron's info
|
|
99
|
+
*/
|
|
100
|
+
const forceCron = (name) => __awaiter(void 0, void 0, void 0, function* () {
|
|
101
|
+
const _e = yield axios_1.default.$post(`/crons/${name}/force`), { content } = _e, response = __rest(_e, ["content"]);
|
|
102
|
+
return Object.assign(Object.assign({}, response), { content: parseCron(content) });
|
|
103
|
+
});
|
|
104
|
+
exports.forceCron = forceCron;
|
|
105
|
+
//# sourceMappingURL=crons.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"crons.js","sourceRoot":"","sources":["../../../../src/modules/crons.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAoC;AACpC,yDAAuD;AAcvD;;;;;;GAMG;AACH,MAAM,SAAS,GAAG,CAAC,IAAa,EAAQ,EAAE,CAAC,iCACtC,IAAI,KACP,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,IAAA,mBAAQ,EAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,SAAS,EAC1D,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,IAAA,mBAAQ,EAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,SAAS,IAC1D,CAAC;AAEH;;;;;;GAMG;AACI,MAAM,WAAW,GAAG,GAAuC,EAAE;IAClE,MAAM,KAA2B,MAAM,eAAK,CAAC,IAAI,CAAY,QAAQ,CAAC,EAAhE,EAAE,OAAO,OAAuD,EAAlD,QAAQ,cAAtB,WAAwB,CAAwC,CAAC;IACvE,uCACK,QAAQ,KACX,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,IAC/B;AACJ,CAAC,CAAA,CAAC;AANW,QAAA,WAAW,eAMtB;AAEF;;;;;;;;GAQG;AACI,MAAM,OAAO,GAAG,CAAO,IAAkB,EAA8B,EAAE;IAC9E,MAAM,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|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.forceCron = exports.stopCron = exports.startCron = exports.getCron = exports.getAllCrons = void 0;
|
|
4
|
+
var crons_1 = require("./crons");
|
|
5
|
+
Object.defineProperty(exports, "getAllCrons", { enumerable: true, get: function () { return crons_1.getAllCrons; } });
|
|
6
|
+
Object.defineProperty(exports, "getCron", { enumerable: true, get: function () { return crons_1.getCron; } });
|
|
7
|
+
Object.defineProperty(exports, "startCron", { enumerable: true, get: function () { return crons_1.startCron; } });
|
|
8
|
+
Object.defineProperty(exports, "stopCron", { enumerable: true, get: function () { return crons_1.stopCron; } });
|
|
9
|
+
Object.defineProperty(exports, "forceCron", { enumerable: true, get: function () { return crons_1.forceCron; } });
|
|
10
|
+
//# sourceMappingURL=crons.public.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"crons.public.js","sourceRoot":"","sources":["../../../../src/modules/crons.public.ts"],"names":[],"mappings":";;;AAAA,iCAOiB;AALf,oGAAA,WAAW,OAAA;AACX,gGAAA,OAAO,OAAA;AACP,kGAAA,SAAS,OAAA;AACT,iGAAA,QAAQ,OAAA;AACR,kGAAA,SAAS,OAAA"}
|
|
@@ -0,0 +1,60 @@
|
|
|
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 __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.checkCurrentService = exports.checkConnectedService = exports.checkAllConnectedService = exports.getAllConnectedServices = void 0;
|
|
16
|
+
const axios_1 = __importDefault(require("../lib/axios"));
|
|
17
|
+
/**
|
|
18
|
+
* Get all services connected to current
|
|
19
|
+
*
|
|
20
|
+
* Needs `general.health-get` permission
|
|
21
|
+
*
|
|
22
|
+
* @returns The current service & the name of connected ones
|
|
23
|
+
*/
|
|
24
|
+
const getAllConnectedServices = () => axios_1.default.$get('/health');
|
|
25
|
+
exports.getAllConnectedServices = getAllConnectedServices;
|
|
26
|
+
/**
|
|
27
|
+
* Check connection for all connected service from current
|
|
28
|
+
*
|
|
29
|
+
* Needs `general.health-get-all` permission
|
|
30
|
+
*
|
|
31
|
+
* @returns The connection status for all services
|
|
32
|
+
*/
|
|
33
|
+
const checkAllConnectedService = () => axios_1.default.$get('/health/all');
|
|
34
|
+
exports.checkAllConnectedService = checkAllConnectedService;
|
|
35
|
+
/**
|
|
36
|
+
* Check connection of a specific service from current
|
|
37
|
+
*
|
|
38
|
+
* Needs `general.health-get-service` permission
|
|
39
|
+
*
|
|
40
|
+
* @param service The name of the service
|
|
41
|
+
*
|
|
42
|
+
* @returns The connection status of the service from current
|
|
43
|
+
*/
|
|
44
|
+
const checkConnectedService = (service) => axios_1.default.$get(`/health/${service}`);
|
|
45
|
+
exports.checkConnectedService = checkConnectedService;
|
|
46
|
+
/**
|
|
47
|
+
* Check connection of current service
|
|
48
|
+
*
|
|
49
|
+
* It's useful when the app will have limited connection, or if you just want the processing time.
|
|
50
|
+
*
|
|
51
|
+
* Needs `general.health-get-all` & `general.health-get-service` permission
|
|
52
|
+
*
|
|
53
|
+
* @returns The connection status of current service
|
|
54
|
+
*/
|
|
55
|
+
const checkCurrentService = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
56
|
+
const { content: { current } } = yield (0, exports.getAllConnectedServices)();
|
|
57
|
+
return (0, exports.checkConnectedService)(current);
|
|
58
|
+
});
|
|
59
|
+
exports.checkCurrentService = checkCurrentService;
|
|
60
|
+
//# sourceMappingURL=health.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"health.js","sourceRoot":"","sources":["../../../../src/modules/health.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,yDAAiC;AAiBjC;;;;;;GAMG;AACI,MAAM,uBAAuB,GAAG,GAAG,EAAE,CAAC,eAAK,CAAC,IAAI,CAA8E,SAAS,CAAC,CAAC;AAAnI,QAAA,uBAAuB,2BAA4G;AAEhJ;;;;;;GAMG;AACI,MAAM,wBAAwB,GAAG,GAAG,EAAE,CAAC,eAAK,CAAC,IAAI,CAAe,aAAa,CAAC,CAAC;AAAzE,QAAA,wBAAwB,4BAAiD;AAEtF;;;;;;;;GAQG;AACI,MAAM,qBAAqB,GAAG,CAAC,OAA2B,EAAE,EAAE,CAAC,eAAK,CAAC,IAAI,CAAa,WAAW,OAAO,EAAE,CAAC,CAAC;AAAtG,QAAA,qBAAqB,yBAAiF;AAEnH;;;;;;;;GAQG;AACI,MAAM,mBAAmB,GAAG,GAAS,EAAE;IAC5C,MAAM,EAAE,OAAO,EAAE,EAAE,OAAO,EAAE,EAAE,GAAG,MAAM,IAAA,+BAAuB,GAAE,CAAC;IACjE,OAAO,IAAA,6BAAqB,EAAC,OAAO,CAAC,CAAC;AACxC,CAAC,CAAA,CAAC;AAHW,QAAA,mBAAmB,uBAG9B"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.checkCurrentService = exports.checkConnectedService = exports.checkAllConnectedService = exports.getAllConnectedServices = void 0;
|
|
4
|
+
var health_1 = require("./health");
|
|
5
|
+
Object.defineProperty(exports, "getAllConnectedServices", { enumerable: true, get: function () { return health_1.getAllConnectedServices; } });
|
|
6
|
+
Object.defineProperty(exports, "checkAllConnectedService", { enumerable: true, get: function () { return health_1.checkAllConnectedService; } });
|
|
7
|
+
Object.defineProperty(exports, "checkConnectedService", { enumerable: true, get: function () { return health_1.checkConnectedService; } });
|
|
8
|
+
Object.defineProperty(exports, "checkCurrentService", { enumerable: true, get: function () { return health_1.checkCurrentService; } });
|
|
9
|
+
//# sourceMappingURL=health.public.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"health.public.js","sourceRoot":"","sources":["../../../../src/modules/health.public.ts"],"names":[],"mappings":";;;AAAA,mCAMkB;AAJhB,iHAAA,uBAAuB,OAAA;AACvB,kHAAA,wBAAwB,OAAA;AACxB,+GAAA,qBAAqB,OAAA;AACrB,6GAAA,mBAAmB,OAAA"}
|