{"version":3,"file":"client.mjs","names":["mutationOptions","queryOptions","z","queryClient","ApproveApprovalSchema","CancelApprovalSchema","CreateApprovalSchema","ResubmitApprovalSchema","WithdrawApprovalSchema","GetApprovalSchema","GetApprovalsSchema","approveApproval","cancelApproval","createApproval","getApproval","getApprovals","resubmitApproval","withdrawApproval","QUERY_KEY","approvalsQueryOptions","params","input","queryKey","queryFn","data","approvalQueryOptions","createApprovalMutationOptions","mutationFn","onSettled","invalidateQueries","exact","approveApprovalMutationOptions","resubmitApprovalMutationOptions","withdrawApprovalMutationOptions","cancelApprovalMutationOptions","queryOptions","z","CompanyCodeSchema","DepartmentIdSchema","EmployeeIdSchema","getActiveEmployees","getCompanyGeneralManager","getDepartmentById","getDepartmentEmployees","getDepartmentManager","getDepartments","getEmployeeByEmployeeId","getEmployeeGeneralManager","getEmployeeManager","getEmployees","getEmployeeSubordinates","getEmployeeSupervisor","getPreviousEmployeeIds","searchEmployees","SearchEmployeesSchema","QUERY_KEY","DAY","baseOptions","staleTime","gcTime","refetchOnWindowFocus","searchEmployeesQueryOptions","params","infer","queryKey","queryFn","data","employeesQueryOptions","activeEmployeesQueryOptions","employeeByEmployeeIdQueryOptions","previousEmployeeIdsQueryOptions","employeeSupervisorQueryOptions","employeeSubordinatesQueryOptions","employeeManagerQueryOptions","employeeGeneralManagerQueryOptions","departmentsQueryOptions","departmentByIdQueryOptions","departmentManagerQueryOptions","departmentEmployeesQueryOptions","companyGeneralManagerQueryOptions"],"sources":["../../src/data/client/approval.ts","../../src/data/client/peoplesoft.ts"],"sourcesContent":["import { mutationOptions, queryOptions } from \"@tanstack/react-query\";\nimport type { z } from \"zod\";\nimport { queryClient } from \"~/lib/queryClient\";\nimport {\n  ApproveApprovalSchema,\n  CancelApprovalSchema,\n  CreateApprovalSchema,\n  ResubmitApprovalSchema,\n  WithdrawApprovalSchema,\n} from \"~/models/approval/Approval\";\nimport type { GetApprovalSchema, GetApprovalsSchema } from \"~/data/server/approval\";\nimport {\n  approveApproval,\n  cancelApproval,\n  createApproval,\n  getApproval,\n  getApprovals,\n  resubmitApproval,\n  withdrawApproval,\n} from \"~/data/server/approval\";\n\nconst QUERY_KEY = \"approval\";\n\nexport const approvalsQueryOptions = (params: z.input<typeof GetApprovalsSchema>) =>\n  queryOptions({\n    queryKey: [QUERY_KEY, params],\n    queryFn: () => getApprovals({ data: params }),\n  });\n\nexport const approvalQueryOptions = (params: z.input<typeof GetApprovalSchema>) =>\n  queryOptions({\n    queryKey: [QUERY_KEY, params],\n    queryFn: () => getApproval({ data: params }),\n  });\n\nexport const createApprovalMutationOptions = () =>\n  mutationOptions({\n    mutationFn: (data: z.input<typeof CreateApprovalSchema>) => createApproval({ data }),\n    onSettled: () => queryClient.invalidateQueries({ queryKey: [QUERY_KEY], exact: false }),\n  });\n\nexport const approveApprovalMutationOptions = () =>\n  mutationOptions({\n    mutationFn: (data: z.input<typeof ApproveApprovalSchema>) => approveApproval({ data }),\n    onSettled: () => queryClient.invalidateQueries({ queryKey: [QUERY_KEY], exact: false }),\n  });\n\nexport const resubmitApprovalMutationOptions = () =>\n  mutationOptions({\n    mutationFn: (data: z.input<typeof ResubmitApprovalSchema>) => resubmitApproval({ data }),\n    onSettled: () => queryClient.invalidateQueries({ queryKey: [QUERY_KEY], exact: false }),\n  });\n\nexport const withdrawApprovalMutationOptions = () =>\n  mutationOptions({\n    mutationFn: (data: z.input<typeof WithdrawApprovalSchema>) => withdrawApproval({ data }),\n    onSettled: () => queryClient.invalidateQueries({ queryKey: [QUERY_KEY], exact: false }),\n  });\n\nexport const cancelApprovalMutationOptions = () =>\n  mutationOptions({\n    mutationFn: (data: z.input<typeof CancelApprovalSchema>) => cancelApproval({ data }),\n    onSettled: () => queryClient.invalidateQueries({ queryKey: [QUERY_KEY], exact: false }),\n  });\n","import { queryOptions } from \"@tanstack/react-query\";\nimport z from \"zod\";\nimport {\n  CompanyCodeSchema,\n  DepartmentIdSchema,\n  EmployeeIdSchema,\n  getActiveEmployees,\n  getCompanyGeneralManager,\n  getDepartmentById,\n  getDepartmentEmployees,\n  getDepartmentManager,\n  getDepartments,\n  getEmployeeByEmployeeId,\n  getEmployeeGeneralManager,\n  getEmployeeManager,\n  getEmployees,\n  getEmployeeSubordinates,\n  getEmployeeSupervisor,\n  getPreviousEmployeeIds,\n  searchEmployees,\n  SearchEmployeesSchema,\n} from \"~/data/server/peoplesoft\";\n\nconst QUERY_KEY = \"peoplesoft\";\nconst DAY = 1000 * 60 * 60 * 24;\n\nconst baseOptions = {\n  staleTime: DAY,\n  gcTime: DAY,\n  refetchOnWindowFocus: false,\n};\n\nexport const searchEmployeesQueryOptions = (params: z.infer<typeof SearchEmployeesSchema>) =>\n  queryOptions({\n    queryKey: [QUERY_KEY, \"employee\", \"search\", params],\n    queryFn: () => searchEmployees({ data: params }),\n    ...baseOptions,\n  });\n\nexport const employeesQueryOptions = () =>\n  queryOptions({\n    queryKey: [QUERY_KEY, \"employee\"],\n    queryFn: () => getEmployees(),\n    ...baseOptions,\n  });\n\nexport const activeEmployeesQueryOptions = () =>\n  queryOptions({\n    queryKey: [QUERY_KEY, \"employee\", \"active\"],\n    queryFn: () => getActiveEmployees(),\n    ...baseOptions,\n  });\n\nexport const employeeByEmployeeIdQueryOptions = (params: z.infer<typeof EmployeeIdSchema>) =>\n  queryOptions({\n    queryKey: [QUERY_KEY, \"employee\", params],\n    queryFn: () => getEmployeeByEmployeeId({ data: params }),\n    ...baseOptions,\n  });\n\nexport const previousEmployeeIdsQueryOptions = () =>\n  queryOptions({\n    queryKey: [QUERY_KEY, \"employee\", \"previousIds\"],\n    queryFn: () => getPreviousEmployeeIds(),\n    ...baseOptions,\n  });\n\nexport const employeeSupervisorQueryOptions = (params: z.infer<typeof EmployeeIdSchema>) =>\n  queryOptions({\n    queryKey: [QUERY_KEY, \"employee\", \"supervisor\", params],\n    queryFn: () => getEmployeeSupervisor({ data: params }),\n    ...baseOptions,\n  });\n\nexport const employeeSubordinatesQueryOptions = (params: z.infer<typeof EmployeeIdSchema>) =>\n  queryOptions({\n    queryKey: [QUERY_KEY, \"employee\", \"subordinates\", params],\n    queryFn: () => getEmployeeSubordinates({ data: params }),\n    ...baseOptions,\n  });\n\nexport const employeeManagerQueryOptions = (params: z.infer<typeof EmployeeIdSchema>) =>\n  queryOptions({\n    queryKey: [QUERY_KEY, \"employee\", \"manager\", params],\n    queryFn: () => getEmployeeManager({ data: params }),\n    ...baseOptions,\n  });\n\nexport const employeeGeneralManagerQueryOptions = (params: z.infer<typeof EmployeeIdSchema>) =>\n  queryOptions({\n    queryKey: [QUERY_KEY, \"employee\", \"generalManager\", params],\n    queryFn: () => getEmployeeGeneralManager({ data: params }),\n    ...baseOptions,\n  });\n\nexport const departmentsQueryOptions = () =>\n  queryOptions({\n    queryKey: [QUERY_KEY, \"department\"],\n    queryFn: () => getDepartments(),\n    ...baseOptions,\n  });\n\nexport const departmentByIdQueryOptions = (params: z.infer<typeof DepartmentIdSchema>) =>\n  queryOptions({\n    queryKey: [QUERY_KEY, \"department\", params],\n    queryFn: () => getDepartmentById({ data: params }),\n    ...baseOptions,\n  });\n\nexport const departmentManagerQueryOptions = (params: z.infer<typeof DepartmentIdSchema>) =>\n  queryOptions({\n    queryKey: [QUERY_KEY, \"department\", \"manager\", params],\n    queryFn: () => getDepartmentManager({ data: params }),\n    ...baseOptions,\n  });\n\nexport const departmentEmployeesQueryOptions = (params: z.infer<typeof DepartmentIdSchema>) =>\n  queryOptions({\n    queryKey: [QUERY_KEY, \"department\", \"employees\", params],\n    queryFn: () => getDepartmentEmployees({ data: params }),\n    ...baseOptions,\n  });\n\nexport const companyGeneralManagerQueryOptions = (params: z.infer<typeof CompanyCodeSchema>) =>\n  queryOptions({\n    queryKey: [QUERY_KEY, \"company\", \"generalManager\", params],\n    queryFn: () => getCompanyGeneralManager({ data: params }),\n    ...baseOptions,\n  });\n"],"mappings":";;;;;AAqBA,MAAMkB,cAAY;AAElB,MAAaC,yBAAyBC,WACpCnB,aAAa;CACXqB,UAAU,CAACJ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