@ocelescope/api-base 0.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/README.md +29 -0
- package/dist/index.d.ts +2022 -0
- package/dist/index.js +1980 -0
- package/package.json +51 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,1980 @@
|
|
|
1
|
+
import { useMutation, useQuery } from "@tanstack/react-query";
|
|
2
|
+
import { client } from "@ocelescope/api-client";
|
|
3
|
+
|
|
4
|
+
//#region src/lib/fetcher.ts
|
|
5
|
+
const customFetch = async (url, options) => client(url, options);
|
|
6
|
+
|
|
7
|
+
//#endregion
|
|
8
|
+
//#region src/api/base.ts
|
|
9
|
+
/**
|
|
10
|
+
* Generated by orval v8.4.1 🍺
|
|
11
|
+
* Do not edit manually.
|
|
12
|
+
* Ocelescope Backend
|
|
13
|
+
* OpenAPI spec version: 0.1
|
|
14
|
+
*/
|
|
15
|
+
const DotVisLayoutEngine = {
|
|
16
|
+
circo: "circo",
|
|
17
|
+
dot: "dot",
|
|
18
|
+
fdp: "fdp",
|
|
19
|
+
sfdp: "sfdp",
|
|
20
|
+
neato: "neato",
|
|
21
|
+
osage: "osage",
|
|
22
|
+
patchwork: "patchwork",
|
|
23
|
+
twopi: "twopi",
|
|
24
|
+
nop: "nop",
|
|
25
|
+
nop2: "nop2"
|
|
26
|
+
};
|
|
27
|
+
const E2OCountFilterDirection = {
|
|
28
|
+
source: "source",
|
|
29
|
+
target: "target"
|
|
30
|
+
};
|
|
31
|
+
const EventTypeFilterMode = {
|
|
32
|
+
exclude: "exclude",
|
|
33
|
+
include: "include"
|
|
34
|
+
};
|
|
35
|
+
const GraphNodeShape = {
|
|
36
|
+
circle: "circle",
|
|
37
|
+
triangle: "triangle",
|
|
38
|
+
rectangle: "rectangle",
|
|
39
|
+
diamond: "diamond",
|
|
40
|
+
hexagon: "hexagon"
|
|
41
|
+
};
|
|
42
|
+
const GraphNodeLabelPos = {
|
|
43
|
+
top: "top",
|
|
44
|
+
center: "center",
|
|
45
|
+
bottom: "bottom"
|
|
46
|
+
};
|
|
47
|
+
const GraphvizLayoutConfigEngine = {
|
|
48
|
+
circo: "circo",
|
|
49
|
+
dot: "dot",
|
|
50
|
+
fdp: "fdp",
|
|
51
|
+
sfdp: "sfdp",
|
|
52
|
+
neato: "neato",
|
|
53
|
+
osage: "osage",
|
|
54
|
+
patchwork: "patchwork",
|
|
55
|
+
twopi: "twopi",
|
|
56
|
+
nop: "nop",
|
|
57
|
+
nop2: "nop2"
|
|
58
|
+
};
|
|
59
|
+
const TableColumnDataType = {
|
|
60
|
+
string: "string",
|
|
61
|
+
number: "number",
|
|
62
|
+
boolean: "boolean",
|
|
63
|
+
date: "date",
|
|
64
|
+
datetime: "datetime"
|
|
65
|
+
};
|
|
66
|
+
const O2OCountFilterDirection = {
|
|
67
|
+
source: "source",
|
|
68
|
+
target: "target"
|
|
69
|
+
};
|
|
70
|
+
const ObjectTypeFilterMode = {
|
|
71
|
+
exclude: "exclude",
|
|
72
|
+
include: "include"
|
|
73
|
+
};
|
|
74
|
+
const TimeFrameFilterMode = {
|
|
75
|
+
exclude: "exclude",
|
|
76
|
+
include: "include"
|
|
77
|
+
};
|
|
78
|
+
const TaskState = {
|
|
79
|
+
PENDING: "PENDING",
|
|
80
|
+
STARTED: "STARTED",
|
|
81
|
+
SUCCESS: "SUCCESS",
|
|
82
|
+
FAILURE: "FAILURE",
|
|
83
|
+
SKIPPED: "SKIPPED",
|
|
84
|
+
CANCELLED: "CANCELLED"
|
|
85
|
+
};
|
|
86
|
+
const E2oDirection = {
|
|
87
|
+
source: "source",
|
|
88
|
+
target: "target"
|
|
89
|
+
};
|
|
90
|
+
const O2oDirection = {
|
|
91
|
+
source: "source",
|
|
92
|
+
target: "target"
|
|
93
|
+
};
|
|
94
|
+
const DownloadOcelOcelsDownloadGetExt = {
|
|
95
|
+
xml: ".xml",
|
|
96
|
+
json: ".json",
|
|
97
|
+
sqlite: ".sqlite"
|
|
98
|
+
};
|
|
99
|
+
/**
|
|
100
|
+
* @summary Get Events
|
|
101
|
+
*/
|
|
102
|
+
const getOcelotPaginatedEventsUrl = (params) => {
|
|
103
|
+
const normalizedParams = new URLSearchParams();
|
|
104
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
105
|
+
if (value !== void 0) normalizedParams.append(key, value === null ? "null" : value.toString());
|
|
106
|
+
});
|
|
107
|
+
const stringifiedParams = normalizedParams.toString();
|
|
108
|
+
return stringifiedParams.length > 0 ? `/api/external/ocelot/events?${stringifiedParams}` : `/api/external/ocelot/events`;
|
|
109
|
+
};
|
|
110
|
+
const ocelotPaginatedEvents = async (params, options) => {
|
|
111
|
+
return customFetch(getOcelotPaginatedEventsUrl(params), {
|
|
112
|
+
...options,
|
|
113
|
+
method: "GET"
|
|
114
|
+
});
|
|
115
|
+
};
|
|
116
|
+
const getOcelotPaginatedEventsQueryKey = (params) => {
|
|
117
|
+
return [`/api/external/ocelot/events`, ...params ? [params] : []];
|
|
118
|
+
};
|
|
119
|
+
const getOcelotPaginatedEventsQueryOptions = (params, options) => {
|
|
120
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
121
|
+
const queryKey = queryOptions?.queryKey ?? getOcelotPaginatedEventsQueryKey(params);
|
|
122
|
+
const queryFn = ({ signal }) => ocelotPaginatedEvents(params, {
|
|
123
|
+
signal,
|
|
124
|
+
...requestOptions
|
|
125
|
+
});
|
|
126
|
+
return {
|
|
127
|
+
queryKey,
|
|
128
|
+
queryFn,
|
|
129
|
+
staleTime: 3e5,
|
|
130
|
+
...queryOptions
|
|
131
|
+
};
|
|
132
|
+
};
|
|
133
|
+
/**
|
|
134
|
+
* @summary Get Events
|
|
135
|
+
*/
|
|
136
|
+
function useOcelotPaginatedEvents(params, options, queryClient) {
|
|
137
|
+
const queryOptions = getOcelotPaginatedEventsQueryOptions(params, options);
|
|
138
|
+
return {
|
|
139
|
+
...useQuery(queryOptions, queryClient),
|
|
140
|
+
queryKey: queryOptions.queryKey
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* @summary Get Objects
|
|
145
|
+
*/
|
|
146
|
+
const getOcelotPaginatedObjectsUrl = (params) => {
|
|
147
|
+
const normalizedParams = new URLSearchParams();
|
|
148
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
149
|
+
if (value !== void 0) normalizedParams.append(key, value === null ? "null" : value.toString());
|
|
150
|
+
});
|
|
151
|
+
const stringifiedParams = normalizedParams.toString();
|
|
152
|
+
return stringifiedParams.length > 0 ? `/api/external/ocelot/objects?${stringifiedParams}` : `/api/external/ocelot/objects`;
|
|
153
|
+
};
|
|
154
|
+
const ocelotPaginatedObjects = async (params, options) => {
|
|
155
|
+
return customFetch(getOcelotPaginatedObjectsUrl(params), {
|
|
156
|
+
...options,
|
|
157
|
+
method: "GET"
|
|
158
|
+
});
|
|
159
|
+
};
|
|
160
|
+
const getOcelotPaginatedObjectsQueryKey = (params) => {
|
|
161
|
+
return [`/api/external/ocelot/objects`, ...params ? [params] : []];
|
|
162
|
+
};
|
|
163
|
+
const getOcelotPaginatedObjectsQueryOptions = (params, options) => {
|
|
164
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
165
|
+
const queryKey = queryOptions?.queryKey ?? getOcelotPaginatedObjectsQueryKey(params);
|
|
166
|
+
const queryFn = ({ signal }) => ocelotPaginatedObjects(params, {
|
|
167
|
+
signal,
|
|
168
|
+
...requestOptions
|
|
169
|
+
});
|
|
170
|
+
return {
|
|
171
|
+
queryKey,
|
|
172
|
+
queryFn,
|
|
173
|
+
staleTime: 3e5,
|
|
174
|
+
...queryOptions
|
|
175
|
+
};
|
|
176
|
+
};
|
|
177
|
+
/**
|
|
178
|
+
* @summary Get Objects
|
|
179
|
+
*/
|
|
180
|
+
function useOcelotPaginatedObjects(params, options, queryClient) {
|
|
181
|
+
const queryOptions = getOcelotPaginatedObjectsQueryOptions(params, options);
|
|
182
|
+
return {
|
|
183
|
+
...useQuery(queryOptions, queryClient),
|
|
184
|
+
queryKey: queryOptions.queryKey
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* @summary Get Object Changes
|
|
189
|
+
*/
|
|
190
|
+
const getOcelotGetObjectChangesUrl = (objectId, params) => {
|
|
191
|
+
const normalizedParams = new URLSearchParams();
|
|
192
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
193
|
+
if (value !== void 0) normalizedParams.append(key, value === null ? "null" : value.toString());
|
|
194
|
+
});
|
|
195
|
+
const stringifiedParams = normalizedParams.toString();
|
|
196
|
+
return stringifiedParams.length > 0 ? `/api/external/ocelot/objects/changes/${objectId}?${stringifiedParams}` : `/api/external/ocelot/objects/changes/${objectId}`;
|
|
197
|
+
};
|
|
198
|
+
const ocelotGetObjectChanges = async (objectId, params, options) => {
|
|
199
|
+
return customFetch(getOcelotGetObjectChangesUrl(objectId, params), {
|
|
200
|
+
...options,
|
|
201
|
+
method: "GET"
|
|
202
|
+
});
|
|
203
|
+
};
|
|
204
|
+
const getOcelotGetObjectChangesQueryKey = (objectId, params) => {
|
|
205
|
+
return [`/api/external/ocelot/objects/changes/${objectId}`, ...params ? [params] : []];
|
|
206
|
+
};
|
|
207
|
+
const getOcelotGetObjectChangesQueryOptions = (objectId, params, options) => {
|
|
208
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
209
|
+
const queryKey = queryOptions?.queryKey ?? getOcelotGetObjectChangesQueryKey(objectId, params);
|
|
210
|
+
const queryFn = ({ signal }) => ocelotGetObjectChanges(objectId, params, {
|
|
211
|
+
signal,
|
|
212
|
+
...requestOptions
|
|
213
|
+
});
|
|
214
|
+
return {
|
|
215
|
+
queryKey,
|
|
216
|
+
queryFn,
|
|
217
|
+
enabled: !!objectId,
|
|
218
|
+
staleTime: 3e5,
|
|
219
|
+
...queryOptions
|
|
220
|
+
};
|
|
221
|
+
};
|
|
222
|
+
/**
|
|
223
|
+
* @summary Get Object Changes
|
|
224
|
+
*/
|
|
225
|
+
function useOcelotGetObjectChanges(objectId, params, options, queryClient) {
|
|
226
|
+
const queryOptions = getOcelotGetObjectChangesQueryOptions(objectId, params, options);
|
|
227
|
+
return {
|
|
228
|
+
...useQuery(queryOptions, queryClient),
|
|
229
|
+
queryKey: queryOptions.queryKey
|
|
230
|
+
};
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* @summary Get Objects Info
|
|
234
|
+
*/
|
|
235
|
+
const getOcelotObjectInfoUrl = (params) => {
|
|
236
|
+
const normalizedParams = new URLSearchParams();
|
|
237
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
238
|
+
if (value !== void 0) normalizedParams.append(key, value === null ? "null" : value.toString());
|
|
239
|
+
});
|
|
240
|
+
const stringifiedParams = normalizedParams.toString();
|
|
241
|
+
return stringifiedParams.length > 0 ? `/api/external/ocelot/objectInfo?${stringifiedParams}` : `/api/external/ocelot/objectInfo`;
|
|
242
|
+
};
|
|
243
|
+
const ocelotObjectInfo = async (params, options) => {
|
|
244
|
+
return customFetch(getOcelotObjectInfoUrl(params), {
|
|
245
|
+
...options,
|
|
246
|
+
method: "GET"
|
|
247
|
+
});
|
|
248
|
+
};
|
|
249
|
+
const getOcelotObjectInfoQueryKey = (params) => {
|
|
250
|
+
return [`/api/external/ocelot/objectInfo`, ...params ? [params] : []];
|
|
251
|
+
};
|
|
252
|
+
const getOcelotObjectInfoQueryOptions = (params, options) => {
|
|
253
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
254
|
+
const queryKey = queryOptions?.queryKey ?? getOcelotObjectInfoQueryKey(params);
|
|
255
|
+
const queryFn = ({ signal }) => ocelotObjectInfo(params, {
|
|
256
|
+
signal,
|
|
257
|
+
...requestOptions
|
|
258
|
+
});
|
|
259
|
+
return {
|
|
260
|
+
queryKey,
|
|
261
|
+
queryFn,
|
|
262
|
+
staleTime: 3e5,
|
|
263
|
+
...queryOptions
|
|
264
|
+
};
|
|
265
|
+
};
|
|
266
|
+
/**
|
|
267
|
+
* @summary Get Objects Info
|
|
268
|
+
*/
|
|
269
|
+
function useOcelotObjectInfo(params, options, queryClient) {
|
|
270
|
+
const queryOptions = getOcelotObjectInfoQueryOptions(params, options);
|
|
271
|
+
return {
|
|
272
|
+
...useQuery(queryOptions, queryClient),
|
|
273
|
+
queryKey: queryOptions.queryKey
|
|
274
|
+
};
|
|
275
|
+
}
|
|
276
|
+
/**
|
|
277
|
+
* @summary Get Event Info
|
|
278
|
+
*/
|
|
279
|
+
const getOcelotEventInfoUrl = (params) => {
|
|
280
|
+
const normalizedParams = new URLSearchParams();
|
|
281
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
282
|
+
if (value !== void 0) normalizedParams.append(key, value === null ? "null" : value.toString());
|
|
283
|
+
});
|
|
284
|
+
const stringifiedParams = normalizedParams.toString();
|
|
285
|
+
return stringifiedParams.length > 0 ? `/api/external/ocelot/eventInfo?${stringifiedParams}` : `/api/external/ocelot/eventInfo`;
|
|
286
|
+
};
|
|
287
|
+
const ocelotEventInfo = async (params, options) => {
|
|
288
|
+
return customFetch(getOcelotEventInfoUrl(params), {
|
|
289
|
+
...options,
|
|
290
|
+
method: "GET"
|
|
291
|
+
});
|
|
292
|
+
};
|
|
293
|
+
const getOcelotEventInfoQueryKey = (params) => {
|
|
294
|
+
return [`/api/external/ocelot/eventInfo`, ...params ? [params] : []];
|
|
295
|
+
};
|
|
296
|
+
const getOcelotEventInfoQueryOptions = (params, options) => {
|
|
297
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
298
|
+
const queryKey = queryOptions?.queryKey ?? getOcelotEventInfoQueryKey(params);
|
|
299
|
+
const queryFn = ({ signal }) => ocelotEventInfo(params, {
|
|
300
|
+
signal,
|
|
301
|
+
...requestOptions
|
|
302
|
+
});
|
|
303
|
+
return {
|
|
304
|
+
queryKey,
|
|
305
|
+
queryFn,
|
|
306
|
+
staleTime: 3e5,
|
|
307
|
+
...queryOptions
|
|
308
|
+
};
|
|
309
|
+
};
|
|
310
|
+
/**
|
|
311
|
+
* @summary Get Event Info
|
|
312
|
+
*/
|
|
313
|
+
function useOcelotEventInfo(params, options, queryClient) {
|
|
314
|
+
const queryOptions = getOcelotEventInfoQueryOptions(params, options);
|
|
315
|
+
return {
|
|
316
|
+
...useQuery(queryOptions, queryClient),
|
|
317
|
+
queryKey: queryOptions.queryKey
|
|
318
|
+
};
|
|
319
|
+
}
|
|
320
|
+
/**
|
|
321
|
+
* @summary Upload ocels, resources or tasks
|
|
322
|
+
*/
|
|
323
|
+
const getUploadUrl = () => {
|
|
324
|
+
return `/api/external/session/upload`;
|
|
325
|
+
};
|
|
326
|
+
const upload = async (bodyUpload, options) => {
|
|
327
|
+
const formData = new FormData();
|
|
328
|
+
bodyUpload.files.forEach((value) => formData.append(`files`, value));
|
|
329
|
+
return customFetch(getUploadUrl(), {
|
|
330
|
+
...options,
|
|
331
|
+
method: "POST",
|
|
332
|
+
body: formData
|
|
333
|
+
});
|
|
334
|
+
};
|
|
335
|
+
const getUploadMutationOptions = (options) => {
|
|
336
|
+
const mutationKey = ["upload"];
|
|
337
|
+
const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
|
|
338
|
+
...options,
|
|
339
|
+
mutation: {
|
|
340
|
+
...options.mutation,
|
|
341
|
+
mutationKey
|
|
342
|
+
}
|
|
343
|
+
} : {
|
|
344
|
+
mutation: { mutationKey },
|
|
345
|
+
request: void 0
|
|
346
|
+
};
|
|
347
|
+
const mutationFn = (props) => {
|
|
348
|
+
const { data } = props ?? {};
|
|
349
|
+
return upload(data, requestOptions);
|
|
350
|
+
};
|
|
351
|
+
return {
|
|
352
|
+
mutationFn,
|
|
353
|
+
...mutationOptions
|
|
354
|
+
};
|
|
355
|
+
};
|
|
356
|
+
/**
|
|
357
|
+
* @summary Upload ocels, resources or tasks
|
|
358
|
+
*/
|
|
359
|
+
const useUpload = (options, queryClient) => {
|
|
360
|
+
return useMutation(getUploadMutationOptions(options), queryClient);
|
|
361
|
+
};
|
|
362
|
+
/**
|
|
363
|
+
* @summary Deletes the Session
|
|
364
|
+
*/
|
|
365
|
+
const getLogoutUrl = () => {
|
|
366
|
+
return `/api/external/session/logout`;
|
|
367
|
+
};
|
|
368
|
+
const logout = async (options) => {
|
|
369
|
+
return customFetch(getLogoutUrl(), {
|
|
370
|
+
...options,
|
|
371
|
+
method: "POST"
|
|
372
|
+
});
|
|
373
|
+
};
|
|
374
|
+
const getLogoutMutationOptions = (options) => {
|
|
375
|
+
const mutationKey = ["logout"];
|
|
376
|
+
const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
|
|
377
|
+
...options,
|
|
378
|
+
mutation: {
|
|
379
|
+
...options.mutation,
|
|
380
|
+
mutationKey
|
|
381
|
+
}
|
|
382
|
+
} : {
|
|
383
|
+
mutation: { mutationKey },
|
|
384
|
+
request: void 0
|
|
385
|
+
};
|
|
386
|
+
const mutationFn = () => {
|
|
387
|
+
return logout(requestOptions);
|
|
388
|
+
};
|
|
389
|
+
return {
|
|
390
|
+
mutationFn,
|
|
391
|
+
...mutationOptions
|
|
392
|
+
};
|
|
393
|
+
};
|
|
394
|
+
/**
|
|
395
|
+
* @summary Deletes the Session
|
|
396
|
+
*/
|
|
397
|
+
const useLogout = (options, queryClient) => {
|
|
398
|
+
return useMutation(getLogoutMutationOptions(options), queryClient);
|
|
399
|
+
};
|
|
400
|
+
/**
|
|
401
|
+
* Returns metadata for all uploaded OCELs along with any OCEL files currently being imported. Includes the ID of the currently active OCEL, if one is selected.
|
|
402
|
+
* @summary List uploaded and uploading OCELs
|
|
403
|
+
*/
|
|
404
|
+
const getGetOcelsUrl = (params) => {
|
|
405
|
+
const normalizedParams = new URLSearchParams();
|
|
406
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
407
|
+
if (value !== void 0) normalizedParams.append(key, value === null ? "null" : value.toString());
|
|
408
|
+
});
|
|
409
|
+
const stringifiedParams = normalizedParams.toString();
|
|
410
|
+
return stringifiedParams.length > 0 ? `/api/external/ocels?${stringifiedParams}` : `/api/external/ocels`;
|
|
411
|
+
};
|
|
412
|
+
const getOcels = async (params, options) => {
|
|
413
|
+
return customFetch(getGetOcelsUrl(params), {
|
|
414
|
+
...options,
|
|
415
|
+
method: "GET"
|
|
416
|
+
});
|
|
417
|
+
};
|
|
418
|
+
const getGetOcelsQueryKey = (params) => {
|
|
419
|
+
return [`/api/external/ocels`, ...params ? [params] : []];
|
|
420
|
+
};
|
|
421
|
+
const getGetOcelsQueryOptions = (params, options) => {
|
|
422
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
423
|
+
const queryKey = queryOptions?.queryKey ?? getGetOcelsQueryKey(params);
|
|
424
|
+
const queryFn = ({ signal }) => getOcels(params, {
|
|
425
|
+
signal,
|
|
426
|
+
...requestOptions
|
|
427
|
+
});
|
|
428
|
+
return {
|
|
429
|
+
queryKey,
|
|
430
|
+
queryFn,
|
|
431
|
+
staleTime: 3e5,
|
|
432
|
+
...queryOptions
|
|
433
|
+
};
|
|
434
|
+
};
|
|
435
|
+
/**
|
|
436
|
+
* @summary List uploaded and uploading OCELs
|
|
437
|
+
*/
|
|
438
|
+
function useGetOcels(params, options, queryClient) {
|
|
439
|
+
const queryOptions = getGetOcelsQueryOptions(params, options);
|
|
440
|
+
return {
|
|
441
|
+
...useQuery(queryOptions, queryClient),
|
|
442
|
+
queryKey: queryOptions.queryKey
|
|
443
|
+
};
|
|
444
|
+
}
|
|
445
|
+
/**
|
|
446
|
+
* @summary Set Filter
|
|
447
|
+
*/
|
|
448
|
+
const getSetFiltersUrl = (params) => {
|
|
449
|
+
const normalizedParams = new URLSearchParams();
|
|
450
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
451
|
+
if (value !== void 0) normalizedParams.append(key, value === null ? "null" : value.toString());
|
|
452
|
+
});
|
|
453
|
+
const stringifiedParams = normalizedParams.toString();
|
|
454
|
+
return stringifiedParams.length > 0 ? `/api/external/ocels?${stringifiedParams}` : `/api/external/ocels`;
|
|
455
|
+
};
|
|
456
|
+
const setFilters = async (oCELFilterNull, params, options) => {
|
|
457
|
+
return customFetch(getSetFiltersUrl(params), {
|
|
458
|
+
...options,
|
|
459
|
+
method: "POST",
|
|
460
|
+
headers: {
|
|
461
|
+
"Content-Type": "application/json",
|
|
462
|
+
...options?.headers
|
|
463
|
+
},
|
|
464
|
+
body: JSON.stringify(oCELFilterNull)
|
|
465
|
+
});
|
|
466
|
+
};
|
|
467
|
+
const getSetFiltersMutationOptions = (options) => {
|
|
468
|
+
const mutationKey = ["setFilters"];
|
|
469
|
+
const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
|
|
470
|
+
...options,
|
|
471
|
+
mutation: {
|
|
472
|
+
...options.mutation,
|
|
473
|
+
mutationKey
|
|
474
|
+
}
|
|
475
|
+
} : {
|
|
476
|
+
mutation: { mutationKey },
|
|
477
|
+
request: void 0
|
|
478
|
+
};
|
|
479
|
+
const mutationFn = (props) => {
|
|
480
|
+
const { data, params } = props ?? {};
|
|
481
|
+
return setFilters(data, params, requestOptions);
|
|
482
|
+
};
|
|
483
|
+
return {
|
|
484
|
+
mutationFn,
|
|
485
|
+
...mutationOptions
|
|
486
|
+
};
|
|
487
|
+
};
|
|
488
|
+
/**
|
|
489
|
+
* @summary Set Filter
|
|
490
|
+
*/
|
|
491
|
+
const useSetFilters = (options, queryClient) => {
|
|
492
|
+
return useMutation(getSetFiltersMutationOptions(options), queryClient);
|
|
493
|
+
};
|
|
494
|
+
/**
|
|
495
|
+
* Deletes the uploaded OCEL with the given `ocel_id`. This action is irreversible and removes the OCEL from the session.
|
|
496
|
+
* @summary Delete an uploaded OCEL
|
|
497
|
+
*/
|
|
498
|
+
const getDeleteOcelUrl = (params) => {
|
|
499
|
+
const normalizedParams = new URLSearchParams();
|
|
500
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
501
|
+
if (value !== void 0) normalizedParams.append(key, value === null ? "null" : value.toString());
|
|
502
|
+
});
|
|
503
|
+
const stringifiedParams = normalizedParams.toString();
|
|
504
|
+
return stringifiedParams.length > 0 ? `/api/external/ocels/ocel/delete?${stringifiedParams}` : `/api/external/ocels/ocel/delete`;
|
|
505
|
+
};
|
|
506
|
+
const deleteOcel = async (params, options) => {
|
|
507
|
+
return customFetch(getDeleteOcelUrl(params), {
|
|
508
|
+
...options,
|
|
509
|
+
method: "POST"
|
|
510
|
+
});
|
|
511
|
+
};
|
|
512
|
+
const getDeleteOcelMutationOptions = (options) => {
|
|
513
|
+
const mutationKey = ["deleteOcel"];
|
|
514
|
+
const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
|
|
515
|
+
...options,
|
|
516
|
+
mutation: {
|
|
517
|
+
...options.mutation,
|
|
518
|
+
mutationKey
|
|
519
|
+
}
|
|
520
|
+
} : {
|
|
521
|
+
mutation: { mutationKey },
|
|
522
|
+
request: void 0
|
|
523
|
+
};
|
|
524
|
+
const mutationFn = (props) => {
|
|
525
|
+
const { params } = props ?? {};
|
|
526
|
+
return deleteOcel(params, requestOptions);
|
|
527
|
+
};
|
|
528
|
+
return {
|
|
529
|
+
mutationFn,
|
|
530
|
+
...mutationOptions
|
|
531
|
+
};
|
|
532
|
+
};
|
|
533
|
+
/**
|
|
534
|
+
* @summary Delete an uploaded OCEL
|
|
535
|
+
*/
|
|
536
|
+
const useDeleteOcel = (options, queryClient) => {
|
|
537
|
+
return useMutation(getDeleteOcelMutationOptions(options), queryClient);
|
|
538
|
+
};
|
|
539
|
+
/**
|
|
540
|
+
* Renames the OCEL represented by the given `ApiOcel` object to `new_name`. This updates the display name used in the UI and metadata.
|
|
541
|
+
* @summary Rename an uploaded OCEL
|
|
542
|
+
*/
|
|
543
|
+
const getRenameOcelUrl = (params) => {
|
|
544
|
+
const normalizedParams = new URLSearchParams();
|
|
545
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
546
|
+
if (value !== void 0) normalizedParams.append(key, value === null ? "null" : value.toString());
|
|
547
|
+
});
|
|
548
|
+
const stringifiedParams = normalizedParams.toString();
|
|
549
|
+
return stringifiedParams.length > 0 ? `/api/external/ocels/ocel/rename?${stringifiedParams}` : `/api/external/ocels/ocel/rename`;
|
|
550
|
+
};
|
|
551
|
+
const renameOcel = async (params, options) => {
|
|
552
|
+
return customFetch(getRenameOcelUrl(params), {
|
|
553
|
+
...options,
|
|
554
|
+
method: "POST"
|
|
555
|
+
});
|
|
556
|
+
};
|
|
557
|
+
const getRenameOcelMutationOptions = (options) => {
|
|
558
|
+
const mutationKey = ["renameOcel"];
|
|
559
|
+
const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
|
|
560
|
+
...options,
|
|
561
|
+
mutation: {
|
|
562
|
+
...options.mutation,
|
|
563
|
+
mutationKey
|
|
564
|
+
}
|
|
565
|
+
} : {
|
|
566
|
+
mutation: { mutationKey },
|
|
567
|
+
request: void 0
|
|
568
|
+
};
|
|
569
|
+
const mutationFn = (props) => {
|
|
570
|
+
const { params } = props ?? {};
|
|
571
|
+
return renameOcel(params, requestOptions);
|
|
572
|
+
};
|
|
573
|
+
return {
|
|
574
|
+
mutationFn,
|
|
575
|
+
...mutationOptions
|
|
576
|
+
};
|
|
577
|
+
};
|
|
578
|
+
/**
|
|
579
|
+
* @summary Rename an uploaded OCEL
|
|
580
|
+
*/
|
|
581
|
+
const useRenameOcel = (options, queryClient) => {
|
|
582
|
+
return useMutation(getRenameOcelMutationOptions(options), queryClient);
|
|
583
|
+
};
|
|
584
|
+
/**
|
|
585
|
+
* @summary Get Object Attributes
|
|
586
|
+
*/
|
|
587
|
+
const getObjectAttributesUrl = (params) => {
|
|
588
|
+
const normalizedParams = new URLSearchParams();
|
|
589
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
590
|
+
if (value !== void 0) normalizedParams.append(key, value === null ? "null" : value.toString());
|
|
591
|
+
});
|
|
592
|
+
const stringifiedParams = normalizedParams.toString();
|
|
593
|
+
return stringifiedParams.length > 0 ? `/api/external/ocels/objects/attributes?${stringifiedParams}` : `/api/external/ocels/objects/attributes`;
|
|
594
|
+
};
|
|
595
|
+
const objectAttributes = async (params, options) => {
|
|
596
|
+
return customFetch(getObjectAttributesUrl(params), {
|
|
597
|
+
...options,
|
|
598
|
+
method: "GET"
|
|
599
|
+
});
|
|
600
|
+
};
|
|
601
|
+
const getObjectAttributesQueryKey = (params) => {
|
|
602
|
+
return [`/api/external/ocels/objects/attributes`, ...params ? [params] : []];
|
|
603
|
+
};
|
|
604
|
+
const getObjectAttributesQueryOptions = (params, options) => {
|
|
605
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
606
|
+
const queryKey = queryOptions?.queryKey ?? getObjectAttributesQueryKey(params);
|
|
607
|
+
const queryFn = ({ signal }) => objectAttributes(params, {
|
|
608
|
+
signal,
|
|
609
|
+
...requestOptions
|
|
610
|
+
});
|
|
611
|
+
return {
|
|
612
|
+
queryKey,
|
|
613
|
+
queryFn,
|
|
614
|
+
staleTime: 3e5,
|
|
615
|
+
...queryOptions
|
|
616
|
+
};
|
|
617
|
+
};
|
|
618
|
+
/**
|
|
619
|
+
* @summary Get Object Attributes
|
|
620
|
+
*/
|
|
621
|
+
function useObjectAttributes(params, options, queryClient) {
|
|
622
|
+
const queryOptions = getObjectAttributesQueryOptions(params, options);
|
|
623
|
+
return {
|
|
624
|
+
...useQuery(queryOptions, queryClient),
|
|
625
|
+
queryKey: queryOptions.queryKey
|
|
626
|
+
};
|
|
627
|
+
}
|
|
628
|
+
/**
|
|
629
|
+
* @summary Get Event Attributes
|
|
630
|
+
*/
|
|
631
|
+
const getEventAttributesUrl = (params) => {
|
|
632
|
+
const normalizedParams = new URLSearchParams();
|
|
633
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
634
|
+
if (value !== void 0) normalizedParams.append(key, value === null ? "null" : value.toString());
|
|
635
|
+
});
|
|
636
|
+
const stringifiedParams = normalizedParams.toString();
|
|
637
|
+
return stringifiedParams.length > 0 ? `/api/external/ocels/events/attributes?${stringifiedParams}` : `/api/external/ocels/events/attributes`;
|
|
638
|
+
};
|
|
639
|
+
const eventAttributes = async (params, options) => {
|
|
640
|
+
return customFetch(getEventAttributesUrl(params), {
|
|
641
|
+
...options,
|
|
642
|
+
method: "GET"
|
|
643
|
+
});
|
|
644
|
+
};
|
|
645
|
+
const getEventAttributesQueryKey = (params) => {
|
|
646
|
+
return [`/api/external/ocels/events/attributes`, ...params ? [params] : []];
|
|
647
|
+
};
|
|
648
|
+
const getEventAttributesQueryOptions = (params, options) => {
|
|
649
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
650
|
+
const queryKey = queryOptions?.queryKey ?? getEventAttributesQueryKey(params);
|
|
651
|
+
const queryFn = ({ signal }) => eventAttributes(params, {
|
|
652
|
+
signal,
|
|
653
|
+
...requestOptions
|
|
654
|
+
});
|
|
655
|
+
return {
|
|
656
|
+
queryKey,
|
|
657
|
+
queryFn,
|
|
658
|
+
staleTime: 3e5,
|
|
659
|
+
...queryOptions
|
|
660
|
+
};
|
|
661
|
+
};
|
|
662
|
+
/**
|
|
663
|
+
* @summary Get Event Attributes
|
|
664
|
+
*/
|
|
665
|
+
function useEventAttributes(params, options, queryClient) {
|
|
666
|
+
const queryOptions = getEventAttributesQueryOptions(params, options);
|
|
667
|
+
return {
|
|
668
|
+
...useQuery(queryOptions, queryClient),
|
|
669
|
+
queryKey: queryOptions.queryKey
|
|
670
|
+
};
|
|
671
|
+
}
|
|
672
|
+
/**
|
|
673
|
+
* @summary Get Event Counts
|
|
674
|
+
*/
|
|
675
|
+
const getEventCountsUrl = (params) => {
|
|
676
|
+
const normalizedParams = new URLSearchParams();
|
|
677
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
678
|
+
if (value !== void 0) normalizedParams.append(key, value === null ? "null" : value.toString());
|
|
679
|
+
});
|
|
680
|
+
const stringifiedParams = normalizedParams.toString();
|
|
681
|
+
return stringifiedParams.length > 0 ? `/api/external/ocels/events/counts?${stringifiedParams}` : `/api/external/ocels/events/counts`;
|
|
682
|
+
};
|
|
683
|
+
const eventCounts = async (params, options) => {
|
|
684
|
+
return customFetch(getEventCountsUrl(params), {
|
|
685
|
+
...options,
|
|
686
|
+
method: "GET"
|
|
687
|
+
});
|
|
688
|
+
};
|
|
689
|
+
const getEventCountsQueryKey = (params) => {
|
|
690
|
+
return [`/api/external/ocels/events/counts`, ...params ? [params] : []];
|
|
691
|
+
};
|
|
692
|
+
const getEventCountsQueryOptions = (params, options) => {
|
|
693
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
694
|
+
const queryKey = queryOptions?.queryKey ?? getEventCountsQueryKey(params);
|
|
695
|
+
const queryFn = ({ signal }) => eventCounts(params, {
|
|
696
|
+
signal,
|
|
697
|
+
...requestOptions
|
|
698
|
+
});
|
|
699
|
+
return {
|
|
700
|
+
queryKey,
|
|
701
|
+
queryFn,
|
|
702
|
+
staleTime: 3e5,
|
|
703
|
+
...queryOptions
|
|
704
|
+
};
|
|
705
|
+
};
|
|
706
|
+
/**
|
|
707
|
+
* @summary Get Event Counts
|
|
708
|
+
*/
|
|
709
|
+
function useEventCounts(params, options, queryClient) {
|
|
710
|
+
const queryOptions = getEventCountsQueryOptions(params, options);
|
|
711
|
+
return {
|
|
712
|
+
...useQuery(queryOptions, queryClient),
|
|
713
|
+
queryKey: queryOptions.queryKey
|
|
714
|
+
};
|
|
715
|
+
}
|
|
716
|
+
/**
|
|
717
|
+
* @summary Get Time Info
|
|
718
|
+
*/
|
|
719
|
+
const getTimeInfoUrl = (params) => {
|
|
720
|
+
const normalizedParams = new URLSearchParams();
|
|
721
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
722
|
+
if (value !== void 0) normalizedParams.append(key, value === null ? "null" : value.toString());
|
|
723
|
+
});
|
|
724
|
+
const stringifiedParams = normalizedParams.toString();
|
|
725
|
+
return stringifiedParams.length > 0 ? `/api/external/ocels/events/time?${stringifiedParams}` : `/api/external/ocels/events/time`;
|
|
726
|
+
};
|
|
727
|
+
const timeInfo = async (params, options) => {
|
|
728
|
+
return customFetch(getTimeInfoUrl(params), {
|
|
729
|
+
...options,
|
|
730
|
+
method: "GET"
|
|
731
|
+
});
|
|
732
|
+
};
|
|
733
|
+
const getTimeInfoQueryKey = (params) => {
|
|
734
|
+
return [`/api/external/ocels/events/time`, ...params ? [params] : []];
|
|
735
|
+
};
|
|
736
|
+
const getTimeInfoQueryOptions = (params, options) => {
|
|
737
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
738
|
+
const queryKey = queryOptions?.queryKey ?? getTimeInfoQueryKey(params);
|
|
739
|
+
const queryFn = ({ signal }) => timeInfo(params, {
|
|
740
|
+
signal,
|
|
741
|
+
...requestOptions
|
|
742
|
+
});
|
|
743
|
+
return {
|
|
744
|
+
queryKey,
|
|
745
|
+
queryFn,
|
|
746
|
+
staleTime: 3e5,
|
|
747
|
+
...queryOptions
|
|
748
|
+
};
|
|
749
|
+
};
|
|
750
|
+
/**
|
|
751
|
+
* @summary Get Time Info
|
|
752
|
+
*/
|
|
753
|
+
function useTimeInfo(params, options, queryClient) {
|
|
754
|
+
const queryOptions = getTimeInfoQueryOptions(params, options);
|
|
755
|
+
return {
|
|
756
|
+
...useQuery(queryOptions, queryClient),
|
|
757
|
+
queryKey: queryOptions.queryKey
|
|
758
|
+
};
|
|
759
|
+
}
|
|
760
|
+
/**
|
|
761
|
+
* @summary Get Object Counts
|
|
762
|
+
*/
|
|
763
|
+
const getObjectCountsUrl = (params) => {
|
|
764
|
+
const normalizedParams = new URLSearchParams();
|
|
765
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
766
|
+
if (value !== void 0) normalizedParams.append(key, value === null ? "null" : value.toString());
|
|
767
|
+
});
|
|
768
|
+
const stringifiedParams = normalizedParams.toString();
|
|
769
|
+
return stringifiedParams.length > 0 ? `/api/external/ocels/objects/counts?${stringifiedParams}` : `/api/external/ocels/objects/counts`;
|
|
770
|
+
};
|
|
771
|
+
const objectCounts = async (params, options) => {
|
|
772
|
+
return customFetch(getObjectCountsUrl(params), {
|
|
773
|
+
...options,
|
|
774
|
+
method: "GET"
|
|
775
|
+
});
|
|
776
|
+
};
|
|
777
|
+
const getObjectCountsQueryKey = (params) => {
|
|
778
|
+
return [`/api/external/ocels/objects/counts`, ...params ? [params] : []];
|
|
779
|
+
};
|
|
780
|
+
const getObjectCountsQueryOptions = (params, options) => {
|
|
781
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
782
|
+
const queryKey = queryOptions?.queryKey ?? getObjectCountsQueryKey(params);
|
|
783
|
+
const queryFn = ({ signal }) => objectCounts(params, {
|
|
784
|
+
signal,
|
|
785
|
+
...requestOptions
|
|
786
|
+
});
|
|
787
|
+
return {
|
|
788
|
+
queryKey,
|
|
789
|
+
queryFn,
|
|
790
|
+
staleTime: 3e5,
|
|
791
|
+
...queryOptions
|
|
792
|
+
};
|
|
793
|
+
};
|
|
794
|
+
/**
|
|
795
|
+
* @summary Get Object Counts
|
|
796
|
+
*/
|
|
797
|
+
function useObjectCounts(params, options, queryClient) {
|
|
798
|
+
const queryOptions = getObjectCountsQueryOptions(params, options);
|
|
799
|
+
return {
|
|
800
|
+
...useQuery(queryOptions, queryClient),
|
|
801
|
+
queryKey: queryOptions.queryKey
|
|
802
|
+
};
|
|
803
|
+
}
|
|
804
|
+
/**
|
|
805
|
+
* @summary Get E2O
|
|
806
|
+
*/
|
|
807
|
+
const getE2oUrl = (params) => {
|
|
808
|
+
const normalizedParams = new URLSearchParams();
|
|
809
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
810
|
+
if (value !== void 0) normalizedParams.append(key, value === null ? "null" : value.toString());
|
|
811
|
+
});
|
|
812
|
+
const stringifiedParams = normalizedParams.toString();
|
|
813
|
+
return stringifiedParams.length > 0 ? `/api/external/ocels/relations/e2o?${stringifiedParams}` : `/api/external/ocels/relations/e2o`;
|
|
814
|
+
};
|
|
815
|
+
const e2o = async (params, options) => {
|
|
816
|
+
return customFetch(getE2oUrl(params), {
|
|
817
|
+
...options,
|
|
818
|
+
method: "GET"
|
|
819
|
+
});
|
|
820
|
+
};
|
|
821
|
+
const getE2oQueryKey = (params) => {
|
|
822
|
+
return [`/api/external/ocels/relations/e2o`, ...params ? [params] : []];
|
|
823
|
+
};
|
|
824
|
+
const getE2oQueryOptions = (params, options) => {
|
|
825
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
826
|
+
const queryKey = queryOptions?.queryKey ?? getE2oQueryKey(params);
|
|
827
|
+
const queryFn = ({ signal }) => e2o(params, {
|
|
828
|
+
signal,
|
|
829
|
+
...requestOptions
|
|
830
|
+
});
|
|
831
|
+
return {
|
|
832
|
+
queryKey,
|
|
833
|
+
queryFn,
|
|
834
|
+
staleTime: 3e5,
|
|
835
|
+
...queryOptions
|
|
836
|
+
};
|
|
837
|
+
};
|
|
838
|
+
/**
|
|
839
|
+
* @summary Get E2O
|
|
840
|
+
*/
|
|
841
|
+
function useE2o(params, options, queryClient) {
|
|
842
|
+
const queryOptions = getE2oQueryOptions(params, options);
|
|
843
|
+
return {
|
|
844
|
+
...useQuery(queryOptions, queryClient),
|
|
845
|
+
queryKey: queryOptions.queryKey
|
|
846
|
+
};
|
|
847
|
+
}
|
|
848
|
+
/**
|
|
849
|
+
* @summary Get Object Relations
|
|
850
|
+
*/
|
|
851
|
+
const getO2oUrl = (params) => {
|
|
852
|
+
const normalizedParams = new URLSearchParams();
|
|
853
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
854
|
+
if (value !== void 0) normalizedParams.append(key, value === null ? "null" : value.toString());
|
|
855
|
+
});
|
|
856
|
+
const stringifiedParams = normalizedParams.toString();
|
|
857
|
+
return stringifiedParams.length > 0 ? `/api/external/ocels/relations/o2o?${stringifiedParams}` : `/api/external/ocels/relations/o2o`;
|
|
858
|
+
};
|
|
859
|
+
const o2o = async (params, options) => {
|
|
860
|
+
return customFetch(getO2oUrl(params), {
|
|
861
|
+
...options,
|
|
862
|
+
method: "GET"
|
|
863
|
+
});
|
|
864
|
+
};
|
|
865
|
+
const getO2oQueryKey = (params) => {
|
|
866
|
+
return [`/api/external/ocels/relations/o2o`, ...params ? [params] : []];
|
|
867
|
+
};
|
|
868
|
+
const getO2oQueryOptions = (params, options) => {
|
|
869
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
870
|
+
const queryKey = queryOptions?.queryKey ?? getO2oQueryKey(params);
|
|
871
|
+
const queryFn = ({ signal }) => o2o(params, {
|
|
872
|
+
signal,
|
|
873
|
+
...requestOptions
|
|
874
|
+
});
|
|
875
|
+
return {
|
|
876
|
+
queryKey,
|
|
877
|
+
queryFn,
|
|
878
|
+
staleTime: 3e5,
|
|
879
|
+
...queryOptions
|
|
880
|
+
};
|
|
881
|
+
};
|
|
882
|
+
/**
|
|
883
|
+
* @summary Get Object Relations
|
|
884
|
+
*/
|
|
885
|
+
function useO2o(params, options, queryClient) {
|
|
886
|
+
const queryOptions = getO2oQueryOptions(params, options);
|
|
887
|
+
return {
|
|
888
|
+
...useQuery(queryOptions, queryClient),
|
|
889
|
+
queryKey: queryOptions.queryKey
|
|
890
|
+
};
|
|
891
|
+
}
|
|
892
|
+
/**
|
|
893
|
+
* @summary Get Event Ids
|
|
894
|
+
*/
|
|
895
|
+
const getEventIdsUrl = (params) => {
|
|
896
|
+
const normalizedParams = new URLSearchParams();
|
|
897
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
898
|
+
if (value !== void 0) normalizedParams.append(key, value === null ? "null" : value.toString());
|
|
899
|
+
});
|
|
900
|
+
const stringifiedParams = normalizedParams.toString();
|
|
901
|
+
return stringifiedParams.length > 0 ? `/api/external/ocels/events/ids?${stringifiedParams}` : `/api/external/ocels/events/ids`;
|
|
902
|
+
};
|
|
903
|
+
const eventIds = async (params, options) => {
|
|
904
|
+
return customFetch(getEventIdsUrl(params), {
|
|
905
|
+
...options,
|
|
906
|
+
method: "GET"
|
|
907
|
+
});
|
|
908
|
+
};
|
|
909
|
+
const getEventIdsQueryKey = (params) => {
|
|
910
|
+
return [`/api/external/ocels/events/ids`, ...params ? [params] : []];
|
|
911
|
+
};
|
|
912
|
+
const getEventIdsQueryOptions = (params, options) => {
|
|
913
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
914
|
+
const queryKey = queryOptions?.queryKey ?? getEventIdsQueryKey(params);
|
|
915
|
+
const queryFn = ({ signal }) => eventIds(params, {
|
|
916
|
+
signal,
|
|
917
|
+
...requestOptions
|
|
918
|
+
});
|
|
919
|
+
return {
|
|
920
|
+
queryKey,
|
|
921
|
+
queryFn,
|
|
922
|
+
staleTime: 3e5,
|
|
923
|
+
...queryOptions
|
|
924
|
+
};
|
|
925
|
+
};
|
|
926
|
+
/**
|
|
927
|
+
* @summary Get Event Ids
|
|
928
|
+
*/
|
|
929
|
+
function useEventIds(params, options, queryClient) {
|
|
930
|
+
const queryOptions = getEventIdsQueryOptions(params, options);
|
|
931
|
+
return {
|
|
932
|
+
...useQuery(queryOptions, queryClient),
|
|
933
|
+
queryKey: queryOptions.queryKey
|
|
934
|
+
};
|
|
935
|
+
}
|
|
936
|
+
/**
|
|
937
|
+
* @summary Get Object Ids
|
|
938
|
+
*/
|
|
939
|
+
const getObjectIdsUrl = (params) => {
|
|
940
|
+
const normalizedParams = new URLSearchParams();
|
|
941
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
942
|
+
if (value !== void 0) normalizedParams.append(key, value === null ? "null" : value.toString());
|
|
943
|
+
});
|
|
944
|
+
const stringifiedParams = normalizedParams.toString();
|
|
945
|
+
return stringifiedParams.length > 0 ? `/api/external/ocels/objects/ids?${stringifiedParams}` : `/api/external/ocels/objects/ids`;
|
|
946
|
+
};
|
|
947
|
+
const objectIds = async (params, options) => {
|
|
948
|
+
return customFetch(getObjectIdsUrl(params), {
|
|
949
|
+
...options,
|
|
950
|
+
method: "GET"
|
|
951
|
+
});
|
|
952
|
+
};
|
|
953
|
+
const getObjectIdsQueryKey = (params) => {
|
|
954
|
+
return [`/api/external/ocels/objects/ids`, ...params ? [params] : []];
|
|
955
|
+
};
|
|
956
|
+
const getObjectIdsQueryOptions = (params, options) => {
|
|
957
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
958
|
+
const queryKey = queryOptions?.queryKey ?? getObjectIdsQueryKey(params);
|
|
959
|
+
const queryFn = ({ signal }) => objectIds(params, {
|
|
960
|
+
signal,
|
|
961
|
+
...requestOptions
|
|
962
|
+
});
|
|
963
|
+
return {
|
|
964
|
+
queryKey,
|
|
965
|
+
queryFn,
|
|
966
|
+
staleTime: 3e5,
|
|
967
|
+
...queryOptions
|
|
968
|
+
};
|
|
969
|
+
};
|
|
970
|
+
/**
|
|
971
|
+
* @summary Get Object Ids
|
|
972
|
+
*/
|
|
973
|
+
function useObjectIds(params, options, queryClient) {
|
|
974
|
+
const queryOptions = getObjectIdsQueryOptions(params, options);
|
|
975
|
+
return {
|
|
976
|
+
...useQuery(queryOptions, queryClient),
|
|
977
|
+
queryKey: queryOptions.queryKey
|
|
978
|
+
};
|
|
979
|
+
}
|
|
980
|
+
/**
|
|
981
|
+
* @summary Get Filter
|
|
982
|
+
*/
|
|
983
|
+
const getGetFiltersUrl = (params) => {
|
|
984
|
+
const normalizedParams = new URLSearchParams();
|
|
985
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
986
|
+
if (value !== void 0) normalizedParams.append(key, value === null ? "null" : value.toString());
|
|
987
|
+
});
|
|
988
|
+
const stringifiedParams = normalizedParams.toString();
|
|
989
|
+
return stringifiedParams.length > 0 ? `/api/external/ocels/filter?${stringifiedParams}` : `/api/external/ocels/filter`;
|
|
990
|
+
};
|
|
991
|
+
const getFilters = async (params, options) => {
|
|
992
|
+
return customFetch(getGetFiltersUrl(params), {
|
|
993
|
+
...options,
|
|
994
|
+
method: "GET"
|
|
995
|
+
});
|
|
996
|
+
};
|
|
997
|
+
const getGetFiltersQueryKey = (params) => {
|
|
998
|
+
return [`/api/external/ocels/filter`, ...params ? [params] : []];
|
|
999
|
+
};
|
|
1000
|
+
const getGetFiltersQueryOptions = (params, options) => {
|
|
1001
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
1002
|
+
const queryKey = queryOptions?.queryKey ?? getGetFiltersQueryKey(params);
|
|
1003
|
+
const queryFn = ({ signal }) => getFilters(params, {
|
|
1004
|
+
signal,
|
|
1005
|
+
...requestOptions
|
|
1006
|
+
});
|
|
1007
|
+
return {
|
|
1008
|
+
queryKey,
|
|
1009
|
+
queryFn,
|
|
1010
|
+
staleTime: 3e5,
|
|
1011
|
+
...queryOptions
|
|
1012
|
+
};
|
|
1013
|
+
};
|
|
1014
|
+
/**
|
|
1015
|
+
* @summary Get Filter
|
|
1016
|
+
*/
|
|
1017
|
+
function useGetFilters(params, options, queryClient) {
|
|
1018
|
+
const queryOptions = getGetFiltersQueryOptions(params, options);
|
|
1019
|
+
return {
|
|
1020
|
+
...useQuery(queryOptions, queryClient),
|
|
1021
|
+
queryKey: queryOptions.queryKey
|
|
1022
|
+
};
|
|
1023
|
+
}
|
|
1024
|
+
/**
|
|
1025
|
+
* @summary Get Extension Meta
|
|
1026
|
+
*/
|
|
1027
|
+
const getGetExtensionMetaUrl = () => {
|
|
1028
|
+
return `/api/external/ocels/extension/meta`;
|
|
1029
|
+
};
|
|
1030
|
+
const getExtensionMeta = async (options) => {
|
|
1031
|
+
return customFetch(getGetExtensionMetaUrl(), {
|
|
1032
|
+
...options,
|
|
1033
|
+
method: "GET"
|
|
1034
|
+
});
|
|
1035
|
+
};
|
|
1036
|
+
const getGetExtensionMetaQueryKey = () => {
|
|
1037
|
+
return [`/api/external/ocels/extension/meta`];
|
|
1038
|
+
};
|
|
1039
|
+
const getGetExtensionMetaQueryOptions = (options) => {
|
|
1040
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
1041
|
+
const queryKey = queryOptions?.queryKey ?? getGetExtensionMetaQueryKey();
|
|
1042
|
+
const queryFn = ({ signal }) => getExtensionMeta({
|
|
1043
|
+
signal,
|
|
1044
|
+
...requestOptions
|
|
1045
|
+
});
|
|
1046
|
+
return {
|
|
1047
|
+
queryKey,
|
|
1048
|
+
queryFn,
|
|
1049
|
+
staleTime: 3e5,
|
|
1050
|
+
...queryOptions
|
|
1051
|
+
};
|
|
1052
|
+
};
|
|
1053
|
+
/**
|
|
1054
|
+
* @summary Get Extension Meta
|
|
1055
|
+
*/
|
|
1056
|
+
function useGetExtensionMeta(options, queryClient) {
|
|
1057
|
+
const queryOptions = getGetExtensionMetaQueryOptions(options);
|
|
1058
|
+
return {
|
|
1059
|
+
...useQuery(queryOptions, queryClient),
|
|
1060
|
+
queryKey: queryOptions.queryKey
|
|
1061
|
+
};
|
|
1062
|
+
}
|
|
1063
|
+
/**
|
|
1064
|
+
* @summary Get default OCEL metadata
|
|
1065
|
+
*/
|
|
1066
|
+
const getGetDefaultOcelUrl = (params) => {
|
|
1067
|
+
const normalizedParams = new URLSearchParams();
|
|
1068
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
1069
|
+
if (value !== void 0) normalizedParams.append(key, value === null ? "null" : value.toString());
|
|
1070
|
+
});
|
|
1071
|
+
const stringifiedParams = normalizedParams.toString();
|
|
1072
|
+
return stringifiedParams.length > 0 ? `/api/external/ocels/ocel/default?${stringifiedParams}` : `/api/external/ocels/ocel/default`;
|
|
1073
|
+
};
|
|
1074
|
+
const getDefaultOcel = async (params, options) => {
|
|
1075
|
+
return customFetch(getGetDefaultOcelUrl(params), {
|
|
1076
|
+
...options,
|
|
1077
|
+
method: "GET"
|
|
1078
|
+
});
|
|
1079
|
+
};
|
|
1080
|
+
const getGetDefaultOcelQueryKey = (params) => {
|
|
1081
|
+
return [`/api/external/ocels/ocel/default`, ...params ? [params] : []];
|
|
1082
|
+
};
|
|
1083
|
+
const getGetDefaultOcelQueryOptions = (params, options) => {
|
|
1084
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
1085
|
+
const queryKey = queryOptions?.queryKey ?? getGetDefaultOcelQueryKey(params);
|
|
1086
|
+
const queryFn = ({ signal }) => getDefaultOcel(params, {
|
|
1087
|
+
signal,
|
|
1088
|
+
...requestOptions
|
|
1089
|
+
});
|
|
1090
|
+
return {
|
|
1091
|
+
queryKey,
|
|
1092
|
+
queryFn,
|
|
1093
|
+
staleTime: 3e5,
|
|
1094
|
+
...queryOptions
|
|
1095
|
+
};
|
|
1096
|
+
};
|
|
1097
|
+
/**
|
|
1098
|
+
* @summary Get default OCEL metadata
|
|
1099
|
+
*/
|
|
1100
|
+
function useGetDefaultOcel(params, options, queryClient) {
|
|
1101
|
+
const queryOptions = getGetDefaultOcelQueryOptions(params, options);
|
|
1102
|
+
return {
|
|
1103
|
+
...useQuery(queryOptions, queryClient),
|
|
1104
|
+
queryKey: queryOptions.queryKey
|
|
1105
|
+
};
|
|
1106
|
+
}
|
|
1107
|
+
/**
|
|
1108
|
+
* @summary Import default OCEL
|
|
1109
|
+
*/
|
|
1110
|
+
const getImportDefaultOcelUrl = (params) => {
|
|
1111
|
+
const normalizedParams = new URLSearchParams();
|
|
1112
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
1113
|
+
if (value !== void 0) normalizedParams.append(key, value === null ? "null" : value.toString());
|
|
1114
|
+
});
|
|
1115
|
+
const stringifiedParams = normalizedParams.toString();
|
|
1116
|
+
return stringifiedParams.length > 0 ? `/api/external/ocels/import-default?${stringifiedParams}` : `/api/external/ocels/import-default`;
|
|
1117
|
+
};
|
|
1118
|
+
const importDefaultOcel = async (params, options) => {
|
|
1119
|
+
return customFetch(getImportDefaultOcelUrl(params), {
|
|
1120
|
+
...options,
|
|
1121
|
+
method: "POST"
|
|
1122
|
+
});
|
|
1123
|
+
};
|
|
1124
|
+
const getImportDefaultOcelMutationOptions = (options) => {
|
|
1125
|
+
const mutationKey = ["importDefaultOcel"];
|
|
1126
|
+
const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
|
|
1127
|
+
...options,
|
|
1128
|
+
mutation: {
|
|
1129
|
+
...options.mutation,
|
|
1130
|
+
mutationKey
|
|
1131
|
+
}
|
|
1132
|
+
} : {
|
|
1133
|
+
mutation: { mutationKey },
|
|
1134
|
+
request: void 0
|
|
1135
|
+
};
|
|
1136
|
+
const mutationFn = (props) => {
|
|
1137
|
+
const { params } = props ?? {};
|
|
1138
|
+
return importDefaultOcel(params, requestOptions);
|
|
1139
|
+
};
|
|
1140
|
+
return {
|
|
1141
|
+
mutationFn,
|
|
1142
|
+
...mutationOptions
|
|
1143
|
+
};
|
|
1144
|
+
};
|
|
1145
|
+
/**
|
|
1146
|
+
* @summary Import default OCEL
|
|
1147
|
+
*/
|
|
1148
|
+
const useImportDefaultOcel = (options, queryClient) => {
|
|
1149
|
+
return useMutation(getImportDefaultOcelMutationOptions(options), queryClient);
|
|
1150
|
+
};
|
|
1151
|
+
/**
|
|
1152
|
+
* @summary Download OCEL including app state
|
|
1153
|
+
*/
|
|
1154
|
+
const getDownloadOcelOcelsDownloadGetUrl = (params) => {
|
|
1155
|
+
const normalizedParams = new URLSearchParams();
|
|
1156
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
1157
|
+
if (value !== void 0) normalizedParams.append(key, value === null ? "null" : value.toString());
|
|
1158
|
+
});
|
|
1159
|
+
const stringifiedParams = normalizedParams.toString();
|
|
1160
|
+
return stringifiedParams.length > 0 ? `/api/external/ocels/download?${stringifiedParams}` : `/api/external/ocels/download`;
|
|
1161
|
+
};
|
|
1162
|
+
const downloadOcelOcelsDownloadGet = async (params, options) => {
|
|
1163
|
+
return customFetch(getDownloadOcelOcelsDownloadGetUrl(params), {
|
|
1164
|
+
...options,
|
|
1165
|
+
method: "GET"
|
|
1166
|
+
});
|
|
1167
|
+
};
|
|
1168
|
+
const getDownloadOcelOcelsDownloadGetQueryKey = (params) => {
|
|
1169
|
+
return [`/api/external/ocels/download`, ...params ? [params] : []];
|
|
1170
|
+
};
|
|
1171
|
+
const getDownloadOcelOcelsDownloadGetQueryOptions = (params, options) => {
|
|
1172
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
1173
|
+
const queryKey = queryOptions?.queryKey ?? getDownloadOcelOcelsDownloadGetQueryKey(params);
|
|
1174
|
+
const queryFn = ({ signal }) => downloadOcelOcelsDownloadGet(params, {
|
|
1175
|
+
signal,
|
|
1176
|
+
...requestOptions
|
|
1177
|
+
});
|
|
1178
|
+
return {
|
|
1179
|
+
queryKey,
|
|
1180
|
+
queryFn,
|
|
1181
|
+
staleTime: 3e5,
|
|
1182
|
+
...queryOptions
|
|
1183
|
+
};
|
|
1184
|
+
};
|
|
1185
|
+
/**
|
|
1186
|
+
* @summary Download OCEL including app state
|
|
1187
|
+
*/
|
|
1188
|
+
function useDownloadOcelOcelsDownloadGet(params, options, queryClient) {
|
|
1189
|
+
const queryOptions = getDownloadOcelOcelsDownloadGetQueryOptions(params, options);
|
|
1190
|
+
return {
|
|
1191
|
+
...useQuery(queryOptions, queryClient),
|
|
1192
|
+
queryKey: queryOptions.queryKey
|
|
1193
|
+
};
|
|
1194
|
+
}
|
|
1195
|
+
/**
|
|
1196
|
+
* @summary returns all tasks of a session
|
|
1197
|
+
*/
|
|
1198
|
+
const getGetSystemTasksUrl = (params) => {
|
|
1199
|
+
const normalizedParams = new URLSearchParams();
|
|
1200
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
1201
|
+
if (value !== void 0) normalizedParams.append(key, value === null ? "null" : value.toString());
|
|
1202
|
+
});
|
|
1203
|
+
const stringifiedParams = normalizedParams.toString();
|
|
1204
|
+
return stringifiedParams.length > 0 ? `/api/external/tasks/system?${stringifiedParams}` : `/api/external/tasks/system`;
|
|
1205
|
+
};
|
|
1206
|
+
const getSystemTasks = async (params, options) => {
|
|
1207
|
+
return customFetch(getGetSystemTasksUrl(params), {
|
|
1208
|
+
...options,
|
|
1209
|
+
method: "GET"
|
|
1210
|
+
});
|
|
1211
|
+
};
|
|
1212
|
+
const getGetSystemTasksQueryKey = (params) => {
|
|
1213
|
+
return [`/api/external/tasks/system`, ...params ? [params] : []];
|
|
1214
|
+
};
|
|
1215
|
+
const getGetSystemTasksQueryOptions = (params, options) => {
|
|
1216
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
1217
|
+
const queryKey = queryOptions?.queryKey ?? getGetSystemTasksQueryKey(params);
|
|
1218
|
+
const queryFn = ({ signal }) => getSystemTasks(params, {
|
|
1219
|
+
signal,
|
|
1220
|
+
...requestOptions
|
|
1221
|
+
});
|
|
1222
|
+
return {
|
|
1223
|
+
queryKey,
|
|
1224
|
+
queryFn,
|
|
1225
|
+
staleTime: 3e5,
|
|
1226
|
+
...queryOptions
|
|
1227
|
+
};
|
|
1228
|
+
};
|
|
1229
|
+
/**
|
|
1230
|
+
* @summary returns all tasks of a session
|
|
1231
|
+
*/
|
|
1232
|
+
function useGetSystemTasks(params, options, queryClient) {
|
|
1233
|
+
const queryOptions = getGetSystemTasksQueryOptions(params, options);
|
|
1234
|
+
return {
|
|
1235
|
+
...useQuery(queryOptions, queryClient),
|
|
1236
|
+
queryKey: queryOptions.queryKey
|
|
1237
|
+
};
|
|
1238
|
+
}
|
|
1239
|
+
/**
|
|
1240
|
+
* @summary returns the task of a given taskId
|
|
1241
|
+
*/
|
|
1242
|
+
const getGetSystemTaskUrl = (taskId) => {
|
|
1243
|
+
return `/api/external/tasks/system/${taskId}`;
|
|
1244
|
+
};
|
|
1245
|
+
const getSystemTask = async (taskId, options) => {
|
|
1246
|
+
return customFetch(getGetSystemTaskUrl(taskId), {
|
|
1247
|
+
...options,
|
|
1248
|
+
method: "GET"
|
|
1249
|
+
});
|
|
1250
|
+
};
|
|
1251
|
+
const getGetSystemTaskQueryKey = (taskId) => {
|
|
1252
|
+
return [`/api/external/tasks/system/${taskId}`];
|
|
1253
|
+
};
|
|
1254
|
+
const getGetSystemTaskQueryOptions = (taskId, options) => {
|
|
1255
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
1256
|
+
const queryKey = queryOptions?.queryKey ?? getGetSystemTaskQueryKey(taskId);
|
|
1257
|
+
const queryFn = ({ signal }) => getSystemTask(taskId, {
|
|
1258
|
+
signal,
|
|
1259
|
+
...requestOptions
|
|
1260
|
+
});
|
|
1261
|
+
return {
|
|
1262
|
+
queryKey,
|
|
1263
|
+
queryFn,
|
|
1264
|
+
enabled: !!taskId,
|
|
1265
|
+
staleTime: 3e5,
|
|
1266
|
+
...queryOptions
|
|
1267
|
+
};
|
|
1268
|
+
};
|
|
1269
|
+
/**
|
|
1270
|
+
* @summary returns the task of a given taskId
|
|
1271
|
+
*/
|
|
1272
|
+
function useGetSystemTask(taskId, options, queryClient) {
|
|
1273
|
+
const queryOptions = getGetSystemTaskQueryOptions(taskId, options);
|
|
1274
|
+
return {
|
|
1275
|
+
...useQuery(queryOptions, queryClient),
|
|
1276
|
+
queryKey: queryOptions.queryKey
|
|
1277
|
+
};
|
|
1278
|
+
}
|
|
1279
|
+
/**
|
|
1280
|
+
* @summary returns all tasks of a session
|
|
1281
|
+
*/
|
|
1282
|
+
const getGetPluginTasksUrl = (params) => {
|
|
1283
|
+
const normalizedParams = new URLSearchParams();
|
|
1284
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
1285
|
+
if (value !== void 0) normalizedParams.append(key, value === null ? "null" : value.toString());
|
|
1286
|
+
});
|
|
1287
|
+
const stringifiedParams = normalizedParams.toString();
|
|
1288
|
+
return stringifiedParams.length > 0 ? `/api/external/tasks/plugin?${stringifiedParams}` : `/api/external/tasks/plugin`;
|
|
1289
|
+
};
|
|
1290
|
+
const getPluginTasks = async (params, options) => {
|
|
1291
|
+
return customFetch(getGetPluginTasksUrl(params), {
|
|
1292
|
+
...options,
|
|
1293
|
+
method: "GET"
|
|
1294
|
+
});
|
|
1295
|
+
};
|
|
1296
|
+
const getGetPluginTasksQueryKey = (params) => {
|
|
1297
|
+
return [`/api/external/tasks/plugin`, ...params ? [params] : []];
|
|
1298
|
+
};
|
|
1299
|
+
const getGetPluginTasksQueryOptions = (params, options) => {
|
|
1300
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
1301
|
+
const queryKey = queryOptions?.queryKey ?? getGetPluginTasksQueryKey(params);
|
|
1302
|
+
const queryFn = ({ signal }) => getPluginTasks(params, {
|
|
1303
|
+
signal,
|
|
1304
|
+
...requestOptions
|
|
1305
|
+
});
|
|
1306
|
+
return {
|
|
1307
|
+
queryKey,
|
|
1308
|
+
queryFn,
|
|
1309
|
+
staleTime: 3e5,
|
|
1310
|
+
...queryOptions
|
|
1311
|
+
};
|
|
1312
|
+
};
|
|
1313
|
+
/**
|
|
1314
|
+
* @summary returns all tasks of a session
|
|
1315
|
+
*/
|
|
1316
|
+
function useGetPluginTasks(params, options, queryClient) {
|
|
1317
|
+
const queryOptions = getGetPluginTasksQueryOptions(params, options);
|
|
1318
|
+
return {
|
|
1319
|
+
...useQuery(queryOptions, queryClient),
|
|
1320
|
+
queryKey: queryOptions.queryKey
|
|
1321
|
+
};
|
|
1322
|
+
}
|
|
1323
|
+
/**
|
|
1324
|
+
* @summary returns the task of a given taskId
|
|
1325
|
+
*/
|
|
1326
|
+
const getGetPluginTaskUrl = (taskId) => {
|
|
1327
|
+
return `/api/external/tasks/plugin/${taskId}`;
|
|
1328
|
+
};
|
|
1329
|
+
const getPluginTask = async (taskId, options) => {
|
|
1330
|
+
return customFetch(getGetPluginTaskUrl(taskId), {
|
|
1331
|
+
...options,
|
|
1332
|
+
method: "GET"
|
|
1333
|
+
});
|
|
1334
|
+
};
|
|
1335
|
+
const getGetPluginTaskQueryKey = (taskId) => {
|
|
1336
|
+
return [`/api/external/tasks/plugin/${taskId}`];
|
|
1337
|
+
};
|
|
1338
|
+
const getGetPluginTaskQueryOptions = (taskId, options) => {
|
|
1339
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
1340
|
+
const queryKey = queryOptions?.queryKey ?? getGetPluginTaskQueryKey(taskId);
|
|
1341
|
+
const queryFn = ({ signal }) => getPluginTask(taskId, {
|
|
1342
|
+
signal,
|
|
1343
|
+
...requestOptions
|
|
1344
|
+
});
|
|
1345
|
+
return {
|
|
1346
|
+
queryKey,
|
|
1347
|
+
queryFn,
|
|
1348
|
+
enabled: !!taskId,
|
|
1349
|
+
staleTime: 3e5,
|
|
1350
|
+
...queryOptions
|
|
1351
|
+
};
|
|
1352
|
+
};
|
|
1353
|
+
/**
|
|
1354
|
+
* @summary returns the task of a given taskId
|
|
1355
|
+
*/
|
|
1356
|
+
function useGetPluginTask(taskId, options, queryClient) {
|
|
1357
|
+
const queryOptions = getGetPluginTaskQueryOptions(taskId, options);
|
|
1358
|
+
return {
|
|
1359
|
+
...useQuery(queryOptions, queryClient),
|
|
1360
|
+
queryKey: queryOptions.queryKey
|
|
1361
|
+
};
|
|
1362
|
+
}
|
|
1363
|
+
/**
|
|
1364
|
+
* @summary Get Plugins
|
|
1365
|
+
*/
|
|
1366
|
+
const getPluginsUrl = () => {
|
|
1367
|
+
return `/api/external/plugins`;
|
|
1368
|
+
};
|
|
1369
|
+
const plugins = async (options) => {
|
|
1370
|
+
return customFetch(getPluginsUrl(), {
|
|
1371
|
+
...options,
|
|
1372
|
+
method: "GET"
|
|
1373
|
+
});
|
|
1374
|
+
};
|
|
1375
|
+
const getPluginsQueryKey = () => {
|
|
1376
|
+
return [`/api/external/plugins`];
|
|
1377
|
+
};
|
|
1378
|
+
const getPluginsQueryOptions = (options) => {
|
|
1379
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
1380
|
+
const queryKey = queryOptions?.queryKey ?? getPluginsQueryKey();
|
|
1381
|
+
const queryFn = ({ signal }) => plugins({
|
|
1382
|
+
signal,
|
|
1383
|
+
...requestOptions
|
|
1384
|
+
});
|
|
1385
|
+
return {
|
|
1386
|
+
queryKey,
|
|
1387
|
+
queryFn,
|
|
1388
|
+
staleTime: 3e5,
|
|
1389
|
+
...queryOptions
|
|
1390
|
+
};
|
|
1391
|
+
};
|
|
1392
|
+
/**
|
|
1393
|
+
* @summary Get Plugins
|
|
1394
|
+
*/
|
|
1395
|
+
function usePlugins(options, queryClient) {
|
|
1396
|
+
const queryOptions = getPluginsQueryOptions(options);
|
|
1397
|
+
return {
|
|
1398
|
+
...useQuery(queryOptions, queryClient),
|
|
1399
|
+
queryKey: queryOptions.queryKey
|
|
1400
|
+
};
|
|
1401
|
+
}
|
|
1402
|
+
/**
|
|
1403
|
+
* @summary Upload Plugin
|
|
1404
|
+
*/
|
|
1405
|
+
const getUploadPluginUrl = () => {
|
|
1406
|
+
return `/api/external/plugins`;
|
|
1407
|
+
};
|
|
1408
|
+
const uploadPlugin = async (bodyUploadPlugin, options) => {
|
|
1409
|
+
const formData = new FormData();
|
|
1410
|
+
formData.append(`file`, bodyUploadPlugin.file);
|
|
1411
|
+
return customFetch(getUploadPluginUrl(), {
|
|
1412
|
+
...options,
|
|
1413
|
+
method: "POST",
|
|
1414
|
+
body: formData
|
|
1415
|
+
});
|
|
1416
|
+
};
|
|
1417
|
+
const getUploadPluginMutationOptions = (options) => {
|
|
1418
|
+
const mutationKey = ["uploadPlugin"];
|
|
1419
|
+
const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
|
|
1420
|
+
...options,
|
|
1421
|
+
mutation: {
|
|
1422
|
+
...options.mutation,
|
|
1423
|
+
mutationKey
|
|
1424
|
+
}
|
|
1425
|
+
} : {
|
|
1426
|
+
mutation: { mutationKey },
|
|
1427
|
+
request: void 0
|
|
1428
|
+
};
|
|
1429
|
+
const mutationFn = (props) => {
|
|
1430
|
+
const { data } = props ?? {};
|
|
1431
|
+
return uploadPlugin(data, requestOptions);
|
|
1432
|
+
};
|
|
1433
|
+
return {
|
|
1434
|
+
mutationFn,
|
|
1435
|
+
...mutationOptions
|
|
1436
|
+
};
|
|
1437
|
+
};
|
|
1438
|
+
/**
|
|
1439
|
+
* @summary Upload Plugin
|
|
1440
|
+
*/
|
|
1441
|
+
const useUploadPlugin = (options, queryClient) => {
|
|
1442
|
+
return useMutation(getUploadPluginMutationOptions(options), queryClient);
|
|
1443
|
+
};
|
|
1444
|
+
/**
|
|
1445
|
+
* @summary Get Plugin
|
|
1446
|
+
*/
|
|
1447
|
+
const getGetPluginUrl = (pluginId) => {
|
|
1448
|
+
return `/api/external/plugins/${pluginId}`;
|
|
1449
|
+
};
|
|
1450
|
+
const getPlugin = async (pluginId, options) => {
|
|
1451
|
+
return customFetch(getGetPluginUrl(pluginId), {
|
|
1452
|
+
...options,
|
|
1453
|
+
method: "GET"
|
|
1454
|
+
});
|
|
1455
|
+
};
|
|
1456
|
+
const getGetPluginQueryKey = (pluginId) => {
|
|
1457
|
+
return [`/api/external/plugins/${pluginId}`];
|
|
1458
|
+
};
|
|
1459
|
+
const getGetPluginQueryOptions = (pluginId, options) => {
|
|
1460
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
1461
|
+
const queryKey = queryOptions?.queryKey ?? getGetPluginQueryKey(pluginId);
|
|
1462
|
+
const queryFn = ({ signal }) => getPlugin(pluginId, {
|
|
1463
|
+
signal,
|
|
1464
|
+
...requestOptions
|
|
1465
|
+
});
|
|
1466
|
+
return {
|
|
1467
|
+
queryKey,
|
|
1468
|
+
queryFn,
|
|
1469
|
+
enabled: !!pluginId,
|
|
1470
|
+
staleTime: 3e5,
|
|
1471
|
+
...queryOptions
|
|
1472
|
+
};
|
|
1473
|
+
};
|
|
1474
|
+
/**
|
|
1475
|
+
* @summary Get Plugin
|
|
1476
|
+
*/
|
|
1477
|
+
function useGetPlugin(pluginId, options, queryClient) {
|
|
1478
|
+
const queryOptions = getGetPluginQueryOptions(pluginId, options);
|
|
1479
|
+
return {
|
|
1480
|
+
...useQuery(queryOptions, queryClient),
|
|
1481
|
+
queryKey: queryOptions.queryKey
|
|
1482
|
+
};
|
|
1483
|
+
}
|
|
1484
|
+
/**
|
|
1485
|
+
* @summary Delete Plugin
|
|
1486
|
+
*/
|
|
1487
|
+
const getDeletePluginUrl = (pluginId) => {
|
|
1488
|
+
return `/api/external/plugins/${pluginId}`;
|
|
1489
|
+
};
|
|
1490
|
+
const deletePlugin = async (pluginId, options) => {
|
|
1491
|
+
return customFetch(getDeletePluginUrl(pluginId), {
|
|
1492
|
+
...options,
|
|
1493
|
+
method: "DELETE"
|
|
1494
|
+
});
|
|
1495
|
+
};
|
|
1496
|
+
const getDeletePluginMutationOptions = (options) => {
|
|
1497
|
+
const mutationKey = ["deletePlugin"];
|
|
1498
|
+
const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
|
|
1499
|
+
...options,
|
|
1500
|
+
mutation: {
|
|
1501
|
+
...options.mutation,
|
|
1502
|
+
mutationKey
|
|
1503
|
+
}
|
|
1504
|
+
} : {
|
|
1505
|
+
mutation: { mutationKey },
|
|
1506
|
+
request: void 0
|
|
1507
|
+
};
|
|
1508
|
+
const mutationFn = (props) => {
|
|
1509
|
+
const { pluginId } = props ?? {};
|
|
1510
|
+
return deletePlugin(pluginId, requestOptions);
|
|
1511
|
+
};
|
|
1512
|
+
return {
|
|
1513
|
+
mutationFn,
|
|
1514
|
+
...mutationOptions
|
|
1515
|
+
};
|
|
1516
|
+
};
|
|
1517
|
+
/**
|
|
1518
|
+
* @summary Delete Plugin
|
|
1519
|
+
*/
|
|
1520
|
+
const useDeletePlugin = (options, queryClient) => {
|
|
1521
|
+
return useMutation(getDeletePluginMutationOptions(options), queryClient);
|
|
1522
|
+
};
|
|
1523
|
+
/**
|
|
1524
|
+
* @summary Get Plugin Method
|
|
1525
|
+
*/
|
|
1526
|
+
const getGetPluginMethodUrl = (pluginId, methodName) => {
|
|
1527
|
+
return `/api/external/plugins/${pluginId}/${methodName}`;
|
|
1528
|
+
};
|
|
1529
|
+
const getPluginMethod = async (pluginId, methodName, options) => {
|
|
1530
|
+
return customFetch(getGetPluginMethodUrl(pluginId, methodName), {
|
|
1531
|
+
...options,
|
|
1532
|
+
method: "GET"
|
|
1533
|
+
});
|
|
1534
|
+
};
|
|
1535
|
+
const getGetPluginMethodQueryKey = (pluginId, methodName) => {
|
|
1536
|
+
return [`/api/external/plugins/${pluginId}/${methodName}`];
|
|
1537
|
+
};
|
|
1538
|
+
const getGetPluginMethodQueryOptions = (pluginId, methodName, options) => {
|
|
1539
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
1540
|
+
const queryKey = queryOptions?.queryKey ?? getGetPluginMethodQueryKey(pluginId, methodName);
|
|
1541
|
+
const queryFn = ({ signal }) => getPluginMethod(pluginId, methodName, {
|
|
1542
|
+
signal,
|
|
1543
|
+
...requestOptions
|
|
1544
|
+
});
|
|
1545
|
+
return {
|
|
1546
|
+
queryKey,
|
|
1547
|
+
queryFn,
|
|
1548
|
+
enabled: !!(pluginId && methodName),
|
|
1549
|
+
staleTime: 3e5,
|
|
1550
|
+
...queryOptions
|
|
1551
|
+
};
|
|
1552
|
+
};
|
|
1553
|
+
/**
|
|
1554
|
+
* @summary Get Plugin Method
|
|
1555
|
+
*/
|
|
1556
|
+
function useGetPluginMethod(pluginId, methodName, options, queryClient) {
|
|
1557
|
+
const queryOptions = getGetPluginMethodQueryOptions(pluginId, methodName, options);
|
|
1558
|
+
return {
|
|
1559
|
+
...useQuery(queryOptions, queryClient),
|
|
1560
|
+
queryKey: queryOptions.queryKey
|
|
1561
|
+
};
|
|
1562
|
+
}
|
|
1563
|
+
/**
|
|
1564
|
+
* @summary Run Plugin
|
|
1565
|
+
*/
|
|
1566
|
+
const getRunPluginUrl = (pluginId, methodName) => {
|
|
1567
|
+
return `/api/external/plugins/${pluginId}/${methodName}`;
|
|
1568
|
+
};
|
|
1569
|
+
const runPlugin = async (pluginId, methodName, bodyRunPlugin, options) => {
|
|
1570
|
+
return customFetch(getRunPluginUrl(pluginId, methodName), {
|
|
1571
|
+
...options,
|
|
1572
|
+
method: "POST",
|
|
1573
|
+
headers: {
|
|
1574
|
+
"Content-Type": "application/json",
|
|
1575
|
+
...options?.headers
|
|
1576
|
+
},
|
|
1577
|
+
body: JSON.stringify(bodyRunPlugin)
|
|
1578
|
+
});
|
|
1579
|
+
};
|
|
1580
|
+
const getRunPluginMutationOptions = (options) => {
|
|
1581
|
+
const mutationKey = ["runPlugin"];
|
|
1582
|
+
const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
|
|
1583
|
+
...options,
|
|
1584
|
+
mutation: {
|
|
1585
|
+
...options.mutation,
|
|
1586
|
+
mutationKey
|
|
1587
|
+
}
|
|
1588
|
+
} : {
|
|
1589
|
+
mutation: { mutationKey },
|
|
1590
|
+
request: void 0
|
|
1591
|
+
};
|
|
1592
|
+
const mutationFn = (props) => {
|
|
1593
|
+
const { pluginId, methodName, data } = props ?? {};
|
|
1594
|
+
return runPlugin(pluginId, methodName, data, requestOptions);
|
|
1595
|
+
};
|
|
1596
|
+
return {
|
|
1597
|
+
mutationFn,
|
|
1598
|
+
...mutationOptions
|
|
1599
|
+
};
|
|
1600
|
+
};
|
|
1601
|
+
/**
|
|
1602
|
+
* @summary Run Plugin
|
|
1603
|
+
*/
|
|
1604
|
+
const useRunPlugin = (options, queryClient) => {
|
|
1605
|
+
return useMutation(getRunPluginMutationOptions(options), queryClient);
|
|
1606
|
+
};
|
|
1607
|
+
/**
|
|
1608
|
+
* @summary Get Computed
|
|
1609
|
+
*/
|
|
1610
|
+
const getGetComputedValuesUrl = (pluginId, methodName, provider) => {
|
|
1611
|
+
return `/api/external/plugins/${pluginId}/${methodName}/computed/${provider}`;
|
|
1612
|
+
};
|
|
1613
|
+
const getComputedValues = async (pluginId, methodName, provider, bodyGetComputedValues, options) => {
|
|
1614
|
+
return customFetch(getGetComputedValuesUrl(pluginId, methodName, provider), {
|
|
1615
|
+
...options,
|
|
1616
|
+
method: "POST",
|
|
1617
|
+
headers: {
|
|
1618
|
+
"Content-Type": "application/json",
|
|
1619
|
+
...options?.headers
|
|
1620
|
+
},
|
|
1621
|
+
body: JSON.stringify(bodyGetComputedValues)
|
|
1622
|
+
});
|
|
1623
|
+
};
|
|
1624
|
+
const getGetComputedValuesMutationOptions = (options) => {
|
|
1625
|
+
const mutationKey = ["getComputedValues"];
|
|
1626
|
+
const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
|
|
1627
|
+
...options,
|
|
1628
|
+
mutation: {
|
|
1629
|
+
...options.mutation,
|
|
1630
|
+
mutationKey
|
|
1631
|
+
}
|
|
1632
|
+
} : {
|
|
1633
|
+
mutation: { mutationKey },
|
|
1634
|
+
request: void 0
|
|
1635
|
+
};
|
|
1636
|
+
const mutationFn = (props) => {
|
|
1637
|
+
const { pluginId, methodName, provider, data } = props ?? {};
|
|
1638
|
+
return getComputedValues(pluginId, methodName, provider, data, requestOptions);
|
|
1639
|
+
};
|
|
1640
|
+
return {
|
|
1641
|
+
mutationFn,
|
|
1642
|
+
...mutationOptions
|
|
1643
|
+
};
|
|
1644
|
+
};
|
|
1645
|
+
/**
|
|
1646
|
+
* @summary Get Computed
|
|
1647
|
+
*/
|
|
1648
|
+
const useGetComputedValues = (options, queryClient) => {
|
|
1649
|
+
return useMutation(getGetComputedValuesMutationOptions(options), queryClient);
|
|
1650
|
+
};
|
|
1651
|
+
/**
|
|
1652
|
+
* @summary Get Resources
|
|
1653
|
+
*/
|
|
1654
|
+
const getResourcesUrl = (params) => {
|
|
1655
|
+
const normalizedParams = new URLSearchParams();
|
|
1656
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
1657
|
+
if (value !== void 0) normalizedParams.append(key, value === null ? "null" : value.toString());
|
|
1658
|
+
});
|
|
1659
|
+
const stringifiedParams = normalizedParams.toString();
|
|
1660
|
+
return stringifiedParams.length > 0 ? `/api/external/resources?${stringifiedParams}` : `/api/external/resources`;
|
|
1661
|
+
};
|
|
1662
|
+
const resources = async (params, options) => {
|
|
1663
|
+
return customFetch(getResourcesUrl(params), {
|
|
1664
|
+
...options,
|
|
1665
|
+
method: "GET"
|
|
1666
|
+
});
|
|
1667
|
+
};
|
|
1668
|
+
const getResourcesQueryKey = (params) => {
|
|
1669
|
+
return [`/api/external/resources`, ...params ? [params] : []];
|
|
1670
|
+
};
|
|
1671
|
+
const getResourcesQueryOptions = (params, options) => {
|
|
1672
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
1673
|
+
const queryKey = queryOptions?.queryKey ?? getResourcesQueryKey(params);
|
|
1674
|
+
const queryFn = ({ signal }) => resources(params, {
|
|
1675
|
+
signal,
|
|
1676
|
+
...requestOptions
|
|
1677
|
+
});
|
|
1678
|
+
return {
|
|
1679
|
+
queryKey,
|
|
1680
|
+
queryFn,
|
|
1681
|
+
staleTime: 3e5,
|
|
1682
|
+
...queryOptions
|
|
1683
|
+
};
|
|
1684
|
+
};
|
|
1685
|
+
/**
|
|
1686
|
+
* @summary Get Resources
|
|
1687
|
+
*/
|
|
1688
|
+
function useResources(params, options, queryClient) {
|
|
1689
|
+
const queryOptions = getResourcesQueryOptions(params, options);
|
|
1690
|
+
return {
|
|
1691
|
+
...useQuery(queryOptions, queryClient),
|
|
1692
|
+
queryKey: queryOptions.queryKey
|
|
1693
|
+
};
|
|
1694
|
+
}
|
|
1695
|
+
/**
|
|
1696
|
+
* @summary Upload Resource
|
|
1697
|
+
*/
|
|
1698
|
+
const getUploadResourceUrl = () => {
|
|
1699
|
+
return `/api/external/resources`;
|
|
1700
|
+
};
|
|
1701
|
+
const uploadResource = async (bodyUploadResource, options) => {
|
|
1702
|
+
const formData = new FormData();
|
|
1703
|
+
formData.append(`file`, bodyUploadResource.file);
|
|
1704
|
+
return customFetch(getUploadResourceUrl(), {
|
|
1705
|
+
...options,
|
|
1706
|
+
method: "POST",
|
|
1707
|
+
body: formData
|
|
1708
|
+
});
|
|
1709
|
+
};
|
|
1710
|
+
const getUploadResourceMutationOptions = (options) => {
|
|
1711
|
+
const mutationKey = ["uploadResource"];
|
|
1712
|
+
const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
|
|
1713
|
+
...options,
|
|
1714
|
+
mutation: {
|
|
1715
|
+
...options.mutation,
|
|
1716
|
+
mutationKey
|
|
1717
|
+
}
|
|
1718
|
+
} : {
|
|
1719
|
+
mutation: { mutationKey },
|
|
1720
|
+
request: void 0
|
|
1721
|
+
};
|
|
1722
|
+
const mutationFn = (props) => {
|
|
1723
|
+
const { data } = props ?? {};
|
|
1724
|
+
return uploadResource(data, requestOptions);
|
|
1725
|
+
};
|
|
1726
|
+
return {
|
|
1727
|
+
mutationFn,
|
|
1728
|
+
...mutationOptions
|
|
1729
|
+
};
|
|
1730
|
+
};
|
|
1731
|
+
/**
|
|
1732
|
+
* @summary Upload Resource
|
|
1733
|
+
*/
|
|
1734
|
+
const useUploadResource = (options, queryClient) => {
|
|
1735
|
+
return useMutation(getUploadResourceMutationOptions(options), queryClient);
|
|
1736
|
+
};
|
|
1737
|
+
/**
|
|
1738
|
+
* @summary Get Resource Meta
|
|
1739
|
+
*/
|
|
1740
|
+
const getGetResourceMetaUrl = () => {
|
|
1741
|
+
return `/api/external/resources/meta`;
|
|
1742
|
+
};
|
|
1743
|
+
const getResourceMeta = async (options) => {
|
|
1744
|
+
return customFetch(getGetResourceMetaUrl(), {
|
|
1745
|
+
...options,
|
|
1746
|
+
method: "GET"
|
|
1747
|
+
});
|
|
1748
|
+
};
|
|
1749
|
+
const getGetResourceMetaQueryKey = () => {
|
|
1750
|
+
return [`/api/external/resources/meta`];
|
|
1751
|
+
};
|
|
1752
|
+
const getGetResourceMetaQueryOptions = (options) => {
|
|
1753
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
1754
|
+
const queryKey = queryOptions?.queryKey ?? getGetResourceMetaQueryKey();
|
|
1755
|
+
const queryFn = ({ signal }) => getResourceMeta({
|
|
1756
|
+
signal,
|
|
1757
|
+
...requestOptions
|
|
1758
|
+
});
|
|
1759
|
+
return {
|
|
1760
|
+
queryKey,
|
|
1761
|
+
queryFn,
|
|
1762
|
+
staleTime: 3e5,
|
|
1763
|
+
...queryOptions
|
|
1764
|
+
};
|
|
1765
|
+
};
|
|
1766
|
+
/**
|
|
1767
|
+
* @summary Get Resource Meta
|
|
1768
|
+
*/
|
|
1769
|
+
function useGetResourceMeta(options, queryClient) {
|
|
1770
|
+
const queryOptions = getGetResourceMetaQueryOptions(options);
|
|
1771
|
+
return {
|
|
1772
|
+
...useQuery(queryOptions, queryClient),
|
|
1773
|
+
queryKey: queryOptions.queryKey
|
|
1774
|
+
};
|
|
1775
|
+
}
|
|
1776
|
+
/**
|
|
1777
|
+
* @summary Download Resource
|
|
1778
|
+
*/
|
|
1779
|
+
const getDownloadResourceUrl = (resourceId) => {
|
|
1780
|
+
return `/api/external/resources/resource/${resourceId}/download`;
|
|
1781
|
+
};
|
|
1782
|
+
const downloadResource = async (resourceId, options) => {
|
|
1783
|
+
return customFetch(getDownloadResourceUrl(resourceId), {
|
|
1784
|
+
...options,
|
|
1785
|
+
method: "GET"
|
|
1786
|
+
});
|
|
1787
|
+
};
|
|
1788
|
+
const getDownloadResourceQueryKey = (resourceId) => {
|
|
1789
|
+
return [`/api/external/resources/resource/${resourceId}/download`];
|
|
1790
|
+
};
|
|
1791
|
+
const getDownloadResourceQueryOptions = (resourceId, options) => {
|
|
1792
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
1793
|
+
const queryKey = queryOptions?.queryKey ?? getDownloadResourceQueryKey(resourceId);
|
|
1794
|
+
const queryFn = ({ signal }) => downloadResource(resourceId, {
|
|
1795
|
+
signal,
|
|
1796
|
+
...requestOptions
|
|
1797
|
+
});
|
|
1798
|
+
return {
|
|
1799
|
+
queryKey,
|
|
1800
|
+
queryFn,
|
|
1801
|
+
enabled: !!resourceId,
|
|
1802
|
+
staleTime: 3e5,
|
|
1803
|
+
...queryOptions
|
|
1804
|
+
};
|
|
1805
|
+
};
|
|
1806
|
+
/**
|
|
1807
|
+
* @summary Download Resource
|
|
1808
|
+
*/
|
|
1809
|
+
function useDownloadResource(resourceId, options, queryClient) {
|
|
1810
|
+
const queryOptions = getDownloadResourceQueryOptions(resourceId, options);
|
|
1811
|
+
return {
|
|
1812
|
+
...useQuery(queryOptions, queryClient),
|
|
1813
|
+
queryKey: queryOptions.queryKey
|
|
1814
|
+
};
|
|
1815
|
+
}
|
|
1816
|
+
/**
|
|
1817
|
+
* @summary Get Resource
|
|
1818
|
+
*/
|
|
1819
|
+
const getResourceUrl = (resourceId) => {
|
|
1820
|
+
return `/api/external/resources/resource/${resourceId}`;
|
|
1821
|
+
};
|
|
1822
|
+
const resource = async (resourceId, options) => {
|
|
1823
|
+
return customFetch(getResourceUrl(resourceId), {
|
|
1824
|
+
...options,
|
|
1825
|
+
method: "GET"
|
|
1826
|
+
});
|
|
1827
|
+
};
|
|
1828
|
+
const getResourceQueryKey = (resourceId) => {
|
|
1829
|
+
return [`/api/external/resources/resource/${resourceId}`];
|
|
1830
|
+
};
|
|
1831
|
+
const getResourceQueryOptions = (resourceId, options) => {
|
|
1832
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
1833
|
+
const queryKey = queryOptions?.queryKey ?? getResourceQueryKey(resourceId);
|
|
1834
|
+
const queryFn = ({ signal }) => resource(resourceId, {
|
|
1835
|
+
signal,
|
|
1836
|
+
...requestOptions
|
|
1837
|
+
});
|
|
1838
|
+
return {
|
|
1839
|
+
queryKey,
|
|
1840
|
+
queryFn,
|
|
1841
|
+
enabled: !!resourceId,
|
|
1842
|
+
staleTime: 3e5,
|
|
1843
|
+
...queryOptions
|
|
1844
|
+
};
|
|
1845
|
+
};
|
|
1846
|
+
/**
|
|
1847
|
+
* @summary Get Resource
|
|
1848
|
+
*/
|
|
1849
|
+
function useResource(resourceId, options, queryClient) {
|
|
1850
|
+
const queryOptions = getResourceQueryOptions(resourceId, options);
|
|
1851
|
+
return {
|
|
1852
|
+
...useQuery(queryOptions, queryClient),
|
|
1853
|
+
queryKey: queryOptions.queryKey
|
|
1854
|
+
};
|
|
1855
|
+
}
|
|
1856
|
+
/**
|
|
1857
|
+
* @summary Delete Resource
|
|
1858
|
+
*/
|
|
1859
|
+
const getDeleteResourceUrl = (resourceId) => {
|
|
1860
|
+
return `/api/external/resources/resource/${resourceId}`;
|
|
1861
|
+
};
|
|
1862
|
+
const deleteResource = async (resourceId, options) => {
|
|
1863
|
+
return customFetch(getDeleteResourceUrl(resourceId), {
|
|
1864
|
+
...options,
|
|
1865
|
+
method: "DELETE"
|
|
1866
|
+
});
|
|
1867
|
+
};
|
|
1868
|
+
const getDeleteResourceMutationOptions = (options) => {
|
|
1869
|
+
const mutationKey = ["deleteResource"];
|
|
1870
|
+
const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
|
|
1871
|
+
...options,
|
|
1872
|
+
mutation: {
|
|
1873
|
+
...options.mutation,
|
|
1874
|
+
mutationKey
|
|
1875
|
+
}
|
|
1876
|
+
} : {
|
|
1877
|
+
mutation: { mutationKey },
|
|
1878
|
+
request: void 0
|
|
1879
|
+
};
|
|
1880
|
+
const mutationFn = (props) => {
|
|
1881
|
+
const { resourceId } = props ?? {};
|
|
1882
|
+
return deleteResource(resourceId, requestOptions);
|
|
1883
|
+
};
|
|
1884
|
+
return {
|
|
1885
|
+
mutationFn,
|
|
1886
|
+
...mutationOptions
|
|
1887
|
+
};
|
|
1888
|
+
};
|
|
1889
|
+
/**
|
|
1890
|
+
* @summary Delete Resource
|
|
1891
|
+
*/
|
|
1892
|
+
const useDeleteResource = (options, queryClient) => {
|
|
1893
|
+
return useMutation(getDeleteResourceMutationOptions(options), queryClient);
|
|
1894
|
+
};
|
|
1895
|
+
/**
|
|
1896
|
+
* @summary Rename Resource
|
|
1897
|
+
*/
|
|
1898
|
+
const getRenameResourceUrl = (resourceId, params) => {
|
|
1899
|
+
const normalizedParams = new URLSearchParams();
|
|
1900
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
1901
|
+
if (value !== void 0) normalizedParams.append(key, value === null ? "null" : value.toString());
|
|
1902
|
+
});
|
|
1903
|
+
const stringifiedParams = normalizedParams.toString();
|
|
1904
|
+
return stringifiedParams.length > 0 ? `/api/external/resources/resource/${resourceId}?${stringifiedParams}` : `/api/external/resources/resource/${resourceId}`;
|
|
1905
|
+
};
|
|
1906
|
+
const renameResource = async (resourceId, params, options) => {
|
|
1907
|
+
return customFetch(getRenameResourceUrl(resourceId, params), {
|
|
1908
|
+
...options,
|
|
1909
|
+
method: "POST"
|
|
1910
|
+
});
|
|
1911
|
+
};
|
|
1912
|
+
const getRenameResourceMutationOptions = (options) => {
|
|
1913
|
+
const mutationKey = ["renameResource"];
|
|
1914
|
+
const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
|
|
1915
|
+
...options,
|
|
1916
|
+
mutation: {
|
|
1917
|
+
...options.mutation,
|
|
1918
|
+
mutationKey
|
|
1919
|
+
}
|
|
1920
|
+
} : {
|
|
1921
|
+
mutation: { mutationKey },
|
|
1922
|
+
request: void 0
|
|
1923
|
+
};
|
|
1924
|
+
const mutationFn = (props) => {
|
|
1925
|
+
const { resourceId, params } = props ?? {};
|
|
1926
|
+
return renameResource(resourceId, params, requestOptions);
|
|
1927
|
+
};
|
|
1928
|
+
return {
|
|
1929
|
+
mutationFn,
|
|
1930
|
+
...mutationOptions
|
|
1931
|
+
};
|
|
1932
|
+
};
|
|
1933
|
+
/**
|
|
1934
|
+
* @summary Rename Resource
|
|
1935
|
+
*/
|
|
1936
|
+
const useRenameResource = (options, queryClient) => {
|
|
1937
|
+
return useMutation(getRenameResourceMutationOptions(options), queryClient);
|
|
1938
|
+
};
|
|
1939
|
+
/**
|
|
1940
|
+
* @summary Sse Endpoint
|
|
1941
|
+
*/
|
|
1942
|
+
const getSseEndpointSseGetUrl = () => {
|
|
1943
|
+
return `/api/external/sse`;
|
|
1944
|
+
};
|
|
1945
|
+
const sseEndpointSseGet = async (options) => {
|
|
1946
|
+
return customFetch(getSseEndpointSseGetUrl(), {
|
|
1947
|
+
...options,
|
|
1948
|
+
method: "GET"
|
|
1949
|
+
});
|
|
1950
|
+
};
|
|
1951
|
+
const getSseEndpointSseGetQueryKey = () => {
|
|
1952
|
+
return [`/api/external/sse`];
|
|
1953
|
+
};
|
|
1954
|
+
const getSseEndpointSseGetQueryOptions = (options) => {
|
|
1955
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
1956
|
+
const queryKey = queryOptions?.queryKey ?? getSseEndpointSseGetQueryKey();
|
|
1957
|
+
const queryFn = ({ signal }) => sseEndpointSseGet({
|
|
1958
|
+
signal,
|
|
1959
|
+
...requestOptions
|
|
1960
|
+
});
|
|
1961
|
+
return {
|
|
1962
|
+
queryKey,
|
|
1963
|
+
queryFn,
|
|
1964
|
+
staleTime: 3e5,
|
|
1965
|
+
...queryOptions
|
|
1966
|
+
};
|
|
1967
|
+
};
|
|
1968
|
+
/**
|
|
1969
|
+
* @summary Sse Endpoint
|
|
1970
|
+
*/
|
|
1971
|
+
function useSseEndpointSseGet(options, queryClient) {
|
|
1972
|
+
const queryOptions = getSseEndpointSseGetQueryOptions(options);
|
|
1973
|
+
return {
|
|
1974
|
+
...useQuery(queryOptions, queryClient),
|
|
1975
|
+
queryKey: queryOptions.queryKey
|
|
1976
|
+
};
|
|
1977
|
+
}
|
|
1978
|
+
|
|
1979
|
+
//#endregion
|
|
1980
|
+
export { DotVisLayoutEngine, DownloadOcelOcelsDownloadGetExt, E2OCountFilterDirection, E2oDirection, EventTypeFilterMode, GraphNodeLabelPos, GraphNodeShape, GraphvizLayoutConfigEngine, O2OCountFilterDirection, O2oDirection, ObjectTypeFilterMode, TableColumnDataType, TaskState, TimeFrameFilterMode, deleteOcel, deletePlugin, deleteResource, downloadOcelOcelsDownloadGet, downloadResource, e2o, eventAttributes, eventCounts, eventIds, getComputedValues, getDefaultOcel, getDeleteOcelMutationOptions, getDeleteOcelUrl, getDeletePluginMutationOptions, getDeletePluginUrl, getDeleteResourceMutationOptions, getDeleteResourceUrl, getDownloadOcelOcelsDownloadGetQueryKey, getDownloadOcelOcelsDownloadGetQueryOptions, getDownloadOcelOcelsDownloadGetUrl, getDownloadResourceQueryKey, getDownloadResourceQueryOptions, getDownloadResourceUrl, getE2oQueryKey, getE2oQueryOptions, getE2oUrl, getEventAttributesQueryKey, getEventAttributesQueryOptions, getEventAttributesUrl, getEventCountsQueryKey, getEventCountsQueryOptions, getEventCountsUrl, getEventIdsQueryKey, getEventIdsQueryOptions, getEventIdsUrl, getExtensionMeta, getFilters, getGetComputedValuesMutationOptions, getGetComputedValuesUrl, getGetDefaultOcelQueryKey, getGetDefaultOcelQueryOptions, getGetDefaultOcelUrl, getGetExtensionMetaQueryKey, getGetExtensionMetaQueryOptions, getGetExtensionMetaUrl, getGetFiltersQueryKey, getGetFiltersQueryOptions, getGetFiltersUrl, getGetOcelsQueryKey, getGetOcelsQueryOptions, getGetOcelsUrl, getGetPluginMethodQueryKey, getGetPluginMethodQueryOptions, getGetPluginMethodUrl, getGetPluginQueryKey, getGetPluginQueryOptions, getGetPluginTaskQueryKey, getGetPluginTaskQueryOptions, getGetPluginTaskUrl, getGetPluginTasksQueryKey, getGetPluginTasksQueryOptions, getGetPluginTasksUrl, getGetPluginUrl, getGetResourceMetaQueryKey, getGetResourceMetaQueryOptions, getGetResourceMetaUrl, getGetSystemTaskQueryKey, getGetSystemTaskQueryOptions, getGetSystemTaskUrl, getGetSystemTasksQueryKey, getGetSystemTasksQueryOptions, getGetSystemTasksUrl, getImportDefaultOcelMutationOptions, getImportDefaultOcelUrl, getLogoutMutationOptions, getLogoutUrl, getO2oQueryKey, getO2oQueryOptions, getO2oUrl, getObjectAttributesQueryKey, getObjectAttributesQueryOptions, getObjectAttributesUrl, getObjectCountsQueryKey, getObjectCountsQueryOptions, getObjectCountsUrl, getObjectIdsQueryKey, getObjectIdsQueryOptions, getObjectIdsUrl, getOcelotEventInfoQueryKey, getOcelotEventInfoQueryOptions, getOcelotEventInfoUrl, getOcelotGetObjectChangesQueryKey, getOcelotGetObjectChangesQueryOptions, getOcelotGetObjectChangesUrl, getOcelotObjectInfoQueryKey, getOcelotObjectInfoQueryOptions, getOcelotObjectInfoUrl, getOcelotPaginatedEventsQueryKey, getOcelotPaginatedEventsQueryOptions, getOcelotPaginatedEventsUrl, getOcelotPaginatedObjectsQueryKey, getOcelotPaginatedObjectsQueryOptions, getOcelotPaginatedObjectsUrl, getOcels, getPlugin, getPluginMethod, getPluginTask, getPluginTasks, getPluginsQueryKey, getPluginsQueryOptions, getPluginsUrl, getRenameOcelMutationOptions, getRenameOcelUrl, getRenameResourceMutationOptions, getRenameResourceUrl, getResourceMeta, getResourceQueryKey, getResourceQueryOptions, getResourceUrl, getResourcesQueryKey, getResourcesQueryOptions, getResourcesUrl, getRunPluginMutationOptions, getRunPluginUrl, getSetFiltersMutationOptions, getSetFiltersUrl, getSseEndpointSseGetQueryKey, getSseEndpointSseGetQueryOptions, getSseEndpointSseGetUrl, getSystemTask, getSystemTasks, getTimeInfoQueryKey, getTimeInfoQueryOptions, getTimeInfoUrl, getUploadMutationOptions, getUploadPluginMutationOptions, getUploadPluginUrl, getUploadResourceMutationOptions, getUploadResourceUrl, getUploadUrl, importDefaultOcel, logout, o2o, objectAttributes, objectCounts, objectIds, ocelotEventInfo, ocelotGetObjectChanges, ocelotObjectInfo, ocelotPaginatedEvents, ocelotPaginatedObjects, plugins, renameOcel, renameResource, resource, resources, runPlugin, setFilters, sseEndpointSseGet, timeInfo, upload, uploadPlugin, uploadResource, useDeleteOcel, useDeletePlugin, useDeleteResource, useDownloadOcelOcelsDownloadGet, useDownloadResource, useE2o, useEventAttributes, useEventCounts, useEventIds, useGetComputedValues, useGetDefaultOcel, useGetExtensionMeta, useGetFilters, useGetOcels, useGetPlugin, useGetPluginMethod, useGetPluginTask, useGetPluginTasks, useGetResourceMeta, useGetSystemTask, useGetSystemTasks, useImportDefaultOcel, useLogout, useO2o, useObjectAttributes, useObjectCounts, useObjectIds, useOcelotEventInfo, useOcelotGetObjectChanges, useOcelotObjectInfo, useOcelotPaginatedEvents, useOcelotPaginatedObjects, usePlugins, useRenameOcel, useRenameResource, useResource, useResources, useRunPlugin, useSetFilters, useSseEndpointSseGet, useTimeInfo, useUpload, useUploadPlugin, useUploadResource };
|