wcz-layout 8.0.2 → 8.0.4
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.
Potentially problematic release.
This version of wcz-layout might be problematic. Click here for more details.
- package/dist/Approval-BSQHVGsm.js +133 -0
- package/dist/Approval-BSQHVGsm.js.map +1 -0
- package/dist/{DialogsContext-D5A8xncJ.js → DialogsContext-DkePghS6.js} +1 -1
- package/dist/{DialogsContext-D5A8xncJ.js.map → DialogsContext-DkePghS6.js.map} +1 -1
- package/dist/Email-D2SPExbn.js +20 -0
- package/dist/Email-D2SPExbn.js.map +1 -0
- package/dist/FileMeta--27aYkPB.js +19 -0
- package/dist/FileMeta--27aYkPB.js.map +1 -0
- package/dist/{FileMeta-fQnJ6uFX.d.ts → FileMeta-CQz1TMre.d.ts} +1 -1
- package/dist/{NotificationContext-DBTYc5z-.js → NotificationContext-FQRaNZRx.js} +1 -1
- package/dist/{NotificationContext-DBTYc5z-.js.map → NotificationContext-FQRaNZRx.js.map} +1 -1
- package/dist/{RouterListItemButton-rcdkgOXQ.js → RouterListItemButton-p9U4Z0SW.js} +1 -1
- package/dist/{RouterListItemButton-rcdkgOXQ.js.map → RouterListItemButton-p9U4Z0SW.js.map} +1 -1
- package/dist/{User-C21DoZOa.d.ts → User-B92WOpE2.d.ts} +1 -1
- package/dist/components.d.ts +12 -11
- package/dist/components.js +342 -303
- package/dist/components.js.map +1 -1
- package/dist/data/client.d.ts +3081 -0
- package/dist/data/client.js +188 -0
- package/dist/data/client.js.map +1 -0
- package/dist/data/server.d.ts +20 -0
- package/dist/data/server.js +24 -0
- package/dist/data/server.js.map +1 -0
- package/dist/env-Dgbk8SQN.js +31 -0
- package/dist/env-Dgbk8SQN.js.map +1 -0
- package/dist/file-BHdm6ob1.js +151 -0
- package/dist/file-BHdm6ob1.js.map +1 -0
- package/dist/file-DNF9kxdN.js +100 -0
- package/dist/file-DNF9kxdN.js.map +1 -0
- package/dist/hooks.d.ts +1 -1
- package/dist/hooks.js +3 -3
- package/dist/hooks.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +17 -16
- package/dist/index.js.map +1 -1
- package/dist/middleware.d.ts +1 -1
- package/dist/middleware.js +2 -1
- package/dist/middleware.js.map +1 -1
- package/dist/models.d.ts +35 -6
- package/dist/models.js +4 -118
- package/dist/models.js.map +1 -1
- package/dist/{msalClient-MNN6BwL6.d.ts → msalClient-DZjYT_QJ.d.ts} +2 -2
- package/dist/msalServer-coQaBOlr.js +47 -0
- package/dist/msalServer-coQaBOlr.js.map +1 -0
- package/dist/peoplesoft-B9kmi9rI.d.ts +1081 -0
- package/dist/peoplesoft-CYSlmcwI.js +174 -0
- package/dist/peoplesoft-CYSlmcwI.js.map +1 -0
- package/dist/{queryClient-CAJR3qjE.js → queryClient-1OJ5Va3i.js} +1 -1
- package/dist/{queryClient-CAJR3qjE.js.map → queryClient-1OJ5Va3i.js.map} +1 -1
- package/dist/{useDialogs-BaxhulU9.js → useDialogs-BQEh6of8.js} +8 -8
- package/dist/useDialogs-BQEh6of8.js.map +1 -0
- package/dist/{utils-CqQKSaSs.js → utils-B7LPctqx.js} +8 -37
- package/dist/utils-B7LPctqx.js.map +1 -0
- package/dist/{utils-BBQ5S6oM.d.ts → utils-BM8-Efdl.d.ts} +2 -2
- package/dist/utils.d.ts +2 -2
- package/dist/utils.js +2 -46
- package/dist/vite.js.map +1 -1
- package/package.json +21 -14
- package/skills/auth/SKILL.md +268 -268
- package/dist/FileMeta-D9HyhrGi.js +0 -42
- package/dist/FileMeta-D9HyhrGi.js.map +0 -1
- package/dist/queries-JPqCc5Tb.js +0 -551
- package/dist/queries-JPqCc5Tb.js.map +0 -1
- package/dist/query.d.ts +0 -3052
- package/dist/query.js +0 -3
- package/dist/useDialogs-BaxhulU9.js.map +0 -1
- package/dist/utils-CqQKSaSs.js.map +0 -1
- package/dist/utils.js.map +0 -1
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import { n as serverEnv } from "./env-Dgbk8SQN.js";
|
|
2
|
+
import { p as createExternalApi } from "./file-BHdm6ob1.js";
|
|
3
|
+
import { a as ResubmitApprovalSchema, i as CreateApprovalSchema, l as ApprovalStepResult, n as ApproveApprovalSchema, o as WithdrawApprovalSchema, r as CancelApprovalSchema, s as ApprovalStatus } from "./Approval-BSQHVGsm.js";
|
|
4
|
+
import { z } from "zod";
|
|
5
|
+
import { createServerFn, createServerOnlyFn } from "@tanstack/react-start";
|
|
6
|
+
//#region src/queries/server/approval.ts
|
|
7
|
+
let approvalApi = null;
|
|
8
|
+
const getApprovalApi = createServerOnlyFn(() => {
|
|
9
|
+
const baseUrl = serverEnv.APPROVAL_BASE_URL;
|
|
10
|
+
if (!baseUrl) throw new Error("APPROVAL_BASE_URL is not defined in server environment variables.");
|
|
11
|
+
approvalApi ??= createExternalApi(baseUrl, "approval");
|
|
12
|
+
return approvalApi;
|
|
13
|
+
});
|
|
14
|
+
const GetApprovalsSchema = z.object({
|
|
15
|
+
appName: z.string().min(1).max(255),
|
|
16
|
+
status: ApprovalStatus.optional(),
|
|
17
|
+
approverEmployeeId: z.string().min(1).max(20).optional(),
|
|
18
|
+
stepResult: ApprovalStepResult.optional()
|
|
19
|
+
});
|
|
20
|
+
const GetApprovalSchema = z.object({ id: z.uuid() });
|
|
21
|
+
const getApprovals = createServerFn({ method: "GET" }).inputValidator(GetApprovalsSchema).handler(async ({ data }) => {
|
|
22
|
+
const api = getApprovalApi();
|
|
23
|
+
const queryParams = new URLSearchParams();
|
|
24
|
+
queryParams.append("applicationName", data.appName);
|
|
25
|
+
if (data.status) queryParams.append("status", data.status.toString());
|
|
26
|
+
if (data.approverEmployeeId) queryParams.append("approverEmployeeId", data.approverEmployeeId);
|
|
27
|
+
if (data.stepResult) queryParams.append("stepResult", data.stepResult.toString());
|
|
28
|
+
return api.request({
|
|
29
|
+
url: `/Requests/Requests?${queryParams.toString()}`,
|
|
30
|
+
method: "GET"
|
|
31
|
+
}).then((r) => r.data);
|
|
32
|
+
});
|
|
33
|
+
const getApproval = createServerFn({ method: "GET" }).inputValidator(GetApprovalSchema).handler(async ({ data }) => {
|
|
34
|
+
return getApprovalApi().request({
|
|
35
|
+
url: `/Requests/${data.id}`,
|
|
36
|
+
method: "GET"
|
|
37
|
+
}).then((r) => r.data);
|
|
38
|
+
});
|
|
39
|
+
const createApproval = createServerFn({ method: "POST" }).inputValidator(CreateApprovalSchema).handler(async ({ data }) => {
|
|
40
|
+
return getApprovalApi().request({
|
|
41
|
+
url: `/Requests`,
|
|
42
|
+
method: "POST",
|
|
43
|
+
data
|
|
44
|
+
}).then((r) => r.data);
|
|
45
|
+
});
|
|
46
|
+
const approveApproval = createServerFn({ method: "POST" }).inputValidator(ApproveApprovalSchema).handler(async ({ data }) => {
|
|
47
|
+
return getApprovalApi().request({
|
|
48
|
+
url: `/Requests/${data.id}/single-approval`,
|
|
49
|
+
method: "POST",
|
|
50
|
+
data
|
|
51
|
+
}).then((r) => r.data);
|
|
52
|
+
});
|
|
53
|
+
const resubmitApproval = createServerFn({ method: "POST" }).inputValidator(ResubmitApprovalSchema).handler(async ({ data }) => {
|
|
54
|
+
return getApprovalApi().request({
|
|
55
|
+
url: `/Requests/${data.id}/resubmit`,
|
|
56
|
+
method: "POST",
|
|
57
|
+
data
|
|
58
|
+
}).then((r) => r.data);
|
|
59
|
+
});
|
|
60
|
+
const withdrawApproval = createServerFn({ method: "POST" }).inputValidator(WithdrawApprovalSchema).handler(async ({ data }) => {
|
|
61
|
+
return getApprovalApi().request({
|
|
62
|
+
url: `/Requests/${data.id}/withdraw`,
|
|
63
|
+
method: "POST",
|
|
64
|
+
data
|
|
65
|
+
}).then((r) => r.data);
|
|
66
|
+
});
|
|
67
|
+
const cancelApproval = createServerFn({ method: "POST" }).inputValidator(CancelApprovalSchema).handler(async ({ data }) => {
|
|
68
|
+
return getApprovalApi().request({
|
|
69
|
+
url: `/Requests/${data.id}/cancel`,
|
|
70
|
+
method: "POST",
|
|
71
|
+
data
|
|
72
|
+
}).then((r) => r.data);
|
|
73
|
+
});
|
|
74
|
+
//#endregion
|
|
75
|
+
//#region src/queries/server/peoplesoft.ts
|
|
76
|
+
let peopleSoftApi = null;
|
|
77
|
+
const getPeopleSoftApi = createServerOnlyFn(() => {
|
|
78
|
+
const baseUrl = serverEnv.PS_BASE_URL;
|
|
79
|
+
if (!baseUrl) throw new Error("PS_BASE_URL is not defined in server environment variables.");
|
|
80
|
+
peopleSoftApi ??= createExternalApi(baseUrl, "ps");
|
|
81
|
+
return peopleSoftApi;
|
|
82
|
+
});
|
|
83
|
+
const SearchEmployeesSchema = z.object({ searchTerm: z.string().min(1) });
|
|
84
|
+
const EmployeeIdSchema = z.object({ employeeId: z.string().min(1) });
|
|
85
|
+
const DepartmentIdSchema = z.object({ departmentId: z.string().min(1) });
|
|
86
|
+
const CompanyCodeSchema = z.object({ companyCode: z.string().min(1) });
|
|
87
|
+
const searchEmployees = createServerFn({ method: "GET" }).inputValidator(SearchEmployeesSchema).handler(async ({ data }) => {
|
|
88
|
+
return getPeopleSoftApi().request({
|
|
89
|
+
url: `/v1/employee?search=${encodeURIComponent(data.searchTerm)}`,
|
|
90
|
+
method: "GET"
|
|
91
|
+
}).then((r) => r.data);
|
|
92
|
+
});
|
|
93
|
+
const getEmployees = createServerFn({ method: "GET" }).handler(async () => {
|
|
94
|
+
return getPeopleSoftApi().request({
|
|
95
|
+
url: `/v1/employee/all`,
|
|
96
|
+
method: "GET"
|
|
97
|
+
}).then((r) => r.data);
|
|
98
|
+
});
|
|
99
|
+
const getActiveEmployees = createServerFn({ method: "GET" }).handler(async () => {
|
|
100
|
+
return getPeopleSoftApi().request({
|
|
101
|
+
url: `/v1/employee/active`,
|
|
102
|
+
method: "GET"
|
|
103
|
+
}).then((r) => r.data);
|
|
104
|
+
});
|
|
105
|
+
const getEmployeeByEmployeeId = createServerFn({ method: "GET" }).inputValidator(EmployeeIdSchema).handler(async ({ data }) => {
|
|
106
|
+
return getPeopleSoftApi().request({
|
|
107
|
+
url: `/v1/employee/${encodeURIComponent(data.employeeId)}`,
|
|
108
|
+
method: "GET"
|
|
109
|
+
}).then((r) => r.data);
|
|
110
|
+
});
|
|
111
|
+
const getPreviousEmployeeIds = createServerFn({ method: "GET" }).handler(async () => {
|
|
112
|
+
return getPeopleSoftApi().request({
|
|
113
|
+
url: `/v1/employee/previousIds`,
|
|
114
|
+
method: "GET"
|
|
115
|
+
}).then((r) => r.data);
|
|
116
|
+
});
|
|
117
|
+
const getEmployeeSupervisor = createServerFn({ method: "GET" }).inputValidator(EmployeeIdSchema).handler(async ({ data }) => {
|
|
118
|
+
return getPeopleSoftApi().request({
|
|
119
|
+
url: `/v1/employee/${encodeURIComponent(data.employeeId)}/supervisor`,
|
|
120
|
+
method: "GET"
|
|
121
|
+
}).then((r) => r.data);
|
|
122
|
+
});
|
|
123
|
+
const getEmployeeSubordinates = createServerFn({ method: "GET" }).inputValidator(EmployeeIdSchema).handler(async ({ data }) => {
|
|
124
|
+
return getPeopleSoftApi().request({
|
|
125
|
+
url: `/v1/employee/${encodeURIComponent(data.employeeId)}/subordinates`,
|
|
126
|
+
method: "GET"
|
|
127
|
+
}).then((r) => r.data);
|
|
128
|
+
});
|
|
129
|
+
const getEmployeeManager = createServerFn({ method: "GET" }).inputValidator(EmployeeIdSchema).handler(async ({ data }) => {
|
|
130
|
+
return getPeopleSoftApi().request({
|
|
131
|
+
url: `/v1/employee/${encodeURIComponent(data.employeeId)}/manager`,
|
|
132
|
+
method: "GET"
|
|
133
|
+
}).then((r) => r.data);
|
|
134
|
+
});
|
|
135
|
+
const getEmployeeGeneralManager = createServerFn({ method: "GET" }).inputValidator(EmployeeIdSchema).handler(async ({ data }) => {
|
|
136
|
+
return getPeopleSoftApi().request({
|
|
137
|
+
url: `/v1/employee/${encodeURIComponent(data.employeeId)}/generalManager`,
|
|
138
|
+
method: "GET"
|
|
139
|
+
}).then((r) => r.data);
|
|
140
|
+
});
|
|
141
|
+
const getDepartments = createServerFn({ method: "GET" }).handler(async () => {
|
|
142
|
+
return getPeopleSoftApi().request({
|
|
143
|
+
url: `/v1/department/all`,
|
|
144
|
+
method: "GET"
|
|
145
|
+
}).then((r) => r.data);
|
|
146
|
+
});
|
|
147
|
+
const getDepartmentById = createServerFn({ method: "GET" }).inputValidator(DepartmentIdSchema).handler(async ({ data }) => {
|
|
148
|
+
return getPeopleSoftApi().request({
|
|
149
|
+
url: `/v1/department/${encodeURIComponent(data.departmentId)}`,
|
|
150
|
+
method: "GET"
|
|
151
|
+
}).then((r) => r.data);
|
|
152
|
+
});
|
|
153
|
+
const getDepartmentManager = createServerFn({ method: "GET" }).inputValidator(DepartmentIdSchema).handler(async ({ data }) => {
|
|
154
|
+
return getPeopleSoftApi().request({
|
|
155
|
+
url: `/v1/department/${encodeURIComponent(data.departmentId)}/manager`,
|
|
156
|
+
method: "GET"
|
|
157
|
+
}).then((r) => r.data);
|
|
158
|
+
});
|
|
159
|
+
const getDepartmentEmployees = createServerFn({ method: "GET" }).inputValidator(DepartmentIdSchema).handler(async ({ data }) => {
|
|
160
|
+
return getPeopleSoftApi().request({
|
|
161
|
+
url: `/v1/department/${encodeURIComponent(data.departmentId)}/employees`,
|
|
162
|
+
method: "GET"
|
|
163
|
+
}).then((r) => r.data);
|
|
164
|
+
});
|
|
165
|
+
const getCompanyGeneralManager = createServerFn({ method: "GET" }).inputValidator(CompanyCodeSchema).handler(async ({ data }) => {
|
|
166
|
+
return getPeopleSoftApi().request({
|
|
167
|
+
url: `/v1/company/${encodeURIComponent(data.companyCode)}/generalManager`,
|
|
168
|
+
method: "GET"
|
|
169
|
+
}).then((r) => r.data);
|
|
170
|
+
});
|
|
171
|
+
//#endregion
|
|
172
|
+
export { createApproval as C, withdrawApproval as D, resubmitApproval as E, cancelApproval as S, getApprovals as T, getPreviousEmployeeIds as _, getActiveEmployees as a, GetApprovalsSchema as b, getDepartmentEmployees as c, getEmployeeByEmployeeId as d, getEmployeeGeneralManager as f, getEmployees as g, getEmployeeSupervisor as h, SearchEmployeesSchema as i, getDepartmentManager as l, getEmployeeSubordinates as m, DepartmentIdSchema as n, getCompanyGeneralManager as o, getEmployeeManager as p, EmployeeIdSchema as r, getDepartmentById as s, CompanyCodeSchema as t, getDepartments as u, searchEmployees as v, getApproval as w, approveApproval as x, GetApprovalSchema as y };
|
|
173
|
+
|
|
174
|
+
//# sourceMappingURL=peoplesoft-CYSlmcwI.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"peoplesoft-CYSlmcwI.js","names":["createServerFn","createServerOnlyFn","AxiosInstance","z","serverEnv","ApproveApprovalSchema","CancelApprovalSchema","CreateApprovalSchema","ResubmitApprovalSchema","WithdrawApprovalSchema","Approval","ApprovalStatus","ApprovalStepResult","createExternalApi","approvalApi","getApprovalApi","baseUrl","APPROVAL_BASE_URL","Error","GetApprovalsSchema","object","appName","string","min","max","status","optional","approverEmployeeId","stepResult","GetApprovalSchema","id","uuid","getApprovals","method","inputValidator","handler","data","api","queryParams","URLSearchParams","append","toString","request","Array","url","then","r","getApproval","createApproval","approveApproval","resubmitApproval","withdrawApproval","cancelApproval","createServerFn","createServerOnlyFn","AxiosInstance","z","serverEnv","Department","Employee","createExternalApi","peopleSoftApi","getPeopleSoftApi","baseUrl","PS_BASE_URL","Error","SearchEmployeesSchema","object","searchTerm","string","min","EmployeeIdSchema","employeeId","DepartmentIdSchema","departmentId","CompanyCodeSchema","companyCode","searchEmployees","method","inputValidator","handler","data","api","request","Array","url","encodeURIComponent","then","r","getEmployees","getActiveEmployees","getEmployeeByEmployeeId","getPreviousEmployeeIds","getEmployeeSupervisor","getEmployeeSubordinates","getEmployeeManager","getEmployeeGeneralManager","getDepartments","getDepartmentById","getDepartmentManager","getDepartmentEmployees","getCompanyGeneralManager"],"sources":["../src/queries/server/approval.ts","../src/queries/server/peoplesoft.ts"],"sourcesContent":["import { createServerFn, createServerOnlyFn } from \"@tanstack/react-start\";\nimport type { AxiosInstance } from \"axios\";\nimport { z } from \"zod\";\nimport { serverEnv } from \"~/env\";\nimport {\n ApproveApprovalSchema,\n CancelApprovalSchema,\n CreateApprovalSchema,\n ResubmitApprovalSchema,\n WithdrawApprovalSchema,\n} from \"~/models/approval/Approval\";\nimport type { Approval } from \"~/models/approval/Approval\";\nimport { ApprovalStatus } from \"~/models/approval/ApprovalStatus\";\nimport { ApprovalStepResult } from \"~/models/approval/ApprovalStepResult\";\nimport { createExternalApi } from \"~/queries/server/externalApi\";\n\nlet approvalApi: AxiosInstance | null = null;\nconst getApprovalApi = createServerOnlyFn((): AxiosInstance => {\n const baseUrl = serverEnv.APPROVAL_BASE_URL;\n if (!baseUrl)\n throw new Error(\"APPROVAL_BASE_URL is not defined in server environment variables.\");\n approvalApi ??= createExternalApi(baseUrl, \"approval\");\n return approvalApi;\n});\n\nexport const GetApprovalsSchema = z.object({\n appName: z.string().min(1).max(255),\n status: ApprovalStatus.optional(),\n approverEmployeeId: z.string().min(1).max(20).optional(),\n stepResult: ApprovalStepResult.optional(),\n});\n\nexport const GetApprovalSchema = z.object({\n id: z.uuid(),\n});\n\nexport const getApprovals = createServerFn({ method: \"GET\" })\n .inputValidator(GetApprovalsSchema)\n .handler(async ({ data }) => {\n const api = getApprovalApi();\n const queryParams = new URLSearchParams();\n queryParams.append(\"applicationName\", data.appName);\n if (data.status) queryParams.append(\"status\", data.status.toString());\n if (data.approverEmployeeId) queryParams.append(\"approverEmployeeId\", data.approverEmployeeId);\n if (data.stepResult) queryParams.append(\"stepResult\", data.stepResult.toString());\n\n return api\n .request<Array<Approval>>({\n url: `/Requests/Requests?${queryParams.toString()}`,\n method: \"GET\",\n })\n .then((r) => r.data);\n });\n\nexport const getApproval = createServerFn({ method: \"GET\" })\n .inputValidator(GetApprovalSchema)\n .handler(async ({ data }) => {\n const api = getApprovalApi();\n return api\n .request<Approval>({\n url: `/Requests/${data.id}`,\n method: \"GET\",\n })\n .then((r) => r.data);\n });\n\nexport const createApproval = createServerFn({ method: \"POST\" })\n .inputValidator(CreateApprovalSchema)\n .handler(async ({ data }) => {\n const api = getApprovalApi();\n return api\n .request<Approval>({\n url: `/Requests`,\n method: \"POST\",\n data,\n })\n .then((r) => r.data);\n });\n\nexport const approveApproval = createServerFn({ method: \"POST\" })\n .inputValidator(ApproveApprovalSchema)\n .handler(async ({ data }) => {\n const api = getApprovalApi();\n return api\n .request<Approval>({\n url: `/Requests/${data.id}/single-approval`,\n method: \"POST\",\n data,\n })\n .then((r) => r.data);\n });\n\nexport const resubmitApproval = createServerFn({ method: \"POST\" })\n .inputValidator(ResubmitApprovalSchema)\n .handler(async ({ data }) => {\n const api = getApprovalApi();\n return api\n .request<Approval>({\n url: `/Requests/${data.id}/resubmit`,\n method: \"POST\",\n data,\n })\n .then((r) => r.data);\n });\n\nexport const withdrawApproval = createServerFn({ method: \"POST\" })\n .inputValidator(WithdrawApprovalSchema)\n .handler(async ({ data }) => {\n const api = getApprovalApi();\n return api\n .request<void>({\n url: `/Requests/${data.id}/withdraw`,\n method: \"POST\",\n data,\n })\n .then((r) => r.data);\n });\n\nexport const cancelApproval = createServerFn({ method: \"POST\" })\n .inputValidator(CancelApprovalSchema)\n .handler(async ({ data }) => {\n const api = getApprovalApi();\n return api\n .request<void>({\n url: `/Requests/${data.id}/cancel`,\n method: \"POST\",\n data,\n })\n .then((r) => r.data);\n });\n","import { createServerFn, createServerOnlyFn } from \"@tanstack/react-start\";\nimport type { AxiosInstance } from \"axios\";\nimport { z } from \"zod\";\nimport { serverEnv } from \"~/env\";\nimport type { Department } from \"~/models/peoplesoft/Department\";\nimport type { Employee } from \"~/models/peoplesoft/Employee\";\nimport { createExternalApi } from \"~/queries/server/externalApi\";\n\nlet peopleSoftApi: AxiosInstance | null = null;\nconst getPeopleSoftApi = createServerOnlyFn((): AxiosInstance => {\n const baseUrl = serverEnv.PS_BASE_URL;\n if (!baseUrl) throw new Error(\"PS_BASE_URL is not defined in server environment variables.\");\n peopleSoftApi ??= createExternalApi(baseUrl, \"ps\");\n return peopleSoftApi;\n});\n\nexport const SearchEmployeesSchema = z.object({\n searchTerm: z.string().min(1),\n});\n\nexport const EmployeeIdSchema = z.object({\n employeeId: z.string().min(1),\n});\n\nexport const DepartmentIdSchema = z.object({\n departmentId: z.string().min(1),\n});\n\nexport const CompanyCodeSchema = z.object({\n companyCode: z.string().min(1),\n});\n\nexport const searchEmployees = createServerFn({ method: \"GET\" })\n .inputValidator(SearchEmployeesSchema)\n .handler(async ({ data }) => {\n const api = getPeopleSoftApi();\n return api\n .request<Array<Employee>>({\n url: `/v1/employee?search=${encodeURIComponent(data.searchTerm)}`,\n method: \"GET\",\n })\n .then((r) => r.data);\n });\n\nexport const getEmployees = createServerFn({ method: \"GET\" }).handler(async () => {\n const api = getPeopleSoftApi();\n return api\n .request<Array<Employee>>({ url: `/v1/employee/all`, method: \"GET\" })\n .then((r) => r.data);\n});\n\nexport const getActiveEmployees = createServerFn({ method: \"GET\" }).handler(async () => {\n const api = getPeopleSoftApi();\n return api\n .request<Array<Employee>>({ url: `/v1/employee/active`, method: \"GET\" })\n .then((r) => r.data);\n});\n\nexport const getEmployeeByEmployeeId = createServerFn({ method: \"GET\" })\n .inputValidator(EmployeeIdSchema)\n .handler(async ({ data }) => {\n const api = getPeopleSoftApi();\n return api\n .request<Employee>({\n url: `/v1/employee/${encodeURIComponent(data.employeeId)}`,\n method: \"GET\",\n })\n .then((r) => r.data);\n });\n\nexport const getPreviousEmployeeIds = createServerFn({ method: \"GET\" }).handler(async () => {\n const api = getPeopleSoftApi();\n return api\n .request<Array<Employee>>({ url: `/v1/employee/previousIds`, method: \"GET\" })\n .then((r) => r.data);\n});\n\nexport const getEmployeeSupervisor = createServerFn({ method: \"GET\" })\n .inputValidator(EmployeeIdSchema)\n .handler(async ({ data }) => {\n const api = getPeopleSoftApi();\n return api\n .request<Employee>({\n url: `/v1/employee/${encodeURIComponent(data.employeeId)}/supervisor`,\n method: \"GET\",\n })\n .then((r) => r.data);\n });\n\nexport const getEmployeeSubordinates = createServerFn({ method: \"GET\" })\n .inputValidator(EmployeeIdSchema)\n .handler(async ({ data }) => {\n const api = getPeopleSoftApi();\n return api\n .request<Array<Employee>>({\n url: `/v1/employee/${encodeURIComponent(data.employeeId)}/subordinates`,\n method: \"GET\",\n })\n .then((r) => r.data);\n });\n\nexport const getEmployeeManager = createServerFn({ method: \"GET\" })\n .inputValidator(EmployeeIdSchema)\n .handler(async ({ data }) => {\n const api = getPeopleSoftApi();\n return api\n .request<Employee>({\n url: `/v1/employee/${encodeURIComponent(data.employeeId)}/manager`,\n method: \"GET\",\n })\n .then((r) => r.data);\n });\n\nexport const getEmployeeGeneralManager = createServerFn({ method: \"GET\" })\n .inputValidator(EmployeeIdSchema)\n .handler(async ({ data }) => {\n const api = getPeopleSoftApi();\n return api\n .request<Employee>({\n url: `/v1/employee/${encodeURIComponent(data.employeeId)}/generalManager`,\n method: \"GET\",\n })\n .then((r) => r.data);\n });\n\nexport const getDepartments = createServerFn({ method: \"GET\" }).handler(async () => {\n const api = getPeopleSoftApi();\n return api\n .request<Array<Department>>({ url: `/v1/department/all`, method: \"GET\" })\n .then((r) => r.data);\n});\n\nexport const getDepartmentById = createServerFn({ method: \"GET\" })\n .inputValidator(DepartmentIdSchema)\n .handler(async ({ data }) => {\n const api = getPeopleSoftApi();\n return api\n .request<Department>({\n url: `/v1/department/${encodeURIComponent(data.departmentId)}`,\n method: \"GET\",\n })\n .then((r) => r.data);\n });\n\nexport const getDepartmentManager = createServerFn({ method: \"GET\" })\n .inputValidator(DepartmentIdSchema)\n .handler(async ({ data }) => {\n const api = getPeopleSoftApi();\n return api\n .request<Employee>({\n url: `/v1/department/${encodeURIComponent(data.departmentId)}/manager`,\n method: \"GET\",\n })\n .then((r) => r.data);\n });\n\nexport const getDepartmentEmployees = createServerFn({ method: \"GET\" })\n .inputValidator(DepartmentIdSchema)\n .handler(async ({ data }) => {\n const api = getPeopleSoftApi();\n return api\n .request<Array<Employee>>({\n url: `/v1/department/${encodeURIComponent(data.departmentId)}/employees`,\n method: \"GET\",\n })\n .then((r) => r.data);\n });\n\nexport const getCompanyGeneralManager = createServerFn({ method: \"GET\" })\n .inputValidator(CompanyCodeSchema)\n .handler(async ({ data }) => {\n const api = getPeopleSoftApi();\n return api\n .request<Employee>({\n url: `/v1/company/${encodeURIComponent(data.companyCode)}/generalManager`,\n method: \"GET\",\n })\n .then((r) => r.data);\n });\n"],"mappings":";;;;;;AAgBA,IAAIc,cAAoC;AACxC,MAAMC,iBAAiBd,yBAAwC;CAC7D,MAAMe,UAAUZ,UAAUa;AAC1B,KAAI,CAACD,QACH,OAAM,IAAIE,MAAM,oEAAoE;AACtFJ,iBAAgBD,kBAAkBG,SAAS,WAAW;AACtD,QAAOF;EACP;AAEF,MAAaK,qBAAqBhB,EAAEiB,OAAO;CACzCC,SAASlB,EAAEmB,QAAQ,CAACC,IAAI,EAAE,CAACC,IAAI,IAAI;CACnCC,QAAQd,eAAee,UAAU;CACjCC,oBAAoBxB,EAAEmB,QAAQ,CAACC,IAAI,EAAE,CAACC,IAAI,GAAG,CAACE,UAAU;CACxDE,YAAYhB,mBAAmBc,UAAS;CACzC,CAAC;AAEF,MAAaG,oBAAoB1B,EAAEiB,OAAO,EACxCU,IAAI3B,EAAE4B,MAAK,EACZ,CAAC;AAEF,MAAaC,eAAehC,eAAe,EAAEiC,QAAQ,OAAO,CAAC,CAC1DC,eAAef,mBAAmB,CAClCgB,QAAQ,OAAO,EAAEC,WAAW;CAC3B,MAAMC,MAAMtB,gBAAgB;CAC5B,MAAMuB,cAAc,IAAIC,iBAAiB;AACzCD,aAAYE,OAAO,mBAAmBJ,KAAKf,QAAQ;AACnD,KAAIe,KAAKX,OAAQa,aAAYE,OAAO,UAAUJ,KAAKX,OAAOgB,UAAU,CAAC;AACrE,KAAIL,KAAKT,mBAAoBW,aAAYE,OAAO,sBAAsBJ,KAAKT,mBAAmB;AAC9F,KAAIS,KAAKR,WAAYU,aAAYE,OAAO,cAAcJ,KAAKR,WAAWa,UAAU,CAAC;AAEjF,Q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CAClCO,QAAQ,OAAO,EAAEC,WAAW;AAE3B,QADYnB,kBACF,CACPqB,QAAkB;EACjBE,KAAK,kBAAkBC,mBAAmBL,KAAKP,aAAa,CAAA;EAC5DI,QAAQ;EACT,CAAC,CACDS,MAAMC,MAAMA,EAAEP,KAAK;EACtB;AAEJ,MAAamB,yBAAyB/C,eAAe,EAAEyB,QAAQ,OAAO,CAAC,CACpEC,eAAeN,mBAAmB,CAClCO,QAAQ,OAAO,EAAEC,WAAW;AAE3B,QADYnB,kBACF,CACPqB,QAAyB;EACxBE,KAAK,kBAAkBC,mBAAmBL,KAAKP,aAAa,CAAA;EAC5DI,QAAQ;EACT,CAAC,CACDS,MAAMC,MAAMA,EAAEP,KAAK;EACtB;AAEJ,MAAaoB,2BAA2BhD,eAAe,EAAEyB,QAAQ,OAAO,CAAC,CACtEC,eAAeJ,kBAAkB,CACjCK,QAAQ,OAAO,EAAEC,WAAW;AAE3B,QADYnB,kBACF,CACPqB,QAAkB;EACjBE,KAAK,eAAeC,mBAAmBL,KAAKL,YAAY,CAAA;EACxDE,QAAQ;EACT,CAAC,CACDS,MAAMC,MAAMA,EAAEP,KAAK;EACtB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"queryClient-
|
|
1
|
+
{"version":3,"file":"queryClient-1OJ5Va3i.js","names":["QueryClient","queryClient"],"sources":["../src/lib/queryClient.ts"],"sourcesContent":["import { QueryClient } from \"@tanstack/react-query\";\n\nexport const queryClient = new QueryClient();\n"],"mappings":";;AAEA,MAAaC,cAAc,IAAID,aAAa"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as DialogsContext } from "./DialogsContext-
|
|
1
|
+
import { t as DialogsContext } from "./DialogsContext-DkePghS6.js";
|
|
2
2
|
import { c } from "react/compiler-runtime";
|
|
3
3
|
import { Button, Dialog, DialogActions, DialogContent, DialogTitle, useEventCallback } from "@mui/material";
|
|
4
4
|
import { useContext } from "react";
|
|
@@ -7,9 +7,9 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
7
7
|
//#region src/hooks/useDialogs.tsx
|
|
8
8
|
function AlertDialog(t0) {
|
|
9
9
|
const $ = c(23);
|
|
10
|
-
if ($[0] !== "
|
|
10
|
+
if ($[0] !== "40306a49a490b7e6c84c5f6c47439f8c7b6ee1f8cf1389e00101b53c362d1875") {
|
|
11
11
|
for (let $i = 0; $i < 23; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
12
|
-
$[0] = "
|
|
12
|
+
$[0] = "40306a49a490b7e6c84c5f6c47439f8c7b6ee1f8cf1389e00101b53c362d1875";
|
|
13
13
|
}
|
|
14
14
|
const { open, payload, onClose } = t0;
|
|
15
15
|
const { t } = useTranslation();
|
|
@@ -86,9 +86,9 @@ function AlertDialog(t0) {
|
|
|
86
86
|
}
|
|
87
87
|
function ConfirmDialog(t0) {
|
|
88
88
|
const $ = c(34);
|
|
89
|
-
if ($[0] !== "
|
|
89
|
+
if ($[0] !== "40306a49a490b7e6c84c5f6c47439f8c7b6ee1f8cf1389e00101b53c362d1875") {
|
|
90
90
|
for (let $i = 0; $i < 34; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
91
|
-
$[0] = "
|
|
91
|
+
$[0] = "40306a49a490b7e6c84c5f6c47439f8c7b6ee1f8cf1389e00101b53c362d1875";
|
|
92
92
|
}
|
|
93
93
|
const { open, payload, onClose } = t0;
|
|
94
94
|
const { t } = useTranslation();
|
|
@@ -195,9 +195,9 @@ function ConfirmDialog(t0) {
|
|
|
195
195
|
}
|
|
196
196
|
function useDialogs() {
|
|
197
197
|
const $ = c(10);
|
|
198
|
-
if ($[0] !== "
|
|
198
|
+
if ($[0] !== "40306a49a490b7e6c84c5f6c47439f8c7b6ee1f8cf1389e00101b53c362d1875") {
|
|
199
199
|
for (let $i = 0; $i < 10; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
200
|
-
$[0] = "
|
|
200
|
+
$[0] = "40306a49a490b7e6c84c5f6c47439f8c7b6ee1f8cf1389e00101b53c362d1875";
|
|
201
201
|
}
|
|
202
202
|
const { open, close } = useContext(DialogsContext);
|
|
203
203
|
let t0;
|
|
@@ -245,4 +245,4 @@ function useDialogs() {
|
|
|
245
245
|
//#endregion
|
|
246
246
|
export { useDialogs as t };
|
|
247
247
|
|
|
248
|
-
//# sourceMappingURL=useDialogs-
|
|
248
|
+
//# sourceMappingURL=useDialogs-BQEh6of8.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDialogs-BQEh6of8.js","names":["Button","Dialog","DialogActions","DialogContent","DialogTitle","useEventCallback","useContext","useTranslation","DialogsContext","ReactNode","OpenDialogOptions","onClose","result","TResult","Promise","AlertOptions","title","ConfirmOptions","cancelText","DialogProps","payload","TPayload","open","OpenAlertDialog","message","options","OpenConfirmDialog","DialogComponent","React","ComponentType","OpenDialog","Component","CloseDialog","dialog","AlertDialogPayload","AlertDialogProps","AlertDialog","t0","$","_c","$i","Symbol","for","t","t1","t2","t3","t4","t5","t6","t7","t8","ConfirmDialogPayload","ConfirmDialogProps","ConfirmDialog","t9","t10","t11","t12","DialogHook","alert","confirm","close","useDialogs","undefined","message_0","options_0"],"sources":["../src/hooks/useDialogs.tsx"],"sourcesContent":["import {\n Button,\n Dialog,\n DialogActions,\n DialogContent,\n DialogTitle,\n useEventCallback,\n} from \"@mui/material\";\nimport { useContext } from \"react\";\nimport { useTranslation } from \"react-i18next\";\nimport { DialogsContext } from \"../contexts/DialogsContext\";\nimport type { ReactNode } from \"react\";\n\nexport interface OpenDialogOptions<TResult> {\n onClose?: (result: TResult) => Promise<void>;\n}\n\nexport interface AlertOptions {\n title?: ReactNode;\n}\n\nexport interface ConfirmOptions {\n title?: ReactNode;\n cancelText?: ReactNode;\n}\n\nexport interface DialogProps<TPayload = undefined, TResult = void> {\n payload: TPayload;\n open: boolean;\n onClose: (result: TResult) => Promise<void>;\n}\n\nexport type OpenAlertDialog = (message: ReactNode, options?: AlertOptions) => Promise<void>;\n\nexport type OpenConfirmDialog = (message: ReactNode, options?: ConfirmOptions) => Promise<boolean>;\n\nexport type DialogComponent<TPayload, TResult> = React.ComponentType<\n DialogProps<TPayload, TResult>\n>;\n\nexport interface OpenDialog {\n <TPayload extends undefined, TResult>(\n Component: DialogComponent<TPayload, TResult>,\n payload?: TPayload,\n options?: OpenDialogOptions<TResult>,\n ): Promise<TResult>;\n <TPayload, TResult>(\n Component: DialogComponent<TPayload, TResult>,\n payload: TPayload,\n options?: OpenDialogOptions<TResult>,\n ): Promise<TResult>;\n}\n\nexport type CloseDialog = <TResult>(dialog: Promise<TResult>, result: TResult) => Promise<TResult>;\n\nexport interface AlertDialogPayload extends AlertOptions {\n message: ReactNode;\n}\n\nexport type AlertDialogProps = DialogProps<AlertDialogPayload, void>;\n\nexport function AlertDialog({ open, payload, onClose }: Readonly<AlertDialogProps>) {\n const { t } = useTranslation();\n\n return (\n <Dialog maxWidth=\"xs\" fullWidth open={open} onClose={() => onClose()} disableRestoreFocus>\n <DialogTitle>{payload.title ?? t(\"Layout.Dialog.Alert\")}</DialogTitle>\n <DialogContent>{payload.message}</DialogContent>\n <DialogActions>\n <Button onClick={() => onClose()} autoFocus>\n {t(\"Layout.Dialog.Confirm\")}\n </Button>\n </DialogActions>\n </Dialog>\n );\n}\n\nexport interface ConfirmDialogPayload extends ConfirmOptions {\n message: ReactNode;\n}\n\nexport type ConfirmDialogProps = DialogProps<ConfirmDialogPayload, boolean>;\n\nexport function ConfirmDialog({ open, payload, onClose }: Readonly<ConfirmDialogProps>) {\n const { t } = useTranslation();\n\n return (\n <Dialog maxWidth=\"xs\" fullWidth open={open} onClose={() => onClose(false)} disableRestoreFocus>\n <DialogTitle>{payload.title ?? t(\"Layout.Dialog.Confirm\")}</DialogTitle>\n <DialogContent>{payload.message}</DialogContent>\n <DialogActions>\n <Button onClick={() => onClose(false)}>\n {payload.cancelText ?? t(\"Layout.Dialog.Cancel\")}\n </Button>\n <Button onClick={() => onClose(true)} autoFocus>\n {t(\"Layout.Dialog.Confirm\")}\n </Button>\n </DialogActions>\n </Dialog>\n );\n}\n\ninterface DialogHook {\n alert: OpenAlertDialog;\n confirm: OpenConfirmDialog;\n open: OpenDialog;\n close: CloseDialog;\n}\n\nexport function useDialogs(): DialogHook {\n const { open, close } = useContext(DialogsContext);\n\n const alert = useEventCallback<OpenAlertDialog>((message, { ...options } = {}) =>\n open(AlertDialog, { ...options, message }),\n );\n\n const confirm = useEventCallback<OpenConfirmDialog>((message, { ...options } = {}) =>\n open(ConfirmDialog, { ...options, message }),\n );\n\n return { alert, confirm, open, close };\n}\n"],"mappings":";;;;;;;AA6DA,SAAOoC,YAAAC,IAAA;CAAA,MAAAC,IAAAC,EAAA,GAAA;AAAA,KAAAD,EAAA,OAAA,oEAAA;AAAA,OAAA,IAAAE,KAAA,GAAAA,KAAA,IAAAA,MAAA,EAAAF,GAAAE,MAAAC,OAAAC,IAAA,4BAAA;AAAAJ,IAAA,KAAA;;CAAqB,MAAA,EAAAhB,MAAAF,SAAAT,YAAA0B;CAC1B,MAAA,EAAAM,MAAcpC,gBAAgB;CAAC,IAAAqC;AAAA,KAAAN,EAAA,OAAA3B,SAAA;AAGwBiC,aAAMjC,SAAS;AAAA2B,IAAA,KAAA3B;AAAA2B,IAAA,KAAAM;OAAAA,MAAAN,EAAA;CAAA,IAAAO;AAAA,KAAAP,EAAA,OAAAlB,QAAAJ,SAAAsB,EAAA,OAAAK,GAAA;AACpDE,OAAAzB,QAAOJ,SAAU2B,EAAE,sBAAsB;AAAAL,IAAA,KAAAlB,QAAAJ;AAAAsB,IAAA,KAAAK;AAAAL,IAAA,KAAAO;OAAAA,MAAAP,EAAA;CAAA,IAAAQ;AAAA,KAAAR,EAAA,OAAAO,IAAA;AAAvDC,OAAA,oBAAC,aAAD,EAAA,UAAcD,IAAwD,CAAA;AAAAP,IAAA,KAAAO;AAAAP,IAAA,KAAAQ;OAAAA,MAAAR,EAAA;CAAA,IAAAS;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C;GAA+B;AAAAxB,IAAA,KAAAsB;AAAAtB,IAAA,KAAAwB;AAAAxB,IAAA,KAAAuB;AAAAvB,IAAA,KAAAhB;AAAAgB,IAAA,KAAAO;OAAAA,MAAAP,EAAA;AAAA,QAA/BO"}
|
|
@@ -1,39 +1,13 @@
|
|
|
1
|
+
import { t as clientEnv } from "./env-Dgbk8SQN.js";
|
|
1
2
|
import { permissions, scopes } from "virtual:wcz-layout";
|
|
2
|
-
import { z } from "zod";
|
|
3
3
|
import { BrowserAuthError, EventType, InteractionRequiredAuthError, NavigationClient, PublicClientApplication } from "@azure/msal-browser";
|
|
4
|
-
import { createEnv } from "@t3-oss/env-core";
|
|
5
4
|
import { createClientOnlyFn, createIsomorphicFn } from "@tanstack/react-start";
|
|
6
|
-
//#region src/env.ts
|
|
7
|
-
const clientEnv = createEnv({
|
|
8
|
-
clientPrefix: "VITE_",
|
|
9
|
-
client: {
|
|
10
|
-
VITE_ENTRA_CLIENT_ID: z.string(),
|
|
11
|
-
VITE_ENTRA_TENANT_ID: z.string(),
|
|
12
|
-
VITE_APP_TITLE: z.string(),
|
|
13
|
-
VITE_MUI_LICENSE_KEY: z.string()
|
|
14
|
-
},
|
|
15
|
-
runtimeEnv: import.meta.env,
|
|
16
|
-
emptyStringAsUndefined: true
|
|
17
|
-
});
|
|
18
|
-
const serverEnv = createEnv({
|
|
19
|
-
server: {
|
|
20
|
-
ENTRA_CLIENT_ID: z.string(),
|
|
21
|
-
ENTRA_TENANT_ID: z.string(),
|
|
22
|
-
ENTRA_CLIENT_SECRET: z.string()
|
|
23
|
-
},
|
|
24
|
-
runtimeEnv: process.env,
|
|
25
|
-
emptyStringAsUndefined: true
|
|
26
|
-
});
|
|
27
|
-
//#endregion
|
|
28
5
|
//#region src/lib/auth/msalClient.ts
|
|
29
|
-
const pca = new PublicClientApplication({
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
},
|
|
35
|
-
cache: { cacheLocation: "localStorage" }
|
|
36
|
-
});
|
|
6
|
+
const pca = new PublicClientApplication({ auth: {
|
|
7
|
+
clientId: clientEnv.VITE_ENTRA_CLIENT_ID,
|
|
8
|
+
authority: `https://login.microsoftonline.com/${clientEnv.VITE_ENTRA_TENANT_ID}`,
|
|
9
|
+
redirectUri: "/"
|
|
10
|
+
} });
|
|
37
11
|
const restoreActiveAccount = () => {
|
|
38
12
|
if (pca.getActiveAccount()) return;
|
|
39
13
|
const [firstAccount] = pca.getAllAccounts();
|
|
@@ -194,9 +168,6 @@ const getFieldStatus = (field) => {
|
|
|
194
168
|
helperText: meta.errors[0]?.message
|
|
195
169
|
};
|
|
196
170
|
};
|
|
197
|
-
const toKebabCase = (str) => {
|
|
198
|
-
return str.replaceAll(/([a-z])([A-Z])/g, "$1-$2").replaceAll(/[\s_]+/g, "-").replaceAll(/[^a-zA-Z0-9-]/g, "").toLowerCase().replaceAll(/-+/g, "-").replaceAll(/(^-|-$)/g, "");
|
|
199
|
-
};
|
|
200
171
|
const decodeJwt = (token) => {
|
|
201
172
|
const base64 = token.split(".")[1].replace(/-/g, "+").replace(/_/g, "/");
|
|
202
173
|
const payload = decodeURIComponent(atob(base64).split("").map((c) => "%" + ("00" + c.charCodeAt(0).toString(16)).slice(-2)).join(""));
|
|
@@ -214,6 +185,6 @@ const buildUser = (payload) => ({
|
|
|
214
185
|
}
|
|
215
186
|
});
|
|
216
187
|
//#endregion
|
|
217
|
-
export { getFieldStatus as a,
|
|
188
|
+
export { getFieldStatus as a, TanStackNavigationClient as c, pca as d, buildUser as i, getAccessToken as l, WISTRON_PRIMARY_COLOR as n, requirePermission as o, WISTRON_SECONDARY_COLOR as r, rootRouteHead as s, Platform as t, getUser as u };
|
|
218
189
|
|
|
219
|
-
//# sourceMappingURL=utils-
|
|
190
|
+
//# sourceMappingURL=utils-B7LPctqx.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils-B7LPctqx.js","names":["AuthenticationResult","BrowserAuthError","EventMessage","EventType","InteractionRequiredAuthError","NavigationClient","NavigationOptions","PublicClientApplication","useNavigate","createClientOnlyFn","createIsomorphicFn","scopes","definedScopes","clientEnv","buildUser","decodeJwt","User","pca","auth","clientId","VITE_ENTRA_CLIENT_ID","authority","VITE_ENTRA_TENANT_ID","redirectUri","restoreActiveAccount","getActiveAccount","firstAccount","getAllAccounts","setActiveAccount","initializeMsal","globalThis","window","undefined","initialize","addEventCallback","event","eventType","LOGIN_SUCCESS","payload","account","response","handleRedirectPromise","initializationPromise","msalReady","TanStackNavigationClient","constructor","navigate","ReturnType","navigateInternal","url","options","relative","replace","location","origin","to","noHistory","getUser","server","client","Promise","idToken","getAccessToken","scopeKey","Error","accessToken","acquireTokenSilent","error","acquireTokenRedirect","redirectError","errorCode","AnyFieldApi","permissions","clientEnv","TokenPayload","User","getUser","WISTRON_PRIMARY_COLOR","WISTRON_SECONDARY_COLOR","Platform","isAndroid","test","userAgent","isIOS","isWindows","isMacOS","navigator","RootRouteHeadOptions","manifest","rootRouteHead","options","meta","charSet","name","content","title","VITE_APP_TITLE","links","rel","sizes","href","type","requirePermission","permissionKey","user","hasPermission","Error","FormOmittedProps","getFieldStatus","field","state","isTouched","hasError","errors","length","helperText","message","toKebabCase","str","replaceAll","toLowerCase","decodeJwt","token","base64Payload","split","base64","replace","payload","decodeURIComponent","atob","map","c","charCodeAt","toString","slice","join","JSON","parse","buildUser","id","sub","email","preferred_username","department","toUpperCase","employeeId","companyName","key","allowedGroups","some","k","groups","includes"],"sources":["../src/lib/auth/msalClient.ts","../src/lib/utils.ts"],"sourcesContent":["import {\n AuthenticationResult,\n BrowserAuthError,\n EventMessage,\n EventType,\n InteractionRequiredAuthError,\n NavigationClient,\n NavigationOptions,\n PublicClientApplication,\n} from \"@azure/msal-browser\";\nimport { useNavigate } from \"@tanstack/react-router\";\nimport { createClientOnlyFn, createIsomorphicFn } from \"@tanstack/react-start\";\nimport { scopes as definedScopes } from \"virtual:wcz-layout\";\nimport { clientEnv } from \"~/env\";\nimport { buildUser, decodeJwt } from \"~/lib/utils\";\nimport type { User } from \"~/models/User\";\n\nexport const pca = new PublicClientApplication({\n auth: {\n clientId: clientEnv.VITE_ENTRA_CLIENT_ID,\n authority: `https://login.microsoftonline.com/${clientEnv.VITE_ENTRA_TENANT_ID}`,\n redirectUri: \"/\",\n },\n});\n\nconst restoreActiveAccount = () => {\n if (pca.getActiveAccount()) return;\n const [firstAccount] = pca.getAllAccounts();\n if (firstAccount) pca.setActiveAccount(firstAccount);\n};\n\nconst initializeMsal = async () => {\n if (globalThis.window === undefined) return;\n\n await pca.initialize();\n\n pca.addEventCallback((event: EventMessage) => {\n if (event.eventType === EventType.LOGIN_SUCCESS && event.payload) {\n const payload = event.payload as AuthenticationResult;\n pca.setActiveAccount(payload.account);\n }\n });\n\n const response = await pca.handleRedirectPromise();\n if (response?.account) {\n pca.setActiveAccount(response.account);\n return;\n }\n\n restoreActiveAccount();\n};\n\nconst initializationPromise = initializeMsal();\nawait initializationPromise;\n\nexport const msalReady = () => initializationPromise;\n\nexport class TanStackNavigationClient extends NavigationClient {\n constructor(private readonly navigate: ReturnType<typeof useNavigate>) {\n super();\n }\n async navigateInternal(url: string, options: NavigationOptions) {\n const relative = url.replace(location.origin, \"\");\n this.navigate({ to: relative, replace: options.noHistory });\n return false;\n }\n}\n\nexport const getUser = createIsomorphicFn()\n .server(() => null)\n .client(async (): Promise<User | null> => {\n await initializationPromise;\n restoreActiveAccount();\n\n const account = pca.getActiveAccount();\n if (!account?.idToken) return null;\n\n return buildUser(decodeJwt(account.idToken));\n });\n\n/**\n * Token Acquisition: Get authenticated access token.\n * Use when: Making API calls from the browser to secured endpoints.\n */\nexport const getAccessToken = createClientOnlyFn(async (scopeKey: keyof typeof definedScopes) => {\n await initializationPromise;\n restoreActiveAccount();\n\n const account = pca.getActiveAccount();\n if (!account) throw new Error(\"No active account. User not signed in.\");\n\n const scopes = [...definedScopes[scopeKey]];\n\n try {\n const { accessToken } = await pca.acquireTokenSilent({ scopes, account });\n return accessToken;\n } catch (error) {\n if (error instanceof InteractionRequiredAuthError) {\n try {\n await pca.acquireTokenRedirect({ scopes, account });\n } catch (redirectError) {\n // Another interaction is already in progress — MSAL will handle it.\n if (\n !(redirectError instanceof BrowserAuthError) ||\n redirectError.errorCode !== \"interaction_in_progress\"\n ) {\n throw redirectError;\n }\n }\n\n // Keep the caller suspended until the page navigates away so pending\n // server functions don't fire without an Authorization header.\n await new Promise<never>(() => {});\n }\n\n throw error;\n }\n});\n","import type { AnyFieldApi } from \"@tanstack/react-form\";\nimport { permissions } from \"virtual:wcz-layout\";\nimport { clientEnv } from \"~/env\";\nimport type { TokenPayload } from \"~/models/TokenPayload\";\nimport type { User } from \"~/models/User\";\nimport { getUser } from \"./auth/msalClient\";\n\nexport const WISTRON_PRIMARY_COLOR = \"#00506E\";\nexport const WISTRON_SECONDARY_COLOR = \"#64DC00\";\n\nexport class Platform {\n static get isAndroid() {\n return /android/i.test(this.userAgent);\n }\n static get isIOS() {\n return /iPad|iPhone|iPod/.test(this.userAgent);\n }\n static get isWindows() {\n return /windows/i.test(this.userAgent);\n }\n static get isMacOS() {\n return /Macintosh|MacIntel|MacPPC|Mac68K/.test(this.userAgent);\n }\n\n private static get userAgent() {\n return typeof navigator === \"undefined\" ? \"\" : navigator.userAgent;\n }\n}\n\ninterface RootRouteHeadOptions {\n manifest?: string;\n}\n\nexport const rootRouteHead = (options?: RootRouteHeadOptions) => ({\n meta: [\n { charSet: \"utf-8\" },\n { name: \"viewport\", content: \"width=device-width, initial-scale=1\" },\n { title: clientEnv.VITE_APP_TITLE },\n { name: \"og:type\", content: \"website\" },\n { name: \"og:title\", content: clientEnv.VITE_APP_TITLE },\n { name: \"og:image\", content: \"/favicon-32x32.png\" },\n ],\n links: [\n { rel: \"apple-touch-icon\", sizes: \"180x180\", href: \"/apple-touch-icon.png\" },\n { rel: \"icon\", type: \"image/png\", sizes: \"32x32\", href: \"/favicon-32x32.png\" },\n { rel: \"icon\", type: \"image/png\", sizes: \"16x16\", href: \"/favicon-16x16.png\" },\n { rel: \"manifest\", href: options?.manifest || \"/manifest.json\" },\n { rel: \"icon\", href: \"/favicon.ico\" },\n ],\n});\n\nexport const requirePermission = (permissionKey: keyof typeof permissions) => {\n return async () => {\n const user = await getUser();\n\n if (!user?.hasPermission(permissionKey))\n throw new Error(\"You do not have permission to access this page.\");\n\n return { user };\n };\n};\n\n/* Internal Utils */\nexport type FormOmittedProps =\n | \"name\"\n | \"value\"\n | \"onChange\"\n | \"onBlur\"\n | \"error\"\n | \"helperText\"\n | \"renderInput\"\n | \"type\"\n | \"aria-label\";\n\nexport const getFieldStatus = (field: AnyFieldApi) => {\n const { meta } = field.state;\n\n const isTouched = meta.isTouched;\n const hasError = !!meta.errors.length;\n const helperText = meta.errors[0]?.message;\n\n return { isTouched, hasError, helperText };\n};\n\nexport const toKebabCase = (str: string): string => {\n return str\n .replaceAll(/([a-z])([A-Z])/g, \"$1-$2\")\n .replaceAll(/[\\s_]+/g, \"-\")\n .replaceAll(/[^a-zA-Z0-9-]/g, \"\")\n .toLowerCase()\n .replaceAll(/-+/g, \"-\")\n .replaceAll(/(^-|-$)/g, \"\");\n};\n\nexport const decodeJwt = (token: string) => {\n const base64Payload = token.split(\".\")[1];\n const base64 = base64Payload.replace(/-/g, \"+\").replace(/_/g, \"/\");\n const payload = decodeURIComponent(\n atob(base64)\n .split(\"\")\n .map((c) => \"%\" + (\"00\" + c.charCodeAt(0).toString(16)).slice(-2))\n .join(\"\"),\n );\n return JSON.parse(payload) as TokenPayload;\n};\n\nexport const buildUser = (payload: TokenPayload): User => ({\n id: payload.sub,\n name: payload.name?.split(\"/\")[0],\n email: payload.preferred_username?.toLowerCase(),\n department: payload.department?.toUpperCase() || \"\",\n employeeId: payload.employeeId?.toUpperCase() || \"\",\n companyName: payload.companyName || \"\",\n hasPermission: (key: keyof typeof permissions) => {\n const allowedGroups = permissions[key];\n return allowedGroups.some((k) => (payload.groups ?? []).includes(k));\n },\n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Aa;CAChDuB,YAAYhB,QAAQgB,YAAYC,aAAa,IAAI;CACjDC,YAAYlB,QAAQkB,YAAYD,aAAa,IAAI;CACjDE,aAAanB,QAAQmB,eAAe;CACpCzC,gBAAgB0C,QAAkC;AAEhD,SADsB3E,YAAY2E,KACbE,MAAMC,OAAOvB,QAAQwB,UAAU,EAAE,EAAEC,SAASF,EAAE,CAAC;;CAEvE"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as User } from "./User-
|
|
1
|
+
import { t as User } from "./User-B92WOpE2.js";
|
|
2
2
|
import { permissions } from "virtual:wcz-layout";
|
|
3
3
|
//#region src/lib/utils.d.ts
|
|
4
4
|
declare const WISTRON_PRIMARY_COLOR = "#00506E";
|
|
@@ -53,4 +53,4 @@ declare const requirePermission: (permissionKey: keyof typeof permissions) => ()
|
|
|
53
53
|
type FormOmittedProps = "name" | "value" | "onChange" | "onBlur" | "error" | "helperText" | "renderInput" | "type" | "aria-label";
|
|
54
54
|
//#endregion
|
|
55
55
|
export { requirePermission as a, WISTRON_SECONDARY_COLOR as i, Platform as n, rootRouteHead as o, WISTRON_PRIMARY_COLOR as r, FormOmittedProps as t };
|
|
56
|
-
//# sourceMappingURL=utils-
|
|
56
|
+
//# sourceMappingURL=utils-BM8-Efdl.d.ts.map
|
package/dist/utils.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as requirePermission, n as Platform } from "./utils-
|
|
2
|
-
import { t as getAccessToken } from "./msalClient-
|
|
1
|
+
import { a as requirePermission, n as Platform } from "./utils-BM8-Efdl.js";
|
|
2
|
+
import { t as getAccessToken } from "./msalClient-DZjYT_QJ.js";
|
|
3
3
|
import i18next, { t } from "i18next";
|
|
4
4
|
import { scopes } from "virtual:wcz-layout";
|
|
5
5
|
import { createEnv } from "@t3-oss/env-core";
|
package/dist/utils.js
CHANGED
|
@@ -1,50 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { l as getAccessToken, o as requirePermission, t as Platform } from "./utils-B7LPctqx.js";
|
|
2
|
+
import { n as getTokenOnBehalfOf, t as getAppToken } from "./msalServer-coQaBOlr.js";
|
|
2
3
|
import i18next, { t } from "i18next";
|
|
3
|
-
import { scopes } from "virtual:wcz-layout";
|
|
4
4
|
import { createEnv } from "@t3-oss/env-core";
|
|
5
|
-
import { createServerOnlyFn } from "@tanstack/react-start";
|
|
6
5
|
import { uuidv7 } from "uuidv7";
|
|
7
|
-
import { ConfidentialClientApplication } from "@azure/msal-node";
|
|
8
|
-
//#region src/lib/auth/msalServer.ts
|
|
9
|
-
let ccaInstance = null;
|
|
10
|
-
function getCCA() {
|
|
11
|
-
ccaInstance ??= new ConfidentialClientApplication({ auth: {
|
|
12
|
-
clientId: serverEnv.ENTRA_CLIENT_ID,
|
|
13
|
-
clientSecret: serverEnv.ENTRA_CLIENT_SECRET,
|
|
14
|
-
authority: `https://login.microsoftonline.com/${serverEnv.ENTRA_TENANT_ID}`
|
|
15
|
-
} });
|
|
16
|
-
return ccaInstance;
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* On-Behalf-Of flow: Exchange user token for a token to call downstream API
|
|
20
|
-
* Use when: Server needs to call microservice on behalf of the logged-in user
|
|
21
|
-
*/
|
|
22
|
-
const getTokenOnBehalfOf = createServerOnlyFn(async (userToken, scopeKey) => {
|
|
23
|
-
const cca = getCCA();
|
|
24
|
-
const scopes$1 = [...scopes[scopeKey]];
|
|
25
|
-
const result = await cca.acquireTokenOnBehalfOf({
|
|
26
|
-
oboAssertion: userToken,
|
|
27
|
-
scopes: scopes$1
|
|
28
|
-
});
|
|
29
|
-
if (!result) throw new Error("Failed to acquire OBO token");
|
|
30
|
-
return result.accessToken;
|
|
31
|
-
});
|
|
32
|
-
/**
|
|
33
|
-
* Client Credentials flow: Get app-only token (no user context)
|
|
34
|
-
* Use when: Background jobs, scheduled tasks, service-to-service calls
|
|
35
|
-
*/
|
|
36
|
-
const getAppToken = createServerOnlyFn(async (scopeKey) => {
|
|
37
|
-
const cca = getCCA();
|
|
38
|
-
const defaultScopes = scopes[scopeKey].map((scope) => {
|
|
39
|
-
const lastSlash = scope.lastIndexOf("/");
|
|
40
|
-
return `${scope.substring(0, lastSlash)}/.default`;
|
|
41
|
-
});
|
|
42
|
-
const uniqueScopes = [...new Set(defaultScopes)];
|
|
43
|
-
const result = await cca.acquireTokenByClientCredential({ scopes: uniqueScopes });
|
|
44
|
-
if (!result) throw new Error("Failed to acquire app token");
|
|
45
|
-
return result.accessToken;
|
|
46
|
-
});
|
|
47
|
-
//#endregion
|
|
48
6
|
export { Platform, createEnv, getAccessToken, getAppToken, getTokenOnBehalfOf, i18next, requirePermission, t, uuidv7 };
|
|
49
|
-
|
|
50
|
-
//# sourceMappingURL=utils.js.map
|
package/dist/vite.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vite.js","names":["z","VaultConfigSchema","object","VAULT_ADDRESS","url","VAULT_USERNAME","string","min","VAULT_PASSWORD","VAULT_SECRET_PATH","VAULT_MOUNT_POINT","default","VaultConfig","infer","fs","https","path","axios","loadEnv","VaultConfigSchema","Resource","Plugin","fetchVaultSecrets","env","Record","Promise","config","parse","VAULT_ADDRESS","VAULT_USERNAME","VAULT_PASSWORD","VAULT_SECRET_PATH","VAULT_MOUNT_POINT","client","create","baseURL","httpsAgent","Agent","rejectUnauthorized","data","loginData","post","password","secretData","get","headers","auth","client_token","secrets","Error","Object","fromEntries","entries","map","key","value","JSON","stringify","loadVaultSecrets","command","process","cwd","forEach","e","console","warn","message","loadLocaleResources","localesPath","addWatchFile","existsSync","mkdirSync","recursive","enPath","join","writeFileSync","files","readdirSync","resources","file","filter","f","endsWith","lang","basename","filePath","translation","readFileSync","ensurePermissionsFile","permissionsPath","dir","dirname","ensureScopesFile","scopesPath","viteWczLayout","virtualModuleId","resolvedVirtualModuleId","name","enforce","configResolved","resolvedConfig","resolve","root","_","optimizeDeps","exclude","include","configureServer","server","refresh","includes","module","moduleGraph","getModuleById","invalidateModule","ws","send","type","watcher","add","on","resolveId","id","load","bind","normalizedPermissionsPath","split","sep","posix","normalizedScopesPath"],"sources":["../src/models/VaultConfig.ts","../src/lib/vite-plugin.ts"],"sourcesContent":["import z from \"zod\";\n\nexport const VaultConfigSchema = z.object({\n VAULT_ADDRESS: z.url(),\n VAULT_USERNAME: z.string().min(1),\n VAULT_PASSWORD: z.string().min(1),\n VAULT_SECRET_PATH: z.string().min(1),\n VAULT_MOUNT_POINT: z.string().default(\"release\"),\n});\n\nexport type VaultConfig = z.infer<typeof VaultConfigSchema>;\n","import fs from \"node:fs\";\nimport https from \"node:https\";\nimport path from \"node:path\";\nimport axios from \"axios\";\nimport { loadEnv } from \"vite\";\nimport { VaultConfigSchema } from \"../models/VaultConfig\";\nimport type { Resource } from \"i18next\";\nimport type { Plugin } from \"vite\";\n\nasync function fetchVaultSecrets(env: Record<string, string>): Promise<Record<string, string>> {\n const config = VaultConfigSchema.parse(env);\n const { VAULT_ADDRESS, VAULT_USERNAME, VAULT_PASSWORD, VAULT_SECRET_PATH, VAULT_MOUNT_POINT } =\n config;\n\n const client = axios.create({\n baseURL: VAULT_ADDRESS,\n httpsAgent: new https.Agent({ rejectUnauthorized: false }),\n });\n\n const { data: loginData } = await client.post(`/v1/auth/userpass/login/${VAULT_USERNAME}`, {\n password: VAULT_PASSWORD,\n });\n\n const { data: secretData } = await client.get(\n `/v1/${VAULT_MOUNT_POINT}/data/${VAULT_SECRET_PATH}`,\n {\n headers: { \"X-Vault-Token\": loginData.auth.client_token },\n },\n );\n\n const secrets = secretData?.data?.data;\n if (!secrets) throw new Error(\"No secrets found\");\n\n return Object.fromEntries(\n Object.entries(secrets).map(([key, value]) => [\n key,\n typeof value === \"string\" ? value : JSON.stringify(value),\n ]),\n );\n}\n\nasync function loadVaultSecrets(command: string): Promise<void> {\n if (command !== \"serve\") return;\n\n const env = loadEnv(\"development\", process.cwd(), \"\");\n if (!env.VAULT_ADDRESS) return;\n\n try {\n const secrets = await fetchVaultSecrets(env);\n Object.entries(secrets).forEach(([key, value]) => {\n process.env[key] ??= value;\n });\n } catch (e) {\n console.warn(\"[vite:wcz-layout] Vault failed:\", e instanceof Error ? e.message : e);\n }\n}\n\nfunction loadLocaleResources(localesPath: string, addWatchFile: (path: string) => void): Resource {\n if (!fs.existsSync(localesPath)) fs.mkdirSync(localesPath, { recursive: true });\n\n const enPath = path.join(localesPath, \"en.json\");\n if (!fs.existsSync(enPath)) fs.writeFileSync(enPath, JSON.stringify({}));\n\n const files = fs.readdirSync(localesPath);\n const resources: Resource = {};\n\n for (const file of files.filter((f) => f.endsWith(\".json\"))) {\n const lang = path.basename(file, \".json\");\n const filePath = path.join(localesPath, file);\n try {\n resources[lang] = { translation: JSON.parse(fs.readFileSync(filePath, \"utf-8\")) };\n } catch {\n resources[lang] = { translation: {} };\n }\n addWatchFile(filePath);\n }\n\n return resources;\n}\n\nfunction ensurePermissionsFile(\n permissionsPath: string,\n addWatchFile: (path: string) => void,\n): void {\n const dir = path.dirname(permissionsPath);\n if (!fs.existsSync(dir)) fs.mkdirSync(dir, { recursive: true });\n if (!fs.existsSync(permissionsPath)) {\n fs.writeFileSync(\n permissionsPath,\n 'export const permissions = {\\n admin: [\"wcz-developers\"]\\n} as const;',\n );\n }\n addWatchFile(permissionsPath);\n}\n\nfunction ensureScopesFile(scopesPath: string, addWatchFile: (path: string) => void): void {\n const dir = path.dirname(scopesPath);\n if (!fs.existsSync(dir)) fs.mkdirSync(dir, { recursive: true });\n if (!fs.existsSync(scopesPath)) {\n fs.writeFileSync(scopesPath, \"export const scopes = {\\n} as const;\");\n }\n addWatchFile(scopesPath);\n}\n\nexport function viteWczLayout(): Plugin {\n const virtualModuleId = \"virtual:wcz-layout\";\n const resolvedVirtualModuleId = \"\\0\" + virtualModuleId;\n\n let localesPath: string;\n let permissionsPath: string;\n let scopesPath: string;\n\n return {\n name: \"vite:wcz-layout\",\n enforce: \"pre\",\n configResolved(resolvedConfig) {\n localesPath = path.resolve(resolvedConfig.root, \"src/locales\");\n permissionsPath = path.resolve(resolvedConfig.root, \"src/lib/auth/permissions.ts\");\n scopesPath = path.resolve(resolvedConfig.root, \"src/lib/auth/scopes.ts\");\n },\n async config(_, { command }) {\n await loadVaultSecrets(command);\n\n return {\n optimizeDeps: {\n exclude: [virtualModuleId],\n include: [\n \"prop-types\",\n \"react-is\",\n \"hoist-non-react-statics\",\n \"url-parse\",\n \"file-saver\",\n \"attr-accept\",\n ],\n },\n };\n },\n configureServer(server) {\n const refresh = (filePath: string) => {\n if (\n filePath.includes(localesPath) ||\n filePath === permissionsPath ||\n filePath === scopesPath\n ) {\n const module = server.moduleGraph.getModuleById(resolvedVirtualModuleId);\n if (module) server.moduleGraph.invalidateModule(module);\n server.ws.send({ type: \"full-reload\", path: \"*\" });\n }\n };\n\n server.watcher.add([localesPath, permissionsPath, scopesPath]);\n server.watcher.on(\"add\", refresh);\n server.watcher.on(\"change\", refresh);\n server.watcher.on(\"unlink\", refresh);\n },\n resolveId(id) {\n if (id === virtualModuleId) return resolvedVirtualModuleId;\n return null;\n },\n load(id) {\n if (id !== resolvedVirtualModuleId) return null;\n\n const resources = loadLocaleResources(localesPath, this.addWatchFile.bind(this));\n ensurePermissionsFile(permissionsPath, this.addWatchFile.bind(this));\n ensureScopesFile(scopesPath, this.addWatchFile.bind(this));\n\n const normalizedPermissionsPath = permissionsPath.split(path.sep).join(path.posix.sep);\n const normalizedScopesPath = scopesPath.split(path.sep).join(path.posix.sep);\n return `\n export const resources = ${JSON.stringify(resources)};\n export { permissions } from \"${normalizedPermissionsPath}\";\n export { scopes } from \"${normalizedScopesPath}\";\n `;\n },\n };\n}\n"],"mappings":";;;;;;;AAEA,MAAaC,oBAAoBD,IAAEE,OAAO;CACxCC,eAAeH,IAAEI,KAAK;CACtBC,gBAAgBL,IAAEM,QAAQ,CAACC,IAAI,EAAE;CACjCC,gBAAgBR,IAAEM,QAAQ,CAACC,IAAI,EAAE;CACjCE,mBAAmBT,IAAEM,Q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lB,YAAYX,oBAAoBC,aAAa,KAAKC,aAAauD,KAAK,KAAK,CAAC;AAChFpC,yBAAsBC,iBAAiB,KAAKpB,aAAauD,KAAK,KAAK,CAAC;AACpEhC,oBAAiBC,YAAY,KAAKxB,aAAauD,KAAK,KAAK,CAAC;GAE1D,MAAMC,4BAA4BpC,gBAAgBqC,MAAM9G,KAAK+G,IAAI,CAACrD,KAAK1D,KAAKgH,MAAMD,IAAI;GACtF,MAAME,uBAAuBpC,WAAWiC,MAAM9G,KAAK+G,IAAI,CAACrD,KAAK1D,KAAKgH,MAAMD,IAAI;AAC5E,UAAO;uCAC0BvE,KAAKC,UAAUqB,UAAU,CAAA;2CACrB+C,0BAAyB;sCAC9BI,qBAAoB;;;EAGvD"}
|
|
1
|
+
{"version":3,"file":"vite.js","names":["z","VaultConfigSchema","object","VAULT_ADDRESS","url","VAULT_USERNAME","string","min","VAULT_PASSWORD","VAULT_SECRET_PATH","VAULT_MOUNT_POINT","default","VaultConfig","infer","fs","https","path","axios","loadEnv","VaultConfigSchema","Resource","Plugin","fetchVaultSecrets","env","Record","Promise","config","parse","VAULT_ADDRESS","VAULT_USERNAME","VAULT_PASSWORD","VAULT_SECRET_PATH","VAULT_MOUNT_POINT","client","create","baseURL","httpsAgent","Agent","rejectUnauthorized","data","loginData","post","password","secretData","get","headers","auth","client_token","secrets","Error","Object","fromEntries","entries","map","key","value","JSON","stringify","loadVaultSecrets","command","process","cwd","forEach","e","console","warn","message","loadLocaleResources","localesPath","addWatchFile","existsSync","mkdirSync","recursive","enPath","join","writeFileSync","files","readdirSync","resources","file","filter","f","endsWith","lang","basename","filePath","translation","readFileSync","ensurePermissionsFile","permissionsPath","dir","dirname","ensureScopesFile","scopesPath","viteWczLayout","virtualModuleId","resolvedVirtualModuleId","name","enforce","configResolved","resolvedConfig","resolve","root","_","optimizeDeps","exclude","include","configureServer","server","refresh","includes","module","moduleGraph","getModuleById","invalidateModule","ws","send","type","watcher","add","on","resolveId","id","load","bind","normalizedPermissionsPath","split","sep","posix","normalizedScopesPath"],"sources":["../src/models/VaultConfig.ts","../src/lib/vite-plugin.ts"],"sourcesContent":["import z from \"zod\";\n\nexport const VaultConfigSchema = z.object({\n VAULT_ADDRESS: z.url(),\n VAULT_USERNAME: z.string().min(1),\n VAULT_PASSWORD: z.string().min(1),\n VAULT_SECRET_PATH: z.string().min(1),\n VAULT_MOUNT_POINT: z.string().default(\"release\"),\n});\n\nexport type VaultConfig = z.infer<typeof VaultConfigSchema>;\n","import fs from \"node:fs\";\nimport https from \"node:https\";\nimport path from \"node:path\";\nimport axios from \"axios\";\nimport { loadEnv } from \"vite\";\nimport { VaultConfigSchema } from \"../models/VaultConfig\";\nimport type { Resource } from \"i18next\";\nimport type { Plugin } from \"vite\";\n\nasync function fetchVaultSecrets(env: Record<string, string>): Promise<Record<string, string>> {\n const config = VaultConfigSchema.parse(env);\n const { VAULT_ADDRESS, VAULT_USERNAME, VAULT_PASSWORD, VAULT_SECRET_PATH, VAULT_MOUNT_POINT } =\n config;\n\n const client = axios.create({\n baseURL: VAULT_ADDRESS,\n httpsAgent: new https.Agent({ rejectUnauthorized: false }),\n });\n\n const { data: loginData } = await client.post(`/v1/auth/userpass/login/${VAULT_USERNAME}`, {\n password: VAULT_PASSWORD,\n });\n\n const { data: secretData } = await client.get(\n `/v1/${VAULT_MOUNT_POINT}/data/${VAULT_SECRET_PATH}`,\n {\n headers: { \"X-Vault-Token\": loginData.auth.client_token },\n },\n );\n\n const secrets = secretData?.data?.data;\n if (!secrets) throw new Error(\"No secrets found\");\n\n return Object.fromEntries(\n Object.entries(secrets).map(([key, value]) => [\n key,\n typeof value === \"string\" ? value : JSON.stringify(value),\n ]),\n );\n}\n\nasync function loadVaultSecrets(command: string): Promise<void> {\n if (command !== \"serve\") return;\n\n const env = loadEnv(\"development\", process.cwd(), \"\");\n if (!env.VAULT_ADDRESS) return;\n\n try {\n const secrets = await fetchVaultSecrets(env);\n Object.entries(secrets).forEach(([key, value]) => {\n process.env[key] ??= value;\n });\n } catch (e) {\n console.warn(\"[vite:wcz-layout] Vault failed:\", e instanceof Error ? e.message : e);\n }\n}\n\nfunction loadLocaleResources(localesPath: string, addWatchFile: (path: string) => void): Resource {\n if (!fs.existsSync(localesPath)) fs.mkdirSync(localesPath, { recursive: true });\n\n const enPath = path.join(localesPath, \"en.json\");\n if (!fs.existsSync(enPath)) fs.writeFileSync(enPath, JSON.stringify({}));\n\n const files = fs.readdirSync(localesPath);\n const resources: Resource = {};\n\n for (const file of files.filter((f) => f.endsWith(\".json\"))) {\n const lang = path.basename(file, \".json\");\n const filePath = path.join(localesPath, file);\n try {\n resources[lang] = { translation: JSON.parse(fs.readFileSync(filePath, \"utf-8\")) };\n } catch {\n resources[lang] = { translation: {} };\n }\n addWatchFile(filePath);\n }\n\n return resources;\n}\n\nfunction ensurePermissionsFile(\n permissionsPath: string,\n addWatchFile: (path: string) => void,\n): void {\n const dir = path.dirname(permissionsPath);\n if (!fs.existsSync(dir)) fs.mkdirSync(dir, { recursive: true });\n if (!fs.existsSync(permissionsPath)) {\n fs.writeFileSync(\n permissionsPath,\n 'export const permissions = {\\n admin: [\"wcz-developers\"]\\n} as const;',\n );\n }\n addWatchFile(permissionsPath);\n}\n\nfunction ensureScopesFile(scopesPath: string, addWatchFile: (path: string) => void): void {\n const dir = path.dirname(scopesPath);\n if (!fs.existsSync(dir)) fs.mkdirSync(dir, { recursive: true });\n if (!fs.existsSync(scopesPath)) {\n fs.writeFileSync(scopesPath, \"export const scopes = {\\n} as const;\");\n }\n addWatchFile(scopesPath);\n}\n\nexport function viteWczLayout(): Plugin {\n const virtualModuleId = \"virtual:wcz-layout\";\n const resolvedVirtualModuleId = \"\\0\" + virtualModuleId;\n\n let localesPath: string;\n let permissionsPath: string;\n let scopesPath: string;\n\n return {\n name: \"vite:wcz-layout\",\n enforce: \"pre\",\n configResolved(resolvedConfig) {\n localesPath = path.resolve(resolvedConfig.root, \"src/locales\");\n permissionsPath = path.resolve(resolvedConfig.root, \"src/lib/auth/permissions.ts\");\n scopesPath = path.resolve(resolvedConfig.root, \"src/lib/auth/scopes.ts\");\n },\n async config(_, { command }) {\n await loadVaultSecrets(command);\n\n return {\n optimizeDeps: {\n exclude: [virtualModuleId],\n include: [\n \"prop-types\",\n \"react-is\",\n \"hoist-non-react-statics\",\n \"url-parse\",\n \"file-saver\",\n \"attr-accept\",\n ],\n },\n };\n },\n configureServer(server) {\n const refresh = (filePath: string) => {\n if (\n filePath.includes(localesPath) ||\n filePath === permissionsPath ||\n filePath === scopesPath\n ) {\n const module = server.moduleGraph.getModuleById(resolvedVirtualModuleId);\n if (module) server.moduleGraph.invalidateModule(module);\n server.ws.send({ type: \"full-reload\", path: \"*\" });\n }\n };\n\n server.watcher.add([localesPath, permissionsPath, scopesPath]);\n server.watcher.on(\"add\", refresh);\n server.watcher.on(\"change\", refresh);\n server.watcher.on(\"unlink\", refresh);\n },\n resolveId(id) {\n if (id === virtualModuleId) return resolvedVirtualModuleId;\n return null;\n },\n load(id) {\n if (id !== resolvedVirtualModuleId) return null;\n\n const resources = loadLocaleResources(localesPath, this.addWatchFile.bind(this));\n ensurePermissionsFile(permissionsPath, this.addWatchFile.bind(this));\n ensureScopesFile(scopesPath, this.addWatchFile.bind(this));\n\n const normalizedPermissionsPath = permissionsPath.split(path.sep).join(path.posix.sep);\n const normalizedScopesPath = scopesPath.split(path.sep).join(path.posix.sep);\n return `\n export const resources = ${JSON.stringify(resources)};\n export { permissions } from \"${normalizedPermissionsPath}\";\n export { scopes } from \"${normalizedScopesPath}\";\n `;\n },\n };\n}\n"],"mappings":";;;;;;;AAEA,MAAaC,oBAAoBD,IAAEE,OAAO;CACxCC,eAAeH,IAAEI,KAAK;CACtBC,gBAAgBL,IAAEM,QAAQ,CAACC,IAAI,EAAE;CACjCC,gBAAgBR,IAAEM,QAAQ,CAACC,IAAI,EAAE;CACjCE,mBAAmBT,IAAEM,QAAQ,CAACC,IAAI,EAAE;CACpCG,mBAAmBV,IAAEM,QAAQ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AC;AAChFpC,yBAAsBC,iBAAiB,KAAKpB,aAAauD,KAAK,KAAK,CAAC;AACpEhC,oBAAiBC,YAAY,KAAKxB,aAAauD,KAAK,KAAK,CAAC;GAE1D,MAAMC,4BAA4BpC,gBAAgBqC,MAAM9G,KAAK+G,IAAI,CAACrD,KAAK1D,KAAKgH,MAAMD,IAAI;GACtF,MAAME,uBAAuBpC,WAAWiC,MAAM9G,KAAK+G,IAAI,CAACrD,KAAK1D,KAAKgH,MAAMD,IAAI;AAC5E,UAAO;uCAC0BvE,KAAKC,UAAUqB,UAAU,CAAA;2CACrB+C,0BAAyB;sCAC9BI,qBAAoB;;;EAGvD"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wcz-layout",
|
|
3
|
-
"version": "8.0.
|
|
3
|
+
"version": "8.0.4",
|
|
4
4
|
"private": false,
|
|
5
5
|
"keywords": [
|
|
6
6
|
"tanstack-intent"
|
|
@@ -27,8 +27,11 @@
|
|
|
27
27
|
"models": [
|
|
28
28
|
"./dist/models.d.ts"
|
|
29
29
|
],
|
|
30
|
-
"
|
|
31
|
-
"./dist/
|
|
30
|
+
"data/client": [
|
|
31
|
+
"./dist/data/client.d.ts"
|
|
32
|
+
],
|
|
33
|
+
"data/server": [
|
|
34
|
+
"./dist/data/server.d.ts"
|
|
32
35
|
],
|
|
33
36
|
"utils": [
|
|
34
37
|
"./dist/utils.d.ts"
|
|
@@ -59,9 +62,13 @@
|
|
|
59
62
|
"types": "./dist/models.d.ts",
|
|
60
63
|
"import": "./dist/models.js"
|
|
61
64
|
},
|
|
62
|
-
"./
|
|
63
|
-
"types": "./dist/
|
|
64
|
-
"import": "./dist/
|
|
65
|
+
"./data/client": {
|
|
66
|
+
"types": "./dist/data/client.d.ts",
|
|
67
|
+
"import": "./dist/data/client.js"
|
|
68
|
+
},
|
|
69
|
+
"./data/server": {
|
|
70
|
+
"types": "./dist/data/server.d.ts",
|
|
71
|
+
"import": "./dist/data/server.js"
|
|
65
72
|
},
|
|
66
73
|
"./utils": {
|
|
67
74
|
"types": "./dist/utils.d.ts",
|
|
@@ -82,16 +89,16 @@
|
|
|
82
89
|
"prepublishOnly": "npm run build"
|
|
83
90
|
},
|
|
84
91
|
"dependencies": {
|
|
85
|
-
"@azure/msal-browser": "^5.
|
|
86
|
-
"@azure/msal-node": "^5.1.
|
|
87
|
-
"@azure/msal-react": "^5.3.
|
|
92
|
+
"@azure/msal-browser": "^5.9.0",
|
|
93
|
+
"@azure/msal-node": "^5.1.5",
|
|
94
|
+
"@azure/msal-react": "^5.3.2",
|
|
88
95
|
"@t3-oss/env-core": "^0.13.11",
|
|
89
96
|
"file-saver": "^2.0.5",
|
|
90
|
-
"i18next": "^26.0.
|
|
97
|
+
"i18next": "^26.0.8",
|
|
91
98
|
"i18next-browser-languagedetector": "^8.2.1",
|
|
92
|
-
"jose": "^6.2.
|
|
99
|
+
"jose": "^6.2.3",
|
|
93
100
|
"react-dropzone": "^15.0.0",
|
|
94
|
-
"react-i18next": "^17.0.
|
|
101
|
+
"react-i18next": "^17.0.6",
|
|
95
102
|
"react-intersection-observer": "^10.0.3",
|
|
96
103
|
"react-number-format": "^5.4.5",
|
|
97
104
|
"tus-js-client": "^4.3.1",
|
|
@@ -99,7 +106,7 @@
|
|
|
99
106
|
},
|
|
100
107
|
"devDependencies": {
|
|
101
108
|
"@rolldown/plugin-babel": "^0.2.3",
|
|
102
|
-
"@tanstack/intent": "^0.0.
|
|
109
|
+
"@tanstack/intent": "^0.0.36",
|
|
103
110
|
"@types/file-saver": "^2.0.7",
|
|
104
111
|
"@types/node": "^24.10.13",
|
|
105
112
|
"@types/react": "^19.2.14",
|
|
@@ -136,5 +143,5 @@
|
|
|
136
143
|
"overrides": {
|
|
137
144
|
"vite": "npm:@voidzero-dev/vite-plus-core@latest"
|
|
138
145
|
},
|
|
139
|
-
"packageManager": "npm@11.
|
|
146
|
+
"packageManager": "npm@11.13.0"
|
|
140
147
|
}
|