wcz-layout 10.1.10 → 10.2.0

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 (80) hide show
  1. package/dist/Approval-D1TfISUL.mjs.map +1 -1
  2. package/dist/{LayoutTable-CxQNMuwo.d.mts → ChatLayout-BmLySLXy.d.mts} +11 -2
  3. package/dist/ChatLayout-Tpuwo8-b.mjs +1622 -0
  4. package/dist/ChatLayout-Tpuwo8-b.mjs.map +1 -0
  5. package/dist/DialogsContext-D23fJjYR.mjs.map +1 -1
  6. package/dist/Email-rnz3H0x3.mjs.map +1 -1
  7. package/dist/FileMeta-CPBWI_jA.mjs.map +1 -1
  8. package/dist/RouterListItemButton-CF-8w-08.mjs +62 -0
  9. package/dist/RouterListItemButton-CF-8w-08.mjs.map +1 -0
  10. package/dist/{approval-ByDIMRhe.mjs → approval-HB2w5jzc.mjs} +2 -2
  11. package/dist/approval-HB2w5jzc.mjs.map +1 -0
  12. package/dist/auth.mjs +4 -4
  13. package/dist/auth.mjs.map +1 -1
  14. package/dist/components.d.mts +3 -2
  15. package/dist/components.mjs +522 -627
  16. package/dist/components.mjs.map +1 -1
  17. package/dist/{createApi-L3ypB1gH.mjs → createApi-CKgFi53y.mjs} +3 -4
  18. package/dist/createApi-CKgFi53y.mjs.map +1 -0
  19. package/dist/data/client.mjs +3 -4
  20. package/dist/data/client.mjs.map +1 -1
  21. package/dist/data/server.mjs +4 -4
  22. package/dist/data/server.mjs.map +1 -1
  23. package/dist/env-BwFl7nWc.mjs +48 -0
  24. package/dist/env-BwFl7nWc.mjs.map +1 -0
  25. package/dist/{file-CwumKq_P.mjs → file-X1sK4ok6.mjs} +5 -4
  26. package/dist/file-X1sK4ok6.mjs.map +1 -0
  27. package/dist/{file-B4Q_bGLN.mjs → file-tkfsnk5F.mjs} +6 -5
  28. package/dist/file-tkfsnk5F.mjs.map +1 -0
  29. package/dist/generatedChart-k7NEdi5Z.mjs +211 -0
  30. package/dist/generatedChart-k7NEdi5Z.mjs.map +1 -0
  31. package/dist/hooks.d.mts +30 -2
  32. package/dist/hooks.mjs +1750 -1227
  33. package/dist/hooks.mjs.map +1 -1
  34. package/dist/index.d.mts +9 -2
  35. package/dist/index.mjs +1250 -1010
  36. package/dist/index.mjs.map +1 -1
  37. package/dist/middleware.mjs +2 -2
  38. package/dist/middleware.mjs.map +1 -1
  39. package/dist/models.d.mts +2 -2
  40. package/dist/models.mjs.map +1 -1
  41. package/dist/{peoplesoft-D1jPlXr9.mjs → peoplesoft-RnvfLbWH.mjs} +4 -23
  42. package/dist/peoplesoft-RnvfLbWH.mjs.map +1 -0
  43. package/dist/{providers-gKUqnVV5.mjs → providers-BfFg_3eo.mjs} +4 -20
  44. package/dist/providers-BfFg_3eo.mjs.map +1 -0
  45. package/dist/{tokens-DODxwvZ2.mjs → tokens-C4SErO-K.mjs} +10 -4
  46. package/dist/tokens-C4SErO-K.mjs.map +1 -0
  47. package/dist/{utils-obBGIuT3.mjs → utils-C2MZoH9U.mjs} +4 -31
  48. package/dist/utils-C2MZoH9U.mjs.map +1 -0
  49. package/dist/{utils-giYfiv39.d.mts → utils-CNYCSgip.d.mts} +2 -2
  50. package/dist/utils-DnMFybj3.mjs +27 -0
  51. package/dist/utils-DnMFybj3.mjs.map +1 -0
  52. package/dist/utils.d.mts +11 -2
  53. package/dist/utils.mjs +3 -5
  54. package/dist/vite.mjs.map +1 -1
  55. package/package.json +19 -21
  56. package/skills/ai/SKILL.md +156 -97
  57. package/skills/client-db/SKILL.md +104 -90
  58. package/skills/db-schema/SKILL.md +28 -20
  59. package/skills/dialogs/SKILL.md +26 -38
  60. package/skills/forms/SKILL.md +133 -73
  61. package/skills/general/SKILL.md +111 -126
  62. package/skills/general/references/auth.md +3 -7
  63. package/skills/routing/SKILL.md +60 -66
  64. package/skills/server-functions/SKILL.md +71 -26
  65. package/skills/services/SKILL.md +1 -1
  66. package/skills/services/docs/approval.md +4 -4
  67. package/skills/table/SKILL.md +113 -130
  68. package/dist/AggregatedCell-3CIdlmt6.mjs +0 -615
  69. package/dist/AggregatedCell-3CIdlmt6.mjs.map +0 -1
  70. package/dist/RouterListItemButton-B-cQ1XwU.mjs +0 -78
  71. package/dist/RouterListItemButton-B-cQ1XwU.mjs.map +0 -1
  72. package/dist/approval-ByDIMRhe.mjs.map +0 -1
  73. package/dist/createApi-L3ypB1gH.mjs.map +0 -1
  74. package/dist/file-B4Q_bGLN.mjs.map +0 -1
  75. package/dist/file-CwumKq_P.mjs.map +0 -1
  76. package/dist/peoplesoft-D1jPlXr9.mjs.map +0 -1
  77. package/dist/providers-gKUqnVV5.mjs.map +0 -1
  78. package/dist/tokens-DODxwvZ2.mjs.map +0 -1
  79. package/dist/utils-obBGIuT3.mjs.map +0 -1
  80. package/skills/general/references/exports.md +0 -117
@@ -1 +0,0 @@
1
- {"version":3,"file":"AggregatedCell-3CIdlmt6.mjs","names":["Button","Dialog","DialogActions","DialogContent","DialogTitle","useEventCallback","useContext","useId","useTranslation","DialogsContext","ReactNode","OpenDialogOptions","onClose","result","TResult","Promise","AlertOptions","title","ConfirmOptions","confirmText","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","messageId","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","_c","aggregationFn_count","aggregationFn_extent","aggregationFn_first","aggregationFn_last","aggregationFn_max","aggregationFn_mean","aggregationFn_median","aggregationFn_min","aggregationFn_sum","aggregationFn_unique","aggregationFn_uniqueCount","createExpandedRowModel","createFacetedMinMaxValues","createFacetedRowModel","createFacetedUniqueValues","createFilteredRowModel","createGroupedRowModel","createPaginatedRowModel","createSortedRowModel","createTableHookContexts","filterFn_arrHas","filterFn_arrIncludes","filterFn_arrIncludesAll","filterFn_arrIncludesSome","filterFn_between","filterFn_betweenInclusive","filterFn_empty","filterFn_endsWith","filterFn_equals","filterFn_equalsString","filterFn_equalsStringSensitive","filterFn_greaterThan","filterFn_greaterThanOrEqualTo","filterFn_inDateRange","filterFn_inNumberRange","filterFn_includesString","filterFn_includesStringSensitive","filterFn_lessThan","filterFn_lessThanOrEqualTo","filterFn_notEmpty","filterFn_startsWith","filterFn_weakEquals","metaHelper","sortFn_alphanumeric","sortFn_alphanumericCaseSensitive","sortFn_basic","sortFn_datetime","sortFn_text","sortFn_textCaseSensitive","stockFeatures","tableFeatures","AggregationFnDef","LayoutColumnMeta","RangeValue","Date","WithResult","TFn","TFeatures","TData","TValue","TResult","layoutTableFeatures","columnMeta","filteredRowModel","sortedRowModel","paginatedRowModel","expandedRowModel","groupedRowModel","facetedRowModel","facetedUniqueValues","facetedMinMaxValues","filterFns","arrHas","arrIncludes","arrIncludesAll","arrIncludesSome","between","betweenInclusive","empty","endsWith","equals","equalsString","equalsStringSensitive","greaterThan","greaterThanOrEqualTo","inDateRange","inNumberRange","includesString","includesStringSensitive","lessThan","lessThanOrEqualTo","notEmpty","startsWith","weakEquals","sortFns","alphanumeric","alphanumericCaseSensitive","basic","datetime","text","textCaseSensitive","aggregationFns","sum","min","max","extent","mean","median","unique","uniqueCount","count","first","last","LayoutTableFeatures","tableContext","cellContext","headerContext","useTableContext","useCellContext","useHeaderContext","TablePagination","TablePaginationProps","FC","useTableContext","PaginationProps","Omit","pageSizeOptions","Array","DEFAULT_PAGE_SIZE_OPTIONS","Pagination","props","table","pageIndex","pageSize","state","pagination","flexShrink","minHeight","borderTop","borderColor","isArray","sx","getPageCount","getRowCount","_","page","setPageIndex","event","setPagination","Number","target","value","Theme","formatForDisplay","Cell","CellData","Column","RowData","Range","defaultRangeExtractor","LayoutTableFeatures","LayoutColumnMeta","layoutTableClasses","root","main","table","toolbar","toolbarLabel","toolbarTitle","toolbarSelectedCount","toolbarDivider","toolbarQuickFilter","columnsButton","columnsPanel","filtersButton","filterPanel","columnHeaders","columnHeaderRow","columnHeader","columnHeaderContent","columnHeaderTitleContainer","sortLabel","sortIndex","menuIcon","columnSeparator","body","row","cell","groupCell","expandButton","actionsCell","cellOffset","rowOffset","filler","skeletonRow","skeletonCell","overlay","footer","footerRow","footerCell","aggregationValue","pagination","const","classNames","names","Array","filter","Boolean","join","pinnedClass","column","AnyColumn","TData","TValue","part","pinned","getIsPinned","shortcutLabel","label","hotkey","columnLabel","meta","columnDef","header","id","hasColumnLabel","columnAlign","align","columnFlex","Object","hasOwn","atoms","columnSizing","get","flex","moveColumn","delta","current","columnOrder","order","length","getAllLeafColumns","map","from","indexOf","to","splice","setColumnOrder","pinnedSx","isHeader","position","zIndex","insetInlineStart","getStart","undefined","insetInlineEnd","getAfter","bgcolor","backgroundImage","theme","palette","action","hover","selected","getIsLastColumn","borderInlineEnd","borderInlineEndStyle","borderColor","getIsFirstColumn","borderInlineStart","borderInlineStartStyle","cellSelectionSx","getIsSelected","edges","getSelectionEdges","outline","top","primary","bottom","left","right","boxShadow","quoteTsv","text","test","replaceAll","toClipboardValue","value","String","Date","toISOString","JSON","stringify","toClipboardText","regions","rows","cells","lookaheadRange","range","direction","lookahead","behind","overscan","ahead","startIndex","endIndex","dayjs","formatValue","value","dateFormat","undefined","Date","format","toString","JSON","stringify","TypographyProps","Typography","FC","formatValue","useCellContext","AggregatedCell","prefix","options","Intl","NumberFormatOptions","dateFormat","t0","$","_c","$i","Symbol","for","props","t1","undefined","cell","T0","t2","t3","t4","t5","t6","t7","t8","bb0","value","getValue","t9","entry","toLocaleString","format","Array","isArray","map","join","_c"],"sources":["../src/hooks/useDialogs.tsx","../src/components/table/context.ts","../src/components/table/table/Pagination.tsx","../src/components/table/utils.ts","../src/components/table/formatValue.ts","../src/components/table/cells/formatters/AggregatedCell.tsx"],"sourcesContent":["import {\n Button,\n Dialog,\n DialogActions,\n DialogContent,\n DialogTitle,\n useEventCallback,\n} from \"@mui/material\";\nimport { useContext, useId } 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 confirmText?: 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 const messageId = useId();\n\n return (\n <Dialog\n maxWidth=\"xs\"\n fullWidth\n open={open}\n onClose={() => onClose()}\n role=\"alertdialog\"\n aria-describedby={messageId}\n >\n <DialogTitle>{payload.title ?? t(\"Layout.Dialog.Alert\")}</DialogTitle>\n <DialogContent id={messageId}>{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 const messageId = useId();\n\n return (\n <Dialog\n maxWidth=\"xs\"\n fullWidth\n open={open}\n onClose={() => onClose(false)}\n role=\"alertdialog\"\n aria-describedby={messageId}\n >\n <DialogTitle>{payload.title ?? t(\"Layout.Dialog.Confirm\")}</DialogTitle>\n <DialogContent id={messageId}>{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 {payload.confirmText ?? 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","import {\n aggregationFn_count,\n aggregationFn_extent,\n aggregationFn_first,\n aggregationFn_last,\n aggregationFn_max,\n aggregationFn_mean,\n aggregationFn_median,\n aggregationFn_min,\n aggregationFn_sum,\n aggregationFn_unique,\n aggregationFn_uniqueCount,\n createExpandedRowModel,\n createFacetedMinMaxValues,\n createFacetedRowModel,\n createFacetedUniqueValues,\n createFilteredRowModel,\n createGroupedRowModel,\n createPaginatedRowModel,\n createSortedRowModel,\n createTableHookContexts,\n filterFn_arrHas,\n filterFn_arrIncludes,\n filterFn_arrIncludesAll,\n filterFn_arrIncludesSome,\n filterFn_between,\n filterFn_betweenInclusive,\n filterFn_empty,\n filterFn_endsWith,\n filterFn_equals,\n filterFn_equalsString,\n filterFn_equalsStringSensitive,\n filterFn_greaterThan,\n filterFn_greaterThanOrEqualTo,\n filterFn_inDateRange,\n filterFn_inNumberRange,\n filterFn_includesString,\n filterFn_includesStringSensitive,\n filterFn_lessThan,\n filterFn_lessThanOrEqualTo,\n filterFn_notEmpty,\n filterFn_startsWith,\n filterFn_weakEquals,\n metaHelper,\n sortFn_alphanumeric,\n sortFn_alphanumericCaseSensitive,\n sortFn_basic,\n sortFn_datetime,\n sortFn_text,\n sortFn_textCaseSensitive,\n stockFeatures,\n tableFeatures,\n} from \"@tanstack/react-table\";\nimport type { AggregationFnDef } from \"@tanstack/react-table\";\nimport type { LayoutColumnMeta } from \"~/components/table/types\";\n\n// table-core types min/max/extent with its non-exported `RangeValue`, which breaks .d.ts emit.\ntype RangeValue = Date | number | undefined;\ntype WithResult<TFn, TResult> =\n TFn extends AggregationFnDef<infer TFeatures, infer TData, infer TValue, unknown>\n ? AggregationFnDef<TFeatures, TData, TValue, TResult>\n : never;\n\nexport const layoutTableFeatures = tableFeatures({\n ...stockFeatures,\n columnMeta: metaHelper<LayoutColumnMeta>(),\n filteredRowModel: createFilteredRowModel(),\n sortedRowModel: createSortedRowModel(),\n paginatedRowModel: createPaginatedRowModel(),\n expandedRowModel: createExpandedRowModel(),\n groupedRowModel: createGroupedRowModel(),\n facetedRowModel: createFacetedRowModel(),\n facetedUniqueValues: createFacetedUniqueValues(),\n facetedMinMaxValues: createFacetedMinMaxValues(),\n filterFns: {\n arrHas: filterFn_arrHas,\n arrIncludes: filterFn_arrIncludes,\n arrIncludesAll: filterFn_arrIncludesAll,\n arrIncludesSome: filterFn_arrIncludesSome,\n between: filterFn_between,\n betweenInclusive: filterFn_betweenInclusive,\n empty: filterFn_empty,\n endsWith: filterFn_endsWith,\n equals: filterFn_equals,\n equalsString: filterFn_equalsString,\n equalsStringSensitive: filterFn_equalsStringSensitive,\n greaterThan: filterFn_greaterThan,\n greaterThanOrEqualTo: filterFn_greaterThanOrEqualTo,\n inDateRange: filterFn_inDateRange,\n inNumberRange: filterFn_inNumberRange,\n includesString: filterFn_includesString,\n includesStringSensitive: filterFn_includesStringSensitive,\n lessThan: filterFn_lessThan,\n lessThanOrEqualTo: filterFn_lessThanOrEqualTo,\n notEmpty: filterFn_notEmpty,\n startsWith: filterFn_startsWith,\n weakEquals: filterFn_weakEquals,\n },\n sortFns: {\n alphanumeric: sortFn_alphanumeric,\n alphanumericCaseSensitive: sortFn_alphanumericCaseSensitive,\n basic: sortFn_basic,\n datetime: sortFn_datetime,\n text: sortFn_text,\n textCaseSensitive: sortFn_textCaseSensitive,\n },\n aggregationFns: {\n sum: aggregationFn_sum,\n min: aggregationFn_min as WithResult<typeof aggregationFn_min, RangeValue>,\n max: aggregationFn_max as WithResult<typeof aggregationFn_max, RangeValue>,\n extent: aggregationFn_extent as WithResult<\n typeof aggregationFn_extent,\n [RangeValue, RangeValue]\n >,\n mean: aggregationFn_mean,\n median: aggregationFn_median,\n unique: aggregationFn_unique,\n uniqueCount: aggregationFn_uniqueCount,\n count: aggregationFn_count,\n first: aggregationFn_first,\n last: aggregationFn_last,\n },\n});\n\nexport type LayoutTableFeatures = typeof layoutTableFeatures;\n\nexport const {\n tableContext,\n cellContext,\n headerContext,\n useTableContext,\n useCellContext,\n useHeaderContext,\n} = createTableHookContexts<LayoutTableFeatures>();\n","import { TablePagination, type TablePaginationProps } from \"@mui/material\";\nimport type { FC } from \"react\";\nimport { useTableContext } from \"~/components/table/context\";\n\nexport type PaginationProps = Omit<\n TablePaginationProps,\n \"count\" | \"page\" | \"rowsPerPage\" | \"onPageChange\" | \"onRowsPerPageChange\" | \"rowsPerPageOptions\"\n> & { pageSizeOptions?: Array<number> };\n\n/** A pager is for large data sets, so it offers no \"All\". LayoutTable starts at the lowest. */\nexport const DEFAULT_PAGE_SIZE_OPTIONS = [25, 50, 100];\n\nexport const Pagination: FC<PaginationProps> = ({\n pageSizeOptions = DEFAULT_PAGE_SIZE_OPTIONS,\n ...props\n}) => {\n // The counts below are table methods; compiled, they would be cached on the table reference,\n // which does not change when only data or options (rowCount, pageCount) do.\n \"use no memo\";\n const table = useTableContext();\n const { pageIndex, pageSize } = table.state.pagination;\n\n return (\n <TablePagination\n component=\"div\"\n showFirstButton\n showLastButton\n {...props}\n sx={[\n { flexShrink: 0, minHeight: 52, borderTop: 1, borderColor: \"divider\" },\n ...(Array.isArray(props.sx) ? props.sx : [props.sx]),\n ]}\n rowsPerPageOptions={pageSizeOptions}\n // pageCount -1 means the total is unknown (cursor paging): MUI shows \"of more than N\" and\n // keeps Next enabled.\n count={table.getPageCount() === -1 ? -1 : table.getRowCount()}\n page={pageIndex}\n rowsPerPage={pageSize}\n onPageChange={(_, page) => table.setPageIndex(page)}\n // One update: a controlled onPaginationChange may resolve two calls against the same state.\n onRowsPerPageChange={(event) =>\n table.setPagination({ pageIndex: 0, pageSize: Number(event.target.value) })\n }\n />\n );\n};\n","import type { Theme } from \"@mui/material\";\nimport { formatForDisplay } from \"@tanstack/react-hotkeys\";\nimport type { Cell, CellData, Column, RowData } from \"@tanstack/react-table\";\nimport type { Range } from \"@tanstack/react-virtual\";\nimport { defaultRangeExtractor } from \"@tanstack/react-virtual\";\nimport type { LayoutTableFeatures } from \"~/components/table/context\";\nimport type { LayoutColumnMeta } from \"./types\";\n\n/** Stable class names on every table part, for `sx` selectors like `.MuiDataGrid-*`. */\nexport const layoutTableClasses = {\n root: \"LayoutTable-root\",\n main: \"LayoutTable-main\",\n table: \"LayoutTable-table\",\n\n toolbar: \"LayoutTable-toolbar\",\n toolbarLabel: \"LayoutTable-toolbarLabel\",\n toolbarTitle: \"LayoutTable-toolbarTitle\",\n toolbarSelectedCount: \"LayoutTable-toolbarSelectedCount\",\n toolbarDivider: \"LayoutTable-toolbarDivider\",\n toolbarQuickFilter: \"LayoutTable-toolbarQuickFilter\",\n columnsButton: \"LayoutTable-columnsButton\",\n columnsPanel: \"LayoutTable-columnsPanel\",\n filtersButton: \"LayoutTable-filtersButton\",\n filterPanel: \"LayoutTable-filterPanel\",\n\n columnHeaders: \"LayoutTable-columnHeaders\",\n columnHeaderRow: \"LayoutTable-columnHeaderRow\",\n columnHeader: \"LayoutTable-columnHeader\",\n \"columnHeader--sortable\": \"LayoutTable-columnHeader--sortable\",\n \"columnHeader--sorted\": \"LayoutTable-columnHeader--sorted\",\n \"columnHeader--filtered\": \"LayoutTable-columnHeader--filtered\",\n \"columnHeader--pinnedStart\": \"LayoutTable-columnHeader--pinnedStart\",\n \"columnHeader--pinnedEnd\": \"LayoutTable-columnHeader--pinnedEnd\",\n columnHeaderContent: \"LayoutTable-columnHeaderContent\",\n columnHeaderTitleContainer: \"LayoutTable-columnHeaderTitleContainer\",\n sortLabel: \"LayoutTable-sortLabel\",\n sortIndex: \"LayoutTable-sortIndex\",\n menuIcon: \"LayoutTable-menuIcon\",\n columnSeparator: \"LayoutTable-columnSeparator\",\n \"columnSeparator--resizable\": \"LayoutTable-columnSeparator--resizable\",\n \"columnSeparator--resizing\": \"LayoutTable-columnSeparator--resizing\",\n\n body: \"LayoutTable-body\",\n row: \"LayoutTable-row\",\n \"row--grouped\": \"LayoutTable-row--grouped\",\n \"row--expanded\": \"LayoutTable-row--expanded\",\n \"row--pinned\": \"LayoutTable-row--pinned\",\n cell: \"LayoutTable-cell\",\n \"cell--selected\": \"LayoutTable-cell--selected\",\n \"cell--grouped\": \"LayoutTable-cell--grouped\",\n \"cell--aggregated\": \"LayoutTable-cell--aggregated\",\n \"cell--pinnedStart\": \"LayoutTable-cell--pinnedStart\",\n \"cell--pinnedEnd\": \"LayoutTable-cell--pinnedEnd\",\n groupCell: \"LayoutTable-groupCell\",\n expandButton: \"LayoutTable-expandButton\",\n actionsCell: \"LayoutTable-actionsCell\",\n cellOffset: \"LayoutTable-cellOffset\",\n rowOffset: \"LayoutTable-rowOffset\",\n filler: \"LayoutTable-filler\",\n skeletonRow: \"LayoutTable-skeletonRow\",\n skeletonCell: \"LayoutTable-skeletonCell\",\n overlay: \"LayoutTable-overlay\",\n\n footer: \"LayoutTable-footer\",\n footerRow: \"LayoutTable-footerRow\",\n footerCell: \"LayoutTable-footerCell\",\n aggregationValue: \"LayoutTable-aggregationValue\",\n pagination: \"LayoutTable-pagination\",\n} as const;\n\nexport const classNames = (...names: Array<string | false | null | undefined>): string =>\n names.filter(Boolean).join(\" \");\n\nexport const pinnedClass = <TData extends RowData, TValue extends CellData>(\n column: AnyColumn<TData, TValue>,\n part: \"columnHeader\" | \"cell\",\n): string | false => {\n const pinned = column.getIsPinned();\n return (\n !!pinned && layoutTableClasses[`${part}--${pinned === \"start\" ? \"pinnedStart\" : \"pinnedEnd\"}`]\n );\n};\n\nexport const shortcutLabel = (label: string, hotkey: string): string =>\n `${label} (${formatForDisplay(hotkey)})`;\n\ntype AnyColumn<TData extends RowData, TValue extends CellData> = Column<\n LayoutTableFeatures,\n TData,\n TValue\n>;\n\nexport const columnLabel = <TData extends RowData, TValue extends CellData>(\n column: AnyColumn<TData, TValue>,\n): string => {\n const meta = column.columnDef.meta as LayoutColumnMeta | undefined;\n if (meta?.label) return meta.label;\n\n return typeof column.columnDef.header === \"string\" ? column.columnDef.header : column.id;\n};\n\nexport const hasColumnLabel = <TData extends RowData, TValue extends CellData>(\n column: AnyColumn<TData, TValue>,\n): boolean =>\n Boolean((column.columnDef.meta as LayoutColumnMeta | undefined)?.label) ||\n typeof column.columnDef.header === \"string\";\n\nexport const columnAlign = <TData extends RowData, TValue extends CellData>(\n column: AnyColumn<TData, TValue>,\n): \"left\" | \"center\" | \"right\" =>\n (column.columnDef.meta as LayoutColumnMeta | undefined)?.align ??\n (hasColumnLabel(column) ? \"left\" : \"center\");\n\n/** The column's `meta.flex`, or 0 once the user has resized it to a fixed width. */\nexport const columnFlex = <TData extends RowData, TValue extends CellData>(\n column: AnyColumn<TData, TValue>,\n): number =>\n Object.hasOwn(column.table.atoms.columnSizing.get(), column.id)\n ? 0\n : ((column.columnDef.meta as LayoutColumnMeta | undefined)?.flex ?? 0);\n\nexport const moveColumn = <TData extends RowData, TValue extends CellData>(\n column: AnyColumn<TData, TValue>,\n delta: number,\n): void => {\n const { table } = column;\n const current = table.atoms.columnOrder.get();\n const order = current.length ? [...current] : table.getAllLeafColumns().map(({ id }) => id);\n const from = order.indexOf(column.id);\n const to = from + delta;\n if (from < 0 || to < 0 || to >= order.length) return;\n\n order.splice(to, 0, ...order.splice(from, 1));\n table.setColumnOrder(order);\n};\n\nexport const pinnedSx = <TData extends RowData, TValue extends CellData>(\n column: AnyColumn<TData, TValue>,\n isHeader = false,\n) => {\n const pinned = column.getIsPinned();\n if (!pinned) return {};\n\n return {\n position: \"sticky\",\n zIndex: isHeader ? 4 : 2,\n insetInlineStart: pinned === \"start\" ? column.getStart(\"start\") : undefined,\n insetInlineEnd: pinned === \"end\" ? column.getAfter(\"end\") : undefined,\n bgcolor: \"background.paper\",\n ...(!isHeader && {\n \".MuiTableRow-root:hover > &\": {\n backgroundImage: (theme: Theme) =>\n `linear-gradient(${theme.palette.action.hover}, ${theme.palette.action.hover})`,\n },\n \".MuiTableRow-root.Mui-selected > &\": {\n backgroundImage: (theme: Theme) =>\n `linear-gradient(${theme.palette.action.selected}, ${theme.palette.action.selected})`,\n },\n }),\n ...(pinned === \"start\" &&\n column.getIsLastColumn(\"start\") && {\n borderInlineEnd: 1,\n borderInlineEndStyle: \"solid\",\n borderColor: \"divider\",\n }),\n ...(pinned === \"end\" &&\n column.getIsFirstColumn(\"end\") && {\n borderInlineStart: 1,\n borderInlineStartStyle: \"solid\",\n borderColor: \"divider\",\n }),\n };\n};\n\nexport const cellSelectionSx = <TData extends RowData, TValue extends CellData>(\n cell: Cell<LayoutTableFeatures, TData, TValue>,\n) => {\n if (!cell.getIsSelected()) return {};\n\n const edges = cell.getSelectionEdges();\n const outline = (theme: Theme) =>\n [\n edges.top && `inset 0 2px 0 0 ${theme.palette.primary.main}`,\n edges.bottom && `inset 0 -2px 0 0 ${theme.palette.primary.main}`,\n edges.left && `inset 2px 0 0 0 ${theme.palette.primary.main}`,\n edges.right && `inset -2px 0 0 0 ${theme.palette.primary.main}`,\n ]\n .filter(Boolean)\n .join(\", \") || \"none\";\n\n return {\n backgroundImage: (theme: Theme) =>\n `linear-gradient(${theme.palette.action.selected}, ${theme.palette.action.selected})`,\n boxShadow: outline,\n };\n};\n\n/** Spreadsheet TSV quoting, so a cell holding a tab or a newline stays one cell. */\nconst quoteTsv = (text: string): string =>\n /[\"\\t\\n\\r]/.test(text) ? `\"${text.replaceAll('\"', '\"\"')}\"` : text;\n\nconst toClipboardValue = (value: unknown): string => {\n if (value == null) return \"\";\n if (typeof value === \"string\") return quoteTsv(value);\n if (typeof value === \"number\" || typeof value === \"boolean\" || typeof value === \"bigint\")\n return quoteTsv(String(value));\n if (value instanceof Date) return quoteTsv(value.toISOString());\n\n // Everything else — objects, and the odd symbol or function — as JSON or blank.\n return quoteTsv(JSON.stringify(value) ?? \"\");\n};\n\n/**\n * Serializes `table.getSelectedCellRangesData()` as TSV, which is what Excel,\n * Google Sheets and LibreOffice all paste as a grid. Disjoint selection regions\n * are separated by a blank line.\n */\nexport const toClipboardText = (regions: Array<Array<Array<unknown>>>): string =>\n regions\n .map((rows) => rows.map((cells) => cells.map(toClipboardValue).join(\"\\t\")).join(\"\\n\"))\n .join(\"\\n\\n\");\n\nexport const lookaheadRange = (\n range: Range,\n direction: \"forward\" | \"backward\" | null,\n lookahead: number,\n): Array<number> => {\n const behind = direction ? 0 : range.overscan;\n const ahead = direction ? lookahead : range.overscan;\n\n return defaultRangeExtractor({\n ...range,\n startIndex: range.startIndex - (direction === \"backward\" ? ahead : behind),\n endIndex: range.endIndex + (direction === \"backward\" ? behind : ahead),\n overscan: 0,\n });\n};\n","import dayjs from \"dayjs\";\n\nexport const formatValue = (value: unknown, dateFormat = \"L LT\"): string => {\n if (value === null || value === undefined) return \"\";\n if (value instanceof Date) return dayjs(value).format(dateFormat);\n if (typeof value === \"string\") return value;\n if (typeof value === \"number\" || typeof value === \"boolean\" || typeof value === \"bigint\") {\n return value.toString();\n }\n\n return JSON.stringify(value) ?? \"\";\n};\n","import type { TypographyProps } from \"@mui/material\";\nimport { Typography } from \"@mui/material\";\nimport type { FC } from \"react\";\nimport { formatValue } from \"~/components/table/formatValue\";\nimport { useCellContext } from \"~/components/table/context\";\n\nexport const AggregatedCell: FC<\n TypographyProps & {\n prefix?: string;\n options?: Intl.NumberFormatOptions;\n dateFormat?: string;\n }\n> = ({ prefix = \"\", options, dateFormat, ...props }) => {\n const cell = useCellContext();\n const value = cell.getValue();\n if (value === null || value === undefined || value === \"\") return null;\n\n const format = (entry: unknown) =>\n typeof entry === \"number\"\n ? entry.toLocaleString(undefined, options)\n : formatValue(entry, dateFormat);\n\n return (\n <Typography variant=\"body2\" color=\"text.secondary\" noWrap {...props}>\n {prefix}\n {/* `extent` — the default aggregate for anything non-numeric — is a [min, max] pair. */}\n {Array.isArray(value) ? value.map(format).join(\" – \") : format(value)}\n </Typography>\n );\n};\n"],"mappings":";;;;;;;;;;;AA8DA,SAAOsC,YAAAC,IAAA;CAAA,MAAAC,IAAAC,EAAA,EAAA;CAAA,IAAAD,EAAA,OAAA,oEAAA;EAAA,KAAA,IAAAE,KAAA,GAAAA,KAAA,IAAAA,MAAA,GAAAF,EAAAE,MAAAC,OAAAC,IAAA,2BAAA;EAAAJ,EAAA,KAAA;CAAA;CAAqB,MAAA,EAAAhB,MAAAF,SAAAV,YAAA2B;CAC1B,MAAA,EAAAM,MAAcrC,eAAe;CAC7B,MAAAsC,YAAkBvC,MAAM;CAAE,IAAAwC;CAAA,IAAAP,EAAA,OAAA5B,SAAA;EAObmC,WAAMnC,QAAQ;EAAC4B,EAAA,KAAA5B;EAAA4B,EAAA,KAAAO;CAAA,OAAAA,KAAAP,EAAA;CAAA,IAAAQ;CAAA,IAAAR,EAAA,OAAA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MAAAW;EAAAX,EAAA,MAAAY;EAAAZ,EAAA,MAAAa;EAAAb,EAAA,MAAAc;EAAAd,EAAA,MAAAe;EAAAf,EAAA,MAAAoB;CAAA,OAAAA,KAAApB,EAAA;CAAA,OAJboB;AAIa"}
@@ -1,78 +0,0 @@
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
- // src/components/router/RouterIconButton.tsx
7
- const Component$1 = 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 CreatedComponent$1 = createLink(Component$1);
27
- const RouterIconButton = (props) => {
28
- const $ = c(3);
29
- if ($[0] !== "78225cdb1e7335044739e8f2aa569a8b6e8ddff45ee95d92920518aa6794a52d") {
30
- for (let $i = 0; $i < 3; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
31
- $[0] = "78225cdb1e7335044739e8f2aa569a8b6e8ddff45ee95d92920518aa6794a52d";
32
- }
33
- let t0;
34
- if ($[1] !== props) {
35
- t0 = /* @__PURE__ */ jsx(CreatedComponent$1, { ...props });
36
- $[1] = props;
37
- $[2] = t0;
38
- } else t0 = $[2];
39
- return t0;
40
- };
41
- // src/components/router/RouterListItemButton.tsx
42
- const Component = 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 CreatedComponent = createLink(Component);
62
- const RouterListItemButton = (props) => {
63
- const $ = c(3);
64
- if ($[0] !== "a33d2f291bddc17afd0afbb422e06a0a3bbcd9c360494d00918e68b54a100925") {
65
- for (let $i = 0; $i < 3; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
66
- $[0] = "a33d2f291bddc17afd0afbb422e06a0a3bbcd9c360494d00918e68b54a100925";
67
- }
68
- let t0;
69
- if ($[1] !== props) {
70
- t0 = /* @__PURE__ */ jsx(CreatedComponent, { ...props });
71
- $[1] = props;
72
- $[2] = t0;
73
- } else t0 = $[2];
74
- return t0;
75
- };
76
- export { RouterIconButton as n, RouterListItemButton as t };
77
-
78
- //# sourceMappingURL=RouterListItemButton-B-cQ1XwU.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"RouterListItemButton-B-cQ1XwU.mjs","names":["IconButton","createLink","React","IconButtonProps","LinkComponent","Component","forwardRef","HTMLAnchorElement","IconButtonComponent","props","reference","$","_c","$i","Symbol","for","t0","CreatedComponent","RouterIconButton","Component","_c","CreatedComponent","ListItemButton","createLink","React","ListItemButtonProps","LinkComponent","Component","forwardRef","HTMLAnchorElement","ButtonComponent","props","reference","$","_c","$i","Symbol","for","t0","CreatedComponent","RouterListItemButton","_c"],"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":";;;;;;AAMA,MAAMK,cAAYH,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,CAElE;AAEA,MAAMC,qBA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OAAA;EAC5DO,KAAA,oBAAC,kBAAD,EAAiB,GAAKP,MAAK,CAAA;EAAIE,EAAA,KAAAF;EAAAE,EAAA,KAAAK;CAAA,OAAAA,KAAAL,EAAA;CAAA,OAA/BK;AAA+B"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"approval-ByDIMRhe.mjs","names":["createServerOnlyFn","z","createApi","ApproveApprovalSchema","CancelApprovalSchema","CreateApprovalSchema","ResubmitApprovalSchema","WithdrawApprovalSchema","Approval","ApprovalStatus","ApprovalStepResult","GetApprovalsSchema","object","appName","string","min","max","status","optional","approverEmployeeId","stepResult","GetApprovalSchema","id","uuid","approvalApi","baseURL","scopeKey","getApprovals","data","input","Promise","Array","parse","queryParams","URLSearchParams","append","toString","api","approvals","request","url","method","getApproval","approval","createApproval","approveApproval","resubmitApproval","withdrawApproval","cancelApproval","z"],"sources":["../src/data/server/approval.ts"],"sourcesContent":["import { createServerOnlyFn } from \"@tanstack/react-start\";\nimport { z } from \"zod\";\nimport { createApi } from \"~/lib/createApi\";\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\";\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\nconst approvalApi = () => createApi({ baseURL: \"APPROVAL_BASE_URL\", scopeKey: \"approval\" });\n\nexport const getApprovals = createServerOnlyFn(\n async ({ data }: { data: z.input<typeof GetApprovalsSchema> }): Promise<Array<Approval>> => {\n const input = GetApprovalsSchema.parse(data);\n const queryParams = new URLSearchParams();\n queryParams.append(\"applicationName\", input.appName);\n if (input.status) queryParams.append(\"status\", input.status.toString());\n if (input.approverEmployeeId)\n queryParams.append(\"approverEmployeeId\", input.approverEmployeeId);\n if (input.stepResult) queryParams.append(\"stepResult\", input.stepResult.toString());\n\n const api = await approvalApi();\n const { data: approvals } = await api.request<Array<Approval>>({\n url: `/Requests?${queryParams.toString()}`,\n method: \"GET\",\n });\n return approvals;\n },\n);\n\nexport const getApproval = createServerOnlyFn(\n async ({ data }: { data: z.input<typeof GetApprovalSchema> }): Promise<Approval> => {\n const input = GetApprovalSchema.parse(data);\n const api = await approvalApi();\n const { data: approval } = await api.request<Approval>({\n url: `/Requests/${input.id}`,\n method: \"GET\",\n });\n return approval;\n },\n);\n\nexport const createApproval = createServerOnlyFn(\n async ({ data }: { data: z.input<typeof CreateApprovalSchema> }): Promise<Approval> => {\n const input = CreateApprovalSchema.parse(data);\n const api = await approvalApi();\n const { data: approval } = await api.request<Approval>({\n url: `/Requests`,\n method: \"POST\",\n data: input,\n });\n return approval;\n },\n);\n\nexport const approveApproval = createServerOnlyFn(\n async ({ data }: { data: z.input<typeof ApproveApprovalSchema> }): Promise<Approval> => {\n const input = ApproveApprovalSchema.parse(data);\n const api = await approvalApi();\n const { data: approval } = await api.request<Approval>({\n url: `/Requests/${input.id}/single-approval`,\n method: \"POST\",\n data: input,\n });\n return approval;\n },\n);\n\nexport const resubmitApproval = createServerOnlyFn(\n async ({ data }: { data: z.input<typeof ResubmitApprovalSchema> }): Promise<Approval> => {\n const input = ResubmitApprovalSchema.parse(data);\n const api = await approvalApi();\n const { data: approval } = await api.request<Approval>({\n url: `/Requests/${input.id}/resubmit`,\n method: \"POST\",\n data: input,\n });\n return approval;\n },\n);\n\nexport const withdrawApproval = createServerOnlyFn(\n async ({ data }: { data: z.input<typeof WithdrawApprovalSchema> }): Promise<void> => {\n const input = WithdrawApprovalSchema.parse(data);\n const api = await approvalApi();\n await api.request<void>({\n url: `/Requests/${input.id}/withdraw`,\n method: \"POST\",\n data: input,\n });\n },\n);\n\nexport const cancelApproval = createServerOnlyFn(\n async ({ data }: { data: z.input<typeof CancelApprovalSchema> }): Promise<void> => {\n const input = CancelApprovalSchema.parse(data);\n const api = await approvalApi();\n await api.request<void>({\n url: `/Requests/${input.id}/cancel`,\n method: \"POST\",\n data: input,\n });\n },\n);\n"],"mappings":";;;;;AAcA,MAAaW,qBAAqBV,IAAEW,OAAO;CACzCC,SAASZ,IAAEa,OAAO,CAAC,CAACC,IAAI,CAAC,CAAC,CAACC,IAAI,GAAG;CAClCC,QAAQR,eAAeS,SAAS;CAChCC,oBAAoBlB,IAAEa,OAAO,CAAC,CAACC,IAAI,CAAC,CAAC,CAACC,IAAI,EAAE,CAAC,CAACE,SAAS;CACvDE,YAAYV,mBAAmBQ,SAAS;AAC1C,CAAC;AAED,MAAaG,oBAAoBpB,IAAEW,OAAO,EACxCU,IAAIrB,IAAEsB,KAAK,EACb,CAAC;AAED,MAAMC,oBAAoBtB,UAAU;CAAEuB,SAAS;CAAqBC,UAAU;AAAW,CAAC;AAE1F,MAAaC,eAAe3B,mBAC1B,OAAO,EAAE4B,WAAmF;CAC1F,MAAMC,QAAQlB,mBAAmBqB,MAAMJ,IAAI;CAC3C,MAAMK,cAAc,IAAIC,gBAAgB;CACxCD,YAAYE,OAAO,mBAAmBN,MAAMhB,OAAO;CACnD,IAAIgB,MAAMZ,QAAQgB,YAAYE,OAAO,UAAUN,MAAMZ,OAAOmB,SAAS,CAAC;CACtE,IAAIP,MAAMV,oBACRc,YAAYE,OAAO,sBAAsBN,MAAMV,kBAAkB;CACnE,IAAIU,MAAMT,YAAYa,YAAYE,OAAO,cAAcN,MAAMT,WAAWgB,SAAS,CAAC;CAGlF,MAAM,EAAER,MAAMU,cAAc,OAAMD,MADhBb,YAAY,EAAA,CACQe,QAAyB;EAC7DC,KAAK,aAAaP,YAAYG,SAAS;EACvCK,QAAQ;CACV,CAAC;CACD,OAAOH;AACT,CACF;AAEA,MAAaI,cAAc1C,m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ACF;AAEA,MAAamB,iBAAiBhD,mBAC5B,OAAO,EAAE4B,WAA0E;CACjF,MAAMC,QAAQzB,qBAAqB4B,MAAMJ,IAAI;CAE7C,OAAMS,MADYb,YAAY,EAAA,CACpBe,QAAc;EACtBC,KAAK,aAAaX,MAAMP,GAAE;EAC1BmB,QAAQ;EACRb,MAAMC;CACR,CAAC;AACH,CACF"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"createApi-L3ypB1gH.mjs","names":["createServerOnlyFn","axios","AxiosError","AxiosInstance","https","serverEnv","scopes","definedScopes","getAccessToken","getAppToken","getSessionUser","ApiOptions","baseURL","scopeKey","httpsAgent","Agent","rejectUnauthorized","createApi","Promise","resolvedBaseURL","process","env","Error","accessToken","api","create","headers","Authorization","interceptors","response","use","undefined","error","data","message"],"sources":["../src/lib/createApi.ts"],"sourcesContent":["import { createServerOnlyFn } from \"@tanstack/react-start\";\nimport axios, { AxiosError, type AxiosInstance } from \"axios\";\nimport https from \"node:https\";\nimport type { serverEnv } from \"virtual:wcz-layout\";\nimport { scopes as definedScopes } from \"virtual:wcz-layout\";\nimport { getAccessToken, getAppToken } from \"~/lib/auth/tokens\";\nimport { getSessionUser } from \"~/lib/auth/user\";\n\nexport interface ApiOptions {\n baseURL: keyof typeof serverEnv & `${string}BASE_URL${string}`;\n scopeKey: keyof typeof definedScopes;\n}\n\nconst httpsAgent = new https.Agent({\n rejectUnauthorized: false,\n});\n\nexport const createApi = createServerOnlyFn(\n async ({ baseURL, scopeKey }: ApiOptions): Promise<AxiosInstance> => {\n const resolvedBaseURL = process.env[baseURL];\n if (!resolvedBaseURL) throw new Error(`\"${baseURL}\" env variable is not set.`);\n\n const accessToken = (await getSessionUser())\n ? await getAccessToken(scopeKey)\n : await getAppToken(scopeKey);\n\n const api = axios.create({\n baseURL: resolvedBaseURL,\n httpsAgent,\n headers: { Authorization: `Bearer ${accessToken}` },\n });\n\n api.interceptors.response.use(undefined, (error: unknown) => {\n if (error instanceof AxiosError)\n throw new Error(error.response?.data?.message ?? error.message);\n throw error;\n });\n\n return api;\n },\n);\n"],"mappings":";;;;;;;AAaA,MAAMc,aAAa,IAAIV,MAAMW,MAAM,EACjCC,oBAAoB,MACtB,CAAC;AAED,MAAaC,YAAYjB,mBACvB,OAAO,EAAEY,SAASC,eAAmD;CACnE,MAAMM,kBAAkBC,QAAQC,IAAIT;CACpC,IAAI,CAACO,iBAAiB,MAAM,IAAIG,MAAM,IAAIV,QAAO,2BAA4B;CAE7E,MAAMW,cAAe,MAAMb,eAAe,IACtC,MAAMF,eAAeK,QAAQ,IAC7B,MAAMJ,YAAYI,QAAQ;CAE9B,MAAMW,MAAMvB,MAAMwB,OAAO;EACvBb,SAASO;EACTL;EACAY,SAAS,EAAEC,eAAe,UAAUJ,cAAc;CACpD,CAAC;CAEDC,IAAII,aAAaC,SAASC,IAAIC,KAAAA,IAAYC,UAAmB;EAC3D,IAAIA,iBAAiB9B,YACnB,MAAM,IAAIoB,MAAMU,MAAMH,UAAUI,MAAMC,WAAWF,MAAME,OAAO;EAChE,MAAMF;CACR,CAAC;CAED,OAAOR;AACT,CACF"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"file-B4Q_bGLN.mjs","names":["createServerOnlyFn","AxiosResponse","https","Readable","DefaultHttpStack","Upload","z","serverEnv","uuidv7","getAccessToken","getAppToken","getSessionUser","createApi","FileMeta","FileMetaSchema","GetFileMetasSchema","object","appName","string","min","max","subId","uuid","FileSchema","id","UpdateFileMetaSchema","extend","fileName","DeleteFileSchema","BatchDeleteFilesSchema","UploadFileResult","UploadFileMetaSchema","default","file","instanceof","File","fileApi","baseURL","scopeKey","toFileResponse","response","disposition","Response","headers","Headers","String","contentLength","set","toWeb","data","ReadableStream","getFileMetas","input","Promise","Array","parse","queryParams","URLSearchParams","append","api","fileMetas","request","url","toString","method","getFileThumbnail","responseType","getFile","downloadFile","updateFileMeta","deleteFile","batchDeleteFiles","insecureHttpsAgent","Agent","rejectUnauthorized","uploadFile","accessToken","stream","fromWeb","resolve","reject","upload","endpoint","FILE_BASE_URL","httpStack","agent","uploadSize","size","chunkSize","metadata","filename","name","filetype","type","Authorization","onError","onSuccess","start","z"],"sources":["../src/data/server/file.ts"],"sourcesContent":["import { createServerOnlyFn } from \"@tanstack/react-start\";\nimport type { AxiosResponse } from \"axios\";\nimport https from \"node:https\";\nimport { Readable } from \"node:stream\";\nimport { DefaultHttpStack, Upload } from \"tus-js-client\";\nimport { z } from \"zod\";\nimport { serverEnv } from \"~/env\";\nimport { uuidv7 } from \"~/exports/utils\";\nimport { getAccessToken, getAppToken } from \"~/lib/auth/tokens\";\nimport { getSessionUser } from \"~/lib/auth/user\";\nimport { createApi } from \"~/lib/createApi\";\nimport type { FileMeta } from \"~/models/file/FileMeta\";\nimport { FileMetaSchema } from \"~/models/file/FileMeta\";\n\nexport const GetFileMetasSchema = z.object({\n appName: z.string().min(1).max(255),\n subId: z.uuid(),\n});\n\nexport const FileSchema = z.object({\n appName: z.string().min(1).max(255),\n id: z.uuid(),\n});\n\nexport const UpdateFileMetaSchema = FileMetaSchema.extend({\n fileName: z.string().min(1).max(255),\n});\n\nconst DeleteFileSchema = FileSchema;\n\nconst BatchDeleteFilesSchema = GetFileMetasSchema;\n\nexport interface UploadFileResult {\n id: string;\n appName: string;\n subId: string;\n fileName: string;\n}\n\nexport const UploadFileMetaSchema = z.object({\n id: z.uuid().default(uuidv7),\n appName: z.string().min(1).max(255),\n subId: z.uuid(),\n file: z.instanceof(File),\n});\n\nconst fileApi = () => createApi({ baseURL: \"FILE_BASE_URL\", scopeKey: \"file\" });\n\nfunction toFileResponse(response: AxiosResponse<Readable>, disposition?: string): Response {\n const headers = new Headers({\n \"Cache-Control\": \"private, max-age=3600, immutable\",\n \"Content-Type\": String(response.headers[\"content-type\"] ?? \"application/octet-stream\"),\n });\n const contentLength = response.headers[\"content-length\"];\n if (contentLength) headers.set(\"Content-Length\", String(contentLength));\n if (disposition) headers.set(\"Content-Disposition\", disposition);\n\n return new Response(Readable.toWeb(response.data) as ReadableStream, { headers });\n}\n\nexport const getFileMetas = createServerOnlyFn(\n async ({ data }: { data: z.input<typeof GetFileMetasSchema> }): Promise<Array<FileMeta>> => {\n const input = GetFileMetasSchema.parse(data);\n const queryParams = new URLSearchParams();\n queryParams.append(\"appName\", input.appName);\n queryParams.append(\"subId\", input.subId);\n\n const api = await fileApi();\n const { data: fileMetas } = await api.request<Array<FileMeta>>({\n url: `/v1/meta?${queryParams.toString()}`,\n method: \"GET\",\n });\n return fileMetas;\n },\n);\n\nexport const getFileThumbnail = createServerOnlyFn(\n async ({ data }: { data: z.input<typeof FileSchema> }): Promise<Response> => {\n const input = FileSchema.parse(data);\n const queryParams = new URLSearchParams();\n queryParams.append(\"appName\", input.appName);\n queryParams.append(\"id\", input.id);\n\n const api = await fileApi();\n const response = await api.request<Readable>({\n url: `/v1/thumbnail?${queryParams.toString()}`,\n method: \"GET\",\n responseType: \"stream\",\n });\n\n return toFileResponse(response);\n },\n);\n\nexport const getFile = createServerOnlyFn(\n async ({ data }: { data: z.input<typeof FileSchema> }): Promise<Response> => {\n const input = FileSchema.parse(data);\n const queryParams = new URLSearchParams();\n queryParams.append(\"appName\", input.appName);\n queryParams.append(\"id\", input.id);\n\n const api = await fileApi();\n const response = await api.request<Readable>({\n url: `/v1?${queryParams.toString()}`,\n method: \"GET\",\n responseType: \"stream\",\n });\n\n return toFileResponse(response, \"inline\");\n },\n);\n\nexport const downloadFile = createServerOnlyFn(\n async ({ data }: { data: z.input<typeof FileSchema> }): Promise<Response> => {\n const input = FileSchema.parse(data);\n const queryParams = new URLSearchParams();\n queryParams.append(\"appName\", input.appName);\n queryParams.append(\"id\", input.id);\n\n const api = await fileApi();\n const response = await api.request<Readable>({\n url: `/v1/download?${queryParams.toString()}`,\n method: \"GET\",\n responseType: \"stream\",\n });\n\n return toFileResponse(response);\n },\n);\n\nexport const updateFileMeta = createServerOnlyFn(\n async ({ data }: { data: z.input<typeof UpdateFileMetaSchema> }): Promise<void> => {\n const input = UpdateFileMetaSchema.parse(data);\n const queryParams = new URLSearchParams();\n queryParams.append(\"appName\", input.appName);\n queryParams.append(\"id\", input.id);\n\n const api = await fileApi();\n await api.request({ url: `/v1/meta?${queryParams.toString()}`, method: \"PUT\", data: input });\n },\n);\n\nexport const deleteFile = createServerOnlyFn(\n async ({ data }: { data: z.input<typeof DeleteFileSchema> }): Promise<void> => {\n const input = DeleteFileSchema.parse(data);\n const queryParams = new URLSearchParams();\n queryParams.append(\"appName\", input.appName);\n queryParams.append(\"id\", input.id);\n\n const api = await fileApi();\n await api.request({ url: `/v1?${queryParams.toString()}`, method: \"DELETE\" });\n },\n);\n\nexport const batchDeleteFiles = createServerOnlyFn(\n async ({ data }: { data: z.input<typeof BatchDeleteFilesSchema> }): Promise<void> => {\n const input = BatchDeleteFilesSchema.parse(data);\n const queryParams = new URLSearchParams();\n queryParams.append(\"appName\", input.appName);\n queryParams.append(\"subId\", input.subId);\n\n const api = await fileApi();\n await api.request({ url: `/v1?${queryParams.toString()}`, method: \"DELETE\" });\n },\n);\n\nconst insecureHttpsAgent = new https.Agent({ rejectUnauthorized: false });\n\nexport const uploadFile = createServerOnlyFn(\n async ({ data }: { data: z.input<typeof UploadFileMetaSchema> }): Promise<UploadFileResult> => {\n const input = UploadFileMetaSchema.parse(data);\n const accessToken = (await getSessionUser())\n ? await getAccessToken(\"file\")\n : await getAppToken(\"file\");\n const stream = Readable.fromWeb(\n input.file.stream() as import(\"node:stream/web\").ReadableStream,\n );\n\n await new Promise<void>((resolve, reject) => {\n const upload = new Upload(stream, {\n endpoint: `${serverEnv.FILE_BASE_URL}/v1/upload`,\n httpStack: new DefaultHttpStack({ agent: insecureHttpsAgent }),\n uploadSize: input.file.size,\n chunkSize: 1_048_576,\n metadata: {\n id: input.id,\n appName: input.appName,\n subId: input.subId,\n filename: input.file.name,\n filetype: input.file.type,\n },\n headers: { Authorization: `Bearer ${accessToken}` },\n onError: reject,\n onSuccess: () => resolve(),\n });\n upload.start();\n });\n\n return {\n id: input.id,\n appName: input.appName,\n subId: input.subId,\n fileName: input.file.name,\n };\n },\n);\n"],"mappings":";;;;;;;;;;;AAcA,MAAae,qBAAqBT,IAAEU,OAAO;CACzCC,SAASX,IAAEY,OAAO,CAAC,CAACC,IAAI,CAAC,CAAC,CAACC,IAAI,GAAG;CAClCC,OAAOf,IAAEgB,KAAK;AAChB,CAAC;AAED,MAAaC,aAAajB,IAAEU,OAAO;CACjCC,SAASX,IAAEY,OAAO,CAAC,CAACC,IAAI,CAAC,CAAC,CAACC,IAAI,GAAG;CAClCI,IAAIlB,IAAEgB,KAAK;AACb,CAAC;AAED,MAAaG,uBAAuBX,eAAeY,OAAO,EACxDC,UAAUrB,IAAEY,OAAO,CAAC,CAACC,IAAI,CAAC,CAAC,CAACC,IAAI,GAAG,EACrC,CAAC;AAED,MAAMQ,mBAAmBL;AAEzB,MAAMM,yBAAyBd;AAS/B,MAAagB,uBAAuBzB,IAAEU,OAAO;CAC3CQ,IAAIlB,IAAEgB,KAAK,CAAC,CAACU,QAAQxB,MAAM;CAC3BS,SAASX,IAAEY,OAAO,CAAC,CAACC,IAAI,CAAC,CAAC,CAACC,IAAI,GAAG;CAClCC,OAAOf,IAAEgB,KAAK;CACdW,MAAM3B,IAAE4B,WAAWC,IAAI;AACzB,CAAC;AAED,MAAMC,gBAAgBxB,UAAU;CAAEyB,SAAS;CAAiBC,UAAU;AAAO,CAAC;AAE9E,SAASC,eAAeC,UAAmCC,aAAgC;CACzF,MAAME,UAAU,IAAIC,QAAQ;EAC1B,iBAAiB;EACjB,gBAAgBC,OAAOL,SAASG,QAAQ,mBAAmB,0BAA0B;CACvF,CAAC;CACD,MAAMG,gBAAgBN,SAASG,QAAQ;CACvC,IAAIG,eAAeH,QAAQI,IAAI,kBAAkBF,OAAOC,aAAa,CAAC;CACtE,IAAIL,aAAaE,QAAQI,IAAI,uBAAuBN,WAAW;CAE/D,OAAO,IAAIC,SAASvC,SAAS6C,MAAMR,SAASS,IAAI,GAAqB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CAGvC,OAAMsC,MADYvB,QAAQ,EAAA,CAChByB,QAAQ;EAAEC,KAAK,OAAON,YAAYO,SAAS;EAAKC,QAAQ;CAAS,CAAC;AAC9E,CACF;AAEA,MAAMQ,qBAAqB,IAAItE,MAAMuE,MAAM,EAAEC,oBAAoB,MAAM,CAAC;AAExE,MAAaC,aAAa3E,mBACxB,OAAO,EAAEiD,WAAsF;CAC7F,MAAMG,QAAQrB,qBAAqBwB,MAAMN,IAAI;CAC7C,MAAM2B,cAAe,MAAMjE,eAAe,IACtC,MAAMF,eAAe,MAAM,IAC3B,MAAMC,YAAY,MAAM;CAC5B,MAAMmE,SAAS1E,SAAS2E,QACtB1B,MAAMnB,KAAK4C,OAAO,CACpB;CAEA,MAAM,IAAIxB,SAAe0B,SAASC,WAAW;EAiB3CC,IAhBmB5E,OAAOwE,QAAQ;GAChCK,UAAU,GAAG3E,UAAU4E,cAAa;GACpCC,WAAW,IAAIhF,iBAAiB,EAAEiF,OAAOb,mBAAmB,CAAC;GAC7Dc,YAAYlC,MAAMnB,KAAKsD;GACvBC,WAAW;GACXC,UAAU;IACRjE,IAAI4B,MAAM5B;IACVP,SAASmC,MAAMnC;IACfI,OAAO+B,MAAM/B;IACbqE,UAAUtC,MAAMnB,KAAK0D;IACrBC,UAAUxC,MAAMnB,KAAK4D;GACvB;GACAlD,SAAS,EAAEmD,eAAe,UAAUlB,cAAc;GAClDmB,SAASf;GACTgB,iBAAiBjB,QAAQ;EAC3B,CACAE,CAAM,CAACgB,MAAM;CACf,CAAC;CAED,OAAO;EACLzE,IAAI4B,MAAM5B;EACVP,SAASmC,MAAMnC;EACfI,OAAO+B,MAAM/B;EACbM,UAAUyB,MAAMnB,KAAK0D;CACvB;AACF,CACF"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"file-CwumKq_P.mjs","names":["createServerFn","serverEnv","getAccessToken","getAppToken","getSessionUser","getFileUploadToken","method","handler","token","endpoint","FILE_BASE_URL","mutationOptions","queryOptions","createServerFn","Upload","uuidv7","z","UploadFileMetaSchema","UploadFileResult","FileSchema","GetFileMetasSchema","UpdateFileMetaSchema","batchDeleteFiles","deleteFile","downloadFile","getFile","getFileMetas","getFileThumbnail","updateFileMeta","QueryClientParam","getFileUploadToken","QUERY_KEY","HOUR","getFileMetasRpc","method","validator","handler","data","getFileThumbnailRpc","getFileRpc","downloadFileRpc","updateFileMetaRpc","deleteFileRpc","batchDeleteFilesRpc","baseOptions","staleTime","gcTime","refetchOnWindowFocus","responseToObjectUrl","response","Response","Promise","blob","URL","createObjectURL","saveBlob","Blob","fileName","url","anchor","document","createElement","href","download","click","revokeObjectURL","fileMetasQueryOptions","params","input","queryKey","appName","subId","queryFn","fileThumbnailQueryOptions","id","enabled","fileQueryOptions","downloadFileMutationOptions","mutationFn","fileExtension","openFileMutationOptions","target","current","Window","Error","onSuccess","source","popup","opener","location","window","open","onError","close","updateFileMetaMutationOptions","queryClient","onSettled","invalidateQueries","exact","deleteFileMutationOptions","batchDeleteFilesMutationOptions","uploadFileMutationOptions","file","setProgress","progress","token","endpoint","resolve","reject","upload","chunkSize","metadata","filename","name","filetype","type","headers","Authorization","onProgress","bytesUploaded","bytesTotal","start","result"],"sources":["../src/server/actions/file.ts","../src/data/client/file.ts"],"sourcesContent":["import { createServerFn } from \"@tanstack/react-start\";\nimport { serverEnv } from \"~/env\";\nimport { getAccessToken, getAppToken } from \"~/lib/auth/tokens\";\nimport { getSessionUser } from \"~/lib/auth/user\";\n\nexport const getFileUploadToken = createServerFn({ method: \"GET\" }).handler(async () => ({\n token: (await getSessionUser()) ? await getAccessToken(\"file\") : await getAppToken(\"file\"),\n endpoint: `${serverEnv.FILE_BASE_URL}/v1/upload`,\n}));\n","import { mutationOptions, queryOptions } from \"@tanstack/react-query\";\nimport { createServerFn } from \"@tanstack/react-start\";\nimport { Upload } from \"tus-js-client\";\nimport { uuidv7 } from \"uuidv7\";\nimport type { z } from \"zod\";\nimport type { UploadFileMetaSchema, UploadFileResult } from \"~/data/server/file\";\nimport {\n FileSchema,\n GetFileMetasSchema,\n UpdateFileMetaSchema,\n batchDeleteFiles,\n deleteFile,\n downloadFile,\n getFile,\n getFileMetas,\n getFileThumbnail,\n updateFileMeta,\n} from \"~/data/server/file\";\nimport type { QueryClientParam } from \"~/models/QueryClientParam\";\nimport { getFileUploadToken } from \"~/server/actions/file\";\n\nconst QUERY_KEY = \"file\";\nconst HOUR = 1000 * 60 * 60;\n\nconst getFileMetasRpc = createServerFn({ method: \"GET\" })\n .validator(GetFileMetasSchema)\n .handler(({ data }) => getFileMetas({ data }));\n\nconst getFileThumbnailRpc = createServerFn({ method: \"GET\" })\n .validator(FileSchema)\n .handler(({ data }) => getFileThumbnail({ data }));\n\nconst getFileRpc = createServerFn({ method: \"GET\" })\n .validator(FileSchema)\n .handler(({ data }) => getFile({ data }));\n\nconst downloadFileRpc = createServerFn({ method: \"GET\" })\n .validator(FileSchema)\n .handler(({ data }) => downloadFile({ data }));\n\nconst updateFileMetaRpc = createServerFn({ method: \"POST\" })\n .validator(UpdateFileMetaSchema)\n .handler(({ data }) => updateFileMeta({ data }));\n\nconst deleteFileRpc = createServerFn({ method: \"POST\" })\n .validator(FileSchema)\n .handler(({ data }) => deleteFile({ data }));\n\nconst batchDeleteFilesRpc = createServerFn({ method: \"POST\" })\n .validator(GetFileMetasSchema)\n .handler(({ data }) => batchDeleteFiles({ data }));\n\nconst baseOptions = {\n staleTime: HOUR,\n gcTime: HOUR,\n refetchOnWindowFocus: false,\n};\n\nasync function responseToObjectUrl(response: Response): Promise<string> {\n const blob = await response.blob();\n return URL.createObjectURL(blob);\n}\n\nfunction saveBlob(blob: Blob, fileName: string): void {\n const url = URL.createObjectURL(blob);\n const anchor = document.createElement(\"a\");\n anchor.href = url;\n anchor.download = fileName;\n anchor.click();\n URL.revokeObjectURL(url);\n}\n\nexport const fileMetasQueryOptions = (params: z.input<typeof GetFileMetasSchema>) =>\n queryOptions({\n queryKey: [QUERY_KEY, \"meta\", params.appName, params.subId],\n queryFn: () => getFileMetasRpc({ data: params }),\n ...baseOptions,\n });\n\nexport const fileThumbnailQueryOptions = (params: z.input<typeof FileSchema>) =>\n queryOptions({\n queryKey: [QUERY_KEY, \"thumbnail\", params.appName, params.id],\n queryFn: async () => responseToObjectUrl(await getFileThumbnailRpc({ data: params })),\n enabled: !!params.id,\n ...baseOptions,\n });\n\nexport const fileQueryOptions = (params: z.input<typeof FileSchema>) =>\n queryOptions({\n queryKey: [QUERY_KEY, params.appName, params.id],\n queryFn: async () => responseToObjectUrl(await downloadFileRpc({ data: params })),\n enabled: !!params.id,\n ...baseOptions,\n });\n\nexport const downloadFileMutationOptions = () =>\n mutationOptions({\n mutationFn: async (\n data: z.input<typeof FileSchema> & { fileName: string; fileExtension: string },\n ) => {\n const response = await downloadFileRpc({ data });\n saveBlob(await response.blob(), `${data.fileName}.${data.fileExtension}`);\n },\n });\n\nexport const openFileMutationOptions = ({ target }: { target: { current: Window | null } }) =>\n mutationOptions<string, Error, z.input<typeof FileSchema>>({\n mutationFn: async (data) => responseToObjectUrl(await getFileRpc({ data })),\n onSuccess: (source) => {\n const popup = target.current;\n target.current = null;\n\n if (popup) {\n popup.opener = null;\n popup.location.href = source;\n } else {\n window.open(source, \"_blank\");\n }\n },\n onError: () => {\n target.current?.close();\n target.current = null;\n },\n });\n\nexport const updateFileMetaMutationOptions = ({ queryClient }: QueryClientParam) =>\n mutationOptions({\n mutationFn: (data: z.input<typeof UpdateFileMetaSchema>) => updateFileMetaRpc({ data }),\n onSettled: () => queryClient.invalidateQueries({ queryKey: [QUERY_KEY, \"meta\"], exact: false }),\n });\n\nexport const deleteFileMutationOptions = ({ queryClient }: QueryClientParam) =>\n mutationOptions({\n mutationFn: (data: z.input<typeof FileSchema>) => deleteFileRpc({ data }),\n onSettled: () => queryClient.invalidateQueries({ queryKey: [QUERY_KEY, \"meta\"], exact: false }),\n });\n\nexport const batchDeleteFilesMutationOptions = ({ queryClient }: QueryClientParam) =>\n mutationOptions({\n mutationFn: (data: z.input<typeof GetFileMetasSchema>) => batchDeleteFilesRpc({ data }),\n onSettled: () => queryClient.invalidateQueries({ queryKey: [QUERY_KEY, \"meta\"], exact: false }),\n });\n\nexport const uploadFileMutationOptions = ({ queryClient }: QueryClientParam) =>\n mutationOptions({\n mutationFn: async ({\n id = uuidv7(),\n appName,\n subId,\n file,\n setProgress,\n }: z.input<typeof UploadFileMetaSchema> & {\n setProgress?: (progress: number) => void;\n }): Promise<UploadFileResult> => {\n const { token, endpoint } = await getFileUploadToken();\n\n await new Promise<void>((resolve, reject) => {\n const upload = new Upload(file, {\n endpoint,\n chunkSize: 1_048_576,\n metadata: {\n id,\n appName: appName,\n subId: subId,\n filename: file.name,\n filetype: file.type,\n },\n headers: { Authorization: `Bearer ${token}` },\n onProgress: (bytesUploaded, bytesTotal) =>\n setProgress?.((bytesUploaded / bytesTotal) * 100),\n onError: reject,\n onSuccess: () => resolve(),\n });\n upload.start();\n });\n\n return { id, appName, subId, fileName: file.name };\n },\n onSuccess: (result) =>\n queryClient.invalidateQueries({\n queryKey: [QUERY_KEY, \"meta\", result.appName, result.subId],\n exact: false,\n }),\n });\n"],"mappings":";;;;;;;;AAKA,MAAaK,qBAAqBL,eAAe,EAAEM,QAAQ,MAAM,CAAC,CAAC,CAACC,QAAQ,aAAa;CACvFC,OAAQ,MAAMJ,eAAe,IAAK,MAAMF,eAAe,MAAM,IAAI,MAAMC,YAAY,MAAM;CACzFM,UAAU,GAAGR,UAAUS,cAAa;AACtC,EAAE;;ACaF,MAAMqB,YAAY;AAClB,MAAMC,OAAO;AAEb,MAAMC,kBAAkBpB,eAAe,EAAEqB,QAAQ,MAAM,CAAC,CAAC,CACtDC,UAAUf,kBAAkB,CAAC,CAC7BgB,SAAS,EAAEC,WAAWX,aAAa,EAAEW,KAAK,CAAC,CAAC;AAE/C,MAAMC,sBAAsBzB,eAAe,EAAEqB,QAAQ,MAAM,CAAC,CAAC,CAC1DC,UAAUhB,UAAU,CAAC,CACrBiB,SAAS,EAAEC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AC5B5B,UAAU;GAACtC;GAAW;GAAQ2F,OAAOpD;GAASoD,OAAOnD;EAAK;EAC1D2B,OAAO;CACT,CAAC;AACL,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"peoplesoft-D1jPlXr9.mjs","names":["createServerOnlyFn","z","createApi","Department","Employee","SearchEmployeesSchema","object","searchTerm","string","min","EmployeeIdSchema","employeeId","DepartmentIdSchema","departmentId","CompanyCodeSchema","companyCode","peoplesoftApi","baseURL","scopeKey","searchEmployees","data","input","Promise","Array","parse","api","employees","request","url","encodeURIComponent","method","getEmployees","getActiveEmployees","getEmployeeByEmployeeId","employee","getPreviousEmployeeIds","getEmployeeSupervisor","getEmployeeSubordinates","getEmployeeManager","getEmployeeGeneralManager","getDepartments","departments","getDepartmentById","department","getDepartmentManager","getDepartmentEmployees","getCompanyGeneralManager","z"],"sources":["../src/data/server/peoplesoft.ts"],"sourcesContent":["import { createServerOnlyFn } from \"@tanstack/react-start\";\nimport { z } from \"zod\";\nimport { createApi } from \"~/lib/createApi\";\nimport type { Department } from \"~/models/peoplesoft/Department\";\nimport type { Employee } from \"~/models/peoplesoft/Employee\";\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\nconst peoplesoftApi = () => createApi({ baseURL: \"PEOPLESOFT_BASE_URL\", scopeKey: \"peoplesoft\" });\n\nexport const searchEmployees = createServerOnlyFn(\n async ({ data }: { data: z.input<typeof SearchEmployeesSchema> }): Promise<Array<Employee>> => {\n const input = SearchEmployeesSchema.parse(data);\n const api = await peoplesoftApi();\n const { data: employees } = await api.request<Array<Employee>>({\n url: `/v1/employee?search=${encodeURIComponent(input.searchTerm)}`,\n method: \"GET\",\n });\n return employees;\n },\n);\n\nexport const getEmployees = createServerOnlyFn(async (): Promise<Array<Employee>> => {\n const api = await peoplesoftApi();\n const { data: employees } = await api.request<Array<Employee>>({\n url: `/v1/employee/all`,\n method: \"GET\",\n });\n return employees;\n});\n\nexport const getActiveEmployees = createServerOnlyFn(async (): Promise<Array<Employee>> => {\n const api = await peoplesoftApi();\n const { data: employees } = await api.request<Array<Employee>>({\n url: `/v1/employee/active`,\n method: \"GET\",\n });\n return employees;\n});\n\nexport const getEmployeeByEmployeeId = createServerOnlyFn(\n async ({ data }: { data: z.input<typeof EmployeeIdSchema> }): Promise<Employee> => {\n const input = EmployeeIdSchema.parse(data);\n const api = await peoplesoftApi();\n const { data: employee } = await api.request<Employee>({\n url: `/v1/employee/${encodeURIComponent(input.employeeId)}`,\n method: \"GET\",\n });\n return employee;\n },\n);\n\nexport const getPreviousEmployeeIds = createServerOnlyFn(async (): Promise<Array<Employee>> => {\n const api = await peoplesoftApi();\n const { data: employees } = await api.request<Array<Employee>>({\n url: `/v1/employee/previousIds`,\n method: \"GET\",\n });\n return employees;\n});\n\nexport const getEmployeeSupervisor = createServerOnlyFn(\n async ({ data }: { data: z.input<typeof EmployeeIdSchema> }): Promise<Employee> => {\n const input = EmployeeIdSchema.parse(data);\n const api = await peoplesoftApi();\n const { data: employee } = await api.request<Employee>({\n url: `/v1/employee/${encodeURIComponent(input.employeeId)}/supervisor`,\n method: \"GET\",\n });\n return employee;\n },\n);\n\nexport const getEmployeeSubordinates = createServerOnlyFn(\n async ({ data }: { data: z.input<typeof EmployeeIdSchema> }): Promise<Array<Employee>> => {\n const input = EmployeeIdSchema.parse(data);\n const api = await peoplesoftApi();\n const { data: employees } = await api.request<Array<Employee>>({\n url: `/v1/employee/${encodeURIComponent(input.employeeId)}/subordinates`,\n method: \"GET\",\n });\n return employees;\n },\n);\n\nexport const getEmployeeManager = createServerOnlyFn(\n async ({ data }: { data: z.input<typeof EmployeeIdSchema> }): Promise<Employee> => {\n const input = EmployeeIdSchema.parse(data);\n const api = await peoplesoftApi();\n const { data: employee } = await api.request<Employee>({\n url: `/v1/employee/${encodeURIComponent(input.employeeId)}/manager`,\n method: \"GET\",\n });\n return employee;\n },\n);\n\nexport const getEmployeeGeneralManager = createServerOnlyFn(\n async ({ data }: { data: z.input<typeof EmployeeIdSchema> }): Promise<Employee> => {\n const input = EmployeeIdSchema.parse(data);\n const api = await peoplesoftApi();\n const { data: employee } = await api.request<Employee>({\n url: `/v1/employee/${encodeURIComponent(input.employeeId)}/generalManager`,\n method: \"GET\",\n });\n return employee;\n },\n);\n\nexport const getDepartments = createServerOnlyFn(async (): Promise<Array<Department>> => {\n const api = await peoplesoftApi();\n const { data: departments } = await api.request<Array<Department>>({\n url: `/v1/department/all`,\n method: \"GET\",\n });\n return departments;\n});\n\nexport const getDepartmentById = createServerOnlyFn(\n async ({ data }: { data: z.input<typeof DepartmentIdSchema> }): Promise<Department> => {\n const input = DepartmentIdSchema.parse(data);\n const api = await peoplesoftApi();\n const { data: department } = await api.request<Department>({\n url: `/v1/department/${encodeURIComponent(input.departmentId)}`,\n method: \"GET\",\n });\n return department;\n },\n);\n\nexport const getDepartmentManager = createServerOnlyFn(\n async ({ data }: { data: z.input<typeof DepartmentIdSchema> }): Promise<Employee> => {\n const input = DepartmentIdSchema.parse(data);\n const api = await peoplesoftApi();\n const { data: employee } = await api.request<Employee>({\n url: `/v1/department/${encodeURIComponent(input.departmentId)}/manager`,\n method: \"GET\",\n });\n return employee;\n },\n);\n\nexport const getDepartmentEmployees = createServerOnlyFn(\n async ({ data }: { data: z.input<typeof DepartmentIdSchema> }): Promise<Array<Employee>> => {\n const input = DepartmentIdSchema.parse(data);\n const api = await peoplesoftApi();\n const { data: employees } = await api.request<Array<Employee>>({\n url: `/v1/department/${encodeURIComponent(input.departmentId)}/employees`,\n method: \"GET\",\n });\n return employees;\n },\n);\n\nexport const getCompanyGeneralManager = createServerOnlyFn(\n async ({ data }: { data: z.input<typeof CompanyCodeSchema> }): Promise<Employee> => {\n const input = CompanyCodeSchema.parse(data);\n const api = await peoplesoftApi();\n const { data: employee } = await api.request<Employee>({\n url: `/v1/company/${encodeURIComponent(input.companyCode)}/generalManager`,\n method: \"GET\",\n });\n return employee;\n },\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAMA,MAAaK,wBAAwBJ,IAAEK,OAAO,EAC5CC,YAAYN,IAAEO,OAAO,CAAC,CAACC,IAAI,CAAC,EAC9B,CAAC;AAED,MAAaC,mBAAmBT,IAAEK,OAAO,EACvCK,YAAYV,IAAEO,OAAO,CAAC,CAACC,IAAI,CAAC,EAC9B,CAAC;AAED,MAAaG,qBAAqBX,IAAEK,OAAO,EACzCO,cAAcZ,IAAEO,OAAO,CAAC,CAACC,IAAI,CAAC,EAChC,CAAC;AAED,MAAaK,oBAAoBb,IAAEK,OAAO,EACxCS,aAAad,IAAEO,OAAO,CAAC,CAACC,IAAI,CAAC,EAC/B,CAAC;AAED,MAAMO,sBAAsBd,UAAU;CAAEe,SAAS;CAAuBC,UAAU;AAAa,CAAC;AAEhG,MAAaC,kBAAkBnB,mBAC7B,OAAO,EAAEoB,WAAsF;CAC7F,MAAMC,QAAQhB,sBAAsBmB,MAAMJ,IAAI;CAE9C,MAAM,EAAEA,MAAMM,cAAc,OAAMD,MADhBT,cAAc,EAAA,CACMW,QAAyB;EAC7DC,KAAK,uBAAuBC,mBAAmBR,MAAMd,UAAU;EAC/DuB,QAAQ;CACV,CAAC;CACD,OAAOJ;AACT,CACF;AAEA,MAAaK,eAAe/B,mBAAmB,YAAsC;CAEnF,MAAM,EAAEoB,MAAMM,cAAc,OAAMD,MADhBT,cAAc,EAAA,CACMW,QAAyB;EAC7DC,KAAK;EACLE,QAAQ;CACV,CAAC;CACD,OAAOJ;AACT,CAAC;AAED,MAAaM,qBAAqBhC,mBAAmB,YAAsC;CAEzF,MAAM,EAAEoB,MAAMM,cAAc,OAAMD,MADhBT,cAAc,EAAA,CACMW,QAAyB;EAC7DC,KAAK;EACLE,QAAQ;CACV,CAAC;CACD,OA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MR,YAAY,EAAC;EAC7DiB,QAAQ;CACV,CAAC;CACD,OAAOJ;AACT,CACF;AAEA,MAAaoB,2BAA2B9C,mBACtC,OAAO,EAAEoB,WAA2E;CAClF,MAAMC,QAAQP,kBAAkBU,MAAMJ,IAAI;CAE1C,MAAM,EAAEA,MAAMc,aAAa,OAAMT,MADfT,cAAc,EAAA,CACKW,QAAkB;EACrDC,KAAK,eAAeC,mBAAmBR,MAAMN,WAAW,EAAC;EACzDe,QAAQ;CACV,CAAC;CACD,OAAOI;AACT,CACF"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"providers-gKUqnVV5.mjs","names":["jose","scopes","definedScopes","serverEnv","Scope","ProviderId","Provider","id","label","clientId","clientSecret","issuer","authorizeEndpoint","tokenEndpoint","loginScopes","ReadonlyArray","audience","jwks","ReturnType","createRemoteJWKSet","logoutUrl","returnTo","entraAuthority","ENTRA_TENANT_ID","entra","ENTRA_CLIENT_ID","ENTRA_CLIENT_SECRET","URL","encodeURIComponent","awsResourceScopes","Set","Object","values","Record","map","entry","undefined","aws","filter","scope","buildAws","AWS_ISSUER","AWS_DOMAIN","AWS_CLIENT_ID","AWS_CLIENT_SECRET","providers","getProvider","provider","find","candidate","Error","getProviderByIssuer","definedScopes"],"sources":["../src/lib/auth/providers.ts"],"sourcesContent":["import * as jose from \"jose\";\nimport { scopes as definedScopes } from \"virtual:wcz-layout\";\nimport { serverEnv } from \"~/env\";\nimport type { Scope } from \"~/models/Scopes\";\nimport type { ProviderId } from \"~/models/User\";\n\n/**\n * Identity providers, server-side only. Entra is always present; AWS registers\n * itself when its env vars are set, so an Entra-only app is unchanged and the\n * login page renders a single button.\n */\nexport interface Provider {\n id: ProviderId;\n label: string;\n clientId: string;\n clientSecret: string;\n /** The `iss` claim, used to pick the right provider for an incoming Bearer. */\n issuer: string;\n authorizeEndpoint: string;\n tokenEndpoint: string;\n loginScopes: ReadonlyArray<string>;\n /**\n * Expected `aud` for incoming Bearer JWTs. Undefined for Cognito: its access\n * tokens carry `client_id`, not `aud`, so the user pool itself is the trust\n * boundary — any client in the pool is accepted.\n * ponytail: pool-wide trust; add a client_id allowlist if other pools' clients\n * could ever reach this app.\n */\n audience?: string;\n jwks: ReturnType<typeof jose.createRemoteJWKSet>;\n logoutUrl: (returnTo: string) => string;\n}\n\nconst entraAuthority = `https://login.microsoftonline.com/${serverEnv.ENTRA_TENANT_ID}`;\n\nconst entra: Provider = {\n id: \"entra\",\n label: \"Microsoft\",\n clientId: serverEnv.ENTRA_CLIENT_ID,\n clientSecret: serverEnv.ENTRA_CLIENT_SECRET,\n issuer: `${entraAuthority}/v2.0`,\n authorizeEndpoint: `${entraAuthority}/oauth2/v2.0/authorize`,\n tokenEndpoint: `${entraAuthority}/oauth2/v2.0/token`,\n // `offline_access` yields the multi-resource refresh token every delegated API\n // token is minted from; `User.Read` covers the Graph profile photo.\n loginScopes: [\"openid\", \"profile\", \"offline_access\", \"User.Read\"],\n audience: serverEnv.ENTRA_CLIENT_ID,\n jwks: jose.createRemoteJWKSet(new URL(`${entraAuthority}/discovery/v2.0/keys`)),\n logoutUrl: (returnTo) =>\n `${entraAuthority}/oauth2/v2.0/logout?post_logout_redirect_uri=${encodeURIComponent(returnTo)}`,\n};\n\n/**\n * Cognito cannot widen scopes after login, so every AWS scope the app will ever\n * ask for has to be requested up front. Derived from `scopes.ts` rather than\n * configured separately, so the two can't drift.\n */\nconst awsResourceScopes = [\n ...new Set(\n Object.values(definedScopes as Record<string, Scope>)\n .map((entry) => (typeof entry === \"string\" ? undefined : entry.aws))\n .filter((scope) => scope !== undefined),\n ),\n];\n\nconst buildAws = (): Provider | null => {\n const { AWS_ISSUER, AWS_DOMAIN, AWS_CLIENT_ID, AWS_CLIENT_SECRET } = serverEnv;\n if (!AWS_ISSUER || !AWS_DOMAIN || !AWS_CLIENT_ID || !AWS_CLIENT_SECRET) return null;\n\n return {\n id: \"aws\",\n label: \"AWS\",\n clientId: AWS_CLIENT_ID,\n clientSecret: AWS_CLIENT_SECRET,\n issuer: AWS_ISSUER,\n authorizeEndpoint: `${AWS_DOMAIN}/oauth2/authorize`,\n tokenEndpoint: `${AWS_DOMAIN}/oauth2/token`,\n loginScopes: [\"openid\", \"email\", \"phone\"], // TODO: [\"openid\", \"email\", \"phone\", ...awsResourceScopes]\n jwks: jose.createRemoteJWKSet(new URL(`${AWS_ISSUER}/.well-known/jwks.json`)),\n logoutUrl: (returnTo) =>\n `${AWS_DOMAIN}/logout?client_id=${AWS_CLIENT_ID}&logout_uri=${encodeURIComponent(returnTo)}`,\n };\n};\n\nconst aws = buildAws();\n\nexport const providers: ReadonlyArray<Provider> = aws ? [entra, aws] : [entra];\n\nexport const getProvider = (id: ProviderId): Provider => {\n const provider = providers.find((candidate) => candidate.id === id);\n if (!provider) throw new Error(`Identity provider \"${id}\" is not configured.`);\n return provider;\n};\n\nexport const getProviderByIssuer = (issuer: string | undefined): Provider | undefined =>\n providers.find((candidate) => candidate.issuer === issuer);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAiCA,MAAMsB,iBAAiB,qCAAqCnB,UAAUoB;AAEtE,MAAMC,QAAkB;CACtBjB,IAAI;CACJC,OAAO;CACPC,UAAUN,UAAUsB;CACpBf,cAAcP,UAAUuB;CACxBf,QAAQ,GAAGW,eAAc;CACzBV,mBAAmB,GAAGU,eAAc;CACpCT,eAAe,GAAGS,eAAc;CAGhCR,aAAa;EAAC;EAAU;EAAW;EAAkB;CAAW;CAChEE,UAAUb,UAAUsB;CACpBR,MAAMjB,KAAKmB,mBAAmB,IAAIQ,IAAI,GAAGL,eAAc,qBAAsB,CAAC;CAC9EF,YAAYC,aACV,GAAGC,eAAc,+CAAgDM,mBAAmBP,QAAQ;AAChG;AAO0B,CACxB,GAAG,IAAIS,IACLC,OAAOC,OAAO9B,MAAsC,CAAC,CAClDgC,KAAKC,UAAW,OAAOA,UAAU,WAAWC,KAAAA,IAAYD,MAAME,GAAI,CAAC,CACnEC,QAAQC,UAAUA,UAAUH,KAAAA,CAAS,CAC1C,CAAC;AAGH,MAAMI,iBAAkC;CACtC,MAAM,EAAEC,YAAYC,YAAYC,eAAeC,sBAAsBzC;CACrE,IAAI,CAACsC,cAAc,CAACC,cAAc,CAACC,iBAAiB,CAACC,mBAAmB,OAAO;CAE/E,OAAO;EACLrC,IAAI;EACJC,OAAO;EACPC,UAAUkC;EACVjC,cAAckC;EACdjC,QAAQ8B;EACR7B,mBAAmB,GAAG8B,WAAU;EAChC7B,eAAe,GAAG6B,WAAU;EAC5B5B,aAAa;GAAC;GAAU;GAAS;EAAO;EACxCG,MAAMjB,KAAKmB,mBAAmB,IAAIQ,IAAI,GAAGc,WAAU,uBAAwB,CAAC;EAC5ErB,YAAYC,aACV,GAAGqB,WAAU,oBAAqBC,cAAa,cAAef,mBAAmBP,QAAQ;CAC7F;AACF;AAEA,MAAMgB,MAAMG,SAAS;AAErB,MAAaK,YAAqCR,MAAM,CAACb,OAAOa,GAAG,IAAI,CAACb,KAAK;AAE7E,MAAasB,eAAevC,OAA6B;CACvD,MAAMwC,WAAWF,UAAUG,MAAMC,cAAcA,UAAU1C,OAAOA,EAAE;CAClE,IAAI,CAACwC,UAAU,MAAM,IAAIG,MAAM,sBAAsB3C,GAAE,qBAAsB;CAC7E,OAAOwC;AACT;AAEA,MAAaI,uBAAuBxC,WAClCkC,UAAUG,MAAMC,cAAcA,UAAUtC,WAAWA,MAAM"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"tokens-DODxwvZ2.mjs","names":["createHash","randomBytes","randomUUID","Provider","SessionExpiredError","Error","TokenResponse","access_token","refresh_token","id_token","expires_in","base64url","bytes","Buffer","toString","createPkce","verifier","challenge","update","digest","createState","isSessionDead","error","suberror","requestToken","provider","body","Record","Promise","credentials","from","clientId","clientSecret","response","fetch","tokenEndpoint","method","headers","authorization","URLSearchParams","client_id","payload","json","ok","message","error_description","status","id","buildAuthUrl","opts","redirectUri","state","url","URL","authorizeEndpoint","search","response_type","redirect_uri","scope","loginScopes","join","code_challenge","code_challenge_method","exchangeCode","code","codeVerifier","grant_type","code_verifier","refreshTokens","refreshToken","clientCredentials","createServerOnlyFn","scopes","definedScopes","Scope","ProviderId","SessionExpiredError","clientCredentials","refreshTokens","getProvider","getAppSession","ScopeKey","resolveScope","key","provider","entry","scope","undefined","Error","getAccessToken","scopeKey","Promise","session","providerId","refreshToken","result","refresh_token","save","access_token","error","destroy","Response","json","message","status","appTokens","Map","token","expiresAt","getAppToken","cached","get","Date","now","defaultScope","slice","lastIndexOf","set","expires_in","definedScopes"],"sources":["../src/lib/auth/oidc.ts","../src/lib/auth/tokens.ts"],"sourcesContent":["import { createHash, randomBytes, randomUUID } from \"node:crypto\";\nimport type { Provider } from \"./providers\";\n\n/**\n * The whole OAuth2/OIDC surface this app needs, as plain form POSTs. Both Entra\n * and Cognito are ordinary OIDC servers, so a second provider is a config object\n * (see `providers.ts`) rather than a second integration.\n */\n\n/** The refresh token is expired/revoked — the user must sign in interactively. */\nexport class SessionExpiredError extends Error {}\n\nexport interface TokenResponse {\n access_token: string;\n refresh_token?: string;\n id_token?: string;\n expires_in: number;\n}\n\nconst base64url = (bytes: Buffer): string => bytes.toString(\"base64url\");\n\n/** PKCE verifier + S256 challenge for the authorization-code flow. */\nexport const createPkce = (): { verifier: string; challenge: string } => {\n const verifier = base64url(randomBytes(32));\n return { verifier, challenge: base64url(createHash(\"sha256\").update(verifier).digest()) };\n};\n\nexport const createState = (): string => randomUUID();\n\n/**\n * Revocation, inactivity expiry and Conditional Access sign-in frequency all\n * surface as `invalid_grant` or `interaction_required` — the session is dead and\n * only an interactive login helps. Missing consent (Entra AADSTS65001) looks the\n * same but is a configuration bug, so it is left to surface as-is.\n */\nconst isSessionDead = (error: { error?: string; suberror?: string }): boolean =>\n (error.error === \"invalid_grant\" || error.error === \"interaction_required\") &&\n error.suberror !== \"consent_required\";\n\nasync function requestToken(\n provider: Provider,\n body: Record<string, string>,\n): Promise<TokenResponse> {\n const credentials = Buffer.from(`${provider.clientId}:${provider.clientSecret}`).toString(\n \"base64\",\n );\n const response = await fetch(provider.tokenEndpoint, {\n method: \"POST\",\n headers: {\n \"content-type\": \"application/x-www-form-urlencoded\",\n // Both providers accept client_secret_basic; it keeps the secret out of the body.\n authorization: `Basic ${credentials}`,\n },\n body: new URLSearchParams({ client_id: provider.clientId, ...body }),\n });\n\n const payload = (await response.json()) as TokenResponse &\n Record<\"error\" | \"error_description\" | \"suberror\", string | undefined>;\n if (response.ok) return payload;\n\n const message = payload.error_description ?? payload.error ?? `HTTP ${response.status}`;\n if (isSessionDead(payload)) throw new SessionExpiredError(message);\n throw new Error(`[${provider.id}] ${message}`);\n}\n\n/** First leg of the auth-code flow: the URL to redirect the browser to. */\nexport function buildAuthUrl(\n provider: Provider,\n opts: { redirectUri: string; state: string; challenge: string },\n): string {\n const url = new URL(provider.authorizeEndpoint);\n url.search = new URLSearchParams({\n client_id: provider.clientId,\n response_type: \"code\",\n redirect_uri: opts.redirectUri,\n state: opts.state,\n scope: provider.loginScopes.join(\" \"),\n code_challenge: opts.challenge,\n code_challenge_method: \"S256\",\n }).toString();\n return url.toString();\n}\n\n/** Second leg: exchange the code for tokens. The refresh token is in the body. */\nexport const exchangeCode = (\n provider: Provider,\n opts: { code: string; redirectUri: string; codeVerifier: string },\n): Promise<TokenResponse> =>\n requestToken(provider, {\n grant_type: \"authorization_code\",\n code: opts.code,\n redirect_uri: opts.redirectUri,\n code_verifier: opts.codeVerifier,\n });\n\n/**\n * Delegated token for `scope`. Entra mints a token for any resource from its\n * multi-resource refresh token; Cognito can only narrow within the scopes already\n * registered on the app client, and ignores the rest.\n */\nexport const refreshTokens = (\n provider: Provider,\n opts: { refreshToken: string; scope: string },\n): Promise<TokenResponse> =>\n requestToken(provider, {\n grant_type: \"refresh_token\",\n refresh_token: opts.refreshToken,\n scope: opts.scope,\n });\n\n/** App-only token: no user context, for background jobs. */\nexport const clientCredentials = (\n provider: Provider,\n opts: { scope: string },\n): Promise<TokenResponse> =>\n requestToken(provider, { grant_type: \"client_credentials\", scope: opts.scope });\n","import { createServerOnlyFn } from \"@tanstack/react-start\";\nimport { scopes as definedScopes } from \"virtual:wcz-layout\";\nimport type { Scope } from \"~/models/Scopes\";\nimport type { ProviderId } from \"~/models/User\";\nimport { SessionExpiredError, clientCredentials, refreshTokens } from \"./oidc\";\nimport { getProvider } from \"./providers\";\nimport { getAppSession } from \"./session\";\n\nexport type ScopeKey = keyof typeof definedScopes;\n\n/**\n * A scope entry is either a bare string (Entra) or `{ entra, aws }`. Throwing on a\n * missing entry fails at the call site instead of sending a token the API rejects.\n */\nexport const resolveScope = (key: ScopeKey, provider: ProviderId): string => {\n const entry: Scope = definedScopes[key];\n const scope =\n typeof entry === \"string\" ? (provider === \"entra\" ? entry : undefined) : entry[provider];\n\n if (!scope) throw new Error(`No \"${key}\" scope is configured for the \"${provider}\" provider.`);\n return scope;\n};\n\n/**\n * Delegated access token for the signed-in user, minted from the session refresh\n * token. Providers that rotate the refresh token return a new one, which is\n * persisted back. Server-only — stripped from the client bundle.\n */\nexport const getAccessToken = createServerOnlyFn(async (scopeKey: ScopeKey): Promise<string> => {\n const session = await getAppSession();\n const { provider: providerId, refreshToken } = session;\n if (!providerId || !refreshToken) throw new Error(\"No active session. User not signed in.\");\n\n try {\n const result = await refreshTokens(getProvider(providerId), {\n refreshToken,\n scope: resolveScope(scopeKey, providerId),\n });\n if (result.refresh_token && result.refresh_token !== refreshToken) {\n session.refreshToken = result.refresh_token;\n await session.save();\n }\n return result.access_token;\n } catch (error) {\n // Revoked/expired refresh token: clear the dead session and answer 401 so the\n // client can redirect to /login, instead of surfacing a 500.\n if (error instanceof SessionExpiredError) {\n session.destroy();\n throw Response.json(\n { message: \"Unauthorized: Session expired, sign in again\" },\n { status: 401 },\n );\n }\n throw error;\n }\n});\n\n// MSAL used to cache these in memory; without it, a small TTL map keeps parity.\nconst appTokens = new Map<ScopeKey, { token: string; expiresAt: number }>();\n\n/**\n * Client-credentials (app-only) token, for background jobs with no user.\n * Entra-only: the AWS population signs in interactively, so a Cognito app client\n * for M2M has no caller yet (and Cognito bills M2M per token request).\n */\nexport const getAppToken = createServerOnlyFn(async (scopeKey: ScopeKey): Promise<string> => {\n const cached = appTokens.get(scopeKey);\n if (cached && cached.expiresAt > Date.now()) return cached.token;\n\n // Entra client credentials only accept `<resource>/.default`, not user scopes.\n const scope = resolveScope(scopeKey, \"entra\");\n const defaultScope = `${scope.slice(0, scope.lastIndexOf(\"/\"))}/.default`;\n\n const result = await clientCredentials(getProvider(\"entra\"), { scope: defaultScope });\n appTokens.set(scopeKey, {\n token: result.access_token,\n expiresAt: Date.now() + (result.expires_in - 60) * 1000,\n });\n return result.access_token;\n});\n"],"mappings":";;;;;;;;;;;;AAUA,IAAaI,sBAAb,cAAyCC,MAAM,CAAA;AAS/C,MAAMM,aAAaC,UAA0BA,MAAME,SAAS,WAAW;;AAGvE,MAAaC,mBAA4D;CACvE,MAAMC,WAAWL,UAAUV,YAAY,EAAE,CAAC;CAC1C,OAAO;EAAEe;EAAUC,WAAWN,UAAUX,WAAW,QAAQ,CAAC,CAACkB,OAAOF,QAAQ,CAAC,CAACG,OAAO,CAAC;CAAE;AAC1F;AAEA,MAAaC,oBAA4BlB,WAAW;;;;;;;AAQpD,MAAMmB,iBAAiBC,WACpBA,MAAMA,UAAU,mBAAmBA,MAAMA,UAAU,2BACpDA,MAAMC,aAAa;AAErB,eAAeC,aACbC,UACAC,MACwB;CACxB,MAAMG,cAAchB,OAAOiB,KAAK,GAAGL,SAASM,SAAQ,GAAIN,SAASO,cAAc,CAAC,CAAClB,SAC/E,QACF;CACA,MAAMmB,WAAW,MAAMC,MAAMT,SAASU,eAAe;EACnDC,QAAQ;EACRC,SAAS;GACP,gBAAgB;GAEhBC,eAAe,SAAST;EAC1B;EACAH,MAAM,IAAIa,gBAAgB;GAAEC,WAAWf,SAASM;GAAU,GAAGL;EAAK,CAAC;CACrE,CAAC;CAED,MAAMe,UAAW,MAAMR,SAASS,KAAK;CAErC,IAAIT,SAASU,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LINE_USER_KEY","OFFLINE_PHOTO_KEY","GRACE_PERIOD","Cached","value","T","savedAt","recall","key","localStorage","raw","getItem","JSON","parse","Date","now","removeItem","remember","undefined","setItem","stringify","isOfflineFailure","error","navigator","onLine","TypeError","withOfflineFallback","fetchFresh","Promise","fresh","clearSessionSnapshot","String","window","addEventListener","event","location","href","createEnv","z","clientEnv","clientPrefix","client","runtimeEnv","import","meta","env","emptyStringAsUndefined","serverEnv","server","ENTRA_CLIENT_ID","string","ENTRA_TENANT_ID","ENTRA_CLIENT_SECRET","AWS_ISSUER","url","optional","AWS_DOMAIN","AWS_CLIENT_ID","AWS_CLIENT_SECRET","SESSION_SECRET","min","FILE_BASE_URL","APPROVAL_BASE_URL","PEOPLESOFT_BASE_URL","EMAIL_BASE_URL","AI_BASE_URL","AI_SUBSCRIPTION_KEY","process","z","IronSession","serverEnv","ProviderId","User","AppSessionData","provider","refreshToken","user","pkceVerifier","state","returnTo","AppSession","getAppSession","Promise","getIronSession","getCookie","setCookie","all","read","write","cookieName","password","SESSION_SECRET","chunk","cookieOptions","secure","process","env","NODE_ENV","sameSite","httpOnly","path","maxAge","undefined","queryOptions","createServerFn","QueryClientParam","ProviderId","User","OFFLINE_USER_KEY","withOfflineFallback","getAppSession","getSessionUser","method","handler","Promise","session","user","getLoginProviders","Array","id","label","providers","map","loginProvidersQueryOptions","queryKey","queryFn","staleTime","userQueryOptions","Infinity","networkMode","refetchOnReconnect","getUser","queryClient","import","meta","env","SSR","ensureQueryData","AnyFieldApi","redirect","ParsedLocation","manifest","permissions","QueryClientParam","TokenPayload","ProviderId","User","getUser","WISTRON_PRIMARY_COLOR","WISTRON_SECONDARY_COLOR","Platform","isAndroid","test","userAgent","isIOS","isWindows","isMacOS","navigator","RootRouteHeadOptions","rootRouteHead","options","meta","charSet","name","content","title","links","rel","sizes","href","type","GuardArgs","location","context","requireAuth","permissionKey","user","queryClient","encodeURIComponent","reloadDocument","hasPermission","Error","NON_PRODUCTION","isTestEnv","origin","split","slice","join","FormOmittedProps","getFieldStatus","field","state","isTouched","hasError","errors","length","helperText","message","sanitizeReturnTo","value","toKebabCase","str","replaceAll","toLowerCase","foldForSearch","String","normalize","permissionGroups","Set","Object","values","flat","buildUser","payload","provider","email","preferred_username","department","toUpperCase","employeeId","companyName","groups","filter","group","has","key","some","includes"],"sources":["../src/lib/auth/offline.ts","../src/env.ts","../src/lib/auth/session.ts","../src/lib/auth/user.ts","../src/lib/utils.ts"],"sourcesContent":["/**\n * Offline fallback for identity. The refresh token never leaves the sealed\n * httpOnly cookie — what is cached here is only the display snapshot (user\n * claims and avatar) so the UI and offline route permissions can still work\n * while the server is unreachable. Server requests remain independently\n * authorized. At-rest protection is the device's OS login and disk encryption.\n */\n\nexport const OFFLINE_USER_KEY = \"auth-user\";\nexport const OFFLINE_PHOTO_KEY = \"auth-photo\";\n\n/** One shift — matches Intune's default offline grace period. */\nconst GRACE_PERIOD = 12 * 60 * 60 * 1000;\n\ntype Cached<T> = { value: T; savedAt: number };\n\nconst recall = <T>(key: string): T | null => {\n if (typeof localStorage === \"undefined\") return null;\n try {\n const raw = localStorage.getItem(key);\n if (!raw) return null;\n const { value, savedAt } = JSON.parse(raw) as Cached<T>;\n if (Date.now() - savedAt > GRACE_PERIOD) {\n localStorage.removeItem(key);\n return null;\n }\n return value;\n } catch {\n localStorage.removeItem(key);\n return null;\n }\n};\n\nconst remember = (key: string, value: unknown): void => {\n if (typeof localStorage === \"undefined\") return;\n try {\n if (value === null || value === undefined) localStorage.removeItem(key);\n else localStorage.setItem(key, JSON.stringify({ value, savedAt: Date.now() }));\n } catch {\n // Storage full or blocked — the offline fallback is best-effort.\n }\n};\n\nconst isOfflineFailure = (error: unknown): boolean =>\n (typeof navigator !== \"undefined\" && !navigator.onLine) || error instanceof TypeError;\n\n/**\n * Answers from the server when reachable, remembering the result; when the call\n * has a transport failure, replays the last result instead, for up to\n * {@link GRACE_PERIOD} since it was last confirmed.\n *\n * Cached values are untrusted client state. Server authorization must never\n * depend on them.\n */\nexport const withOfflineFallback = async <T>(\n key: string,\n fetchFresh: () => Promise<T>,\n): Promise<T | null> => {\n try {\n const fresh = await fetchFresh();\n remember(key, fresh);\n return fresh;\n } catch (error) {\n if (!isOfflineFailure(error)) throw error;\n return recall<T>(key);\n }\n};\n\n/** Drops the cached identity. Call on logout, before leaving the page. */\nexport const clearSessionSnapshot = (): void => {\n if (typeof localStorage === \"undefined\") return;\n localStorage.removeItem(OFFLINE_USER_KEY);\n localStorage.removeItem(OFFLINE_PHOTO_KEY);\n localStorage.setItem(\"auth-logout\", String(Date.now()));\n};\n\nif (typeof window !== \"undefined\")\n window.addEventListener(\"storage\", (event) => {\n if (event.key === \"auth-logout\") location.href = \"/auth/logout\";\n });\n","import { createEnv } from \"@t3-oss/env-core\";\nimport { z } from \"zod\";\n\nexport const clientEnv = createEnv({\n clientPrefix: \"VITE_\",\n client: {},\n runtimeEnv: import.meta.env,\n emptyStringAsUndefined: true,\n});\n\nexport const serverEnv = createEnv({\n server: {\n ENTRA_CLIENT_ID: z.string(),\n ENTRA_TENANT_ID: z.string(),\n ENTRA_CLIENT_SECRET: z.string(),\n AWS_ISSUER: z.url().optional(),\n AWS_DOMAIN: z.url().optional(),\n AWS_CLIENT_ID: z.string().optional(),\n AWS_CLIENT_SECRET: z.string().optional(),\n SESSION_SECRET: z.string().min(32),\n FILE_BASE_URL: z.string().optional(),\n APPROVAL_BASE_URL: z.string().optional(),\n PEOPLESOFT_BASE_URL: z.string().optional(),\n EMAIL_BASE_URL: z.string().optional(),\n AI_BASE_URL: z.string().optional(),\n AI_SUBSCRIPTION_KEY: z.string().optional(),\n },\n runtimeEnv: process.env,\n emptyStringAsUndefined: true,\n});\n","import type { IronSession } from \"iron-session\";\nimport { serverEnv } from \"~/env\";\nimport type { ProviderId, User } from \"~/models/User\";\n\nexport interface AppSessionData {\n /** Which identity provider signed this user in. */\n provider?: ProviderId;\n /** The only token persisted; delegated access tokens are minted from it. */\n refreshToken?: string;\n user?: User;\n /** Transient, only between /auth/login and /auth/callback. */\n pkceVerifier?: string;\n state?: string;\n returnTo?: string;\n}\n\nexport type AppSession = IronSession<AppSessionData>;\n\nexport const getAppSession = async (): Promise<AppSession> => {\n // Dynamic import: `@tanstack/react-start/server` is the server entry and drags\n // in the SSR renderer (`react-dom/server`). Keep it out of the client graph —\n // this helper is only ever called server-side, and all callers already await it.\n const [{ getIronSession }, { getCookie, setCookie }] = await Promise.all([\n import(\"iron-session\"),\n import(\"@tanstack/react-start/server\"),\n ]);\n\n return getIronSession<AppSessionData>(\n { read: getCookie, write: setCookie },\n {\n // Not `session`: that name holds the pre-stable `useSession` seal, which\n // iron-session can't read. Users sign in once more after the upgrade.\n cookieName: \"app-session\",\n password: serverEnv.SESSION_SECRET,\n chunk: true,\n cookieOptions: {\n secure: process.env.NODE_ENV === \"production\",\n sameSite: \"lax\",\n httpOnly: true,\n path: \"/\",\n // Explicit `undefined`: browser-session cookie and a seal that never\n // expires — what `useSession` did. Omit it to fall back to iron's 14-day `ttl`.\n maxAge: undefined,\n },\n },\n );\n};\n","import { queryOptions } from \"@tanstack/react-query\";\nimport { createServerFn } from \"@tanstack/react-start\";\nimport type { QueryClientParam } from \"~/models/QueryClientParam\";\nimport type { ProviderId, User } from \"~/models/User\";\nimport { OFFLINE_USER_KEY, withOfflineFallback } from \"./offline\";\nimport { getAppSession } from \"./session\";\n\n/**\n * Reads the signed-in user from the session cookie, or null. As a server function\n * it runs in-process when called on the server (SSR, middleware) and as an RPC\n * when called from the client — so it doubles as the client `queryFn`.\n */\nexport const getSessionUser = createServerFn({ method: \"GET\" }).handler(\n async (): Promise<User | null> => {\n const session = await getAppSession();\n return session.user ?? null;\n },\n);\n\n/** The identity providers the server offers, for the login page. */\nexport const getLoginProviders = createServerFn({ method: \"GET\" }).handler(\n async (): Promise<Array<{ id: ProviderId; label: string }>> => {\n // Dynamic import: `providers` reads `serverEnv` and must not reach the client.\n const { providers } = await import(\"./providers\");\n return providers.map(({ id, label }) => ({ id, label }));\n },\n);\n\n/**\n * Feeds `LoginForm`. Server config, not per-user, so it is safe to prime on the\n * server — the `/login` route's loader does that to avoid a flash of empty card.\n */\nexport const loginProvidersQueryOptions = queryOptions({\n queryKey: [\"auth\", \"providers\"],\n queryFn: () => getLoginProviders(),\n staleTime: \"static\",\n});\n\n/**\n * Client-side query for the signed-in user. Shared between `getUser` (route\n * `beforeLoad`) and the always-mounted observer in `LayoutProvider` — the\n * observer is what seeds the offline snapshot on the very first page load\n * (`beforeLoad` does not re-run after SSR hydration) and what makes\n * `refetchOnReconnect` fire once connectivity returns.\n */\nexport const userQueryOptions = queryOptions({\n queryKey: [\"auth\", \"user\"],\n queryFn: () => withOfflineFallback(OFFLINE_USER_KEY, () => getSessionUser()),\n staleTime: Infinity,\n // Default \"online\" pauses the query (never calling queryFn) once the browser\n // reports no connection — which is exactly when the fallback is needed.\n networkMode: \"offlineFirst\",\n // Back online: re-confirm the session and re-stamp the snapshot's grace period.\n refetchOnReconnect: \"always\",\n});\n\nexport const getUser = ({ queryClient }: QueryClientParam): Promise<User | null> => {\n if (import.meta.env.SSR) return getSessionUser();\n\n return queryClient.ensureQueryData(userQueryOptions);\n};\n","import type { AnyFieldApi } from \"@tanstack/react-form\";\nimport { redirect } from \"@tanstack/react-router\";\nimport type { ParsedLocation } from \"@tanstack/react-router\";\nimport { manifest, permissions } from \"virtual:wcz-layout\";\nimport type { QueryClientParam } from \"~/models/QueryClientParam\";\nimport type { TokenPayload } from \"~/models/TokenPayload\";\nimport type { ProviderId, User } from \"~/models/User\";\nimport { getUser } from \"./auth/user\";\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: manifest.name },\n { name: \"og:type\", content: \"website\" },\n { name: \"og:title\", content: manifest.name },\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\ntype GuardArgs = { location: ParsedLocation; context: QueryClientParam };\n\n/**\n * Route guard for `beforeLoad`. Routes are public by default; add this to close one.\n *\n * - `requireAuth()` — signed in with any provider. The only gate a population\n * without permission groups (e.g. AWS users) can pass.\n * - `requireAuth(\"admin\")` — signed in *and* in a group listed under that key.\n *\n * `reloadDocument` is required: `/auth/login` is a component-less server route and\n * must be reached with a full-document navigation. It starts the login directly when\n * only one provider is registered, otherwise it forwards to the `/login` chooser.\n */\nexport const requireAuth = (permissionKey?: keyof typeof permissions) => {\n return async ({ location, context }: GuardArgs) => {\n const user = await getUser({ queryClient: context.queryClient });\n\n if (!user)\n throw redirect({\n href: `/auth/login?returnTo=${encodeURIComponent(location.href)}`,\n reloadDocument: true,\n });\n\n if (permissionKey && !hasPermission(user, permissionKey))\n throw new Error(\"You do not have permission to access this page.\");\n\n return { user };\n };\n};\n\n/* Internal Utils */\nconst NON_PRODUCTION = /(?:^|[.-])(?:dev|qas|uat|test)(?:[.-]|$)/i;\n\n/** True only for a dev/qas/uat/test domain — localhost and production are not. */\nexport const isTestEnv = (origin: string | undefined) =>\n NON_PRODUCTION.test((origin ?? \"\").split(\".\").slice(1).join(\".\"));\n\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\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 */\nexport const sanitizeReturnTo = (value: string | null | undefined): string =>\n value && /^\\/(?![/\\\\])/.test(value) ? value : \"/\";\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 foldForSearch = (value: unknown): string =>\n String(value ?? \"\")\n .toLowerCase()\n .normalize(\"NFD\")\n .replaceAll(/[\\u{300}-\\u{36F}]/gu, \"\")\n .normalize(\"NFC\");\n\nconst permissionGroups = new Set<string>(Object.values(permissions).flat());\n\n/**\n * Maps id/access-token claims to the serializable `User`. Groups are trimmed to\n * those named in `permissions.ts` — an unfiltered group list would blow the\n * cookie. Cognito's claim names differ, so both are read.\n */\nexport const buildUser = (payload: TokenPayload, provider: ProviderId): User => ({\n provider,\n name: (payload.name ?? payload[\"cognito:username\"] ?? \"\").split(\"/\")[0],\n email: (payload.preferred_username ?? payload.email ?? \"\").toLowerCase(),\n department: payload.department?.toUpperCase() || \"\",\n employeeId: (payload.employeeId ?? payload[\"cognito:username\"] ?? \"\").toUpperCase(),\n companyName: payload.companyName || \"\",\n groups:\n (payload.groups ?? payload[\"cognito:groups\"])?.filter((group) => permissionGroups.has(group)) ??\n [],\n});\n\nexport const hasPermission = (user: User | null, key: keyof typeof permissions): boolean =>\n user ? permissions[key].some((group) => user.groups.includes(group)) : false;\n"],"mappings":";;;;;;;;;;;;;;AAQA,MAAaA,mBAAmB;AAChC,MAAaC,oBAAoB;;AAGjC,MAAMC,eAAe;AAIrB,MAAMK,UAAaC,QAA0B;CAC3C,IAAI,OAAOC,iBAAiB,aAAa,OAAO;CAChD,IAAI;EACF,MAAMC,MAAMD,aAAaE,QAAQH,GAAG;EACpC,IAAI,CAACE,KAAK,OAAO;EACjB,MAAM,EAAEN,OAAOE,YAAYM,KAAKC,MAAMH,GAAG;EACzC,IAAII,KAAKC,IAAI,IAAIT,UAAUJ,cAAc;GACvCO,aAAaO,WAAWR,GAAG;GAC3B,OAAO;EACT;EACA,OAAOJ;CACT,QAAQ;EACNK,aAAaO,WAAWR,GAAG;EAC3B,OAAO;CACT;AACF;AAEA,MAAMS,YAAYT,KAAaJ,UAAyB;CACtD,IAAI,OAAOK,iBAAiB,aAAa;CACzC,IAAI;EACF,IAAIL,UAAU,QAAQA,UAAUc,KAAAA,GAAWT,aAAaO,WAAWR,GAAG;OACjEC,aAAaU,QAAQX,KAAKI,KAAKQ,UAAU;GAAEhB;GAAOE,SAASQ,KAAKC,IAAI;EAAE,CAAC,CAAC;CAC/E,QAAQ,CACN;AAEJ;AAEA,MAAMM,oBAAoBC,UACvB,OAAOC,cAAc,eAAe,CAACA,UAAUC,UAAWF,iBAAiBG;;;;;;;;;AAU9E,MAAaC,sBAAsB,OACjClB,KACAmB,eACsB;CACtB,IAAI;EACF,MAAME,QAAQ,MAAMF,WAAW;EAC/BV,SAAST,KAAKqB,KAAK;EACnB,OAAOA;CACT,SAASP,OAAO;EACd,IAAI,CAACD,iBAAiBC,KAAK,GAAG,MAAMA;EACpC,OAAOf,OAAUC,GAAG;CACtB;AAC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,UAAU/C,KAAK6C,OAAOM,SAASJ,KAAK,CAAC,IAAI"}
@@ -1,117 +0,0 @@
1
- # wcz-layout exports
2
-
3
- Public import subpaths and commonly used exports. Read this when you need to know where a
4
- symbol lives; you do not need it loaded for ordinary feature work.
5
-
6
- ## `wcz-layout`
7
-
8
- The root subpath. Everything the application shell needs.
9
-
10
- - `LayoutProvider` — root shell provider. Props: `theme` (required), `navigation?`,
11
- `options?` (`appBarActions`, `showShell`; see the `routing` skill). Installs the Emotion
12
- cache, MUI `ThemeProvider`, `LocalizationProvider`
13
- (dayjs), i18next and the dialogs provider. Wrap `{children}` with it inside `<body>` in
14
- `__root.tsx`. Do not install any of those yourself. Render `<html lang={i18n.language}>`
15
- in the shell: the browser starts i18next in that language before hydrating, so the
16
- server-rendered page is kept rather than rebuilt in another language.
17
- - `Navigation` — the type for the sidebar tree. Items are
18
- `{ kind: "item" | "header" | "group" | "divider" }`; an item takes `to` or `href`,
19
- `title`, `icon` and optional `search`; groups take `title`, `icon` and `children`; headers
20
- take `title`; every kind accepts `hidden`.
21
- - `rootRouteHead` — returns the root route's `head()` value (title, meta, links).
22
- - `getUser({ queryClient })` — resolves the signed-in user. Call it in the root
23
- `beforeLoad` and return `{ user }`; that is what makes `Route.useRouteContext().user`
24
- available on every route.
25
- - `setLanguageFromRequest()` — on the server, switches i18next to the request's language (the
26
- `i18next` cookie, then `Accept-Language`) so pages server-render in it; a no-op in the
27
- browser. `await` it first in the root `beforeLoad`, before `getUser`.
28
- - `loginProvidersQueryOptions` — query options for the configured OAuth providers. The
29
- `/login` route loads it so the buttons server-render.
30
- - `WISTRON_PRIMARY_COLOR`, `WISTRON_SECONDARY_COLOR` — brand colors for the app's theme.
31
-
32
- ## `wcz-layout/vite`
33
-
34
- - `viteWczLayout()` — **required** Vite plugin. Keep the template's plugin order after
35
- `tanstackStart()`, `nitro()`, `viteReact()` and the React Compiler babel plugin. It
36
- builds the `virtual:wcz-layout` module from the app's `src/lib/locales/*.json`,
37
- `src/lib/auth/permissions.ts`, `src/lib/auth/scopes.ts`, `src/env.ts` and
38
- `public/manifest.json`, and loads Vault secrets into `process.env` during `serve`.
39
- Without it the build fails to resolve
40
- `virtual:wcz-layout`. The app must also declare that module in
41
- `src/types/wcz-layout.d.ts`.
42
-
43
- ## `wcz-layout/components`
44
-
45
- - `LayoutTable` — table renderer; see the `table` skill. Types: `LayoutTableProps`,
46
- `RowAction`, `LayoutColumnMeta`, `FilterOperator`, `TableFilterOption`,
47
- `TableFilterVariant`
48
- - `AggregatedCell` — aggregated value cell for grouped rows
49
- - `Fullscreen` — Box that fills the rest of the viewport and scrolls inside (tables, maps, charts)
50
- - `Dropzone`, `FileViewer` — file upload and preview; see the `services` skill
51
- - `LoginForm` — provider buttons for the login route; takes no props and reads
52
- `?returnTo` itself
53
- - `RouterButton`, `RouterFab`, `RouterIconButton`, `RouterLink`, `RouterListItemButton`,
54
- `RouterTab` — MUI components taking router `to` / `params` / `search`
55
- - `RouterNotFound`, `RouterError` — default 404 and error components. Pass them to
56
- `createRouter` as `defaultNotFoundComponent` and `defaultErrorComponent`.
57
-
58
- ## `wcz-layout/hooks`
59
-
60
- - `useLayoutForm`, `withLayoutForm`, `useFormContext`, `useFieldContext` — form instance,
61
- reusable sub-forms, and the contexts custom field components read; see the `forms` skill
62
- - `useLayoutTable`, `createLayoutColumnHelper`, `layoutTableFeatures`, `useTableContext`,
63
- `useHeaderContext`, `useCellContext` — table instance, column helper and contexts, plus
64
- type `LayoutTableFeatures`; see the `table` skill
65
- - `createLayoutChatHook` — binds a chat server function to the MUI chat (generated UI,
66
- approvals, persistence) and returns `useLayoutChat` and `LayoutChat`; see the `ai` skill
67
- - `useDialogs` — alert, confirm, custom dialogs and `close`, plus type `DialogProps`; see
68
- the `dialogs` skill
69
- - `useTranslation` — translation inside components
70
- - `useInView` — element visibility observer (react-intersection-observer); defers queries until visible, drives infinite scroll
71
- - `useScanDetection` — barcode laser scanner keystrokes; see the `scanning` skill
72
-
73
- ## `wcz-layout/middleware`
74
-
75
- - `authMiddleware` — rejects unauthenticated calls, optionally checks a permission key.
76
- Goes in a server function's `.middleware([])`, **after** `databaseMiddleware` so it
77
- narrows `context.user` to `User`. See the `server-functions` skill for the full order.
78
- - `userMiddleware` — attaches the user without requiring one, as `User | null`
79
- - `validationMiddleware` — validates API route input against a Zod schema. REST routes
80
- only; server functions use `.validator()`.
81
- - `csrfMiddleware` — CSRF protection for server functions. Without a `src/start.ts`, Start
82
- applies the same check by default, so the template has none. If the app adds
83
- `src/start.ts` for its own request middleware, list `csrfMiddleware` there too —
84
- `createStart(() => ({ requestMiddleware: [csrfMiddleware, ...] }))` — because a start
85
- instance replaces that default. It is a **request** middleware, never part of a
86
- `.middleware([])` array.
87
-
88
- `databaseMiddleware` is **not** here. It is app-local; every app writes its own. See the
89
- `server-functions` skill.
90
-
91
- ## `wcz-layout/utils`
92
-
93
- - `t`, `i18next` — translation outside components
94
- - `uuidv7` — time-sortable id. Use it for every client-generated primary key.
95
- - `requireAuth` — `beforeLoad` route guard, redirects to `/login`; see the `routing` skill
96
- - `hasPermission` — permission check for a user
97
- - `Platform` — OS detection from the user agent
98
- - `createEnv` — typed environment schema
99
-
100
- ## `wcz-layout/auth`
101
-
102
- - `handleLogin`, `handleCallback`, `handleLogout` — OAuth route handlers. Mount each as a
103
- server `GET` handler at `/auth/login`, `/auth/callback` and `/auth/logout`.
104
- - `getAccessToken` — delegated token for the signed-in user, server-only
105
- - `getAppToken` — app-only token for background jobs, server-only
106
-
107
- ## `wcz-layout/models`
108
-
109
- - Service types: `User`, `Permissions`, `Scopes`, `FileMeta`, `Email`, `EmailAttachment`,
110
- `Employee`, `Department`, `EmployeeStatus`, `EmployeeCategoryGroup`, `Approval*`
111
- - Matching Zod schemas: `FileMetaSchema`, `EmailSchema`, `EmailAttachmentSchema`,
112
- `EmployeeSchema`, `DepartmentSchema` and the approval `*Schema`
113
-
114
- ## `wcz-layout/data/client`, `wcz-layout/data/server`
115
-
116
- - Client query and mutation option factories for file, approval and PeopleSoft services.
117
- Server exports contain those operations plus `sendEmail`; see the `services` skill.