wcz-layout 10.1.9 → 10.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{Approval-DoD-GRRH.mjs → Approval-D1TfISUL.mjs} +11 -21
- package/dist/Approval-D1TfISUL.mjs.map +1 -0
- package/dist/{LayoutTable-CRo43iWr.d.mts → ChatLayout-BmLySLXy.d.mts} +11 -18
- package/dist/ChatLayout-Tpuwo8-b.mjs +1622 -0
- package/dist/ChatLayout-Tpuwo8-b.mjs.map +1 -0
- package/dist/{DialogsContext-DLqA8RJ_.mjs → DialogsContext-D23fJjYR.mjs} +2 -3
- package/dist/DialogsContext-D23fJjYR.mjs.map +1 -0
- package/dist/{Email-CKUxOURX.d.mts → Email-Dz5k0UWE.d.mts} +1 -3
- package/dist/{Email-BzQQkbe9.mjs → Email-rnz3H0x3.mjs} +3 -5
- package/dist/Email-rnz3H0x3.mjs.map +1 -0
- package/dist/{Employee-agVPiGrJ.d.mts → Employee-C8xIlBxY.d.mts} +1 -7
- package/dist/{FileMeta-Be9viU7D.d.mts → FileMeta-B39e2FLC.d.mts} +1 -3
- package/dist/{FileMeta-DDqUju1Y.mjs → FileMeta-CPBWI_jA.mjs} +2 -3
- package/dist/FileMeta-CPBWI_jA.mjs.map +1 -0
- package/dist/{QueryClientParam-JcH0mJWl.d.mts → QueryClientParam-CTV1vj76.d.mts} +1 -3
- package/dist/RouterListItemButton-CF-8w-08.mjs +62 -0
- package/dist/RouterListItemButton-CF-8w-08.mjs.map +1 -0
- package/dist/{User-D4__w1I1.d.mts → User-aJksXItw.d.mts} +1 -3
- package/dist/{approval-L09uPzTU.mjs → approval-HB2w5jzc.mjs} +4 -5
- package/dist/approval-HB2w5jzc.mjs.map +1 -0
- package/dist/auth.d.mts +0 -4
- package/dist/auth.mjs +5 -6
- package/dist/auth.mjs.map +1 -1
- package/dist/components.d.mts +63 -33
- package/dist/components.mjs +658 -748
- package/dist/components.mjs.map +1 -1
- package/dist/{createApi-BhNkG4jz.mjs → createApi-CKgFi53y.mjs} +4 -6
- package/dist/createApi-CKgFi53y.mjs.map +1 -0
- package/dist/data/client.d.mts +2 -8
- package/dist/data/client.mjs +6 -9
- package/dist/data/client.mjs.map +1 -1
- package/dist/data/server.d.mts +2 -4
- package/dist/data/server.mjs +6 -7
- package/dist/data/server.mjs.map +1 -1
- package/dist/env-BwFl7nWc.mjs +48 -0
- package/dist/env-BwFl7nWc.mjs.map +1 -0
- package/dist/{file-Chlljz3o.mjs → file-X1sK4ok6.mjs} +7 -8
- package/dist/file-X1sK4ok6.mjs.map +1 -0
- package/dist/{file-Dl8JCcqy.mjs → file-tkfsnk5F.mjs} +8 -8
- package/dist/file-tkfsnk5F.mjs.map +1 -0
- package/dist/generatedChart-k7NEdi5Z.mjs +211 -0
- package/dist/generatedChart-k7NEdi5Z.mjs.map +1 -0
- package/dist/hooks.d.mts +30 -30
- package/dist/hooks.mjs +1828 -1304
- package/dist/hooks.mjs.map +1 -1
- package/dist/index.d.mts +11 -14
- package/dist/index.mjs +1273 -1051
- package/dist/index.mjs.map +1 -1
- package/dist/middleware.d.mts +1 -7
- package/dist/middleware.mjs +5 -8
- package/dist/middleware.mjs.map +1 -1
- package/dist/models.d.mts +4 -32
- package/dist/models.mjs +7 -11
- package/dist/models.mjs.map +1 -1
- package/dist/{peoplesoft-D6q3cYsH.d.mts → peoplesoft-C-zPdRVj.d.mts} +3 -9
- package/dist/{peoplesoft-BhintHQz.mjs → peoplesoft-RnvfLbWH.mjs} +5 -25
- package/dist/peoplesoft-RnvfLbWH.mjs.map +1 -0
- package/dist/{providers-BvuZWkpD.mjs → providers-BfFg_3eo.mjs} +5 -23
- package/dist/providers-BfFg_3eo.mjs.map +1 -0
- package/dist/{tokens-XuFhVbh5.mjs → tokens-C4SErO-K.mjs} +12 -8
- package/dist/tokens-C4SErO-K.mjs.map +1 -0
- package/dist/{utils-CaeVFWF-.mjs → utils-C2MZoH9U.mjs} +8 -39
- package/dist/utils-C2MZoH9U.mjs.map +1 -0
- package/dist/{utils-Bhi0KiBx.d.mts → utils-CNYCSgip.d.mts} +3 -5
- package/dist/utils-DnMFybj3.mjs +27 -0
- package/dist/utils-DnMFybj3.mjs.map +1 -0
- package/dist/utils.d.mts +11 -2
- package/dist/utils.mjs +3 -5
- package/dist/vite.d.mts +0 -2
- package/dist/vite.mjs +2 -4
- package/dist/vite.mjs.map +1 -1
- package/package.json +131 -131
- package/skills/ai/SKILL.md +136 -39
- package/skills/client-db/SKILL.md +104 -90
- package/skills/db-schema/SKILL.md +28 -20
- package/skills/dialogs/SKILL.md +26 -38
- package/skills/forms/SKILL.md +133 -73
- package/skills/general/SKILL.md +99 -105
- package/skills/general/references/auth.md +70 -0
- package/skills/migrations/versions/migrate-v10-to-v11.md +30 -4
- package/skills/routing/SKILL.md +60 -58
- package/skills/scanning/SKILL.md +67 -0
- package/skills/server-functions/SKILL.md +71 -26
- package/skills/services/SKILL.md +4 -4
- package/skills/services/docs/approval.md +70 -24
- package/skills/services/docs/email.md +24 -3
- package/skills/services/docs/file.md +69 -27
- package/skills/services/docs/peoplesoft.md +55 -39
- package/skills/start/steps/03-apm-setup.md +9 -9
- package/skills/table/SKILL.md +250 -267
- package/dist/AggregatedCell-oGcwbetF.mjs +0 -559
- package/dist/AggregatedCell-oGcwbetF.mjs.map +0 -1
- package/dist/Approval-DoD-GRRH.mjs.map +0 -1
- package/dist/DialogsContext-DLqA8RJ_.mjs.map +0 -1
- package/dist/Email-BzQQkbe9.mjs.map +0 -1
- package/dist/FileMeta-DDqUju1Y.mjs.map +0 -1
- package/dist/RouterListItemButton-ULMlaQh6.mjs +0 -80
- package/dist/RouterListItemButton-ULMlaQh6.mjs.map +0 -1
- package/dist/approval-L09uPzTU.mjs.map +0 -1
- package/dist/createApi-BhNkG4jz.mjs.map +0 -1
- package/dist/file-Chlljz3o.mjs.map +0 -1
- package/dist/file-Dl8JCcqy.mjs.map +0 -1
- package/dist/peoplesoft-BhintHQz.mjs.map +0 -1
- package/dist/providers-BvuZWkpD.mjs.map +0 -1
- package/dist/tokens-XuFhVbh5.mjs.map +0 -1
- package/dist/utils-CaeVFWF-.mjs.map +0 -1
- package/skills/general/references/exports.md +0 -114
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Approval-DoD-GRRH.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","z","ApprovalEmployeeSchema","object","employeeId","string","trim","min","max","name","email","ApprovalEmployee","infer","ApprovalProxySchema","proxy","ApprovalProxy","z","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","z","ApprovalStepResult","enum","z","ApprovalEmployeeSchema","ApprovalProxySchema","ApprovalStepResult","ApprovalFlowStepSchema","object","id","uuid","order","number","approverRole","string","trim","min","max","default","optional","approver","actualApprover","proxies","array","result","resultDate","date","resultComment","ApprovalFlowStep","infer","z","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","z","ApprovalCoRequestorSchema","ApprovalEmployee","ApprovalEmployeeSchema","ApprovalProxySchema","ApprovalFlow","ApprovalFlowSchema","ApprovalFlowStepSchema","ApprovalRequestType","ApprovalStatus","ApprovalStepResult","HqApprovalRequestSchema","ApprovalSchema","object","id","uuid","number","string","trim","min","max","applicationName","type","default","optional","status","created","date","createdBy","custom","updated","updatedBy","approvalFlows","array","currentApprovers","extend","proxies","coRequestors","Approval","infer","CreateApprovalSchema","pick","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\nexport const ApprovalProxySchema = z.object({\n proxy: ApprovalEmployeeSchema,\n});\n\nexport type ApprovalProxy = z.infer<typeof ApprovalProxySchema>;\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, ApprovalProxySchema } 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 proxies: z.array(ApprovalProxySchema),\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 \"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 {\n type ApprovalEmployee,\n ApprovalEmployeeSchema,\n ApprovalProxySchema,\n} 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().min(1).max(30),\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(\n ApprovalEmployeeSchema.extend({ proxies: z.array(ApprovalProxySchema) }),\n ),\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\n .array(\n ApprovalFlowStepSchema.pick({\n approverRole: true,\n approver: true,\n }),\n )\n .min(1),\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 emailBody: z.string().trim().min(1),\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\n .array(\n ApprovalFlowStepSchema.pick({\n approverRole: true,\n approver: true,\n }),\n )\n .min(1),\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\n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EACV,CAAC,CACH,CAAC,CACAA,IAAI,CAAC;AACV,CAAC;AAKD,MAAasC,uBAAuBzD,EAAEa,OAAO;CAC3CC,IAAId,EAAEe,KAAK;CACX2C,SAAS1D,EAAEiB,OAAO,CAAC,CAACC,KAAK,CAAC,CAACC,IAAI,CAAC,CAAC,CAACC,IAAI,GAAI;CAC1CsB,WAAW1C,EAAEiB,OAAO,CAAC,CAACC,KAAK,CAAC,CAACC,IAAI,CAAC;AACpC,CAAC;AAKD,MAAayC,yBAAyB5D,EAAEa,OAAO;CAC7CC,IAAId,EAAEe,KAAK;CACX2C,SAAS1D,EAAEiB,OAAO,CAAC,CAACC,KAAK,CAAC,CAACC,IAAI,CAAC,CAAC,CAACC,IAAI,GAAI;CAC1CsB,WAAW1C,EAAEiB,OAAO,CAAC,CAACC,KAAK,CAAC,CAACC,IAAI,CAAC;AACpC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DialogsContext-DLqA8RJ_.mjs","names":["createContext","CloseDialog","OpenDialog","DialogsContextValue","open","close","DialogsContext"],"sources":["../src/contexts/DialogsContext.ts"],"sourcesContent":["import { createContext } from \"react\";\nimport type { CloseDialog, OpenDialog } from \"../hooks/useDialogs\";\n\nexport interface DialogsContextValue {\n open: OpenDialog;\n close: CloseDialog;\n}\n\nexport const DialogsContext = createContext<DialogsContextValue>({} as DialogsContextValue);\n"],"mappings":";;AAQA,MAAaM,iBAAiBN,cAAmC,CAAC,CAAwB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Email-BzQQkbe9.mjs","names":["z","EmailAttachmentSchema","object","appName","string","trim","min","max","subId","uuid","EmailAttachment","infer","z","EmailAttachmentSchema","EmailSchema","object","subject","string","trim","min","max","body","to","array","email","bcc","optional","cc","attachments","Email","infer"],"sources":["../src/models/email/EmailAttachment.ts","../src/models/email/Email.ts"],"sourcesContent":["import z from \"zod\";\n\nexport const EmailAttachmentSchema = z.object({\n appName: z.string().trim().min(1).max(100),\n subId: z.uuid(),\n});\n\nexport type EmailAttachment = z.infer<typeof EmailAttachmentSchema>;\n","import z from \"zod\";\nimport { EmailAttachmentSchema } from \"./EmailAttachment\";\n\nexport const EmailSchema = z.object({\n subject: z.string().trim().min(1).max(60),\n body: z.string().trim().min(1),\n to: z.array(z.email()).min(1),\n bcc: z.array(z.email()).optional(),\n cc: z.array(z.email()).optional(),\n attachments: z.array(EmailAttachmentSchema).optional(),\n});\n\nexport type Email = z.infer<typeof EmailSchema>;\n"],"mappings":";;AAEA,MAAaC,wBAAwBD,EAAEE,OAAO;CAC5CC,SAASH,EAAEI,OAAO,CAAC,CAACC,KAAK,CAAC,CAACC,IAAI,CAAC,CAAC,CAACC,IAAI,GAAG;CACzCC,OAAOR,EAAES,KAAK;AAChB,CAAC;;;ACFD,MAAaK,cAAcF,EAAEG,OAAO;CAClCC,SAASJ,EAAEK,OAAO,CAAC,CAACC,KAAK,CAAC,CAACC,IAAI,CAAC,CAAC,CAACC,IAAI,EAAE;CACxCC,MAAMT,EAAEK,OAAO,CAAC,CAACC,KAAK,CAAC,CAACC,IAAI,CAAC;CAC7BG,IAAIV,EAAEW,MAAMX,EAAEY,MAAM,CAAC,CAAC,CAACL,IAAI,CAAC;CAC5BM,KAAKb,EAAEW,MAAMX,EAAEY,MAAM,CAAC,CAAC,CAACE,SAAS;CACjCC,IAAIf,EAAEW,MAAMX,EAAEY,MAAM,CAAC,CAAC,CAACE,SAAS;CAChCE,aAAahB,EAAEW,MAAMV,qBAAqB,CAAC,CAACa,SAAS;AACvD,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"FileMeta-DDqUju1Y.mjs","names":["z","FileMetaSchema","object","id","uuid","subId","appName","string","trim","min","max","fileName","fileExtension","fileSize","number","mediaSubType","mediaType","mimeType","createdBy","createdDate","date","FileMeta","infer","z"],"sources":["../src/models/file/FileMeta.ts"],"sourcesContent":["import * as z from \"zod\";\n\nexport const FileMetaSchema = z.object({\n id: z.uuid(),\n subId: z.uuid(),\n appName: z.string().trim().min(1).max(255),\n fileName: z.string().trim().min(1).max(255),\n fileExtension: z.string().trim().min(1).max(255),\n fileSize: z.number().min(0),\n mediaSubType: z.string().trim().min(1).max(255),\n mediaType: z.string().trim().min(1).max(255),\n mimeType: z.string().trim().min(1).max(255),\n createdBy: z.string().trim().min(1).max(255),\n createdDate: z.date(),\n});\n\nexport type FileMeta = z.infer<typeof FileMetaSchema>;\n"],"mappings":";;AAEA,MAAaC,iBAAiBD,IAAEE,OAAO;CACrCC,IAAIH,IAAEI,KAAK;CACXC,OAAOL,IAAEI,KAAK;CACdE,SAASN,IAAEO,OAAO,CAAC,CAACC,KAAK,CAAC,CAACC,IAAI,CAAC,CAAC,CAACC,IAAI,GAAG;CACzCC,UAAUX,IAAEO,OAAO,CAAC,CAACC,KAAK,CAAC,CAACC,IAAI,CAAC,CAAC,CAACC,IAAI,GAAG;CAC1CE,eAAeZ,IAAEO,OAAO,CAAC,CAACC,KAAK,CAAC,CAACC,IAAI,CAAC,CAAC,CAACC,IAAI,GAAG;CAC/CG,UAAUb,IAAEc,OAAO,CAAC,CAACL,IAAI,CAAC;CAC1BM,cAAcf,IAAEO,OAAO,CAAC,CAACC,KAAK,CAAC,CAACC,IAAI,CAAC,CAAC,CAACC,IAAI,GAAG;CAC9CM,WAAWhB,IAAEO,OAAO,CAAC,CAACC,KAAK,CAAC,CAACC,IAAI,CAAC,CAAC,CAACC,IAAI,GAAG;CAC3CO,UAAUjB,IAAEO,OAAO,CAAC,CAACC,KAAK,CAAC,CAACC,IAAI,CAAC,CAAC,CAACC,IAAI,GAAG;CAC1CQ,WAAWlB,IAAEO,OAAO,CAAC,CAACC,KAAK,CAAC,CAACC,IAAI,CAAC,CAAC,CAACC,IAAI,GAAG;CAC3CS,aAAanB,IAAEoB,KAAK;AACtB,CAAC"}
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import { c } from "react/compiler-runtime";
|
|
2
|
-
import { IconButton, ListItemButton } from "@mui/material";
|
|
3
|
-
import React from "react";
|
|
4
|
-
import { createLink } from "@tanstack/react-router";
|
|
5
|
-
import { jsx } from "react/jsx-runtime";
|
|
6
|
-
//#region src/components/router/RouterIconButton.tsx
|
|
7
|
-
const Component$1 = React.forwardRef(function IconButtonComponent(props, reference) {
|
|
8
|
-
const $ = c(4);
|
|
9
|
-
if ($[0] !== "78225cdb1e7335044739e8f2aa569a8b6e8ddff45ee95d92920518aa6794a52d") {
|
|
10
|
-
for (let $i = 0; $i < 4; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
11
|
-
$[0] = "78225cdb1e7335044739e8f2aa569a8b6e8ddff45ee95d92920518aa6794a52d";
|
|
12
|
-
}
|
|
13
|
-
let t0;
|
|
14
|
-
if ($[1] !== props || $[2] !== reference) {
|
|
15
|
-
t0 = /* @__PURE__ */ jsx(IconButton, {
|
|
16
|
-
ref: reference,
|
|
17
|
-
component: "a",
|
|
18
|
-
...props
|
|
19
|
-
});
|
|
20
|
-
$[1] = props;
|
|
21
|
-
$[2] = reference;
|
|
22
|
-
$[3] = t0;
|
|
23
|
-
} else t0 = $[3];
|
|
24
|
-
return t0;
|
|
25
|
-
});
|
|
26
|
-
const CreatedComponent$1 = createLink(Component$1);
|
|
27
|
-
const RouterIconButton = (props) => {
|
|
28
|
-
const $ = c(3);
|
|
29
|
-
if ($[0] !== "78225cdb1e7335044739e8f2aa569a8b6e8ddff45ee95d92920518aa6794a52d") {
|
|
30
|
-
for (let $i = 0; $i < 3; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
31
|
-
$[0] = "78225cdb1e7335044739e8f2aa569a8b6e8ddff45ee95d92920518aa6794a52d";
|
|
32
|
-
}
|
|
33
|
-
let t0;
|
|
34
|
-
if ($[1] !== props) {
|
|
35
|
-
t0 = /* @__PURE__ */ jsx(CreatedComponent$1, { ...props });
|
|
36
|
-
$[1] = props;
|
|
37
|
-
$[2] = t0;
|
|
38
|
-
} else t0 = $[2];
|
|
39
|
-
return t0;
|
|
40
|
-
};
|
|
41
|
-
//#endregion
|
|
42
|
-
//#region src/components/router/RouterListItemButton.tsx
|
|
43
|
-
const Component = React.forwardRef(function ButtonComponent(props, reference) {
|
|
44
|
-
const $ = c(4);
|
|
45
|
-
if ($[0] !== "a33d2f291bddc17afd0afbb422e06a0a3bbcd9c360494d00918e68b54a100925") {
|
|
46
|
-
for (let $i = 0; $i < 4; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
47
|
-
$[0] = "a33d2f291bddc17afd0afbb422e06a0a3bbcd9c360494d00918e68b54a100925";
|
|
48
|
-
}
|
|
49
|
-
let t0;
|
|
50
|
-
if ($[1] !== props || $[2] !== reference) {
|
|
51
|
-
t0 = /* @__PURE__ */ jsx(ListItemButton, {
|
|
52
|
-
ref: reference,
|
|
53
|
-
component: "a",
|
|
54
|
-
...props
|
|
55
|
-
});
|
|
56
|
-
$[1] = props;
|
|
57
|
-
$[2] = reference;
|
|
58
|
-
$[3] = t0;
|
|
59
|
-
} else t0 = $[3];
|
|
60
|
-
return t0;
|
|
61
|
-
});
|
|
62
|
-
const CreatedComponent = createLink(Component);
|
|
63
|
-
const RouterListItemButton = (props) => {
|
|
64
|
-
const $ = c(3);
|
|
65
|
-
if ($[0] !== "a33d2f291bddc17afd0afbb422e06a0a3bbcd9c360494d00918e68b54a100925") {
|
|
66
|
-
for (let $i = 0; $i < 3; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
67
|
-
$[0] = "a33d2f291bddc17afd0afbb422e06a0a3bbcd9c360494d00918e68b54a100925";
|
|
68
|
-
}
|
|
69
|
-
let t0;
|
|
70
|
-
if ($[1] !== props) {
|
|
71
|
-
t0 = /* @__PURE__ */ jsx(CreatedComponent, { ...props });
|
|
72
|
-
$[1] = props;
|
|
73
|
-
$[2] = t0;
|
|
74
|
-
} else t0 = $[2];
|
|
75
|
-
return t0;
|
|
76
|
-
};
|
|
77
|
-
//#endregion
|
|
78
|
-
export { RouterIconButton as n, RouterListItemButton as t };
|
|
79
|
-
|
|
80
|
-
//# sourceMappingURL=RouterListItemButton-ULMlaQh6.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"RouterListItemButton-ULMlaQh6.mjs","names":["IconButton","createLink","React","IconButtonProps","LinkComponent","Component","forwardRef","HTMLAnchorElement","IconButtonComponent","props","reference","$","_c","$i","Symbol","for","t0","CreatedComponent","RouterIconButton","Component","_c","CreatedComponent","ListItemButton","createLink","React","ListItemButtonProps","LinkComponent","Component","forwardRef","HTMLAnchorElement","ButtonComponent","props","reference","$","_c","$i","Symbol","for","t0","CreatedComponent","RouterListItemButton","_c"],"sources":["../src/components/router/RouterIconButton.tsx","../src/components/router/RouterListItemButton.tsx"],"sourcesContent":["import { IconButton } from \"@mui/material\";\nimport { createLink } from \"@tanstack/react-router\";\nimport React from \"react\";\nimport type { IconButtonProps } from \"@mui/material\";\nimport type { LinkComponent } from \"@tanstack/react-router\";\n\nconst Component = React.forwardRef<HTMLAnchorElement, IconButtonProps<\"a\">>(\n function IconButtonComponent(props, reference) {\n return <IconButton ref={reference} component=\"a\" {...props} />;\n },\n);\n\nconst CreatedComponent = createLink(Component);\n\nexport const RouterIconButton: LinkComponent<typeof Component> = (props) => {\n return <CreatedComponent {...props} />;\n};\n","import { ListItemButton } from \"@mui/material\";\nimport { createLink } from \"@tanstack/react-router\";\nimport React from \"react\";\nimport type { ListItemButtonProps } from \"@mui/material\";\nimport type { LinkComponent } from \"@tanstack/react-router\";\n\nconst Component = React.forwardRef<HTMLAnchorElement, ListItemButtonProps<\"a\">>(\n function ButtonComponent(props, reference) {\n return <ListItemButton ref={reference} component=\"a\" {...props} />;\n },\n);\n\nconst CreatedComponent = createLink(Component);\n\nexport const RouterListItemButton: LinkComponent<typeof Component> = (props) => {\n return <CreatedComponent {...props} />;\n};\n"],"mappings":";;;;;;AAMA,MAAMK,cAAYH,MAAMI,WACtB,SAAAE,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M,KAAA,oBAAC,gBAAD;GAAqBN,KAAAA;GAAqB,WAAA;GAAG,GAAKD;EAAK,CAAA;EAAIE,EAAA,KAAAF;EAAAE,EAAA,KAAAD;EAAAC,EAAA,KAAAK;CAAA,OAAAA,KAAAL,EAAA;CAAA,OAA3DK;AAA2D,CAEtE;AAEA,MAAMC,mBAAmBhB,WAAWI,SAAS;AAE7C,MAAaa,wBAAwDT,UAAA;CAAA,MAAAE,IAAAC,EAAA,CAAA;CAAA,IAAAD,EAAA,OAAA,oEAAA;EAAA,KAAA,IAAAE,KAAA,GAAAA,KAAA,GAAAA,MAAA,GAAAF,EAAAE,MAAAC,OAAAC,IAAA,2BAAA;EAAAJ,EAAA,KAAA;CAAA;CAAA,IAAAK;CAAA,IAAAL,EAAA,OAAAF,OAAA;EAC5DO,KAAA,oBAAC,kBAAD,EAAiB,GAAKP,MAAK,CAAA;EAAIE,EAAA,KAAAF;EAAAE,EAAA,KAAAK;CAAA,OAAAA,KAAAL,EAAA;CAAA,OAA/BK;AAA+B"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"approval-L09uPzTU.mjs","names":["createServerOnlyFn","z","createApi","ApproveApprovalSchema","CancelApprovalSchema","CreateApprovalSchema","ResubmitApprovalSchema","WithdrawApprovalSchema","Approval","ApprovalStatus","ApprovalStepResult","GetApprovalsSchema","object","appName","string","min","max","status","optional","approverEmployeeId","stepResult","GetApprovalSchema","id","uuid","approvalApi","baseURL","scopeKey","getApprovals","data","input","Promise","Array","parse","queryParams","URLSearchParams","append","toString","api","approvals","request","url","method","getApproval","approval","createApproval","approveApproval","resubmitApproval","withdrawApproval","cancelApproval","z"],"sources":["../src/data/server/approval.ts"],"sourcesContent":["import { createServerOnlyFn } from \"@tanstack/react-start\";\nimport { z } from \"zod\";\nimport { createApi } from \"~/lib/createApi\";\nimport {\n ApproveApprovalSchema,\n CancelApprovalSchema,\n CreateApprovalSchema,\n ResubmitApprovalSchema,\n WithdrawApprovalSchema,\n} from \"~/models/approval/Approval\";\nimport type { Approval } from \"~/models/approval/Approval\";\nimport { ApprovalStatus } from \"~/models/approval/ApprovalStatus\";\nimport { ApprovalStepResult } from \"~/models/approval/ApprovalStepResult\";\n\nexport const GetApprovalsSchema = z.object({\n appName: z.string().min(1).max(255),\n status: ApprovalStatus.optional(),\n approverEmployeeId: z.string().min(1).max(20).optional(),\n stepResult: ApprovalStepResult.optional(),\n});\n\nexport const GetApprovalSchema = z.object({\n id: z.uuid(),\n});\n\nconst approvalApi = () => createApi({ baseURL: \"APPROVAL_BASE_URL\", scopeKey: \"approval\" });\n\nexport const getApprovals = createServerOnlyFn(\n async ({ data }: { data: z.input<typeof GetApprovalsSchema> }): Promise<Array<Approval>> => {\n const input = GetApprovalsSchema.parse(data);\n const queryParams = new URLSearchParams();\n queryParams.append(\"applicationName\", input.appName);\n if (input.status) queryParams.append(\"status\", input.status.toString());\n if (input.approverEmployeeId)\n queryParams.append(\"approverEmployeeId\", input.approverEmployeeId);\n if (input.stepResult) queryParams.append(\"stepResult\", input.stepResult.toString());\n\n const api = await approvalApi();\n const { data: approvals } = await api.request<Array<Approval>>({\n url: `/Requests?${queryParams.toString()}`,\n method: \"GET\",\n });\n return approvals;\n },\n);\n\nexport const getApproval = createServerOnlyFn(\n async ({ data }: { data: z.input<typeof GetApprovalSchema> }): Promise<Approval> => {\n const input = GetApprovalSchema.parse(data);\n const api = await approvalApi();\n const { data: approval } = await api.request<Approval>({\n url: `/Requests/${input.id}`,\n method: \"GET\",\n });\n return approval;\n },\n);\n\nexport const createApproval = createServerOnlyFn(\n async ({ data }: { data: z.input<typeof CreateApprovalSchema> }): Promise<Approval> => {\n const input = CreateApprovalSchema.parse(data);\n const api = await approvalApi();\n const { data: approval } = await api.request<Approval>({\n url: `/Requests`,\n method: \"POST\",\n data: input,\n });\n return approval;\n },\n);\n\nexport const approveApproval = createServerOnlyFn(\n async ({ data }: { data: z.input<typeof ApproveApprovalSchema> }): Promise<Approval> => {\n const input = ApproveApprovalSchema.parse(data);\n const api = await approvalApi();\n const { data: approval } = await api.request<Approval>({\n url: `/Requests/${input.id}/single-approval`,\n method: \"POST\",\n data: input,\n });\n return approval;\n },\n);\n\nexport const resubmitApproval = createServerOnlyFn(\n async ({ data }: { data: z.input<typeof ResubmitApprovalSchema> }): Promise<Approval> => {\n const input = ResubmitApprovalSchema.parse(data);\n const api = await approvalApi();\n const { data: approval } = await api.request<Approval>({\n url: `/Requests/${input.id}/resubmit`,\n method: \"POST\",\n data: input,\n });\n return approval;\n },\n);\n\nexport const withdrawApproval = createServerOnlyFn(\n async ({ data }: { data: z.input<typeof WithdrawApprovalSchema> }): Promise<void> => {\n const input = WithdrawApprovalSchema.parse(data);\n const api = await approvalApi();\n await api.request<void>({\n url: `/Requests/${input.id}/withdraw`,\n method: \"POST\",\n data: input,\n });\n },\n);\n\nexport const cancelApproval = createServerOnlyFn(\n async ({ data }: { data: z.input<typeof CancelApprovalSchema> }): Promise<void> => {\n const input = CancelApprovalSchema.parse(data);\n const api = await approvalApi();\n await api.request<void>({\n url: `/Requests/${input.id}/cancel`,\n method: \"POST\",\n data: input,\n });\n },\n);\n"],"mappings":";;;;;AAcA,MAAaW,qBAAqBV,IAAEW,OAAO;CACzCC,SAASZ,IAAEa,OAAO,CAAC,CAACC,IAAI,CAAC,CAAC,CAACC,IAAI,GAAG;CAClCC,QAAQR,eAAeS,SAAS;CAChCC,oBAAoBlB,IAAEa,OAAO,CAAC,CAACC,IAAI,CAAC,CAAC,CAACC,IAAI,EAAE,CAAC,CAACE,SAAS;CACvDE,YAAYV,mBAAmBQ,SAAS;AAC1C,CAAC;AAED,MAAaG,oBAAoBpB,IAAEW,OAAO,EACxCU,IAAIrB,IAAEsB,KAAK,EACb,CAAC;AAED,MAAMC,oBAAoBtB,UAAU;CAAEuB,SAAS;CAAqBC,UAAU;AAAW,CAAC;AAE1F,MAAaC,eAAe3B,mBAC1B,OAAO,EAAE4B,WAAmF;CAC1F,MAAMC,QAAQlB,mBAA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CACF;AAEA,MAAaG,mBAAmB9C,mBAC9B,OAAO,EAAE4B,WAAgF;CACvF,MAAMC,QAAQvB,uBAAuB0B,MAAMJ,IAAI;CAE/C,MAAM,EAAEA,MAAMe,aAAa,OAAMN,MADfb,YAAY,EAAA,CACOe,QAAkB;EACrDC,KAAK,aAAaX,MAAMP,GAAE;EAC1BmB,QAAQ;EACRb,MAAMC;CACR,CAAC;CACD,OAAOc;AACT,CACF;AAEA,MAAaI,mBAAmB/C,mBAC9B,OAAO,EAAE4B,WAA4E;CACnF,MAAMC,QAAQtB,uBAAuByB,MAAMJ,IAAI;CAE/C,OAAMS,MADYb,YAAY,EAAA,CACpBe,QAAc;EACtBC,KAAK,aAAaX,MAAMP,GAAE;EAC1BmB,QAAQ;EACRb,MAAMC;CACR,CAAC;AACH,CACF;AAEA,MAAamB,iBAAiBhD,mBAC5B,OAAO,EAAE4B,WAA0E;CACjF,MAAMC,QAAQzB,qBAAqB4B,MAAMJ,IAAI;CAE7C,OAAMS,MADYb,YAAY,EAAA,CACpBe,QAAc;EACtBC,KAAK,aAAaX,MAAMP,GAAE;EAC1BmB,QAAQ;EACRb,MAAMC;CACR,CAAC;AACH,CACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createApi-BhNkG4jz.mjs","names":["createServerOnlyFn","axios","AxiosError","AxiosInstance","https","serverEnv","scopes","definedScopes","getAccessToken","getAppToken","getSessionUser","ApiOptions","baseURL","scopeKey","httpsAgent","Agent","rejectUnauthorized","createApi","Promise","resolvedBaseURL","process","env","Error","accessToken","api","create","headers","Authorization","interceptors","response","use","undefined","error","data","message"],"sources":["../src/lib/createApi.ts"],"sourcesContent":["import { createServerOnlyFn } from \"@tanstack/react-start\";\nimport axios, { AxiosError, type AxiosInstance } from \"axios\";\nimport https from \"node:https\";\nimport type { serverEnv } from \"virtual:wcz-layout\";\nimport { scopes as definedScopes } from \"virtual:wcz-layout\";\nimport { getAccessToken, getAppToken } from \"~/lib/auth/tokens\";\nimport { getSessionUser } from \"~/lib/auth/user\";\n\nexport interface ApiOptions {\n baseURL: keyof typeof serverEnv & `${string}BASE_URL${string}`;\n scopeKey: keyof typeof definedScopes;\n}\n\nconst httpsAgent = new https.Agent({\n rejectUnauthorized: false,\n});\n\nexport const createApi = createServerOnlyFn(\n async ({ baseURL, scopeKey }: ApiOptions): Promise<AxiosInstance> => {\n const resolvedBaseURL = process.env[baseURL];\n if (!resolvedBaseURL) throw new Error(`\"${baseURL}\" env variable is not set.`);\n\n const accessToken = (await getSessionUser())\n ? await getAccessToken(scopeKey)\n : await getAppToken(scopeKey);\n\n const api = axios.create({\n baseURL: resolvedBaseURL,\n httpsAgent,\n headers: { Authorization: `Bearer ${accessToken}` },\n });\n\n api.interceptors.response.use(undefined, (error: unknown) => {\n if (error instanceof AxiosError)\n throw new Error(error.response?.data?.message ?? error.message);\n throw error;\n });\n\n return api;\n },\n);\n"],"mappings":";;;;;;;AAaA,MAAMc,aAAa,IAAIV,MAAMW,MAAM,EACjCC,oBAAoB,MACtB,CAAC;AAED,MAAaC,YAAYjB,mBACvB,OAAO,EAAEY,SAASC,eAAmD;CACnE,MAAMM,kBAAkBC,QAAQC,IAAIT;CACpC,IAAI,CAACO,iBAAiB,MAAM,IAAIG,MAAM,IAAIV,QAAO,2BAA4B;CAE7E,MAAMW,cAAe,MAAMb,eAAe,IACtC,MAAMF,eAAeK,QAAQ,IAC7B,MAAMJ,YAAYI,QAAQ;CAE9B,MAAMW,MAAMvB,MAAMwB,OAAO;EACvBb,SAASO;EACTL;EACAY,SAAS,EAAEC,eAAe,UAAUJ,cAAc;CACpD,CAAC;CAEDC,IAAII,aAAaC,SAASC,IAAIC,KAAAA,IAAYC,UAAmB;EAC3D,IAAIA,iBAAiB9B,YACnB,MAAM,IAAIoB,MAAMU,MAAMH,UAAUI,MAAMC,WAAWF,MAAME,OAAO;EAChE,MAAMF;CACR,CAAC;CAED,OAAOR;AACT,CACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"file-Chlljz3o.mjs","names":["createServerFn","serverEnv","getAccessToken","getAppToken","getSessionUser","getFileUploadToken","method","handler","token","endpoint","FILE_BASE_URL","mutationOptions","queryOptions","createServerFn","Upload","uuidv7","z","UploadFileMetaSchema","UploadFileResult","FileSchema","GetFileMetasSchema","UpdateFileMetaSchema","batchDeleteFiles","deleteFile","downloadFile","getFile","getFileMetas","getFileThumbnail","updateFileMeta","QueryClientParam","getFileUploadToken","QUERY_KEY","HOUR","getFileMetasRpc","method","validator","handler","data","getFileThumbnailRpc","getFileRpc","downloadFileRpc","updateFileMetaRpc","deleteFileRpc","batchDeleteFilesRpc","baseOptions","staleTime","gcTime","refetchOnWindowFocus","responseToObjectUrl","response","Response","Promise","blob","URL","createObjectURL","saveBlob","Blob","fileName","url","anchor","document","createElement","href","download","click","revokeObjectURL","fileMetasQueryOptions","params","input","queryKey","appName","subId","queryFn","fileThumbnailQueryOptions","id","enabled","fileQueryOptions","downloadFileMutationOptions","mutationFn","fileExtension","openFileMutationOptions","target","current","Window","Error","onSuccess","source","popup","opener","location","window","open","onError","close","updateFileMetaMutationOptions","queryClient","onSettled","invalidateQueries","exact","deleteFileMutationOptions","batchDeleteFilesMutationOptions","uploadFileMutationOptions","file","setProgress","progress","token","endpoint","resolve","reject","upload","chunkSize","metadata","filename","name","filetype","type","headers","Authorization","onProgress","bytesUploaded","bytesTotal","start","result"],"sources":["../src/server/actions/file.ts","../src/data/client/file.ts"],"sourcesContent":["import { createServerFn } from \"@tanstack/react-start\";\nimport { serverEnv } from \"~/env\";\nimport { getAccessToken, getAppToken } from \"~/lib/auth/tokens\";\nimport { getSessionUser } from \"~/lib/auth/user\";\n\nexport const getFileUploadToken = createServerFn({ method: \"GET\" }).handler(async () => ({\n token: (await getSessionUser()) ? await getAccessToken(\"file\") : await getAppToken(\"file\"),\n endpoint: `${serverEnv.FILE_BASE_URL}/v1/upload`,\n}));\n","import { mutationOptions, queryOptions } from \"@tanstack/react-query\";\nimport { createServerFn } from \"@tanstack/react-start\";\nimport { Upload } from \"tus-js-client\";\nimport { uuidv7 } from \"uuidv7\";\nimport type { z } from \"zod\";\nimport type { UploadFileMetaSchema, UploadFileResult } from \"~/data/server/file\";\nimport {\n FileSchema,\n GetFileMetasSchema,\n UpdateFileMetaSchema,\n batchDeleteFiles,\n deleteFile,\n downloadFile,\n getFile,\n getFileMetas,\n getFileThumbnail,\n updateFileMeta,\n} from \"~/data/server/file\";\nimport type { QueryClientParam } from \"~/models/QueryClientParam\";\nimport { getFileUploadToken } from \"~/server/actions/file\";\n\nconst QUERY_KEY = \"file\";\nconst HOUR = 1000 * 60 * 60;\n\nconst getFileMetasRpc = createServerFn({ method: \"GET\" })\n .validator(GetFileMetasSchema)\n .handler(({ data }) => getFileMetas({ data }));\n\nconst getFileThumbnailRpc = createServerFn({ method: \"GET\" })\n .validator(FileSchema)\n .handler(({ data }) => getFileThumbnail({ data }));\n\nconst getFileRpc = createServerFn({ method: \"GET\" })\n .validator(FileSchema)\n .handler(({ data }) => getFile({ data }));\n\nconst downloadFileRpc = createServerFn({ method: \"GET\" })\n .validator(FileSchema)\n .handler(({ data }) => downloadFile({ data }));\n\nconst updateFileMetaRpc = createServerFn({ method: \"POST\" })\n .validator(UpdateFileMetaSchema)\n .handler(({ data }) => updateFileMeta({ data }));\n\nconst deleteFileRpc = createServerFn({ method: \"POST\" })\n .validator(FileSchema)\n .handler(({ data }) => deleteFile({ data }));\n\nconst batchDeleteFilesRpc = createServerFn({ method: \"POST\" })\n .validator(GetFileMetasSchema)\n .handler(({ data }) => batchDeleteFiles({ data }));\n\nconst baseOptions = {\n staleTime: HOUR,\n gcTime: HOUR,\n refetchOnWindowFocus: false,\n};\n\nasync function responseToObjectUrl(response: Response): Promise<string> {\n const blob = await response.blob();\n return URL.createObjectURL(blob);\n}\n\nfunction saveBlob(blob: Blob, fileName: string): void {\n const url = URL.createObjectURL(blob);\n const anchor = document.createElement(\"a\");\n anchor.href = url;\n anchor.download = fileName;\n anchor.click();\n URL.revokeObjectURL(url);\n}\n\nexport const fileMetasQueryOptions = (params: z.input<typeof GetFileMetasSchema>) =>\n queryOptions({\n queryKey: [QUERY_KEY, \"meta\", params.appName, params.subId],\n queryFn: () => getFileMetasRpc({ data: params }),\n ...baseOptions,\n });\n\nexport const fileThumbnailQueryOptions = (params: z.input<typeof FileSchema>) =>\n queryOptions({\n queryKey: [QUERY_KEY, \"thumbnail\", params.appName, params.id],\n queryFn: async () => responseToObjectUrl(await getFileThumbnailRpc({ data: params })),\n enabled: !!params.id,\n ...baseOptions,\n });\n\nexport const fileQueryOptions = (params: z.input<typeof FileSchema>) =>\n queryOptions({\n queryKey: [QUERY_KEY, params.appName, params.id],\n queryFn: async () => responseToObjectUrl(await downloadFileRpc({ data: params })),\n enabled: !!params.id,\n ...baseOptions,\n });\n\nexport const downloadFileMutationOptions = () =>\n mutationOptions({\n mutationFn: async (\n data: z.input<typeof FileSchema> & { fileName: string; fileExtension: string },\n ) => {\n const response = await downloadFileRpc({ data });\n saveBlob(await response.blob(), `${data.fileName}.${data.fileExtension}`);\n },\n });\n\nexport const openFileMutationOptions = ({ target }: { target: { current: Window | null } }) =>\n mutationOptions<string, Error, z.input<typeof FileSchema>>({\n mutationFn: async (data) => responseToObjectUrl(await getFileRpc({ data })),\n onSuccess: (source) => {\n const popup = target.current;\n target.current = null;\n\n if (popup) {\n popup.opener = null;\n popup.location.href = source;\n } else {\n window.open(source, \"_blank\");\n }\n },\n onError: () => {\n target.current?.close();\n target.current = null;\n },\n });\n\nexport const updateFileMetaMutationOptions = ({ queryClient }: QueryClientParam) =>\n mutationOptions({\n mutationFn: (data: z.input<typeof UpdateFileMetaSchema>) => updateFileMetaRpc({ data }),\n onSettled: () => queryClient.invalidateQueries({ queryKey: [QUERY_KEY, \"meta\"], exact: false }),\n });\n\nexport const deleteFileMutationOptions = ({ queryClient }: QueryClientParam) =>\n mutationOptions({\n mutationFn: (data: z.input<typeof FileSchema>) => deleteFileRpc({ data }),\n onSettled: () => queryClient.invalidateQueries({ queryKey: [QUERY_KEY, \"meta\"], exact: false }),\n });\n\nexport const batchDeleteFilesMutationOptions = ({ queryClient }: QueryClientParam) =>\n mutationOptions({\n mutationFn: (data: z.input<typeof GetFileMetasSchema>) => batchDeleteFilesRpc({ data }),\n onSettled: () => queryClient.invalidateQueries({ queryKey: [QUERY_KEY, \"meta\"], exact: false }),\n });\n\nexport const uploadFileMutationOptions = ({ queryClient }: QueryClientParam) =>\n mutationOptions({\n mutationFn: async ({\n id = uuidv7(),\n appName,\n subId,\n file,\n setProgress,\n }: z.input<typeof UploadFileMetaSchema> & {\n setProgress?: (progress: number) => void;\n }): Promise<UploadFileResult> => {\n const { token, endpoint } = await getFileUploadToken();\n\n await new Promise<void>((resolve, reject) => {\n const upload = new Upload(file, {\n endpoint,\n chunkSize: 1_048_576,\n metadata: {\n id,\n appName: appName,\n subId: subId,\n filename: file.name,\n filetype: file.type,\n },\n headers: { Authorization: `Bearer ${token}` },\n onProgress: (bytesUploaded, bytesTotal) =>\n setProgress?.((bytesUploaded / bytesTotal) * 100),\n onError: reject,\n onSuccess: () => resolve(),\n });\n upload.start();\n });\n\n return { id, appName, subId, fileName: file.name };\n },\n onSuccess: (result) =>\n queryClient.invalidateQueries({\n queryKey: [QUERY_KEY, \"meta\", result.appName, result.subId],\n exact: false,\n }),\n });\n"],"mappings":";;;;;;;;AAKA,MAAaK,qBAAqBL,eAAe,EAAEM,QAAQ,MAAM,CAAC,CAAC,CAACC,QAAQ,aAAa;CACvFC,OAAQ,MAAMJ,eAAe,IAAK,MAAMF,eAAe,MAAM,IAAI,MAAMC,YAAY,MAAM;CACzFM,UAAU,GAAGR,UAAUS,cAAa;AACtC,EAAE;;;ACaF,MAAMqB,YAAY;AAClB,MAAMC,OAAO;AAEb,MAAMC,kBAAkBpB,eAAe,EAAEqB,QAAQ,MAAM,CAAC,CAAC,CACtDC,UAAUf,kBAAkB,CAAC,CAC7BgB,SAAS,EAAEC,WAAW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C3B,CACAE,CAAM,CAACY,MAAM;EACf,CAAC;EAED,OAAO;GAAE/C;GAAIJ;GAASC;GAAOd,UAAU6C,KAAKW;EAAK;CACnD;CACA5B,YAAYqC,WACV3B,YAAYE,kBAAkB;EAC5B5B,UAAU;GAACtC;GAAW;GAAQ2F,OAAOpD;GAASoD,OAAOnD;EAAK;EAC1D2B,OAAO;CACT,CAAC;AACL,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"file-Dl8JCcqy.mjs","names":["createServerOnlyFn","AxiosResponse","https","Readable","DefaultHttpStack","Upload","z","serverEnv","uuidv7","getAccessToken","getAppToken","getSessionUser","createApi","FileMeta","FileMetaSchema","GetFileMetasSchema","object","appName","string","min","max","subId","uuid","FileSchema","id","UpdateFileMetaSchema","extend","fileName","DeleteFileSchema","BatchDeleteFilesSchema","UploadFileResult","UploadFileMetaSchema","default","file","instanceof","File","fileApi","baseURL","scopeKey","toFileResponse","response","disposition","Response","headers","Headers","String","contentLength","set","toWeb","data","ReadableStream","getFileMetas","input","Promise","Array","parse","queryParams","URLSearchParams","append","api","fileMetas","request","url","toString","method","getFileThumbnail","responseType","getFile","downloadFile","updateFileMeta","deleteFile","batchDeleteFiles","insecureHttpsAgent","Agent","rejectUnauthorized","uploadFile","accessToken","stream","fromWeb","resolve","reject","upload","endpoint","FILE_BASE_URL","httpStack","agent","uploadSize","size","chunkSize","metadata","filename","name","filetype","type","Authorization","onError","onSuccess","start","z"],"sources":["../src/data/server/file.ts"],"sourcesContent":["import { createServerOnlyFn } from \"@tanstack/react-start\";\nimport type { AxiosResponse } from \"axios\";\nimport https from \"node:https\";\nimport { Readable } from \"node:stream\";\nimport { DefaultHttpStack, Upload } from \"tus-js-client\";\nimport { z } from \"zod\";\nimport { serverEnv } from \"~/env\";\nimport { uuidv7 } from \"~/exports/utils\";\nimport { getAccessToken, getAppToken } from \"~/lib/auth/tokens\";\nimport { getSessionUser } from \"~/lib/auth/user\";\nimport { createApi } from \"~/lib/createApi\";\nimport type { FileMeta } from \"~/models/file/FileMeta\";\nimport { FileMetaSchema } from \"~/models/file/FileMeta\";\n\nexport const GetFileMetasSchema = z.object({\n appName: z.string().min(1).max(255),\n subId: z.uuid(),\n});\n\nexport const FileSchema = z.object({\n appName: z.string().min(1).max(255),\n id: z.uuid(),\n});\n\nexport const UpdateFileMetaSchema = FileMetaSchema.extend({\n fileName: z.string().min(1).max(255),\n});\n\nconst DeleteFileSchema = FileSchema;\n\nconst BatchDeleteFilesSchema = GetFileMetasSchema;\n\nexport interface UploadFileResult {\n id: string;\n appName: string;\n subId: string;\n fileName: string;\n}\n\nexport const UploadFileMetaSchema = z.object({\n id: z.uuid().default(uuidv7),\n appName: z.string().min(1).max(255),\n subId: z.uuid(),\n file: z.instanceof(File),\n});\n\nconst fileApi = () => createApi({ baseURL: \"FILE_BASE_URL\", scopeKey: \"file\" });\n\nfunction toFileResponse(response: AxiosResponse<Readable>, disposition?: string): Response {\n const headers = new Headers({\n \"Cache-Control\": \"private, max-age=3600, immutable\",\n \"Content-Type\": String(response.headers[\"content-type\"] ?? \"application/octet-stream\"),\n });\n const contentLength = response.headers[\"content-length\"];\n if (contentLength) headers.set(\"Content-Length\", String(contentLength));\n if (disposition) headers.set(\"Content-Disposition\", disposition);\n\n return new Response(Readable.toWeb(response.data) as ReadableStream, { headers });\n}\n\nexport const getFileMetas = createServerOnlyFn(\n async ({ data }: { data: z.input<typeof GetFileMetasSchema> }): Promise<Array<FileMeta>> => {\n const input = GetFileMetasSchema.parse(data);\n const queryParams = new URLSearchParams();\n queryParams.append(\"appName\", input.appName);\n queryParams.append(\"subId\", input.subId);\n\n const api = await fileApi();\n const { data: fileMetas } = await api.request<Array<FileMeta>>({\n url: `/v1/meta?${queryParams.toString()}`,\n method: \"GET\",\n });\n return fileMetas;\n },\n);\n\nexport const getFileThumbnail = createServerOnlyFn(\n async ({ data }: { data: z.input<typeof FileSchema> }): Promise<Response> => {\n const input = FileSchema.parse(data);\n const queryParams = new URLSearchParams();\n queryParams.append(\"appName\", input.appName);\n queryParams.append(\"id\", input.id);\n\n const api = await fileApi();\n const response = await api.request<Readable>({\n url: `/v1/thumbnail?${queryParams.toString()}`,\n method: \"GET\",\n responseType: \"stream\",\n });\n\n return toFileResponse(response);\n },\n);\n\nexport const getFile = createServerOnlyFn(\n async ({ data }: { data: z.input<typeof FileSchema> }): Promise<Response> => {\n const input = FileSchema.parse(data);\n const queryParams = new URLSearchParams();\n queryParams.append(\"appName\", input.appName);\n queryParams.append(\"id\", input.id);\n\n const api = await fileApi();\n const response = await api.request<Readable>({\n url: `/v1?${queryParams.toString()}`,\n method: \"GET\",\n responseType: \"stream\",\n });\n\n return toFileResponse(response, \"inline\");\n },\n);\n\nexport const downloadFile = createServerOnlyFn(\n async ({ data }: { data: z.input<typeof FileSchema> }): Promise<Response> => {\n const input = FileSchema.parse(data);\n const queryParams = new URLSearchParams();\n queryParams.append(\"appName\", input.appName);\n queryParams.append(\"id\", input.id);\n\n const api = await fileApi();\n const response = await api.request<Readable>({\n url: `/v1/download?${queryParams.toString()}`,\n method: \"GET\",\n responseType: \"stream\",\n });\n\n return toFileResponse(response);\n },\n);\n\nexport const updateFileMeta = createServerOnlyFn(\n async ({ data }: { data: z.input<typeof UpdateFileMetaSchema> }): Promise<void> => {\n const input = UpdateFileMetaSchema.parse(data);\n const queryParams = new URLSearchParams();\n queryParams.append(\"appName\", input.appName);\n queryParams.append(\"id\", input.id);\n\n const api = await fileApi();\n await api.request({ url: `/v1/meta?${queryParams.toString()}`, method: \"PUT\", data: input });\n },\n);\n\nexport const deleteFile = createServerOnlyFn(\n async ({ data }: { data: z.input<typeof DeleteFileSchema> }): Promise<void> => {\n const input = DeleteFileSchema.parse(data);\n const queryParams = new URLSearchParams();\n queryParams.append(\"appName\", input.appName);\n queryParams.append(\"id\", input.id);\n\n const api = await fileApi();\n await api.request({ url: `/v1?${queryParams.toString()}`, method: \"DELETE\" });\n },\n);\n\nexport const batchDeleteFiles = createServerOnlyFn(\n async ({ data }: { data: z.input<typeof BatchDeleteFilesSchema> }): Promise<void> => {\n const input = BatchDeleteFilesSchema.parse(data);\n const queryParams = new URLSearchParams();\n queryParams.append(\"appName\", input.appName);\n queryParams.append(\"subId\", input.subId);\n\n const api = await fileApi();\n await api.request({ url: `/v1?${queryParams.toString()}`, method: \"DELETE\" });\n },\n);\n\nconst insecureHttpsAgent = new https.Agent({ rejectUnauthorized: false });\n\nexport const uploadFile = createServerOnlyFn(\n async ({ data }: { data: z.input<typeof UploadFileMetaSchema> }): Promise<UploadFileResult> => {\n const input = UploadFileMetaSchema.parse(data);\n const accessToken = (await getSessionUser())\n ? await getAccessToken(\"file\")\n : await getAppToken(\"file\");\n const stream = Readable.fromWeb(\n input.file.stream() as import(\"node:stream/web\").ReadableStream,\n );\n\n await new Promise<void>((resolve, reject) => {\n const upload = new Upload(stream, {\n endpoint: `${serverEnv.FILE_BASE_URL}/v1/upload`,\n httpStack: new DefaultHttpStack({ agent: insecureHttpsAgent }),\n uploadSize: input.file.size,\n chunkSize: 1_048_576,\n metadata: {\n id: input.id,\n appName: input.appName,\n subId: input.subId,\n filename: input.file.name,\n filetype: input.file.type,\n },\n headers: { Authorization: `Bearer ${accessToken}` },\n onError: reject,\n onSuccess: () => resolve(),\n });\n upload.start();\n });\n\n return {\n id: input.id,\n appName: input.appName,\n subId: input.subId,\n fileName: input.file.name,\n };\n },\n);\n"],"mappings":";;;;;;;;;;;AAcA,MAAae,qBAAqBT,IAAEU,OAAO;CACzCC,SAASX,IAAEY,OAAO,CAAC,CAACC,IAAI,CAAC,CAAC,CAACC,IAAI,GAAG;CAClCC,OAAOf,IAAEgB,KAAK;AAChB,CAAC;AAED,MAAaC,aAAajB,IAAEU,OAAO;CACjCC,SAASX,IAAEY,OAAO,CAAC,CAACC,IAAI,CAAC,CAAC,CAACC,IAAI,GAAG;CAClCI,IAAIlB,IAAEgB,KAAK;AACb,CAAC;AAED,MAAaG,uBAAuBX,eAAeY,OAAO,E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MAAMnB,KAAK4C,OAAO,CACpB;CAEA,MAAM,IAAIxB,SAAe0B,SAASC,WAAW;EAiB3CC,IAhBmB5E,OAAOwE,QAAQ;GAChCK,UAAU,GAAG3E,UAAU4E,cAAa;GACpCC,WAAW,IAAIhF,iBAAiB,EAAEiF,OAAOb,mBAAmB,CAAC;GAC7Dc,YAAYlC,MAAMnB,KAAKsD;GACvBC,WAAW;GACXC,UAAU;IACRjE,IAAI4B,MAAM5B;IACVP,SAASmC,MAAMnC;IACfI,OAAO+B,MAAM/B;IACbqE,UAAUtC,MAAMnB,KAAK0D;IACrBC,UAAUxC,MAAMnB,KAAK4D;GACvB;GACAlD,SAAS,EAAEmD,eAAe,UAAUlB,cAAc;GAClDmB,SAASf;GACTgB,iBAAiBjB,QAAQ;EAC3B,CACAE,CAAM,CAACgB,MAAM;CACf,CAAC;CAED,OAAO;EACLzE,IAAI4B,MAAM5B;EACVP,SAASmC,MAAMnC;EACfI,OAAO+B,MAAM/B;EACbM,UAAUyB,MAAMnB,KAAK0D;CACvB;AACF,CACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"peoplesoft-BhintHQz.mjs","names":["createServerOnlyFn","z","createApi","Department","Employee","SearchEmployeesSchema","object","searchTerm","string","min","EmployeeIdSchema","employeeId","DepartmentIdSchema","departmentId","CompanyCodeSchema","companyCode","peoplesoftApi","baseURL","scopeKey","searchEmployees","data","input","Promise","Array","parse","api","employees","request","url","encodeURIComponent","method","getEmployees","getActiveEmployees","getEmployeeByEmployeeId","employee","getPreviousEmployeeIds","getEmployeeSupervisor","getEmployeeSubordinates","getEmployeeManager","getEmployeeGeneralManager","getDepartments","departments","getDepartmentById","department","getDepartmentManager","getDepartmentEmployees","getCompanyGeneralManager","z"],"sources":["../src/data/server/peoplesoft.ts"],"sourcesContent":["import { createServerOnlyFn } from \"@tanstack/react-start\";\r\nimport { z } from \"zod\";\r\nimport { createApi } from \"~/lib/createApi\";\r\nimport type { Department } from \"~/models/peoplesoft/Department\";\r\nimport type { Employee } from \"~/models/peoplesoft/Employee\";\r\n\r\nexport const SearchEmployeesSchema = z.object({\r\n searchTerm: z.string().min(1),\r\n});\r\n\r\nexport const EmployeeIdSchema = z.object({\r\n employeeId: z.string().min(1),\r\n});\r\n\r\nexport const DepartmentIdSchema = z.object({\r\n departmentId: z.string().min(1),\r\n});\r\n\r\nexport const CompanyCodeSchema = z.object({\r\n companyCode: z.string().min(1),\r\n});\r\n\r\nconst peoplesoftApi = () => createApi({ baseURL: \"PEOPLESOFT_BASE_URL\", scopeKey: \"peoplesoft\" });\r\n\r\nexport const searchEmployees = createServerOnlyFn(\r\n async ({ data }: { data: z.input<typeof SearchEmployeesSchema> }): Promise<Array<Employee>> => {\r\n const input = SearchEmployeesSchema.parse(data);\r\n const api = await peoplesoftApi();\r\n const { data: employees } = await api.request<Array<Employee>>({\r\n url: `/v1/employee?search=${encodeURIComponent(input.searchTerm)}`,\r\n method: \"GET\",\r\n });\r\n return employees;\r\n },\r\n);\r\n\r\nexport const getEmployees = createServerOnlyFn(async (): Promise<Array<Employee>> => {\r\n const api = await peoplesoftApi();\r\n const { data: employees } = await api.request<Array<Employee>>({\r\n url: `/v1/employee/all`,\r\n method: \"GET\",\r\n });\r\n return employees;\r\n});\r\n\r\nexport const getActiveEmployees = createServerOnlyFn(async (): Promise<Array<Employee>> => {\r\n const api = await peoplesoftApi();\r\n const { data: employees } = await api.request<Array<Employee>>({\r\n url: `/v1/employee/active`,\r\n method: \"GET\",\r\n });\r\n return employees;\r\n});\r\n\r\nexport const getEmployeeByEmployeeId = createServerOnlyFn(\r\n async ({ data }: { data: z.input<typeof EmployeeIdSchema> }): Promise<Employee> => {\r\n const input = EmployeeIdSchema.parse(data);\r\n const api = await peoplesoftApi();\r\n const { data: employee } = await api.request<Employee>({\r\n url: `/v1/employee/${encodeURIComponent(input.employeeId)}`,\r\n method: \"GET\",\r\n });\r\n return employee;\r\n },\r\n);\r\n\r\nexport const getPreviousEmployeeIds = createServerOnlyFn(async (): Promise<Array<Employee>> => {\r\n const api = await peoplesoftApi();\r\n const { data: employees } = await api.request<Array<Employee>>({\r\n url: `/v1/employee/previousIds`,\r\n method: \"GET\",\r\n });\r\n return employees;\r\n});\r\n\r\nexport const getEmployeeSupervisor = createServerOnlyFn(\r\n async ({ data }: { data: z.input<typeof EmployeeIdSchema> }): Promise<Employee> => {\r\n const input = EmployeeIdSchema.parse(data);\r\n const api = await peoplesoftApi();\r\n const { data: employee } = await api.request<Employee>({\r\n url: `/v1/employee/${encodeURIComponent(input.employeeId)}/supervisor`,\r\n method: \"GET\",\r\n });\r\n return employee;\r\n },\r\n);\r\n\r\nexport const getEmployeeSubordinates = createServerOnlyFn(\r\n async ({ data }: { data: z.input<typeof EmployeeIdSchema> }): Promise<Array<Employee>> => {\r\n const input = EmployeeIdSchema.parse(data);\r\n const api = await peoplesoftApi();\r\n const { data: employees } = await api.request<Array<Employee>>({\r\n url: `/v1/employee/${encodeURIComponent(input.employeeId)}/subordinates`,\r\n method: \"GET\",\r\n });\r\n return employees;\r\n },\r\n);\r\n\r\nexport const getEmployeeManager = createServerOnlyFn(\r\n async ({ data }: { data: z.input<typeof EmployeeIdSchema> }): Promise<Employee> => {\r\n const input = EmployeeIdSchema.parse(data);\r\n const api = await peoplesoftApi();\r\n const { data: employee } = await api.request<Employee>({\r\n url: `/v1/employee/${encodeURIComponent(input.employeeId)}/manager`,\r\n method: \"GET\",\r\n });\r\n return employee;\r\n },\r\n);\r\n\r\nexport const getEmployeeGeneralManager = createServerOnlyFn(\r\n async ({ data }: { data: z.input<typeof EmployeeIdSchema> }): Promise<Employee> => {\r\n const input = EmployeeIdSchema.parse(data);\r\n const api = await peoplesoftApi();\r\n const { data: employee } = await api.request<Employee>({\r\n url: `/v1/employee/${encodeURIComponent(input.employeeId)}/generalManager`,\r\n method: \"GET\",\r\n });\r\n return employee;\r\n },\r\n);\r\n\r\nexport const getDepartments = createServerOnlyFn(async (): Promise<Array<Department>> => {\r\n const api = await peoplesoftApi();\r\n const { data: departments } = await api.request<Array<Department>>({\r\n url: `/v1/department/all`,\r\n method: \"GET\",\r\n });\r\n return departments;\r\n});\r\n\r\nexport const getDepartmentById = createServerOnlyFn(\r\n async ({ data }: { data: z.input<typeof DepartmentIdSchema> }): Promise<Department> => {\r\n const input = DepartmentIdSchema.parse(data);\r\n const api = await peoplesoftApi();\r\n const { data: department } = await api.request<Department>({\r\n url: `/v1/department/${encodeURIComponent(input.departmentId)}`,\r\n method: \"GET\",\r\n });\r\n return department;\r\n },\r\n);\r\n\r\nexport const getDepartmentManager = createServerOnlyFn(\r\n async ({ data }: { data: z.input<typeof DepartmentIdSchema> }): Promise<Employee> => {\r\n const input = DepartmentIdSchema.parse(data);\r\n const api = await peoplesoftApi();\r\n const { data: employee } = await api.request<Employee>({\r\n url: `/v1/department/${encodeURIComponent(input.departmentId)}/manager`,\r\n method: \"GET\",\r\n });\r\n return employee;\r\n },\r\n);\r\n\r\nexport const getDepartmentEmployees = createServerOnlyFn(\r\n async ({ data }: { data: z.input<typeof DepartmentIdSchema> }): Promise<Array<Employee>> => {\r\n const input = DepartmentIdSchema.parse(data);\r\n const api = await peoplesoftApi();\r\n const { data: employees } = await api.request<Array<Employee>>({\r\n url: `/v1/department/${encodeURIComponent(input.departmentId)}/employees`,\r\n method: \"GET\",\r\n });\r\n return employees;\r\n },\r\n);\r\n\r\nexport const getCompanyGeneralManager = createServerOnlyFn(\r\n async ({ data }: { data: z.input<typeof CompanyCodeSchema> }): Promise<Employee> => {\r\n const input = CompanyCodeSchema.parse(data);\r\n const api = await peoplesoftApi();\r\n const { data: employee } = await api.request<Employee>({\r\n url: `/v1/company/${encodeURIComponent(input.companyCode)}/generalManager`,\r\n method: \"GET\",\r\n });\r\n return employee;\r\n },\r\n);\r\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAMA,MAAaK,wBAAwBJ,IAAEK,OAAO,EAC5CC,YAAYN,IAAEO,OAAO,CAAC,CAACC,IAAI,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rDC,KAAK,eAAeC,mBAAmBR,MAAMN,WAAW,EAAC;EACzDe,QAAQ;CACV,CAAC;CACD,OAAOI;AACT,CACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"providers-BvuZWkpD.mjs","names":["jose","scopes","definedScopes","serverEnv","Scope","ProviderId","Provider","id","label","clientId","clientSecret","issuer","authorizeEndpoint","tokenEndpoint","loginScopes","ReadonlyArray","audience","jwks","ReturnType","createRemoteJWKSet","logoutUrl","returnTo","entraAuthority","ENTRA_TENANT_ID","entra","ENTRA_CLIENT_ID","ENTRA_CLIENT_SECRET","URL","encodeURIComponent","awsResourceScopes","Set","Object","values","Record","map","entry","undefined","aws","filter","scope","buildAws","AWS_ISSUER","AWS_DOMAIN","AWS_CLIENT_ID","AWS_CLIENT_SECRET","providers","getProvider","provider","find","candidate","Error","getProviderByIssuer","definedScopes"],"sources":["../src/lib/auth/providers.ts"],"sourcesContent":["import * as jose from \"jose\";\nimport { scopes as definedScopes } from \"virtual:wcz-layout\";\nimport { serverEnv } from \"~/env\";\nimport type { Scope } from \"~/models/Scopes\";\nimport type { ProviderId } from \"~/models/User\";\n\n/**\n * Identity providers, server-side only. Entra is always present; AWS registers\n * itself when its env vars are set, so an Entra-only app is unchanged and the\n * login page renders a single button.\n */\nexport interface Provider {\n id: ProviderId;\n label: string;\n clientId: string;\n clientSecret: string;\n /** The `iss` claim, used to pick the right provider for an incoming Bearer. */\n issuer: string;\n authorizeEndpoint: string;\n tokenEndpoint: string;\n loginScopes: ReadonlyArray<string>;\n /**\n * Expected `aud` for incoming Bearer JWTs. Undefined for Cognito: its access\n * tokens carry `client_id`, not `aud`, so the user pool itself is the trust\n * boundary — any client in the pool is accepted.\n * ponytail: pool-wide trust; add a client_id allowlist if other pools' clients\n * could ever reach this app.\n */\n audience?: string;\n jwks: ReturnType<typeof jose.createRemoteJWKSet>;\n logoutUrl: (returnTo: string) => string;\n}\n\nconst entraAuthority = `https://login.microsoftonline.com/${serverEnv.ENTRA_TENANT_ID}`;\n\nconst entra: Provider = {\n id: \"entra\",\n label: \"Microsoft\",\n clientId: serverEnv.ENTRA_CLIENT_ID,\n clientSecret: serverEnv.ENTRA_CLIENT_SECRET,\n issuer: `${entraAuthority}/v2.0`,\n authorizeEndpoint: `${entraAuthority}/oauth2/v2.0/authorize`,\n tokenEndpoint: `${entraAuthority}/oauth2/v2.0/token`,\n // `offline_access` yields the multi-resource refresh token every delegated API\n // token is minted from; `User.Read` covers the Graph profile photo.\n loginScopes: [\"openid\", \"profile\", \"offline_access\", \"User.Read\"],\n audience: serverEnv.ENTRA_CLIENT_ID,\n jwks: jose.createRemoteJWKSet(new URL(`${entraAuthority}/discovery/v2.0/keys`)),\n logoutUrl: (returnTo) =>\n `${entraAuthority}/oauth2/v2.0/logout?post_logout_redirect_uri=${encodeURIComponent(returnTo)}`,\n};\n\n/**\n * Cognito cannot widen scopes after login, so every AWS scope the app will ever\n * ask for has to be requested up front. Derived from `scopes.ts` rather than\n * configured separately, so the two can't drift.\n */\nconst awsResourceScopes = [\n ...new Set(\n Object.values(definedScopes as Record<string, Scope>)\n .map((entry) => (typeof entry === \"string\" ? undefined : entry.aws))\n .filter((scope) => scope !== undefined),\n ),\n];\n\nconst buildAws = (): Provider | null => {\n const { AWS_ISSUER, AWS_DOMAIN, AWS_CLIENT_ID, AWS_CLIENT_SECRET } = serverEnv;\n if (!AWS_ISSUER || !AWS_DOMAIN || !AWS_CLIENT_ID || !AWS_CLIENT_SECRET) return null;\n\n return {\n id: \"aws\",\n label: \"AWS\",\n clientId: AWS_CLIENT_ID,\n clientSecret: AWS_CLIENT_SECRET,\n issuer: AWS_ISSUER,\n authorizeEndpoint: `${AWS_DOMAIN}/oauth2/authorize`,\n tokenEndpoint: `${AWS_DOMAIN}/oauth2/token`,\n loginScopes: [\"openid\", \"email\", \"phone\"], // TODO: [\"openid\", \"email\", \"phone\", ...awsResourceScopes]\n jwks: jose.createRemoteJWKSet(new URL(`${AWS_ISSUER}/.well-known/jwks.json`)),\n logoutUrl: (returnTo) =>\n `${AWS_DOMAIN}/logout?client_id=${AWS_CLIENT_ID}&logout_uri=${encodeURIComponent(returnTo)}`,\n };\n};\n\nconst aws = buildAws();\n\nexport const providers: ReadonlyArray<Provider> = aws ? [entra, aws] : [entra];\n\nexport const getProvider = (id: ProviderId): Provider => {\n const provider = providers.find((candidate) => candidate.id === id);\n if (!provider) throw new Error(`Identity provider \"${id}\" is not configured.`);\n return provider;\n};\n\nexport const getProviderByIssuer = (issuer: string | undefined): Provider | undefined =>\n providers.find((candidate) => candidate.issuer === issuer);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAiCA,MAAMsB,iBAAiB,qCAAqCnB,UAAUoB;AAEtE,MAAMC,QAAkB;CACtBjB,IAAI;CACJC,OAAO;CACPC,UAAUN,UAAUsB;CACpBf,cAAcP,UAAUuB;CACxBf,QAAQ,GAAGW,eAAc;CACzBV,mBAAmB,GAAGU,eAAc;CACpCT,eAAe,GAAGS,eAAc;CAGhCR,aAAa;EAAC;EAAU;EAAW;EAAkB;CAAW;CAChEE,UAAUb,UAAUsB;CACpBR,MAAMjB,KAAKmB,mBAAmB,IAAIQ,IAAI,GAAGL,eAAc,qBAAsB,CAAC;CAC9EF,YAAYC,aACV,GAAGC,eAAc,+CAAgDM,mBAAmBP,QAAQ;AAChG;AAO0B,CACxB,GAAG,IAAIS,IACLC,OAAOC,OAAO9B,MAAsC,CAAC,CAClDgC,KAAKC,UAAW,OAAOA,UAAU,WAAWC,KAAAA,IAAYD,MAAME,GAAI,CAAC,CACnEC,QAAQC,UAAUA,UAAUH,KAAAA,CAAS,CAC1C,CAAC;AAGH,MAAMI,iBAAkC;CACtC,MAAM,EAAEC,YAAYC,YAAYC,eAAeC,sBAAsBzC;CACrE,IAAI,CAACsC,cAAc,CAACC,cAAc,CAACC,iBAAiB,CAACC,mBAAmB,OAAO;CAE/E,OAAO;EACLrC,IAAI;EACJC,OAAO;EACPC,UAAUkC;EACVjC,cAAckC;EACdjC,QAAQ8B;EACR7B,mBAAmB,GAAG8B,WAAU;EAChC7B,eAAe,GAAG6B,WAAU;EAC5B5B,aAAa;GAAC;GAAU;GAAS;EAAO;EACxCG,MAAMjB,KAAKmB,mBAAmB,IAAIQ,IAAI,GAAGc,WAAU,uBAAwB,CAAC;EAC5ErB,YAAYC,aACV,GAAGqB,WAAU,oBAAqBC,cAAa,cAAef,mBAAmBP,QAAQ;CAC7F;AACF;AAEA,MAAMgB,MAAMG,SAAS;AAErB,MAAaK,YAAqCR,MAAM,CAACb,OAAOa,GAAG,IAAI,CAACb,KAAK;AAE7E,MAAasB,eAAevC,OAA6B;CACvD,MAAMwC,WAAWF,UAAUG,MAAMC,cAAcA,UAAU1C,OAAOA,EAAE;CAClE,IAAI,CAACwC,UAAU,MAAM,IAAIG,MAAM,sBAAsB3C,GAAE,qBAAsB;CAC7E,OAAOwC;AACT;AAEA,MAAaI,uBAAuBxC,WAClCkC,UAAUG,MAAMC,cAAcA,UAAUtC,WAAWA,MAAM"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tokens-XuFhVbh5.mjs","names":["createHash","randomBytes","randomUUID","Provider","SessionExpiredError","Error","TokenResponse","access_token","refresh_token","id_token","expires_in","base64url","bytes","Buffer","toString","createPkce","verifier","challenge","update","digest","createState","isSessionDead","error","suberror","requestToken","provider","body","Record","Promise","credentials","from","clientId","clientSecret","response","fetch","tokenEndpoint","method","headers","authorization","URLSearchParams","client_id","payload","json","ok","message","error_description","status","id","buildAuthUrl","opts","redirectUri","state","url","URL","authorizeEndpoint","search","response_type","redirect_uri","scope","loginScopes","join","code_challenge","code_challenge_method","exchangeCode","code","codeVerifier","grant_type","code_verifier","refreshTokens","refreshToken","clientCredentials","createServerOnlyFn","scopes","definedScopes","Scope","ProviderId","SessionExpiredError","clientCredentials","refreshTokens","getProvider","getAppSession","ScopeKey","resolveScope","key","provider","entry","scope","undefined","Error","getAccessToken","scopeKey","Promise","session","providerId","refreshToken","result","refresh_token","save","access_token","error","destroy","Response","json","message","status","appTokens","Map","token","expiresAt","getAppToken","cached","get","Date","now","defaultScope","slice","lastIndexOf","set","expires_in","definedScopes"],"sources":["../src/lib/auth/oidc.ts","../src/lib/auth/tokens.ts"],"sourcesContent":["import { createHash, randomBytes, randomUUID } from \"node:crypto\";\nimport type { Provider } from \"./providers\";\n\n/**\n * The whole OAuth2/OIDC surface this app needs, as plain form POSTs. Both Entra\n * and Cognito are ordinary OIDC servers, so a second provider is a config object\n * (see `providers.ts`) rather than a second integration.\n */\n\n/** The refresh token is expired/revoked — the user must sign in interactively. */\nexport class SessionExpiredError extends Error {}\n\nexport interface TokenResponse {\n access_token: string;\n refresh_token?: string;\n id_token?: string;\n expires_in: number;\n}\n\nconst base64url = (bytes: Buffer): string => bytes.toString(\"base64url\");\n\n/** PKCE verifier + S256 challenge for the authorization-code flow. */\nexport const createPkce = (): { verifier: string; challenge: string } => {\n const verifier = base64url(randomBytes(32));\n return { verifier, challenge: base64url(createHash(\"sha256\").update(verifier).digest()) };\n};\n\nexport const createState = (): string => randomUUID();\n\n/**\n * Revocation, inactivity expiry and Conditional Access sign-in frequency all\n * surface as `invalid_grant` or `interaction_required` — the session is dead and\n * only an interactive login helps. Missing consent (Entra AADSTS65001) looks the\n * same but is a configuration bug, so it is left to surface as-is.\n */\nconst isSessionDead = (error: { error?: string; suberror?: string }): boolean =>\n (error.error === \"invalid_grant\" || error.error === \"interaction_required\") &&\n error.suberror !== \"consent_required\";\n\nasync function requestToken(\n provider: Provider,\n body: Record<string, string>,\n): Promise<TokenResponse> {\n const credentials = Buffer.from(`${provider.clientId}:${provider.clientSecret}`).toString(\n \"base64\",\n );\n const response = await fetch(provider.tokenEndpoint, {\n method: \"POST\",\n headers: {\n \"content-type\": \"application/x-www-form-urlencoded\",\n // Both providers accept client_secret_basic; it keeps the secret out of the body.\n authorization: `Basic ${credentials}`,\n },\n body: new URLSearchParams({ client_id: provider.clientId, ...body }),\n });\n\n const payload = (await response.json()) as TokenResponse &\n Record<\"error\" | \"error_description\" | \"suberror\", string | undefined>;\n if (response.ok) return payload;\n\n const message = payload.error_description ?? payload.error ?? `HTTP ${response.status}`;\n if (isSessionDead(payload)) throw new SessionExpiredError(message);\n throw new Error(`[${provider.id}] ${message}`);\n}\n\n/** First leg of the auth-code flow: the URL to redirect the browser to. */\nexport function buildAuthUrl(\n provider: Provider,\n opts: { redirectUri: string; state: string; challenge: string },\n): string {\n const url = new URL(provider.authorizeEndpoint);\n url.search = new URLSearchParams({\n client_id: provider.clientId,\n response_type: \"code\",\n redirect_uri: opts.redirectUri,\n state: opts.state,\n scope: provider.loginScopes.join(\" \"),\n code_challenge: opts.challenge,\n code_challenge_method: \"S256\",\n }).toString();\n return url.toString();\n}\n\n/** Second leg: exchange the code for tokens. The refresh token is in the body. */\nexport const exchangeCode = (\n provider: Provider,\n opts: { code: string; redirectUri: string; codeVerifier: string },\n): Promise<TokenResponse> =>\n requestToken(provider, {\n grant_type: \"authorization_code\",\n code: opts.code,\n redirect_uri: opts.redirectUri,\n code_verifier: opts.codeVerifier,\n });\n\n/**\n * Delegated token for `scope`. Entra mints a token for any resource from its\n * multi-resource refresh token; Cognito can only narrow within the scopes already\n * registered on the app client, and ignores the rest.\n */\nexport const refreshTokens = (\n provider: Provider,\n opts: { refreshToken: string; scope: string },\n): Promise<TokenResponse> =>\n requestToken(provider, {\n grant_type: \"refresh_token\",\n refresh_token: opts.refreshToken,\n scope: opts.scope,\n });\n\n/** App-only token: no user context, for background jobs. */\nexport const clientCredentials = (\n provider: Provider,\n opts: { scope: string },\n): Promise<TokenResponse> =>\n requestToken(provider, { grant_type: \"client_credentials\", scope: opts.scope });\n","import { createServerOnlyFn } from \"@tanstack/react-start\";\nimport { scopes as definedScopes } from \"virtual:wcz-layout\";\nimport type { Scope } from \"~/models/Scopes\";\nimport type { ProviderId } from \"~/models/User\";\nimport { SessionExpiredError, clientCredentials, refreshTokens } from \"./oidc\";\nimport { getProvider } from \"./providers\";\nimport { getAppSession } from \"./session\";\n\nexport type ScopeKey = keyof typeof definedScopes;\n\n/**\n * A scope entry is either a bare string (Entra) or `{ entra, aws }`. Throwing on a\n * missing entry fails at the call site instead of sending a token the API rejects.\n */\nexport const resolveScope = (key: ScopeKey, provider: ProviderId): string => {\n const entry: Scope = definedScopes[key];\n const scope =\n typeof entry === \"string\" ? (provider === \"entra\" ? entry : undefined) : entry[provider];\n\n if (!scope) throw new Error(`No \"${key}\" scope is configured for the \"${provider}\" provider.`);\n return scope;\n};\n\n/**\n * Delegated access token for the signed-in user, minted from the session refresh\n * token. Providers that rotate the refresh token return a new one, which is\n * persisted back. Server-only — stripped from the client bundle.\n */\nexport const getAccessToken = createServerOnlyFn(async (scopeKey: ScopeKey): Promise<string> => {\n const session = await getAppSession();\n const { provider: providerId, refreshToken } = session;\n if (!providerId || !refreshToken) throw new Error(\"No active session. User not signed in.\");\n\n try {\n const result = await refreshTokens(getProvider(providerId), {\n refreshToken,\n scope: resolveScope(scopeKey, providerId),\n });\n if (result.refresh_token && result.refresh_token !== refreshToken) {\n session.refreshToken = result.refresh_token;\n await session.save();\n }\n return result.access_token;\n } catch (error) {\n // Revoked/expired refresh token: clear the dead session and answer 401 so the\n // client can redirect to /login, instead of surfacing a 500.\n if (error instanceof SessionExpiredError) {\n session.destroy();\n throw Response.json(\n { message: \"Unauthorized: Session expired, sign in again\" },\n { status: 401 },\n );\n }\n throw error;\n }\n});\n\n// MSAL used to cache these in memory; without it, a small TTL map keeps parity.\nconst appTokens = new Map<ScopeKey, { token: string; expiresAt: number }>();\n\n/**\n * Client-credentials (app-only) token, for background jobs with no user.\n * Entra-only: the AWS population signs in interactively, so a Cognito app client\n * for M2M has no caller yet (and Cognito bills M2M per token request).\n */\nexport const getAppToken = createServerOnlyFn(async (scopeKey: ScopeKey): Promise<string> => {\n const cached = appTokens.get(scopeKey);\n if (cached && cached.expiresAt > Date.now()) return cached.token;\n\n // Entra client credentials only accept `<resource>/.default`, not user scopes.\n const scope = resolveScope(scopeKey, \"entra\");\n const defaultScope = `${scope.slice(0, scope.lastIndexOf(\"/\"))}/.default`;\n\n const result = await clientCredentials(getProvider(\"entra\"), { scope: defaultScope });\n appTokens.set(scopeKey, {\n token: result.access_token,\n expiresAt: Date.now() + (result.expires_in - 60) * 1000,\n });\n return result.access_token;\n});\n"],"mappings":";;;;;;;;;;;;AAUA,IAAaI,sBAAb,cAAyCC,MAAM,CAAA;AAS/C,MAAMM,aAAaC,UAA0BA,MAAME,SAAS,WAAW;;AAGvE,MAAaC,mBAA4D;CACvE,MAAMC,WAAWL,UAAUV,YAAY,EAAE,CAAC;CAC1C,OAAO;EAAEe;EAAUC,WAAWN,UAAUX,WAAW,QAAQ,CAAC,CAACkB,OAAOF,QAAQ,CAAC,CAACG,OAAO,CAAC;CAAE;AAC1F;AAEA,MAAaC,oBAA4BlB,WAAW;;;;;;;AAQpD,MAAMmB,iBAAiBC,WACpBA,MAAMA,UAAU,mBAAmBA,MAAMA,UAAU,2BACpDA,MAAMC,aAAa;AAErB,eAAeC,aACbC,UACAC,MACwB;CACxB,MAAMG,cAAchB,OAAOiB,KAAK,GAAGL,SAASM,SAAQ,GAAIN,SAASO,cAAc,CAAC,CAAClB,SAC/E,QACF;CACA,MAAMmB,WAAW,MAAMC,MAAMT,SAASU,eAAe;EACnDC,QAAQ;EACRC,SAAS;GACP,gBAAgB;GAEhBC,eAAe,SAAST;EAC1B;EACAH,MAAM,IAAIa,gBAAgB;GAAEC,WAAWf,SAASM;GAAU,GAAGL;EAAK,CAAC;CACrE,CAAC;CAED,MAAMe,UAAW,MAAMR,SAASS,KAAK;CAErC,IAAIT,SAASU,IAAI,OAAOF;CAExB,MAAMG,UAAUH,QAAQI,qBAAqBJ,QAAQnB,SAAS,QAAQW,SAASa;CAC/E,IAAIzB,cAAcoB,OAAO,GAAG,MAAM,IAAIrC,oBAAoBwC,OAAO;CACjE,MAAM,IAAIvC,MAAM,IAAIoB,SAASsB,GAAE,IAAKH,SAAS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,YAAYc,UAAU,GAAG;GAC1DC;GACAR,OAAOJ,aAAaQ,UAAUG,UAAU;EAC1C,CAAC;EACD,IAAIE,OAAOC,iBAAiBD,OAAOC,kBAAkBF,cAAc;GACjEF,QAAQE,eAAeC,OAAOC;GAC9B,MAAMJ,QAAQK,KAAK;EACrB;EACA,OAAOF,OAAOG;CAChB,SAASC,OAAO;EAGd,IAAIA,iBAAiBvB,qBAAqB;GACxCgB,QAAQQ,QAAQ;GAChB,MAAMC,SAASC,KACb,EAAEC,SAAS,+CAA+C,GAC1D,EAAEC,QAAQ,IAAI,CAChB;EACF;EACA,MAAML;CACR;AACF,CAAC;AAGD,MAAMM,4BAAY,IAAIC,IAAoD;;;;;;AAO1E,MAAaG,cAActC,mBAAmB,OAAOmB,aAAwC;CAC3F,MAAMoB,SAASL,UAAUM,IAAIrB,QAAQ;CACrC,IAAIoB,UAAUA,OAAOF,YAAYI,KAAKC,IAAI,GAAG,OAAOH,OAAOH;CAG3D,MAAMrB,QAAQJ,aAAaQ,UAAU,OAAO;CAC5C,MAAMwB,eAAe,GAAG5B,MAAM6B,MAAM,GAAG7B,MAAM8B,YAAY,GAAG,CAAC,EAAC;CAE9D,MAAMrB,SAAS,MAAMlB,kBAAkBE,YAAY,OAAO,GAAG,EAAEO,OAAO4B,aAAa,CAAC;CACpFT,UAAUY,IAAI3B,UAAU;EACtBiB,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-CaeVFWF-.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","ENTRA_TENANT_ID","ENTRA_CLIENT_SECRET","AWS_ISSUER","url","optional","AWS_DOMAIN","AWS_CLIENT_ID","AWS_CLIENT_SECRET","SESSION_SECRET","min","FILE_BASE_URL","APPROVAL_BASE_URL","PEOPLESOFT_BASE_URL","EMAIL_BASE_URL","AI_BASE_URL","AI_SUBSCRIPTION_KEY","process","z","IronSession","serverEnv","ProviderId","User","AppSessionData","provider","refreshToken","user","pkceVerifier","state","returnTo","AppSession","getAppSession","Promise","getIronSession","getCookie","setCookie","all","read","write","cookieName","password","SESSION_SECRET","chunk","cookieOptions","secure","process","env","NODE_ENV","sameSite","httpOnly","path","maxAge","undefined","queryOptions","createServerFn","QueryClientParam","ProviderId","User","OFFLINE_USER_KEY","withOfflineFallback","getAppSession","getSessionUser","method","handler","Promise","session","user","getLoginProviders","Array","id","label","providers","map","loginProvidersQueryOptions","queryKey","queryFn","staleTime","userQueryOptions","Infinity","networkMode","refetchOnReconnect","getUser","queryClient","import","meta","env","SSR","ensureQueryData","AnyFieldApi","redirect","ParsedLocation","manifest","permissions","QueryClientParam","TokenPayload","ProviderId","User","getUser","WISTRON_PRIMARY_COLOR","WISTRON_SECONDARY_COLOR","Platform","isAndroid","test","userAgent","isIOS","isWindows","isMacOS","navigator","RootRouteHeadOptions","rootRouteHead","options","meta","charSet","name","content","title","links","rel","sizes","href","type","GuardArgs","location","context","requireAuth","permissionKey","user","queryClient","encodeURIComponent","reloadDocument","hasPermission","Error","NON_PRODUCTION","isTestEnv","origin","split","slice","join","FormOmittedProps","getFieldStatus","field","state","isTouched","hasError","errors","length","helperText","message","sanitizeReturnTo","value","toKebabCase","str","replaceAll","toLowerCase","foldForSearch","String","normalize","permissionGroups","Set","Object","values","flat","buildUser","payload","provider","email","preferred_username","department","toUpperCase","employeeId","companyName","groups","filter","group","has","key","some","includes"],"sources":["../src/lib/auth/offline.ts","../src/env.ts","../src/lib/auth/session.ts","../src/lib/auth/user.ts","../src/lib/utils.ts"],"sourcesContent":["/**\n * Offline fallback for identity. The refresh token never leaves the sealed\n * httpOnly cookie — what is cached here is only the display snapshot (user\n * claims and avatar) so the UI and offline route permissions can still work\n * while the server is unreachable. Server requests remain independently\n * authorized. At-rest protection is the device's OS login and disk encryption.\n */\n\nexport const OFFLINE_USER_KEY = \"auth-user\";\nexport const OFFLINE_PHOTO_KEY = \"auth-photo\";\n\n/** One shift — matches Intune's default offline grace period. */\nconst GRACE_PERIOD = 12 * 60 * 60 * 1000;\n\ntype Cached<T> = { value: T; savedAt: number };\n\nconst recall = <T>(key: string): T | null => {\n if (typeof localStorage === \"undefined\") return null;\n try {\n const raw = localStorage.getItem(key);\n if (!raw) return null;\n const { value, savedAt } = JSON.parse(raw) as Cached<T>;\n if (Date.now() - savedAt > GRACE_PERIOD) {\n localStorage.removeItem(key);\n return null;\n }\n return value;\n } catch {\n localStorage.removeItem(key);\n return null;\n }\n};\n\nconst remember = (key: string, value: unknown): void => {\n if (typeof localStorage === \"undefined\") return;\n try {\n if (value === null || value === undefined) localStorage.removeItem(key);\n else localStorage.setItem(key, JSON.stringify({ value, savedAt: Date.now() }));\n } catch {\n // Storage full or blocked — the offline fallback is best-effort.\n }\n};\n\nconst isOfflineFailure = (error: unknown): boolean =>\n (typeof navigator !== \"undefined\" && !navigator.onLine) || error instanceof TypeError;\n\n/**\n * Answers from the server when reachable, remembering the result; when the call\n * has a transport failure, replays the last result instead, for up to\n * {@link GRACE_PERIOD} since it was last confirmed.\n *\n * Cached values are untrusted client state. Server authorization must never\n * depend on them.\n */\nexport const withOfflineFallback = async <T>(\n key: string,\n fetchFresh: () => Promise<T>,\n): Promise<T | null> => {\n try {\n const fresh = await fetchFresh();\n remember(key, fresh);\n return fresh;\n } catch (error) {\n if (!isOfflineFailure(error)) throw error;\n return recall<T>(key);\n }\n};\n\n/** Drops the cached identity. Call on logout, before leaving the page. */\nexport const clearSessionSnapshot = (): void => {\n if (typeof localStorage === \"undefined\") return;\n localStorage.removeItem(OFFLINE_USER_KEY);\n localStorage.removeItem(OFFLINE_PHOTO_KEY);\n localStorage.setItem(\"auth-logout\", String(Date.now()));\n};\n\nif (typeof window !== \"undefined\")\n window.addEventListener(\"storage\", (event) => {\n if (event.key === \"auth-logout\") location.href = \"/auth/logout\";\n });\n","import { createEnv } from \"@t3-oss/env-core\";\nimport { z } from \"zod\";\n\nexport const clientEnv = createEnv({\n clientPrefix: \"VITE_\",\n client: {},\n runtimeEnv: import.meta.env,\n emptyStringAsUndefined: true,\n});\n\nexport const serverEnv = createEnv({\n server: {\n ENTRA_CLIENT_ID: z.string(),\n ENTRA_TENANT_ID: z.string(),\n ENTRA_CLIENT_SECRET: z.string(),\n AWS_ISSUER: z.url().optional(),\n AWS_DOMAIN: z.url().optional(),\n AWS_CLIENT_ID: z.string().optional(),\n AWS_CLIENT_SECRET: z.string().optional(),\n SESSION_SECRET: z.string().min(32),\n FILE_BASE_URL: z.string().optional(),\n APPROVAL_BASE_URL: z.string().optional(),\n PEOPLESOFT_BASE_URL: z.string().optional(),\n EMAIL_BASE_URL: z.string().optional(),\n AI_BASE_URL: z.string().optional(),\n AI_SUBSCRIPTION_KEY: z.string().optional(),\n },\n runtimeEnv: process.env,\n emptyStringAsUndefined: true,\n});\n","import type { IronSession } from \"iron-session\";\nimport { serverEnv } from \"~/env\";\nimport type { ProviderId, User } from \"~/models/User\";\n\nexport interface AppSessionData {\n /** Which identity provider signed this user in. */\n provider?: ProviderId;\n /** The only token persisted; delegated access tokens are minted from it. */\n refreshToken?: string;\n user?: User;\n /** Transient, only between /auth/login and /auth/callback. */\n pkceVerifier?: string;\n state?: string;\n returnTo?: string;\n}\n\nexport type AppSession = IronSession<AppSessionData>;\n\nexport const getAppSession = async (): Promise<AppSession> => {\n // Dynamic import: `@tanstack/react-start/server` is the server entry and drags\n // in the SSR renderer (`react-dom/server`). Keep it out of the client graph —\n // this helper is only ever called server-side, and all callers already await it.\n const [{ getIronSession }, { getCookie, setCookie }] = await Promise.all([\n import(\"iron-session\"),\n import(\"@tanstack/react-start/server\"),\n ]);\n\n return getIronSession<AppSessionData>(\n { read: getCookie, write: setCookie },\n {\n // Not `session`: that name holds the pre-stable `useSession` seal, which\n // iron-session can't read. Users sign in once more after the upgrade.\n cookieName: \"app-session\",\n password: serverEnv.SESSION_SECRET,\n chunk: true,\n cookieOptions: {\n secure: process.env.NODE_ENV === \"production\",\n sameSite: \"lax\",\n httpOnly: true,\n path: \"/\",\n // Explicit `undefined`: browser-session cookie and a seal that never\n // expires — what `useSession` did. Omit it to fall back to iron's 14-day `ttl`.\n maxAge: undefined,\n },\n },\n );\n};\n","import { queryOptions } from \"@tanstack/react-query\";\nimport { createServerFn } from \"@tanstack/react-start\";\nimport type { QueryClientParam } from \"~/models/QueryClientParam\";\nimport type { ProviderId, User } from \"~/models/User\";\nimport { OFFLINE_USER_KEY, withOfflineFallback } from \"./offline\";\nimport { getAppSession } from \"./session\";\n\n/**\n * Reads the signed-in user from the session cookie, or null. As a server function\n * it runs in-process when called on the server (SSR, middleware) and as an RPC\n * when called from the client — so it doubles as the client `queryFn`.\n */\nexport const getSessionUser = createServerFn({ method: \"GET\" }).handler(\n async (): Promise<User | null> => {\n const session = await getAppSession();\n return session.user ?? null;\n },\n);\n\n/** The identity providers the server offers, for the login page. */\nexport const getLoginProviders = createServerFn({ method: \"GET\" }).handler(\n async (): Promise<Array<{ id: ProviderId; label: string }>> => {\n // Dynamic import: `providers` reads `serverEnv` and must not reach the client.\n const { providers } = await import(\"./providers\");\n return providers.map(({ id, label }) => ({ id, label }));\n },\n);\n\n/**\n * Feeds `LoginForm`. Server config, not per-user, so it is safe to prime on the\n * server — the `/login` route's loader does that to avoid a flash of empty card.\n */\nexport const loginProvidersQueryOptions = queryOptions({\n queryKey: [\"auth\", \"providers\"],\n queryFn: () => getLoginProviders(),\n staleTime: \"static\",\n});\n\n/**\n * Client-side query for the signed-in user. Shared between `getUser` (route\n * `beforeLoad`) and the always-mounted observer in `LayoutProvider` — the\n * observer is what seeds the offline snapshot on the very first page load\n * (`beforeLoad` does not re-run after SSR hydration) and what makes\n * `refetchOnReconnect` fire once connectivity returns.\n */\nexport const userQueryOptions = queryOptions({\n queryKey: [\"auth\", \"user\"],\n queryFn: () => withOfflineFallback(OFFLINE_USER_KEY, () => getSessionUser()),\n staleTime: Infinity,\n // Default \"online\" pauses the query (never calling queryFn) once the browser\n // reports no connection — which is exactly when the fallback is needed.\n networkMode: \"offlineFirst\",\n // Back online: re-confirm the session and re-stamp the snapshot's grace period.\n refetchOnReconnect: \"always\",\n});\n\nexport const getUser = ({ queryClient }: QueryClientParam): Promise<User | null> => {\n if (import.meta.env.SSR) return getSessionUser();\n\n return queryClient.ensureQueryData(userQueryOptions);\n};\n","import type { AnyFieldApi } from \"@tanstack/react-form\";\r\nimport { redirect } from \"@tanstack/react-router\";\r\nimport type { ParsedLocation } from \"@tanstack/react-router\";\r\nimport { manifest, permissions } from \"virtual:wcz-layout\";\r\nimport type { QueryClientParam } from \"~/models/QueryClientParam\";\r\nimport type { TokenPayload } from \"~/models/TokenPayload\";\r\nimport type { ProviderId, User } from \"~/models/User\";\r\nimport { getUser } from \"./auth/user\";\r\n\r\nexport const WISTRON_PRIMARY_COLOR = \"#00506E\";\r\nexport const WISTRON_SECONDARY_COLOR = \"#64DC00\";\r\n\r\nexport class Platform {\r\n static get isAndroid() {\r\n return /android/i.test(this.userAgent);\r\n }\r\n static get isIOS() {\r\n return /iPad|iPhone|iPod/.test(this.userAgent);\r\n }\r\n static get isWindows() {\r\n return /windows/i.test(this.userAgent);\r\n }\r\n static get isMacOS() {\r\n return /Macintosh|MacIntel|MacPPC|Mac68K/.test(this.userAgent);\r\n }\r\n\r\n private static get userAgent() {\r\n return typeof navigator === \"undefined\" ? \"\" : navigator.userAgent;\r\n }\r\n}\r\n\r\ninterface RootRouteHeadOptions {\r\n manifest?: string;\r\n}\r\n\r\nexport const rootRouteHead = (options?: RootRouteHeadOptions) => ({\r\n meta: [\r\n { charSet: \"utf-8\" },\r\n { name: \"viewport\", content: \"width=device-width, initial-scale=1\" },\r\n { title: manifest.name },\r\n { name: \"og:type\", content: \"website\" },\r\n { name: \"og:title\", content: manifest.name },\r\n { name: \"og:image\", content: \"/favicon-32x32.png\" },\r\n ],\r\n links: [\r\n { rel: \"apple-touch-icon\", sizes: \"180x180\", href: \"/apple-touch-icon.png\" },\r\n { rel: \"icon\", type: \"image/png\", sizes: \"32x32\", href: \"/favicon-32x32.png\" },\r\n { rel: \"icon\", type: \"image/png\", sizes: \"16x16\", href: \"/favicon-16x16.png\" },\r\n { rel: \"manifest\", href: options?.manifest || \"/manifest.json\" },\r\n { rel: \"icon\", href: \"/favicon.ico\" },\r\n ],\r\n});\r\n\r\ntype GuardArgs = { location: ParsedLocation; context: QueryClientParam };\r\n\r\n/**\r\n * Route guard for `beforeLoad`. Routes are public by default; add this to close one.\r\n *\r\n * - `requireAuth()` — signed in with any provider. The only gate a population\r\n * without permission groups (e.g. AWS users) can pass.\r\n * - `requireAuth(\"admin\")` — signed in *and* in a group listed under that key.\r\n *\r\n * `reloadDocument` is required: `/auth/login` is a component-less server route and\r\n * must be reached with a full-document navigation. It starts the login directly when\r\n * only one provider is registered, otherwise it forwards to the `/login` chooser.\r\n */\r\nexport const requireAuth = (permissionKey?: keyof typeof permissions) => {\r\n return async ({ location, context }: GuardArgs) => {\r\n const user = await getUser({ queryClient: context.queryClient });\r\n\r\n if (!user)\r\n throw redirect({\r\n href: `/auth/login?returnTo=${encodeURIComponent(location.href)}`,\r\n reloadDocument: true,\r\n });\r\n\r\n if (permissionKey && !hasPermission(user, permissionKey))\r\n throw new Error(\"You do not have permission to access this page.\");\r\n\r\n return { user };\r\n };\r\n};\r\n\r\n/* Internal Utils */\r\nconst NON_PRODUCTION = /(?:^|[.-])(?:dev|qas|uat|test)(?:[.-]|$)/i;\r\n\r\n/** True only for a dev/qas/uat/test domain — localhost and production are not. */\r\nexport const isTestEnv = (origin: string | undefined) =>\r\n NON_PRODUCTION.test((origin ?? \"\").split(\".\").slice(1).join(\".\"));\r\n\r\nexport type FormOmittedProps =\r\n | \"name\"\r\n | \"value\"\r\n | \"onChange\"\r\n | \"onBlur\"\r\n | \"error\"\r\n | \"helperText\"\r\n | \"renderInput\"\r\n | \"type\"\r\n | \"aria-label\";\r\n\r\nexport const getFieldStatus = (field: AnyFieldApi) => {\r\n const { meta } = field.state;\r\n\r\n const isTouched = meta.isTouched;\r\n const hasError = !!meta.errors.length;\r\n const helperText = meta.errors[0]?.message;\r\n\r\n return { isTouched, hasError, helperText };\r\n};\r\n\r\n/**\r\n * Only same-origin paths are allowed, so `returnTo` cannot become an open\r\n * redirect. Backslash counts as a separator too: browsers normalize `/\\evil`\r\n * to the protocol-relative `//evil`.\r\n */\r\nexport const sanitizeReturnTo = (value: string | null | undefined): string =>\r\n value && /^\\/(?![/\\\\])/.test(value) ? value : \"/\";\r\n\r\nexport const toKebabCase = (str: string): string => {\r\n return str\r\n .replaceAll(/([a-z])([A-Z])/g, \"$1-$2\")\r\n .replaceAll(/[\\s_]+/g, \"-\")\r\n .replaceAll(/[^a-zA-Z0-9-]/g, \"\")\r\n .toLowerCase()\r\n .replaceAll(/-+/g, \"-\")\r\n .replaceAll(/(^-|-$)/g, \"\");\r\n};\r\n\r\nexport const foldForSearch = (value: unknown): string =>\r\n String(value ?? \"\")\r\n .toLowerCase()\r\n .normalize(\"NFD\")\r\n .replaceAll(/[\\u{300}-\\u{36F}]/gu, \"\")\r\n .normalize(\"NFC\");\r\n\r\nconst permissionGroups = new Set<string>(Object.values(permissions).flat());\r\n\r\n/**\r\n * Maps id/access-token claims to the serializable `User`. Groups are trimmed to\r\n * those named in `permissions.ts` — an unfiltered group list would blow the\r\n * cookie. Cognito's claim names differ, so both are read.\r\n */\r\nexport const buildUser = (payload: TokenPayload, provider: ProviderId): User => ({\r\n provider,\r\n name: (payload.name ?? payload[\"cognito:username\"] ?? \"\").split(\"/\")[0],\r\n email: (payload.preferred_username ?? payload.email ?? \"\").toLowerCase(),\r\n department: payload.department?.toUpperCase() || \"\",\r\n employeeId: (payload.employeeId ?? payload[\"cognito:username\"] ?? \"\").toUpperCase(),\r\n companyName: payload.companyName || \"\",\r\n groups:\r\n (payload.groups ?? payload[\"cognito:groups\"])?.filter((group) => permissionGroups.has(group)) ??\r\n [],\r\n});\r\n\r\nexport const hasPermission = (user: User | null, key: keyof typeof permissions): boolean =>\r\n user ? permissions[key].some((group) => user.groups.includes(group)) : false;\r\n"],"mappings":";;;;;;;;;;;;;;AAQA,MAAaA,mBAAmB;AAChC,MAAaC,oBAAoB;;AAGjC,MAAMC,eAAe;AAIrB,MAAMK,UAAaC,QAA0B;CAC3C,IAAI,OAAOC,iBAAiB,aAAa,OAAO;CAChD,IAAI;EACF,MAAMC,MAAMD,aAAaE,QAAQH,GAAG;EACpC,IAAI,CAACE,KAAK,OAAO;EACjB,MAAM,EAAEN,OAAOE,YAAYM,KAAKC,MAAMH,GAAG;EACzC,IAAII,KAAKC,IAAI,IAAIT,UAAUJ,cAAc;GACvCO,aAAaO,WAAWR,GAAG;GAC3B,OAAO;EACT;EACA,OAAOJ;CACT,QAAQ;EACNK,aAAaO,WAAWR,GAAG;EAC3B,OAAO;CACT;AACF;AAEA,MAAMS,YAAYT,KAAaJ,UAAyB;CACtD,IAAI,OAAOK,iBAAiB,aAAa;CACzC,IAAI;EACF,IAAIL,UAAU,QAAQA,UAAUc,KAAAA,GAAWT,aAAaO,WAAWR,GAAG;OACjEC,aAAaU,QAAQX,KAAKI,KAAKQ,UAAU;GAAEhB;GAAOE,SAASQ,KAAKC,IAAI;EAAE,CAAC,CAAC;CAC/E,QAAQ,CACN;AAEJ;AAEA,MAAMM,oBAAoBC,UACvB,OAAOC,cAAc,eAAe,CAACA,UAAUC,UAAWF,iBAAiBG;;;;;;;;;AAU9E,MAAaC,sBAAsB,OACjClB,KACAmB,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pCC,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,114 +0,0 @@
|
|
|
1
|
-
# wcz-layout exports
|
|
2
|
-
|
|
3
|
-
Public import subpaths and commonly used exports. Read this when you need to know where a
|
|
4
|
-
symbol lives; you do not need it loaded for ordinary feature work.
|
|
5
|
-
|
|
6
|
-
## `wcz-layout`
|
|
7
|
-
|
|
8
|
-
The root subpath. Everything the application shell needs.
|
|
9
|
-
|
|
10
|
-
- `LayoutProvider` — root shell provider. Props: `theme` (required), `navigation?`,
|
|
11
|
-
`options?`. Installs the Emotion cache, MUI `ThemeProvider`, `LocalizationProvider`
|
|
12
|
-
(dayjs), i18next and the dialogs provider. Wrap `{children}` with it inside `<body>` in
|
|
13
|
-
`__root.tsx`. Do not install any of those yourself. Render `<html lang={i18n.language}>`
|
|
14
|
-
in the shell: the browser starts i18next in that language before hydrating, so the
|
|
15
|
-
server-rendered page is kept rather than rebuilt in another language.
|
|
16
|
-
- `Navigation` — the type for the sidebar tree. Items are
|
|
17
|
-
`{ kind: "item" | "header" | "group" | "divider" }`; an item takes `to` or `href`,
|
|
18
|
-
`title`, `icon` and optional `search`; groups take `title`, `icon` and `children`; headers
|
|
19
|
-
take `title`; every kind accepts `hidden`.
|
|
20
|
-
- `rootRouteHead` — returns the root route's `head()` value (title, meta, links).
|
|
21
|
-
- `getUser({ queryClient })` — resolves the signed-in user. Call it in the root
|
|
22
|
-
`beforeLoad` and return `{ user }`; that is what makes `Route.useRouteContext().user`
|
|
23
|
-
available on every route.
|
|
24
|
-
- `setLanguageFromRequest()` — on the server, switches i18next to the request's language (the
|
|
25
|
-
`i18next` cookie, then `Accept-Language`) so pages server-render in it; a no-op in the
|
|
26
|
-
browser. `await` it first in the root `beforeLoad`, before `getUser`.
|
|
27
|
-
- `loginProvidersQueryOptions` — query options for the configured OAuth providers. The
|
|
28
|
-
`/login` route loads it so the buttons server-render.
|
|
29
|
-
- `WISTRON_PRIMARY_COLOR`, `WISTRON_SECONDARY_COLOR` — brand colors for the app's theme.
|
|
30
|
-
|
|
31
|
-
## `wcz-layout/vite`
|
|
32
|
-
|
|
33
|
-
- `viteWczLayout()` — **required** Vite plugin. Keep the template's plugin order after
|
|
34
|
-
`tanstackStart()`, `nitro()`, `viteReact()` and the React Compiler babel plugin. It
|
|
35
|
-
builds the `virtual:wcz-layout` module from the app's `src/lib/locales/*.json`,
|
|
36
|
-
`src/lib/auth/permissions.ts`, `src/lib/auth/scopes.ts`, `src/env.ts` and
|
|
37
|
-
`public/manifest.json`, and loads Vault secrets into `process.env` during `serve`.
|
|
38
|
-
Without it the build fails to resolve
|
|
39
|
-
`virtual:wcz-layout`. The app must also declare that module in
|
|
40
|
-
`src/types/wcz-layout.d.ts`.
|
|
41
|
-
|
|
42
|
-
## `wcz-layout/components`
|
|
43
|
-
|
|
44
|
-
- `LayoutTable` — table renderer; see the `table` skill. Types: `LayoutTableProps`,
|
|
45
|
-
`RowAction`, `LayoutColumnMeta`, `FilterOperator`, `TableFilterOption`,
|
|
46
|
-
`TableFilterVariant`
|
|
47
|
-
- `AggregatedCell` — aggregated value cell for grouped rows
|
|
48
|
-
- `Fullscreen` — fills the viewport, for a page whose only content is a table
|
|
49
|
-
- `Dropzone`, `FileViewer` — file upload and preview; see the `services` skill
|
|
50
|
-
- `LoginForm` — provider buttons for the login route; takes no props and reads
|
|
51
|
-
`?returnTo` itself
|
|
52
|
-
- `RouterButton`, `RouterFab`, `RouterIconButton`, `RouterLink`, `RouterListItemButton`,
|
|
53
|
-
`RouterTab` — MUI components taking router `to` / `params` / `search`
|
|
54
|
-
- `RouterNotFound`, `RouterError` — default 404 and error components. Pass them to
|
|
55
|
-
`createRouter` as `defaultNotFoundComponent` and `defaultErrorComponent`.
|
|
56
|
-
|
|
57
|
-
## `wcz-layout/hooks`
|
|
58
|
-
|
|
59
|
-
- `useLayoutForm`, `withLayoutForm`, `useFormContext`, `useFieldContext` — form instance,
|
|
60
|
-
reusable sub-forms, and the contexts custom field components read; see the `forms` skill
|
|
61
|
-
- `useLayoutTable`, `createLayoutColumnHelper`, `layoutTableFeatures`, `useTableContext`,
|
|
62
|
-
`useHeaderContext`, `useCellContext` — table instance, column helper and contexts, plus
|
|
63
|
-
type `LayoutTableFeatures`; see the `table` skill
|
|
64
|
-
- `useDialogs` — alert, confirm, custom dialogs and `close`, plus type `DialogProps`; see
|
|
65
|
-
the `dialogs` skill
|
|
66
|
-
- `useTranslation` — translation inside components
|
|
67
|
-
- `useInView` — element visibility observer
|
|
68
|
-
- `useScanDetection` — barcode scanner keystrokes
|
|
69
|
-
|
|
70
|
-
## `wcz-layout/middleware`
|
|
71
|
-
|
|
72
|
-
- `authMiddleware` — rejects unauthenticated calls, optionally checks a permission key.
|
|
73
|
-
Goes in a server function's `.middleware([])`, **after** `databaseMiddleware` so it
|
|
74
|
-
narrows `context.user` to `User`. See the `server-functions` skill for the full order.
|
|
75
|
-
- `userMiddleware` — attaches the user without requiring one, as `User | null`
|
|
76
|
-
- `validationMiddleware` — validates API route input against a Zod schema. REST routes
|
|
77
|
-
only; server functions use `.validator()`.
|
|
78
|
-
- `csrfMiddleware` — CSRF protection for server functions. Without a `src/start.ts`, Start
|
|
79
|
-
applies the same check by default, so the template has none. If the app adds
|
|
80
|
-
`src/start.ts` for its own request middleware, list `csrfMiddleware` there too —
|
|
81
|
-
`createStart(() => ({ requestMiddleware: [csrfMiddleware, ...] }))` — because a start
|
|
82
|
-
instance replaces that default. It is a **request** middleware, never part of a
|
|
83
|
-
`.middleware([])` array.
|
|
84
|
-
|
|
85
|
-
`databaseMiddleware` is **not** here. It is app-local; every app writes its own. See the
|
|
86
|
-
`server-functions` skill.
|
|
87
|
-
|
|
88
|
-
## `wcz-layout/utils`
|
|
89
|
-
|
|
90
|
-
- `t`, `i18next` — translation outside components
|
|
91
|
-
- `uuidv7` — time-sortable id. Use it for every client-generated primary key.
|
|
92
|
-
- `requireAuth` — `beforeLoad` route guard, redirects to `/login`; see the `routing` skill
|
|
93
|
-
- `hasPermission` — permission check for a user
|
|
94
|
-
- `Platform` — OS detection from the user agent
|
|
95
|
-
- `createEnv` — typed environment schema
|
|
96
|
-
|
|
97
|
-
## `wcz-layout/auth`
|
|
98
|
-
|
|
99
|
-
- `handleLogin`, `handleCallback`, `handleLogout` — OAuth route handlers. Mount each as a
|
|
100
|
-
server `GET` handler at `/auth/login`, `/auth/callback` and `/auth/logout`.
|
|
101
|
-
- `getAccessToken` — delegated token for the signed-in user, server-only
|
|
102
|
-
- `getAppToken` — app-only token for background jobs, server-only
|
|
103
|
-
|
|
104
|
-
## `wcz-layout/models`
|
|
105
|
-
|
|
106
|
-
- Service types: `User`, `Permissions`, `Scopes`, `FileMeta`, `Email`, `EmailAttachment`,
|
|
107
|
-
`Employee`, `Department`, `EmployeeStatus`, `EmployeeCategoryGroup`, `Approval*`
|
|
108
|
-
- Matching Zod schemas: `FileMetaSchema`, `EmailSchema`, `EmailAttachmentSchema`,
|
|
109
|
-
`EmployeeSchema`, `DepartmentSchema` and the approval `*Schema`
|
|
110
|
-
|
|
111
|
-
## `wcz-layout/data/client`, `wcz-layout/data/server`
|
|
112
|
-
|
|
113
|
-
- Client query and mutation option factories for file, approval and PeopleSoft services.
|
|
114
|
-
Server exports contain those operations plus `sendEmail`; see the `services` skill.
|