wcz-layout 6.7.2 → 9.6.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (275) hide show
  1. package/dist/Approval-C-hF4jbT.mjs +194 -0
  2. package/dist/Approval-C-hF4jbT.mjs.map +1 -0
  3. package/dist/DialogsContext-DLqA8RJ_.mjs +7 -0
  4. package/dist/DialogsContext-DLqA8RJ_.mjs.map +1 -0
  5. package/dist/Email-BzQQkbe9.mjs +20 -0
  6. package/dist/Email-BzQQkbe9.mjs.map +1 -0
  7. package/dist/Email-CKUxOURX.d.mts +17 -0
  8. package/dist/Employee-iepWeWhO.d.mts +363 -0
  9. package/dist/FileMeta-Be9viU7D.d.mts +19 -0
  10. package/dist/FileMeta-DDqUju1Y.mjs +19 -0
  11. package/dist/FileMeta-DDqUju1Y.mjs.map +1 -0
  12. package/dist/NotificationContext-CgwUOeW0.mjs +7 -0
  13. package/dist/NotificationContext-CgwUOeW0.mjs.map +1 -0
  14. package/dist/QueryClientParam-Cbb0MIKg.d.mts +10 -0
  15. package/dist/RouterListItemButton-owZVvuC_.mjs +78 -0
  16. package/dist/RouterListItemButton-owZVvuC_.mjs.map +1 -0
  17. package/dist/User-1gKoYJvW.d.mts +12 -0
  18. package/dist/auth.d.mts +19 -0
  19. package/dist/auth.mjs +92 -0
  20. package/dist/auth.mjs.map +1 -0
  21. package/dist/authMiddleware-CKD6lG9v.mjs +49 -0
  22. package/dist/authMiddleware-CKD6lG9v.mjs.map +1 -0
  23. package/dist/components.d.mts +104 -0
  24. package/dist/components.mjs +1277 -0
  25. package/dist/components.mjs.map +1 -0
  26. package/dist/data/client.d.mts +3202 -0
  27. package/dist/data/client.mjs +211 -0
  28. package/dist/data/client.mjs.map +1 -0
  29. package/dist/data/server.d.mts +10 -0
  30. package/dist/data/server.mjs +16 -0
  31. package/dist/data/server.mjs.map +1 -0
  32. package/dist/entra-47nBhMK-.mjs +109 -0
  33. package/dist/entra-47nBhMK-.mjs.map +1 -0
  34. package/dist/env-CoveIivr.mjs +30 -0
  35. package/dist/env-CoveIivr.mjs.map +1 -0
  36. package/dist/file-Bcoxn1YA.mjs +154 -0
  37. package/dist/file-Bcoxn1YA.mjs.map +1 -0
  38. package/dist/file-DgooCXxX.mjs +171 -0
  39. package/dist/file-DgooCXxX.mjs.map +1 -0
  40. package/dist/hooks.d.mts +215 -0
  41. package/dist/hooks.mjs +1090 -0
  42. package/dist/hooks.mjs.map +1 -0
  43. package/dist/index.d.mts +50 -0
  44. package/dist/index.mjs +1951 -0
  45. package/dist/index.mjs.map +1 -0
  46. package/dist/middleware.d.mts +33 -0
  47. package/dist/middleware.mjs +27 -0
  48. package/dist/middleware.mjs.map +1 -0
  49. package/dist/models.d.mts +225 -0
  50. package/dist/models.mjs +74 -0
  51. package/dist/models.mjs.map +1 -0
  52. package/dist/msalServer-Ce9p7sTC.mjs +30 -0
  53. package/dist/msalServer-Ce9p7sTC.mjs.map +1 -0
  54. package/dist/peoplesoft-4pOmhLn5.d.mts +167 -0
  55. package/dist/peoplesoft-BdPHe6Ac.mjs +202 -0
  56. package/dist/peoplesoft-BdPHe6Ac.mjs.map +1 -0
  57. package/dist/useDialogs-BUzVrTSP.mjs +248 -0
  58. package/dist/useDialogs-BUzVrTSP.mjs.map +1 -0
  59. package/dist/user-Dzv0N9fj.d.mts +16 -0
  60. package/dist/utils-5x4uNxsX.d.mts +63 -0
  61. package/dist/utils-CqVAK5F8.mjs +238 -0
  62. package/dist/utils-CqVAK5F8.mjs.map +1 -0
  63. package/dist/utils-D39-w_ij.mjs +4 -0
  64. package/dist/utils.d.mts +5 -0
  65. package/dist/utils.mjs +3 -0
  66. package/dist/vite.d.mts +6 -0
  67. package/dist/vite.mjs +149 -0
  68. package/dist/vite.mjs.map +1 -0
  69. package/package.json +127 -62
  70. package/skills/client-db/SKILL.md +109 -0
  71. package/skills/data-grid/SKILL.md +142 -0
  72. package/skills/db-schema/SKILL.md +72 -0
  73. package/skills/dialogs/SKILL.md +78 -0
  74. package/skills/forms/SKILL.md +83 -0
  75. package/skills/general/SKILL.md +74 -0
  76. package/skills/routing/SKILL.md +94 -0
  77. package/skills/server-functions/SKILL.md +111 -0
  78. package/skills/services/SKILL.md +31 -0
  79. package/skills/services/docs/approval.md +257 -0
  80. package/skills/services/docs/email.md +32 -0
  81. package/skills/services/docs/file.md +108 -0
  82. package/skills/services/docs/peoplesoft.md +110 -0
  83. package/skills/start/SKILL.md +47 -0
  84. package/skills/start/steps/01-git-setup.md +11 -0
  85. package/skills/start/steps/02-project-name-setup.md +19 -0
  86. package/skills/start/steps/03-apm-setup.md +208 -0
  87. package/skills/start/steps/04-wicop-setup.md +80 -0
  88. package/skills/start/steps/05-database-setup.md +44 -0
  89. package/skills/start/steps/06-entra-setup.md +98 -0
  90. package/skills/start/steps/07-vault-setup.md +69 -0
  91. package/skills/start/steps/08-generate-favicon.md +8 -0
  92. package/skills/start/steps/09-commit.md +15 -0
  93. package/skills/start/steps/10-gitlab-ci.md +25 -0
  94. package/dist/src/components/Layout.d.ts +0 -16
  95. package/dist/src/components/Layout.js +0 -122
  96. package/dist/src/components/Layout.js.map +0 -1
  97. package/dist/src/components/dataGrid/ChipInputCell.d.ts +0 -9
  98. package/dist/src/components/dataGrid/ChipInputCell.js +0 -17
  99. package/dist/src/components/dataGrid/ChipInputCell.js.map +0 -1
  100. package/dist/src/components/dataGrid/EditableColumnHeader.d.ts +0 -2
  101. package/dist/src/components/dataGrid/EditableColumnHeader.js +0 -7
  102. package/dist/src/components/dataGrid/EditableColumnHeader.js.map +0 -1
  103. package/dist/src/components/dataGrid/GridToolbar.d.ts +0 -8
  104. package/dist/src/components/dataGrid/GridToolbar.js +0 -40
  105. package/dist/src/components/dataGrid/GridToolbar.js.map +0 -1
  106. package/dist/src/components/dataGrid/TableContainer.d.ts +0 -3
  107. package/dist/src/components/dataGrid/TableContainer.js +0 -32
  108. package/dist/src/components/dataGrid/TableContainer.js.map +0 -1
  109. package/dist/src/components/form/FormAutocomplete.d.ts +0 -7
  110. package/dist/src/components/form/FormAutocomplete.js +0 -10
  111. package/dist/src/components/form/FormAutocomplete.js.map +0 -1
  112. package/dist/src/components/form/FormCheckbox.d.ts +0 -7
  113. package/dist/src/components/form/FormCheckbox.js +0 -11
  114. package/dist/src/components/form/FormCheckbox.js.map +0 -1
  115. package/dist/src/components/form/FormDatePicker.d.ts +0 -9
  116. package/dist/src/components/form/FormDatePicker.js +0 -19
  117. package/dist/src/components/form/FormDatePicker.js.map +0 -1
  118. package/dist/src/components/form/FormDateTimePicker.d.ts +0 -9
  119. package/dist/src/components/form/FormDateTimePicker.js +0 -19
  120. package/dist/src/components/form/FormDateTimePicker.js.map +0 -1
  121. package/dist/src/components/form/FormNumberField.d.ts +0 -12
  122. package/dist/src/components/form/FormNumberField.js +0 -12
  123. package/dist/src/components/form/FormNumberField.js.map +0 -1
  124. package/dist/src/components/form/FormRadioGroup.d.ts +0 -13
  125. package/dist/src/components/form/FormRadioGroup.js +0 -11
  126. package/dist/src/components/form/FormRadioGroup.js.map +0 -1
  127. package/dist/src/components/form/FormSlider.d.ts +0 -7
  128. package/dist/src/components/form/FormSlider.js +0 -11
  129. package/dist/src/components/form/FormSlider.js.map +0 -1
  130. package/dist/src/components/form/FormSubmitButton.d.ts +0 -5
  131. package/dist/src/components/form/FormSubmitButton.js +0 -13
  132. package/dist/src/components/form/FormSubmitButton.js.map +0 -1
  133. package/dist/src/components/form/FormSwitch.d.ts +0 -7
  134. package/dist/src/components/form/FormSwitch.js +0 -11
  135. package/dist/src/components/form/FormSwitch.js.map +0 -1
  136. package/dist/src/components/form/FormTextField.d.ts +0 -7
  137. package/dist/src/components/form/FormTextField.js +0 -11
  138. package/dist/src/components/form/FormTextField.js.map +0 -1
  139. package/dist/src/components/layout/AccountMenu.d.ts +0 -9
  140. package/dist/src/components/layout/AccountMenu.js +0 -44
  141. package/dist/src/components/layout/AccountMenu.js.map +0 -1
  142. package/dist/src/components/layout/DevelopmentBanner.d.ts +0 -7
  143. package/dist/src/components/layout/DevelopmentBanner.js +0 -29
  144. package/dist/src/components/layout/DevelopmentBanner.js.map +0 -1
  145. package/dist/src/components/layout/ErrorPage.d.ts +0 -2
  146. package/dist/src/components/layout/ErrorPage.js +0 -25
  147. package/dist/src/components/layout/ErrorPage.js.map +0 -1
  148. package/dist/src/components/layout/LayoutDialog.d.ts +0 -12
  149. package/dist/src/components/layout/LayoutDialog.js +0 -12
  150. package/dist/src/components/layout/LayoutDialog.js.map +0 -1
  151. package/dist/src/components/layout/LayoutSnackbar.d.ts +0 -8
  152. package/dist/src/components/layout/LayoutSnackbar.js +0 -25
  153. package/dist/src/components/layout/LayoutSnackbar.js.map +0 -1
  154. package/dist/src/components/layout/NavigationDrawer.d.ts +0 -11
  155. package/dist/src/components/layout/NavigationDrawer.js +0 -70
  156. package/dist/src/components/layout/NavigationDrawer.js.map +0 -1
  157. package/dist/src/components/layout/NotificationMenu.d.ts +0 -8
  158. package/dist/src/components/layout/NotificationMenu.js +0 -26
  159. package/dist/src/components/layout/NotificationMenu.js.map +0 -1
  160. package/dist/src/components/layout/TypographyWithIcon.d.ts +0 -7
  161. package/dist/src/components/layout/TypographyWithIcon.js +0 -22
  162. package/dist/src/components/layout/TypographyWithIcon.js.map +0 -1
  163. package/dist/src/components/layout/Unauthorized.d.ts +0 -2
  164. package/dist/src/components/layout/Unauthorized.js +0 -26
  165. package/dist/src/components/layout/Unauthorized.js.map +0 -1
  166. package/dist/src/contexts/LayoutContext.d.ts +0 -40
  167. package/dist/src/contexts/LayoutContext.js +0 -60
  168. package/dist/src/contexts/LayoutContext.js.map +0 -1
  169. package/dist/src/contexts/UserContext.d.ts +0 -24
  170. package/dist/src/contexts/UserContext.js +0 -55
  171. package/dist/src/contexts/UserContext.js.map +0 -1
  172. package/dist/src/hooks/FormHooks.d.ts +0 -46
  173. package/dist/src/hooks/FormHooks.js +0 -31
  174. package/dist/src/hooks/FormHooks.js.map +0 -1
  175. package/dist/src/hooks/UseSnackbar.d.ts +0 -10
  176. package/dist/src/hooks/UseSnackbar.js +0 -23
  177. package/dist/src/hooks/UseSnackbar.js.map +0 -1
  178. package/dist/src/hooks/UseUser.d.ts +0 -10
  179. package/dist/src/hooks/UseUser.js +0 -25
  180. package/dist/src/hooks/UseUser.js.map +0 -1
  181. package/dist/src/index.d.ts +0 -20
  182. package/dist/src/index.js +0 -15
  183. package/dist/src/index.js.map +0 -1
  184. package/dist/src/models/Error.d.ts +0 -6
  185. package/dist/src/models/Error.js +0 -2
  186. package/dist/src/models/Error.js.map +0 -1
  187. package/dist/src/models/KeycloakSettings.d.ts +0 -8
  188. package/dist/src/models/KeycloakSettings.js +0 -2
  189. package/dist/src/models/KeycloakSettings.js.map +0 -1
  190. package/dist/src/models/LayoutPaletteColorOptions.d.ts +0 -6
  191. package/dist/src/models/LayoutPaletteColorOptions.js +0 -2
  192. package/dist/src/models/LayoutPaletteColorOptions.js.map +0 -1
  193. package/dist/src/models/LayoutRoute.d.ts +0 -14
  194. package/dist/src/models/LayoutRoute.js +0 -2
  195. package/dist/src/models/LayoutRoute.js.map +0 -1
  196. package/dist/src/models/Notification.d.ts +0 -9
  197. package/dist/src/models/Notification.js +0 -2
  198. package/dist/src/models/Notification.js.map +0 -1
  199. package/dist/src/models/PeoplesoftDepartment.d.ts +0 -14
  200. package/dist/src/models/PeoplesoftDepartment.js +0 -2
  201. package/dist/src/models/PeoplesoftDepartment.js.map +0 -1
  202. package/dist/src/models/PeoplesoftEmployee.d.ts +0 -34
  203. package/dist/src/models/PeoplesoftEmployee.js +0 -2
  204. package/dist/src/models/PeoplesoftEmployee.js.map +0 -1
  205. package/dist/src/models/Snackbar.d.ts +0 -15
  206. package/dist/src/models/Snackbar.js +0 -2
  207. package/dist/src/models/Snackbar.js.map +0 -1
  208. package/dist/src/models/User.d.ts +0 -27
  209. package/dist/src/models/User.js +0 -11
  210. package/dist/src/models/User.js.map +0 -1
  211. package/dist/src/models/types/EmployeeCategoryGroup.d.ts +0 -1
  212. package/dist/src/models/types/EmployeeCategoryGroup.js +0 -2
  213. package/dist/src/models/types/EmployeeCategoryGroup.js.map +0 -1
  214. package/dist/src/models/types/EmployeeStatus.d.ts +0 -1
  215. package/dist/src/models/types/EmployeeStatus.js +0 -2
  216. package/dist/src/models/types/EmployeeStatus.js.map +0 -1
  217. package/dist/src/utils/Auth.d.ts +0 -12
  218. package/dist/src/utils/Auth.js +0 -49
  219. package/dist/src/utils/Auth.js.map +0 -1
  220. package/dist/src/utils/Fetches.d.ts +0 -5
  221. package/dist/src/utils/Fetches.js +0 -66
  222. package/dist/src/utils/Fetches.js.map +0 -1
  223. package/dist/src/utils/FormUtils.d.ts +0 -7
  224. package/dist/src/utils/FormUtils.js +0 -9
  225. package/dist/src/utils/FormUtils.js.map +0 -1
  226. package/dist/src/utils/Helpers.d.ts +0 -11
  227. package/dist/src/utils/Helpers.js +0 -26
  228. package/dist/src/utils/Helpers.js.map +0 -1
  229. package/dist/tsconfig.tsbuildinfo +0 -1
  230. package/src/components/Layout.tsx +0 -183
  231. package/src/components/dataGrid/ChipInputCell.tsx +0 -31
  232. package/src/components/dataGrid/EditableColumnHeader.tsx +0 -7
  233. package/src/components/dataGrid/GridToolbar.tsx +0 -63
  234. package/src/components/dataGrid/TableContainer.tsx +0 -39
  235. package/src/components/form/FormAutocomplete.tsx +0 -34
  236. package/src/components/form/FormCheckbox.tsx +0 -32
  237. package/src/components/form/FormDatePicker.tsx +0 -34
  238. package/src/components/form/FormDateTimePicker.tsx +0 -34
  239. package/src/components/form/FormNumberField.tsx +0 -33
  240. package/src/components/form/FormRadioGroup.tsx +0 -43
  241. package/src/components/form/FormSlider.tsx +0 -28
  242. package/src/components/form/FormSubmitButton.tsx +0 -29
  243. package/src/components/form/FormSwitch.tsx +0 -32
  244. package/src/components/form/FormTextField.tsx +0 -26
  245. package/src/components/layout/AccountMenu.tsx +0 -160
  246. package/src/components/layout/DevelopmentBanner.tsx +0 -54
  247. package/src/components/layout/ErrorPage.tsx +0 -34
  248. package/src/components/layout/LayoutDialog.tsx +0 -50
  249. package/src/components/layout/LayoutSnackbar.tsx +0 -44
  250. package/src/components/layout/NavigationDrawer.tsx +0 -131
  251. package/src/components/layout/NotificationMenu.tsx +0 -76
  252. package/src/components/layout/TypographyWithIcon.tsx +0 -35
  253. package/src/components/layout/Unauthorized.tsx +0 -37
  254. package/src/contexts/LayoutContext.tsx +0 -127
  255. package/src/contexts/UserContext.tsx +0 -88
  256. package/src/hooks/FormHooks.ts +0 -33
  257. package/src/hooks/UseSnackbar.tsx +0 -28
  258. package/src/hooks/UseUser.tsx +0 -29
  259. package/src/index.ts +0 -27
  260. package/src/models/Error.tsx +0 -6
  261. package/src/models/KeycloakSettings.ts +0 -8
  262. package/src/models/LayoutPaletteColorOptions.tsx +0 -7
  263. package/src/models/LayoutRoute.ts +0 -15
  264. package/src/models/Notification.ts +0 -10
  265. package/src/models/PeoplesoftDepartment.ts +0 -15
  266. package/src/models/PeoplesoftEmployee.ts +0 -35
  267. package/src/models/Snackbar.ts +0 -16
  268. package/src/models/User.ts +0 -13
  269. package/src/models/types/EmployeeCategoryGroup.ts +0 -1
  270. package/src/models/types/EmployeeStatus.ts +0 -1
  271. package/src/utils/Auth.ts +0 -58
  272. package/src/utils/Fetches.ts +0 -83
  273. package/src/utils/FormUtils.ts +0 -22
  274. package/src/utils/Helpers.ts +0 -27
  275. package/tsconfig.json +0 -29
@@ -0,0 +1,19 @@
1
+ import * as z$2 from "zod";
2
+ //#region src/models/file/FileMeta.ts
3
+ const FileMetaSchema = z$2.object({
4
+ id: z$2.uuid(),
5
+ subId: z$2.uuid(),
6
+ appName: z$2.string().trim().min(1).max(255),
7
+ fileName: z$2.string().trim().min(1).max(255),
8
+ fileExtension: z$2.string().trim().min(1).max(255),
9
+ fileSize: z$2.number().min(0),
10
+ mediaSubType: z$2.string().trim().min(1).max(255),
11
+ mediaType: z$2.string().trim().min(1).max(255),
12
+ mimeType: z$2.string().trim().min(1).max(255),
13
+ createdBy: z$2.string().trim().min(1).max(255),
14
+ createdDate: z$2.date()
15
+ });
16
+ //#endregion
17
+ export { FileMetaSchema as t };
18
+
19
+ //# sourceMappingURL=FileMeta-DDqUju1Y.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FileMeta-DDqUju1Y.mjs","names":["z","FileMetaSchema","object","id","uuid","subId","appName","string","trim","min","max","fileName","fileExtension","fileSize","number","mediaSubType","mediaType","mimeType","createdBy","createdDate","date","FileMeta","infer"],"sources":["../src/models/file/FileMeta.ts"],"sourcesContent":["import * as z from \"zod\";\n\nexport const FileMetaSchema = z.object({\n id: z.uuid(),\n subId: z.uuid(),\n appName: z.string().trim().min(1).max(255),\n fileName: z.string().trim().min(1).max(255),\n fileExtension: z.string().trim().min(1).max(255),\n fileSize: z.number().min(0),\n mediaSubType: z.string().trim().min(1).max(255),\n mediaType: z.string().trim().min(1).max(255),\n mimeType: z.string().trim().min(1).max(255),\n createdBy: z.string().trim().min(1).max(255),\n createdDate: z.date(),\n});\n\nexport type FileMeta = z.infer<typeof FileMetaSchema>;\n"],"mappings":";;AAEA,MAAaC,iBAAiBD,IAAEE,OAAO;CACrCC,IAAIH,IAAEI,KAAK;CACXC,OAAOL,IAAEI,KAAK;CACdE,SAASN,IAAEO,OAAO,CAAC,CAACC,KAAK,CAAC,CAACC,IAAI,CAAC,CAAC,CAACC,IAAI,GAAG;CACzCC,UAAUX,IAAEO,OAAO,CAAC,CAACC,KAAK,CAAC,CAACC,IAAI,CAAC,CAAC,CAACC,IAAI,GAAG;CAC1CE,eAAeZ,IAAEO,OAAO,CAAC,CAACC,KAAK,CAAC,CAACC,IAAI,CAAC,CAAC,CAACC,IAAI,GAAG;CAC/CG,UAAUb,IAAEc,OAAO,CAAC,CAACL,IAAI,CAAC;CAC1BM,cAAcf,IAAEO,OAAO,CAAC,CAACC,KAAK,CAAC,CAACC,IAAI,CAAC,CAAC,CAACC,IAAI,GAAG;CAC9CM,WAAWhB,IAAEO,OAAO,CAAC,CAACC,KAAK,CAAC,CAACC,IAAI,CAAC,CAAC,CAACC,IAAI,GAAG;CAC3CO,UAAUjB,IAAEO,OAAO,CAAC,CAACC,KAAK,CAAC,CAACC,IAAI,CAAC,CAAC,CAACC,IAAI,GAAG;CAC1CQ,WAAWlB,IAAEO,OAAO,CAAC,CAACC,KAAK,CAAC,CAACC,IAAI,CAAC,CAAC,CAACC,IAAI,GAAG;CAC3CS,aAAanB,IAAEoB,KAAK;AACtB,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { createContext } from "react";
2
+ //#region src/contexts/NotificationContext.tsx
3
+ const NotificationContext = createContext(null);
4
+ //#endregion
5
+ export { NotificationContext as t };
6
+
7
+ //# sourceMappingURL=NotificationContext-CgwUOeW0.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NotificationContext-CgwUOeW0.mjs","names":["createContext","AlertColor","NotificationOptions","severity","autoHideDuration","NotificationContextValue","notify","message","options","NotificationContext"],"sources":["../src/contexts/NotificationContext.tsx"],"sourcesContent":["import { createContext } from \"react\";\nimport type { AlertColor } from \"@mui/material/Alert\";\n\nexport interface NotificationOptions {\n severity?: AlertColor;\n autoHideDuration?: number;\n}\n\nexport interface NotificationContextValue {\n notify: (message: string, options?: NotificationOptions) => void;\n}\n\nexport const NotificationContext = createContext<NotificationContextValue | null>(null);\n"],"mappings":";;AAYA,MAAaS,sBAAsBT,cAA+C,IAAI"}
@@ -0,0 +1,10 @@
1
+ import { QueryClient } from "@tanstack/react-query";
2
+ import z from "zod";
3
+ //#region src/models/QueryClientParam.d.ts
4
+ declare const BQueryClientParamSchema: z.ZodObject<{
5
+ queryClient: z.ZodCustom<QueryClient, QueryClient>;
6
+ }, z.core.$strip>;
7
+ type QueryClientParam = z.infer<typeof BQueryClientParamSchema>;
8
+ //#endregion
9
+ export { QueryClientParam as t };
10
+ //# sourceMappingURL=QueryClientParam-Cbb0MIKg.d.mts.map
@@ -0,0 +1,78 @@
1
+ import { c } from "react/compiler-runtime";
2
+ import { IconButton, ListItemButton } from "@mui/material";
3
+ import React from "react";
4
+ import { createLink } from "@tanstack/react-router";
5
+ import { jsx } from "react/jsx-runtime";
6
+ //#region src/components/router/RouterIconButton.tsx
7
+ const CreatedComponent$1 = createLink(React.forwardRef(function IconButtonComponent(props, reference) {
8
+ const $ = c(4);
9
+ if ($[0] !== "78225cdb1e7335044739e8f2aa569a8b6e8ddff45ee95d92920518aa6794a52d") {
10
+ for (let $i = 0; $i < 4; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
11
+ $[0] = "78225cdb1e7335044739e8f2aa569a8b6e8ddff45ee95d92920518aa6794a52d";
12
+ }
13
+ let t0;
14
+ if ($[1] !== props || $[2] !== reference) {
15
+ t0 = /* @__PURE__ */ jsx(IconButton, {
16
+ ref: reference,
17
+ component: "a",
18
+ ...props
19
+ });
20
+ $[1] = props;
21
+ $[2] = reference;
22
+ $[3] = t0;
23
+ } else t0 = $[3];
24
+ return t0;
25
+ }));
26
+ const RouterIconButton = (props) => {
27
+ const $ = c(3);
28
+ if ($[0] !== "78225cdb1e7335044739e8f2aa569a8b6e8ddff45ee95d92920518aa6794a52d") {
29
+ for (let $i = 0; $i < 3; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
30
+ $[0] = "78225cdb1e7335044739e8f2aa569a8b6e8ddff45ee95d92920518aa6794a52d";
31
+ }
32
+ let t0;
33
+ if ($[1] !== props) {
34
+ t0 = /* @__PURE__ */ jsx(CreatedComponent$1, { ...props });
35
+ $[1] = props;
36
+ $[2] = t0;
37
+ } else t0 = $[2];
38
+ return t0;
39
+ };
40
+ //#endregion
41
+ //#region src/components/router/RouterListItemButton.tsx
42
+ const CreatedComponent = createLink(React.forwardRef(function ButtonComponent(props, reference) {
43
+ const $ = c(4);
44
+ if ($[0] !== "a33d2f291bddc17afd0afbb422e06a0a3bbcd9c360494d00918e68b54a100925") {
45
+ for (let $i = 0; $i < 4; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
46
+ $[0] = "a33d2f291bddc17afd0afbb422e06a0a3bbcd9c360494d00918e68b54a100925";
47
+ }
48
+ let t0;
49
+ if ($[1] !== props || $[2] !== reference) {
50
+ t0 = /* @__PURE__ */ jsx(ListItemButton, {
51
+ ref: reference,
52
+ component: "a",
53
+ ...props
54
+ });
55
+ $[1] = props;
56
+ $[2] = reference;
57
+ $[3] = t0;
58
+ } else t0 = $[3];
59
+ return t0;
60
+ }));
61
+ const RouterListItemButton = (props) => {
62
+ const $ = c(3);
63
+ if ($[0] !== "a33d2f291bddc17afd0afbb422e06a0a3bbcd9c360494d00918e68b54a100925") {
64
+ for (let $i = 0; $i < 3; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
65
+ $[0] = "a33d2f291bddc17afd0afbb422e06a0a3bbcd9c360494d00918e68b54a100925";
66
+ }
67
+ let t0;
68
+ if ($[1] !== props) {
69
+ t0 = /* @__PURE__ */ jsx(CreatedComponent, { ...props });
70
+ $[1] = props;
71
+ $[2] = t0;
72
+ } else t0 = $[2];
73
+ return t0;
74
+ };
75
+ //#endregion
76
+ export { RouterIconButton as n, RouterListItemButton as t };
77
+
78
+ //# sourceMappingURL=RouterListItemButton-owZVvuC_.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RouterListItemButton-owZVvuC_.mjs","names":["IconButton","createLink","React","IconButtonProps","LinkComponent","Component","forwardRef","HTMLAnchorElement","IconButtonComponent","props","reference","$","_c","$i","Symbol","for","t0","CreatedComponent","RouterIconButton","ListItemButton","createLink","React","ListItemButtonProps","LinkComponent","Component","forwardRef","HTMLAnchorElement","ButtonComponent","props","reference","$","_c","$i","Symbol","for","t0","CreatedComponent","RouterListItemButton"],"sources":["../src/components/router/RouterIconButton.tsx","../src/components/router/RouterListItemButton.tsx"],"sourcesContent":["import { IconButton } from \"@mui/material\";\nimport { createLink } from \"@tanstack/react-router\";\nimport React from \"react\";\nimport type { IconButtonProps } from \"@mui/material\";\nimport type { LinkComponent } from \"@tanstack/react-router\";\n\nconst Component = React.forwardRef<HTMLAnchorElement, IconButtonProps<\"a\">>(\n function IconButtonComponent(props, reference) {\n return <IconButton ref={reference} component=\"a\" {...props} />;\n },\n);\n\nconst CreatedComponent = createLink(Component);\n\nexport const RouterIconButton: LinkComponent<typeof Component> = (props) => {\n return <CreatedComponent {...props} />;\n};\n","import { ListItemButton } from \"@mui/material\";\nimport { createLink } from \"@tanstack/react-router\";\nimport React from \"react\";\nimport type { ListItemButtonProps } from \"@mui/material\";\nimport type { LinkComponent } from \"@tanstack/react-router\";\n\nconst Component = React.forwardRef<HTMLAnchorElement, ListItemButtonProps<\"a\">>(\n function ButtonComponent(props, reference) {\n return <ListItemButton ref={reference} component=\"a\" {...props} />;\n },\n);\n\nconst CreatedComponent = createLink(Component);\n\nexport const RouterListItemButton: LinkComponent<typeof Component> = (props) => {\n return <CreatedComponent {...props} />;\n};\n"],"mappings":";;;;;;AAYA,MAAMiB,qBAAmBhB,WANPC,MAAMI,WACtB,SAAAE,oBAAAC,OAAAC,WAAA;CAAA,MAAAC,IAAAC,EAAA,CAAA;CAAA,IAAAD,EAAA,OAAA,oEAAA;EAAA,KAAA,IAAAE,KAAA,GAAAA,KAAA,GAAAA,MAAA,GAAAF,EAAAE,MAAAC,OAAAC,IAAA,2BAAA;EAAAJ,EAAA,KAAA;CAAA;CAAA,IAAAK;CAAA,IAAAL,EAAA,OAAAF,SAAAE,EAAA,OAAAD,WAAA;EACSM,KAAA,oBAAC,YAAD;GAAiBN,KAAAA;GAAqB,WAAA;GAAG,GAAKD;EAAK,CAAA;EAAIE,EAAA,KAAAF;EAAAE,EAAA,KAAAD;EAAAC,EAAA,KAAAK;CAAA,OAAAA,KAAAL,EAAA;CAAA,OAAvDK;AAAuD,CAI9BX,CAAS;AAE7C,MAAaa,oBAAoDT,UAAA;CAAA,MAAAE,IAAAC,EAAA,CAAA;CAAA,IAAAD,EAAA,OAAA,oEAAA;EAAA,KAAA,IAAAE,KAAA,GAAAA,KAAA,GAAAA,MAAA,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.d.ts
2
+ type User = {
3
+ name: string;
4
+ email: string;
5
+ department: string;
6
+ employeeId: string;
7
+ companyName?: string;
8
+ groups: Array<string>;
9
+ };
10
+ //#endregion
11
+ export { User as t };
12
+ //# sourceMappingURL=User-1gKoYJvW.d.mts.map
@@ -0,0 +1,19 @@
1
+ import { t as getAccessToken } from "./user-Dzv0N9fj.mjs";
2
+ import { scopes } from "virtual:wcz-layout";
3
+ //#region src/lib/auth/authHandlers.d.ts
4
+ /** GET /auth/login — start the flow: stash PKCE + state, redirect to Entra. */
5
+ declare function handleLogin(): Promise<Response>;
6
+ /** GET /auth/callback — finish the flow: validate state, exchange code, set session. */
7
+ declare function handleCallback(): Promise<Response>;
8
+ /** GET /auth/logout — clear the local session and sign out of the Entra session. */
9
+ declare function handleLogout(): Promise<Response>;
10
+ //#endregion
11
+ //#region src/lib/auth/msalServer.d.ts
12
+ /**
13
+ * Client Credentials flow: Get app-only token (no user context)
14
+ * Use when: Background jobs, scheduled tasks, service-to-service calls
15
+ */
16
+ declare const getAppToken: (scopeKey: keyof typeof scopes) => Promise<string>;
17
+ //#endregion
18
+ export { getAccessToken, getAppToken, handleCallback, handleLogin, handleLogout };
19
+ //# sourceMappingURL=auth.d.mts.map
package/dist/auth.mjs ADDED
@@ -0,0 +1,92 @@
1
+ import { i as buildUser, l as getAccessToken, p as getAppSession } from "./utils-CqVAK5F8.mjs";
2
+ import { t as getAppToken } from "./msalServer-Ce9p7sTC.mjs";
3
+ //#region src/lib/auth/authHandlers.ts
4
+ /**
5
+ * Server-side handlers for the OAuth2 Authorization Code (PKCE) flow. They are
6
+ * mounted by thin route files (`/auth/login`, `/auth/callback`, `/auth/logout`)
7
+ * in the consuming app and drive the full server-side Entra login — the browser
8
+ * never loads an auth library.
9
+ */
10
+ const redirect = (location) => new Response(null, {
11
+ status: 302,
12
+ headers: { Location: location }
13
+ });
14
+ /** The OAuth redirect URI, derived from the request origin. */
15
+ const resolveRedirectUri = (origin) => `${origin}/auth/callback`;
16
+ /**
17
+ * Only same-origin paths are allowed, so `returnTo` cannot become an open
18
+ * redirect. Backslash counts as a separator too: browsers normalize `/\evil`
19
+ * to the protocol-relative `//evil`.
20
+ */
21
+ const sanitizeReturnTo = (value) => value && /^\/(?![/\\])/.test(value) ? value : "/";
22
+ /** GET /auth/login — start the flow: stash PKCE + state, redirect to Entra. */
23
+ async function handleLogin() {
24
+ const { getRequestUrl } = await import("@tanstack/react-start/server");
25
+ const url = getRequestUrl();
26
+ const returnTo = sanitizeReturnTo(url.searchParams.get("returnTo"));
27
+ const { cryptoProvider, buildAuthCodeUrl } = await import("./entra-47nBhMK-.mjs");
28
+ const { verifier, challenge } = await cryptoProvider.generatePkceCodes();
29
+ const state = cryptoProvider.createNewGuid();
30
+ await (await getAppSession()).update({
31
+ pkceVerifier: verifier,
32
+ state,
33
+ returnTo
34
+ });
35
+ const authUrl = await buildAuthCodeUrl({
36
+ redirectUri: resolveRedirectUri(url.origin),
37
+ state,
38
+ codeChallenge: challenge
39
+ });
40
+ return redirect(authUrl);
41
+ }
42
+ /** GET /auth/callback — finish the flow: validate state, exchange code, set session. */
43
+ async function handleCallback() {
44
+ const { getRequestUrl } = await import("@tanstack/react-start/server");
45
+ const url = getRequestUrl();
46
+ const session = await getAppSession();
47
+ const { pkceVerifier, state: expectedState, returnTo = "/" } = session.data;
48
+ const error = url.searchParams.get("error");
49
+ if (error) {
50
+ await session.clear();
51
+ return redirect(`/?auth_error=${encodeURIComponent(error)}`);
52
+ }
53
+ const code = url.searchParams.get("code");
54
+ const state = url.searchParams.get("state");
55
+ if (!code || !state || !pkceVerifier || state !== expectedState) {
56
+ await session.clear();
57
+ return redirect("/?auth_error=invalid_state");
58
+ }
59
+ try {
60
+ const { exchangeCodeForSession } = await import("./entra-47nBhMK-.mjs");
61
+ const { refreshToken, claims } = await exchangeCodeForSession({
62
+ code,
63
+ redirectUri: resolveRedirectUri(url.origin),
64
+ codeVerifier: pkceVerifier
65
+ });
66
+ await session.update({
67
+ refreshToken,
68
+ user: buildUser(claims),
69
+ pkceVerifier: void 0,
70
+ state: void 0,
71
+ returnTo: void 0
72
+ });
73
+ return redirect(returnTo);
74
+ } catch (error) {
75
+ const message = error instanceof Error ? error.message : "token_exchange_failed";
76
+ console.error("[auth] code exchange failed:", message);
77
+ await session.clear();
78
+ return redirect(`/?auth_error=${encodeURIComponent(message)}`);
79
+ }
80
+ }
81
+ /** GET /auth/logout — clear the local session and sign out of the Entra session. */
82
+ async function handleLogout() {
83
+ const { getRequestUrl } = await import("@tanstack/react-start/server");
84
+ const url = getRequestUrl();
85
+ await (await getAppSession()).clear();
86
+ const { buildLogoutUrl } = await import("./entra-47nBhMK-.mjs");
87
+ return redirect(buildLogoutUrl(`${url.origin}/`));
88
+ }
89
+ //#endregion
90
+ export { getAccessToken, getAppToken, handleCallback, handleLogin, handleLogout };
91
+
92
+ //# sourceMappingURL=auth.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth.mjs","names":["buildUser","getAppSession","redirect","location","Response","status","headers","Location","resolveRedirectUri","origin","sanitizeReturnTo","value","test","handleLogin","Promise","getRequestUrl","url","returnTo","searchParams","get","cryptoProvider","buildAuthCodeUrl","verifier","challenge","generatePkceCodes","state","createNewGuid","session","update","pkceVerifier","authUrl","redirectUri","codeChallenge","handleCallback","expectedState","data","error","clear","encodeURIComponent","code","exchangeCodeForSession","refreshToken","claims","codeVerifier","user","undefined","message","Error","console","handleLogout","buildLogoutUrl"],"sources":["../src/lib/auth/authHandlers.ts"],"sourcesContent":["import { buildUser } from \"~/lib/utils\";\nimport { getAppSession } from \"./session\";\n\n// These handlers run only as server route handlers, so their server-only deps are\n// imported dynamically to keep them out of the client bundle: `entra` pulls in\n// `@azure/msal-node`, and `@tanstack/react-start/server` pulls in the SSR renderer\n// (`react-dom/server`).\n\n/**\n * Server-side handlers for the OAuth2 Authorization Code (PKCE) flow. They are\n * mounted by thin route files (`/auth/login`, `/auth/callback`, `/auth/logout`)\n * in the consuming app and drive the full server-side Entra login — the browser\n * never loads an auth library.\n */\n\nconst redirect = (location: string): Response =>\n new Response(null, { status: 302, headers: { Location: location } });\n\n/** The OAuth redirect URI, derived from the request origin. */\nconst resolveRedirectUri = (origin: string): string => `${origin}/auth/callback`;\n\n/**\n * Only same-origin paths are allowed, so `returnTo` cannot become an open\n * redirect. Backslash counts as a separator too: browsers normalize `/\\evil`\n * to the protocol-relative `//evil`.\n */\nconst sanitizeReturnTo = (value: string | null): string =>\n value && /^\\/(?![/\\\\])/.test(value) ? value : \"/\";\n\n/** GET /auth/login — start the flow: stash PKCE + state, redirect to Entra. */\nexport async function handleLogin(): Promise<Response> {\n const { getRequestUrl } = await import(\"@tanstack/react-start/server\");\n const url = getRequestUrl();\n const returnTo = sanitizeReturnTo(url.searchParams.get(\"returnTo\"));\n\n const { cryptoProvider, buildAuthCodeUrl } = await import(\"./entra\");\n const { verifier, challenge } = await cryptoProvider.generatePkceCodes();\n const state = cryptoProvider.createNewGuid();\n\n const session = await getAppSession();\n await session.update({ pkceVerifier: verifier, state, returnTo });\n\n const authUrl = await buildAuthCodeUrl({\n redirectUri: resolveRedirectUri(url.origin),\n state,\n codeChallenge: challenge,\n });\n return redirect(authUrl);\n}\n\n/** GET /auth/callback — finish the flow: validate state, exchange code, set session. */\nexport async function handleCallback(): Promise<Response> {\n const { getRequestUrl } = await import(\"@tanstack/react-start/server\");\n const url = getRequestUrl();\n const session = await getAppSession();\n const { pkceVerifier, state: expectedState, returnTo = \"/\" } = session.data;\n\n const error = url.searchParams.get(\"error\");\n if (error) {\n await session.clear();\n return redirect(`/?auth_error=${encodeURIComponent(error)}`);\n }\n\n const code = url.searchParams.get(\"code\");\n const state = url.searchParams.get(\"state\");\n if (!code || !state || !pkceVerifier || state !== expectedState) {\n await session.clear();\n return redirect(\"/?auth_error=invalid_state\");\n }\n\n try {\n const { exchangeCodeForSession } = await import(\"./entra\");\n const { refreshToken, claims } = await exchangeCodeForSession({\n code,\n redirectUri: resolveRedirectUri(url.origin),\n codeVerifier: pkceVerifier,\n });\n\n // Persist the refresh token + trimmed user; drop the spent transient values.\n await session.update({\n refreshToken,\n user: buildUser(claims),\n pkceVerifier: undefined,\n state: undefined,\n returnTo: undefined,\n });\n\n return redirect(returnTo);\n } catch (error) {\n const message = error instanceof Error ? error.message : \"token_exchange_failed\";\n console.error(\"[auth] code exchange failed:\", message);\n await session.clear();\n return redirect(`/?auth_error=${encodeURIComponent(message)}`);\n }\n}\n\n/** GET /auth/logout — clear the local session and sign out of the Entra session. */\nexport async function handleLogout(): Promise<Response> {\n const { getRequestUrl } = await import(\"@tanstack/react-start/server\");\n const url = getRequestUrl();\n const session = await getAppSession();\n await session.clear();\n const { buildLogoutUrl } = await import(\"./entra\");\n return redirect(buildLogoutUrl(`${url.origin}/`));\n}\n"],"mappings":";;;;;;;;;AAeA,MAAME,YAAYC,aAChB,IAAIC,SAAS,MAAM;CAAEC,QAAQ;CAAKC,SAAS,EAAEC,UAAUJ,SAAS;AAAE,CAAC;;AAGrE,MAAMK,sBAAsBC,WAA2B,GAAGA,OAAM;;;;;;AAOhE,MAAMC,oBAAoBC,UACxBA,SAAS,eAAeC,KAAKD,KAAK,IAAIA,QAAQ;;AAGhD,eAAsBE,cAAiC;CACrD,MAAM,EAAEE,kBAAkB,MAAM,OAAO;CACvC,MAAMC,MAAMD,cAAc;CAC1B,MAAME,WAAWP,iBAAiBM,IAAIE,aAAaC,IAAI,UAAU,CAAC;CAElE,MAAM,EAAEC,gBAAgBC,qBAAqB,MAAM,OAAO;CAC1D,MAAM,EAAEC,UAAUC,cAAc,MAAMH,eAAeI,kBAAkB;CACvE,MAAMC,QAAQL,eAAeM,cAAc;CAG3C,OAAMC,MADgB1B,cAAc,EAAA,CACtB2B,OAAO;EAAEC,cAAcP;EAAUG;EAAOR;CAAS,CAAC;CAEhE,MAAMa,UAAU,MAAMT,iBAAiB;EACrCU,aAAavB,mBAAmBQ,IAAIP,MAAM;EAC1CgB;EACAO,eAAeT;CACjB,CAAC;CACD,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cAAc;CAE1B,OAAMY,MADgB1B,cAAc,EAAA,CACtBoC,MAAM;CACpB,MAAM,EAAEa,mBAAmB,MAAM,OAAO;CACxC,OAAOhD,SAASgD,eAAe,GAAGlC,IAAIP,OAAM,EAAG,CAAC;AAClD"}
@@ -0,0 +1,49 @@
1
+ import { i as buildUser, o as hasPermission, u as getSessionUser } from "./utils-CqVAK5F8.mjs";
2
+ import { t as serverEnv } from "./env-CoveIivr.mjs";
3
+ import { createMiddleware } from "@tanstack/react-start";
4
+ import * as jose from "jose";
5
+ //#region src/middleware/authMiddleware.ts
6
+ async function resolveUser(request) {
7
+ const authHeader = request.headers.get("Authorization");
8
+ if (authHeader?.startsWith("Bearer ")) {
9
+ let payload;
10
+ try {
11
+ payload = await verifyToken(authHeader.substring(7));
12
+ } catch (error) {
13
+ throw Response.json({ message: error instanceof Error ? error.message : "Unauthorized: Invalid access token" }, { status: 401 });
14
+ }
15
+ return buildUser(payload);
16
+ }
17
+ return getSessionUser();
18
+ }
19
+ const requiredAuthenticationMiddleware = createMiddleware().server(async ({ next, request }) => {
20
+ const user = await resolveUser(request);
21
+ if (!user) throw Response.json({ message: "Unauthorized: User not signed in" }, { status: 401 });
22
+ return next({ context: { user } });
23
+ });
24
+ const publicAuthenticationMiddleware = createMiddleware().server(async ({ next, request }) => {
25
+ return next({ context: { user: await resolveUser(request) } });
26
+ });
27
+ function authenticationMiddleware(options) {
28
+ return options?.optional ? publicAuthenticationMiddleware : requiredAuthenticationMiddleware;
29
+ }
30
+ const authorizationMiddleware = (permissionKey) => createMiddleware().middleware([authenticationMiddleware()]).server(async ({ next, context }) => {
31
+ if (hasPermission(context.user, permissionKey)) return next();
32
+ throw Response.json({ message: `Forbidden: User ${context.user.name} is not authorized to access this resource` }, { status: 403 });
33
+ });
34
+ async function verifyToken(token) {
35
+ const { payload } = await jose.jwtVerify(token, getJWKS(), {
36
+ issuer: `https://login.microsoftonline.com/${serverEnv.ENTRA_TENANT_ID}/v2.0`,
37
+ audience: serverEnv.ENTRA_CLIENT_ID
38
+ });
39
+ return payload;
40
+ }
41
+ let jwksCache = null;
42
+ function getJWKS() {
43
+ jwksCache ??= jose.createRemoteJWKSet(new URL(`https://login.microsoftonline.com/${serverEnv.ENTRA_TENANT_ID}/discovery/v2.0/keys`));
44
+ return jwksCache;
45
+ }
46
+ //#endregion
47
+ export { authorizationMiddleware as n, authenticationMiddleware as t };
48
+
49
+ //# sourceMappingURL=authMiddleware-CKD6lG9v.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authMiddleware-CKD6lG9v.mjs","names":["createMiddleware","jose","permissions","serverEnv","getSessionUser","buildUser","hasPermission","TokenPayload","User","resolveUser","request","Request","Promise","authHeader","headers","get","startsWith","payload","verifyToken","substring","length","error","Response","json","message","Error","status","requiredAuthenticationMiddleware","server","user","next","context","publicAuthenticationMiddleware","authenticationMiddleware","options","optional","authorizationMiddleware","permissionKey","middleware","name","token","jwtVerify","getJWKS","issuer","ENTRA_TENANT_ID","audience","ENTRA_CLIENT_ID","jwksCache","ReturnType","createRemoteJWKSet","URL"],"sources":["../src/middleware/authMiddleware.ts"],"sourcesContent":["import { createMiddleware } from \"@tanstack/react-start\";\nimport * as jose from \"jose\";\nimport type { permissions } from \"virtual:wcz-layout\";\nimport { serverEnv } from \"~/env\";\nimport { getSessionUser } from \"~/lib/auth/user\";\nimport { buildUser, hasPermission } from \"~/lib/utils\";\nimport type { TokenPayload } from \"~/models/TokenPayload\";\nimport type { User } from \"~/models/User\";\n\nasync function resolveUser(request: Request): Promise<User | null> {\n const authHeader = request.headers.get(\"Authorization\");\n\n if (authHeader?.startsWith(\"Bearer \")) {\n let payload: TokenPayload;\n try {\n payload = await verifyToken(authHeader.substring(\"Bearer \".length));\n } catch (error) {\n throw Response.json(\n { message: error instanceof Error ? error.message : \"Unauthorized: Invalid access token\" },\n { status: 401 },\n );\n }\n return buildUser(payload);\n }\n\n return getSessionUser();\n}\n\nconst requiredAuthenticationMiddleware = createMiddleware().server<{ user: User }>(\n async ({ next, request }) => {\n const user = await resolveUser(request);\n\n if (!user)\n throw Response.json({ message: \"Unauthorized: User not signed in\" }, { status: 401 });\n\n return next({ context: { user } });\n },\n);\n\nconst publicAuthenticationMiddleware = createMiddleware().server<{ user: User | null }>(\n async ({ next, request }) => {\n const user = await resolveUser(request);\n return next({ context: { user } });\n },\n);\n\nexport function authenticationMiddleware(options?: {\n optional?: false;\n}): typeof requiredAuthenticationMiddleware;\n\nexport function authenticationMiddleware(options: {\n optional: true;\n}): typeof publicAuthenticationMiddleware;\n\nexport function authenticationMiddleware(options: {\n optional: boolean;\n}): typeof requiredAuthenticationMiddleware | typeof publicAuthenticationMiddleware;\n\nexport function authenticationMiddleware(options?: { optional?: boolean }) {\n return options?.optional ? publicAuthenticationMiddleware : requiredAuthenticationMiddleware;\n}\n\nexport const authorizationMiddleware = (permissionKey: keyof typeof permissions) =>\n createMiddleware()\n .middleware([authenticationMiddleware()])\n .server(async ({ next, context }) => {\n if (hasPermission(context.user, permissionKey)) return next();\n throw Response.json(\n {\n message: `Forbidden: User ${context.user.name} is not authorized to access this resource`,\n },\n { status: 403 },\n );\n });\n\nasync function verifyToken(token: string): Promise<TokenPayload> {\n const { payload } = await jose.jwtVerify(token, getJWKS(), {\n issuer: `https://login.microsoftonline.com/${serverEnv.ENTRA_TENANT_ID}/v2.0`,\n audience: serverEnv.ENTRA_CLIENT_ID,\n });\n return payload as unknown as TokenPayload;\n}\n\nlet jwksCache: ReturnType<typeof jose.createRemoteJWKSet> | null = null;\n\nfunction getJWKS() {\n jwksCache ??= jose.createRemoteJWKSet(\n new URL(`https://login.microsoftonline.com/${serverEnv.ENTRA_TENANT_ID}/discovery/v2.0/keys`),\n );\n return jwksCache;\n}\n"],"mappings":";;;;;AASA,eAAeS,YAAYC,SAAwC;CACjE,MAAMG,aAAaH,QAAQI,QAAQC,IAAI,eAAe;CAEtD,IAAIF,YAAYG,WAAW,SAAS,GAAG;EACrC,IAAIC;EACJ,IAAI;GACFA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C,gBAAe;EACtEC,UAAU1C,UAAU2C;CACtB,CAAC;CACD,OAAO7B;AACT;AAEA,IAAI8B,YAA+D;AAEnE,SAASL,UAAU;CACjBK,cAAc9C,KAAKgD,mBACjB,IAAIC,IAAI,qCAAqC/C,UAAUyC,gBAAe,qBAAsB,CAC9F;CACA,OAAOG;AACT"}
@@ -0,0 +1,104 @@
1
+ import { t as FileMeta } from "./FileMeta-Be9viU7D.mjs";
2
+ import { BoxProps, ButtonProps, FabProps, IconButtonProps, LinkProps, ListItemButtonProps, SxProps, TabProps, Theme, TypographyProps } from "@mui/material";
3
+ import React$1, { ComponentType, FC, ReactNode } from "react";
4
+ import * as z$2 from "zod";
5
+ import { ErrorComponentProps, LinkComponent } from "@tanstack/react-router";
6
+ import { DropzoneOptions } from "react-dropzone";
7
+ import { GridActionsCellItemProps, GridColumnHeaderParams, GridValidRowModel } from "@mui/x-data-grid-premium";
8
+ //#region src/components/core/TypographyWithIcon.d.ts
9
+ interface TypographyWithIconProps extends TypographyProps {
10
+ startIcon?: React.ReactNode;
11
+ endIcon?: React.ReactNode;
12
+ gap?: number | string;
13
+ }
14
+ declare const TypographyWithIcon: React.FC<TypographyWithIconProps>;
15
+ //#endregion
16
+ //#region src/components/core/Fullscreen.d.ts
17
+ declare const Fullscreen: FC<BoxProps>;
18
+ //#endregion
19
+ //#region src/components/file/Dropzone.d.ts
20
+ interface DropzoneProps extends DropzoneOptions {
21
+ sx?: SxProps<Theme>;
22
+ progress?: number;
23
+ }
24
+ declare const Dropzone: FC<DropzoneProps>;
25
+ //#endregion
26
+ //#region src/models/file/FileActions.d.ts
27
+ declare const FileActionsSchema: z$2.ZodObject<{
28
+ download: z$2.ZodOptional<z$2.ZodBoolean>;
29
+ delete: z$2.ZodOptional<z$2.ZodBoolean>;
30
+ }, z$2.core.$strip>;
31
+ type FileActions = z$2.infer<typeof FileActionsSchema>;
32
+ //#endregion
33
+ //#region src/components/file/fileViewer/FileViewerGrid.d.ts
34
+ type FileViewerGridItemBar = "hidden" | "always" | "onMouseEnter";
35
+ interface FileViewerGridProps {
36
+ size?: number;
37
+ itemBar?: FileViewerGridItemBar;
38
+ sx?: SxProps<Theme>;
39
+ }
40
+ //#endregion
41
+ //#region src/components/file/fileViewer/FileViewerList.d.ts
42
+ interface FileViewerListProps {
43
+ sx?: SxProps<Theme>;
44
+ }
45
+ //#endregion
46
+ //#region src/components/file/FileViewer.d.ts
47
+ interface FileViewerComponent {
48
+ Grid: ComponentType<FileViewerGridProps>;
49
+ List: ComponentType<FileViewerListProps>;
50
+ }
51
+ interface FileViewerProps {
52
+ appName: string;
53
+ subId: string;
54
+ onDelete?: (params: {
55
+ remainingFileMetas: Array<FileMeta>;
56
+ deletedFileMeta: FileMeta;
57
+ }) => void;
58
+ actions?: FileActions;
59
+ children: (component: FileViewerComponent) => ReactNode;
60
+ }
61
+ declare const FileViewer: FC<FileViewerProps>;
62
+ //#endregion
63
+ //#region src/components/data-grid/EditableColumnHeader.d.ts
64
+ declare const EditableColumnHeader: <T extends GridValidRowModel>({ colDef }: GridColumnHeaderParams<T>) => import("react").JSX.Element;
65
+ //#endregion
66
+ //#region src/components/router/RouterButton.d.ts
67
+ declare const Component$6: React$1.ForwardRefExoticComponent<Omit<ButtonProps<"a">, "ref"> & React$1.RefAttributes<HTMLAnchorElement>>;
68
+ declare const RouterButton: LinkComponent<typeof Component$6>;
69
+ //#endregion
70
+ //#region src/components/router/RouterFab.d.ts
71
+ declare const Component$5: React$1.ForwardRefExoticComponent<Omit<FabProps<"a">, "ref"> & React$1.RefAttributes<HTMLAnchorElement>>;
72
+ declare const RouterFab: LinkComponent<typeof Component$5>;
73
+ //#endregion
74
+ //#region src/components/router/RouterGridActionsCellItem.d.ts
75
+ declare const Component$4: React$1.ForwardRefExoticComponent<GridActionsCellItemProps & React$1.RefAttributes<HTMLButtonElement>>;
76
+ declare const RouterGridActionsCellItem: LinkComponent<typeof Component$4>;
77
+ //#endregion
78
+ //#region src/components/router/RouterIconButton.d.ts
79
+ declare const Component$3: React$1.ForwardRefExoticComponent<Omit<IconButtonProps<"a">, "ref"> & React$1.RefAttributes<HTMLAnchorElement>>;
80
+ declare const RouterIconButton: LinkComponent<typeof Component$3>;
81
+ //#endregion
82
+ //#region src/components/router/RouterLink.d.ts
83
+ declare const Component$2: React$1.ForwardRefExoticComponent<Omit<LinkProps, "ref"> & React$1.RefAttributes<HTMLAnchorElement>>;
84
+ declare const RouterLink: LinkComponent<typeof Component$2>;
85
+ //#endregion
86
+ //#region src/components/router/RouterTab.d.ts
87
+ declare const Component$1: React$1.ForwardRefExoticComponent<Omit<TabProps<"a">, "ref"> & React$1.RefAttributes<HTMLAnchorElement>>;
88
+ declare const RouterTab: LinkComponent<typeof Component$1>;
89
+ //#endregion
90
+ //#region src/components/router/RouterListItemButton.d.ts
91
+ declare const Component: React$1.ForwardRefExoticComponent<Omit<ListItemButtonProps<"a">, "ref"> & React$1.RefAttributes<HTMLAnchorElement>>;
92
+ declare const RouterListItemButton: LinkComponent<typeof Component>;
93
+ //#endregion
94
+ //#region src/components/router/RouterNotFound.d.ts
95
+ declare function RouterNotFound(): import("react").JSX.Element;
96
+ //#endregion
97
+ //#region src/components/router/RouterError.d.ts
98
+ interface RouterErrorProps {
99
+ error: ErrorComponentProps["error"];
100
+ }
101
+ declare const RouterError: FC<RouterErrorProps>;
102
+ //#endregion
103
+ export { Dropzone, EditableColumnHeader, FileViewer, Fullscreen, RouterButton, RouterError, RouterFab, RouterGridActionsCellItem, RouterIconButton, RouterLink, RouterListItemButton, RouterNotFound, RouterTab, TypographyWithIcon };
104
+ //# sourceMappingURL=components.d.mts.map