@tagsamurai/gsts-api-services 2.0.1-alpha.45 → 2.0.1-alpha.47
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/api-services.es.js
CHANGED
|
@@ -2,10 +2,10 @@ import R from "axios";
|
|
|
2
2
|
const E = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, SSR: !1, VITE_APP_GLOBAL_SETTINGS_API: "https://dev-api.global-settings.tagsamurai.com", VITE_APP_IMAGE_BASE_URL: "https://dev-api.tagsamurai.com/fam/utility/v2/files", VITE_APP_LOGS_NOTIFICATION_API: "https://dev-api-logs-notification.tagsamurai.com", VITE_APP_TAGSAMURAI_API: "https://dev-api.tagsamurai.com" }, O = (t = "APP_TAGSAMURAI_API") => E["VITE_" + t], u = (t = {}, e = !1) => {
|
|
3
3
|
const {
|
|
4
4
|
env: r = "APP_GLOBAL_SETTINGS_API",
|
|
5
|
-
prefix:
|
|
5
|
+
prefix: n = "",
|
|
6
6
|
headers: p = {},
|
|
7
7
|
...f
|
|
8
|
-
} = t, U = "".concat(O(r)).concat(
|
|
8
|
+
} = t, U = "".concat(O(r)).concat(n), P = R.create({
|
|
9
9
|
...f,
|
|
10
10
|
baseURL: U,
|
|
11
11
|
headers: e ? p : {
|
|
@@ -14,15 +14,15 @@ const E = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, SSR: !1, VITE_
|
|
|
14
14
|
}
|
|
15
15
|
});
|
|
16
16
|
return P.interceptors.request.use((y) => {
|
|
17
|
-
var T,
|
|
18
|
-
const S = JSON.parse((
|
|
17
|
+
var $, T, D;
|
|
18
|
+
const S = JSON.parse(($ = localStorage.getItem("user")) != null ? $ : "{}"), L = (D = (T = S.jwt) != null ? T : S.token) != null ? D : "";
|
|
19
19
|
return y.headers.Authorization = "Bearer ".concat(L), y;
|
|
20
20
|
}), P;
|
|
21
21
|
}, d = u({
|
|
22
22
|
prefix: "/v1/global-settings/auth"
|
|
23
23
|
}), C = (t) => {
|
|
24
|
-
var e, r,
|
|
25
|
-
return ((e = t.response) == null ? void 0 : e.status) === 401 || ((r = t.response) == null ? void 0 : r.status) === 500 || ((p = (
|
|
24
|
+
var e, r, n, p;
|
|
25
|
+
return ((e = t.response) == null ? void 0 : e.status) === 401 || ((r = t.response) == null ? void 0 : r.status) === 500 || ((p = (n = t.response) == null ? void 0 : n.data) == null ? void 0 : p.message) === "jwt malformed" ? (window.onblur = null, window.onfocus = null, window.sessionExpired = !0, window.dispatchEvent(new CustomEvent("user:expired"))) : Promise.reject(t);
|
|
26
26
|
}, J = {
|
|
27
27
|
login: (t) => {
|
|
28
28
|
const e = { ...t, isMobile: !1 };
|
|
@@ -50,17 +50,17 @@ const E = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, SSR: !1, VITE_
|
|
|
50
50
|
*/
|
|
51
51
|
logout: () => d.post("/logout")
|
|
52
52
|
}, _ = (t, e, r) => {
|
|
53
|
-
const
|
|
54
|
-
let p = t.startsWith("http") ? t : "".concat(
|
|
53
|
+
const n = new URL(O("APP_TAGSAMURAI_API") || "").origin;
|
|
54
|
+
let p = t.startsWith("http") ? t : "".concat(n, "/file-storage/api/file/").concat(t.replace(/^\/+/, ""));
|
|
55
55
|
if (e || r) {
|
|
56
56
|
const f = new URLSearchParams();
|
|
57
57
|
e && (f.set("width", e.toString()), f.set("height", (r == null ? void 0 : r.toString()) || e.toString())), p += "?".concat(f.toString());
|
|
58
58
|
}
|
|
59
59
|
return p;
|
|
60
60
|
}, F = () => {
|
|
61
|
-
var e, r,
|
|
61
|
+
var e, r, n;
|
|
62
62
|
const t = JSON.parse((e = localStorage.getItem("user")) != null ? e : "{}");
|
|
63
|
-
return (
|
|
63
|
+
return (n = (r = t.jwt) != null ? r : t.token) != null ? n : "";
|
|
64
64
|
}, x = async (t, e) => {
|
|
65
65
|
const r = await fetch(t, {
|
|
66
66
|
headers: {
|
|
@@ -69,8 +69,8 @@ const E = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, SSR: !1, VITE_
|
|
|
69
69
|
});
|
|
70
70
|
if (!r.ok)
|
|
71
71
|
throw new Error("Image fetch failed: ".concat(r.status, " ").concat(r.statusText));
|
|
72
|
-
const
|
|
73
|
-
return new Blob([
|
|
72
|
+
const n = await r.arrayBuffer();
|
|
73
|
+
return new Blob([n], {
|
|
74
74
|
type: r.headers.get("Content-Type") || "image/webp"
|
|
75
75
|
});
|
|
76
76
|
}, G = async (t) => {
|
|
@@ -80,10 +80,10 @@ const E = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, SSR: !1, VITE_
|
|
|
80
80
|
} catch (e) {
|
|
81
81
|
return;
|
|
82
82
|
}
|
|
83
|
-
}, j = async (t, e, r,
|
|
83
|
+
}, j = async (t, e, r, n) => {
|
|
84
84
|
if (!t) return;
|
|
85
85
|
const p = _(t, e, r);
|
|
86
|
-
return
|
|
86
|
+
return n ? p : G(p);
|
|
87
87
|
}, B = (t) => {
|
|
88
88
|
if (!t || typeof t == "string")
|
|
89
89
|
return;
|
|
@@ -104,39 +104,39 @@ const E = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, SSR: !1, VITE_
|
|
|
104
104
|
} catch (r) {
|
|
105
105
|
return !1;
|
|
106
106
|
}
|
|
107
|
-
},
|
|
107
|
+
}, i = (t) => {
|
|
108
108
|
if (!t)
|
|
109
109
|
return {};
|
|
110
110
|
const e = {};
|
|
111
111
|
return Object.keys(t).forEach((r) => {
|
|
112
|
-
const
|
|
113
|
-
e[r] = N(
|
|
112
|
+
const n = t[r];
|
|
113
|
+
e[r] = N(n) ? JSON.parse(n.trim()) : n;
|
|
114
114
|
}), e;
|
|
115
115
|
}, c = u({
|
|
116
116
|
prefix: "/v2/analytics-reporting"
|
|
117
117
|
}), q = {
|
|
118
118
|
getChangelogs: (t) => {
|
|
119
|
-
const e =
|
|
119
|
+
const e = i(t);
|
|
120
120
|
return c.post("/change-log/list", e);
|
|
121
121
|
},
|
|
122
122
|
getChangelogOptions: (t) => c.post("/change-log/options", t),
|
|
123
123
|
getSessionList: (t) => {
|
|
124
|
-
const e =
|
|
124
|
+
const e = i(t);
|
|
125
125
|
return c.post("/session-log/list", e);
|
|
126
126
|
},
|
|
127
127
|
getSessionOptions: (t) => c.post("/session-log/options", t),
|
|
128
128
|
getHardwareChangelogs: (t) => {
|
|
129
|
-
const e =
|
|
129
|
+
const e = i(t);
|
|
130
130
|
return c.post("/hardware-change-log/list", e);
|
|
131
131
|
},
|
|
132
132
|
getHardwareOptions: (t) => c.post("/hardware-change-log/options", t),
|
|
133
133
|
getTaggingList: (t) => {
|
|
134
|
-
const e =
|
|
134
|
+
const e = i(t);
|
|
135
135
|
return c.post("/reader-tagging-log/list", e);
|
|
136
136
|
},
|
|
137
137
|
getTaggingOptions: (t) => c.post("/reader-tagging-log/options", t),
|
|
138
138
|
getUserTagList: (t) => {
|
|
139
|
-
const e =
|
|
139
|
+
const e = i(t);
|
|
140
140
|
return c.post("/reader-user-tag-log/list", e);
|
|
141
141
|
},
|
|
142
142
|
getUserTagOptions: (t) => c.post("/reader-user-tag-log/options", t)
|
|
@@ -155,20 +155,20 @@ const E = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, SSR: !1, VITE_
|
|
|
155
155
|
prefix: "/v2/hardware-tagging"
|
|
156
156
|
}), Y = {
|
|
157
157
|
getAllTAG: (t) => {
|
|
158
|
-
const e =
|
|
158
|
+
const e = i(t);
|
|
159
159
|
return g.post("/all-tag/list", e);
|
|
160
160
|
},
|
|
161
161
|
getAllTAGOptions: (t) => {
|
|
162
|
-
const e =
|
|
162
|
+
const e = i(t);
|
|
163
163
|
return g.post("all-tag/options", e);
|
|
164
164
|
},
|
|
165
165
|
getNotPairedYetCounts: () => g.get("/not-paired-yet/tag-count"),
|
|
166
166
|
getNotPairedYetList: (t) => {
|
|
167
|
-
const e =
|
|
167
|
+
const e = i(t);
|
|
168
168
|
return g.post("/not-paired-yet/list", e);
|
|
169
169
|
},
|
|
170
170
|
getNotPairedYetOptions: (t) => {
|
|
171
|
-
const e =
|
|
171
|
+
const e = i(t);
|
|
172
172
|
return g.post("/not-paired-yet/options", e);
|
|
173
173
|
},
|
|
174
174
|
getAuditTAGDetail: (t) => g.post("/audit/detail", t),
|
|
@@ -176,11 +176,11 @@ const E = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, SSR: !1, VITE_
|
|
|
176
176
|
submitCombineTAG: (t) => g.post("/combine-tag/combine", t),
|
|
177
177
|
submitSeparateTAG: (t) => g.post("/combine-tag/separate", t),
|
|
178
178
|
getPairedList: (t) => {
|
|
179
|
-
const e =
|
|
179
|
+
const e = i(t);
|
|
180
180
|
return g.post("/paired/list", e);
|
|
181
181
|
},
|
|
182
182
|
getPairedOptions: (t) => {
|
|
183
|
-
const e =
|
|
183
|
+
const e = i(t);
|
|
184
184
|
return g.post("/paired/options", e);
|
|
185
185
|
},
|
|
186
186
|
getScanTag: (t) => g.get("/scan-tag", { params: { tag: t } })
|
|
@@ -188,7 +188,7 @@ const E = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, SSR: !1, VITE_
|
|
|
188
188
|
prefix: "/v2/hardware-tagging"
|
|
189
189
|
}), z = {
|
|
190
190
|
getHandheldReader: (t) => {
|
|
191
|
-
const e =
|
|
191
|
+
const e = i(t);
|
|
192
192
|
return o.post("/handheld-reader/list", e);
|
|
193
193
|
},
|
|
194
194
|
getHandheldReaderDetail: (t) => o.get("/handheld-reader/".concat(t)),
|
|
@@ -206,7 +206,7 @@ const E = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, SSR: !1, VITE_
|
|
|
206
206
|
}),
|
|
207
207
|
putAntennaPower: (t, e) => o.put("/iot-reader/".concat(e, "/set-antenna-power"), t),
|
|
208
208
|
getIotReader: (t) => {
|
|
209
|
-
const e =
|
|
209
|
+
const e = i({ ...t });
|
|
210
210
|
return o.post("/iot-reader", e);
|
|
211
211
|
},
|
|
212
212
|
getIotReaderDetail: (t) => o.get("/iot-reader/".concat(t)),
|
|
@@ -254,11 +254,11 @@ const E = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, SSR: !1, VITE_
|
|
|
254
254
|
prefix: "/v2/hardware-tagging"
|
|
255
255
|
}), Z = {
|
|
256
256
|
getTAGEventlog: (t) => {
|
|
257
|
-
const e =
|
|
257
|
+
const e = i(t);
|
|
258
258
|
return A.post("/tag-event-log/list", e);
|
|
259
259
|
},
|
|
260
260
|
getTAGEventlogOptions: (t) => {
|
|
261
|
-
const e =
|
|
261
|
+
const e = i(t);
|
|
262
262
|
return A.post("/tag-event-log/options", e);
|
|
263
263
|
},
|
|
264
264
|
getDetailTAGEventlog: (t) => A.get("/tag-event-log/".concat(t))
|
|
@@ -312,7 +312,7 @@ const E = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, SSR: !1, VITE_
|
|
|
312
312
|
confirmEmailChange: (t) => s.post("/auth/confirm-email-change", { token: t }),
|
|
313
313
|
cancelEmailChange: (t) => s.delete("/auth/cancel-email-change/".concat(t)),
|
|
314
314
|
getPositionList: (t) => {
|
|
315
|
-
const e =
|
|
315
|
+
const e = i(t);
|
|
316
316
|
return s.post("/position/list", e);
|
|
317
317
|
},
|
|
318
318
|
getPositionDetail: (t) => s.get("/position/".concat(t)),
|
|
@@ -323,7 +323,7 @@ const E = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, SSR: !1, VITE_
|
|
|
323
323
|
return s.delete("/position", { params: e });
|
|
324
324
|
},
|
|
325
325
|
getDivisionList: (t) => {
|
|
326
|
-
const e =
|
|
326
|
+
const e = i(t);
|
|
327
327
|
return s.post("/division/list", e);
|
|
328
328
|
},
|
|
329
329
|
getDivisionDetail: (t) => s.get("/division/".concat(t)),
|
|
@@ -335,18 +335,18 @@ const E = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, SSR: !1, VITE_
|
|
|
335
335
|
},
|
|
336
336
|
createUsers: (t) => {
|
|
337
337
|
const e = new FormData();
|
|
338
|
-
return Object.entries(t).forEach(([r,
|
|
339
|
-
|
|
338
|
+
return Object.entries(t).forEach(([r, n]) => {
|
|
339
|
+
n != null && e.append(r, n);
|
|
340
340
|
}), s.post("/users", e, {
|
|
341
341
|
headers: { "Content-Type": "multipart/form-data" }
|
|
342
342
|
});
|
|
343
343
|
},
|
|
344
344
|
getGlobalUserList: (t) => {
|
|
345
|
-
const e =
|
|
345
|
+
const e = i(t);
|
|
346
346
|
return s.post("/users/list", e);
|
|
347
347
|
},
|
|
348
348
|
getGlobalUserOptions: (t) => {
|
|
349
|
-
const e =
|
|
349
|
+
const e = i(t);
|
|
350
350
|
return s.post("/users/options", e);
|
|
351
351
|
},
|
|
352
352
|
getGlobalUserDetail: (t) => s.get("/users/".concat(t)),
|
|
@@ -356,8 +356,8 @@ const E = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, SSR: !1, VITE_
|
|
|
356
356
|
},
|
|
357
357
|
editUsers: (t, e) => {
|
|
358
358
|
const r = new FormData();
|
|
359
|
-
return Object.entries(e).forEach(([
|
|
360
|
-
p != null && r.append(
|
|
359
|
+
return Object.entries(e).forEach(([n, p]) => {
|
|
360
|
+
p != null && r.append(n, p);
|
|
361
361
|
}), s.patch("/users/".concat(t), r, {
|
|
362
362
|
headers: { "Content-Type": "multipart/form-data" }
|
|
363
363
|
});
|
|
@@ -385,7 +385,7 @@ const E = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, SSR: !1, VITE_
|
|
|
385
385
|
exportDivisionTable: () => s.post("/division/list/export", {}, { responseType: "blob" }),
|
|
386
386
|
exportUserTable: () => s.post("/users/list/export", {}, { responseType: "blob" }),
|
|
387
387
|
getCustomFieldList: (t) => {
|
|
388
|
-
const e =
|
|
388
|
+
const e = i(t);
|
|
389
389
|
return s.post("/custom-fields/list", e);
|
|
390
390
|
},
|
|
391
391
|
getCustomFieldOptions: (t) => s.post("/custom-fields/options", t),
|
|
@@ -458,30 +458,20 @@ const E = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, SSR: !1, VITE_
|
|
|
458
458
|
get: () => w.get("/"),
|
|
459
459
|
update: (t) => w.put("/", t)
|
|
460
460
|
}, m = u({
|
|
461
|
-
prefix: "/v2/
|
|
461
|
+
prefix: "/utility/v2/file-manager"
|
|
462
462
|
}), nt = {
|
|
463
463
|
getStorageInformation: () => m.get("/files/storage"),
|
|
464
|
-
|
|
465
|
-
const
|
|
466
|
-
return m.
|
|
467
|
-
},
|
|
468
|
-
|
|
469
|
-
const
|
|
470
|
-
return m.post("/
|
|
471
|
-
},
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
},
|
|
476
|
-
recoverFiles: (t) => m.put("/user/recover", t),
|
|
477
|
-
deleteFiles: (t) => {
|
|
478
|
-
const e = n(t);
|
|
479
|
-
return m.delete("/user", e);
|
|
480
|
-
},
|
|
481
|
-
deletePermanently: (t) => {
|
|
482
|
-
const e = n(t);
|
|
483
|
-
return m.delete("/user/delete-permanent", e);
|
|
484
|
-
}
|
|
464
|
+
postFileManager: (t, e) => {
|
|
465
|
+
const r = i(e);
|
|
466
|
+
return m.post("/".concat(t, "/list"), r);
|
|
467
|
+
},
|
|
468
|
+
postFileManagerOption: (t, e) => {
|
|
469
|
+
const r = i(e);
|
|
470
|
+
return m.post("/".concat(t, "/options"), r);
|
|
471
|
+
},
|
|
472
|
+
recoverFiles: (t, e) => m.put("/".concat(t, "/recover"), e),
|
|
473
|
+
deleteFiles: (t, e) => m.delete("/".concat(t), { params: e }),
|
|
474
|
+
deletePermanently: (t, e) => m.delete("/".concat(t, "/delete-permanent"), { params: e })
|
|
485
475
|
};
|
|
486
476
|
export {
|
|
487
477
|
J as AuthServices,
|
package/package.json
CHANGED
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
import { AxiosResponse } from 'axios';
|
|
2
|
-
import { FileManagerFilterParams, FileManagerOptionBoolean } from '../types/fileManager.type';
|
|
3
|
-
import { FetchOptionResponse } from '../types/fetchResponse.type';
|
|
2
|
+
import { FileManagerFilterParams, FileManagerOptionBoolean, FileType } from '../types/fileManager.type';
|
|
4
3
|
import { DeleteFileManagerDto } from '../dto/fileManager.dto';
|
|
5
4
|
declare const FileManagerServices: {
|
|
6
5
|
getStorageInformation: () => Promise<AxiosResponse>;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
deletePermanently: (params: DeleteFileManagerDto) => Promise<AxiosResponse>;
|
|
6
|
+
postFileManager: (type: FileType, params?: FileManagerFilterParams) => Promise<AxiosResponse>;
|
|
7
|
+
postFileManagerOption: (type: FileType, params?: FileManagerOptionBoolean) => Promise<AxiosResponse>;
|
|
8
|
+
recoverFiles: (type: FileType, body: object) => Promise<AxiosResponse>;
|
|
9
|
+
deleteFiles: (type: FileType, params: DeleteFileManagerDto) => Promise<AxiosResponse>;
|
|
10
|
+
deletePermanently: (type: FileType, params: DeleteFileManagerDto) => Promise<AxiosResponse>;
|
|
13
11
|
};
|
|
14
12
|
export default FileManagerServices;
|
|
@@ -1,40 +1,42 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export type FileType = 'attachment' | 'custom-field' | 'damage' | 'disposal' | 'maintenance-routine' | 'repair-ticketing' | 'recycle-bin';
|
|
1
|
+
import { MultiSelectOption } from './options.type';
|
|
2
|
+
export type FileType = 'attachment' | 'custom-field' | 'damage' | 'disposal' | 'maintenance-routine' | 'repair-ticketing' | 'planning-strategy' | 'recycle-bin' | 'user';
|
|
3
3
|
export type FileManagerType = {
|
|
4
4
|
_id: string;
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
assetName: string;
|
|
6
|
+
countdown: number;
|
|
7
|
+
createdAt: string;
|
|
8
8
|
fileFormat: string;
|
|
9
|
+
fileName: string;
|
|
10
|
+
filePath: string;
|
|
9
11
|
fileSize: string;
|
|
10
|
-
|
|
11
|
-
fileType?: FileType;
|
|
12
|
-
group?: string;
|
|
13
|
-
user?: string;
|
|
14
|
-
countdown?: number;
|
|
15
|
-
modifiedBy?: string;
|
|
16
|
-
createdAt: Date;
|
|
12
|
+
group: string;
|
|
17
13
|
hasSystemRole: {
|
|
18
14
|
documentDeletion: {
|
|
15
|
+
create: boolean;
|
|
19
16
|
delete: boolean;
|
|
17
|
+
update: boolean;
|
|
20
18
|
view: boolean;
|
|
21
19
|
};
|
|
22
20
|
};
|
|
21
|
+
modifiedBy: string;
|
|
22
|
+
transactionId: string;
|
|
23
23
|
};
|
|
24
24
|
export type FileManagerParams = {
|
|
25
25
|
isDeleted?: boolean;
|
|
26
26
|
createdAt?: number[];
|
|
27
|
-
|
|
27
|
+
group?: string[];
|
|
28
|
+
modifiedBy?: string[];
|
|
28
29
|
fileFormat?: string[];
|
|
29
30
|
assetName?: string[];
|
|
30
31
|
};
|
|
31
32
|
export type FileManagerFilterParams = Partial<Record<keyof FileManagerParams, string | boolean>>;
|
|
32
33
|
export type FileManagerOptionFilter = {
|
|
33
|
-
modifiedByOptions?:
|
|
34
|
-
fileFormatOptions?:
|
|
34
|
+
modifiedByOptions?: MultiSelectOption[];
|
|
35
|
+
fileFormatOptions?: MultiSelectOption[];
|
|
36
|
+
assetNameOptions?: MultiSelectOption[];
|
|
35
37
|
};
|
|
36
38
|
export type FileManagerOptionBoolean = {
|
|
37
39
|
modifiedByOptions?: boolean;
|
|
38
40
|
fileFormatOptions?: boolean;
|
|
39
|
-
|
|
41
|
+
assetNameOptions?: boolean;
|
|
40
42
|
};
|