@tagsamurai/gsts-api-services 2.0.1-alpha.26 → 2.0.1-alpha.28

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 U = { 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" }, I = (t = "APP_TAGSAMURAI_API") => U["VITE_" + t], p = (t = {}, e = !1) => {
3
3
  const {
4
4
  env: r = "APP_GLOBAL_SETTINGS_API",
5
- prefix: o = "",
5
+ prefix: n = "",
6
6
  headers: a = {},
7
7
  ...l
8
- } = t, w = "".concat(I(r)).concat(o), A = R.create({
8
+ } = t, w = "".concat(I(r)).concat(n), h = R.create({
9
9
  ...l,
10
10
  baseURL: w,
11
11
  headers: e ? a : {
@@ -13,16 +13,16 @@ const U = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, SSR: !1, VITE_
13
13
  ...a
14
14
  }
15
15
  });
16
- return A.interceptors.request.use((h) => {
16
+ return h.interceptors.request.use((A) => {
17
17
  var S, y, $;
18
18
  const P = JSON.parse((S = localStorage.getItem("user")) != null ? S : "{}"), O = ($ = (y = P.jwt) != null ? y : P.token) != null ? $ : "";
19
- return h.headers.Authorization = "Bearer ".concat(O), h;
20
- }), A;
19
+ return A.headers.Authorization = "Bearer ".concat(O), A;
20
+ }), h;
21
21
  }, c = p({
22
22
  prefix: "/v1/global-settings/auth"
23
23
  }), E = (t) => {
24
- var e, r, o, a;
25
- return ((e = t.response) == null ? void 0 : e.status) === 401 || ((r = t.response) == null ? void 0 : r.status) === 500 || ((a = (o = t.response) == null ? void 0 : o.data) == null ? void 0 : a.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, a;
25
+ return ((e = t.response) == null ? void 0 : e.status) === 401 || ((r = t.response) == null ? void 0 : r.status) === 500 || ((a = (n = t.response) == null ? void 0 : n.data) == null ? void 0 : a.message) === "jwt malformed" ? (window.onblur = null, window.onfocus = null, window.sessionExpired = !0, window.dispatchEvent(new CustomEvent("user:expired"))) : Promise.reject(t);
26
26
  }, k = {
27
27
  login: (t) => {
28
28
  const e = { ...t, isMobile: !1 };
@@ -50,17 +50,17 @@ const U = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, SSR: !1, VITE_
50
50
  */
51
51
  logout: () => c.post("/logout")
52
52
  }, L = (t, e, r) => {
53
- const o = new URL(I("APP_TAGSAMURAI_API") || "").origin;
54
- let a = t.startsWith("http") ? t : "".concat(o, "/file-storage/api/file/").concat(t.replace(/^\/+/, ""));
53
+ const n = new URL(I("APP_TAGSAMURAI_API") || "").origin;
54
+ let a = t.startsWith("http") ? t : "".concat(n, "/file-storage/api/file/").concat(t.replace(/^\/+/, ""));
55
55
  if (e || r) {
56
56
  const l = new URLSearchParams();
57
57
  e && (l.set("width", e.toString()), l.set("height", (r == null ? void 0 : r.toString()) || e.toString())), a += "?".concat(l.toString());
58
58
  }
59
59
  return a;
60
60
  }, _ = () => {
61
- var e, r, o;
61
+ var e, r, n;
62
62
  const t = JSON.parse((e = localStorage.getItem("user")) != null ? e : "{}");
63
- return (o = (r = t.jwt) != null ? r : t.token) != null ? o : "";
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 U = { 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 o = await r.arrayBuffer();
73
- return new Blob([o], {
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
  }, C = async (t) => {
@@ -80,10 +80,10 @@ const U = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, SSR: !1, VITE_
80
80
  } catch (e) {
81
81
  return;
82
82
  }
83
- }, H = async (t, e, r, o) => {
83
+ }, H = async (t, e, r, n) => {
84
84
  if (!t) return;
85
85
  const a = L(t, e, r);
86
- return o ? a : C(a);
86
+ return n ? a : C(a);
87
87
  }, J = (t) => {
88
88
  if (!t || typeof t == "string")
89
89
  return;
@@ -109,14 +109,17 @@ const U = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, SSR: !1, VITE_
109
109
  return {};
110
110
  const e = {};
111
111
  return Object.keys(t).forEach((r) => {
112
- const o = t[r];
113
- e[r] = G(o) ? JSON.parse(o.trim()) : o;
112
+ const n = t[r];
113
+ e[r] = G(n) ? JSON.parse(n.trim()) : n;
114
114
  }), e;
115
115
  }, T = p({
116
- prefix: "/v1/global-settings/change-log"
116
+ prefix: "v2/analytics-reporting"
117
117
  }), j = {
118
- getChangelogs: (t) => T.get("", { params: t }),
119
- getChangelogOptions: (t) => T.get("/options", { params: t })
118
+ getChangelogs: (t) => {
119
+ const e = u(t);
120
+ return T.post("/change-log/list", e);
121
+ },
122
+ getChangelogOptions: (t) => T.post("/change-log/options", t)
120
123
  }, m = p({
121
124
  prefix: "/v1/global-settings/division"
122
125
  }), B = {
@@ -161,46 +164,46 @@ const U = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, SSR: !1, VITE_
161
164
  return g.post("/paired/options", e);
162
165
  },
163
166
  getScanTag: (t) => g.get("/scan-tag", { params: { tag: t } })
164
- }, n = p({
167
+ }, o = p({
165
168
  prefix: "/v2/hardware-tagging"
166
169
  }), V = {
167
170
  getHandheldReader: (t) => {
168
171
  const e = u(t);
169
- return n.post("/handheld-reader/list", e);
170
- },
171
- getHandheldReaderDetail: (t) => n.get("/handheld-reader/".concat(t)),
172
- getHandheldReaderOptions: (t) => n.post("/handheld-reader/options", t),
173
- putMarkHandheldStatus: (t, e, r) => n.patch("/".concat(t, "/status"), r, { params: e }),
174
- postPingReaders: (t) => n.post("/iot-reader/ping", t),
175
- putMarkIOTStatus: (t, e) => n.put("/".concat(e, "/mark-status"), t),
176
- putEditReaderGroup: (t, e, r) => n.patch("/".concat(t, "-reader/").concat(r, "/group"), e),
177
- putEditAntennaGroup: (t, e) => n.put("/iot-reader/".concat(e, "/set-port-group"), t),
178
- putEditPortStatus: (t, e) => n.put("/iot-reader/".concat(e, "/set-port-status"), t),
179
- putEditAliasName: (t, e, r) => n.patch("/".concat(t, "-reader/").concat(r, "/alias-name"), e),
180
- postActivateHardware: (t, e) => n.post("/".concat(t, "-reader/activate"), e),
181
- deleteHardware: (t, e) => n.delete("/".concat(t, "-reader"), {
172
+ return o.post("/handheld-reader/list", e);
173
+ },
174
+ getHandheldReaderDetail: (t) => o.get("/handheld-reader/".concat(t)),
175
+ getHandheldReaderOptions: (t) => o.post("/handheld-reader/options", t),
176
+ putMarkHandheldStatus: (t, e, r) => o.patch("/".concat(t, "/status"), r, { params: e }),
177
+ postPingReaders: (t) => o.post("/iot-reader/ping", t),
178
+ putMarkIOTStatus: (t, e) => o.put("/".concat(e, "/mark-status"), t),
179
+ putEditReaderGroup: (t, e, r) => o.patch("/".concat(t, "-reader/").concat(r, "/group"), e),
180
+ putEditAntennaGroup: (t, e) => o.put("/iot-reader/".concat(e, "/set-port-group"), t),
181
+ putEditPortStatus: (t, e) => o.put("/iot-reader/".concat(e, "/set-port-status"), t),
182
+ putEditAliasName: (t, e, r) => o.patch("/".concat(t, "-reader/").concat(r, "/alias-name"), e),
183
+ postActivateHardware: (t, e) => o.post("/".concat(t, "-reader/activate"), e),
184
+ deleteHardware: (t, e) => o.delete("/".concat(t, "-reader"), {
182
185
  params: e
183
186
  }),
184
- putAntennaPower: (t, e) => n.put("/iot-reader/".concat(e, "/set-antenna-power"), t),
187
+ putAntennaPower: (t, e) => o.put("/iot-reader/".concat(e, "/set-antenna-power"), t),
185
188
  getIotReader: (t) => {
186
189
  const e = u({ ...t });
187
- return n.post("/iot-reader", e);
188
- },
189
- getIotReaderDetail: (t) => n.get("/iot-reader/".concat(t)),
190
- getIotReaderOptions: (t) => n.post("/iot-reader/options", t),
191
- getIotReaderPort: (t, e) => n.post("/iot-reader/".concat(t, "/port/list"), { params: e }),
192
- getIotReaderTablet: (t, e) => n.post("/iot-reader/".concat(t, "/tablet/list"), { params: e }),
193
- getIotReaderTabletOptions: (t, e) => n.post("/iot-reader/".concat(t, "/tablet/options"), e),
194
- putEditIotReader: (t, e) => n.patch("/iot-reader/".concat(t), e),
195
- disconnectIotTablet: (t, e) => n.delete("/iot-reader/".concat(t, "/tablet"), {
190
+ return o.post("/iot-reader", e);
191
+ },
192
+ getIotReaderDetail: (t) => o.get("/iot-reader/".concat(t)),
193
+ getIotReaderOptions: (t) => o.post("/iot-reader/options", t),
194
+ getIotReaderPort: (t, e) => o.post("/iot-reader/".concat(t, "/port/list"), { params: e }),
195
+ getIotReaderTablet: (t, e) => o.post("/iot-reader/".concat(t, "/tablet/list"), { params: e }),
196
+ getIotReaderTabletOptions: (t, e) => o.post("/iot-reader/".concat(t, "/tablet/options"), e),
197
+ putEditIotReader: (t, e) => o.patch("/iot-reader/".concat(t), e),
198
+ disconnectIotTablet: (t, e) => o.delete("/iot-reader/".concat(t, "/tablet"), {
196
199
  data: e
197
200
  }),
198
201
  // TODO: Activity API spec not finished yet
199
- getActivityLog: (t) => n.get("/activity-log", { params: t }),
200
- getActivityLogOptions: (t) => n.get("/activity-log/options", { params: t }),
201
- getDetailActivityLog: (t) => n.get("/activity-log", { params: t }),
202
- getDetailActivityLogOptions: (t) => n.get("/activity-log/options", { params: t }),
203
- getExistingAliasNames: () => n.get("/reader/alias-names")
202
+ getActivityLog: (t) => o.get("/activity-log", { params: t }),
203
+ getActivityLogOptions: (t) => o.get("/activity-log/options", { params: t }),
204
+ getDetailActivityLog: (t) => o.get("/activity-log", { params: t }),
205
+ getDetailActivityLogOptions: (t) => o.get("/activity-log/options", { params: t }),
206
+ getExistingAliasNames: () => o.get("/reader/alias-names")
204
207
  }, N = p({
205
208
  env: "APP_LOGS_NOTIFICATION_API",
206
209
  prefix: "/v2"
@@ -312,8 +315,8 @@ const U = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, SSR: !1, VITE_
312
315
  },
313
316
  createUsers: (t) => {
314
317
  const e = new FormData();
315
- return Object.entries(t).forEach(([r, o]) => {
316
- o != null && e.append(r, o);
318
+ return Object.entries(t).forEach(([r, n]) => {
319
+ n != null && e.append(r, n);
317
320
  }), s.post("/users", e, {
318
321
  headers: { "Content-Type": "multipart/form-data" }
319
322
  });
@@ -333,8 +336,8 @@ const U = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, SSR: !1, VITE_
333
336
  },
334
337
  editUsers: (t, e) => {
335
338
  const r = new FormData();
336
- return Object.entries(e).forEach(([o, a]) => {
337
- a != null && r.append(o, a);
339
+ return Object.entries(e).forEach(([n, a]) => {
340
+ a != null && r.append(n, a);
338
341
  }), s.patch("/users/".concat(t), r, {
339
342
  headers: { "Content-Type": "multipart/form-data" }
340
343
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tagsamurai/gsts-api-services",
3
- "version": "2.0.1-alpha.26",
3
+ "version": "2.0.1-alpha.28",
4
4
  "author": "developer.tagsamurai",
5
5
  "description": "Global Settings Tag Samurai Services Library",
6
6
  "module": "./api-services.es.js",
@@ -1,22 +1,32 @@
1
+ import { TableParams } from '../types/dataTable.type';
1
2
  import { ChangelogType } from '../types/changelog.type';
2
3
  import { FetchListResponse, FetchOptionResponse } from '../types/fetchResponse.type';
3
- import { FilterOptions } from './dataTable.dto';
4
4
  export type ChangelogResponse = FetchListResponse<ChangelogType>;
5
- export type ChangelogOptionResponse = FetchOptionResponse<FilterOptions>;
6
- export type ChangelogFilterQuery = {
7
- object?: string;
8
- objectName?: string;
9
- field?: string;
10
- action?: string;
11
- modifiedBy?: string;
12
- createdAt?: string;
5
+ export type ChangelogOptionResponse = FetchOptionResponse<ChangelogOptionFilter>;
6
+ export interface ChangelogFilterQuery extends TableParams {
7
+ objects?: string[];
8
+ objectName?: string[];
9
+ field?: string[];
10
+ action?: string[];
11
+ modifiedBy?: string[];
12
+ createdAt?: number[];
13
13
  userId?: string;
14
14
  modifiedById?: string;
15
- };
16
- export type ChangelogOptionQuery = {
15
+ objectId?: string;
16
+ module?: string;
17
+ activityLog?: boolean;
18
+ }
19
+ export type ChangelogOptionFilter = {
17
20
  actionOptions?: boolean;
18
21
  modifiedByOptions?: boolean;
19
22
  fieldOptions?: boolean;
20
23
  objectNameOptions?: boolean;
21
- object?: string;
24
+ objectOptions?: boolean;
22
25
  };
26
+ export interface ChangelogOptionQuery extends ChangelogOptionFilter {
27
+ module?: string;
28
+ objects?: string[];
29
+ objectId?: string;
30
+ userId?: string;
31
+ activityLog?: boolean;
32
+ }
@@ -78,8 +78,6 @@ export interface DeleteHardware {
78
78
  export interface PutEditReaderGroup {
79
79
  fixedAssetGroup?: string;
80
80
  supplyAssetGroup?: string;
81
- receivingFixedAssetGroup?: string[];
82
- receivingSupplyAssetGroup?: string[];
83
81
  }
84
82
  export interface PutEditIotReader {
85
83
  antennaPower: number[];
@@ -110,7 +108,7 @@ export interface SmartFixedReaderGroup {
110
108
  supplyAsset?: string;
111
109
  }
112
110
  export interface PutEditAntennaGroup {
113
- group: Omit<PutEditReaderGroup, 'receivingFixedAssetGroup' | 'receivingSupplyAssetGroup'>[];
111
+ group: PutEditReaderGroup[];
114
112
  }
115
113
  export interface PutEditAntennaPower {
116
114
  power: number[];
@@ -1,7 +1,10 @@
1
1
  import { AxiosResponse } from 'axios';
2
2
  import { ChangelogFilterQuery, ChangelogOptionQuery, ChangelogOptionResponse, ChangelogResponse } from '../dto/changelog.dto';
3
+ import { FilterQuery } from '../types/fetchResponse.type';
3
4
  declare const ChangelogServices: {
4
- getChangelogs: (params?: ChangelogFilterQuery) => Promise<AxiosResponse<ChangelogResponse>>;
5
- getChangelogOptions: (params?: ChangelogOptionQuery) => Promise<AxiosResponse<ChangelogOptionResponse>>;
5
+ getChangelogs: (params?: FilterQuery<ChangelogFilterQuery>) => Promise<AxiosResponse<ChangelogResponse>>;
6
+ getChangelogOptions: (body?: ChangelogOptionQuery) => Promise<AxiosResponse<{
7
+ data: ChangelogOptionResponse;
8
+ }>>;
6
9
  };
7
10
  export default ChangelogServices;
@@ -1,21 +1,12 @@
1
- import { Option } from '../../node_modules/@fewangsit/wangsvue-gsts/dropdown';
2
1
  export type ChangelogType = {
3
2
  _id: string;
4
3
  action: string;
5
- field: string;
4
+ field?: string;
6
5
  oldValue?: string;
7
6
  newValue?: string;
8
- modifiedBy?: string;
9
- modifiedById?: string;
7
+ modifiedBy: string;
10
8
  object: string;
11
- objectId: string;
12
9
  objectName: string;
13
10
  createdAt: string;
14
11
  updatedAt: string;
15
12
  };
16
- export type ChangelogOptionFilter = {
17
- actionOptions?: Option[];
18
- modifiedByOptions?: Option[];
19
- fieldOptions?: Option[];
20
- objectNameOptions?: Option[];
21
- };