@ezpaarse-project/ezreeport-sdk-js 1.0.0-beta.9 → 1.0.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/browser/ezreeport-sdk-js.mjs +597 -1968
- package/dist/browser/ezreeport-sdk-js.mjs.map +1 -1
- package/dist/browser/ezreeport-sdk-js.umd.js +1 -3
- package/dist/browser/ezreeport-sdk-js.umd.js.map +1 -1
- package/dist/node/ezreeport-sdk-js.js +2 -0
- package/dist/node/ezreeport-sdk-js.js.map +1 -0
- package/dist/node/ezreeport-sdk-js.mjs +978 -0
- package/dist/node/ezreeport-sdk-js.mjs.map +1 -0
- package/dist/types/{src/index.d.ts → index.d.ts} +4 -2
- package/dist/types/{src/lib → lib}/axios.d.ts +2 -2
- package/dist/types/{src/lib → lib}/utils.d.ts +5 -0
- package/dist/types/{src/modules → modules}/queues.d.ts +2 -4
- package/dist/types/{src/modules → modules}/tasks.d.ts +26 -4
- package/dist/types/modules/tasks.public.d.ts +2 -0
- package/dist/types/{src/modules → modules}/tasksActivity.d.ts +2 -4
- package/dist/types/modules/tasksPresets.d.ts +83 -0
- package/dist/types/modules/tasksPresets.public.d.ts +1 -0
- package/package.json +17 -14
- package/dist/node/package.json +0 -58
- package/dist/node/src/index.js +0 -42
- package/dist/node/src/index.js.map +0 -1
- package/dist/node/src/lib/axios.js +0 -95
- package/dist/node/src/lib/axios.js.map +0 -1
- package/dist/node/src/lib/promises.js +0 -41
- package/dist/node/src/lib/promises.js.map +0 -1
- package/dist/node/src/lib/utils.js +0 -24
- package/dist/node/src/lib/utils.js.map +0 -1
- package/dist/node/src/modules/auth.js +0 -111
- package/dist/node/src/modules/auth.js.map +0 -1
- package/dist/node/src/modules/auth.public.js +0 -11
- package/dist/node/src/modules/auth.public.js.map +0 -1
- package/dist/node/src/modules/crons.js +0 -128
- package/dist/node/src/modules/crons.js.map +0 -1
- package/dist/node/src/modules/crons.public.js +0 -11
- package/dist/node/src/modules/crons.public.js.map +0 -1
- package/dist/node/src/modules/elastic.js +0 -31
- package/dist/node/src/modules/elastic.js.map +0 -1
- package/dist/node/src/modules/elastic.public.js +0 -7
- package/dist/node/src/modules/elastic.public.js.map +0 -1
- package/dist/node/src/modules/health.js +0 -60
- package/dist/node/src/modules/health.js.map +0 -1
- package/dist/node/src/modules/health.public.js +0 -9
- package/dist/node/src/modules/health.public.js.map +0 -1
- package/dist/node/src/modules/history.js +0 -62
- package/dist/node/src/modules/history.js.map +0 -1
- package/dist/node/src/modules/history.public.js +0 -6
- package/dist/node/src/modules/history.public.js.map +0 -1
- package/dist/node/src/modules/namespaces.js +0 -15
- package/dist/node/src/modules/namespaces.js.map +0 -1
- package/dist/node/src/modules/namespaces.public.js +0 -3
- package/dist/node/src/modules/namespaces.public.js.map +0 -1
- package/dist/node/src/modules/queues.js +0 -179
- package/dist/node/src/modules/queues.js.map +0 -1
- package/dist/node/src/modules/queues.public.js +0 -13
- package/dist/node/src/modules/queues.public.js.map +0 -1
- package/dist/node/src/modules/reports.js +0 -267
- package/dist/node/src/modules/reports.js.map +0 -1
- package/dist/node/src/modules/reports.public.js +0 -13
- package/dist/node/src/modules/reports.public.js.map +0 -1
- package/dist/node/src/modules/setup.js +0 -35
- package/dist/node/src/modules/setup.js.map +0 -1
- package/dist/node/src/modules/setup.public.js +0 -12
- package/dist/node/src/modules/setup.public.js.map +0 -1
- package/dist/node/src/modules/tasks.base.js +0 -51
- package/dist/node/src/modules/tasks.base.js.map +0 -1
- package/dist/node/src/modules/tasks.js +0 -264
- package/dist/node/src/modules/tasks.js.map +0 -1
- package/dist/node/src/modules/tasks.public.js +0 -20
- package/dist/node/src/modules/tasks.public.js.map +0 -1
- package/dist/node/src/modules/tasksActivity.js +0 -62
- package/dist/node/src/modules/tasksActivity.js.map +0 -1
- package/dist/node/src/modules/tasksActivity.public.js +0 -6
- package/dist/node/src/modules/tasksActivity.public.js.map +0 -1
- package/dist/node/src/modules/templates.js +0 -136
- package/dist/node/src/modules/templates.js.map +0 -1
- package/dist/node/src/modules/templates.public.js +0 -11
- package/dist/node/src/modules/templates.public.js.map +0 -1
- package/dist/types/src/modules/history.d.ts +0 -38
- package/dist/types/src/modules/history.public.d.ts +0 -1
- package/dist/types/src/modules/tasks.public.d.ts +0 -2
- /package/dist/types/{src/lib → lib}/promises.d.ts +0 -0
- /package/dist/types/{src/modules → modules}/auth.d.ts +0 -0
- /package/dist/types/{src/modules → modules}/auth.public.d.ts +0 -0
- /package/dist/types/{src/modules → modules}/crons.d.ts +0 -0
- /package/dist/types/{src/modules → modules}/crons.public.d.ts +0 -0
- /package/dist/types/{src/modules → modules}/elastic.d.ts +0 -0
- /package/dist/types/{src/modules → modules}/elastic.public.d.ts +0 -0
- /package/dist/types/{src/modules → modules}/health.d.ts +0 -0
- /package/dist/types/{src/modules → modules}/health.public.d.ts +0 -0
- /package/dist/types/{src/modules → modules}/namespaces.d.ts +0 -0
- /package/dist/types/{src/modules → modules}/namespaces.public.d.ts +0 -0
- /package/dist/types/{src/modules → modules}/queues.public.d.ts +0 -0
- /package/dist/types/{src/modules → modules}/reports.d.ts +0 -0
- /package/dist/types/{src/modules → modules}/reports.public.d.ts +0 -0
- /package/dist/types/{src/modules → modules}/setup.d.ts +0 -0
- /package/dist/types/{src/modules → modules}/setup.public.d.ts +0 -0
- /package/dist/types/{src/modules → modules}/tasks.base.d.ts +0 -0
- /package/dist/types/{src/modules → modules}/tasksActivity.public.d.ts +0 -0
- /package/dist/types/{src/modules → modules}/templates.d.ts +0 -0
- /package/dist/types/{src/modules → modules}/templates.public.d.ts +0 -0
|
@@ -0,0 +1,978 @@
|
|
|
1
|
+
import se, { AxiosError as re } from "axios";
|
|
2
|
+
const oe = "1.0.0", S = 6e4, N = 36e5;
|
|
3
|
+
function u(e, t) {
|
|
4
|
+
const n = (t == null ? void 0 : t.additionalDigits) ?? 2, s = ue(e);
|
|
5
|
+
let r;
|
|
6
|
+
if (s.date) {
|
|
7
|
+
const p = le(s.date, n);
|
|
8
|
+
r = pe(p.restDateString, p.year);
|
|
9
|
+
}
|
|
10
|
+
if (!r || isNaN(r.getTime()))
|
|
11
|
+
return /* @__PURE__ */ new Date(NaN);
|
|
12
|
+
const o = r.getTime();
|
|
13
|
+
let a = 0, l;
|
|
14
|
+
if (s.time && (a = de(s.time), isNaN(a)))
|
|
15
|
+
return /* @__PURE__ */ new Date(NaN);
|
|
16
|
+
if (s.timezone) {
|
|
17
|
+
if (l = fe(s.timezone), isNaN(l))
|
|
18
|
+
return /* @__PURE__ */ new Date(NaN);
|
|
19
|
+
} else {
|
|
20
|
+
const p = new Date(o + a), d = /* @__PURE__ */ new Date(0);
|
|
21
|
+
return d.setFullYear(
|
|
22
|
+
p.getUTCFullYear(),
|
|
23
|
+
p.getUTCMonth(),
|
|
24
|
+
p.getUTCDate()
|
|
25
|
+
), d.setHours(
|
|
26
|
+
p.getUTCHours(),
|
|
27
|
+
p.getUTCMinutes(),
|
|
28
|
+
p.getUTCSeconds(),
|
|
29
|
+
p.getUTCMilliseconds()
|
|
30
|
+
), d;
|
|
31
|
+
}
|
|
32
|
+
return new Date(o + a + l);
|
|
33
|
+
}
|
|
34
|
+
const _ = {
|
|
35
|
+
dateTimeDelimiter: /[T ]/,
|
|
36
|
+
timeZoneDelimiter: /[Z ]/i,
|
|
37
|
+
timezone: /([Z+-].*)$/
|
|
38
|
+
}, ae = /^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/, ie = /^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/, ce = /^([+-])(\d{2})(?::?(\d{2}))?$/;
|
|
39
|
+
function ue(e) {
|
|
40
|
+
const t = {}, n = e.split(_.dateTimeDelimiter);
|
|
41
|
+
let s;
|
|
42
|
+
if (n.length > 2)
|
|
43
|
+
return t;
|
|
44
|
+
if (/:/.test(n[0]) ? s = n[0] : (t.date = n[0], s = n[1], _.timeZoneDelimiter.test(t.date) && (t.date = e.split(_.timeZoneDelimiter)[0], s = e.substr(
|
|
45
|
+
t.date.length,
|
|
46
|
+
e.length
|
|
47
|
+
))), s) {
|
|
48
|
+
const r = _.timezone.exec(s);
|
|
49
|
+
r ? (t.time = s.replace(r[1], ""), t.timezone = r[1]) : t.time = s;
|
|
50
|
+
}
|
|
51
|
+
return t;
|
|
52
|
+
}
|
|
53
|
+
function le(e, t) {
|
|
54
|
+
const n = new RegExp(
|
|
55
|
+
"^(?:(\\d{4}|[+-]\\d{" + (4 + t) + "})|(\\d{2}|[+-]\\d{" + (2 + t) + "})$)"
|
|
56
|
+
), s = e.match(n);
|
|
57
|
+
if (!s)
|
|
58
|
+
return { year: NaN, restDateString: "" };
|
|
59
|
+
const r = s[1] ? parseInt(s[1]) : null, o = s[2] ? parseInt(s[2]) : null;
|
|
60
|
+
return {
|
|
61
|
+
year: o === null ? r : o * 100,
|
|
62
|
+
restDateString: e.slice((s[1] || s[2]).length)
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
function pe(e, t) {
|
|
66
|
+
if (t === null)
|
|
67
|
+
return /* @__PURE__ */ new Date(NaN);
|
|
68
|
+
const n = e.match(ae);
|
|
69
|
+
if (!n)
|
|
70
|
+
return /* @__PURE__ */ new Date(NaN);
|
|
71
|
+
const s = !!n[4], r = h(n[1]), o = h(n[2]) - 1, a = h(n[3]), l = h(n[4]), p = h(n[5]) - 1;
|
|
72
|
+
if (s)
|
|
73
|
+
return he(t, l, p) ? ge(t, l, p) : /* @__PURE__ */ new Date(NaN);
|
|
74
|
+
{
|
|
75
|
+
const d = /* @__PURE__ */ new Date(0);
|
|
76
|
+
return !me(t, o, a) || !ve(t, r) ? /* @__PURE__ */ new Date(NaN) : (d.setUTCFullYear(t, o, Math.max(r, a)), d);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
function h(e) {
|
|
80
|
+
return e ? parseInt(e) : 1;
|
|
81
|
+
}
|
|
82
|
+
function de(e) {
|
|
83
|
+
const t = e.match(ie);
|
|
84
|
+
if (!t)
|
|
85
|
+
return NaN;
|
|
86
|
+
const n = L(t[1]), s = L(t[2]), r = L(t[3]);
|
|
87
|
+
return we(n, s, r) ? n * N + s * S + r * 1e3 : NaN;
|
|
88
|
+
}
|
|
89
|
+
function L(e) {
|
|
90
|
+
return e && parseFloat(e.replace(",", ".")) || 0;
|
|
91
|
+
}
|
|
92
|
+
function fe(e) {
|
|
93
|
+
if (e === "Z")
|
|
94
|
+
return 0;
|
|
95
|
+
const t = e.match(ce);
|
|
96
|
+
if (!t)
|
|
97
|
+
return 0;
|
|
98
|
+
const n = t[1] === "+" ? -1 : 1, s = parseInt(t[2]), r = t[3] && parseInt(t[3]) || 0;
|
|
99
|
+
return _e(s, r) ? n * (s * N + r * S) : NaN;
|
|
100
|
+
}
|
|
101
|
+
function ge(e, t, n) {
|
|
102
|
+
const s = /* @__PURE__ */ new Date(0);
|
|
103
|
+
s.setUTCFullYear(e, 0, 4);
|
|
104
|
+
const r = s.getUTCDay() || 7, o = (t - 1) * 7 + n + 1 - r;
|
|
105
|
+
return s.setUTCDate(s.getUTCDate() + o), s;
|
|
106
|
+
}
|
|
107
|
+
const ye = [31, null, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
|
|
108
|
+
function P(e) {
|
|
109
|
+
return e % 400 === 0 || e % 4 === 0 && e % 100 !== 0;
|
|
110
|
+
}
|
|
111
|
+
function me(e, t, n) {
|
|
112
|
+
return t >= 0 && t <= 11 && n >= 1 && n <= (ye[t] || (P(e) ? 29 : 28));
|
|
113
|
+
}
|
|
114
|
+
function ve(e, t) {
|
|
115
|
+
return t >= 1 && t <= (P(e) ? 366 : 365);
|
|
116
|
+
}
|
|
117
|
+
function he(e, t, n) {
|
|
118
|
+
return t >= 1 && t <= 53 && n >= 0 && n <= 6;
|
|
119
|
+
}
|
|
120
|
+
function we(e, t, n) {
|
|
121
|
+
return e === 24 ? t === 0 && n === 0 : n >= 0 && n < 60 && t >= 0 && t < 60 && e >= 0 && e < 25;
|
|
122
|
+
}
|
|
123
|
+
function _e(e, t) {
|
|
124
|
+
return t >= 0 && t <= 59;
|
|
125
|
+
}
|
|
126
|
+
const M = se.create({
|
|
127
|
+
headers: {
|
|
128
|
+
"Content-Type": "application/json"
|
|
129
|
+
}
|
|
130
|
+
}), f = async (e, ...t) => {
|
|
131
|
+
try {
|
|
132
|
+
return await M[e](...t);
|
|
133
|
+
} catch (n) {
|
|
134
|
+
if (!(n instanceof re) || !n.response)
|
|
135
|
+
throw n;
|
|
136
|
+
const s = n.response;
|
|
137
|
+
let r = "";
|
|
138
|
+
switch (s.status) {
|
|
139
|
+
case 400:
|
|
140
|
+
r = "Check parameters or API token";
|
|
141
|
+
break;
|
|
142
|
+
case 401:
|
|
143
|
+
r = "You must be logged before using this function, use `auth.login(token)`";
|
|
144
|
+
break;
|
|
145
|
+
case 403:
|
|
146
|
+
r = "You dont have enough permissions";
|
|
147
|
+
break;
|
|
148
|
+
case 404:
|
|
149
|
+
r = "Check parameters";
|
|
150
|
+
break;
|
|
151
|
+
case 409:
|
|
152
|
+
r = "Request conflit with current state";
|
|
153
|
+
break;
|
|
154
|
+
case 500:
|
|
155
|
+
r = "Something went wrong with server";
|
|
156
|
+
break;
|
|
157
|
+
}
|
|
158
|
+
throw r = `${n.code} (${s.status}) - ${r}: ${s.data.content.message}`, new Error(r);
|
|
159
|
+
}
|
|
160
|
+
}, i = Object.assign(
|
|
161
|
+
M,
|
|
162
|
+
{
|
|
163
|
+
$get: async (...e) => (await f("get", ...e)).data,
|
|
164
|
+
$post: async (...e) => (await f("post", ...e)).data,
|
|
165
|
+
$put: async (...e) => (await f("put", ...e)).data,
|
|
166
|
+
$patch: async (...e) => (await f("patch", ...e)).data,
|
|
167
|
+
$delete: async (...e) => (await f("delete", ...e)).data
|
|
168
|
+
}
|
|
169
|
+
), U = (e) => ({
|
|
170
|
+
...e,
|
|
171
|
+
createdAt: u(e.createdAt),
|
|
172
|
+
updatedAt: e.updatedAt ? u(e.updatedAt) : void 0
|
|
173
|
+
}), be = (e) => ({
|
|
174
|
+
...e,
|
|
175
|
+
namespace: U(e.namespace),
|
|
176
|
+
createdAt: u(e.createdAt),
|
|
177
|
+
updatedAt: e.updatedAt ? u(e.updatedAt) : void 0
|
|
178
|
+
}), $e = (e) => ({
|
|
179
|
+
...e,
|
|
180
|
+
memberships: (e == null ? void 0 : e.memberships.map(be)) ?? [],
|
|
181
|
+
createdAt: u(e.createdAt),
|
|
182
|
+
updatedAt: e != null && e.updatedAt ? u(e.updatedAt) : void 0
|
|
183
|
+
}), Y = (e) => {
|
|
184
|
+
i.defaults.headers.common.authorization = `Bearer ${e}`;
|
|
185
|
+
}, z = () => {
|
|
186
|
+
i.defaults.headers.common.authorization = void 0;
|
|
187
|
+
}, F = () => {
|
|
188
|
+
const e = i.defaults.headers.common.authorization;
|
|
189
|
+
if (!e || typeof e != "string")
|
|
190
|
+
return !1;
|
|
191
|
+
const [, t] = e.split("Bearer ");
|
|
192
|
+
return !!t;
|
|
193
|
+
}, Te = async () => {
|
|
194
|
+
const { content: e, ...t } = await i.$get("/me");
|
|
195
|
+
return {
|
|
196
|
+
...t,
|
|
197
|
+
content: $e(e)
|
|
198
|
+
};
|
|
199
|
+
}, Le = () => i.$get("/me/permissions"), Ae = () => i.$get("/me/namespaces"), Ft = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
200
|
+
__proto__: null,
|
|
201
|
+
getCurrentNamespaces: Ae,
|
|
202
|
+
getCurrentPermissions: Le,
|
|
203
|
+
getCurrentUser: Te,
|
|
204
|
+
isLogged: F,
|
|
205
|
+
login: Y,
|
|
206
|
+
logout: z
|
|
207
|
+
}, Symbol.toStringTag, { value: "Module" })), m = (e) => ({
|
|
208
|
+
...e,
|
|
209
|
+
nextRun: e.nextRun ? u(e.nextRun) : void 0,
|
|
210
|
+
lastRun: e.lastRun ? u(e.lastRun) : void 0
|
|
211
|
+
}), ke = async () => {
|
|
212
|
+
const { content: e, ...t } = await i.$get("/crons");
|
|
213
|
+
return {
|
|
214
|
+
...t,
|
|
215
|
+
content: e.map(m)
|
|
216
|
+
};
|
|
217
|
+
}, Ee = async (e) => {
|
|
218
|
+
const t = typeof e == "string" ? e : e.name, { content: n, ...s } = await i.$get(`/crons/${t}`);
|
|
219
|
+
return {
|
|
220
|
+
...s,
|
|
221
|
+
content: m(n)
|
|
222
|
+
};
|
|
223
|
+
}, Re = async (e) => {
|
|
224
|
+
const t = typeof e == "string" ? e : e.name, { content: n, ...s } = await i.$put(`/crons/${t}/start`, {});
|
|
225
|
+
return {
|
|
226
|
+
...s,
|
|
227
|
+
content: m(n)
|
|
228
|
+
};
|
|
229
|
+
}, Ce = async (e) => {
|
|
230
|
+
const t = typeof e == "string" ? e : e.name, { content: n, ...s } = await i.$put(`/crons/${t}/stop`, {});
|
|
231
|
+
return {
|
|
232
|
+
...s,
|
|
233
|
+
content: m(n)
|
|
234
|
+
};
|
|
235
|
+
}, De = async (e) => {
|
|
236
|
+
const { name: t, ...n } = e, { content: s, ...r } = await i.$patch(`/crons/${t}`, n);
|
|
237
|
+
return {
|
|
238
|
+
...r,
|
|
239
|
+
content: m(s)
|
|
240
|
+
};
|
|
241
|
+
}, je = async (e) => {
|
|
242
|
+
const t = typeof e == "string" ? e : e.name, { content: n, ...s } = await i.$post(`/crons/${t}/_force`, {});
|
|
243
|
+
return {
|
|
244
|
+
...s,
|
|
245
|
+
content: m(n)
|
|
246
|
+
};
|
|
247
|
+
}, Wt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
248
|
+
__proto__: null,
|
|
249
|
+
forceCron: je,
|
|
250
|
+
getAllCrons: ke,
|
|
251
|
+
getCron: Ee,
|
|
252
|
+
startCron: Re,
|
|
253
|
+
stopCron: Ce,
|
|
254
|
+
updateCron: De
|
|
255
|
+
}, Symbol.toStringTag, { value: "Module" })), W = () => i.$get("/health"), xe = () => i.$get("/health/_all"), J = (e) => i.$get(`/health/${e}`), Se = async () => {
|
|
256
|
+
const { content: { current: e } } = await W();
|
|
257
|
+
return J(e);
|
|
258
|
+
}, Jt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
259
|
+
__proto__: null,
|
|
260
|
+
checkAllConnectedService: xe,
|
|
261
|
+
checkConnectedService: J,
|
|
262
|
+
checkCurrentService: Se,
|
|
263
|
+
getAllConnectedServices: W
|
|
264
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
265
|
+
var B = /* @__PURE__ */ ((e) => (e.DAILY = "DAILY", e.WEEKLY = "WEEKLY", e.MONTHLY = "MONTHLY", e.QUARTERLY = "QUARTERLY", e.BIENNIAL = "BIENNIAL", e.YEARLY = "YEARLY", e))(B || {});
|
|
266
|
+
const $ = (e) => ({
|
|
267
|
+
...e,
|
|
268
|
+
nextRun: u(e.nextRun),
|
|
269
|
+
lastRun: e.lastRun ? u(e.lastRun) : void 0,
|
|
270
|
+
createdAt: u(e.createdAt),
|
|
271
|
+
updatedAt: e.updatedAt ? u(e.updatedAt) : void 0
|
|
272
|
+
}), O = (e) => {
|
|
273
|
+
const { namespace: t, ...n } = e, { namespaceId: s, ...r } = $({
|
|
274
|
+
namespaceId: t.id,
|
|
275
|
+
...n
|
|
276
|
+
});
|
|
277
|
+
return {
|
|
278
|
+
...r,
|
|
279
|
+
namespace: U(t)
|
|
280
|
+
};
|
|
281
|
+
}, Ne = (e) => ({
|
|
282
|
+
...e,
|
|
283
|
+
createdAt: u(e.createdAt)
|
|
284
|
+
}), Pe = (e) => ({
|
|
285
|
+
...e,
|
|
286
|
+
task: O(e.task),
|
|
287
|
+
createdAt: u(e.createdAt)
|
|
288
|
+
}), Me = async (e, t) => {
|
|
289
|
+
const { data: { content: n, ...s } } = await f(
|
|
290
|
+
"get",
|
|
291
|
+
"/tasks-activity",
|
|
292
|
+
{
|
|
293
|
+
params: {
|
|
294
|
+
namespaces: t,
|
|
295
|
+
...e ?? {}
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
);
|
|
299
|
+
return {
|
|
300
|
+
...s,
|
|
301
|
+
content: n.map(Pe)
|
|
302
|
+
};
|
|
303
|
+
}, Bt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
304
|
+
__proto__: null,
|
|
305
|
+
getAllEntries: Me
|
|
306
|
+
}, Symbol.toStringTag, { value: "Module" })), Ue = (e) => ({
|
|
307
|
+
...e,
|
|
308
|
+
createdAt: u(e.createdAt),
|
|
309
|
+
updatedAt: e.updatedAt ? u(e.updatedAt) : void 0
|
|
310
|
+
}), A = (e) => ({
|
|
311
|
+
...e,
|
|
312
|
+
createdAt: u(e.createdAt),
|
|
313
|
+
updatedAt: e.updatedAt ? u(e.updatedAt) : void 0
|
|
314
|
+
}), Ye = async () => {
|
|
315
|
+
const { content: e, ...t } = await i.$get("/tasks-presets");
|
|
316
|
+
return {
|
|
317
|
+
...t,
|
|
318
|
+
content: e.map(Ue)
|
|
319
|
+
};
|
|
320
|
+
}, ze = async (e) => {
|
|
321
|
+
const t = typeof e == "string" ? e : e.id, { content: n, ...s } = await i.$get(`/tasks-presets/${t}`);
|
|
322
|
+
return {
|
|
323
|
+
...s,
|
|
324
|
+
content: A(n)
|
|
325
|
+
};
|
|
326
|
+
}, Fe = async (e) => {
|
|
327
|
+
const { content: t, ...n } = await i.$post("/tasks-presets/", e);
|
|
328
|
+
return {
|
|
329
|
+
...n,
|
|
330
|
+
content: A(t)
|
|
331
|
+
};
|
|
332
|
+
}, We = async (e) => {
|
|
333
|
+
const { id: t, ...n } = e, { content: s, ...r } = await i.$put(
|
|
334
|
+
`/tasks-presets/${t}`,
|
|
335
|
+
n
|
|
336
|
+
);
|
|
337
|
+
return {
|
|
338
|
+
...r,
|
|
339
|
+
content: A(s)
|
|
340
|
+
};
|
|
341
|
+
}, Je = async (e) => {
|
|
342
|
+
const t = typeof e == "string" ? e : e.id;
|
|
343
|
+
await i.$delete(`/tasks-presets/${t}`);
|
|
344
|
+
}, Ot = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
345
|
+
__proto__: null,
|
|
346
|
+
createTasksPreset: Fe,
|
|
347
|
+
deleteTasksPreset: Je,
|
|
348
|
+
getAllTasksPresets: Ye,
|
|
349
|
+
getTasksPreset: ze,
|
|
350
|
+
upsertTasksPreset: We
|
|
351
|
+
}, Symbol.toStringTag, { value: "Module" })), Qt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
352
|
+
__proto__: null
|
|
353
|
+
}, Symbol.toStringTag, { value: "Module" })), k = (e) => ({
|
|
354
|
+
...e,
|
|
355
|
+
added: u(e.added),
|
|
356
|
+
started: e.started ? u(e.started) : void 0,
|
|
357
|
+
ended: e.ended ? u(e.ended) : void 0
|
|
358
|
+
}), Be = () => i.$get("/queues"), Oe = async (e) => {
|
|
359
|
+
const t = typeof e == "string" ? e : e.name;
|
|
360
|
+
return i.$get(`/queues/${t}`);
|
|
361
|
+
}, Qe = async (e) => {
|
|
362
|
+
const { name: t, ...n } = e;
|
|
363
|
+
return i.$patch(`/queues/${t}`, n);
|
|
364
|
+
}, Ke = async (e) => {
|
|
365
|
+
const t = typeof e == "string" ? e : e.name;
|
|
366
|
+
return i.$put(`/queues/${t}/pause`);
|
|
367
|
+
}, qe = async (e) => {
|
|
368
|
+
const t = typeof e == "string" ? e : e.name;
|
|
369
|
+
return i.$put(`/queues/${t}/resume`);
|
|
370
|
+
}, He = async (e, t) => {
|
|
371
|
+
const n = typeof e == "string" ? e : e.name, { data: { content: s, ...r } } = await f(
|
|
372
|
+
"get",
|
|
373
|
+
`/queues/${n}/jobs`,
|
|
374
|
+
{
|
|
375
|
+
params: t
|
|
376
|
+
}
|
|
377
|
+
);
|
|
378
|
+
return {
|
|
379
|
+
...r,
|
|
380
|
+
content: s.map(k)
|
|
381
|
+
};
|
|
382
|
+
}, w = async (e, t, n) => {
|
|
383
|
+
const s = typeof e == "string" ? e : e.name, r = typeof t == "string" || typeof t == "number" ? t : t.id, { content: o, ...a } = await i.$get(`/queues/${s}/jobs/${r}`, { params: { namespaces: n } });
|
|
384
|
+
return {
|
|
385
|
+
...a,
|
|
386
|
+
content: k(o)
|
|
387
|
+
};
|
|
388
|
+
}, Ze = async (e, t, n) => {
|
|
389
|
+
const s = typeof e == "string" ? e : e.name, r = typeof t == "string" || typeof t == "number" ? t : t.id, { content: o, ...a } = await i.$post(`/queues/${s}/jobs/${r}/_retry`, { params: { namespaces: n } });
|
|
390
|
+
return {
|
|
391
|
+
...a,
|
|
392
|
+
content: k(o)
|
|
393
|
+
};
|
|
394
|
+
}, Kt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
395
|
+
__proto__: null,
|
|
396
|
+
getAllQueues: Be,
|
|
397
|
+
getJob: w,
|
|
398
|
+
getQueue: Oe,
|
|
399
|
+
getQueueJobs: He,
|
|
400
|
+
pauseQueue: Ke,
|
|
401
|
+
resumeQueue: qe,
|
|
402
|
+
retryJob: Ze,
|
|
403
|
+
updateQueue: Qe
|
|
404
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
405
|
+
function Ge(e) {
|
|
406
|
+
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
407
|
+
}
|
|
408
|
+
var E = { exports: {} }, y = typeof Reflect == "object" ? Reflect : null, j = y && typeof y.apply == "function" ? y.apply : function(t, n, s) {
|
|
409
|
+
return Function.prototype.apply.call(t, n, s);
|
|
410
|
+
}, b;
|
|
411
|
+
y && typeof y.ownKeys == "function" ? b = y.ownKeys : Object.getOwnPropertySymbols ? b = function(t) {
|
|
412
|
+
return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t));
|
|
413
|
+
} : b = function(t) {
|
|
414
|
+
return Object.getOwnPropertyNames(t);
|
|
415
|
+
};
|
|
416
|
+
function Ve(e) {
|
|
417
|
+
console && console.warn && console.warn(e);
|
|
418
|
+
}
|
|
419
|
+
var Q = Number.isNaN || function(t) {
|
|
420
|
+
return t !== t;
|
|
421
|
+
};
|
|
422
|
+
function c() {
|
|
423
|
+
c.init.call(this);
|
|
424
|
+
}
|
|
425
|
+
E.exports = c;
|
|
426
|
+
E.exports.once = tt;
|
|
427
|
+
c.EventEmitter = c;
|
|
428
|
+
c.prototype._events = void 0;
|
|
429
|
+
c.prototype._eventsCount = 0;
|
|
430
|
+
c.prototype._maxListeners = void 0;
|
|
431
|
+
var x = 10;
|
|
432
|
+
function T(e) {
|
|
433
|
+
if (typeof e != "function")
|
|
434
|
+
throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof e);
|
|
435
|
+
}
|
|
436
|
+
Object.defineProperty(c, "defaultMaxListeners", {
|
|
437
|
+
enumerable: !0,
|
|
438
|
+
get: function() {
|
|
439
|
+
return x;
|
|
440
|
+
},
|
|
441
|
+
set: function(e) {
|
|
442
|
+
if (typeof e != "number" || e < 0 || Q(e))
|
|
443
|
+
throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received ' + e + ".");
|
|
444
|
+
x = e;
|
|
445
|
+
}
|
|
446
|
+
});
|
|
447
|
+
c.init = function() {
|
|
448
|
+
(this._events === void 0 || this._events === Object.getPrototypeOf(this)._events) && (this._events = /* @__PURE__ */ Object.create(null), this._eventsCount = 0), this._maxListeners = this._maxListeners || void 0;
|
|
449
|
+
};
|
|
450
|
+
c.prototype.setMaxListeners = function(t) {
|
|
451
|
+
if (typeof t != "number" || t < 0 || Q(t))
|
|
452
|
+
throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received ' + t + ".");
|
|
453
|
+
return this._maxListeners = t, this;
|
|
454
|
+
};
|
|
455
|
+
function K(e) {
|
|
456
|
+
return e._maxListeners === void 0 ? c.defaultMaxListeners : e._maxListeners;
|
|
457
|
+
}
|
|
458
|
+
c.prototype.getMaxListeners = function() {
|
|
459
|
+
return K(this);
|
|
460
|
+
};
|
|
461
|
+
c.prototype.emit = function(t) {
|
|
462
|
+
for (var n = [], s = 1; s < arguments.length; s++)
|
|
463
|
+
n.push(arguments[s]);
|
|
464
|
+
var r = t === "error", o = this._events;
|
|
465
|
+
if (o !== void 0)
|
|
466
|
+
r = r && o.error === void 0;
|
|
467
|
+
else if (!r)
|
|
468
|
+
return !1;
|
|
469
|
+
if (r) {
|
|
470
|
+
var a;
|
|
471
|
+
if (n.length > 0 && (a = n[0]), a instanceof Error)
|
|
472
|
+
throw a;
|
|
473
|
+
var l = new Error("Unhandled error." + (a ? " (" + a.message + ")" : ""));
|
|
474
|
+
throw l.context = a, l;
|
|
475
|
+
}
|
|
476
|
+
var p = o[t];
|
|
477
|
+
if (p === void 0)
|
|
478
|
+
return !1;
|
|
479
|
+
if (typeof p == "function")
|
|
480
|
+
j(p, this, n);
|
|
481
|
+
else
|
|
482
|
+
for (var d = p.length, ne = V(p, d), s = 0; s < d; ++s)
|
|
483
|
+
j(ne[s], this, n);
|
|
484
|
+
return !0;
|
|
485
|
+
};
|
|
486
|
+
function q(e, t, n, s) {
|
|
487
|
+
var r, o, a;
|
|
488
|
+
if (T(n), o = e._events, o === void 0 ? (o = e._events = /* @__PURE__ */ Object.create(null), e._eventsCount = 0) : (o.newListener !== void 0 && (e.emit(
|
|
489
|
+
"newListener",
|
|
490
|
+
t,
|
|
491
|
+
n.listener ? n.listener : n
|
|
492
|
+
), o = e._events), a = o[t]), a === void 0)
|
|
493
|
+
a = o[t] = n, ++e._eventsCount;
|
|
494
|
+
else if (typeof a == "function" ? a = o[t] = s ? [n, a] : [a, n] : s ? a.unshift(n) : a.push(n), r = K(e), r > 0 && a.length > r && !a.warned) {
|
|
495
|
+
a.warned = !0;
|
|
496
|
+
var l = new Error("Possible EventEmitter memory leak detected. " + a.length + " " + String(t) + " listeners added. Use emitter.setMaxListeners() to increase limit");
|
|
497
|
+
l.name = "MaxListenersExceededWarning", l.emitter = e, l.type = t, l.count = a.length, Ve(l);
|
|
498
|
+
}
|
|
499
|
+
return e;
|
|
500
|
+
}
|
|
501
|
+
c.prototype.addListener = function(t, n) {
|
|
502
|
+
return q(this, t, n, !1);
|
|
503
|
+
};
|
|
504
|
+
c.prototype.on = c.prototype.addListener;
|
|
505
|
+
c.prototype.prependListener = function(t, n) {
|
|
506
|
+
return q(this, t, n, !0);
|
|
507
|
+
};
|
|
508
|
+
function Xe() {
|
|
509
|
+
if (!this.fired)
|
|
510
|
+
return this.target.removeListener(this.type, this.wrapFn), this.fired = !0, arguments.length === 0 ? this.listener.call(this.target) : this.listener.apply(this.target, arguments);
|
|
511
|
+
}
|
|
512
|
+
function H(e, t, n) {
|
|
513
|
+
var s = { fired: !1, wrapFn: void 0, target: e, type: t, listener: n }, r = Xe.bind(s);
|
|
514
|
+
return r.listener = n, s.wrapFn = r, r;
|
|
515
|
+
}
|
|
516
|
+
c.prototype.once = function(t, n) {
|
|
517
|
+
return T(n), this.on(t, H(this, t, n)), this;
|
|
518
|
+
};
|
|
519
|
+
c.prototype.prependOnceListener = function(t, n) {
|
|
520
|
+
return T(n), this.prependListener(t, H(this, t, n)), this;
|
|
521
|
+
};
|
|
522
|
+
c.prototype.removeListener = function(t, n) {
|
|
523
|
+
var s, r, o, a, l;
|
|
524
|
+
if (T(n), r = this._events, r === void 0)
|
|
525
|
+
return this;
|
|
526
|
+
if (s = r[t], s === void 0)
|
|
527
|
+
return this;
|
|
528
|
+
if (s === n || s.listener === n)
|
|
529
|
+
--this._eventsCount === 0 ? this._events = /* @__PURE__ */ Object.create(null) : (delete r[t], r.removeListener && this.emit("removeListener", t, s.listener || n));
|
|
530
|
+
else if (typeof s != "function") {
|
|
531
|
+
for (o = -1, a = s.length - 1; a >= 0; a--)
|
|
532
|
+
if (s[a] === n || s[a].listener === n) {
|
|
533
|
+
l = s[a].listener, o = a;
|
|
534
|
+
break;
|
|
535
|
+
}
|
|
536
|
+
if (o < 0)
|
|
537
|
+
return this;
|
|
538
|
+
o === 0 ? s.shift() : Ie(s, o), s.length === 1 && (r[t] = s[0]), r.removeListener !== void 0 && this.emit("removeListener", t, l || n);
|
|
539
|
+
}
|
|
540
|
+
return this;
|
|
541
|
+
};
|
|
542
|
+
c.prototype.off = c.prototype.removeListener;
|
|
543
|
+
c.prototype.removeAllListeners = function(t) {
|
|
544
|
+
var n, s, r;
|
|
545
|
+
if (s = this._events, s === void 0)
|
|
546
|
+
return this;
|
|
547
|
+
if (s.removeListener === void 0)
|
|
548
|
+
return arguments.length === 0 ? (this._events = /* @__PURE__ */ Object.create(null), this._eventsCount = 0) : s[t] !== void 0 && (--this._eventsCount === 0 ? this._events = /* @__PURE__ */ Object.create(null) : delete s[t]), this;
|
|
549
|
+
if (arguments.length === 0) {
|
|
550
|
+
var o = Object.keys(s), a;
|
|
551
|
+
for (r = 0; r < o.length; ++r)
|
|
552
|
+
a = o[r], a !== "removeListener" && this.removeAllListeners(a);
|
|
553
|
+
return this.removeAllListeners("removeListener"), this._events = /* @__PURE__ */ Object.create(null), this._eventsCount = 0, this;
|
|
554
|
+
}
|
|
555
|
+
if (n = s[t], typeof n == "function")
|
|
556
|
+
this.removeListener(t, n);
|
|
557
|
+
else if (n !== void 0)
|
|
558
|
+
for (r = n.length - 1; r >= 0; r--)
|
|
559
|
+
this.removeListener(t, n[r]);
|
|
560
|
+
return this;
|
|
561
|
+
};
|
|
562
|
+
function Z(e, t, n) {
|
|
563
|
+
var s = e._events;
|
|
564
|
+
if (s === void 0)
|
|
565
|
+
return [];
|
|
566
|
+
var r = s[t];
|
|
567
|
+
return r === void 0 ? [] : typeof r == "function" ? n ? [r.listener || r] : [r] : n ? et(r) : V(r, r.length);
|
|
568
|
+
}
|
|
569
|
+
c.prototype.listeners = function(t) {
|
|
570
|
+
return Z(this, t, !0);
|
|
571
|
+
};
|
|
572
|
+
c.prototype.rawListeners = function(t) {
|
|
573
|
+
return Z(this, t, !1);
|
|
574
|
+
};
|
|
575
|
+
c.listenerCount = function(e, t) {
|
|
576
|
+
return typeof e.listenerCount == "function" ? e.listenerCount(t) : G.call(e, t);
|
|
577
|
+
};
|
|
578
|
+
c.prototype.listenerCount = G;
|
|
579
|
+
function G(e) {
|
|
580
|
+
var t = this._events;
|
|
581
|
+
if (t !== void 0) {
|
|
582
|
+
var n = t[e];
|
|
583
|
+
if (typeof n == "function")
|
|
584
|
+
return 1;
|
|
585
|
+
if (n !== void 0)
|
|
586
|
+
return n.length;
|
|
587
|
+
}
|
|
588
|
+
return 0;
|
|
589
|
+
}
|
|
590
|
+
c.prototype.eventNames = function() {
|
|
591
|
+
return this._eventsCount > 0 ? b(this._events) : [];
|
|
592
|
+
};
|
|
593
|
+
function V(e, t) {
|
|
594
|
+
for (var n = new Array(t), s = 0; s < t; ++s)
|
|
595
|
+
n[s] = e[s];
|
|
596
|
+
return n;
|
|
597
|
+
}
|
|
598
|
+
function Ie(e, t) {
|
|
599
|
+
for (; t + 1 < e.length; t++)
|
|
600
|
+
e[t] = e[t + 1];
|
|
601
|
+
e.pop();
|
|
602
|
+
}
|
|
603
|
+
function et(e) {
|
|
604
|
+
for (var t = new Array(e.length), n = 0; n < t.length; ++n)
|
|
605
|
+
t[n] = e[n].listener || e[n];
|
|
606
|
+
return t;
|
|
607
|
+
}
|
|
608
|
+
function tt(e, t) {
|
|
609
|
+
return new Promise(function(n, s) {
|
|
610
|
+
function r(a) {
|
|
611
|
+
e.removeListener(t, o), s(a);
|
|
612
|
+
}
|
|
613
|
+
function o() {
|
|
614
|
+
typeof e.removeListener == "function" && e.removeListener("error", r), n([].slice.call(arguments));
|
|
615
|
+
}
|
|
616
|
+
X(e, t, o, { once: !0 }), t !== "error" && nt(e, r, { once: !0 });
|
|
617
|
+
});
|
|
618
|
+
}
|
|
619
|
+
function nt(e, t, n) {
|
|
620
|
+
typeof e.on == "function" && X(e, "error", t, n);
|
|
621
|
+
}
|
|
622
|
+
function X(e, t, n, s) {
|
|
623
|
+
if (typeof e.on == "function")
|
|
624
|
+
s.once ? e.once(t, n) : e.on(t, n);
|
|
625
|
+
else if (typeof e.addEventListener == "function")
|
|
626
|
+
e.addEventListener(t, function r(o) {
|
|
627
|
+
s.once && e.removeEventListener(t, r), n(o);
|
|
628
|
+
});
|
|
629
|
+
else
|
|
630
|
+
throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type ' + typeof e);
|
|
631
|
+
}
|
|
632
|
+
var st = E.exports;
|
|
633
|
+
const rt = /* @__PURE__ */ Ge(st), ot = (e, t = new rt()) => {
|
|
634
|
+
const n = {
|
|
635
|
+
emit: (o, ...a) => (t.emit(o.toString(), ...a), n)
|
|
636
|
+
}, s = e(n), r = Object.assign(
|
|
637
|
+
s,
|
|
638
|
+
{
|
|
639
|
+
on: (o, a) => (t.on(o.toString(), (...l) => a(...l)), r),
|
|
640
|
+
once: (o, a) => (t.once(o.toString(), (...l) => a(...l)), r),
|
|
641
|
+
off: (o, a) => (t.off(o.toString(), (...l) => a(...l)), r)
|
|
642
|
+
}
|
|
643
|
+
);
|
|
644
|
+
return r;
|
|
645
|
+
}, at = (e) => new Promise(
|
|
646
|
+
(t) => {
|
|
647
|
+
setTimeout(t, e);
|
|
648
|
+
}
|
|
649
|
+
), it = (e) => ({
|
|
650
|
+
start: u(e.start),
|
|
651
|
+
end: u(e.end)
|
|
652
|
+
}), ct = (e) => ({
|
|
653
|
+
...e,
|
|
654
|
+
createdAt: u(e.createdAt),
|
|
655
|
+
destroyAt: u(e.destroyAt),
|
|
656
|
+
period: e.period ? it(e.period) : void 0
|
|
657
|
+
}), R = (e) => ({
|
|
658
|
+
...e,
|
|
659
|
+
detail: ct(e.detail)
|
|
660
|
+
}), I = (e, t, n) => {
|
|
661
|
+
var r, o;
|
|
662
|
+
const s = typeof e == "string" ? e : e.id;
|
|
663
|
+
return i.$post(
|
|
664
|
+
`/tasks/${s}/_run`,
|
|
665
|
+
null,
|
|
666
|
+
{
|
|
667
|
+
params: {
|
|
668
|
+
test_emails: t == null ? void 0 : t.testEmails,
|
|
669
|
+
period_start: (r = t == null ? void 0 : t.period) == null ? void 0 : r.start,
|
|
670
|
+
period_end: (o = t == null ? void 0 : t.period) == null ? void 0 : o.end,
|
|
671
|
+
namespaces: n
|
|
672
|
+
}
|
|
673
|
+
}
|
|
674
|
+
);
|
|
675
|
+
}, ut = (...e) => ot(
|
|
676
|
+
async (t) => {
|
|
677
|
+
const { content: { id: n, queue: s } } = await I(...e);
|
|
678
|
+
t.emit("started", { id: n, queue: s });
|
|
679
|
+
let r;
|
|
680
|
+
do {
|
|
681
|
+
const {
|
|
682
|
+
content: {
|
|
683
|
+
progress: o,
|
|
684
|
+
status: a,
|
|
685
|
+
result: l
|
|
686
|
+
}
|
|
687
|
+
// FIXME: What if param order changes ?
|
|
688
|
+
// eslint-disable-next-line no-await-in-loop
|
|
689
|
+
} = await w(s, n, e[2]);
|
|
690
|
+
r = { progress: o, status: a, result: l }, t.emit("progress", { progress: o, status: a });
|
|
691
|
+
let p = 1e3;
|
|
692
|
+
r.status === "active" && (p = 250), await at(p);
|
|
693
|
+
} while (["completed", "failed", "stuck"].includes(r.status) === !1);
|
|
694
|
+
if (!r.result)
|
|
695
|
+
throw new Error("Generation failed with weird error");
|
|
696
|
+
return R(r.result);
|
|
697
|
+
}
|
|
698
|
+
), v = async (e, t, n) => (await f(
|
|
699
|
+
"get",
|
|
700
|
+
`/reports/${e}`,
|
|
701
|
+
{
|
|
702
|
+
responseType: n,
|
|
703
|
+
params: { namespaces: t }
|
|
704
|
+
}
|
|
705
|
+
)).data, lt = (e, t, n, s = "pdf") => v(`${e}.rep.${s}`, t, n), pt = async (e, t, n, s) => {
|
|
706
|
+
var o;
|
|
707
|
+
const { content: { result: r } } = await w(
|
|
708
|
+
e,
|
|
709
|
+
t,
|
|
710
|
+
n
|
|
711
|
+
);
|
|
712
|
+
if (!r)
|
|
713
|
+
throw new Error("Job have no result");
|
|
714
|
+
return v(((o = r.detail) == null ? void 0 : o.files.report) ?? "", n, s);
|
|
715
|
+
}, dt = async (e, t, n) => {
|
|
716
|
+
const s = await v(`${e}.det.json`, t, n);
|
|
717
|
+
return !n || n === "json" ? R(s) : s;
|
|
718
|
+
}, ft = async (e, t, n, s) => {
|
|
719
|
+
var a;
|
|
720
|
+
const { content: { result: r } } = await w(
|
|
721
|
+
e,
|
|
722
|
+
t,
|
|
723
|
+
n
|
|
724
|
+
);
|
|
725
|
+
if (!r)
|
|
726
|
+
throw new Error("Job have no result");
|
|
727
|
+
const o = await v(((a = r.detail) == null ? void 0 : a.files.detail) ?? "", n, s);
|
|
728
|
+
return !s || s === "json" ? R(o) : o;
|
|
729
|
+
}, gt = (e, t, n) => v(`${e}.deb.json`, t, n), yt = async (e, t, n, s) => {
|
|
730
|
+
var o;
|
|
731
|
+
const { content: { result: r } } = await w(
|
|
732
|
+
e,
|
|
733
|
+
t,
|
|
734
|
+
n
|
|
735
|
+
);
|
|
736
|
+
if (!r)
|
|
737
|
+
throw new Error("Job have no result");
|
|
738
|
+
return v(((o = r.detail) == null ? void 0 : o.files.debug) ?? "", n, s);
|
|
739
|
+
}, qt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
740
|
+
__proto__: null,
|
|
741
|
+
getReportDebugByJob: yt,
|
|
742
|
+
getReportDebugByName: gt,
|
|
743
|
+
getReportDetailByJob: ft,
|
|
744
|
+
getReportDetailByName: dt,
|
|
745
|
+
getReportFileByJob: pt,
|
|
746
|
+
getReportFileByName: lt,
|
|
747
|
+
startAndListenGeneration: ut,
|
|
748
|
+
startGeneration: I
|
|
749
|
+
}, Symbol.toStringTag, { value: "Module" })), mt = (e) => {
|
|
750
|
+
i.defaults.baseURL = e;
|
|
751
|
+
}, vt = () => {
|
|
752
|
+
i.defaults.baseURL = void 0;
|
|
753
|
+
}, ht = () => !!i.defaults.baseURL, Ht = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
754
|
+
__proto__: null,
|
|
755
|
+
isLogged: F,
|
|
756
|
+
isURLset: ht,
|
|
757
|
+
login: Y,
|
|
758
|
+
logout: z,
|
|
759
|
+
setURL: mt,
|
|
760
|
+
unsetURL: vt
|
|
761
|
+
}, Symbol.toStringTag, { value: "Module" })), C = (e) => ({
|
|
762
|
+
...e,
|
|
763
|
+
createdAt: u(e.createdAt),
|
|
764
|
+
updatedAt: e.updatedAt ? u(e.updatedAt) : void 0
|
|
765
|
+
}), D = (e) => {
|
|
766
|
+
const { body: t, tasks: n, ...s } = e;
|
|
767
|
+
return {
|
|
768
|
+
...C(s),
|
|
769
|
+
tasks: n.map($),
|
|
770
|
+
body: t
|
|
771
|
+
};
|
|
772
|
+
}, wt = async () => {
|
|
773
|
+
const { content: e, ...t } = await i.$get("/templates");
|
|
774
|
+
return {
|
|
775
|
+
...t,
|
|
776
|
+
content: e.map(C)
|
|
777
|
+
};
|
|
778
|
+
}, _t = async (e) => {
|
|
779
|
+
const t = typeof e == "string" ? e : e.id, { content: n, ...s } = await i.$get(`/templates/${t}`);
|
|
780
|
+
return {
|
|
781
|
+
...s,
|
|
782
|
+
content: D(n)
|
|
783
|
+
};
|
|
784
|
+
}, bt = async (e) => {
|
|
785
|
+
const { content: t, ...n } = await i.$post(
|
|
786
|
+
"/templates",
|
|
787
|
+
e
|
|
788
|
+
);
|
|
789
|
+
return {
|
|
790
|
+
...n,
|
|
791
|
+
content: D(t)
|
|
792
|
+
};
|
|
793
|
+
}, ee = async (e) => {
|
|
794
|
+
const { id: t, ...n } = e, { content: s, ...r } = await i.$put(
|
|
795
|
+
`/templates/${t}`,
|
|
796
|
+
n
|
|
797
|
+
);
|
|
798
|
+
return {
|
|
799
|
+
...r,
|
|
800
|
+
content: D(s)
|
|
801
|
+
};
|
|
802
|
+
}, $t = ee, Tt = async (e) => {
|
|
803
|
+
const t = typeof e == "string" ? e : e.id;
|
|
804
|
+
await i.$delete(`/templates/${t}`);
|
|
805
|
+
}, g = (e) => {
|
|
806
|
+
const {
|
|
807
|
+
activity: t,
|
|
808
|
+
template: n,
|
|
809
|
+
targets: s,
|
|
810
|
+
extends: r,
|
|
811
|
+
...o
|
|
812
|
+
} = e;
|
|
813
|
+
return {
|
|
814
|
+
...O(o),
|
|
815
|
+
extends: C(r),
|
|
816
|
+
activity: t.map(Ne),
|
|
817
|
+
template: n,
|
|
818
|
+
targets: s
|
|
819
|
+
};
|
|
820
|
+
}, Lt = async (e, t) => {
|
|
821
|
+
const { data: { content: n, ...s } } = await f(
|
|
822
|
+
"get",
|
|
823
|
+
"/tasks",
|
|
824
|
+
{
|
|
825
|
+
params: {
|
|
826
|
+
namespaces: t,
|
|
827
|
+
...e ?? {}
|
|
828
|
+
}
|
|
829
|
+
}
|
|
830
|
+
);
|
|
831
|
+
return {
|
|
832
|
+
...s,
|
|
833
|
+
content: n.map(({ tags: r, _count: o, ...a }) => ({
|
|
834
|
+
tags: r,
|
|
835
|
+
_count: o,
|
|
836
|
+
...$(a)
|
|
837
|
+
}))
|
|
838
|
+
};
|
|
839
|
+
}, At = (e) => i.$get(
|
|
840
|
+
"/tasks/_targets",
|
|
841
|
+
{ params: { namespaces: e } }
|
|
842
|
+
), kt = async (e, t) => {
|
|
843
|
+
const { content: n, ...s } = await i.$get(
|
|
844
|
+
`/tasks/_targets/${e}/tasks`,
|
|
845
|
+
{ params: { namespaces: t } }
|
|
846
|
+
);
|
|
847
|
+
return {
|
|
848
|
+
...s,
|
|
849
|
+
content: n.map(({ tags: r, ...o }) => ({
|
|
850
|
+
tags: r,
|
|
851
|
+
...$(o)
|
|
852
|
+
}))
|
|
853
|
+
};
|
|
854
|
+
}, Et = async (e, t, n) => {
|
|
855
|
+
const s = typeof t == "string" ? t : t.id;
|
|
856
|
+
await i.$delete(`/tasks/_targets/${e}/tasks/${s}`, { params: { namespaces: n } });
|
|
857
|
+
}, Rt = async (e, t) => {
|
|
858
|
+
const { content: n, ...s } = await i.$post(
|
|
859
|
+
"/tasks",
|
|
860
|
+
e,
|
|
861
|
+
{ params: { namespaces: t } }
|
|
862
|
+
);
|
|
863
|
+
return {
|
|
864
|
+
...s,
|
|
865
|
+
content: g(n)
|
|
866
|
+
};
|
|
867
|
+
}, Ct = async (e, t, n) => {
|
|
868
|
+
const { content: s, ...r } = await i.$post(
|
|
869
|
+
`/tasks/_from-preset/${e}`,
|
|
870
|
+
t,
|
|
871
|
+
{ params: { namespaces: n } }
|
|
872
|
+
);
|
|
873
|
+
return {
|
|
874
|
+
...r,
|
|
875
|
+
content: g(s)
|
|
876
|
+
};
|
|
877
|
+
}, Dt = async (e, t) => {
|
|
878
|
+
const n = typeof e == "string" ? e : e.id, { content: s, ...r } = await i.$get(`/tasks/${n}`, { params: { namespaces: t } });
|
|
879
|
+
return {
|
|
880
|
+
...r,
|
|
881
|
+
content: g(s)
|
|
882
|
+
};
|
|
883
|
+
}, te = async (e, t) => {
|
|
884
|
+
const { id: n, ...s } = e, { content: r, ...o } = await i.$put(
|
|
885
|
+
`/tasks/${n}`,
|
|
886
|
+
s,
|
|
887
|
+
{ params: { namespaces: t } }
|
|
888
|
+
);
|
|
889
|
+
return {
|
|
890
|
+
...o,
|
|
891
|
+
content: g(r)
|
|
892
|
+
};
|
|
893
|
+
}, jt = te, xt = async (e, t) => {
|
|
894
|
+
const n = typeof e == "string" ? e : e.id;
|
|
895
|
+
await i.$delete(`/tasks/${n}`, { params: { namespaces: t } });
|
|
896
|
+
}, St = async (e, t) => {
|
|
897
|
+
const n = typeof e == "string" ? e : e.id, { content: s, ...r } = await i.$put(
|
|
898
|
+
`/tasks/${n}/_enable`,
|
|
899
|
+
void 0,
|
|
900
|
+
{ params: { namespaces: t } }
|
|
901
|
+
);
|
|
902
|
+
return {
|
|
903
|
+
...r,
|
|
904
|
+
content: g(s)
|
|
905
|
+
};
|
|
906
|
+
}, Nt = async (e, t) => {
|
|
907
|
+
const n = typeof e == "string" ? e : e.id, { content: s, ...r } = await i.$put(
|
|
908
|
+
`/tasks/${n}/_disable`,
|
|
909
|
+
void 0,
|
|
910
|
+
{ params: { namespaces: t } }
|
|
911
|
+
);
|
|
912
|
+
return {
|
|
913
|
+
...r,
|
|
914
|
+
content: g(s)
|
|
915
|
+
};
|
|
916
|
+
}, Pt = async (e, t, n) => {
|
|
917
|
+
const s = typeof e == "string" ? e : e.id, r = typeof t == "string" ? t : t.id, { content: o, ...a } = await i.$put(
|
|
918
|
+
`/tasks/${s}/_link/${r}`,
|
|
919
|
+
void 0,
|
|
920
|
+
{ params: { namespaces: n } }
|
|
921
|
+
);
|
|
922
|
+
return {
|
|
923
|
+
...a,
|
|
924
|
+
content: g(o)
|
|
925
|
+
};
|
|
926
|
+
}, Mt = async (e, t, n) => {
|
|
927
|
+
const s = typeof e == "string" ? e : e.id, r = typeof t == "string" ? t : t.id;
|
|
928
|
+
await i.$delete(
|
|
929
|
+
`/tasks/${s}/_link/${r}`,
|
|
930
|
+
{ params: { namespaces: n } }
|
|
931
|
+
);
|
|
932
|
+
}, Zt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
933
|
+
__proto__: null,
|
|
934
|
+
Recurrence: B,
|
|
935
|
+
createTask: Rt,
|
|
936
|
+
createTaskFromPreset: Ct,
|
|
937
|
+
deleteTask: xt,
|
|
938
|
+
disableTask: Nt,
|
|
939
|
+
enableTask: St,
|
|
940
|
+
getAllTargets: At,
|
|
941
|
+
getAllTasks: Lt,
|
|
942
|
+
getTask: Dt,
|
|
943
|
+
getTasksOfTarget: kt,
|
|
944
|
+
linkTaskToTemplate: Pt,
|
|
945
|
+
unlinkTaskToTemplate: Mt,
|
|
946
|
+
unsubTargetOfTask: Et,
|
|
947
|
+
updateTask: jt,
|
|
948
|
+
upsertTask: te
|
|
949
|
+
}, Symbol.toStringTag, { value: "Module" })), Gt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
950
|
+
__proto__: null,
|
|
951
|
+
createTemplate: bt,
|
|
952
|
+
deleteTemplate: Tt,
|
|
953
|
+
getAllTemplates: wt,
|
|
954
|
+
getTemplate: _t,
|
|
955
|
+
updateTemplate: $t,
|
|
956
|
+
upsertTemplate: ee
|
|
957
|
+
}, Symbol.toStringTag, { value: "Module" })), Ut = (e) => i.$get("/elastic/indices", { params: { namespace: e } }), Yt = (e, t) => i.$get(`/elastic/indices/${e}`, { params: { namespace: t } }), Vt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
958
|
+
__proto__: null,
|
|
959
|
+
getAllIndices: Ut,
|
|
960
|
+
getIndexMapping: Yt
|
|
961
|
+
}, Symbol.toStringTag, { value: "Module" })), Xt = oe;
|
|
962
|
+
export {
|
|
963
|
+
Ft as auth,
|
|
964
|
+
Wt as crons,
|
|
965
|
+
Vt as elastic,
|
|
966
|
+
Jt as health,
|
|
967
|
+
Bt as history,
|
|
968
|
+
Qt as namespaces,
|
|
969
|
+
Kt as queues,
|
|
970
|
+
qt as reports,
|
|
971
|
+
Ht as setup,
|
|
972
|
+
Zt as tasks,
|
|
973
|
+
Bt as tasksActivity,
|
|
974
|
+
Ot as tasksPresets,
|
|
975
|
+
Gt as templates,
|
|
976
|
+
Xt as version
|
|
977
|
+
};
|
|
978
|
+
//# sourceMappingURL=ezreeport-sdk-js.mjs.map
|