@tagsamurai/gsts-api-services 2.0.1-alpha.2 → 2.0.1-alpha.3
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 +95 -86
- package/main.d.ts +1 -0
- package/package.json +1 -1
- package/src/dto/tablet.dto.d.ts +38 -0
- package/src/services/tablet.service.d.ts +10 -0
- package/src/types/tablet.type.d.ts +16 -0
package/api-services.es.js
CHANGED
|
@@ -1,34 +1,34 @@
|
|
|
1
1
|
import _ from "axios";
|
|
2
|
-
const
|
|
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" }, b = (t = "APP_TAGSAMURAI_API") => E["VITE_" + t], i = (t = {}, e = !1) => {
|
|
3
3
|
const {
|
|
4
4
|
env: r = "APP_GLOBAL_SETTINGS_API",
|
|
5
5
|
prefix: s = "",
|
|
6
|
-
headers:
|
|
6
|
+
headers: a = {},
|
|
7
7
|
...p
|
|
8
|
-
} = t, y = "".concat(
|
|
8
|
+
} = t, y = "".concat(b(r)).concat(s), f = _.create({
|
|
9
9
|
...p,
|
|
10
10
|
baseURL: y,
|
|
11
|
-
headers: e ?
|
|
11
|
+
headers: e ? a : {
|
|
12
12
|
"Content-Type": "application/json",
|
|
13
|
-
...
|
|
13
|
+
...a
|
|
14
14
|
}
|
|
15
15
|
});
|
|
16
|
-
return
|
|
17
|
-
var
|
|
18
|
-
const
|
|
19
|
-
return
|
|
20
|
-
}),
|
|
21
|
-
}, u =
|
|
16
|
+
return f.interceptors.request.use((v) => {
|
|
17
|
+
var h, S, $;
|
|
18
|
+
const P = JSON.parse((h = localStorage.getItem("user")) != null ? h : "{}"), O = ($ = (S = P.jwt) != null ? S : P.token) != null ? $ : "";
|
|
19
|
+
return v.headers.Authorization = "Bearer ".concat(O), v;
|
|
20
|
+
}), f;
|
|
21
|
+
}, u = i({
|
|
22
22
|
prefix: "/v1/global-settings/auth"
|
|
23
|
-
}),
|
|
24
|
-
var e, r, s,
|
|
25
|
-
return ((e = t.response) == null ? void 0 : e.status) === 401 || ((r = t.response) == null ? void 0 : r.status) === 500 || ((
|
|
26
|
-
},
|
|
23
|
+
}), w = (t) => {
|
|
24
|
+
var e, r, s, a;
|
|
25
|
+
return ((e = t.response) == null ? void 0 : e.status) === 401 || ((r = t.response) == null ? void 0 : r.status) === 500 || ((a = (s = t.response) == null ? void 0 : s.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
|
+
}, B = {
|
|
27
27
|
login: (t) => {
|
|
28
28
|
const e = { ...t, isMobile: !1 };
|
|
29
29
|
return u.post("/login", e);
|
|
30
30
|
},
|
|
31
|
-
reLogin: (t) => (u.interceptors.response.use((e) => e,
|
|
31
|
+
reLogin: (t) => (u.interceptors.response.use((e) => e, w), u.post("/login", t)),
|
|
32
32
|
requestOTP: (t) => {
|
|
33
33
|
const e = { email: t };
|
|
34
34
|
return u.post("/request-otp", e);
|
|
@@ -49,19 +49,19 @@ const b = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, SSR: !1, VITE_
|
|
|
49
49
|
* @deprecated use postLogout instead
|
|
50
50
|
*/
|
|
51
51
|
logout: () => u.post("/logout")
|
|
52
|
-
},
|
|
53
|
-
const s = new URL(
|
|
54
|
-
let
|
|
52
|
+
}, L = (t, e, r) => {
|
|
53
|
+
const s = new URL(b("APP_TAGSAMURAI_API") || "").origin;
|
|
54
|
+
let a = t.startsWith("http") ? t : "".concat(s, "/file-storage/api/file/").concat(t.replace(/^\/+/, ""));
|
|
55
55
|
if (e || r) {
|
|
56
56
|
const p = new URLSearchParams();
|
|
57
|
-
e && (p.set("width", e.toString()), p.set("height", (r == null ? void 0 : r.toString()) || e.toString())),
|
|
57
|
+
e && (p.set("width", e.toString()), p.set("height", (r == null ? void 0 : r.toString()) || e.toString())), a += "?".concat(p.toString());
|
|
58
58
|
}
|
|
59
|
-
return
|
|
60
|
-
},
|
|
59
|
+
return a;
|
|
60
|
+
}, R = () => {
|
|
61
61
|
var e, r, s;
|
|
62
62
|
const t = JSON.parse((e = localStorage.getItem("user")) != null ? e : "{}");
|
|
63
63
|
return (s = (r = t.jwt) != null ? r : t.token) != null ? s : "";
|
|
64
|
-
},
|
|
64
|
+
}, G = async (t, e) => {
|
|
65
65
|
const r = await fetch(t, {
|
|
66
66
|
headers: {
|
|
67
67
|
Authorization: "Bearer ".concat(e)
|
|
@@ -73,18 +73,18 @@ const b = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, SSR: !1, VITE_
|
|
|
73
73
|
return new Blob([s], {
|
|
74
74
|
type: r.headers.get("Content-Type") || "image/webp"
|
|
75
75
|
});
|
|
76
|
-
},
|
|
76
|
+
}, U = async (t) => {
|
|
77
77
|
try {
|
|
78
|
-
const e =
|
|
78
|
+
const e = R(), r = await G(t, e);
|
|
79
79
|
return URL.createObjectURL(r);
|
|
80
80
|
} catch (e) {
|
|
81
81
|
return;
|
|
82
82
|
}
|
|
83
|
-
},
|
|
83
|
+
}, k = async (t, e, r, s) => {
|
|
84
84
|
if (!t) return;
|
|
85
|
-
const
|
|
86
|
-
return s ?
|
|
87
|
-
},
|
|
85
|
+
const a = L(t, e, r);
|
|
86
|
+
return s ? a : U(a);
|
|
87
|
+
}, j = (t) => {
|
|
88
88
|
if (!t || typeof t == "string")
|
|
89
89
|
return;
|
|
90
90
|
const e = {};
|
|
@@ -95,7 +95,7 @@ const b = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, SSR: !1, VITE_
|
|
|
95
95
|
[r]: t[r]
|
|
96
96
|
});
|
|
97
97
|
}), e;
|
|
98
|
-
},
|
|
98
|
+
}, x = (t) => {
|
|
99
99
|
if (typeof t != "string") return !1;
|
|
100
100
|
const e = t.trim();
|
|
101
101
|
if (!e) return !1;
|
|
@@ -104,33 +104,33 @@ const b = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, SSR: !1, VITE_
|
|
|
104
104
|
} catch (r) {
|
|
105
105
|
return !1;
|
|
106
106
|
}
|
|
107
|
-
},
|
|
107
|
+
}, T = (t) => {
|
|
108
108
|
if (!t)
|
|
109
109
|
return {};
|
|
110
110
|
const e = {};
|
|
111
111
|
return Object.keys(t).forEach((r) => {
|
|
112
112
|
const s = t[r];
|
|
113
|
-
e[r] =
|
|
113
|
+
e[r] = x(s) ? JSON.parse(s.trim()) : s;
|
|
114
114
|
}), e;
|
|
115
|
-
},
|
|
115
|
+
}, m = i({
|
|
116
116
|
prefix: "/v1/global-settings/change-log"
|
|
117
|
-
}), j = {
|
|
118
|
-
getChangelogs: (t) => I.get("", { params: t }),
|
|
119
|
-
getChangelogOptions: (t) => I.get("/options", { params: t })
|
|
120
|
-
}, c = a({
|
|
121
|
-
prefix: "/v1/global-settings/division"
|
|
122
117
|
}), J = {
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
118
|
+
getChangelogs: (t) => m.get("", { params: t }),
|
|
119
|
+
getChangelogOptions: (t) => m.get("/options", { params: t })
|
|
120
|
+
}, l = i({
|
|
121
|
+
prefix: "/v1/global-settings/division"
|
|
122
|
+
}), M = {
|
|
123
|
+
getDivisions: (t) => l.get("", { params: t }),
|
|
124
|
+
getDivisionDetail: (t) => l.get("/".concat(t)),
|
|
125
|
+
postCreateDivision: (t) => l.post("/", t),
|
|
126
|
+
putEditDivision: (t, e) => l.put("/".concat(t), e),
|
|
127
127
|
deleteDivisions: (t) => {
|
|
128
128
|
const e = { id: JSON.stringify(t) };
|
|
129
|
-
return
|
|
129
|
+
return l.delete("", { params: e });
|
|
130
130
|
}
|
|
131
|
-
}, g =
|
|
131
|
+
}, g = i({
|
|
132
132
|
prefix: "/v1/global-settings"
|
|
133
|
-
}),
|
|
133
|
+
}), H = {
|
|
134
134
|
getTAGAllPaired: (t, e) => g.get("/".concat(t), { params: e }),
|
|
135
135
|
getTAGAllPairedOptions: (t, e) => g.get("/".concat(t, "/options"), { params: e }),
|
|
136
136
|
getTAGNotPaired: (t, e) => g.get("/".concat(t, "/not-paired"), { params: e }),
|
|
@@ -140,16 +140,16 @@ const b = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, SSR: !1, VITE_
|
|
|
140
140
|
putAuditTAG: (t, e) => g.put("/".concat(t, "/audit"), e),
|
|
141
141
|
putAllocateTAG: (t, e) => g.put("/".concat(t, "/allocate"), e),
|
|
142
142
|
putCombineTAG: (t) => g.put("/combine", t)
|
|
143
|
-
}, n =
|
|
143
|
+
}, n = i({
|
|
144
144
|
prefix: "/v2/hardware-tagging"
|
|
145
|
-
}),
|
|
145
|
+
}), V = {
|
|
146
146
|
getHandheldReader: (t) => {
|
|
147
|
-
const e =
|
|
147
|
+
const e = T(t);
|
|
148
148
|
return n.post("/handheld-reader/list", e);
|
|
149
149
|
},
|
|
150
150
|
getHandheldReaderDetail: (t) => n.get("/handheld-reader/".concat(t)),
|
|
151
151
|
getHandheldReaderOptions: (t) => {
|
|
152
|
-
const e =
|
|
152
|
+
const e = T(t);
|
|
153
153
|
return n.post("/handheld-reader/options", e);
|
|
154
154
|
},
|
|
155
155
|
putMarkHandheldStatus: (t) => n.patch("/handheld-reader/status", t),
|
|
@@ -182,41 +182,41 @@ const b = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, SSR: !1, VITE_
|
|
|
182
182
|
getDetailActivityLogOptions: (t) => n.get("/activity-log/options", { params: t }),
|
|
183
183
|
getExistingAliasNames: () => n.get("/reader/alias-names"),
|
|
184
184
|
getIotReaderPort: (t, e) => n.get("/iot-reader/".concat(t, "/ports"), { params: e })
|
|
185
|
-
}, D =
|
|
185
|
+
}, D = i({
|
|
186
186
|
env: "APP_LOGS_NOTIFICATION_API",
|
|
187
187
|
prefix: "/v2"
|
|
188
|
-
}),
|
|
188
|
+
}), q = {
|
|
189
189
|
getSessionLogList: (t) => D.get("/session-log", { params: t })
|
|
190
|
-
},
|
|
190
|
+
}, I = i({
|
|
191
191
|
prefix: "/v1/global-settings/option"
|
|
192
|
-
}), q = {
|
|
193
|
-
getPositions: () => m.get("/position"),
|
|
194
|
-
getDivisions: () => m.get("/division")
|
|
195
|
-
}, l = a({
|
|
196
|
-
prefix: "/v1/global-settings/position"
|
|
197
192
|
}), F = {
|
|
198
|
-
getPositions: (
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
193
|
+
getPositions: () => I.get("/position"),
|
|
194
|
+
getDivisions: () => I.get("/division")
|
|
195
|
+
}, c = i({
|
|
196
|
+
prefix: "/v1/global-settings/position"
|
|
197
|
+
}), z = {
|
|
198
|
+
getPositions: (t) => c.get("", { params: t }),
|
|
199
|
+
getPositionDetail: (t) => c.get("/".concat(t)),
|
|
200
|
+
postCreatePosition: (t) => c.post("/", t),
|
|
201
|
+
putEditPosition: (t, e) => c.put("/".concat(t), e),
|
|
202
202
|
deletePositions: (t) => {
|
|
203
203
|
const e = { id: JSON.stringify(t) };
|
|
204
|
-
return
|
|
204
|
+
return c.delete("", { params: e });
|
|
205
205
|
}
|
|
206
|
-
},
|
|
206
|
+
}, C = i({
|
|
207
207
|
env: "APP_TAGSAMURAI_API",
|
|
208
208
|
prefix: "/tag/v2"
|
|
209
|
-
}), z = {
|
|
210
|
-
getTagInfo: (t) => x.get("/rfid-qr/scan", { params: t })
|
|
211
|
-
}, d = a({
|
|
212
|
-
prefix: "/v1/global-settings/change-log"
|
|
213
209
|
}), W = {
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
}, o = a({
|
|
218
|
-
prefix: "/v1/global-settings/user"
|
|
210
|
+
getTagInfo: (t) => C.get("/rfid-qr/scan", { params: t })
|
|
211
|
+
}, A = i({
|
|
212
|
+
prefix: "/v1/global-settings/change-log"
|
|
219
213
|
}), K = {
|
|
214
|
+
getTAGEventlog: (t) => A.get("/tag-event-log", { params: t }),
|
|
215
|
+
getTAGEventlogOptions: (t) => A.get("/tag-event-log/options", { params: t }),
|
|
216
|
+
getDetailTAGEventlog: (t) => A.get("/tag-event-log/".concat(t))
|
|
217
|
+
}, o = i({
|
|
218
|
+
prefix: "/v1/global-settings/user"
|
|
219
|
+
}), Q = {
|
|
220
220
|
getUsers: (t) => o.get("", { params: t }),
|
|
221
221
|
getUserDetail: (t) => o.get("/".concat(t)),
|
|
222
222
|
getUserSystemLogs: (t, e) => o.get("/".concat(t, "/system-logs"), { params: e }),
|
|
@@ -244,20 +244,29 @@ const b = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, SSR: !1, VITE_
|
|
|
244
244
|
deleteCancelEmailChange: (t) => o.delete("/cancel-email-change/".concat(t)),
|
|
245
245
|
postResendEmail: (t) => o.post("/resend-email", t),
|
|
246
246
|
putChangePassword: (t, e) => o.put("/change-password/".concat(t), e)
|
|
247
|
+
}, d = i({
|
|
248
|
+
prefix: "/v2/hardware-tagging"
|
|
249
|
+
}), X = {
|
|
250
|
+
getTabletList: (t) => d.post("/tablet/list", t),
|
|
251
|
+
getTabletOption: (t) => d.post("/tablet/options", t),
|
|
252
|
+
updateTabletStatus: (t, e) => d.patch("/tablet/status", e, { params: { ids: t } }),
|
|
253
|
+
disconnectTablet: (t) => d.patch("/tablet/disconnect-reader", { params: { ids: t } }),
|
|
254
|
+
deleteTablet: (t) => d.delete("/tablet", { params: { ids: t } })
|
|
247
255
|
};
|
|
248
256
|
export {
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
k as
|
|
257
|
+
B as AuthServices,
|
|
258
|
+
J as ChangelogServices,
|
|
259
|
+
M as DivisionServices,
|
|
260
|
+
H as GlobalTagServices,
|
|
261
|
+
V as HardwareServices,
|
|
262
|
+
q as LogServices,
|
|
263
|
+
F as OptionServices,
|
|
264
|
+
z as PositionServices,
|
|
265
|
+
X as TabletServices,
|
|
266
|
+
K as TagEventlogServices,
|
|
267
|
+
W as TagServices,
|
|
268
|
+
Q as UserServices,
|
|
269
|
+
b as getBaseURL,
|
|
270
|
+
k as getImageURL,
|
|
271
|
+
j as queryParamsStringfy
|
|
263
272
|
};
|
package/main.d.ts
CHANGED
|
@@ -9,4 +9,5 @@ export { default as PositionServices } from './src/services/position.service';
|
|
|
9
9
|
export { default as TagServices } from './src/services/tag.service';
|
|
10
10
|
export { default as TagEventlogServices } from './src/services/tagEventlog.service';
|
|
11
11
|
export { default as UserServices } from './src/services/user.service';
|
|
12
|
+
export { default as TabletServices } from './src/services/tablet.service';
|
|
12
13
|
export { getBaseURL, getImageURL, queryParamsStringfy } from './src/utils';
|
package/package.json
CHANGED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { FetchDetailResponse, FetchResponse } from '../types/fetchResponse.type';
|
|
2
|
+
import { MultiSelectOption } from '../types/options.type';
|
|
3
|
+
import { Tab, Tablet } from '../types/tablet.type';
|
|
4
|
+
export interface GetTabletListQuery {
|
|
5
|
+
tab?: Tab;
|
|
6
|
+
page?: number;
|
|
7
|
+
limit?: number;
|
|
8
|
+
sortBy?: string;
|
|
9
|
+
sortOrder?: number;
|
|
10
|
+
search?: string;
|
|
11
|
+
column?: string[];
|
|
12
|
+
deviceName?: string[];
|
|
13
|
+
status?: string[];
|
|
14
|
+
group?: string[];
|
|
15
|
+
reader?: string[];
|
|
16
|
+
registeredAt?: number[];
|
|
17
|
+
reportedBy?: string[];
|
|
18
|
+
reportedAt?: number[];
|
|
19
|
+
}
|
|
20
|
+
export type GetTabletListResponse = FetchDetailResponse<Tablet>;
|
|
21
|
+
export interface GetTabletOptionsQuery {
|
|
22
|
+
tab?: Tab;
|
|
23
|
+
statusOptions?: boolean;
|
|
24
|
+
deviceNameOptions?: boolean;
|
|
25
|
+
readerOptions?: boolean;
|
|
26
|
+
reportedByOptions?: boolean;
|
|
27
|
+
}
|
|
28
|
+
export type GetTabletOptionsResponse = FetchResponse & {
|
|
29
|
+
data: {
|
|
30
|
+
deviceNameOptions: MultiSelectOption[];
|
|
31
|
+
readerOptions: MultiSelectOption[];
|
|
32
|
+
statusOptions: MultiSelectOption[];
|
|
33
|
+
reportedByOptions: MultiSelectOption[];
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
export interface UpdateTabletStatusBody {
|
|
37
|
+
status?: Tab;
|
|
38
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { GetTabletListQuery, GetTabletListResponse, GetTabletOptionsQuery, GetTabletOptionsResponse, UpdateTabletStatusBody } from '../dto/tablet.dto';
|
|
2
|
+
import { AxiosResponse } from 'axios';
|
|
3
|
+
declare const TabletServices: {
|
|
4
|
+
getTabletList: (body: GetTabletListQuery) => Promise<AxiosResponse<GetTabletListResponse>>;
|
|
5
|
+
getTabletOption: (body: GetTabletOptionsQuery) => Promise<AxiosResponse<GetTabletOptionsResponse>>;
|
|
6
|
+
updateTabletStatus: (ids: string, body: UpdateTabletStatusBody) => Promise<AxiosResponse>;
|
|
7
|
+
disconnectTablet: (ids: string) => Promise<AxiosResponse>;
|
|
8
|
+
deleteTablet: (ids: string) => Promise<AxiosResponse>;
|
|
9
|
+
};
|
|
10
|
+
export default TabletServices;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export type Tab = 'Available' | 'Damaged/Missing';
|
|
2
|
+
export interface Tablet {
|
|
3
|
+
_id: string;
|
|
4
|
+
deviceName: string;
|
|
5
|
+
deviceId: string;
|
|
6
|
+
status: string;
|
|
7
|
+
group: {
|
|
8
|
+
fixedAsset: string | null;
|
|
9
|
+
supplyAsset: string | null;
|
|
10
|
+
};
|
|
11
|
+
reader: string | null;
|
|
12
|
+
aliasName: string | null;
|
|
13
|
+
registeredAt: string;
|
|
14
|
+
reportedBy: string | null;
|
|
15
|
+
reportedAt: string | null;
|
|
16
|
+
}
|