@tagsamurai/gsts-api-services 2.0.1-alpha.45 → 2.0.1-alpha.46

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.
@@ -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: i = "",
5
+ prefix: n = "",
6
6
  headers: p = {},
7
7
  ...f
8
- } = t, U = "".concat(O(r)).concat(i), P = R.create({
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, $, D;
18
- const S = JSON.parse((T = localStorage.getItem("user")) != null ? T : "{}"), L = (D = ($ = S.jwt) != null ? $ : S.token) != null ? D : "";
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, i, p;
25
- return ((e = t.response) == null ? void 0 : e.status) === 401 || ((r = t.response) == null ? void 0 : r.status) === 500 || ((p = (i = t.response) == null ? void 0 : i.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);
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 i = new URL(O("APP_TAGSAMURAI_API") || "").origin;
54
- let p = t.startsWith("http") ? t : "".concat(i, "/file-storage/api/file/").concat(t.replace(/^\/+/, ""));
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, i;
61
+ var e, r, n;
62
62
  const t = JSON.parse((e = localStorage.getItem("user")) != null ? e : "{}");
63
- return (i = (r = t.jwt) != null ? r : t.token) != null ? i : "";
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 i = await r.arrayBuffer();
73
- return new Blob([i], {
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, i) => {
83
+ }, j = async (t, e, r, n) => {
84
84
  if (!t) return;
85
85
  const p = _(t, e, r);
86
- return i ? p : G(p);
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
- }, n = (t) => {
107
+ }, i = (t) => {
108
108
  if (!t)
109
109
  return {};
110
110
  const e = {};
111
111
  return Object.keys(t).forEach((r) => {
112
- const i = t[r];
113
- e[r] = N(i) ? JSON.parse(i.trim()) : i;
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 = n(t);
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 = n(t);
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 = n(t);
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 = n(t);
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 = n(t);
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 = n(t);
158
+ const e = i(t);
159
159
  return g.post("/all-tag/list", e);
160
160
  },
161
161
  getAllTAGOptions: (t) => {
162
- const e = n(t);
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 = n(t);
167
+ const e = i(t);
168
168
  return g.post("/not-paired-yet/list", e);
169
169
  },
170
170
  getNotPairedYetOptions: (t) => {
171
- const e = n(t);
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 = n(t);
179
+ const e = i(t);
180
180
  return g.post("/paired/list", e);
181
181
  },
182
182
  getPairedOptions: (t) => {
183
- const e = n(t);
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 = n(t);
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 = n({ ...t });
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 = n(t);
257
+ const e = i(t);
258
258
  return A.post("/tag-event-log/list", e);
259
259
  },
260
260
  getTAGEventlogOptions: (t) => {
261
- const e = n(t);
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 = n(t);
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 = n(t);
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, i]) => {
339
- i != null && e.append(r, i);
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 = n(t);
345
+ const e = i(t);
346
346
  return s.post("/users/list", e);
347
347
  },
348
348
  getGlobalUserOptions: (t) => {
349
- const e = n(t);
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(([i, p]) => {
360
- p != null && r.append(i, p);
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 = n(t);
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/general-settings"
461
+ prefix: "/utility/v2/file-manager"
462
462
  }), nt = {
463
463
  getStorageInformation: () => m.get("/files/storage"),
464
- getFileManager: (t) => {
465
- const e = n(t);
466
- return m.get("/user", e);
467
- },
468
- postFileManager: (t) => {
469
- const e = n(t);
470
- return m.post("/user/list", e);
471
- },
472
- postFileManagerOption: (t) => {
473
- const e = n(t);
474
- return m.post("/user/options", e);
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,6 +1,6 @@
1
1
  {
2
2
  "name": "@tagsamurai/gsts-api-services",
3
- "version": "2.0.1-alpha.45",
3
+ "version": "2.0.1-alpha.46",
4
4
  "author": "developer.tagsamurai",
5
5
  "description": "Global Settings Tag Samurai Services Library",
6
6
  "module": "./api-services.es.js",
@@ -1,3 +1,3 @@
1
1
  export type DeleteFileManagerDto = {
2
- id?: string;
2
+ ids?: string;
3
3
  };
@@ -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
- getFileManager: (params?: FileManagerFilterParams) => Promise<AxiosResponse>;
8
- postFileManager: (params?: FileManagerFilterParams) => Promise<AxiosResponse>;
9
- postFileManagerOption: (params?: FileManagerOptionBoolean) => Promise<AxiosResponse<FetchOptionResponse<FileManagerOptionBoolean>>>;
10
- recoverFiles: (body: object) => Promise<AxiosResponse>;
11
- deleteFiles: (params: DeleteFileManagerDto) => Promise<AxiosResponse>;
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,44 @@
1
- import { Option } from '../../node_modules/@fewangsit/wangsvue-gsts/dropdown';
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
- transactionId?: string;
6
- assetName?: string;
7
- fileName: string;
5
+ assetName: string;
6
+ countdown: number;
7
+ createdAt: string;
8
8
  fileFormat: string;
9
+ fileName: string;
10
+ filePath: string;
9
11
  fileSize: string;
10
- filePath?: string;
11
- fileType?: FileType;
12
- group?: string;
13
- user?: string;
14
- countdown?: number;
15
- modifiedBy?: string;
16
- createdAt: Date;
12
+ fileType: string;
13
+ group: string;
17
14
  hasSystemRole: {
18
15
  documentDeletion: {
16
+ create: boolean;
19
17
  delete: boolean;
18
+ update: boolean;
20
19
  view: boolean;
21
20
  };
22
21
  };
22
+ modifiedBy: string;
23
+ transactionId: string;
23
24
  };
24
25
  export type FileManagerParams = {
25
26
  isDeleted?: boolean;
26
27
  createdAt?: number[];
27
- modifiedBy?: number[];
28
+ group?: string[];
29
+ modifiedBy?: string[];
28
30
  fileFormat?: string[];
31
+ fileType?: string[];
29
32
  assetName?: string[];
30
33
  };
31
34
  export type FileManagerFilterParams = Partial<Record<keyof FileManagerParams, string | boolean>>;
32
35
  export type FileManagerOptionFilter = {
33
- modifiedByOptions?: Option[];
34
- fileFormatOptions?: Option[];
36
+ modifiedByOptions?: MultiSelectOption[];
37
+ fileFormatOptions?: MultiSelectOption[];
38
+ assetNameOptions?: MultiSelectOption[];
35
39
  };
36
40
  export type FileManagerOptionBoolean = {
37
41
  modifiedByOptions?: boolean;
38
42
  fileFormatOptions?: boolean;
39
- isDeleted?: boolean;
43
+ assetNameOptions?: boolean;
40
44
  };