wcz-test 6.7.5 → 6.7.7
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/dist/Approval-CWQn-kah.d.cts +284 -0
- package/dist/FileMeta-CC014fnB.d.cts +18 -0
- package/dist/client-utils.cjs +118 -0
- package/dist/client-utils.cjs.map +1 -0
- package/dist/client-utils.d.cts +704 -0
- package/dist/client-utils.d.ts +28 -30
- package/dist/components.cjs +802 -0
- package/dist/components.cjs.map +1 -0
- package/dist/components.d.cts +89 -0
- package/dist/hooks.cjs +534 -0
- package/dist/hooks.cjs.map +1 -0
- package/dist/hooks.d.cts +160 -0
- package/dist/index.cjs +3373 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +36 -0
- package/dist/models.cjs +330 -0
- package/dist/models.cjs.map +1 -0
- package/dist/models.d.cts +161 -0
- package/dist/queries.cjs +706 -0
- package/dist/queries.cjs.map +1 -0
- package/dist/queries.d.cts +1585 -0
- package/dist/server-utils.cjs +145 -0
- package/dist/server-utils.cjs.map +1 -0
- package/dist/server-utils.d.cts +36 -0
- package/dist/utils-ChipkRJ9.d.cts +49 -0
- package/dist/utils.cjs +81 -0
- package/dist/utils.cjs.map +1 -0
- package/dist/utils.d.cts +4 -0
- package/dist/vite.cjs +94 -0
- package/dist/vite.cjs.map +1 -0
- package/dist/vite.d.cts +5 -0
- package/package.json +20 -11
package/dist/queries.cjs
ADDED
|
@@ -0,0 +1,706 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// src/queries.ts
|
|
31
|
+
var queries_exports = {};
|
|
32
|
+
__export(queries_exports, {
|
|
33
|
+
approveApproval: () => approveApproval,
|
|
34
|
+
cancelApproval: () => cancelApproval,
|
|
35
|
+
createApproval: () => createApproval,
|
|
36
|
+
getApproval: () => getApproval,
|
|
37
|
+
getApprovals: () => getApprovals,
|
|
38
|
+
resubmitApproval: () => resubmitApproval,
|
|
39
|
+
useApproveApproval: () => useApproveApproval,
|
|
40
|
+
useCancelApproval: () => useCancelApproval,
|
|
41
|
+
useCreateApproval: () => useCreateApproval,
|
|
42
|
+
useDeleteFile: () => useDeleteFile,
|
|
43
|
+
useDeleteFiles: () => useDeleteFiles,
|
|
44
|
+
useDownloadFile: () => useDownloadFile,
|
|
45
|
+
useGetApproval: () => useGetApproval,
|
|
46
|
+
useGetApprovals: () => useGetApprovals,
|
|
47
|
+
useGetFile: () => useGetFile,
|
|
48
|
+
useGetFileMetas: () => useGetFileMetas,
|
|
49
|
+
useGetFileThumbnail: () => useGetFileThumbnail,
|
|
50
|
+
useGetPeopleSoftActiveEmployees: () => useGetPeopleSoftActiveEmployees,
|
|
51
|
+
useGetPeopleSoftCompanyGeneralManager: () => useGetPeopleSoftCompanyGeneralManager,
|
|
52
|
+
useGetPeopleSoftDepartmentById: () => useGetPeopleSoftDepartmentById,
|
|
53
|
+
useGetPeopleSoftDepartmentEmployees: () => useGetPeopleSoftDepartmentEmployees,
|
|
54
|
+
useGetPeopleSoftDepartmentManager: () => useGetPeopleSoftDepartmentManager,
|
|
55
|
+
useGetPeopleSoftDepartments: () => useGetPeopleSoftDepartments,
|
|
56
|
+
useGetPeopleSoftEmployeeById: () => useGetPeopleSoftEmployeeById,
|
|
57
|
+
useGetPeopleSoftEmployeeGeneralManager: () => useGetPeopleSoftEmployeeGeneralManager,
|
|
58
|
+
useGetPeopleSoftEmployeeManager: () => useGetPeopleSoftEmployeeManager,
|
|
59
|
+
useGetPeopleSoftEmployeeSubordinates: () => useGetPeopleSoftEmployeeSubordinates,
|
|
60
|
+
useGetPeopleSoftEmployeeSupervisor: () => useGetPeopleSoftEmployeeSupervisor,
|
|
61
|
+
useGetPeopleSoftEmployees: () => useGetPeopleSoftEmployees,
|
|
62
|
+
useGetPeopleSoftEmployeesSearch: () => useGetPeopleSoftEmployeesSearch,
|
|
63
|
+
useGetPeopleSoftPreviousEmployeeIds: () => useGetPeopleSoftPreviousEmployeeIds,
|
|
64
|
+
useOpenFile: () => useOpenFile,
|
|
65
|
+
useResubmitApproval: () => useResubmitApproval,
|
|
66
|
+
useUpdateFileMeta: () => useUpdateFileMeta,
|
|
67
|
+
useUploadFile: () => useUploadFile,
|
|
68
|
+
useWithdrawApproval: () => useWithdrawApproval,
|
|
69
|
+
withdrawApproval: () => withdrawApproval
|
|
70
|
+
});
|
|
71
|
+
module.exports = __toCommonJS(queries_exports);
|
|
72
|
+
|
|
73
|
+
// src/queries/FileHooks.ts
|
|
74
|
+
var import_react_query = require("@tanstack/react-query");
|
|
75
|
+
var import_file_saver = __toESM(require("file-saver"), 1);
|
|
76
|
+
var import_react = require("react");
|
|
77
|
+
var import_tus_js_client = require("tus-js-client");
|
|
78
|
+
var import_uuidv7 = require("uuidv7");
|
|
79
|
+
var import_zod2 = __toESM(require("zod"), 1);
|
|
80
|
+
|
|
81
|
+
// src/models/file/FileMeta.ts
|
|
82
|
+
var z = __toESM(require("zod"), 1);
|
|
83
|
+
var FileMetaSchema = z.object({
|
|
84
|
+
id: z.uuid(),
|
|
85
|
+
subId: z.uuid(),
|
|
86
|
+
appName: z.string().trim().min(1).max(255),
|
|
87
|
+
fileName: z.string().trim().min(1).max(255),
|
|
88
|
+
fileExtension: z.string().trim().min(1).max(255),
|
|
89
|
+
fileSize: z.number().min(0),
|
|
90
|
+
mediaSubType: z.string().trim().min(1).max(255),
|
|
91
|
+
mediaType: z.string().trim().min(1).max(255),
|
|
92
|
+
mimeType: z.string().trim().min(1).max(255),
|
|
93
|
+
createdBy: z.string().trim().min(1).max(255),
|
|
94
|
+
createdDate: z.date()
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
// src/lib/utils.ts
|
|
98
|
+
var import_axios = __toESM(require("axios"), 1);
|
|
99
|
+
|
|
100
|
+
// src/env.ts
|
|
101
|
+
var import_env_core = require("@t3-oss/env-core");
|
|
102
|
+
var import_zod = require("zod");
|
|
103
|
+
var import_meta = {};
|
|
104
|
+
var clientEnv = (0, import_env_core.createEnv)({
|
|
105
|
+
clientPrefix: "VITE_",
|
|
106
|
+
client: {
|
|
107
|
+
VITE_APP_TITLE: import_zod.z.string(),
|
|
108
|
+
VITE_MUI_LICENSE_KEY: import_zod.z.string(),
|
|
109
|
+
VITE_API_URL: import_zod.z.url()
|
|
110
|
+
},
|
|
111
|
+
runtimeEnv: import_meta.env,
|
|
112
|
+
emptyStringAsUndefined: true
|
|
113
|
+
});
|
|
114
|
+
var serverEnv = (0, import_env_core.createEnv)({
|
|
115
|
+
server: {
|
|
116
|
+
DATABASE_URL: import_zod.z.string(),
|
|
117
|
+
MICROSOFT_CLIENT_ID: import_zod.z.string(),
|
|
118
|
+
MICROSOFT_CLIENT_SECRET: import_zod.z.string()
|
|
119
|
+
},
|
|
120
|
+
runtimeEnv: process.env,
|
|
121
|
+
emptyStringAsUndefined: true
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
// src/lib/utils.ts
|
|
125
|
+
var httpClient = import_axios.default.create({
|
|
126
|
+
baseURL: clientEnv.VITE_API_URL
|
|
127
|
+
// TODO: Not working in children projects
|
|
128
|
+
});
|
|
129
|
+
var toKebabCase = (str) => {
|
|
130
|
+
return str.replaceAll(/([a-z])([A-Z])/g, "$1-$2").replaceAll(/[\s_]+/g, "-").replaceAll(/[^a-zA-Z0-9-]/g, "").toLowerCase().replaceAll(/-+/g, "-").replaceAll(/(^-|-$)/g, "");
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
// src/queries/FileHooks.ts
|
|
134
|
+
var QUERY_KEY = "file";
|
|
135
|
+
var HOUR = 1e3 * 60 * 60;
|
|
136
|
+
var APP_NAME = toKebabCase(clientEnv.VITE_APP_TITLE);
|
|
137
|
+
var GetFileMetasParamsSchema = import_zod2.default.object({
|
|
138
|
+
appName: import_zod2.default.string().min(1).max(255).default(APP_NAME).optional(),
|
|
139
|
+
subId: import_zod2.default.uuid()
|
|
140
|
+
});
|
|
141
|
+
var useGetFileMetas = (params, options) => {
|
|
142
|
+
const queryParams = new URLSearchParams();
|
|
143
|
+
queryParams.append("appName", params.appName ?? APP_NAME);
|
|
144
|
+
queryParams.append("subId", params.subId);
|
|
145
|
+
return (0, import_react_query.useQuery)({
|
|
146
|
+
...options,
|
|
147
|
+
queryKey: [QUERY_KEY, "meta", params.appName ?? APP_NAME, params.subId],
|
|
148
|
+
queryFn: ({ signal }) => httpClient.request({
|
|
149
|
+
url: `/${QUERY_KEY}/v1/meta?${queryParams.toString()}`,
|
|
150
|
+
method: "GET",
|
|
151
|
+
signal
|
|
152
|
+
}),
|
|
153
|
+
staleTime: HOUR,
|
|
154
|
+
gcTime: HOUR,
|
|
155
|
+
refetchOnWindowFocus: false
|
|
156
|
+
});
|
|
157
|
+
};
|
|
158
|
+
var GetFileThumbnailParamsSchema = import_zod2.default.object({
|
|
159
|
+
appName: import_zod2.default.string().min(1).max(255).default(APP_NAME).optional(),
|
|
160
|
+
meta: FileMetaSchema.nullish()
|
|
161
|
+
});
|
|
162
|
+
var useGetFileThumbnail = (params, options) => {
|
|
163
|
+
const queryParams = new URLSearchParams();
|
|
164
|
+
queryParams.append("appName", params.appName ?? APP_NAME);
|
|
165
|
+
queryParams.append("id", params.meta?.id ?? "");
|
|
166
|
+
return (0, import_react_query.useQuery)({
|
|
167
|
+
...options,
|
|
168
|
+
queryKey: [QUERY_KEY, "thumbnail", params.appName ?? APP_NAME, params.meta?.id],
|
|
169
|
+
queryFn: ({ signal }) => httpClient.request({
|
|
170
|
+
url: `/${QUERY_KEY}/v1/thumbnail?${queryParams.toString()}`,
|
|
171
|
+
method: "GET",
|
|
172
|
+
signal,
|
|
173
|
+
responseType: "blob"
|
|
174
|
+
}),
|
|
175
|
+
select: (data) => URL.createObjectURL(data),
|
|
176
|
+
staleTime: HOUR,
|
|
177
|
+
gcTime: HOUR,
|
|
178
|
+
refetchOnWindowFocus: false,
|
|
179
|
+
enabled: !!params.meta && options?.enabled !== false
|
|
180
|
+
});
|
|
181
|
+
};
|
|
182
|
+
var GetFileParamsSchema = import_zod2.default.object({
|
|
183
|
+
appName: import_zod2.default.string().min(1).max(255).default(APP_NAME).optional(),
|
|
184
|
+
meta: FileMetaSchema.nullish()
|
|
185
|
+
});
|
|
186
|
+
var useGetFile = (params, options) => {
|
|
187
|
+
const queryParams = new URLSearchParams();
|
|
188
|
+
queryParams.append("appName", params.appName ?? APP_NAME);
|
|
189
|
+
queryParams.append("id", params.meta?.id ?? "");
|
|
190
|
+
return (0, import_react_query.useQuery)({
|
|
191
|
+
...options,
|
|
192
|
+
queryKey: [QUERY_KEY, params.appName ?? APP_NAME, params.meta?.id],
|
|
193
|
+
queryFn: ({ signal }) => httpClient.request({
|
|
194
|
+
url: `/${QUERY_KEY}/v1?${queryParams.toString()}`,
|
|
195
|
+
method: "GET",
|
|
196
|
+
signal,
|
|
197
|
+
responseType: "blob"
|
|
198
|
+
}),
|
|
199
|
+
select: (data) => URL.createObjectURL(data),
|
|
200
|
+
staleTime: HOUR,
|
|
201
|
+
gcTime: HOUR,
|
|
202
|
+
refetchOnWindowFocus: false,
|
|
203
|
+
enabled: !!params.meta && options?.enabled !== false
|
|
204
|
+
});
|
|
205
|
+
};
|
|
206
|
+
var useDownloadFile = (options) => {
|
|
207
|
+
return (0, import_react_query.useMutation)({
|
|
208
|
+
...options,
|
|
209
|
+
mutationFn: (meta) => httpClient.request({
|
|
210
|
+
url: `/${QUERY_KEY}/v1/download?appName=${APP_NAME}&id=${meta.id}`,
|
|
211
|
+
method: "GET",
|
|
212
|
+
responseType: "blob"
|
|
213
|
+
}),
|
|
214
|
+
onSuccess: (data, variables) => (0, import_file_saver.default)(data, `${variables.fileName}.${variables.fileExtension}`)
|
|
215
|
+
});
|
|
216
|
+
};
|
|
217
|
+
var useOpenFile = (options) => {
|
|
218
|
+
return (0, import_react_query.useMutation)({
|
|
219
|
+
...options,
|
|
220
|
+
mutationFn: (meta) => httpClient.request({
|
|
221
|
+
url: `/${QUERY_KEY}/v1?appName=${APP_NAME}&id=${meta.id}`,
|
|
222
|
+
method: "GET",
|
|
223
|
+
responseType: "blob"
|
|
224
|
+
}),
|
|
225
|
+
onSuccess: (data) => {
|
|
226
|
+
window.open(URL.createObjectURL(data));
|
|
227
|
+
}
|
|
228
|
+
});
|
|
229
|
+
};
|
|
230
|
+
var useUpdateFileMeta = (options) => {
|
|
231
|
+
const queryClient = (0, import_react_query.useQueryClient)();
|
|
232
|
+
return (0, import_react_query.useMutation)({
|
|
233
|
+
...options,
|
|
234
|
+
mutationFn: (meta) => httpClient.request({
|
|
235
|
+
url: `/${QUERY_KEY}/v1/meta?appName=${APP_NAME}&id=${meta.id}`,
|
|
236
|
+
method: "PUT",
|
|
237
|
+
data: meta
|
|
238
|
+
}),
|
|
239
|
+
onSettled: () => queryClient.invalidateQueries({ queryKey: [QUERY_KEY, "meta"], exact: false })
|
|
240
|
+
});
|
|
241
|
+
};
|
|
242
|
+
var useDeleteFile = (options) => {
|
|
243
|
+
const queryClient = (0, import_react_query.useQueryClient)();
|
|
244
|
+
return (0, import_react_query.useMutation)({
|
|
245
|
+
...options,
|
|
246
|
+
mutationFn: (meta) => httpClient.request({
|
|
247
|
+
url: `/${QUERY_KEY}/v1?appName=${APP_NAME}&id=${meta.id}`,
|
|
248
|
+
method: "DELETE"
|
|
249
|
+
}),
|
|
250
|
+
onSettled: () => queryClient.invalidateQueries({ queryKey: [QUERY_KEY, "meta"], exact: false })
|
|
251
|
+
});
|
|
252
|
+
};
|
|
253
|
+
var useDeleteFiles = (options) => {
|
|
254
|
+
const queryClient = (0, import_react_query.useQueryClient)();
|
|
255
|
+
return (0, import_react_query.useMutation)({
|
|
256
|
+
...options,
|
|
257
|
+
mutationFn: (subId) => httpClient.request({
|
|
258
|
+
url: `/${QUERY_KEY}/v1?appName=${APP_NAME}&subId=${subId}`,
|
|
259
|
+
method: "DELETE"
|
|
260
|
+
}),
|
|
261
|
+
onSettled: () => queryClient.invalidateQueries({ queryKey: [QUERY_KEY, "meta"], exact: false })
|
|
262
|
+
});
|
|
263
|
+
};
|
|
264
|
+
var useUploadFile = ({ subId, onSuccess, onError }) => {
|
|
265
|
+
const [progress, setProgress] = (0, import_react.useState)(0);
|
|
266
|
+
const queryClient = (0, import_react_query.useQueryClient)();
|
|
267
|
+
const mutate = async (file) => {
|
|
268
|
+
if (!subId) throw new Error("subId is required for file upload");
|
|
269
|
+
const metadata = {
|
|
270
|
+
id: (0, import_uuidv7.uuidv7)(),
|
|
271
|
+
appName: APP_NAME,
|
|
272
|
+
subId,
|
|
273
|
+
fileName: file.name
|
|
274
|
+
};
|
|
275
|
+
const upload = new import_tus_js_client.Upload(file, {
|
|
276
|
+
endpoint: `${clientEnv.VITE_API_URL}/${QUERY_KEY}/v1/upload`,
|
|
277
|
+
chunkSize: 1048576,
|
|
278
|
+
// 1 MB
|
|
279
|
+
metadata: {
|
|
280
|
+
id: metadata.id,
|
|
281
|
+
appName: metadata.appName,
|
|
282
|
+
subId: metadata.subId,
|
|
283
|
+
fileName: metadata.fileName,
|
|
284
|
+
fileExtension: file.type
|
|
285
|
+
},
|
|
286
|
+
// headers: { "Authorization": `Bearer ${await getToken()}` }, //TODO: implement token retrieval
|
|
287
|
+
onError: (error) => {
|
|
288
|
+
setProgress(0);
|
|
289
|
+
onError?.(error);
|
|
290
|
+
},
|
|
291
|
+
onProgress: (bytesUploaded, bytesTotal) => {
|
|
292
|
+
setProgress(bytesUploaded / bytesTotal * 100);
|
|
293
|
+
},
|
|
294
|
+
onSuccess: () => {
|
|
295
|
+
setProgress(0);
|
|
296
|
+
queryClient.invalidateQueries({ queryKey: [QUERY_KEY, "meta", subId], exact: false });
|
|
297
|
+
onSuccess?.(metadata);
|
|
298
|
+
}
|
|
299
|
+
});
|
|
300
|
+
const previousUploads = await upload.findPreviousUploads();
|
|
301
|
+
if (previousUploads.length > 0) {
|
|
302
|
+
upload.resumeFromPreviousUpload(previousUploads[0]);
|
|
303
|
+
}
|
|
304
|
+
upload.start();
|
|
305
|
+
};
|
|
306
|
+
return { mutate, progress };
|
|
307
|
+
};
|
|
308
|
+
|
|
309
|
+
// src/queries/PeopleSoftHooks.ts
|
|
310
|
+
var import_react_query2 = require("@tanstack/react-query");
|
|
311
|
+
var QUERY_KEY2 = "ps";
|
|
312
|
+
var DAY = 1e3 * 60 * 60 * 24;
|
|
313
|
+
var useGetPeopleSoftEmployeesSearch = (searchTerm, options) => {
|
|
314
|
+
return (0, import_react_query2.useQuery)({
|
|
315
|
+
...options,
|
|
316
|
+
queryKey: [QUERY_KEY2, "employee", "search", searchTerm],
|
|
317
|
+
queryFn: ({ signal }) => httpClient.request({
|
|
318
|
+
url: `/${QUERY_KEY2}/v1/employee?search=${searchTerm}`,
|
|
319
|
+
method: "GET",
|
|
320
|
+
signal
|
|
321
|
+
}),
|
|
322
|
+
staleTime: DAY,
|
|
323
|
+
gcTime: DAY,
|
|
324
|
+
refetchOnWindowFocus: false
|
|
325
|
+
});
|
|
326
|
+
};
|
|
327
|
+
var useGetPeopleSoftEmployees = (options) => {
|
|
328
|
+
return (0, import_react_query2.useQuery)({
|
|
329
|
+
...options,
|
|
330
|
+
queryKey: [QUERY_KEY2, "employee"],
|
|
331
|
+
queryFn: ({ signal }) => httpClient.request({
|
|
332
|
+
url: `/${QUERY_KEY2}/v1/employee/all`,
|
|
333
|
+
method: "GET",
|
|
334
|
+
signal
|
|
335
|
+
}),
|
|
336
|
+
staleTime: DAY,
|
|
337
|
+
gcTime: DAY,
|
|
338
|
+
refetchOnWindowFocus: false
|
|
339
|
+
});
|
|
340
|
+
};
|
|
341
|
+
var useGetPeopleSoftActiveEmployees = (options) => {
|
|
342
|
+
return (0, import_react_query2.useQuery)({
|
|
343
|
+
...options,
|
|
344
|
+
queryKey: [QUERY_KEY2, "employee", "active"],
|
|
345
|
+
queryFn: ({ signal }) => httpClient.request({
|
|
346
|
+
url: `/${QUERY_KEY2}/v1/employee/active`,
|
|
347
|
+
method: "GET",
|
|
348
|
+
signal
|
|
349
|
+
}),
|
|
350
|
+
staleTime: DAY,
|
|
351
|
+
gcTime: DAY,
|
|
352
|
+
refetchOnWindowFocus: false
|
|
353
|
+
});
|
|
354
|
+
};
|
|
355
|
+
var useGetPeopleSoftEmployeeById = (employeeId, options) => {
|
|
356
|
+
return (0, import_react_query2.useQuery)({
|
|
357
|
+
...options,
|
|
358
|
+
queryKey: [QUERY_KEY2, "employee", employeeId],
|
|
359
|
+
queryFn: ({ signal }) => httpClient.request({
|
|
360
|
+
url: `/${QUERY_KEY2}/v1/employee/${employeeId}`,
|
|
361
|
+
method: "GET",
|
|
362
|
+
signal
|
|
363
|
+
}),
|
|
364
|
+
staleTime: DAY,
|
|
365
|
+
gcTime: DAY,
|
|
366
|
+
refetchOnWindowFocus: false
|
|
367
|
+
});
|
|
368
|
+
};
|
|
369
|
+
var useGetPeopleSoftPreviousEmployeeIds = (options) => {
|
|
370
|
+
return (0, import_react_query2.useQuery)({
|
|
371
|
+
...options,
|
|
372
|
+
queryKey: [QUERY_KEY2, "employee", "previousIds"],
|
|
373
|
+
queryFn: ({ signal }) => httpClient.request({
|
|
374
|
+
url: `/${QUERY_KEY2}/v1/employee/previousIds`,
|
|
375
|
+
method: "GET",
|
|
376
|
+
signal
|
|
377
|
+
}),
|
|
378
|
+
staleTime: DAY,
|
|
379
|
+
gcTime: DAY,
|
|
380
|
+
refetchOnWindowFocus: false
|
|
381
|
+
});
|
|
382
|
+
};
|
|
383
|
+
var useGetPeopleSoftEmployeeSupervisor = (employeeId, options) => {
|
|
384
|
+
return (0, import_react_query2.useQuery)({
|
|
385
|
+
...options,
|
|
386
|
+
queryKey: [QUERY_KEY2, "employee", employeeId, "supervisor"],
|
|
387
|
+
queryFn: ({ signal }) => httpClient.request({
|
|
388
|
+
url: `/${QUERY_KEY2}/v1/employee/${employeeId}/supervisor`,
|
|
389
|
+
method: "GET",
|
|
390
|
+
signal
|
|
391
|
+
}),
|
|
392
|
+
staleTime: DAY,
|
|
393
|
+
gcTime: DAY,
|
|
394
|
+
refetchOnWindowFocus: false
|
|
395
|
+
});
|
|
396
|
+
};
|
|
397
|
+
var useGetPeopleSoftEmployeeSubordinates = (employeeId, options) => {
|
|
398
|
+
return (0, import_react_query2.useQuery)({
|
|
399
|
+
...options,
|
|
400
|
+
queryKey: [QUERY_KEY2, "employee", employeeId, "subordinates"],
|
|
401
|
+
queryFn: ({ signal }) => httpClient.request({
|
|
402
|
+
url: `/${QUERY_KEY2}/v1/employee/${employeeId}/subordinates`,
|
|
403
|
+
method: "GET",
|
|
404
|
+
signal
|
|
405
|
+
}),
|
|
406
|
+
staleTime: DAY,
|
|
407
|
+
gcTime: DAY,
|
|
408
|
+
refetchOnWindowFocus: false
|
|
409
|
+
});
|
|
410
|
+
};
|
|
411
|
+
var useGetPeopleSoftEmployeeManager = (employeeId, options) => {
|
|
412
|
+
return (0, import_react_query2.useQuery)({
|
|
413
|
+
...options,
|
|
414
|
+
queryKey: [QUERY_KEY2, "employee", employeeId, "manager"],
|
|
415
|
+
queryFn: ({ signal }) => httpClient.request({
|
|
416
|
+
url: `/${QUERY_KEY2}/v1/employee/${employeeId}/manager`,
|
|
417
|
+
method: "GET",
|
|
418
|
+
signal
|
|
419
|
+
}),
|
|
420
|
+
staleTime: DAY,
|
|
421
|
+
gcTime: DAY,
|
|
422
|
+
refetchOnWindowFocus: false
|
|
423
|
+
});
|
|
424
|
+
};
|
|
425
|
+
var useGetPeopleSoftEmployeeGeneralManager = (employeeId, options) => {
|
|
426
|
+
return (0, import_react_query2.useQuery)({
|
|
427
|
+
...options,
|
|
428
|
+
queryKey: [QUERY_KEY2, "employee", employeeId, "generalManager"],
|
|
429
|
+
queryFn: ({ signal }) => httpClient.request({
|
|
430
|
+
url: `/${QUERY_KEY2}/v1/employee/${employeeId}/generalManager`,
|
|
431
|
+
method: "GET",
|
|
432
|
+
signal
|
|
433
|
+
}),
|
|
434
|
+
staleTime: DAY,
|
|
435
|
+
gcTime: DAY,
|
|
436
|
+
refetchOnWindowFocus: false
|
|
437
|
+
});
|
|
438
|
+
};
|
|
439
|
+
var useGetPeopleSoftDepartments = (options) => {
|
|
440
|
+
return (0, import_react_query2.useQuery)({
|
|
441
|
+
...options,
|
|
442
|
+
queryKey: [QUERY_KEY2, "department"],
|
|
443
|
+
queryFn: ({ signal }) => httpClient.request({
|
|
444
|
+
url: `/${QUERY_KEY2}/v1/department/all`,
|
|
445
|
+
method: "GET",
|
|
446
|
+
signal
|
|
447
|
+
}),
|
|
448
|
+
staleTime: DAY,
|
|
449
|
+
gcTime: DAY,
|
|
450
|
+
refetchOnWindowFocus: false
|
|
451
|
+
});
|
|
452
|
+
};
|
|
453
|
+
var useGetPeopleSoftDepartmentById = (departmentId, options) => {
|
|
454
|
+
return (0, import_react_query2.useQuery)({
|
|
455
|
+
...options,
|
|
456
|
+
queryKey: [QUERY_KEY2, "department", departmentId],
|
|
457
|
+
queryFn: ({ signal }) => httpClient.request({
|
|
458
|
+
url: `/${QUERY_KEY2}/v1/department/${departmentId}`,
|
|
459
|
+
method: "GET",
|
|
460
|
+
signal
|
|
461
|
+
}),
|
|
462
|
+
staleTime: DAY,
|
|
463
|
+
gcTime: DAY,
|
|
464
|
+
refetchOnWindowFocus: false
|
|
465
|
+
});
|
|
466
|
+
};
|
|
467
|
+
var useGetPeopleSoftDepartmentManager = (departmentId, options) => {
|
|
468
|
+
return (0, import_react_query2.useQuery)({
|
|
469
|
+
...options,
|
|
470
|
+
queryKey: [QUERY_KEY2, "department", departmentId, "manager"],
|
|
471
|
+
queryFn: ({ signal }) => httpClient.request({
|
|
472
|
+
url: `/${QUERY_KEY2}/v1/department/${departmentId}/manager`,
|
|
473
|
+
method: "GET",
|
|
474
|
+
signal
|
|
475
|
+
}),
|
|
476
|
+
staleTime: DAY,
|
|
477
|
+
gcTime: DAY,
|
|
478
|
+
refetchOnWindowFocus: false
|
|
479
|
+
});
|
|
480
|
+
};
|
|
481
|
+
var useGetPeopleSoftDepartmentEmployees = (departmentId, options) => {
|
|
482
|
+
return (0, import_react_query2.useQuery)({
|
|
483
|
+
...options,
|
|
484
|
+
queryKey: [QUERY_KEY2, "department", departmentId, "employees"],
|
|
485
|
+
queryFn: ({ signal }) => httpClient.request({
|
|
486
|
+
url: `/${QUERY_KEY2}/v1/department/${departmentId}/employees`,
|
|
487
|
+
method: "GET",
|
|
488
|
+
signal
|
|
489
|
+
}),
|
|
490
|
+
staleTime: DAY,
|
|
491
|
+
gcTime: DAY,
|
|
492
|
+
refetchOnWindowFocus: false
|
|
493
|
+
});
|
|
494
|
+
};
|
|
495
|
+
var useGetPeopleSoftCompanyGeneralManager = (companyCode, options) => {
|
|
496
|
+
return (0, import_react_query2.useQuery)({
|
|
497
|
+
...options,
|
|
498
|
+
queryKey: [QUERY_KEY2, "company", companyCode, "generalManager"],
|
|
499
|
+
queryFn: ({ signal }) => httpClient.request({
|
|
500
|
+
url: `/${QUERY_KEY2}/v1/company/${companyCode}/generalManager`,
|
|
501
|
+
method: "GET",
|
|
502
|
+
signal
|
|
503
|
+
}),
|
|
504
|
+
staleTime: DAY,
|
|
505
|
+
gcTime: DAY,
|
|
506
|
+
refetchOnWindowFocus: false
|
|
507
|
+
});
|
|
508
|
+
};
|
|
509
|
+
|
|
510
|
+
// src/queries/Approval.ts
|
|
511
|
+
var import_react_start = require("@tanstack/react-start");
|
|
512
|
+
var import_zod5 = __toESM(require("zod"), 1);
|
|
513
|
+
|
|
514
|
+
// src/models/approval/ApprovalStatus.ts
|
|
515
|
+
var import_zod3 = __toESM(require("zod"), 1);
|
|
516
|
+
var ApprovalStatus = import_zod3.default.enum([
|
|
517
|
+
"WaitingForApproval",
|
|
518
|
+
"Approved",
|
|
519
|
+
"PartiallyApproved",
|
|
520
|
+
"Rejected",
|
|
521
|
+
"Withdrawn",
|
|
522
|
+
"Cancelled"
|
|
523
|
+
]);
|
|
524
|
+
|
|
525
|
+
// src/models/approval/ApprovalStepResult.ts
|
|
526
|
+
var import_zod4 = __toESM(require("zod"), 1);
|
|
527
|
+
var ApprovalStepResult = import_zod4.default.enum([
|
|
528
|
+
"NotAvailable",
|
|
529
|
+
"FutureApproval",
|
|
530
|
+
"WaitingForApproval",
|
|
531
|
+
"Approved",
|
|
532
|
+
"Rejected",
|
|
533
|
+
"Skipped",
|
|
534
|
+
"Withdrawn",
|
|
535
|
+
"Cancelled"
|
|
536
|
+
]);
|
|
537
|
+
|
|
538
|
+
// src/queries/Approval.ts
|
|
539
|
+
var ROUTE = "approval";
|
|
540
|
+
var APP_NAME2 = toKebabCase(clientEnv.VITE_APP_TITLE);
|
|
541
|
+
var GetApprovalsParamsSchema = import_zod5.default.object({
|
|
542
|
+
appName: import_zod5.default.string().min(1).max(255).default(APP_NAME2).optional(),
|
|
543
|
+
status: ApprovalStatus.optional(),
|
|
544
|
+
approverEmployeeId: import_zod5.default.string().min(1).max(20).optional(),
|
|
545
|
+
stepResult: ApprovalStepResult.optional()
|
|
546
|
+
});
|
|
547
|
+
var getApprovalsBase = async (params, signal) => {
|
|
548
|
+
const queryParams = new URLSearchParams();
|
|
549
|
+
queryParams.append("applicationName", params?.appName ?? APP_NAME2);
|
|
550
|
+
if (params?.status) queryParams.append("status", params.status.toString());
|
|
551
|
+
if (params?.approverEmployeeId) queryParams.append("approverEmployeeId", params.approverEmployeeId);
|
|
552
|
+
if (params?.stepResult) queryParams.append("stepResult", params.stepResult.toString());
|
|
553
|
+
const request = await httpClient.request({
|
|
554
|
+
url: `/${ROUTE}/Requests/Requests?${queryParams.toString()}`,
|
|
555
|
+
method: "GET",
|
|
556
|
+
signal
|
|
557
|
+
});
|
|
558
|
+
return request.data;
|
|
559
|
+
};
|
|
560
|
+
var getApprovalBase = async (id, signal) => {
|
|
561
|
+
const request = await httpClient.request({
|
|
562
|
+
url: `/${ROUTE}/Requests/${id}`,
|
|
563
|
+
method: "GET",
|
|
564
|
+
signal
|
|
565
|
+
});
|
|
566
|
+
return request.data;
|
|
567
|
+
};
|
|
568
|
+
var createApprovalBase = async (data) => {
|
|
569
|
+
const request = await httpClient.request({
|
|
570
|
+
url: `/${ROUTE}/Requests`,
|
|
571
|
+
method: "POST",
|
|
572
|
+
data
|
|
573
|
+
});
|
|
574
|
+
return request.data;
|
|
575
|
+
};
|
|
576
|
+
var approveApprovalBase = async (data) => {
|
|
577
|
+
const request = await httpClient.request({
|
|
578
|
+
url: `/${ROUTE}/Requests/${data.id}/single-approval`,
|
|
579
|
+
method: "POST",
|
|
580
|
+
data
|
|
581
|
+
});
|
|
582
|
+
return request.data;
|
|
583
|
+
};
|
|
584
|
+
var resubmitApprovalBase = async (data) => {
|
|
585
|
+
const request = await httpClient.request({
|
|
586
|
+
url: `/${ROUTE}/Requests/${data.id}/resubmit`,
|
|
587
|
+
method: "POST",
|
|
588
|
+
data
|
|
589
|
+
});
|
|
590
|
+
return request.data;
|
|
591
|
+
};
|
|
592
|
+
var withdrawApprovalBase = async (data) => {
|
|
593
|
+
await httpClient.request({
|
|
594
|
+
url: `/${ROUTE}/Requests/${data.id}/withdraw`,
|
|
595
|
+
method: "POST",
|
|
596
|
+
data
|
|
597
|
+
});
|
|
598
|
+
};
|
|
599
|
+
var cancelApprovalBase = async (data) => {
|
|
600
|
+
await httpClient.request({
|
|
601
|
+
url: `/${ROUTE}/Requests/${data.id}/cancel`,
|
|
602
|
+
method: "POST",
|
|
603
|
+
data
|
|
604
|
+
});
|
|
605
|
+
};
|
|
606
|
+
var getApprovals = (0, import_react_start.createIsomorphicFn)().server(getApprovalsBase).client(getApprovalsBase);
|
|
607
|
+
var getApproval = (0, import_react_start.createIsomorphicFn)().server(getApprovalBase).client(getApprovalBase);
|
|
608
|
+
var createApproval = (0, import_react_start.createIsomorphicFn)().server(createApprovalBase).client(createApprovalBase);
|
|
609
|
+
var approveApproval = (0, import_react_start.createIsomorphicFn)().server(approveApprovalBase).client(approveApprovalBase);
|
|
610
|
+
var resubmitApproval = (0, import_react_start.createIsomorphicFn)().server(resubmitApprovalBase).client(resubmitApprovalBase);
|
|
611
|
+
var withdrawApproval = (0, import_react_start.createIsomorphicFn)().server(withdrawApprovalBase).client(withdrawApprovalBase);
|
|
612
|
+
var cancelApproval = (0, import_react_start.createIsomorphicFn)().server(cancelApprovalBase).client(cancelApprovalBase);
|
|
613
|
+
|
|
614
|
+
// src/queries/ApprovalHooks.ts
|
|
615
|
+
var import_react_query3 = require("@tanstack/react-query");
|
|
616
|
+
var useGetApprovals = (params, options) => (0, import_react_query3.useQuery)({
|
|
617
|
+
...options,
|
|
618
|
+
queryKey: [ROUTE, params],
|
|
619
|
+
queryFn: ({ signal }) => getApprovals(params, signal)
|
|
620
|
+
});
|
|
621
|
+
var useGetApproval = (id, options) => (0, import_react_query3.useQuery)({
|
|
622
|
+
...options,
|
|
623
|
+
queryKey: [ROUTE, id],
|
|
624
|
+
queryFn: ({ signal }) => getApproval(id, signal)
|
|
625
|
+
});
|
|
626
|
+
var useCreateApproval = (options) => {
|
|
627
|
+
const queryClient = (0, import_react_query3.useQueryClient)();
|
|
628
|
+
return (0, import_react_query3.useMutation)({
|
|
629
|
+
...options,
|
|
630
|
+
mutationFn: (data) => createApproval(data),
|
|
631
|
+
onSettled: () => queryClient.invalidateQueries({ queryKey: [ROUTE], exact: false })
|
|
632
|
+
});
|
|
633
|
+
};
|
|
634
|
+
var useApproveApproval = (options) => {
|
|
635
|
+
const queryClient = (0, import_react_query3.useQueryClient)();
|
|
636
|
+
return (0, import_react_query3.useMutation)({
|
|
637
|
+
...options,
|
|
638
|
+
mutationFn: (data) => approveApproval(data),
|
|
639
|
+
onSettled: () => queryClient.invalidateQueries({ queryKey: [ROUTE], exact: false })
|
|
640
|
+
});
|
|
641
|
+
};
|
|
642
|
+
var useResubmitApproval = (options) => {
|
|
643
|
+
const queryClient = (0, import_react_query3.useQueryClient)();
|
|
644
|
+
return (0, import_react_query3.useMutation)({
|
|
645
|
+
...options,
|
|
646
|
+
mutationFn: (data) => resubmitApproval(data),
|
|
647
|
+
onSettled: () => queryClient.invalidateQueries({ queryKey: [ROUTE], exact: false })
|
|
648
|
+
});
|
|
649
|
+
};
|
|
650
|
+
var useWithdrawApproval = (options) => {
|
|
651
|
+
const queryClient = (0, import_react_query3.useQueryClient)();
|
|
652
|
+
return (0, import_react_query3.useMutation)({
|
|
653
|
+
...options,
|
|
654
|
+
mutationFn: (data) => withdrawApproval(data),
|
|
655
|
+
onSettled: () => queryClient.invalidateQueries({ queryKey: [ROUTE], exact: false })
|
|
656
|
+
});
|
|
657
|
+
};
|
|
658
|
+
var useCancelApproval = (options) => {
|
|
659
|
+
const queryClient = (0, import_react_query3.useQueryClient)();
|
|
660
|
+
return (0, import_react_query3.useMutation)({
|
|
661
|
+
...options,
|
|
662
|
+
mutationFn: (data) => cancelApproval(data),
|
|
663
|
+
onSettled: () => queryClient.invalidateQueries({ queryKey: [ROUTE], exact: false })
|
|
664
|
+
});
|
|
665
|
+
};
|
|
666
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
667
|
+
0 && (module.exports = {
|
|
668
|
+
approveApproval,
|
|
669
|
+
cancelApproval,
|
|
670
|
+
createApproval,
|
|
671
|
+
getApproval,
|
|
672
|
+
getApprovals,
|
|
673
|
+
resubmitApproval,
|
|
674
|
+
useApproveApproval,
|
|
675
|
+
useCancelApproval,
|
|
676
|
+
useCreateApproval,
|
|
677
|
+
useDeleteFile,
|
|
678
|
+
useDeleteFiles,
|
|
679
|
+
useDownloadFile,
|
|
680
|
+
useGetApproval,
|
|
681
|
+
useGetApprovals,
|
|
682
|
+
useGetFile,
|
|
683
|
+
useGetFileMetas,
|
|
684
|
+
useGetFileThumbnail,
|
|
685
|
+
useGetPeopleSoftActiveEmployees,
|
|
686
|
+
useGetPeopleSoftCompanyGeneralManager,
|
|
687
|
+
useGetPeopleSoftDepartmentById,
|
|
688
|
+
useGetPeopleSoftDepartmentEmployees,
|
|
689
|
+
useGetPeopleSoftDepartmentManager,
|
|
690
|
+
useGetPeopleSoftDepartments,
|
|
691
|
+
useGetPeopleSoftEmployeeById,
|
|
692
|
+
useGetPeopleSoftEmployeeGeneralManager,
|
|
693
|
+
useGetPeopleSoftEmployeeManager,
|
|
694
|
+
useGetPeopleSoftEmployeeSubordinates,
|
|
695
|
+
useGetPeopleSoftEmployeeSupervisor,
|
|
696
|
+
useGetPeopleSoftEmployees,
|
|
697
|
+
useGetPeopleSoftEmployeesSearch,
|
|
698
|
+
useGetPeopleSoftPreviousEmployeeIds,
|
|
699
|
+
useOpenFile,
|
|
700
|
+
useResubmitApproval,
|
|
701
|
+
useUpdateFileMeta,
|
|
702
|
+
useUploadFile,
|
|
703
|
+
useWithdrawApproval,
|
|
704
|
+
withdrawApproval
|
|
705
|
+
});
|
|
706
|
+
//# sourceMappingURL=queries.cjs.map
|