wcz-layout 10.0.0 → 10.1.2

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 (74) hide show
  1. package/dist/{AggregatedCell-BtKC5-m6.mjs → AggregatedCell-C7nAQyMO.mjs} +15 -2
  2. package/dist/AggregatedCell-C7nAQyMO.mjs.map +1 -0
  3. package/dist/{Approval-C-hF4jbT.mjs → Approval-DoD-GRRH.mjs} +18 -14
  4. package/dist/Approval-DoD-GRRH.mjs.map +1 -0
  5. package/dist/{Employee-DbdStvU0.d.mts → Employee-N9fRSnIl.d.mts} +30 -14
  6. package/dist/FileMeta-DDqUju1Y.mjs.map +1 -1
  7. package/dist/{LayoutTable-4DLs-NI-.d.mts → LayoutTable-DX9IaO8V.d.mts} +205 -197
  8. package/dist/RouterListItemButton-ULMlaQh6.mjs.map +1 -1
  9. package/dist/{approval-DFExxyAJ.mjs → approval-DiNOXd4B.mjs} +4 -4
  10. package/dist/approval-DiNOXd4B.mjs.map +1 -0
  11. package/dist/auth.mjs +4 -4
  12. package/dist/components.d.mts +1 -1
  13. package/dist/components.mjs +47 -21
  14. package/dist/components.mjs.map +1 -1
  15. package/dist/{createApi-CLYWCzR2.mjs → createApi-DGJJ4I_R.mjs} +3 -3
  16. package/dist/{createApi-CLYWCzR2.mjs.map → createApi-DGJJ4I_R.mjs.map} +1 -1
  17. package/dist/data/client.d.mts +183 -64
  18. package/dist/data/client.mjs +5 -5
  19. package/dist/data/client.mjs.map +1 -1
  20. package/dist/data/server.d.mts +1 -1
  21. package/dist/data/server.mjs +4 -4
  22. package/dist/{file-aSQto2rw.mjs → file-C14fhUeg.mjs} +4 -4
  23. package/dist/{file-aSQto2rw.mjs.map → file-C14fhUeg.mjs.map} +1 -1
  24. package/dist/{file-CZwQfvTU.mjs → file-C5BOj1q8.mjs} +4 -4
  25. package/dist/file-C5BOj1q8.mjs.map +1 -0
  26. package/dist/hooks.d.mts +1 -1
  27. package/dist/hooks.mjs +461 -452
  28. package/dist/hooks.mjs.map +1 -1
  29. package/dist/index.mjs +4 -4
  30. package/dist/index.mjs.map +1 -1
  31. package/dist/middleware.mjs +2 -2
  32. package/dist/middleware.mjs.map +1 -1
  33. package/dist/models.d.mts +22 -2
  34. package/dist/models.mjs +1 -1
  35. package/dist/{peoplesoft-BY_75WTS.d.mts → peoplesoft-BIdTNshE.d.mts} +2 -3
  36. package/dist/{peoplesoft-CQnc01Hc.mjs → peoplesoft-BkJMCcHb.mjs} +3 -3
  37. package/dist/peoplesoft-BkJMCcHb.mjs.map +1 -0
  38. package/dist/{providers-Dbl95AxR.mjs → providers-DrairEO2.mjs} +2 -2
  39. package/dist/providers-DrairEO2.mjs.map +1 -0
  40. package/dist/{tokens-D8CVIFTb.mjs → tokens-BLRreL1j.mjs} +3 -3
  41. package/dist/tokens-BLRreL1j.mjs.map +1 -0
  42. package/dist/{utils-KaM5VMTJ.mjs → utils-BUpDoqme.mjs} +13 -13
  43. package/dist/utils-BUpDoqme.mjs.map +1 -0
  44. package/dist/utils.mjs +1 -1
  45. package/package.json +16 -14
  46. package/skills/ai/SKILL.md +59 -0
  47. package/skills/client-db/SKILL.md +47 -43
  48. package/skills/db-schema/SKILL.md +6 -0
  49. package/skills/dialogs/SKILL.md +8 -6
  50. package/skills/forms/SKILL.md +19 -1
  51. package/skills/general/SKILL.md +21 -19
  52. package/skills/general/references/exports.md +6 -3
  53. package/skills/migrations/versions/migrate-v10-to-v11.md +1 -0
  54. package/skills/migrations/versions/migrate-v9-to-v10.md +26 -25
  55. package/skills/routing/SKILL.md +7 -4
  56. package/skills/server-functions/SKILL.md +8 -5
  57. package/skills/services/SKILL.md +1 -1
  58. package/skills/services/docs/approval.md +258 -257
  59. package/skills/services/docs/peoplesoft.md +4 -0
  60. package/skills/start/SKILL.md +3 -2
  61. package/skills/start/steps/02-project-name-setup.md +1 -1
  62. package/skills/start/steps/07-vault-setup.md +5 -4
  63. package/skills/table/SKILL.md +20 -31
  64. package/dist/AggregatedCell-BtKC5-m6.mjs.map +0 -1
  65. package/dist/Approval-C-hF4jbT.mjs.map +0 -1
  66. package/dist/approval-DFExxyAJ.mjs.map +0 -1
  67. package/dist/file-CZwQfvTU.mjs.map +0 -1
  68. package/dist/peoplesoft-CQnc01Hc.mjs.map +0 -1
  69. package/dist/providers-Dbl95AxR.mjs.map +0 -1
  70. package/dist/tokens-D8CVIFTb.mjs.map +0 -1
  71. package/dist/utils-KaM5VMTJ.mjs.map +0 -1
  72. package/skills/unslop/SKILL.md +0 -80
  73. /package/skills/start/steps/{10-gitlab-ci.md → 09-gitlab-ci.md} +0 -0
  74. /package/skills/start/steps/{09-commit.md → 10-commit.md} +0 -0
@@ -1 +0,0 @@
1
- {"version":3,"file":"AggregatedCell-BtKC5-m6.mjs","names":["Button","Dialog","DialogActions","DialogContent","DialogTitle","useEventCallback","useContext","useTranslation","DialogsContext","ReactNode","OpenDialogOptions","onClose","result","TResult","Promise","AlertOptions","title","ConfirmOptions","cancelText","DialogProps","payload","TPayload","open","OpenAlertDialog","message","options","OpenConfirmDialog","DialogComponent","React","ComponentType","OpenDialog","Component","CloseDialog","dialog","AlertDialogPayload","AlertDialogProps","AlertDialog","t0","$","_c","$i","Symbol","for","t","t1","t2","t3","t4","t5","t6","t7","t8","ConfirmDialogPayload","ConfirmDialogProps","ConfirmDialog","t9","t10","t11","t12","DialogHook","alert","confirm","close","useDialogs","undefined","message_0","options_0","Theme","formatForDisplay","Cell","CellData","Column","RowData","LayoutTableFeatures","LayoutColumnMeta","shortcutLabel","label","hotkey","AnyColumn","TData","TValue","columnLabel","column","meta","columnDef","header","id","hasColumnLabel","Boolean","columnAlign","align","moveColumn","delta","table","current","atoms","columnOrder","get","order","length","getAllLeafColumns","map","from","indexOf","to","splice","setColumnOrder","pinnedSx","isHeader","pinned","getIsPinned","position","zIndex","insetInlineStart","getStart","undefined","insetInlineEnd","getAfter","bgcolor","backgroundImage","theme","palette","action","hover","selected","getIsLastColumn","borderInlineEnd","borderInlineEndStyle","borderColor","getIsFirstColumn","borderInlineStart","borderInlineStartStyle","cellSelectionSx","cell","getIsSelected","edges","getSelectionEdges","outline","top","primary","main","bottom","left","right","filter","join","boxShadow","quoteTsv","text","test","replaceAll","toClipboardValue","value","String","Date","toISOString","JSON","stringify","toClipboardText","regions","Array","rows","cells","dayjs","formatValue","value","dateFormat","undefined","Date","format","toString","JSON","stringify","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","LayoutColumnMeta","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","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"],"sources":["../src/hooks/useDialogs.tsx","../src/components/table/utils.ts","../src/components/table/formatValue.ts","../src/components/table/context.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 } from \"react\";\nimport { useTranslation } from \"react-i18next\";\nimport { DialogsContext } from \"../contexts/DialogsContext\";\nimport type { ReactNode } from \"react\";\n\nexport interface OpenDialogOptions<TResult> {\n onClose?: (result: TResult) => Promise<void>;\n}\n\nexport interface AlertOptions {\n title?: ReactNode;\n}\n\nexport interface ConfirmOptions {\n title?: ReactNode;\n cancelText?: ReactNode;\n}\n\nexport interface DialogProps<TPayload = undefined, TResult = void> {\n payload: TPayload;\n open: boolean;\n onClose: (result: TResult) => Promise<void>;\n}\n\nexport type OpenAlertDialog = (message: ReactNode, options?: AlertOptions) => Promise<void>;\n\nexport type OpenConfirmDialog = (message: ReactNode, options?: ConfirmOptions) => Promise<boolean>;\n\nexport type DialogComponent<TPayload, TResult> = React.ComponentType<\n DialogProps<TPayload, TResult>\n>;\n\nexport interface OpenDialog {\n <TPayload extends undefined, TResult>(\n Component: DialogComponent<TPayload, TResult>,\n payload?: TPayload,\n options?: OpenDialogOptions<TResult>,\n ): Promise<TResult>;\n <TPayload, TResult>(\n Component: DialogComponent<TPayload, TResult>,\n payload: TPayload,\n options?: OpenDialogOptions<TResult>,\n ): Promise<TResult>;\n}\n\nexport type CloseDialog = <TResult>(dialog: Promise<TResult>, result: TResult) => Promise<TResult>;\n\nexport interface AlertDialogPayload extends AlertOptions {\n message: ReactNode;\n}\n\nexport type AlertDialogProps = DialogProps<AlertDialogPayload, void>;\n\nexport function AlertDialog({ open, payload, onClose }: Readonly<AlertDialogProps>) {\n const { t } = useTranslation();\n\n return (\n <Dialog maxWidth=\"xs\" fullWidth open={open} onClose={() => onClose()} disableRestoreFocus>\n <DialogTitle>{payload.title ?? t(\"Layout.Dialog.Alert\")}</DialogTitle>\n <DialogContent>{payload.message}</DialogContent>\n <DialogActions>\n <Button onClick={() => onClose()} autoFocus>\n {t(\"Layout.Dialog.Confirm\")}\n </Button>\n </DialogActions>\n </Dialog>\n );\n}\n\nexport interface ConfirmDialogPayload extends ConfirmOptions {\n message: ReactNode;\n}\n\nexport type ConfirmDialogProps = DialogProps<ConfirmDialogPayload, boolean>;\n\nexport function ConfirmDialog({ open, payload, onClose }: Readonly<ConfirmDialogProps>) {\n const { t } = useTranslation();\n\n return (\n <Dialog maxWidth=\"xs\" fullWidth open={open} onClose={() => onClose(false)} disableRestoreFocus>\n <DialogTitle>{payload.title ?? t(\"Layout.Dialog.Confirm\")}</DialogTitle>\n <DialogContent>{payload.message}</DialogContent>\n <DialogActions>\n <Button onClick={() => onClose(false)}>\n {payload.cancelText ?? t(\"Layout.Dialog.Cancel\")}\n </Button>\n <Button onClick={() => onClose(true)} autoFocus>\n {t(\"Layout.Dialog.Confirm\")}\n </Button>\n </DialogActions>\n </Dialog>\n );\n}\n\ninterface DialogHook {\n alert: OpenAlertDialog;\n confirm: OpenConfirmDialog;\n open: OpenDialog;\n close: CloseDialog;\n}\n\nexport function useDialogs(): DialogHook {\n const { open, close } = useContext(DialogsContext);\n\n const alert = useEventCallback<OpenAlertDialog>((message, { ...options } = {}) =>\n open(AlertDialog, { ...options, message }),\n );\n\n const confirm = useEventCallback<OpenConfirmDialog>((message, { ...options } = {}) =>\n open(ConfirmDialog, { ...options, message }),\n );\n\n return { alert, confirm, open, close };\n}\n","import type { Theme } from \"@mui/material\";\nimport { formatForDisplay } from \"@tanstack/react-hotkeys\";\nimport type { Cell, CellData, Column, RowData } from \"@tanstack/react-table\";\nimport type { LayoutTableFeatures } from \"~/components/table/context\";\nimport type { LayoutColumnMeta } from \"./types\";\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\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","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 {\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 { LayoutColumnMeta } from \"~/components/table/types\";\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,\n max: aggregationFn_max,\n extent: aggregationFn_extent,\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 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":";;;;;;;;;;AA6DA,SAAOoC,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,SAAAT,YAAA0B;CAC1B,MAAA,EAAAM,MAAcpC,eAAe;CAAE,IAAAqC;CAAA,IAAAN,EAAA,OAAA3B,SAAA;EAGwBiC,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GAAoB,SAAAV;GAAc,OAAAC;GAAiB,QAAAC;GAAM,GAAKP;GAA9D,UAAA,CACGX,IAEAqB,EAHQ;;EAIEf,EAAA,MAAAS;EAAAT,EAAA,MAAAU;EAAAV,EAAA,MAAAW;EAAAX,EAAA,MAAAY;EAAAZ,EAAA,MAAAa;EAAAb,EAAA,MAAAc;EAAAd,EAAA,MAAAe;EAAAf,EAAA,MAAAoB;CAAA,OAAAA,KAAApB,EAAA;CAAA,OAJboB;AAIa"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"Approval-C-hF4jbT.mjs","names":["z","ApprovalCoRequestorGroupSchema","object","role","string","trim","min","email","ApprovalCoRequestorGroup","infer","ApprovalCoRequestorEmployeeSchema","employeeId","name","ApprovalCoRequestorEmployee","ApprovalCoRequestorPrincipalSchema","union","ApprovalCoRequestorPrincipal","ApprovalCoRequestorPermissionsSchema","withdraw","boolean","default","optional","cancel","ApprovalCoRequestorPermissions","ApprovalCoRequestorSchema","id","uuid","principal","permissions","ApprovalCoRequestor","z","ApprovalEmployeeSchema","object","employeeId","string","trim","min","max","name","email","ApprovalEmployee","infer","z","StepApprovalOrder","enum","z","StepApprovalOrder","ApprovalFlowStep","ApprovalFlowSchema","object","id","uuid","approvalStage","number","batchSequence","optional","approvalSequence","stepApprovalOrder","steps","array","custom","isActive","boolean","default","ApprovalFlow","infer","z","ApprovalStepResult","enum","z","ApprovalEmployeeSchema","ApprovalStepResult","ApprovalFlowStepSchema","object","id","uuid","order","number","approverRole","string","trim","min","max","default","optional","approver","actualApprover","result","resultDate","date","resultComment","ApprovalFlowStep","infer","z","ApprovalRequestType","enum","z","ApprovalStatus","enum","z","HqApprovalColSchema","object","title","string","optional","text","textColor","textSize","HqApprovalCol","infer","HqApprovalRowSchema","col","array","HqApprovalRow","HqApprovalSectionSchema","row","type","HqApprovalSection","HqApprovalPageSchema","section","HqApprovalPage","HqApprovalSummarySchema","page","HqApprovalSummary","HqApprovalFormDataSchema","systemId","formType","formId","stepName","userId","subject","summary","messageId","attachList","chkResult","apprSummary","approvalComment","HqApprovalFormData","HqApprovalHeaderSchema","serviceId","authorizationCode","dataCreatedTime","characterEnable","boolean","default","HqApprovalHeader","HqApprovalRequestSchema","header","formData","HqApprovalRequest","z","ApprovalCoRequestorSchema","ApprovalEmployee","ApprovalFlow","ApprovalFlowSchema","ApprovalFlowStepSchema","ApprovalRequestType","ApprovalStatus","ApprovalStepResult","HqApprovalRequestSchema","ApprovalSchema","object","id","uuid","number","string","trim","max","optional","applicationName","min","type","default","status","created","date","createdBy","custom","updated","updatedBy","approvalFlows","array","currentApprovers","coRequestors","Approval","infer","CreateApprovalSchema","pick","extend","emailBody","hqApprovalRequest","approvalStage","batchSequence","stepApprovalOrder","steps","approverRole","approver","CreateApproval","ApproveApprovalSchema","result","resultComment","ApproveApproval","ResubmitApprovalSchema","ResubmitApproval","CancelApprovalSchema","comment","CancelApproval","WithdrawApprovalSchema","WithdrawApproval"],"sources":["../src/models/approval/ApprovalCoRequestor.ts","../src/models/approval/ApprovalEmployee.ts","../src/models/approval/StepApprovalOrder.ts","../src/models/approval/ApprovalFlow.ts","../src/models/approval/ApprovalStepResult.ts","../src/models/approval/ApprovalFlowStep.ts","../src/models/approval/ApprovalRequestType.ts","../src/models/approval/ApprovalStatus.ts","../src/models/approval/HqApprovalRequest.ts","../src/models/approval/Approval.ts"],"sourcesContent":["import { z } from \"zod\";\n\nexport const ApprovalCoRequestorGroupSchema = z.object({\n role: z.string().trim().min(1),\n email: z.email(),\n});\n\nexport type ApprovalCoRequestorGroup = z.infer<typeof ApprovalCoRequestorGroupSchema>;\n\nexport const ApprovalCoRequestorEmployeeSchema = z.object({\n employeeId: z.string().trim().min(1),\n name: z.string().trim().min(1),\n email: z.email(),\n});\n\nexport type ApprovalCoRequestorEmployee = z.infer<typeof ApprovalCoRequestorEmployeeSchema>;\n\nexport const ApprovalCoRequestorPrincipalSchema = z.union([\n ApprovalCoRequestorGroupSchema,\n ApprovalCoRequestorEmployeeSchema,\n]);\n\nexport type ApprovalCoRequestorPrincipal = z.infer<typeof ApprovalCoRequestorPrincipalSchema>;\n\nexport const ApprovalCoRequestorPermissionsSchema = z.object({\n withdraw: z.boolean().default(false).optional(),\n cancel: z.boolean().default(false).optional(),\n});\n\nexport type ApprovalCoRequestorPermissions = z.infer<typeof ApprovalCoRequestorPermissionsSchema>;\n\nexport const ApprovalCoRequestorSchema = z.object({\n id: z.uuid(),\n principal: ApprovalCoRequestorPrincipalSchema,\n permissions: ApprovalCoRequestorPermissionsSchema,\n});\n\nexport type ApprovalCoRequestor = z.infer<typeof ApprovalCoRequestorSchema>;\n","import { z } from \"zod\";\n\nexport const ApprovalEmployeeSchema = z.object({\n employeeId: z.string().trim().min(1).max(20),\n name: z.string().trim().min(1).max(50),\n email: z.email().min(1).max(100),\n});\n\nexport type ApprovalEmployee = z.infer<typeof ApprovalEmployeeSchema>;\n","import z from \"zod\";\n\nexport const StepApprovalOrder = z.enum([\"Serial\", \"Parallel\", \"OneOfThem\"]);\n","import { z } from \"zod\";\nimport { StepApprovalOrder } from \"./StepApprovalOrder\";\nimport type { ApprovalFlowStep } from \"./ApprovalFlowStep\";\n\nexport const ApprovalFlowSchema = z.object({\n id: z.uuid(),\n approvalStage: z.number(),\n batchSequence: z.number().optional(),\n approvalSequence: z.number(),\n stepApprovalOrder: StepApprovalOrder,\n steps: z.array(z.custom<ApprovalFlowStep>()),\n isActive: z.boolean().default(false).optional(),\n});\n\nexport type ApprovalFlow = z.infer<typeof ApprovalFlowSchema>;\n","import z from \"zod\";\n\nexport const ApprovalStepResult = z.enum([\n \"NotAvailable\",\n \"FutureApproval\",\n \"WaitingForApproval\",\n \"Approved\",\n \"Rejected\",\n \"Skipped\",\n \"Withdrawn\",\n \"Cancelled\",\n]);\n","import { z } from \"zod\";\nimport { ApprovalEmployeeSchema } from \"./ApprovalEmployee\";\nimport { ApprovalStepResult } from \"./ApprovalStepResult\";\n\nexport const ApprovalFlowStepSchema = z.object({\n id: z.uuid(),\n order: z.number(),\n approverRole: z.string().trim().min(1).max(100).default(\"Approver\").optional(),\n approver: ApprovalEmployeeSchema,\n actualApprover: ApprovalEmployeeSchema.optional(),\n result: ApprovalStepResult.default(\"NotAvailable\").optional(),\n resultDate: z.date().optional(),\n resultComment: z.string().trim().max(2000).optional(),\n});\n\nexport type ApprovalFlowStep = z.infer<typeof ApprovalFlowStepSchema>;\n","import z from \"zod\";\n\nexport const ApprovalRequestType = z.enum([\"Single\", \"Batch\"]);\n","import z from \"zod\";\n\nexport const ApprovalStatus = z.enum([\n \"WaitingForApproval\",\n \"Approved\",\n \"PartiallyApproved\",\n \"Rejected\",\n \"Withdrawn\",\n \"Cancelled\",\n]);\n","import { z } from \"zod\";\n\nexport const HqApprovalColSchema = z.object({\n title: z.string().optional(),\n text: z.string().optional(),\n textColor: z.string().optional(),\n textSize: z.string().optional(),\n});\n\nexport type HqApprovalCol = z.infer<typeof HqApprovalColSchema>;\n\nexport const HqApprovalRowSchema = z.object({\n col: z.array(HqApprovalColSchema),\n});\n\nexport type HqApprovalRow = z.infer<typeof HqApprovalRowSchema>;\n\nexport const HqApprovalSectionSchema = z.object({\n row: z.array(HqApprovalRowSchema),\n title: z.string().optional(),\n type: z.string().optional(),\n text: z.string().optional(),\n});\n\nexport type HqApprovalSection = z.infer<typeof HqApprovalSectionSchema>;\n\nexport const HqApprovalPageSchema = z.object({\n section: z.array(HqApprovalSectionSchema),\n});\n\nexport type HqApprovalPage = z.infer<typeof HqApprovalPageSchema>;\n\nexport const HqApprovalSummarySchema = z.object({\n page: z.array(HqApprovalPageSchema),\n});\n\nexport type HqApprovalSummary = z.infer<typeof HqApprovalSummarySchema>;\n\nexport const HqApprovalFormDataSchema = z.object({\n systemId: z.string().optional(),\n formType: z.string().optional(),\n formId: z.string().optional(),\n stepName: z.string().optional(),\n userId: z.string().optional(),\n title: z.string().optional(),\n subject: z.string().optional(),\n summary: HqApprovalSummarySchema.optional(),\n messageId: z.string().optional(),\n attachList: z.string().optional(),\n chkResult: z.string().optional(),\n apprSummary: z.string().optional(),\n approvalComment: z.string().optional(),\n});\n\nexport type HqApprovalFormData = z.infer<typeof HqApprovalFormDataSchema>;\n\nexport const HqApprovalHeaderSchema = z.object({\n serviceId: z.string().optional(),\n authorizationCode: z.string().optional(),\n dataCreatedTime: z.string().optional(),\n characterEnable: z.boolean().default(false).optional(),\n});\n\nexport type HqApprovalHeader = z.infer<typeof HqApprovalHeaderSchema>;\n\nexport const HqApprovalRequestSchema = z.object({\n header: HqApprovalHeaderSchema.optional(),\n formData: HqApprovalFormDataSchema.optional(),\n});\n\nexport type HqApprovalRequest = z.infer<typeof HqApprovalRequestSchema>;\n","import z from \"zod\";\nimport { ApprovalCoRequestorSchema } from \"./ApprovalCoRequestor\";\nimport { type ApprovalEmployee } from \"./ApprovalEmployee\";\nimport type { ApprovalFlow } from \"./ApprovalFlow\";\nimport { ApprovalFlowSchema } from \"./ApprovalFlow\";\nimport { ApprovalFlowStepSchema } from \"./ApprovalFlowStep\";\nimport { ApprovalRequestType } from \"./ApprovalRequestType\";\nimport { ApprovalStatus } from \"./ApprovalStatus\";\nimport { ApprovalStepResult } from \"./ApprovalStepResult\";\nimport { HqApprovalRequestSchema } from \"./HqApprovalRequest\";\n\nexport const ApprovalSchema = z.object({\n id: z.uuid(),\n number: z.string().trim().max(30).optional(),\n applicationName: z.string().trim().min(1).max(50),\n type: ApprovalRequestType.default(\"Single\").optional(),\n status: ApprovalStatus,\n created: z.date(),\n createdBy: z.custom<ApprovalEmployee>(),\n updated: z.date().optional(),\n updatedBy: z.custom<ApprovalEmployee>().optional(),\n approvalFlows: z.array(z.custom<ApprovalFlow>()).min(1),\n currentApprovers: z.array(z.custom<ApprovalEmployee>()),\n coRequestors: z.array(ApprovalCoRequestorSchema).optional(),\n});\n\nexport type Approval = z.infer<typeof ApprovalSchema>;\n\n// Create Approval\nexport const CreateApprovalSchema = ApprovalSchema.pick({\n id: true,\n number: true,\n applicationName: true,\n type: true,\n status: true,\n approvalFlows: true,\n}).extend({\n emailBody: z.string().trim().min(1),\n hqApprovalRequest: HqApprovalRequestSchema.optional(),\n approvalFlows: z\n .array(\n ApprovalFlowSchema.pick({\n approvalStage: true,\n batchSequence: true,\n stepApprovalOrder: true,\n steps: true,\n }).extend({\n steps: z.array(\n ApprovalFlowStepSchema.pick({\n approverRole: true,\n approver: true,\n }),\n ),\n }),\n )\n .min(1),\n coRequestors: z.array(ApprovalCoRequestorSchema).optional(),\n});\n\nexport type CreateApproval = z.infer<typeof CreateApprovalSchema>;\n\n// Single Approval\nexport const ApproveApprovalSchema = z.object({\n id: z.uuid(),\n result: ApprovalStepResult,\n resultComment: z.string().trim().max(2000).optional(),\n emailBody: z.string().trim().min(1),\n});\n\nexport type ApproveApproval = z.infer<typeof ApproveApprovalSchema>;\n\n// Resubmit Approval\nexport const ResubmitApprovalSchema = ApprovalSchema.pick({\n id: true,\n approvalFlows: true,\n}).extend({\n approvalFlows: z\n .array(\n ApprovalFlowSchema.pick({\n approvalStage: true,\n batchSequence: true,\n stepApprovalOrder: true,\n steps: true,\n }).extend({\n steps: z.array(\n ApprovalFlowStepSchema.pick({\n approverRole: true,\n approver: true,\n }),\n ),\n }),\n )\n .min(1),\n});\n\nexport type ResubmitApproval = z.infer<typeof ResubmitApprovalSchema>;\n\n// Cancel Approval\nexport const CancelApprovalSchema = z.object({\n id: z.uuid(),\n comment: z.string().trim().min(1).max(2000),\n emailBody: z.string().trim().min(1),\n});\n\nexport type CancelApproval = z.infer<typeof CancelApprovalSchema>;\n\n// Withdraw Approval\nexport const WithdrawApprovalSchema = z.object({\n id: z.uuid(),\n comment: z.string().trim().min(1).max(2000),\n emailBody: z.string().trim().min(1),\n});\n\nexport type WithdrawApproval = z.infer<typeof WithdrawApprovalSchema>;\n"],"mappings":";;AAEA,MAAaC,iCAAiCD,IAAEE,OAAO;CACrDC,MAAMH,IAAEI,OAAO,CAAC,CAACC,KAAK,CAAC,CAACC,IAAI,CAAC;CAC7BC,OAAOP,IA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AAI;CAC1CsB,WAAWvC,EAAEe,OAAO,CAAC,CAACC,KAAK,CAAC,CAACI,IAAI,CAAC;AACpC,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"approval-DFExxyAJ.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"],"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/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,sBAAsBP,YAAYG,SAAS;EAChDK,QAAQ;CACV,CAAC;CACD,OAAOH;AACT,CACF;AAEA,MAAaI,cAAc1C,mBACzB,OAAO,EAAE4B,WAA2E;CAClF,MAAMC,QAAQR,kBAAkB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E;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":"file-CZwQfvTU.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"],"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,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AOwE,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":"peoplesoft-CQnc01Hc.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"],"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,cA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AClC,OAAO,EAAEoB,WAA4E;CACnF,MAAMC,QAAQT,mBAAmBY,MAAMJ,IAAI;CAE3C,MAAM,EAAEA,MAAMc,aAAa,OAAMT,MADfT,cAAc,EAAA,CACKW,QAAkB;EACrDC,KAAK,kBAAkBC,mBAAmBR,MAAMR,YAAY,EAAC;EAC7DiB,QAAQ;CACV,CAAC;CACD,OAAOI;AACT,CACF;AAEA,MAAaW,yBAAyB7C,mBACpC,OAAO,EAAEoB,WAAmF;CAC1F,MAAMC,QAAQT,mBAAmBY,MAAMJ,IAAI;CAE3C,MAAM,EAAEA,MAAMM,cAAc,OAAMD,MADhBT,cAAc,EAAA,CACMW,QAAyB;EAC7DC,KAAK,kBAAkBC,mBAAmBR,MAAMR,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-Dbl95AxR.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"],"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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EA,MAAaI,uBAAuBxC,WAClCkC,UAAUG,MAAMC,cAAcA,UAAUtC,WAAWA,MAAM"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"tokens-D8CVIFTb.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","data","result","refresh_token","update","access_token","error","clear","Response","json","message","status","appTokens","Map","token","expiresAt","getAppToken","cached","get","Date","now","defaultScope","slice","lastIndexOf","set","expires_in"],"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.data;\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 await session.update({ refreshToken: result.refresh_token });\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 await session.clear();\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,U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OAAOH,OAAOH;CAG3D,MAAMtB,QAAQJ,aAAaQ,UAAU,OAAO;CAC5C,MAAMyB,eAAe,GAAG7B,MAAM8B,MAAM,GAAG9B,MAAM+B,YAAY,GAAG,CAAC,EAAC;CAE9D,MAAMrB,SAAS,MAAMnB,kBAAkBE,YAAY,OAAO,GAAG,EAAEO,OAAO6B,aAAa,CAAC;CACpFT,UAAUY,IAAI5B,UAAU;EACtBkB,OAAOZ,OAAOG;EACdU,WAAWI,KAAKC,IAAI,KAAKlB,OAAOuB,aAAa,MAAM;CACrD,CAAC;CACD,OAAOvB,OAAOG;AAChB,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils-KaM5VMTJ.mjs","names":["OFFLINE_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","min","ENTRA_TENANT_ID","ENTRA_CLIENT_SECRET","AWS_ISSUER","url","optional","AWS_DOMAIN","AWS_CLIENT_ID","AWS_CLIENT_SECRET","SESSION_SECRET","FILE_BASE_URL","APPROVAL_BASE_URL","PEOPLESOFT_BASE_URL","EMAIL_BASE_URL","AI_BASE_URL","AI_SUBSCRIPTION_KEY","process","useSession","serverEnv","ProviderId","User","AppSessionData","provider","refreshToken","user","pkceVerifier","state","returnTo","AppSession","Awaited","ReturnType","getAppSession","Promise","getSession","name","password","SESSION_SECRET","queryOptions","createServerFn","QueryClientParam","ProviderId","User","OFFLINE_USER_KEY","withOfflineFallback","getAppSession","getSessionUser","method","handler","Promise","session","data","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().min(1),\n ENTRA_TENANT_ID: z.string().min(1),\n ENTRA_CLIENT_SECRET: z.string().min(1),\n AWS_ISSUER: z.url().optional(),\n AWS_DOMAIN: z.url().optional(),\n AWS_CLIENT_ID: z.string().min(1).optional(),\n AWS_CLIENT_SECRET: z.string().min(1).optional(),\n SESSION_SECRET: z.string().min(32),\n FILE_BASE_URL: z.string().min(1).optional(),\n APPROVAL_BASE_URL: z.string().min(1).optional(),\n PEOPLESOFT_BASE_URL: z.string().min(1).optional(),\n EMAIL_BASE_URL: z.string().min(1).optional(),\n AI_BASE_URL: z.string().min(1).optional(),\n AI_SUBSCRIPTION_KEY: z.string().min(1).optional(),\n },\n runtimeEnv: process.env,\n emptyStringAsUndefined: true,\n});\n","import type { useSession } from \"@tanstack/react-start/server\";\r\nimport { serverEnv } from \"~/env\";\r\nimport type { ProviderId, User } from \"~/models/User\";\r\n\r\nexport interface AppSessionData {\r\n /** Which identity provider signed this user in. */\r\n provider?: ProviderId;\r\n /** The only token persisted; delegated access tokens are minted from it. */\r\n refreshToken?: string;\r\n user?: User;\r\n /** Transient, only between /auth/login and /auth/callback. */\r\n pkceVerifier?: string;\r\n state?: string;\r\n returnTo?: string;\r\n}\r\n\r\n/** `SessionManager` is not re-exported upstream, so name it through `useSession`. */\r\nexport type AppSession = Awaited<ReturnType<typeof useSession<AppSessionData>>>;\r\n\r\nexport const getAppSession = async (): Promise<AppSession> => {\r\n // Dynamic import: `@tanstack/react-start/server` is the server entry and drags\r\n // in the SSR renderer (`react-dom/server`). Keep it out of the client graph —\r\n // this helper is only ever called server-side, and all callers already await it.\r\n // Aliased off the `use*` name so it isn't mistaken for a React hook (it's a\r\n // server session helper, not a hook).\r\n const { useSession: getSession } = await import(\"@tanstack/react-start/server\");\r\n\r\n return getSession<AppSessionData>({\r\n name: \"session\",\r\n password: serverEnv.SESSION_SECRET,\r\n });\r\n};\r\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.data.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,oBAAo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,GAAA,CAAIZ,YAAY;CACvEc,YAAYJ,QAAQI,YAAYC,YAAY,KAAK;CACjDC,aAAaN,QAAQM,cAAcN,QAAQ,uBAAuB,GAAA,CAAIK,YAAY;CAClFE,aAAaP,QAAQO,eAAe;CACpCC,SACGR,QAAQQ,UAAUR,QAAQ,kBAAA,EAAoBS,QAAQC,UAAUhB,iBAAiBiB,IAAID,KAAK,CAAC,KAC5F,CAAA;AACJ;AAEA,MAAa3C,iBAAiBJ,MAAmBiD,QAC/CjD,OAAOlC,YAAYmF,IAAI,CAACC,MAAMH,UAAU/C,KAAK6C,OAAOM,SAASJ,KAAK,CAAC,IAAI"}
@@ -1,80 +0,0 @@
1
- ---
2
- name: unslop
3
- description: Cut AI tells from any writing. Must always apply.
4
- ---
5
-
6
- # Unslop
7
-
8
- Edit text to remove AI patterns and add human voice.
9
-
10
- ## Process
11
-
12
- 1. Scan for the patterns below.
13
- 2. Rewrite. Preserve meaning, match intended tone.
14
- 3. Add soul (see next section).
15
- 4. Self-audit: "What makes this obviously AI generated?" Fix remaining tells.
16
-
17
- ## Adding soul
18
-
19
- Removing patterns is half the job. Sterile, voiceless writing is just as obvious.
20
-
21
- - **Have opinions.** React to facts instead of neutrally listing pros and cons.
22
- - **Vary rhythm.** Short sentences. Then longer ones that take their time. Mix it up.
23
- - **Acknowledge complexity.** "Impressive but also kind of unsettling" beats "impressive."
24
- - **Use "I" when it fits.** First person isn't unprofessional.
25
- - **Let some mess in.** Perfect structure looks machine-made.
26
- - **Be specific.** Not "this is concerning" but "there's something unsettling about agents churning away at 3am."
27
-
28
- ## Patterns to detect and fix
29
-
30
- ### Content
31
-
32
- 1. **Puffery.** "pivotal moment", "testament to", "evolving landscape", "setting the stage for", "indelible mark", "deeply rooted". Cut puffery, state what happened.
33
- 2. **Name-dropping.** Listing media outlets without context. Pick one, say what was said.
34
- 3. **Superficial -ing phrases.** "highlighting...", "ensuring...", "reflecting...", "showcasing...", "fostering...". Delete or expand with real sources.
35
- 4. **Promotional language.** "nestled", "vibrant", "breathtaking", "groundbreaking", "renowned", "stunning", "must-visit". Use neutral descriptions.
36
- 5. **Vague attributions.** "Experts believe", "Industry reports suggest", "Some critics argue". Name the source or delete.
37
- 6. **Formulaic challenges.** "Despite challenges... continues to thrive." Replace with specific facts.
38
-
39
- ### Language
40
-
41
- 7. **AI vocabulary.** Additionally, crucial, delve, enduring, enhance, fostering, garner, interplay, intricate, landscape (abstract), pivotal, showcase, tapestry (abstract), testament, underscore, vibrant. Replace with plain words.
42
- 8. **Fancy ways to say "is".** "serves as", "stands as", "boasts", "features". Just say "is" or "has".
43
- 9. **"Not just X, but Y."** State the point directly instead.
44
- 10. **Rule of three.** Forcing ideas into groups of three. Use the natural number.
45
- 11. **Synonym cycling.** Protagonist, main character, central figure, hero all in one paragraph. Pick one, repeat it.
46
- 12. **False ranges.** "from X to Y" where X and Y aren't on a meaningful scale. List topics directly.
47
-
48
- ### Style
49
-
50
- 13. **Em dash overuse.** Avoid em dashes entirely. Use periods or commas only (no parentheses, no en dashes, no hyphen-as-dash substitutes). Em dashes are an AI tell, and reaching for parentheses instead just trades one tell for another. If a thought needs separation, end the sentence or use a comma.
51
- 14. **Colon overuse.** Colons are fine before a list or example. Not as mid-sentence connectors. "If you're coming from traditional automation: instead of registering event handlers, you describe conditions" adds nothing with the colon. Rewrite to let the point stand on its own without comparison framing. "Describing when the scheduler should fire works best as plain English." Same meaning, no crutch punctuation.
52
- 15. **Boldface overuse.** Don't bold every proper noun or acronym.
53
- 16. **Inline-header lists.** The tell is a bold label and colon that restates the line: "**Performance:** Performance improved...". Convert those to prose. A bold lead-in that ends in a period, names the item, and is followed by genuinely new detail ("**Schema in TypeScript.** Tables live in one file.") is fine, not a tell.
54
- 17. **Title case headings.** Use sentence case.
55
- 18. **Decorative emojis.** Remove from headings and bullets.
56
- 19. **Curly quotes.** Replace with straight quotes.
57
-
58
- ### Communication artifacts
59
-
60
- 20. **Chatbot phrases.** "I hope this helps!", "Let me know if...", "Of course!", "Certainly!", "Found the smoking gun!" Remove.
61
- 21. **Cutoff disclaimers.** "While specific details are limited..." Find sources or remove.
62
- 22. **Sycophantic tone.** "Great question! You're absolutely right!" Respond directly.
63
-
64
- ### Filler
65
-
66
- 23. **Filler phrases.** "In order to" becomes "To". "Due to the fact that" becomes "Because". "It is important to note that" gets deleted.
67
- 24. **Excessive hedging.** "could potentially possibly be argued that it might" becomes "may".
68
- 25. **Generic conclusions.** "The future looks bright." State specific plans or facts.
69
-
70
- ### Jargon
71
-
72
- 26. **Abstract metaphor nouns.** Substrate, wedge, vector, locus, vantage, nexus, primitive (as noun), harness (as metaphor), surface (as in "API surface"), bedrock, scaffolding (as metaphor), modality, paradigm, gold-plating, ratchet (as metaphor), evacuate (for moving code), endgame, north star, flywheel. These read as technical but usually have a plainer concrete word. "Substrate" becomes "base". "Wedge in" becomes "add". "Vector" becomes "way" or "method". "Gold-plating" becomes "more than the job needs". "Ratchet" becomes the mechanism's real name or "a limit that only tightens". "Evacuate" becomes "move out". "Endgame" becomes "the last phase". Pick the concrete word.
73
-
74
- ### Plain speech
75
-
76
- 27. **Say what it does, not how it feels.** "the database stays close at hand", "SQL you can read", "types that follow your schema" name a feeling. The fix names the mechanism or a number: "`.toSQL()` returns the exact string sent to the database", "a column rename fails the build". Ask what the sentence tells the reader to do or know, then write that. If you can't restate it as a concrete instruction, fact, or number, cut it. One more check: if the sentence could appear unchanged in another project's docs, it says nothing about this one. Cut it.
77
- 28. **Shorten or split dense sentences.** If the reader has to backtrack to parse a sentence, break it in two or drop clauses. One idea per sentence.
78
- 29. **Active voice.** Prefer it. Catch "is/are/was/were + past participle" and name the actor: "queries are validated" becomes "the compiler validates queries", "the file is parsed by the loader" becomes "the loader parses the file". Passive is fine only when the actor is unknown or genuinely doesn't matter.
79
- 30. **Cut adverbs, or use a stronger verb.** "runs quickly" becomes "is fast" or the number. "significantly improves" becomes the measured delta. An adverb propping up a weak verb means the verb is wrong.
80
- 31. **Prefer the plain word.** "utilize" becomes "use", "leverage" becomes "use", "facilitate" becomes "help", "numerous" becomes "many", "in the event that" becomes "if". The fancier synonym is rarely clearer.