@ezpaarse-project/ezreeport-sdk-js 3.0.0-rc.0 → 3.1.0-rc.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.
- package/dist/api-BMa8Xm_O.js +14 -0
- package/dist/api-Bux99RKM.d.ts +27 -0
- package/dist/api-Bux99RKM.d.ts.map +1 -0
- package/dist/api-CAycTX8Z.d.mts +27 -0
- package/dist/api-CAycTX8Z.d.mts.map +1 -0
- package/dist/api-DFielZ98.mjs +10 -0
- package/dist/api-DFielZ98.mjs.map +1 -0
- package/dist/asyncToGenerator-BTgp0X8Q.mjs +28 -0
- package/dist/asyncToGenerator-D0muCXnm.js +34 -0
- package/dist/auth.d.mts +47 -0
- package/dist/auth.d.mts.map +1 -0
- package/dist/auth.d.ts +20 -16
- package/dist/auth.d.ts.map +1 -0
- package/dist/auth.js +8 -2
- package/dist/auth.mjs +6 -7
- package/dist/body-BeZQpy9P.d.mts +20 -0
- package/dist/body-BeZQpy9P.d.mts.map +1 -0
- package/dist/{body-ADynkNh0.d.ts → body-CBEqKjUe.d.ts} +12 -10
- package/dist/body-CBEqKjUe.d.ts.map +1 -0
- package/dist/crons.d.mts +19 -0
- package/dist/crons.d.mts.map +1 -0
- package/dist/crons.d.ts +10 -7
- package/dist/crons.d.ts.map +1 -0
- package/dist/crons.js +70 -2
- package/dist/crons.mjs +62 -87
- package/dist/crons.mjs.map +1 -1
- package/dist/decorator-Bjs7qJx3.mjs +46 -0
- package/dist/decorator-Bjs7qJx3.mjs.map +1 -0
- package/dist/decorator-DkHkhO2_.js +63 -0
- package/dist/elastic.d.mts +29 -0
- package/dist/elastic.d.mts.map +1 -0
- package/dist/elastic.d.ts +6 -3
- package/dist/elastic.d.ts.map +1 -0
- package/dist/elastic.js +53 -2
- package/dist/elastic.mjs +51 -48
- package/dist/elastic.mjs.map +1 -1
- package/dist/fetch-BoGJTvlB.js +84 -0
- package/dist/fetch-DcGZzMm-.mjs +73 -0
- package/dist/fetch-DcGZzMm-.mjs.map +1 -0
- package/dist/figures-Bdr-CTN1.mjs +252 -0
- package/dist/figures-Bdr-CTN1.mjs.map +1 -0
- package/dist/figures-cK0cMwpV.js +454 -0
- package/dist/generations.d.mts +20 -0
- package/dist/generations.d.mts.map +1 -0
- package/dist/generations.d.ts +13 -10
- package/dist/generations.d.ts.map +1 -0
- package/dist/generations.js +13 -2
- package/dist/generations.mjs +11 -7
- package/dist/health.d.mts +38 -0
- package/dist/health.d.mts.map +1 -0
- package/dist/health.d.ts +25 -22
- package/dist/health.d.ts.map +1 -0
- package/dist/health.js +25 -2
- package/dist/health.mjs +25 -42
- package/dist/health.mjs.map +1 -1
- package/dist/helpers/aggregations.d.mts +5 -0
- package/dist/helpers/aggregations.d.ts +5 -120
- package/dist/helpers/aggregations.js +128 -2
- package/dist/helpers/aggregations.mjs +123 -39
- package/dist/helpers/aggregations.mjs.map +1 -1
- package/dist/helpers/figures.d.mts +7 -0
- package/dist/helpers/figures.d.ts +7 -221
- package/dist/helpers/figures.js +32 -2
- package/dist/helpers/figures.mjs +4 -33
- package/dist/helpers/filters.d.mts +12 -0
- package/dist/helpers/filters.d.mts.map +1 -0
- package/dist/helpers/filters.d.ts +8 -4
- package/dist/helpers/filters.d.ts.map +1 -0
- package/dist/helpers/filters.js +8 -2
- package/dist/helpers/filters.mjs +7 -6
- package/dist/helpers/filters.mjs.map +1 -1
- package/dist/helpers/generations.d.mts +62 -0
- package/dist/helpers/generations.d.mts.map +1 -0
- package/dist/helpers/generations.d.ts +24 -17
- package/dist/helpers/generations.d.ts.map +1 -0
- package/dist/helpers/generations.js +120 -2
- package/dist/helpers/generations.mjs +116 -306
- package/dist/helpers/generations.mjs.map +1 -1
- package/dist/helpers/layouts.d.mts +11 -0
- package/dist/helpers/layouts.d.ts +11 -24
- package/dist/helpers/layouts.js +17 -2
- package/dist/helpers/layouts.mjs +5 -44
- package/dist/helpers/permissions.d.mts +20 -0
- package/dist/helpers/permissions.d.mts.map +1 -0
- package/dist/helpers/permissions.d.ts +5 -2
- package/dist/helpers/permissions.d.ts.map +1 -0
- package/dist/helpers/permissions.js +49 -2
- package/dist/helpers/permissions.mjs +47 -42
- package/dist/helpers/permissions.mjs.map +1 -1
- package/dist/helpers/task-presets.d.mts +21 -0
- package/dist/helpers/task-presets.d.mts.map +1 -0
- package/dist/helpers/task-presets.d.ts +10 -5
- package/dist/helpers/task-presets.d.ts.map +1 -0
- package/dist/helpers/task-presets.js +41 -2
- package/dist/helpers/task-presets.mjs +41 -38
- package/dist/helpers/task-presets.mjs.map +1 -1
- package/dist/helpers/tasks.d.mts +81 -0
- package/dist/helpers/tasks.d.mts.map +1 -0
- package/dist/helpers/tasks.d.ts +44 -34
- package/dist/helpers/tasks.d.ts.map +1 -0
- package/dist/helpers/tasks.js +220 -2
- package/dist/helpers/tasks.mjs +193 -210
- package/dist/helpers/tasks.mjs.map +1 -1
- package/dist/helpers/templates.d.mts +43 -0
- package/dist/helpers/templates.d.mts.map +1 -0
- package/dist/helpers/templates.d.ts +27 -18
- package/dist/helpers/templates.d.ts.map +1 -0
- package/dist/helpers/templates.js +132 -2
- package/dist/helpers/templates.mjs +111 -120
- package/dist/helpers/templates.mjs.map +1 -1
- package/dist/index-8Jjx2sF7.d.ts +123 -0
- package/dist/index-8Jjx2sF7.d.ts.map +1 -0
- package/dist/index-B1i_oJHZ.d.mts +62 -0
- package/dist/index-B1i_oJHZ.d.mts.map +1 -0
- package/dist/index-BM9ZEIo1.d.mts +112 -0
- package/dist/index-BM9ZEIo1.d.mts.map +1 -0
- package/dist/index-BQMs7hcI.d.mts +123 -0
- package/dist/index-BQMs7hcI.d.mts.map +1 -0
- package/dist/index-BwnTPP7V.d.mts +34 -0
- package/dist/index-BwnTPP7V.d.mts.map +1 -0
- package/dist/index-CFTcAzkv.d.ts +62 -0
- package/dist/index-CFTcAzkv.d.ts.map +1 -0
- package/dist/index-CLUuJN2U.d.ts +34 -0
- package/dist/index-CLUuJN2U.d.ts.map +1 -0
- package/dist/index-C_kFLsnO.d.ts +229 -0
- package/dist/index-C_kFLsnO.d.ts.map +1 -0
- package/dist/index-DIYCM-ZC.d.mts +73 -0
- package/dist/index-DIYCM-ZC.d.mts.map +1 -0
- package/dist/index-DdWYJWZx.d.mts +57 -0
- package/dist/index-DdWYJWZx.d.mts.map +1 -0
- package/dist/index-DwY7Gx4v.d.ts +73 -0
- package/dist/index-DwY7Gx4v.d.ts.map +1 -0
- package/dist/index-WThwo4GE.d.mts +229 -0
- package/dist/index-WThwo4GE.d.mts.map +1 -0
- package/dist/index-ikFTh5Of.d.ts +57 -0
- package/dist/index-ikFTh5Of.d.ts.map +1 -0
- package/dist/index-vQuyEowr.d.ts +112 -0
- package/dist/index-vQuyEowr.d.ts.map +1 -0
- package/dist/index.d.mts +169 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.d.ts +157 -6
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +13 -2
- package/dist/index.mjs +8 -7
- package/dist/index.mjs.map +1 -1
- package/dist/layouts-B4-6tFOc.js +146 -0
- package/dist/layouts-BjVGZ985.mjs +69 -0
- package/dist/layouts-BjVGZ985.mjs.map +1 -0
- package/dist/methods-1m6HC-Cq.js +74 -0
- package/dist/methods-B-5Y4mYI.js +244 -0
- package/dist/methods-BJmwe8TB.mjs +150 -0
- package/dist/methods-BJmwe8TB.mjs.map +1 -0
- package/dist/methods-BT7d3cn_.mjs +60 -0
- package/dist/methods-BT7d3cn_.mjs.map +1 -0
- package/dist/methods-COQbKdUK.mjs +191 -0
- package/dist/methods-COQbKdUK.mjs.map +1 -0
- package/dist/methods-Cwsy79oP.mjs +58 -0
- package/dist/methods-Cwsy79oP.mjs.map +1 -0
- package/dist/methods-D22WgfeH.js +83 -0
- package/dist/methods-DywJ3kNL.js +197 -0
- package/dist/namespaces.d.mts +2 -0
- package/dist/namespaces.d.ts +2 -28
- package/dist/namespaces.js +0 -2
- package/dist/namespaces.mjs +0 -2
- package/dist/objectSpread2-CqB2zXI4.mjs +67 -0
- package/dist/objectSpread2-D6h_DL8D.js +73 -0
- package/dist/objectWithoutProperties-BW1v2UJb.mjs +25 -0
- package/dist/objectWithoutProperties-WR0nj2yB.js +31 -0
- package/dist/recurrence.d.mts +34 -0
- package/dist/recurrence.d.mts.map +1 -0
- package/dist/recurrence.d.ts +12 -6
- package/dist/recurrence.d.ts.map +1 -0
- package/dist/recurrence.js +54 -2
- package/dist/recurrence.mjs +51 -49
- package/dist/recurrence.mjs.map +1 -1
- package/dist/reports.d.mts +88 -0
- package/dist/reports.d.mts.map +1 -0
- package/dist/reports.d.ts +14 -10
- package/dist/reports.d.ts.map +1 -0
- package/dist/reports.js +15 -2
- package/dist/reports.mjs +8 -12
- package/dist/task-activity.d.mts +38 -0
- package/dist/task-activity.d.mts.map +1 -0
- package/dist/task-activity.d.ts +26 -21
- package/dist/task-activity.d.ts.map +1 -0
- package/dist/task-activity.js +35 -2
- package/dist/task-activity.mjs +35 -61
- package/dist/task-activity.mjs.map +1 -1
- package/dist/task-presets-DiNjCcoY.js +178 -0
- package/dist/task-presets-gBDbKXvf.mjs +144 -0
- package/dist/task-presets-gBDbKXvf.mjs.map +1 -0
- package/dist/task-presets.d.mts +8 -0
- package/dist/task-presets.d.ts +8 -61
- package/dist/task-presets.js +16 -2
- package/dist/task-presets.mjs +11 -10
- package/dist/tasks-C7BDH9DB.mjs +0 -0
- package/dist/tasks-CvWlwPt4.js +0 -0
- package/dist/tasks.d.mts +8 -0
- package/dist/tasks.d.ts +8 -60
- package/dist/tasks.js +16 -2
- package/dist/tasks.mjs +11 -10
- package/dist/template-tags.d.mts +3 -0
- package/dist/template-tags.d.ts +3 -0
- package/dist/template-tags.js +125 -0
- package/dist/template-tags.mjs +122 -0
- package/dist/template-tags.mjs.map +1 -0
- package/dist/templates-4-HG94_R.mjs +123 -0
- package/dist/templates-4-HG94_R.mjs.map +1 -0
- package/dist/templates-BDeiW4cQ.js +151 -0
- package/dist/templates.d.mts +5 -0
- package/dist/templates.d.ts +5 -51
- package/dist/templates.js +14 -2
- package/dist/templates.mjs +10 -9
- package/dist/transform-BwhdwBpm.js +51 -0
- package/dist/transform-qQl1fxH9.mjs +40 -0
- package/dist/transform-qQl1fxH9.mjs.map +1 -0
- package/dist/types-BMxmOgXj.d.ts +80 -0
- package/dist/types-BMxmOgXj.d.ts.map +1 -0
- package/dist/types-BzHI9Ite.d.mts +25 -0
- package/dist/types-BzHI9Ite.d.mts.map +1 -0
- package/dist/types-C1-YTWbn.d.ts +25 -0
- package/dist/types-C1-YTWbn.d.ts.map +1 -0
- package/dist/types-C45-jPGm.d.ts +104 -0
- package/dist/types-C45-jPGm.d.ts.map +1 -0
- package/dist/types-Cog_jwWQ.d.ts +30 -0
- package/dist/types-Cog_jwWQ.d.ts.map +1 -0
- package/dist/types-D3Or9gzv.d.mts +104 -0
- package/dist/types-D3Or9gzv.d.mts.map +1 -0
- package/dist/types-DHTY3l5T.d.mts +30 -0
- package/dist/types-DHTY3l5T.d.mts.map +1 -0
- package/dist/types-EvlWp0P4.d.mts +69 -0
- package/dist/types-EvlWp0P4.d.mts.map +1 -0
- package/dist/types-GqzHU1o3.d.ts +69 -0
- package/dist/types-GqzHU1o3.d.ts.map +1 -0
- package/dist/types-O3D5ZCFu.d.mts +80 -0
- package/dist/types-O3D5ZCFu.d.mts.map +1 -0
- package/package.json +75 -91
- package/dist/_commonjsHelpers-C6fGbg64.mjs +0 -7
- package/dist/_commonjsHelpers-C6fGbg64.mjs.map +0 -1
- package/dist/_commonjsHelpers-DwGv2jUC.js +0 -2
- package/dist/_commonjsHelpers-DwGv2jUC.js.map +0 -1
- package/dist/api-BSUnyE6V.js +0 -2
- package/dist/api-BSUnyE6V.js.map +0 -1
- package/dist/api-Beaugm6M.d.ts +0 -24
- package/dist/api-Cwb98wAh.mjs +0 -18
- package/dist/api-Cwb98wAh.mjs.map +0 -1
- package/dist/auth.js.map +0 -1
- package/dist/auth.mjs.map +0 -1
- package/dist/crons.js.map +0 -1
- package/dist/decorator-C2gcn2rK.js +0 -2
- package/dist/decorator-C2gcn2rK.js.map +0 -1
- package/dist/decorator-DCiVxI72.mjs +0 -24
- package/dist/decorator-DCiVxI72.mjs.map +0 -1
- package/dist/elastic.js.map +0 -1
- package/dist/fetch-DldyAFkY.js +0 -2
- package/dist/fetch-DldyAFkY.js.map +0 -1
- package/dist/fetch-FK-Cz8Ty.mjs +0 -52
- package/dist/fetch-FK-Cz8Ty.mjs.map +0 -1
- package/dist/generations.js.map +0 -1
- package/dist/generations.mjs.map +0 -1
- package/dist/health.js.map +0 -1
- package/dist/helpers/aggregations.js.map +0 -1
- package/dist/helpers/figures.js.map +0 -1
- package/dist/helpers/figures.mjs.map +0 -1
- package/dist/helpers/filters.js.map +0 -1
- package/dist/helpers/generations.js.map +0 -1
- package/dist/helpers/layouts.js.map +0 -1
- package/dist/helpers/layouts.mjs.map +0 -1
- package/dist/helpers/permissions.js.map +0 -1
- package/dist/helpers/task-presets.js.map +0 -1
- package/dist/helpers/tasks.js.map +0 -1
- package/dist/helpers/templates.js.map +0 -1
- package/dist/index-CVa-i8Jy.js +0 -7
- package/dist/index-CVa-i8Jy.js.map +0 -1
- package/dist/index-CqG3FOrT.mjs +0 -1113
- package/dist/index-CqG3FOrT.mjs.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/methods-B1u-wrM_.js +0 -2
- package/dist/methods-B1u-wrM_.js.map +0 -1
- package/dist/methods-BArV-Of4.js +0 -2
- package/dist/methods-BArV-Of4.js.map +0 -1
- package/dist/methods-C1KfMC_9.mjs +0 -158
- package/dist/methods-C1KfMC_9.mjs.map +0 -1
- package/dist/methods-CBNMk0T-.mjs +0 -47
- package/dist/methods-CBNMk0T-.mjs.map +0 -1
- package/dist/methods-CEARrYHM.mjs +0 -151
- package/dist/methods-CEARrYHM.mjs.map +0 -1
- package/dist/methods-CXuFuv8n.js +0 -2
- package/dist/methods-CXuFuv8n.js.map +0 -1
- package/dist/methods-DbOs99Zw.js +0 -2
- package/dist/methods-DbOs99Zw.js.map +0 -1
- package/dist/methods-DieaE_8I.js +0 -2
- package/dist/methods-DieaE_8I.js.map +0 -1
- package/dist/methods-DkGCHQdm.mjs +0 -144
- package/dist/methods-DkGCHQdm.mjs.map +0 -1
- package/dist/methods-YvctuH6v.js +0 -2
- package/dist/methods-YvctuH6v.js.map +0 -1
- package/dist/methods-byDDsdem.mjs +0 -122
- package/dist/methods-byDDsdem.mjs.map +0 -1
- package/dist/methods-k68hJDbY.mjs +0 -90
- package/dist/methods-k68hJDbY.mjs.map +0 -1
- package/dist/namespaces.js.map +0 -1
- package/dist/namespaces.mjs.map +0 -1
- package/dist/recurrence.js.map +0 -1
- package/dist/reports.js.map +0 -1
- package/dist/reports.mjs.map +0 -1
- package/dist/task-activity.js.map +0 -1
- package/dist/task-presets.js.map +0 -1
- package/dist/task-presets.mjs.map +0 -1
- package/dist/tasks-C-Si9c_j.js +0 -2
- package/dist/tasks-C-Si9c_j.js.map +0 -1
- package/dist/tasks-rnhGl39m.mjs +0 -34
- package/dist/tasks-rnhGl39m.mjs.map +0 -1
- package/dist/tasks.js.map +0 -1
- package/dist/tasks.mjs.map +0 -1
- package/dist/templates-BNAX4vB8.mjs +0 -29
- package/dist/templates-BNAX4vB8.mjs.map +0 -1
- package/dist/templates-BgRTZc5c.d.ts +0 -14
- package/dist/templates-D7C0TH1C.js +0 -2
- package/dist/templates-D7C0TH1C.js.map +0 -1
- package/dist/templates.js.map +0 -1
- package/dist/templates.mjs.map +0 -1
- package/dist/transform-DrB-Z9tA.mjs +0 -26
- package/dist/transform-DrB-Z9tA.mjs.map +0 -1
- package/dist/transform-DzLAfSJo.js +0 -2
- package/dist/transform-DzLAfSJo.js.map +0 -1
- package/dist/types-BxhkIhgG.d.ts +0 -50
- package/dist/types-CCDLyhAJ.d.ts +0 -77
- package/dist/types-Cac8HEO5.d.ts +0 -23
- package/dist/types-CgKoQCwb.d.ts +0 -67
- package/dist/types-DcoMmjs3.d.ts +0 -101
package/dist/crons.mjs
CHANGED
|
@@ -1,92 +1,67 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
var R = (n, o) => {
|
|
14
|
-
var t = {};
|
|
15
|
-
for (var s in n)
|
|
16
|
-
y.call(n, s) && o.indexOf(s) < 0 && (t[s] = n[s]);
|
|
17
|
-
if (n != null && r)
|
|
18
|
-
for (var s of r(n))
|
|
19
|
-
o.indexOf(s) < 0 && C.call(n, s) && (t[s] = n[s]);
|
|
20
|
-
return t;
|
|
21
|
-
};
|
|
22
|
-
var c = (n, o, t) => new Promise((s, a) => {
|
|
23
|
-
var g = (e) => {
|
|
24
|
-
try {
|
|
25
|
-
u(t.next(e));
|
|
26
|
-
} catch (p) {
|
|
27
|
-
a(p);
|
|
28
|
-
}
|
|
29
|
-
}, P = (e) => {
|
|
30
|
-
try {
|
|
31
|
-
u(t.throw(e));
|
|
32
|
-
} catch (p) {
|
|
33
|
-
a(p);
|
|
34
|
-
}
|
|
35
|
-
}, u = (e) => e.done ? s(e.value) : Promise.resolve(e.value).then(g, P);
|
|
36
|
-
u((t = t.apply(n, o)).next());
|
|
1
|
+
import { t as client } from "./fetch-DcGZzMm-.mjs";
|
|
2
|
+
import { n as assignPermission } from "./decorator-Bjs7qJx3.mjs";
|
|
3
|
+
import { t as _asyncToGenerator } from "./asyncToGenerator-BTgp0X8Q.mjs";
|
|
4
|
+
import { t as _objectSpread2 } from "./objectSpread2-CqB2zXI4.mjs";
|
|
5
|
+
import { t as _objectWithoutProperties } from "./objectWithoutProperties-BW1v2UJb.mjs";
|
|
6
|
+
import { parseISO } from "date-fns";
|
|
7
|
+
|
|
8
|
+
//#region src/modules/crons/methods.ts
|
|
9
|
+
const _excluded = ["name"];
|
|
10
|
+
const transformCron = (cron) => _objectSpread2(_objectSpread2({}, cron), {}, {
|
|
11
|
+
lastRun: cron.lastRun ? parseISO(cron.lastRun) : void 0,
|
|
12
|
+
nextRun: cron.nextRun ? parseISO(cron.nextRun) : void 0
|
|
37
13
|
});
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
14
|
+
function getAllCrons() {
|
|
15
|
+
return _getAllCrons.apply(this, arguments);
|
|
16
|
+
}
|
|
17
|
+
function _getAllCrons() {
|
|
18
|
+
_getAllCrons = _asyncToGenerator(function* () {
|
|
19
|
+
const { content } = yield client.fetch("/crons");
|
|
20
|
+
return content.map(transformCron);
|
|
21
|
+
});
|
|
22
|
+
return _getAllCrons.apply(this, arguments);
|
|
23
|
+
}
|
|
24
|
+
assignPermission(getAllCrons, "GET /crons");
|
|
25
|
+
function getCron(_x) {
|
|
26
|
+
return _getCron.apply(this, arguments);
|
|
27
|
+
}
|
|
28
|
+
function _getCron() {
|
|
29
|
+
_getCron = _asyncToGenerator(function* (cronOrName) {
|
|
30
|
+
const name = typeof cronOrName === "string" ? cronOrName : cronOrName.name;
|
|
31
|
+
const { content } = yield client.fetch(`/crons/${name}`);
|
|
32
|
+
return transformCron(content);
|
|
33
|
+
});
|
|
34
|
+
return _getCron.apply(this, arguments);
|
|
35
|
+
}
|
|
36
|
+
assignPermission(getCron, "GET /crons/:name");
|
|
37
|
+
function updateCron(_x2) {
|
|
38
|
+
return _updateCron.apply(this, arguments);
|
|
52
39
|
}
|
|
53
|
-
|
|
54
|
-
function
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
40
|
+
function _updateCron() {
|
|
41
|
+
_updateCron = _asyncToGenerator(function* (cron) {
|
|
42
|
+
const { name } = cron, data = _objectWithoutProperties(cron, _excluded);
|
|
43
|
+
const { content } = yield client.fetch(`/crons/${name}`, {
|
|
44
|
+
method: "PATCH",
|
|
45
|
+
body: data
|
|
46
|
+
});
|
|
47
|
+
return transformCron(content);
|
|
48
|
+
});
|
|
49
|
+
return _updateCron.apply(this, arguments);
|
|
61
50
|
}
|
|
62
|
-
|
|
63
|
-
function
|
|
64
|
-
|
|
65
|
-
const a = n, { name: o } = a, t = R(a, ["name"]), {
|
|
66
|
-
content: s
|
|
67
|
-
} = yield i.fetch(`/crons/${o}`, {
|
|
68
|
-
method: "PATCH",
|
|
69
|
-
body: t
|
|
70
|
-
});
|
|
71
|
-
return m(s);
|
|
72
|
-
});
|
|
51
|
+
assignPermission(updateCron, "PATCH /crons/:name");
|
|
52
|
+
function forceCron(_x3) {
|
|
53
|
+
return _forceCron.apply(this, arguments);
|
|
73
54
|
}
|
|
74
|
-
|
|
75
|
-
function
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
});
|
|
82
|
-
return m(t);
|
|
83
|
-
});
|
|
55
|
+
function _forceCron() {
|
|
56
|
+
_forceCron = _asyncToGenerator(function* (cronOrName) {
|
|
57
|
+
const name = typeof cronOrName === "string" ? cronOrName : cronOrName.name;
|
|
58
|
+
const { content } = yield client.fetch(`/crons/${name}`, { method: "POST" });
|
|
59
|
+
return transformCron(content);
|
|
60
|
+
});
|
|
61
|
+
return _forceCron.apply(this, arguments);
|
|
84
62
|
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
v as updateCron
|
|
91
|
-
};
|
|
92
|
-
//# sourceMappingURL=crons.mjs.map
|
|
63
|
+
assignPermission(forceCron, "POST /crons/:name");
|
|
64
|
+
|
|
65
|
+
//#endregion
|
|
66
|
+
export { forceCron, getAllCrons, getCron, updateCron };
|
|
67
|
+
//# sourceMappingURL=crons.mjs.map
|
package/dist/crons.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"crons.mjs","sources":["../src/modules/crons/methods.ts"],"sourcesContent":["import { parseISO } from 'date-fns';\n\nimport { client } from '~/lib/fetch';\nimport type { ApiResponse } from '~/lib/api';\n\nimport { assignPermission } from '~/helpers/permissions/decorator';\n\nimport type { RawCron, Cron, InputCron } from './types';\n\nconst transformCron = (cron: RawCron): Cron => ({\n ...cron,\n lastRun: cron.lastRun ? parseISO(cron.lastRun) : undefined,\n nextRun: cron.nextRun ? parseISO(cron.nextRun) : undefined,\n});\n\nexport async function getAllCrons(): Promise<Cron[]> {\n const {\n content,\n } = await client.fetch<ApiResponse<RawCron[]>>('/crons');\n\n return content.map(transformCron);\n}\nassignPermission(getAllCrons, 'GET /crons');\n\nexport async function getCron(\n cronOrName: Cron | string,\n): Promise<Cron> {\n const name = typeof cronOrName === 'string' ? cronOrName : cronOrName.name;\n\n const {\n content,\n } = await client.fetch<ApiResponse<RawCron>>(`/crons/${name}`);\n\n return transformCron(content);\n}\nassignPermission(getCron, 'GET /crons/:name');\n\nexport async function updateCron(\n cron: InputCron & { name: string },\n): Promise<Cron> {\n const { name, ...data } = cron;\n\n const {\n content,\n } = await client.fetch<ApiResponse<RawCron>>(`/crons/${name}`, {\n method: 'PATCH',\n body: data,\n });\n\n return transformCron(content);\n}\nassignPermission(updateCron, 'PATCH /crons/:name');\n\nexport async function forceCron(\n cronOrName: Cron | string,\n): Promise<Cron> {\n const name = typeof cronOrName === 'string' ? cronOrName : cronOrName.name;\n\n const {\n content,\n } = await client.fetch<ApiResponse<RawCron>>(`/crons/${name}`, {\n method: 'POST',\n });\n\n return transformCron(content);\n}\nassignPermission(forceCron, 'POST /crons/:name');\n"],"
|
|
1
|
+
{"version":3,"file":"crons.mjs","names":[],"sources":["../src/modules/crons/methods.ts"],"sourcesContent":["import { parseISO } from 'date-fns';\n\nimport { client } from '~/lib/fetch';\nimport type { ApiResponse } from '~/lib/api';\n\nimport { assignPermission } from '~/helpers/permissions/decorator';\n\nimport type { RawCron, Cron, InputCron } from './types';\n\nconst transformCron = (cron: RawCron): Cron => ({\n ...cron,\n lastRun: cron.lastRun ? parseISO(cron.lastRun) : undefined,\n nextRun: cron.nextRun ? parseISO(cron.nextRun) : undefined,\n});\n\nexport async function getAllCrons(): Promise<Cron[]> {\n const {\n content,\n } = await client.fetch<ApiResponse<RawCron[]>>('/crons');\n\n return content.map(transformCron);\n}\nassignPermission(getAllCrons, 'GET /crons');\n\nexport async function getCron(\n cronOrName: Cron | string,\n): Promise<Cron> {\n const name = typeof cronOrName === 'string' ? cronOrName : cronOrName.name;\n\n const {\n content,\n } = await client.fetch<ApiResponse<RawCron>>(`/crons/${name}`);\n\n return transformCron(content);\n}\nassignPermission(getCron, 'GET /crons/:name');\n\nexport async function updateCron(\n cron: InputCron & { name: string },\n): Promise<Cron> {\n const { name, ...data } = cron;\n\n const {\n content,\n } = await client.fetch<ApiResponse<RawCron>>(`/crons/${name}`, {\n method: 'PATCH',\n body: data,\n });\n\n return transformCron(content);\n}\nassignPermission(updateCron, 'PATCH /crons/:name');\n\nexport async function forceCron(\n cronOrName: Cron | string,\n): Promise<Cron> {\n const name = typeof cronOrName === 'string' ? cronOrName : cronOrName.name;\n\n const {\n content,\n } = await client.fetch<ApiResponse<RawCron>>(`/crons/${name}`, {\n method: 'POST',\n });\n\n return transformCron(content);\n}\nassignPermission(forceCron, 'POST /crons/:name');\n"],"mappings":";;;;;;;;mBAwCU;AA/BV,MAAM,iBAAiB,2CAClB;CACH,SAAS,KAAK,UAAU,SAAS,KAAK,QAAQ,GAAG;CACjD,SAAS,KAAK,UAAU,SAAS,KAAK,QAAQ,GAAG;;AAGnD,SAAsB;;;;+CAA+B;EACnD,MAAM,EACJ,kBACQ,OAAO,MAA8B,SAAS;AAExD,SAAO,QAAQ,IAAI,cAAc;;;;AAEnC,iBAAiB,aAAa,aAAa;AAE3C,SAAsB,QACpB;;;;qDACe;EACf,MAAM,OAAO,OAAO,eAAe,WAAW,aAAa,WAAW;EAEtE,MAAM,EACJ,kBACQ,OAAO,MAA4B,UAAU,OAAO;AAE9D,SAAO,cAAc,QAAQ;;;;AAE/B,iBAAiB,SAAS,mBAAmB;AAE7C,SAAsB,WACpB;;;;kDACe;EACf,MAAM,EAAE,eAAS,gCAAS;EAE1B,MAAM,EACJ,kBACQ,OAAO,MAA4B,UAAU,QAAQ;GAC7D,QAAQ;GACR,MAAM;GACP,CAAC;AAEF,SAAO,cAAc,QAAQ;;;;AAE/B,iBAAiB,YAAY,qBAAqB;AAElD,SAAsB,UACpB;;;;uDACe;EACf,MAAM,OAAO,OAAO,eAAe,WAAW,aAAa,WAAW;EAEtE,MAAM,EACJ,kBACQ,OAAO,MAA4B,UAAU,QAAQ,EAC7D,QAAQ,QACT,CAAC;AAEF,SAAO,cAAc,QAAQ;;;;AAE/B,iBAAiB,WAAW,oBAAoB"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
//#region src/helpers/permissions/decorator.ts
|
|
2
|
+
function isSDKFunction(fnc) {
|
|
3
|
+
return "ezrPermissions" in fnc;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Assign a permission name to a SDK function, used to check if the user have the permission
|
|
7
|
+
*
|
|
8
|
+
* @param fnc The function to decorate
|
|
9
|
+
* @param permission The permission name (cf. /auth/me/permissions)
|
|
10
|
+
* @param isNamespaced If the permission is namespaced (cf. /auth/me/permissions)
|
|
11
|
+
*/
|
|
12
|
+
function assignPermission(fnc, permission, isNamespaced = false) {
|
|
13
|
+
Object.defineProperty(fnc, "ezrPermissions", {
|
|
14
|
+
value: [{
|
|
15
|
+
permission,
|
|
16
|
+
isNamespaced
|
|
17
|
+
}],
|
|
18
|
+
writable: false,
|
|
19
|
+
enumerable: false
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Assign permission names of its dependencies to a SDK function, used to check if the user have
|
|
24
|
+
* the permission
|
|
25
|
+
*
|
|
26
|
+
* @param fnc The function to decorate
|
|
27
|
+
* @param deps The dependencies
|
|
28
|
+
* @param permission The additional permission name (cf. /auth/me/permissions)
|
|
29
|
+
* @param isNamespaced If the additional permission is namespaced (cf. /auth/me/permissions)
|
|
30
|
+
*/
|
|
31
|
+
function assignDependencies(fnc, deps, permission, isNamespaced = false) {
|
|
32
|
+
const permissions = deps.filter((dep) => isSDKFunction(dep)).flatMap((dep) => dep.ezrPermissions);
|
|
33
|
+
if (permission) permissions.unshift({
|
|
34
|
+
permission,
|
|
35
|
+
isNamespaced
|
|
36
|
+
});
|
|
37
|
+
Object.defineProperty(fnc, "ezrPermissions", {
|
|
38
|
+
value: permissions,
|
|
39
|
+
writable: false,
|
|
40
|
+
enumerable: false
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
//#endregion
|
|
45
|
+
export { assignPermission as n, isSDKFunction as r, assignDependencies as t };
|
|
46
|
+
//# sourceMappingURL=decorator-Bjs7qJx3.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"decorator-Bjs7qJx3.mjs","names":[],"sources":["../src/helpers/permissions/decorator.ts"],"sourcesContent":["// oxlint-disable-next-line no-explicit-any\nexport type LambdaFunction = (...args: any[]) => any;\n\ninterface SDKFunctionAddition {\n ezrPermissions: { permission: string; isNamespaced: boolean }[];\n}\n\nexport type SDKFunction = LambdaFunction & SDKFunctionAddition;\n\nexport function isSDKFunction(fnc: LambdaFunction): fnc is SDKFunction {\n return 'ezrPermissions' in fnc;\n}\n\n/**\n * Assign a permission name to a SDK function, used to check if the user have the permission\n *\n * @param fnc The function to decorate\n * @param permission The permission name (cf. /auth/me/permissions)\n * @param isNamespaced If the permission is namespaced (cf. /auth/me/permissions)\n */\nexport function assignPermission(\n fnc: LambdaFunction,\n permission: string,\n isNamespaced = false\n): void {\n Object.defineProperty(fnc, 'ezrPermissions', {\n value: [{ permission, isNamespaced }],\n writable: false,\n enumerable: false,\n });\n}\n\n/**\n * Assign permission names of its dependencies to a SDK function, used to check if the user have\n * the permission\n *\n * @param fnc The function to decorate\n * @param deps The dependencies\n * @param permission The additional permission name (cf. /auth/me/permissions)\n * @param isNamespaced If the additional permission is namespaced (cf. /auth/me/permissions)\n */\nexport function assignDependencies(\n fnc: LambdaFunction,\n deps: LambdaFunction[],\n permission?: string,\n isNamespaced = false\n): void {\n const dependencies = deps.filter((dep) => isSDKFunction(dep));\n const permissions = dependencies.flatMap((dep) => dep.ezrPermissions);\n\n if (permission) {\n permissions.unshift({ permission, isNamespaced });\n }\n\n Object.defineProperty(fnc, 'ezrPermissions', {\n value: permissions,\n writable: false,\n enumerable: false,\n });\n}\n"],"mappings":";AASA,SAAgB,cAAc,KAAyC;AACrE,QAAO,oBAAoB;;;;;;;;;AAU7B,SAAgB,iBACd,KACA,YACA,eAAe,OACT;AACN,QAAO,eAAe,KAAK,kBAAkB;EAC3C,OAAO,CAAC;GAAE;GAAY;GAAc,CAAC;EACrC,UAAU;EACV,YAAY;EACb,CAAC;;;;;;;;;;;AAYJ,SAAgB,mBACd,KACA,MACA,YACA,eAAe,OACT;CAEN,MAAM,cADe,KAAK,QAAQ,QAAQ,cAAc,IAAI,CAAC,CAC5B,SAAS,QAAQ,IAAI,eAAe;AAErE,KAAI,WACF,aAAY,QAAQ;EAAE;EAAY;EAAc,CAAC;AAGnD,QAAO,eAAe,KAAK,kBAAkB;EAC3C,OAAO;EACP,UAAU;EACV,YAAY;EACb,CAAC"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
|
|
2
|
+
//#region src/helpers/permissions/decorator.ts
|
|
3
|
+
function isSDKFunction(fnc) {
|
|
4
|
+
return "ezrPermissions" in fnc;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Assign a permission name to a SDK function, used to check if the user have the permission
|
|
8
|
+
*
|
|
9
|
+
* @param fnc The function to decorate
|
|
10
|
+
* @param permission The permission name (cf. /auth/me/permissions)
|
|
11
|
+
* @param isNamespaced If the permission is namespaced (cf. /auth/me/permissions)
|
|
12
|
+
*/
|
|
13
|
+
function assignPermission(fnc, permission, isNamespaced = false) {
|
|
14
|
+
Object.defineProperty(fnc, "ezrPermissions", {
|
|
15
|
+
value: [{
|
|
16
|
+
permission,
|
|
17
|
+
isNamespaced
|
|
18
|
+
}],
|
|
19
|
+
writable: false,
|
|
20
|
+
enumerable: false
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Assign permission names of its dependencies to a SDK function, used to check if the user have
|
|
25
|
+
* the permission
|
|
26
|
+
*
|
|
27
|
+
* @param fnc The function to decorate
|
|
28
|
+
* @param deps The dependencies
|
|
29
|
+
* @param permission The additional permission name (cf. /auth/me/permissions)
|
|
30
|
+
* @param isNamespaced If the additional permission is namespaced (cf. /auth/me/permissions)
|
|
31
|
+
*/
|
|
32
|
+
function assignDependencies(fnc, deps, permission, isNamespaced = false) {
|
|
33
|
+
const permissions = deps.filter((dep) => isSDKFunction(dep)).flatMap((dep) => dep.ezrPermissions);
|
|
34
|
+
if (permission) permissions.unshift({
|
|
35
|
+
permission,
|
|
36
|
+
isNamespaced
|
|
37
|
+
});
|
|
38
|
+
Object.defineProperty(fnc, "ezrPermissions", {
|
|
39
|
+
value: permissions,
|
|
40
|
+
writable: false,
|
|
41
|
+
enumerable: false
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
//#endregion
|
|
46
|
+
Object.defineProperty(exports, 'assignDependencies', {
|
|
47
|
+
enumerable: true,
|
|
48
|
+
get: function () {
|
|
49
|
+
return assignDependencies;
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
Object.defineProperty(exports, 'assignPermission', {
|
|
53
|
+
enumerable: true,
|
|
54
|
+
get: function () {
|
|
55
|
+
return assignPermission;
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
Object.defineProperty(exports, 'isSDKFunction', {
|
|
59
|
+
enumerable: true,
|
|
60
|
+
get: function () {
|
|
61
|
+
return isSDKFunction;
|
|
62
|
+
}
|
|
63
|
+
});
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { t as Namespace } from "./types-DHTY3l5T.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/modules/elastic/types.d.ts
|
|
4
|
+
type Mapping = Record<string, string>;
|
|
5
|
+
type Index = string;
|
|
6
|
+
//#endregion
|
|
7
|
+
//#region src/modules/elastic/methods.d.ts
|
|
8
|
+
/**
|
|
9
|
+
* List all available indices
|
|
10
|
+
*
|
|
11
|
+
* Providing a query will resolve it
|
|
12
|
+
*
|
|
13
|
+
* @param namespace The concerned namespace. **Needed if not admin**
|
|
14
|
+
*
|
|
15
|
+
* @returns The list of available indices
|
|
16
|
+
*/
|
|
17
|
+
declare function getAllIndices(namespaceOrId?: Namespace | string, query?: string): Promise<Index[]>;
|
|
18
|
+
/**
|
|
19
|
+
* Get mapping of an specific index
|
|
20
|
+
*
|
|
21
|
+
* @param index The index (can be a wildcard)
|
|
22
|
+
* @param namespace The concerned namespace. **Needed if not admin**
|
|
23
|
+
*
|
|
24
|
+
* @returns The list of available indices
|
|
25
|
+
*/
|
|
26
|
+
declare function getIndexMapping(index: string, namespaceOrId?: Namespace | string): Promise<Mapping>;
|
|
27
|
+
//#endregion
|
|
28
|
+
export { type Index, type Mapping, getAllIndices, getIndexMapping };
|
|
29
|
+
//# sourceMappingURL=elastic.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"elastic.d.mts","names":[],"sources":["../src/modules/elastic/types.ts","../src/modules/elastic/methods.ts"],"sourcesContent":[],"mappings":";;;KAAY,OAAA,GAAU;KAEV,KAAA;;;;AAFZ;AAEA;;;;ACgBA;;;AAGG,iBAHmB,aAAA,CAGnB,aAAA,CAAA,EAFe,SAEf,GAAA,MAAA,EAAA,KAAA,CAAA,EAAA,MAAA,CAAA,EAAA,OAAA,CAAQ,KAAR,EAAA,CAAA;;AA2BH;;;;;;;iBAAsB,eAAA,gCAEJ,qBACf,QAAQ"}
|
package/dist/elastic.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import { Namespace } from
|
|
1
|
+
import { t as Namespace } from "./types-Cog_jwWQ.js";
|
|
2
2
|
|
|
3
|
+
//#region src/modules/elastic/types.d.ts
|
|
3
4
|
type Mapping = Record<string, string>;
|
|
4
5
|
type Index = string;
|
|
5
|
-
|
|
6
|
+
//#endregion
|
|
7
|
+
//#region src/modules/elastic/methods.d.ts
|
|
6
8
|
/**
|
|
7
9
|
* List all available indices
|
|
8
10
|
*
|
|
@@ -22,5 +24,6 @@ declare function getAllIndices(namespaceOrId?: Namespace | string, query?: strin
|
|
|
22
24
|
* @returns The list of available indices
|
|
23
25
|
*/
|
|
24
26
|
declare function getIndexMapping(index: string, namespaceOrId?: Namespace | string): Promise<Mapping>;
|
|
25
|
-
|
|
27
|
+
//#endregion
|
|
26
28
|
export { type Index, type Mapping, getAllIndices, getIndexMapping };
|
|
29
|
+
//# sourceMappingURL=elastic.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"elastic.d.ts","names":[],"sources":["../src/modules/elastic/types.ts","../src/modules/elastic/methods.ts"],"sourcesContent":[],"mappings":";;;KAAY,OAAA,GAAU;KAEV,KAAA;;;;AAFZ;AAEA;;;;ACgBA;;;AAGG,iBAHmB,aAAA,CAGnB,aAAA,CAAA,EAFe,SAEf,GAAA,MAAA,EAAA,KAAA,CAAA,EAAA,MAAA,CAAA,EAAA,OAAA,CAAQ,KAAR,EAAA,CAAA;;AA2BH;;;;;;;iBAAsB,eAAA,gCAEJ,qBACf,QAAQ"}
|
package/dist/elastic.js
CHANGED
|
@@ -1,2 +1,53 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
const require_fetch = require('./fetch-BoGJTvlB.js');
|
|
2
|
+
const require_decorator = require('./decorator-DkHkhO2_.js');
|
|
3
|
+
const require_asyncToGenerator = require('./asyncToGenerator-D0muCXnm.js');
|
|
4
|
+
|
|
5
|
+
//#region src/modules/elastic/methods.ts
|
|
6
|
+
/**
|
|
7
|
+
* List all available indices
|
|
8
|
+
*
|
|
9
|
+
* Providing a query will resolve it
|
|
10
|
+
*
|
|
11
|
+
* @param namespace The concerned namespace. **Needed if not admin**
|
|
12
|
+
*
|
|
13
|
+
* @returns The list of available indices
|
|
14
|
+
*/
|
|
15
|
+
function getAllIndices(_x, _x2) {
|
|
16
|
+
return _getAllIndices.apply(this, arguments);
|
|
17
|
+
}
|
|
18
|
+
function _getAllIndices() {
|
|
19
|
+
_getAllIndices = require_asyncToGenerator._asyncToGenerator(function* (namespaceOrId, query) {
|
|
20
|
+
const namespaceId = typeof namespaceOrId === "string" ? namespaceOrId : namespaceOrId === null || namespaceOrId === void 0 ? void 0 : namespaceOrId.id;
|
|
21
|
+
const { content } = yield require_fetch.client.fetch("/elastic/indices", { query: {
|
|
22
|
+
query: query || void 0,
|
|
23
|
+
namespaceId: namespaceId || void 0
|
|
24
|
+
} });
|
|
25
|
+
return content;
|
|
26
|
+
});
|
|
27
|
+
return _getAllIndices.apply(this, arguments);
|
|
28
|
+
}
|
|
29
|
+
require_decorator.assignPermission(getAllIndices, "GET /elastic/indices", true);
|
|
30
|
+
/**
|
|
31
|
+
* Get mapping of an specific index
|
|
32
|
+
*
|
|
33
|
+
* @param index The index (can be a wildcard)
|
|
34
|
+
* @param namespace The concerned namespace. **Needed if not admin**
|
|
35
|
+
*
|
|
36
|
+
* @returns The list of available indices
|
|
37
|
+
*/
|
|
38
|
+
function getIndexMapping(_x3, _x4) {
|
|
39
|
+
return _getIndexMapping.apply(this, arguments);
|
|
40
|
+
}
|
|
41
|
+
function _getIndexMapping() {
|
|
42
|
+
_getIndexMapping = require_asyncToGenerator._asyncToGenerator(function* (index, namespaceOrId) {
|
|
43
|
+
const namespaceId = typeof namespaceOrId === "string" ? namespaceOrId : namespaceOrId === null || namespaceOrId === void 0 ? void 0 : namespaceOrId.id;
|
|
44
|
+
const { content } = yield require_fetch.client.fetch(`/elastic/indices/${index}`, { query: { namespaceId: namespaceId || void 0 } });
|
|
45
|
+
return content;
|
|
46
|
+
});
|
|
47
|
+
return _getIndexMapping.apply(this, arguments);
|
|
48
|
+
}
|
|
49
|
+
require_decorator.assignPermission(getIndexMapping, "GET /elastic/indices/:index", true);
|
|
50
|
+
|
|
51
|
+
//#endregion
|
|
52
|
+
exports.getAllIndices = getAllIndices;
|
|
53
|
+
exports.getIndexMapping = getIndexMapping;
|
package/dist/elastic.mjs
CHANGED
|
@@ -1,50 +1,53 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
import { c as l } from "./fetch-FK-Cz8Ty.mjs";
|
|
18
|
-
import { a as y } from "./decorator-DCiVxI72.mjs";
|
|
19
|
-
function d(i, t) {
|
|
20
|
-
return u(this, null, function* () {
|
|
21
|
-
const n = typeof i == "string" ? i : i == null ? void 0 : i.id, { content: c } = yield l.fetch(
|
|
22
|
-
"/elastic/indices",
|
|
23
|
-
{
|
|
24
|
-
query: {
|
|
25
|
-
query: t || void 0,
|
|
26
|
-
namespaceId: n || void 0
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
);
|
|
30
|
-
return c;
|
|
31
|
-
});
|
|
1
|
+
import { t as client } from "./fetch-DcGZzMm-.mjs";
|
|
2
|
+
import { n as assignPermission } from "./decorator-Bjs7qJx3.mjs";
|
|
3
|
+
import { t as _asyncToGenerator } from "./asyncToGenerator-BTgp0X8Q.mjs";
|
|
4
|
+
|
|
5
|
+
//#region src/modules/elastic/methods.ts
|
|
6
|
+
/**
|
|
7
|
+
* List all available indices
|
|
8
|
+
*
|
|
9
|
+
* Providing a query will resolve it
|
|
10
|
+
*
|
|
11
|
+
* @param namespace The concerned namespace. **Needed if not admin**
|
|
12
|
+
*
|
|
13
|
+
* @returns The list of available indices
|
|
14
|
+
*/
|
|
15
|
+
function getAllIndices(_x, _x2) {
|
|
16
|
+
return _getAllIndices.apply(this, arguments);
|
|
32
17
|
}
|
|
33
|
-
|
|
34
|
-
function
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
});
|
|
18
|
+
function _getAllIndices() {
|
|
19
|
+
_getAllIndices = _asyncToGenerator(function* (namespaceOrId, query) {
|
|
20
|
+
const namespaceId = typeof namespaceOrId === "string" ? namespaceOrId : namespaceOrId === null || namespaceOrId === void 0 ? void 0 : namespaceOrId.id;
|
|
21
|
+
const { content } = yield client.fetch("/elastic/indices", { query: {
|
|
22
|
+
query: query || void 0,
|
|
23
|
+
namespaceId: namespaceId || void 0
|
|
24
|
+
} });
|
|
25
|
+
return content;
|
|
26
|
+
});
|
|
27
|
+
return _getAllIndices.apply(this, arguments);
|
|
44
28
|
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
29
|
+
assignPermission(getAllIndices, "GET /elastic/indices", true);
|
|
30
|
+
/**
|
|
31
|
+
* Get mapping of an specific index
|
|
32
|
+
*
|
|
33
|
+
* @param index The index (can be a wildcard)
|
|
34
|
+
* @param namespace The concerned namespace. **Needed if not admin**
|
|
35
|
+
*
|
|
36
|
+
* @returns The list of available indices
|
|
37
|
+
*/
|
|
38
|
+
function getIndexMapping(_x3, _x4) {
|
|
39
|
+
return _getIndexMapping.apply(this, arguments);
|
|
40
|
+
}
|
|
41
|
+
function _getIndexMapping() {
|
|
42
|
+
_getIndexMapping = _asyncToGenerator(function* (index, namespaceOrId) {
|
|
43
|
+
const namespaceId = typeof namespaceOrId === "string" ? namespaceOrId : namespaceOrId === null || namespaceOrId === void 0 ? void 0 : namespaceOrId.id;
|
|
44
|
+
const { content } = yield client.fetch(`/elastic/indices/${index}`, { query: { namespaceId: namespaceId || void 0 } });
|
|
45
|
+
return content;
|
|
46
|
+
});
|
|
47
|
+
return _getIndexMapping.apply(this, arguments);
|
|
48
|
+
}
|
|
49
|
+
assignPermission(getIndexMapping, "GET /elastic/indices/:index", true);
|
|
50
|
+
|
|
51
|
+
//#endregion
|
|
52
|
+
export { getAllIndices, getIndexMapping };
|
|
53
|
+
//# sourceMappingURL=elastic.mjs.map
|
package/dist/elastic.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"elastic.mjs","sources":["../src/modules/elastic/methods.ts"],"sourcesContent":["import { client } from '~/lib/fetch';\nimport type { ApiResponse } from '~/lib/api';\n\nimport { assignPermission } from '~/helpers/permissions/decorator';\n\nimport type { Namespace } from '~/modules/namespaces/types';\n\nimport type { Index, Mapping } from './types';\n\n/**\n * List all available indices\n *\n * Providing a query will resolve it\n *\n * @param namespace The concerned namespace. **Needed if not admin**\n *\n * @returns The list of available indices\n */\nexport async function getAllIndices(\n namespaceOrId?: Namespace | string,\n query?: string\n): Promise<Index[]> {\n const namespaceId =\n typeof namespaceOrId === 'string' ? namespaceOrId : namespaceOrId?.id;\n\n const { content } = await client.fetch<ApiResponse<Index[]>>(\n '/elastic/indices',\n {\n query: {\n query: query || undefined,\n namespaceId: namespaceId || undefined,\n },\n }\n );\n\n return content;\n}\nassignPermission(getAllIndices, 'GET /elastic/indices', true);\n\n/**\n * Get mapping of an specific index\n *\n * @param index The index (can be a wildcard)\n * @param namespace The concerned namespace. **Needed if not admin**\n *\n * @returns The list of available indices\n */\n\nexport async function getIndexMapping(\n index: string,\n namespaceOrId?: Namespace | string\n): Promise<Mapping> {\n const namespaceId =\n typeof namespaceOrId === 'string' ? namespaceOrId : namespaceOrId?.id;\n\n const { content } = await client.fetch<ApiResponse<Mapping>>(\n `/elastic/indices/${index}`,\n {\n query: { namespaceId: namespaceId || undefined },\n }\n );\n\n return content;\n}\nassignPermission(getIndexMapping, 'GET /elastic/indices/:index', true);\n"],"
|
|
1
|
+
{"version":3,"file":"elastic.mjs","names":[],"sources":["../src/modules/elastic/methods.ts"],"sourcesContent":["import { client } from '~/lib/fetch';\nimport type { ApiResponse } from '~/lib/api';\n\nimport { assignPermission } from '~/helpers/permissions/decorator';\n\nimport type { Namespace } from '~/modules/namespaces/types';\n\nimport type { Index, Mapping } from './types';\n\n/**\n * List all available indices\n *\n * Providing a query will resolve it\n *\n * @param namespace The concerned namespace. **Needed if not admin**\n *\n * @returns The list of available indices\n */\nexport async function getAllIndices(\n namespaceOrId?: Namespace | string,\n query?: string\n): Promise<Index[]> {\n const namespaceId =\n typeof namespaceOrId === 'string' ? namespaceOrId : namespaceOrId?.id;\n\n const { content } = await client.fetch<ApiResponse<Index[]>>(\n '/elastic/indices',\n {\n query: {\n query: query || undefined,\n namespaceId: namespaceId || undefined,\n },\n }\n );\n\n return content;\n}\nassignPermission(getAllIndices, 'GET /elastic/indices', true);\n\n/**\n * Get mapping of an specific index\n *\n * @param index The index (can be a wildcard)\n * @param namespace The concerned namespace. **Needed if not admin**\n *\n * @returns The list of available indices\n */\n\nexport async function getIndexMapping(\n index: string,\n namespaceOrId?: Namespace | string\n): Promise<Mapping> {\n const namespaceId =\n typeof namespaceOrId === 'string' ? namespaceOrId : namespaceOrId?.id;\n\n const { content } = await client.fetch<ApiResponse<Mapping>>(\n `/elastic/indices/${index}`,\n {\n query: { namespaceId: namespaceId || undefined },\n }\n );\n\n return content;\n}\nassignPermission(getIndexMapping, 'GET /elastic/indices/:index', true);\n"],"mappings":";;;;;;;;;;;;;;AAkBA,SAAsB,cACpB,IACA;;;;+CADA,eACA,OACkB;EAClB,MAAM,cACJ,OAAO,kBAAkB,WAAW,8EAAgB,cAAe;EAErE,MAAM,EAAE,kBAAkB,OAAO,MAC/B,oBACA,EACE,OAAO;GACL,OAAO,SAAS;GAChB,aAAa,eAAe;GAC7B,EACF,CACF;AAED,SAAO;;;;AAET,iBAAiB,eAAe,wBAAwB,KAAK;;;;;;;;;AAW7D,SAAsB,gBACpB,KACA;;;;iDADA,OACA,eACkB;EAClB,MAAM,cACJ,OAAO,kBAAkB,WAAW,8EAAgB,cAAe;EAErE,MAAM,EAAE,kBAAkB,OAAO,MAC/B,oBAAoB,SACpB,EACE,OAAO,EAAE,aAAa,eAAe,QAAW,EACjD,CACF;AAED,SAAO;;;;AAET,iBAAiB,iBAAiB,+BAA+B,KAAK"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
const require_figures = require('./figures-cK0cMwpV.js');
|
|
2
|
+
let ofetch = require("ofetch");
|
|
3
|
+
let socket_io_client = require("socket.io-client");
|
|
4
|
+
|
|
5
|
+
//#region src/lib/fetch.ts
|
|
6
|
+
const sockets = /* @__PURE__ */ new Map();
|
|
7
|
+
/**
|
|
8
|
+
* Client for the API
|
|
9
|
+
*/
|
|
10
|
+
const client = {
|
|
11
|
+
token: "",
|
|
12
|
+
fetch: ofetch.ofetch.create({}),
|
|
13
|
+
socket: (() => {})
|
|
14
|
+
};
|
|
15
|
+
const prepareSocketCreator = (baseURL, auth) => {
|
|
16
|
+
const wsURL = new URL(baseURL);
|
|
17
|
+
wsURL.protocol = wsURL.protocol.replace("http", "ws");
|
|
18
|
+
if (wsURL.href.at(-1) !== "/") wsURL.href = `${wsURL.href}/`;
|
|
19
|
+
const socketIoPath = new URL("socket.io/", wsURL).pathname;
|
|
20
|
+
return (namespaceName, rooms) => {
|
|
21
|
+
var _namespace$rooms;
|
|
22
|
+
let namespace = sockets.get(namespaceName);
|
|
23
|
+
if (!((_namespace$rooms = namespace === null || namespace === void 0 ? void 0 : namespace.rooms) !== null && _namespace$rooms !== void 0 ? _namespace$rooms : []).every((rs) => (rooms !== null && rooms !== void 0 ? rooms : []).includes(rs))) {
|
|
24
|
+
namespace === null || namespace === void 0 || namespace.con.disconnect();
|
|
25
|
+
namespace = void 0;
|
|
26
|
+
}
|
|
27
|
+
if (!namespace) {
|
|
28
|
+
const url = new URL(namespaceName, wsURL);
|
|
29
|
+
try {
|
|
30
|
+
namespace = {
|
|
31
|
+
con: (0, socket_io_client.io)(url.href, {
|
|
32
|
+
path: socketIoPath,
|
|
33
|
+
auth: auth || void 0,
|
|
34
|
+
query: rooms ? { rooms } : void 0
|
|
35
|
+
}),
|
|
36
|
+
rooms
|
|
37
|
+
};
|
|
38
|
+
sockets.set(namespaceName, namespace);
|
|
39
|
+
} catch (error) {
|
|
40
|
+
console.error(`[ezreeport-sdk-js] Couldn't create socket for ${namespaceName}`, error);
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return namespace.con;
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* Prepare the client for the rest of the SDK, will update config if needed
|
|
49
|
+
*
|
|
50
|
+
* @param baseURL Base HTTP URL of the API
|
|
51
|
+
* @param auth Auth options to be authenticated
|
|
52
|
+
*/
|
|
53
|
+
function prepareClient(baseURL, auth) {
|
|
54
|
+
const headers = {};
|
|
55
|
+
if (auth === null || auth === void 0 ? void 0 : auth.token) headers.Authorization = `Bearer ${auth.token}`;
|
|
56
|
+
let href;
|
|
57
|
+
let url;
|
|
58
|
+
if (typeof baseURL === "string") {
|
|
59
|
+
href = baseURL;
|
|
60
|
+
url = new URL(baseURL);
|
|
61
|
+
} else {
|
|
62
|
+
href = baseURL.href;
|
|
63
|
+
url = baseURL;
|
|
64
|
+
}
|
|
65
|
+
client.fetch = ofetch.ofetch.create({
|
|
66
|
+
baseURL: href,
|
|
67
|
+
headers
|
|
68
|
+
});
|
|
69
|
+
client.socket = prepareSocketCreator(url, auth);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
//#endregion
|
|
73
|
+
Object.defineProperty(exports, 'client', {
|
|
74
|
+
enumerable: true,
|
|
75
|
+
get: function () {
|
|
76
|
+
return client;
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
Object.defineProperty(exports, 'prepareClient', {
|
|
80
|
+
enumerable: true,
|
|
81
|
+
get: function () {
|
|
82
|
+
return prepareClient;
|
|
83
|
+
}
|
|
84
|
+
});
|