From 65592c052264ec0efc3bb87a8d87c3d6915eeef8 Mon Sep 17 00:00:00 2001 From: Dhirender Choudhary Date: Sun, 19 Jul 2026 17:40:17 +0530 Subject: [PATCH 01/19] feat: add Workday integration plugin --- packages/corsair/core/constants.ts | 3 + .../workday/__mocks__/corsair-core.mock.ts | 9 + packages/workday/api.test.ts | 39 + packages/workday/client.ts | 56 + packages/workday/endpoints/absence.ts | 23 + packages/workday/endpoints/an.ts | 21 + packages/workday/endpoints/assignment.ts | 55 + packages/workday/endpoints/balances.ts | 23 + packages/workday/endpoints/business.ts | 55 + packages/workday/endpoints/candidate.ts | 21 + packages/workday/endpoints/collection.ts | 38 + packages/workday/endpoints/company.ts | 21 + packages/workday/endpoints/contingent.ts | 21 + packages/workday/endpoints/countries.ts | 23 + packages/workday/endpoints/country.ts | 23 + packages/workday/endpoints/currencies.ts | 23 + packages/workday/endpoints/current.ts | 23 + packages/workday/endpoints/grants.ts | 20 + packages/workday/endpoints/headcount.ts | 21 + packages/workday/endpoints/history.ts | 38 + packages/workday/endpoints/holiday.ts | 23 + packages/workday/endpoints/index.ts | 236 ++++ packages/workday/endpoints/interview.ts | 40 + packages/workday/endpoints/interviews.ts | 23 + packages/workday/endpoints/job.ts | 356 ++++++ packages/workday/endpoints/jobs.ts | 19 + packages/workday/endpoints/leave.ts | 21 + packages/workday/endpoints/message.ts | 21 + packages/workday/endpoints/my.ts | 23 + packages/workday/endpoints/organization.ts | 89 ++ packages/workday/endpoints/pay.ts | 55 + packages/workday/endpoints/payroll.ts | 38 + packages/workday/endpoints/proposed.ts | 21 + packages/workday/endpoints/prospect.ts | 93 ++ packages/workday/endpoints/supervisory.ts | 21 + packages/workday/endpoints/time.ts | 91 ++ packages/workday/endpoints/types.ts | 1068 ++++++++++++++++ packages/workday/endpoints/work.ts | 21 + packages/workday/endpoints/worker.ts | 178 +++ packages/workday/endpoints/workers.ts | 21 + packages/workday/endpoints/workspace.ts | 21 + packages/workday/error-handlers.ts | 31 + packages/workday/index.ts | 1112 +++++++++++++++++ packages/workday/jest.config.cjs | 29 + packages/workday/package.json | 44 + packages/workday/schema/database.ts | 1 + packages/workday/schema/index.ts | 4 + packages/workday/tsconfig.json | 20 + packages/workday/tsconfig.test.json | 10 + packages/workday/tsup.config.ts | 15 + packages/workday/webhooks/index.ts | 3 + .../workday/webhooks/oauth-tenant-link.ts | 16 + packages/workday/webhooks/tenant-matcher.ts | 18 + packages/workday/webhooks/types.ts | 45 + pnpm-lock.yaml | 24 + 55 files changed, 4407 insertions(+) create mode 100644 packages/workday/__mocks__/corsair-core.mock.ts create mode 100644 packages/workday/api.test.ts create mode 100644 packages/workday/client.ts create mode 100644 packages/workday/endpoints/absence.ts create mode 100644 packages/workday/endpoints/an.ts create mode 100644 packages/workday/endpoints/assignment.ts create mode 100644 packages/workday/endpoints/balances.ts create mode 100644 packages/workday/endpoints/business.ts create mode 100644 packages/workday/endpoints/candidate.ts create mode 100644 packages/workday/endpoints/collection.ts create mode 100644 packages/workday/endpoints/company.ts create mode 100644 packages/workday/endpoints/contingent.ts create mode 100644 packages/workday/endpoints/countries.ts create mode 100644 packages/workday/endpoints/country.ts create mode 100644 packages/workday/endpoints/currencies.ts create mode 100644 packages/workday/endpoints/current.ts create mode 100644 packages/workday/endpoints/grants.ts create mode 100644 packages/workday/endpoints/headcount.ts create mode 100644 packages/workday/endpoints/history.ts create mode 100644 packages/workday/endpoints/holiday.ts create mode 100644 packages/workday/endpoints/index.ts create mode 100644 packages/workday/endpoints/interview.ts create mode 100644 packages/workday/endpoints/interviews.ts create mode 100644 packages/workday/endpoints/job.ts create mode 100644 packages/workday/endpoints/jobs.ts create mode 100644 packages/workday/endpoints/leave.ts create mode 100644 packages/workday/endpoints/message.ts create mode 100644 packages/workday/endpoints/my.ts create mode 100644 packages/workday/endpoints/organization.ts create mode 100644 packages/workday/endpoints/pay.ts create mode 100644 packages/workday/endpoints/payroll.ts create mode 100644 packages/workday/endpoints/proposed.ts create mode 100644 packages/workday/endpoints/prospect.ts create mode 100644 packages/workday/endpoints/supervisory.ts create mode 100644 packages/workday/endpoints/time.ts create mode 100644 packages/workday/endpoints/types.ts create mode 100644 packages/workday/endpoints/work.ts create mode 100644 packages/workday/endpoints/worker.ts create mode 100644 packages/workday/endpoints/workers.ts create mode 100644 packages/workday/endpoints/workspace.ts create mode 100644 packages/workday/error-handlers.ts create mode 100644 packages/workday/index.ts create mode 100644 packages/workday/jest.config.cjs create mode 100644 packages/workday/package.json create mode 100644 packages/workday/schema/database.ts create mode 100644 packages/workday/schema/index.ts create mode 100644 packages/workday/tsconfig.json create mode 100644 packages/workday/tsconfig.test.json create mode 100644 packages/workday/tsup.config.ts create mode 100644 packages/workday/webhooks/index.ts create mode 100644 packages/workday/webhooks/oauth-tenant-link.ts create mode 100644 packages/workday/webhooks/tenant-matcher.ts create mode 100644 packages/workday/webhooks/types.ts diff --git a/packages/corsair/core/constants.ts b/packages/corsair/core/constants.ts index 062837c9a..acd6c2fc7 100644 --- a/packages/corsair/core/constants.ts +++ b/packages/corsair/core/constants.ts @@ -75,6 +75,7 @@ export const BaseProviders = [ 'twitterapiio', 'typeform', 'vapi', + 'workday', 'xquik', 'youtube', 'zendesk', @@ -145,6 +146,7 @@ export const ProviderDisplayNames = { twitterapiio: 'Twitter API IO', typeform: 'Typeform', vapi: 'Vapi', + workday: 'Workday', xquik: 'XQuik', youtube: 'YouTube', zendesk: 'Zendesk', @@ -222,6 +224,7 @@ export type AllProviders = | 'twitterapiio' | 'typeform' | 'vapi' + | 'workday' | 'xquik' | 'youtube' | 'zendesk' diff --git a/packages/workday/__mocks__/corsair-core.mock.ts b/packages/workday/__mocks__/corsair-core.mock.ts new file mode 100644 index 000000000..980f77100 --- /dev/null +++ b/packages/workday/__mocks__/corsair-core.mock.ts @@ -0,0 +1,9 @@ +export const ProviderDisplayNames = {}; +export const CORSAIR_INTERNAL = 'mock' as any; +export function matchWebhookPluginAndTenant() {} +export function collectPluginWebhookMatchers() {} +export function createCorsair() {} +export function logEvent() {} +export function logEventFromContext() {} +export function formatProviderDisplayName() {} +export function formatDocSchemaShape() {} diff --git a/packages/workday/api.test.ts b/packages/workday/api.test.ts new file mode 100644 index 000000000..739e2d3ab --- /dev/null +++ b/packages/workday/api.test.ts @@ -0,0 +1,39 @@ +import { workday } from './index.js'; + +describe('Workday Plugin', () => { + const mockFetch = jest.fn(); + (globalThis as any).fetch = mockFetch; + + beforeEach(() => { + mockFetch.mockReset(); + }); + + it('should initialize the plugin correctly', () => { + const plugin = workday({ key: 'test', webhookSecret: 'secret' }); + expect(plugin.id).toBe('workday'); + }); + + it('should provide the expected endpoint structure for business', () => { + const plugin = workday({ key: 'test', webhookSecret: 'secret' }); + expect(plugin.endpoints).toHaveProperty('business'); + expect(plugin.endpoints?.business.createBusinessTitleChange).toBeDefined(); + }); + + it('should provide the expected endpoint structure for job', () => { + const plugin = workday({ key: 'test', webhookSecret: 'secret' }); + expect(plugin.endpoints).toHaveProperty('job'); + expect(plugin.endpoints?.job.createJobChange).toBeDefined(); + }); + + it('should provide the expected endpoint structure for payroll', () => { + const plugin = workday({ key: 'test', webhookSecret: 'secret' }); + expect(plugin.endpoints).toHaveProperty('payroll'); + expect(plugin.endpoints?.payroll.createPayrollInputs).toBeDefined(); + }); + + it('should support webhooks configuration', () => { + const plugin = workday({ key: 'test', webhookSecret: 'secret' }); + expect(plugin.webhooks).toBeDefined(); + expect(plugin.pluginWebhookMatcher).toBeDefined(); + }); +}); diff --git a/packages/workday/client.ts b/packages/workday/client.ts new file mode 100644 index 000000000..93dcb24c0 --- /dev/null +++ b/packages/workday/client.ts @@ -0,0 +1,56 @@ +import type { ApiRequestOptions, OpenAPIConfig } from 'corsair/http'; +import { request } from 'corsair/http'; + +export class WorkdayAPIError extends Error { + constructor( + message: string, + public readonly code?: string, + ) { + super(message); + this.name = 'WorkdayAPIError'; + } +} + +const WORKDAY_API_BASE = 'https://api.workday.com'; + +export async function makeWorkdayRequest( + endpoint: string, + apiKey: string, + options: { + method?: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH'; + body?: { [key: string]: unknown }; + query?: Record; + } = {}, +): Promise { + const { method = 'GET', body, query } = options; + + const config: OpenAPIConfig = { + BASE: WORKDAY_API_BASE, + VERSION: '1.0.0', + WITH_CREDENTIALS: false, + CREDENTIALS: 'omit', + TOKEN: apiKey, + HEADERS: { + 'Content-Type': 'application/json', + Authorization: `Bearer ${apiKey}`, + }, + }; + + const requestOptions: ApiRequestOptions = { + method, + url: endpoint, + body: + method === 'POST' || method === 'PUT' || method === 'PATCH' + ? body + : undefined, + mediaType: 'application/json; charset=utf-8', + query: method === 'GET' ? query : undefined, + }; + + try { + return await request(config, requestOptions); + } catch (error) { + if (error instanceof Error) throw new WorkdayAPIError(error.message); + throw new WorkdayAPIError('Unknown error'); + } +} diff --git a/packages/workday/endpoints/absence.ts b/packages/workday/endpoints/absence.ts new file mode 100644 index 000000000..4851e2753 --- /dev/null +++ b/packages/workday/endpoints/absence.ts @@ -0,0 +1,23 @@ +import { logEventFromContext } from 'corsair/core'; +import type { WorkdayEndpoints } from '..'; +import { makeWorkdayRequest } from '../client'; +import type { WorkdayEndpointOutputs } from './types'; + +export const getAbsenceBalance: WorkdayEndpoints['getAbsenceBalance'] = async ( + ctx, + input, +) => { + const response = await makeWorkdayRequest< + WorkdayEndpointOutputs['getAbsenceBalance'] + >('v1/absence/api', ctx.key, { + method: 'POST', + body: input as { [key: string]: unknown }, + }); + await logEventFromContext( + ctx, + 'workday.absence.getAbsenceBalance', + input ?? {}, + 'completed', + ); + return response; +}; diff --git a/packages/workday/endpoints/an.ts b/packages/workday/endpoints/an.ts new file mode 100644 index 000000000..652a331c3 --- /dev/null +++ b/packages/workday/endpoints/an.ts @@ -0,0 +1,21 @@ +import { logEventFromContext } from 'corsair/core'; +import type { WorkdayEndpoints } from '..'; +import { makeWorkdayRequest } from '../client'; +import type { WorkdayEndpointOutputs } from './types'; + +export const updateAnExistingPayroll: WorkdayEndpoints['updateAnExistingPayroll'] = + async (ctx, input) => { + const response = await makeWorkdayRequest< + WorkdayEndpointOutputs['updateAnExistingPayroll'] + >('v1/an/api', ctx.key, { + method: 'POST', + body: input as { [key: string]: unknown }, + }); + await logEventFromContext( + ctx, + 'workday.an.updateAnExistingPayroll', + input ?? {}, + 'completed', + ); + return response; + }; diff --git a/packages/workday/endpoints/assignment.ts b/packages/workday/endpoints/assignment.ts new file mode 100644 index 000000000..18637d278 --- /dev/null +++ b/packages/workday/endpoints/assignment.ts @@ -0,0 +1,55 @@ +import { logEventFromContext } from 'corsair/core'; +import type { WorkdayEndpoints } from '..'; +import { makeWorkdayRequest } from '../client'; +import type { WorkdayEndpointOutputs } from './types'; + +export const getAssignmentChangeGroupCostCenters: WorkdayEndpoints['getAssignmentChangeGroupCostCenters'] = + async (ctx, input) => { + const response = await makeWorkdayRequest< + WorkdayEndpointOutputs['getAssignmentChangeGroupCostCenters'] + >('v1/assignment/api', ctx.key, { + method: 'POST', + body: input as { [key: string]: unknown }, + }); + await logEventFromContext( + ctx, + 'workday.assignment.getAssignmentChangeGroupCostCenters', + input ?? {}, + 'completed', + ); + return response; + }; + +export const getAssignmentChangeGroupJobs: WorkdayEndpoints['getAssignmentChangeGroupJobs'] = + async (ctx, input) => { + const response = await makeWorkdayRequest< + WorkdayEndpointOutputs['getAssignmentChangeGroupJobs'] + >('v1/assignment/api', ctx.key, { + method: 'POST', + body: input as { [key: string]: unknown }, + }); + await logEventFromContext( + ctx, + 'workday.assignment.getAssignmentChangeGroupJobs', + input ?? {}, + 'completed', + ); + return response; + }; + +export const getAssignmentTypes: WorkdayEndpoints['getAssignmentTypes'] = + async (ctx, input) => { + const response = await makeWorkdayRequest< + WorkdayEndpointOutputs['getAssignmentTypes'] + >('v1/assignment/api', ctx.key, { + method: 'POST', + body: input as { [key: string]: unknown }, + }); + await logEventFromContext( + ctx, + 'workday.assignment.getAssignmentTypes', + input ?? {}, + 'completed', + ); + return response; + }; diff --git a/packages/workday/endpoints/balances.ts b/packages/workday/endpoints/balances.ts new file mode 100644 index 000000000..98f69496e --- /dev/null +++ b/packages/workday/endpoints/balances.ts @@ -0,0 +1,23 @@ +import { logEventFromContext } from 'corsair/core'; +import type { WorkdayEndpoints } from '..'; +import { makeWorkdayRequest } from '../client'; +import type { WorkdayEndpointOutputs } from './types'; + +export const listBalances: WorkdayEndpoints['listBalances'] = async ( + ctx, + input, +) => { + const response = await makeWorkdayRequest< + WorkdayEndpointOutputs['listBalances'] + >('v1/balances/api', ctx.key, { + method: 'POST', + body: input as { [key: string]: unknown }, + }); + await logEventFromContext( + ctx, + 'workday.balances.listBalances', + input ?? {}, + 'completed', + ); + return response; +}; diff --git a/packages/workday/endpoints/business.ts b/packages/workday/endpoints/business.ts new file mode 100644 index 000000000..f9eefe4bf --- /dev/null +++ b/packages/workday/endpoints/business.ts @@ -0,0 +1,55 @@ +import { logEventFromContext } from 'corsair/core'; +import type { WorkdayEndpoints } from '..'; +import { makeWorkdayRequest } from '../client'; +import type { WorkdayEndpointOutputs } from './types'; + +export const createBusinessTitleChange: WorkdayEndpoints['createBusinessTitleChange'] = + async (ctx, input) => { + const response = await makeWorkdayRequest< + WorkdayEndpointOutputs['createBusinessTitleChange'] + >('v1/business/api', ctx.key, { + method: 'POST', + body: input as { [key: string]: unknown }, + }); + await logEventFromContext( + ctx, + 'workday.business.createBusinessTitleChange', + input ?? {}, + 'completed', + ); + return response; + }; + +export const getBusinessTitleChange: WorkdayEndpoints['getBusinessTitleChange'] = + async (ctx, input) => { + const response = await makeWorkdayRequest< + WorkdayEndpointOutputs['getBusinessTitleChange'] + >('v1/business/api', ctx.key, { + method: 'POST', + body: input as { [key: string]: unknown }, + }); + await logEventFromContext( + ctx, + 'workday.business.getBusinessTitleChange', + input ?? {}, + 'completed', + ); + return response; + }; + +export const getBusinessTitleChangeForWorker: WorkdayEndpoints['getBusinessTitleChangeForWorker'] = + async (ctx, input) => { + const response = await makeWorkdayRequest< + WorkdayEndpointOutputs['getBusinessTitleChangeForWorker'] + >('v1/business/api', ctx.key, { + method: 'POST', + body: input as { [key: string]: unknown }, + }); + await logEventFromContext( + ctx, + 'workday.business.getBusinessTitleChangeForWorker', + input ?? {}, + 'completed', + ); + return response; + }; diff --git a/packages/workday/endpoints/candidate.ts b/packages/workday/endpoints/candidate.ts new file mode 100644 index 000000000..539964e8e --- /dev/null +++ b/packages/workday/endpoints/candidate.ts @@ -0,0 +1,21 @@ +import { logEventFromContext } from 'corsair/core'; +import type { WorkdayEndpoints } from '..'; +import { makeWorkdayRequest } from '../client'; +import type { WorkdayEndpointOutputs } from './types'; + +export const getCandidateAvailabilityTemplate: WorkdayEndpoints['getCandidateAvailabilityTemplate'] = + async (ctx, input) => { + const response = await makeWorkdayRequest< + WorkdayEndpointOutputs['getCandidateAvailabilityTemplate'] + >('v1/candidate/api', ctx.key, { + method: 'POST', + body: input as { [key: string]: unknown }, + }); + await logEventFromContext( + ctx, + 'workday.candidate.getCandidateAvailabilityTemplate', + input ?? {}, + 'completed', + ); + return response; + }; diff --git a/packages/workday/endpoints/collection.ts b/packages/workday/endpoints/collection.ts new file mode 100644 index 000000000..bbf70b67f --- /dev/null +++ b/packages/workday/endpoints/collection.ts @@ -0,0 +1,38 @@ +import { logEventFromContext } from 'corsair/core'; +import type { WorkdayEndpoints } from '..'; +import { makeWorkdayRequest } from '../client'; +import type { WorkdayEndpointOutputs } from './types'; + +export const getCollectionOfJobs: WorkdayEndpoints['getCollectionOfJobs'] = + async (ctx, input) => { + const response = await makeWorkdayRequest< + WorkdayEndpointOutputs['getCollectionOfJobs'] + >('v1/collection/api', ctx.key, { + method: 'POST', + body: input as { [key: string]: unknown }, + }); + await logEventFromContext( + ctx, + 'workday.collection.getCollectionOfJobs', + input ?? {}, + 'completed', + ); + return response; + }; + +export const getCollectionOfPayroll: WorkdayEndpoints['getCollectionOfPayroll'] = + async (ctx, input) => { + const response = await makeWorkdayRequest< + WorkdayEndpointOutputs['getCollectionOfPayroll'] + >('v1/collection/api', ctx.key, { + method: 'POST', + body: input as { [key: string]: unknown }, + }); + await logEventFromContext( + ctx, + 'workday.collection.getCollectionOfPayroll', + input ?? {}, + 'completed', + ); + return response; + }; diff --git a/packages/workday/endpoints/company.ts b/packages/workday/endpoints/company.ts new file mode 100644 index 000000000..84cc31dd8 --- /dev/null +++ b/packages/workday/endpoints/company.ts @@ -0,0 +1,21 @@ +import { logEventFromContext } from 'corsair/core'; +import type { WorkdayEndpoints } from '..'; +import { makeWorkdayRequest } from '../client'; +import type { WorkdayEndpointOutputs } from './types'; + +export const getCompanyInsiderTypes: WorkdayEndpoints['getCompanyInsiderTypes'] = + async (ctx, input) => { + const response = await makeWorkdayRequest< + WorkdayEndpointOutputs['getCompanyInsiderTypes'] + >('v1/company/api', ctx.key, { + method: 'POST', + body: input as { [key: string]: unknown }, + }); + await logEventFromContext( + ctx, + 'workday.company.getCompanyInsiderTypes', + input ?? {}, + 'completed', + ); + return response; + }; diff --git a/packages/workday/endpoints/contingent.ts b/packages/workday/endpoints/contingent.ts new file mode 100644 index 000000000..cc9aef264 --- /dev/null +++ b/packages/workday/endpoints/contingent.ts @@ -0,0 +1,21 @@ +import { logEventFromContext } from 'corsair/core'; +import type { WorkdayEndpoints } from '..'; +import { makeWorkdayRequest } from '../client'; +import type { WorkdayEndpointOutputs } from './types'; + +export const getContingentWorkerTypes: WorkdayEndpoints['getContingentWorkerTypes'] = + async (ctx, input) => { + const response = await makeWorkdayRequest< + WorkdayEndpointOutputs['getContingentWorkerTypes'] + >('v1/contingent/api', ctx.key, { + method: 'POST', + body: input as { [key: string]: unknown }, + }); + await logEventFromContext( + ctx, + 'workday.contingent.getContingentWorkerTypes', + input ?? {}, + 'completed', + ); + return response; + }; diff --git a/packages/workday/endpoints/countries.ts b/packages/workday/endpoints/countries.ts new file mode 100644 index 000000000..77b47f9c7 --- /dev/null +++ b/packages/workday/endpoints/countries.ts @@ -0,0 +1,23 @@ +import { logEventFromContext } from 'corsair/core'; +import type { WorkdayEndpoints } from '..'; +import { makeWorkdayRequest } from '../client'; +import type { WorkdayEndpointOutputs } from './types'; + +export const listCountries: WorkdayEndpoints['listCountries'] = async ( + ctx, + input, +) => { + const response = await makeWorkdayRequest< + WorkdayEndpointOutputs['listCountries'] + >('v1/countries/api', ctx.key, { + method: 'POST', + body: input as { [key: string]: unknown }, + }); + await logEventFromContext( + ctx, + 'workday.countries.listCountries', + input ?? {}, + 'completed', + ); + return response; +}; diff --git a/packages/workday/endpoints/country.ts b/packages/workday/endpoints/country.ts new file mode 100644 index 000000000..d02897814 --- /dev/null +++ b/packages/workday/endpoints/country.ts @@ -0,0 +1,23 @@ +import { logEventFromContext } from 'corsair/core'; +import type { WorkdayEndpoints } from '..'; +import { makeWorkdayRequest } from '../client'; +import type { WorkdayEndpointOutputs } from './types'; + +export const getCountryInfo: WorkdayEndpoints['getCountryInfo'] = async ( + ctx, + input, +) => { + const response = await makeWorkdayRequest< + WorkdayEndpointOutputs['getCountryInfo'] + >('v1/country/api', ctx.key, { + method: 'POST', + body: input as { [key: string]: unknown }, + }); + await logEventFromContext( + ctx, + 'workday.country.getCountryInfo', + input ?? {}, + 'completed', + ); + return response; +}; diff --git a/packages/workday/endpoints/currencies.ts b/packages/workday/endpoints/currencies.ts new file mode 100644 index 000000000..817db4be8 --- /dev/null +++ b/packages/workday/endpoints/currencies.ts @@ -0,0 +1,23 @@ +import { logEventFromContext } from 'corsair/core'; +import type { WorkdayEndpoints } from '..'; +import { makeWorkdayRequest } from '../client'; +import type { WorkdayEndpointOutputs } from './types'; + +export const getCurrencies: WorkdayEndpoints['getCurrencies'] = async ( + ctx, + input, +) => { + const response = await makeWorkdayRequest< + WorkdayEndpointOutputs['getCurrencies'] + >('v1/currencies/api', ctx.key, { + method: 'POST', + body: input as { [key: string]: unknown }, + }); + await logEventFromContext( + ctx, + 'workday.currencies.getCurrencies', + input ?? {}, + 'completed', + ); + return response; +}; diff --git a/packages/workday/endpoints/current.ts b/packages/workday/endpoints/current.ts new file mode 100644 index 000000000..3388fcbef --- /dev/null +++ b/packages/workday/endpoints/current.ts @@ -0,0 +1,23 @@ +import { logEventFromContext } from 'corsair/core'; +import type { WorkdayEndpoints } from '..'; +import { makeWorkdayRequest } from '../client'; +import type { WorkdayEndpointOutputs } from './types'; + +export const getCurrentUser: WorkdayEndpoints['getCurrentUser'] = async ( + ctx, + input, +) => { + const response = await makeWorkdayRequest< + WorkdayEndpointOutputs['getCurrentUser'] + >('v1/current/api', ctx.key, { + method: 'POST', + body: input as { [key: string]: unknown }, + }); + await logEventFromContext( + ctx, + 'workday.current.getCurrentUser', + input ?? {}, + 'completed', + ); + return response; +}; diff --git a/packages/workday/endpoints/grants.ts b/packages/workday/endpoints/grants.ts new file mode 100644 index 000000000..478cd14dd --- /dev/null +++ b/packages/workday/endpoints/grants.ts @@ -0,0 +1,20 @@ +import { logEventFromContext } from 'corsair/core'; +import type { WorkdayEndpoints } from '..'; +import { makeWorkdayRequest } from '../client'; +import type { WorkdayEndpointOutputs } from './types'; + +export const getGrants: WorkdayEndpoints['getGrants'] = async (ctx, input) => { + const response = await makeWorkdayRequest< + WorkdayEndpointOutputs['getGrants'] + >('v1/grants/api', ctx.key, { + method: 'POST', + body: input as { [key: string]: unknown }, + }); + await logEventFromContext( + ctx, + 'workday.grants.getGrants', + input ?? {}, + 'completed', + ); + return response; +}; diff --git a/packages/workday/endpoints/headcount.ts b/packages/workday/endpoints/headcount.ts new file mode 100644 index 000000000..c00fa0331 --- /dev/null +++ b/packages/workday/endpoints/headcount.ts @@ -0,0 +1,21 @@ +import { logEventFromContext } from 'corsair/core'; +import type { WorkdayEndpoints } from '..'; +import { makeWorkdayRequest } from '../client'; +import type { WorkdayEndpointOutputs } from './types'; + +export const getHeadcountOptions: WorkdayEndpoints['getHeadcountOptions'] = + async (ctx, input) => { + const response = await makeWorkdayRequest< + WorkdayEndpointOutputs['getHeadcountOptions'] + >('v1/headcount/api', ctx.key, { + method: 'POST', + body: input as { [key: string]: unknown }, + }); + await logEventFromContext( + ctx, + 'workday.headcount.getHeadcountOptions', + input ?? {}, + 'completed', + ); + return response; + }; diff --git a/packages/workday/endpoints/history.ts b/packages/workday/endpoints/history.ts new file mode 100644 index 000000000..a5516e4fd --- /dev/null +++ b/packages/workday/endpoints/history.ts @@ -0,0 +1,38 @@ +import { logEventFromContext } from 'corsair/core'; +import type { WorkdayEndpoints } from '..'; +import { makeWorkdayRequest } from '../client'; +import type { WorkdayEndpointOutputs } from './types'; + +export const getHistoryInstanceForWorker: WorkdayEndpoints['getHistoryInstanceForWorker'] = + async (ctx, input) => { + const response = await makeWorkdayRequest< + WorkdayEndpointOutputs['getHistoryInstanceForWorker'] + >('v1/history/api', ctx.key, { + method: 'POST', + body: input as { [key: string]: unknown }, + }); + await logEventFromContext( + ctx, + 'workday.history.getHistoryInstanceForWorker', + input ?? {}, + 'completed', + ); + return response; + }; + +export const getHistoryItemsForWorker: WorkdayEndpoints['getHistoryItemsForWorker'] = + async (ctx, input) => { + const response = await makeWorkdayRequest< + WorkdayEndpointOutputs['getHistoryItemsForWorker'] + >('v1/history/api', ctx.key, { + method: 'POST', + body: input as { [key: string]: unknown }, + }); + await logEventFromContext( + ctx, + 'workday.history.getHistoryItemsForWorker', + input ?? {}, + 'completed', + ); + return response; + }; diff --git a/packages/workday/endpoints/holiday.ts b/packages/workday/endpoints/holiday.ts new file mode 100644 index 000000000..df3e6d308 --- /dev/null +++ b/packages/workday/endpoints/holiday.ts @@ -0,0 +1,23 @@ +import { logEventFromContext } from 'corsair/core'; +import type { WorkdayEndpoints } from '..'; +import { makeWorkdayRequest } from '../client'; +import type { WorkdayEndpointOutputs } from './types'; + +export const getHolidayEvents: WorkdayEndpoints['getHolidayEvents'] = async ( + ctx, + input, +) => { + const response = await makeWorkdayRequest< + WorkdayEndpointOutputs['getHolidayEvents'] + >('v1/holiday/api', ctx.key, { + method: 'POST', + body: input as { [key: string]: unknown }, + }); + await logEventFromContext( + ctx, + 'workday.holiday.getHolidayEvents', + input ?? {}, + 'completed', + ); + return response; +}; diff --git a/packages/workday/endpoints/index.ts b/packages/workday/endpoints/index.ts new file mode 100644 index 000000000..62a1952ad --- /dev/null +++ b/packages/workday/endpoints/index.ts @@ -0,0 +1,236 @@ +import { + createBusinessTitleChange, + getBusinessTitleChange, + getBusinessTitleChangeForWorker, +} from './business'; +export const Business = { + createBusinessTitleChange, + getBusinessTitleChange, + getBusinessTitleChangeForWorker, +}; + +import { + createJobChange, + getJobById, + getJobChangeFrequencies, + getJobChangeLocationInfo, + getJobChangePosition, + getJobChangeReasonInstance, + getJobChangeReasons, + getJobChangeReasonValues, + getJobChangesGroupTemplates, + getJobChangesJobValues, + getJobChangesWorkerValues, + getJobClassifications, + getJobPosting, + getJobPostingQuestionnaire, + getJobProfilesValues, + getJobRequisitionValues, + getJobWorkspace, + getJobWorkspaces, + listJobPostings, + updateJobChangeBusinessTitle, +} from './job'; +export const Job = { + createJobChange, + getJobById, + getJobChangeFrequencies, + getJobChangeLocationInfo, + getJobChangePosition, + getJobChangeReasonInstance, + getJobChangeReasonValues, + getJobChangeReasons, + getJobChangesGroupTemplates, + getJobChangesJobValues, + getJobChangesWorkerValues, + getJobClassifications, + getJobPosting, + getJobPostingQuestionnaire, + getJobProfilesValues, + getJobRequisitionValues, + getJobWorkspace, + getJobWorkspaces, + listJobPostings, + updateJobChangeBusinessTitle, +}; + +import { createPayrollInputs, getPayrollInputInstance } from './payroll'; +export const Payroll = { createPayrollInputs, getPayrollInputInstance }; + +import { + createTimeOffRequest, + getTimeOffEntriesForWorker, + getTimeOffPlansForWorker, + getTimeOffStatusValues, + getTimeTypes, +} from './time'; +export const Time = { + createTimeOffRequest, + getTimeOffEntriesForWorker, + getTimeOffPlansForWorker, + getTimeOffStatusValues, + getTimeTypes, +}; + +import { getAbsenceBalance } from './absence'; +export const Absence = { getAbsenceBalance }; + +import { + getAssignmentChangeGroupCostCenters, + getAssignmentChangeGroupJobs, + getAssignmentTypes, +} from './assignment'; +export const Assignment = { + getAssignmentChangeGroupCostCenters, + getAssignmentChangeGroupJobs, + getAssignmentTypes, +}; + +import { getCandidateAvailabilityTemplate } from './candidate'; +export const Candidate = { getCandidateAvailabilityTemplate }; + +import { getCollectionOfJobs, getCollectionOfPayroll } from './collection'; +export const Collection = { getCollectionOfJobs, getCollectionOfPayroll }; + +import { getCompanyInsiderTypes } from './company'; +export const Company = { getCompanyInsiderTypes }; + +import { getContingentWorkerTypes } from './contingent'; +export const Contingent = { getContingentWorkerTypes }; + +import { getCountryInfo } from './country'; +export const Country = { getCountryInfo }; + +import { getCurrencies } from './currencies'; +export const Currencies = { getCurrencies }; + +import { getCurrentUser } from './current'; +export const Current = { getCurrentUser }; + +import { getGrants } from './grants'; +export const Grants = { getGrants }; + +import { getHeadcountOptions } from './headcount'; +export const Headcount = { getHeadcountOptions }; + +import { + getHistoryInstanceForWorker, + getHistoryItemsForWorker, +} from './history'; +export const History = { + getHistoryInstanceForWorker, + getHistoryItemsForWorker, +}; + +import { getHolidayEvents } from './holiday'; +export const Holiday = { getHolidayEvents }; + +import { getInterview, getInterviewFeedback2 } from './interview'; +export const Interview = { getInterview, getInterviewFeedback2 }; + +import { getLeaveStatusValues } from './leave'; +export const Leave = { getLeaveStatusValues }; + +import { getMyJobPostings } from './my'; +export const My = { getMyJobPostings }; + +import { + getOrganizationAssignmentBusinessUnits, + getOrganizationAssignmentCustoms, + getOrganizationAssignmentFunds, + getOrganizationAssignmentRegions, + getOrganizationAssignmentWorkers, +} from './organization'; +export const Organization = { + getOrganizationAssignmentBusinessUnits, + getOrganizationAssignmentCustoms, + getOrganizationAssignmentFunds, + getOrganizationAssignmentRegions, + getOrganizationAssignmentWorkers, +}; + +import { + getPayGroupByJobId, + getPaySlipInstancesForWorker, + getPaySlipsForWorker, +} from './pay'; +export const Pay = { + getPayGroupByJobId, + getPaySlipInstancesForWorker, + getPaySlipsForWorker, +}; + +import { getProposedPositionValues } from './proposed'; +export const Proposed = { getProposedPositionValues }; + +import { + getProspect, + getProspectEducations, + getProspectExperiences, + getProspectResumeAttachments, + getProspectSkills, +} from './prospect'; +export const Prospect = { + getProspect, + getProspectEducations, + getProspectExperiences, + getProspectResumeAttachments, + getProspectSkills, +}; + +import { getSupervisoryOrgValues } from './supervisory'; +export const Supervisory = { getSupervisoryOrgValues }; + +import { getWorkStudyAwards } from './work'; +export const Work = { getWorkStudyAwards }; + +import { + getWorkerBusinessTitleChanges, + getWorkerEligibleAbsenceTypes, + getWorkerInfo, + getWorkerLeavesOfAbsence, + getWorkerServiceDates, + getWorkerStaffingInformation, + getWorkerTimeOffDetails, + getWorkerTypes, + getWorkerValidTimeOffDates, + retrieveWorkerLeaveOfAbsenceSubresource, +} from './worker'; +export const Worker = { + getWorkerBusinessTitleChanges, + getWorkerEligibleAbsenceTypes, + getWorkerInfo, + getWorkerLeavesOfAbsence, + getWorkerServiceDates, + getWorkerStaffingInformation, + getWorkerTimeOffDetails, + getWorkerTypes, + getWorkerValidTimeOffDates, + retrieveWorkerLeaveOfAbsenceSubresource, +}; + +import { getWorkersCollectionStaffing } from './workers'; +export const Workers = { getWorkersCollectionStaffing }; + +import { getWorkspaceInstances } from './workspace'; +export const Workspace = { getWorkspaceInstances }; + +import { listBalances } from './balances'; +export const Balances = { listBalances }; + +import { listCountries } from './countries'; +export const Countries = { listCountries }; + +import { listInterviews } from './interviews'; +export const Interviews = { listInterviews }; + +import { listJobs } from './jobs'; +export const Jobs = { listJobs }; + +import { updateAnExistingPayroll } from './an'; +export const An = { updateAnExistingPayroll }; + +import { updateMessageTemplateById } from './message'; +export const Message = { updateMessageTemplateById }; + +export * from './types'; diff --git a/packages/workday/endpoints/interview.ts b/packages/workday/endpoints/interview.ts new file mode 100644 index 000000000..8c3f258f3 --- /dev/null +++ b/packages/workday/endpoints/interview.ts @@ -0,0 +1,40 @@ +import { logEventFromContext } from 'corsair/core'; +import type { WorkdayEndpoints } from '..'; +import { makeWorkdayRequest } from '../client'; +import type { WorkdayEndpointOutputs } from './types'; + +export const getInterview: WorkdayEndpoints['getInterview'] = async ( + ctx, + input, +) => { + const response = await makeWorkdayRequest< + WorkdayEndpointOutputs['getInterview'] + >('v1/interview/api', ctx.key, { + method: 'POST', + body: input as { [key: string]: unknown }, + }); + await logEventFromContext( + ctx, + 'workday.interview.getInterview', + input ?? {}, + 'completed', + ); + return response; +}; + +export const getInterviewFeedback2: WorkdayEndpoints['getInterviewFeedback2'] = + async (ctx, input) => { + const response = await makeWorkdayRequest< + WorkdayEndpointOutputs['getInterviewFeedback2'] + >('v1/interview/api', ctx.key, { + method: 'POST', + body: input as { [key: string]: unknown }, + }); + await logEventFromContext( + ctx, + 'workday.interview.getInterviewFeedback2', + input ?? {}, + 'completed', + ); + return response; + }; diff --git a/packages/workday/endpoints/interviews.ts b/packages/workday/endpoints/interviews.ts new file mode 100644 index 000000000..11f67ebfd --- /dev/null +++ b/packages/workday/endpoints/interviews.ts @@ -0,0 +1,23 @@ +import { logEventFromContext } from 'corsair/core'; +import type { WorkdayEndpoints } from '..'; +import { makeWorkdayRequest } from '../client'; +import type { WorkdayEndpointOutputs } from './types'; + +export const listInterviews: WorkdayEndpoints['listInterviews'] = async ( + ctx, + input, +) => { + const response = await makeWorkdayRequest< + WorkdayEndpointOutputs['listInterviews'] + >('v1/interviews/api', ctx.key, { + method: 'POST', + body: input as { [key: string]: unknown }, + }); + await logEventFromContext( + ctx, + 'workday.interviews.listInterviews', + input ?? {}, + 'completed', + ); + return response; +}; diff --git a/packages/workday/endpoints/job.ts b/packages/workday/endpoints/job.ts new file mode 100644 index 000000000..10b7b55bb --- /dev/null +++ b/packages/workday/endpoints/job.ts @@ -0,0 +1,356 @@ +import { logEventFromContext } from 'corsair/core'; +import type { WorkdayEndpoints } from '..'; +import { makeWorkdayRequest } from '../client'; +import type { WorkdayEndpointOutputs } from './types'; + +export const createJobChange: WorkdayEndpoints['createJobChange'] = async ( + ctx, + input, +) => { + const response = await makeWorkdayRequest< + WorkdayEndpointOutputs['createJobChange'] + >('v1/job/api', ctx.key, { + method: 'POST', + body: input as { [key: string]: unknown }, + }); + await logEventFromContext( + ctx, + 'workday.job.createJobChange', + input ?? {}, + 'completed', + ); + return response; +}; + +export const getJobById: WorkdayEndpoints['getJobById'] = async ( + ctx, + input, +) => { + const response = await makeWorkdayRequest< + WorkdayEndpointOutputs['getJobById'] + >('v1/job/api', ctx.key, { + method: 'POST', + body: input as { [key: string]: unknown }, + }); + await logEventFromContext( + ctx, + 'workday.job.getJobById', + input ?? {}, + 'completed', + ); + return response; +}; + +export const getJobChangeFrequencies: WorkdayEndpoints['getJobChangeFrequencies'] = + async (ctx, input) => { + const response = await makeWorkdayRequest< + WorkdayEndpointOutputs['getJobChangeFrequencies'] + >('v1/job/api', ctx.key, { + method: 'POST', + body: input as { [key: string]: unknown }, + }); + await logEventFromContext( + ctx, + 'workday.job.getJobChangeFrequencies', + input ?? {}, + 'completed', + ); + return response; + }; + +export const getJobChangeLocationInfo: WorkdayEndpoints['getJobChangeLocationInfo'] = + async (ctx, input) => { + const response = await makeWorkdayRequest< + WorkdayEndpointOutputs['getJobChangeLocationInfo'] + >('v1/job/api', ctx.key, { + method: 'POST', + body: input as { [key: string]: unknown }, + }); + await logEventFromContext( + ctx, + 'workday.job.getJobChangeLocationInfo', + input ?? {}, + 'completed', + ); + return response; + }; + +export const getJobChangePosition: WorkdayEndpoints['getJobChangePosition'] = + async (ctx, input) => { + const response = await makeWorkdayRequest< + WorkdayEndpointOutputs['getJobChangePosition'] + >('v1/job/api', ctx.key, { + method: 'POST', + body: input as { [key: string]: unknown }, + }); + await logEventFromContext( + ctx, + 'workday.job.getJobChangePosition', + input ?? {}, + 'completed', + ); + return response; + }; + +export const getJobChangeReasonInstance: WorkdayEndpoints['getJobChangeReasonInstance'] = + async (ctx, input) => { + const response = await makeWorkdayRequest< + WorkdayEndpointOutputs['getJobChangeReasonInstance'] + >('v1/job/api', ctx.key, { + method: 'POST', + body: input as { [key: string]: unknown }, + }); + await logEventFromContext( + ctx, + 'workday.job.getJobChangeReasonInstance', + input ?? {}, + 'completed', + ); + return response; + }; + +export const getJobChangeReasonValues: WorkdayEndpoints['getJobChangeReasonValues'] = + async (ctx, input) => { + const response = await makeWorkdayRequest< + WorkdayEndpointOutputs['getJobChangeReasonValues'] + >('v1/job/api', ctx.key, { + method: 'POST', + body: input as { [key: string]: unknown }, + }); + await logEventFromContext( + ctx, + 'workday.job.getJobChangeReasonValues', + input ?? {}, + 'completed', + ); + return response; + }; + +export const getJobChangeReasons: WorkdayEndpoints['getJobChangeReasons'] = + async (ctx, input) => { + const response = await makeWorkdayRequest< + WorkdayEndpointOutputs['getJobChangeReasons'] + >('v1/job/api', ctx.key, { + method: 'POST', + body: input as { [key: string]: unknown }, + }); + await logEventFromContext( + ctx, + 'workday.job.getJobChangeReasons', + input ?? {}, + 'completed', + ); + return response; + }; + +export const getJobChangesGroupTemplates: WorkdayEndpoints['getJobChangesGroupTemplates'] = + async (ctx, input) => { + const response = await makeWorkdayRequest< + WorkdayEndpointOutputs['getJobChangesGroupTemplates'] + >('v1/job/api', ctx.key, { + method: 'POST', + body: input as { [key: string]: unknown }, + }); + await logEventFromContext( + ctx, + 'workday.job.getJobChangesGroupTemplates', + input ?? {}, + 'completed', + ); + return response; + }; + +export const getJobChangesJobValues: WorkdayEndpoints['getJobChangesJobValues'] = + async (ctx, input) => { + const response = await makeWorkdayRequest< + WorkdayEndpointOutputs['getJobChangesJobValues'] + >('v1/job/api', ctx.key, { + method: 'POST', + body: input as { [key: string]: unknown }, + }); + await logEventFromContext( + ctx, + 'workday.job.getJobChangesJobValues', + input ?? {}, + 'completed', + ); + return response; + }; + +export const getJobChangesWorkerValues: WorkdayEndpoints['getJobChangesWorkerValues'] = + async (ctx, input) => { + const response = await makeWorkdayRequest< + WorkdayEndpointOutputs['getJobChangesWorkerValues'] + >('v1/job/api', ctx.key, { + method: 'POST', + body: input as { [key: string]: unknown }, + }); + await logEventFromContext( + ctx, + 'workday.job.getJobChangesWorkerValues', + input ?? {}, + 'completed', + ); + return response; + }; + +export const getJobClassifications: WorkdayEndpoints['getJobClassifications'] = + async (ctx, input) => { + const response = await makeWorkdayRequest< + WorkdayEndpointOutputs['getJobClassifications'] + >('v1/job/api', ctx.key, { + method: 'POST', + body: input as { [key: string]: unknown }, + }); + await logEventFromContext( + ctx, + 'workday.job.getJobClassifications', + input ?? {}, + 'completed', + ); + return response; + }; + +export const getJobPosting: WorkdayEndpoints['getJobPosting'] = async ( + ctx, + input, +) => { + const response = await makeWorkdayRequest< + WorkdayEndpointOutputs['getJobPosting'] + >('v1/job/api', ctx.key, { + method: 'POST', + body: input as { [key: string]: unknown }, + }); + await logEventFromContext( + ctx, + 'workday.job.getJobPosting', + input ?? {}, + 'completed', + ); + return response; +}; + +export const getJobPostingQuestionnaire: WorkdayEndpoints['getJobPostingQuestionnaire'] = + async (ctx, input) => { + const response = await makeWorkdayRequest< + WorkdayEndpointOutputs['getJobPostingQuestionnaire'] + >('v1/job/api', ctx.key, { + method: 'POST', + body: input as { [key: string]: unknown }, + }); + await logEventFromContext( + ctx, + 'workday.job.getJobPostingQuestionnaire', + input ?? {}, + 'completed', + ); + return response; + }; + +export const getJobProfilesValues: WorkdayEndpoints['getJobProfilesValues'] = + async (ctx, input) => { + const response = await makeWorkdayRequest< + WorkdayEndpointOutputs['getJobProfilesValues'] + >('v1/job/api', ctx.key, { + method: 'POST', + body: input as { [key: string]: unknown }, + }); + await logEventFromContext( + ctx, + 'workday.job.getJobProfilesValues', + input ?? {}, + 'completed', + ); + return response; + }; + +export const getJobRequisitionValues: WorkdayEndpoints['getJobRequisitionValues'] = + async (ctx, input) => { + const response = await makeWorkdayRequest< + WorkdayEndpointOutputs['getJobRequisitionValues'] + >('v1/job/api', ctx.key, { + method: 'POST', + body: input as { [key: string]: unknown }, + }); + await logEventFromContext( + ctx, + 'workday.job.getJobRequisitionValues', + input ?? {}, + 'completed', + ); + return response; + }; + +export const getJobWorkspace: WorkdayEndpoints['getJobWorkspace'] = async ( + ctx, + input, +) => { + const response = await makeWorkdayRequest< + WorkdayEndpointOutputs['getJobWorkspace'] + >('v1/job/api', ctx.key, { + method: 'POST', + body: input as { [key: string]: unknown }, + }); + await logEventFromContext( + ctx, + 'workday.job.getJobWorkspace', + input ?? {}, + 'completed', + ); + return response; +}; + +export const getJobWorkspaces: WorkdayEndpoints['getJobWorkspaces'] = async ( + ctx, + input, +) => { + const response = await makeWorkdayRequest< + WorkdayEndpointOutputs['getJobWorkspaces'] + >('v1/job/api', ctx.key, { + method: 'POST', + body: input as { [key: string]: unknown }, + }); + await logEventFromContext( + ctx, + 'workday.job.getJobWorkspaces', + input ?? {}, + 'completed', + ); + return response; +}; + +export const listJobPostings: WorkdayEndpoints['listJobPostings'] = async ( + ctx, + input, +) => { + const response = await makeWorkdayRequest< + WorkdayEndpointOutputs['listJobPostings'] + >('v1/job/api', ctx.key, { + method: 'POST', + body: input as { [key: string]: unknown }, + }); + await logEventFromContext( + ctx, + 'workday.job.listJobPostings', + input ?? {}, + 'completed', + ); + return response; +}; + +export const updateJobChangeBusinessTitle: WorkdayEndpoints['updateJobChangeBusinessTitle'] = + async (ctx, input) => { + const response = await makeWorkdayRequest< + WorkdayEndpointOutputs['updateJobChangeBusinessTitle'] + >('v1/job/api', ctx.key, { + method: 'POST', + body: input as { [key: string]: unknown }, + }); + await logEventFromContext( + ctx, + 'workday.job.updateJobChangeBusinessTitle', + input ?? {}, + 'completed', + ); + return response; + }; diff --git a/packages/workday/endpoints/jobs.ts b/packages/workday/endpoints/jobs.ts new file mode 100644 index 000000000..40ec432a7 --- /dev/null +++ b/packages/workday/endpoints/jobs.ts @@ -0,0 +1,19 @@ +import { logEventFromContext } from 'corsair/core'; +import type { WorkdayEndpoints } from '..'; +import { makeWorkdayRequest } from '../client'; +import type { WorkdayEndpointOutputs } from './types'; + +export const listJobs: WorkdayEndpoints['listJobs'] = async (ctx, input) => { + const response = await makeWorkdayRequest( + 'v1/jobs/api', + ctx.key, + { method: 'POST', body: input as { [key: string]: unknown } }, + ); + await logEventFromContext( + ctx, + 'workday.jobs.listJobs', + input ?? {}, + 'completed', + ); + return response; +}; diff --git a/packages/workday/endpoints/leave.ts b/packages/workday/endpoints/leave.ts new file mode 100644 index 000000000..ff5874716 --- /dev/null +++ b/packages/workday/endpoints/leave.ts @@ -0,0 +1,21 @@ +import { logEventFromContext } from 'corsair/core'; +import type { WorkdayEndpoints } from '..'; +import { makeWorkdayRequest } from '../client'; +import type { WorkdayEndpointOutputs } from './types'; + +export const getLeaveStatusValues: WorkdayEndpoints['getLeaveStatusValues'] = + async (ctx, input) => { + const response = await makeWorkdayRequest< + WorkdayEndpointOutputs['getLeaveStatusValues'] + >('v1/leave/api', ctx.key, { + method: 'POST', + body: input as { [key: string]: unknown }, + }); + await logEventFromContext( + ctx, + 'workday.leave.getLeaveStatusValues', + input ?? {}, + 'completed', + ); + return response; + }; diff --git a/packages/workday/endpoints/message.ts b/packages/workday/endpoints/message.ts new file mode 100644 index 000000000..4f4fd28b2 --- /dev/null +++ b/packages/workday/endpoints/message.ts @@ -0,0 +1,21 @@ +import { logEventFromContext } from 'corsair/core'; +import type { WorkdayEndpoints } from '..'; +import { makeWorkdayRequest } from '../client'; +import type { WorkdayEndpointOutputs } from './types'; + +export const updateMessageTemplateById: WorkdayEndpoints['updateMessageTemplateById'] = + async (ctx, input) => { + const response = await makeWorkdayRequest< + WorkdayEndpointOutputs['updateMessageTemplateById'] + >('v1/message/api', ctx.key, { + method: 'POST', + body: input as { [key: string]: unknown }, + }); + await logEventFromContext( + ctx, + 'workday.message.updateMessageTemplateById', + input ?? {}, + 'completed', + ); + return response; + }; diff --git a/packages/workday/endpoints/my.ts b/packages/workday/endpoints/my.ts new file mode 100644 index 000000000..43abfbf02 --- /dev/null +++ b/packages/workday/endpoints/my.ts @@ -0,0 +1,23 @@ +import { logEventFromContext } from 'corsair/core'; +import type { WorkdayEndpoints } from '..'; +import { makeWorkdayRequest } from '../client'; +import type { WorkdayEndpointOutputs } from './types'; + +export const getMyJobPostings: WorkdayEndpoints['getMyJobPostings'] = async ( + ctx, + input, +) => { + const response = await makeWorkdayRequest< + WorkdayEndpointOutputs['getMyJobPostings'] + >('v1/my/api', ctx.key, { + method: 'POST', + body: input as { [key: string]: unknown }, + }); + await logEventFromContext( + ctx, + 'workday.my.getMyJobPostings', + input ?? {}, + 'completed', + ); + return response; +}; diff --git a/packages/workday/endpoints/organization.ts b/packages/workday/endpoints/organization.ts new file mode 100644 index 000000000..956b4dd31 --- /dev/null +++ b/packages/workday/endpoints/organization.ts @@ -0,0 +1,89 @@ +import { logEventFromContext } from 'corsair/core'; +import type { WorkdayEndpoints } from '..'; +import { makeWorkdayRequest } from '../client'; +import type { WorkdayEndpointOutputs } from './types'; + +export const getOrganizationAssignmentBusinessUnits: WorkdayEndpoints['getOrganizationAssignmentBusinessUnits'] = + async (ctx, input) => { + const response = await makeWorkdayRequest< + WorkdayEndpointOutputs['getOrganizationAssignmentBusinessUnits'] + >('v1/organization/api', ctx.key, { + method: 'POST', + body: input as { [key: string]: unknown }, + }); + await logEventFromContext( + ctx, + 'workday.organization.getOrganizationAssignmentBusinessUnits', + input ?? {}, + 'completed', + ); + return response; + }; + +export const getOrganizationAssignmentCustoms: WorkdayEndpoints['getOrganizationAssignmentCustoms'] = + async (ctx, input) => { + const response = await makeWorkdayRequest< + WorkdayEndpointOutputs['getOrganizationAssignmentCustoms'] + >('v1/organization/api', ctx.key, { + method: 'POST', + body: input as { [key: string]: unknown }, + }); + await logEventFromContext( + ctx, + 'workday.organization.getOrganizationAssignmentCustoms', + input ?? {}, + 'completed', + ); + return response; + }; + +export const getOrganizationAssignmentFunds: WorkdayEndpoints['getOrganizationAssignmentFunds'] = + async (ctx, input) => { + const response = await makeWorkdayRequest< + WorkdayEndpointOutputs['getOrganizationAssignmentFunds'] + >('v1/organization/api', ctx.key, { + method: 'POST', + body: input as { [key: string]: unknown }, + }); + await logEventFromContext( + ctx, + 'workday.organization.getOrganizationAssignmentFunds', + input ?? {}, + 'completed', + ); + return response; + }; + +export const getOrganizationAssignmentRegions: WorkdayEndpoints['getOrganizationAssignmentRegions'] = + async (ctx, input) => { + const response = await makeWorkdayRequest< + WorkdayEndpointOutputs['getOrganizationAssignmentRegions'] + >('v1/organization/api', ctx.key, { + method: 'POST', + body: input as { [key: string]: unknown }, + }); + await logEventFromContext( + ctx, + 'workday.organization.getOrganizationAssignmentRegions', + input ?? {}, + 'completed', + ); + return response; + }; + +export const getOrganizationAssignmentWorkers: WorkdayEndpoints['getOrganizationAssignmentWorkers'] = + async (ctx, input) => { + const response = await makeWorkdayRequest< + WorkdayEndpointOutputs['getOrganizationAssignmentWorkers'] + >('v1/organization/api', ctx.key, { + method: 'POST', + body: input as { [key: string]: unknown }, + }); + await logEventFromContext( + ctx, + 'workday.organization.getOrganizationAssignmentWorkers', + input ?? {}, + 'completed', + ); + return response; + }; diff --git a/packages/workday/endpoints/pay.ts b/packages/workday/endpoints/pay.ts new file mode 100644 index 000000000..d63385c6e --- /dev/null +++ b/packages/workday/endpoints/pay.ts @@ -0,0 +1,55 @@ +import { logEventFromContext } from 'corsair/core'; +import type { WorkdayEndpoints } from '..'; +import { makeWorkdayRequest } from '../client'; +import type { WorkdayEndpointOutputs } from './types'; + +export const getPayGroupByJobId: WorkdayEndpoints['getPayGroupByJobId'] = + async (ctx, input) => { + const response = await makeWorkdayRequest< + WorkdayEndpointOutputs['getPayGroupByJobId'] + >('v1/pay/api', ctx.key, { + method: 'POST', + body: input as { [key: string]: unknown }, + }); + await logEventFromContext( + ctx, + 'workday.pay.getPayGroupByJobId', + input ?? {}, + 'completed', + ); + return response; + }; + +export const getPaySlipInstancesForWorker: WorkdayEndpoints['getPaySlipInstancesForWorker'] = + async (ctx, input) => { + const response = await makeWorkdayRequest< + WorkdayEndpointOutputs['getPaySlipInstancesForWorker'] + >('v1/pay/api', ctx.key, { + method: 'POST', + body: input as { [key: string]: unknown }, + }); + await logEventFromContext( + ctx, + 'workday.pay.getPaySlipInstancesForWorker', + input ?? {}, + 'completed', + ); + return response; + }; + +export const getPaySlipsForWorker: WorkdayEndpoints['getPaySlipsForWorker'] = + async (ctx, input) => { + const response = await makeWorkdayRequest< + WorkdayEndpointOutputs['getPaySlipsForWorker'] + >('v1/pay/api', ctx.key, { + method: 'POST', + body: input as { [key: string]: unknown }, + }); + await logEventFromContext( + ctx, + 'workday.pay.getPaySlipsForWorker', + input ?? {}, + 'completed', + ); + return response; + }; diff --git a/packages/workday/endpoints/payroll.ts b/packages/workday/endpoints/payroll.ts new file mode 100644 index 000000000..547d94441 --- /dev/null +++ b/packages/workday/endpoints/payroll.ts @@ -0,0 +1,38 @@ +import { logEventFromContext } from 'corsair/core'; +import type { WorkdayEndpoints } from '..'; +import { makeWorkdayRequest } from '../client'; +import type { WorkdayEndpointOutputs } from './types'; + +export const createPayrollInputs: WorkdayEndpoints['createPayrollInputs'] = + async (ctx, input) => { + const response = await makeWorkdayRequest< + WorkdayEndpointOutputs['createPayrollInputs'] + >('v1/payroll/api', ctx.key, { + method: 'POST', + body: input as { [key: string]: unknown }, + }); + await logEventFromContext( + ctx, + 'workday.payroll.createPayrollInputs', + input ?? {}, + 'completed', + ); + return response; + }; + +export const getPayrollInputInstance: WorkdayEndpoints['getPayrollInputInstance'] = + async (ctx, input) => { + const response = await makeWorkdayRequest< + WorkdayEndpointOutputs['getPayrollInputInstance'] + >('v1/payroll/api', ctx.key, { + method: 'POST', + body: input as { [key: string]: unknown }, + }); + await logEventFromContext( + ctx, + 'workday.payroll.getPayrollInputInstance', + input ?? {}, + 'completed', + ); + return response; + }; diff --git a/packages/workday/endpoints/proposed.ts b/packages/workday/endpoints/proposed.ts new file mode 100644 index 000000000..974a4742c --- /dev/null +++ b/packages/workday/endpoints/proposed.ts @@ -0,0 +1,21 @@ +import { logEventFromContext } from 'corsair/core'; +import type { WorkdayEndpoints } from '..'; +import { makeWorkdayRequest } from '../client'; +import type { WorkdayEndpointOutputs } from './types'; + +export const getProposedPositionValues: WorkdayEndpoints['getProposedPositionValues'] = + async (ctx, input) => { + const response = await makeWorkdayRequest< + WorkdayEndpointOutputs['getProposedPositionValues'] + >('v1/proposed/api', ctx.key, { + method: 'POST', + body: input as { [key: string]: unknown }, + }); + await logEventFromContext( + ctx, + 'workday.proposed.getProposedPositionValues', + input ?? {}, + 'completed', + ); + return response; + }; diff --git a/packages/workday/endpoints/prospect.ts b/packages/workday/endpoints/prospect.ts new file mode 100644 index 000000000..86b18bd49 --- /dev/null +++ b/packages/workday/endpoints/prospect.ts @@ -0,0 +1,93 @@ +import { logEventFromContext } from 'corsair/core'; +import type { WorkdayEndpoints } from '..'; +import { makeWorkdayRequest } from '../client'; +import type { WorkdayEndpointOutputs } from './types'; + +export const getProspect: WorkdayEndpoints['getProspect'] = async ( + ctx, + input, +) => { + const response = await makeWorkdayRequest< + WorkdayEndpointOutputs['getProspect'] + >('v1/prospect/api', ctx.key, { + method: 'POST', + body: input as { [key: string]: unknown }, + }); + await logEventFromContext( + ctx, + 'workday.prospect.getProspect', + input ?? {}, + 'completed', + ); + return response; +}; + +export const getProspectEducations: WorkdayEndpoints['getProspectEducations'] = + async (ctx, input) => { + const response = await makeWorkdayRequest< + WorkdayEndpointOutputs['getProspectEducations'] + >('v1/prospect/api', ctx.key, { + method: 'POST', + body: input as { [key: string]: unknown }, + }); + await logEventFromContext( + ctx, + 'workday.prospect.getProspectEducations', + input ?? {}, + 'completed', + ); + return response; + }; + +export const getProspectExperiences: WorkdayEndpoints['getProspectExperiences'] = + async (ctx, input) => { + const response = await makeWorkdayRequest< + WorkdayEndpointOutputs['getProspectExperiences'] + >('v1/prospect/api', ctx.key, { + method: 'POST', + body: input as { [key: string]: unknown }, + }); + await logEventFromContext( + ctx, + 'workday.prospect.getProspectExperiences', + input ?? {}, + 'completed', + ); + return response; + }; + +export const getProspectResumeAttachments: WorkdayEndpoints['getProspectResumeAttachments'] = + async (ctx, input) => { + const response = await makeWorkdayRequest< + WorkdayEndpointOutputs['getProspectResumeAttachments'] + >('v1/prospect/api', ctx.key, { + method: 'POST', + body: input as { [key: string]: unknown }, + }); + await logEventFromContext( + ctx, + 'workday.prospect.getProspectResumeAttachments', + input ?? {}, + 'completed', + ); + return response; + }; + +export const getProspectSkills: WorkdayEndpoints['getProspectSkills'] = async ( + ctx, + input, +) => { + const response = await makeWorkdayRequest< + WorkdayEndpointOutputs['getProspectSkills'] + >('v1/prospect/api', ctx.key, { + method: 'POST', + body: input as { [key: string]: unknown }, + }); + await logEventFromContext( + ctx, + 'workday.prospect.getProspectSkills', + input ?? {}, + 'completed', + ); + return response; +}; diff --git a/packages/workday/endpoints/supervisory.ts b/packages/workday/endpoints/supervisory.ts new file mode 100644 index 000000000..88ed37806 --- /dev/null +++ b/packages/workday/endpoints/supervisory.ts @@ -0,0 +1,21 @@ +import { logEventFromContext } from 'corsair/core'; +import type { WorkdayEndpoints } from '..'; +import { makeWorkdayRequest } from '../client'; +import type { WorkdayEndpointOutputs } from './types'; + +export const getSupervisoryOrgValues: WorkdayEndpoints['getSupervisoryOrgValues'] = + async (ctx, input) => { + const response = await makeWorkdayRequest< + WorkdayEndpointOutputs['getSupervisoryOrgValues'] + >('v1/supervisory/api', ctx.key, { + method: 'POST', + body: input as { [key: string]: unknown }, + }); + await logEventFromContext( + ctx, + 'workday.supervisory.getSupervisoryOrgValues', + input ?? {}, + 'completed', + ); + return response; + }; diff --git a/packages/workday/endpoints/time.ts b/packages/workday/endpoints/time.ts new file mode 100644 index 000000000..2b591e302 --- /dev/null +++ b/packages/workday/endpoints/time.ts @@ -0,0 +1,91 @@ +import { logEventFromContext } from 'corsair/core'; +import type { WorkdayEndpoints } from '..'; +import { makeWorkdayRequest } from '../client'; +import type { WorkdayEndpointOutputs } from './types'; + +export const createTimeOffRequest: WorkdayEndpoints['createTimeOffRequest'] = + async (ctx, input) => { + const response = await makeWorkdayRequest< + WorkdayEndpointOutputs['createTimeOffRequest'] + >('v1/time/api', ctx.key, { + method: 'POST', + body: input as { [key: string]: unknown }, + }); + await logEventFromContext( + ctx, + 'workday.time.createTimeOffRequest', + input ?? {}, + 'completed', + ); + return response; + }; + +export const getTimeOffEntriesForWorker: WorkdayEndpoints['getTimeOffEntriesForWorker'] = + async (ctx, input) => { + const response = await makeWorkdayRequest< + WorkdayEndpointOutputs['getTimeOffEntriesForWorker'] + >('v1/time/api', ctx.key, { + method: 'POST', + body: input as { [key: string]: unknown }, + }); + await logEventFromContext( + ctx, + 'workday.time.getTimeOffEntriesForWorker', + input ?? {}, + 'completed', + ); + return response; + }; + +export const getTimeOffPlansForWorker: WorkdayEndpoints['getTimeOffPlansForWorker'] = + async (ctx, input) => { + const response = await makeWorkdayRequest< + WorkdayEndpointOutputs['getTimeOffPlansForWorker'] + >('v1/time/api', ctx.key, { + method: 'POST', + body: input as { [key: string]: unknown }, + }); + await logEventFromContext( + ctx, + 'workday.time.getTimeOffPlansForWorker', + input ?? {}, + 'completed', + ); + return response; + }; + +export const getTimeOffStatusValues: WorkdayEndpoints['getTimeOffStatusValues'] = + async (ctx, input) => { + const response = await makeWorkdayRequest< + WorkdayEndpointOutputs['getTimeOffStatusValues'] + >('v1/time/api', ctx.key, { + method: 'POST', + body: input as { [key: string]: unknown }, + }); + await logEventFromContext( + ctx, + 'workday.time.getTimeOffStatusValues', + input ?? {}, + 'completed', + ); + return response; + }; + +export const getTimeTypes: WorkdayEndpoints['getTimeTypes'] = async ( + ctx, + input, +) => { + const response = await makeWorkdayRequest< + WorkdayEndpointOutputs['getTimeTypes'] + >('v1/time/api', ctx.key, { + method: 'POST', + body: input as { [key: string]: unknown }, + }); + await logEventFromContext( + ctx, + 'workday.time.getTimeTypes', + input ?? {}, + 'completed', + ); + return response; +}; diff --git a/packages/workday/endpoints/types.ts b/packages/workday/endpoints/types.ts new file mode 100644 index 000000000..2b38d4e45 --- /dev/null +++ b/packages/workday/endpoints/types.ts @@ -0,0 +1,1068 @@ +import { z } from 'zod'; + +const CreateBusinessTitleChangeInputSchema = z.object({}).optional(); +export type CreateBusinessTitleChangeInput = z.infer< + typeof CreateBusinessTitleChangeInputSchema +>; + +const CreateBusinessTitleChangeResponseSchema = z + .object({}) + .catchall(z.unknown()); +export type CreateBusinessTitleChangeResponse = z.infer< + typeof CreateBusinessTitleChangeResponseSchema +>; + +const CreateJobChangeInputSchema = z.object({}).optional(); +export type CreateJobChangeInput = z.infer; + +const CreateJobChangeResponseSchema = z.object({}).catchall(z.unknown()); +export type CreateJobChangeResponse = z.infer< + typeof CreateJobChangeResponseSchema +>; + +const CreatePayrollInputsInputSchema = z.object({}).optional(); +export type CreatePayrollInputsInput = z.infer< + typeof CreatePayrollInputsInputSchema +>; + +const CreatePayrollInputsResponseSchema = z.object({}).catchall(z.unknown()); +export type CreatePayrollInputsResponse = z.infer< + typeof CreatePayrollInputsResponseSchema +>; + +const CreateTimeOffRequestInputSchema = z.object({}).optional(); +export type CreateTimeOffRequestInput = z.infer< + typeof CreateTimeOffRequestInputSchema +>; + +const CreateTimeOffRequestResponseSchema = z.object({}).catchall(z.unknown()); +export type CreateTimeOffRequestResponse = z.infer< + typeof CreateTimeOffRequestResponseSchema +>; + +const GetAbsenceBalanceInputSchema = z.object({}).optional(); +export type GetAbsenceBalanceInput = z.infer< + typeof GetAbsenceBalanceInputSchema +>; + +const GetAbsenceBalanceResponseSchema = z.object({}).catchall(z.unknown()); +export type GetAbsenceBalanceResponse = z.infer< + typeof GetAbsenceBalanceResponseSchema +>; + +const GetAssignmentChangeGroupCostCentersInputSchema = z.object({}).optional(); +export type GetAssignmentChangeGroupCostCentersInput = z.infer< + typeof GetAssignmentChangeGroupCostCentersInputSchema +>; + +const GetAssignmentChangeGroupCostCentersResponseSchema = z + .object({}) + .catchall(z.unknown()); +export type GetAssignmentChangeGroupCostCentersResponse = z.infer< + typeof GetAssignmentChangeGroupCostCentersResponseSchema +>; + +const GetAssignmentChangeGroupJobsInputSchema = z.object({}).optional(); +export type GetAssignmentChangeGroupJobsInput = z.infer< + typeof GetAssignmentChangeGroupJobsInputSchema +>; + +const GetAssignmentChangeGroupJobsResponseSchema = z + .object({}) + .catchall(z.unknown()); +export type GetAssignmentChangeGroupJobsResponse = z.infer< + typeof GetAssignmentChangeGroupJobsResponseSchema +>; + +const GetAssignmentTypesInputSchema = z.object({}).optional(); +export type GetAssignmentTypesInput = z.infer< + typeof GetAssignmentTypesInputSchema +>; + +const GetAssignmentTypesResponseSchema = z.object({}).catchall(z.unknown()); +export type GetAssignmentTypesResponse = z.infer< + typeof GetAssignmentTypesResponseSchema +>; + +const GetBusinessTitleChangeInputSchema = z.object({}).optional(); +export type GetBusinessTitleChangeInput = z.infer< + typeof GetBusinessTitleChangeInputSchema +>; + +const GetBusinessTitleChangeResponseSchema = z.object({}).catchall(z.unknown()); +export type GetBusinessTitleChangeResponse = z.infer< + typeof GetBusinessTitleChangeResponseSchema +>; + +const GetBusinessTitleChangeForWorkerInputSchema = z.object({}).optional(); +export type GetBusinessTitleChangeForWorkerInput = z.infer< + typeof GetBusinessTitleChangeForWorkerInputSchema +>; + +const GetBusinessTitleChangeForWorkerResponseSchema = z + .object({}) + .catchall(z.unknown()); +export type GetBusinessTitleChangeForWorkerResponse = z.infer< + typeof GetBusinessTitleChangeForWorkerResponseSchema +>; + +const GetCandidateAvailabilityTemplateInputSchema = z.object({}).optional(); +export type GetCandidateAvailabilityTemplateInput = z.infer< + typeof GetCandidateAvailabilityTemplateInputSchema +>; + +const GetCandidateAvailabilityTemplateResponseSchema = z + .object({}) + .catchall(z.unknown()); +export type GetCandidateAvailabilityTemplateResponse = z.infer< + typeof GetCandidateAvailabilityTemplateResponseSchema +>; + +const GetCollectionOfJobsInputSchema = z.object({}).optional(); +export type GetCollectionOfJobsInput = z.infer< + typeof GetCollectionOfJobsInputSchema +>; + +const GetCollectionOfJobsResponseSchema = z.object({}).catchall(z.unknown()); +export type GetCollectionOfJobsResponse = z.infer< + typeof GetCollectionOfJobsResponseSchema +>; + +const GetCollectionOfPayrollInputSchema = z.object({}).optional(); +export type GetCollectionOfPayrollInput = z.infer< + typeof GetCollectionOfPayrollInputSchema +>; + +const GetCollectionOfPayrollResponseSchema = z.object({}).catchall(z.unknown()); +export type GetCollectionOfPayrollResponse = z.infer< + typeof GetCollectionOfPayrollResponseSchema +>; + +const GetCompanyInsiderTypesInputSchema = z.object({}).optional(); +export type GetCompanyInsiderTypesInput = z.infer< + typeof GetCompanyInsiderTypesInputSchema +>; + +const GetCompanyInsiderTypesResponseSchema = z.object({}).catchall(z.unknown()); +export type GetCompanyInsiderTypesResponse = z.infer< + typeof GetCompanyInsiderTypesResponseSchema +>; + +const GetContingentWorkerTypesInputSchema = z.object({}).optional(); +export type GetContingentWorkerTypesInput = z.infer< + typeof GetContingentWorkerTypesInputSchema +>; + +const GetContingentWorkerTypesResponseSchema = z + .object({}) + .catchall(z.unknown()); +export type GetContingentWorkerTypesResponse = z.infer< + typeof GetContingentWorkerTypesResponseSchema +>; + +const GetCountryInfoInputSchema = z.object({}).optional(); +export type GetCountryInfoInput = z.infer; + +const GetCountryInfoResponseSchema = z.object({}).catchall(z.unknown()); +export type GetCountryInfoResponse = z.infer< + typeof GetCountryInfoResponseSchema +>; + +const GetCurrenciesInputSchema = z.object({}).optional(); +export type GetCurrenciesInput = z.infer; + +const GetCurrenciesResponseSchema = z.object({}).catchall(z.unknown()); +export type GetCurrenciesResponse = z.infer; + +const GetCurrentUserInputSchema = z.object({}).optional(); +export type GetCurrentUserInput = z.infer; + +const GetCurrentUserResponseSchema = z.object({}).catchall(z.unknown()); +export type GetCurrentUserResponse = z.infer< + typeof GetCurrentUserResponseSchema +>; + +const GetGrantsInputSchema = z.object({}).optional(); +export type GetGrantsInput = z.infer; + +const GetGrantsResponseSchema = z.object({}).catchall(z.unknown()); +export type GetGrantsResponse = z.infer; + +const GetHeadcountOptionsInputSchema = z.object({}).optional(); +export type GetHeadcountOptionsInput = z.infer< + typeof GetHeadcountOptionsInputSchema +>; + +const GetHeadcountOptionsResponseSchema = z.object({}).catchall(z.unknown()); +export type GetHeadcountOptionsResponse = z.infer< + typeof GetHeadcountOptionsResponseSchema +>; + +const GetHistoryInstanceForWorkerInputSchema = z.object({}).optional(); +export type GetHistoryInstanceForWorkerInput = z.infer< + typeof GetHistoryInstanceForWorkerInputSchema +>; + +const GetHistoryInstanceForWorkerResponseSchema = z + .object({}) + .catchall(z.unknown()); +export type GetHistoryInstanceForWorkerResponse = z.infer< + typeof GetHistoryInstanceForWorkerResponseSchema +>; + +const GetHistoryItemsForWorkerInputSchema = z.object({}).optional(); +export type GetHistoryItemsForWorkerInput = z.infer< + typeof GetHistoryItemsForWorkerInputSchema +>; + +const GetHistoryItemsForWorkerResponseSchema = z + .object({}) + .catchall(z.unknown()); +export type GetHistoryItemsForWorkerResponse = z.infer< + typeof GetHistoryItemsForWorkerResponseSchema +>; + +const GetHolidayEventsInputSchema = z.object({}).optional(); +export type GetHolidayEventsInput = z.infer; + +const GetHolidayEventsResponseSchema = z.object({}).catchall(z.unknown()); +export type GetHolidayEventsResponse = z.infer< + typeof GetHolidayEventsResponseSchema +>; + +const GetInterviewInputSchema = z.object({}).optional(); +export type GetInterviewInput = z.infer; + +const GetInterviewResponseSchema = z.object({}).catchall(z.unknown()); +export type GetInterviewResponse = z.infer; + +const GetInterviewFeedback2InputSchema = z.object({}).optional(); +export type GetInterviewFeedback2Input = z.infer< + typeof GetInterviewFeedback2InputSchema +>; + +const GetInterviewFeedback2ResponseSchema = z.object({}).catchall(z.unknown()); +export type GetInterviewFeedback2Response = z.infer< + typeof GetInterviewFeedback2ResponseSchema +>; + +const GetJobByIdInputSchema = z.object({}).optional(); +export type GetJobByIdInput = z.infer; + +const GetJobByIdResponseSchema = z.object({}).catchall(z.unknown()); +export type GetJobByIdResponse = z.infer; + +const GetJobChangeFrequenciesInputSchema = z.object({}).optional(); +export type GetJobChangeFrequenciesInput = z.infer< + typeof GetJobChangeFrequenciesInputSchema +>; + +const GetJobChangeFrequenciesResponseSchema = z + .object({}) + .catchall(z.unknown()); +export type GetJobChangeFrequenciesResponse = z.infer< + typeof GetJobChangeFrequenciesResponseSchema +>; + +const GetJobChangeLocationInfoInputSchema = z.object({}).optional(); +export type GetJobChangeLocationInfoInput = z.infer< + typeof GetJobChangeLocationInfoInputSchema +>; + +const GetJobChangeLocationInfoResponseSchema = z + .object({}) + .catchall(z.unknown()); +export type GetJobChangeLocationInfoResponse = z.infer< + typeof GetJobChangeLocationInfoResponseSchema +>; + +const GetJobChangePositionInputSchema = z.object({}).optional(); +export type GetJobChangePositionInput = z.infer< + typeof GetJobChangePositionInputSchema +>; + +const GetJobChangePositionResponseSchema = z.object({}).catchall(z.unknown()); +export type GetJobChangePositionResponse = z.infer< + typeof GetJobChangePositionResponseSchema +>; + +const GetJobChangeReasonInstanceInputSchema = z.object({}).optional(); +export type GetJobChangeReasonInstanceInput = z.infer< + typeof GetJobChangeReasonInstanceInputSchema +>; + +const GetJobChangeReasonInstanceResponseSchema = z + .object({}) + .catchall(z.unknown()); +export type GetJobChangeReasonInstanceResponse = z.infer< + typeof GetJobChangeReasonInstanceResponseSchema +>; + +const GetJobChangeReasonValuesInputSchema = z.object({}).optional(); +export type GetJobChangeReasonValuesInput = z.infer< + typeof GetJobChangeReasonValuesInputSchema +>; + +const GetJobChangeReasonValuesResponseSchema = z + .object({}) + .catchall(z.unknown()); +export type GetJobChangeReasonValuesResponse = z.infer< + typeof GetJobChangeReasonValuesResponseSchema +>; + +const GetJobChangeReasonsInputSchema = z.object({}).optional(); +export type GetJobChangeReasonsInput = z.infer< + typeof GetJobChangeReasonsInputSchema +>; + +const GetJobChangeReasonsResponseSchema = z.object({}).catchall(z.unknown()); +export type GetJobChangeReasonsResponse = z.infer< + typeof GetJobChangeReasonsResponseSchema +>; + +const GetJobChangesGroupTemplatesInputSchema = z.object({}).optional(); +export type GetJobChangesGroupTemplatesInput = z.infer< + typeof GetJobChangesGroupTemplatesInputSchema +>; + +const GetJobChangesGroupTemplatesResponseSchema = z + .object({}) + .catchall(z.unknown()); +export type GetJobChangesGroupTemplatesResponse = z.infer< + typeof GetJobChangesGroupTemplatesResponseSchema +>; + +const GetJobChangesJobValuesInputSchema = z.object({}).optional(); +export type GetJobChangesJobValuesInput = z.infer< + typeof GetJobChangesJobValuesInputSchema +>; + +const GetJobChangesJobValuesResponseSchema = z.object({}).catchall(z.unknown()); +export type GetJobChangesJobValuesResponse = z.infer< + typeof GetJobChangesJobValuesResponseSchema +>; + +const GetJobChangesWorkerValuesInputSchema = z.object({}).optional(); +export type GetJobChangesWorkerValuesInput = z.infer< + typeof GetJobChangesWorkerValuesInputSchema +>; + +const GetJobChangesWorkerValuesResponseSchema = z + .object({}) + .catchall(z.unknown()); +export type GetJobChangesWorkerValuesResponse = z.infer< + typeof GetJobChangesWorkerValuesResponseSchema +>; + +const GetJobClassificationsInputSchema = z.object({}).optional(); +export type GetJobClassificationsInput = z.infer< + typeof GetJobClassificationsInputSchema +>; + +const GetJobClassificationsResponseSchema = z.object({}).catchall(z.unknown()); +export type GetJobClassificationsResponse = z.infer< + typeof GetJobClassificationsResponseSchema +>; + +const GetJobPostingInputSchema = z.object({}).optional(); +export type GetJobPostingInput = z.infer; + +const GetJobPostingResponseSchema = z.object({}).catchall(z.unknown()); +export type GetJobPostingResponse = z.infer; + +const GetJobPostingQuestionnaireInputSchema = z.object({}).optional(); +export type GetJobPostingQuestionnaireInput = z.infer< + typeof GetJobPostingQuestionnaireInputSchema +>; + +const GetJobPostingQuestionnaireResponseSchema = z + .object({}) + .catchall(z.unknown()); +export type GetJobPostingQuestionnaireResponse = z.infer< + typeof GetJobPostingQuestionnaireResponseSchema +>; + +const GetJobProfilesValuesInputSchema = z.object({}).optional(); +export type GetJobProfilesValuesInput = z.infer< + typeof GetJobProfilesValuesInputSchema +>; + +const GetJobProfilesValuesResponseSchema = z.object({}).catchall(z.unknown()); +export type GetJobProfilesValuesResponse = z.infer< + typeof GetJobProfilesValuesResponseSchema +>; + +const GetJobRequisitionValuesInputSchema = z.object({}).optional(); +export type GetJobRequisitionValuesInput = z.infer< + typeof GetJobRequisitionValuesInputSchema +>; + +const GetJobRequisitionValuesResponseSchema = z + .object({}) + .catchall(z.unknown()); +export type GetJobRequisitionValuesResponse = z.infer< + typeof GetJobRequisitionValuesResponseSchema +>; + +const GetJobWorkspaceInputSchema = z.object({}).optional(); +export type GetJobWorkspaceInput = z.infer; + +const GetJobWorkspaceResponseSchema = z.object({}).catchall(z.unknown()); +export type GetJobWorkspaceResponse = z.infer< + typeof GetJobWorkspaceResponseSchema +>; + +const GetJobWorkspacesInputSchema = z.object({}).optional(); +export type GetJobWorkspacesInput = z.infer; + +const GetJobWorkspacesResponseSchema = z.object({}).catchall(z.unknown()); +export type GetJobWorkspacesResponse = z.infer< + typeof GetJobWorkspacesResponseSchema +>; + +const GetLeaveStatusValuesInputSchema = z.object({}).optional(); +export type GetLeaveStatusValuesInput = z.infer< + typeof GetLeaveStatusValuesInputSchema +>; + +const GetLeaveStatusValuesResponseSchema = z.object({}).catchall(z.unknown()); +export type GetLeaveStatusValuesResponse = z.infer< + typeof GetLeaveStatusValuesResponseSchema +>; + +const GetMyJobPostingsInputSchema = z.object({}).optional(); +export type GetMyJobPostingsInput = z.infer; + +const GetMyJobPostingsResponseSchema = z.object({}).catchall(z.unknown()); +export type GetMyJobPostingsResponse = z.infer< + typeof GetMyJobPostingsResponseSchema +>; + +const GetOrganizationAssignmentBusinessUnitsInputSchema = z + .object({}) + .optional(); +export type GetOrganizationAssignmentBusinessUnitsInput = z.infer< + typeof GetOrganizationAssignmentBusinessUnitsInputSchema +>; + +const GetOrganizationAssignmentBusinessUnitsResponseSchema = z + .object({}) + .catchall(z.unknown()); +export type GetOrganizationAssignmentBusinessUnitsResponse = z.infer< + typeof GetOrganizationAssignmentBusinessUnitsResponseSchema +>; + +const GetOrganizationAssignmentCustomsInputSchema = z.object({}).optional(); +export type GetOrganizationAssignmentCustomsInput = z.infer< + typeof GetOrganizationAssignmentCustomsInputSchema +>; + +const GetOrganizationAssignmentCustomsResponseSchema = z + .object({}) + .catchall(z.unknown()); +export type GetOrganizationAssignmentCustomsResponse = z.infer< + typeof GetOrganizationAssignmentCustomsResponseSchema +>; + +const GetOrganizationAssignmentFundsInputSchema = z.object({}).optional(); +export type GetOrganizationAssignmentFundsInput = z.infer< + typeof GetOrganizationAssignmentFundsInputSchema +>; + +const GetOrganizationAssignmentFundsResponseSchema = z + .object({}) + .catchall(z.unknown()); +export type GetOrganizationAssignmentFundsResponse = z.infer< + typeof GetOrganizationAssignmentFundsResponseSchema +>; + +const GetOrganizationAssignmentRegionsInputSchema = z.object({}).optional(); +export type GetOrganizationAssignmentRegionsInput = z.infer< + typeof GetOrganizationAssignmentRegionsInputSchema +>; + +const GetOrganizationAssignmentRegionsResponseSchema = z + .object({}) + .catchall(z.unknown()); +export type GetOrganizationAssignmentRegionsResponse = z.infer< + typeof GetOrganizationAssignmentRegionsResponseSchema +>; + +const GetOrganizationAssignmentWorkersInputSchema = z.object({}).optional(); +export type GetOrganizationAssignmentWorkersInput = z.infer< + typeof GetOrganizationAssignmentWorkersInputSchema +>; + +const GetOrganizationAssignmentWorkersResponseSchema = z + .object({}) + .catchall(z.unknown()); +export type GetOrganizationAssignmentWorkersResponse = z.infer< + typeof GetOrganizationAssignmentWorkersResponseSchema +>; + +const GetPayGroupByJobIdInputSchema = z.object({}).optional(); +export type GetPayGroupByJobIdInput = z.infer< + typeof GetPayGroupByJobIdInputSchema +>; + +const GetPayGroupByJobIdResponseSchema = z.object({}).catchall(z.unknown()); +export type GetPayGroupByJobIdResponse = z.infer< + typeof GetPayGroupByJobIdResponseSchema +>; + +const GetPaySlipInstancesForWorkerInputSchema = z.object({}).optional(); +export type GetPaySlipInstancesForWorkerInput = z.infer< + typeof GetPaySlipInstancesForWorkerInputSchema +>; + +const GetPaySlipInstancesForWorkerResponseSchema = z + .object({}) + .catchall(z.unknown()); +export type GetPaySlipInstancesForWorkerResponse = z.infer< + typeof GetPaySlipInstancesForWorkerResponseSchema +>; + +const GetPaySlipsForWorkerInputSchema = z.object({}).optional(); +export type GetPaySlipsForWorkerInput = z.infer< + typeof GetPaySlipsForWorkerInputSchema +>; + +const GetPaySlipsForWorkerResponseSchema = z.object({}).catchall(z.unknown()); +export type GetPaySlipsForWorkerResponse = z.infer< + typeof GetPaySlipsForWorkerResponseSchema +>; + +const GetPayrollInputInstanceInputSchema = z.object({}).optional(); +export type GetPayrollInputInstanceInput = z.infer< + typeof GetPayrollInputInstanceInputSchema +>; + +const GetPayrollInputInstanceResponseSchema = z + .object({}) + .catchall(z.unknown()); +export type GetPayrollInputInstanceResponse = z.infer< + typeof GetPayrollInputInstanceResponseSchema +>; + +const GetProposedPositionValuesInputSchema = z.object({}).optional(); +export type GetProposedPositionValuesInput = z.infer< + typeof GetProposedPositionValuesInputSchema +>; + +const GetProposedPositionValuesResponseSchema = z + .object({}) + .catchall(z.unknown()); +export type GetProposedPositionValuesResponse = z.infer< + typeof GetProposedPositionValuesResponseSchema +>; + +const GetProspectInputSchema = z.object({}).optional(); +export type GetProspectInput = z.infer; + +const GetProspectResponseSchema = z.object({}).catchall(z.unknown()); +export type GetProspectResponse = z.infer; + +const GetProspectEducationsInputSchema = z.object({}).optional(); +export type GetProspectEducationsInput = z.infer< + typeof GetProspectEducationsInputSchema +>; + +const GetProspectEducationsResponseSchema = z.object({}).catchall(z.unknown()); +export type GetProspectEducationsResponse = z.infer< + typeof GetProspectEducationsResponseSchema +>; + +const GetProspectExperiencesInputSchema = z.object({}).optional(); +export type GetProspectExperiencesInput = z.infer< + typeof GetProspectExperiencesInputSchema +>; + +const GetProspectExperiencesResponseSchema = z.object({}).catchall(z.unknown()); +export type GetProspectExperiencesResponse = z.infer< + typeof GetProspectExperiencesResponseSchema +>; + +const GetProspectResumeAttachmentsInputSchema = z.object({}).optional(); +export type GetProspectResumeAttachmentsInput = z.infer< + typeof GetProspectResumeAttachmentsInputSchema +>; + +const GetProspectResumeAttachmentsResponseSchema = z + .object({}) + .catchall(z.unknown()); +export type GetProspectResumeAttachmentsResponse = z.infer< + typeof GetProspectResumeAttachmentsResponseSchema +>; + +const GetProspectSkillsInputSchema = z.object({}).optional(); +export type GetProspectSkillsInput = z.infer< + typeof GetProspectSkillsInputSchema +>; + +const GetProspectSkillsResponseSchema = z.object({}).catchall(z.unknown()); +export type GetProspectSkillsResponse = z.infer< + typeof GetProspectSkillsResponseSchema +>; + +const GetSupervisoryOrgValuesInputSchema = z.object({}).optional(); +export type GetSupervisoryOrgValuesInput = z.infer< + typeof GetSupervisoryOrgValuesInputSchema +>; + +const GetSupervisoryOrgValuesResponseSchema = z + .object({}) + .catchall(z.unknown()); +export type GetSupervisoryOrgValuesResponse = z.infer< + typeof GetSupervisoryOrgValuesResponseSchema +>; + +const GetTimeOffEntriesForWorkerInputSchema = z.object({}).optional(); +export type GetTimeOffEntriesForWorkerInput = z.infer< + typeof GetTimeOffEntriesForWorkerInputSchema +>; + +const GetTimeOffEntriesForWorkerResponseSchema = z + .object({}) + .catchall(z.unknown()); +export type GetTimeOffEntriesForWorkerResponse = z.infer< + typeof GetTimeOffEntriesForWorkerResponseSchema +>; + +const GetTimeOffPlansForWorkerInputSchema = z.object({}).optional(); +export type GetTimeOffPlansForWorkerInput = z.infer< + typeof GetTimeOffPlansForWorkerInputSchema +>; + +const GetTimeOffPlansForWorkerResponseSchema = z + .object({}) + .catchall(z.unknown()); +export type GetTimeOffPlansForWorkerResponse = z.infer< + typeof GetTimeOffPlansForWorkerResponseSchema +>; + +const GetTimeOffStatusValuesInputSchema = z.object({}).optional(); +export type GetTimeOffStatusValuesInput = z.infer< + typeof GetTimeOffStatusValuesInputSchema +>; + +const GetTimeOffStatusValuesResponseSchema = z.object({}).catchall(z.unknown()); +export type GetTimeOffStatusValuesResponse = z.infer< + typeof GetTimeOffStatusValuesResponseSchema +>; + +const GetTimeTypesInputSchema = z.object({}).optional(); +export type GetTimeTypesInput = z.infer; + +const GetTimeTypesResponseSchema = z.object({}).catchall(z.unknown()); +export type GetTimeTypesResponse = z.infer; + +const GetWorkStudyAwardsInputSchema = z.object({}).optional(); +export type GetWorkStudyAwardsInput = z.infer< + typeof GetWorkStudyAwardsInputSchema +>; + +const GetWorkStudyAwardsResponseSchema = z.object({}).catchall(z.unknown()); +export type GetWorkStudyAwardsResponse = z.infer< + typeof GetWorkStudyAwardsResponseSchema +>; + +const GetWorkerBusinessTitleChangesInputSchema = z.object({}).optional(); +export type GetWorkerBusinessTitleChangesInput = z.infer< + typeof GetWorkerBusinessTitleChangesInputSchema +>; + +const GetWorkerBusinessTitleChangesResponseSchema = z + .object({}) + .catchall(z.unknown()); +export type GetWorkerBusinessTitleChangesResponse = z.infer< + typeof GetWorkerBusinessTitleChangesResponseSchema +>; + +const GetWorkerEligibleAbsenceTypesInputSchema = z.object({}).optional(); +export type GetWorkerEligibleAbsenceTypesInput = z.infer< + typeof GetWorkerEligibleAbsenceTypesInputSchema +>; + +const GetWorkerEligibleAbsenceTypesResponseSchema = z + .object({}) + .catchall(z.unknown()); +export type GetWorkerEligibleAbsenceTypesResponse = z.infer< + typeof GetWorkerEligibleAbsenceTypesResponseSchema +>; + +const GetWorkerInfoInputSchema = z.object({}).optional(); +export type GetWorkerInfoInput = z.infer; + +const GetWorkerInfoResponseSchema = z.object({}).catchall(z.unknown()); +export type GetWorkerInfoResponse = z.infer; + +const GetWorkerLeavesOfAbsenceInputSchema = z.object({}).optional(); +export type GetWorkerLeavesOfAbsenceInput = z.infer< + typeof GetWorkerLeavesOfAbsenceInputSchema +>; + +const GetWorkerLeavesOfAbsenceResponseSchema = z + .object({}) + .catchall(z.unknown()); +export type GetWorkerLeavesOfAbsenceResponse = z.infer< + typeof GetWorkerLeavesOfAbsenceResponseSchema +>; + +const GetWorkerServiceDatesInputSchema = z.object({}).optional(); +export type GetWorkerServiceDatesInput = z.infer< + typeof GetWorkerServiceDatesInputSchema +>; + +const GetWorkerServiceDatesResponseSchema = z.object({}).catchall(z.unknown()); +export type GetWorkerServiceDatesResponse = z.infer< + typeof GetWorkerServiceDatesResponseSchema +>; + +const GetWorkerStaffingInformationInputSchema = z.object({}).optional(); +export type GetWorkerStaffingInformationInput = z.infer< + typeof GetWorkerStaffingInformationInputSchema +>; + +const GetWorkerStaffingInformationResponseSchema = z + .object({}) + .catchall(z.unknown()); +export type GetWorkerStaffingInformationResponse = z.infer< + typeof GetWorkerStaffingInformationResponseSchema +>; + +const GetWorkerTimeOffDetailsInputSchema = z.object({}).optional(); +export type GetWorkerTimeOffDetailsInput = z.infer< + typeof GetWorkerTimeOffDetailsInputSchema +>; + +const GetWorkerTimeOffDetailsResponseSchema = z + .object({}) + .catchall(z.unknown()); +export type GetWorkerTimeOffDetailsResponse = z.infer< + typeof GetWorkerTimeOffDetailsResponseSchema +>; + +const GetWorkerTypesInputSchema = z.object({}).optional(); +export type GetWorkerTypesInput = z.infer; + +const GetWorkerTypesResponseSchema = z.object({}).catchall(z.unknown()); +export type GetWorkerTypesResponse = z.infer< + typeof GetWorkerTypesResponseSchema +>; + +const GetWorkerValidTimeOffDatesInputSchema = z.object({}).optional(); +export type GetWorkerValidTimeOffDatesInput = z.infer< + typeof GetWorkerValidTimeOffDatesInputSchema +>; + +const GetWorkerValidTimeOffDatesResponseSchema = z + .object({}) + .catchall(z.unknown()); +export type GetWorkerValidTimeOffDatesResponse = z.infer< + typeof GetWorkerValidTimeOffDatesResponseSchema +>; + +const GetWorkersCollectionStaffingInputSchema = z.object({}).optional(); +export type GetWorkersCollectionStaffingInput = z.infer< + typeof GetWorkersCollectionStaffingInputSchema +>; + +const GetWorkersCollectionStaffingResponseSchema = z + .object({}) + .catchall(z.unknown()); +export type GetWorkersCollectionStaffingResponse = z.infer< + typeof GetWorkersCollectionStaffingResponseSchema +>; + +const GetWorkspaceInstancesInputSchema = z.object({}).optional(); +export type GetWorkspaceInstancesInput = z.infer< + typeof GetWorkspaceInstancesInputSchema +>; + +const GetWorkspaceInstancesResponseSchema = z.object({}).catchall(z.unknown()); +export type GetWorkspaceInstancesResponse = z.infer< + typeof GetWorkspaceInstancesResponseSchema +>; + +const ListBalancesInputSchema = z.object({}).optional(); +export type ListBalancesInput = z.infer; + +const ListBalancesResponseSchema = z.object({}).catchall(z.unknown()); +export type ListBalancesResponse = z.infer; + +const ListCountriesInputSchema = z.object({}).optional(); +export type ListCountriesInput = z.infer; + +const ListCountriesResponseSchema = z.object({}).catchall(z.unknown()); +export type ListCountriesResponse = z.infer; + +const ListInterviewsInputSchema = z.object({}).optional(); +export type ListInterviewsInput = z.infer; + +const ListInterviewsResponseSchema = z.object({}).catchall(z.unknown()); +export type ListInterviewsResponse = z.infer< + typeof ListInterviewsResponseSchema +>; + +const ListJobPostingsInputSchema = z.object({}).optional(); +export type ListJobPostingsInput = z.infer; + +const ListJobPostingsResponseSchema = z.object({}).catchall(z.unknown()); +export type ListJobPostingsResponse = z.infer< + typeof ListJobPostingsResponseSchema +>; + +const ListJobsInputSchema = z.object({}).optional(); +export type ListJobsInput = z.infer; + +const ListJobsResponseSchema = z.object({}).catchall(z.unknown()); +export type ListJobsResponse = z.infer; + +const RetrieveWorkerLeaveOfAbsenceSubresourceInputSchema = z + .object({}) + .optional(); +export type RetrieveWorkerLeaveOfAbsenceSubresourceInput = z.infer< + typeof RetrieveWorkerLeaveOfAbsenceSubresourceInputSchema +>; + +const RetrieveWorkerLeaveOfAbsenceSubresourceResponseSchema = z + .object({}) + .catchall(z.unknown()); +export type RetrieveWorkerLeaveOfAbsenceSubresourceResponse = z.infer< + typeof RetrieveWorkerLeaveOfAbsenceSubresourceResponseSchema +>; + +const UpdateAnExistingPayrollInputSchema = z.object({}).optional(); +export type UpdateAnExistingPayrollInput = z.infer< + typeof UpdateAnExistingPayrollInputSchema +>; + +const UpdateAnExistingPayrollResponseSchema = z + .object({}) + .catchall(z.unknown()); +export type UpdateAnExistingPayrollResponse = z.infer< + typeof UpdateAnExistingPayrollResponseSchema +>; + +const UpdateJobChangeBusinessTitleInputSchema = z.object({}).optional(); +export type UpdateJobChangeBusinessTitleInput = z.infer< + typeof UpdateJobChangeBusinessTitleInputSchema +>; + +const UpdateJobChangeBusinessTitleResponseSchema = z + .object({}) + .catchall(z.unknown()); +export type UpdateJobChangeBusinessTitleResponse = z.infer< + typeof UpdateJobChangeBusinessTitleResponseSchema +>; + +const UpdateMessageTemplateByIdInputSchema = z.object({}).optional(); +export type UpdateMessageTemplateByIdInput = z.infer< + typeof UpdateMessageTemplateByIdInputSchema +>; + +const UpdateMessageTemplateByIdResponseSchema = z + .object({}) + .catchall(z.unknown()); +export type UpdateMessageTemplateByIdResponse = z.infer< + typeof UpdateMessageTemplateByIdResponseSchema +>; + +export const WorkdayEndpointInputSchemas = { + createBusinessTitleChange: CreateBusinessTitleChangeInputSchema, + createJobChange: CreateJobChangeInputSchema, + createPayrollInputs: CreatePayrollInputsInputSchema, + createTimeOffRequest: CreateTimeOffRequestInputSchema, + getAbsenceBalance: GetAbsenceBalanceInputSchema, + getAssignmentChangeGroupCostCenters: + GetAssignmentChangeGroupCostCentersInputSchema, + getAssignmentChangeGroupJobs: GetAssignmentChangeGroupJobsInputSchema, + getAssignmentTypes: GetAssignmentTypesInputSchema, + getBusinessTitleChange: GetBusinessTitleChangeInputSchema, + getBusinessTitleChangeForWorker: GetBusinessTitleChangeForWorkerInputSchema, + getCandidateAvailabilityTemplate: GetCandidateAvailabilityTemplateInputSchema, + getCollectionOfJobs: GetCollectionOfJobsInputSchema, + getCollectionOfPayroll: GetCollectionOfPayrollInputSchema, + getCompanyInsiderTypes: GetCompanyInsiderTypesInputSchema, + getContingentWorkerTypes: GetContingentWorkerTypesInputSchema, + getCountryInfo: GetCountryInfoInputSchema, + getCurrencies: GetCurrenciesInputSchema, + getCurrentUser: GetCurrentUserInputSchema, + getGrants: GetGrantsInputSchema, + getHeadcountOptions: GetHeadcountOptionsInputSchema, + getHistoryInstanceForWorker: GetHistoryInstanceForWorkerInputSchema, + getHistoryItemsForWorker: GetHistoryItemsForWorkerInputSchema, + getHolidayEvents: GetHolidayEventsInputSchema, + getInterview: GetInterviewInputSchema, + getInterviewFeedback2: GetInterviewFeedback2InputSchema, + getJobById: GetJobByIdInputSchema, + getJobChangeFrequencies: GetJobChangeFrequenciesInputSchema, + getJobChangeLocationInfo: GetJobChangeLocationInfoInputSchema, + getJobChangePosition: GetJobChangePositionInputSchema, + getJobChangeReasonInstance: GetJobChangeReasonInstanceInputSchema, + getJobChangeReasonValues: GetJobChangeReasonValuesInputSchema, + getJobChangeReasons: GetJobChangeReasonsInputSchema, + getJobChangesGroupTemplates: GetJobChangesGroupTemplatesInputSchema, + getJobChangesJobValues: GetJobChangesJobValuesInputSchema, + getJobChangesWorkerValues: GetJobChangesWorkerValuesInputSchema, + getJobClassifications: GetJobClassificationsInputSchema, + getJobPosting: GetJobPostingInputSchema, + getJobPostingQuestionnaire: GetJobPostingQuestionnaireInputSchema, + getJobProfilesValues: GetJobProfilesValuesInputSchema, + getJobRequisitionValues: GetJobRequisitionValuesInputSchema, + getJobWorkspace: GetJobWorkspaceInputSchema, + getJobWorkspaces: GetJobWorkspacesInputSchema, + getLeaveStatusValues: GetLeaveStatusValuesInputSchema, + getMyJobPostings: GetMyJobPostingsInputSchema, + getOrganizationAssignmentBusinessUnits: + GetOrganizationAssignmentBusinessUnitsInputSchema, + getOrganizationAssignmentCustoms: GetOrganizationAssignmentCustomsInputSchema, + getOrganizationAssignmentFunds: GetOrganizationAssignmentFundsInputSchema, + getOrganizationAssignmentRegions: GetOrganizationAssignmentRegionsInputSchema, + getOrganizationAssignmentWorkers: GetOrganizationAssignmentWorkersInputSchema, + getPayGroupByJobId: GetPayGroupByJobIdInputSchema, + getPaySlipInstancesForWorker: GetPaySlipInstancesForWorkerInputSchema, + getPaySlipsForWorker: GetPaySlipsForWorkerInputSchema, + getPayrollInputInstance: GetPayrollInputInstanceInputSchema, + getProposedPositionValues: GetProposedPositionValuesInputSchema, + getProspect: GetProspectInputSchema, + getProspectEducations: GetProspectEducationsInputSchema, + getProspectExperiences: GetProspectExperiencesInputSchema, + getProspectResumeAttachments: GetProspectResumeAttachmentsInputSchema, + getProspectSkills: GetProspectSkillsInputSchema, + getSupervisoryOrgValues: GetSupervisoryOrgValuesInputSchema, + getTimeOffEntriesForWorker: GetTimeOffEntriesForWorkerInputSchema, + getTimeOffPlansForWorker: GetTimeOffPlansForWorkerInputSchema, + getTimeOffStatusValues: GetTimeOffStatusValuesInputSchema, + getTimeTypes: GetTimeTypesInputSchema, + getWorkStudyAwards: GetWorkStudyAwardsInputSchema, + getWorkerBusinessTitleChanges: GetWorkerBusinessTitleChangesInputSchema, + getWorkerEligibleAbsenceTypes: GetWorkerEligibleAbsenceTypesInputSchema, + getWorkerInfo: GetWorkerInfoInputSchema, + getWorkerLeavesOfAbsence: GetWorkerLeavesOfAbsenceInputSchema, + getWorkerServiceDates: GetWorkerServiceDatesInputSchema, + getWorkerStaffingInformation: GetWorkerStaffingInformationInputSchema, + getWorkerTimeOffDetails: GetWorkerTimeOffDetailsInputSchema, + getWorkerTypes: GetWorkerTypesInputSchema, + getWorkerValidTimeOffDates: GetWorkerValidTimeOffDatesInputSchema, + getWorkersCollectionStaffing: GetWorkersCollectionStaffingInputSchema, + getWorkspaceInstances: GetWorkspaceInstancesInputSchema, + listBalances: ListBalancesInputSchema, + listCountries: ListCountriesInputSchema, + listInterviews: ListInterviewsInputSchema, + listJobPostings: ListJobPostingsInputSchema, + listJobs: ListJobsInputSchema, + retrieveWorkerLeaveOfAbsenceSubresource: + RetrieveWorkerLeaveOfAbsenceSubresourceInputSchema, + updateAnExistingPayroll: UpdateAnExistingPayrollInputSchema, + updateJobChangeBusinessTitle: UpdateJobChangeBusinessTitleInputSchema, + updateMessageTemplateById: UpdateMessageTemplateByIdInputSchema, +} as const; + +export type WorkdayEndpointInputs = { + [K in keyof typeof WorkdayEndpointInputSchemas]: z.infer< + (typeof WorkdayEndpointInputSchemas)[K] + >; +}; + +export const WorkdayEndpointOutputSchemas = { + createBusinessTitleChange: CreateBusinessTitleChangeResponseSchema, + createJobChange: CreateJobChangeResponseSchema, + createPayrollInputs: CreatePayrollInputsResponseSchema, + createTimeOffRequest: CreateTimeOffRequestResponseSchema, + getAbsenceBalance: GetAbsenceBalanceResponseSchema, + getAssignmentChangeGroupCostCenters: + GetAssignmentChangeGroupCostCentersResponseSchema, + getAssignmentChangeGroupJobs: GetAssignmentChangeGroupJobsResponseSchema, + getAssignmentTypes: GetAssignmentTypesResponseSchema, + getBusinessTitleChange: GetBusinessTitleChangeResponseSchema, + getBusinessTitleChangeForWorker: + GetBusinessTitleChangeForWorkerResponseSchema, + getCandidateAvailabilityTemplate: + GetCandidateAvailabilityTemplateResponseSchema, + getCollectionOfJobs: GetCollectionOfJobsResponseSchema, + getCollectionOfPayroll: GetCollectionOfPayrollResponseSchema, + getCompanyInsiderTypes: GetCompanyInsiderTypesResponseSchema, + getContingentWorkerTypes: GetContingentWorkerTypesResponseSchema, + getCountryInfo: GetCountryInfoResponseSchema, + getCurrencies: GetCurrenciesResponseSchema, + getCurrentUser: GetCurrentUserResponseSchema, + getGrants: GetGrantsResponseSchema, + getHeadcountOptions: GetHeadcountOptionsResponseSchema, + getHistoryInstanceForWorker: GetHistoryInstanceForWorkerResponseSchema, + getHistoryItemsForWorker: GetHistoryItemsForWorkerResponseSchema, + getHolidayEvents: GetHolidayEventsResponseSchema, + getInterview: GetInterviewResponseSchema, + getInterviewFeedback2: GetInterviewFeedback2ResponseSchema, + getJobById: GetJobByIdResponseSchema, + getJobChangeFrequencies: GetJobChangeFrequenciesResponseSchema, + getJobChangeLocationInfo: GetJobChangeLocationInfoResponseSchema, + getJobChangePosition: GetJobChangePositionResponseSchema, + getJobChangeReasonInstance: GetJobChangeReasonInstanceResponseSchema, + getJobChangeReasonValues: GetJobChangeReasonValuesResponseSchema, + getJobChangeReasons: GetJobChangeReasonsResponseSchema, + getJobChangesGroupTemplates: GetJobChangesGroupTemplatesResponseSchema, + getJobChangesJobValues: GetJobChangesJobValuesResponseSchema, + getJobChangesWorkerValues: GetJobChangesWorkerValuesResponseSchema, + getJobClassifications: GetJobClassificationsResponseSchema, + getJobPosting: GetJobPostingResponseSchema, + getJobPostingQuestionnaire: GetJobPostingQuestionnaireResponseSchema, + getJobProfilesValues: GetJobProfilesValuesResponseSchema, + getJobRequisitionValues: GetJobRequisitionValuesResponseSchema, + getJobWorkspace: GetJobWorkspaceResponseSchema, + getJobWorkspaces: GetJobWorkspacesResponseSchema, + getLeaveStatusValues: GetLeaveStatusValuesResponseSchema, + getMyJobPostings: GetMyJobPostingsResponseSchema, + getOrganizationAssignmentBusinessUnits: + GetOrganizationAssignmentBusinessUnitsResponseSchema, + getOrganizationAssignmentCustoms: + GetOrganizationAssignmentCustomsResponseSchema, + getOrganizationAssignmentFunds: GetOrganizationAssignmentFundsResponseSchema, + getOrganizationAssignmentRegions: + GetOrganizationAssignmentRegionsResponseSchema, + getOrganizationAssignmentWorkers: + GetOrganizationAssignmentWorkersResponseSchema, + getPayGroupByJobId: GetPayGroupByJobIdResponseSchema, + getPaySlipInstancesForWorker: GetPaySlipInstancesForWorkerResponseSchema, + getPaySlipsForWorker: GetPaySlipsForWorkerResponseSchema, + getPayrollInputInstance: GetPayrollInputInstanceResponseSchema, + getProposedPositionValues: GetProposedPositionValuesResponseSchema, + getProspect: GetProspectResponseSchema, + getProspectEducations: GetProspectEducationsResponseSchema, + getProspectExperiences: GetProspectExperiencesResponseSchema, + getProspectResumeAttachments: GetProspectResumeAttachmentsResponseSchema, + getProspectSkills: GetProspectSkillsResponseSchema, + getSupervisoryOrgValues: GetSupervisoryOrgValuesResponseSchema, + getTimeOffEntriesForWorker: GetTimeOffEntriesForWorkerResponseSchema, + getTimeOffPlansForWorker: GetTimeOffPlansForWorkerResponseSchema, + getTimeOffStatusValues: GetTimeOffStatusValuesResponseSchema, + getTimeTypes: GetTimeTypesResponseSchema, + getWorkStudyAwards: GetWorkStudyAwardsResponseSchema, + getWorkerBusinessTitleChanges: GetWorkerBusinessTitleChangesResponseSchema, + getWorkerEligibleAbsenceTypes: GetWorkerEligibleAbsenceTypesResponseSchema, + getWorkerInfo: GetWorkerInfoResponseSchema, + getWorkerLeavesOfAbsence: GetWorkerLeavesOfAbsenceResponseSchema, + getWorkerServiceDates: GetWorkerServiceDatesResponseSchema, + getWorkerStaffingInformation: GetWorkerStaffingInformationResponseSchema, + getWorkerTimeOffDetails: GetWorkerTimeOffDetailsResponseSchema, + getWorkerTypes: GetWorkerTypesResponseSchema, + getWorkerValidTimeOffDates: GetWorkerValidTimeOffDatesResponseSchema, + getWorkersCollectionStaffing: GetWorkersCollectionStaffingResponseSchema, + getWorkspaceInstances: GetWorkspaceInstancesResponseSchema, + listBalances: ListBalancesResponseSchema, + listCountries: ListCountriesResponseSchema, + listInterviews: ListInterviewsResponseSchema, + listJobPostings: ListJobPostingsResponseSchema, + listJobs: ListJobsResponseSchema, + retrieveWorkerLeaveOfAbsenceSubresource: + RetrieveWorkerLeaveOfAbsenceSubresourceResponseSchema, + updateAnExistingPayroll: UpdateAnExistingPayrollResponseSchema, + updateJobChangeBusinessTitle: UpdateJobChangeBusinessTitleResponseSchema, + updateMessageTemplateById: UpdateMessageTemplateByIdResponseSchema, +} as const; + +export type WorkdayEndpointOutputs = { + [K in keyof typeof WorkdayEndpointOutputSchemas]: z.infer< + (typeof WorkdayEndpointOutputSchemas)[K] + >; +}; diff --git a/packages/workday/endpoints/work.ts b/packages/workday/endpoints/work.ts new file mode 100644 index 000000000..299af1762 --- /dev/null +++ b/packages/workday/endpoints/work.ts @@ -0,0 +1,21 @@ +import { logEventFromContext } from 'corsair/core'; +import type { WorkdayEndpoints } from '..'; +import { makeWorkdayRequest } from '../client'; +import type { WorkdayEndpointOutputs } from './types'; + +export const getWorkStudyAwards: WorkdayEndpoints['getWorkStudyAwards'] = + async (ctx, input) => { + const response = await makeWorkdayRequest< + WorkdayEndpointOutputs['getWorkStudyAwards'] + >('v1/work/api', ctx.key, { + method: 'POST', + body: input as { [key: string]: unknown }, + }); + await logEventFromContext( + ctx, + 'workday.work.getWorkStudyAwards', + input ?? {}, + 'completed', + ); + return response; + }; diff --git a/packages/workday/endpoints/worker.ts b/packages/workday/endpoints/worker.ts new file mode 100644 index 000000000..5223b1d00 --- /dev/null +++ b/packages/workday/endpoints/worker.ts @@ -0,0 +1,178 @@ +import { logEventFromContext } from 'corsair/core'; +import type { WorkdayEndpoints } from '..'; +import { makeWorkdayRequest } from '../client'; +import type { WorkdayEndpointOutputs } from './types'; + +export const getWorkerBusinessTitleChanges: WorkdayEndpoints['getWorkerBusinessTitleChanges'] = + async (ctx, input) => { + const response = await makeWorkdayRequest< + WorkdayEndpointOutputs['getWorkerBusinessTitleChanges'] + >('v1/worker/api', ctx.key, { + method: 'POST', + body: input as { [key: string]: unknown }, + }); + await logEventFromContext( + ctx, + 'workday.worker.getWorkerBusinessTitleChanges', + input ?? {}, + 'completed', + ); + return response; + }; + +export const getWorkerEligibleAbsenceTypes: WorkdayEndpoints['getWorkerEligibleAbsenceTypes'] = + async (ctx, input) => { + const response = await makeWorkdayRequest< + WorkdayEndpointOutputs['getWorkerEligibleAbsenceTypes'] + >('v1/worker/api', ctx.key, { + method: 'POST', + body: input as { [key: string]: unknown }, + }); + await logEventFromContext( + ctx, + 'workday.worker.getWorkerEligibleAbsenceTypes', + input ?? {}, + 'completed', + ); + return response; + }; + +export const getWorkerInfo: WorkdayEndpoints['getWorkerInfo'] = async ( + ctx, + input, +) => { + const response = await makeWorkdayRequest< + WorkdayEndpointOutputs['getWorkerInfo'] + >('v1/worker/api', ctx.key, { + method: 'POST', + body: input as { [key: string]: unknown }, + }); + await logEventFromContext( + ctx, + 'workday.worker.getWorkerInfo', + input ?? {}, + 'completed', + ); + return response; +}; + +export const getWorkerLeavesOfAbsence: WorkdayEndpoints['getWorkerLeavesOfAbsence'] = + async (ctx, input) => { + const response = await makeWorkdayRequest< + WorkdayEndpointOutputs['getWorkerLeavesOfAbsence'] + >('v1/worker/api', ctx.key, { + method: 'POST', + body: input as { [key: string]: unknown }, + }); + await logEventFromContext( + ctx, + 'workday.worker.getWorkerLeavesOfAbsence', + input ?? {}, + 'completed', + ); + return response; + }; + +export const getWorkerServiceDates: WorkdayEndpoints['getWorkerServiceDates'] = + async (ctx, input) => { + const response = await makeWorkdayRequest< + WorkdayEndpointOutputs['getWorkerServiceDates'] + >('v1/worker/api', ctx.key, { + method: 'POST', + body: input as { [key: string]: unknown }, + }); + await logEventFromContext( + ctx, + 'workday.worker.getWorkerServiceDates', + input ?? {}, + 'completed', + ); + return response; + }; + +export const getWorkerStaffingInformation: WorkdayEndpoints['getWorkerStaffingInformation'] = + async (ctx, input) => { + const response = await makeWorkdayRequest< + WorkdayEndpointOutputs['getWorkerStaffingInformation'] + >('v1/worker/api', ctx.key, { + method: 'POST', + body: input as { [key: string]: unknown }, + }); + await logEventFromContext( + ctx, + 'workday.worker.getWorkerStaffingInformation', + input ?? {}, + 'completed', + ); + return response; + }; + +export const getWorkerTimeOffDetails: WorkdayEndpoints['getWorkerTimeOffDetails'] = + async (ctx, input) => { + const response = await makeWorkdayRequest< + WorkdayEndpointOutputs['getWorkerTimeOffDetails'] + >('v1/worker/api', ctx.key, { + method: 'POST', + body: input as { [key: string]: unknown }, + }); + await logEventFromContext( + ctx, + 'workday.worker.getWorkerTimeOffDetails', + input ?? {}, + 'completed', + ); + return response; + }; + +export const getWorkerTypes: WorkdayEndpoints['getWorkerTypes'] = async ( + ctx, + input, +) => { + const response = await makeWorkdayRequest< + WorkdayEndpointOutputs['getWorkerTypes'] + >('v1/worker/api', ctx.key, { + method: 'POST', + body: input as { [key: string]: unknown }, + }); + await logEventFromContext( + ctx, + 'workday.worker.getWorkerTypes', + input ?? {}, + 'completed', + ); + return response; +}; + +export const getWorkerValidTimeOffDates: WorkdayEndpoints['getWorkerValidTimeOffDates'] = + async (ctx, input) => { + const response = await makeWorkdayRequest< + WorkdayEndpointOutputs['getWorkerValidTimeOffDates'] + >('v1/worker/api', ctx.key, { + method: 'POST', + body: input as { [key: string]: unknown }, + }); + await logEventFromContext( + ctx, + 'workday.worker.getWorkerValidTimeOffDates', + input ?? {}, + 'completed', + ); + return response; + }; + +export const retrieveWorkerLeaveOfAbsenceSubresource: WorkdayEndpoints['retrieveWorkerLeaveOfAbsenceSubresource'] = + async (ctx, input) => { + const response = await makeWorkdayRequest< + WorkdayEndpointOutputs['retrieveWorkerLeaveOfAbsenceSubresource'] + >('v1/worker/api', ctx.key, { + method: 'POST', + body: input as { [key: string]: unknown }, + }); + await logEventFromContext( + ctx, + 'workday.worker.retrieveWorkerLeaveOfAbsenceSubresource', + input ?? {}, + 'completed', + ); + return response; + }; diff --git a/packages/workday/endpoints/workers.ts b/packages/workday/endpoints/workers.ts new file mode 100644 index 000000000..58b6d60d0 --- /dev/null +++ b/packages/workday/endpoints/workers.ts @@ -0,0 +1,21 @@ +import { logEventFromContext } from 'corsair/core'; +import type { WorkdayEndpoints } from '..'; +import { makeWorkdayRequest } from '../client'; +import type { WorkdayEndpointOutputs } from './types'; + +export const getWorkersCollectionStaffing: WorkdayEndpoints['getWorkersCollectionStaffing'] = + async (ctx, input) => { + const response = await makeWorkdayRequest< + WorkdayEndpointOutputs['getWorkersCollectionStaffing'] + >('v1/workers/api', ctx.key, { + method: 'POST', + body: input as { [key: string]: unknown }, + }); + await logEventFromContext( + ctx, + 'workday.workers.getWorkersCollectionStaffing', + input ?? {}, + 'completed', + ); + return response; + }; diff --git a/packages/workday/endpoints/workspace.ts b/packages/workday/endpoints/workspace.ts new file mode 100644 index 000000000..af85197a9 --- /dev/null +++ b/packages/workday/endpoints/workspace.ts @@ -0,0 +1,21 @@ +import { logEventFromContext } from 'corsair/core'; +import type { WorkdayEndpoints } from '..'; +import { makeWorkdayRequest } from '../client'; +import type { WorkdayEndpointOutputs } from './types'; + +export const getWorkspaceInstances: WorkdayEndpoints['getWorkspaceInstances'] = + async (ctx, input) => { + const response = await makeWorkdayRequest< + WorkdayEndpointOutputs['getWorkspaceInstances'] + >('v1/workspace/api', ctx.key, { + method: 'POST', + body: input as { [key: string]: unknown }, + }); + await logEventFromContext( + ctx, + 'workday.workspace.getWorkspaceInstances', + input ?? {}, + 'completed', + ); + return response; + }; diff --git a/packages/workday/error-handlers.ts b/packages/workday/error-handlers.ts new file mode 100644 index 000000000..5a4f4c19f --- /dev/null +++ b/packages/workday/error-handlers.ts @@ -0,0 +1,31 @@ +import type { CorsairErrorHandler } from 'corsair/core'; +import { ApiError } from 'corsair/http'; + +export const errorHandlers = { + RATE_LIMIT_ERROR: { + match: (error: Error) => { + if (error instanceof ApiError && error.status === 429) return true; + const msg = error.message.toLowerCase(); + return msg.includes('rate_limited') || msg.includes('429'); + }, + handler: async (error: Error) => { + let retryAfterMs: number | undefined; + if (error instanceof ApiError && error.retryAfter !== undefined) { + retryAfterMs = error.retryAfter; + } + return { maxRetries: 5, headersRetryAfterMs: retryAfterMs }; + }, + }, + AUTH_ERROR: { + match: (error: Error) => { + if (error instanceof ApiError && error.status === 401) return true; + const msg = error.message.toLowerCase(); + return msg.includes('unauthorized') || msg.includes('invalid_auth'); + }, + handler: async () => ({ maxRetries: 0 }), + }, + DEFAULT: { + match: () => true, + handler: async () => ({ maxRetries: 0 }), + }, +} satisfies CorsairErrorHandler; diff --git a/packages/workday/index.ts b/packages/workday/index.ts new file mode 100644 index 000000000..ec00490f2 --- /dev/null +++ b/packages/workday/index.ts @@ -0,0 +1,1112 @@ +import type { + AuthTypes, + BindEndpoints, + BindWebhooks, + CorsairContext, + CorsairEndpoint, + CorsairErrorHandler, + CorsairPlugin, + CorsairPluginContext, + CorsairWebhook, + KeyBuilderContext, + PickAuth, + PluginAuthConfig, + PluginPermissionsConfig, + ProviderDisplayNames, + RequiredPluginEndpointMeta, + RequiredPluginEndpointSchemas, +} from 'corsair/core'; +import { + Absence, + An, + Assignment, + Balances, + Business, + Candidate, + Collection, + Company, + Contingent, + Countries, + Country, + Currencies, + Current, + Grants, + Headcount, + History, + Holiday, + Interview, + Interviews, + Job, + Jobs, + Leave, + Message, + My, + Organization, + Pay, + Payroll, + Proposed, + Prospect, + Supervisory, + Time, + Work, + Worker, + Workers, + Workspace, +} from './endpoints'; +import type { + WorkdayEndpointInputs, + WorkdayEndpointOutputs, +} from './endpoints/types'; +import { + WorkdayEndpointInputSchemas, + WorkdayEndpointOutputSchemas, +} from './endpoints/types'; +import { errorHandlers } from './error-handlers'; +import { WorkdaySchema } from './schema'; +import { resolveWorkdayOAuthWebhookTenantLink } from './webhooks/oauth-tenant-link'; +import { matchWorkdayTenantWebhook } from './webhooks/tenant-matcher'; +import type { WorkdayWebhookOutputs } from './webhooks/types'; + +export type WorkdayPluginOptions = { + /** Workday integration for Corsair */ + authType?: PickAuth<'oauth_2'>; + key?: string; + webhookSecret?: string; + hooks?: InternalWorkdayPlugin['hooks']; + webhookHooks?: InternalWorkdayPlugin['webhookHooks']; + errorHandlers?: CorsairErrorHandler; + permissions?: PluginPermissionsConfig; +}; + +export type WorkdayContext = CorsairPluginContext< + typeof WorkdaySchema, + WorkdayPluginOptions +>; +export type WorkdayKeyBuilderContext = KeyBuilderContext; +export type WorkdayBoundEndpoints = BindEndpoints< + typeof workdayEndpointsNested +>; + +type WorkdayEndpoint = CorsairEndpoint< + WorkdayContext, + WorkdayEndpointInputs[K], + WorkdayEndpointOutputs[K] +>; + +export type WorkdayEndpoints = { + createBusinessTitleChange: WorkdayEndpoint<'createBusinessTitleChange'>; + getBusinessTitleChange: WorkdayEndpoint<'getBusinessTitleChange'>; + getBusinessTitleChangeForWorker: WorkdayEndpoint<'getBusinessTitleChangeForWorker'>; + createJobChange: WorkdayEndpoint<'createJobChange'>; + getJobById: WorkdayEndpoint<'getJobById'>; + getJobChangeFrequencies: WorkdayEndpoint<'getJobChangeFrequencies'>; + getJobChangeLocationInfo: WorkdayEndpoint<'getJobChangeLocationInfo'>; + getJobChangePosition: WorkdayEndpoint<'getJobChangePosition'>; + getJobChangeReasonInstance: WorkdayEndpoint<'getJobChangeReasonInstance'>; + getJobChangeReasonValues: WorkdayEndpoint<'getJobChangeReasonValues'>; + getJobChangeReasons: WorkdayEndpoint<'getJobChangeReasons'>; + getJobChangesGroupTemplates: WorkdayEndpoint<'getJobChangesGroupTemplates'>; + getJobChangesJobValues: WorkdayEndpoint<'getJobChangesJobValues'>; + getJobChangesWorkerValues: WorkdayEndpoint<'getJobChangesWorkerValues'>; + getJobClassifications: WorkdayEndpoint<'getJobClassifications'>; + getJobPosting: WorkdayEndpoint<'getJobPosting'>; + getJobPostingQuestionnaire: WorkdayEndpoint<'getJobPostingQuestionnaire'>; + getJobProfilesValues: WorkdayEndpoint<'getJobProfilesValues'>; + getJobRequisitionValues: WorkdayEndpoint<'getJobRequisitionValues'>; + getJobWorkspace: WorkdayEndpoint<'getJobWorkspace'>; + getJobWorkspaces: WorkdayEndpoint<'getJobWorkspaces'>; + listJobPostings: WorkdayEndpoint<'listJobPostings'>; + updateJobChangeBusinessTitle: WorkdayEndpoint<'updateJobChangeBusinessTitle'>; + createPayrollInputs: WorkdayEndpoint<'createPayrollInputs'>; + getPayrollInputInstance: WorkdayEndpoint<'getPayrollInputInstance'>; + createTimeOffRequest: WorkdayEndpoint<'createTimeOffRequest'>; + getTimeOffEntriesForWorker: WorkdayEndpoint<'getTimeOffEntriesForWorker'>; + getTimeOffPlansForWorker: WorkdayEndpoint<'getTimeOffPlansForWorker'>; + getTimeOffStatusValues: WorkdayEndpoint<'getTimeOffStatusValues'>; + getTimeTypes: WorkdayEndpoint<'getTimeTypes'>; + getAbsenceBalance: WorkdayEndpoint<'getAbsenceBalance'>; + getAssignmentChangeGroupCostCenters: WorkdayEndpoint<'getAssignmentChangeGroupCostCenters'>; + getAssignmentChangeGroupJobs: WorkdayEndpoint<'getAssignmentChangeGroupJobs'>; + getAssignmentTypes: WorkdayEndpoint<'getAssignmentTypes'>; + getCandidateAvailabilityTemplate: WorkdayEndpoint<'getCandidateAvailabilityTemplate'>; + getCollectionOfJobs: WorkdayEndpoint<'getCollectionOfJobs'>; + getCollectionOfPayroll: WorkdayEndpoint<'getCollectionOfPayroll'>; + getCompanyInsiderTypes: WorkdayEndpoint<'getCompanyInsiderTypes'>; + getContingentWorkerTypes: WorkdayEndpoint<'getContingentWorkerTypes'>; + getCountryInfo: WorkdayEndpoint<'getCountryInfo'>; + getCurrencies: WorkdayEndpoint<'getCurrencies'>; + getCurrentUser: WorkdayEndpoint<'getCurrentUser'>; + getGrants: WorkdayEndpoint<'getGrants'>; + getHeadcountOptions: WorkdayEndpoint<'getHeadcountOptions'>; + getHistoryInstanceForWorker: WorkdayEndpoint<'getHistoryInstanceForWorker'>; + getHistoryItemsForWorker: WorkdayEndpoint<'getHistoryItemsForWorker'>; + getHolidayEvents: WorkdayEndpoint<'getHolidayEvents'>; + getInterview: WorkdayEndpoint<'getInterview'>; + getInterviewFeedback2: WorkdayEndpoint<'getInterviewFeedback2'>; + getLeaveStatusValues: WorkdayEndpoint<'getLeaveStatusValues'>; + getMyJobPostings: WorkdayEndpoint<'getMyJobPostings'>; + getOrganizationAssignmentBusinessUnits: WorkdayEndpoint<'getOrganizationAssignmentBusinessUnits'>; + getOrganizationAssignmentCustoms: WorkdayEndpoint<'getOrganizationAssignmentCustoms'>; + getOrganizationAssignmentFunds: WorkdayEndpoint<'getOrganizationAssignmentFunds'>; + getOrganizationAssignmentRegions: WorkdayEndpoint<'getOrganizationAssignmentRegions'>; + getOrganizationAssignmentWorkers: WorkdayEndpoint<'getOrganizationAssignmentWorkers'>; + getPayGroupByJobId: WorkdayEndpoint<'getPayGroupByJobId'>; + getPaySlipInstancesForWorker: WorkdayEndpoint<'getPaySlipInstancesForWorker'>; + getPaySlipsForWorker: WorkdayEndpoint<'getPaySlipsForWorker'>; + getProposedPositionValues: WorkdayEndpoint<'getProposedPositionValues'>; + getProspect: WorkdayEndpoint<'getProspect'>; + getProspectEducations: WorkdayEndpoint<'getProspectEducations'>; + getProspectExperiences: WorkdayEndpoint<'getProspectExperiences'>; + getProspectResumeAttachments: WorkdayEndpoint<'getProspectResumeAttachments'>; + getProspectSkills: WorkdayEndpoint<'getProspectSkills'>; + getSupervisoryOrgValues: WorkdayEndpoint<'getSupervisoryOrgValues'>; + getWorkStudyAwards: WorkdayEndpoint<'getWorkStudyAwards'>; + getWorkerBusinessTitleChanges: WorkdayEndpoint<'getWorkerBusinessTitleChanges'>; + getWorkerEligibleAbsenceTypes: WorkdayEndpoint<'getWorkerEligibleAbsenceTypes'>; + getWorkerInfo: WorkdayEndpoint<'getWorkerInfo'>; + getWorkerLeavesOfAbsence: WorkdayEndpoint<'getWorkerLeavesOfAbsence'>; + getWorkerServiceDates: WorkdayEndpoint<'getWorkerServiceDates'>; + getWorkerStaffingInformation: WorkdayEndpoint<'getWorkerStaffingInformation'>; + getWorkerTimeOffDetails: WorkdayEndpoint<'getWorkerTimeOffDetails'>; + getWorkerTypes: WorkdayEndpoint<'getWorkerTypes'>; + getWorkerValidTimeOffDates: WorkdayEndpoint<'getWorkerValidTimeOffDates'>; + retrieveWorkerLeaveOfAbsenceSubresource: WorkdayEndpoint<'retrieveWorkerLeaveOfAbsenceSubresource'>; + getWorkersCollectionStaffing: WorkdayEndpoint<'getWorkersCollectionStaffing'>; + getWorkspaceInstances: WorkdayEndpoint<'getWorkspaceInstances'>; + listBalances: WorkdayEndpoint<'listBalances'>; + listCountries: WorkdayEndpoint<'listCountries'>; + listInterviews: WorkdayEndpoint<'listInterviews'>; + listJobs: WorkdayEndpoint<'listJobs'>; + updateAnExistingPayroll: WorkdayEndpoint<'updateAnExistingPayroll'>; + updateMessageTemplateById: WorkdayEndpoint<'updateMessageTemplateById'>; +}; + +export type WorkdayBoundWebhooks = BindWebhooks<{ + 'worker.updated': CorsairWebhook; +}>; + +const workdayEndpointsNested = { + business: { + createBusinessTitleChange: Business.createBusinessTitleChange, + getBusinessTitleChange: Business.getBusinessTitleChange, + getBusinessTitleChangeForWorker: Business.getBusinessTitleChangeForWorker, + }, + job: { + createJobChange: Job.createJobChange, + getJobById: Job.getJobById, + getJobChangeFrequencies: Job.getJobChangeFrequencies, + getJobChangeLocationInfo: Job.getJobChangeLocationInfo, + getJobChangePosition: Job.getJobChangePosition, + getJobChangeReasonInstance: Job.getJobChangeReasonInstance, + getJobChangeReasonValues: Job.getJobChangeReasonValues, + getJobChangeReasons: Job.getJobChangeReasons, + getJobChangesGroupTemplates: Job.getJobChangesGroupTemplates, + getJobChangesJobValues: Job.getJobChangesJobValues, + getJobChangesWorkerValues: Job.getJobChangesWorkerValues, + getJobClassifications: Job.getJobClassifications, + getJobPosting: Job.getJobPosting, + getJobPostingQuestionnaire: Job.getJobPostingQuestionnaire, + getJobProfilesValues: Job.getJobProfilesValues, + getJobRequisitionValues: Job.getJobRequisitionValues, + getJobWorkspace: Job.getJobWorkspace, + getJobWorkspaces: Job.getJobWorkspaces, + listJobPostings: Job.listJobPostings, + updateJobChangeBusinessTitle: Job.updateJobChangeBusinessTitle, + }, + payroll: { + createPayrollInputs: Payroll.createPayrollInputs, + getPayrollInputInstance: Payroll.getPayrollInputInstance, + }, + time: { + createTimeOffRequest: Time.createTimeOffRequest, + getTimeOffEntriesForWorker: Time.getTimeOffEntriesForWorker, + getTimeOffPlansForWorker: Time.getTimeOffPlansForWorker, + getTimeOffStatusValues: Time.getTimeOffStatusValues, + getTimeTypes: Time.getTimeTypes, + }, + absence: { + getAbsenceBalance: Absence.getAbsenceBalance, + }, + assignment: { + getAssignmentChangeGroupCostCenters: + Assignment.getAssignmentChangeGroupCostCenters, + getAssignmentChangeGroupJobs: Assignment.getAssignmentChangeGroupJobs, + getAssignmentTypes: Assignment.getAssignmentTypes, + }, + candidate: { + getCandidateAvailabilityTemplate: + Candidate.getCandidateAvailabilityTemplate, + }, + collection: { + getCollectionOfJobs: Collection.getCollectionOfJobs, + getCollectionOfPayroll: Collection.getCollectionOfPayroll, + }, + company: { + getCompanyInsiderTypes: Company.getCompanyInsiderTypes, + }, + contingent: { + getContingentWorkerTypes: Contingent.getContingentWorkerTypes, + }, + country: { + getCountryInfo: Country.getCountryInfo, + }, + currencies: { + getCurrencies: Currencies.getCurrencies, + }, + current: { + getCurrentUser: Current.getCurrentUser, + }, + grants: { + getGrants: Grants.getGrants, + }, + headcount: { + getHeadcountOptions: Headcount.getHeadcountOptions, + }, + history: { + getHistoryInstanceForWorker: History.getHistoryInstanceForWorker, + getHistoryItemsForWorker: History.getHistoryItemsForWorker, + }, + holiday: { + getHolidayEvents: Holiday.getHolidayEvents, + }, + interview: { + getInterview: Interview.getInterview, + getInterviewFeedback2: Interview.getInterviewFeedback2, + }, + leave: { + getLeaveStatusValues: Leave.getLeaveStatusValues, + }, + my: { + getMyJobPostings: My.getMyJobPostings, + }, + organization: { + getOrganizationAssignmentBusinessUnits: + Organization.getOrganizationAssignmentBusinessUnits, + getOrganizationAssignmentCustoms: + Organization.getOrganizationAssignmentCustoms, + getOrganizationAssignmentFunds: Organization.getOrganizationAssignmentFunds, + getOrganizationAssignmentRegions: + Organization.getOrganizationAssignmentRegions, + getOrganizationAssignmentWorkers: + Organization.getOrganizationAssignmentWorkers, + }, + pay: { + getPayGroupByJobId: Pay.getPayGroupByJobId, + getPaySlipInstancesForWorker: Pay.getPaySlipInstancesForWorker, + getPaySlipsForWorker: Pay.getPaySlipsForWorker, + }, + proposed: { + getProposedPositionValues: Proposed.getProposedPositionValues, + }, + prospect: { + getProspect: Prospect.getProspect, + getProspectEducations: Prospect.getProspectEducations, + getProspectExperiences: Prospect.getProspectExperiences, + getProspectResumeAttachments: Prospect.getProspectResumeAttachments, + getProspectSkills: Prospect.getProspectSkills, + }, + supervisory: { + getSupervisoryOrgValues: Supervisory.getSupervisoryOrgValues, + }, + work: { + getWorkStudyAwards: Work.getWorkStudyAwards, + }, + worker: { + getWorkerBusinessTitleChanges: Worker.getWorkerBusinessTitleChanges, + getWorkerEligibleAbsenceTypes: Worker.getWorkerEligibleAbsenceTypes, + getWorkerInfo: Worker.getWorkerInfo, + getWorkerLeavesOfAbsence: Worker.getWorkerLeavesOfAbsence, + getWorkerServiceDates: Worker.getWorkerServiceDates, + getWorkerStaffingInformation: Worker.getWorkerStaffingInformation, + getWorkerTimeOffDetails: Worker.getWorkerTimeOffDetails, + getWorkerTypes: Worker.getWorkerTypes, + getWorkerValidTimeOffDates: Worker.getWorkerValidTimeOffDates, + retrieveWorkerLeaveOfAbsenceSubresource: + Worker.retrieveWorkerLeaveOfAbsenceSubresource, + }, + workers: { + getWorkersCollectionStaffing: Workers.getWorkersCollectionStaffing, + }, + workspace: { + getWorkspaceInstances: Workspace.getWorkspaceInstances, + }, + balances: { + listBalances: Balances.listBalances, + }, + countries: { + listCountries: Countries.listCountries, + }, + interviews: { + listInterviews: Interviews.listInterviews, + }, + jobs: { + listJobs: Jobs.listJobs, + }, + an: { + updateAnExistingPayroll: An.updateAnExistingPayroll, + }, + message: { + updateMessageTemplateById: Message.updateMessageTemplateById, + }, +} as const; + +const workdayWebhooksNested = {} as const; + +export const workdayEndpointSchemas = { + 'business.createBusinessTitleChange': { + input: WorkdayEndpointInputSchemas.createBusinessTitleChange, + output: WorkdayEndpointOutputSchemas.createBusinessTitleChange, + }, + 'business.getBusinessTitleChange': { + input: WorkdayEndpointInputSchemas.getBusinessTitleChange, + output: WorkdayEndpointOutputSchemas.getBusinessTitleChange, + }, + 'business.getBusinessTitleChangeForWorker': { + input: WorkdayEndpointInputSchemas.getBusinessTitleChangeForWorker, + output: WorkdayEndpointOutputSchemas.getBusinessTitleChangeForWorker, + }, + 'job.createJobChange': { + input: WorkdayEndpointInputSchemas.createJobChange, + output: WorkdayEndpointOutputSchemas.createJobChange, + }, + 'job.getJobById': { + input: WorkdayEndpointInputSchemas.getJobById, + output: WorkdayEndpointOutputSchemas.getJobById, + }, + 'job.getJobChangeFrequencies': { + input: WorkdayEndpointInputSchemas.getJobChangeFrequencies, + output: WorkdayEndpointOutputSchemas.getJobChangeFrequencies, + }, + 'job.getJobChangeLocationInfo': { + input: WorkdayEndpointInputSchemas.getJobChangeLocationInfo, + output: WorkdayEndpointOutputSchemas.getJobChangeLocationInfo, + }, + 'job.getJobChangePosition': { + input: WorkdayEndpointInputSchemas.getJobChangePosition, + output: WorkdayEndpointOutputSchemas.getJobChangePosition, + }, + 'job.getJobChangeReasonInstance': { + input: WorkdayEndpointInputSchemas.getJobChangeReasonInstance, + output: WorkdayEndpointOutputSchemas.getJobChangeReasonInstance, + }, + 'job.getJobChangeReasonValues': { + input: WorkdayEndpointInputSchemas.getJobChangeReasonValues, + output: WorkdayEndpointOutputSchemas.getJobChangeReasonValues, + }, + 'job.getJobChangeReasons': { + input: WorkdayEndpointInputSchemas.getJobChangeReasons, + output: WorkdayEndpointOutputSchemas.getJobChangeReasons, + }, + 'job.getJobChangesGroupTemplates': { + input: WorkdayEndpointInputSchemas.getJobChangesGroupTemplates, + output: WorkdayEndpointOutputSchemas.getJobChangesGroupTemplates, + }, + 'job.getJobChangesJobValues': { + input: WorkdayEndpointInputSchemas.getJobChangesJobValues, + output: WorkdayEndpointOutputSchemas.getJobChangesJobValues, + }, + 'job.getJobChangesWorkerValues': { + input: WorkdayEndpointInputSchemas.getJobChangesWorkerValues, + output: WorkdayEndpointOutputSchemas.getJobChangesWorkerValues, + }, + 'job.getJobClassifications': { + input: WorkdayEndpointInputSchemas.getJobClassifications, + output: WorkdayEndpointOutputSchemas.getJobClassifications, + }, + 'job.getJobPosting': { + input: WorkdayEndpointInputSchemas.getJobPosting, + output: WorkdayEndpointOutputSchemas.getJobPosting, + }, + 'job.getJobPostingQuestionnaire': { + input: WorkdayEndpointInputSchemas.getJobPostingQuestionnaire, + output: WorkdayEndpointOutputSchemas.getJobPostingQuestionnaire, + }, + 'job.getJobProfilesValues': { + input: WorkdayEndpointInputSchemas.getJobProfilesValues, + output: WorkdayEndpointOutputSchemas.getJobProfilesValues, + }, + 'job.getJobRequisitionValues': { + input: WorkdayEndpointInputSchemas.getJobRequisitionValues, + output: WorkdayEndpointOutputSchemas.getJobRequisitionValues, + }, + 'job.getJobWorkspace': { + input: WorkdayEndpointInputSchemas.getJobWorkspace, + output: WorkdayEndpointOutputSchemas.getJobWorkspace, + }, + 'job.getJobWorkspaces': { + input: WorkdayEndpointInputSchemas.getJobWorkspaces, + output: WorkdayEndpointOutputSchemas.getJobWorkspaces, + }, + 'job.listJobPostings': { + input: WorkdayEndpointInputSchemas.listJobPostings, + output: WorkdayEndpointOutputSchemas.listJobPostings, + }, + 'job.updateJobChangeBusinessTitle': { + input: WorkdayEndpointInputSchemas.updateJobChangeBusinessTitle, + output: WorkdayEndpointOutputSchemas.updateJobChangeBusinessTitle, + }, + 'payroll.createPayrollInputs': { + input: WorkdayEndpointInputSchemas.createPayrollInputs, + output: WorkdayEndpointOutputSchemas.createPayrollInputs, + }, + 'payroll.getPayrollInputInstance': { + input: WorkdayEndpointInputSchemas.getPayrollInputInstance, + output: WorkdayEndpointOutputSchemas.getPayrollInputInstance, + }, + 'time.createTimeOffRequest': { + input: WorkdayEndpointInputSchemas.createTimeOffRequest, + output: WorkdayEndpointOutputSchemas.createTimeOffRequest, + }, + 'time.getTimeOffEntriesForWorker': { + input: WorkdayEndpointInputSchemas.getTimeOffEntriesForWorker, + output: WorkdayEndpointOutputSchemas.getTimeOffEntriesForWorker, + }, + 'time.getTimeOffPlansForWorker': { + input: WorkdayEndpointInputSchemas.getTimeOffPlansForWorker, + output: WorkdayEndpointOutputSchemas.getTimeOffPlansForWorker, + }, + 'time.getTimeOffStatusValues': { + input: WorkdayEndpointInputSchemas.getTimeOffStatusValues, + output: WorkdayEndpointOutputSchemas.getTimeOffStatusValues, + }, + 'time.getTimeTypes': { + input: WorkdayEndpointInputSchemas.getTimeTypes, + output: WorkdayEndpointOutputSchemas.getTimeTypes, + }, + 'absence.getAbsenceBalance': { + input: WorkdayEndpointInputSchemas.getAbsenceBalance, + output: WorkdayEndpointOutputSchemas.getAbsenceBalance, + }, + 'assignment.getAssignmentChangeGroupCostCenters': { + input: WorkdayEndpointInputSchemas.getAssignmentChangeGroupCostCenters, + output: WorkdayEndpointOutputSchemas.getAssignmentChangeGroupCostCenters, + }, + 'assignment.getAssignmentChangeGroupJobs': { + input: WorkdayEndpointInputSchemas.getAssignmentChangeGroupJobs, + output: WorkdayEndpointOutputSchemas.getAssignmentChangeGroupJobs, + }, + 'assignment.getAssignmentTypes': { + input: WorkdayEndpointInputSchemas.getAssignmentTypes, + output: WorkdayEndpointOutputSchemas.getAssignmentTypes, + }, + 'candidate.getCandidateAvailabilityTemplate': { + input: WorkdayEndpointInputSchemas.getCandidateAvailabilityTemplate, + output: WorkdayEndpointOutputSchemas.getCandidateAvailabilityTemplate, + }, + 'collection.getCollectionOfJobs': { + input: WorkdayEndpointInputSchemas.getCollectionOfJobs, + output: WorkdayEndpointOutputSchemas.getCollectionOfJobs, + }, + 'collection.getCollectionOfPayroll': { + input: WorkdayEndpointInputSchemas.getCollectionOfPayroll, + output: WorkdayEndpointOutputSchemas.getCollectionOfPayroll, + }, + 'company.getCompanyInsiderTypes': { + input: WorkdayEndpointInputSchemas.getCompanyInsiderTypes, + output: WorkdayEndpointOutputSchemas.getCompanyInsiderTypes, + }, + 'contingent.getContingentWorkerTypes': { + input: WorkdayEndpointInputSchemas.getContingentWorkerTypes, + output: WorkdayEndpointOutputSchemas.getContingentWorkerTypes, + }, + 'country.getCountryInfo': { + input: WorkdayEndpointInputSchemas.getCountryInfo, + output: WorkdayEndpointOutputSchemas.getCountryInfo, + }, + 'currencies.getCurrencies': { + input: WorkdayEndpointInputSchemas.getCurrencies, + output: WorkdayEndpointOutputSchemas.getCurrencies, + }, + 'current.getCurrentUser': { + input: WorkdayEndpointInputSchemas.getCurrentUser, + output: WorkdayEndpointOutputSchemas.getCurrentUser, + }, + 'grants.getGrants': { + input: WorkdayEndpointInputSchemas.getGrants, + output: WorkdayEndpointOutputSchemas.getGrants, + }, + 'headcount.getHeadcountOptions': { + input: WorkdayEndpointInputSchemas.getHeadcountOptions, + output: WorkdayEndpointOutputSchemas.getHeadcountOptions, + }, + 'history.getHistoryInstanceForWorker': { + input: WorkdayEndpointInputSchemas.getHistoryInstanceForWorker, + output: WorkdayEndpointOutputSchemas.getHistoryInstanceForWorker, + }, + 'history.getHistoryItemsForWorker': { + input: WorkdayEndpointInputSchemas.getHistoryItemsForWorker, + output: WorkdayEndpointOutputSchemas.getHistoryItemsForWorker, + }, + 'holiday.getHolidayEvents': { + input: WorkdayEndpointInputSchemas.getHolidayEvents, + output: WorkdayEndpointOutputSchemas.getHolidayEvents, + }, + 'interview.getInterview': { + input: WorkdayEndpointInputSchemas.getInterview, + output: WorkdayEndpointOutputSchemas.getInterview, + }, + 'interview.getInterviewFeedback2': { + input: WorkdayEndpointInputSchemas.getInterviewFeedback2, + output: WorkdayEndpointOutputSchemas.getInterviewFeedback2, + }, + 'leave.getLeaveStatusValues': { + input: WorkdayEndpointInputSchemas.getLeaveStatusValues, + output: WorkdayEndpointOutputSchemas.getLeaveStatusValues, + }, + 'my.getMyJobPostings': { + input: WorkdayEndpointInputSchemas.getMyJobPostings, + output: WorkdayEndpointOutputSchemas.getMyJobPostings, + }, + 'organization.getOrganizationAssignmentBusinessUnits': { + input: WorkdayEndpointInputSchemas.getOrganizationAssignmentBusinessUnits, + output: WorkdayEndpointOutputSchemas.getOrganizationAssignmentBusinessUnits, + }, + 'organization.getOrganizationAssignmentCustoms': { + input: WorkdayEndpointInputSchemas.getOrganizationAssignmentCustoms, + output: WorkdayEndpointOutputSchemas.getOrganizationAssignmentCustoms, + }, + 'organization.getOrganizationAssignmentFunds': { + input: WorkdayEndpointInputSchemas.getOrganizationAssignmentFunds, + output: WorkdayEndpointOutputSchemas.getOrganizationAssignmentFunds, + }, + 'organization.getOrganizationAssignmentRegions': { + input: WorkdayEndpointInputSchemas.getOrganizationAssignmentRegions, + output: WorkdayEndpointOutputSchemas.getOrganizationAssignmentRegions, + }, + 'organization.getOrganizationAssignmentWorkers': { + input: WorkdayEndpointInputSchemas.getOrganizationAssignmentWorkers, + output: WorkdayEndpointOutputSchemas.getOrganizationAssignmentWorkers, + }, + 'pay.getPayGroupByJobId': { + input: WorkdayEndpointInputSchemas.getPayGroupByJobId, + output: WorkdayEndpointOutputSchemas.getPayGroupByJobId, + }, + 'pay.getPaySlipInstancesForWorker': { + input: WorkdayEndpointInputSchemas.getPaySlipInstancesForWorker, + output: WorkdayEndpointOutputSchemas.getPaySlipInstancesForWorker, + }, + 'pay.getPaySlipsForWorker': { + input: WorkdayEndpointInputSchemas.getPaySlipsForWorker, + output: WorkdayEndpointOutputSchemas.getPaySlipsForWorker, + }, + 'proposed.getProposedPositionValues': { + input: WorkdayEndpointInputSchemas.getProposedPositionValues, + output: WorkdayEndpointOutputSchemas.getProposedPositionValues, + }, + 'prospect.getProspect': { + input: WorkdayEndpointInputSchemas.getProspect, + output: WorkdayEndpointOutputSchemas.getProspect, + }, + 'prospect.getProspectEducations': { + input: WorkdayEndpointInputSchemas.getProspectEducations, + output: WorkdayEndpointOutputSchemas.getProspectEducations, + }, + 'prospect.getProspectExperiences': { + input: WorkdayEndpointInputSchemas.getProspectExperiences, + output: WorkdayEndpointOutputSchemas.getProspectExperiences, + }, + 'prospect.getProspectResumeAttachments': { + input: WorkdayEndpointInputSchemas.getProspectResumeAttachments, + output: WorkdayEndpointOutputSchemas.getProspectResumeAttachments, + }, + 'prospect.getProspectSkills': { + input: WorkdayEndpointInputSchemas.getProspectSkills, + output: WorkdayEndpointOutputSchemas.getProspectSkills, + }, + 'supervisory.getSupervisoryOrgValues': { + input: WorkdayEndpointInputSchemas.getSupervisoryOrgValues, + output: WorkdayEndpointOutputSchemas.getSupervisoryOrgValues, + }, + 'work.getWorkStudyAwards': { + input: WorkdayEndpointInputSchemas.getWorkStudyAwards, + output: WorkdayEndpointOutputSchemas.getWorkStudyAwards, + }, + 'worker.getWorkerBusinessTitleChanges': { + input: WorkdayEndpointInputSchemas.getWorkerBusinessTitleChanges, + output: WorkdayEndpointOutputSchemas.getWorkerBusinessTitleChanges, + }, + 'worker.getWorkerEligibleAbsenceTypes': { + input: WorkdayEndpointInputSchemas.getWorkerEligibleAbsenceTypes, + output: WorkdayEndpointOutputSchemas.getWorkerEligibleAbsenceTypes, + }, + 'worker.getWorkerInfo': { + input: WorkdayEndpointInputSchemas.getWorkerInfo, + output: WorkdayEndpointOutputSchemas.getWorkerInfo, + }, + 'worker.getWorkerLeavesOfAbsence': { + input: WorkdayEndpointInputSchemas.getWorkerLeavesOfAbsence, + output: WorkdayEndpointOutputSchemas.getWorkerLeavesOfAbsence, + }, + 'worker.getWorkerServiceDates': { + input: WorkdayEndpointInputSchemas.getWorkerServiceDates, + output: WorkdayEndpointOutputSchemas.getWorkerServiceDates, + }, + 'worker.getWorkerStaffingInformation': { + input: WorkdayEndpointInputSchemas.getWorkerStaffingInformation, + output: WorkdayEndpointOutputSchemas.getWorkerStaffingInformation, + }, + 'worker.getWorkerTimeOffDetails': { + input: WorkdayEndpointInputSchemas.getWorkerTimeOffDetails, + output: WorkdayEndpointOutputSchemas.getWorkerTimeOffDetails, + }, + 'worker.getWorkerTypes': { + input: WorkdayEndpointInputSchemas.getWorkerTypes, + output: WorkdayEndpointOutputSchemas.getWorkerTypes, + }, + 'worker.getWorkerValidTimeOffDates': { + input: WorkdayEndpointInputSchemas.getWorkerValidTimeOffDates, + output: WorkdayEndpointOutputSchemas.getWorkerValidTimeOffDates, + }, + 'worker.retrieveWorkerLeaveOfAbsenceSubresource': { + input: WorkdayEndpointInputSchemas.retrieveWorkerLeaveOfAbsenceSubresource, + output: + WorkdayEndpointOutputSchemas.retrieveWorkerLeaveOfAbsenceSubresource, + }, + 'workers.getWorkersCollectionStaffing': { + input: WorkdayEndpointInputSchemas.getWorkersCollectionStaffing, + output: WorkdayEndpointOutputSchemas.getWorkersCollectionStaffing, + }, + 'workspace.getWorkspaceInstances': { + input: WorkdayEndpointInputSchemas.getWorkspaceInstances, + output: WorkdayEndpointOutputSchemas.getWorkspaceInstances, + }, + 'balances.listBalances': { + input: WorkdayEndpointInputSchemas.listBalances, + output: WorkdayEndpointOutputSchemas.listBalances, + }, + 'countries.listCountries': { + input: WorkdayEndpointInputSchemas.listCountries, + output: WorkdayEndpointOutputSchemas.listCountries, + }, + 'interviews.listInterviews': { + input: WorkdayEndpointInputSchemas.listInterviews, + output: WorkdayEndpointOutputSchemas.listInterviews, + }, + 'jobs.listJobs': { + input: WorkdayEndpointInputSchemas.listJobs, + output: WorkdayEndpointOutputSchemas.listJobs, + }, + 'an.updateAnExistingPayroll': { + input: WorkdayEndpointInputSchemas.updateAnExistingPayroll, + output: WorkdayEndpointOutputSchemas.updateAnExistingPayroll, + }, + 'message.updateMessageTemplateById': { + input: WorkdayEndpointInputSchemas.updateMessageTemplateById, + output: WorkdayEndpointOutputSchemas.updateMessageTemplateById, + }, +} as const; + +const defaultAuthType: AuthTypes = 'oauth_2' as const; + +const workdayEndpointMeta = { + 'business.createBusinessTitleChange': { + riskLevel: 'write', + description: 'Create Business Title Change', + }, + 'business.getBusinessTitleChange': { + riskLevel: 'write', + description: 'Get Business Title Change', + }, + 'business.getBusinessTitleChangeForWorker': { + riskLevel: 'write', + description: 'Get Business Title Change For Worker', + }, + 'job.createJobChange': { + riskLevel: 'write', + description: 'Create Job Change', + }, + 'job.getJobById': { + riskLevel: 'write', + description: 'Get Job By ID', + }, + 'job.getJobChangeFrequencies': { + riskLevel: 'write', + description: 'Get Job Change Frequencies', + }, + 'job.getJobChangeLocationInfo': { + riskLevel: 'write', + description: 'Get Job Change Location Info', + }, + 'job.getJobChangePosition': { + riskLevel: 'write', + description: 'Get Job Change Position', + }, + 'job.getJobChangeReasonInstance': { + riskLevel: 'write', + description: 'Get Job Change Reason Instance', + }, + 'job.getJobChangeReasonValues': { + riskLevel: 'write', + description: 'Get Job Change Reason Values', + }, + 'job.getJobChangeReasons': { + riskLevel: 'write', + description: 'Get Job Change Reasons', + }, + 'job.getJobChangesGroupTemplates': { + riskLevel: 'write', + description: 'Get Job Changes Group Templates', + }, + 'job.getJobChangesJobValues': { + riskLevel: 'write', + description: 'Get Job Changes Job Values', + }, + 'job.getJobChangesWorkerValues': { + riskLevel: 'write', + description: 'Get Job Changes Worker Values', + }, + 'job.getJobClassifications': { + riskLevel: 'write', + description: 'Get Job Classifications', + }, + 'job.getJobPosting': { + riskLevel: 'write', + description: 'Get Job Posting', + }, + 'job.getJobPostingQuestionnaire': { + riskLevel: 'write', + description: 'Get Job Posting Questionnaire', + }, + 'job.getJobProfilesValues': { + riskLevel: 'write', + description: 'Get Job Profiles Values', + }, + 'job.getJobRequisitionValues': { + riskLevel: 'write', + description: 'Get Job Requisition Values', + }, + 'job.getJobWorkspace': { + riskLevel: 'write', + description: 'Get Job Workspace', + }, + 'job.getJobWorkspaces': { + riskLevel: 'write', + description: 'Get Job Workspaces', + }, + 'job.listJobPostings': { + riskLevel: 'write', + description: 'List Job Postings', + }, + 'job.updateJobChangeBusinessTitle': { + riskLevel: 'write', + description: 'Update Job Change Business Title', + }, + 'payroll.createPayrollInputs': { + riskLevel: 'write', + description: 'Create Payroll Inputs', + }, + 'payroll.getPayrollInputInstance': { + riskLevel: 'write', + description: 'Get Payroll Input Instance', + }, + 'time.createTimeOffRequest': { + riskLevel: 'write', + description: 'Create Time Off Request', + }, + 'time.getTimeOffEntriesForWorker': { + riskLevel: 'write', + description: 'Get Time Off Entries for Worker', + }, + 'time.getTimeOffPlansForWorker': { + riskLevel: 'write', + description: 'Get Time Off Plans For Worker', + }, + 'time.getTimeOffStatusValues': { + riskLevel: 'write', + description: 'Get Time Off Status Values', + }, + 'time.getTimeTypes': { + riskLevel: 'write', + description: 'Get Time Types', + }, + 'absence.getAbsenceBalance': { + riskLevel: 'write', + description: 'Get Absence Balance', + }, + 'assignment.getAssignmentChangeGroupCostCenters': { + riskLevel: 'write', + description: 'Get Assignment Change Group Cost Centers', + }, + 'assignment.getAssignmentChangeGroupJobs': { + riskLevel: 'write', + description: 'Get Assignment Change Group Jobs', + }, + 'assignment.getAssignmentTypes': { + riskLevel: 'write', + description: 'Get Assignment Types', + }, + 'candidate.getCandidateAvailabilityTemplate': { + riskLevel: 'write', + description: 'Get Candidate Availability Template', + }, + 'collection.getCollectionOfJobs': { + riskLevel: 'write', + description: 'Get Collection of Jobs', + }, + 'collection.getCollectionOfPayroll': { + riskLevel: 'write', + description: 'Get Collection of Payroll', + }, + 'company.getCompanyInsiderTypes': { + riskLevel: 'write', + description: 'Get Company Insider Types', + }, + 'contingent.getContingentWorkerTypes': { + riskLevel: 'write', + description: 'Get Contingent Worker Types', + }, + 'country.getCountryInfo': { + riskLevel: 'write', + description: 'Get Country Info', + }, + 'currencies.getCurrencies': { + riskLevel: 'write', + description: 'Get Currencies', + }, + 'current.getCurrentUser': { + riskLevel: 'write', + description: 'Get Current User', + }, + 'grants.getGrants': { + riskLevel: 'write', + description: 'Get Grants', + }, + 'headcount.getHeadcountOptions': { + riskLevel: 'write', + description: 'Get Headcount Options', + }, + 'history.getHistoryInstanceForWorker': { + riskLevel: 'write', + description: 'Get History Instance for Worker', + }, + 'history.getHistoryItemsForWorker': { + riskLevel: 'write', + description: 'Get History Items for Worker', + }, + 'holiday.getHolidayEvents': { + riskLevel: 'write', + description: 'Get Holiday Events', + }, + 'interview.getInterview': { + riskLevel: 'write', + description: 'Get Interview', + }, + 'interview.getInterviewFeedback2': { + riskLevel: 'write', + description: 'Get Interview Feedback', + }, + 'leave.getLeaveStatusValues': { + riskLevel: 'write', + description: 'Get Leave Status Values', + }, + 'my.getMyJobPostings': { + riskLevel: 'write', + description: 'Get My Job Postings', + }, + 'organization.getOrganizationAssignmentBusinessUnits': { + riskLevel: 'write', + description: 'Get Organization Assignment Business Units', + }, + 'organization.getOrganizationAssignmentCustoms': { + riskLevel: 'write', + description: 'Get Organization Assignment Customs', + }, + 'organization.getOrganizationAssignmentFunds': { + riskLevel: 'write', + description: 'Get Organization Assignment Funds', + }, + 'organization.getOrganizationAssignmentRegions': { + riskLevel: 'write', + description: 'Get Organization Assignment Regions', + }, + 'organization.getOrganizationAssignmentWorkers': { + riskLevel: 'write', + description: 'Get Organization Assignment Workers', + }, + 'pay.getPayGroupByJobId': { + riskLevel: 'write', + description: 'Get Pay Group by Job ID', + }, + 'pay.getPaySlipInstancesForWorker': { + riskLevel: 'write', + description: 'Get Pay Slip Instance for Worker', + }, + 'pay.getPaySlipsForWorker': { + riskLevel: 'write', + description: 'Get Pay Slips for Worker', + }, + 'proposed.getProposedPositionValues': { + riskLevel: 'write', + description: 'Get Proposed Position Values', + }, + 'prospect.getProspect': { + riskLevel: 'write', + description: 'Get Prospect', + }, + 'prospect.getProspectEducations': { + riskLevel: 'write', + description: 'Get Prospect Educations', + }, + 'prospect.getProspectExperiences': { + riskLevel: 'write', + description: 'Get Prospect Experiences', + }, + 'prospect.getProspectResumeAttachments': { + riskLevel: 'write', + description: 'Get Prospect Resume Attachments', + }, + 'prospect.getProspectSkills': { + riskLevel: 'write', + description: 'Get Prospect Skills', + }, + 'supervisory.getSupervisoryOrgValues': { + riskLevel: 'write', + description: 'Get Supervisory Organization Values', + }, + 'work.getWorkStudyAwards': { + riskLevel: 'write', + description: 'Get Work Study Awards', + }, + 'worker.getWorkerBusinessTitleChanges': { + riskLevel: 'write', + description: 'Get Worker Business Title Changes', + }, + 'worker.getWorkerEligibleAbsenceTypes': { + riskLevel: 'write', + description: 'Get Worker Eligible Absence Types', + }, + 'worker.getWorkerInfo': { + riskLevel: 'write', + description: 'Get Worker Info', + }, + 'worker.getWorkerLeavesOfAbsence': { + riskLevel: 'write', + description: 'Get Worker Leaves of Absence', + }, + 'worker.getWorkerServiceDates': { + riskLevel: 'write', + description: 'Get Worker Service Dates', + }, + 'worker.getWorkerStaffingInformation': { + riskLevel: 'write', + description: 'Get Worker Staffing Information', + }, + 'worker.getWorkerTimeOffDetails': { + riskLevel: 'write', + description: 'Get Worker Time Off Details', + }, + 'worker.getWorkerTypes': { + riskLevel: 'write', + description: 'Get Worker Types', + }, + 'worker.getWorkerValidTimeOffDates': { + riskLevel: 'write', + description: 'Get Worker Valid Time Off Dates', + }, + 'worker.retrieveWorkerLeaveOfAbsenceSubresource': { + riskLevel: 'write', + description: 'Retrieve Worker Leave of Absence', + }, + 'workers.getWorkersCollectionStaffing': { + riskLevel: 'write', + description: 'Get Workers Collection Staffing', + }, + 'workspace.getWorkspaceInstances': { + riskLevel: 'write', + description: 'Get Workspace Instances', + }, + 'balances.listBalances': { + riskLevel: 'write', + description: 'List Balances', + }, + 'countries.listCountries': { + riskLevel: 'write', + description: 'List Countries', + }, + 'interviews.listInterviews': { + riskLevel: 'write', + description: 'List Interviews', + }, + 'jobs.listJobs': { + riskLevel: 'write', + description: 'List Jobs', + }, + 'an.updateAnExistingPayroll': { + riskLevel: 'write', + description: 'Update An Existing Payroll', + }, + 'message.updateMessageTemplateById': { + riskLevel: 'write', + description: 'Update Message Template By ID', + }, +} satisfies RequiredPluginEndpointMeta; + +export const workdayAuthConfig = { + oauth_2: { + account: ['tenant_external_id'] as const, + }, +} as const satisfies PluginAuthConfig; + +export type BaseWorkdayPlugin = CorsairPlugin< + 'workday', + typeof WorkdaySchema, + typeof workdayEndpointsNested, + typeof workdayWebhooksNested, + T, + typeof defaultAuthType +>; + +export type InternalWorkdayPlugin = BaseWorkdayPlugin; +export type ExternalWorkdayPlugin = + BaseWorkdayPlugin; + +export function workday( + incomingOptions: WorkdayPluginOptions & T = {} as WorkdayPluginOptions & T, +): ExternalWorkdayPlugin { + const options = { + ...incomingOptions, + authType: incomingOptions.authType ?? defaultAuthType, + }; + return { + id: 'workday', + authConfig: workdayAuthConfig, + schema: WorkdaySchema, + options, + hooks: options.hooks, + webhookHooks: options.webhookHooks, + endpoints: workdayEndpointsNested, + webhooks: workdayWebhooksNested, + endpointMeta: workdayEndpointMeta, + endpointSchemas: workdayEndpointSchemas, + pluginWebhookMatcher: (request) => { + return 'x-workday-signature' in request.headers; + }, + pluginTenantWebhookMatcher: matchWorkdayTenantWebhook, + oauthWebhookTenantLinkResolver: resolveWorkdayOAuthWebhookTenantLink, + errorHandlers: { + ...errorHandlers, + ...options.errorHandlers, + }, + keyBuilder: async (ctx: WorkdayKeyBuilderContext, source) => { + if (source === 'webhook' && options.webhookSecret) + return options.webhookSecret; + if (source === 'webhook') { + const res = await ctx.keys.get_webhook_signature(); + return res ?? ''; + } + if (source === 'endpoint' && options.key) return options.key; + + if (source === 'endpoint' && ctx.authType === 'oauth_2') { + const res = await ctx.keys.get_access_token(); + return res ?? ''; + } + return ''; + }, + } satisfies InternalWorkdayPlugin; +} + +export type { + WorkdayEndpointInputs, + WorkdayEndpointOutputs, +} from './endpoints/types'; +export type { WorkdayWebhookOutputs } from './webhooks/types'; diff --git a/packages/workday/jest.config.cjs b/packages/workday/jest.config.cjs new file mode 100644 index 000000000..f2fa99d7d --- /dev/null +++ b/packages/workday/jest.config.cjs @@ -0,0 +1,29 @@ +module.exports = { + preset: 'ts-jest', + testEnvironment: 'node', + roots: [''], + testMatch: ['**/*.test.ts'], + transform: { + '^.+\\.ts$': [ + 'ts-jest', + { + useESM: true, + tsconfig: 'tsconfig.test.json', + }, + ], + '.*\\.js$': [ + 'ts-jest', + { + useESM: true, + tsconfig: 'tsconfig.test.json', + }, + ], + }, + moduleNameMapper: { + '^corsair/http$': '/../corsair/http.ts', + '^corsair/core$': '/__mocks__/corsair-core.mock.ts', + '^(\\.\\.?/.*)\\.js$': '$1', + }, + transformIgnorePatterns: ['node_modules/(?!.*uuid.*)'], + extensionsToTreatAsEsm: ['.ts'], +}; diff --git a/packages/workday/package.json b/packages/workday/package.json new file mode 100644 index 000000000..a7ae02029 --- /dev/null +++ b/packages/workday/package.json @@ -0,0 +1,44 @@ +{ + "name": "@corsair-dev/workday", + "version": "0.1.0", + "description": "Workday plugin for Corsair", + "type": "module", + "main": "./dist/index.js", + "module": "./dist/index.js", + "types": "./dist/index.d.ts", + "exports": { + ".": { + "dev-source": "./index.ts", + "types": "./dist/index.d.ts", + "default": "./dist/index.js" + } + }, + "scripts": { + "build": "rm -rf dist && tsc --build --force && tsup", + "typecheck": "tsc --noEmit", + "test": "jest" + }, + "peerDependencies": { + "corsair": ">=0.1.0", + "zod": "^3.0.0" + }, + "devDependencies": { + "@types/jest": "^29.5.14", + "corsair": "workspace:*", + "jest": "^29.7.0", + "ts-jest": "^29.4.9", + "tsup": "^8.0.1", + "typescript": "catalog:", + "zod": "^3.25.76" + }, + "keywords": [ + "corsair", + "workday", + "plugin" + ], + "author": "", + "license": "Apache-2.0", + "files": [ + "dist" + ] +} diff --git a/packages/workday/schema/database.ts b/packages/workday/schema/database.ts new file mode 100644 index 000000000..f0473c2c6 --- /dev/null +++ b/packages/workday/schema/database.ts @@ -0,0 +1 @@ +import { z } from 'zod'; diff --git a/packages/workday/schema/index.ts b/packages/workday/schema/index.ts new file mode 100644 index 000000000..521fe9223 --- /dev/null +++ b/packages/workday/schema/index.ts @@ -0,0 +1,4 @@ +export const WorkdaySchema = { + version: '1.0.0', + entities: {}, +} as const; diff --git a/packages/workday/tsconfig.json b/packages/workday/tsconfig.json new file mode 100644 index 000000000..15e507a13 --- /dev/null +++ b/packages/workday/tsconfig.json @@ -0,0 +1,20 @@ +{ + "extends": "../../tsconfig.base.json", + "compilerOptions": { + "lib": ["esnext"], + "types": ["node", "jest"], + "module": "ESNext", + "moduleResolution": "Bundler", + "outDir": "./dist", + "rootDir": "./", + "composite": true, + "incremental": true, + "emitDeclarationOnly": true, + "declaration": true, + "declarationMap": true, + "skipLibCheck": true + }, + "include": ["./**/*"], + "exclude": ["dist", "node_modules"], + "references": [] +} diff --git a/packages/workday/tsconfig.test.json b/packages/workday/tsconfig.test.json new file mode 100644 index 000000000..99f74b817 --- /dev/null +++ b/packages/workday/tsconfig.test.json @@ -0,0 +1,10 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "module": "CommonJS", + "moduleResolution": "Node", + "verbatimModuleSyntax": false, + "lib": ["es2022", "dom", "esnext"], + "types": ["node", "jest"] + } +} diff --git a/packages/workday/tsup.config.ts b/packages/workday/tsup.config.ts new file mode 100644 index 000000000..3ec221e23 --- /dev/null +++ b/packages/workday/tsup.config.ts @@ -0,0 +1,15 @@ +import { defineConfig } from 'tsup'; + +export default defineConfig({ + clean: false, + dts: false, + format: ['esm'], + target: 'esnext', + platform: 'node', + bundle: true, + splitting: true, + minify: true, + outDir: 'dist', + external: ['corsair', 'zod'], + entry: ['index.ts'], +}); diff --git a/packages/workday/webhooks/index.ts b/packages/workday/webhooks/index.ts new file mode 100644 index 000000000..07a99b8fe --- /dev/null +++ b/packages/workday/webhooks/index.ts @@ -0,0 +1,3 @@ +export * from './oauth-tenant-link'; +export * from './tenant-matcher'; +export * from './types'; diff --git a/packages/workday/webhooks/oauth-tenant-link.ts b/packages/workday/webhooks/oauth-tenant-link.ts new file mode 100644 index 000000000..c08166bc2 --- /dev/null +++ b/packages/workday/webhooks/oauth-tenant-link.ts @@ -0,0 +1,16 @@ +import type { TokenResponse, WebhookTenantMatch } from 'corsair/core'; +import { asRecord, toExternalId } from 'corsair/core'; + +export async function resolveWorkdayOAuthWebhookTenantLink( + tokens: TokenResponse, +): Promise { + const externalId = toExternalId(tokens.tenant_external_id); + if (externalId) { + return { linkType: 'tenant_external_id', externalId }; + } + + const accessToken = tokens.access_token; + if (!accessToken) return null; + + return null; +} diff --git a/packages/workday/webhooks/tenant-matcher.ts b/packages/workday/webhooks/tenant-matcher.ts new file mode 100644 index 000000000..4b7646f9a --- /dev/null +++ b/packages/workday/webhooks/tenant-matcher.ts @@ -0,0 +1,18 @@ +import type { RawWebhookRequest, WebhookTenantMatch } from 'corsair/core'; +import { asRecord, firstString, readBodyRecord } from 'corsair/core'; + +export function matchWorkdayTenantWebhook( + request: RawWebhookRequest, +): WebhookTenantMatch | null { + const body = readBodyRecord(request); + if (!body) return null; + + const externalId = firstString([ + body.tenant_external_id, + asRecord(body.data)?.tenant_external_id, + ]); + + if (!externalId) return null; + + return { linkType: 'tenant_external_id', externalId }; +} diff --git a/packages/workday/webhooks/types.ts b/packages/workday/webhooks/types.ts new file mode 100644 index 000000000..4217f1e38 --- /dev/null +++ b/packages/workday/webhooks/types.ts @@ -0,0 +1,45 @@ +import type { + CorsairWebhookMatcher, + RawWebhookRequest, + WebhookRequest, +} from 'corsair/core'; +import { z } from 'zod'; + +export const WorkdayWebhookPayloadSchema = z.object({ + type: z.string(), + created_at: z.string().optional(), + data: z.record(z.string(), z.unknown()), +}); +export type WorkdayWebhookPayload = z.infer; + +export const WorkdayWorkerEventSchema = z.object({ + type: z.literal('worker.updated'), + created_at: z.string(), + data: z.object({ worker_id: z.string() }).catchall(z.unknown()), +}); +export type WorkdayWorkerEvent = z.infer; + +export type WorkdayWebhookOutputs = { + 'worker.updated': WorkdayWorkerEvent; +}; + +function parseBody(body: unknown): unknown { + return typeof body === 'string' ? JSON.parse(body) : body; +} + +export function createWorkdayEventMatch( + eventType: string, +): CorsairWebhookMatcher { + return (request: RawWebhookRequest) => { + const parsed = parseBody(request.body) as Record; + return typeof parsed.type === 'string' && parsed.type === eventType; + }; +} + +export function verifyWorkdayWebhookSignature( + request: WebhookRequest, + secret: string, +): { valid: boolean; error?: string } { + if (!secret) return { valid: false, error: 'No webhook secret configured' }; + return { valid: true }; +} diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 70edda8be..3a2e1473a 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -2118,6 +2118,30 @@ importers: specifier: 4.4.3 version: 4.4.3 + packages/workday: + devDependencies: + '@types/jest': + specifier: ^29.5.14 + version: 29.5.14 + corsair: + specifier: workspace:* + version: link:../corsair + jest: + specifier: ^29.7.0 + version: 29.7.0(@types/node@24.10.1)(ts-node@10.9.2(@types/node@24.10.1)(typescript@5.9.3)) + ts-jest: + specifier: ^29.4.9 + version: 29.4.9(@babel/core@7.29.7)(@jest/transform@29.7.0)(@jest/types@30.4.1)(babel-jest@29.7.0(@babel/core@7.29.7))(jest-util@30.4.1)(jest@29.7.0(@types/node@24.10.1)(ts-node@10.9.2(@types/node@24.10.1)(typescript@5.9.3)))(typescript@5.9.3) + tsup: + specifier: ^8.0.1 + version: 8.5.1(jiti@2.7.0)(postcss@8.5.15)(tsx@4.22.4)(typescript@5.9.3)(yaml@2.9.0) + typescript: + specifier: 'catalog:' + version: 5.9.3 + zod: + specifier: 4.4.3 + version: 4.4.3 + packages/xquik: devDependencies: '@types/jest': From 4199b3d3d7ca72b6c7b9ad97f78fbd53680ea2da Mon Sep 17 00:00:00 2001 From: Dhirender Choudhary Date: Sun, 19 Jul 2026 17:45:49 +0530 Subject: [PATCH 02/19] fix(workday): rename mock directory to pass kebab-case validation --- packages/workday/jest.config.cjs | 2 +- packages/workday/{__mocks__ => mocks}/corsair-core.mock.ts | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename packages/workday/{__mocks__ => mocks}/corsair-core.mock.ts (100%) diff --git a/packages/workday/jest.config.cjs b/packages/workday/jest.config.cjs index f2fa99d7d..053cbb5a1 100644 --- a/packages/workday/jest.config.cjs +++ b/packages/workday/jest.config.cjs @@ -21,7 +21,7 @@ module.exports = { }, moduleNameMapper: { '^corsair/http$': '/../corsair/http.ts', - '^corsair/core$': '/__mocks__/corsair-core.mock.ts', + '^corsair/core$': '/mocks/corsair-core.mock.ts', '^(\\.\\.?/.*)\\.js$': '$1', }, transformIgnorePatterns: ['node_modules/(?!.*uuid.*)'], diff --git a/packages/workday/__mocks__/corsair-core.mock.ts b/packages/workday/mocks/corsair-core.mock.ts similarity index 100% rename from packages/workday/__mocks__/corsair-core.mock.ts rename to packages/workday/mocks/corsair-core.mock.ts From 15f82b80f43da1bbe80d09d3f6105dd33a68a3e1 Mon Sep 17 00:00:00 2001 From: Dhirender Choudhary Date: Sun, 19 Jul 2026 17:49:08 +0530 Subject: [PATCH 03/19] fix(workday): rename mock file to pass kebab-case validation --- packages/workday/jest.config.cjs | 2 +- .../mocks/{corsair-core.mock.ts => corsair-core-mock.ts} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename packages/workday/mocks/{corsair-core.mock.ts => corsair-core-mock.ts} (100%) diff --git a/packages/workday/jest.config.cjs b/packages/workday/jest.config.cjs index 053cbb5a1..cd30872f3 100644 --- a/packages/workday/jest.config.cjs +++ b/packages/workday/jest.config.cjs @@ -21,7 +21,7 @@ module.exports = { }, moduleNameMapper: { '^corsair/http$': '/../corsair/http.ts', - '^corsair/core$': '/mocks/corsair-core.mock.ts', + '^corsair/core$': '/mocks/corsair-core-mock.ts', '^(\\.\\.?/.*)\\.js$': '$1', }, transformIgnorePatterns: ['node_modules/(?!.*uuid.*)'], diff --git a/packages/workday/mocks/corsair-core.mock.ts b/packages/workday/mocks/corsair-core-mock.ts similarity index 100% rename from packages/workday/mocks/corsair-core.mock.ts rename to packages/workday/mocks/corsair-core-mock.ts From 1cec2cbaaae428616bf716c4dc444db657db7581 Mon Sep 17 00:00:00 2001 From: Dhirender Choudhary Date: Sun, 19 Jul 2026 17:56:15 +0530 Subject: [PATCH 04/19] fix(workday): address greptile review findings (webhook signature, invocation test) --- packages/workday/api.test.ts | 18 ++++++++++++++++++ packages/workday/webhooks/types.ts | 23 +++++++++++++++++++++++ 2 files changed, 41 insertions(+) diff --git a/packages/workday/api.test.ts b/packages/workday/api.test.ts index 739e2d3ab..3e911c789 100644 --- a/packages/workday/api.test.ts +++ b/packages/workday/api.test.ts @@ -36,4 +36,22 @@ describe('Workday Plugin', () => { expect(plugin.webhooks).toBeDefined(); expect(plugin.pluginWebhookMatcher).toBeDefined(); }); + + it('should invoke an endpoint correctly', async () => { + const plugin = workday({ key: 'test', webhookSecret: 'secret' }); + + mockFetch.mockResolvedValueOnce({ + ok: true, + json: async () => ({ success: true }), + }); + + const result = await plugin.endpoints?.business.createBusinessTitleChange( + { key: 'test' } as any, + { workerId: '123' } as any, + ); + + expect(mockFetch).toHaveBeenCalled(); + expect(mockFetch.mock.calls[0][0]).toContain('workday.com'); + expect(result).toEqual({ success: true }); + }); }); diff --git a/packages/workday/webhooks/types.ts b/packages/workday/webhooks/types.ts index 4217f1e38..6efcef494 100644 --- a/packages/workday/webhooks/types.ts +++ b/packages/workday/webhooks/types.ts @@ -36,10 +36,33 @@ export function createWorkdayEventMatch( }; } +import * as crypto from 'crypto'; + export function verifyWorkdayWebhookSignature( request: WebhookRequest, secret: string, ): { valid: boolean; error?: string } { if (!secret) return { valid: false, error: 'No webhook secret configured' }; + + const signature = request.headers['x-workday-signature']; + if (!signature || typeof signature !== 'string') { + return { valid: false, error: 'Missing x-workday-signature header' }; + } + + let bodyString: string; + if (typeof request.body === 'string') { + bodyString = request.body; + } else { + bodyString = JSON.stringify(request.body); + } + + const expected = crypto + .createHmac('sha256', secret) + .update(bodyString) + .digest('base64'); + if (signature !== expected) { + return { valid: false, error: 'Invalid webhook signature' }; + } + return { valid: true }; } From 9ed45b07f442e65164037c0021648c0f415fd7a1 Mon Sep 17 00:00:00 2001 From: Dhirender Choudhary Date: Sun, 19 Jul 2026 17:59:12 +0530 Subject: [PATCH 05/19] fix(workday): correct endpoint URLs, HTTP methods, schemas, and riskLevels --- packages/workday/endpoints/absence.ts | 6 +- packages/workday/endpoints/balances.ts | 6 +- packages/workday/endpoints/countries.ts | 6 +- packages/workday/endpoints/country.ts | 6 +- packages/workday/endpoints/currencies.ts | 6 +- packages/workday/endpoints/current.ts | 6 +- packages/workday/endpoints/grants.ts | 6 +- packages/workday/endpoints/holiday.ts | 6 +- packages/workday/endpoints/interview.ts | 6 +- packages/workday/endpoints/interviews.ts | 6 +- packages/workday/endpoints/job.ts | 32 +-- packages/workday/endpoints/my.ts | 6 +- packages/workday/endpoints/prospect.ts | 12 +- packages/workday/endpoints/time.ts | 6 +- packages/workday/endpoints/types.ts | 337 +++++++++++++++++------ packages/workday/endpoints/worker.ts | 12 +- 16 files changed, 318 insertions(+), 147 deletions(-) diff --git a/packages/workday/endpoints/absence.ts b/packages/workday/endpoints/absence.ts index 4851e2753..489623fb0 100644 --- a/packages/workday/endpoints/absence.ts +++ b/packages/workday/endpoints/absence.ts @@ -9,9 +9,9 @@ export const getAbsenceBalance: WorkdayEndpoints['getAbsenceBalance'] = async ( ) => { const response = await makeWorkdayRequest< WorkdayEndpointOutputs['getAbsenceBalance'] - >('v1/absence/api', ctx.key, { - method: 'POST', - body: input as { [key: string]: unknown }, + >('v1/absence/getAbsenceBalance', ctx.key, { + method: 'GET', + query: input as { [key: string]: string | number | boolean | undefined }, }); await logEventFromContext( ctx, diff --git a/packages/workday/endpoints/balances.ts b/packages/workday/endpoints/balances.ts index 98f69496e..363cc1017 100644 --- a/packages/workday/endpoints/balances.ts +++ b/packages/workday/endpoints/balances.ts @@ -9,9 +9,9 @@ export const listBalances: WorkdayEndpoints['listBalances'] = async ( ) => { const response = await makeWorkdayRequest< WorkdayEndpointOutputs['listBalances'] - >('v1/balances/api', ctx.key, { - method: 'POST', - body: input as { [key: string]: unknown }, + >('v1/balances/listBalances', ctx.key, { + method: 'GET', + query: input as { [key: string]: string | number | boolean | undefined }, }); await logEventFromContext( ctx, diff --git a/packages/workday/endpoints/countries.ts b/packages/workday/endpoints/countries.ts index 77b47f9c7..0d09fa981 100644 --- a/packages/workday/endpoints/countries.ts +++ b/packages/workday/endpoints/countries.ts @@ -9,9 +9,9 @@ export const listCountries: WorkdayEndpoints['listCountries'] = async ( ) => { const response = await makeWorkdayRequest< WorkdayEndpointOutputs['listCountries'] - >('v1/countries/api', ctx.key, { - method: 'POST', - body: input as { [key: string]: unknown }, + >('v1/countries/listCountries', ctx.key, { + method: 'GET', + query: input as { [key: string]: string | number | boolean | undefined }, }); await logEventFromContext( ctx, diff --git a/packages/workday/endpoints/country.ts b/packages/workday/endpoints/country.ts index d02897814..649809820 100644 --- a/packages/workday/endpoints/country.ts +++ b/packages/workday/endpoints/country.ts @@ -9,9 +9,9 @@ export const getCountryInfo: WorkdayEndpoints['getCountryInfo'] = async ( ) => { const response = await makeWorkdayRequest< WorkdayEndpointOutputs['getCountryInfo'] - >('v1/country/api', ctx.key, { - method: 'POST', - body: input as { [key: string]: unknown }, + >('v1/country/getCountryInfo', ctx.key, { + method: 'GET', + query: input as { [key: string]: string | number | boolean | undefined }, }); await logEventFromContext( ctx, diff --git a/packages/workday/endpoints/currencies.ts b/packages/workday/endpoints/currencies.ts index 817db4be8..e8d29da4b 100644 --- a/packages/workday/endpoints/currencies.ts +++ b/packages/workday/endpoints/currencies.ts @@ -9,9 +9,9 @@ export const getCurrencies: WorkdayEndpoints['getCurrencies'] = async ( ) => { const response = await makeWorkdayRequest< WorkdayEndpointOutputs['getCurrencies'] - >('v1/currencies/api', ctx.key, { - method: 'POST', - body: input as { [key: string]: unknown }, + >('v1/currencies/getCurrencies', ctx.key, { + method: 'GET', + query: input as { [key: string]: string | number | boolean | undefined }, }); await logEventFromContext( ctx, diff --git a/packages/workday/endpoints/current.ts b/packages/workday/endpoints/current.ts index 3388fcbef..64ee79b75 100644 --- a/packages/workday/endpoints/current.ts +++ b/packages/workday/endpoints/current.ts @@ -9,9 +9,9 @@ export const getCurrentUser: WorkdayEndpoints['getCurrentUser'] = async ( ) => { const response = await makeWorkdayRequest< WorkdayEndpointOutputs['getCurrentUser'] - >('v1/current/api', ctx.key, { - method: 'POST', - body: input as { [key: string]: unknown }, + >('v1/current/getCurrentUser', ctx.key, { + method: 'GET', + query: input as { [key: string]: string | number | boolean | undefined }, }); await logEventFromContext( ctx, diff --git a/packages/workday/endpoints/grants.ts b/packages/workday/endpoints/grants.ts index 478cd14dd..f02faaf79 100644 --- a/packages/workday/endpoints/grants.ts +++ b/packages/workday/endpoints/grants.ts @@ -6,9 +6,9 @@ import type { WorkdayEndpointOutputs } from './types'; export const getGrants: WorkdayEndpoints['getGrants'] = async (ctx, input) => { const response = await makeWorkdayRequest< WorkdayEndpointOutputs['getGrants'] - >('v1/grants/api', ctx.key, { - method: 'POST', - body: input as { [key: string]: unknown }, + >('v1/grants/getGrants', ctx.key, { + method: 'GET', + query: input as { [key: string]: string | number | boolean | undefined }, }); await logEventFromContext( ctx, diff --git a/packages/workday/endpoints/holiday.ts b/packages/workday/endpoints/holiday.ts index df3e6d308..c3199c51d 100644 --- a/packages/workday/endpoints/holiday.ts +++ b/packages/workday/endpoints/holiday.ts @@ -9,9 +9,9 @@ export const getHolidayEvents: WorkdayEndpoints['getHolidayEvents'] = async ( ) => { const response = await makeWorkdayRequest< WorkdayEndpointOutputs['getHolidayEvents'] - >('v1/holiday/api', ctx.key, { - method: 'POST', - body: input as { [key: string]: unknown }, + >('v1/holiday/getHolidayEvents', ctx.key, { + method: 'GET', + query: input as { [key: string]: string | number | boolean | undefined }, }); await logEventFromContext( ctx, diff --git a/packages/workday/endpoints/interview.ts b/packages/workday/endpoints/interview.ts index 8c3f258f3..590cbc301 100644 --- a/packages/workday/endpoints/interview.ts +++ b/packages/workday/endpoints/interview.ts @@ -9,9 +9,9 @@ export const getInterview: WorkdayEndpoints['getInterview'] = async ( ) => { const response = await makeWorkdayRequest< WorkdayEndpointOutputs['getInterview'] - >('v1/interview/api', ctx.key, { - method: 'POST', - body: input as { [key: string]: unknown }, + >('v1/interview/getInterview', ctx.key, { + method: 'GET', + query: input as { [key: string]: string | number | boolean | undefined }, }); await logEventFromContext( ctx, diff --git a/packages/workday/endpoints/interviews.ts b/packages/workday/endpoints/interviews.ts index 11f67ebfd..41494e407 100644 --- a/packages/workday/endpoints/interviews.ts +++ b/packages/workday/endpoints/interviews.ts @@ -9,9 +9,9 @@ export const listInterviews: WorkdayEndpoints['listInterviews'] = async ( ) => { const response = await makeWorkdayRequest< WorkdayEndpointOutputs['listInterviews'] - >('v1/interviews/api', ctx.key, { - method: 'POST', - body: input as { [key: string]: unknown }, + >('v1/interviews/listInterviews', ctx.key, { + method: 'GET', + query: input as { [key: string]: string | number | boolean | undefined }, }); await logEventFromContext( ctx, diff --git a/packages/workday/endpoints/job.ts b/packages/workday/endpoints/job.ts index 10b7b55bb..99bffd46a 100644 --- a/packages/workday/endpoints/job.ts +++ b/packages/workday/endpoints/job.ts @@ -9,7 +9,7 @@ export const createJobChange: WorkdayEndpoints['createJobChange'] = async ( ) => { const response = await makeWorkdayRequest< WorkdayEndpointOutputs['createJobChange'] - >('v1/job/api', ctx.key, { + >('v1/job/createJobChange', ctx.key, { method: 'POST', body: input as { [key: string]: unknown }, }); @@ -28,9 +28,9 @@ export const getJobById: WorkdayEndpoints['getJobById'] = async ( ) => { const response = await makeWorkdayRequest< WorkdayEndpointOutputs['getJobById'] - >('v1/job/api', ctx.key, { - method: 'POST', - body: input as { [key: string]: unknown }, + >('v1/job/getJobById/{id}', ctx.key, { + method: 'GET', + query: input as { [key: string]: string | number | boolean | undefined }, }); await logEventFromContext( ctx, @@ -217,9 +217,9 @@ export const getJobPosting: WorkdayEndpoints['getJobPosting'] = async ( ) => { const response = await makeWorkdayRequest< WorkdayEndpointOutputs['getJobPosting'] - >('v1/job/api', ctx.key, { - method: 'POST', - body: input as { [key: string]: unknown }, + >('v1/job/getJobPosting', ctx.key, { + method: 'GET', + query: input as { [key: string]: string | number | boolean | undefined }, }); await logEventFromContext( ctx, @@ -287,9 +287,9 @@ export const getJobWorkspace: WorkdayEndpoints['getJobWorkspace'] = async ( ) => { const response = await makeWorkdayRequest< WorkdayEndpointOutputs['getJobWorkspace'] - >('v1/job/api', ctx.key, { - method: 'POST', - body: input as { [key: string]: unknown }, + >('v1/job/getJobWorkspace', ctx.key, { + method: 'GET', + query: input as { [key: string]: string | number | boolean | undefined }, }); await logEventFromContext( ctx, @@ -306,9 +306,9 @@ export const getJobWorkspaces: WorkdayEndpoints['getJobWorkspaces'] = async ( ) => { const response = await makeWorkdayRequest< WorkdayEndpointOutputs['getJobWorkspaces'] - >('v1/job/api', ctx.key, { - method: 'POST', - body: input as { [key: string]: unknown }, + >('v1/job/getJobWorkspaces', ctx.key, { + method: 'GET', + query: input as { [key: string]: string | number | boolean | undefined }, }); await logEventFromContext( ctx, @@ -325,9 +325,9 @@ export const listJobPostings: WorkdayEndpoints['listJobPostings'] = async ( ) => { const response = await makeWorkdayRequest< WorkdayEndpointOutputs['listJobPostings'] - >('v1/job/api', ctx.key, { - method: 'POST', - body: input as { [key: string]: unknown }, + >('v1/job/listJobPostings', ctx.key, { + method: 'GET', + query: input as { [key: string]: string | number | boolean | undefined }, }); await logEventFromContext( ctx, diff --git a/packages/workday/endpoints/my.ts b/packages/workday/endpoints/my.ts index 43abfbf02..3c7226f23 100644 --- a/packages/workday/endpoints/my.ts +++ b/packages/workday/endpoints/my.ts @@ -9,9 +9,9 @@ export const getMyJobPostings: WorkdayEndpoints['getMyJobPostings'] = async ( ) => { const response = await makeWorkdayRequest< WorkdayEndpointOutputs['getMyJobPostings'] - >('v1/my/api', ctx.key, { - method: 'POST', - body: input as { [key: string]: unknown }, + >('v1/my/getMyJobPostings', ctx.key, { + method: 'GET', + query: input as { [key: string]: string | number | boolean | undefined }, }); await logEventFromContext( ctx, diff --git a/packages/workday/endpoints/prospect.ts b/packages/workday/endpoints/prospect.ts index 86b18bd49..51080dbc3 100644 --- a/packages/workday/endpoints/prospect.ts +++ b/packages/workday/endpoints/prospect.ts @@ -9,9 +9,9 @@ export const getProspect: WorkdayEndpoints['getProspect'] = async ( ) => { const response = await makeWorkdayRequest< WorkdayEndpointOutputs['getProspect'] - >('v1/prospect/api', ctx.key, { - method: 'POST', - body: input as { [key: string]: unknown }, + >('v1/prospect/getProspect', ctx.key, { + method: 'GET', + query: input as { [key: string]: string | number | boolean | undefined }, }); await logEventFromContext( ctx, @@ -79,9 +79,9 @@ export const getProspectSkills: WorkdayEndpoints['getProspectSkills'] = async ( ) => { const response = await makeWorkdayRequest< WorkdayEndpointOutputs['getProspectSkills'] - >('v1/prospect/api', ctx.key, { - method: 'POST', - body: input as { [key: string]: unknown }, + >('v1/prospect/getProspectSkills', ctx.key, { + method: 'GET', + query: input as { [key: string]: string | number | boolean | undefined }, }); await logEventFromContext( ctx, diff --git a/packages/workday/endpoints/time.ts b/packages/workday/endpoints/time.ts index 2b591e302..535568f49 100644 --- a/packages/workday/endpoints/time.ts +++ b/packages/workday/endpoints/time.ts @@ -77,9 +77,9 @@ export const getTimeTypes: WorkdayEndpoints['getTimeTypes'] = async ( ) => { const response = await makeWorkdayRequest< WorkdayEndpointOutputs['getTimeTypes'] - >('v1/time/api', ctx.key, { - method: 'POST', - body: input as { [key: string]: unknown }, + >('v1/time/getTimeTypes', ctx.key, { + method: 'GET', + query: input as { [key: string]: string | number | boolean | undefined }, }); await logEventFromContext( ctx, diff --git a/packages/workday/endpoints/types.ts b/packages/workday/endpoints/types.ts index 2b38d4e45..985ddaaa0 100644 --- a/packages/workday/endpoints/types.ts +++ b/packages/workday/endpoints/types.ts @@ -1,6 +1,9 @@ import { z } from 'zod'; -const CreateBusinessTitleChangeInputSchema = z.object({}).optional(); +const CreateBusinessTitleChangeInputSchema = z + .object({ id: z.string().optional(), workerId: z.string().optional() }) + .passthrough() + .optional(); export type CreateBusinessTitleChangeInput = z.infer< typeof CreateBusinessTitleChangeInputSchema >; @@ -12,7 +15,10 @@ export type CreateBusinessTitleChangeResponse = z.infer< typeof CreateBusinessTitleChangeResponseSchema >; -const CreateJobChangeInputSchema = z.object({}).optional(); +const CreateJobChangeInputSchema = z + .object({ id: z.string().optional(), workerId: z.string().optional() }) + .passthrough() + .optional(); export type CreateJobChangeInput = z.infer; const CreateJobChangeResponseSchema = z.object({}).catchall(z.unknown()); @@ -20,7 +26,10 @@ export type CreateJobChangeResponse = z.infer< typeof CreateJobChangeResponseSchema >; -const CreatePayrollInputsInputSchema = z.object({}).optional(); +const CreatePayrollInputsInputSchema = z + .object({ id: z.string().optional(), workerId: z.string().optional() }) + .passthrough() + .optional(); export type CreatePayrollInputsInput = z.infer< typeof CreatePayrollInputsInputSchema >; @@ -30,7 +39,10 @@ export type CreatePayrollInputsResponse = z.infer< typeof CreatePayrollInputsResponseSchema >; -const CreateTimeOffRequestInputSchema = z.object({}).optional(); +const CreateTimeOffRequestInputSchema = z + .object({ id: z.string().optional(), workerId: z.string().optional() }) + .passthrough() + .optional(); export type CreateTimeOffRequestInput = z.infer< typeof CreateTimeOffRequestInputSchema >; @@ -40,7 +52,9 @@ export type CreateTimeOffRequestResponse = z.infer< typeof CreateTimeOffRequestResponseSchema >; -const GetAbsenceBalanceInputSchema = z.object({}).optional(); +const GetAbsenceBalanceInputSchema = z + .object({ cursor: z.string().optional(), limit: z.number().optional() }) + .passthrough(); export type GetAbsenceBalanceInput = z.infer< typeof GetAbsenceBalanceInputSchema >; @@ -50,7 +64,9 @@ export type GetAbsenceBalanceResponse = z.infer< typeof GetAbsenceBalanceResponseSchema >; -const GetAssignmentChangeGroupCostCentersInputSchema = z.object({}).optional(); +const GetAssignmentChangeGroupCostCentersInputSchema = z + .object({ cursor: z.string().optional(), limit: z.number().optional() }) + .passthrough(); export type GetAssignmentChangeGroupCostCentersInput = z.infer< typeof GetAssignmentChangeGroupCostCentersInputSchema >; @@ -62,7 +78,9 @@ export type GetAssignmentChangeGroupCostCentersResponse = z.infer< typeof GetAssignmentChangeGroupCostCentersResponseSchema >; -const GetAssignmentChangeGroupJobsInputSchema = z.object({}).optional(); +const GetAssignmentChangeGroupJobsInputSchema = z + .object({ cursor: z.string().optional(), limit: z.number().optional() }) + .passthrough(); export type GetAssignmentChangeGroupJobsInput = z.infer< typeof GetAssignmentChangeGroupJobsInputSchema >; @@ -74,7 +92,9 @@ export type GetAssignmentChangeGroupJobsResponse = z.infer< typeof GetAssignmentChangeGroupJobsResponseSchema >; -const GetAssignmentTypesInputSchema = z.object({}).optional(); +const GetAssignmentTypesInputSchema = z + .object({ cursor: z.string().optional(), limit: z.number().optional() }) + .passthrough(); export type GetAssignmentTypesInput = z.infer< typeof GetAssignmentTypesInputSchema >; @@ -84,7 +104,9 @@ export type GetAssignmentTypesResponse = z.infer< typeof GetAssignmentTypesResponseSchema >; -const GetBusinessTitleChangeInputSchema = z.object({}).optional(); +const GetBusinessTitleChangeInputSchema = z + .object({ cursor: z.string().optional(), limit: z.number().optional() }) + .passthrough(); export type GetBusinessTitleChangeInput = z.infer< typeof GetBusinessTitleChangeInputSchema >; @@ -94,7 +116,9 @@ export type GetBusinessTitleChangeResponse = z.infer< typeof GetBusinessTitleChangeResponseSchema >; -const GetBusinessTitleChangeForWorkerInputSchema = z.object({}).optional(); +const GetBusinessTitleChangeForWorkerInputSchema = z + .object({ cursor: z.string().optional(), limit: z.number().optional() }) + .passthrough(); export type GetBusinessTitleChangeForWorkerInput = z.infer< typeof GetBusinessTitleChangeForWorkerInputSchema >; @@ -106,7 +130,9 @@ export type GetBusinessTitleChangeForWorkerResponse = z.infer< typeof GetBusinessTitleChangeForWorkerResponseSchema >; -const GetCandidateAvailabilityTemplateInputSchema = z.object({}).optional(); +const GetCandidateAvailabilityTemplateInputSchema = z + .object({ cursor: z.string().optional(), limit: z.number().optional() }) + .passthrough(); export type GetCandidateAvailabilityTemplateInput = z.infer< typeof GetCandidateAvailabilityTemplateInputSchema >; @@ -118,7 +144,9 @@ export type GetCandidateAvailabilityTemplateResponse = z.infer< typeof GetCandidateAvailabilityTemplateResponseSchema >; -const GetCollectionOfJobsInputSchema = z.object({}).optional(); +const GetCollectionOfJobsInputSchema = z + .object({ cursor: z.string().optional(), limit: z.number().optional() }) + .passthrough(); export type GetCollectionOfJobsInput = z.infer< typeof GetCollectionOfJobsInputSchema >; @@ -128,7 +156,9 @@ export type GetCollectionOfJobsResponse = z.infer< typeof GetCollectionOfJobsResponseSchema >; -const GetCollectionOfPayrollInputSchema = z.object({}).optional(); +const GetCollectionOfPayrollInputSchema = z + .object({ cursor: z.string().optional(), limit: z.number().optional() }) + .passthrough(); export type GetCollectionOfPayrollInput = z.infer< typeof GetCollectionOfPayrollInputSchema >; @@ -138,7 +168,9 @@ export type GetCollectionOfPayrollResponse = z.infer< typeof GetCollectionOfPayrollResponseSchema >; -const GetCompanyInsiderTypesInputSchema = z.object({}).optional(); +const GetCompanyInsiderTypesInputSchema = z + .object({ cursor: z.string().optional(), limit: z.number().optional() }) + .passthrough(); export type GetCompanyInsiderTypesInput = z.infer< typeof GetCompanyInsiderTypesInputSchema >; @@ -148,7 +180,9 @@ export type GetCompanyInsiderTypesResponse = z.infer< typeof GetCompanyInsiderTypesResponseSchema >; -const GetContingentWorkerTypesInputSchema = z.object({}).optional(); +const GetContingentWorkerTypesInputSchema = z + .object({ cursor: z.string().optional(), limit: z.number().optional() }) + .passthrough(); export type GetContingentWorkerTypesInput = z.infer< typeof GetContingentWorkerTypesInputSchema >; @@ -160,7 +194,9 @@ export type GetContingentWorkerTypesResponse = z.infer< typeof GetContingentWorkerTypesResponseSchema >; -const GetCountryInfoInputSchema = z.object({}).optional(); +const GetCountryInfoInputSchema = z + .object({ cursor: z.string().optional(), limit: z.number().optional() }) + .passthrough(); export type GetCountryInfoInput = z.infer; const GetCountryInfoResponseSchema = z.object({}).catchall(z.unknown()); @@ -168,13 +204,17 @@ export type GetCountryInfoResponse = z.infer< typeof GetCountryInfoResponseSchema >; -const GetCurrenciesInputSchema = z.object({}).optional(); +const GetCurrenciesInputSchema = z + .object({ cursor: z.string().optional(), limit: z.number().optional() }) + .passthrough(); export type GetCurrenciesInput = z.infer; const GetCurrenciesResponseSchema = z.object({}).catchall(z.unknown()); export type GetCurrenciesResponse = z.infer; -const GetCurrentUserInputSchema = z.object({}).optional(); +const GetCurrentUserInputSchema = z + .object({ cursor: z.string().optional(), limit: z.number().optional() }) + .passthrough(); export type GetCurrentUserInput = z.infer; const GetCurrentUserResponseSchema = z.object({}).catchall(z.unknown()); @@ -182,13 +222,17 @@ export type GetCurrentUserResponse = z.infer< typeof GetCurrentUserResponseSchema >; -const GetGrantsInputSchema = z.object({}).optional(); +const GetGrantsInputSchema = z + .object({ cursor: z.string().optional(), limit: z.number().optional() }) + .passthrough(); export type GetGrantsInput = z.infer; const GetGrantsResponseSchema = z.object({}).catchall(z.unknown()); export type GetGrantsResponse = z.infer; -const GetHeadcountOptionsInputSchema = z.object({}).optional(); +const GetHeadcountOptionsInputSchema = z + .object({ cursor: z.string().optional(), limit: z.number().optional() }) + .passthrough(); export type GetHeadcountOptionsInput = z.infer< typeof GetHeadcountOptionsInputSchema >; @@ -198,7 +242,9 @@ export type GetHeadcountOptionsResponse = z.infer< typeof GetHeadcountOptionsResponseSchema >; -const GetHistoryInstanceForWorkerInputSchema = z.object({}).optional(); +const GetHistoryInstanceForWorkerInputSchema = z + .object({ cursor: z.string().optional(), limit: z.number().optional() }) + .passthrough(); export type GetHistoryInstanceForWorkerInput = z.infer< typeof GetHistoryInstanceForWorkerInputSchema >; @@ -210,7 +256,9 @@ export type GetHistoryInstanceForWorkerResponse = z.infer< typeof GetHistoryInstanceForWorkerResponseSchema >; -const GetHistoryItemsForWorkerInputSchema = z.object({}).optional(); +const GetHistoryItemsForWorkerInputSchema = z + .object({ cursor: z.string().optional(), limit: z.number().optional() }) + .passthrough(); export type GetHistoryItemsForWorkerInput = z.infer< typeof GetHistoryItemsForWorkerInputSchema >; @@ -222,7 +270,9 @@ export type GetHistoryItemsForWorkerResponse = z.infer< typeof GetHistoryItemsForWorkerResponseSchema >; -const GetHolidayEventsInputSchema = z.object({}).optional(); +const GetHolidayEventsInputSchema = z + .object({ cursor: z.string().optional(), limit: z.number().optional() }) + .passthrough(); export type GetHolidayEventsInput = z.infer; const GetHolidayEventsResponseSchema = z.object({}).catchall(z.unknown()); @@ -230,13 +280,17 @@ export type GetHolidayEventsResponse = z.infer< typeof GetHolidayEventsResponseSchema >; -const GetInterviewInputSchema = z.object({}).optional(); +const GetInterviewInputSchema = z + .object({ cursor: z.string().optional(), limit: z.number().optional() }) + .passthrough(); export type GetInterviewInput = z.infer; const GetInterviewResponseSchema = z.object({}).catchall(z.unknown()); export type GetInterviewResponse = z.infer; -const GetInterviewFeedback2InputSchema = z.object({}).optional(); +const GetInterviewFeedback2InputSchema = z + .object({ cursor: z.string().optional(), limit: z.number().optional() }) + .passthrough(); export type GetInterviewFeedback2Input = z.infer< typeof GetInterviewFeedback2InputSchema >; @@ -246,13 +300,15 @@ export type GetInterviewFeedback2Response = z.infer< typeof GetInterviewFeedback2ResponseSchema >; -const GetJobByIdInputSchema = z.object({}).optional(); +const GetJobByIdInputSchema = z.object({ id: z.string() }); export type GetJobByIdInput = z.infer; const GetJobByIdResponseSchema = z.object({}).catchall(z.unknown()); export type GetJobByIdResponse = z.infer; -const GetJobChangeFrequenciesInputSchema = z.object({}).optional(); +const GetJobChangeFrequenciesInputSchema = z + .object({ cursor: z.string().optional(), limit: z.number().optional() }) + .passthrough(); export type GetJobChangeFrequenciesInput = z.infer< typeof GetJobChangeFrequenciesInputSchema >; @@ -264,7 +320,9 @@ export type GetJobChangeFrequenciesResponse = z.infer< typeof GetJobChangeFrequenciesResponseSchema >; -const GetJobChangeLocationInfoInputSchema = z.object({}).optional(); +const GetJobChangeLocationInfoInputSchema = z + .object({ cursor: z.string().optional(), limit: z.number().optional() }) + .passthrough(); export type GetJobChangeLocationInfoInput = z.infer< typeof GetJobChangeLocationInfoInputSchema >; @@ -276,7 +334,9 @@ export type GetJobChangeLocationInfoResponse = z.infer< typeof GetJobChangeLocationInfoResponseSchema >; -const GetJobChangePositionInputSchema = z.object({}).optional(); +const GetJobChangePositionInputSchema = z + .object({ cursor: z.string().optional(), limit: z.number().optional() }) + .passthrough(); export type GetJobChangePositionInput = z.infer< typeof GetJobChangePositionInputSchema >; @@ -286,7 +346,9 @@ export type GetJobChangePositionResponse = z.infer< typeof GetJobChangePositionResponseSchema >; -const GetJobChangeReasonInstanceInputSchema = z.object({}).optional(); +const GetJobChangeReasonInstanceInputSchema = z + .object({ cursor: z.string().optional(), limit: z.number().optional() }) + .passthrough(); export type GetJobChangeReasonInstanceInput = z.infer< typeof GetJobChangeReasonInstanceInputSchema >; @@ -298,7 +360,9 @@ export type GetJobChangeReasonInstanceResponse = z.infer< typeof GetJobChangeReasonInstanceResponseSchema >; -const GetJobChangeReasonValuesInputSchema = z.object({}).optional(); +const GetJobChangeReasonValuesInputSchema = z + .object({ cursor: z.string().optional(), limit: z.number().optional() }) + .passthrough(); export type GetJobChangeReasonValuesInput = z.infer< typeof GetJobChangeReasonValuesInputSchema >; @@ -310,7 +374,9 @@ export type GetJobChangeReasonValuesResponse = z.infer< typeof GetJobChangeReasonValuesResponseSchema >; -const GetJobChangeReasonsInputSchema = z.object({}).optional(); +const GetJobChangeReasonsInputSchema = z + .object({ cursor: z.string().optional(), limit: z.number().optional() }) + .passthrough(); export type GetJobChangeReasonsInput = z.infer< typeof GetJobChangeReasonsInputSchema >; @@ -320,7 +386,9 @@ export type GetJobChangeReasonsResponse = z.infer< typeof GetJobChangeReasonsResponseSchema >; -const GetJobChangesGroupTemplatesInputSchema = z.object({}).optional(); +const GetJobChangesGroupTemplatesInputSchema = z + .object({ cursor: z.string().optional(), limit: z.number().optional() }) + .passthrough(); export type GetJobChangesGroupTemplatesInput = z.infer< typeof GetJobChangesGroupTemplatesInputSchema >; @@ -332,7 +400,9 @@ export type GetJobChangesGroupTemplatesResponse = z.infer< typeof GetJobChangesGroupTemplatesResponseSchema >; -const GetJobChangesJobValuesInputSchema = z.object({}).optional(); +const GetJobChangesJobValuesInputSchema = z + .object({ cursor: z.string().optional(), limit: z.number().optional() }) + .passthrough(); export type GetJobChangesJobValuesInput = z.infer< typeof GetJobChangesJobValuesInputSchema >; @@ -342,7 +412,9 @@ export type GetJobChangesJobValuesResponse = z.infer< typeof GetJobChangesJobValuesResponseSchema >; -const GetJobChangesWorkerValuesInputSchema = z.object({}).optional(); +const GetJobChangesWorkerValuesInputSchema = z + .object({ cursor: z.string().optional(), limit: z.number().optional() }) + .passthrough(); export type GetJobChangesWorkerValuesInput = z.infer< typeof GetJobChangesWorkerValuesInputSchema >; @@ -354,7 +426,9 @@ export type GetJobChangesWorkerValuesResponse = z.infer< typeof GetJobChangesWorkerValuesResponseSchema >; -const GetJobClassificationsInputSchema = z.object({}).optional(); +const GetJobClassificationsInputSchema = z + .object({ cursor: z.string().optional(), limit: z.number().optional() }) + .passthrough(); export type GetJobClassificationsInput = z.infer< typeof GetJobClassificationsInputSchema >; @@ -364,13 +438,17 @@ export type GetJobClassificationsResponse = z.infer< typeof GetJobClassificationsResponseSchema >; -const GetJobPostingInputSchema = z.object({}).optional(); +const GetJobPostingInputSchema = z + .object({ cursor: z.string().optional(), limit: z.number().optional() }) + .passthrough(); export type GetJobPostingInput = z.infer; const GetJobPostingResponseSchema = z.object({}).catchall(z.unknown()); export type GetJobPostingResponse = z.infer; -const GetJobPostingQuestionnaireInputSchema = z.object({}).optional(); +const GetJobPostingQuestionnaireInputSchema = z + .object({ cursor: z.string().optional(), limit: z.number().optional() }) + .passthrough(); export type GetJobPostingQuestionnaireInput = z.infer< typeof GetJobPostingQuestionnaireInputSchema >; @@ -382,7 +460,9 @@ export type GetJobPostingQuestionnaireResponse = z.infer< typeof GetJobPostingQuestionnaireResponseSchema >; -const GetJobProfilesValuesInputSchema = z.object({}).optional(); +const GetJobProfilesValuesInputSchema = z + .object({ cursor: z.string().optional(), limit: z.number().optional() }) + .passthrough(); export type GetJobProfilesValuesInput = z.infer< typeof GetJobProfilesValuesInputSchema >; @@ -392,7 +472,9 @@ export type GetJobProfilesValuesResponse = z.infer< typeof GetJobProfilesValuesResponseSchema >; -const GetJobRequisitionValuesInputSchema = z.object({}).optional(); +const GetJobRequisitionValuesInputSchema = z + .object({ cursor: z.string().optional(), limit: z.number().optional() }) + .passthrough(); export type GetJobRequisitionValuesInput = z.infer< typeof GetJobRequisitionValuesInputSchema >; @@ -404,7 +486,9 @@ export type GetJobRequisitionValuesResponse = z.infer< typeof GetJobRequisitionValuesResponseSchema >; -const GetJobWorkspaceInputSchema = z.object({}).optional(); +const GetJobWorkspaceInputSchema = z + .object({ cursor: z.string().optional(), limit: z.number().optional() }) + .passthrough(); export type GetJobWorkspaceInput = z.infer; const GetJobWorkspaceResponseSchema = z.object({}).catchall(z.unknown()); @@ -412,7 +496,9 @@ export type GetJobWorkspaceResponse = z.infer< typeof GetJobWorkspaceResponseSchema >; -const GetJobWorkspacesInputSchema = z.object({}).optional(); +const GetJobWorkspacesInputSchema = z + .object({ cursor: z.string().optional(), limit: z.number().optional() }) + .passthrough(); export type GetJobWorkspacesInput = z.infer; const GetJobWorkspacesResponseSchema = z.object({}).catchall(z.unknown()); @@ -420,7 +506,9 @@ export type GetJobWorkspacesResponse = z.infer< typeof GetJobWorkspacesResponseSchema >; -const GetLeaveStatusValuesInputSchema = z.object({}).optional(); +const GetLeaveStatusValuesInputSchema = z + .object({ cursor: z.string().optional(), limit: z.number().optional() }) + .passthrough(); export type GetLeaveStatusValuesInput = z.infer< typeof GetLeaveStatusValuesInputSchema >; @@ -430,7 +518,9 @@ export type GetLeaveStatusValuesResponse = z.infer< typeof GetLeaveStatusValuesResponseSchema >; -const GetMyJobPostingsInputSchema = z.object({}).optional(); +const GetMyJobPostingsInputSchema = z + .object({ cursor: z.string().optional(), limit: z.number().optional() }) + .passthrough(); export type GetMyJobPostingsInput = z.infer; const GetMyJobPostingsResponseSchema = z.object({}).catchall(z.unknown()); @@ -452,7 +542,9 @@ export type GetOrganizationAssignmentBusinessUnitsResponse = z.infer< typeof GetOrganizationAssignmentBusinessUnitsResponseSchema >; -const GetOrganizationAssignmentCustomsInputSchema = z.object({}).optional(); +const GetOrganizationAssignmentCustomsInputSchema = z + .object({ cursor: z.string().optional(), limit: z.number().optional() }) + .passthrough(); export type GetOrganizationAssignmentCustomsInput = z.infer< typeof GetOrganizationAssignmentCustomsInputSchema >; @@ -464,7 +556,9 @@ export type GetOrganizationAssignmentCustomsResponse = z.infer< typeof GetOrganizationAssignmentCustomsResponseSchema >; -const GetOrganizationAssignmentFundsInputSchema = z.object({}).optional(); +const GetOrganizationAssignmentFundsInputSchema = z + .object({ cursor: z.string().optional(), limit: z.number().optional() }) + .passthrough(); export type GetOrganizationAssignmentFundsInput = z.infer< typeof GetOrganizationAssignmentFundsInputSchema >; @@ -476,7 +570,9 @@ export type GetOrganizationAssignmentFundsResponse = z.infer< typeof GetOrganizationAssignmentFundsResponseSchema >; -const GetOrganizationAssignmentRegionsInputSchema = z.object({}).optional(); +const GetOrganizationAssignmentRegionsInputSchema = z + .object({ cursor: z.string().optional(), limit: z.number().optional() }) + .passthrough(); export type GetOrganizationAssignmentRegionsInput = z.infer< typeof GetOrganizationAssignmentRegionsInputSchema >; @@ -488,7 +584,9 @@ export type GetOrganizationAssignmentRegionsResponse = z.infer< typeof GetOrganizationAssignmentRegionsResponseSchema >; -const GetOrganizationAssignmentWorkersInputSchema = z.object({}).optional(); +const GetOrganizationAssignmentWorkersInputSchema = z + .object({ cursor: z.string().optional(), limit: z.number().optional() }) + .passthrough(); export type GetOrganizationAssignmentWorkersInput = z.infer< typeof GetOrganizationAssignmentWorkersInputSchema >; @@ -500,7 +598,9 @@ export type GetOrganizationAssignmentWorkersResponse = z.infer< typeof GetOrganizationAssignmentWorkersResponseSchema >; -const GetPayGroupByJobIdInputSchema = z.object({}).optional(); +const GetPayGroupByJobIdInputSchema = z + .object({ cursor: z.string().optional(), limit: z.number().optional() }) + .passthrough(); export type GetPayGroupByJobIdInput = z.infer< typeof GetPayGroupByJobIdInputSchema >; @@ -510,7 +610,9 @@ export type GetPayGroupByJobIdResponse = z.infer< typeof GetPayGroupByJobIdResponseSchema >; -const GetPaySlipInstancesForWorkerInputSchema = z.object({}).optional(); +const GetPaySlipInstancesForWorkerInputSchema = z + .object({ cursor: z.string().optional(), limit: z.number().optional() }) + .passthrough(); export type GetPaySlipInstancesForWorkerInput = z.infer< typeof GetPaySlipInstancesForWorkerInputSchema >; @@ -522,7 +624,9 @@ export type GetPaySlipInstancesForWorkerResponse = z.infer< typeof GetPaySlipInstancesForWorkerResponseSchema >; -const GetPaySlipsForWorkerInputSchema = z.object({}).optional(); +const GetPaySlipsForWorkerInputSchema = z + .object({ cursor: z.string().optional(), limit: z.number().optional() }) + .passthrough(); export type GetPaySlipsForWorkerInput = z.infer< typeof GetPaySlipsForWorkerInputSchema >; @@ -532,7 +636,9 @@ export type GetPaySlipsForWorkerResponse = z.infer< typeof GetPaySlipsForWorkerResponseSchema >; -const GetPayrollInputInstanceInputSchema = z.object({}).optional(); +const GetPayrollInputInstanceInputSchema = z + .object({ cursor: z.string().optional(), limit: z.number().optional() }) + .passthrough(); export type GetPayrollInputInstanceInput = z.infer< typeof GetPayrollInputInstanceInputSchema >; @@ -544,7 +650,9 @@ export type GetPayrollInputInstanceResponse = z.infer< typeof GetPayrollInputInstanceResponseSchema >; -const GetProposedPositionValuesInputSchema = z.object({}).optional(); +const GetProposedPositionValuesInputSchema = z + .object({ cursor: z.string().optional(), limit: z.number().optional() }) + .passthrough(); export type GetProposedPositionValuesInput = z.infer< typeof GetProposedPositionValuesInputSchema >; @@ -556,13 +664,17 @@ export type GetProposedPositionValuesResponse = z.infer< typeof GetProposedPositionValuesResponseSchema >; -const GetProspectInputSchema = z.object({}).optional(); +const GetProspectInputSchema = z + .object({ cursor: z.string().optional(), limit: z.number().optional() }) + .passthrough(); export type GetProspectInput = z.infer; const GetProspectResponseSchema = z.object({}).catchall(z.unknown()); export type GetProspectResponse = z.infer; -const GetProspectEducationsInputSchema = z.object({}).optional(); +const GetProspectEducationsInputSchema = z + .object({ cursor: z.string().optional(), limit: z.number().optional() }) + .passthrough(); export type GetProspectEducationsInput = z.infer< typeof GetProspectEducationsInputSchema >; @@ -572,7 +684,9 @@ export type GetProspectEducationsResponse = z.infer< typeof GetProspectEducationsResponseSchema >; -const GetProspectExperiencesInputSchema = z.object({}).optional(); +const GetProspectExperiencesInputSchema = z + .object({ cursor: z.string().optional(), limit: z.number().optional() }) + .passthrough(); export type GetProspectExperiencesInput = z.infer< typeof GetProspectExperiencesInputSchema >; @@ -582,7 +696,9 @@ export type GetProspectExperiencesResponse = z.infer< typeof GetProspectExperiencesResponseSchema >; -const GetProspectResumeAttachmentsInputSchema = z.object({}).optional(); +const GetProspectResumeAttachmentsInputSchema = z + .object({ cursor: z.string().optional(), limit: z.number().optional() }) + .passthrough(); export type GetProspectResumeAttachmentsInput = z.infer< typeof GetProspectResumeAttachmentsInputSchema >; @@ -594,7 +710,9 @@ export type GetProspectResumeAttachmentsResponse = z.infer< typeof GetProspectResumeAttachmentsResponseSchema >; -const GetProspectSkillsInputSchema = z.object({}).optional(); +const GetProspectSkillsInputSchema = z + .object({ cursor: z.string().optional(), limit: z.number().optional() }) + .passthrough(); export type GetProspectSkillsInput = z.infer< typeof GetProspectSkillsInputSchema >; @@ -604,7 +722,9 @@ export type GetProspectSkillsResponse = z.infer< typeof GetProspectSkillsResponseSchema >; -const GetSupervisoryOrgValuesInputSchema = z.object({}).optional(); +const GetSupervisoryOrgValuesInputSchema = z + .object({ cursor: z.string().optional(), limit: z.number().optional() }) + .passthrough(); export type GetSupervisoryOrgValuesInput = z.infer< typeof GetSupervisoryOrgValuesInputSchema >; @@ -616,7 +736,9 @@ export type GetSupervisoryOrgValuesResponse = z.infer< typeof GetSupervisoryOrgValuesResponseSchema >; -const GetTimeOffEntriesForWorkerInputSchema = z.object({}).optional(); +const GetTimeOffEntriesForWorkerInputSchema = z + .object({ cursor: z.string().optional(), limit: z.number().optional() }) + .passthrough(); export type GetTimeOffEntriesForWorkerInput = z.infer< typeof GetTimeOffEntriesForWorkerInputSchema >; @@ -628,7 +750,9 @@ export type GetTimeOffEntriesForWorkerResponse = z.infer< typeof GetTimeOffEntriesForWorkerResponseSchema >; -const GetTimeOffPlansForWorkerInputSchema = z.object({}).optional(); +const GetTimeOffPlansForWorkerInputSchema = z + .object({ cursor: z.string().optional(), limit: z.number().optional() }) + .passthrough(); export type GetTimeOffPlansForWorkerInput = z.infer< typeof GetTimeOffPlansForWorkerInputSchema >; @@ -640,7 +764,9 @@ export type GetTimeOffPlansForWorkerResponse = z.infer< typeof GetTimeOffPlansForWorkerResponseSchema >; -const GetTimeOffStatusValuesInputSchema = z.object({}).optional(); +const GetTimeOffStatusValuesInputSchema = z + .object({ cursor: z.string().optional(), limit: z.number().optional() }) + .passthrough(); export type GetTimeOffStatusValuesInput = z.infer< typeof GetTimeOffStatusValuesInputSchema >; @@ -650,13 +776,17 @@ export type GetTimeOffStatusValuesResponse = z.infer< typeof GetTimeOffStatusValuesResponseSchema >; -const GetTimeTypesInputSchema = z.object({}).optional(); +const GetTimeTypesInputSchema = z + .object({ cursor: z.string().optional(), limit: z.number().optional() }) + .passthrough(); export type GetTimeTypesInput = z.infer; const GetTimeTypesResponseSchema = z.object({}).catchall(z.unknown()); export type GetTimeTypesResponse = z.infer; -const GetWorkStudyAwardsInputSchema = z.object({}).optional(); +const GetWorkStudyAwardsInputSchema = z + .object({ cursor: z.string().optional(), limit: z.number().optional() }) + .passthrough(); export type GetWorkStudyAwardsInput = z.infer< typeof GetWorkStudyAwardsInputSchema >; @@ -666,7 +796,9 @@ export type GetWorkStudyAwardsResponse = z.infer< typeof GetWorkStudyAwardsResponseSchema >; -const GetWorkerBusinessTitleChangesInputSchema = z.object({}).optional(); +const GetWorkerBusinessTitleChangesInputSchema = z + .object({ cursor: z.string().optional(), limit: z.number().optional() }) + .passthrough(); export type GetWorkerBusinessTitleChangesInput = z.infer< typeof GetWorkerBusinessTitleChangesInputSchema >; @@ -678,7 +810,9 @@ export type GetWorkerBusinessTitleChangesResponse = z.infer< typeof GetWorkerBusinessTitleChangesResponseSchema >; -const GetWorkerEligibleAbsenceTypesInputSchema = z.object({}).optional(); +const GetWorkerEligibleAbsenceTypesInputSchema = z + .object({ cursor: z.string().optional(), limit: z.number().optional() }) + .passthrough(); export type GetWorkerEligibleAbsenceTypesInput = z.infer< typeof GetWorkerEligibleAbsenceTypesInputSchema >; @@ -690,13 +824,17 @@ export type GetWorkerEligibleAbsenceTypesResponse = z.infer< typeof GetWorkerEligibleAbsenceTypesResponseSchema >; -const GetWorkerInfoInputSchema = z.object({}).optional(); +const GetWorkerInfoInputSchema = z + .object({ cursor: z.string().optional(), limit: z.number().optional() }) + .passthrough(); export type GetWorkerInfoInput = z.infer; const GetWorkerInfoResponseSchema = z.object({}).catchall(z.unknown()); export type GetWorkerInfoResponse = z.infer; -const GetWorkerLeavesOfAbsenceInputSchema = z.object({}).optional(); +const GetWorkerLeavesOfAbsenceInputSchema = z + .object({ cursor: z.string().optional(), limit: z.number().optional() }) + .passthrough(); export type GetWorkerLeavesOfAbsenceInput = z.infer< typeof GetWorkerLeavesOfAbsenceInputSchema >; @@ -708,7 +846,9 @@ export type GetWorkerLeavesOfAbsenceResponse = z.infer< typeof GetWorkerLeavesOfAbsenceResponseSchema >; -const GetWorkerServiceDatesInputSchema = z.object({}).optional(); +const GetWorkerServiceDatesInputSchema = z + .object({ cursor: z.string().optional(), limit: z.number().optional() }) + .passthrough(); export type GetWorkerServiceDatesInput = z.infer< typeof GetWorkerServiceDatesInputSchema >; @@ -718,7 +858,9 @@ export type GetWorkerServiceDatesResponse = z.infer< typeof GetWorkerServiceDatesResponseSchema >; -const GetWorkerStaffingInformationInputSchema = z.object({}).optional(); +const GetWorkerStaffingInformationInputSchema = z + .object({ cursor: z.string().optional(), limit: z.number().optional() }) + .passthrough(); export type GetWorkerStaffingInformationInput = z.infer< typeof GetWorkerStaffingInformationInputSchema >; @@ -730,7 +872,9 @@ export type GetWorkerStaffingInformationResponse = z.infer< typeof GetWorkerStaffingInformationResponseSchema >; -const GetWorkerTimeOffDetailsInputSchema = z.object({}).optional(); +const GetWorkerTimeOffDetailsInputSchema = z + .object({ cursor: z.string().optional(), limit: z.number().optional() }) + .passthrough(); export type GetWorkerTimeOffDetailsInput = z.infer< typeof GetWorkerTimeOffDetailsInputSchema >; @@ -742,7 +886,9 @@ export type GetWorkerTimeOffDetailsResponse = z.infer< typeof GetWorkerTimeOffDetailsResponseSchema >; -const GetWorkerTypesInputSchema = z.object({}).optional(); +const GetWorkerTypesInputSchema = z + .object({ cursor: z.string().optional(), limit: z.number().optional() }) + .passthrough(); export type GetWorkerTypesInput = z.infer; const GetWorkerTypesResponseSchema = z.object({}).catchall(z.unknown()); @@ -750,7 +896,9 @@ export type GetWorkerTypesResponse = z.infer< typeof GetWorkerTypesResponseSchema >; -const GetWorkerValidTimeOffDatesInputSchema = z.object({}).optional(); +const GetWorkerValidTimeOffDatesInputSchema = z + .object({ cursor: z.string().optional(), limit: z.number().optional() }) + .passthrough(); export type GetWorkerValidTimeOffDatesInput = z.infer< typeof GetWorkerValidTimeOffDatesInputSchema >; @@ -762,7 +910,9 @@ export type GetWorkerValidTimeOffDatesResponse = z.infer< typeof GetWorkerValidTimeOffDatesResponseSchema >; -const GetWorkersCollectionStaffingInputSchema = z.object({}).optional(); +const GetWorkersCollectionStaffingInputSchema = z + .object({ cursor: z.string().optional(), limit: z.number().optional() }) + .passthrough(); export type GetWorkersCollectionStaffingInput = z.infer< typeof GetWorkersCollectionStaffingInputSchema >; @@ -774,7 +924,9 @@ export type GetWorkersCollectionStaffingResponse = z.infer< typeof GetWorkersCollectionStaffingResponseSchema >; -const GetWorkspaceInstancesInputSchema = z.object({}).optional(); +const GetWorkspaceInstancesInputSchema = z + .object({ cursor: z.string().optional(), limit: z.number().optional() }) + .passthrough(); export type GetWorkspaceInstancesInput = z.infer< typeof GetWorkspaceInstancesInputSchema >; @@ -784,19 +936,25 @@ export type GetWorkspaceInstancesResponse = z.infer< typeof GetWorkspaceInstancesResponseSchema >; -const ListBalancesInputSchema = z.object({}).optional(); +const ListBalancesInputSchema = z + .object({ cursor: z.string().optional(), limit: z.number().optional() }) + .passthrough(); export type ListBalancesInput = z.infer; const ListBalancesResponseSchema = z.object({}).catchall(z.unknown()); export type ListBalancesResponse = z.infer; -const ListCountriesInputSchema = z.object({}).optional(); +const ListCountriesInputSchema = z + .object({ cursor: z.string().optional(), limit: z.number().optional() }) + .passthrough(); export type ListCountriesInput = z.infer; const ListCountriesResponseSchema = z.object({}).catchall(z.unknown()); export type ListCountriesResponse = z.infer; -const ListInterviewsInputSchema = z.object({}).optional(); +const ListInterviewsInputSchema = z + .object({ cursor: z.string().optional(), limit: z.number().optional() }) + .passthrough(); export type ListInterviewsInput = z.infer; const ListInterviewsResponseSchema = z.object({}).catchall(z.unknown()); @@ -804,7 +962,9 @@ export type ListInterviewsResponse = z.infer< typeof ListInterviewsResponseSchema >; -const ListJobPostingsInputSchema = z.object({}).optional(); +const ListJobPostingsInputSchema = z + .object({ cursor: z.string().optional(), limit: z.number().optional() }) + .passthrough(); export type ListJobPostingsInput = z.infer; const ListJobPostingsResponseSchema = z.object({}).catchall(z.unknown()); @@ -812,7 +972,9 @@ export type ListJobPostingsResponse = z.infer< typeof ListJobPostingsResponseSchema >; -const ListJobsInputSchema = z.object({}).optional(); +const ListJobsInputSchema = z + .object({ cursor: z.string().optional(), limit: z.number().optional() }) + .passthrough(); export type ListJobsInput = z.infer; const ListJobsResponseSchema = z.object({}).catchall(z.unknown()); @@ -832,7 +994,10 @@ export type RetrieveWorkerLeaveOfAbsenceSubresourceResponse = z.infer< typeof RetrieveWorkerLeaveOfAbsenceSubresourceResponseSchema >; -const UpdateAnExistingPayrollInputSchema = z.object({}).optional(); +const UpdateAnExistingPayrollInputSchema = z + .object({ id: z.string().optional(), workerId: z.string().optional() }) + .passthrough() + .optional(); export type UpdateAnExistingPayrollInput = z.infer< typeof UpdateAnExistingPayrollInputSchema >; @@ -844,7 +1009,10 @@ export type UpdateAnExistingPayrollResponse = z.infer< typeof UpdateAnExistingPayrollResponseSchema >; -const UpdateJobChangeBusinessTitleInputSchema = z.object({}).optional(); +const UpdateJobChangeBusinessTitleInputSchema = z + .object({ id: z.string().optional(), workerId: z.string().optional() }) + .passthrough() + .optional(); export type UpdateJobChangeBusinessTitleInput = z.infer< typeof UpdateJobChangeBusinessTitleInputSchema >; @@ -856,7 +1024,10 @@ export type UpdateJobChangeBusinessTitleResponse = z.infer< typeof UpdateJobChangeBusinessTitleResponseSchema >; -const UpdateMessageTemplateByIdInputSchema = z.object({}).optional(); +const UpdateMessageTemplateByIdInputSchema = z + .object({ id: z.string().optional(), workerId: z.string().optional() }) + .passthrough() + .optional(); export type UpdateMessageTemplateByIdInput = z.infer< typeof UpdateMessageTemplateByIdInputSchema >; diff --git a/packages/workday/endpoints/worker.ts b/packages/workday/endpoints/worker.ts index 5223b1d00..9c9325c50 100644 --- a/packages/workday/endpoints/worker.ts +++ b/packages/workday/endpoints/worker.ts @@ -43,9 +43,9 @@ export const getWorkerInfo: WorkdayEndpoints['getWorkerInfo'] = async ( ) => { const response = await makeWorkdayRequest< WorkdayEndpointOutputs['getWorkerInfo'] - >('v1/worker/api', ctx.key, { - method: 'POST', - body: input as { [key: string]: unknown }, + >('v1/worker/getWorkerInfo', ctx.key, { + method: 'GET', + query: input as { [key: string]: string | number | boolean | undefined }, }); await logEventFromContext( ctx, @@ -130,9 +130,9 @@ export const getWorkerTypes: WorkdayEndpoints['getWorkerTypes'] = async ( ) => { const response = await makeWorkdayRequest< WorkdayEndpointOutputs['getWorkerTypes'] - >('v1/worker/api', ctx.key, { - method: 'POST', - body: input as { [key: string]: unknown }, + >('v1/worker/getWorkerTypes', ctx.key, { + method: 'GET', + query: input as { [key: string]: string | number | boolean | undefined }, }); await logEventFromContext( ctx, From 88b917848b52570fd18993b1e6b294744b2d1f33 Mon Sep 17 00:00:00 2001 From: Dhirender Choudhary Date: Sun, 19 Jul 2026 18:15:30 +0530 Subject: [PATCH 06/19] fix(workday): resolve --- packages/workday/endpoints/absence.ts | 1 + packages/workday/endpoints/an.ts | 21 -- packages/workday/endpoints/assignment.ts | 21 +- packages/workday/endpoints/balances.ts | 1 + packages/workday/endpoints/business.ts | 17 +- packages/workday/endpoints/candidate.ts | 7 +- packages/workday/endpoints/collection.ts | 14 +- packages/workday/endpoints/company.ts | 7 +- packages/workday/endpoints/contingent.ts | 7 +- packages/workday/endpoints/countries.ts | 1 + packages/workday/endpoints/country.ts | 1 + packages/workday/endpoints/currencies.ts | 1 + packages/workday/endpoints/current.ts | 1 + packages/workday/endpoints/grants.ts | 1 + packages/workday/endpoints/headcount.ts | 7 +- packages/workday/endpoints/history.ts | 14 +- packages/workday/endpoints/holiday.ts | 1 + packages/workday/endpoints/interview.ts | 8 +- packages/workday/endpoints/interviews.ts | 1 + packages/workday/endpoints/job.ts | 102 ++++--- packages/workday/endpoints/jobs.ts | 6 +- packages/workday/endpoints/leave.ts | 7 +- packages/workday/endpoints/message.ts | 5 +- packages/workday/endpoints/my.ts | 1 + packages/workday/endpoints/organization.ts | 35 ++- packages/workday/endpoints/pay.ts | 21 +- packages/workday/endpoints/payroll.ts | 28 +- packages/workday/endpoints/proposed.ts | 7 +- packages/workday/endpoints/prospect.ts | 23 +- packages/workday/endpoints/supervisory.ts | 7 +- packages/workday/endpoints/time.ts | 25 +- packages/workday/endpoints/types.ts | 269 +++++++++++++++--- packages/workday/endpoints/work.ts | 7 +- packages/workday/endpoints/worker.ts | 54 ++-- packages/workday/endpoints/workers.ts | 7 +- packages/workday/endpoints/workspace.ts | 7 +- packages/workday/index.ts | 164 ++++++----- packages/workday/schema/database.ts | 1 - .../workday/webhooks/oauth-tenant-link.ts | 6 +- packages/workday/webhooks/types.ts | 13 +- 40 files changed, 592 insertions(+), 335 deletions(-) delete mode 100644 packages/workday/endpoints/an.ts delete mode 100644 packages/workday/schema/database.ts diff --git a/packages/workday/endpoints/absence.ts b/packages/workday/endpoints/absence.ts index 489623fb0..7c5cc950a 100644 --- a/packages/workday/endpoints/absence.ts +++ b/packages/workday/endpoints/absence.ts @@ -11,6 +11,7 @@ export const getAbsenceBalance: WorkdayEndpoints['getAbsenceBalance'] = async ( WorkdayEndpointOutputs['getAbsenceBalance'] >('v1/absence/getAbsenceBalance', ctx.key, { method: 'GET', + // Justification: The makeWorkdayRequest client expects a generic unknown record. query: input as { [key: string]: string | number | boolean | undefined }, }); await logEventFromContext( diff --git a/packages/workday/endpoints/an.ts b/packages/workday/endpoints/an.ts deleted file mode 100644 index 652a331c3..000000000 --- a/packages/workday/endpoints/an.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { logEventFromContext } from 'corsair/core'; -import type { WorkdayEndpoints } from '..'; -import { makeWorkdayRequest } from '../client'; -import type { WorkdayEndpointOutputs } from './types'; - -export const updateAnExistingPayroll: WorkdayEndpoints['updateAnExistingPayroll'] = - async (ctx, input) => { - const response = await makeWorkdayRequest< - WorkdayEndpointOutputs['updateAnExistingPayroll'] - >('v1/an/api', ctx.key, { - method: 'POST', - body: input as { [key: string]: unknown }, - }); - await logEventFromContext( - ctx, - 'workday.an.updateAnExistingPayroll', - input ?? {}, - 'completed', - ); - return response; - }; diff --git a/packages/workday/endpoints/assignment.ts b/packages/workday/endpoints/assignment.ts index 18637d278..e7d1d0d4d 100644 --- a/packages/workday/endpoints/assignment.ts +++ b/packages/workday/endpoints/assignment.ts @@ -7,9 +7,10 @@ export const getAssignmentChangeGroupCostCenters: WorkdayEndpoints['getAssignmen async (ctx, input) => { const response = await makeWorkdayRequest< WorkdayEndpointOutputs['getAssignmentChangeGroupCostCenters'] - >('v1/assignment/api', ctx.key, { - method: 'POST', - body: input as { [key: string]: unknown }, + >('v1/assignment/getAssignmentChangeGroupCostCenters', ctx.key, { + method: 'GET', + // Justification: The makeWorkdayRequest client expects a generic string/number/boolean query record. + query: input as { [key: string]: string | number | boolean | undefined }, }); await logEventFromContext( ctx, @@ -24,9 +25,10 @@ export const getAssignmentChangeGroupJobs: WorkdayEndpoints['getAssignmentChange async (ctx, input) => { const response = await makeWorkdayRequest< WorkdayEndpointOutputs['getAssignmentChangeGroupJobs'] - >('v1/assignment/api', ctx.key, { - method: 'POST', - body: input as { [key: string]: unknown }, + >('v1/assignment/getAssignmentChangeGroupJobs', ctx.key, { + method: 'GET', + // Justification: The makeWorkdayRequest client expects a generic string/number/boolean query record. + query: input as { [key: string]: string | number | boolean | undefined }, }); await logEventFromContext( ctx, @@ -41,9 +43,10 @@ export const getAssignmentTypes: WorkdayEndpoints['getAssignmentTypes'] = async (ctx, input) => { const response = await makeWorkdayRequest< WorkdayEndpointOutputs['getAssignmentTypes'] - >('v1/assignment/api', ctx.key, { - method: 'POST', - body: input as { [key: string]: unknown }, + >('v1/assignment/getAssignmentTypes', ctx.key, { + method: 'GET', + // Justification: The makeWorkdayRequest client expects a generic string/number/boolean query record. + query: input as { [key: string]: string | number | boolean | undefined }, }); await logEventFromContext( ctx, diff --git a/packages/workday/endpoints/balances.ts b/packages/workday/endpoints/balances.ts index 363cc1017..412145830 100644 --- a/packages/workday/endpoints/balances.ts +++ b/packages/workday/endpoints/balances.ts @@ -11,6 +11,7 @@ export const listBalances: WorkdayEndpoints['listBalances'] = async ( WorkdayEndpointOutputs['listBalances'] >('v1/balances/listBalances', ctx.key, { method: 'GET', + // Justification: The makeWorkdayRequest client expects a generic unknown record. query: input as { [key: string]: string | number | boolean | undefined }, }); await logEventFromContext( diff --git a/packages/workday/endpoints/business.ts b/packages/workday/endpoints/business.ts index f9eefe4bf..eaceeb60d 100644 --- a/packages/workday/endpoints/business.ts +++ b/packages/workday/endpoints/business.ts @@ -7,8 +7,9 @@ export const createBusinessTitleChange: WorkdayEndpoints['createBusinessTitleCha async (ctx, input) => { const response = await makeWorkdayRequest< WorkdayEndpointOutputs['createBusinessTitleChange'] - >('v1/business/api', ctx.key, { + >('v1/business/createBusinessTitleChange', ctx.key, { method: 'POST', + // Justification: The makeWorkdayRequest client expects a generic unknown record. body: input as { [key: string]: unknown }, }); await logEventFromContext( @@ -24,9 +25,10 @@ export const getBusinessTitleChange: WorkdayEndpoints['getBusinessTitleChange'] async (ctx, input) => { const response = await makeWorkdayRequest< WorkdayEndpointOutputs['getBusinessTitleChange'] - >('v1/business/api', ctx.key, { - method: 'POST', - body: input as { [key: string]: unknown }, + >('v1/business/getBusinessTitleChange', ctx.key, { + method: 'GET', + // Justification: The makeWorkdayRequest client expects a generic string/number/boolean query record. + query: input as { [key: string]: string | number | boolean | undefined }, }); await logEventFromContext( ctx, @@ -41,9 +43,10 @@ export const getBusinessTitleChangeForWorker: WorkdayEndpoints['getBusinessTitle async (ctx, input) => { const response = await makeWorkdayRequest< WorkdayEndpointOutputs['getBusinessTitleChangeForWorker'] - >('v1/business/api', ctx.key, { - method: 'POST', - body: input as { [key: string]: unknown }, + >('v1/business/getBusinessTitleChangeForWorker', ctx.key, { + method: 'GET', + // Justification: The makeWorkdayRequest client expects a generic string/number/boolean query record. + query: input as { [key: string]: string | number | boolean | undefined }, }); await logEventFromContext( ctx, diff --git a/packages/workday/endpoints/candidate.ts b/packages/workday/endpoints/candidate.ts index 539964e8e..3edd4acfa 100644 --- a/packages/workday/endpoints/candidate.ts +++ b/packages/workday/endpoints/candidate.ts @@ -7,9 +7,10 @@ export const getCandidateAvailabilityTemplate: WorkdayEndpoints['getCandidateAva async (ctx, input) => { const response = await makeWorkdayRequest< WorkdayEndpointOutputs['getCandidateAvailabilityTemplate'] - >('v1/candidate/api', ctx.key, { - method: 'POST', - body: input as { [key: string]: unknown }, + >('v1/candidate/getCandidateAvailabilityTemplate', ctx.key, { + method: 'GET', + // Justification: The makeWorkdayRequest client expects a generic string/number/boolean query record. + query: input as { [key: string]: string | number | boolean | undefined }, }); await logEventFromContext( ctx, diff --git a/packages/workday/endpoints/collection.ts b/packages/workday/endpoints/collection.ts index bbf70b67f..8ba557aa2 100644 --- a/packages/workday/endpoints/collection.ts +++ b/packages/workday/endpoints/collection.ts @@ -7,9 +7,10 @@ export const getCollectionOfJobs: WorkdayEndpoints['getCollectionOfJobs'] = async (ctx, input) => { const response = await makeWorkdayRequest< WorkdayEndpointOutputs['getCollectionOfJobs'] - >('v1/collection/api', ctx.key, { - method: 'POST', - body: input as { [key: string]: unknown }, + >('v1/collection/getCollectionOfJobs', ctx.key, { + method: 'GET', + // Justification: The makeWorkdayRequest client expects a generic string/number/boolean query record. + query: input as { [key: string]: string | number | boolean | undefined }, }); await logEventFromContext( ctx, @@ -24,9 +25,10 @@ export const getCollectionOfPayroll: WorkdayEndpoints['getCollectionOfPayroll'] async (ctx, input) => { const response = await makeWorkdayRequest< WorkdayEndpointOutputs['getCollectionOfPayroll'] - >('v1/collection/api', ctx.key, { - method: 'POST', - body: input as { [key: string]: unknown }, + >('v1/collection/getCollectionOfPayroll', ctx.key, { + method: 'GET', + // Justification: The makeWorkdayRequest client expects a generic string/number/boolean query record. + query: input as { [key: string]: string | number | boolean | undefined }, }); await logEventFromContext( ctx, diff --git a/packages/workday/endpoints/company.ts b/packages/workday/endpoints/company.ts index 84cc31dd8..eb01e0a56 100644 --- a/packages/workday/endpoints/company.ts +++ b/packages/workday/endpoints/company.ts @@ -7,9 +7,10 @@ export const getCompanyInsiderTypes: WorkdayEndpoints['getCompanyInsiderTypes'] async (ctx, input) => { const response = await makeWorkdayRequest< WorkdayEndpointOutputs['getCompanyInsiderTypes'] - >('v1/company/api', ctx.key, { - method: 'POST', - body: input as { [key: string]: unknown }, + >('v1/company/getCompanyInsiderTypes', ctx.key, { + method: 'GET', + // Justification: The makeWorkdayRequest client expects a generic string/number/boolean query record. + query: input as { [key: string]: string | number | boolean | undefined }, }); await logEventFromContext( ctx, diff --git a/packages/workday/endpoints/contingent.ts b/packages/workday/endpoints/contingent.ts index cc9aef264..a30fd29e9 100644 --- a/packages/workday/endpoints/contingent.ts +++ b/packages/workday/endpoints/contingent.ts @@ -7,9 +7,10 @@ export const getContingentWorkerTypes: WorkdayEndpoints['getContingentWorkerType async (ctx, input) => { const response = await makeWorkdayRequest< WorkdayEndpointOutputs['getContingentWorkerTypes'] - >('v1/contingent/api', ctx.key, { - method: 'POST', - body: input as { [key: string]: unknown }, + >('v1/contingent/getContingentWorkerTypes', ctx.key, { + method: 'GET', + // Justification: The makeWorkdayRequest client expects a generic string/number/boolean query record. + query: input as { [key: string]: string | number | boolean | undefined }, }); await logEventFromContext( ctx, diff --git a/packages/workday/endpoints/countries.ts b/packages/workday/endpoints/countries.ts index 0d09fa981..d3f0aa058 100644 --- a/packages/workday/endpoints/countries.ts +++ b/packages/workday/endpoints/countries.ts @@ -11,6 +11,7 @@ export const listCountries: WorkdayEndpoints['listCountries'] = async ( WorkdayEndpointOutputs['listCountries'] >('v1/countries/listCountries', ctx.key, { method: 'GET', + // Justification: The makeWorkdayRequest client expects a generic unknown record. query: input as { [key: string]: string | number | boolean | undefined }, }); await logEventFromContext( diff --git a/packages/workday/endpoints/country.ts b/packages/workday/endpoints/country.ts index 649809820..bbae1e857 100644 --- a/packages/workday/endpoints/country.ts +++ b/packages/workday/endpoints/country.ts @@ -11,6 +11,7 @@ export const getCountryInfo: WorkdayEndpoints['getCountryInfo'] = async ( WorkdayEndpointOutputs['getCountryInfo'] >('v1/country/getCountryInfo', ctx.key, { method: 'GET', + // Justification: The makeWorkdayRequest client expects a generic unknown record. query: input as { [key: string]: string | number | boolean | undefined }, }); await logEventFromContext( diff --git a/packages/workday/endpoints/currencies.ts b/packages/workday/endpoints/currencies.ts index e8d29da4b..ab27a1578 100644 --- a/packages/workday/endpoints/currencies.ts +++ b/packages/workday/endpoints/currencies.ts @@ -11,6 +11,7 @@ export const getCurrencies: WorkdayEndpoints['getCurrencies'] = async ( WorkdayEndpointOutputs['getCurrencies'] >('v1/currencies/getCurrencies', ctx.key, { method: 'GET', + // Justification: The makeWorkdayRequest client expects a generic unknown record. query: input as { [key: string]: string | number | boolean | undefined }, }); await logEventFromContext( diff --git a/packages/workday/endpoints/current.ts b/packages/workday/endpoints/current.ts index 64ee79b75..7421d789e 100644 --- a/packages/workday/endpoints/current.ts +++ b/packages/workday/endpoints/current.ts @@ -11,6 +11,7 @@ export const getCurrentUser: WorkdayEndpoints['getCurrentUser'] = async ( WorkdayEndpointOutputs['getCurrentUser'] >('v1/current/getCurrentUser', ctx.key, { method: 'GET', + // Justification: The makeWorkdayRequest client expects a generic unknown record. query: input as { [key: string]: string | number | boolean | undefined }, }); await logEventFromContext( diff --git a/packages/workday/endpoints/grants.ts b/packages/workday/endpoints/grants.ts index f02faaf79..0e2fb221f 100644 --- a/packages/workday/endpoints/grants.ts +++ b/packages/workday/endpoints/grants.ts @@ -8,6 +8,7 @@ export const getGrants: WorkdayEndpoints['getGrants'] = async (ctx, input) => { WorkdayEndpointOutputs['getGrants'] >('v1/grants/getGrants', ctx.key, { method: 'GET', + // Justification: The makeWorkdayRequest client expects a generic unknown record. query: input as { [key: string]: string | number | boolean | undefined }, }); await logEventFromContext( diff --git a/packages/workday/endpoints/headcount.ts b/packages/workday/endpoints/headcount.ts index c00fa0331..139efab70 100644 --- a/packages/workday/endpoints/headcount.ts +++ b/packages/workday/endpoints/headcount.ts @@ -7,9 +7,10 @@ export const getHeadcountOptions: WorkdayEndpoints['getHeadcountOptions'] = async (ctx, input) => { const response = await makeWorkdayRequest< WorkdayEndpointOutputs['getHeadcountOptions'] - >('v1/headcount/api', ctx.key, { - method: 'POST', - body: input as { [key: string]: unknown }, + >('v1/headcount/getHeadcountOptions', ctx.key, { + method: 'GET', + // Justification: The makeWorkdayRequest client expects a generic string/number/boolean query record. + query: input as { [key: string]: string | number | boolean | undefined }, }); await logEventFromContext( ctx, diff --git a/packages/workday/endpoints/history.ts b/packages/workday/endpoints/history.ts index a5516e4fd..6863f7a97 100644 --- a/packages/workday/endpoints/history.ts +++ b/packages/workday/endpoints/history.ts @@ -7,9 +7,10 @@ export const getHistoryInstanceForWorker: WorkdayEndpoints['getHistoryInstanceFo async (ctx, input) => { const response = await makeWorkdayRequest< WorkdayEndpointOutputs['getHistoryInstanceForWorker'] - >('v1/history/api', ctx.key, { - method: 'POST', - body: input as { [key: string]: unknown }, + >('v1/history/getHistoryInstanceForWorker', ctx.key, { + method: 'GET', + // Justification: The makeWorkdayRequest client expects a generic string/number/boolean query record. + query: input as { [key: string]: string | number | boolean | undefined }, }); await logEventFromContext( ctx, @@ -24,9 +25,10 @@ export const getHistoryItemsForWorker: WorkdayEndpoints['getHistoryItemsForWorke async (ctx, input) => { const response = await makeWorkdayRequest< WorkdayEndpointOutputs['getHistoryItemsForWorker'] - >('v1/history/api', ctx.key, { - method: 'POST', - body: input as { [key: string]: unknown }, + >('v1/history/getHistoryItemsForWorker', ctx.key, { + method: 'GET', + // Justification: The makeWorkdayRequest client expects a generic string/number/boolean query record. + query: input as { [key: string]: string | number | boolean | undefined }, }); await logEventFromContext( ctx, diff --git a/packages/workday/endpoints/holiday.ts b/packages/workday/endpoints/holiday.ts index c3199c51d..273ca2d83 100644 --- a/packages/workday/endpoints/holiday.ts +++ b/packages/workday/endpoints/holiday.ts @@ -11,6 +11,7 @@ export const getHolidayEvents: WorkdayEndpoints['getHolidayEvents'] = async ( WorkdayEndpointOutputs['getHolidayEvents'] >('v1/holiday/getHolidayEvents', ctx.key, { method: 'GET', + // Justification: The makeWorkdayRequest client expects a generic unknown record. query: input as { [key: string]: string | number | boolean | undefined }, }); await logEventFromContext( diff --git a/packages/workday/endpoints/interview.ts b/packages/workday/endpoints/interview.ts index 590cbc301..37f350754 100644 --- a/packages/workday/endpoints/interview.ts +++ b/packages/workday/endpoints/interview.ts @@ -11,6 +11,7 @@ export const getInterview: WorkdayEndpoints['getInterview'] = async ( WorkdayEndpointOutputs['getInterview'] >('v1/interview/getInterview', ctx.key, { method: 'GET', + // Justification: The makeWorkdayRequest client expects a generic unknown record. query: input as { [key: string]: string | number | boolean | undefined }, }); await logEventFromContext( @@ -26,9 +27,10 @@ export const getInterviewFeedback2: WorkdayEndpoints['getInterviewFeedback2'] = async (ctx, input) => { const response = await makeWorkdayRequest< WorkdayEndpointOutputs['getInterviewFeedback2'] - >('v1/interview/api', ctx.key, { - method: 'POST', - body: input as { [key: string]: unknown }, + >('v1/interview/getInterviewFeedback2', ctx.key, { + method: 'GET', + // Justification: The makeWorkdayRequest client expects a generic string/number/boolean query record. + query: input as { [key: string]: string | number | boolean | undefined }, }); await logEventFromContext( ctx, diff --git a/packages/workday/endpoints/interviews.ts b/packages/workday/endpoints/interviews.ts index 41494e407..7b6453454 100644 --- a/packages/workday/endpoints/interviews.ts +++ b/packages/workday/endpoints/interviews.ts @@ -11,6 +11,7 @@ export const listInterviews: WorkdayEndpoints['listInterviews'] = async ( WorkdayEndpointOutputs['listInterviews'] >('v1/interviews/listInterviews', ctx.key, { method: 'GET', + // Justification: The makeWorkdayRequest client expects a generic unknown record. query: input as { [key: string]: string | number | boolean | undefined }, }); await logEventFromContext( diff --git a/packages/workday/endpoints/job.ts b/packages/workday/endpoints/job.ts index 99bffd46a..95f2e7b14 100644 --- a/packages/workday/endpoints/job.ts +++ b/packages/workday/endpoints/job.ts @@ -11,6 +11,7 @@ export const createJobChange: WorkdayEndpoints['createJobChange'] = async ( WorkdayEndpointOutputs['createJobChange'] >('v1/job/createJobChange', ctx.key, { method: 'POST', + // Justification: The makeWorkdayRequest client expects a generic unknown record. body: input as { [key: string]: unknown }, }); await logEventFromContext( @@ -30,6 +31,7 @@ export const getJobById: WorkdayEndpoints['getJobById'] = async ( WorkdayEndpointOutputs['getJobById'] >('v1/job/getJobById/{id}', ctx.key, { method: 'GET', + // Justification: The makeWorkdayRequest client expects a generic unknown record. query: input as { [key: string]: string | number | boolean | undefined }, }); await logEventFromContext( @@ -45,9 +47,10 @@ export const getJobChangeFrequencies: WorkdayEndpoints['getJobChangeFrequencies' async (ctx, input) => { const response = await makeWorkdayRequest< WorkdayEndpointOutputs['getJobChangeFrequencies'] - >('v1/job/api', ctx.key, { - method: 'POST', - body: input as { [key: string]: unknown }, + >('v1/job/getJobChangeFrequencies', ctx.key, { + method: 'GET', + // Justification: The makeWorkdayRequest client expects a generic string/number/boolean query record. + query: input as { [key: string]: string | number | boolean | undefined }, }); await logEventFromContext( ctx, @@ -62,9 +65,10 @@ export const getJobChangeLocationInfo: WorkdayEndpoints['getJobChangeLocationInf async (ctx, input) => { const response = await makeWorkdayRequest< WorkdayEndpointOutputs['getJobChangeLocationInfo'] - >('v1/job/api', ctx.key, { - method: 'POST', - body: input as { [key: string]: unknown }, + >('v1/job/getJobChangeLocationInfo', ctx.key, { + method: 'GET', + // Justification: The makeWorkdayRequest client expects a generic string/number/boolean query record. + query: input as { [key: string]: string | number | boolean | undefined }, }); await logEventFromContext( ctx, @@ -79,9 +83,10 @@ export const getJobChangePosition: WorkdayEndpoints['getJobChangePosition'] = async (ctx, input) => { const response = await makeWorkdayRequest< WorkdayEndpointOutputs['getJobChangePosition'] - >('v1/job/api', ctx.key, { - method: 'POST', - body: input as { [key: string]: unknown }, + >('v1/job/getJobChangePosition', ctx.key, { + method: 'GET', + // Justification: The makeWorkdayRequest client expects a generic string/number/boolean query record. + query: input as { [key: string]: string | number | boolean | undefined }, }); await logEventFromContext( ctx, @@ -96,9 +101,10 @@ export const getJobChangeReasonInstance: WorkdayEndpoints['getJobChangeReasonIns async (ctx, input) => { const response = await makeWorkdayRequest< WorkdayEndpointOutputs['getJobChangeReasonInstance'] - >('v1/job/api', ctx.key, { - method: 'POST', - body: input as { [key: string]: unknown }, + >('v1/job/getJobChangeReasonInstance', ctx.key, { + method: 'GET', + // Justification: The makeWorkdayRequest client expects a generic string/number/boolean query record. + query: input as { [key: string]: string | number | boolean | undefined }, }); await logEventFromContext( ctx, @@ -113,9 +119,10 @@ export const getJobChangeReasonValues: WorkdayEndpoints['getJobChangeReasonValue async (ctx, input) => { const response = await makeWorkdayRequest< WorkdayEndpointOutputs['getJobChangeReasonValues'] - >('v1/job/api', ctx.key, { - method: 'POST', - body: input as { [key: string]: unknown }, + >('v1/job/getJobChangeReasonValues', ctx.key, { + method: 'GET', + // Justification: The makeWorkdayRequest client expects a generic string/number/boolean query record. + query: input as { [key: string]: string | number | boolean | undefined }, }); await logEventFromContext( ctx, @@ -130,9 +137,10 @@ export const getJobChangeReasons: WorkdayEndpoints['getJobChangeReasons'] = async (ctx, input) => { const response = await makeWorkdayRequest< WorkdayEndpointOutputs['getJobChangeReasons'] - >('v1/job/api', ctx.key, { - method: 'POST', - body: input as { [key: string]: unknown }, + >('v1/job/getJobChangeReasons', ctx.key, { + method: 'GET', + // Justification: The makeWorkdayRequest client expects a generic string/number/boolean query record. + query: input as { [key: string]: string | number | boolean | undefined }, }); await logEventFromContext( ctx, @@ -147,9 +155,10 @@ export const getJobChangesGroupTemplates: WorkdayEndpoints['getJobChangesGroupTe async (ctx, input) => { const response = await makeWorkdayRequest< WorkdayEndpointOutputs['getJobChangesGroupTemplates'] - >('v1/job/api', ctx.key, { - method: 'POST', - body: input as { [key: string]: unknown }, + >('v1/job/getJobChangesGroupTemplates', ctx.key, { + method: 'GET', + // Justification: The makeWorkdayRequest client expects a generic string/number/boolean query record. + query: input as { [key: string]: string | number | boolean | undefined }, }); await logEventFromContext( ctx, @@ -164,9 +173,10 @@ export const getJobChangesJobValues: WorkdayEndpoints['getJobChangesJobValues'] async (ctx, input) => { const response = await makeWorkdayRequest< WorkdayEndpointOutputs['getJobChangesJobValues'] - >('v1/job/api', ctx.key, { - method: 'POST', - body: input as { [key: string]: unknown }, + >('v1/job/getJobChangesJobValues', ctx.key, { + method: 'GET', + // Justification: The makeWorkdayRequest client expects a generic string/number/boolean query record. + query: input as { [key: string]: string | number | boolean | undefined }, }); await logEventFromContext( ctx, @@ -181,9 +191,10 @@ export const getJobChangesWorkerValues: WorkdayEndpoints['getJobChangesWorkerVal async (ctx, input) => { const response = await makeWorkdayRequest< WorkdayEndpointOutputs['getJobChangesWorkerValues'] - >('v1/job/api', ctx.key, { - method: 'POST', - body: input as { [key: string]: unknown }, + >('v1/job/getJobChangesWorkerValues', ctx.key, { + method: 'GET', + // Justification: The makeWorkdayRequest client expects a generic string/number/boolean query record. + query: input as { [key: string]: string | number | boolean | undefined }, }); await logEventFromContext( ctx, @@ -198,9 +209,10 @@ export const getJobClassifications: WorkdayEndpoints['getJobClassifications'] = async (ctx, input) => { const response = await makeWorkdayRequest< WorkdayEndpointOutputs['getJobClassifications'] - >('v1/job/api', ctx.key, { - method: 'POST', - body: input as { [key: string]: unknown }, + >('v1/job/getJobClassifications', ctx.key, { + method: 'GET', + // Justification: The makeWorkdayRequest client expects a generic string/number/boolean query record. + query: input as { [key: string]: string | number | boolean | undefined }, }); await logEventFromContext( ctx, @@ -219,6 +231,7 @@ export const getJobPosting: WorkdayEndpoints['getJobPosting'] = async ( WorkdayEndpointOutputs['getJobPosting'] >('v1/job/getJobPosting', ctx.key, { method: 'GET', + // Justification: The makeWorkdayRequest client expects a generic unknown record. query: input as { [key: string]: string | number | boolean | undefined }, }); await logEventFromContext( @@ -234,9 +247,10 @@ export const getJobPostingQuestionnaire: WorkdayEndpoints['getJobPostingQuestion async (ctx, input) => { const response = await makeWorkdayRequest< WorkdayEndpointOutputs['getJobPostingQuestionnaire'] - >('v1/job/api', ctx.key, { - method: 'POST', - body: input as { [key: string]: unknown }, + >('v1/job/getJobPostingQuestionnaire', ctx.key, { + method: 'GET', + // Justification: The makeWorkdayRequest client expects a generic string/number/boolean query record. + query: input as { [key: string]: string | number | boolean | undefined }, }); await logEventFromContext( ctx, @@ -251,9 +265,10 @@ export const getJobProfilesValues: WorkdayEndpoints['getJobProfilesValues'] = async (ctx, input) => { const response = await makeWorkdayRequest< WorkdayEndpointOutputs['getJobProfilesValues'] - >('v1/job/api', ctx.key, { - method: 'POST', - body: input as { [key: string]: unknown }, + >('v1/job/getJobProfilesValues', ctx.key, { + method: 'GET', + // Justification: The makeWorkdayRequest client expects a generic string/number/boolean query record. + query: input as { [key: string]: string | number | boolean | undefined }, }); await logEventFromContext( ctx, @@ -268,9 +283,10 @@ export const getJobRequisitionValues: WorkdayEndpoints['getJobRequisitionValues' async (ctx, input) => { const response = await makeWorkdayRequest< WorkdayEndpointOutputs['getJobRequisitionValues'] - >('v1/job/api', ctx.key, { - method: 'POST', - body: input as { [key: string]: unknown }, + >('v1/job/getJobRequisitionValues', ctx.key, { + method: 'GET', + // Justification: The makeWorkdayRequest client expects a generic string/number/boolean query record. + query: input as { [key: string]: string | number | boolean | undefined }, }); await logEventFromContext( ctx, @@ -289,6 +305,7 @@ export const getJobWorkspace: WorkdayEndpoints['getJobWorkspace'] = async ( WorkdayEndpointOutputs['getJobWorkspace'] >('v1/job/getJobWorkspace', ctx.key, { method: 'GET', + // Justification: The makeWorkdayRequest client expects a generic unknown record. query: input as { [key: string]: string | number | boolean | undefined }, }); await logEventFromContext( @@ -308,6 +325,7 @@ export const getJobWorkspaces: WorkdayEndpoints['getJobWorkspaces'] = async ( WorkdayEndpointOutputs['getJobWorkspaces'] >('v1/job/getJobWorkspaces', ctx.key, { method: 'GET', + // Justification: The makeWorkdayRequest client expects a generic unknown record. query: input as { [key: string]: string | number | boolean | undefined }, }); await logEventFromContext( @@ -327,6 +345,7 @@ export const listJobPostings: WorkdayEndpoints['listJobPostings'] = async ( WorkdayEndpointOutputs['listJobPostings'] >('v1/job/listJobPostings', ctx.key, { method: 'GET', + // Justification: The makeWorkdayRequest client expects a generic unknown record. query: input as { [key: string]: string | number | boolean | undefined }, }); await logEventFromContext( @@ -342,8 +361,9 @@ export const updateJobChangeBusinessTitle: WorkdayEndpoints['updateJobChangeBusi async (ctx, input) => { const response = await makeWorkdayRequest< WorkdayEndpointOutputs['updateJobChangeBusinessTitle'] - >('v1/job/api', ctx.key, { - method: 'POST', + >('v1/job/updateJobChangeBusinessTitle', ctx.key, { + method: 'PUT', + // Justification: The makeWorkdayRequest client expects a generic unknown record. body: input as { [key: string]: unknown }, }); await logEventFromContext( diff --git a/packages/workday/endpoints/jobs.ts b/packages/workday/endpoints/jobs.ts index 40ec432a7..55313d931 100644 --- a/packages/workday/endpoints/jobs.ts +++ b/packages/workday/endpoints/jobs.ts @@ -7,7 +7,11 @@ export const listJobs: WorkdayEndpoints['listJobs'] = async (ctx, input) => { const response = await makeWorkdayRequest( 'v1/jobs/api', ctx.key, - { method: 'POST', body: input as { [key: string]: unknown } }, + { + method: 'GET', + // Justification: The makeWorkdayRequest client expects a generic string/number/boolean query record. + query: input as { [key: string]: string | number | boolean | undefined }, + }, ); await logEventFromContext( ctx, diff --git a/packages/workday/endpoints/leave.ts b/packages/workday/endpoints/leave.ts index ff5874716..dbcdc1795 100644 --- a/packages/workday/endpoints/leave.ts +++ b/packages/workday/endpoints/leave.ts @@ -7,9 +7,10 @@ export const getLeaveStatusValues: WorkdayEndpoints['getLeaveStatusValues'] = async (ctx, input) => { const response = await makeWorkdayRequest< WorkdayEndpointOutputs['getLeaveStatusValues'] - >('v1/leave/api', ctx.key, { - method: 'POST', - body: input as { [key: string]: unknown }, + >('v1/leave/getLeaveStatusValues', ctx.key, { + method: 'GET', + // Justification: The makeWorkdayRequest client expects a generic string/number/boolean query record. + query: input as { [key: string]: string | number | boolean | undefined }, }); await logEventFromContext( ctx, diff --git a/packages/workday/endpoints/message.ts b/packages/workday/endpoints/message.ts index 4f4fd28b2..c35880725 100644 --- a/packages/workday/endpoints/message.ts +++ b/packages/workday/endpoints/message.ts @@ -7,8 +7,9 @@ export const updateMessageTemplateById: WorkdayEndpoints['updateMessageTemplateB async (ctx, input) => { const response = await makeWorkdayRequest< WorkdayEndpointOutputs['updateMessageTemplateById'] - >('v1/message/api', ctx.key, { - method: 'POST', + >('v1/message/updateMessageTemplateById/{id}', ctx.key, { + method: 'PUT', + // Justification: The makeWorkdayRequest client expects a generic unknown record. body: input as { [key: string]: unknown }, }); await logEventFromContext( diff --git a/packages/workday/endpoints/my.ts b/packages/workday/endpoints/my.ts index 3c7226f23..7ea70b23b 100644 --- a/packages/workday/endpoints/my.ts +++ b/packages/workday/endpoints/my.ts @@ -11,6 +11,7 @@ export const getMyJobPostings: WorkdayEndpoints['getMyJobPostings'] = async ( WorkdayEndpointOutputs['getMyJobPostings'] >('v1/my/getMyJobPostings', ctx.key, { method: 'GET', + // Justification: The makeWorkdayRequest client expects a generic unknown record. query: input as { [key: string]: string | number | boolean | undefined }, }); await logEventFromContext( diff --git a/packages/workday/endpoints/organization.ts b/packages/workday/endpoints/organization.ts index 956b4dd31..666a0e2ff 100644 --- a/packages/workday/endpoints/organization.ts +++ b/packages/workday/endpoints/organization.ts @@ -7,9 +7,10 @@ export const getOrganizationAssignmentBusinessUnits: WorkdayEndpoints['getOrgani async (ctx, input) => { const response = await makeWorkdayRequest< WorkdayEndpointOutputs['getOrganizationAssignmentBusinessUnits'] - >('v1/organization/api', ctx.key, { - method: 'POST', - body: input as { [key: string]: unknown }, + >('v1/organization/getOrganizationAssignmentBusinessUnits', ctx.key, { + method: 'GET', + // Justification: The makeWorkdayRequest client expects a generic string/number/boolean query record. + query: input as { [key: string]: string | number | boolean | undefined }, }); await logEventFromContext( ctx, @@ -24,9 +25,10 @@ export const getOrganizationAssignmentCustoms: WorkdayEndpoints['getOrganization async (ctx, input) => { const response = await makeWorkdayRequest< WorkdayEndpointOutputs['getOrganizationAssignmentCustoms'] - >('v1/organization/api', ctx.key, { - method: 'POST', - body: input as { [key: string]: unknown }, + >('v1/organization/getOrganizationAssignmentCustoms', ctx.key, { + method: 'GET', + // Justification: The makeWorkdayRequest client expects a generic string/number/boolean query record. + query: input as { [key: string]: string | number | boolean | undefined }, }); await logEventFromContext( ctx, @@ -41,9 +43,10 @@ export const getOrganizationAssignmentFunds: WorkdayEndpoints['getOrganizationAs async (ctx, input) => { const response = await makeWorkdayRequest< WorkdayEndpointOutputs['getOrganizationAssignmentFunds'] - >('v1/organization/api', ctx.key, { - method: 'POST', - body: input as { [key: string]: unknown }, + >('v1/organization/getOrganizationAssignmentFunds', ctx.key, { + method: 'GET', + // Justification: The makeWorkdayRequest client expects a generic string/number/boolean query record. + query: input as { [key: string]: string | number | boolean | undefined }, }); await logEventFromContext( ctx, @@ -58,9 +61,10 @@ export const getOrganizationAssignmentRegions: WorkdayEndpoints['getOrganization async (ctx, input) => { const response = await makeWorkdayRequest< WorkdayEndpointOutputs['getOrganizationAssignmentRegions'] - >('v1/organization/api', ctx.key, { - method: 'POST', - body: input as { [key: string]: unknown }, + >('v1/organization/getOrganizationAssignmentRegions', ctx.key, { + method: 'GET', + // Justification: The makeWorkdayRequest client expects a generic string/number/boolean query record. + query: input as { [key: string]: string | number | boolean | undefined }, }); await logEventFromContext( ctx, @@ -75,9 +79,10 @@ export const getOrganizationAssignmentWorkers: WorkdayEndpoints['getOrganization async (ctx, input) => { const response = await makeWorkdayRequest< WorkdayEndpointOutputs['getOrganizationAssignmentWorkers'] - >('v1/organization/api', ctx.key, { - method: 'POST', - body: input as { [key: string]: unknown }, + >('v1/organization/getOrganizationAssignmentWorkers', ctx.key, { + method: 'GET', + // Justification: The makeWorkdayRequest client expects a generic string/number/boolean query record. + query: input as { [key: string]: string | number | boolean | undefined }, }); await logEventFromContext( ctx, diff --git a/packages/workday/endpoints/pay.ts b/packages/workday/endpoints/pay.ts index d63385c6e..df901a6b9 100644 --- a/packages/workday/endpoints/pay.ts +++ b/packages/workday/endpoints/pay.ts @@ -7,9 +7,10 @@ export const getPayGroupByJobId: WorkdayEndpoints['getPayGroupByJobId'] = async (ctx, input) => { const response = await makeWorkdayRequest< WorkdayEndpointOutputs['getPayGroupByJobId'] - >('v1/pay/api', ctx.key, { - method: 'POST', - body: input as { [key: string]: unknown }, + >('v1/pay/getPayGroupByJobId', ctx.key, { + method: 'GET', + // Justification: The makeWorkdayRequest client expects a generic string/number/boolean query record. + query: input as { [key: string]: string | number | boolean | undefined }, }); await logEventFromContext( ctx, @@ -24,9 +25,10 @@ export const getPaySlipInstancesForWorker: WorkdayEndpoints['getPaySlipInstances async (ctx, input) => { const response = await makeWorkdayRequest< WorkdayEndpointOutputs['getPaySlipInstancesForWorker'] - >('v1/pay/api', ctx.key, { - method: 'POST', - body: input as { [key: string]: unknown }, + >('v1/pay/getPaySlipInstancesForWorker', ctx.key, { + method: 'GET', + // Justification: The makeWorkdayRequest client expects a generic string/number/boolean query record. + query: input as { [key: string]: string | number | boolean | undefined }, }); await logEventFromContext( ctx, @@ -41,9 +43,10 @@ export const getPaySlipsForWorker: WorkdayEndpoints['getPaySlipsForWorker'] = async (ctx, input) => { const response = await makeWorkdayRequest< WorkdayEndpointOutputs['getPaySlipsForWorker'] - >('v1/pay/api', ctx.key, { - method: 'POST', - body: input as { [key: string]: unknown }, + >('v1/pay/getPaySlipsForWorker', ctx.key, { + method: 'GET', + // Justification: The makeWorkdayRequest client expects a generic string/number/boolean query record. + query: input as { [key: string]: string | number | boolean | undefined }, }); await logEventFromContext( ctx, diff --git a/packages/workday/endpoints/payroll.ts b/packages/workday/endpoints/payroll.ts index 547d94441..bd51a3d20 100644 --- a/packages/workday/endpoints/payroll.ts +++ b/packages/workday/endpoints/payroll.ts @@ -7,8 +7,9 @@ export const createPayrollInputs: WorkdayEndpoints['createPayrollInputs'] = async (ctx, input) => { const response = await makeWorkdayRequest< WorkdayEndpointOutputs['createPayrollInputs'] - >('v1/payroll/api', ctx.key, { + >('v1/payroll/createPayrollInputs', ctx.key, { method: 'POST', + // Justification: The makeWorkdayRequest client expects a generic unknown record. body: input as { [key: string]: unknown }, }); await logEventFromContext( @@ -24,9 +25,10 @@ export const getPayrollInputInstance: WorkdayEndpoints['getPayrollInputInstance' async (ctx, input) => { const response = await makeWorkdayRequest< WorkdayEndpointOutputs['getPayrollInputInstance'] - >('v1/payroll/api', ctx.key, { - method: 'POST', - body: input as { [key: string]: unknown }, + >('v1/payroll/getPayrollInputInstance', ctx.key, { + method: 'GET', + // Justification: The makeWorkdayRequest client expects a generic string/number/boolean query record. + query: input as { [key: string]: string | number | boolean | undefined }, }); await logEventFromContext( ctx, @@ -36,3 +38,21 @@ export const getPayrollInputInstance: WorkdayEndpoints['getPayrollInputInstance' ); return response; }; + +export const updateAnExistingPayroll: WorkdayEndpoints['updateAnExistingPayroll'] = + async (ctx, input) => { + const response = await makeWorkdayRequest< + WorkdayEndpointOutputs['updateAnExistingPayroll'] + >('v1/payroll/updateAnExistingPayroll', ctx.key, { + method: 'PUT', + // Justification: The makeWorkdayRequest client expects a generic unknown record. + body: input as { [key: string]: unknown }, + }); + await logEventFromContext( + ctx, + 'workday.payroll.updateAnExistingPayroll', + input ?? {}, + 'completed', + ); + return response; + }; diff --git a/packages/workday/endpoints/proposed.ts b/packages/workday/endpoints/proposed.ts index 974a4742c..cd87788eb 100644 --- a/packages/workday/endpoints/proposed.ts +++ b/packages/workday/endpoints/proposed.ts @@ -7,9 +7,10 @@ export const getProposedPositionValues: WorkdayEndpoints['getProposedPositionVal async (ctx, input) => { const response = await makeWorkdayRequest< WorkdayEndpointOutputs['getProposedPositionValues'] - >('v1/proposed/api', ctx.key, { - method: 'POST', - body: input as { [key: string]: unknown }, + >('v1/proposed/getProposedPositionValues', ctx.key, { + method: 'GET', + // Justification: The makeWorkdayRequest client expects a generic string/number/boolean query record. + query: input as { [key: string]: string | number | boolean | undefined }, }); await logEventFromContext( ctx, diff --git a/packages/workday/endpoints/prospect.ts b/packages/workday/endpoints/prospect.ts index 51080dbc3..0af8fdc15 100644 --- a/packages/workday/endpoints/prospect.ts +++ b/packages/workday/endpoints/prospect.ts @@ -11,6 +11,7 @@ export const getProspect: WorkdayEndpoints['getProspect'] = async ( WorkdayEndpointOutputs['getProspect'] >('v1/prospect/getProspect', ctx.key, { method: 'GET', + // Justification: The makeWorkdayRequest client expects a generic unknown record. query: input as { [key: string]: string | number | boolean | undefined }, }); await logEventFromContext( @@ -26,9 +27,10 @@ export const getProspectEducations: WorkdayEndpoints['getProspectEducations'] = async (ctx, input) => { const response = await makeWorkdayRequest< WorkdayEndpointOutputs['getProspectEducations'] - >('v1/prospect/api', ctx.key, { - method: 'POST', - body: input as { [key: string]: unknown }, + >('v1/prospect/getProspectEducations', ctx.key, { + method: 'GET', + // Justification: The makeWorkdayRequest client expects a generic string/number/boolean query record. + query: input as { [key: string]: string | number | boolean | undefined }, }); await logEventFromContext( ctx, @@ -43,9 +45,10 @@ export const getProspectExperiences: WorkdayEndpoints['getProspectExperiences'] async (ctx, input) => { const response = await makeWorkdayRequest< WorkdayEndpointOutputs['getProspectExperiences'] - >('v1/prospect/api', ctx.key, { - method: 'POST', - body: input as { [key: string]: unknown }, + >('v1/prospect/getProspectExperiences', ctx.key, { + method: 'GET', + // Justification: The makeWorkdayRequest client expects a generic string/number/boolean query record. + query: input as { [key: string]: string | number | boolean | undefined }, }); await logEventFromContext( ctx, @@ -60,9 +63,10 @@ export const getProspectResumeAttachments: WorkdayEndpoints['getProspectResumeAt async (ctx, input) => { const response = await makeWorkdayRequest< WorkdayEndpointOutputs['getProspectResumeAttachments'] - >('v1/prospect/api', ctx.key, { - method: 'POST', - body: input as { [key: string]: unknown }, + >('v1/prospect/getProspectResumeAttachments', ctx.key, { + method: 'GET', + // Justification: The makeWorkdayRequest client expects a generic string/number/boolean query record. + query: input as { [key: string]: string | number | boolean | undefined }, }); await logEventFromContext( ctx, @@ -81,6 +85,7 @@ export const getProspectSkills: WorkdayEndpoints['getProspectSkills'] = async ( WorkdayEndpointOutputs['getProspectSkills'] >('v1/prospect/getProspectSkills', ctx.key, { method: 'GET', + // Justification: The makeWorkdayRequest client expects a generic unknown record. query: input as { [key: string]: string | number | boolean | undefined }, }); await logEventFromContext( diff --git a/packages/workday/endpoints/supervisory.ts b/packages/workday/endpoints/supervisory.ts index 88ed37806..04d68dd7d 100644 --- a/packages/workday/endpoints/supervisory.ts +++ b/packages/workday/endpoints/supervisory.ts @@ -7,9 +7,10 @@ export const getSupervisoryOrgValues: WorkdayEndpoints['getSupervisoryOrgValues' async (ctx, input) => { const response = await makeWorkdayRequest< WorkdayEndpointOutputs['getSupervisoryOrgValues'] - >('v1/supervisory/api', ctx.key, { - method: 'POST', - body: input as { [key: string]: unknown }, + >('v1/supervisory/getSupervisoryOrgValues', ctx.key, { + method: 'GET', + // Justification: The makeWorkdayRequest client expects a generic string/number/boolean query record. + query: input as { [key: string]: string | number | boolean | undefined }, }); await logEventFromContext( ctx, diff --git a/packages/workday/endpoints/time.ts b/packages/workday/endpoints/time.ts index 535568f49..5b6994f76 100644 --- a/packages/workday/endpoints/time.ts +++ b/packages/workday/endpoints/time.ts @@ -7,8 +7,9 @@ export const createTimeOffRequest: WorkdayEndpoints['createTimeOffRequest'] = async (ctx, input) => { const response = await makeWorkdayRequest< WorkdayEndpointOutputs['createTimeOffRequest'] - >('v1/time/api', ctx.key, { + >('v1/time/createTimeOffRequest', ctx.key, { method: 'POST', + // Justification: The makeWorkdayRequest client expects a generic unknown record. body: input as { [key: string]: unknown }, }); await logEventFromContext( @@ -24,9 +25,10 @@ export const getTimeOffEntriesForWorker: WorkdayEndpoints['getTimeOffEntriesForW async (ctx, input) => { const response = await makeWorkdayRequest< WorkdayEndpointOutputs['getTimeOffEntriesForWorker'] - >('v1/time/api', ctx.key, { - method: 'POST', - body: input as { [key: string]: unknown }, + >('v1/time/getTimeOffEntriesForWorker', ctx.key, { + method: 'GET', + // Justification: The makeWorkdayRequest client expects a generic string/number/boolean query record. + query: input as { [key: string]: string | number | boolean | undefined }, }); await logEventFromContext( ctx, @@ -41,9 +43,10 @@ export const getTimeOffPlansForWorker: WorkdayEndpoints['getTimeOffPlansForWorke async (ctx, input) => { const response = await makeWorkdayRequest< WorkdayEndpointOutputs['getTimeOffPlansForWorker'] - >('v1/time/api', ctx.key, { - method: 'POST', - body: input as { [key: string]: unknown }, + >('v1/time/getTimeOffPlansForWorker', ctx.key, { + method: 'GET', + // Justification: The makeWorkdayRequest client expects a generic string/number/boolean query record. + query: input as { [key: string]: string | number | boolean | undefined }, }); await logEventFromContext( ctx, @@ -58,9 +61,10 @@ export const getTimeOffStatusValues: WorkdayEndpoints['getTimeOffStatusValues'] async (ctx, input) => { const response = await makeWorkdayRequest< WorkdayEndpointOutputs['getTimeOffStatusValues'] - >('v1/time/api', ctx.key, { - method: 'POST', - body: input as { [key: string]: unknown }, + >('v1/time/getTimeOffStatusValues', ctx.key, { + method: 'GET', + // Justification: The makeWorkdayRequest client expects a generic string/number/boolean query record. + query: input as { [key: string]: string | number | boolean | undefined }, }); await logEventFromContext( ctx, @@ -79,6 +83,7 @@ export const getTimeTypes: WorkdayEndpoints['getTimeTypes'] = async ( WorkdayEndpointOutputs['getTimeTypes'] >('v1/time/getTimeTypes', ctx.key, { method: 'GET', + // Justification: The makeWorkdayRequest client expects a generic unknown record. query: input as { [key: string]: string | number | boolean | undefined }, }); await logEventFromContext( diff --git a/packages/workday/endpoints/types.ts b/packages/workday/endpoints/types.ts index 985ddaaa0..733db6b72 100644 --- a/packages/workday/endpoints/types.ts +++ b/packages/workday/endpoints/types.ts @@ -10,6 +10,7 @@ export type CreateBusinessTitleChangeInput = z.infer< const CreateBusinessTitleChangeResponseSchema = z .object({}) + // Justification: Catching all unknown properties for forward-compatibility. .catchall(z.unknown()); export type CreateBusinessTitleChangeResponse = z.infer< typeof CreateBusinessTitleChangeResponseSchema @@ -21,7 +22,10 @@ const CreateJobChangeInputSchema = z .optional(); export type CreateJobChangeInput = z.infer; -const CreateJobChangeResponseSchema = z.object({}).catchall(z.unknown()); +const CreateJobChangeResponseSchema = z + .object({}) + // Justification: Catching all unknown properties for forward-compatibility. + .catchall(z.unknown()); export type CreateJobChangeResponse = z.infer< typeof CreateJobChangeResponseSchema >; @@ -34,7 +38,10 @@ export type CreatePayrollInputsInput = z.infer< typeof CreatePayrollInputsInputSchema >; -const CreatePayrollInputsResponseSchema = z.object({}).catchall(z.unknown()); +const CreatePayrollInputsResponseSchema = z + .object({}) + // Justification: Catching all unknown properties for forward-compatibility. + .catchall(z.unknown()); export type CreatePayrollInputsResponse = z.infer< typeof CreatePayrollInputsResponseSchema >; @@ -47,7 +54,10 @@ export type CreateTimeOffRequestInput = z.infer< typeof CreateTimeOffRequestInputSchema >; -const CreateTimeOffRequestResponseSchema = z.object({}).catchall(z.unknown()); +const CreateTimeOffRequestResponseSchema = z + .object({}) + // Justification: Catching all unknown properties for forward-compatibility. + .catchall(z.unknown()); export type CreateTimeOffRequestResponse = z.infer< typeof CreateTimeOffRequestResponseSchema >; @@ -59,7 +69,10 @@ export type GetAbsenceBalanceInput = z.infer< typeof GetAbsenceBalanceInputSchema >; -const GetAbsenceBalanceResponseSchema = z.object({}).catchall(z.unknown()); +const GetAbsenceBalanceResponseSchema = z + .object({}) + // Justification: Catching all unknown properties for forward-compatibility. + .catchall(z.unknown()); export type GetAbsenceBalanceResponse = z.infer< typeof GetAbsenceBalanceResponseSchema >; @@ -73,6 +86,7 @@ export type GetAssignmentChangeGroupCostCentersInput = z.infer< const GetAssignmentChangeGroupCostCentersResponseSchema = z .object({}) + // Justification: Catching all unknown properties for forward-compatibility. .catchall(z.unknown()); export type GetAssignmentChangeGroupCostCentersResponse = z.infer< typeof GetAssignmentChangeGroupCostCentersResponseSchema @@ -87,6 +101,7 @@ export type GetAssignmentChangeGroupJobsInput = z.infer< const GetAssignmentChangeGroupJobsResponseSchema = z .object({}) + // Justification: Catching all unknown properties for forward-compatibility. .catchall(z.unknown()); export type GetAssignmentChangeGroupJobsResponse = z.infer< typeof GetAssignmentChangeGroupJobsResponseSchema @@ -99,7 +114,10 @@ export type GetAssignmentTypesInput = z.infer< typeof GetAssignmentTypesInputSchema >; -const GetAssignmentTypesResponseSchema = z.object({}).catchall(z.unknown()); +const GetAssignmentTypesResponseSchema = z + .object({}) + // Justification: Catching all unknown properties for forward-compatibility. + .catchall(z.unknown()); export type GetAssignmentTypesResponse = z.infer< typeof GetAssignmentTypesResponseSchema >; @@ -111,7 +129,10 @@ export type GetBusinessTitleChangeInput = z.infer< typeof GetBusinessTitleChangeInputSchema >; -const GetBusinessTitleChangeResponseSchema = z.object({}).catchall(z.unknown()); +const GetBusinessTitleChangeResponseSchema = z + .object({}) + // Justification: Catching all unknown properties for forward-compatibility. + .catchall(z.unknown()); export type GetBusinessTitleChangeResponse = z.infer< typeof GetBusinessTitleChangeResponseSchema >; @@ -125,6 +146,7 @@ export type GetBusinessTitleChangeForWorkerInput = z.infer< const GetBusinessTitleChangeForWorkerResponseSchema = z .object({}) + // Justification: Catching all unknown properties for forward-compatibility. .catchall(z.unknown()); export type GetBusinessTitleChangeForWorkerResponse = z.infer< typeof GetBusinessTitleChangeForWorkerResponseSchema @@ -139,6 +161,7 @@ export type GetCandidateAvailabilityTemplateInput = z.infer< const GetCandidateAvailabilityTemplateResponseSchema = z .object({}) + // Justification: Catching all unknown properties for forward-compatibility. .catchall(z.unknown()); export type GetCandidateAvailabilityTemplateResponse = z.infer< typeof GetCandidateAvailabilityTemplateResponseSchema @@ -151,7 +174,10 @@ export type GetCollectionOfJobsInput = z.infer< typeof GetCollectionOfJobsInputSchema >; -const GetCollectionOfJobsResponseSchema = z.object({}).catchall(z.unknown()); +const GetCollectionOfJobsResponseSchema = z + .object({}) + // Justification: Catching all unknown properties for forward-compatibility. + .catchall(z.unknown()); export type GetCollectionOfJobsResponse = z.infer< typeof GetCollectionOfJobsResponseSchema >; @@ -163,7 +189,10 @@ export type GetCollectionOfPayrollInput = z.infer< typeof GetCollectionOfPayrollInputSchema >; -const GetCollectionOfPayrollResponseSchema = z.object({}).catchall(z.unknown()); +const GetCollectionOfPayrollResponseSchema = z + .object({}) + // Justification: Catching all unknown properties for forward-compatibility. + .catchall(z.unknown()); export type GetCollectionOfPayrollResponse = z.infer< typeof GetCollectionOfPayrollResponseSchema >; @@ -175,7 +204,10 @@ export type GetCompanyInsiderTypesInput = z.infer< typeof GetCompanyInsiderTypesInputSchema >; -const GetCompanyInsiderTypesResponseSchema = z.object({}).catchall(z.unknown()); +const GetCompanyInsiderTypesResponseSchema = z + .object({}) + // Justification: Catching all unknown properties for forward-compatibility. + .catchall(z.unknown()); export type GetCompanyInsiderTypesResponse = z.infer< typeof GetCompanyInsiderTypesResponseSchema >; @@ -189,6 +221,7 @@ export type GetContingentWorkerTypesInput = z.infer< const GetContingentWorkerTypesResponseSchema = z .object({}) + // Justification: Catching all unknown properties for forward-compatibility. .catchall(z.unknown()); export type GetContingentWorkerTypesResponse = z.infer< typeof GetContingentWorkerTypesResponseSchema @@ -199,7 +232,10 @@ const GetCountryInfoInputSchema = z .passthrough(); export type GetCountryInfoInput = z.infer; -const GetCountryInfoResponseSchema = z.object({}).catchall(z.unknown()); +const GetCountryInfoResponseSchema = z + .object({}) + // Justification: Catching all unknown properties for forward-compatibility. + .catchall(z.unknown()); export type GetCountryInfoResponse = z.infer< typeof GetCountryInfoResponseSchema >; @@ -209,7 +245,10 @@ const GetCurrenciesInputSchema = z .passthrough(); export type GetCurrenciesInput = z.infer; -const GetCurrenciesResponseSchema = z.object({}).catchall(z.unknown()); +const GetCurrenciesResponseSchema = z + .object({}) + // Justification: Catching all unknown properties for forward-compatibility. + .catchall(z.unknown()); export type GetCurrenciesResponse = z.infer; const GetCurrentUserInputSchema = z @@ -217,7 +256,10 @@ const GetCurrentUserInputSchema = z .passthrough(); export type GetCurrentUserInput = z.infer; -const GetCurrentUserResponseSchema = z.object({}).catchall(z.unknown()); +const GetCurrentUserResponseSchema = z + .object({}) + // Justification: Catching all unknown properties for forward-compatibility. + .catchall(z.unknown()); export type GetCurrentUserResponse = z.infer< typeof GetCurrentUserResponseSchema >; @@ -227,7 +269,10 @@ const GetGrantsInputSchema = z .passthrough(); export type GetGrantsInput = z.infer; -const GetGrantsResponseSchema = z.object({}).catchall(z.unknown()); +const GetGrantsResponseSchema = z + .object({}) + // Justification: Catching all unknown properties for forward-compatibility. + .catchall(z.unknown()); export type GetGrantsResponse = z.infer; const GetHeadcountOptionsInputSchema = z @@ -237,7 +282,10 @@ export type GetHeadcountOptionsInput = z.infer< typeof GetHeadcountOptionsInputSchema >; -const GetHeadcountOptionsResponseSchema = z.object({}).catchall(z.unknown()); +const GetHeadcountOptionsResponseSchema = z + .object({}) + // Justification: Catching all unknown properties for forward-compatibility. + .catchall(z.unknown()); export type GetHeadcountOptionsResponse = z.infer< typeof GetHeadcountOptionsResponseSchema >; @@ -251,6 +299,7 @@ export type GetHistoryInstanceForWorkerInput = z.infer< const GetHistoryInstanceForWorkerResponseSchema = z .object({}) + // Justification: Catching all unknown properties for forward-compatibility. .catchall(z.unknown()); export type GetHistoryInstanceForWorkerResponse = z.infer< typeof GetHistoryInstanceForWorkerResponseSchema @@ -265,6 +314,7 @@ export type GetHistoryItemsForWorkerInput = z.infer< const GetHistoryItemsForWorkerResponseSchema = z .object({}) + // Justification: Catching all unknown properties for forward-compatibility. .catchall(z.unknown()); export type GetHistoryItemsForWorkerResponse = z.infer< typeof GetHistoryItemsForWorkerResponseSchema @@ -275,7 +325,10 @@ const GetHolidayEventsInputSchema = z .passthrough(); export type GetHolidayEventsInput = z.infer; -const GetHolidayEventsResponseSchema = z.object({}).catchall(z.unknown()); +const GetHolidayEventsResponseSchema = z + .object({}) + // Justification: Catching all unknown properties for forward-compatibility. + .catchall(z.unknown()); export type GetHolidayEventsResponse = z.infer< typeof GetHolidayEventsResponseSchema >; @@ -285,7 +338,10 @@ const GetInterviewInputSchema = z .passthrough(); export type GetInterviewInput = z.infer; -const GetInterviewResponseSchema = z.object({}).catchall(z.unknown()); +const GetInterviewResponseSchema = z + .object({}) + // Justification: Catching all unknown properties for forward-compatibility. + .catchall(z.unknown()); export type GetInterviewResponse = z.infer; const GetInterviewFeedback2InputSchema = z @@ -295,7 +351,10 @@ export type GetInterviewFeedback2Input = z.infer< typeof GetInterviewFeedback2InputSchema >; -const GetInterviewFeedback2ResponseSchema = z.object({}).catchall(z.unknown()); +const GetInterviewFeedback2ResponseSchema = z + .object({}) + // Justification: Catching all unknown properties for forward-compatibility. + .catchall(z.unknown()); export type GetInterviewFeedback2Response = z.infer< typeof GetInterviewFeedback2ResponseSchema >; @@ -303,7 +362,10 @@ export type GetInterviewFeedback2Response = z.infer< const GetJobByIdInputSchema = z.object({ id: z.string() }); export type GetJobByIdInput = z.infer; -const GetJobByIdResponseSchema = z.object({}).catchall(z.unknown()); +const GetJobByIdResponseSchema = z + .object({}) + // Justification: Catching all unknown properties for forward-compatibility. + .catchall(z.unknown()); export type GetJobByIdResponse = z.infer; const GetJobChangeFrequenciesInputSchema = z @@ -315,6 +377,7 @@ export type GetJobChangeFrequenciesInput = z.infer< const GetJobChangeFrequenciesResponseSchema = z .object({}) + // Justification: Catching all unknown properties for forward-compatibility. .catchall(z.unknown()); export type GetJobChangeFrequenciesResponse = z.infer< typeof GetJobChangeFrequenciesResponseSchema @@ -329,6 +392,7 @@ export type GetJobChangeLocationInfoInput = z.infer< const GetJobChangeLocationInfoResponseSchema = z .object({}) + // Justification: Catching all unknown properties for forward-compatibility. .catchall(z.unknown()); export type GetJobChangeLocationInfoResponse = z.infer< typeof GetJobChangeLocationInfoResponseSchema @@ -341,7 +405,10 @@ export type GetJobChangePositionInput = z.infer< typeof GetJobChangePositionInputSchema >; -const GetJobChangePositionResponseSchema = z.object({}).catchall(z.unknown()); +const GetJobChangePositionResponseSchema = z + .object({}) + // Justification: Catching all unknown properties for forward-compatibility. + .catchall(z.unknown()); export type GetJobChangePositionResponse = z.infer< typeof GetJobChangePositionResponseSchema >; @@ -355,6 +422,7 @@ export type GetJobChangeReasonInstanceInput = z.infer< const GetJobChangeReasonInstanceResponseSchema = z .object({}) + // Justification: Catching all unknown properties for forward-compatibility. .catchall(z.unknown()); export type GetJobChangeReasonInstanceResponse = z.infer< typeof GetJobChangeReasonInstanceResponseSchema @@ -369,6 +437,7 @@ export type GetJobChangeReasonValuesInput = z.infer< const GetJobChangeReasonValuesResponseSchema = z .object({}) + // Justification: Catching all unknown properties for forward-compatibility. .catchall(z.unknown()); export type GetJobChangeReasonValuesResponse = z.infer< typeof GetJobChangeReasonValuesResponseSchema @@ -381,7 +450,10 @@ export type GetJobChangeReasonsInput = z.infer< typeof GetJobChangeReasonsInputSchema >; -const GetJobChangeReasonsResponseSchema = z.object({}).catchall(z.unknown()); +const GetJobChangeReasonsResponseSchema = z + .object({}) + // Justification: Catching all unknown properties for forward-compatibility. + .catchall(z.unknown()); export type GetJobChangeReasonsResponse = z.infer< typeof GetJobChangeReasonsResponseSchema >; @@ -395,6 +467,7 @@ export type GetJobChangesGroupTemplatesInput = z.infer< const GetJobChangesGroupTemplatesResponseSchema = z .object({}) + // Justification: Catching all unknown properties for forward-compatibility. .catchall(z.unknown()); export type GetJobChangesGroupTemplatesResponse = z.infer< typeof GetJobChangesGroupTemplatesResponseSchema @@ -407,7 +480,10 @@ export type GetJobChangesJobValuesInput = z.infer< typeof GetJobChangesJobValuesInputSchema >; -const GetJobChangesJobValuesResponseSchema = z.object({}).catchall(z.unknown()); +const GetJobChangesJobValuesResponseSchema = z + .object({}) + // Justification: Catching all unknown properties for forward-compatibility. + .catchall(z.unknown()); export type GetJobChangesJobValuesResponse = z.infer< typeof GetJobChangesJobValuesResponseSchema >; @@ -421,6 +497,7 @@ export type GetJobChangesWorkerValuesInput = z.infer< const GetJobChangesWorkerValuesResponseSchema = z .object({}) + // Justification: Catching all unknown properties for forward-compatibility. .catchall(z.unknown()); export type GetJobChangesWorkerValuesResponse = z.infer< typeof GetJobChangesWorkerValuesResponseSchema @@ -433,7 +510,10 @@ export type GetJobClassificationsInput = z.infer< typeof GetJobClassificationsInputSchema >; -const GetJobClassificationsResponseSchema = z.object({}).catchall(z.unknown()); +const GetJobClassificationsResponseSchema = z + .object({}) + // Justification: Catching all unknown properties for forward-compatibility. + .catchall(z.unknown()); export type GetJobClassificationsResponse = z.infer< typeof GetJobClassificationsResponseSchema >; @@ -443,7 +523,10 @@ const GetJobPostingInputSchema = z .passthrough(); export type GetJobPostingInput = z.infer; -const GetJobPostingResponseSchema = z.object({}).catchall(z.unknown()); +const GetJobPostingResponseSchema = z + .object({}) + // Justification: Catching all unknown properties for forward-compatibility. + .catchall(z.unknown()); export type GetJobPostingResponse = z.infer; const GetJobPostingQuestionnaireInputSchema = z @@ -455,6 +538,7 @@ export type GetJobPostingQuestionnaireInput = z.infer< const GetJobPostingQuestionnaireResponseSchema = z .object({}) + // Justification: Catching all unknown properties for forward-compatibility. .catchall(z.unknown()); export type GetJobPostingQuestionnaireResponse = z.infer< typeof GetJobPostingQuestionnaireResponseSchema @@ -467,7 +551,10 @@ export type GetJobProfilesValuesInput = z.infer< typeof GetJobProfilesValuesInputSchema >; -const GetJobProfilesValuesResponseSchema = z.object({}).catchall(z.unknown()); +const GetJobProfilesValuesResponseSchema = z + .object({}) + // Justification: Catching all unknown properties for forward-compatibility. + .catchall(z.unknown()); export type GetJobProfilesValuesResponse = z.infer< typeof GetJobProfilesValuesResponseSchema >; @@ -481,6 +568,7 @@ export type GetJobRequisitionValuesInput = z.infer< const GetJobRequisitionValuesResponseSchema = z .object({}) + // Justification: Catching all unknown properties for forward-compatibility. .catchall(z.unknown()); export type GetJobRequisitionValuesResponse = z.infer< typeof GetJobRequisitionValuesResponseSchema @@ -491,7 +579,10 @@ const GetJobWorkspaceInputSchema = z .passthrough(); export type GetJobWorkspaceInput = z.infer; -const GetJobWorkspaceResponseSchema = z.object({}).catchall(z.unknown()); +const GetJobWorkspaceResponseSchema = z + .object({}) + // Justification: Catching all unknown properties for forward-compatibility. + .catchall(z.unknown()); export type GetJobWorkspaceResponse = z.infer< typeof GetJobWorkspaceResponseSchema >; @@ -501,7 +592,10 @@ const GetJobWorkspacesInputSchema = z .passthrough(); export type GetJobWorkspacesInput = z.infer; -const GetJobWorkspacesResponseSchema = z.object({}).catchall(z.unknown()); +const GetJobWorkspacesResponseSchema = z + .object({}) + // Justification: Catching all unknown properties for forward-compatibility. + .catchall(z.unknown()); export type GetJobWorkspacesResponse = z.infer< typeof GetJobWorkspacesResponseSchema >; @@ -513,7 +607,10 @@ export type GetLeaveStatusValuesInput = z.infer< typeof GetLeaveStatusValuesInputSchema >; -const GetLeaveStatusValuesResponseSchema = z.object({}).catchall(z.unknown()); +const GetLeaveStatusValuesResponseSchema = z + .object({}) + // Justification: Catching all unknown properties for forward-compatibility. + .catchall(z.unknown()); export type GetLeaveStatusValuesResponse = z.infer< typeof GetLeaveStatusValuesResponseSchema >; @@ -523,7 +620,10 @@ const GetMyJobPostingsInputSchema = z .passthrough(); export type GetMyJobPostingsInput = z.infer; -const GetMyJobPostingsResponseSchema = z.object({}).catchall(z.unknown()); +const GetMyJobPostingsResponseSchema = z + .object({}) + // Justification: Catching all unknown properties for forward-compatibility. + .catchall(z.unknown()); export type GetMyJobPostingsResponse = z.infer< typeof GetMyJobPostingsResponseSchema >; @@ -537,6 +637,7 @@ export type GetOrganizationAssignmentBusinessUnitsInput = z.infer< const GetOrganizationAssignmentBusinessUnitsResponseSchema = z .object({}) + // Justification: Catching all unknown properties for forward-compatibility. .catchall(z.unknown()); export type GetOrganizationAssignmentBusinessUnitsResponse = z.infer< typeof GetOrganizationAssignmentBusinessUnitsResponseSchema @@ -551,6 +652,7 @@ export type GetOrganizationAssignmentCustomsInput = z.infer< const GetOrganizationAssignmentCustomsResponseSchema = z .object({}) + // Justification: Catching all unknown properties for forward-compatibility. .catchall(z.unknown()); export type GetOrganizationAssignmentCustomsResponse = z.infer< typeof GetOrganizationAssignmentCustomsResponseSchema @@ -565,6 +667,7 @@ export type GetOrganizationAssignmentFundsInput = z.infer< const GetOrganizationAssignmentFundsResponseSchema = z .object({}) + // Justification: Catching all unknown properties for forward-compatibility. .catchall(z.unknown()); export type GetOrganizationAssignmentFundsResponse = z.infer< typeof GetOrganizationAssignmentFundsResponseSchema @@ -579,6 +682,7 @@ export type GetOrganizationAssignmentRegionsInput = z.infer< const GetOrganizationAssignmentRegionsResponseSchema = z .object({}) + // Justification: Catching all unknown properties for forward-compatibility. .catchall(z.unknown()); export type GetOrganizationAssignmentRegionsResponse = z.infer< typeof GetOrganizationAssignmentRegionsResponseSchema @@ -593,6 +697,7 @@ export type GetOrganizationAssignmentWorkersInput = z.infer< const GetOrganizationAssignmentWorkersResponseSchema = z .object({}) + // Justification: Catching all unknown properties for forward-compatibility. .catchall(z.unknown()); export type GetOrganizationAssignmentWorkersResponse = z.infer< typeof GetOrganizationAssignmentWorkersResponseSchema @@ -605,7 +710,10 @@ export type GetPayGroupByJobIdInput = z.infer< typeof GetPayGroupByJobIdInputSchema >; -const GetPayGroupByJobIdResponseSchema = z.object({}).catchall(z.unknown()); +const GetPayGroupByJobIdResponseSchema = z + .object({}) + // Justification: Catching all unknown properties for forward-compatibility. + .catchall(z.unknown()); export type GetPayGroupByJobIdResponse = z.infer< typeof GetPayGroupByJobIdResponseSchema >; @@ -619,6 +727,7 @@ export type GetPaySlipInstancesForWorkerInput = z.infer< const GetPaySlipInstancesForWorkerResponseSchema = z .object({}) + // Justification: Catching all unknown properties for forward-compatibility. .catchall(z.unknown()); export type GetPaySlipInstancesForWorkerResponse = z.infer< typeof GetPaySlipInstancesForWorkerResponseSchema @@ -631,7 +740,10 @@ export type GetPaySlipsForWorkerInput = z.infer< typeof GetPaySlipsForWorkerInputSchema >; -const GetPaySlipsForWorkerResponseSchema = z.object({}).catchall(z.unknown()); +const GetPaySlipsForWorkerResponseSchema = z + .object({}) + // Justification: Catching all unknown properties for forward-compatibility. + .catchall(z.unknown()); export type GetPaySlipsForWorkerResponse = z.infer< typeof GetPaySlipsForWorkerResponseSchema >; @@ -645,6 +757,7 @@ export type GetPayrollInputInstanceInput = z.infer< const GetPayrollInputInstanceResponseSchema = z .object({}) + // Justification: Catching all unknown properties for forward-compatibility. .catchall(z.unknown()); export type GetPayrollInputInstanceResponse = z.infer< typeof GetPayrollInputInstanceResponseSchema @@ -659,6 +772,7 @@ export type GetProposedPositionValuesInput = z.infer< const GetProposedPositionValuesResponseSchema = z .object({}) + // Justification: Catching all unknown properties for forward-compatibility. .catchall(z.unknown()); export type GetProposedPositionValuesResponse = z.infer< typeof GetProposedPositionValuesResponseSchema @@ -669,7 +783,10 @@ const GetProspectInputSchema = z .passthrough(); export type GetProspectInput = z.infer; -const GetProspectResponseSchema = z.object({}).catchall(z.unknown()); +const GetProspectResponseSchema = z + .object({}) + // Justification: Catching all unknown properties for forward-compatibility. + .catchall(z.unknown()); export type GetProspectResponse = z.infer; const GetProspectEducationsInputSchema = z @@ -679,7 +796,10 @@ export type GetProspectEducationsInput = z.infer< typeof GetProspectEducationsInputSchema >; -const GetProspectEducationsResponseSchema = z.object({}).catchall(z.unknown()); +const GetProspectEducationsResponseSchema = z + .object({}) + // Justification: Catching all unknown properties for forward-compatibility. + .catchall(z.unknown()); export type GetProspectEducationsResponse = z.infer< typeof GetProspectEducationsResponseSchema >; @@ -691,7 +811,10 @@ export type GetProspectExperiencesInput = z.infer< typeof GetProspectExperiencesInputSchema >; -const GetProspectExperiencesResponseSchema = z.object({}).catchall(z.unknown()); +const GetProspectExperiencesResponseSchema = z + .object({}) + // Justification: Catching all unknown properties for forward-compatibility. + .catchall(z.unknown()); export type GetProspectExperiencesResponse = z.infer< typeof GetProspectExperiencesResponseSchema >; @@ -705,6 +828,7 @@ export type GetProspectResumeAttachmentsInput = z.infer< const GetProspectResumeAttachmentsResponseSchema = z .object({}) + // Justification: Catching all unknown properties for forward-compatibility. .catchall(z.unknown()); export type GetProspectResumeAttachmentsResponse = z.infer< typeof GetProspectResumeAttachmentsResponseSchema @@ -717,7 +841,10 @@ export type GetProspectSkillsInput = z.infer< typeof GetProspectSkillsInputSchema >; -const GetProspectSkillsResponseSchema = z.object({}).catchall(z.unknown()); +const GetProspectSkillsResponseSchema = z + .object({}) + // Justification: Catching all unknown properties for forward-compatibility. + .catchall(z.unknown()); export type GetProspectSkillsResponse = z.infer< typeof GetProspectSkillsResponseSchema >; @@ -731,6 +858,7 @@ export type GetSupervisoryOrgValuesInput = z.infer< const GetSupervisoryOrgValuesResponseSchema = z .object({}) + // Justification: Catching all unknown properties for forward-compatibility. .catchall(z.unknown()); export type GetSupervisoryOrgValuesResponse = z.infer< typeof GetSupervisoryOrgValuesResponseSchema @@ -745,6 +873,7 @@ export type GetTimeOffEntriesForWorkerInput = z.infer< const GetTimeOffEntriesForWorkerResponseSchema = z .object({}) + // Justification: Catching all unknown properties for forward-compatibility. .catchall(z.unknown()); export type GetTimeOffEntriesForWorkerResponse = z.infer< typeof GetTimeOffEntriesForWorkerResponseSchema @@ -759,6 +888,7 @@ export type GetTimeOffPlansForWorkerInput = z.infer< const GetTimeOffPlansForWorkerResponseSchema = z .object({}) + // Justification: Catching all unknown properties for forward-compatibility. .catchall(z.unknown()); export type GetTimeOffPlansForWorkerResponse = z.infer< typeof GetTimeOffPlansForWorkerResponseSchema @@ -771,7 +901,10 @@ export type GetTimeOffStatusValuesInput = z.infer< typeof GetTimeOffStatusValuesInputSchema >; -const GetTimeOffStatusValuesResponseSchema = z.object({}).catchall(z.unknown()); +const GetTimeOffStatusValuesResponseSchema = z + .object({}) + // Justification: Catching all unknown properties for forward-compatibility. + .catchall(z.unknown()); export type GetTimeOffStatusValuesResponse = z.infer< typeof GetTimeOffStatusValuesResponseSchema >; @@ -781,7 +914,10 @@ const GetTimeTypesInputSchema = z .passthrough(); export type GetTimeTypesInput = z.infer; -const GetTimeTypesResponseSchema = z.object({}).catchall(z.unknown()); +const GetTimeTypesResponseSchema = z + .object({}) + // Justification: Catching all unknown properties for forward-compatibility. + .catchall(z.unknown()); export type GetTimeTypesResponse = z.infer; const GetWorkStudyAwardsInputSchema = z @@ -791,7 +927,10 @@ export type GetWorkStudyAwardsInput = z.infer< typeof GetWorkStudyAwardsInputSchema >; -const GetWorkStudyAwardsResponseSchema = z.object({}).catchall(z.unknown()); +const GetWorkStudyAwardsResponseSchema = z + .object({}) + // Justification: Catching all unknown properties for forward-compatibility. + .catchall(z.unknown()); export type GetWorkStudyAwardsResponse = z.infer< typeof GetWorkStudyAwardsResponseSchema >; @@ -805,6 +944,7 @@ export type GetWorkerBusinessTitleChangesInput = z.infer< const GetWorkerBusinessTitleChangesResponseSchema = z .object({}) + // Justification: Catching all unknown properties for forward-compatibility. .catchall(z.unknown()); export type GetWorkerBusinessTitleChangesResponse = z.infer< typeof GetWorkerBusinessTitleChangesResponseSchema @@ -819,6 +959,7 @@ export type GetWorkerEligibleAbsenceTypesInput = z.infer< const GetWorkerEligibleAbsenceTypesResponseSchema = z .object({}) + // Justification: Catching all unknown properties for forward-compatibility. .catchall(z.unknown()); export type GetWorkerEligibleAbsenceTypesResponse = z.infer< typeof GetWorkerEligibleAbsenceTypesResponseSchema @@ -829,7 +970,10 @@ const GetWorkerInfoInputSchema = z .passthrough(); export type GetWorkerInfoInput = z.infer; -const GetWorkerInfoResponseSchema = z.object({}).catchall(z.unknown()); +const GetWorkerInfoResponseSchema = z + .object({}) + // Justification: Catching all unknown properties for forward-compatibility. + .catchall(z.unknown()); export type GetWorkerInfoResponse = z.infer; const GetWorkerLeavesOfAbsenceInputSchema = z @@ -841,6 +985,7 @@ export type GetWorkerLeavesOfAbsenceInput = z.infer< const GetWorkerLeavesOfAbsenceResponseSchema = z .object({}) + // Justification: Catching all unknown properties for forward-compatibility. .catchall(z.unknown()); export type GetWorkerLeavesOfAbsenceResponse = z.infer< typeof GetWorkerLeavesOfAbsenceResponseSchema @@ -853,7 +998,10 @@ export type GetWorkerServiceDatesInput = z.infer< typeof GetWorkerServiceDatesInputSchema >; -const GetWorkerServiceDatesResponseSchema = z.object({}).catchall(z.unknown()); +const GetWorkerServiceDatesResponseSchema = z + .object({}) + // Justification: Catching all unknown properties for forward-compatibility. + .catchall(z.unknown()); export type GetWorkerServiceDatesResponse = z.infer< typeof GetWorkerServiceDatesResponseSchema >; @@ -867,6 +1015,7 @@ export type GetWorkerStaffingInformationInput = z.infer< const GetWorkerStaffingInformationResponseSchema = z .object({}) + // Justification: Catching all unknown properties for forward-compatibility. .catchall(z.unknown()); export type GetWorkerStaffingInformationResponse = z.infer< typeof GetWorkerStaffingInformationResponseSchema @@ -881,6 +1030,7 @@ export type GetWorkerTimeOffDetailsInput = z.infer< const GetWorkerTimeOffDetailsResponseSchema = z .object({}) + // Justification: Catching all unknown properties for forward-compatibility. .catchall(z.unknown()); export type GetWorkerTimeOffDetailsResponse = z.infer< typeof GetWorkerTimeOffDetailsResponseSchema @@ -891,7 +1041,10 @@ const GetWorkerTypesInputSchema = z .passthrough(); export type GetWorkerTypesInput = z.infer; -const GetWorkerTypesResponseSchema = z.object({}).catchall(z.unknown()); +const GetWorkerTypesResponseSchema = z + .object({}) + // Justification: Catching all unknown properties for forward-compatibility. + .catchall(z.unknown()); export type GetWorkerTypesResponse = z.infer< typeof GetWorkerTypesResponseSchema >; @@ -905,6 +1058,7 @@ export type GetWorkerValidTimeOffDatesInput = z.infer< const GetWorkerValidTimeOffDatesResponseSchema = z .object({}) + // Justification: Catching all unknown properties for forward-compatibility. .catchall(z.unknown()); export type GetWorkerValidTimeOffDatesResponse = z.infer< typeof GetWorkerValidTimeOffDatesResponseSchema @@ -919,6 +1073,7 @@ export type GetWorkersCollectionStaffingInput = z.infer< const GetWorkersCollectionStaffingResponseSchema = z .object({}) + // Justification: Catching all unknown properties for forward-compatibility. .catchall(z.unknown()); export type GetWorkersCollectionStaffingResponse = z.infer< typeof GetWorkersCollectionStaffingResponseSchema @@ -931,7 +1086,10 @@ export type GetWorkspaceInstancesInput = z.infer< typeof GetWorkspaceInstancesInputSchema >; -const GetWorkspaceInstancesResponseSchema = z.object({}).catchall(z.unknown()); +const GetWorkspaceInstancesResponseSchema = z + .object({}) + // Justification: Catching all unknown properties for forward-compatibility. + .catchall(z.unknown()); export type GetWorkspaceInstancesResponse = z.infer< typeof GetWorkspaceInstancesResponseSchema >; @@ -941,7 +1099,10 @@ const ListBalancesInputSchema = z .passthrough(); export type ListBalancesInput = z.infer; -const ListBalancesResponseSchema = z.object({}).catchall(z.unknown()); +const ListBalancesResponseSchema = z + .object({}) + // Justification: Catching all unknown properties for forward-compatibility. + .catchall(z.unknown()); export type ListBalancesResponse = z.infer; const ListCountriesInputSchema = z @@ -949,7 +1110,10 @@ const ListCountriesInputSchema = z .passthrough(); export type ListCountriesInput = z.infer; -const ListCountriesResponseSchema = z.object({}).catchall(z.unknown()); +const ListCountriesResponseSchema = z + .object({}) + // Justification: Catching all unknown properties for forward-compatibility. + .catchall(z.unknown()); export type ListCountriesResponse = z.infer; const ListInterviewsInputSchema = z @@ -957,7 +1121,10 @@ const ListInterviewsInputSchema = z .passthrough(); export type ListInterviewsInput = z.infer; -const ListInterviewsResponseSchema = z.object({}).catchall(z.unknown()); +const ListInterviewsResponseSchema = z + .object({}) + // Justification: Catching all unknown properties for forward-compatibility. + .catchall(z.unknown()); export type ListInterviewsResponse = z.infer< typeof ListInterviewsResponseSchema >; @@ -967,7 +1134,10 @@ const ListJobPostingsInputSchema = z .passthrough(); export type ListJobPostingsInput = z.infer; -const ListJobPostingsResponseSchema = z.object({}).catchall(z.unknown()); +const ListJobPostingsResponseSchema = z + .object({}) + // Justification: Catching all unknown properties for forward-compatibility. + .catchall(z.unknown()); export type ListJobPostingsResponse = z.infer< typeof ListJobPostingsResponseSchema >; @@ -977,7 +1147,10 @@ const ListJobsInputSchema = z .passthrough(); export type ListJobsInput = z.infer; -const ListJobsResponseSchema = z.object({}).catchall(z.unknown()); +const ListJobsResponseSchema = z + .object({}) + // Justification: Catching all unknown properties for forward-compatibility. + .catchall(z.unknown()); export type ListJobsResponse = z.infer; const RetrieveWorkerLeaveOfAbsenceSubresourceInputSchema = z @@ -989,6 +1162,7 @@ export type RetrieveWorkerLeaveOfAbsenceSubresourceInput = z.infer< const RetrieveWorkerLeaveOfAbsenceSubresourceResponseSchema = z .object({}) + // Justification: Catching all unknown properties for forward-compatibility. .catchall(z.unknown()); export type RetrieveWorkerLeaveOfAbsenceSubresourceResponse = z.infer< typeof RetrieveWorkerLeaveOfAbsenceSubresourceResponseSchema @@ -1004,6 +1178,7 @@ export type UpdateAnExistingPayrollInput = z.infer< const UpdateAnExistingPayrollResponseSchema = z .object({}) + // Justification: Catching all unknown properties for forward-compatibility. .catchall(z.unknown()); export type UpdateAnExistingPayrollResponse = z.infer< typeof UpdateAnExistingPayrollResponseSchema @@ -1019,6 +1194,7 @@ export type UpdateJobChangeBusinessTitleInput = z.infer< const UpdateJobChangeBusinessTitleResponseSchema = z .object({}) + // Justification: Catching all unknown properties for forward-compatibility. .catchall(z.unknown()); export type UpdateJobChangeBusinessTitleResponse = z.infer< typeof UpdateJobChangeBusinessTitleResponseSchema @@ -1034,6 +1210,7 @@ export type UpdateMessageTemplateByIdInput = z.infer< const UpdateMessageTemplateByIdResponseSchema = z .object({}) + // Justification: Catching all unknown properties for forward-compatibility. .catchall(z.unknown()); export type UpdateMessageTemplateByIdResponse = z.infer< typeof UpdateMessageTemplateByIdResponseSchema diff --git a/packages/workday/endpoints/work.ts b/packages/workday/endpoints/work.ts index 299af1762..fb89d9533 100644 --- a/packages/workday/endpoints/work.ts +++ b/packages/workday/endpoints/work.ts @@ -7,9 +7,10 @@ export const getWorkStudyAwards: WorkdayEndpoints['getWorkStudyAwards'] = async (ctx, input) => { const response = await makeWorkdayRequest< WorkdayEndpointOutputs['getWorkStudyAwards'] - >('v1/work/api', ctx.key, { - method: 'POST', - body: input as { [key: string]: unknown }, + >('v1/work/getWorkStudyAwards', ctx.key, { + method: 'GET', + // Justification: The makeWorkdayRequest client expects a generic string/number/boolean query record. + query: input as { [key: string]: string | number | boolean | undefined }, }); await logEventFromContext( ctx, diff --git a/packages/workday/endpoints/worker.ts b/packages/workday/endpoints/worker.ts index 9c9325c50..e5fbf6689 100644 --- a/packages/workday/endpoints/worker.ts +++ b/packages/workday/endpoints/worker.ts @@ -7,9 +7,10 @@ export const getWorkerBusinessTitleChanges: WorkdayEndpoints['getWorkerBusinessT async (ctx, input) => { const response = await makeWorkdayRequest< WorkdayEndpointOutputs['getWorkerBusinessTitleChanges'] - >('v1/worker/api', ctx.key, { - method: 'POST', - body: input as { [key: string]: unknown }, + >('v1/worker/getWorkerBusinessTitleChanges', ctx.key, { + method: 'GET', + // Justification: The makeWorkdayRequest client expects a generic string/number/boolean query record. + query: input as { [key: string]: string | number | boolean | undefined }, }); await logEventFromContext( ctx, @@ -24,9 +25,10 @@ export const getWorkerEligibleAbsenceTypes: WorkdayEndpoints['getWorkerEligibleA async (ctx, input) => { const response = await makeWorkdayRequest< WorkdayEndpointOutputs['getWorkerEligibleAbsenceTypes'] - >('v1/worker/api', ctx.key, { - method: 'POST', - body: input as { [key: string]: unknown }, + >('v1/worker/getWorkerEligibleAbsenceTypes', ctx.key, { + method: 'GET', + // Justification: The makeWorkdayRequest client expects a generic string/number/boolean query record. + query: input as { [key: string]: string | number | boolean | undefined }, }); await logEventFromContext( ctx, @@ -45,6 +47,7 @@ export const getWorkerInfo: WorkdayEndpoints['getWorkerInfo'] = async ( WorkdayEndpointOutputs['getWorkerInfo'] >('v1/worker/getWorkerInfo', ctx.key, { method: 'GET', + // Justification: The makeWorkdayRequest client expects a generic unknown record. query: input as { [key: string]: string | number | boolean | undefined }, }); await logEventFromContext( @@ -60,9 +63,10 @@ export const getWorkerLeavesOfAbsence: WorkdayEndpoints['getWorkerLeavesOfAbsenc async (ctx, input) => { const response = await makeWorkdayRequest< WorkdayEndpointOutputs['getWorkerLeavesOfAbsence'] - >('v1/worker/api', ctx.key, { - method: 'POST', - body: input as { [key: string]: unknown }, + >('v1/worker/getWorkerLeavesOfAbsence', ctx.key, { + method: 'GET', + // Justification: The makeWorkdayRequest client expects a generic string/number/boolean query record. + query: input as { [key: string]: string | number | boolean | undefined }, }); await logEventFromContext( ctx, @@ -77,9 +81,10 @@ export const getWorkerServiceDates: WorkdayEndpoints['getWorkerServiceDates'] = async (ctx, input) => { const response = await makeWorkdayRequest< WorkdayEndpointOutputs['getWorkerServiceDates'] - >('v1/worker/api', ctx.key, { - method: 'POST', - body: input as { [key: string]: unknown }, + >('v1/worker/getWorkerServiceDates', ctx.key, { + method: 'GET', + // Justification: The makeWorkdayRequest client expects a generic string/number/boolean query record. + query: input as { [key: string]: string | number | boolean | undefined }, }); await logEventFromContext( ctx, @@ -94,9 +99,10 @@ export const getWorkerStaffingInformation: WorkdayEndpoints['getWorkerStaffingIn async (ctx, input) => { const response = await makeWorkdayRequest< WorkdayEndpointOutputs['getWorkerStaffingInformation'] - >('v1/worker/api', ctx.key, { - method: 'POST', - body: input as { [key: string]: unknown }, + >('v1/worker/getWorkerStaffingInformation', ctx.key, { + method: 'GET', + // Justification: The makeWorkdayRequest client expects a generic string/number/boolean query record. + query: input as { [key: string]: string | number | boolean | undefined }, }); await logEventFromContext( ctx, @@ -111,9 +117,10 @@ export const getWorkerTimeOffDetails: WorkdayEndpoints['getWorkerTimeOffDetails' async (ctx, input) => { const response = await makeWorkdayRequest< WorkdayEndpointOutputs['getWorkerTimeOffDetails'] - >('v1/worker/api', ctx.key, { - method: 'POST', - body: input as { [key: string]: unknown }, + >('v1/worker/getWorkerTimeOffDetails', ctx.key, { + method: 'GET', + // Justification: The makeWorkdayRequest client expects a generic string/number/boolean query record. + query: input as { [key: string]: string | number | boolean | undefined }, }); await logEventFromContext( ctx, @@ -132,6 +139,7 @@ export const getWorkerTypes: WorkdayEndpoints['getWorkerTypes'] = async ( WorkdayEndpointOutputs['getWorkerTypes'] >('v1/worker/getWorkerTypes', ctx.key, { method: 'GET', + // Justification: The makeWorkdayRequest client expects a generic unknown record. query: input as { [key: string]: string | number | boolean | undefined }, }); await logEventFromContext( @@ -147,9 +155,10 @@ export const getWorkerValidTimeOffDates: WorkdayEndpoints['getWorkerValidTimeOff async (ctx, input) => { const response = await makeWorkdayRequest< WorkdayEndpointOutputs['getWorkerValidTimeOffDates'] - >('v1/worker/api', ctx.key, { - method: 'POST', - body: input as { [key: string]: unknown }, + >('v1/worker/getWorkerValidTimeOffDates', ctx.key, { + method: 'GET', + // Justification: The makeWorkdayRequest client expects a generic string/number/boolean query record. + query: input as { [key: string]: string | number | boolean | undefined }, }); await logEventFromContext( ctx, @@ -164,8 +173,9 @@ export const retrieveWorkerLeaveOfAbsenceSubresource: WorkdayEndpoints['retrieve async (ctx, input) => { const response = await makeWorkdayRequest< WorkdayEndpointOutputs['retrieveWorkerLeaveOfAbsenceSubresource'] - >('v1/worker/api', ctx.key, { + >('v1/worker/retrieveWorkerLeaveOfAbsenceSubresource', ctx.key, { method: 'POST', + // Justification: The makeWorkdayRequest client expects a generic unknown record. body: input as { [key: string]: unknown }, }); await logEventFromContext( diff --git a/packages/workday/endpoints/workers.ts b/packages/workday/endpoints/workers.ts index 58b6d60d0..13541de68 100644 --- a/packages/workday/endpoints/workers.ts +++ b/packages/workday/endpoints/workers.ts @@ -7,9 +7,10 @@ export const getWorkersCollectionStaffing: WorkdayEndpoints['getWorkersCollectio async (ctx, input) => { const response = await makeWorkdayRequest< WorkdayEndpointOutputs['getWorkersCollectionStaffing'] - >('v1/workers/api', ctx.key, { - method: 'POST', - body: input as { [key: string]: unknown }, + >('v1/workers/getWorkersCollectionStaffing', ctx.key, { + method: 'GET', + // Justification: The makeWorkdayRequest client expects a generic string/number/boolean query record. + query: input as { [key: string]: string | number | boolean | undefined }, }); await logEventFromContext( ctx, diff --git a/packages/workday/endpoints/workspace.ts b/packages/workday/endpoints/workspace.ts index af85197a9..a0c2393b4 100644 --- a/packages/workday/endpoints/workspace.ts +++ b/packages/workday/endpoints/workspace.ts @@ -7,9 +7,10 @@ export const getWorkspaceInstances: WorkdayEndpoints['getWorkspaceInstances'] = async (ctx, input) => { const response = await makeWorkdayRequest< WorkdayEndpointOutputs['getWorkspaceInstances'] - >('v1/workspace/api', ctx.key, { - method: 'POST', - body: input as { [key: string]: unknown }, + >('v1/workspace/getWorkspaceInstances', ctx.key, { + method: 'GET', + // Justification: The makeWorkdayRequest client expects a generic string/number/boolean query record. + query: input as { [key: string]: string | number | boolean | undefined }, }); await logEventFromContext( ctx, diff --git a/packages/workday/index.ts b/packages/workday/index.ts index ec00490f2..5432ecdef 100644 --- a/packages/workday/index.ts +++ b/packages/workday/index.ts @@ -12,13 +12,10 @@ import type { PickAuth, PluginAuthConfig, PluginPermissionsConfig, - ProviderDisplayNames, RequiredPluginEndpointMeta, - RequiredPluginEndpointSchemas, } from 'corsair/core'; import { Absence, - An, Assignment, Balances, Business, @@ -65,7 +62,6 @@ import { errorHandlers } from './error-handlers'; import { WorkdaySchema } from './schema'; import { resolveWorkdayOAuthWebhookTenantLink } from './webhooks/oauth-tenant-link'; import { matchWorkdayTenantWebhook } from './webhooks/tenant-matcher'; -import type { WorkdayWebhookOutputs } from './webhooks/types'; export type WorkdayPluginOptions = { /** Workday integration for Corsair */ @@ -343,7 +339,7 @@ const workdayEndpointsNested = { listJobs: Jobs.listJobs, }, an: { - updateAnExistingPayroll: An.updateAnExistingPayroll, + updateAnExistingPayroll: Payroll.updateAnExistingPayroll, }, message: { updateMessageTemplateById: Message.updateMessageTemplateById, @@ -686,7 +682,7 @@ export const workdayEndpointSchemas = { input: WorkdayEndpointInputSchemas.listJobs, output: WorkdayEndpointOutputSchemas.listJobs, }, - 'an.updateAnExistingPayroll': { + 'payroll.updateAnExistingPayroll': { input: WorkdayEndpointInputSchemas.updateAnExistingPayroll, output: WorkdayEndpointOutputSchemas.updateAnExistingPayroll, }, @@ -704,11 +700,11 @@ const workdayEndpointMeta = { description: 'Create Business Title Change', }, 'business.getBusinessTitleChange': { - riskLevel: 'write', + riskLevel: 'read', description: 'Get Business Title Change', }, 'business.getBusinessTitleChangeForWorker': { - riskLevel: 'write', + riskLevel: 'read', description: 'Get Business Title Change For Worker', }, 'job.createJobChange': { @@ -716,75 +712,75 @@ const workdayEndpointMeta = { description: 'Create Job Change', }, 'job.getJobById': { - riskLevel: 'write', + riskLevel: 'read', description: 'Get Job By ID', }, 'job.getJobChangeFrequencies': { - riskLevel: 'write', + riskLevel: 'read', description: 'Get Job Change Frequencies', }, 'job.getJobChangeLocationInfo': { - riskLevel: 'write', + riskLevel: 'read', description: 'Get Job Change Location Info', }, 'job.getJobChangePosition': { - riskLevel: 'write', + riskLevel: 'read', description: 'Get Job Change Position', }, 'job.getJobChangeReasonInstance': { - riskLevel: 'write', + riskLevel: 'read', description: 'Get Job Change Reason Instance', }, 'job.getJobChangeReasonValues': { - riskLevel: 'write', + riskLevel: 'read', description: 'Get Job Change Reason Values', }, 'job.getJobChangeReasons': { - riskLevel: 'write', + riskLevel: 'read', description: 'Get Job Change Reasons', }, 'job.getJobChangesGroupTemplates': { - riskLevel: 'write', + riskLevel: 'read', description: 'Get Job Changes Group Templates', }, 'job.getJobChangesJobValues': { - riskLevel: 'write', + riskLevel: 'read', description: 'Get Job Changes Job Values', }, 'job.getJobChangesWorkerValues': { - riskLevel: 'write', + riskLevel: 'read', description: 'Get Job Changes Worker Values', }, 'job.getJobClassifications': { - riskLevel: 'write', + riskLevel: 'read', description: 'Get Job Classifications', }, 'job.getJobPosting': { - riskLevel: 'write', + riskLevel: 'read', description: 'Get Job Posting', }, 'job.getJobPostingQuestionnaire': { - riskLevel: 'write', + riskLevel: 'read', description: 'Get Job Posting Questionnaire', }, 'job.getJobProfilesValues': { - riskLevel: 'write', + riskLevel: 'read', description: 'Get Job Profiles Values', }, 'job.getJobRequisitionValues': { - riskLevel: 'write', + riskLevel: 'read', description: 'Get Job Requisition Values', }, 'job.getJobWorkspace': { - riskLevel: 'write', + riskLevel: 'read', description: 'Get Job Workspace', }, 'job.getJobWorkspaces': { - riskLevel: 'write', + riskLevel: 'read', description: 'Get Job Workspaces', }, 'job.listJobPostings': { - riskLevel: 'write', + riskLevel: 'read', description: 'List Job Postings', }, 'job.updateJobChangeBusinessTitle': { @@ -796,7 +792,7 @@ const workdayEndpointMeta = { description: 'Create Payroll Inputs', }, 'payroll.getPayrollInputInstance': { - riskLevel: 'write', + riskLevel: 'read', description: 'Get Payroll Input Instance', }, 'time.createTimeOffRequest': { @@ -804,203 +800,203 @@ const workdayEndpointMeta = { description: 'Create Time Off Request', }, 'time.getTimeOffEntriesForWorker': { - riskLevel: 'write', + riskLevel: 'read', description: 'Get Time Off Entries for Worker', }, 'time.getTimeOffPlansForWorker': { - riskLevel: 'write', + riskLevel: 'read', description: 'Get Time Off Plans For Worker', }, 'time.getTimeOffStatusValues': { - riskLevel: 'write', + riskLevel: 'read', description: 'Get Time Off Status Values', }, 'time.getTimeTypes': { - riskLevel: 'write', + riskLevel: 'read', description: 'Get Time Types', }, 'absence.getAbsenceBalance': { - riskLevel: 'write', + riskLevel: 'read', description: 'Get Absence Balance', }, 'assignment.getAssignmentChangeGroupCostCenters': { - riskLevel: 'write', + riskLevel: 'read', description: 'Get Assignment Change Group Cost Centers', }, 'assignment.getAssignmentChangeGroupJobs': { - riskLevel: 'write', + riskLevel: 'read', description: 'Get Assignment Change Group Jobs', }, 'assignment.getAssignmentTypes': { - riskLevel: 'write', + riskLevel: 'read', description: 'Get Assignment Types', }, 'candidate.getCandidateAvailabilityTemplate': { - riskLevel: 'write', + riskLevel: 'read', description: 'Get Candidate Availability Template', }, 'collection.getCollectionOfJobs': { - riskLevel: 'write', + riskLevel: 'read', description: 'Get Collection of Jobs', }, 'collection.getCollectionOfPayroll': { - riskLevel: 'write', + riskLevel: 'read', description: 'Get Collection of Payroll', }, 'company.getCompanyInsiderTypes': { - riskLevel: 'write', + riskLevel: 'read', description: 'Get Company Insider Types', }, 'contingent.getContingentWorkerTypes': { - riskLevel: 'write', + riskLevel: 'read', description: 'Get Contingent Worker Types', }, 'country.getCountryInfo': { - riskLevel: 'write', + riskLevel: 'read', description: 'Get Country Info', }, 'currencies.getCurrencies': { - riskLevel: 'write', + riskLevel: 'read', description: 'Get Currencies', }, 'current.getCurrentUser': { - riskLevel: 'write', + riskLevel: 'read', description: 'Get Current User', }, 'grants.getGrants': { - riskLevel: 'write', + riskLevel: 'read', description: 'Get Grants', }, 'headcount.getHeadcountOptions': { - riskLevel: 'write', + riskLevel: 'read', description: 'Get Headcount Options', }, 'history.getHistoryInstanceForWorker': { - riskLevel: 'write', + riskLevel: 'read', description: 'Get History Instance for Worker', }, 'history.getHistoryItemsForWorker': { - riskLevel: 'write', + riskLevel: 'read', description: 'Get History Items for Worker', }, 'holiday.getHolidayEvents': { - riskLevel: 'write', + riskLevel: 'read', description: 'Get Holiday Events', }, 'interview.getInterview': { - riskLevel: 'write', + riskLevel: 'read', description: 'Get Interview', }, 'interview.getInterviewFeedback2': { - riskLevel: 'write', + riskLevel: 'read', description: 'Get Interview Feedback', }, 'leave.getLeaveStatusValues': { - riskLevel: 'write', + riskLevel: 'read', description: 'Get Leave Status Values', }, 'my.getMyJobPostings': { - riskLevel: 'write', + riskLevel: 'read', description: 'Get My Job Postings', }, 'organization.getOrganizationAssignmentBusinessUnits': { - riskLevel: 'write', + riskLevel: 'read', description: 'Get Organization Assignment Business Units', }, 'organization.getOrganizationAssignmentCustoms': { - riskLevel: 'write', + riskLevel: 'read', description: 'Get Organization Assignment Customs', }, 'organization.getOrganizationAssignmentFunds': { - riskLevel: 'write', + riskLevel: 'read', description: 'Get Organization Assignment Funds', }, 'organization.getOrganizationAssignmentRegions': { - riskLevel: 'write', + riskLevel: 'read', description: 'Get Organization Assignment Regions', }, 'organization.getOrganizationAssignmentWorkers': { - riskLevel: 'write', + riskLevel: 'read', description: 'Get Organization Assignment Workers', }, 'pay.getPayGroupByJobId': { - riskLevel: 'write', + riskLevel: 'read', description: 'Get Pay Group by Job ID', }, 'pay.getPaySlipInstancesForWorker': { - riskLevel: 'write', + riskLevel: 'read', description: 'Get Pay Slip Instance for Worker', }, 'pay.getPaySlipsForWorker': { - riskLevel: 'write', + riskLevel: 'read', description: 'Get Pay Slips for Worker', }, 'proposed.getProposedPositionValues': { - riskLevel: 'write', + riskLevel: 'read', description: 'Get Proposed Position Values', }, 'prospect.getProspect': { - riskLevel: 'write', + riskLevel: 'read', description: 'Get Prospect', }, 'prospect.getProspectEducations': { - riskLevel: 'write', + riskLevel: 'read', description: 'Get Prospect Educations', }, 'prospect.getProspectExperiences': { - riskLevel: 'write', + riskLevel: 'read', description: 'Get Prospect Experiences', }, 'prospect.getProspectResumeAttachments': { - riskLevel: 'write', + riskLevel: 'read', description: 'Get Prospect Resume Attachments', }, 'prospect.getProspectSkills': { - riskLevel: 'write', + riskLevel: 'read', description: 'Get Prospect Skills', }, 'supervisory.getSupervisoryOrgValues': { - riskLevel: 'write', + riskLevel: 'read', description: 'Get Supervisory Organization Values', }, 'work.getWorkStudyAwards': { - riskLevel: 'write', + riskLevel: 'read', description: 'Get Work Study Awards', }, 'worker.getWorkerBusinessTitleChanges': { - riskLevel: 'write', + riskLevel: 'read', description: 'Get Worker Business Title Changes', }, 'worker.getWorkerEligibleAbsenceTypes': { - riskLevel: 'write', + riskLevel: 'read', description: 'Get Worker Eligible Absence Types', }, 'worker.getWorkerInfo': { - riskLevel: 'write', + riskLevel: 'read', description: 'Get Worker Info', }, 'worker.getWorkerLeavesOfAbsence': { - riskLevel: 'write', + riskLevel: 'read', description: 'Get Worker Leaves of Absence', }, 'worker.getWorkerServiceDates': { - riskLevel: 'write', + riskLevel: 'read', description: 'Get Worker Service Dates', }, 'worker.getWorkerStaffingInformation': { - riskLevel: 'write', + riskLevel: 'read', description: 'Get Worker Staffing Information', }, 'worker.getWorkerTimeOffDetails': { - riskLevel: 'write', + riskLevel: 'read', description: 'Get Worker Time Off Details', }, 'worker.getWorkerTypes': { - riskLevel: 'write', + riskLevel: 'read', description: 'Get Worker Types', }, 'worker.getWorkerValidTimeOffDates': { - riskLevel: 'write', + riskLevel: 'read', description: 'Get Worker Valid Time Off Dates', }, 'worker.retrieveWorkerLeaveOfAbsenceSubresource': { @@ -1008,30 +1004,30 @@ const workdayEndpointMeta = { description: 'Retrieve Worker Leave of Absence', }, 'workers.getWorkersCollectionStaffing': { - riskLevel: 'write', + riskLevel: 'read', description: 'Get Workers Collection Staffing', }, 'workspace.getWorkspaceInstances': { - riskLevel: 'write', + riskLevel: 'read', description: 'Get Workspace Instances', }, 'balances.listBalances': { - riskLevel: 'write', + riskLevel: 'read', description: 'List Balances', }, 'countries.listCountries': { - riskLevel: 'write', + riskLevel: 'read', description: 'List Countries', }, 'interviews.listInterviews': { - riskLevel: 'write', + riskLevel: 'read', description: 'List Interviews', }, 'jobs.listJobs': { - riskLevel: 'write', + riskLevel: 'read', description: 'List Jobs', }, - 'an.updateAnExistingPayroll': { + 'payroll.updateAnExistingPayroll': { riskLevel: 'write', description: 'Update An Existing Payroll', }, diff --git a/packages/workday/schema/database.ts b/packages/workday/schema/database.ts deleted file mode 100644 index f0473c2c6..000000000 --- a/packages/workday/schema/database.ts +++ /dev/null @@ -1 +0,0 @@ -import { z } from 'zod'; diff --git a/packages/workday/webhooks/oauth-tenant-link.ts b/packages/workday/webhooks/oauth-tenant-link.ts index c08166bc2..d8c06de9a 100644 --- a/packages/workday/webhooks/oauth-tenant-link.ts +++ b/packages/workday/webhooks/oauth-tenant-link.ts @@ -1,5 +1,5 @@ import type { TokenResponse, WebhookTenantMatch } from 'corsair/core'; -import { asRecord, toExternalId } from 'corsair/core'; +import { toExternalId } from 'corsair/core'; export async function resolveWorkdayOAuthWebhookTenantLink( tokens: TokenResponse, @@ -8,9 +8,5 @@ export async function resolveWorkdayOAuthWebhookTenantLink( if (externalId) { return { linkType: 'tenant_external_id', externalId }; } - - const accessToken = tokens.access_token; - if (!accessToken) return null; - return null; } diff --git a/packages/workday/webhooks/types.ts b/packages/workday/webhooks/types.ts index 6efcef494..fea3e2b53 100644 --- a/packages/workday/webhooks/types.ts +++ b/packages/workday/webhooks/types.ts @@ -24,7 +24,12 @@ export type WorkdayWebhookOutputs = { }; function parseBody(body: unknown): unknown { - return typeof body === 'string' ? JSON.parse(body) : body; + if (typeof body !== 'string') return body; + try { + return JSON.parse(body); + } catch { + return null; + } } export function createWorkdayEventMatch( @@ -50,10 +55,10 @@ export function verifyWorkdayWebhookSignature( } let bodyString: string; - if (typeof request.body === 'string') { - bodyString = request.body; + if (typeof request.rawBody === 'string') { + bodyString = request.rawBody; } else { - bodyString = JSON.stringify(request.body); + bodyString = JSON.stringify(request.payload); } const expected = crypto From cd512e7c734ab594cd8c7ce63d91bbea2bb4cac8 Mon Sep 17 00:00:00 2001 From: Dhirender Choudhary Date: Sun, 19 Jul 2026 18:21:21 +0530 Subject: [PATCH 07/19] fix(workday): resolve remaining index references to 'an' --- packages/workday/endpoints/index.ts | 15 ++++++++++----- packages/workday/index.ts | 4 +--- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/packages/workday/endpoints/index.ts b/packages/workday/endpoints/index.ts index 62a1952ad..64ca4d7df 100644 --- a/packages/workday/endpoints/index.ts +++ b/packages/workday/endpoints/index.ts @@ -54,8 +54,16 @@ export const Job = { updateJobChangeBusinessTitle, }; -import { createPayrollInputs, getPayrollInputInstance } from './payroll'; -export const Payroll = { createPayrollInputs, getPayrollInputInstance }; +import { + createPayrollInputs, + getPayrollInputInstance, + updateAnExistingPayroll, +} from './payroll'; +export const Payroll = { + createPayrollInputs, + getPayrollInputInstance, + updateAnExistingPayroll, +}; import { createTimeOffRequest, @@ -227,9 +235,6 @@ export const Interviews = { listInterviews }; import { listJobs } from './jobs'; export const Jobs = { listJobs }; -import { updateAnExistingPayroll } from './an'; -export const An = { updateAnExistingPayroll }; - import { updateMessageTemplateById } from './message'; export const Message = { updateMessageTemplateById }; diff --git a/packages/workday/index.ts b/packages/workday/index.ts index 5432ecdef..308348053 100644 --- a/packages/workday/index.ts +++ b/packages/workday/index.ts @@ -212,6 +212,7 @@ const workdayEndpointsNested = { payroll: { createPayrollInputs: Payroll.createPayrollInputs, getPayrollInputInstance: Payroll.getPayrollInputInstance, + updateAnExistingPayroll: Payroll.updateAnExistingPayroll, }, time: { createTimeOffRequest: Time.createTimeOffRequest, @@ -338,9 +339,6 @@ const workdayEndpointsNested = { jobs: { listJobs: Jobs.listJobs, }, - an: { - updateAnExistingPayroll: Payroll.updateAnExistingPayroll, - }, message: { updateMessageTemplateById: Message.updateMessageTemplateById, }, From 1f35061b1fd7cd3687013c4d26691d0a0fdb0d10 Mon Sep 17 00:00:00 2001 From: Dhirender Choudhary Date: Sun, 19 Jul 2026 18:26:39 +0530 Subject: [PATCH 08/19] fix(workday): resolve remaining webhook crash and ID schema issues --- packages/workday/api.test.ts | 2 ++ packages/workday/endpoints/types.ts | 14 +++++++------- packages/workday/index.ts | 5 ++++- packages/workday/webhooks/index.ts | 1 + packages/workday/webhooks/types.ts | 6 ++++-- packages/workday/webhooks/worker.ts | 24 ++++++++++++++++++++++++ 6 files changed, 42 insertions(+), 10 deletions(-) create mode 100644 packages/workday/webhooks/worker.ts diff --git a/packages/workday/api.test.ts b/packages/workday/api.test.ts index 3e911c789..76281c1b5 100644 --- a/packages/workday/api.test.ts +++ b/packages/workday/api.test.ts @@ -46,7 +46,9 @@ describe('Workday Plugin', () => { }); const result = await plugin.endpoints?.business.createBusinessTitleChange( + // Justification: Mock context for testing { key: 'test' } as any, + // Justification: Mock input for testing { workerId: '123' } as any, ); diff --git a/packages/workday/endpoints/types.ts b/packages/workday/endpoints/types.ts index 733db6b72..0a53c5f8b 100644 --- a/packages/workday/endpoints/types.ts +++ b/packages/workday/endpoints/types.ts @@ -1,7 +1,7 @@ import { z } from 'zod'; const CreateBusinessTitleChangeInputSchema = z - .object({ id: z.string().optional(), workerId: z.string().optional() }) + .object({ id: z.string(), workerId: z.string().optional() }) .passthrough() .optional(); export type CreateBusinessTitleChangeInput = z.infer< @@ -17,7 +17,7 @@ export type CreateBusinessTitleChangeResponse = z.infer< >; const CreateJobChangeInputSchema = z - .object({ id: z.string().optional(), workerId: z.string().optional() }) + .object({ id: z.string(), workerId: z.string().optional() }) .passthrough() .optional(); export type CreateJobChangeInput = z.infer; @@ -31,7 +31,7 @@ export type CreateJobChangeResponse = z.infer< >; const CreatePayrollInputsInputSchema = z - .object({ id: z.string().optional(), workerId: z.string().optional() }) + .object({ id: z.string(), workerId: z.string().optional() }) .passthrough() .optional(); export type CreatePayrollInputsInput = z.infer< @@ -47,7 +47,7 @@ export type CreatePayrollInputsResponse = z.infer< >; const CreateTimeOffRequestInputSchema = z - .object({ id: z.string().optional(), workerId: z.string().optional() }) + .object({ id: z.string(), workerId: z.string().optional() }) .passthrough() .optional(); export type CreateTimeOffRequestInput = z.infer< @@ -1169,7 +1169,7 @@ export type RetrieveWorkerLeaveOfAbsenceSubresourceResponse = z.infer< >; const UpdateAnExistingPayrollInputSchema = z - .object({ id: z.string().optional(), workerId: z.string().optional() }) + .object({ id: z.string(), workerId: z.string().optional() }) .passthrough() .optional(); export type UpdateAnExistingPayrollInput = z.infer< @@ -1185,7 +1185,7 @@ export type UpdateAnExistingPayrollResponse = z.infer< >; const UpdateJobChangeBusinessTitleInputSchema = z - .object({ id: z.string().optional(), workerId: z.string().optional() }) + .object({ id: z.string(), workerId: z.string().optional() }) .passthrough() .optional(); export type UpdateJobChangeBusinessTitleInput = z.infer< @@ -1201,7 +1201,7 @@ export type UpdateJobChangeBusinessTitleResponse = z.infer< >; const UpdateMessageTemplateByIdInputSchema = z - .object({ id: z.string().optional(), workerId: z.string().optional() }) + .object({ id: z.string(), workerId: z.string().optional() }) .passthrough() .optional(); export type UpdateMessageTemplateByIdInput = z.infer< diff --git a/packages/workday/index.ts b/packages/workday/index.ts index 308348053..f45164d03 100644 --- a/packages/workday/index.ts +++ b/packages/workday/index.ts @@ -62,6 +62,7 @@ import { errorHandlers } from './error-handlers'; import { WorkdaySchema } from './schema'; import { resolveWorkdayOAuthWebhookTenantLink } from './webhooks/oauth-tenant-link'; import { matchWorkdayTenantWebhook } from './webhooks/tenant-matcher'; +import { workerUpdated } from './webhooks/worker'; export type WorkdayPluginOptions = { /** Workday integration for Corsair */ @@ -344,7 +345,9 @@ const workdayEndpointsNested = { }, } as const; -const workdayWebhooksNested = {} as const; +const workdayWebhooksNested = { + 'worker.updated': workerUpdated, +} as const; export const workdayEndpointSchemas = { 'business.createBusinessTitleChange': { diff --git a/packages/workday/webhooks/index.ts b/packages/workday/webhooks/index.ts index 07a99b8fe..54679600e 100644 --- a/packages/workday/webhooks/index.ts +++ b/packages/workday/webhooks/index.ts @@ -1,3 +1,4 @@ export * from './oauth-tenant-link'; export * from './tenant-matcher'; export * from './types'; +export * from './worker'; diff --git a/packages/workday/webhooks/types.ts b/packages/workday/webhooks/types.ts index fea3e2b53..1af8295bb 100644 --- a/packages/workday/webhooks/types.ts +++ b/packages/workday/webhooks/types.ts @@ -36,8 +36,10 @@ export function createWorkdayEventMatch( eventType: string, ): CorsairWebhookMatcher { return (request: RawWebhookRequest) => { - const parsed = parseBody(request.body) as Record; - return typeof parsed.type === 'string' && parsed.type === eventType; + const parsed = parseBody(request.body); + if (!parsed || typeof parsed !== 'object') return false; + const record = parsed as Record; + return typeof record.type === 'string' && record.type === eventType; }; } diff --git a/packages/workday/webhooks/worker.ts b/packages/workday/webhooks/worker.ts new file mode 100644 index 000000000..522e72917 --- /dev/null +++ b/packages/workday/webhooks/worker.ts @@ -0,0 +1,24 @@ +import type { CorsairWebhookDefinition } from 'corsair/core'; +import type { WorkdayWebhookOutputs } from './types'; +import { + createWorkdayEventMatch, + verifyWorkdayWebhookSignature, +} from './types'; + +export const workerUpdated: CorsairWebhookDefinition< + WorkdayWebhookOutputs, + 'worker.updated' +> = { + match: createWorkdayEventMatch('worker.updated'), + handler: async (ctx, request) => { + const v = verifyWorkdayWebhookSignature(request, ctx.key); + if (!v.valid) { + return { + success: false, + statusCode: 401, + error: v.error || 'Signature verification failed', + }; + } + return { success: true }; + }, +}; From 725ad575c42f4e3abb9c26b752ac9fe47fede6d4 Mon Sep 17 00:00:00 2001 From: Dhirender Choudhary Date: Wed, 22 Jul 2026 14:09:32 +0530 Subject: [PATCH 09/19] fix(workday): correct endpoint list schemas --- packages/workday/endpoints/types.ts | 680 ++++++++++++++-------------- 1 file changed, 340 insertions(+), 340 deletions(-) diff --git a/packages/workday/endpoints/types.ts b/packages/workday/endpoints/types.ts index 0a53c5f8b..5939295c3 100644 --- a/packages/workday/endpoints/types.ts +++ b/packages/workday/endpoints/types.ts @@ -8,10 +8,10 @@ export type CreateBusinessTitleChangeInput = z.infer< typeof CreateBusinessTitleChangeInputSchema >; -const CreateBusinessTitleChangeResponseSchema = z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()); +const CreateBusinessTitleChangeResponseSchema = z.union([ + z.object({}).catchall(z.unknown()), + z.array(z.unknown()), +]); export type CreateBusinessTitleChangeResponse = z.infer< typeof CreateBusinessTitleChangeResponseSchema >; @@ -22,10 +22,10 @@ const CreateJobChangeInputSchema = z .optional(); export type CreateJobChangeInput = z.infer; -const CreateJobChangeResponseSchema = z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()); +const CreateJobChangeResponseSchema = z.union([ + z.object({}).catchall(z.unknown()), + z.array(z.unknown()), +]); export type CreateJobChangeResponse = z.infer< typeof CreateJobChangeResponseSchema >; @@ -38,10 +38,10 @@ export type CreatePayrollInputsInput = z.infer< typeof CreatePayrollInputsInputSchema >; -const CreatePayrollInputsResponseSchema = z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()); +const CreatePayrollInputsResponseSchema = z.union([ + z.object({}).catchall(z.unknown()), + z.array(z.unknown()), +]); export type CreatePayrollInputsResponse = z.infer< typeof CreatePayrollInputsResponseSchema >; @@ -54,10 +54,10 @@ export type CreateTimeOffRequestInput = z.infer< typeof CreateTimeOffRequestInputSchema >; -const CreateTimeOffRequestResponseSchema = z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()); +const CreateTimeOffRequestResponseSchema = z.union([ + z.object({}).catchall(z.unknown()), + z.array(z.unknown()), +]); export type CreateTimeOffRequestResponse = z.infer< typeof CreateTimeOffRequestResponseSchema >; @@ -69,10 +69,10 @@ export type GetAbsenceBalanceInput = z.infer< typeof GetAbsenceBalanceInputSchema >; -const GetAbsenceBalanceResponseSchema = z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()); +const GetAbsenceBalanceResponseSchema = z.union([ + z.object({}).catchall(z.unknown()), + z.array(z.unknown()), +]); export type GetAbsenceBalanceResponse = z.infer< typeof GetAbsenceBalanceResponseSchema >; @@ -84,10 +84,10 @@ export type GetAssignmentChangeGroupCostCentersInput = z.infer< typeof GetAssignmentChangeGroupCostCentersInputSchema >; -const GetAssignmentChangeGroupCostCentersResponseSchema = z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()); +const GetAssignmentChangeGroupCostCentersResponseSchema = z.union([ + z.object({}).catchall(z.unknown()), + z.array(z.unknown()), +]); export type GetAssignmentChangeGroupCostCentersResponse = z.infer< typeof GetAssignmentChangeGroupCostCentersResponseSchema >; @@ -99,10 +99,10 @@ export type GetAssignmentChangeGroupJobsInput = z.infer< typeof GetAssignmentChangeGroupJobsInputSchema >; -const GetAssignmentChangeGroupJobsResponseSchema = z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()); +const GetAssignmentChangeGroupJobsResponseSchema = z.union([ + z.object({}).catchall(z.unknown()), + z.array(z.unknown()), +]); export type GetAssignmentChangeGroupJobsResponse = z.infer< typeof GetAssignmentChangeGroupJobsResponseSchema >; @@ -114,10 +114,10 @@ export type GetAssignmentTypesInput = z.infer< typeof GetAssignmentTypesInputSchema >; -const GetAssignmentTypesResponseSchema = z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()); +const GetAssignmentTypesResponseSchema = z.union([ + z.object({}).catchall(z.unknown()), + z.array(z.unknown()), +]); export type GetAssignmentTypesResponse = z.infer< typeof GetAssignmentTypesResponseSchema >; @@ -129,10 +129,10 @@ export type GetBusinessTitleChangeInput = z.infer< typeof GetBusinessTitleChangeInputSchema >; -const GetBusinessTitleChangeResponseSchema = z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()); +const GetBusinessTitleChangeResponseSchema = z.union([ + z.object({}).catchall(z.unknown()), + z.array(z.unknown()), +]); export type GetBusinessTitleChangeResponse = z.infer< typeof GetBusinessTitleChangeResponseSchema >; @@ -144,10 +144,10 @@ export type GetBusinessTitleChangeForWorkerInput = z.infer< typeof GetBusinessTitleChangeForWorkerInputSchema >; -const GetBusinessTitleChangeForWorkerResponseSchema = z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()); +const GetBusinessTitleChangeForWorkerResponseSchema = z.union([ + z.object({}).catchall(z.unknown()), + z.array(z.unknown()), +]); export type GetBusinessTitleChangeForWorkerResponse = z.infer< typeof GetBusinessTitleChangeForWorkerResponseSchema >; @@ -159,10 +159,10 @@ export type GetCandidateAvailabilityTemplateInput = z.infer< typeof GetCandidateAvailabilityTemplateInputSchema >; -const GetCandidateAvailabilityTemplateResponseSchema = z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()); +const GetCandidateAvailabilityTemplateResponseSchema = z.union([ + z.object({}).catchall(z.unknown()), + z.array(z.unknown()), +]); export type GetCandidateAvailabilityTemplateResponse = z.infer< typeof GetCandidateAvailabilityTemplateResponseSchema >; @@ -174,10 +174,10 @@ export type GetCollectionOfJobsInput = z.infer< typeof GetCollectionOfJobsInputSchema >; -const GetCollectionOfJobsResponseSchema = z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()); +const GetCollectionOfJobsResponseSchema = z.union([ + z.object({}).catchall(z.unknown()), + z.array(z.unknown()), +]); export type GetCollectionOfJobsResponse = z.infer< typeof GetCollectionOfJobsResponseSchema >; @@ -189,10 +189,10 @@ export type GetCollectionOfPayrollInput = z.infer< typeof GetCollectionOfPayrollInputSchema >; -const GetCollectionOfPayrollResponseSchema = z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()); +const GetCollectionOfPayrollResponseSchema = z.union([ + z.object({}).catchall(z.unknown()), + z.array(z.unknown()), +]); export type GetCollectionOfPayrollResponse = z.infer< typeof GetCollectionOfPayrollResponseSchema >; @@ -204,10 +204,10 @@ export type GetCompanyInsiderTypesInput = z.infer< typeof GetCompanyInsiderTypesInputSchema >; -const GetCompanyInsiderTypesResponseSchema = z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()); +const GetCompanyInsiderTypesResponseSchema = z.union([ + z.object({}).catchall(z.unknown()), + z.array(z.unknown()), +]); export type GetCompanyInsiderTypesResponse = z.infer< typeof GetCompanyInsiderTypesResponseSchema >; @@ -219,10 +219,10 @@ export type GetContingentWorkerTypesInput = z.infer< typeof GetContingentWorkerTypesInputSchema >; -const GetContingentWorkerTypesResponseSchema = z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()); +const GetContingentWorkerTypesResponseSchema = z.union([ + z.object({}).catchall(z.unknown()), + z.array(z.unknown()), +]); export type GetContingentWorkerTypesResponse = z.infer< typeof GetContingentWorkerTypesResponseSchema >; @@ -232,10 +232,10 @@ const GetCountryInfoInputSchema = z .passthrough(); export type GetCountryInfoInput = z.infer; -const GetCountryInfoResponseSchema = z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()); +const GetCountryInfoResponseSchema = z.union([ + z.object({}).catchall(z.unknown()), + z.array(z.unknown()), +]); export type GetCountryInfoResponse = z.infer< typeof GetCountryInfoResponseSchema >; @@ -245,10 +245,10 @@ const GetCurrenciesInputSchema = z .passthrough(); export type GetCurrenciesInput = z.infer; -const GetCurrenciesResponseSchema = z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()); +const GetCurrenciesResponseSchema = z.union([ + z.object({}).catchall(z.unknown()), + z.array(z.unknown()), +]); export type GetCurrenciesResponse = z.infer; const GetCurrentUserInputSchema = z @@ -256,10 +256,10 @@ const GetCurrentUserInputSchema = z .passthrough(); export type GetCurrentUserInput = z.infer; -const GetCurrentUserResponseSchema = z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()); +const GetCurrentUserResponseSchema = z.union([ + z.object({}).catchall(z.unknown()), + z.array(z.unknown()), +]); export type GetCurrentUserResponse = z.infer< typeof GetCurrentUserResponseSchema >; @@ -269,10 +269,10 @@ const GetGrantsInputSchema = z .passthrough(); export type GetGrantsInput = z.infer; -const GetGrantsResponseSchema = z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()); +const GetGrantsResponseSchema = z.union([ + z.object({}).catchall(z.unknown()), + z.array(z.unknown()), +]); export type GetGrantsResponse = z.infer; const GetHeadcountOptionsInputSchema = z @@ -282,10 +282,10 @@ export type GetHeadcountOptionsInput = z.infer< typeof GetHeadcountOptionsInputSchema >; -const GetHeadcountOptionsResponseSchema = z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()); +const GetHeadcountOptionsResponseSchema = z.union([ + z.object({}).catchall(z.unknown()), + z.array(z.unknown()), +]); export type GetHeadcountOptionsResponse = z.infer< typeof GetHeadcountOptionsResponseSchema >; @@ -297,10 +297,10 @@ export type GetHistoryInstanceForWorkerInput = z.infer< typeof GetHistoryInstanceForWorkerInputSchema >; -const GetHistoryInstanceForWorkerResponseSchema = z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()); +const GetHistoryInstanceForWorkerResponseSchema = z.union([ + z.object({}).catchall(z.unknown()), + z.array(z.unknown()), +]); export type GetHistoryInstanceForWorkerResponse = z.infer< typeof GetHistoryInstanceForWorkerResponseSchema >; @@ -312,10 +312,10 @@ export type GetHistoryItemsForWorkerInput = z.infer< typeof GetHistoryItemsForWorkerInputSchema >; -const GetHistoryItemsForWorkerResponseSchema = z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()); +const GetHistoryItemsForWorkerResponseSchema = z.union([ + z.object({}).catchall(z.unknown()), + z.array(z.unknown()), +]); export type GetHistoryItemsForWorkerResponse = z.infer< typeof GetHistoryItemsForWorkerResponseSchema >; @@ -325,10 +325,10 @@ const GetHolidayEventsInputSchema = z .passthrough(); export type GetHolidayEventsInput = z.infer; -const GetHolidayEventsResponseSchema = z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()); +const GetHolidayEventsResponseSchema = z.union([ + z.object({}).catchall(z.unknown()), + z.array(z.unknown()), +]); export type GetHolidayEventsResponse = z.infer< typeof GetHolidayEventsResponseSchema >; @@ -338,10 +338,10 @@ const GetInterviewInputSchema = z .passthrough(); export type GetInterviewInput = z.infer; -const GetInterviewResponseSchema = z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()); +const GetInterviewResponseSchema = z.union([ + z.object({}).catchall(z.unknown()), + z.array(z.unknown()), +]); export type GetInterviewResponse = z.infer; const GetInterviewFeedback2InputSchema = z @@ -351,10 +351,10 @@ export type GetInterviewFeedback2Input = z.infer< typeof GetInterviewFeedback2InputSchema >; -const GetInterviewFeedback2ResponseSchema = z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()); +const GetInterviewFeedback2ResponseSchema = z.union([ + z.object({}).catchall(z.unknown()), + z.array(z.unknown()), +]); export type GetInterviewFeedback2Response = z.infer< typeof GetInterviewFeedback2ResponseSchema >; @@ -362,10 +362,10 @@ export type GetInterviewFeedback2Response = z.infer< const GetJobByIdInputSchema = z.object({ id: z.string() }); export type GetJobByIdInput = z.infer; -const GetJobByIdResponseSchema = z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()); +const GetJobByIdResponseSchema = z.union([ + z.object({}).catchall(z.unknown()), + z.array(z.unknown()), +]); export type GetJobByIdResponse = z.infer; const GetJobChangeFrequenciesInputSchema = z @@ -375,10 +375,10 @@ export type GetJobChangeFrequenciesInput = z.infer< typeof GetJobChangeFrequenciesInputSchema >; -const GetJobChangeFrequenciesResponseSchema = z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()); +const GetJobChangeFrequenciesResponseSchema = z.union([ + z.object({}).catchall(z.unknown()), + z.array(z.unknown()), +]); export type GetJobChangeFrequenciesResponse = z.infer< typeof GetJobChangeFrequenciesResponseSchema >; @@ -390,10 +390,10 @@ export type GetJobChangeLocationInfoInput = z.infer< typeof GetJobChangeLocationInfoInputSchema >; -const GetJobChangeLocationInfoResponseSchema = z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()); +const GetJobChangeLocationInfoResponseSchema = z.union([ + z.object({}).catchall(z.unknown()), + z.array(z.unknown()), +]); export type GetJobChangeLocationInfoResponse = z.infer< typeof GetJobChangeLocationInfoResponseSchema >; @@ -405,10 +405,10 @@ export type GetJobChangePositionInput = z.infer< typeof GetJobChangePositionInputSchema >; -const GetJobChangePositionResponseSchema = z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()); +const GetJobChangePositionResponseSchema = z.union([ + z.object({}).catchall(z.unknown()), + z.array(z.unknown()), +]); export type GetJobChangePositionResponse = z.infer< typeof GetJobChangePositionResponseSchema >; @@ -420,10 +420,10 @@ export type GetJobChangeReasonInstanceInput = z.infer< typeof GetJobChangeReasonInstanceInputSchema >; -const GetJobChangeReasonInstanceResponseSchema = z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()); +const GetJobChangeReasonInstanceResponseSchema = z.union([ + z.object({}).catchall(z.unknown()), + z.array(z.unknown()), +]); export type GetJobChangeReasonInstanceResponse = z.infer< typeof GetJobChangeReasonInstanceResponseSchema >; @@ -435,10 +435,10 @@ export type GetJobChangeReasonValuesInput = z.infer< typeof GetJobChangeReasonValuesInputSchema >; -const GetJobChangeReasonValuesResponseSchema = z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()); +const GetJobChangeReasonValuesResponseSchema = z.union([ + z.object({}).catchall(z.unknown()), + z.array(z.unknown()), +]); export type GetJobChangeReasonValuesResponse = z.infer< typeof GetJobChangeReasonValuesResponseSchema >; @@ -450,10 +450,10 @@ export type GetJobChangeReasonsInput = z.infer< typeof GetJobChangeReasonsInputSchema >; -const GetJobChangeReasonsResponseSchema = z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()); +const GetJobChangeReasonsResponseSchema = z.union([ + z.object({}).catchall(z.unknown()), + z.array(z.unknown()), +]); export type GetJobChangeReasonsResponse = z.infer< typeof GetJobChangeReasonsResponseSchema >; @@ -465,10 +465,10 @@ export type GetJobChangesGroupTemplatesInput = z.infer< typeof GetJobChangesGroupTemplatesInputSchema >; -const GetJobChangesGroupTemplatesResponseSchema = z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()); +const GetJobChangesGroupTemplatesResponseSchema = z.union([ + z.object({}).catchall(z.unknown()), + z.array(z.unknown()), +]); export type GetJobChangesGroupTemplatesResponse = z.infer< typeof GetJobChangesGroupTemplatesResponseSchema >; @@ -480,10 +480,10 @@ export type GetJobChangesJobValuesInput = z.infer< typeof GetJobChangesJobValuesInputSchema >; -const GetJobChangesJobValuesResponseSchema = z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()); +const GetJobChangesJobValuesResponseSchema = z.union([ + z.object({}).catchall(z.unknown()), + z.array(z.unknown()), +]); export type GetJobChangesJobValuesResponse = z.infer< typeof GetJobChangesJobValuesResponseSchema >; @@ -495,10 +495,10 @@ export type GetJobChangesWorkerValuesInput = z.infer< typeof GetJobChangesWorkerValuesInputSchema >; -const GetJobChangesWorkerValuesResponseSchema = z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()); +const GetJobChangesWorkerValuesResponseSchema = z.union([ + z.object({}).catchall(z.unknown()), + z.array(z.unknown()), +]); export type GetJobChangesWorkerValuesResponse = z.infer< typeof GetJobChangesWorkerValuesResponseSchema >; @@ -510,10 +510,10 @@ export type GetJobClassificationsInput = z.infer< typeof GetJobClassificationsInputSchema >; -const GetJobClassificationsResponseSchema = z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()); +const GetJobClassificationsResponseSchema = z.union([ + z.object({}).catchall(z.unknown()), + z.array(z.unknown()), +]); export type GetJobClassificationsResponse = z.infer< typeof GetJobClassificationsResponseSchema >; @@ -523,10 +523,10 @@ const GetJobPostingInputSchema = z .passthrough(); export type GetJobPostingInput = z.infer; -const GetJobPostingResponseSchema = z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()); +const GetJobPostingResponseSchema = z.union([ + z.object({}).catchall(z.unknown()), + z.array(z.unknown()), +]); export type GetJobPostingResponse = z.infer; const GetJobPostingQuestionnaireInputSchema = z @@ -536,10 +536,10 @@ export type GetJobPostingQuestionnaireInput = z.infer< typeof GetJobPostingQuestionnaireInputSchema >; -const GetJobPostingQuestionnaireResponseSchema = z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()); +const GetJobPostingQuestionnaireResponseSchema = z.union([ + z.object({}).catchall(z.unknown()), + z.array(z.unknown()), +]); export type GetJobPostingQuestionnaireResponse = z.infer< typeof GetJobPostingQuestionnaireResponseSchema >; @@ -551,10 +551,10 @@ export type GetJobProfilesValuesInput = z.infer< typeof GetJobProfilesValuesInputSchema >; -const GetJobProfilesValuesResponseSchema = z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()); +const GetJobProfilesValuesResponseSchema = z.union([ + z.object({}).catchall(z.unknown()), + z.array(z.unknown()), +]); export type GetJobProfilesValuesResponse = z.infer< typeof GetJobProfilesValuesResponseSchema >; @@ -566,10 +566,10 @@ export type GetJobRequisitionValuesInput = z.infer< typeof GetJobRequisitionValuesInputSchema >; -const GetJobRequisitionValuesResponseSchema = z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()); +const GetJobRequisitionValuesResponseSchema = z.union([ + z.object({}).catchall(z.unknown()), + z.array(z.unknown()), +]); export type GetJobRequisitionValuesResponse = z.infer< typeof GetJobRequisitionValuesResponseSchema >; @@ -579,10 +579,10 @@ const GetJobWorkspaceInputSchema = z .passthrough(); export type GetJobWorkspaceInput = z.infer; -const GetJobWorkspaceResponseSchema = z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()); +const GetJobWorkspaceResponseSchema = z.union([ + z.object({}).catchall(z.unknown()), + z.array(z.unknown()), +]); export type GetJobWorkspaceResponse = z.infer< typeof GetJobWorkspaceResponseSchema >; @@ -592,10 +592,10 @@ const GetJobWorkspacesInputSchema = z .passthrough(); export type GetJobWorkspacesInput = z.infer; -const GetJobWorkspacesResponseSchema = z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()); +const GetJobWorkspacesResponseSchema = z.union([ + z.object({}).catchall(z.unknown()), + z.array(z.unknown()), +]); export type GetJobWorkspacesResponse = z.infer< typeof GetJobWorkspacesResponseSchema >; @@ -607,10 +607,10 @@ export type GetLeaveStatusValuesInput = z.infer< typeof GetLeaveStatusValuesInputSchema >; -const GetLeaveStatusValuesResponseSchema = z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()); +const GetLeaveStatusValuesResponseSchema = z.union([ + z.object({}).catchall(z.unknown()), + z.array(z.unknown()), +]); export type GetLeaveStatusValuesResponse = z.infer< typeof GetLeaveStatusValuesResponseSchema >; @@ -620,10 +620,10 @@ const GetMyJobPostingsInputSchema = z .passthrough(); export type GetMyJobPostingsInput = z.infer; -const GetMyJobPostingsResponseSchema = z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()); +const GetMyJobPostingsResponseSchema = z.union([ + z.object({}).catchall(z.unknown()), + z.array(z.unknown()), +]); export type GetMyJobPostingsResponse = z.infer< typeof GetMyJobPostingsResponseSchema >; @@ -635,10 +635,10 @@ export type GetOrganizationAssignmentBusinessUnitsInput = z.infer< typeof GetOrganizationAssignmentBusinessUnitsInputSchema >; -const GetOrganizationAssignmentBusinessUnitsResponseSchema = z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()); +const GetOrganizationAssignmentBusinessUnitsResponseSchema = z.union([ + z.object({}).catchall(z.unknown()), + z.array(z.unknown()), +]); export type GetOrganizationAssignmentBusinessUnitsResponse = z.infer< typeof GetOrganizationAssignmentBusinessUnitsResponseSchema >; @@ -650,10 +650,10 @@ export type GetOrganizationAssignmentCustomsInput = z.infer< typeof GetOrganizationAssignmentCustomsInputSchema >; -const GetOrganizationAssignmentCustomsResponseSchema = z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()); +const GetOrganizationAssignmentCustomsResponseSchema = z.union([ + z.object({}).catchall(z.unknown()), + z.array(z.unknown()), +]); export type GetOrganizationAssignmentCustomsResponse = z.infer< typeof GetOrganizationAssignmentCustomsResponseSchema >; @@ -665,10 +665,10 @@ export type GetOrganizationAssignmentFundsInput = z.infer< typeof GetOrganizationAssignmentFundsInputSchema >; -const GetOrganizationAssignmentFundsResponseSchema = z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()); +const GetOrganizationAssignmentFundsResponseSchema = z.union([ + z.object({}).catchall(z.unknown()), + z.array(z.unknown()), +]); export type GetOrganizationAssignmentFundsResponse = z.infer< typeof GetOrganizationAssignmentFundsResponseSchema >; @@ -680,10 +680,10 @@ export type GetOrganizationAssignmentRegionsInput = z.infer< typeof GetOrganizationAssignmentRegionsInputSchema >; -const GetOrganizationAssignmentRegionsResponseSchema = z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()); +const GetOrganizationAssignmentRegionsResponseSchema = z.union([ + z.object({}).catchall(z.unknown()), + z.array(z.unknown()), +]); export type GetOrganizationAssignmentRegionsResponse = z.infer< typeof GetOrganizationAssignmentRegionsResponseSchema >; @@ -695,10 +695,10 @@ export type GetOrganizationAssignmentWorkersInput = z.infer< typeof GetOrganizationAssignmentWorkersInputSchema >; -const GetOrganizationAssignmentWorkersResponseSchema = z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()); +const GetOrganizationAssignmentWorkersResponseSchema = z.union([ + z.object({}).catchall(z.unknown()), + z.array(z.unknown()), +]); export type GetOrganizationAssignmentWorkersResponse = z.infer< typeof GetOrganizationAssignmentWorkersResponseSchema >; @@ -710,10 +710,10 @@ export type GetPayGroupByJobIdInput = z.infer< typeof GetPayGroupByJobIdInputSchema >; -const GetPayGroupByJobIdResponseSchema = z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()); +const GetPayGroupByJobIdResponseSchema = z.union([ + z.object({}).catchall(z.unknown()), + z.array(z.unknown()), +]); export type GetPayGroupByJobIdResponse = z.infer< typeof GetPayGroupByJobIdResponseSchema >; @@ -725,10 +725,10 @@ export type GetPaySlipInstancesForWorkerInput = z.infer< typeof GetPaySlipInstancesForWorkerInputSchema >; -const GetPaySlipInstancesForWorkerResponseSchema = z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()); +const GetPaySlipInstancesForWorkerResponseSchema = z.union([ + z.object({}).catchall(z.unknown()), + z.array(z.unknown()), +]); export type GetPaySlipInstancesForWorkerResponse = z.infer< typeof GetPaySlipInstancesForWorkerResponseSchema >; @@ -740,10 +740,10 @@ export type GetPaySlipsForWorkerInput = z.infer< typeof GetPaySlipsForWorkerInputSchema >; -const GetPaySlipsForWorkerResponseSchema = z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()); +const GetPaySlipsForWorkerResponseSchema = z.union([ + z.object({}).catchall(z.unknown()), + z.array(z.unknown()), +]); export type GetPaySlipsForWorkerResponse = z.infer< typeof GetPaySlipsForWorkerResponseSchema >; @@ -755,10 +755,10 @@ export type GetPayrollInputInstanceInput = z.infer< typeof GetPayrollInputInstanceInputSchema >; -const GetPayrollInputInstanceResponseSchema = z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()); +const GetPayrollInputInstanceResponseSchema = z.union([ + z.object({}).catchall(z.unknown()), + z.array(z.unknown()), +]); export type GetPayrollInputInstanceResponse = z.infer< typeof GetPayrollInputInstanceResponseSchema >; @@ -770,10 +770,10 @@ export type GetProposedPositionValuesInput = z.infer< typeof GetProposedPositionValuesInputSchema >; -const GetProposedPositionValuesResponseSchema = z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()); +const GetProposedPositionValuesResponseSchema = z.union([ + z.object({}).catchall(z.unknown()), + z.array(z.unknown()), +]); export type GetProposedPositionValuesResponse = z.infer< typeof GetProposedPositionValuesResponseSchema >; @@ -783,10 +783,10 @@ const GetProspectInputSchema = z .passthrough(); export type GetProspectInput = z.infer; -const GetProspectResponseSchema = z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()); +const GetProspectResponseSchema = z.union([ + z.object({}).catchall(z.unknown()), + z.array(z.unknown()), +]); export type GetProspectResponse = z.infer; const GetProspectEducationsInputSchema = z @@ -796,10 +796,10 @@ export type GetProspectEducationsInput = z.infer< typeof GetProspectEducationsInputSchema >; -const GetProspectEducationsResponseSchema = z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()); +const GetProspectEducationsResponseSchema = z.union([ + z.object({}).catchall(z.unknown()), + z.array(z.unknown()), +]); export type GetProspectEducationsResponse = z.infer< typeof GetProspectEducationsResponseSchema >; @@ -811,10 +811,10 @@ export type GetProspectExperiencesInput = z.infer< typeof GetProspectExperiencesInputSchema >; -const GetProspectExperiencesResponseSchema = z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()); +const GetProspectExperiencesResponseSchema = z.union([ + z.object({}).catchall(z.unknown()), + z.array(z.unknown()), +]); export type GetProspectExperiencesResponse = z.infer< typeof GetProspectExperiencesResponseSchema >; @@ -826,10 +826,10 @@ export type GetProspectResumeAttachmentsInput = z.infer< typeof GetProspectResumeAttachmentsInputSchema >; -const GetProspectResumeAttachmentsResponseSchema = z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()); +const GetProspectResumeAttachmentsResponseSchema = z.union([ + z.object({}).catchall(z.unknown()), + z.array(z.unknown()), +]); export type GetProspectResumeAttachmentsResponse = z.infer< typeof GetProspectResumeAttachmentsResponseSchema >; @@ -841,10 +841,10 @@ export type GetProspectSkillsInput = z.infer< typeof GetProspectSkillsInputSchema >; -const GetProspectSkillsResponseSchema = z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()); +const GetProspectSkillsResponseSchema = z.union([ + z.object({}).catchall(z.unknown()), + z.array(z.unknown()), +]); export type GetProspectSkillsResponse = z.infer< typeof GetProspectSkillsResponseSchema >; @@ -856,10 +856,10 @@ export type GetSupervisoryOrgValuesInput = z.infer< typeof GetSupervisoryOrgValuesInputSchema >; -const GetSupervisoryOrgValuesResponseSchema = z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()); +const GetSupervisoryOrgValuesResponseSchema = z.union([ + z.object({}).catchall(z.unknown()), + z.array(z.unknown()), +]); export type GetSupervisoryOrgValuesResponse = z.infer< typeof GetSupervisoryOrgValuesResponseSchema >; @@ -871,10 +871,10 @@ export type GetTimeOffEntriesForWorkerInput = z.infer< typeof GetTimeOffEntriesForWorkerInputSchema >; -const GetTimeOffEntriesForWorkerResponseSchema = z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()); +const GetTimeOffEntriesForWorkerResponseSchema = z.union([ + z.object({}).catchall(z.unknown()), + z.array(z.unknown()), +]); export type GetTimeOffEntriesForWorkerResponse = z.infer< typeof GetTimeOffEntriesForWorkerResponseSchema >; @@ -886,10 +886,10 @@ export type GetTimeOffPlansForWorkerInput = z.infer< typeof GetTimeOffPlansForWorkerInputSchema >; -const GetTimeOffPlansForWorkerResponseSchema = z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()); +const GetTimeOffPlansForWorkerResponseSchema = z.union([ + z.object({}).catchall(z.unknown()), + z.array(z.unknown()), +]); export type GetTimeOffPlansForWorkerResponse = z.infer< typeof GetTimeOffPlansForWorkerResponseSchema >; @@ -901,10 +901,10 @@ export type GetTimeOffStatusValuesInput = z.infer< typeof GetTimeOffStatusValuesInputSchema >; -const GetTimeOffStatusValuesResponseSchema = z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()); +const GetTimeOffStatusValuesResponseSchema = z.union([ + z.object({}).catchall(z.unknown()), + z.array(z.unknown()), +]); export type GetTimeOffStatusValuesResponse = z.infer< typeof GetTimeOffStatusValuesResponseSchema >; @@ -914,10 +914,10 @@ const GetTimeTypesInputSchema = z .passthrough(); export type GetTimeTypesInput = z.infer; -const GetTimeTypesResponseSchema = z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()); +const GetTimeTypesResponseSchema = z.union([ + z.object({}).catchall(z.unknown()), + z.array(z.unknown()), +]); export type GetTimeTypesResponse = z.infer; const GetWorkStudyAwardsInputSchema = z @@ -927,10 +927,10 @@ export type GetWorkStudyAwardsInput = z.infer< typeof GetWorkStudyAwardsInputSchema >; -const GetWorkStudyAwardsResponseSchema = z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()); +const GetWorkStudyAwardsResponseSchema = z.union([ + z.object({}).catchall(z.unknown()), + z.array(z.unknown()), +]); export type GetWorkStudyAwardsResponse = z.infer< typeof GetWorkStudyAwardsResponseSchema >; @@ -942,10 +942,10 @@ export type GetWorkerBusinessTitleChangesInput = z.infer< typeof GetWorkerBusinessTitleChangesInputSchema >; -const GetWorkerBusinessTitleChangesResponseSchema = z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()); +const GetWorkerBusinessTitleChangesResponseSchema = z.union([ + z.object({}).catchall(z.unknown()), + z.array(z.unknown()), +]); export type GetWorkerBusinessTitleChangesResponse = z.infer< typeof GetWorkerBusinessTitleChangesResponseSchema >; @@ -957,10 +957,10 @@ export type GetWorkerEligibleAbsenceTypesInput = z.infer< typeof GetWorkerEligibleAbsenceTypesInputSchema >; -const GetWorkerEligibleAbsenceTypesResponseSchema = z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()); +const GetWorkerEligibleAbsenceTypesResponseSchema = z.union([ + z.object({}).catchall(z.unknown()), + z.array(z.unknown()), +]); export type GetWorkerEligibleAbsenceTypesResponse = z.infer< typeof GetWorkerEligibleAbsenceTypesResponseSchema >; @@ -970,10 +970,10 @@ const GetWorkerInfoInputSchema = z .passthrough(); export type GetWorkerInfoInput = z.infer; -const GetWorkerInfoResponseSchema = z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()); +const GetWorkerInfoResponseSchema = z.union([ + z.object({}).catchall(z.unknown()), + z.array(z.unknown()), +]); export type GetWorkerInfoResponse = z.infer; const GetWorkerLeavesOfAbsenceInputSchema = z @@ -983,10 +983,10 @@ export type GetWorkerLeavesOfAbsenceInput = z.infer< typeof GetWorkerLeavesOfAbsenceInputSchema >; -const GetWorkerLeavesOfAbsenceResponseSchema = z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()); +const GetWorkerLeavesOfAbsenceResponseSchema = z.union([ + z.object({}).catchall(z.unknown()), + z.array(z.unknown()), +]); export type GetWorkerLeavesOfAbsenceResponse = z.infer< typeof GetWorkerLeavesOfAbsenceResponseSchema >; @@ -998,10 +998,10 @@ export type GetWorkerServiceDatesInput = z.infer< typeof GetWorkerServiceDatesInputSchema >; -const GetWorkerServiceDatesResponseSchema = z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()); +const GetWorkerServiceDatesResponseSchema = z.union([ + z.object({}).catchall(z.unknown()), + z.array(z.unknown()), +]); export type GetWorkerServiceDatesResponse = z.infer< typeof GetWorkerServiceDatesResponseSchema >; @@ -1013,10 +1013,10 @@ export type GetWorkerStaffingInformationInput = z.infer< typeof GetWorkerStaffingInformationInputSchema >; -const GetWorkerStaffingInformationResponseSchema = z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()); +const GetWorkerStaffingInformationResponseSchema = z.union([ + z.object({}).catchall(z.unknown()), + z.array(z.unknown()), +]); export type GetWorkerStaffingInformationResponse = z.infer< typeof GetWorkerStaffingInformationResponseSchema >; @@ -1028,10 +1028,10 @@ export type GetWorkerTimeOffDetailsInput = z.infer< typeof GetWorkerTimeOffDetailsInputSchema >; -const GetWorkerTimeOffDetailsResponseSchema = z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()); +const GetWorkerTimeOffDetailsResponseSchema = z.union([ + z.object({}).catchall(z.unknown()), + z.array(z.unknown()), +]); export type GetWorkerTimeOffDetailsResponse = z.infer< typeof GetWorkerTimeOffDetailsResponseSchema >; @@ -1041,10 +1041,10 @@ const GetWorkerTypesInputSchema = z .passthrough(); export type GetWorkerTypesInput = z.infer; -const GetWorkerTypesResponseSchema = z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()); +const GetWorkerTypesResponseSchema = z.union([ + z.object({}).catchall(z.unknown()), + z.array(z.unknown()), +]); export type GetWorkerTypesResponse = z.infer< typeof GetWorkerTypesResponseSchema >; @@ -1056,10 +1056,10 @@ export type GetWorkerValidTimeOffDatesInput = z.infer< typeof GetWorkerValidTimeOffDatesInputSchema >; -const GetWorkerValidTimeOffDatesResponseSchema = z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()); +const GetWorkerValidTimeOffDatesResponseSchema = z.union([ + z.object({}).catchall(z.unknown()), + z.array(z.unknown()), +]); export type GetWorkerValidTimeOffDatesResponse = z.infer< typeof GetWorkerValidTimeOffDatesResponseSchema >; @@ -1071,10 +1071,10 @@ export type GetWorkersCollectionStaffingInput = z.infer< typeof GetWorkersCollectionStaffingInputSchema >; -const GetWorkersCollectionStaffingResponseSchema = z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()); +const GetWorkersCollectionStaffingResponseSchema = z.union([ + z.object({}).catchall(z.unknown()), + z.array(z.unknown()), +]); export type GetWorkersCollectionStaffingResponse = z.infer< typeof GetWorkersCollectionStaffingResponseSchema >; @@ -1086,10 +1086,10 @@ export type GetWorkspaceInstancesInput = z.infer< typeof GetWorkspaceInstancesInputSchema >; -const GetWorkspaceInstancesResponseSchema = z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()); +const GetWorkspaceInstancesResponseSchema = z.union([ + z.object({}).catchall(z.unknown()), + z.array(z.unknown()), +]); export type GetWorkspaceInstancesResponse = z.infer< typeof GetWorkspaceInstancesResponseSchema >; @@ -1099,10 +1099,10 @@ const ListBalancesInputSchema = z .passthrough(); export type ListBalancesInput = z.infer; -const ListBalancesResponseSchema = z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()); +const ListBalancesResponseSchema = z.union([ + z.object({}).catchall(z.unknown()), + z.array(z.unknown()), +]); export type ListBalancesResponse = z.infer; const ListCountriesInputSchema = z @@ -1110,10 +1110,10 @@ const ListCountriesInputSchema = z .passthrough(); export type ListCountriesInput = z.infer; -const ListCountriesResponseSchema = z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()); +const ListCountriesResponseSchema = z.union([ + z.object({}).catchall(z.unknown()), + z.array(z.unknown()), +]); export type ListCountriesResponse = z.infer; const ListInterviewsInputSchema = z @@ -1121,10 +1121,10 @@ const ListInterviewsInputSchema = z .passthrough(); export type ListInterviewsInput = z.infer; -const ListInterviewsResponseSchema = z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()); +const ListInterviewsResponseSchema = z.union([ + z.object({}).catchall(z.unknown()), + z.array(z.unknown()), +]); export type ListInterviewsResponse = z.infer< typeof ListInterviewsResponseSchema >; @@ -1134,10 +1134,10 @@ const ListJobPostingsInputSchema = z .passthrough(); export type ListJobPostingsInput = z.infer; -const ListJobPostingsResponseSchema = z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()); +const ListJobPostingsResponseSchema = z.union([ + z.object({}).catchall(z.unknown()), + z.array(z.unknown()), +]); export type ListJobPostingsResponse = z.infer< typeof ListJobPostingsResponseSchema >; @@ -1147,10 +1147,10 @@ const ListJobsInputSchema = z .passthrough(); export type ListJobsInput = z.infer; -const ListJobsResponseSchema = z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()); +const ListJobsResponseSchema = z.union([ + z.object({}).catchall(z.unknown()), + z.array(z.unknown()), +]); export type ListJobsResponse = z.infer; const RetrieveWorkerLeaveOfAbsenceSubresourceInputSchema = z @@ -1160,10 +1160,10 @@ export type RetrieveWorkerLeaveOfAbsenceSubresourceInput = z.infer< typeof RetrieveWorkerLeaveOfAbsenceSubresourceInputSchema >; -const RetrieveWorkerLeaveOfAbsenceSubresourceResponseSchema = z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()); +const RetrieveWorkerLeaveOfAbsenceSubresourceResponseSchema = z.union([ + z.object({}).catchall(z.unknown()), + z.array(z.unknown()), +]); export type RetrieveWorkerLeaveOfAbsenceSubresourceResponse = z.infer< typeof RetrieveWorkerLeaveOfAbsenceSubresourceResponseSchema >; @@ -1176,10 +1176,10 @@ export type UpdateAnExistingPayrollInput = z.infer< typeof UpdateAnExistingPayrollInputSchema >; -const UpdateAnExistingPayrollResponseSchema = z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()); +const UpdateAnExistingPayrollResponseSchema = z.union([ + z.object({}).catchall(z.unknown()), + z.array(z.unknown()), +]); export type UpdateAnExistingPayrollResponse = z.infer< typeof UpdateAnExistingPayrollResponseSchema >; @@ -1192,10 +1192,10 @@ export type UpdateJobChangeBusinessTitleInput = z.infer< typeof UpdateJobChangeBusinessTitleInputSchema >; -const UpdateJobChangeBusinessTitleResponseSchema = z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()); +const UpdateJobChangeBusinessTitleResponseSchema = z.union([ + z.object({}).catchall(z.unknown()), + z.array(z.unknown()), +]); export type UpdateJobChangeBusinessTitleResponse = z.infer< typeof UpdateJobChangeBusinessTitleResponseSchema >; @@ -1208,10 +1208,10 @@ export type UpdateMessageTemplateByIdInput = z.infer< typeof UpdateMessageTemplateByIdInputSchema >; -const UpdateMessageTemplateByIdResponseSchema = z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()); +const UpdateMessageTemplateByIdResponseSchema = z.union([ + z.object({}).catchall(z.unknown()), + z.array(z.unknown()), +]); export type UpdateMessageTemplateByIdResponse = z.infer< typeof UpdateMessageTemplateByIdResponseSchema >; From 75f15ead7cd6eb37ecdad0a1e4802e5ab7b6fdd4 Mon Sep 17 00:00:00 2001 From: Dhirender Choudhary Date: Wed, 22 Jul 2026 14:19:48 +0530 Subject: [PATCH 10/19] fix(workday): resolve remaining URL interpolation and missing justifications --- packages/workday/api.test.ts | 1 + packages/workday/endpoints/job.ts | 2 +- packages/workday/endpoints/types.ts | 850 ++++++++++++++++++++++------ 3 files changed, 682 insertions(+), 171 deletions(-) diff --git a/packages/workday/api.test.ts b/packages/workday/api.test.ts index 76281c1b5..f480e8a43 100644 --- a/packages/workday/api.test.ts +++ b/packages/workday/api.test.ts @@ -2,6 +2,7 @@ import { workday } from './index.js'; describe('Workday Plugin', () => { const mockFetch = jest.fn(); + // Justification: jest requires injecting fetch into global scope for tests. (globalThis as any).fetch = mockFetch; beforeEach(() => { diff --git a/packages/workday/endpoints/job.ts b/packages/workday/endpoints/job.ts index 95f2e7b14..9847d46d7 100644 --- a/packages/workday/endpoints/job.ts +++ b/packages/workday/endpoints/job.ts @@ -29,7 +29,7 @@ export const getJobById: WorkdayEndpoints['getJobById'] = async ( ) => { const response = await makeWorkdayRequest< WorkdayEndpointOutputs['getJobById'] - >('v1/job/getJobById/{id}', ctx.key, { + >(`v1/job/getJobById/${input?.id || ''}`, ctx.key, { method: 'GET', // Justification: The makeWorkdayRequest client expects a generic unknown record. query: input as { [key: string]: string | number | boolean | undefined }, diff --git a/packages/workday/endpoints/types.ts b/packages/workday/endpoints/types.ts index 5939295c3..01858b0d1 100644 --- a/packages/workday/endpoints/types.ts +++ b/packages/workday/endpoints/types.ts @@ -9,8 +9,14 @@ export type CreateBusinessTitleChangeInput = z.infer< >; const CreateBusinessTitleChangeResponseSchema = z.union([ - z.object({}).catchall(z.unknown()), - z.array(z.unknown()), + z + .object({}) + // Justification: Catching all unknown properties for forward-compatibility. + .catchall(z.unknown()), + z.array( + // Justification: Catching all unknown properties for forward-compatibility. + z.unknown(), + ), ]); export type CreateBusinessTitleChangeResponse = z.infer< typeof CreateBusinessTitleChangeResponseSchema @@ -23,8 +29,14 @@ const CreateJobChangeInputSchema = z export type CreateJobChangeInput = z.infer; const CreateJobChangeResponseSchema = z.union([ - z.object({}).catchall(z.unknown()), - z.array(z.unknown()), + z + .object({}) + // Justification: Catching all unknown properties for forward-compatibility. + .catchall(z.unknown()), + z.array( + // Justification: Catching all unknown properties for forward-compatibility. + z.unknown(), + ), ]); export type CreateJobChangeResponse = z.infer< typeof CreateJobChangeResponseSchema @@ -39,8 +51,14 @@ export type CreatePayrollInputsInput = z.infer< >; const CreatePayrollInputsResponseSchema = z.union([ - z.object({}).catchall(z.unknown()), - z.array(z.unknown()), + z + .object({}) + // Justification: Catching all unknown properties for forward-compatibility. + .catchall(z.unknown()), + z.array( + // Justification: Catching all unknown properties for forward-compatibility. + z.unknown(), + ), ]); export type CreatePayrollInputsResponse = z.infer< typeof CreatePayrollInputsResponseSchema @@ -55,8 +73,14 @@ export type CreateTimeOffRequestInput = z.infer< >; const CreateTimeOffRequestResponseSchema = z.union([ - z.object({}).catchall(z.unknown()), - z.array(z.unknown()), + z + .object({}) + // Justification: Catching all unknown properties for forward-compatibility. + .catchall(z.unknown()), + z.array( + // Justification: Catching all unknown properties for forward-compatibility. + z.unknown(), + ), ]); export type CreateTimeOffRequestResponse = z.infer< typeof CreateTimeOffRequestResponseSchema @@ -70,8 +94,14 @@ export type GetAbsenceBalanceInput = z.infer< >; const GetAbsenceBalanceResponseSchema = z.union([ - z.object({}).catchall(z.unknown()), - z.array(z.unknown()), + z + .object({}) + // Justification: Catching all unknown properties for forward-compatibility. + .catchall(z.unknown()), + z.array( + // Justification: Catching all unknown properties for forward-compatibility. + z.unknown(), + ), ]); export type GetAbsenceBalanceResponse = z.infer< typeof GetAbsenceBalanceResponseSchema @@ -85,8 +115,14 @@ export type GetAssignmentChangeGroupCostCentersInput = z.infer< >; const GetAssignmentChangeGroupCostCentersResponseSchema = z.union([ - z.object({}).catchall(z.unknown()), - z.array(z.unknown()), + z + .object({}) + // Justification: Catching all unknown properties for forward-compatibility. + .catchall(z.unknown()), + z.array( + // Justification: Catching all unknown properties for forward-compatibility. + z.unknown(), + ), ]); export type GetAssignmentChangeGroupCostCentersResponse = z.infer< typeof GetAssignmentChangeGroupCostCentersResponseSchema @@ -100,8 +136,14 @@ export type GetAssignmentChangeGroupJobsInput = z.infer< >; const GetAssignmentChangeGroupJobsResponseSchema = z.union([ - z.object({}).catchall(z.unknown()), - z.array(z.unknown()), + z + .object({}) + // Justification: Catching all unknown properties for forward-compatibility. + .catchall(z.unknown()), + z.array( + // Justification: Catching all unknown properties for forward-compatibility. + z.unknown(), + ), ]); export type GetAssignmentChangeGroupJobsResponse = z.infer< typeof GetAssignmentChangeGroupJobsResponseSchema @@ -115,8 +157,14 @@ export type GetAssignmentTypesInput = z.infer< >; const GetAssignmentTypesResponseSchema = z.union([ - z.object({}).catchall(z.unknown()), - z.array(z.unknown()), + z + .object({}) + // Justification: Catching all unknown properties for forward-compatibility. + .catchall(z.unknown()), + z.array( + // Justification: Catching all unknown properties for forward-compatibility. + z.unknown(), + ), ]); export type GetAssignmentTypesResponse = z.infer< typeof GetAssignmentTypesResponseSchema @@ -130,8 +178,14 @@ export type GetBusinessTitleChangeInput = z.infer< >; const GetBusinessTitleChangeResponseSchema = z.union([ - z.object({}).catchall(z.unknown()), - z.array(z.unknown()), + z + .object({}) + // Justification: Catching all unknown properties for forward-compatibility. + .catchall(z.unknown()), + z.array( + // Justification: Catching all unknown properties for forward-compatibility. + z.unknown(), + ), ]); export type GetBusinessTitleChangeResponse = z.infer< typeof GetBusinessTitleChangeResponseSchema @@ -145,8 +199,14 @@ export type GetBusinessTitleChangeForWorkerInput = z.infer< >; const GetBusinessTitleChangeForWorkerResponseSchema = z.union([ - z.object({}).catchall(z.unknown()), - z.array(z.unknown()), + z + .object({}) + // Justification: Catching all unknown properties for forward-compatibility. + .catchall(z.unknown()), + z.array( + // Justification: Catching all unknown properties for forward-compatibility. + z.unknown(), + ), ]); export type GetBusinessTitleChangeForWorkerResponse = z.infer< typeof GetBusinessTitleChangeForWorkerResponseSchema @@ -160,8 +220,14 @@ export type GetCandidateAvailabilityTemplateInput = z.infer< >; const GetCandidateAvailabilityTemplateResponseSchema = z.union([ - z.object({}).catchall(z.unknown()), - z.array(z.unknown()), + z + .object({}) + // Justification: Catching all unknown properties for forward-compatibility. + .catchall(z.unknown()), + z.array( + // Justification: Catching all unknown properties for forward-compatibility. + z.unknown(), + ), ]); export type GetCandidateAvailabilityTemplateResponse = z.infer< typeof GetCandidateAvailabilityTemplateResponseSchema @@ -175,8 +241,14 @@ export type GetCollectionOfJobsInput = z.infer< >; const GetCollectionOfJobsResponseSchema = z.union([ - z.object({}).catchall(z.unknown()), - z.array(z.unknown()), + z + .object({}) + // Justification: Catching all unknown properties for forward-compatibility. + .catchall(z.unknown()), + z.array( + // Justification: Catching all unknown properties for forward-compatibility. + z.unknown(), + ), ]); export type GetCollectionOfJobsResponse = z.infer< typeof GetCollectionOfJobsResponseSchema @@ -190,8 +262,14 @@ export type GetCollectionOfPayrollInput = z.infer< >; const GetCollectionOfPayrollResponseSchema = z.union([ - z.object({}).catchall(z.unknown()), - z.array(z.unknown()), + z + .object({}) + // Justification: Catching all unknown properties for forward-compatibility. + .catchall(z.unknown()), + z.array( + // Justification: Catching all unknown properties for forward-compatibility. + z.unknown(), + ), ]); export type GetCollectionOfPayrollResponse = z.infer< typeof GetCollectionOfPayrollResponseSchema @@ -205,8 +283,14 @@ export type GetCompanyInsiderTypesInput = z.infer< >; const GetCompanyInsiderTypesResponseSchema = z.union([ - z.object({}).catchall(z.unknown()), - z.array(z.unknown()), + z + .object({}) + // Justification: Catching all unknown properties for forward-compatibility. + .catchall(z.unknown()), + z.array( + // Justification: Catching all unknown properties for forward-compatibility. + z.unknown(), + ), ]); export type GetCompanyInsiderTypesResponse = z.infer< typeof GetCompanyInsiderTypesResponseSchema @@ -220,8 +304,14 @@ export type GetContingentWorkerTypesInput = z.infer< >; const GetContingentWorkerTypesResponseSchema = z.union([ - z.object({}).catchall(z.unknown()), - z.array(z.unknown()), + z + .object({}) + // Justification: Catching all unknown properties for forward-compatibility. + .catchall(z.unknown()), + z.array( + // Justification: Catching all unknown properties for forward-compatibility. + z.unknown(), + ), ]); export type GetContingentWorkerTypesResponse = z.infer< typeof GetContingentWorkerTypesResponseSchema @@ -233,8 +323,14 @@ const GetCountryInfoInputSchema = z export type GetCountryInfoInput = z.infer; const GetCountryInfoResponseSchema = z.union([ - z.object({}).catchall(z.unknown()), - z.array(z.unknown()), + z + .object({}) + // Justification: Catching all unknown properties for forward-compatibility. + .catchall(z.unknown()), + z.array( + // Justification: Catching all unknown properties for forward-compatibility. + z.unknown(), + ), ]); export type GetCountryInfoResponse = z.infer< typeof GetCountryInfoResponseSchema @@ -246,8 +342,14 @@ const GetCurrenciesInputSchema = z export type GetCurrenciesInput = z.infer; const GetCurrenciesResponseSchema = z.union([ - z.object({}).catchall(z.unknown()), - z.array(z.unknown()), + z + .object({}) + // Justification: Catching all unknown properties for forward-compatibility. + .catchall(z.unknown()), + z.array( + // Justification: Catching all unknown properties for forward-compatibility. + z.unknown(), + ), ]); export type GetCurrenciesResponse = z.infer; @@ -257,8 +359,14 @@ const GetCurrentUserInputSchema = z export type GetCurrentUserInput = z.infer; const GetCurrentUserResponseSchema = z.union([ - z.object({}).catchall(z.unknown()), - z.array(z.unknown()), + z + .object({}) + // Justification: Catching all unknown properties for forward-compatibility. + .catchall(z.unknown()), + z.array( + // Justification: Catching all unknown properties for forward-compatibility. + z.unknown(), + ), ]); export type GetCurrentUserResponse = z.infer< typeof GetCurrentUserResponseSchema @@ -270,8 +378,14 @@ const GetGrantsInputSchema = z export type GetGrantsInput = z.infer; const GetGrantsResponseSchema = z.union([ - z.object({}).catchall(z.unknown()), - z.array(z.unknown()), + z + .object({}) + // Justification: Catching all unknown properties for forward-compatibility. + .catchall(z.unknown()), + z.array( + // Justification: Catching all unknown properties for forward-compatibility. + z.unknown(), + ), ]); export type GetGrantsResponse = z.infer; @@ -283,8 +397,14 @@ export type GetHeadcountOptionsInput = z.infer< >; const GetHeadcountOptionsResponseSchema = z.union([ - z.object({}).catchall(z.unknown()), - z.array(z.unknown()), + z + .object({}) + // Justification: Catching all unknown properties for forward-compatibility. + .catchall(z.unknown()), + z.array( + // Justification: Catching all unknown properties for forward-compatibility. + z.unknown(), + ), ]); export type GetHeadcountOptionsResponse = z.infer< typeof GetHeadcountOptionsResponseSchema @@ -298,8 +418,14 @@ export type GetHistoryInstanceForWorkerInput = z.infer< >; const GetHistoryInstanceForWorkerResponseSchema = z.union([ - z.object({}).catchall(z.unknown()), - z.array(z.unknown()), + z + .object({}) + // Justification: Catching all unknown properties for forward-compatibility. + .catchall(z.unknown()), + z.array( + // Justification: Catching all unknown properties for forward-compatibility. + z.unknown(), + ), ]); export type GetHistoryInstanceForWorkerResponse = z.infer< typeof GetHistoryInstanceForWorkerResponseSchema @@ -313,8 +439,14 @@ export type GetHistoryItemsForWorkerInput = z.infer< >; const GetHistoryItemsForWorkerResponseSchema = z.union([ - z.object({}).catchall(z.unknown()), - z.array(z.unknown()), + z + .object({}) + // Justification: Catching all unknown properties for forward-compatibility. + .catchall(z.unknown()), + z.array( + // Justification: Catching all unknown properties for forward-compatibility. + z.unknown(), + ), ]); export type GetHistoryItemsForWorkerResponse = z.infer< typeof GetHistoryItemsForWorkerResponseSchema @@ -326,8 +458,14 @@ const GetHolidayEventsInputSchema = z export type GetHolidayEventsInput = z.infer; const GetHolidayEventsResponseSchema = z.union([ - z.object({}).catchall(z.unknown()), - z.array(z.unknown()), + z + .object({}) + // Justification: Catching all unknown properties for forward-compatibility. + .catchall(z.unknown()), + z.array( + // Justification: Catching all unknown properties for forward-compatibility. + z.unknown(), + ), ]); export type GetHolidayEventsResponse = z.infer< typeof GetHolidayEventsResponseSchema @@ -339,8 +477,14 @@ const GetInterviewInputSchema = z export type GetInterviewInput = z.infer; const GetInterviewResponseSchema = z.union([ - z.object({}).catchall(z.unknown()), - z.array(z.unknown()), + z + .object({}) + // Justification: Catching all unknown properties for forward-compatibility. + .catchall(z.unknown()), + z.array( + // Justification: Catching all unknown properties for forward-compatibility. + z.unknown(), + ), ]); export type GetInterviewResponse = z.infer; @@ -352,8 +496,14 @@ export type GetInterviewFeedback2Input = z.infer< >; const GetInterviewFeedback2ResponseSchema = z.union([ - z.object({}).catchall(z.unknown()), - z.array(z.unknown()), + z + .object({}) + // Justification: Catching all unknown properties for forward-compatibility. + .catchall(z.unknown()), + z.array( + // Justification: Catching all unknown properties for forward-compatibility. + z.unknown(), + ), ]); export type GetInterviewFeedback2Response = z.infer< typeof GetInterviewFeedback2ResponseSchema @@ -363,8 +513,14 @@ const GetJobByIdInputSchema = z.object({ id: z.string() }); export type GetJobByIdInput = z.infer; const GetJobByIdResponseSchema = z.union([ - z.object({}).catchall(z.unknown()), - z.array(z.unknown()), + z + .object({}) + // Justification: Catching all unknown properties for forward-compatibility. + .catchall(z.unknown()), + z.array( + // Justification: Catching all unknown properties for forward-compatibility. + z.unknown(), + ), ]); export type GetJobByIdResponse = z.infer; @@ -376,8 +532,14 @@ export type GetJobChangeFrequenciesInput = z.infer< >; const GetJobChangeFrequenciesResponseSchema = z.union([ - z.object({}).catchall(z.unknown()), - z.array(z.unknown()), + z + .object({}) + // Justification: Catching all unknown properties for forward-compatibility. + .catchall(z.unknown()), + z.array( + // Justification: Catching all unknown properties for forward-compatibility. + z.unknown(), + ), ]); export type GetJobChangeFrequenciesResponse = z.infer< typeof GetJobChangeFrequenciesResponseSchema @@ -391,8 +553,14 @@ export type GetJobChangeLocationInfoInput = z.infer< >; const GetJobChangeLocationInfoResponseSchema = z.union([ - z.object({}).catchall(z.unknown()), - z.array(z.unknown()), + z + .object({}) + // Justification: Catching all unknown properties for forward-compatibility. + .catchall(z.unknown()), + z.array( + // Justification: Catching all unknown properties for forward-compatibility. + z.unknown(), + ), ]); export type GetJobChangeLocationInfoResponse = z.infer< typeof GetJobChangeLocationInfoResponseSchema @@ -406,8 +574,14 @@ export type GetJobChangePositionInput = z.infer< >; const GetJobChangePositionResponseSchema = z.union([ - z.object({}).catchall(z.unknown()), - z.array(z.unknown()), + z + .object({}) + // Justification: Catching all unknown properties for forward-compatibility. + .catchall(z.unknown()), + z.array( + // Justification: Catching all unknown properties for forward-compatibility. + z.unknown(), + ), ]); export type GetJobChangePositionResponse = z.infer< typeof GetJobChangePositionResponseSchema @@ -421,8 +595,14 @@ export type GetJobChangeReasonInstanceInput = z.infer< >; const GetJobChangeReasonInstanceResponseSchema = z.union([ - z.object({}).catchall(z.unknown()), - z.array(z.unknown()), + z + .object({}) + // Justification: Catching all unknown properties for forward-compatibility. + .catchall(z.unknown()), + z.array( + // Justification: Catching all unknown properties for forward-compatibility. + z.unknown(), + ), ]); export type GetJobChangeReasonInstanceResponse = z.infer< typeof GetJobChangeReasonInstanceResponseSchema @@ -436,8 +616,14 @@ export type GetJobChangeReasonValuesInput = z.infer< >; const GetJobChangeReasonValuesResponseSchema = z.union([ - z.object({}).catchall(z.unknown()), - z.array(z.unknown()), + z + .object({}) + // Justification: Catching all unknown properties for forward-compatibility. + .catchall(z.unknown()), + z.array( + // Justification: Catching all unknown properties for forward-compatibility. + z.unknown(), + ), ]); export type GetJobChangeReasonValuesResponse = z.infer< typeof GetJobChangeReasonValuesResponseSchema @@ -451,8 +637,14 @@ export type GetJobChangeReasonsInput = z.infer< >; const GetJobChangeReasonsResponseSchema = z.union([ - z.object({}).catchall(z.unknown()), - z.array(z.unknown()), + z + .object({}) + // Justification: Catching all unknown properties for forward-compatibility. + .catchall(z.unknown()), + z.array( + // Justification: Catching all unknown properties for forward-compatibility. + z.unknown(), + ), ]); export type GetJobChangeReasonsResponse = z.infer< typeof GetJobChangeReasonsResponseSchema @@ -466,8 +658,14 @@ export type GetJobChangesGroupTemplatesInput = z.infer< >; const GetJobChangesGroupTemplatesResponseSchema = z.union([ - z.object({}).catchall(z.unknown()), - z.array(z.unknown()), + z + .object({}) + // Justification: Catching all unknown properties for forward-compatibility. + .catchall(z.unknown()), + z.array( + // Justification: Catching all unknown properties for forward-compatibility. + z.unknown(), + ), ]); export type GetJobChangesGroupTemplatesResponse = z.infer< typeof GetJobChangesGroupTemplatesResponseSchema @@ -481,8 +679,14 @@ export type GetJobChangesJobValuesInput = z.infer< >; const GetJobChangesJobValuesResponseSchema = z.union([ - z.object({}).catchall(z.unknown()), - z.array(z.unknown()), + z + .object({}) + // Justification: Catching all unknown properties for forward-compatibility. + .catchall(z.unknown()), + z.array( + // Justification: Catching all unknown properties for forward-compatibility. + z.unknown(), + ), ]); export type GetJobChangesJobValuesResponse = z.infer< typeof GetJobChangesJobValuesResponseSchema @@ -496,8 +700,14 @@ export type GetJobChangesWorkerValuesInput = z.infer< >; const GetJobChangesWorkerValuesResponseSchema = z.union([ - z.object({}).catchall(z.unknown()), - z.array(z.unknown()), + z + .object({}) + // Justification: Catching all unknown properties for forward-compatibility. + .catchall(z.unknown()), + z.array( + // Justification: Catching all unknown properties for forward-compatibility. + z.unknown(), + ), ]); export type GetJobChangesWorkerValuesResponse = z.infer< typeof GetJobChangesWorkerValuesResponseSchema @@ -511,8 +721,14 @@ export type GetJobClassificationsInput = z.infer< >; const GetJobClassificationsResponseSchema = z.union([ - z.object({}).catchall(z.unknown()), - z.array(z.unknown()), + z + .object({}) + // Justification: Catching all unknown properties for forward-compatibility. + .catchall(z.unknown()), + z.array( + // Justification: Catching all unknown properties for forward-compatibility. + z.unknown(), + ), ]); export type GetJobClassificationsResponse = z.infer< typeof GetJobClassificationsResponseSchema @@ -524,8 +740,14 @@ const GetJobPostingInputSchema = z export type GetJobPostingInput = z.infer; const GetJobPostingResponseSchema = z.union([ - z.object({}).catchall(z.unknown()), - z.array(z.unknown()), + z + .object({}) + // Justification: Catching all unknown properties for forward-compatibility. + .catchall(z.unknown()), + z.array( + // Justification: Catching all unknown properties for forward-compatibility. + z.unknown(), + ), ]); export type GetJobPostingResponse = z.infer; @@ -537,8 +759,14 @@ export type GetJobPostingQuestionnaireInput = z.infer< >; const GetJobPostingQuestionnaireResponseSchema = z.union([ - z.object({}).catchall(z.unknown()), - z.array(z.unknown()), + z + .object({}) + // Justification: Catching all unknown properties for forward-compatibility. + .catchall(z.unknown()), + z.array( + // Justification: Catching all unknown properties for forward-compatibility. + z.unknown(), + ), ]); export type GetJobPostingQuestionnaireResponse = z.infer< typeof GetJobPostingQuestionnaireResponseSchema @@ -552,8 +780,14 @@ export type GetJobProfilesValuesInput = z.infer< >; const GetJobProfilesValuesResponseSchema = z.union([ - z.object({}).catchall(z.unknown()), - z.array(z.unknown()), + z + .object({}) + // Justification: Catching all unknown properties for forward-compatibility. + .catchall(z.unknown()), + z.array( + // Justification: Catching all unknown properties for forward-compatibility. + z.unknown(), + ), ]); export type GetJobProfilesValuesResponse = z.infer< typeof GetJobProfilesValuesResponseSchema @@ -567,8 +801,14 @@ export type GetJobRequisitionValuesInput = z.infer< >; const GetJobRequisitionValuesResponseSchema = z.union([ - z.object({}).catchall(z.unknown()), - z.array(z.unknown()), + z + .object({}) + // Justification: Catching all unknown properties for forward-compatibility. + .catchall(z.unknown()), + z.array( + // Justification: Catching all unknown properties for forward-compatibility. + z.unknown(), + ), ]); export type GetJobRequisitionValuesResponse = z.infer< typeof GetJobRequisitionValuesResponseSchema @@ -580,8 +820,14 @@ const GetJobWorkspaceInputSchema = z export type GetJobWorkspaceInput = z.infer; const GetJobWorkspaceResponseSchema = z.union([ - z.object({}).catchall(z.unknown()), - z.array(z.unknown()), + z + .object({}) + // Justification: Catching all unknown properties for forward-compatibility. + .catchall(z.unknown()), + z.array( + // Justification: Catching all unknown properties for forward-compatibility. + z.unknown(), + ), ]); export type GetJobWorkspaceResponse = z.infer< typeof GetJobWorkspaceResponseSchema @@ -593,8 +839,14 @@ const GetJobWorkspacesInputSchema = z export type GetJobWorkspacesInput = z.infer; const GetJobWorkspacesResponseSchema = z.union([ - z.object({}).catchall(z.unknown()), - z.array(z.unknown()), + z + .object({}) + // Justification: Catching all unknown properties for forward-compatibility. + .catchall(z.unknown()), + z.array( + // Justification: Catching all unknown properties for forward-compatibility. + z.unknown(), + ), ]); export type GetJobWorkspacesResponse = z.infer< typeof GetJobWorkspacesResponseSchema @@ -608,8 +860,14 @@ export type GetLeaveStatusValuesInput = z.infer< >; const GetLeaveStatusValuesResponseSchema = z.union([ - z.object({}).catchall(z.unknown()), - z.array(z.unknown()), + z + .object({}) + // Justification: Catching all unknown properties for forward-compatibility. + .catchall(z.unknown()), + z.array( + // Justification: Catching all unknown properties for forward-compatibility. + z.unknown(), + ), ]); export type GetLeaveStatusValuesResponse = z.infer< typeof GetLeaveStatusValuesResponseSchema @@ -621,8 +879,14 @@ const GetMyJobPostingsInputSchema = z export type GetMyJobPostingsInput = z.infer; const GetMyJobPostingsResponseSchema = z.union([ - z.object({}).catchall(z.unknown()), - z.array(z.unknown()), + z + .object({}) + // Justification: Catching all unknown properties for forward-compatibility. + .catchall(z.unknown()), + z.array( + // Justification: Catching all unknown properties for forward-compatibility. + z.unknown(), + ), ]); export type GetMyJobPostingsResponse = z.infer< typeof GetMyJobPostingsResponseSchema @@ -636,8 +900,14 @@ export type GetOrganizationAssignmentBusinessUnitsInput = z.infer< >; const GetOrganizationAssignmentBusinessUnitsResponseSchema = z.union([ - z.object({}).catchall(z.unknown()), - z.array(z.unknown()), + z + .object({}) + // Justification: Catching all unknown properties for forward-compatibility. + .catchall(z.unknown()), + z.array( + // Justification: Catching all unknown properties for forward-compatibility. + z.unknown(), + ), ]); export type GetOrganizationAssignmentBusinessUnitsResponse = z.infer< typeof GetOrganizationAssignmentBusinessUnitsResponseSchema @@ -651,8 +921,14 @@ export type GetOrganizationAssignmentCustomsInput = z.infer< >; const GetOrganizationAssignmentCustomsResponseSchema = z.union([ - z.object({}).catchall(z.unknown()), - z.array(z.unknown()), + z + .object({}) + // Justification: Catching all unknown properties for forward-compatibility. + .catchall(z.unknown()), + z.array( + // Justification: Catching all unknown properties for forward-compatibility. + z.unknown(), + ), ]); export type GetOrganizationAssignmentCustomsResponse = z.infer< typeof GetOrganizationAssignmentCustomsResponseSchema @@ -666,8 +942,14 @@ export type GetOrganizationAssignmentFundsInput = z.infer< >; const GetOrganizationAssignmentFundsResponseSchema = z.union([ - z.object({}).catchall(z.unknown()), - z.array(z.unknown()), + z + .object({}) + // Justification: Catching all unknown properties for forward-compatibility. + .catchall(z.unknown()), + z.array( + // Justification: Catching all unknown properties for forward-compatibility. + z.unknown(), + ), ]); export type GetOrganizationAssignmentFundsResponse = z.infer< typeof GetOrganizationAssignmentFundsResponseSchema @@ -681,8 +963,14 @@ export type GetOrganizationAssignmentRegionsInput = z.infer< >; const GetOrganizationAssignmentRegionsResponseSchema = z.union([ - z.object({}).catchall(z.unknown()), - z.array(z.unknown()), + z + .object({}) + // Justification: Catching all unknown properties for forward-compatibility. + .catchall(z.unknown()), + z.array( + // Justification: Catching all unknown properties for forward-compatibility. + z.unknown(), + ), ]); export type GetOrganizationAssignmentRegionsResponse = z.infer< typeof GetOrganizationAssignmentRegionsResponseSchema @@ -696,8 +984,14 @@ export type GetOrganizationAssignmentWorkersInput = z.infer< >; const GetOrganizationAssignmentWorkersResponseSchema = z.union([ - z.object({}).catchall(z.unknown()), - z.array(z.unknown()), + z + .object({}) + // Justification: Catching all unknown properties for forward-compatibility. + .catchall(z.unknown()), + z.array( + // Justification: Catching all unknown properties for forward-compatibility. + z.unknown(), + ), ]); export type GetOrganizationAssignmentWorkersResponse = z.infer< typeof GetOrganizationAssignmentWorkersResponseSchema @@ -711,8 +1005,14 @@ export type GetPayGroupByJobIdInput = z.infer< >; const GetPayGroupByJobIdResponseSchema = z.union([ - z.object({}).catchall(z.unknown()), - z.array(z.unknown()), + z + .object({}) + // Justification: Catching all unknown properties for forward-compatibility. + .catchall(z.unknown()), + z.array( + // Justification: Catching all unknown properties for forward-compatibility. + z.unknown(), + ), ]); export type GetPayGroupByJobIdResponse = z.infer< typeof GetPayGroupByJobIdResponseSchema @@ -726,8 +1026,14 @@ export type GetPaySlipInstancesForWorkerInput = z.infer< >; const GetPaySlipInstancesForWorkerResponseSchema = z.union([ - z.object({}).catchall(z.unknown()), - z.array(z.unknown()), + z + .object({}) + // Justification: Catching all unknown properties for forward-compatibility. + .catchall(z.unknown()), + z.array( + // Justification: Catching all unknown properties for forward-compatibility. + z.unknown(), + ), ]); export type GetPaySlipInstancesForWorkerResponse = z.infer< typeof GetPaySlipInstancesForWorkerResponseSchema @@ -741,8 +1047,14 @@ export type GetPaySlipsForWorkerInput = z.infer< >; const GetPaySlipsForWorkerResponseSchema = z.union([ - z.object({}).catchall(z.unknown()), - z.array(z.unknown()), + z + .object({}) + // Justification: Catching all unknown properties for forward-compatibility. + .catchall(z.unknown()), + z.array( + // Justification: Catching all unknown properties for forward-compatibility. + z.unknown(), + ), ]); export type GetPaySlipsForWorkerResponse = z.infer< typeof GetPaySlipsForWorkerResponseSchema @@ -756,8 +1068,14 @@ export type GetPayrollInputInstanceInput = z.infer< >; const GetPayrollInputInstanceResponseSchema = z.union([ - z.object({}).catchall(z.unknown()), - z.array(z.unknown()), + z + .object({}) + // Justification: Catching all unknown properties for forward-compatibility. + .catchall(z.unknown()), + z.array( + // Justification: Catching all unknown properties for forward-compatibility. + z.unknown(), + ), ]); export type GetPayrollInputInstanceResponse = z.infer< typeof GetPayrollInputInstanceResponseSchema @@ -771,8 +1089,14 @@ export type GetProposedPositionValuesInput = z.infer< >; const GetProposedPositionValuesResponseSchema = z.union([ - z.object({}).catchall(z.unknown()), - z.array(z.unknown()), + z + .object({}) + // Justification: Catching all unknown properties for forward-compatibility. + .catchall(z.unknown()), + z.array( + // Justification: Catching all unknown properties for forward-compatibility. + z.unknown(), + ), ]); export type GetProposedPositionValuesResponse = z.infer< typeof GetProposedPositionValuesResponseSchema @@ -784,8 +1108,14 @@ const GetProspectInputSchema = z export type GetProspectInput = z.infer; const GetProspectResponseSchema = z.union([ - z.object({}).catchall(z.unknown()), - z.array(z.unknown()), + z + .object({}) + // Justification: Catching all unknown properties for forward-compatibility. + .catchall(z.unknown()), + z.array( + // Justification: Catching all unknown properties for forward-compatibility. + z.unknown(), + ), ]); export type GetProspectResponse = z.infer; @@ -797,8 +1127,14 @@ export type GetProspectEducationsInput = z.infer< >; const GetProspectEducationsResponseSchema = z.union([ - z.object({}).catchall(z.unknown()), - z.array(z.unknown()), + z + .object({}) + // Justification: Catching all unknown properties for forward-compatibility. + .catchall(z.unknown()), + z.array( + // Justification: Catching all unknown properties for forward-compatibility. + z.unknown(), + ), ]); export type GetProspectEducationsResponse = z.infer< typeof GetProspectEducationsResponseSchema @@ -812,8 +1148,14 @@ export type GetProspectExperiencesInput = z.infer< >; const GetProspectExperiencesResponseSchema = z.union([ - z.object({}).catchall(z.unknown()), - z.array(z.unknown()), + z + .object({}) + // Justification: Catching all unknown properties for forward-compatibility. + .catchall(z.unknown()), + z.array( + // Justification: Catching all unknown properties for forward-compatibility. + z.unknown(), + ), ]); export type GetProspectExperiencesResponse = z.infer< typeof GetProspectExperiencesResponseSchema @@ -827,8 +1169,14 @@ export type GetProspectResumeAttachmentsInput = z.infer< >; const GetProspectResumeAttachmentsResponseSchema = z.union([ - z.object({}).catchall(z.unknown()), - z.array(z.unknown()), + z + .object({}) + // Justification: Catching all unknown properties for forward-compatibility. + .catchall(z.unknown()), + z.array( + // Justification: Catching all unknown properties for forward-compatibility. + z.unknown(), + ), ]); export type GetProspectResumeAttachmentsResponse = z.infer< typeof GetProspectResumeAttachmentsResponseSchema @@ -842,8 +1190,14 @@ export type GetProspectSkillsInput = z.infer< >; const GetProspectSkillsResponseSchema = z.union([ - z.object({}).catchall(z.unknown()), - z.array(z.unknown()), + z + .object({}) + // Justification: Catching all unknown properties for forward-compatibility. + .catchall(z.unknown()), + z.array( + // Justification: Catching all unknown properties for forward-compatibility. + z.unknown(), + ), ]); export type GetProspectSkillsResponse = z.infer< typeof GetProspectSkillsResponseSchema @@ -857,8 +1211,14 @@ export type GetSupervisoryOrgValuesInput = z.infer< >; const GetSupervisoryOrgValuesResponseSchema = z.union([ - z.object({}).catchall(z.unknown()), - z.array(z.unknown()), + z + .object({}) + // Justification: Catching all unknown properties for forward-compatibility. + .catchall(z.unknown()), + z.array( + // Justification: Catching all unknown properties for forward-compatibility. + z.unknown(), + ), ]); export type GetSupervisoryOrgValuesResponse = z.infer< typeof GetSupervisoryOrgValuesResponseSchema @@ -872,8 +1232,14 @@ export type GetTimeOffEntriesForWorkerInput = z.infer< >; const GetTimeOffEntriesForWorkerResponseSchema = z.union([ - z.object({}).catchall(z.unknown()), - z.array(z.unknown()), + z + .object({}) + // Justification: Catching all unknown properties for forward-compatibility. + .catchall(z.unknown()), + z.array( + // Justification: Catching all unknown properties for forward-compatibility. + z.unknown(), + ), ]); export type GetTimeOffEntriesForWorkerResponse = z.infer< typeof GetTimeOffEntriesForWorkerResponseSchema @@ -887,8 +1253,14 @@ export type GetTimeOffPlansForWorkerInput = z.infer< >; const GetTimeOffPlansForWorkerResponseSchema = z.union([ - z.object({}).catchall(z.unknown()), - z.array(z.unknown()), + z + .object({}) + // Justification: Catching all unknown properties for forward-compatibility. + .catchall(z.unknown()), + z.array( + // Justification: Catching all unknown properties for forward-compatibility. + z.unknown(), + ), ]); export type GetTimeOffPlansForWorkerResponse = z.infer< typeof GetTimeOffPlansForWorkerResponseSchema @@ -902,8 +1274,14 @@ export type GetTimeOffStatusValuesInput = z.infer< >; const GetTimeOffStatusValuesResponseSchema = z.union([ - z.object({}).catchall(z.unknown()), - z.array(z.unknown()), + z + .object({}) + // Justification: Catching all unknown properties for forward-compatibility. + .catchall(z.unknown()), + z.array( + // Justification: Catching all unknown properties for forward-compatibility. + z.unknown(), + ), ]); export type GetTimeOffStatusValuesResponse = z.infer< typeof GetTimeOffStatusValuesResponseSchema @@ -915,8 +1293,14 @@ const GetTimeTypesInputSchema = z export type GetTimeTypesInput = z.infer; const GetTimeTypesResponseSchema = z.union([ - z.object({}).catchall(z.unknown()), - z.array(z.unknown()), + z + .object({}) + // Justification: Catching all unknown properties for forward-compatibility. + .catchall(z.unknown()), + z.array( + // Justification: Catching all unknown properties for forward-compatibility. + z.unknown(), + ), ]); export type GetTimeTypesResponse = z.infer; @@ -928,8 +1312,14 @@ export type GetWorkStudyAwardsInput = z.infer< >; const GetWorkStudyAwardsResponseSchema = z.union([ - z.object({}).catchall(z.unknown()), - z.array(z.unknown()), + z + .object({}) + // Justification: Catching all unknown properties for forward-compatibility. + .catchall(z.unknown()), + z.array( + // Justification: Catching all unknown properties for forward-compatibility. + z.unknown(), + ), ]); export type GetWorkStudyAwardsResponse = z.infer< typeof GetWorkStudyAwardsResponseSchema @@ -943,8 +1333,14 @@ export type GetWorkerBusinessTitleChangesInput = z.infer< >; const GetWorkerBusinessTitleChangesResponseSchema = z.union([ - z.object({}).catchall(z.unknown()), - z.array(z.unknown()), + z + .object({}) + // Justification: Catching all unknown properties for forward-compatibility. + .catchall(z.unknown()), + z.array( + // Justification: Catching all unknown properties for forward-compatibility. + z.unknown(), + ), ]); export type GetWorkerBusinessTitleChangesResponse = z.infer< typeof GetWorkerBusinessTitleChangesResponseSchema @@ -958,8 +1354,14 @@ export type GetWorkerEligibleAbsenceTypesInput = z.infer< >; const GetWorkerEligibleAbsenceTypesResponseSchema = z.union([ - z.object({}).catchall(z.unknown()), - z.array(z.unknown()), + z + .object({}) + // Justification: Catching all unknown properties for forward-compatibility. + .catchall(z.unknown()), + z.array( + // Justification: Catching all unknown properties for forward-compatibility. + z.unknown(), + ), ]); export type GetWorkerEligibleAbsenceTypesResponse = z.infer< typeof GetWorkerEligibleAbsenceTypesResponseSchema @@ -971,8 +1373,14 @@ const GetWorkerInfoInputSchema = z export type GetWorkerInfoInput = z.infer; const GetWorkerInfoResponseSchema = z.union([ - z.object({}).catchall(z.unknown()), - z.array(z.unknown()), + z + .object({}) + // Justification: Catching all unknown properties for forward-compatibility. + .catchall(z.unknown()), + z.array( + // Justification: Catching all unknown properties for forward-compatibility. + z.unknown(), + ), ]); export type GetWorkerInfoResponse = z.infer; @@ -984,8 +1392,14 @@ export type GetWorkerLeavesOfAbsenceInput = z.infer< >; const GetWorkerLeavesOfAbsenceResponseSchema = z.union([ - z.object({}).catchall(z.unknown()), - z.array(z.unknown()), + z + .object({}) + // Justification: Catching all unknown properties for forward-compatibility. + .catchall(z.unknown()), + z.array( + // Justification: Catching all unknown properties for forward-compatibility. + z.unknown(), + ), ]); export type GetWorkerLeavesOfAbsenceResponse = z.infer< typeof GetWorkerLeavesOfAbsenceResponseSchema @@ -999,8 +1413,14 @@ export type GetWorkerServiceDatesInput = z.infer< >; const GetWorkerServiceDatesResponseSchema = z.union([ - z.object({}).catchall(z.unknown()), - z.array(z.unknown()), + z + .object({}) + // Justification: Catching all unknown properties for forward-compatibility. + .catchall(z.unknown()), + z.array( + // Justification: Catching all unknown properties for forward-compatibility. + z.unknown(), + ), ]); export type GetWorkerServiceDatesResponse = z.infer< typeof GetWorkerServiceDatesResponseSchema @@ -1014,8 +1434,14 @@ export type GetWorkerStaffingInformationInput = z.infer< >; const GetWorkerStaffingInformationResponseSchema = z.union([ - z.object({}).catchall(z.unknown()), - z.array(z.unknown()), + z + .object({}) + // Justification: Catching all unknown properties for forward-compatibility. + .catchall(z.unknown()), + z.array( + // Justification: Catching all unknown properties for forward-compatibility. + z.unknown(), + ), ]); export type GetWorkerStaffingInformationResponse = z.infer< typeof GetWorkerStaffingInformationResponseSchema @@ -1029,8 +1455,14 @@ export type GetWorkerTimeOffDetailsInput = z.infer< >; const GetWorkerTimeOffDetailsResponseSchema = z.union([ - z.object({}).catchall(z.unknown()), - z.array(z.unknown()), + z + .object({}) + // Justification: Catching all unknown properties for forward-compatibility. + .catchall(z.unknown()), + z.array( + // Justification: Catching all unknown properties for forward-compatibility. + z.unknown(), + ), ]); export type GetWorkerTimeOffDetailsResponse = z.infer< typeof GetWorkerTimeOffDetailsResponseSchema @@ -1042,8 +1474,14 @@ const GetWorkerTypesInputSchema = z export type GetWorkerTypesInput = z.infer; const GetWorkerTypesResponseSchema = z.union([ - z.object({}).catchall(z.unknown()), - z.array(z.unknown()), + z + .object({}) + // Justification: Catching all unknown properties for forward-compatibility. + .catchall(z.unknown()), + z.array( + // Justification: Catching all unknown properties for forward-compatibility. + z.unknown(), + ), ]); export type GetWorkerTypesResponse = z.infer< typeof GetWorkerTypesResponseSchema @@ -1057,8 +1495,14 @@ export type GetWorkerValidTimeOffDatesInput = z.infer< >; const GetWorkerValidTimeOffDatesResponseSchema = z.union([ - z.object({}).catchall(z.unknown()), - z.array(z.unknown()), + z + .object({}) + // Justification: Catching all unknown properties for forward-compatibility. + .catchall(z.unknown()), + z.array( + // Justification: Catching all unknown properties for forward-compatibility. + z.unknown(), + ), ]); export type GetWorkerValidTimeOffDatesResponse = z.infer< typeof GetWorkerValidTimeOffDatesResponseSchema @@ -1072,8 +1516,14 @@ export type GetWorkersCollectionStaffingInput = z.infer< >; const GetWorkersCollectionStaffingResponseSchema = z.union([ - z.object({}).catchall(z.unknown()), - z.array(z.unknown()), + z + .object({}) + // Justification: Catching all unknown properties for forward-compatibility. + .catchall(z.unknown()), + z.array( + // Justification: Catching all unknown properties for forward-compatibility. + z.unknown(), + ), ]); export type GetWorkersCollectionStaffingResponse = z.infer< typeof GetWorkersCollectionStaffingResponseSchema @@ -1087,8 +1537,14 @@ export type GetWorkspaceInstancesInput = z.infer< >; const GetWorkspaceInstancesResponseSchema = z.union([ - z.object({}).catchall(z.unknown()), - z.array(z.unknown()), + z + .object({}) + // Justification: Catching all unknown properties for forward-compatibility. + .catchall(z.unknown()), + z.array( + // Justification: Catching all unknown properties for forward-compatibility. + z.unknown(), + ), ]); export type GetWorkspaceInstancesResponse = z.infer< typeof GetWorkspaceInstancesResponseSchema @@ -1100,8 +1556,14 @@ const ListBalancesInputSchema = z export type ListBalancesInput = z.infer; const ListBalancesResponseSchema = z.union([ - z.object({}).catchall(z.unknown()), - z.array(z.unknown()), + z + .object({}) + // Justification: Catching all unknown properties for forward-compatibility. + .catchall(z.unknown()), + z.array( + // Justification: Catching all unknown properties for forward-compatibility. + z.unknown(), + ), ]); export type ListBalancesResponse = z.infer; @@ -1111,8 +1573,14 @@ const ListCountriesInputSchema = z export type ListCountriesInput = z.infer; const ListCountriesResponseSchema = z.union([ - z.object({}).catchall(z.unknown()), - z.array(z.unknown()), + z + .object({}) + // Justification: Catching all unknown properties for forward-compatibility. + .catchall(z.unknown()), + z.array( + // Justification: Catching all unknown properties for forward-compatibility. + z.unknown(), + ), ]); export type ListCountriesResponse = z.infer; @@ -1122,8 +1590,14 @@ const ListInterviewsInputSchema = z export type ListInterviewsInput = z.infer; const ListInterviewsResponseSchema = z.union([ - z.object({}).catchall(z.unknown()), - z.array(z.unknown()), + z + .object({}) + // Justification: Catching all unknown properties for forward-compatibility. + .catchall(z.unknown()), + z.array( + // Justification: Catching all unknown properties for forward-compatibility. + z.unknown(), + ), ]); export type ListInterviewsResponse = z.infer< typeof ListInterviewsResponseSchema @@ -1135,8 +1609,14 @@ const ListJobPostingsInputSchema = z export type ListJobPostingsInput = z.infer; const ListJobPostingsResponseSchema = z.union([ - z.object({}).catchall(z.unknown()), - z.array(z.unknown()), + z + .object({}) + // Justification: Catching all unknown properties for forward-compatibility. + .catchall(z.unknown()), + z.array( + // Justification: Catching all unknown properties for forward-compatibility. + z.unknown(), + ), ]); export type ListJobPostingsResponse = z.infer< typeof ListJobPostingsResponseSchema @@ -1148,8 +1628,14 @@ const ListJobsInputSchema = z export type ListJobsInput = z.infer; const ListJobsResponseSchema = z.union([ - z.object({}).catchall(z.unknown()), - z.array(z.unknown()), + z + .object({}) + // Justification: Catching all unknown properties for forward-compatibility. + .catchall(z.unknown()), + z.array( + // Justification: Catching all unknown properties for forward-compatibility. + z.unknown(), + ), ]); export type ListJobsResponse = z.infer; @@ -1161,8 +1647,14 @@ export type RetrieveWorkerLeaveOfAbsenceSubresourceInput = z.infer< >; const RetrieveWorkerLeaveOfAbsenceSubresourceResponseSchema = z.union([ - z.object({}).catchall(z.unknown()), - z.array(z.unknown()), + z + .object({}) + // Justification: Catching all unknown properties for forward-compatibility. + .catchall(z.unknown()), + z.array( + // Justification: Catching all unknown properties for forward-compatibility. + z.unknown(), + ), ]); export type RetrieveWorkerLeaveOfAbsenceSubresourceResponse = z.infer< typeof RetrieveWorkerLeaveOfAbsenceSubresourceResponseSchema @@ -1177,8 +1669,14 @@ export type UpdateAnExistingPayrollInput = z.infer< >; const UpdateAnExistingPayrollResponseSchema = z.union([ - z.object({}).catchall(z.unknown()), - z.array(z.unknown()), + z + .object({}) + // Justification: Catching all unknown properties for forward-compatibility. + .catchall(z.unknown()), + z.array( + // Justification: Catching all unknown properties for forward-compatibility. + z.unknown(), + ), ]); export type UpdateAnExistingPayrollResponse = z.infer< typeof UpdateAnExistingPayrollResponseSchema @@ -1193,8 +1691,14 @@ export type UpdateJobChangeBusinessTitleInput = z.infer< >; const UpdateJobChangeBusinessTitleResponseSchema = z.union([ - z.object({}).catchall(z.unknown()), - z.array(z.unknown()), + z + .object({}) + // Justification: Catching all unknown properties for forward-compatibility. + .catchall(z.unknown()), + z.array( + // Justification: Catching all unknown properties for forward-compatibility. + z.unknown(), + ), ]); export type UpdateJobChangeBusinessTitleResponse = z.infer< typeof UpdateJobChangeBusinessTitleResponseSchema @@ -1209,8 +1713,14 @@ export type UpdateMessageTemplateByIdInput = z.infer< >; const UpdateMessageTemplateByIdResponseSchema = z.union([ - z.object({}).catchall(z.unknown()), - z.array(z.unknown()), + z + .object({}) + // Justification: Catching all unknown properties for forward-compatibility. + .catchall(z.unknown()), + z.array( + // Justification: Catching all unknown properties for forward-compatibility. + z.unknown(), + ), ]); export type UpdateMessageTemplateByIdResponse = z.infer< typeof UpdateMessageTemplateByIdResponseSchema From adfe9e841df73b9a1d2336155743d9c6fd328e8f Mon Sep 17 00:00:00 2001 From: Dhirender Choudhary Date: Wed, 22 Jul 2026 14:21:54 +0530 Subject: [PATCH 11/19] chore(workday): sync lockfile for ts-jest dependency --- packages/workday/package.json | 2 +- pnpm-lock.yaml | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/workday/package.json b/packages/workday/package.json index a7ae02029..cda5ef7dd 100644 --- a/packages/workday/package.json +++ b/packages/workday/package.json @@ -26,7 +26,7 @@ "@types/jest": "^29.5.14", "corsair": "workspace:*", "jest": "^29.7.0", - "ts-jest": "^29.4.9", + "ts-jest": "29.4.9", "tsup": "^8.0.1", "typescript": "catalog:", "zod": "^3.25.76" diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index a7fd64b2c..216b5e530 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -2457,8 +2457,8 @@ importers: specifier: ^29.7.0 version: 29.7.0(@types/node@24.10.1)(ts-node@10.9.2(@types/node@24.10.1)(typescript@5.9.3)) ts-jest: - specifier: ^29.4.9 - version: 29.4.9(@babel/core@7.29.7)(@jest/transform@29.7.0)(@jest/types@30.4.1)(babel-jest@29.7.0(@babel/core@7.29.7))(jest-util@30.4.1)(jest@29.7.0(@types/node@24.10.1)(ts-node@10.9.2(@types/node@24.10.1)(typescript@5.9.3)))(typescript@5.9.3) + specifier: 29.4.9 + version: 29.4.9(@babel/core@7.29.7)(@jest/transform@29.7.0)(@jest/types@30.4.1)(babel-jest@29.7.0(@babel/core@7.29.7))(esbuild@0.27.0)(jest-util@30.4.1)(jest@29.7.0(@types/node@24.10.1)(ts-node@10.9.2(@types/node@24.10.1)(typescript@5.9.3)))(typescript@5.9.3) tsup: specifier: ^8.0.1 version: 8.5.1(jiti@2.7.0)(postcss@8.5.15)(tsx@4.22.4)(typescript@5.9.3)(yaml@2.9.0) @@ -4050,11 +4050,11 @@ packages: '@esbuild-kit/core-utils@3.3.2': resolution: {integrity: sha512-sPRAnw9CdSsRmEtnsl2WXWdyquogVpB3yZ3dgwJfe8zrOzTsV7cJvmwrKVa+0ma5BoiGJ+BoqkMvawbayKUsqQ==} - deprecated: 'Merged into tsx: https://tsx.is' + deprecated: 'Merged into tsx: https://tsx.hirok.io' '@esbuild-kit/esm-loader@2.6.5': resolution: {integrity: sha512-FxEMIkJKnodyA1OaCUoEvbYRkoZlLZ4d/eXFu9Fh8CbBBgP5EmZxrfTRyN0qpXZ4vOvqnE5YdRdcrmUUXuU+dA==} - deprecated: 'Merged into tsx: https://tsx.is' + deprecated: 'Merged into tsx: https://tsx.hirok.io' '@esbuild/aix-ppc64@0.25.12': resolution: {integrity: sha512-Hhmwd6CInZ3dwpuGTF8fJG6yoWmsToE+vYgD4nytZVxcu1ulHpUQRAB1UJ8+N1Am3Mz4+xOByoQoSZf4D+CpkA==} From 69eeaa8ae09b2894bd22c45b4c39aee25a2c82cd Mon Sep 17 00:00:00 2001 From: Dhirender Choudhary Date: Wed, 22 Jul 2026 14:34:25 +0530 Subject: [PATCH 12/19] fix(workday): resolve remaining webhook type issues --- packages/workday/webhooks/worker.ts | 38 ++++++++++++++--------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/packages/workday/webhooks/worker.ts b/packages/workday/webhooks/worker.ts index 522e72917..8387a0e09 100644 --- a/packages/workday/webhooks/worker.ts +++ b/packages/workday/webhooks/worker.ts @@ -1,24 +1,24 @@ -import type { CorsairWebhookDefinition } from 'corsair/core'; -import type { WorkdayWebhookOutputs } from './types'; +import type { CorsairWebhook } from 'corsair/core'; +import type { WorkdayContext } from '../index'; +import type { WorkdayWorkerEvent } from './types'; import { createWorkdayEventMatch, verifyWorkdayWebhookSignature, } from './types'; -export const workerUpdated: CorsairWebhookDefinition< - WorkdayWebhookOutputs, - 'worker.updated' -> = { - match: createWorkdayEventMatch('worker.updated'), - handler: async (ctx, request) => { - const v = verifyWorkdayWebhookSignature(request, ctx.key); - if (!v.valid) { - return { - success: false, - statusCode: 401, - error: v.error || 'Signature verification failed', - }; - } - return { success: true }; - }, -}; +export const workerUpdated: CorsairWebhook = + { + match: createWorkdayEventMatch('worker.updated'), + handler: async (ctx, request) => { + const secret = ctx.options?.webhookSecret || (ctx as any).key || ''; + const v = verifyWorkdayWebhookSignature(request as any, secret); + if (!v.valid) { + return { + success: false, + statusCode: 401, + error: v.error || 'Signature verification failed', + }; + } + return { success: true }; + }, + }; From c210bfcf9cfb6c77e1c0a8c044aa55ccd003327d Mon Sep 17 00:00:00 2001 From: Dhirender Choudhary Date: Wed, 22 Jul 2026 14:36:52 +0530 Subject: [PATCH 13/19] fix(workday): resolve timing-attack vulnerability using verifyHmacSignature --- packages/workday/webhooks/types.ts | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/packages/workday/webhooks/types.ts b/packages/workday/webhooks/types.ts index 1af8295bb..2f06ba98e 100644 --- a/packages/workday/webhooks/types.ts +++ b/packages/workday/webhooks/types.ts @@ -43,7 +43,7 @@ export function createWorkdayEventMatch( }; } -import * as crypto from 'crypto'; +import { verifyHmacSignature } from 'corsair/http'; export function verifyWorkdayWebhookSignature( request: WebhookRequest, @@ -63,11 +63,8 @@ export function verifyWorkdayWebhookSignature( bodyString = JSON.stringify(request.payload); } - const expected = crypto - .createHmac('sha256', secret) - .update(bodyString) - .digest('base64'); - if (signature !== expected) { + const isValid = verifyHmacSignature(bodyString, secret, signature); + if (!isValid) { return { valid: false, error: 'Invalid webhook signature' }; } From 4188fd329d73f3717b2286887dd03b99e720381e Mon Sep 17 00:00:00 2001 From: Dhirender Choudhary Date: Sat, 8 Aug 2026 22:28:48 +0530 Subject: [PATCH 14/19] fix(workday): wire 85 ops to real Workday REST paths Replace fabricated v1/{domain}/{op} stubs with staffing/absence/ recruiting/payroll/common/person routes, tenant-hosted OAuth, and the 13 Composio-aligned triggers. --- packages/workday/api.test.ts | 241 +- packages/workday/client.ts | 85 +- packages/workday/endpoints/absence.ts | 24 - packages/workday/endpoints/assignment.ts | 58 - packages/workday/endpoints/balances.ts | 24 - packages/workday/endpoints/business.ts | 58 - packages/workday/endpoints/candidate.ts | 22 - packages/workday/endpoints/collection.ts | 40 - packages/workday/endpoints/company.ts | 22 - packages/workday/endpoints/contingent.ts | 22 - packages/workday/endpoints/countries.ts | 24 - packages/workday/endpoints/country.ts | 24 - packages/workday/endpoints/currencies.ts | 24 - packages/workday/endpoints/current.ts | 24 - packages/workday/endpoints/factory.ts | 202 ++ packages/workday/endpoints/grants.ts | 21 - packages/workday/endpoints/headcount.ts | 22 - packages/workday/endpoints/history.ts | 40 - packages/workday/endpoints/holiday.ts | 24 - packages/workday/endpoints/index.ts | 297 +- packages/workday/endpoints/interview.ts | 42 - packages/workday/endpoints/interviews.ts | 24 - packages/workday/endpoints/job.ts | 376 --- packages/workday/endpoints/jobs.ts | 23 - packages/workday/endpoints/leave.ts | 22 - packages/workday/endpoints/message.ts | 22 - packages/workday/endpoints/my.ts | 24 - packages/workday/endpoints/operations.ts | 215 ++ packages/workday/endpoints/organization.ts | 94 - packages/workday/endpoints/pay.ts | 58 - packages/workday/endpoints/payroll.ts | 58 - packages/workday/endpoints/proposed.ts | 22 - packages/workday/endpoints/prospect.ts | 98 - packages/workday/endpoints/routes.ts | 1450 +++++++++ packages/workday/endpoints/supervisory.ts | 22 - packages/workday/endpoints/time.ts | 96 - packages/workday/endpoints/types.ts | 3260 ++++++++------------ packages/workday/endpoints/work.ts | 22 - packages/workday/endpoints/worker.ts | 188 -- packages/workday/endpoints/workers.ts | 22 - packages/workday/endpoints/workspace.ts | 22 - packages/workday/index.ts | 544 ++-- packages/workday/webhooks/index.ts | 2 +- packages/workday/webhooks/triggers.ts | 69 + packages/workday/webhooks/types.ts | 65 +- packages/workday/webhooks/worker.ts | 24 - 46 files changed, 3887 insertions(+), 4275 deletions(-) delete mode 100644 packages/workday/endpoints/absence.ts delete mode 100644 packages/workday/endpoints/assignment.ts delete mode 100644 packages/workday/endpoints/balances.ts delete mode 100644 packages/workday/endpoints/business.ts delete mode 100644 packages/workday/endpoints/candidate.ts delete mode 100644 packages/workday/endpoints/collection.ts delete mode 100644 packages/workday/endpoints/company.ts delete mode 100644 packages/workday/endpoints/contingent.ts delete mode 100644 packages/workday/endpoints/countries.ts delete mode 100644 packages/workday/endpoints/country.ts delete mode 100644 packages/workday/endpoints/currencies.ts delete mode 100644 packages/workday/endpoints/current.ts create mode 100644 packages/workday/endpoints/factory.ts delete mode 100644 packages/workday/endpoints/grants.ts delete mode 100644 packages/workday/endpoints/headcount.ts delete mode 100644 packages/workday/endpoints/history.ts delete mode 100644 packages/workday/endpoints/holiday.ts delete mode 100644 packages/workday/endpoints/interview.ts delete mode 100644 packages/workday/endpoints/interviews.ts delete mode 100644 packages/workday/endpoints/job.ts delete mode 100644 packages/workday/endpoints/jobs.ts delete mode 100644 packages/workday/endpoints/leave.ts delete mode 100644 packages/workday/endpoints/message.ts delete mode 100644 packages/workday/endpoints/my.ts create mode 100644 packages/workday/endpoints/operations.ts delete mode 100644 packages/workday/endpoints/organization.ts delete mode 100644 packages/workday/endpoints/pay.ts delete mode 100644 packages/workday/endpoints/payroll.ts delete mode 100644 packages/workday/endpoints/proposed.ts delete mode 100644 packages/workday/endpoints/prospect.ts create mode 100644 packages/workday/endpoints/routes.ts delete mode 100644 packages/workday/endpoints/supervisory.ts delete mode 100644 packages/workday/endpoints/time.ts delete mode 100644 packages/workday/endpoints/work.ts delete mode 100644 packages/workday/endpoints/worker.ts delete mode 100644 packages/workday/endpoints/workers.ts delete mode 100644 packages/workday/endpoints/workspace.ts create mode 100644 packages/workday/webhooks/triggers.ts delete mode 100644 packages/workday/webhooks/worker.ts diff --git a/packages/workday/api.test.ts b/packages/workday/api.test.ts index f480e8a43..56244a279 100644 --- a/packages/workday/api.test.ts +++ b/packages/workday/api.test.ts @@ -1,60 +1,237 @@ +import { + normalizeWorkdayHost, + workdayOAuthUrls, + workdayServiceBase, +} from './client.js'; +import { buildQuery, requestBody, resolvePath } from './endpoints/factory.js'; +import { workdayRoutes } from './endpoints/routes.js'; import { workday } from './index.js'; +function mockJsonResponse(body: unknown, status = 200) { + return { + ok: status >= 200 && status < 300, + status, + headers: { + get: (name: string) => + name.toLowerCase() === 'content-type' ? 'application/json' : null, + }, + json: async () => body, + text: async () => JSON.stringify(body), + }; +} + describe('Workday Plugin', () => { const mockFetch = jest.fn(); // Justification: jest requires injecting fetch into global scope for tests. - (globalThis as any).fetch = mockFetch; + (globalThis as { fetch?: typeof fetch }).fetch = mockFetch; beforeEach(() => { mockFetch.mockReset(); }); - it('should initialize the plugin correctly', () => { - const plugin = workday({ key: 'test', webhookSecret: 'secret' }); + const pluginOpts = { + key: 'test-token', + tenant: 'acme', + host: 'wd2-impl-services1.workday.com', + webhookSecret: 'secret', + }; + + it('initializes with workday id', () => { + const plugin = workday(pluginOpts); expect(plugin.id).toBe('workday'); }); - it('should provide the expected endpoint structure for business', () => { - const plugin = workday({ key: 'test', webhookSecret: 'secret' }); - expect(plugin.endpoints).toHaveProperty('business'); - expect(plugin.endpoints?.business.createBusinessTitleChange).toBeDefined(); + it('registers all 85 routes as nested endpoints', () => { + const plugin = workday(pluginOpts); + expect(workdayRoutes).toHaveLength(85); + for (const route of workdayRoutes) { + const group = ( + plugin.endpoints as Record> + )?.[route.group]; + expect(group).toBeDefined(); + expect(group?.[route.name]).toBeDefined(); + } }); - it('should provide the expected endpoint structure for job', () => { - const plugin = workday({ key: 'test', webhookSecret: 'secret' }); - expect(plugin.endpoints).toHaveProperty('job'); - expect(plugin.endpoints?.job.createJobChange).toBeDefined(); + it('registers 13 Composio-aligned triggers', () => { + const plugin = workday(pluginOpts); + const hooks = plugin.webhooks as Record | undefined; + expect(Object.keys(hooks ?? {})).toHaveLength(13); + expect(hooks?.['absenceBalance.changed']).toBeDefined(); + expect(hooks?.['jobPosting.created']).toBeDefined(); + expect(hooks?.['workerLeaveOfAbsence.created']).toBeDefined(); }); - it('should provide the expected endpoint structure for payroll', () => { - const plugin = workday({ key: 'test', webhookSecret: 'secret' }); - expect(plugin.endpoints).toHaveProperty('payroll'); - expect(plugin.endpoints?.payroll.createPayrollInputs).toBeDefined(); + it('requires tenant for oauth_2 and builds Workday OAuth URLs', () => { + expect(() => workday({ key: 'x' })).toThrow(/tenant is required/); + const plugin = workday(pluginOpts); + expect(plugin.oauthConfig?.authUrl).toBe( + 'https://wd2-impl-services1.workday.com/ccx/oauth2/acme/authorize', + ); + expect(plugin.oauthConfig?.tokenUrl).toBe( + 'https://wd2-impl-services1.workday.com/ccx/oauth2/acme/token', + ); }); - it('should support webhooks configuration', () => { - const plugin = workday({ key: 'test', webhookSecret: 'secret' }); - expect(plugin.webhooks).toBeDefined(); - expect(plugin.pluginWebhookMatcher).toBeDefined(); + it('interpolates path params and never leaves literal {ID}', () => { + const path = resolvePath( + '/workers/{ID}/jobChanges', + { ID: 'abc/def' }, + { pathParams: ['ID'] }, + ); + expect(path).toBe('/workers/abc%2Fdef/jobChanges'); + expect(path).not.toContain('{ID}'); }); - it('should invoke an endpoint correctly', async () => { - const plugin = workday({ key: 'test', webhookSecret: 'secret' }); + it('accepts id/workerId aliases for ID path params', () => { + expect( + resolvePath( + '/workers/{ID}/requestTimeOff', + { workerId: 'w1' }, + { pathParams: ['ID'] }, + ), + ).toBe('/workers/w1/requestTimeOff'); + expect( + resolvePath('/jobs/{ID}', { id: 'job-9' }, { pathParams: ['ID'] }), + ).toBe('/jobs/job-9'); + }); - mockFetch.mockResolvedValueOnce({ - ok: true, - json: async () => ({ success: true }), - }); + it('maps createJobChange to Staffing v6 POST /workers/{ID}/jobChanges', async () => { + const plugin = workday(pluginOpts); + mockFetch.mockResolvedValueOnce( + mockJsonResponse({ id: 'jc-1', descriptor: 'Job Change' }, 201), + ); - const result = await plugin.endpoints?.business.createBusinessTitleChange( - // Justification: Mock context for testing - { key: 'test' } as any, - // Justification: Mock input for testing - { workerId: '123' } as any, + const result = await plugin.endpoints?.job.createJobChange( + // Justification: minimal endpoint context for unit test + { key: 'test-token', options: pluginOpts } as never, + { + ID: 'worker-1', + date: '2026-08-01', + reason: { id: 'reason-1' }, + }, ); expect(mockFetch).toHaveBeenCalled(); - expect(mockFetch.mock.calls[0][0]).toContain('workday.com'); - expect(result).toEqual({ success: true }); + const [url, init] = mockFetch.mock.calls[0] as [string, RequestInit]; + expect(url).toContain( + '/ccx/api/staffing/v6/acme/workers/worker-1/jobChanges', + ); + expect(init.method).toBe('POST'); + expect(result).toEqual({ id: 'jc-1', descriptor: 'Job Change' }); + }); + + it('maps getJobById to GET staffing /jobs/{ID} with encoded id', async () => { + const plugin = workday(pluginOpts); + mockFetch.mockResolvedValueOnce(mockJsonResponse({ id: 'job-1' })); + + await plugin.endpoints?.job.getJobById( + { key: 'test-token', options: pluginOpts } as never, + { ID: 'a b' }, + ); + + const [url, init] = mockFetch.mock.calls[0] as [string, RequestInit]; + expect(url).toContain('/ccx/api/staffing/v6/acme/jobs/a%20b'); + expect(init.method).toBe('GET'); + }); + + it('maps listBalances to Absence Management v5 GET /balances', async () => { + const plugin = workday(pluginOpts); + mockFetch.mockResolvedValueOnce(mockJsonResponse({ data: [], total: 0 })); + + await plugin.endpoints?.balances.listBalances( + { key: 'test-token', options: pluginOpts } as never, + { worker: 'w1', limit: 20, offset: 0 }, + ); + + const [url, init] = mockFetch.mock.calls[0] as [string, RequestInit]; + expect(url).toContain('/ccx/api/absenceManagement/v5/acme/balances'); + expect(url).toContain('worker=w1'); + expect(init.method).toBe('GET'); + }); + + it('maps retrieveWorkerLeaveOfAbsenceSubresource as GET read', async () => { + const plugin = workday(pluginOpts); + const meta = + plugin.endpointMeta?.['worker.retrieveWorkerLeaveOfAbsenceSubresource']; + expect(meta?.riskLevel).toBe('read'); + + mockFetch.mockResolvedValueOnce(mockJsonResponse({ id: 'loa-1' })); + + await plugin.endpoints?.worker.retrieveWorkerLeaveOfAbsenceSubresource( + { key: 'test-token', options: pluginOpts } as never, + { ID: 'w1', subresourceID: 'loa-1' }, + ); + + const [url, init] = mockFetch.mock.calls[0] as [string, RequestInit]; + expect(url).toContain( + '/ccx/api/absenceManagement/v5/acme/workers/w1/leavesOfAbsence/loa-1', + ); + expect(init.method).toBe('GET'); + }); + + it('maps updateMessageTemplateById with interpolated ID (no literal braces)', async () => { + const plugin = workday(pluginOpts); + mockFetch.mockResolvedValueOnce(mockJsonResponse({ id: 'mt-1' })); + + await plugin.endpoints?.message.updateMessageTemplateById( + { key: 'test-token', options: pluginOpts } as never, + { ID: 'mt-1', name: 'Interview Invite' }, + ); + + const [url, init] = mockFetch.mock.calls[0] as [string, RequestInit]; + expect(url).toContain('/ccx/api/recruiting/v4/acme/messageTemplates/mt-1'); + expect(url).not.toContain('{ID}'); + expect(init.method).toBe('PUT'); + }); + + it('assigns read riskLevel to GET ops and write to mutating ops', () => { + const plugin = workday(pluginOpts); + expect(plugin.endpointMeta?.['current.getCurrentUser']?.riskLevel).toBe( + 'read', + ); + expect(plugin.endpointMeta?.['job.createJobChange']?.riskLevel).toBe( + 'write', + ); + expect( + plugin.endpointMeta?.['payroll.updateAnExistingPayroll']?.riskLevel, + ).toBe('write'); + }); + + it('builds query from route queryParams and body excluding path params', () => { + const route = workdayRoutes.find((r) => r.name === 'createJobChange'); + expect(route).toBeDefined(); + if (!route) return; + expect(buildQuery(route, { ID: 'w1', limit: 5 })).toBeUndefined(); + expect(requestBody(route, { ID: 'w1', date: '2026-01-01' })).toEqual({ + date: '2026-01-01', + }); + }); + + it('builds service base URLs and normalizes host', () => { + expect(normalizeWorkdayHost('https://example.workday.com/')).toBe( + 'example.workday.com', + ); + expect( + workdayServiceBase( + { host: 'example.workday.com', tenant: 'acme' }, + 'staffing', + 'v6', + ), + ).toBe('https://example.workday.com/ccx/api/staffing/v6/acme'); + expect( + workdayOAuthUrls({ host: 'example.workday.com', tenant: 'acme' }).authUrl, + ).toContain('/ccx/oauth2/acme/authorize'); + }); + + it('matches trigger events by type and verifies HMAC signature wiring', async () => { + const plugin = workday(pluginOpts); + const trigger = plugin.webhooks?.['jobPosting.created']; + expect(trigger).toBeDefined(); + const matched = trigger?.match?.({ + headers: { 'x-workday-event': 'jobPosting.created' }, + body: JSON.stringify({ type: 'jobPosting.created', data: {} }), + } as never); + expect(matched).toBe(true); }); }); diff --git a/packages/workday/client.ts b/packages/workday/client.ts index 93dcb24c0..d89d9cd21 100644 --- a/packages/workday/client.ts +++ b/packages/workday/client.ts @@ -1,5 +1,6 @@ import type { ApiRequestOptions, OpenAPIConfig } from 'corsair/http'; import { request } from 'corsair/http'; +import type { WorkdayService } from './endpoints/routes'; export class WorkdayAPIError extends Error { constructor( @@ -11,22 +12,90 @@ export class WorkdayAPIError extends Error { } } -const WORKDAY_API_BASE = 'https://api.workday.com'; +export type WorkdayConnection = { + /** e.g. wd2-impl-services1.workday.com — no scheme */ + host: string; + /** Workday tenant identifier */ + tenant: string; +}; + +const DEFAULT_HOST = 'wd2-impl-services1.workday.com'; + +/** Strip scheme / trailing slash; host only. */ +export function normalizeWorkdayHost(host: string): string { + const trimmed = host.trim(); + if (!trimmed) throw new Error('[workday] host is required'); + try { + if (trimmed.includes('://')) { + const url = new URL(trimmed); + if (url.protocol !== 'https:') { + throw new Error('[workday] host must use https'); + } + return url.host; + } + } catch (error) { + if (error instanceof Error && error.message.startsWith('[workday]')) { + throw error; + } + } + return trimmed.replace(/\/+$/, ''); +} + +export function normalizeWorkdayTenant(tenant: string): string { + const trimmed = tenant.trim(); + if (!trimmed) throw new Error('[workday] tenant is required'); + if (trimmed.includes('/') || trimmed.includes('://')) { + throw new Error('[workday] tenant must be the bare tenant name'); + } + return trimmed; +} + +export function resolveWorkdayConnection(input: { + host?: string; + tenant?: string; +}): WorkdayConnection { + return { + host: normalizeWorkdayHost(input.host?.trim() || DEFAULT_HOST), + tenant: normalizeWorkdayTenant(input.tenant ?? ''), + }; +} + +/** OAuth endpoints: https://{host}/ccx/oauth2/{tenant}/{authorize|token} */ +export function workdayOAuthUrls(connection: WorkdayConnection) { + const base = `https://${connection.host}/ccx/oauth2/${connection.tenant}`; + return { + authUrl: `${base}/authorize`, + tokenUrl: `${base}/token`, + }; +} + +/** REST base: https://{host}/ccx/api/{service}/{version}/{tenant} */ +export function workdayServiceBase( + connection: WorkdayConnection, + service: WorkdayService, + version: string, +): string { + return `https://${connection.host}/ccx/api/${service}/${version}/${connection.tenant}`; +} export async function makeWorkdayRequest( - endpoint: string, + path: string, apiKey: string, options: { method?: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH'; body?: { [key: string]: unknown }; query?: Record; - } = {}, + connection: WorkdayConnection; + service: WorkdayService; + version: string; + }, ): Promise { - const { method = 'GET', body, query } = options; + const { method = 'GET', body, query, connection, service, version } = options; + const base = workdayServiceBase(connection, service, version); const config: OpenAPIConfig = { - BASE: WORKDAY_API_BASE, - VERSION: '1.0.0', + BASE: base, + VERSION: version, WITH_CREDENTIALS: false, CREDENTIALS: 'omit', TOKEN: apiKey, @@ -38,13 +107,13 @@ export async function makeWorkdayRequest( const requestOptions: ApiRequestOptions = { method, - url: endpoint, + url: path.startsWith('/') ? path : `/${path}`, body: method === 'POST' || method === 'PUT' || method === 'PATCH' ? body : undefined, mediaType: 'application/json; charset=utf-8', - query: method === 'GET' ? query : undefined, + query, }; try { diff --git a/packages/workday/endpoints/absence.ts b/packages/workday/endpoints/absence.ts deleted file mode 100644 index 7c5cc950a..000000000 --- a/packages/workday/endpoints/absence.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { logEventFromContext } from 'corsair/core'; -import type { WorkdayEndpoints } from '..'; -import { makeWorkdayRequest } from '../client'; -import type { WorkdayEndpointOutputs } from './types'; - -export const getAbsenceBalance: WorkdayEndpoints['getAbsenceBalance'] = async ( - ctx, - input, -) => { - const response = await makeWorkdayRequest< - WorkdayEndpointOutputs['getAbsenceBalance'] - >('v1/absence/getAbsenceBalance', ctx.key, { - method: 'GET', - // Justification: The makeWorkdayRequest client expects a generic unknown record. - query: input as { [key: string]: string | number | boolean | undefined }, - }); - await logEventFromContext( - ctx, - 'workday.absence.getAbsenceBalance', - input ?? {}, - 'completed', - ); - return response; -}; diff --git a/packages/workday/endpoints/assignment.ts b/packages/workday/endpoints/assignment.ts deleted file mode 100644 index e7d1d0d4d..000000000 --- a/packages/workday/endpoints/assignment.ts +++ /dev/null @@ -1,58 +0,0 @@ -import { logEventFromContext } from 'corsair/core'; -import type { WorkdayEndpoints } from '..'; -import { makeWorkdayRequest } from '../client'; -import type { WorkdayEndpointOutputs } from './types'; - -export const getAssignmentChangeGroupCostCenters: WorkdayEndpoints['getAssignmentChangeGroupCostCenters'] = - async (ctx, input) => { - const response = await makeWorkdayRequest< - WorkdayEndpointOutputs['getAssignmentChangeGroupCostCenters'] - >('v1/assignment/getAssignmentChangeGroupCostCenters', ctx.key, { - method: 'GET', - // Justification: The makeWorkdayRequest client expects a generic string/number/boolean query record. - query: input as { [key: string]: string | number | boolean | undefined }, - }); - await logEventFromContext( - ctx, - 'workday.assignment.getAssignmentChangeGroupCostCenters', - input ?? {}, - 'completed', - ); - return response; - }; - -export const getAssignmentChangeGroupJobs: WorkdayEndpoints['getAssignmentChangeGroupJobs'] = - async (ctx, input) => { - const response = await makeWorkdayRequest< - WorkdayEndpointOutputs['getAssignmentChangeGroupJobs'] - >('v1/assignment/getAssignmentChangeGroupJobs', ctx.key, { - method: 'GET', - // Justification: The makeWorkdayRequest client expects a generic string/number/boolean query record. - query: input as { [key: string]: string | number | boolean | undefined }, - }); - await logEventFromContext( - ctx, - 'workday.assignment.getAssignmentChangeGroupJobs', - input ?? {}, - 'completed', - ); - return response; - }; - -export const getAssignmentTypes: WorkdayEndpoints['getAssignmentTypes'] = - async (ctx, input) => { - const response = await makeWorkdayRequest< - WorkdayEndpointOutputs['getAssignmentTypes'] - >('v1/assignment/getAssignmentTypes', ctx.key, { - method: 'GET', - // Justification: The makeWorkdayRequest client expects a generic string/number/boolean query record. - query: input as { [key: string]: string | number | boolean | undefined }, - }); - await logEventFromContext( - ctx, - 'workday.assignment.getAssignmentTypes', - input ?? {}, - 'completed', - ); - return response; - }; diff --git a/packages/workday/endpoints/balances.ts b/packages/workday/endpoints/balances.ts deleted file mode 100644 index 412145830..000000000 --- a/packages/workday/endpoints/balances.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { logEventFromContext } from 'corsair/core'; -import type { WorkdayEndpoints } from '..'; -import { makeWorkdayRequest } from '../client'; -import type { WorkdayEndpointOutputs } from './types'; - -export const listBalances: WorkdayEndpoints['listBalances'] = async ( - ctx, - input, -) => { - const response = await makeWorkdayRequest< - WorkdayEndpointOutputs['listBalances'] - >('v1/balances/listBalances', ctx.key, { - method: 'GET', - // Justification: The makeWorkdayRequest client expects a generic unknown record. - query: input as { [key: string]: string | number | boolean | undefined }, - }); - await logEventFromContext( - ctx, - 'workday.balances.listBalances', - input ?? {}, - 'completed', - ); - return response; -}; diff --git a/packages/workday/endpoints/business.ts b/packages/workday/endpoints/business.ts deleted file mode 100644 index eaceeb60d..000000000 --- a/packages/workday/endpoints/business.ts +++ /dev/null @@ -1,58 +0,0 @@ -import { logEventFromContext } from 'corsair/core'; -import type { WorkdayEndpoints } from '..'; -import { makeWorkdayRequest } from '../client'; -import type { WorkdayEndpointOutputs } from './types'; - -export const createBusinessTitleChange: WorkdayEndpoints['createBusinessTitleChange'] = - async (ctx, input) => { - const response = await makeWorkdayRequest< - WorkdayEndpointOutputs['createBusinessTitleChange'] - >('v1/business/createBusinessTitleChange', ctx.key, { - method: 'POST', - // Justification: The makeWorkdayRequest client expects a generic unknown record. - body: input as { [key: string]: unknown }, - }); - await logEventFromContext( - ctx, - 'workday.business.createBusinessTitleChange', - input ?? {}, - 'completed', - ); - return response; - }; - -export const getBusinessTitleChange: WorkdayEndpoints['getBusinessTitleChange'] = - async (ctx, input) => { - const response = await makeWorkdayRequest< - WorkdayEndpointOutputs['getBusinessTitleChange'] - >('v1/business/getBusinessTitleChange', ctx.key, { - method: 'GET', - // Justification: The makeWorkdayRequest client expects a generic string/number/boolean query record. - query: input as { [key: string]: string | number | boolean | undefined }, - }); - await logEventFromContext( - ctx, - 'workday.business.getBusinessTitleChange', - input ?? {}, - 'completed', - ); - return response; - }; - -export const getBusinessTitleChangeForWorker: WorkdayEndpoints['getBusinessTitleChangeForWorker'] = - async (ctx, input) => { - const response = await makeWorkdayRequest< - WorkdayEndpointOutputs['getBusinessTitleChangeForWorker'] - >('v1/business/getBusinessTitleChangeForWorker', ctx.key, { - method: 'GET', - // Justification: The makeWorkdayRequest client expects a generic string/number/boolean query record. - query: input as { [key: string]: string | number | boolean | undefined }, - }); - await logEventFromContext( - ctx, - 'workday.business.getBusinessTitleChangeForWorker', - input ?? {}, - 'completed', - ); - return response; - }; diff --git a/packages/workday/endpoints/candidate.ts b/packages/workday/endpoints/candidate.ts deleted file mode 100644 index 3edd4acfa..000000000 --- a/packages/workday/endpoints/candidate.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { logEventFromContext } from 'corsair/core'; -import type { WorkdayEndpoints } from '..'; -import { makeWorkdayRequest } from '../client'; -import type { WorkdayEndpointOutputs } from './types'; - -export const getCandidateAvailabilityTemplate: WorkdayEndpoints['getCandidateAvailabilityTemplate'] = - async (ctx, input) => { - const response = await makeWorkdayRequest< - WorkdayEndpointOutputs['getCandidateAvailabilityTemplate'] - >('v1/candidate/getCandidateAvailabilityTemplate', ctx.key, { - method: 'GET', - // Justification: The makeWorkdayRequest client expects a generic string/number/boolean query record. - query: input as { [key: string]: string | number | boolean | undefined }, - }); - await logEventFromContext( - ctx, - 'workday.candidate.getCandidateAvailabilityTemplate', - input ?? {}, - 'completed', - ); - return response; - }; diff --git a/packages/workday/endpoints/collection.ts b/packages/workday/endpoints/collection.ts deleted file mode 100644 index 8ba557aa2..000000000 --- a/packages/workday/endpoints/collection.ts +++ /dev/null @@ -1,40 +0,0 @@ -import { logEventFromContext } from 'corsair/core'; -import type { WorkdayEndpoints } from '..'; -import { makeWorkdayRequest } from '../client'; -import type { WorkdayEndpointOutputs } from './types'; - -export const getCollectionOfJobs: WorkdayEndpoints['getCollectionOfJobs'] = - async (ctx, input) => { - const response = await makeWorkdayRequest< - WorkdayEndpointOutputs['getCollectionOfJobs'] - >('v1/collection/getCollectionOfJobs', ctx.key, { - method: 'GET', - // Justification: The makeWorkdayRequest client expects a generic string/number/boolean query record. - query: input as { [key: string]: string | number | boolean | undefined }, - }); - await logEventFromContext( - ctx, - 'workday.collection.getCollectionOfJobs', - input ?? {}, - 'completed', - ); - return response; - }; - -export const getCollectionOfPayroll: WorkdayEndpoints['getCollectionOfPayroll'] = - async (ctx, input) => { - const response = await makeWorkdayRequest< - WorkdayEndpointOutputs['getCollectionOfPayroll'] - >('v1/collection/getCollectionOfPayroll', ctx.key, { - method: 'GET', - // Justification: The makeWorkdayRequest client expects a generic string/number/boolean query record. - query: input as { [key: string]: string | number | boolean | undefined }, - }); - await logEventFromContext( - ctx, - 'workday.collection.getCollectionOfPayroll', - input ?? {}, - 'completed', - ); - return response; - }; diff --git a/packages/workday/endpoints/company.ts b/packages/workday/endpoints/company.ts deleted file mode 100644 index eb01e0a56..000000000 --- a/packages/workday/endpoints/company.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { logEventFromContext } from 'corsair/core'; -import type { WorkdayEndpoints } from '..'; -import { makeWorkdayRequest } from '../client'; -import type { WorkdayEndpointOutputs } from './types'; - -export const getCompanyInsiderTypes: WorkdayEndpoints['getCompanyInsiderTypes'] = - async (ctx, input) => { - const response = await makeWorkdayRequest< - WorkdayEndpointOutputs['getCompanyInsiderTypes'] - >('v1/company/getCompanyInsiderTypes', ctx.key, { - method: 'GET', - // Justification: The makeWorkdayRequest client expects a generic string/number/boolean query record. - query: input as { [key: string]: string | number | boolean | undefined }, - }); - await logEventFromContext( - ctx, - 'workday.company.getCompanyInsiderTypes', - input ?? {}, - 'completed', - ); - return response; - }; diff --git a/packages/workday/endpoints/contingent.ts b/packages/workday/endpoints/contingent.ts deleted file mode 100644 index a30fd29e9..000000000 --- a/packages/workday/endpoints/contingent.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { logEventFromContext } from 'corsair/core'; -import type { WorkdayEndpoints } from '..'; -import { makeWorkdayRequest } from '../client'; -import type { WorkdayEndpointOutputs } from './types'; - -export const getContingentWorkerTypes: WorkdayEndpoints['getContingentWorkerTypes'] = - async (ctx, input) => { - const response = await makeWorkdayRequest< - WorkdayEndpointOutputs['getContingentWorkerTypes'] - >('v1/contingent/getContingentWorkerTypes', ctx.key, { - method: 'GET', - // Justification: The makeWorkdayRequest client expects a generic string/number/boolean query record. - query: input as { [key: string]: string | number | boolean | undefined }, - }); - await logEventFromContext( - ctx, - 'workday.contingent.getContingentWorkerTypes', - input ?? {}, - 'completed', - ); - return response; - }; diff --git a/packages/workday/endpoints/countries.ts b/packages/workday/endpoints/countries.ts deleted file mode 100644 index d3f0aa058..000000000 --- a/packages/workday/endpoints/countries.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { logEventFromContext } from 'corsair/core'; -import type { WorkdayEndpoints } from '..'; -import { makeWorkdayRequest } from '../client'; -import type { WorkdayEndpointOutputs } from './types'; - -export const listCountries: WorkdayEndpoints['listCountries'] = async ( - ctx, - input, -) => { - const response = await makeWorkdayRequest< - WorkdayEndpointOutputs['listCountries'] - >('v1/countries/listCountries', ctx.key, { - method: 'GET', - // Justification: The makeWorkdayRequest client expects a generic unknown record. - query: input as { [key: string]: string | number | boolean | undefined }, - }); - await logEventFromContext( - ctx, - 'workday.countries.listCountries', - input ?? {}, - 'completed', - ); - return response; -}; diff --git a/packages/workday/endpoints/country.ts b/packages/workday/endpoints/country.ts deleted file mode 100644 index bbae1e857..000000000 --- a/packages/workday/endpoints/country.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { logEventFromContext } from 'corsair/core'; -import type { WorkdayEndpoints } from '..'; -import { makeWorkdayRequest } from '../client'; -import type { WorkdayEndpointOutputs } from './types'; - -export const getCountryInfo: WorkdayEndpoints['getCountryInfo'] = async ( - ctx, - input, -) => { - const response = await makeWorkdayRequest< - WorkdayEndpointOutputs['getCountryInfo'] - >('v1/country/getCountryInfo', ctx.key, { - method: 'GET', - // Justification: The makeWorkdayRequest client expects a generic unknown record. - query: input as { [key: string]: string | number | boolean | undefined }, - }); - await logEventFromContext( - ctx, - 'workday.country.getCountryInfo', - input ?? {}, - 'completed', - ); - return response; -}; diff --git a/packages/workday/endpoints/currencies.ts b/packages/workday/endpoints/currencies.ts deleted file mode 100644 index ab27a1578..000000000 --- a/packages/workday/endpoints/currencies.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { logEventFromContext } from 'corsair/core'; -import type { WorkdayEndpoints } from '..'; -import { makeWorkdayRequest } from '../client'; -import type { WorkdayEndpointOutputs } from './types'; - -export const getCurrencies: WorkdayEndpoints['getCurrencies'] = async ( - ctx, - input, -) => { - const response = await makeWorkdayRequest< - WorkdayEndpointOutputs['getCurrencies'] - >('v1/currencies/getCurrencies', ctx.key, { - method: 'GET', - // Justification: The makeWorkdayRequest client expects a generic unknown record. - query: input as { [key: string]: string | number | boolean | undefined }, - }); - await logEventFromContext( - ctx, - 'workday.currencies.getCurrencies', - input ?? {}, - 'completed', - ); - return response; -}; diff --git a/packages/workday/endpoints/current.ts b/packages/workday/endpoints/current.ts deleted file mode 100644 index 7421d789e..000000000 --- a/packages/workday/endpoints/current.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { logEventFromContext } from 'corsair/core'; -import type { WorkdayEndpoints } from '..'; -import { makeWorkdayRequest } from '../client'; -import type { WorkdayEndpointOutputs } from './types'; - -export const getCurrentUser: WorkdayEndpoints['getCurrentUser'] = async ( - ctx, - input, -) => { - const response = await makeWorkdayRequest< - WorkdayEndpointOutputs['getCurrentUser'] - >('v1/current/getCurrentUser', ctx.key, { - method: 'GET', - // Justification: The makeWorkdayRequest client expects a generic unknown record. - query: input as { [key: string]: string | number | boolean | undefined }, - }); - await logEventFromContext( - ctx, - 'workday.current.getCurrentUser', - input ?? {}, - 'completed', - ); - return response; -}; diff --git a/packages/workday/endpoints/factory.ts b/packages/workday/endpoints/factory.ts new file mode 100644 index 000000000..50b9a3976 --- /dev/null +++ b/packages/workday/endpoints/factory.ts @@ -0,0 +1,202 @@ +import type { CorsairEndpoint } from 'corsair/core'; +import { AuthMissingError, logEventFromContext } from 'corsair/core'; +import type { WorkdayConnection } from '../client'; +import { makeWorkdayRequest, resolveWorkdayConnection } from '../client'; +import type { WorkdayContext, WorkdayKeyBuilderContext } from '../index'; +import type { WorkdayRoute, WorkdayRouteName } from './routes'; +import { getWorkdayRoute } from './routes'; +import type { WorkdayEndpointInput, WorkdayEndpointOutputs } from './types'; +import { + WorkdayEndpointInputSchemas, + WorkdayEndpointOutputSchemas, +} from './types'; + +export type WorkdayEndpoint = CorsairEndpoint< + WorkdayContext, + WorkdayEndpointInput, + unknown +>; + +const BODY_CONTROL_KEYS = new Set(['body', 'query', 'headers']); + +const PATH_ALIASES: Record = { + ID: ['ID', 'id', 'workerId', 'worker_id'], + subresourceID: [ + 'subresourceID', + 'subresourceId', + 'subResourceID', + 'subResourceId', + ], +}; + +function encodePathPart(value: unknown): string { + if (value === undefined || value === null || value === '') { + throw new Error('[workday] missing required path parameter'); + } + return encodeURIComponent(String(value)); +} + +function resolvePathParam( + input: WorkdayEndpointInput, + pathKey: string, +): unknown { + const aliases = PATH_ALIASES[pathKey] ?? [pathKey]; + for (const candidate of aliases) { + if (input[candidate] !== undefined && input[candidate] !== null) { + return input[candidate]; + } + } + return undefined; +} + +export function resolvePath( + path: string, + input: WorkdayEndpointInput, + route: Pick, +): string { + let index = 0; + return path.replace(/\{([^}]+)\}/g, (_, placeholder: string) => { + const mappedKey = route.pathParams[index]; + index += 1; + const key = mappedKey ?? placeholder; + const value = + resolvePathParam(input, key) ?? resolvePathParam(input, placeholder); + return encodePathPart(value); + }); +} + +function flattenQueryValue( + value: unknown, +): string | number | boolean | undefined { + if (value === undefined || value === null) return undefined; + if ( + typeof value === 'string' || + typeof value === 'number' || + typeof value === 'boolean' + ) { + return value; + } + if (Array.isArray(value)) { + return value.map(String).join(','); + } + return String(value); +} + +export function buildQuery( + route: WorkdayRoute, + input: WorkdayEndpointInput, +): Record | undefined { + const query: Record = { + ...(input.query as + | Record + | undefined), + }; + for (const key of route.queryParams) { + const value = flattenQueryValue(input[key]); + if (value !== undefined) query[key] = value; + } + return Object.keys(query).length > 0 ? query : undefined; +} + +export function requestBody( + route: WorkdayRoute, + input: WorkdayEndpointInput, +): { [key: string]: unknown } | undefined { + if (route.method === 'GET' || route.method === 'DELETE') return undefined; + if ('body' in input && input.body !== undefined) { + return input.body as { [key: string]: unknown }; + } + const pathKeys = new Set( + route.pathParams.flatMap((key) => [key, ...(PATH_ALIASES[key] ?? [])]), + ); + const queryKeys = new Set(route.queryParams); + const body = Object.fromEntries( + Object.entries(input).filter(([key, value]) => { + return ( + !pathKeys.has(key) && + !queryKeys.has(key) && + !BODY_CONTROL_KEYS.has(key) && + value !== undefined + ); + }), + ); + return Object.keys(body).length > 0 ? body : undefined; +} + +async function resolveConnection( + ctx: Pick & { + keys?: Partial; + }, +): Promise { + const fromKeysHost = (await ctx.keys?.get_host?.()) ?? undefined; + const fromKeysTenant = (await ctx.keys?.get_tenant?.()) ?? undefined; + const host = ctx.options?.host?.trim() || fromKeysHost?.trim() || undefined; + const tenant = + ctx.options?.tenant?.trim() || fromKeysTenant?.trim() || undefined; + return resolveWorkdayConnection({ host, tenant }); +} + +function normalizeInputAliases( + raw: WorkdayEndpointInput, +): WorkdayEndpointInput { + const input = { ...raw }; + if (input.ID === undefined) { + const alias = resolvePathParam(input, 'ID'); + if (alias !== undefined) input.ID = alias; + } + if (input.subresourceID === undefined) { + const alias = resolvePathParam(input, 'subresourceID'); + if (alias !== undefined) input.subresourceID = alias; + } + return input; +} + +export async function executeWorkdayOperation( + ctx: WorkdayContext, + rawInput: WorkdayEndpointInput | undefined, + route: WorkdayRoute, +) { + if (!ctx.key) { + throw new AuthMissingError('workday', 'oauth_2'); + } + const normalized = normalizeInputAliases(rawInput ?? {}); + const parsed = + WorkdayEndpointInputSchemas[route.name as WorkdayRouteName].parse( + normalized, + ); + const input = parsed as WorkdayEndpointInput; + + const connection = await resolveConnection(ctx); + const path = resolvePath(route.path, input, route); + + let status: 'completed' | 'failed' = 'completed'; + try { + const response = await makeWorkdayRequest(path, ctx.key, { + method: route.method, + body: requestBody(route, input), + query: buildQuery(route, input), + connection, + service: route.service, + version: route.version, + }); + return WorkdayEndpointOutputSchemas[route.name as WorkdayRouteName].parse( + response, + ) as WorkdayEndpointOutputs[WorkdayRouteName]; + } catch (error) { + status = 'failed'; + throw error; + } finally { + await logEventFromContext( + ctx, + `workday.${route.group}.${route.name}`, + { method: route.method, service: route.service, path: route.path }, + status, + ); + } +} + +export function createWorkdayEndpoint(name: WorkdayRouteName): WorkdayEndpoint { + const route = getWorkdayRoute(name); + return (async (ctx, input) => + executeWorkdayOperation(ctx, input ?? {}, route)) as WorkdayEndpoint; +} diff --git a/packages/workday/endpoints/grants.ts b/packages/workday/endpoints/grants.ts deleted file mode 100644 index 0e2fb221f..000000000 --- a/packages/workday/endpoints/grants.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { logEventFromContext } from 'corsair/core'; -import type { WorkdayEndpoints } from '..'; -import { makeWorkdayRequest } from '../client'; -import type { WorkdayEndpointOutputs } from './types'; - -export const getGrants: WorkdayEndpoints['getGrants'] = async (ctx, input) => { - const response = await makeWorkdayRequest< - WorkdayEndpointOutputs['getGrants'] - >('v1/grants/getGrants', ctx.key, { - method: 'GET', - // Justification: The makeWorkdayRequest client expects a generic unknown record. - query: input as { [key: string]: string | number | boolean | undefined }, - }); - await logEventFromContext( - ctx, - 'workday.grants.getGrants', - input ?? {}, - 'completed', - ); - return response; -}; diff --git a/packages/workday/endpoints/headcount.ts b/packages/workday/endpoints/headcount.ts deleted file mode 100644 index 139efab70..000000000 --- a/packages/workday/endpoints/headcount.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { logEventFromContext } from 'corsair/core'; -import type { WorkdayEndpoints } from '..'; -import { makeWorkdayRequest } from '../client'; -import type { WorkdayEndpointOutputs } from './types'; - -export const getHeadcountOptions: WorkdayEndpoints['getHeadcountOptions'] = - async (ctx, input) => { - const response = await makeWorkdayRequest< - WorkdayEndpointOutputs['getHeadcountOptions'] - >('v1/headcount/getHeadcountOptions', ctx.key, { - method: 'GET', - // Justification: The makeWorkdayRequest client expects a generic string/number/boolean query record. - query: input as { [key: string]: string | number | boolean | undefined }, - }); - await logEventFromContext( - ctx, - 'workday.headcount.getHeadcountOptions', - input ?? {}, - 'completed', - ); - return response; - }; diff --git a/packages/workday/endpoints/history.ts b/packages/workday/endpoints/history.ts deleted file mode 100644 index 6863f7a97..000000000 --- a/packages/workday/endpoints/history.ts +++ /dev/null @@ -1,40 +0,0 @@ -import { logEventFromContext } from 'corsair/core'; -import type { WorkdayEndpoints } from '..'; -import { makeWorkdayRequest } from '../client'; -import type { WorkdayEndpointOutputs } from './types'; - -export const getHistoryInstanceForWorker: WorkdayEndpoints['getHistoryInstanceForWorker'] = - async (ctx, input) => { - const response = await makeWorkdayRequest< - WorkdayEndpointOutputs['getHistoryInstanceForWorker'] - >('v1/history/getHistoryInstanceForWorker', ctx.key, { - method: 'GET', - // Justification: The makeWorkdayRequest client expects a generic string/number/boolean query record. - query: input as { [key: string]: string | number | boolean | undefined }, - }); - await logEventFromContext( - ctx, - 'workday.history.getHistoryInstanceForWorker', - input ?? {}, - 'completed', - ); - return response; - }; - -export const getHistoryItemsForWorker: WorkdayEndpoints['getHistoryItemsForWorker'] = - async (ctx, input) => { - const response = await makeWorkdayRequest< - WorkdayEndpointOutputs['getHistoryItemsForWorker'] - >('v1/history/getHistoryItemsForWorker', ctx.key, { - method: 'GET', - // Justification: The makeWorkdayRequest client expects a generic string/number/boolean query record. - query: input as { [key: string]: string | number | boolean | undefined }, - }); - await logEventFromContext( - ctx, - 'workday.history.getHistoryItemsForWorker', - input ?? {}, - 'completed', - ); - return response; - }; diff --git a/packages/workday/endpoints/holiday.ts b/packages/workday/endpoints/holiday.ts deleted file mode 100644 index 273ca2d83..000000000 --- a/packages/workday/endpoints/holiday.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { logEventFromContext } from 'corsair/core'; -import type { WorkdayEndpoints } from '..'; -import { makeWorkdayRequest } from '../client'; -import type { WorkdayEndpointOutputs } from './types'; - -export const getHolidayEvents: WorkdayEndpoints['getHolidayEvents'] = async ( - ctx, - input, -) => { - const response = await makeWorkdayRequest< - WorkdayEndpointOutputs['getHolidayEvents'] - >('v1/holiday/getHolidayEvents', ctx.key, { - method: 'GET', - // Justification: The makeWorkdayRequest client expects a generic unknown record. - query: input as { [key: string]: string | number | boolean | undefined }, - }); - await logEventFromContext( - ctx, - 'workday.holiday.getHolidayEvents', - input ?? {}, - 'completed', - ); - return response; -}; diff --git a/packages/workday/endpoints/index.ts b/packages/workday/endpoints/index.ts index 64ca4d7df..3bbe42370 100644 --- a/packages/workday/endpoints/index.ts +++ b/packages/workday/endpoints/index.ts @@ -1,241 +1,56 @@ -import { - createBusinessTitleChange, - getBusinessTitleChange, - getBusinessTitleChangeForWorker, -} from './business'; -export const Business = { - createBusinessTitleChange, - getBusinessTitleChange, - getBusinessTitleChangeForWorker, -}; - -import { - createJobChange, - getJobById, - getJobChangeFrequencies, - getJobChangeLocationInfo, - getJobChangePosition, - getJobChangeReasonInstance, - getJobChangeReasons, - getJobChangeReasonValues, - getJobChangesGroupTemplates, - getJobChangesJobValues, - getJobChangesWorkerValues, - getJobClassifications, - getJobPosting, - getJobPostingQuestionnaire, - getJobProfilesValues, - getJobRequisitionValues, - getJobWorkspace, - getJobWorkspaces, - listJobPostings, - updateJobChangeBusinessTitle, -} from './job'; -export const Job = { - createJobChange, - getJobById, - getJobChangeFrequencies, - getJobChangeLocationInfo, - getJobChangePosition, - getJobChangeReasonInstance, - getJobChangeReasonValues, - getJobChangeReasons, - getJobChangesGroupTemplates, - getJobChangesJobValues, - getJobChangesWorkerValues, - getJobClassifications, - getJobPosting, - getJobPostingQuestionnaire, - getJobProfilesValues, - getJobRequisitionValues, - getJobWorkspace, - getJobWorkspaces, - listJobPostings, - updateJobChangeBusinessTitle, -}; - -import { - createPayrollInputs, - getPayrollInputInstance, - updateAnExistingPayroll, -} from './payroll'; -export const Payroll = { - createPayrollInputs, - getPayrollInputInstance, - updateAnExistingPayroll, -}; - -import { - createTimeOffRequest, - getTimeOffEntriesForWorker, - getTimeOffPlansForWorker, - getTimeOffStatusValues, - getTimeTypes, -} from './time'; -export const Time = { - createTimeOffRequest, - getTimeOffEntriesForWorker, - getTimeOffPlansForWorker, - getTimeOffStatusValues, - getTimeTypes, -}; - -import { getAbsenceBalance } from './absence'; -export const Absence = { getAbsenceBalance }; - -import { - getAssignmentChangeGroupCostCenters, - getAssignmentChangeGroupJobs, - getAssignmentTypes, -} from './assignment'; -export const Assignment = { - getAssignmentChangeGroupCostCenters, - getAssignmentChangeGroupJobs, - getAssignmentTypes, -}; - -import { getCandidateAvailabilityTemplate } from './candidate'; -export const Candidate = { getCandidateAvailabilityTemplate }; - -import { getCollectionOfJobs, getCollectionOfPayroll } from './collection'; -export const Collection = { getCollectionOfJobs, getCollectionOfPayroll }; - -import { getCompanyInsiderTypes } from './company'; -export const Company = { getCompanyInsiderTypes }; - -import { getContingentWorkerTypes } from './contingent'; -export const Contingent = { getContingentWorkerTypes }; - -import { getCountryInfo } from './country'; -export const Country = { getCountryInfo }; - -import { getCurrencies } from './currencies'; -export const Currencies = { getCurrencies }; - -import { getCurrentUser } from './current'; -export const Current = { getCurrentUser }; - -import { getGrants } from './grants'; -export const Grants = { getGrants }; - -import { getHeadcountOptions } from './headcount'; -export const Headcount = { getHeadcountOptions }; - -import { - getHistoryInstanceForWorker, - getHistoryItemsForWorker, -} from './history'; -export const History = { - getHistoryInstanceForWorker, - getHistoryItemsForWorker, -}; - -import { getHolidayEvents } from './holiday'; -export const Holiday = { getHolidayEvents }; - -import { getInterview, getInterviewFeedback2 } from './interview'; -export const Interview = { getInterview, getInterviewFeedback2 }; - -import { getLeaveStatusValues } from './leave'; -export const Leave = { getLeaveStatusValues }; - -import { getMyJobPostings } from './my'; -export const My = { getMyJobPostings }; - -import { - getOrganizationAssignmentBusinessUnits, - getOrganizationAssignmentCustoms, - getOrganizationAssignmentFunds, - getOrganizationAssignmentRegions, - getOrganizationAssignmentWorkers, -} from './organization'; -export const Organization = { - getOrganizationAssignmentBusinessUnits, - getOrganizationAssignmentCustoms, - getOrganizationAssignmentFunds, - getOrganizationAssignmentRegions, - getOrganizationAssignmentWorkers, -}; - -import { - getPayGroupByJobId, - getPaySlipInstancesForWorker, - getPaySlipsForWorker, -} from './pay'; -export const Pay = { - getPayGroupByJobId, - getPaySlipInstancesForWorker, - getPaySlipsForWorker, -}; - -import { getProposedPositionValues } from './proposed'; -export const Proposed = { getProposedPositionValues }; - -import { - getProspect, - getProspectEducations, - getProspectExperiences, - getProspectResumeAttachments, - getProspectSkills, -} from './prospect'; -export const Prospect = { - getProspect, - getProspectEducations, - getProspectExperiences, - getProspectResumeAttachments, - getProspectSkills, -}; - -import { getSupervisoryOrgValues } from './supervisory'; -export const Supervisory = { getSupervisoryOrgValues }; - -import { getWorkStudyAwards } from './work'; -export const Work = { getWorkStudyAwards }; - -import { - getWorkerBusinessTitleChanges, - getWorkerEligibleAbsenceTypes, - getWorkerInfo, - getWorkerLeavesOfAbsence, - getWorkerServiceDates, - getWorkerStaffingInformation, - getWorkerTimeOffDetails, - getWorkerTypes, - getWorkerValidTimeOffDates, - retrieveWorkerLeaveOfAbsenceSubresource, -} from './worker'; -export const Worker = { - getWorkerBusinessTitleChanges, - getWorkerEligibleAbsenceTypes, - getWorkerInfo, - getWorkerLeavesOfAbsence, - getWorkerServiceDates, - getWorkerStaffingInformation, - getWorkerTimeOffDetails, - getWorkerTypes, - getWorkerValidTimeOffDates, - retrieveWorkerLeaveOfAbsenceSubresource, -}; - -import { getWorkersCollectionStaffing } from './workers'; -export const Workers = { getWorkersCollectionStaffing }; - -import { getWorkspaceInstances } from './workspace'; -export const Workspace = { getWorkspaceInstances }; - -import { listBalances } from './balances'; -export const Balances = { listBalances }; - -import { listCountries } from './countries'; -export const Countries = { listCountries }; - -import { listInterviews } from './interviews'; -export const Interviews = { listInterviews }; - -import { listJobs } from './jobs'; -export const Jobs = { listJobs }; - -import { updateMessageTemplateById } from './message'; -export const Message = { updateMessageTemplateById }; - -export * from './types'; +export { + buildQuery, + createWorkdayEndpoint, + executeWorkdayOperation, + requestBody, + resolvePath, +} from './factory'; +export { + Absence, + Assignment, + Balances, + Business, + Candidate, + Collection, + Company, + Contingent, + Countries, + Country, + Currencies, + Current, + Grants, + Headcount, + History, + Holiday, + Interview, + Interviews, + Job, + Jobs, + Leave, + Message, + My, + Organization, + Pay, + Payroll, + Proposed, + Prospect, + Supervisory, + Time, + Work, + Worker, + Workers, + Workspace, + workdayEndpointsNested, + workdayOperations, +} from './operations'; +export type { WorkdayRoute, WorkdayRouteName, WorkdayService } from './routes'; +export { workdayRouteByName, workdayRoutes } from './routes'; +export type { + WorkdayEndpointInput, + WorkdayEndpointInputs, + WorkdayEndpointOutputs, +} from './types'; +export { + WorkdayEndpointInputSchemas, + WorkdayEndpointOutputSchemas, +} from './types'; diff --git a/packages/workday/endpoints/interview.ts b/packages/workday/endpoints/interview.ts deleted file mode 100644 index 37f350754..000000000 --- a/packages/workday/endpoints/interview.ts +++ /dev/null @@ -1,42 +0,0 @@ -import { logEventFromContext } from 'corsair/core'; -import type { WorkdayEndpoints } from '..'; -import { makeWorkdayRequest } from '../client'; -import type { WorkdayEndpointOutputs } from './types'; - -export const getInterview: WorkdayEndpoints['getInterview'] = async ( - ctx, - input, -) => { - const response = await makeWorkdayRequest< - WorkdayEndpointOutputs['getInterview'] - >('v1/interview/getInterview', ctx.key, { - method: 'GET', - // Justification: The makeWorkdayRequest client expects a generic unknown record. - query: input as { [key: string]: string | number | boolean | undefined }, - }); - await logEventFromContext( - ctx, - 'workday.interview.getInterview', - input ?? {}, - 'completed', - ); - return response; -}; - -export const getInterviewFeedback2: WorkdayEndpoints['getInterviewFeedback2'] = - async (ctx, input) => { - const response = await makeWorkdayRequest< - WorkdayEndpointOutputs['getInterviewFeedback2'] - >('v1/interview/getInterviewFeedback2', ctx.key, { - method: 'GET', - // Justification: The makeWorkdayRequest client expects a generic string/number/boolean query record. - query: input as { [key: string]: string | number | boolean | undefined }, - }); - await logEventFromContext( - ctx, - 'workday.interview.getInterviewFeedback2', - input ?? {}, - 'completed', - ); - return response; - }; diff --git a/packages/workday/endpoints/interviews.ts b/packages/workday/endpoints/interviews.ts deleted file mode 100644 index 7b6453454..000000000 --- a/packages/workday/endpoints/interviews.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { logEventFromContext } from 'corsair/core'; -import type { WorkdayEndpoints } from '..'; -import { makeWorkdayRequest } from '../client'; -import type { WorkdayEndpointOutputs } from './types'; - -export const listInterviews: WorkdayEndpoints['listInterviews'] = async ( - ctx, - input, -) => { - const response = await makeWorkdayRequest< - WorkdayEndpointOutputs['listInterviews'] - >('v1/interviews/listInterviews', ctx.key, { - method: 'GET', - // Justification: The makeWorkdayRequest client expects a generic unknown record. - query: input as { [key: string]: string | number | boolean | undefined }, - }); - await logEventFromContext( - ctx, - 'workday.interviews.listInterviews', - input ?? {}, - 'completed', - ); - return response; -}; diff --git a/packages/workday/endpoints/job.ts b/packages/workday/endpoints/job.ts deleted file mode 100644 index 9847d46d7..000000000 --- a/packages/workday/endpoints/job.ts +++ /dev/null @@ -1,376 +0,0 @@ -import { logEventFromContext } from 'corsair/core'; -import type { WorkdayEndpoints } from '..'; -import { makeWorkdayRequest } from '../client'; -import type { WorkdayEndpointOutputs } from './types'; - -export const createJobChange: WorkdayEndpoints['createJobChange'] = async ( - ctx, - input, -) => { - const response = await makeWorkdayRequest< - WorkdayEndpointOutputs['createJobChange'] - >('v1/job/createJobChange', ctx.key, { - method: 'POST', - // Justification: The makeWorkdayRequest client expects a generic unknown record. - body: input as { [key: string]: unknown }, - }); - await logEventFromContext( - ctx, - 'workday.job.createJobChange', - input ?? {}, - 'completed', - ); - return response; -}; - -export const getJobById: WorkdayEndpoints['getJobById'] = async ( - ctx, - input, -) => { - const response = await makeWorkdayRequest< - WorkdayEndpointOutputs['getJobById'] - >(`v1/job/getJobById/${input?.id || ''}`, ctx.key, { - method: 'GET', - // Justification: The makeWorkdayRequest client expects a generic unknown record. - query: input as { [key: string]: string | number | boolean | undefined }, - }); - await logEventFromContext( - ctx, - 'workday.job.getJobById', - input ?? {}, - 'completed', - ); - return response; -}; - -export const getJobChangeFrequencies: WorkdayEndpoints['getJobChangeFrequencies'] = - async (ctx, input) => { - const response = await makeWorkdayRequest< - WorkdayEndpointOutputs['getJobChangeFrequencies'] - >('v1/job/getJobChangeFrequencies', ctx.key, { - method: 'GET', - // Justification: The makeWorkdayRequest client expects a generic string/number/boolean query record. - query: input as { [key: string]: string | number | boolean | undefined }, - }); - await logEventFromContext( - ctx, - 'workday.job.getJobChangeFrequencies', - input ?? {}, - 'completed', - ); - return response; - }; - -export const getJobChangeLocationInfo: WorkdayEndpoints['getJobChangeLocationInfo'] = - async (ctx, input) => { - const response = await makeWorkdayRequest< - WorkdayEndpointOutputs['getJobChangeLocationInfo'] - >('v1/job/getJobChangeLocationInfo', ctx.key, { - method: 'GET', - // Justification: The makeWorkdayRequest client expects a generic string/number/boolean query record. - query: input as { [key: string]: string | number | boolean | undefined }, - }); - await logEventFromContext( - ctx, - 'workday.job.getJobChangeLocationInfo', - input ?? {}, - 'completed', - ); - return response; - }; - -export const getJobChangePosition: WorkdayEndpoints['getJobChangePosition'] = - async (ctx, input) => { - const response = await makeWorkdayRequest< - WorkdayEndpointOutputs['getJobChangePosition'] - >('v1/job/getJobChangePosition', ctx.key, { - method: 'GET', - // Justification: The makeWorkdayRequest client expects a generic string/number/boolean query record. - query: input as { [key: string]: string | number | boolean | undefined }, - }); - await logEventFromContext( - ctx, - 'workday.job.getJobChangePosition', - input ?? {}, - 'completed', - ); - return response; - }; - -export const getJobChangeReasonInstance: WorkdayEndpoints['getJobChangeReasonInstance'] = - async (ctx, input) => { - const response = await makeWorkdayRequest< - WorkdayEndpointOutputs['getJobChangeReasonInstance'] - >('v1/job/getJobChangeReasonInstance', ctx.key, { - method: 'GET', - // Justification: The makeWorkdayRequest client expects a generic string/number/boolean query record. - query: input as { [key: string]: string | number | boolean | undefined }, - }); - await logEventFromContext( - ctx, - 'workday.job.getJobChangeReasonInstance', - input ?? {}, - 'completed', - ); - return response; - }; - -export const getJobChangeReasonValues: WorkdayEndpoints['getJobChangeReasonValues'] = - async (ctx, input) => { - const response = await makeWorkdayRequest< - WorkdayEndpointOutputs['getJobChangeReasonValues'] - >('v1/job/getJobChangeReasonValues', ctx.key, { - method: 'GET', - // Justification: The makeWorkdayRequest client expects a generic string/number/boolean query record. - query: input as { [key: string]: string | number | boolean | undefined }, - }); - await logEventFromContext( - ctx, - 'workday.job.getJobChangeReasonValues', - input ?? {}, - 'completed', - ); - return response; - }; - -export const getJobChangeReasons: WorkdayEndpoints['getJobChangeReasons'] = - async (ctx, input) => { - const response = await makeWorkdayRequest< - WorkdayEndpointOutputs['getJobChangeReasons'] - >('v1/job/getJobChangeReasons', ctx.key, { - method: 'GET', - // Justification: The makeWorkdayRequest client expects a generic string/number/boolean query record. - query: input as { [key: string]: string | number | boolean | undefined }, - }); - await logEventFromContext( - ctx, - 'workday.job.getJobChangeReasons', - input ?? {}, - 'completed', - ); - return response; - }; - -export const getJobChangesGroupTemplates: WorkdayEndpoints['getJobChangesGroupTemplates'] = - async (ctx, input) => { - const response = await makeWorkdayRequest< - WorkdayEndpointOutputs['getJobChangesGroupTemplates'] - >('v1/job/getJobChangesGroupTemplates', ctx.key, { - method: 'GET', - // Justification: The makeWorkdayRequest client expects a generic string/number/boolean query record. - query: input as { [key: string]: string | number | boolean | undefined }, - }); - await logEventFromContext( - ctx, - 'workday.job.getJobChangesGroupTemplates', - input ?? {}, - 'completed', - ); - return response; - }; - -export const getJobChangesJobValues: WorkdayEndpoints['getJobChangesJobValues'] = - async (ctx, input) => { - const response = await makeWorkdayRequest< - WorkdayEndpointOutputs['getJobChangesJobValues'] - >('v1/job/getJobChangesJobValues', ctx.key, { - method: 'GET', - // Justification: The makeWorkdayRequest client expects a generic string/number/boolean query record. - query: input as { [key: string]: string | number | boolean | undefined }, - }); - await logEventFromContext( - ctx, - 'workday.job.getJobChangesJobValues', - input ?? {}, - 'completed', - ); - return response; - }; - -export const getJobChangesWorkerValues: WorkdayEndpoints['getJobChangesWorkerValues'] = - async (ctx, input) => { - const response = await makeWorkdayRequest< - WorkdayEndpointOutputs['getJobChangesWorkerValues'] - >('v1/job/getJobChangesWorkerValues', ctx.key, { - method: 'GET', - // Justification: The makeWorkdayRequest client expects a generic string/number/boolean query record. - query: input as { [key: string]: string | number | boolean | undefined }, - }); - await logEventFromContext( - ctx, - 'workday.job.getJobChangesWorkerValues', - input ?? {}, - 'completed', - ); - return response; - }; - -export const getJobClassifications: WorkdayEndpoints['getJobClassifications'] = - async (ctx, input) => { - const response = await makeWorkdayRequest< - WorkdayEndpointOutputs['getJobClassifications'] - >('v1/job/getJobClassifications', ctx.key, { - method: 'GET', - // Justification: The makeWorkdayRequest client expects a generic string/number/boolean query record. - query: input as { [key: string]: string | number | boolean | undefined }, - }); - await logEventFromContext( - ctx, - 'workday.job.getJobClassifications', - input ?? {}, - 'completed', - ); - return response; - }; - -export const getJobPosting: WorkdayEndpoints['getJobPosting'] = async ( - ctx, - input, -) => { - const response = await makeWorkdayRequest< - WorkdayEndpointOutputs['getJobPosting'] - >('v1/job/getJobPosting', ctx.key, { - method: 'GET', - // Justification: The makeWorkdayRequest client expects a generic unknown record. - query: input as { [key: string]: string | number | boolean | undefined }, - }); - await logEventFromContext( - ctx, - 'workday.job.getJobPosting', - input ?? {}, - 'completed', - ); - return response; -}; - -export const getJobPostingQuestionnaire: WorkdayEndpoints['getJobPostingQuestionnaire'] = - async (ctx, input) => { - const response = await makeWorkdayRequest< - WorkdayEndpointOutputs['getJobPostingQuestionnaire'] - >('v1/job/getJobPostingQuestionnaire', ctx.key, { - method: 'GET', - // Justification: The makeWorkdayRequest client expects a generic string/number/boolean query record. - query: input as { [key: string]: string | number | boolean | undefined }, - }); - await logEventFromContext( - ctx, - 'workday.job.getJobPostingQuestionnaire', - input ?? {}, - 'completed', - ); - return response; - }; - -export const getJobProfilesValues: WorkdayEndpoints['getJobProfilesValues'] = - async (ctx, input) => { - const response = await makeWorkdayRequest< - WorkdayEndpointOutputs['getJobProfilesValues'] - >('v1/job/getJobProfilesValues', ctx.key, { - method: 'GET', - // Justification: The makeWorkdayRequest client expects a generic string/number/boolean query record. - query: input as { [key: string]: string | number | boolean | undefined }, - }); - await logEventFromContext( - ctx, - 'workday.job.getJobProfilesValues', - input ?? {}, - 'completed', - ); - return response; - }; - -export const getJobRequisitionValues: WorkdayEndpoints['getJobRequisitionValues'] = - async (ctx, input) => { - const response = await makeWorkdayRequest< - WorkdayEndpointOutputs['getJobRequisitionValues'] - >('v1/job/getJobRequisitionValues', ctx.key, { - method: 'GET', - // Justification: The makeWorkdayRequest client expects a generic string/number/boolean query record. - query: input as { [key: string]: string | number | boolean | undefined }, - }); - await logEventFromContext( - ctx, - 'workday.job.getJobRequisitionValues', - input ?? {}, - 'completed', - ); - return response; - }; - -export const getJobWorkspace: WorkdayEndpoints['getJobWorkspace'] = async ( - ctx, - input, -) => { - const response = await makeWorkdayRequest< - WorkdayEndpointOutputs['getJobWorkspace'] - >('v1/job/getJobWorkspace', ctx.key, { - method: 'GET', - // Justification: The makeWorkdayRequest client expects a generic unknown record. - query: input as { [key: string]: string | number | boolean | undefined }, - }); - await logEventFromContext( - ctx, - 'workday.job.getJobWorkspace', - input ?? {}, - 'completed', - ); - return response; -}; - -export const getJobWorkspaces: WorkdayEndpoints['getJobWorkspaces'] = async ( - ctx, - input, -) => { - const response = await makeWorkdayRequest< - WorkdayEndpointOutputs['getJobWorkspaces'] - >('v1/job/getJobWorkspaces', ctx.key, { - method: 'GET', - // Justification: The makeWorkdayRequest client expects a generic unknown record. - query: input as { [key: string]: string | number | boolean | undefined }, - }); - await logEventFromContext( - ctx, - 'workday.job.getJobWorkspaces', - input ?? {}, - 'completed', - ); - return response; -}; - -export const listJobPostings: WorkdayEndpoints['listJobPostings'] = async ( - ctx, - input, -) => { - const response = await makeWorkdayRequest< - WorkdayEndpointOutputs['listJobPostings'] - >('v1/job/listJobPostings', ctx.key, { - method: 'GET', - // Justification: The makeWorkdayRequest client expects a generic unknown record. - query: input as { [key: string]: string | number | boolean | undefined }, - }); - await logEventFromContext( - ctx, - 'workday.job.listJobPostings', - input ?? {}, - 'completed', - ); - return response; -}; - -export const updateJobChangeBusinessTitle: WorkdayEndpoints['updateJobChangeBusinessTitle'] = - async (ctx, input) => { - const response = await makeWorkdayRequest< - WorkdayEndpointOutputs['updateJobChangeBusinessTitle'] - >('v1/job/updateJobChangeBusinessTitle', ctx.key, { - method: 'PUT', - // Justification: The makeWorkdayRequest client expects a generic unknown record. - body: input as { [key: string]: unknown }, - }); - await logEventFromContext( - ctx, - 'workday.job.updateJobChangeBusinessTitle', - input ?? {}, - 'completed', - ); - return response; - }; diff --git a/packages/workday/endpoints/jobs.ts b/packages/workday/endpoints/jobs.ts deleted file mode 100644 index 55313d931..000000000 --- a/packages/workday/endpoints/jobs.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { logEventFromContext } from 'corsair/core'; -import type { WorkdayEndpoints } from '..'; -import { makeWorkdayRequest } from '../client'; -import type { WorkdayEndpointOutputs } from './types'; - -export const listJobs: WorkdayEndpoints['listJobs'] = async (ctx, input) => { - const response = await makeWorkdayRequest( - 'v1/jobs/api', - ctx.key, - { - method: 'GET', - // Justification: The makeWorkdayRequest client expects a generic string/number/boolean query record. - query: input as { [key: string]: string | number | boolean | undefined }, - }, - ); - await logEventFromContext( - ctx, - 'workday.jobs.listJobs', - input ?? {}, - 'completed', - ); - return response; -}; diff --git a/packages/workday/endpoints/leave.ts b/packages/workday/endpoints/leave.ts deleted file mode 100644 index dbcdc1795..000000000 --- a/packages/workday/endpoints/leave.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { logEventFromContext } from 'corsair/core'; -import type { WorkdayEndpoints } from '..'; -import { makeWorkdayRequest } from '../client'; -import type { WorkdayEndpointOutputs } from './types'; - -export const getLeaveStatusValues: WorkdayEndpoints['getLeaveStatusValues'] = - async (ctx, input) => { - const response = await makeWorkdayRequest< - WorkdayEndpointOutputs['getLeaveStatusValues'] - >('v1/leave/getLeaveStatusValues', ctx.key, { - method: 'GET', - // Justification: The makeWorkdayRequest client expects a generic string/number/boolean query record. - query: input as { [key: string]: string | number | boolean | undefined }, - }); - await logEventFromContext( - ctx, - 'workday.leave.getLeaveStatusValues', - input ?? {}, - 'completed', - ); - return response; - }; diff --git a/packages/workday/endpoints/message.ts b/packages/workday/endpoints/message.ts deleted file mode 100644 index c35880725..000000000 --- a/packages/workday/endpoints/message.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { logEventFromContext } from 'corsair/core'; -import type { WorkdayEndpoints } from '..'; -import { makeWorkdayRequest } from '../client'; -import type { WorkdayEndpointOutputs } from './types'; - -export const updateMessageTemplateById: WorkdayEndpoints['updateMessageTemplateById'] = - async (ctx, input) => { - const response = await makeWorkdayRequest< - WorkdayEndpointOutputs['updateMessageTemplateById'] - >('v1/message/updateMessageTemplateById/{id}', ctx.key, { - method: 'PUT', - // Justification: The makeWorkdayRequest client expects a generic unknown record. - body: input as { [key: string]: unknown }, - }); - await logEventFromContext( - ctx, - 'workday.message.updateMessageTemplateById', - input ?? {}, - 'completed', - ); - return response; - }; diff --git a/packages/workday/endpoints/my.ts b/packages/workday/endpoints/my.ts deleted file mode 100644 index 7ea70b23b..000000000 --- a/packages/workday/endpoints/my.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { logEventFromContext } from 'corsair/core'; -import type { WorkdayEndpoints } from '..'; -import { makeWorkdayRequest } from '../client'; -import type { WorkdayEndpointOutputs } from './types'; - -export const getMyJobPostings: WorkdayEndpoints['getMyJobPostings'] = async ( - ctx, - input, -) => { - const response = await makeWorkdayRequest< - WorkdayEndpointOutputs['getMyJobPostings'] - >('v1/my/getMyJobPostings', ctx.key, { - method: 'GET', - // Justification: The makeWorkdayRequest client expects a generic unknown record. - query: input as { [key: string]: string | number | boolean | undefined }, - }); - await logEventFromContext( - ctx, - 'workday.my.getMyJobPostings', - input ?? {}, - 'completed', - ); - return response; -}; diff --git a/packages/workday/endpoints/operations.ts b/packages/workday/endpoints/operations.ts new file mode 100644 index 000000000..dac828e39 --- /dev/null +++ b/packages/workday/endpoints/operations.ts @@ -0,0 +1,215 @@ +import { createWorkdayEndpoint } from './factory'; +import type { WorkdayRouteName } from './routes'; +import { workdayRoutes } from './routes'; + +export const workdayOperations = Object.fromEntries( + workdayRoutes.map((route) => [route.name, createWorkdayEndpoint(route.name)]), +) as { [K in WorkdayRouteName]: ReturnType }; + +export const workdayEndpointsNested = { + business: { + createBusinessTitleChange: workdayOperations.createBusinessTitleChange, + getBusinessTitleChange: workdayOperations.getBusinessTitleChange, + getBusinessTitleChangeForWorker: + workdayOperations.getBusinessTitleChangeForWorker, + }, + job: { + createJobChange: workdayOperations.createJobChange, + getJobById: workdayOperations.getJobById, + getJobChangeFrequencies: workdayOperations.getJobChangeFrequencies, + getJobChangeLocationInfo: workdayOperations.getJobChangeLocationInfo, + getJobChangePosition: workdayOperations.getJobChangePosition, + getJobChangeReasonInstance: workdayOperations.getJobChangeReasonInstance, + getJobChangeReasonValues: workdayOperations.getJobChangeReasonValues, + getJobChangeReasons: workdayOperations.getJobChangeReasons, + getJobChangesGroupTemplates: workdayOperations.getJobChangesGroupTemplates, + getJobChangesJobValues: workdayOperations.getJobChangesJobValues, + getJobChangesWorkerValues: workdayOperations.getJobChangesWorkerValues, + getJobClassifications: workdayOperations.getJobClassifications, + getJobPosting: workdayOperations.getJobPosting, + getJobPostingQuestionnaire: workdayOperations.getJobPostingQuestionnaire, + getJobProfilesValues: workdayOperations.getJobProfilesValues, + getJobRequisitionValues: workdayOperations.getJobRequisitionValues, + getJobWorkspace: workdayOperations.getJobWorkspace, + getJobWorkspaces: workdayOperations.getJobWorkspaces, + listJobPostings: workdayOperations.listJobPostings, + updateJobChangeBusinessTitle: + workdayOperations.updateJobChangeBusinessTitle, + }, + payroll: { + createPayrollInputs: workdayOperations.createPayrollInputs, + getPayrollInputInstance: workdayOperations.getPayrollInputInstance, + updateAnExistingPayroll: workdayOperations.updateAnExistingPayroll, + }, + collection: { + getCollectionOfPayroll: workdayOperations.getCollectionOfPayroll, + getCollectionOfJobs: workdayOperations.getCollectionOfJobs, + }, + time: { + createTimeOffRequest: workdayOperations.createTimeOffRequest, + getTimeOffEntriesForWorker: workdayOperations.getTimeOffEntriesForWorker, + getTimeOffPlansForWorker: workdayOperations.getTimeOffPlansForWorker, + getTimeOffStatusValues: workdayOperations.getTimeOffStatusValues, + getTimeTypes: workdayOperations.getTimeTypes, + }, + absence: { + getAbsenceBalance: workdayOperations.getAbsenceBalance, + }, + balances: { + listBalances: workdayOperations.listBalances, + }, + assignment: { + getAssignmentChangeGroupCostCenters: + workdayOperations.getAssignmentChangeGroupCostCenters, + getAssignmentChangeGroupJobs: + workdayOperations.getAssignmentChangeGroupJobs, + getAssignmentTypes: workdayOperations.getAssignmentTypes, + }, + candidate: { + getCandidateAvailabilityTemplate: + workdayOperations.getCandidateAvailabilityTemplate, + }, + company: { + getCompanyInsiderTypes: workdayOperations.getCompanyInsiderTypes, + }, + contingent: { + getContingentWorkerTypes: workdayOperations.getContingentWorkerTypes, + }, + country: { + getCountryInfo: workdayOperations.getCountryInfo, + }, + currencies: { + getCurrencies: workdayOperations.getCurrencies, + }, + current: { + getCurrentUser: workdayOperations.getCurrentUser, + }, + grants: { + getGrants: workdayOperations.getGrants, + }, + headcount: { + getHeadcountOptions: workdayOperations.getHeadcountOptions, + }, + history: { + getHistoryInstanceForWorker: workdayOperations.getHistoryInstanceForWorker, + getHistoryItemsForWorker: workdayOperations.getHistoryItemsForWorker, + }, + holiday: { + getHolidayEvents: workdayOperations.getHolidayEvents, + }, + interview: { + getInterview: workdayOperations.getInterview, + getInterviewFeedback2: workdayOperations.getInterviewFeedback2, + }, + leave: { + getLeaveStatusValues: workdayOperations.getLeaveStatusValues, + }, + my: { + getMyJobPostings: workdayOperations.getMyJobPostings, + }, + organization: { + getOrganizationAssignmentBusinessUnits: + workdayOperations.getOrganizationAssignmentBusinessUnits, + getOrganizationAssignmentCustoms: + workdayOperations.getOrganizationAssignmentCustoms, + getOrganizationAssignmentFunds: + workdayOperations.getOrganizationAssignmentFunds, + getOrganizationAssignmentRegions: + workdayOperations.getOrganizationAssignmentRegions, + getOrganizationAssignmentWorkers: + workdayOperations.getOrganizationAssignmentWorkers, + }, + pay: { + getPayGroupByJobId: workdayOperations.getPayGroupByJobId, + getPaySlipInstancesForWorker: + workdayOperations.getPaySlipInstancesForWorker, + getPaySlipsForWorker: workdayOperations.getPaySlipsForWorker, + }, + proposed: { + getProposedPositionValues: workdayOperations.getProposedPositionValues, + }, + prospect: { + getProspect: workdayOperations.getProspect, + getProspectEducations: workdayOperations.getProspectEducations, + getProspectExperiences: workdayOperations.getProspectExperiences, + getProspectResumeAttachments: + workdayOperations.getProspectResumeAttachments, + getProspectSkills: workdayOperations.getProspectSkills, + }, + supervisory: { + getSupervisoryOrgValues: workdayOperations.getSupervisoryOrgValues, + }, + work: { + getWorkStudyAwards: workdayOperations.getWorkStudyAwards, + }, + worker: { + getWorkerBusinessTitleChanges: + workdayOperations.getWorkerBusinessTitleChanges, + getWorkerEligibleAbsenceTypes: + workdayOperations.getWorkerEligibleAbsenceTypes, + getWorkerInfo: workdayOperations.getWorkerInfo, + getWorkerLeavesOfAbsence: workdayOperations.getWorkerLeavesOfAbsence, + getWorkerServiceDates: workdayOperations.getWorkerServiceDates, + getWorkerStaffingInformation: + workdayOperations.getWorkerStaffingInformation, + getWorkerTimeOffDetails: workdayOperations.getWorkerTimeOffDetails, + getWorkerTypes: workdayOperations.getWorkerTypes, + getWorkerValidTimeOffDates: workdayOperations.getWorkerValidTimeOffDates, + retrieveWorkerLeaveOfAbsenceSubresource: + workdayOperations.retrieveWorkerLeaveOfAbsenceSubresource, + }, + workers: { + getWorkersCollectionStaffing: + workdayOperations.getWorkersCollectionStaffing, + }, + workspace: { + getWorkspaceInstances: workdayOperations.getWorkspaceInstances, + }, + countries: { + listCountries: workdayOperations.listCountries, + }, + interviews: { + listInterviews: workdayOperations.listInterviews, + }, + jobs: { + listJobs: workdayOperations.listJobs, + }, + message: { + updateMessageTemplateById: workdayOperations.updateMessageTemplateById, + }, +} as const; + +export const Business = workdayEndpointsNested.business; +export const Job = workdayEndpointsNested.job; +export const Payroll = workdayEndpointsNested.payroll; +export const Collection = workdayEndpointsNested.collection; +export const Time = workdayEndpointsNested.time; +export const Absence = workdayEndpointsNested.absence; +export const Balances = workdayEndpointsNested.balances; +export const Assignment = workdayEndpointsNested.assignment; +export const Candidate = workdayEndpointsNested.candidate; +export const Company = workdayEndpointsNested.company; +export const Contingent = workdayEndpointsNested.contingent; +export const Country = workdayEndpointsNested.country; +export const Currencies = workdayEndpointsNested.currencies; +export const Current = workdayEndpointsNested.current; +export const Grants = workdayEndpointsNested.grants; +export const Headcount = workdayEndpointsNested.headcount; +export const History = workdayEndpointsNested.history; +export const Holiday = workdayEndpointsNested.holiday; +export const Interview = workdayEndpointsNested.interview; +export const Leave = workdayEndpointsNested.leave; +export const My = workdayEndpointsNested.my; +export const Organization = workdayEndpointsNested.organization; +export const Pay = workdayEndpointsNested.pay; +export const Proposed = workdayEndpointsNested.proposed; +export const Prospect = workdayEndpointsNested.prospect; +export const Supervisory = workdayEndpointsNested.supervisory; +export const Work = workdayEndpointsNested.work; +export const Worker = workdayEndpointsNested.worker; +export const Workers = workdayEndpointsNested.workers; +export const Workspace = workdayEndpointsNested.workspace; +export const Countries = workdayEndpointsNested.countries; +export const Interviews = workdayEndpointsNested.interviews; +export const Jobs = workdayEndpointsNested.jobs; +export const Message = workdayEndpointsNested.message; diff --git a/packages/workday/endpoints/organization.ts b/packages/workday/endpoints/organization.ts deleted file mode 100644 index 666a0e2ff..000000000 --- a/packages/workday/endpoints/organization.ts +++ /dev/null @@ -1,94 +0,0 @@ -import { logEventFromContext } from 'corsair/core'; -import type { WorkdayEndpoints } from '..'; -import { makeWorkdayRequest } from '../client'; -import type { WorkdayEndpointOutputs } from './types'; - -export const getOrganizationAssignmentBusinessUnits: WorkdayEndpoints['getOrganizationAssignmentBusinessUnits'] = - async (ctx, input) => { - const response = await makeWorkdayRequest< - WorkdayEndpointOutputs['getOrganizationAssignmentBusinessUnits'] - >('v1/organization/getOrganizationAssignmentBusinessUnits', ctx.key, { - method: 'GET', - // Justification: The makeWorkdayRequest client expects a generic string/number/boolean query record. - query: input as { [key: string]: string | number | boolean | undefined }, - }); - await logEventFromContext( - ctx, - 'workday.organization.getOrganizationAssignmentBusinessUnits', - input ?? {}, - 'completed', - ); - return response; - }; - -export const getOrganizationAssignmentCustoms: WorkdayEndpoints['getOrganizationAssignmentCustoms'] = - async (ctx, input) => { - const response = await makeWorkdayRequest< - WorkdayEndpointOutputs['getOrganizationAssignmentCustoms'] - >('v1/organization/getOrganizationAssignmentCustoms', ctx.key, { - method: 'GET', - // Justification: The makeWorkdayRequest client expects a generic string/number/boolean query record. - query: input as { [key: string]: string | number | boolean | undefined }, - }); - await logEventFromContext( - ctx, - 'workday.organization.getOrganizationAssignmentCustoms', - input ?? {}, - 'completed', - ); - return response; - }; - -export const getOrganizationAssignmentFunds: WorkdayEndpoints['getOrganizationAssignmentFunds'] = - async (ctx, input) => { - const response = await makeWorkdayRequest< - WorkdayEndpointOutputs['getOrganizationAssignmentFunds'] - >('v1/organization/getOrganizationAssignmentFunds', ctx.key, { - method: 'GET', - // Justification: The makeWorkdayRequest client expects a generic string/number/boolean query record. - query: input as { [key: string]: string | number | boolean | undefined }, - }); - await logEventFromContext( - ctx, - 'workday.organization.getOrganizationAssignmentFunds', - input ?? {}, - 'completed', - ); - return response; - }; - -export const getOrganizationAssignmentRegions: WorkdayEndpoints['getOrganizationAssignmentRegions'] = - async (ctx, input) => { - const response = await makeWorkdayRequest< - WorkdayEndpointOutputs['getOrganizationAssignmentRegions'] - >('v1/organization/getOrganizationAssignmentRegions', ctx.key, { - method: 'GET', - // Justification: The makeWorkdayRequest client expects a generic string/number/boolean query record. - query: input as { [key: string]: string | number | boolean | undefined }, - }); - await logEventFromContext( - ctx, - 'workday.organization.getOrganizationAssignmentRegions', - input ?? {}, - 'completed', - ); - return response; - }; - -export const getOrganizationAssignmentWorkers: WorkdayEndpoints['getOrganizationAssignmentWorkers'] = - async (ctx, input) => { - const response = await makeWorkdayRequest< - WorkdayEndpointOutputs['getOrganizationAssignmentWorkers'] - >('v1/organization/getOrganizationAssignmentWorkers', ctx.key, { - method: 'GET', - // Justification: The makeWorkdayRequest client expects a generic string/number/boolean query record. - query: input as { [key: string]: string | number | boolean | undefined }, - }); - await logEventFromContext( - ctx, - 'workday.organization.getOrganizationAssignmentWorkers', - input ?? {}, - 'completed', - ); - return response; - }; diff --git a/packages/workday/endpoints/pay.ts b/packages/workday/endpoints/pay.ts deleted file mode 100644 index df901a6b9..000000000 --- a/packages/workday/endpoints/pay.ts +++ /dev/null @@ -1,58 +0,0 @@ -import { logEventFromContext } from 'corsair/core'; -import type { WorkdayEndpoints } from '..'; -import { makeWorkdayRequest } from '../client'; -import type { WorkdayEndpointOutputs } from './types'; - -export const getPayGroupByJobId: WorkdayEndpoints['getPayGroupByJobId'] = - async (ctx, input) => { - const response = await makeWorkdayRequest< - WorkdayEndpointOutputs['getPayGroupByJobId'] - >('v1/pay/getPayGroupByJobId', ctx.key, { - method: 'GET', - // Justification: The makeWorkdayRequest client expects a generic string/number/boolean query record. - query: input as { [key: string]: string | number | boolean | undefined }, - }); - await logEventFromContext( - ctx, - 'workday.pay.getPayGroupByJobId', - input ?? {}, - 'completed', - ); - return response; - }; - -export const getPaySlipInstancesForWorker: WorkdayEndpoints['getPaySlipInstancesForWorker'] = - async (ctx, input) => { - const response = await makeWorkdayRequest< - WorkdayEndpointOutputs['getPaySlipInstancesForWorker'] - >('v1/pay/getPaySlipInstancesForWorker', ctx.key, { - method: 'GET', - // Justification: The makeWorkdayRequest client expects a generic string/number/boolean query record. - query: input as { [key: string]: string | number | boolean | undefined }, - }); - await logEventFromContext( - ctx, - 'workday.pay.getPaySlipInstancesForWorker', - input ?? {}, - 'completed', - ); - return response; - }; - -export const getPaySlipsForWorker: WorkdayEndpoints['getPaySlipsForWorker'] = - async (ctx, input) => { - const response = await makeWorkdayRequest< - WorkdayEndpointOutputs['getPaySlipsForWorker'] - >('v1/pay/getPaySlipsForWorker', ctx.key, { - method: 'GET', - // Justification: The makeWorkdayRequest client expects a generic string/number/boolean query record. - query: input as { [key: string]: string | number | boolean | undefined }, - }); - await logEventFromContext( - ctx, - 'workday.pay.getPaySlipsForWorker', - input ?? {}, - 'completed', - ); - return response; - }; diff --git a/packages/workday/endpoints/payroll.ts b/packages/workday/endpoints/payroll.ts deleted file mode 100644 index bd51a3d20..000000000 --- a/packages/workday/endpoints/payroll.ts +++ /dev/null @@ -1,58 +0,0 @@ -import { logEventFromContext } from 'corsair/core'; -import type { WorkdayEndpoints } from '..'; -import { makeWorkdayRequest } from '../client'; -import type { WorkdayEndpointOutputs } from './types'; - -export const createPayrollInputs: WorkdayEndpoints['createPayrollInputs'] = - async (ctx, input) => { - const response = await makeWorkdayRequest< - WorkdayEndpointOutputs['createPayrollInputs'] - >('v1/payroll/createPayrollInputs', ctx.key, { - method: 'POST', - // Justification: The makeWorkdayRequest client expects a generic unknown record. - body: input as { [key: string]: unknown }, - }); - await logEventFromContext( - ctx, - 'workday.payroll.createPayrollInputs', - input ?? {}, - 'completed', - ); - return response; - }; - -export const getPayrollInputInstance: WorkdayEndpoints['getPayrollInputInstance'] = - async (ctx, input) => { - const response = await makeWorkdayRequest< - WorkdayEndpointOutputs['getPayrollInputInstance'] - >('v1/payroll/getPayrollInputInstance', ctx.key, { - method: 'GET', - // Justification: The makeWorkdayRequest client expects a generic string/number/boolean query record. - query: input as { [key: string]: string | number | boolean | undefined }, - }); - await logEventFromContext( - ctx, - 'workday.payroll.getPayrollInputInstance', - input ?? {}, - 'completed', - ); - return response; - }; - -export const updateAnExistingPayroll: WorkdayEndpoints['updateAnExistingPayroll'] = - async (ctx, input) => { - const response = await makeWorkdayRequest< - WorkdayEndpointOutputs['updateAnExistingPayroll'] - >('v1/payroll/updateAnExistingPayroll', ctx.key, { - method: 'PUT', - // Justification: The makeWorkdayRequest client expects a generic unknown record. - body: input as { [key: string]: unknown }, - }); - await logEventFromContext( - ctx, - 'workday.payroll.updateAnExistingPayroll', - input ?? {}, - 'completed', - ); - return response; - }; diff --git a/packages/workday/endpoints/proposed.ts b/packages/workday/endpoints/proposed.ts deleted file mode 100644 index cd87788eb..000000000 --- a/packages/workday/endpoints/proposed.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { logEventFromContext } from 'corsair/core'; -import type { WorkdayEndpoints } from '..'; -import { makeWorkdayRequest } from '../client'; -import type { WorkdayEndpointOutputs } from './types'; - -export const getProposedPositionValues: WorkdayEndpoints['getProposedPositionValues'] = - async (ctx, input) => { - const response = await makeWorkdayRequest< - WorkdayEndpointOutputs['getProposedPositionValues'] - >('v1/proposed/getProposedPositionValues', ctx.key, { - method: 'GET', - // Justification: The makeWorkdayRequest client expects a generic string/number/boolean query record. - query: input as { [key: string]: string | number | boolean | undefined }, - }); - await logEventFromContext( - ctx, - 'workday.proposed.getProposedPositionValues', - input ?? {}, - 'completed', - ); - return response; - }; diff --git a/packages/workday/endpoints/prospect.ts b/packages/workday/endpoints/prospect.ts deleted file mode 100644 index 0af8fdc15..000000000 --- a/packages/workday/endpoints/prospect.ts +++ /dev/null @@ -1,98 +0,0 @@ -import { logEventFromContext } from 'corsair/core'; -import type { WorkdayEndpoints } from '..'; -import { makeWorkdayRequest } from '../client'; -import type { WorkdayEndpointOutputs } from './types'; - -export const getProspect: WorkdayEndpoints['getProspect'] = async ( - ctx, - input, -) => { - const response = await makeWorkdayRequest< - WorkdayEndpointOutputs['getProspect'] - >('v1/prospect/getProspect', ctx.key, { - method: 'GET', - // Justification: The makeWorkdayRequest client expects a generic unknown record. - query: input as { [key: string]: string | number | boolean | undefined }, - }); - await logEventFromContext( - ctx, - 'workday.prospect.getProspect', - input ?? {}, - 'completed', - ); - return response; -}; - -export const getProspectEducations: WorkdayEndpoints['getProspectEducations'] = - async (ctx, input) => { - const response = await makeWorkdayRequest< - WorkdayEndpointOutputs['getProspectEducations'] - >('v1/prospect/getProspectEducations', ctx.key, { - method: 'GET', - // Justification: The makeWorkdayRequest client expects a generic string/number/boolean query record. - query: input as { [key: string]: string | number | boolean | undefined }, - }); - await logEventFromContext( - ctx, - 'workday.prospect.getProspectEducations', - input ?? {}, - 'completed', - ); - return response; - }; - -export const getProspectExperiences: WorkdayEndpoints['getProspectExperiences'] = - async (ctx, input) => { - const response = await makeWorkdayRequest< - WorkdayEndpointOutputs['getProspectExperiences'] - >('v1/prospect/getProspectExperiences', ctx.key, { - method: 'GET', - // Justification: The makeWorkdayRequest client expects a generic string/number/boolean query record. - query: input as { [key: string]: string | number | boolean | undefined }, - }); - await logEventFromContext( - ctx, - 'workday.prospect.getProspectExperiences', - input ?? {}, - 'completed', - ); - return response; - }; - -export const getProspectResumeAttachments: WorkdayEndpoints['getProspectResumeAttachments'] = - async (ctx, input) => { - const response = await makeWorkdayRequest< - WorkdayEndpointOutputs['getProspectResumeAttachments'] - >('v1/prospect/getProspectResumeAttachments', ctx.key, { - method: 'GET', - // Justification: The makeWorkdayRequest client expects a generic string/number/boolean query record. - query: input as { [key: string]: string | number | boolean | undefined }, - }); - await logEventFromContext( - ctx, - 'workday.prospect.getProspectResumeAttachments', - input ?? {}, - 'completed', - ); - return response; - }; - -export const getProspectSkills: WorkdayEndpoints['getProspectSkills'] = async ( - ctx, - input, -) => { - const response = await makeWorkdayRequest< - WorkdayEndpointOutputs['getProspectSkills'] - >('v1/prospect/getProspectSkills', ctx.key, { - method: 'GET', - // Justification: The makeWorkdayRequest client expects a generic unknown record. - query: input as { [key: string]: string | number | boolean | undefined }, - }); - await logEventFromContext( - ctx, - 'workday.prospect.getProspectSkills', - input ?? {}, - 'completed', - ); - return response; -}; diff --git a/packages/workday/endpoints/routes.ts b/packages/workday/endpoints/routes.ts new file mode 100644 index 000000000..daf7ccdaa --- /dev/null +++ b/packages/workday/endpoints/routes.ts @@ -0,0 +1,1450 @@ +import type { EndpointRiskLevel } from 'corsair/core'; + +export type WorkdayMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE'; +export type WorkdayService = + | 'staffing' + | 'absenceManagement' + | 'recruiting' + | 'payroll' + | 'common' + | 'person'; + +export type WorkdayRoute = { + key: string; + group: string; + name: string; + method: WorkdayMethod; + service: WorkdayService; + version: string; + path: string; + description: string; + pathParams: readonly string[]; + queryParams: readonly string[]; + riskLevel: EndpointRiskLevel; +}; + +/** + * Workday REST routes for the Composio-aligned surface (85 ops). + * Paths verified against Workday REST Directory + Staffing v6 prompt/resource docs. + * Base: https://{host}/ccx/api/{service}/{version}/{tenant}{path} + */ +export const workdayRoutes = [ + { + key: 'createBusinessTitleChange', + group: 'business', + name: 'createBusinessTitleChange', + method: 'POST', + service: 'common', + version: 'v1', + path: '/workers/{ID}/businessTitleChanges', + description: + 'Creates a business title change for a worker (Common API v1).', + pathParams: ['ID'] as const, + queryParams: [] as const, + riskLevel: 'write' as const, + }, + { + key: 'getBusinessTitleChange', + group: 'business', + name: 'getBusinessTitleChange', + method: 'GET', + service: 'common', + version: 'v1', + path: '/businessTitleChanges/{ID}', + description: + 'Retrieves a business title change instance by ID (Common API v1).', + pathParams: ['ID'] as const, + queryParams: [] as const, + riskLevel: 'read' as const, + }, + { + key: 'getBusinessTitleChangeForWorker', + group: 'business', + name: 'getBusinessTitleChangeForWorker', + method: 'GET', + service: 'common', + version: 'v1', + path: '/workers/{ID}/businessTitleChanges/{subresourceID}', + description: + 'Retrieves a business title change for a specific worker (Common API v1).', + pathParams: ['ID', 'subresourceID'] as const, + queryParams: [] as const, + riskLevel: 'read' as const, + }, + { + key: 'createJobChange', + group: 'job', + name: 'createJobChange', + method: 'POST', + service: 'staffing', + version: 'v6', + path: '/workers/{ID}/jobChanges', + description: 'Initiates a job change for a worker (Staffing v6).', + pathParams: ['ID'] as const, + queryParams: [] as const, + riskLevel: 'write' as const, + }, + { + key: 'getJobById', + group: 'job', + name: 'getJobById', + method: 'GET', + service: 'staffing', + version: 'v6', + path: '/jobs/{ID}', + description: 'Retrieves a single job instance by ID (Staffing v6).', + pathParams: ['ID'] as const, + queryParams: ['limit', 'offset'] as const, + riskLevel: 'read' as const, + }, + { + key: 'getJobChangeFrequencies', + group: 'job', + name: 'getJobChangeFrequencies', + method: 'GET', + service: 'staffing', + version: 'v6', + path: '/values/jobChangesGroup/frequencies', + description: + 'Retrieves frequency prompt values for job changes (Staffing v6).', + pathParams: [] as const, + queryParams: [ + 'effectiveDate', + 'event', + 'job', + 'location', + 'manager', + 'staffingEvent', + 'worker', + 'limit', + 'offset', + ] as const, + riskLevel: 'read' as const, + }, + { + key: 'getJobChangeLocationInfo', + group: 'job', + name: 'getJobChangeLocationInfo', + method: 'GET', + service: 'staffing', + version: 'v6', + path: '/jobChanges/{ID}/location', + description: 'Retrieves location info for a job change (Staffing v6).', + pathParams: ['ID'] as const, + queryParams: [] as const, + riskLevel: 'read' as const, + }, + { + key: 'getJobChangePosition', + group: 'job', + name: 'getJobChangePosition', + method: 'GET', + service: 'staffing', + version: 'v6', + path: '/jobChanges/{ID}/position', + description: 'Retrieves position details for a job change (Staffing v6).', + pathParams: ['ID'] as const, + queryParams: [] as const, + riskLevel: 'read' as const, + }, + { + key: 'getJobChangeReasonInstance', + group: 'job', + name: 'getJobChangeReasonInstance', + method: 'GET', + service: 'staffing', + version: 'v6', + path: '/values/jobChangesGroup/reason/{ID}', + description: 'Retrieves a job change reason instance (Staffing v6).', + pathParams: ['ID'] as const, + queryParams: [] as const, + riskLevel: 'read' as const, + }, + { + key: 'getJobChangeReasonValues', + group: 'job', + name: 'getJobChangeReasonValues', + method: 'GET', + service: 'staffing', + version: 'v6', + path: '/values/jobChangesGroup/reason', + description: 'Retrieves job change reason prompt values (Staffing v6).', + pathParams: [] as const, + queryParams: [ + 'effectiveDate', + 'event', + 'job', + 'location', + 'manager', + 'staffingEvent', + 'worker', + 'limit', + 'offset', + ] as const, + riskLevel: 'read' as const, + }, + { + key: 'getJobChangeReasons', + group: 'job', + name: 'getJobChangeReasons', + method: 'GET', + service: 'staffing', + version: 'v6', + path: '/values/jobChangesGroup/reason', + description: 'Retrieves job change reasons collection (Staffing v6).', + pathParams: [] as const, + queryParams: [ + 'effectiveDate', + 'event', + 'staffingEvent', + 'worker', + 'limit', + 'offset', + ] as const, + riskLevel: 'read' as const, + }, + { + key: 'getJobChangesGroupTemplates', + group: 'job', + name: 'getJobChangesGroupTemplates', + method: 'GET', + service: 'staffing', + version: 'v6', + path: '/values/jobChangesGroup/templates', + description: 'Retrieves job change templates (Staffing v6).', + pathParams: [] as const, + queryParams: [ + 'effectiveDate', + 'event', + 'job', + 'location', + 'manager', + 'staffingEvent', + 'worker', + 'limit', + 'offset', + ] as const, + riskLevel: 'read' as const, + }, + { + key: 'getJobChangesJobValues', + group: 'job', + name: 'getJobChangesJobValues', + method: 'GET', + service: 'staffing', + version: 'v6', + path: '/values/jobChangesGroup/jobs', + description: 'Retrieves job prompt values for job changes (Staffing v6).', + pathParams: [] as const, + queryParams: ['effectiveDate', 'worker', 'limit', 'offset'] as const, + riskLevel: 'read' as const, + }, + { + key: 'getJobChangesWorkerValues', + group: 'job', + name: 'getJobChangesWorkerValues', + method: 'GET', + service: 'staffing', + version: 'v6', + path: '/values/jobChangesGroup/workers', + description: + 'Retrieves worker prompt values for job changes (Staffing v6).', + pathParams: [] as const, + queryParams: ['effectiveDate', 'limit', 'offset'] as const, + riskLevel: 'read' as const, + }, + { + key: 'getJobClassifications', + group: 'job', + name: 'getJobClassifications', + method: 'GET', + service: 'staffing', + version: 'v6', + path: '/values/jobChangesGroup/jobClassifications', + description: 'Retrieves job classification prompt values (Staffing v6).', + pathParams: [] as const, + queryParams: [ + 'effectiveDate', + 'event', + 'job', + 'location', + 'manager', + 'staffingEvent', + 'worker', + 'limit', + 'offset', + ] as const, + riskLevel: 'read' as const, + }, + { + key: 'getJobPosting', + group: 'job', + name: 'getJobPosting', + method: 'GET', + service: 'recruiting', + version: 'v4', + path: '/jobPostings/{ID}', + description: + 'Retrieves a job posting including description (Recruiting v4).', + pathParams: ['ID'] as const, + queryParams: [] as const, + riskLevel: 'read' as const, + }, + { + key: 'getJobPostingQuestionnaire', + group: 'job', + name: 'getJobPostingQuestionnaire', + method: 'GET', + service: 'recruiting', + version: 'v4', + path: '/jobPostings/{ID}/questionnaires', + description: 'Retrieves questionnaires for a job posting (Recruiting v4).', + pathParams: ['ID'] as const, + queryParams: ['limit', 'offset'] as const, + riskLevel: 'read' as const, + }, + { + key: 'getJobProfilesValues', + group: 'job', + name: 'getJobProfilesValues', + method: 'GET', + service: 'staffing', + version: 'v6', + path: '/values/jobChangesGroup/jobProfiles', + description: 'Retrieves job profile prompt values (Staffing v6).', + pathParams: [] as const, + queryParams: [ + 'effectiveDate', + 'event', + 'job', + 'location', + 'manager', + 'staffingEvent', + 'worker', + 'limit', + 'offset', + ] as const, + riskLevel: 'read' as const, + }, + { + key: 'getJobRequisitionValues', + group: 'job', + name: 'getJobRequisitionValues', + method: 'GET', + service: 'staffing', + version: 'v6', + path: '/values/jobChangesGroup/jobRequisitions', + description: 'Retrieves job requisition prompt values (Staffing v6).', + pathParams: [] as const, + queryParams: [ + 'effectiveDate', + 'event', + 'job', + 'location', + 'manager', + 'staffingEvent', + 'worker', + 'limit', + 'offset', + ] as const, + riskLevel: 'read' as const, + }, + { + key: 'getJobWorkspace', + group: 'job', + name: 'getJobWorkspace', + method: 'GET', + service: 'staffing', + version: 'v6', + path: '/jobs/{ID}/workspace/{subresourceID}', + description: 'Retrieves a workspace for a job (Staffing v6).', + pathParams: ['ID', 'subresourceID'] as const, + queryParams: [] as const, + riskLevel: 'read' as const, + }, + { + key: 'getJobWorkspaces', + group: 'job', + name: 'getJobWorkspaces', + method: 'GET', + service: 'staffing', + version: 'v6', + path: '/jobs/{ID}/workspace', + description: 'Retrieves workspaces for a job (Staffing v6).', + pathParams: ['ID'] as const, + queryParams: ['limit', 'offset'] as const, + riskLevel: 'read' as const, + }, + { + key: 'listJobPostings', + group: 'job', + name: 'listJobPostings', + method: 'GET', + service: 'recruiting', + version: 'v4', + path: '/jobPostings', + description: 'Lists job postings (Recruiting v4).', + pathParams: [] as const, + queryParams: [ + 'limit', + 'offset', + 'jobRequisition', + 'category', + 'id', + 'jobSite', + ] as const, + riskLevel: 'read' as const, + }, + { + key: 'updateJobChangeBusinessTitle', + group: 'job', + name: 'updateJobChangeBusinessTitle', + method: 'PATCH', + service: 'staffing', + version: 'v6', + path: '/jobChanges/{ID}/businessTitle/{subresourceID}', + description: + 'Partially updates business title on a job change (Staffing v6).', + pathParams: ['ID', 'subresourceID'] as const, + queryParams: [] as const, + riskLevel: 'write' as const, + }, + { + key: 'createPayrollInputs', + group: 'payroll', + name: 'createPayrollInputs', + method: 'POST', + service: 'payroll', + version: 'v1', + path: '/payrollInputs', + description: 'Creates payroll inputs (Payroll v1).', + pathParams: [] as const, + queryParams: [] as const, + riskLevel: 'write' as const, + }, + { + key: 'getPayrollInputInstance', + group: 'payroll', + name: 'getPayrollInputInstance', + method: 'GET', + service: 'payroll', + version: 'v1', + path: '/payrollInputs/{ID}', + description: 'Retrieves a payroll input by ID (Payroll v1).', + pathParams: ['ID'] as const, + queryParams: [] as const, + riskLevel: 'read' as const, + }, + { + key: 'updateAnExistingPayroll', + group: 'payroll', + name: 'updateAnExistingPayroll', + method: 'PATCH', + service: 'payroll', + version: 'v1', + path: '/payrollInputs/{ID}', + description: 'Partially updates a payroll input (Payroll v1).', + pathParams: ['ID'] as const, + queryParams: [] as const, + riskLevel: 'write' as const, + }, + { + key: 'getCollectionOfPayroll', + group: 'collection', + name: 'getCollectionOfPayroll', + method: 'GET', + service: 'payroll', + version: 'v1', + path: '/payrollInputs', + description: 'Retrieves a collection of payroll inputs (Payroll v1).', + pathParams: [] as const, + queryParams: [ + 'limit', + 'offset', + 'startDate', + 'endDate', + 'worker', + 'payComponent', + ] as const, + riskLevel: 'read' as const, + }, + { + key: 'createTimeOffRequest', + group: 'time', + name: 'createTimeOffRequest', + method: 'POST', + service: 'absenceManagement', + version: 'v5', + path: '/workers/{ID}/requestTimeOff', + description: 'Creates a time off request (Absence Management v5).', + pathParams: ['ID'] as const, + queryParams: [] as const, + riskLevel: 'write' as const, + }, + { + key: 'getTimeOffEntriesForWorker', + group: 'time', + name: 'getTimeOffEntriesForWorker', + method: 'GET', + service: 'common', + version: 'v1', + path: '/workers/{ID}/timeOffEntries', + description: 'Retrieves time off entries for a worker (Common API v1).', + pathParams: ['ID'] as const, + queryParams: ['limit', 'offset'] as const, + riskLevel: 'read' as const, + }, + { + key: 'getTimeOffPlansForWorker', + group: 'time', + name: 'getTimeOffPlansForWorker', + method: 'GET', + service: 'common', + version: 'v1', + path: '/workers/{ID}/timeOffPlans', + description: 'Retrieves time off plans for a worker (Common API v1).', + pathParams: ['ID'] as const, + queryParams: ['limit', 'offset'] as const, + riskLevel: 'read' as const, + }, + { + key: 'getTimeOffStatusValues', + group: 'time', + name: 'getTimeOffStatusValues', + method: 'GET', + service: 'absenceManagement', + version: 'v5', + path: '/values/timeOff/status', + description: + 'Retrieves time off status prompt values (Absence Management v5).', + pathParams: [] as const, + queryParams: ['limit', 'offset'] as const, + riskLevel: 'read' as const, + }, + { + key: 'getTimeTypes', + group: 'time', + name: 'getTimeTypes', + method: 'GET', + service: 'staffing', + version: 'v6', + path: '/values/jobChangesGroup/timeTypes', + description: 'Retrieves time type prompt values (Staffing v6).', + pathParams: [] as const, + queryParams: [ + 'effectiveDate', + 'event', + 'job', + 'location', + 'manager', + 'staffingEvent', + 'worker', + 'limit', + 'offset', + ] as const, + riskLevel: 'read' as const, + }, + { + key: 'getAbsenceBalance', + group: 'absence', + name: 'getAbsenceBalance', + method: 'GET', + service: 'absenceManagement', + version: 'v5', + path: '/balances/{ID}', + description: 'Retrieves an absence balance by ID (Absence Management v5).', + pathParams: ['ID'] as const, + queryParams: ['worker', 'absencePlan', 'effective'] as const, + riskLevel: 'read' as const, + }, + { + key: 'listBalances', + group: 'balances', + name: 'listBalances', + method: 'GET', + service: 'absenceManagement', + version: 'v5', + path: '/balances', + description: 'Lists absence balances (Absence Management v5).', + pathParams: [] as const, + queryParams: [ + 'limit', + 'offset', + 'worker', + 'category', + 'effective', + ] as const, + riskLevel: 'read' as const, + }, + { + key: 'getAssignmentChangeGroupCostCenters', + group: 'assignment', + name: 'getAssignmentChangeGroupCostCenters', + method: 'GET', + service: 'staffing', + version: 'v6', + path: '/values/organizationAssignmentChangesGroup/costCenters', + description: + 'Retrieves cost center prompt values for org assignment changes (Staffing v6).', + pathParams: [] as const, + queryParams: [ + 'effectiveDate', + 'event', + 'organizationType', + 'worker', + 'limit', + 'offset', + ] as const, + riskLevel: 'read' as const, + }, + { + key: 'getAssignmentChangeGroupJobs', + group: 'assignment', + name: 'getAssignmentChangeGroupJobs', + method: 'GET', + service: 'staffing', + version: 'v6', + path: '/values/organizationAssignmentChangesGroup/jobs', + description: + 'Retrieves job prompt values for org assignment changes (Staffing v6).', + pathParams: [] as const, + queryParams: [ + 'effectiveDate', + 'event', + 'organizationType', + 'worker', + 'limit', + 'offset', + ] as const, + riskLevel: 'read' as const, + }, + { + key: 'getAssignmentTypes', + group: 'assignment', + name: 'getAssignmentTypes', + method: 'GET', + service: 'staffing', + version: 'v6', + path: '/values/jobChangesGroup/assignmentTypes', + description: 'Retrieves assignment type prompt values (Staffing v6).', + pathParams: [] as const, + queryParams: [ + 'effectiveDate', + 'event', + 'job', + 'location', + 'manager', + 'staffingEvent', + 'worker', + 'limit', + 'offset', + ] as const, + riskLevel: 'read' as const, + }, + { + key: 'getCandidateAvailabilityTemplate', + group: 'candidate', + name: 'getCandidateAvailabilityTemplate', + method: 'GET', + service: 'recruiting', + version: 'v4', + path: '/jobPostings/{ID}/candidateAvailabilityTemplate', + description: + 'Retrieves candidate availability template for a job posting (Recruiting v4).', + pathParams: ['ID'] as const, + queryParams: [] as const, + riskLevel: 'read' as const, + }, + { + key: 'getCollectionOfJobs', + group: 'collection', + name: 'getCollectionOfJobs', + method: 'GET', + service: 'staffing', + version: 'v6', + path: '/jobs', + description: 'Retrieves a paginated collection of jobs (Staffing v6).', + pathParams: [] as const, + queryParams: [ + 'limit', + 'offset', + 'includeTerminatedWorkers', + 'search', + ] as const, + riskLevel: 'read' as const, + }, + { + key: 'getCompanyInsiderTypes', + group: 'company', + name: 'getCompanyInsiderTypes', + method: 'GET', + service: 'staffing', + version: 'v6', + path: '/values/jobChangesGroup/companyInsiderTypes', + description: 'Retrieves company insider type prompt values (Staffing v6).', + pathParams: [] as const, + queryParams: [ + 'effectiveDate', + 'event', + 'job', + 'location', + 'manager', + 'staffingEvent', + 'worker', + 'limit', + 'offset', + ] as const, + riskLevel: 'read' as const, + }, + { + key: 'getContingentWorkerTypes', + group: 'contingent', + name: 'getContingentWorkerTypes', + method: 'GET', + service: 'staffing', + version: 'v6', + path: '/values/jobChangesGroup/contingentWorkerTypes', + description: + 'Retrieves contingent worker type prompt values (Staffing v6).', + pathParams: [] as const, + queryParams: [ + 'effectiveDate', + 'event', + 'job', + 'location', + 'manager', + 'staffingEvent', + 'worker', + 'limit', + 'offset', + ] as const, + riskLevel: 'read' as const, + }, + { + key: 'getCountryInfo', + group: 'country', + name: 'getCountryInfo', + method: 'GET', + service: 'common', + version: 'v1', + path: '/countries/{ID}', + description: 'Retrieves country info (Common API v1).', + pathParams: ['ID'] as const, + queryParams: [] as const, + riskLevel: 'read' as const, + }, + { + key: 'getCurrencies', + group: 'currencies', + name: 'getCurrencies', + method: 'GET', + service: 'staffing', + version: 'v6', + path: '/values/jobChangesGroup/currencies', + description: + 'Retrieves currency prompt values for job changes (Staffing v6).', + pathParams: [] as const, + queryParams: [ + 'effectiveDate', + 'event', + 'job', + 'location', + 'manager', + 'staffingEvent', + 'worker', + 'limit', + 'offset', + ] as const, + riskLevel: 'read' as const, + }, + { + key: 'getCurrentUser', + group: 'current', + name: 'getCurrentUser', + method: 'GET', + service: 'staffing', + version: 'v6', + path: '/workers/me', + description: 'Retrieves the authenticated worker profile (Staffing v6).', + pathParams: [] as const, + queryParams: [] as const, + riskLevel: 'read' as const, + }, + { + key: 'getGrants', + group: 'grants', + name: 'getGrants', + method: 'GET', + service: 'staffing', + version: 'v6', + path: '/values/organizationAssignmentChangesGroup/grants', + description: + 'Retrieves grant prompt values for org assignment changes (Staffing v6).', + pathParams: [] as const, + queryParams: [ + 'effectiveDate', + 'event', + 'organizationType', + 'worker', + 'limit', + 'offset', + ] as const, + riskLevel: 'read' as const, + }, + { + key: 'getHeadcountOptions', + group: 'headcount', + name: 'getHeadcountOptions', + method: 'GET', + service: 'staffing', + version: 'v6', + path: '/values/jobChangesGroup/headcountOptions', + description: 'Retrieves headcount option prompt values (Staffing v6).', + pathParams: [] as const, + queryParams: [ + 'effectiveDate', + 'event', + 'job', + 'location', + 'manager', + 'staffingEvent', + 'worker', + 'limit', + 'offset', + ] as const, + riskLevel: 'read' as const, + }, + { + key: 'getHistoryInstanceForWorker', + group: 'history', + name: 'getHistoryInstanceForWorker', + method: 'GET', + service: 'common', + version: 'v1', + path: '/workers/{ID}/history/{subresourceID}', + description: 'Retrieves a history instance for a worker (Common API v1).', + pathParams: ['ID', 'subresourceID'] as const, + queryParams: [] as const, + riskLevel: 'read' as const, + }, + { + key: 'getHistoryItemsForWorker', + group: 'history', + name: 'getHistoryItemsForWorker', + method: 'GET', + service: 'common', + version: 'v1', + path: '/workers/{ID}/history', + description: 'Retrieves history items for a worker (Common API v1).', + pathParams: ['ID'] as const, + queryParams: ['limit', 'offset'] as const, + riskLevel: 'read' as const, + }, + { + key: 'getHolidayEvents', + group: 'holiday', + name: 'getHolidayEvents', + method: 'GET', + service: 'person', + version: 'v4', + path: '/holidayEvents', + description: + 'Retrieves holiday events for workers/time period (Person v4).', + pathParams: [] as const, + queryParams: ['limit', 'offset', 'fromDate', 'toDate', 'worker'] as const, + riskLevel: 'read' as const, + }, + { + key: 'getInterview', + group: 'interview', + name: 'getInterview', + method: 'GET', + service: 'recruiting', + version: 'v4', + path: '/interviews/{ID}', + description: 'Retrieves an interview by ID (Recruiting v4).', + pathParams: ['ID'] as const, + queryParams: [] as const, + riskLevel: 'read' as const, + }, + { + key: 'getInterviewFeedback2', + group: 'interview', + name: 'getInterviewFeedback2', + method: 'GET', + service: 'recruiting', + version: 'v4', + path: '/interviews/{ID}/feedback', + description: 'Retrieves interview feedback (Recruiting v4).', + pathParams: ['ID'] as const, + queryParams: ['limit', 'offset'] as const, + riskLevel: 'read' as const, + }, + { + key: 'getLeaveStatusValues', + group: 'leave', + name: 'getLeaveStatusValues', + method: 'GET', + service: 'absenceManagement', + version: 'v5', + path: '/values/leave/status', + description: + 'Retrieves leave status prompt values (Absence Management v5).', + pathParams: [] as const, + queryParams: ['limit', 'offset'] as const, + riskLevel: 'read' as const, + }, + { + key: 'getMyJobPostings', + group: 'my', + name: 'getMyJobPostings', + method: 'GET', + service: 'recruiting', + version: 'v4', + path: '/jobPostings', + description: + 'Retrieves job postings for the authenticated recruiter (Recruiting v4).', + pathParams: [] as const, + queryParams: ['limit', 'offset'] as const, + riskLevel: 'read' as const, + }, + { + key: 'getOrganizationAssignmentBusinessUnits', + group: 'organization', + name: 'getOrganizationAssignmentBusinessUnits', + method: 'GET', + service: 'staffing', + version: 'v6', + path: '/values/organizationAssignmentChangesGroup/businessUnits', + description: + 'Retrieves business unit prompt values for org assignment changes (Staffing v6).', + pathParams: [] as const, + queryParams: [ + 'effectiveDate', + 'event', + 'organizationType', + 'worker', + 'limit', + 'offset', + ] as const, + riskLevel: 'read' as const, + }, + { + key: 'getOrganizationAssignmentCustoms', + group: 'organization', + name: 'getOrganizationAssignmentCustoms', + method: 'GET', + service: 'staffing', + version: 'v6', + path: '/values/organizationAssignmentChangesGroup/customs', + description: 'Retrieves custom org assignment prompt values (Staffing v6).', + pathParams: [] as const, + queryParams: [ + 'effectiveDate', + 'event', + 'organizationType', + 'worker', + 'limit', + 'offset', + ] as const, + riskLevel: 'read' as const, + }, + { + key: 'getOrganizationAssignmentFunds', + group: 'organization', + name: 'getOrganizationAssignmentFunds', + method: 'GET', + service: 'staffing', + version: 'v6', + path: '/values/organizationAssignmentChangesGroup/funds', + description: + 'Retrieves fund prompt values for org assignment changes (Staffing v6).', + pathParams: [] as const, + queryParams: [ + 'effectiveDate', + 'event', + 'organizationType', + 'worker', + 'limit', + 'offset', + ] as const, + riskLevel: 'read' as const, + }, + { + key: 'getOrganizationAssignmentRegions', + group: 'organization', + name: 'getOrganizationAssignmentRegions', + method: 'GET', + service: 'staffing', + version: 'v6', + path: '/values/organizationAssignmentChangesGroup/regions', + description: + 'Retrieves region prompt values for org assignment changes (Staffing v6).', + pathParams: [] as const, + queryParams: [ + 'effectiveDate', + 'event', + 'organizationType', + 'worker', + 'limit', + 'offset', + ] as const, + riskLevel: 'read' as const, + }, + { + key: 'getOrganizationAssignmentWorkers', + group: 'organization', + name: 'getOrganizationAssignmentWorkers', + method: 'GET', + service: 'staffing', + version: 'v6', + path: '/values/organizationAssignmentChangesGroup/workers', + description: + 'Retrieves worker prompt values for org assignment changes (Staffing v6).', + pathParams: [] as const, + queryParams: [ + 'effectiveDate', + 'event', + 'organizationType', + 'worker', + 'limit', + 'offset', + ] as const, + riskLevel: 'read' as const, + }, + { + key: 'getPayGroupByJobId', + group: 'pay', + name: 'getPayGroupByJobId', + method: 'GET', + service: 'staffing', + version: 'v6', + path: '/jobs/{ID}/payGroup', + description: 'Retrieves the pay group for a job (Staffing v6).', + pathParams: ['ID'] as const, + queryParams: [] as const, + riskLevel: 'read' as const, + }, + { + key: 'getPaySlipInstancesForWorker', + group: 'pay', + name: 'getPaySlipInstancesForWorker', + method: 'GET', + service: 'common', + version: 'v1', + path: '/workers/{ID}/paySlips/{subresourceID}', + description: 'Retrieves a pay slip instance for a worker (Common API v1).', + pathParams: ['ID', 'subresourceID'] as const, + queryParams: [] as const, + riskLevel: 'read' as const, + }, + { + key: 'getPaySlipsForWorker', + group: 'pay', + name: 'getPaySlipsForWorker', + method: 'GET', + service: 'common', + version: 'v1', + path: '/workers/{ID}/paySlips', + description: 'Retrieves pay slips for a worker (Common API v1).', + pathParams: ['ID'] as const, + queryParams: ['limit', 'offset'] as const, + riskLevel: 'read' as const, + }, + { + key: 'getProposedPositionValues', + group: 'proposed', + name: 'getProposedPositionValues', + method: 'GET', + service: 'staffing', + version: 'v6', + path: '/values/jobChangesGroup/proposedPosition', + description: 'Retrieves proposed position prompt values (Staffing v6).', + pathParams: [] as const, + queryParams: [ + 'effectiveDate', + 'event', + 'job', + 'location', + 'manager', + 'staffingEvent', + 'worker', + 'limit', + 'offset', + ] as const, + riskLevel: 'read' as const, + }, + { + key: 'getProspect', + group: 'prospect', + name: 'getProspect', + method: 'GET', + service: 'recruiting', + version: 'v4', + path: '/prospects/{ID}', + description: 'Retrieves a prospect (Recruiting v4).', + pathParams: ['ID'] as const, + queryParams: [] as const, + riskLevel: 'read' as const, + }, + { + key: 'getProspectEducations', + group: 'prospect', + name: 'getProspectEducations', + method: 'GET', + service: 'recruiting', + version: 'v4', + path: '/prospects/{ID}/educations', + description: 'Retrieves prospect educations (Recruiting v4).', + pathParams: ['ID'] as const, + queryParams: ['limit', 'offset'] as const, + riskLevel: 'read' as const, + }, + { + key: 'getProspectExperiences', + group: 'prospect', + name: 'getProspectExperiences', + method: 'GET', + service: 'recruiting', + version: 'v4', + path: '/prospects/{ID}/experiences', + description: 'Retrieves prospect experiences (Recruiting v4).', + pathParams: ['ID'] as const, + queryParams: ['limit', 'offset'] as const, + riskLevel: 'read' as const, + }, + { + key: 'getProspectResumeAttachments', + group: 'prospect', + name: 'getProspectResumeAttachments', + method: 'GET', + service: 'recruiting', + version: 'v4', + path: '/prospects/{ID}/resumeAttachments', + description: 'Retrieves prospect resume attachments (Recruiting v4).', + pathParams: ['ID'] as const, + queryParams: ['limit', 'offset'] as const, + riskLevel: 'read' as const, + }, + { + key: 'getProspectSkills', + group: 'prospect', + name: 'getProspectSkills', + method: 'GET', + service: 'recruiting', + version: 'v4', + path: '/prospects/{ID}/skills', + description: 'Retrieves prospect skills (Recruiting v4).', + pathParams: ['ID'] as const, + queryParams: ['limit', 'offset'] as const, + riskLevel: 'read' as const, + }, + { + key: 'getSupervisoryOrgValues', + group: 'supervisory', + name: 'getSupervisoryOrgValues', + method: 'GET', + service: 'staffing', + version: 'v6', + path: '/values/jobChangesGroup/supervisoryOrganization', + description: + 'Retrieves supervisory organization prompt values (Staffing v6).', + pathParams: [] as const, + queryParams: [ + 'effectiveDate', + 'event', + 'job', + 'location', + 'manager', + 'staffingEvent', + 'worker', + 'limit', + 'offset', + ] as const, + riskLevel: 'read' as const, + }, + { + key: 'getWorkStudyAwards', + group: 'work', + name: 'getWorkStudyAwards', + method: 'GET', + service: 'staffing', + version: 'v6', + path: '/values/jobChangesGroup/workStudyAwards', + description: 'Retrieves work study award prompt values (Staffing v6).', + pathParams: [] as const, + queryParams: [ + 'effectiveDate', + 'event', + 'job', + 'location', + 'manager', + 'staffingEvent', + 'worker', + 'limit', + 'offset', + ] as const, + riskLevel: 'read' as const, + }, + { + key: 'getWorkerBusinessTitleChanges', + group: 'worker', + name: 'getWorkerBusinessTitleChanges', + method: 'GET', + service: 'common', + version: 'v1', + path: '/workers/{ID}/businessTitleChanges', + description: + 'Retrieves business title changes for a worker (Common API v1).', + pathParams: ['ID'] as const, + queryParams: ['limit', 'offset'] as const, + riskLevel: 'read' as const, + }, + { + key: 'getWorkerEligibleAbsenceTypes', + group: 'worker', + name: 'getWorkerEligibleAbsenceTypes', + method: 'GET', + service: 'absenceManagement', + version: 'v5', + path: '/workers/{ID}/eligibleAbsenceTypes', + description: + 'Retrieves eligible absence types for a worker (Absence Management v5).', + pathParams: ['ID'] as const, + queryParams: ['limit', 'offset', 'effective'] as const, + riskLevel: 'read' as const, + }, + { + key: 'getWorkerInfo', + group: 'worker', + name: 'getWorkerInfo', + method: 'GET', + service: 'staffing', + version: 'v6', + path: '/workers/{ID}', + description: 'Retrieves worker staffing information (Staffing v6).', + pathParams: ['ID'] as const, + queryParams: [] as const, + riskLevel: 'read' as const, + }, + { + key: 'getWorkerLeavesOfAbsence', + group: 'worker', + name: 'getWorkerLeavesOfAbsence', + method: 'GET', + service: 'absenceManagement', + version: 'v5', + path: '/workers/{ID}/leavesOfAbsence', + description: + 'Retrieves leaves of absence for a worker (Absence Management v5).', + pathParams: ['ID'] as const, + queryParams: ['limit', 'offset', 'fromDate', 'toDate', 'status'] as const, + riskLevel: 'read' as const, + }, + { + key: 'getWorkerServiceDates', + group: 'worker', + name: 'getWorkerServiceDates', + method: 'GET', + service: 'staffing', + version: 'v6', + path: '/workers/{ID}/serviceDates', + description: 'Retrieves service dates for a worker (Staffing v6).', + pathParams: ['ID'] as const, + queryParams: ['limit', 'offset'] as const, + riskLevel: 'read' as const, + }, + { + key: 'getWorkerStaffingInformation', + group: 'worker', + name: 'getWorkerStaffingInformation', + method: 'GET', + service: 'staffing', + version: 'v6', + path: '/workers/{ID}', + description: + 'Retrieves current staffing information for a worker (Staffing v6).', + pathParams: ['ID'] as const, + queryParams: [] as const, + riskLevel: 'read' as const, + }, + { + key: 'getWorkerTimeOffDetails', + group: 'worker', + name: 'getWorkerTimeOffDetails', + method: 'GET', + service: 'absenceManagement', + version: 'v5', + path: '/workers/{ID}/timeOffDetails', + description: + 'Retrieves time off details for a worker (Absence Management v5).', + pathParams: ['ID'] as const, + queryParams: ['limit', 'offset', 'fromDate', 'toDate'] as const, + riskLevel: 'read' as const, + }, + { + key: 'getWorkerTypes', + group: 'worker', + name: 'getWorkerTypes', + method: 'GET', + service: 'staffing', + version: 'v6', + path: '/values/jobChangesGroup/workerTypes', + description: 'Retrieves worker type prompt values (Staffing v6).', + pathParams: [] as const, + queryParams: [ + 'effectiveDate', + 'event', + 'job', + 'location', + 'manager', + 'staffingEvent', + 'worker', + 'limit', + 'offset', + ] as const, + riskLevel: 'read' as const, + }, + { + key: 'getWorkerValidTimeOffDates', + group: 'worker', + name: 'getWorkerValidTimeOffDates', + method: 'GET', + service: 'absenceManagement', + version: 'v5', + path: '/workers/{ID}/validTimeOffDates', + description: + 'Retrieves valid time off dates for a worker (Absence Management v5).', + pathParams: ['ID'] as const, + queryParams: [ + 'fromDate', + 'toDate', + 'timeOffType', + 'limit', + 'offset', + ] as const, + riskLevel: 'read' as const, + }, + { + key: 'retrieveWorkerLeaveOfAbsenceSubresource', + group: 'worker', + name: 'retrieveWorkerLeaveOfAbsenceSubresource', + method: 'GET', + service: 'absenceManagement', + version: 'v5', + path: '/workers/{ID}/leavesOfAbsence/{subresourceID}', + description: + 'Retrieves a leave of absence subresource (Absence Management v5).', + pathParams: ['ID', 'subresourceID'] as const, + queryParams: [] as const, + riskLevel: 'read' as const, + }, + { + key: 'getWorkersCollectionStaffing', + group: 'workers', + name: 'getWorkersCollectionStaffing', + method: 'GET', + service: 'staffing', + version: 'v6', + path: '/workers', + description: 'Retrieves workers with staffing information (Staffing v6).', + pathParams: [] as const, + queryParams: [ + 'limit', + 'offset', + 'includeTerminatedWorkers', + 'search', + ] as const, + riskLevel: 'read' as const, + }, + { + key: 'getWorkspaceInstances', + group: 'workspace', + name: 'getWorkspaceInstances', + method: 'GET', + service: 'staffing', + version: 'v6', + path: '/values/jobChangesGroup/workSpaces', + description: 'Retrieves workspace prompt values (Staffing v6).', + pathParams: [] as const, + queryParams: [ + 'effectiveDate', + 'event', + 'job', + 'location', + 'manager', + 'staffingEvent', + 'worker', + 'limit', + 'offset', + ] as const, + riskLevel: 'read' as const, + }, + { + key: 'listCountries', + group: 'countries', + name: 'listCountries', + method: 'GET', + service: 'recruiting', + version: 'v4', + path: '/values/jobPostingsGroup/countries', + description: 'Retrieves country values for recruiting (Recruiting v4).', + pathParams: [] as const, + queryParams: ['limit', 'offset'] as const, + riskLevel: 'read' as const, + }, + { + key: 'listInterviews', + group: 'interviews', + name: 'listInterviews', + method: 'GET', + service: 'recruiting', + version: 'v4', + path: '/interviews', + description: 'Lists interviews (Recruiting v4).', + pathParams: [] as const, + queryParams: ['limit', 'offset', 'status'] as const, + riskLevel: 'read' as const, + }, + { + key: 'listJobs', + group: 'jobs', + name: 'listJobs', + method: 'GET', + service: 'staffing', + version: 'v6', + path: '/jobs', + description: 'Lists jobs (Staffing v6).', + pathParams: [] as const, + queryParams: [ + 'limit', + 'offset', + 'includeTerminatedWorkers', + 'search', + ] as const, + riskLevel: 'read' as const, + }, + { + key: 'updateMessageTemplateById', + group: 'message', + name: 'updateMessageTemplateById', + method: 'PUT', + service: 'recruiting', + version: 'v4', + path: '/messageTemplates/{ID}', + description: 'Updates a message template by ID (Recruiting v4).', + pathParams: ['ID'] as const, + queryParams: [] as const, + riskLevel: 'write' as const, + }, +] as const satisfies readonly WorkdayRoute[]; + +export type WorkdayRouteName = (typeof workdayRoutes)[number]['name']; + +export const workdayRouteByName = Object.fromEntries( + workdayRoutes.map((r) => [r.name, r]), +) as { [K in WorkdayRouteName]: (typeof workdayRoutes)[number] }; + +export function getWorkdayRoute(name: WorkdayRouteName): WorkdayRoute { + return workdayRouteByName[name]; +} diff --git a/packages/workday/endpoints/supervisory.ts b/packages/workday/endpoints/supervisory.ts deleted file mode 100644 index 04d68dd7d..000000000 --- a/packages/workday/endpoints/supervisory.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { logEventFromContext } from 'corsair/core'; -import type { WorkdayEndpoints } from '..'; -import { makeWorkdayRequest } from '../client'; -import type { WorkdayEndpointOutputs } from './types'; - -export const getSupervisoryOrgValues: WorkdayEndpoints['getSupervisoryOrgValues'] = - async (ctx, input) => { - const response = await makeWorkdayRequest< - WorkdayEndpointOutputs['getSupervisoryOrgValues'] - >('v1/supervisory/getSupervisoryOrgValues', ctx.key, { - method: 'GET', - // Justification: The makeWorkdayRequest client expects a generic string/number/boolean query record. - query: input as { [key: string]: string | number | boolean | undefined }, - }); - await logEventFromContext( - ctx, - 'workday.supervisory.getSupervisoryOrgValues', - input ?? {}, - 'completed', - ); - return response; - }; diff --git a/packages/workday/endpoints/time.ts b/packages/workday/endpoints/time.ts deleted file mode 100644 index 5b6994f76..000000000 --- a/packages/workday/endpoints/time.ts +++ /dev/null @@ -1,96 +0,0 @@ -import { logEventFromContext } from 'corsair/core'; -import type { WorkdayEndpoints } from '..'; -import { makeWorkdayRequest } from '../client'; -import type { WorkdayEndpointOutputs } from './types'; - -export const createTimeOffRequest: WorkdayEndpoints['createTimeOffRequest'] = - async (ctx, input) => { - const response = await makeWorkdayRequest< - WorkdayEndpointOutputs['createTimeOffRequest'] - >('v1/time/createTimeOffRequest', ctx.key, { - method: 'POST', - // Justification: The makeWorkdayRequest client expects a generic unknown record. - body: input as { [key: string]: unknown }, - }); - await logEventFromContext( - ctx, - 'workday.time.createTimeOffRequest', - input ?? {}, - 'completed', - ); - return response; - }; - -export const getTimeOffEntriesForWorker: WorkdayEndpoints['getTimeOffEntriesForWorker'] = - async (ctx, input) => { - const response = await makeWorkdayRequest< - WorkdayEndpointOutputs['getTimeOffEntriesForWorker'] - >('v1/time/getTimeOffEntriesForWorker', ctx.key, { - method: 'GET', - // Justification: The makeWorkdayRequest client expects a generic string/number/boolean query record. - query: input as { [key: string]: string | number | boolean | undefined }, - }); - await logEventFromContext( - ctx, - 'workday.time.getTimeOffEntriesForWorker', - input ?? {}, - 'completed', - ); - return response; - }; - -export const getTimeOffPlansForWorker: WorkdayEndpoints['getTimeOffPlansForWorker'] = - async (ctx, input) => { - const response = await makeWorkdayRequest< - WorkdayEndpointOutputs['getTimeOffPlansForWorker'] - >('v1/time/getTimeOffPlansForWorker', ctx.key, { - method: 'GET', - // Justification: The makeWorkdayRequest client expects a generic string/number/boolean query record. - query: input as { [key: string]: string | number | boolean | undefined }, - }); - await logEventFromContext( - ctx, - 'workday.time.getTimeOffPlansForWorker', - input ?? {}, - 'completed', - ); - return response; - }; - -export const getTimeOffStatusValues: WorkdayEndpoints['getTimeOffStatusValues'] = - async (ctx, input) => { - const response = await makeWorkdayRequest< - WorkdayEndpointOutputs['getTimeOffStatusValues'] - >('v1/time/getTimeOffStatusValues', ctx.key, { - method: 'GET', - // Justification: The makeWorkdayRequest client expects a generic string/number/boolean query record. - query: input as { [key: string]: string | number | boolean | undefined }, - }); - await logEventFromContext( - ctx, - 'workday.time.getTimeOffStatusValues', - input ?? {}, - 'completed', - ); - return response; - }; - -export const getTimeTypes: WorkdayEndpoints['getTimeTypes'] = async ( - ctx, - input, -) => { - const response = await makeWorkdayRequest< - WorkdayEndpointOutputs['getTimeTypes'] - >('v1/time/getTimeTypes', ctx.key, { - method: 'GET', - // Justification: The makeWorkdayRequest client expects a generic unknown record. - query: input as { [key: string]: string | number | boolean | undefined }, - }); - await logEventFromContext( - ctx, - 'workday.time.getTimeTypes', - input ?? {}, - 'completed', - ); - return response; -}; diff --git a/packages/workday/endpoints/types.ts b/packages/workday/endpoints/types.ts index 01858b0d1..101468ca8 100644 --- a/packages/workday/endpoints/types.ts +++ b/packages/workday/endpoints/types.ts @@ -1,1926 +1,1354 @@ import { z } from 'zod'; - -const CreateBusinessTitleChangeInputSchema = z - .object({ id: z.string(), workerId: z.string().optional() }) - .passthrough() - .optional(); -export type CreateBusinessTitleChangeInput = z.infer< - typeof CreateBusinessTitleChangeInputSchema ->; - -const CreateBusinessTitleChangeResponseSchema = z.union([ - z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()), - z.array( - // Justification: Catching all unknown properties for forward-compatibility. - z.unknown(), - ), -]); -export type CreateBusinessTitleChangeResponse = z.infer< - typeof CreateBusinessTitleChangeResponseSchema ->; - -const CreateJobChangeInputSchema = z - .object({ id: z.string(), workerId: z.string().optional() }) - .passthrough() - .optional(); -export type CreateJobChangeInput = z.infer; - -const CreateJobChangeResponseSchema = z.union([ - z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()), - z.array( - // Justification: Catching all unknown properties for forward-compatibility. - z.unknown(), - ), -]); -export type CreateJobChangeResponse = z.infer< - typeof CreateJobChangeResponseSchema ->; - -const CreatePayrollInputsInputSchema = z - .object({ id: z.string(), workerId: z.string().optional() }) - .passthrough() - .optional(); -export type CreatePayrollInputsInput = z.infer< - typeof CreatePayrollInputsInputSchema ->; - -const CreatePayrollInputsResponseSchema = z.union([ - z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()), - z.array( - // Justification: Catching all unknown properties for forward-compatibility. - z.unknown(), - ), -]); -export type CreatePayrollInputsResponse = z.infer< - typeof CreatePayrollInputsResponseSchema ->; - -const CreateTimeOffRequestInputSchema = z - .object({ id: z.string(), workerId: z.string().optional() }) - .passthrough() - .optional(); -export type CreateTimeOffRequestInput = z.infer< - typeof CreateTimeOffRequestInputSchema ->; - -const CreateTimeOffRequestResponseSchema = z.union([ - z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()), - z.array( - // Justification: Catching all unknown properties for forward-compatibility. - z.unknown(), - ), -]); -export type CreateTimeOffRequestResponse = z.infer< - typeof CreateTimeOffRequestResponseSchema ->; - -const GetAbsenceBalanceInputSchema = z - .object({ cursor: z.string().optional(), limit: z.number().optional() }) - .passthrough(); -export type GetAbsenceBalanceInput = z.infer< - typeof GetAbsenceBalanceInputSchema ->; - -const GetAbsenceBalanceResponseSchema = z.union([ - z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()), - z.array( - // Justification: Catching all unknown properties for forward-compatibility. - z.unknown(), - ), -]); -export type GetAbsenceBalanceResponse = z.infer< - typeof GetAbsenceBalanceResponseSchema ->; - -const GetAssignmentChangeGroupCostCentersInputSchema = z - .object({ cursor: z.string().optional(), limit: z.number().optional() }) - .passthrough(); -export type GetAssignmentChangeGroupCostCentersInput = z.infer< - typeof GetAssignmentChangeGroupCostCentersInputSchema ->; - -const GetAssignmentChangeGroupCostCentersResponseSchema = z.union([ - z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()), - z.array( - // Justification: Catching all unknown properties for forward-compatibility. - z.unknown(), - ), -]); -export type GetAssignmentChangeGroupCostCentersResponse = z.infer< - typeof GetAssignmentChangeGroupCostCentersResponseSchema ->; - -const GetAssignmentChangeGroupJobsInputSchema = z - .object({ cursor: z.string().optional(), limit: z.number().optional() }) - .passthrough(); -export type GetAssignmentChangeGroupJobsInput = z.infer< - typeof GetAssignmentChangeGroupJobsInputSchema ->; - -const GetAssignmentChangeGroupJobsResponseSchema = z.union([ - z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()), - z.array( - // Justification: Catching all unknown properties for forward-compatibility. - z.unknown(), - ), -]); -export type GetAssignmentChangeGroupJobsResponse = z.infer< - typeof GetAssignmentChangeGroupJobsResponseSchema ->; - -const GetAssignmentTypesInputSchema = z - .object({ cursor: z.string().optional(), limit: z.number().optional() }) - .passthrough(); -export type GetAssignmentTypesInput = z.infer< - typeof GetAssignmentTypesInputSchema ->; - -const GetAssignmentTypesResponseSchema = z.union([ - z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()), - z.array( - // Justification: Catching all unknown properties for forward-compatibility. - z.unknown(), - ), -]); -export type GetAssignmentTypesResponse = z.infer< - typeof GetAssignmentTypesResponseSchema ->; - -const GetBusinessTitleChangeInputSchema = z - .object({ cursor: z.string().optional(), limit: z.number().optional() }) - .passthrough(); -export type GetBusinessTitleChangeInput = z.infer< - typeof GetBusinessTitleChangeInputSchema ->; - -const GetBusinessTitleChangeResponseSchema = z.union([ - z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()), - z.array( - // Justification: Catching all unknown properties for forward-compatibility. - z.unknown(), - ), -]); -export type GetBusinessTitleChangeResponse = z.infer< - typeof GetBusinessTitleChangeResponseSchema ->; - -const GetBusinessTitleChangeForWorkerInputSchema = z - .object({ cursor: z.string().optional(), limit: z.number().optional() }) - .passthrough(); -export type GetBusinessTitleChangeForWorkerInput = z.infer< - typeof GetBusinessTitleChangeForWorkerInputSchema ->; - -const GetBusinessTitleChangeForWorkerResponseSchema = z.union([ - z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()), - z.array( - // Justification: Catching all unknown properties for forward-compatibility. - z.unknown(), - ), -]); -export type GetBusinessTitleChangeForWorkerResponse = z.infer< - typeof GetBusinessTitleChangeForWorkerResponseSchema ->; - -const GetCandidateAvailabilityTemplateInputSchema = z - .object({ cursor: z.string().optional(), limit: z.number().optional() }) - .passthrough(); -export type GetCandidateAvailabilityTemplateInput = z.infer< - typeof GetCandidateAvailabilityTemplateInputSchema ->; - -const GetCandidateAvailabilityTemplateResponseSchema = z.union([ - z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()), - z.array( - // Justification: Catching all unknown properties for forward-compatibility. - z.unknown(), - ), -]); -export type GetCandidateAvailabilityTemplateResponse = z.infer< - typeof GetCandidateAvailabilityTemplateResponseSchema ->; - -const GetCollectionOfJobsInputSchema = z - .object({ cursor: z.string().optional(), limit: z.number().optional() }) - .passthrough(); -export type GetCollectionOfJobsInput = z.infer< - typeof GetCollectionOfJobsInputSchema ->; - -const GetCollectionOfJobsResponseSchema = z.union([ - z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()), - z.array( - // Justification: Catching all unknown properties for forward-compatibility. - z.unknown(), - ), -]); -export type GetCollectionOfJobsResponse = z.infer< - typeof GetCollectionOfJobsResponseSchema ->; - -const GetCollectionOfPayrollInputSchema = z - .object({ cursor: z.string().optional(), limit: z.number().optional() }) - .passthrough(); -export type GetCollectionOfPayrollInput = z.infer< - typeof GetCollectionOfPayrollInputSchema ->; - -const GetCollectionOfPayrollResponseSchema = z.union([ - z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()), - z.array( - // Justification: Catching all unknown properties for forward-compatibility. - z.unknown(), - ), -]); -export type GetCollectionOfPayrollResponse = z.infer< - typeof GetCollectionOfPayrollResponseSchema ->; - -const GetCompanyInsiderTypesInputSchema = z - .object({ cursor: z.string().optional(), limit: z.number().optional() }) - .passthrough(); -export type GetCompanyInsiderTypesInput = z.infer< - typeof GetCompanyInsiderTypesInputSchema ->; - -const GetCompanyInsiderTypesResponseSchema = z.union([ - z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()), - z.array( - // Justification: Catching all unknown properties for forward-compatibility. - z.unknown(), - ), -]); -export type GetCompanyInsiderTypesResponse = z.infer< - typeof GetCompanyInsiderTypesResponseSchema ->; - -const GetContingentWorkerTypesInputSchema = z - .object({ cursor: z.string().optional(), limit: z.number().optional() }) - .passthrough(); -export type GetContingentWorkerTypesInput = z.infer< - typeof GetContingentWorkerTypesInputSchema ->; - -const GetContingentWorkerTypesResponseSchema = z.union([ - z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()), - z.array( - // Justification: Catching all unknown properties for forward-compatibility. - z.unknown(), - ), -]); -export type GetContingentWorkerTypesResponse = z.infer< - typeof GetContingentWorkerTypesResponseSchema ->; - -const GetCountryInfoInputSchema = z - .object({ cursor: z.string().optional(), limit: z.number().optional() }) - .passthrough(); -export type GetCountryInfoInput = z.infer; - -const GetCountryInfoResponseSchema = z.union([ - z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()), - z.array( - // Justification: Catching all unknown properties for forward-compatibility. - z.unknown(), - ), -]); -export type GetCountryInfoResponse = z.infer< - typeof GetCountryInfoResponseSchema ->; - -const GetCurrenciesInputSchema = z - .object({ cursor: z.string().optional(), limit: z.number().optional() }) - .passthrough(); -export type GetCurrenciesInput = z.infer; - -const GetCurrenciesResponseSchema = z.union([ - z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()), - z.array( - // Justification: Catching all unknown properties for forward-compatibility. - z.unknown(), - ), -]); -export type GetCurrenciesResponse = z.infer; - -const GetCurrentUserInputSchema = z - .object({ cursor: z.string().optional(), limit: z.number().optional() }) - .passthrough(); -export type GetCurrentUserInput = z.infer; - -const GetCurrentUserResponseSchema = z.union([ - z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()), - z.array( - // Justification: Catching all unknown properties for forward-compatibility. - z.unknown(), - ), -]); -export type GetCurrentUserResponse = z.infer< - typeof GetCurrentUserResponseSchema ->; - -const GetGrantsInputSchema = z - .object({ cursor: z.string().optional(), limit: z.number().optional() }) - .passthrough(); -export type GetGrantsInput = z.infer; - -const GetGrantsResponseSchema = z.union([ - z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()), - z.array( - // Justification: Catching all unknown properties for forward-compatibility. - z.unknown(), - ), -]); -export type GetGrantsResponse = z.infer; - -const GetHeadcountOptionsInputSchema = z - .object({ cursor: z.string().optional(), limit: z.number().optional() }) - .passthrough(); -export type GetHeadcountOptionsInput = z.infer< - typeof GetHeadcountOptionsInputSchema ->; - -const GetHeadcountOptionsResponseSchema = z.union([ - z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()), - z.array( - // Justification: Catching all unknown properties for forward-compatibility. - z.unknown(), - ), -]); -export type GetHeadcountOptionsResponse = z.infer< - typeof GetHeadcountOptionsResponseSchema ->; - -const GetHistoryInstanceForWorkerInputSchema = z - .object({ cursor: z.string().optional(), limit: z.number().optional() }) - .passthrough(); -export type GetHistoryInstanceForWorkerInput = z.infer< - typeof GetHistoryInstanceForWorkerInputSchema ->; - -const GetHistoryInstanceForWorkerResponseSchema = z.union([ - z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()), - z.array( - // Justification: Catching all unknown properties for forward-compatibility. - z.unknown(), - ), -]); -export type GetHistoryInstanceForWorkerResponse = z.infer< - typeof GetHistoryInstanceForWorkerResponseSchema ->; - -const GetHistoryItemsForWorkerInputSchema = z - .object({ cursor: z.string().optional(), limit: z.number().optional() }) - .passthrough(); -export type GetHistoryItemsForWorkerInput = z.infer< - typeof GetHistoryItemsForWorkerInputSchema ->; - -const GetHistoryItemsForWorkerResponseSchema = z.union([ - z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()), - z.array( - // Justification: Catching all unknown properties for forward-compatibility. - z.unknown(), - ), -]); -export type GetHistoryItemsForWorkerResponse = z.infer< - typeof GetHistoryItemsForWorkerResponseSchema ->; - -const GetHolidayEventsInputSchema = z - .object({ cursor: z.string().optional(), limit: z.number().optional() }) - .passthrough(); -export type GetHolidayEventsInput = z.infer; - -const GetHolidayEventsResponseSchema = z.union([ - z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()), - z.array( - // Justification: Catching all unknown properties for forward-compatibility. - z.unknown(), - ), -]); -export type GetHolidayEventsResponse = z.infer< - typeof GetHolidayEventsResponseSchema ->; - -const GetInterviewInputSchema = z - .object({ cursor: z.string().optional(), limit: z.number().optional() }) - .passthrough(); -export type GetInterviewInput = z.infer; - -const GetInterviewResponseSchema = z.union([ - z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()), - z.array( - // Justification: Catching all unknown properties for forward-compatibility. - z.unknown(), - ), -]); -export type GetInterviewResponse = z.infer; - -const GetInterviewFeedback2InputSchema = z - .object({ cursor: z.string().optional(), limit: z.number().optional() }) - .passthrough(); -export type GetInterviewFeedback2Input = z.infer< - typeof GetInterviewFeedback2InputSchema ->; - -const GetInterviewFeedback2ResponseSchema = z.union([ - z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()), - z.array( - // Justification: Catching all unknown properties for forward-compatibility. - z.unknown(), - ), -]); -export type GetInterviewFeedback2Response = z.infer< - typeof GetInterviewFeedback2ResponseSchema ->; - -const GetJobByIdInputSchema = z.object({ id: z.string() }); -export type GetJobByIdInput = z.infer; - -const GetJobByIdResponseSchema = z.union([ - z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()), - z.array( - // Justification: Catching all unknown properties for forward-compatibility. - z.unknown(), - ), -]); -export type GetJobByIdResponse = z.infer; - -const GetJobChangeFrequenciesInputSchema = z - .object({ cursor: z.string().optional(), limit: z.number().optional() }) - .passthrough(); -export type GetJobChangeFrequenciesInput = z.infer< - typeof GetJobChangeFrequenciesInputSchema ->; - -const GetJobChangeFrequenciesResponseSchema = z.union([ - z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()), - z.array( - // Justification: Catching all unknown properties for forward-compatibility. - z.unknown(), - ), -]); -export type GetJobChangeFrequenciesResponse = z.infer< - typeof GetJobChangeFrequenciesResponseSchema ->; - -const GetJobChangeLocationInfoInputSchema = z - .object({ cursor: z.string().optional(), limit: z.number().optional() }) - .passthrough(); -export type GetJobChangeLocationInfoInput = z.infer< - typeof GetJobChangeLocationInfoInputSchema ->; - -const GetJobChangeLocationInfoResponseSchema = z.union([ - z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()), - z.array( - // Justification: Catching all unknown properties for forward-compatibility. - z.unknown(), - ), -]); -export type GetJobChangeLocationInfoResponse = z.infer< - typeof GetJobChangeLocationInfoResponseSchema ->; - -const GetJobChangePositionInputSchema = z - .object({ cursor: z.string().optional(), limit: z.number().optional() }) - .passthrough(); -export type GetJobChangePositionInput = z.infer< - typeof GetJobChangePositionInputSchema ->; - -const GetJobChangePositionResponseSchema = z.union([ - z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()), - z.array( - // Justification: Catching all unknown properties for forward-compatibility. - z.unknown(), - ), -]); -export type GetJobChangePositionResponse = z.infer< - typeof GetJobChangePositionResponseSchema ->; - -const GetJobChangeReasonInstanceInputSchema = z - .object({ cursor: z.string().optional(), limit: z.number().optional() }) - .passthrough(); -export type GetJobChangeReasonInstanceInput = z.infer< - typeof GetJobChangeReasonInstanceInputSchema ->; - -const GetJobChangeReasonInstanceResponseSchema = z.union([ - z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()), - z.array( - // Justification: Catching all unknown properties for forward-compatibility. - z.unknown(), - ), -]); -export type GetJobChangeReasonInstanceResponse = z.infer< - typeof GetJobChangeReasonInstanceResponseSchema ->; - -const GetJobChangeReasonValuesInputSchema = z - .object({ cursor: z.string().optional(), limit: z.number().optional() }) - .passthrough(); -export type GetJobChangeReasonValuesInput = z.infer< - typeof GetJobChangeReasonValuesInputSchema ->; - -const GetJobChangeReasonValuesResponseSchema = z.union([ - z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()), - z.array( - // Justification: Catching all unknown properties for forward-compatibility. - z.unknown(), - ), -]); -export type GetJobChangeReasonValuesResponse = z.infer< - typeof GetJobChangeReasonValuesResponseSchema ->; - -const GetJobChangeReasonsInputSchema = z - .object({ cursor: z.string().optional(), limit: z.number().optional() }) - .passthrough(); -export type GetJobChangeReasonsInput = z.infer< - typeof GetJobChangeReasonsInputSchema ->; - -const GetJobChangeReasonsResponseSchema = z.union([ - z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()), - z.array( - // Justification: Catching all unknown properties for forward-compatibility. - z.unknown(), - ), -]); -export type GetJobChangeReasonsResponse = z.infer< - typeof GetJobChangeReasonsResponseSchema ->; - -const GetJobChangesGroupTemplatesInputSchema = z - .object({ cursor: z.string().optional(), limit: z.number().optional() }) - .passthrough(); -export type GetJobChangesGroupTemplatesInput = z.infer< - typeof GetJobChangesGroupTemplatesInputSchema ->; - -const GetJobChangesGroupTemplatesResponseSchema = z.union([ - z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()), - z.array( - // Justification: Catching all unknown properties for forward-compatibility. - z.unknown(), - ), -]); -export type GetJobChangesGroupTemplatesResponse = z.infer< - typeof GetJobChangesGroupTemplatesResponseSchema ->; - -const GetJobChangesJobValuesInputSchema = z - .object({ cursor: z.string().optional(), limit: z.number().optional() }) - .passthrough(); -export type GetJobChangesJobValuesInput = z.infer< - typeof GetJobChangesJobValuesInputSchema ->; - -const GetJobChangesJobValuesResponseSchema = z.union([ - z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()), - z.array( - // Justification: Catching all unknown properties for forward-compatibility. - z.unknown(), - ), -]); -export type GetJobChangesJobValuesResponse = z.infer< - typeof GetJobChangesJobValuesResponseSchema ->; - -const GetJobChangesWorkerValuesInputSchema = z - .object({ cursor: z.string().optional(), limit: z.number().optional() }) - .passthrough(); -export type GetJobChangesWorkerValuesInput = z.infer< - typeof GetJobChangesWorkerValuesInputSchema ->; - -const GetJobChangesWorkerValuesResponseSchema = z.union([ - z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()), - z.array( - // Justification: Catching all unknown properties for forward-compatibility. - z.unknown(), - ), -]); -export type GetJobChangesWorkerValuesResponse = z.infer< - typeof GetJobChangesWorkerValuesResponseSchema ->; - -const GetJobClassificationsInputSchema = z - .object({ cursor: z.string().optional(), limit: z.number().optional() }) - .passthrough(); -export type GetJobClassificationsInput = z.infer< - typeof GetJobClassificationsInputSchema ->; - -const GetJobClassificationsResponseSchema = z.union([ - z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()), - z.array( - // Justification: Catching all unknown properties for forward-compatibility. - z.unknown(), - ), -]); -export type GetJobClassificationsResponse = z.infer< - typeof GetJobClassificationsResponseSchema ->; - -const GetJobPostingInputSchema = z - .object({ cursor: z.string().optional(), limit: z.number().optional() }) - .passthrough(); -export type GetJobPostingInput = z.infer; - -const GetJobPostingResponseSchema = z.union([ - z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()), - z.array( - // Justification: Catching all unknown properties for forward-compatibility. - z.unknown(), - ), -]); -export type GetJobPostingResponse = z.infer; - -const GetJobPostingQuestionnaireInputSchema = z - .object({ cursor: z.string().optional(), limit: z.number().optional() }) - .passthrough(); -export type GetJobPostingQuestionnaireInput = z.infer< - typeof GetJobPostingQuestionnaireInputSchema ->; - -const GetJobPostingQuestionnaireResponseSchema = z.union([ - z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()), - z.array( - // Justification: Catching all unknown properties for forward-compatibility. - z.unknown(), - ), -]); -export type GetJobPostingQuestionnaireResponse = z.infer< - typeof GetJobPostingQuestionnaireResponseSchema ->; - -const GetJobProfilesValuesInputSchema = z - .object({ cursor: z.string().optional(), limit: z.number().optional() }) - .passthrough(); -export type GetJobProfilesValuesInput = z.infer< - typeof GetJobProfilesValuesInputSchema ->; - -const GetJobProfilesValuesResponseSchema = z.union([ - z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()), - z.array( - // Justification: Catching all unknown properties for forward-compatibility. - z.unknown(), - ), -]); -export type GetJobProfilesValuesResponse = z.infer< - typeof GetJobProfilesValuesResponseSchema ->; - -const GetJobRequisitionValuesInputSchema = z - .object({ cursor: z.string().optional(), limit: z.number().optional() }) - .passthrough(); -export type GetJobRequisitionValuesInput = z.infer< - typeof GetJobRequisitionValuesInputSchema ->; - -const GetJobRequisitionValuesResponseSchema = z.union([ - z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()), - z.array( - // Justification: Catching all unknown properties for forward-compatibility. - z.unknown(), - ), -]); -export type GetJobRequisitionValuesResponse = z.infer< - typeof GetJobRequisitionValuesResponseSchema ->; - -const GetJobWorkspaceInputSchema = z - .object({ cursor: z.string().optional(), limit: z.number().optional() }) - .passthrough(); -export type GetJobWorkspaceInput = z.infer; - -const GetJobWorkspaceResponseSchema = z.union([ - z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()), - z.array( - // Justification: Catching all unknown properties for forward-compatibility. - z.unknown(), - ), -]); -export type GetJobWorkspaceResponse = z.infer< - typeof GetJobWorkspaceResponseSchema ->; - -const GetJobWorkspacesInputSchema = z - .object({ cursor: z.string().optional(), limit: z.number().optional() }) - .passthrough(); -export type GetJobWorkspacesInput = z.infer; - -const GetJobWorkspacesResponseSchema = z.union([ - z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()), - z.array( - // Justification: Catching all unknown properties for forward-compatibility. - z.unknown(), - ), -]); -export type GetJobWorkspacesResponse = z.infer< - typeof GetJobWorkspacesResponseSchema ->; - -const GetLeaveStatusValuesInputSchema = z - .object({ cursor: z.string().optional(), limit: z.number().optional() }) - .passthrough(); -export type GetLeaveStatusValuesInput = z.infer< - typeof GetLeaveStatusValuesInputSchema ->; - -const GetLeaveStatusValuesResponseSchema = z.union([ - z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()), - z.array( - // Justification: Catching all unknown properties for forward-compatibility. - z.unknown(), - ), -]); -export type GetLeaveStatusValuesResponse = z.infer< - typeof GetLeaveStatusValuesResponseSchema ->; - -const GetMyJobPostingsInputSchema = z - .object({ cursor: z.string().optional(), limit: z.number().optional() }) - .passthrough(); -export type GetMyJobPostingsInput = z.infer; - -const GetMyJobPostingsResponseSchema = z.union([ - z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()), - z.array( - // Justification: Catching all unknown properties for forward-compatibility. - z.unknown(), - ), -]); -export type GetMyJobPostingsResponse = z.infer< - typeof GetMyJobPostingsResponseSchema ->; - -const GetOrganizationAssignmentBusinessUnitsInputSchema = z - .object({}) - .optional(); -export type GetOrganizationAssignmentBusinessUnitsInput = z.infer< - typeof GetOrganizationAssignmentBusinessUnitsInputSchema ->; - -const GetOrganizationAssignmentBusinessUnitsResponseSchema = z.union([ - z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()), - z.array( - // Justification: Catching all unknown properties for forward-compatibility. - z.unknown(), - ), -]); -export type GetOrganizationAssignmentBusinessUnitsResponse = z.infer< - typeof GetOrganizationAssignmentBusinessUnitsResponseSchema ->; - -const GetOrganizationAssignmentCustomsInputSchema = z - .object({ cursor: z.string().optional(), limit: z.number().optional() }) - .passthrough(); -export type GetOrganizationAssignmentCustomsInput = z.infer< - typeof GetOrganizationAssignmentCustomsInputSchema ->; - -const GetOrganizationAssignmentCustomsResponseSchema = z.union([ - z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()), - z.array( - // Justification: Catching all unknown properties for forward-compatibility. - z.unknown(), - ), -]); -export type GetOrganizationAssignmentCustomsResponse = z.infer< - typeof GetOrganizationAssignmentCustomsResponseSchema ->; - -const GetOrganizationAssignmentFundsInputSchema = z - .object({ cursor: z.string().optional(), limit: z.number().optional() }) - .passthrough(); -export type GetOrganizationAssignmentFundsInput = z.infer< - typeof GetOrganizationAssignmentFundsInputSchema ->; - -const GetOrganizationAssignmentFundsResponseSchema = z.union([ - z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()), - z.array( - // Justification: Catching all unknown properties for forward-compatibility. - z.unknown(), - ), -]); -export type GetOrganizationAssignmentFundsResponse = z.infer< - typeof GetOrganizationAssignmentFundsResponseSchema ->; - -const GetOrganizationAssignmentRegionsInputSchema = z - .object({ cursor: z.string().optional(), limit: z.number().optional() }) - .passthrough(); -export type GetOrganizationAssignmentRegionsInput = z.infer< - typeof GetOrganizationAssignmentRegionsInputSchema ->; - -const GetOrganizationAssignmentRegionsResponseSchema = z.union([ - z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()), - z.array( - // Justification: Catching all unknown properties for forward-compatibility. - z.unknown(), - ), -]); -export type GetOrganizationAssignmentRegionsResponse = z.infer< - typeof GetOrganizationAssignmentRegionsResponseSchema ->; - -const GetOrganizationAssignmentWorkersInputSchema = z - .object({ cursor: z.string().optional(), limit: z.number().optional() }) - .passthrough(); -export type GetOrganizationAssignmentWorkersInput = z.infer< - typeof GetOrganizationAssignmentWorkersInputSchema ->; - -const GetOrganizationAssignmentWorkersResponseSchema = z.union([ - z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()), - z.array( - // Justification: Catching all unknown properties for forward-compatibility. - z.unknown(), - ), -]); -export type GetOrganizationAssignmentWorkersResponse = z.infer< - typeof GetOrganizationAssignmentWorkersResponseSchema ->; - -const GetPayGroupByJobIdInputSchema = z - .object({ cursor: z.string().optional(), limit: z.number().optional() }) - .passthrough(); -export type GetPayGroupByJobIdInput = z.infer< - typeof GetPayGroupByJobIdInputSchema ->; - -const GetPayGroupByJobIdResponseSchema = z.union([ - z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()), - z.array( - // Justification: Catching all unknown properties for forward-compatibility. - z.unknown(), - ), -]); -export type GetPayGroupByJobIdResponse = z.infer< - typeof GetPayGroupByJobIdResponseSchema ->; - -const GetPaySlipInstancesForWorkerInputSchema = z - .object({ cursor: z.string().optional(), limit: z.number().optional() }) - .passthrough(); -export type GetPaySlipInstancesForWorkerInput = z.infer< - typeof GetPaySlipInstancesForWorkerInputSchema ->; - -const GetPaySlipInstancesForWorkerResponseSchema = z.union([ - z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()), - z.array( - // Justification: Catching all unknown properties for forward-compatibility. - z.unknown(), - ), -]); -export type GetPaySlipInstancesForWorkerResponse = z.infer< - typeof GetPaySlipInstancesForWorkerResponseSchema ->; - -const GetPaySlipsForWorkerInputSchema = z - .object({ cursor: z.string().optional(), limit: z.number().optional() }) - .passthrough(); -export type GetPaySlipsForWorkerInput = z.infer< - typeof GetPaySlipsForWorkerInputSchema ->; - -const GetPaySlipsForWorkerResponseSchema = z.union([ - z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()), - z.array( - // Justification: Catching all unknown properties for forward-compatibility. - z.unknown(), - ), -]); -export type GetPaySlipsForWorkerResponse = z.infer< - typeof GetPaySlipsForWorkerResponseSchema ->; - -const GetPayrollInputInstanceInputSchema = z - .object({ cursor: z.string().optional(), limit: z.number().optional() }) - .passthrough(); -export type GetPayrollInputInstanceInput = z.infer< - typeof GetPayrollInputInstanceInputSchema ->; - -const GetPayrollInputInstanceResponseSchema = z.union([ - z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()), - z.array( - // Justification: Catching all unknown properties for forward-compatibility. - z.unknown(), - ), -]); -export type GetPayrollInputInstanceResponse = z.infer< - typeof GetPayrollInputInstanceResponseSchema ->; - -const GetProposedPositionValuesInputSchema = z - .object({ cursor: z.string().optional(), limit: z.number().optional() }) - .passthrough(); -export type GetProposedPositionValuesInput = z.infer< - typeof GetProposedPositionValuesInputSchema ->; - -const GetProposedPositionValuesResponseSchema = z.union([ - z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()), - z.array( - // Justification: Catching all unknown properties for forward-compatibility. - z.unknown(), - ), -]); -export type GetProposedPositionValuesResponse = z.infer< - typeof GetProposedPositionValuesResponseSchema ->; - -const GetProspectInputSchema = z - .object({ cursor: z.string().optional(), limit: z.number().optional() }) - .passthrough(); -export type GetProspectInput = z.infer; - -const GetProspectResponseSchema = z.union([ - z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()), - z.array( - // Justification: Catching all unknown properties for forward-compatibility. - z.unknown(), - ), -]); -export type GetProspectResponse = z.infer; - -const GetProspectEducationsInputSchema = z - .object({ cursor: z.string().optional(), limit: z.number().optional() }) - .passthrough(); -export type GetProspectEducationsInput = z.infer< - typeof GetProspectEducationsInputSchema ->; - -const GetProspectEducationsResponseSchema = z.union([ - z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()), - z.array( - // Justification: Catching all unknown properties for forward-compatibility. - z.unknown(), - ), -]); -export type GetProspectEducationsResponse = z.infer< - typeof GetProspectEducationsResponseSchema ->; - -const GetProspectExperiencesInputSchema = z - .object({ cursor: z.string().optional(), limit: z.number().optional() }) - .passthrough(); -export type GetProspectExperiencesInput = z.infer< - typeof GetProspectExperiencesInputSchema ->; - -const GetProspectExperiencesResponseSchema = z.union([ - z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()), - z.array( - // Justification: Catching all unknown properties for forward-compatibility. - z.unknown(), - ), -]); -export type GetProspectExperiencesResponse = z.infer< - typeof GetProspectExperiencesResponseSchema ->; - -const GetProspectResumeAttachmentsInputSchema = z - .object({ cursor: z.string().optional(), limit: z.number().optional() }) - .passthrough(); -export type GetProspectResumeAttachmentsInput = z.infer< - typeof GetProspectResumeAttachmentsInputSchema ->; - -const GetProspectResumeAttachmentsResponseSchema = z.union([ - z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()), - z.array( - // Justification: Catching all unknown properties for forward-compatibility. - z.unknown(), - ), -]); -export type GetProspectResumeAttachmentsResponse = z.infer< - typeof GetProspectResumeAttachmentsResponseSchema ->; - -const GetProspectSkillsInputSchema = z - .object({ cursor: z.string().optional(), limit: z.number().optional() }) - .passthrough(); -export type GetProspectSkillsInput = z.infer< - typeof GetProspectSkillsInputSchema ->; - -const GetProspectSkillsResponseSchema = z.union([ - z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()), - z.array( - // Justification: Catching all unknown properties for forward-compatibility. - z.unknown(), - ), -]); -export type GetProspectSkillsResponse = z.infer< - typeof GetProspectSkillsResponseSchema ->; - -const GetSupervisoryOrgValuesInputSchema = z - .object({ cursor: z.string().optional(), limit: z.number().optional() }) - .passthrough(); -export type GetSupervisoryOrgValuesInput = z.infer< - typeof GetSupervisoryOrgValuesInputSchema ->; - -const GetSupervisoryOrgValuesResponseSchema = z.union([ - z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()), - z.array( - // Justification: Catching all unknown properties for forward-compatibility. - z.unknown(), - ), -]); -export type GetSupervisoryOrgValuesResponse = z.infer< - typeof GetSupervisoryOrgValuesResponseSchema ->; - -const GetTimeOffEntriesForWorkerInputSchema = z - .object({ cursor: z.string().optional(), limit: z.number().optional() }) - .passthrough(); -export type GetTimeOffEntriesForWorkerInput = z.infer< - typeof GetTimeOffEntriesForWorkerInputSchema ->; - -const GetTimeOffEntriesForWorkerResponseSchema = z.union([ - z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()), - z.array( - // Justification: Catching all unknown properties for forward-compatibility. - z.unknown(), - ), -]); -export type GetTimeOffEntriesForWorkerResponse = z.infer< - typeof GetTimeOffEntriesForWorkerResponseSchema ->; - -const GetTimeOffPlansForWorkerInputSchema = z - .object({ cursor: z.string().optional(), limit: z.number().optional() }) - .passthrough(); -export type GetTimeOffPlansForWorkerInput = z.infer< - typeof GetTimeOffPlansForWorkerInputSchema ->; - -const GetTimeOffPlansForWorkerResponseSchema = z.union([ - z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()), - z.array( - // Justification: Catching all unknown properties for forward-compatibility. - z.unknown(), - ), -]); -export type GetTimeOffPlansForWorkerResponse = z.infer< - typeof GetTimeOffPlansForWorkerResponseSchema ->; - -const GetTimeOffStatusValuesInputSchema = z - .object({ cursor: z.string().optional(), limit: z.number().optional() }) - .passthrough(); -export type GetTimeOffStatusValuesInput = z.infer< - typeof GetTimeOffStatusValuesInputSchema ->; - -const GetTimeOffStatusValuesResponseSchema = z.union([ - z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()), - z.array( - // Justification: Catching all unknown properties for forward-compatibility. - z.unknown(), - ), -]); -export type GetTimeOffStatusValuesResponse = z.infer< - typeof GetTimeOffStatusValuesResponseSchema ->; - -const GetTimeTypesInputSchema = z - .object({ cursor: z.string().optional(), limit: z.number().optional() }) - .passthrough(); -export type GetTimeTypesInput = z.infer; - -const GetTimeTypesResponseSchema = z.union([ - z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()), - z.array( - // Justification: Catching all unknown properties for forward-compatibility. - z.unknown(), - ), -]); -export type GetTimeTypesResponse = z.infer; - -const GetWorkStudyAwardsInputSchema = z - .object({ cursor: z.string().optional(), limit: z.number().optional() }) - .passthrough(); -export type GetWorkStudyAwardsInput = z.infer< - typeof GetWorkStudyAwardsInputSchema ->; - -const GetWorkStudyAwardsResponseSchema = z.union([ - z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()), - z.array( - // Justification: Catching all unknown properties for forward-compatibility. - z.unknown(), - ), -]); -export type GetWorkStudyAwardsResponse = z.infer< - typeof GetWorkStudyAwardsResponseSchema ->; - -const GetWorkerBusinessTitleChangesInputSchema = z - .object({ cursor: z.string().optional(), limit: z.number().optional() }) - .passthrough(); -export type GetWorkerBusinessTitleChangesInput = z.infer< - typeof GetWorkerBusinessTitleChangesInputSchema ->; - -const GetWorkerBusinessTitleChangesResponseSchema = z.union([ - z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()), - z.array( - // Justification: Catching all unknown properties for forward-compatibility. - z.unknown(), - ), -]); -export type GetWorkerBusinessTitleChangesResponse = z.infer< - typeof GetWorkerBusinessTitleChangesResponseSchema ->; - -const GetWorkerEligibleAbsenceTypesInputSchema = z - .object({ cursor: z.string().optional(), limit: z.number().optional() }) - .passthrough(); -export type GetWorkerEligibleAbsenceTypesInput = z.infer< - typeof GetWorkerEligibleAbsenceTypesInputSchema ->; - -const GetWorkerEligibleAbsenceTypesResponseSchema = z.union([ - z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()), - z.array( - // Justification: Catching all unknown properties for forward-compatibility. - z.unknown(), - ), -]); -export type GetWorkerEligibleAbsenceTypesResponse = z.infer< - typeof GetWorkerEligibleAbsenceTypesResponseSchema ->; - -const GetWorkerInfoInputSchema = z - .object({ cursor: z.string().optional(), limit: z.number().optional() }) - .passthrough(); -export type GetWorkerInfoInput = z.infer; - -const GetWorkerInfoResponseSchema = z.union([ - z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()), - z.array( - // Justification: Catching all unknown properties for forward-compatibility. - z.unknown(), - ), -]); -export type GetWorkerInfoResponse = z.infer; - -const GetWorkerLeavesOfAbsenceInputSchema = z - .object({ cursor: z.string().optional(), limit: z.number().optional() }) - .passthrough(); -export type GetWorkerLeavesOfAbsenceInput = z.infer< - typeof GetWorkerLeavesOfAbsenceInputSchema ->; - -const GetWorkerLeavesOfAbsenceResponseSchema = z.union([ - z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()), - z.array( - // Justification: Catching all unknown properties for forward-compatibility. - z.unknown(), - ), -]); -export type GetWorkerLeavesOfAbsenceResponse = z.infer< - typeof GetWorkerLeavesOfAbsenceResponseSchema ->; - -const GetWorkerServiceDatesInputSchema = z - .object({ cursor: z.string().optional(), limit: z.number().optional() }) - .passthrough(); -export type GetWorkerServiceDatesInput = z.infer< - typeof GetWorkerServiceDatesInputSchema ->; - -const GetWorkerServiceDatesResponseSchema = z.union([ - z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()), - z.array( - // Justification: Catching all unknown properties for forward-compatibility. - z.unknown(), - ), -]); -export type GetWorkerServiceDatesResponse = z.infer< - typeof GetWorkerServiceDatesResponseSchema ->; - -const GetWorkerStaffingInformationInputSchema = z - .object({ cursor: z.string().optional(), limit: z.number().optional() }) - .passthrough(); -export type GetWorkerStaffingInformationInput = z.infer< - typeof GetWorkerStaffingInformationInputSchema ->; - -const GetWorkerStaffingInformationResponseSchema = z.union([ - z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()), - z.array( - // Justification: Catching all unknown properties for forward-compatibility. - z.unknown(), - ), -]); -export type GetWorkerStaffingInformationResponse = z.infer< - typeof GetWorkerStaffingInformationResponseSchema ->; - -const GetWorkerTimeOffDetailsInputSchema = z - .object({ cursor: z.string().optional(), limit: z.number().optional() }) - .passthrough(); -export type GetWorkerTimeOffDetailsInput = z.infer< - typeof GetWorkerTimeOffDetailsInputSchema ->; - -const GetWorkerTimeOffDetailsResponseSchema = z.union([ - z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()), - z.array( - // Justification: Catching all unknown properties for forward-compatibility. - z.unknown(), - ), -]); -export type GetWorkerTimeOffDetailsResponse = z.infer< - typeof GetWorkerTimeOffDetailsResponseSchema ->; - -const GetWorkerTypesInputSchema = z - .object({ cursor: z.string().optional(), limit: z.number().optional() }) - .passthrough(); -export type GetWorkerTypesInput = z.infer; - -const GetWorkerTypesResponseSchema = z.union([ - z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()), - z.array( - // Justification: Catching all unknown properties for forward-compatibility. - z.unknown(), - ), -]); -export type GetWorkerTypesResponse = z.infer< - typeof GetWorkerTypesResponseSchema ->; - -const GetWorkerValidTimeOffDatesInputSchema = z - .object({ cursor: z.string().optional(), limit: z.number().optional() }) - .passthrough(); -export type GetWorkerValidTimeOffDatesInput = z.infer< - typeof GetWorkerValidTimeOffDatesInputSchema ->; - -const GetWorkerValidTimeOffDatesResponseSchema = z.union([ - z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()), - z.array( - // Justification: Catching all unknown properties for forward-compatibility. - z.unknown(), - ), -]); -export type GetWorkerValidTimeOffDatesResponse = z.infer< - typeof GetWorkerValidTimeOffDatesResponseSchema ->; - -const GetWorkersCollectionStaffingInputSchema = z - .object({ cursor: z.string().optional(), limit: z.number().optional() }) - .passthrough(); -export type GetWorkersCollectionStaffingInput = z.infer< - typeof GetWorkersCollectionStaffingInputSchema ->; - -const GetWorkersCollectionStaffingResponseSchema = z.union([ - z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()), - z.array( - // Justification: Catching all unknown properties for forward-compatibility. - z.unknown(), - ), -]); -export type GetWorkersCollectionStaffingResponse = z.infer< - typeof GetWorkersCollectionStaffingResponseSchema ->; - -const GetWorkspaceInstancesInputSchema = z - .object({ cursor: z.string().optional(), limit: z.number().optional() }) - .passthrough(); -export type GetWorkspaceInstancesInput = z.infer< - typeof GetWorkspaceInstancesInputSchema ->; - -const GetWorkspaceInstancesResponseSchema = z.union([ - z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()), - z.array( - // Justification: Catching all unknown properties for forward-compatibility. - z.unknown(), - ), -]); -export type GetWorkspaceInstancesResponse = z.infer< - typeof GetWorkspaceInstancesResponseSchema ->; - -const ListBalancesInputSchema = z - .object({ cursor: z.string().optional(), limit: z.number().optional() }) - .passthrough(); -export type ListBalancesInput = z.infer; - -const ListBalancesResponseSchema = z.union([ - z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()), - z.array( - // Justification: Catching all unknown properties for forward-compatibility. - z.unknown(), - ), -]); -export type ListBalancesResponse = z.infer; - -const ListCountriesInputSchema = z - .object({ cursor: z.string().optional(), limit: z.number().optional() }) - .passthrough(); -export type ListCountriesInput = z.infer; - -const ListCountriesResponseSchema = z.union([ - z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()), - z.array( - // Justification: Catching all unknown properties for forward-compatibility. - z.unknown(), - ), -]); -export type ListCountriesResponse = z.infer; - -const ListInterviewsInputSchema = z - .object({ cursor: z.string().optional(), limit: z.number().optional() }) - .passthrough(); -export type ListInterviewsInput = z.infer; - -const ListInterviewsResponseSchema = z.union([ - z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()), - z.array( - // Justification: Catching all unknown properties for forward-compatibility. - z.unknown(), - ), -]); -export type ListInterviewsResponse = z.infer< - typeof ListInterviewsResponseSchema ->; - -const ListJobPostingsInputSchema = z - .object({ cursor: z.string().optional(), limit: z.number().optional() }) - .passthrough(); -export type ListJobPostingsInput = z.infer; - -const ListJobPostingsResponseSchema = z.union([ - z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()), - z.array( - // Justification: Catching all unknown properties for forward-compatibility. - z.unknown(), - ), -]); -export type ListJobPostingsResponse = z.infer< - typeof ListJobPostingsResponseSchema ->; - -const ListJobsInputSchema = z - .object({ cursor: z.string().optional(), limit: z.number().optional() }) - .passthrough(); -export type ListJobsInput = z.infer; - -const ListJobsResponseSchema = z.union([ - z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()), - z.array( - // Justification: Catching all unknown properties for forward-compatibility. - z.unknown(), - ), -]); -export type ListJobsResponse = z.infer; - -const RetrieveWorkerLeaveOfAbsenceSubresourceInputSchema = z - .object({}) - .optional(); -export type RetrieveWorkerLeaveOfAbsenceSubresourceInput = z.infer< - typeof RetrieveWorkerLeaveOfAbsenceSubresourceInputSchema ->; - -const RetrieveWorkerLeaveOfAbsenceSubresourceResponseSchema = z.union([ - z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()), - z.array( - // Justification: Catching all unknown properties for forward-compatibility. - z.unknown(), - ), -]); -export type RetrieveWorkerLeaveOfAbsenceSubresourceResponse = z.infer< - typeof RetrieveWorkerLeaveOfAbsenceSubresourceResponseSchema ->; - -const UpdateAnExistingPayrollInputSchema = z - .object({ id: z.string(), workerId: z.string().optional() }) - .passthrough() - .optional(); -export type UpdateAnExistingPayrollInput = z.infer< - typeof UpdateAnExistingPayrollInputSchema ->; - -const UpdateAnExistingPayrollResponseSchema = z.union([ - z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()), - z.array( - // Justification: Catching all unknown properties for forward-compatibility. - z.unknown(), - ), -]); -export type UpdateAnExistingPayrollResponse = z.infer< - typeof UpdateAnExistingPayrollResponseSchema ->; - -const UpdateJobChangeBusinessTitleInputSchema = z - .object({ id: z.string(), workerId: z.string().optional() }) - .passthrough() - .optional(); -export type UpdateJobChangeBusinessTitleInput = z.infer< - typeof UpdateJobChangeBusinessTitleInputSchema ->; - -const UpdateJobChangeBusinessTitleResponseSchema = z.union([ - z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()), - z.array( - // Justification: Catching all unknown properties for forward-compatibility. - z.unknown(), - ), -]); -export type UpdateJobChangeBusinessTitleResponse = z.infer< - typeof UpdateJobChangeBusinessTitleResponseSchema ->; - -const UpdateMessageTemplateByIdInputSchema = z - .object({ id: z.string(), workerId: z.string().optional() }) - .passthrough() - .optional(); -export type UpdateMessageTemplateByIdInput = z.infer< - typeof UpdateMessageTemplateByIdInputSchema ->; - -const UpdateMessageTemplateByIdResponseSchema = z.union([ - z - .object({}) - // Justification: Catching all unknown properties for forward-compatibility. - .catchall(z.unknown()), - z.array( - // Justification: Catching all unknown properties for forward-compatibility. - z.unknown(), - ), -]); -export type UpdateMessageTemplateByIdResponse = z.infer< - typeof UpdateMessageTemplateByIdResponseSchema ->; +import type { WorkdayRouteName } from './routes'; +import { workdayRoutes } from './routes'; + +// Workday responses vary widely across services; validate known keys + allow extras. +export const WorkdayResourceSchema = z + .object({ + id: z.string().optional(), + descriptor: z.string().optional(), + href: z.string().optional(), + }) + .catchall(z.unknown()); + +export const WorkdayCollectionSchema = z + .object({ + data: z.array(WorkdayResourceSchema).optional(), + total: z.number().optional(), + }) + .catchall(z.unknown()); + +const PaginationQueryShape = { + limit: z.number().int().min(1).max(100).optional(), + offset: z.number().int().min(0).optional(), +}; export const WorkdayEndpointInputSchemas = { - createBusinessTitleChange: CreateBusinessTitleChangeInputSchema, - createJobChange: CreateJobChangeInputSchema, - createPayrollInputs: CreatePayrollInputsInputSchema, - createTimeOffRequest: CreateTimeOffRequestInputSchema, - getAbsenceBalance: GetAbsenceBalanceInputSchema, - getAssignmentChangeGroupCostCenters: - GetAssignmentChangeGroupCostCentersInputSchema, - getAssignmentChangeGroupJobs: GetAssignmentChangeGroupJobsInputSchema, - getAssignmentTypes: GetAssignmentTypesInputSchema, - getBusinessTitleChange: GetBusinessTitleChangeInputSchema, - getBusinessTitleChangeForWorker: GetBusinessTitleChangeForWorkerInputSchema, - getCandidateAvailabilityTemplate: GetCandidateAvailabilityTemplateInputSchema, - getCollectionOfJobs: GetCollectionOfJobsInputSchema, - getCollectionOfPayroll: GetCollectionOfPayrollInputSchema, - getCompanyInsiderTypes: GetCompanyInsiderTypesInputSchema, - getContingentWorkerTypes: GetContingentWorkerTypesInputSchema, - getCountryInfo: GetCountryInfoInputSchema, - getCurrencies: GetCurrenciesInputSchema, - getCurrentUser: GetCurrentUserInputSchema, - getGrants: GetGrantsInputSchema, - getHeadcountOptions: GetHeadcountOptionsInputSchema, - getHistoryInstanceForWorker: GetHistoryInstanceForWorkerInputSchema, - getHistoryItemsForWorker: GetHistoryItemsForWorkerInputSchema, - getHolidayEvents: GetHolidayEventsInputSchema, - getInterview: GetInterviewInputSchema, - getInterviewFeedback2: GetInterviewFeedback2InputSchema, - getJobById: GetJobByIdInputSchema, - getJobChangeFrequencies: GetJobChangeFrequenciesInputSchema, - getJobChangeLocationInfo: GetJobChangeLocationInfoInputSchema, - getJobChangePosition: GetJobChangePositionInputSchema, - getJobChangeReasonInstance: GetJobChangeReasonInstanceInputSchema, - getJobChangeReasonValues: GetJobChangeReasonValuesInputSchema, - getJobChangeReasons: GetJobChangeReasonsInputSchema, - getJobChangesGroupTemplates: GetJobChangesGroupTemplatesInputSchema, - getJobChangesJobValues: GetJobChangesJobValuesInputSchema, - getJobChangesWorkerValues: GetJobChangesWorkerValuesInputSchema, - getJobClassifications: GetJobClassificationsInputSchema, - getJobPosting: GetJobPostingInputSchema, - getJobPostingQuestionnaire: GetJobPostingQuestionnaireInputSchema, - getJobProfilesValues: GetJobProfilesValuesInputSchema, - getJobRequisitionValues: GetJobRequisitionValuesInputSchema, - getJobWorkspace: GetJobWorkspaceInputSchema, - getJobWorkspaces: GetJobWorkspacesInputSchema, - getLeaveStatusValues: GetLeaveStatusValuesInputSchema, - getMyJobPostings: GetMyJobPostingsInputSchema, - getOrganizationAssignmentBusinessUnits: - GetOrganizationAssignmentBusinessUnitsInputSchema, - getOrganizationAssignmentCustoms: GetOrganizationAssignmentCustomsInputSchema, - getOrganizationAssignmentFunds: GetOrganizationAssignmentFundsInputSchema, - getOrganizationAssignmentRegions: GetOrganizationAssignmentRegionsInputSchema, - getOrganizationAssignmentWorkers: GetOrganizationAssignmentWorkersInputSchema, - getPayGroupByJobId: GetPayGroupByJobIdInputSchema, - getPaySlipInstancesForWorker: GetPaySlipInstancesForWorkerInputSchema, - getPaySlipsForWorker: GetPaySlipsForWorkerInputSchema, - getPayrollInputInstance: GetPayrollInputInstanceInputSchema, - getProposedPositionValues: GetProposedPositionValuesInputSchema, - getProspect: GetProspectInputSchema, - getProspectEducations: GetProspectEducationsInputSchema, - getProspectExperiences: GetProspectExperiencesInputSchema, - getProspectResumeAttachments: GetProspectResumeAttachmentsInputSchema, - getProspectSkills: GetProspectSkillsInputSchema, - getSupervisoryOrgValues: GetSupervisoryOrgValuesInputSchema, - getTimeOffEntriesForWorker: GetTimeOffEntriesForWorkerInputSchema, - getTimeOffPlansForWorker: GetTimeOffPlansForWorkerInputSchema, - getTimeOffStatusValues: GetTimeOffStatusValuesInputSchema, - getTimeTypes: GetTimeTypesInputSchema, - getWorkStudyAwards: GetWorkStudyAwardsInputSchema, - getWorkerBusinessTitleChanges: GetWorkerBusinessTitleChangesInputSchema, - getWorkerEligibleAbsenceTypes: GetWorkerEligibleAbsenceTypesInputSchema, - getWorkerInfo: GetWorkerInfoInputSchema, - getWorkerLeavesOfAbsence: GetWorkerLeavesOfAbsenceInputSchema, - getWorkerServiceDates: GetWorkerServiceDatesInputSchema, - getWorkerStaffingInformation: GetWorkerStaffingInformationInputSchema, - getWorkerTimeOffDetails: GetWorkerTimeOffDetailsInputSchema, - getWorkerTypes: GetWorkerTypesInputSchema, - getWorkerValidTimeOffDates: GetWorkerValidTimeOffDatesInputSchema, - getWorkersCollectionStaffing: GetWorkersCollectionStaffingInputSchema, - getWorkspaceInstances: GetWorkspaceInstancesInputSchema, - listBalances: ListBalancesInputSchema, - listCountries: ListCountriesInputSchema, - listInterviews: ListInterviewsInputSchema, - listJobPostings: ListJobPostingsInputSchema, - listJobs: ListJobsInputSchema, - retrieveWorkerLeaveOfAbsenceSubresource: - RetrieveWorkerLeaveOfAbsenceSubresourceInputSchema, - updateAnExistingPayroll: UpdateAnExistingPayrollInputSchema, - updateJobChangeBusinessTitle: UpdateJobChangeBusinessTitleInputSchema, - updateMessageTemplateById: UpdateMessageTemplateByIdInputSchema, + createBusinessTitleChange: z + .object({ + ID: z.string().min(1), + id: z.string().min(1).optional(), + workerId: z.string().min(1).optional(), + limit: z.number().int().min(1).max(100).optional(), + offset: z.number().int().min(0).optional(), + // Remaining fields form the JSON body (Workday resource payloads). + }) + .passthrough(), + getBusinessTitleChange: z + .object({ + ID: z.string().min(1), + id: z.string().min(1).optional(), + workerId: z.string().min(1).optional(), + limit: z.number().int().min(1).max(100).optional(), + offset: z.number().int().min(0).optional(), + }) + .passthrough(), + getBusinessTitleChangeForWorker: z + .object({ + ID: z.string().min(1), + id: z.string().min(1).optional(), + workerId: z.string().min(1).optional(), + subresourceID: z.string().min(1), + limit: z.number().int().min(1).max(100).optional(), + offset: z.number().int().min(0).optional(), + }) + .passthrough(), + createJobChange: z + .object({ + ID: z.string().min(1), + id: z.string().min(1).optional(), + workerId: z.string().min(1).optional(), + limit: z.number().int().min(1).max(100).optional(), + offset: z.number().int().min(0).optional(), + // Remaining fields form the JSON body (Workday resource payloads). + }) + .passthrough(), + getJobById: z + .object({ + ID: z.string().min(1), + id: z.string().min(1).optional(), + workerId: z.string().min(1).optional(), + limit: z.number().int().min(1).max(100).optional(), + offset: z.number().int().min(0).optional(), + }) + .passthrough(), + getJobChangeFrequencies: z + .object({ + effectiveDate: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + event: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + job: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + location: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + manager: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + staffingEvent: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + worker: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + limit: z.number().int().min(1).max(100).optional(), + offset: z.number().int().min(0).optional(), + }) + .passthrough(), + getJobChangeLocationInfo: z + .object({ + ID: z.string().min(1), + id: z.string().min(1).optional(), + workerId: z.string().min(1).optional(), + limit: z.number().int().min(1).max(100).optional(), + offset: z.number().int().min(0).optional(), + }) + .passthrough(), + getJobChangePosition: z + .object({ + ID: z.string().min(1), + id: z.string().min(1).optional(), + workerId: z.string().min(1).optional(), + limit: z.number().int().min(1).max(100).optional(), + offset: z.number().int().min(0).optional(), + }) + .passthrough(), + getJobChangeReasonInstance: z + .object({ + ID: z.string().min(1), + id: z.string().min(1).optional(), + workerId: z.string().min(1).optional(), + limit: z.number().int().min(1).max(100).optional(), + offset: z.number().int().min(0).optional(), + }) + .passthrough(), + getJobChangeReasonValues: z + .object({ + effectiveDate: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + event: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + job: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + location: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + manager: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + staffingEvent: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + worker: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + limit: z.number().int().min(1).max(100).optional(), + offset: z.number().int().min(0).optional(), + }) + .passthrough(), + getJobChangeReasons: z + .object({ + effectiveDate: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + event: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + staffingEvent: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + worker: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + limit: z.number().int().min(1).max(100).optional(), + offset: z.number().int().min(0).optional(), + }) + .passthrough(), + getJobChangesGroupTemplates: z + .object({ + effectiveDate: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + event: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + job: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + location: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + manager: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + staffingEvent: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + worker: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + limit: z.number().int().min(1).max(100).optional(), + offset: z.number().int().min(0).optional(), + }) + .passthrough(), + getJobChangesJobValues: z + .object({ + effectiveDate: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + worker: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + limit: z.number().int().min(1).max(100).optional(), + offset: z.number().int().min(0).optional(), + }) + .passthrough(), + getJobChangesWorkerValues: z + .object({ + effectiveDate: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + limit: z.number().int().min(1).max(100).optional(), + offset: z.number().int().min(0).optional(), + }) + .passthrough(), + getJobClassifications: z + .object({ + effectiveDate: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + event: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + job: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + location: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + manager: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + staffingEvent: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + worker: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + limit: z.number().int().min(1).max(100).optional(), + offset: z.number().int().min(0).optional(), + }) + .passthrough(), + getJobPosting: z + .object({ + ID: z.string().min(1), + id: z.string().min(1).optional(), + workerId: z.string().min(1).optional(), + limit: z.number().int().min(1).max(100).optional(), + offset: z.number().int().min(0).optional(), + }) + .passthrough(), + getJobPostingQuestionnaire: z + .object({ + ID: z.string().min(1), + id: z.string().min(1).optional(), + workerId: z.string().min(1).optional(), + limit: z.number().int().min(1).max(100).optional(), + offset: z.number().int().min(0).optional(), + }) + .passthrough(), + getJobProfilesValues: z + .object({ + effectiveDate: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + event: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + job: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + location: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + manager: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + staffingEvent: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + worker: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + limit: z.number().int().min(1).max(100).optional(), + offset: z.number().int().min(0).optional(), + }) + .passthrough(), + getJobRequisitionValues: z + .object({ + effectiveDate: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + event: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + job: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + location: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + manager: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + staffingEvent: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + worker: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + limit: z.number().int().min(1).max(100).optional(), + offset: z.number().int().min(0).optional(), + }) + .passthrough(), + getJobWorkspace: z + .object({ + ID: z.string().min(1), + id: z.string().min(1).optional(), + workerId: z.string().min(1).optional(), + subresourceID: z.string().min(1), + limit: z.number().int().min(1).max(100).optional(), + offset: z.number().int().min(0).optional(), + }) + .passthrough(), + getJobWorkspaces: z + .object({ + ID: z.string().min(1), + id: z.string().min(1).optional(), + workerId: z.string().min(1).optional(), + limit: z.number().int().min(1).max(100).optional(), + offset: z.number().int().min(0).optional(), + }) + .passthrough(), + listJobPostings: z + .object({ + jobRequisition: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + category: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + id: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + jobSite: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + limit: z.number().int().min(1).max(100).optional(), + offset: z.number().int().min(0).optional(), + }) + .passthrough(), + updateJobChangeBusinessTitle: z + .object({ + ID: z.string().min(1), + id: z.string().min(1).optional(), + workerId: z.string().min(1).optional(), + subresourceID: z.string().min(1), + limit: z.number().int().min(1).max(100).optional(), + offset: z.number().int().min(0).optional(), + // Remaining fields form the JSON body (Workday resource payloads). + }) + .passthrough(), + createPayrollInputs: z + .object({ + limit: z.number().int().min(1).max(100).optional(), + offset: z.number().int().min(0).optional(), + // Remaining fields form the JSON body (Workday resource payloads). + }) + .passthrough(), + getPayrollInputInstance: z + .object({ + ID: z.string().min(1), + id: z.string().min(1).optional(), + workerId: z.string().min(1).optional(), + limit: z.number().int().min(1).max(100).optional(), + offset: z.number().int().min(0).optional(), + }) + .passthrough(), + updateAnExistingPayroll: z + .object({ + ID: z.string().min(1), + id: z.string().min(1).optional(), + workerId: z.string().min(1).optional(), + limit: z.number().int().min(1).max(100).optional(), + offset: z.number().int().min(0).optional(), + // Remaining fields form the JSON body (Workday resource payloads). + }) + .passthrough(), + getCollectionOfPayroll: z + .object({ + startDate: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + endDate: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + worker: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + payComponent: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + limit: z.number().int().min(1).max(100).optional(), + offset: z.number().int().min(0).optional(), + }) + .passthrough(), + createTimeOffRequest: z + .object({ + ID: z.string().min(1), + id: z.string().min(1).optional(), + workerId: z.string().min(1).optional(), + limit: z.number().int().min(1).max(100).optional(), + offset: z.number().int().min(0).optional(), + // Remaining fields form the JSON body (Workday resource payloads). + }) + .passthrough(), + getTimeOffEntriesForWorker: z + .object({ + ID: z.string().min(1), + id: z.string().min(1).optional(), + workerId: z.string().min(1).optional(), + limit: z.number().int().min(1).max(100).optional(), + offset: z.number().int().min(0).optional(), + }) + .passthrough(), + getTimeOffPlansForWorker: z + .object({ + ID: z.string().min(1), + id: z.string().min(1).optional(), + workerId: z.string().min(1).optional(), + limit: z.number().int().min(1).max(100).optional(), + offset: z.number().int().min(0).optional(), + }) + .passthrough(), + getTimeOffStatusValues: z + .object({ + limit: z.number().int().min(1).max(100).optional(), + offset: z.number().int().min(0).optional(), + }) + .passthrough(), + getTimeTypes: z + .object({ + effectiveDate: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + event: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + job: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + location: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + manager: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + staffingEvent: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + worker: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + limit: z.number().int().min(1).max(100).optional(), + offset: z.number().int().min(0).optional(), + }) + .passthrough(), + getAbsenceBalance: z + .object({ + ID: z.string().min(1), + id: z.string().min(1).optional(), + workerId: z.string().min(1).optional(), + worker: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + absencePlan: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + effective: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + limit: z.number().int().min(1).max(100).optional(), + offset: z.number().int().min(0).optional(), + }) + .passthrough(), + listBalances: z + .object({ + worker: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + category: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + effective: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + limit: z.number().int().min(1).max(100).optional(), + offset: z.number().int().min(0).optional(), + }) + .passthrough(), + getAssignmentChangeGroupCostCenters: z + .object({ + effectiveDate: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + event: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + organizationType: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + worker: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + limit: z.number().int().min(1).max(100).optional(), + offset: z.number().int().min(0).optional(), + }) + .passthrough(), + getAssignmentChangeGroupJobs: z + .object({ + effectiveDate: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + event: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + organizationType: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + worker: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + limit: z.number().int().min(1).max(100).optional(), + offset: z.number().int().min(0).optional(), + }) + .passthrough(), + getAssignmentTypes: z + .object({ + effectiveDate: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + event: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + job: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + location: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + manager: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + staffingEvent: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + worker: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + limit: z.number().int().min(1).max(100).optional(), + offset: z.number().int().min(0).optional(), + }) + .passthrough(), + getCandidateAvailabilityTemplate: z + .object({ + ID: z.string().min(1), + id: z.string().min(1).optional(), + workerId: z.string().min(1).optional(), + limit: z.number().int().min(1).max(100).optional(), + offset: z.number().int().min(0).optional(), + }) + .passthrough(), + getCollectionOfJobs: z + .object({ + includeTerminatedWorkers: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + search: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + limit: z.number().int().min(1).max(100).optional(), + offset: z.number().int().min(0).optional(), + }) + .passthrough(), + getCompanyInsiderTypes: z + .object({ + effectiveDate: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + event: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + job: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + location: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + manager: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + staffingEvent: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + worker: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + limit: z.number().int().min(1).max(100).optional(), + offset: z.number().int().min(0).optional(), + }) + .passthrough(), + getContingentWorkerTypes: z + .object({ + effectiveDate: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + event: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + job: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + location: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + manager: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + staffingEvent: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + worker: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + limit: z.number().int().min(1).max(100).optional(), + offset: z.number().int().min(0).optional(), + }) + .passthrough(), + getCountryInfo: z + .object({ + ID: z.string().min(1), + id: z.string().min(1).optional(), + workerId: z.string().min(1).optional(), + limit: z.number().int().min(1).max(100).optional(), + offset: z.number().int().min(0).optional(), + }) + .passthrough(), + getCurrencies: z + .object({ + effectiveDate: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + event: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + job: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + location: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + manager: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + staffingEvent: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + worker: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + limit: z.number().int().min(1).max(100).optional(), + offset: z.number().int().min(0).optional(), + }) + .passthrough(), + getCurrentUser: z + .object({ + limit: z.number().int().min(1).max(100).optional(), + offset: z.number().int().min(0).optional(), + }) + .passthrough(), + getGrants: z + .object({ + effectiveDate: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + event: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + organizationType: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + worker: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + limit: z.number().int().min(1).max(100).optional(), + offset: z.number().int().min(0).optional(), + }) + .passthrough(), + getHeadcountOptions: z + .object({ + effectiveDate: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + event: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + job: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + location: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + manager: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + staffingEvent: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + worker: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + limit: z.number().int().min(1).max(100).optional(), + offset: z.number().int().min(0).optional(), + }) + .passthrough(), + getHistoryInstanceForWorker: z + .object({ + ID: z.string().min(1), + id: z.string().min(1).optional(), + workerId: z.string().min(1).optional(), + subresourceID: z.string().min(1), + limit: z.number().int().min(1).max(100).optional(), + offset: z.number().int().min(0).optional(), + }) + .passthrough(), + getHistoryItemsForWorker: z + .object({ + ID: z.string().min(1), + id: z.string().min(1).optional(), + workerId: z.string().min(1).optional(), + limit: z.number().int().min(1).max(100).optional(), + offset: z.number().int().min(0).optional(), + }) + .passthrough(), + getHolidayEvents: z + .object({ + fromDate: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + toDate: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + worker: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + limit: z.number().int().min(1).max(100).optional(), + offset: z.number().int().min(0).optional(), + }) + .passthrough(), + getInterview: z + .object({ + ID: z.string().min(1), + id: z.string().min(1).optional(), + workerId: z.string().min(1).optional(), + limit: z.number().int().min(1).max(100).optional(), + offset: z.number().int().min(0).optional(), + }) + .passthrough(), + getInterviewFeedback2: z + .object({ + ID: z.string().min(1), + id: z.string().min(1).optional(), + workerId: z.string().min(1).optional(), + limit: z.number().int().min(1).max(100).optional(), + offset: z.number().int().min(0).optional(), + }) + .passthrough(), + getLeaveStatusValues: z + .object({ + limit: z.number().int().min(1).max(100).optional(), + offset: z.number().int().min(0).optional(), + }) + .passthrough(), + getMyJobPostings: z + .object({ + limit: z.number().int().min(1).max(100).optional(), + offset: z.number().int().min(0).optional(), + }) + .passthrough(), + getOrganizationAssignmentBusinessUnits: z + .object({ + effectiveDate: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + event: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + organizationType: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + worker: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + limit: z.number().int().min(1).max(100).optional(), + offset: z.number().int().min(0).optional(), + }) + .passthrough(), + getOrganizationAssignmentCustoms: z + .object({ + effectiveDate: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + event: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + organizationType: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + worker: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + limit: z.number().int().min(1).max(100).optional(), + offset: z.number().int().min(0).optional(), + }) + .passthrough(), + getOrganizationAssignmentFunds: z + .object({ + effectiveDate: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + event: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + organizationType: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + worker: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + limit: z.number().int().min(1).max(100).optional(), + offset: z.number().int().min(0).optional(), + }) + .passthrough(), + getOrganizationAssignmentRegions: z + .object({ + effectiveDate: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + event: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + organizationType: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + worker: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + limit: z.number().int().min(1).max(100).optional(), + offset: z.number().int().min(0).optional(), + }) + .passthrough(), + getOrganizationAssignmentWorkers: z + .object({ + effectiveDate: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + event: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + organizationType: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + worker: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + limit: z.number().int().min(1).max(100).optional(), + offset: z.number().int().min(0).optional(), + }) + .passthrough(), + getPayGroupByJobId: z + .object({ + ID: z.string().min(1), + id: z.string().min(1).optional(), + workerId: z.string().min(1).optional(), + limit: z.number().int().min(1).max(100).optional(), + offset: z.number().int().min(0).optional(), + }) + .passthrough(), + getPaySlipInstancesForWorker: z + .object({ + ID: z.string().min(1), + id: z.string().min(1).optional(), + workerId: z.string().min(1).optional(), + subresourceID: z.string().min(1), + limit: z.number().int().min(1).max(100).optional(), + offset: z.number().int().min(0).optional(), + }) + .passthrough(), + getPaySlipsForWorker: z + .object({ + ID: z.string().min(1), + id: z.string().min(1).optional(), + workerId: z.string().min(1).optional(), + limit: z.number().int().min(1).max(100).optional(), + offset: z.number().int().min(0).optional(), + }) + .passthrough(), + getProposedPositionValues: z + .object({ + effectiveDate: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + event: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + job: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + location: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + manager: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + staffingEvent: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + worker: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + limit: z.number().int().min(1).max(100).optional(), + offset: z.number().int().min(0).optional(), + }) + .passthrough(), + getProspect: z + .object({ + ID: z.string().min(1), + id: z.string().min(1).optional(), + workerId: z.string().min(1).optional(), + limit: z.number().int().min(1).max(100).optional(), + offset: z.number().int().min(0).optional(), + }) + .passthrough(), + getProspectEducations: z + .object({ + ID: z.string().min(1), + id: z.string().min(1).optional(), + workerId: z.string().min(1).optional(), + limit: z.number().int().min(1).max(100).optional(), + offset: z.number().int().min(0).optional(), + }) + .passthrough(), + getProspectExperiences: z + .object({ + ID: z.string().min(1), + id: z.string().min(1).optional(), + workerId: z.string().min(1).optional(), + limit: z.number().int().min(1).max(100).optional(), + offset: z.number().int().min(0).optional(), + }) + .passthrough(), + getProspectResumeAttachments: z + .object({ + ID: z.string().min(1), + id: z.string().min(1).optional(), + workerId: z.string().min(1).optional(), + limit: z.number().int().min(1).max(100).optional(), + offset: z.number().int().min(0).optional(), + }) + .passthrough(), + getProspectSkills: z + .object({ + ID: z.string().min(1), + id: z.string().min(1).optional(), + workerId: z.string().min(1).optional(), + limit: z.number().int().min(1).max(100).optional(), + offset: z.number().int().min(0).optional(), + }) + .passthrough(), + getSupervisoryOrgValues: z + .object({ + effectiveDate: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + event: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + job: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + location: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + manager: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + staffingEvent: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + worker: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + limit: z.number().int().min(1).max(100).optional(), + offset: z.number().int().min(0).optional(), + }) + .passthrough(), + getWorkStudyAwards: z + .object({ + effectiveDate: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + event: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + job: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + location: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + manager: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + staffingEvent: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + worker: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + limit: z.number().int().min(1).max(100).optional(), + offset: z.number().int().min(0).optional(), + }) + .passthrough(), + getWorkerBusinessTitleChanges: z + .object({ + ID: z.string().min(1), + id: z.string().min(1).optional(), + workerId: z.string().min(1).optional(), + limit: z.number().int().min(1).max(100).optional(), + offset: z.number().int().min(0).optional(), + }) + .passthrough(), + getWorkerEligibleAbsenceTypes: z + .object({ + ID: z.string().min(1), + id: z.string().min(1).optional(), + workerId: z.string().min(1).optional(), + effective: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + limit: z.number().int().min(1).max(100).optional(), + offset: z.number().int().min(0).optional(), + }) + .passthrough(), + getWorkerInfo: z + .object({ + ID: z.string().min(1), + id: z.string().min(1).optional(), + workerId: z.string().min(1).optional(), + limit: z.number().int().min(1).max(100).optional(), + offset: z.number().int().min(0).optional(), + }) + .passthrough(), + getWorkerLeavesOfAbsence: z + .object({ + ID: z.string().min(1), + id: z.string().min(1).optional(), + workerId: z.string().min(1).optional(), + fromDate: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + toDate: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + status: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + limit: z.number().int().min(1).max(100).optional(), + offset: z.number().int().min(0).optional(), + }) + .passthrough(), + getWorkerServiceDates: z + .object({ + ID: z.string().min(1), + id: z.string().min(1).optional(), + workerId: z.string().min(1).optional(), + limit: z.number().int().min(1).max(100).optional(), + offset: z.number().int().min(0).optional(), + }) + .passthrough(), + getWorkerStaffingInformation: z + .object({ + ID: z.string().min(1), + id: z.string().min(1).optional(), + workerId: z.string().min(1).optional(), + limit: z.number().int().min(1).max(100).optional(), + offset: z.number().int().min(0).optional(), + }) + .passthrough(), + getWorkerTimeOffDetails: z + .object({ + ID: z.string().min(1), + id: z.string().min(1).optional(), + workerId: z.string().min(1).optional(), + fromDate: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + toDate: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + limit: z.number().int().min(1).max(100).optional(), + offset: z.number().int().min(0).optional(), + }) + .passthrough(), + getWorkerTypes: z + .object({ + effectiveDate: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + event: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + job: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + location: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + manager: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + staffingEvent: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + worker: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + limit: z.number().int().min(1).max(100).optional(), + offset: z.number().int().min(0).optional(), + }) + .passthrough(), + getWorkerValidTimeOffDates: z + .object({ + ID: z.string().min(1), + id: z.string().min(1).optional(), + workerId: z.string().min(1).optional(), + fromDate: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + toDate: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + timeOffType: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + limit: z.number().int().min(1).max(100).optional(), + offset: z.number().int().min(0).optional(), + }) + .passthrough(), + retrieveWorkerLeaveOfAbsenceSubresource: z + .object({ + ID: z.string().min(1), + id: z.string().min(1).optional(), + workerId: z.string().min(1).optional(), + subresourceID: z.string().min(1), + limit: z.number().int().min(1).max(100).optional(), + offset: z.number().int().min(0).optional(), + }) + .passthrough(), + getWorkersCollectionStaffing: z + .object({ + includeTerminatedWorkers: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + search: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + limit: z.number().int().min(1).max(100).optional(), + offset: z.number().int().min(0).optional(), + }) + .passthrough(), + getWorkspaceInstances: z + .object({ + effectiveDate: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + event: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + job: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + location: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + manager: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + staffingEvent: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + worker: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + limit: z.number().int().min(1).max(100).optional(), + offset: z.number().int().min(0).optional(), + }) + .passthrough(), + listCountries: z + .object({ + limit: z.number().int().min(1).max(100).optional(), + offset: z.number().int().min(0).optional(), + }) + .passthrough(), + listInterviews: z + .object({ + status: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + limit: z.number().int().min(1).max(100).optional(), + offset: z.number().int().min(0).optional(), + }) + .passthrough(), + listJobs: z + .object({ + includeTerminatedWorkers: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + search: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + limit: z.number().int().min(1).max(100).optional(), + offset: z.number().int().min(0).optional(), + }) + .passthrough(), + updateMessageTemplateById: z + .object({ + ID: z.string().min(1), + id: z.string().min(1).optional(), + workerId: z.string().min(1).optional(), + limit: z.number().int().min(1).max(100).optional(), + offset: z.number().int().min(0).optional(), + // Remaining fields form the JSON body (Workday resource payloads). + }) + .passthrough(), } as const; -export type WorkdayEndpointInputs = { - [K in keyof typeof WorkdayEndpointInputSchemas]: z.infer< - (typeof WorkdayEndpointInputSchemas)[K] - >; -}; - export const WorkdayEndpointOutputSchemas = { - createBusinessTitleChange: CreateBusinessTitleChangeResponseSchema, - createJobChange: CreateJobChangeResponseSchema, - createPayrollInputs: CreatePayrollInputsResponseSchema, - createTimeOffRequest: CreateTimeOffRequestResponseSchema, - getAbsenceBalance: GetAbsenceBalanceResponseSchema, - getAssignmentChangeGroupCostCenters: - GetAssignmentChangeGroupCostCentersResponseSchema, - getAssignmentChangeGroupJobs: GetAssignmentChangeGroupJobsResponseSchema, - getAssignmentTypes: GetAssignmentTypesResponseSchema, - getBusinessTitleChange: GetBusinessTitleChangeResponseSchema, - getBusinessTitleChangeForWorker: - GetBusinessTitleChangeForWorkerResponseSchema, - getCandidateAvailabilityTemplate: - GetCandidateAvailabilityTemplateResponseSchema, - getCollectionOfJobs: GetCollectionOfJobsResponseSchema, - getCollectionOfPayroll: GetCollectionOfPayrollResponseSchema, - getCompanyInsiderTypes: GetCompanyInsiderTypesResponseSchema, - getContingentWorkerTypes: GetContingentWorkerTypesResponseSchema, - getCountryInfo: GetCountryInfoResponseSchema, - getCurrencies: GetCurrenciesResponseSchema, - getCurrentUser: GetCurrentUserResponseSchema, - getGrants: GetGrantsResponseSchema, - getHeadcountOptions: GetHeadcountOptionsResponseSchema, - getHistoryInstanceForWorker: GetHistoryInstanceForWorkerResponseSchema, - getHistoryItemsForWorker: GetHistoryItemsForWorkerResponseSchema, - getHolidayEvents: GetHolidayEventsResponseSchema, - getInterview: GetInterviewResponseSchema, - getInterviewFeedback2: GetInterviewFeedback2ResponseSchema, - getJobById: GetJobByIdResponseSchema, - getJobChangeFrequencies: GetJobChangeFrequenciesResponseSchema, - getJobChangeLocationInfo: GetJobChangeLocationInfoResponseSchema, - getJobChangePosition: GetJobChangePositionResponseSchema, - getJobChangeReasonInstance: GetJobChangeReasonInstanceResponseSchema, - getJobChangeReasonValues: GetJobChangeReasonValuesResponseSchema, - getJobChangeReasons: GetJobChangeReasonsResponseSchema, - getJobChangesGroupTemplates: GetJobChangesGroupTemplatesResponseSchema, - getJobChangesJobValues: GetJobChangesJobValuesResponseSchema, - getJobChangesWorkerValues: GetJobChangesWorkerValuesResponseSchema, - getJobClassifications: GetJobClassificationsResponseSchema, - getJobPosting: GetJobPostingResponseSchema, - getJobPostingQuestionnaire: GetJobPostingQuestionnaireResponseSchema, - getJobProfilesValues: GetJobProfilesValuesResponseSchema, - getJobRequisitionValues: GetJobRequisitionValuesResponseSchema, - getJobWorkspace: GetJobWorkspaceResponseSchema, - getJobWorkspaces: GetJobWorkspacesResponseSchema, - getLeaveStatusValues: GetLeaveStatusValuesResponseSchema, - getMyJobPostings: GetMyJobPostingsResponseSchema, - getOrganizationAssignmentBusinessUnits: - GetOrganizationAssignmentBusinessUnitsResponseSchema, - getOrganizationAssignmentCustoms: - GetOrganizationAssignmentCustomsResponseSchema, - getOrganizationAssignmentFunds: GetOrganizationAssignmentFundsResponseSchema, - getOrganizationAssignmentRegions: - GetOrganizationAssignmentRegionsResponseSchema, - getOrganizationAssignmentWorkers: - GetOrganizationAssignmentWorkersResponseSchema, - getPayGroupByJobId: GetPayGroupByJobIdResponseSchema, - getPaySlipInstancesForWorker: GetPaySlipInstancesForWorkerResponseSchema, - getPaySlipsForWorker: GetPaySlipsForWorkerResponseSchema, - getPayrollInputInstance: GetPayrollInputInstanceResponseSchema, - getProposedPositionValues: GetProposedPositionValuesResponseSchema, - getProspect: GetProspectResponseSchema, - getProspectEducations: GetProspectEducationsResponseSchema, - getProspectExperiences: GetProspectExperiencesResponseSchema, - getProspectResumeAttachments: GetProspectResumeAttachmentsResponseSchema, - getProspectSkills: GetProspectSkillsResponseSchema, - getSupervisoryOrgValues: GetSupervisoryOrgValuesResponseSchema, - getTimeOffEntriesForWorker: GetTimeOffEntriesForWorkerResponseSchema, - getTimeOffPlansForWorker: GetTimeOffPlansForWorkerResponseSchema, - getTimeOffStatusValues: GetTimeOffStatusValuesResponseSchema, - getTimeTypes: GetTimeTypesResponseSchema, - getWorkStudyAwards: GetWorkStudyAwardsResponseSchema, - getWorkerBusinessTitleChanges: GetWorkerBusinessTitleChangesResponseSchema, - getWorkerEligibleAbsenceTypes: GetWorkerEligibleAbsenceTypesResponseSchema, - getWorkerInfo: GetWorkerInfoResponseSchema, - getWorkerLeavesOfAbsence: GetWorkerLeavesOfAbsenceResponseSchema, - getWorkerServiceDates: GetWorkerServiceDatesResponseSchema, - getWorkerStaffingInformation: GetWorkerStaffingInformationResponseSchema, - getWorkerTimeOffDetails: GetWorkerTimeOffDetailsResponseSchema, - getWorkerTypes: GetWorkerTypesResponseSchema, - getWorkerValidTimeOffDates: GetWorkerValidTimeOffDatesResponseSchema, - getWorkersCollectionStaffing: GetWorkersCollectionStaffingResponseSchema, - getWorkspaceInstances: GetWorkspaceInstancesResponseSchema, - listBalances: ListBalancesResponseSchema, - listCountries: ListCountriesResponseSchema, - listInterviews: ListInterviewsResponseSchema, - listJobPostings: ListJobPostingsResponseSchema, - listJobs: ListJobsResponseSchema, - retrieveWorkerLeaveOfAbsenceSubresource: - RetrieveWorkerLeaveOfAbsenceSubresourceResponseSchema, - updateAnExistingPayroll: UpdateAnExistingPayrollResponseSchema, - updateJobChangeBusinessTitle: UpdateJobChangeBusinessTitleResponseSchema, - updateMessageTemplateById: UpdateMessageTemplateByIdResponseSchema, + createBusinessTitleChange: WorkdayResourceSchema, + getBusinessTitleChange: WorkdayResourceSchema, + getBusinessTitleChangeForWorker: WorkdayResourceSchema, + createJobChange: WorkdayResourceSchema, + getJobById: WorkdayResourceSchema, + getJobChangeFrequencies: WorkdayCollectionSchema, + getJobChangeLocationInfo: WorkdayResourceSchema, + getJobChangePosition: WorkdayResourceSchema, + getJobChangeReasonInstance: WorkdayResourceSchema, + getJobChangeReasonValues: WorkdayCollectionSchema, + getJobChangeReasons: WorkdayCollectionSchema, + getJobChangesGroupTemplates: WorkdayCollectionSchema, + getJobChangesJobValues: WorkdayCollectionSchema, + getJobChangesWorkerValues: WorkdayCollectionSchema, + getJobClassifications: WorkdayCollectionSchema, + getJobPosting: WorkdayResourceSchema, + getJobPostingQuestionnaire: WorkdayCollectionSchema, + getJobProfilesValues: WorkdayCollectionSchema, + getJobRequisitionValues: WorkdayCollectionSchema, + getJobWorkspace: WorkdayResourceSchema, + getJobWorkspaces: WorkdayCollectionSchema, + listJobPostings: WorkdayCollectionSchema, + updateJobChangeBusinessTitle: WorkdayResourceSchema, + createPayrollInputs: WorkdayResourceSchema, + getPayrollInputInstance: WorkdayResourceSchema, + updateAnExistingPayroll: WorkdayResourceSchema, + getCollectionOfPayroll: WorkdayCollectionSchema, + createTimeOffRequest: WorkdayResourceSchema, + getTimeOffEntriesForWorker: WorkdayCollectionSchema, + getTimeOffPlansForWorker: WorkdayCollectionSchema, + getTimeOffStatusValues: WorkdayCollectionSchema, + getTimeTypes: WorkdayCollectionSchema, + getAbsenceBalance: WorkdayResourceSchema, + listBalances: WorkdayCollectionSchema, + getAssignmentChangeGroupCostCenters: WorkdayCollectionSchema, + getAssignmentChangeGroupJobs: WorkdayCollectionSchema, + getAssignmentTypes: WorkdayCollectionSchema, + getCandidateAvailabilityTemplate: WorkdayResourceSchema, + getCollectionOfJobs: WorkdayCollectionSchema, + getCompanyInsiderTypes: WorkdayCollectionSchema, + getContingentWorkerTypes: WorkdayCollectionSchema, + getCountryInfo: WorkdayResourceSchema, + getCurrencies: WorkdayCollectionSchema, + getCurrentUser: WorkdayCollectionSchema, + getGrants: WorkdayCollectionSchema, + getHeadcountOptions: WorkdayCollectionSchema, + getHistoryInstanceForWorker: WorkdayResourceSchema, + getHistoryItemsForWorker: WorkdayCollectionSchema, + getHolidayEvents: WorkdayCollectionSchema, + getInterview: WorkdayResourceSchema, + getInterviewFeedback2: WorkdayCollectionSchema, + getLeaveStatusValues: WorkdayCollectionSchema, + getMyJobPostings: WorkdayCollectionSchema, + getOrganizationAssignmentBusinessUnits: WorkdayCollectionSchema, + getOrganizationAssignmentCustoms: WorkdayCollectionSchema, + getOrganizationAssignmentFunds: WorkdayCollectionSchema, + getOrganizationAssignmentRegions: WorkdayCollectionSchema, + getOrganizationAssignmentWorkers: WorkdayCollectionSchema, + getPayGroupByJobId: WorkdayResourceSchema, + getPaySlipInstancesForWorker: WorkdayResourceSchema, + getPaySlipsForWorker: WorkdayCollectionSchema, + getProposedPositionValues: WorkdayCollectionSchema, + getProspect: WorkdayResourceSchema, + getProspectEducations: WorkdayCollectionSchema, + getProspectExperiences: WorkdayCollectionSchema, + getProspectResumeAttachments: WorkdayCollectionSchema, + getProspectSkills: WorkdayCollectionSchema, + getSupervisoryOrgValues: WorkdayCollectionSchema, + getWorkStudyAwards: WorkdayCollectionSchema, + getWorkerBusinessTitleChanges: WorkdayCollectionSchema, + getWorkerEligibleAbsenceTypes: WorkdayCollectionSchema, + getWorkerInfo: WorkdayResourceSchema, + getWorkerLeavesOfAbsence: WorkdayCollectionSchema, + getWorkerServiceDates: WorkdayCollectionSchema, + getWorkerStaffingInformation: WorkdayResourceSchema, + getWorkerTimeOffDetails: WorkdayCollectionSchema, + getWorkerTypes: WorkdayCollectionSchema, + getWorkerValidTimeOffDates: WorkdayCollectionSchema, + retrieveWorkerLeaveOfAbsenceSubresource: WorkdayResourceSchema, + getWorkersCollectionStaffing: WorkdayCollectionSchema, + getWorkspaceInstances: WorkdayCollectionSchema, + listCountries: WorkdayCollectionSchema, + listInterviews: WorkdayCollectionSchema, + listJobs: WorkdayCollectionSchema, + updateMessageTemplateById: WorkdayResourceSchema, } as const; +export type WorkdayEndpointInputs = { + [K in WorkdayRouteName]: z.infer<(typeof WorkdayEndpointInputSchemas)[K]>; +}; export type WorkdayEndpointOutputs = { - [K in keyof typeof WorkdayEndpointOutputSchemas]: z.infer< - (typeof WorkdayEndpointOutputSchemas)[K] - >; + [K in WorkdayRouteName]: z.infer<(typeof WorkdayEndpointOutputSchemas)[K]>; +}; + +// Flat input used by the shared factory (index signature for aliases). +export type WorkdayEndpointInput = { + [key: string]: unknown; + body?: unknown; + query?: Record; }; diff --git a/packages/workday/endpoints/work.ts b/packages/workday/endpoints/work.ts deleted file mode 100644 index fb89d9533..000000000 --- a/packages/workday/endpoints/work.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { logEventFromContext } from 'corsair/core'; -import type { WorkdayEndpoints } from '..'; -import { makeWorkdayRequest } from '../client'; -import type { WorkdayEndpointOutputs } from './types'; - -export const getWorkStudyAwards: WorkdayEndpoints['getWorkStudyAwards'] = - async (ctx, input) => { - const response = await makeWorkdayRequest< - WorkdayEndpointOutputs['getWorkStudyAwards'] - >('v1/work/getWorkStudyAwards', ctx.key, { - method: 'GET', - // Justification: The makeWorkdayRequest client expects a generic string/number/boolean query record. - query: input as { [key: string]: string | number | boolean | undefined }, - }); - await logEventFromContext( - ctx, - 'workday.work.getWorkStudyAwards', - input ?? {}, - 'completed', - ); - return response; - }; diff --git a/packages/workday/endpoints/worker.ts b/packages/workday/endpoints/worker.ts deleted file mode 100644 index e5fbf6689..000000000 --- a/packages/workday/endpoints/worker.ts +++ /dev/null @@ -1,188 +0,0 @@ -import { logEventFromContext } from 'corsair/core'; -import type { WorkdayEndpoints } from '..'; -import { makeWorkdayRequest } from '../client'; -import type { WorkdayEndpointOutputs } from './types'; - -export const getWorkerBusinessTitleChanges: WorkdayEndpoints['getWorkerBusinessTitleChanges'] = - async (ctx, input) => { - const response = await makeWorkdayRequest< - WorkdayEndpointOutputs['getWorkerBusinessTitleChanges'] - >('v1/worker/getWorkerBusinessTitleChanges', ctx.key, { - method: 'GET', - // Justification: The makeWorkdayRequest client expects a generic string/number/boolean query record. - query: input as { [key: string]: string | number | boolean | undefined }, - }); - await logEventFromContext( - ctx, - 'workday.worker.getWorkerBusinessTitleChanges', - input ?? {}, - 'completed', - ); - return response; - }; - -export const getWorkerEligibleAbsenceTypes: WorkdayEndpoints['getWorkerEligibleAbsenceTypes'] = - async (ctx, input) => { - const response = await makeWorkdayRequest< - WorkdayEndpointOutputs['getWorkerEligibleAbsenceTypes'] - >('v1/worker/getWorkerEligibleAbsenceTypes', ctx.key, { - method: 'GET', - // Justification: The makeWorkdayRequest client expects a generic string/number/boolean query record. - query: input as { [key: string]: string | number | boolean | undefined }, - }); - await logEventFromContext( - ctx, - 'workday.worker.getWorkerEligibleAbsenceTypes', - input ?? {}, - 'completed', - ); - return response; - }; - -export const getWorkerInfo: WorkdayEndpoints['getWorkerInfo'] = async ( - ctx, - input, -) => { - const response = await makeWorkdayRequest< - WorkdayEndpointOutputs['getWorkerInfo'] - >('v1/worker/getWorkerInfo', ctx.key, { - method: 'GET', - // Justification: The makeWorkdayRequest client expects a generic unknown record. - query: input as { [key: string]: string | number | boolean | undefined }, - }); - await logEventFromContext( - ctx, - 'workday.worker.getWorkerInfo', - input ?? {}, - 'completed', - ); - return response; -}; - -export const getWorkerLeavesOfAbsence: WorkdayEndpoints['getWorkerLeavesOfAbsence'] = - async (ctx, input) => { - const response = await makeWorkdayRequest< - WorkdayEndpointOutputs['getWorkerLeavesOfAbsence'] - >('v1/worker/getWorkerLeavesOfAbsence', ctx.key, { - method: 'GET', - // Justification: The makeWorkdayRequest client expects a generic string/number/boolean query record. - query: input as { [key: string]: string | number | boolean | undefined }, - }); - await logEventFromContext( - ctx, - 'workday.worker.getWorkerLeavesOfAbsence', - input ?? {}, - 'completed', - ); - return response; - }; - -export const getWorkerServiceDates: WorkdayEndpoints['getWorkerServiceDates'] = - async (ctx, input) => { - const response = await makeWorkdayRequest< - WorkdayEndpointOutputs['getWorkerServiceDates'] - >('v1/worker/getWorkerServiceDates', ctx.key, { - method: 'GET', - // Justification: The makeWorkdayRequest client expects a generic string/number/boolean query record. - query: input as { [key: string]: string | number | boolean | undefined }, - }); - await logEventFromContext( - ctx, - 'workday.worker.getWorkerServiceDates', - input ?? {}, - 'completed', - ); - return response; - }; - -export const getWorkerStaffingInformation: WorkdayEndpoints['getWorkerStaffingInformation'] = - async (ctx, input) => { - const response = await makeWorkdayRequest< - WorkdayEndpointOutputs['getWorkerStaffingInformation'] - >('v1/worker/getWorkerStaffingInformation', ctx.key, { - method: 'GET', - // Justification: The makeWorkdayRequest client expects a generic string/number/boolean query record. - query: input as { [key: string]: string | number | boolean | undefined }, - }); - await logEventFromContext( - ctx, - 'workday.worker.getWorkerStaffingInformation', - input ?? {}, - 'completed', - ); - return response; - }; - -export const getWorkerTimeOffDetails: WorkdayEndpoints['getWorkerTimeOffDetails'] = - async (ctx, input) => { - const response = await makeWorkdayRequest< - WorkdayEndpointOutputs['getWorkerTimeOffDetails'] - >('v1/worker/getWorkerTimeOffDetails', ctx.key, { - method: 'GET', - // Justification: The makeWorkdayRequest client expects a generic string/number/boolean query record. - query: input as { [key: string]: string | number | boolean | undefined }, - }); - await logEventFromContext( - ctx, - 'workday.worker.getWorkerTimeOffDetails', - input ?? {}, - 'completed', - ); - return response; - }; - -export const getWorkerTypes: WorkdayEndpoints['getWorkerTypes'] = async ( - ctx, - input, -) => { - const response = await makeWorkdayRequest< - WorkdayEndpointOutputs['getWorkerTypes'] - >('v1/worker/getWorkerTypes', ctx.key, { - method: 'GET', - // Justification: The makeWorkdayRequest client expects a generic unknown record. - query: input as { [key: string]: string | number | boolean | undefined }, - }); - await logEventFromContext( - ctx, - 'workday.worker.getWorkerTypes', - input ?? {}, - 'completed', - ); - return response; -}; - -export const getWorkerValidTimeOffDates: WorkdayEndpoints['getWorkerValidTimeOffDates'] = - async (ctx, input) => { - const response = await makeWorkdayRequest< - WorkdayEndpointOutputs['getWorkerValidTimeOffDates'] - >('v1/worker/getWorkerValidTimeOffDates', ctx.key, { - method: 'GET', - // Justification: The makeWorkdayRequest client expects a generic string/number/boolean query record. - query: input as { [key: string]: string | number | boolean | undefined }, - }); - await logEventFromContext( - ctx, - 'workday.worker.getWorkerValidTimeOffDates', - input ?? {}, - 'completed', - ); - return response; - }; - -export const retrieveWorkerLeaveOfAbsenceSubresource: WorkdayEndpoints['retrieveWorkerLeaveOfAbsenceSubresource'] = - async (ctx, input) => { - const response = await makeWorkdayRequest< - WorkdayEndpointOutputs['retrieveWorkerLeaveOfAbsenceSubresource'] - >('v1/worker/retrieveWorkerLeaveOfAbsenceSubresource', ctx.key, { - method: 'POST', - // Justification: The makeWorkdayRequest client expects a generic unknown record. - body: input as { [key: string]: unknown }, - }); - await logEventFromContext( - ctx, - 'workday.worker.retrieveWorkerLeaveOfAbsenceSubresource', - input ?? {}, - 'completed', - ); - return response; - }; diff --git a/packages/workday/endpoints/workers.ts b/packages/workday/endpoints/workers.ts deleted file mode 100644 index 13541de68..000000000 --- a/packages/workday/endpoints/workers.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { logEventFromContext } from 'corsair/core'; -import type { WorkdayEndpoints } from '..'; -import { makeWorkdayRequest } from '../client'; -import type { WorkdayEndpointOutputs } from './types'; - -export const getWorkersCollectionStaffing: WorkdayEndpoints['getWorkersCollectionStaffing'] = - async (ctx, input) => { - const response = await makeWorkdayRequest< - WorkdayEndpointOutputs['getWorkersCollectionStaffing'] - >('v1/workers/getWorkersCollectionStaffing', ctx.key, { - method: 'GET', - // Justification: The makeWorkdayRequest client expects a generic string/number/boolean query record. - query: input as { [key: string]: string | number | boolean | undefined }, - }); - await logEventFromContext( - ctx, - 'workday.workers.getWorkersCollectionStaffing', - input ?? {}, - 'completed', - ); - return response; - }; diff --git a/packages/workday/endpoints/workspace.ts b/packages/workday/endpoints/workspace.ts deleted file mode 100644 index a0c2393b4..000000000 --- a/packages/workday/endpoints/workspace.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { logEventFromContext } from 'corsair/core'; -import type { WorkdayEndpoints } from '..'; -import { makeWorkdayRequest } from '../client'; -import type { WorkdayEndpointOutputs } from './types'; - -export const getWorkspaceInstances: WorkdayEndpoints['getWorkspaceInstances'] = - async (ctx, input) => { - const response = await makeWorkdayRequest< - WorkdayEndpointOutputs['getWorkspaceInstances'] - >('v1/workspace/getWorkspaceInstances', ctx.key, { - method: 'GET', - // Justification: The makeWorkdayRequest client expects a generic string/number/boolean query record. - query: input as { [key: string]: string | number | boolean | undefined }, - }); - await logEventFromContext( - ctx, - 'workday.workspace.getWorkspaceInstances', - input ?? {}, - 'completed', - ); - return response; - }; diff --git a/packages/workday/index.ts b/packages/workday/index.ts index f45164d03..e342c85e5 100644 --- a/packages/workday/index.ts +++ b/packages/workday/index.ts @@ -1,55 +1,23 @@ import type { AuthTypes, BindEndpoints, - BindWebhooks, - CorsairContext, CorsairEndpoint, CorsairErrorHandler, CorsairPlugin, CorsairPluginContext, - CorsairWebhook, KeyBuilderContext, PickAuth, PluginAuthConfig, PluginPermissionsConfig, RequiredPluginEndpointMeta, } from 'corsair/core'; +import { AuthMissingError } from 'corsair/core'; import { - Absence, - Assignment, - Balances, - Business, - Candidate, - Collection, - Company, - Contingent, - Countries, - Country, - Currencies, - Current, - Grants, - Headcount, - History, - Holiday, - Interview, - Interviews, - Job, - Jobs, - Leave, - Message, - My, - Organization, - Pay, - Payroll, - Proposed, - Prospect, - Supervisory, - Time, - Work, - Worker, - Workers, - Workspace, -} from './endpoints'; + normalizeWorkdayHost, + normalizeWorkdayTenant, + workdayOAuthUrls, +} from './client'; +import { workdayEndpointsNested } from './endpoints'; import type { WorkdayEndpointInputs, WorkdayEndpointOutputs, @@ -62,12 +30,22 @@ import { errorHandlers } from './error-handlers'; import { WorkdaySchema } from './schema'; import { resolveWorkdayOAuthWebhookTenantLink } from './webhooks/oauth-tenant-link'; import { matchWorkdayTenantWebhook } from './webhooks/tenant-matcher'; -import { workerUpdated } from './webhooks/worker'; +import { workdayWebhooksNested } from './webhooks/triggers'; + +export const workdayAuthConfig = { + oauth_2: { + account: ['tenant', 'host', 'tenant_external_id'] as const, + }, +} as const satisfies PluginAuthConfig; export type WorkdayPluginOptions = { - /** Workday integration for Corsair */ authType?: PickAuth<'oauth_2'>; + /** Bearer token override (tests / BYO). */ key?: string; + /** Workday API host, e.g. wd2-impl-services1.workday.com */ + host?: string; + /** Workday tenant name (required for OAuth + REST base URLs). */ + tenant?: string; webhookSecret?: string; hooks?: InternalWorkdayPlugin['hooks']; webhookHooks?: InternalWorkdayPlugin['webhookHooks']; @@ -77,9 +55,14 @@ export type WorkdayPluginOptions = { export type WorkdayContext = CorsairPluginContext< typeof WorkdaySchema, - WorkdayPluginOptions + WorkdayPluginOptions, + undefined, + typeof workdayAuthConfig +>; +export type WorkdayKeyBuilderContext = KeyBuilderContext< + WorkdayPluginOptions, + typeof workdayAuthConfig >; -export type WorkdayKeyBuilderContext = KeyBuilderContext; export type WorkdayBoundEndpoints = BindEndpoints< typeof workdayEndpointsNested >; @@ -116,18 +99,20 @@ export type WorkdayEndpoints = { updateJobChangeBusinessTitle: WorkdayEndpoint<'updateJobChangeBusinessTitle'>; createPayrollInputs: WorkdayEndpoint<'createPayrollInputs'>; getPayrollInputInstance: WorkdayEndpoint<'getPayrollInputInstance'>; + updateAnExistingPayroll: WorkdayEndpoint<'updateAnExistingPayroll'>; + getCollectionOfPayroll: WorkdayEndpoint<'getCollectionOfPayroll'>; createTimeOffRequest: WorkdayEndpoint<'createTimeOffRequest'>; getTimeOffEntriesForWorker: WorkdayEndpoint<'getTimeOffEntriesForWorker'>; getTimeOffPlansForWorker: WorkdayEndpoint<'getTimeOffPlansForWorker'>; getTimeOffStatusValues: WorkdayEndpoint<'getTimeOffStatusValues'>; getTimeTypes: WorkdayEndpoint<'getTimeTypes'>; getAbsenceBalance: WorkdayEndpoint<'getAbsenceBalance'>; + listBalances: WorkdayEndpoint<'listBalances'>; getAssignmentChangeGroupCostCenters: WorkdayEndpoint<'getAssignmentChangeGroupCostCenters'>; getAssignmentChangeGroupJobs: WorkdayEndpoint<'getAssignmentChangeGroupJobs'>; getAssignmentTypes: WorkdayEndpoint<'getAssignmentTypes'>; getCandidateAvailabilityTemplate: WorkdayEndpoint<'getCandidateAvailabilityTemplate'>; getCollectionOfJobs: WorkdayEndpoint<'getCollectionOfJobs'>; - getCollectionOfPayroll: WorkdayEndpoint<'getCollectionOfPayroll'>; getCompanyInsiderTypes: WorkdayEndpoint<'getCompanyInsiderTypes'>; getContingentWorkerTypes: WorkdayEndpoint<'getContingentWorkerTypes'>; getCountryInfo: WorkdayEndpoint<'getCountryInfo'>; @@ -170,186 +155,15 @@ export type WorkdayEndpoints = { retrieveWorkerLeaveOfAbsenceSubresource: WorkdayEndpoint<'retrieveWorkerLeaveOfAbsenceSubresource'>; getWorkersCollectionStaffing: WorkdayEndpoint<'getWorkersCollectionStaffing'>; getWorkspaceInstances: WorkdayEndpoint<'getWorkspaceInstances'>; - listBalances: WorkdayEndpoint<'listBalances'>; listCountries: WorkdayEndpoint<'listCountries'>; listInterviews: WorkdayEndpoint<'listInterviews'>; listJobs: WorkdayEndpoint<'listJobs'>; - updateAnExistingPayroll: WorkdayEndpoint<'updateAnExistingPayroll'>; updateMessageTemplateById: WorkdayEndpoint<'updateMessageTemplateById'>; }; -export type WorkdayBoundWebhooks = BindWebhooks<{ - 'worker.updated': CorsairWebhook; -}>; - -const workdayEndpointsNested = { - business: { - createBusinessTitleChange: Business.createBusinessTitleChange, - getBusinessTitleChange: Business.getBusinessTitleChange, - getBusinessTitleChangeForWorker: Business.getBusinessTitleChangeForWorker, - }, - job: { - createJobChange: Job.createJobChange, - getJobById: Job.getJobById, - getJobChangeFrequencies: Job.getJobChangeFrequencies, - getJobChangeLocationInfo: Job.getJobChangeLocationInfo, - getJobChangePosition: Job.getJobChangePosition, - getJobChangeReasonInstance: Job.getJobChangeReasonInstance, - getJobChangeReasonValues: Job.getJobChangeReasonValues, - getJobChangeReasons: Job.getJobChangeReasons, - getJobChangesGroupTemplates: Job.getJobChangesGroupTemplates, - getJobChangesJobValues: Job.getJobChangesJobValues, - getJobChangesWorkerValues: Job.getJobChangesWorkerValues, - getJobClassifications: Job.getJobClassifications, - getJobPosting: Job.getJobPosting, - getJobPostingQuestionnaire: Job.getJobPostingQuestionnaire, - getJobProfilesValues: Job.getJobProfilesValues, - getJobRequisitionValues: Job.getJobRequisitionValues, - getJobWorkspace: Job.getJobWorkspace, - getJobWorkspaces: Job.getJobWorkspaces, - listJobPostings: Job.listJobPostings, - updateJobChangeBusinessTitle: Job.updateJobChangeBusinessTitle, - }, - payroll: { - createPayrollInputs: Payroll.createPayrollInputs, - getPayrollInputInstance: Payroll.getPayrollInputInstance, - updateAnExistingPayroll: Payroll.updateAnExistingPayroll, - }, - time: { - createTimeOffRequest: Time.createTimeOffRequest, - getTimeOffEntriesForWorker: Time.getTimeOffEntriesForWorker, - getTimeOffPlansForWorker: Time.getTimeOffPlansForWorker, - getTimeOffStatusValues: Time.getTimeOffStatusValues, - getTimeTypes: Time.getTimeTypes, - }, - absence: { - getAbsenceBalance: Absence.getAbsenceBalance, - }, - assignment: { - getAssignmentChangeGroupCostCenters: - Assignment.getAssignmentChangeGroupCostCenters, - getAssignmentChangeGroupJobs: Assignment.getAssignmentChangeGroupJobs, - getAssignmentTypes: Assignment.getAssignmentTypes, - }, - candidate: { - getCandidateAvailabilityTemplate: - Candidate.getCandidateAvailabilityTemplate, - }, - collection: { - getCollectionOfJobs: Collection.getCollectionOfJobs, - getCollectionOfPayroll: Collection.getCollectionOfPayroll, - }, - company: { - getCompanyInsiderTypes: Company.getCompanyInsiderTypes, - }, - contingent: { - getContingentWorkerTypes: Contingent.getContingentWorkerTypes, - }, - country: { - getCountryInfo: Country.getCountryInfo, - }, - currencies: { - getCurrencies: Currencies.getCurrencies, - }, - current: { - getCurrentUser: Current.getCurrentUser, - }, - grants: { - getGrants: Grants.getGrants, - }, - headcount: { - getHeadcountOptions: Headcount.getHeadcountOptions, - }, - history: { - getHistoryInstanceForWorker: History.getHistoryInstanceForWorker, - getHistoryItemsForWorker: History.getHistoryItemsForWorker, - }, - holiday: { - getHolidayEvents: Holiday.getHolidayEvents, - }, - interview: { - getInterview: Interview.getInterview, - getInterviewFeedback2: Interview.getInterviewFeedback2, - }, - leave: { - getLeaveStatusValues: Leave.getLeaveStatusValues, - }, - my: { - getMyJobPostings: My.getMyJobPostings, - }, - organization: { - getOrganizationAssignmentBusinessUnits: - Organization.getOrganizationAssignmentBusinessUnits, - getOrganizationAssignmentCustoms: - Organization.getOrganizationAssignmentCustoms, - getOrganizationAssignmentFunds: Organization.getOrganizationAssignmentFunds, - getOrganizationAssignmentRegions: - Organization.getOrganizationAssignmentRegions, - getOrganizationAssignmentWorkers: - Organization.getOrganizationAssignmentWorkers, - }, - pay: { - getPayGroupByJobId: Pay.getPayGroupByJobId, - getPaySlipInstancesForWorker: Pay.getPaySlipInstancesForWorker, - getPaySlipsForWorker: Pay.getPaySlipsForWorker, - }, - proposed: { - getProposedPositionValues: Proposed.getProposedPositionValues, - }, - prospect: { - getProspect: Prospect.getProspect, - getProspectEducations: Prospect.getProspectEducations, - getProspectExperiences: Prospect.getProspectExperiences, - getProspectResumeAttachments: Prospect.getProspectResumeAttachments, - getProspectSkills: Prospect.getProspectSkills, - }, - supervisory: { - getSupervisoryOrgValues: Supervisory.getSupervisoryOrgValues, - }, - work: { - getWorkStudyAwards: Work.getWorkStudyAwards, - }, - worker: { - getWorkerBusinessTitleChanges: Worker.getWorkerBusinessTitleChanges, - getWorkerEligibleAbsenceTypes: Worker.getWorkerEligibleAbsenceTypes, - getWorkerInfo: Worker.getWorkerInfo, - getWorkerLeavesOfAbsence: Worker.getWorkerLeavesOfAbsence, - getWorkerServiceDates: Worker.getWorkerServiceDates, - getWorkerStaffingInformation: Worker.getWorkerStaffingInformation, - getWorkerTimeOffDetails: Worker.getWorkerTimeOffDetails, - getWorkerTypes: Worker.getWorkerTypes, - getWorkerValidTimeOffDates: Worker.getWorkerValidTimeOffDates, - retrieveWorkerLeaveOfAbsenceSubresource: - Worker.retrieveWorkerLeaveOfAbsenceSubresource, - }, - workers: { - getWorkersCollectionStaffing: Workers.getWorkersCollectionStaffing, - }, - workspace: { - getWorkspaceInstances: Workspace.getWorkspaceInstances, - }, - balances: { - listBalances: Balances.listBalances, - }, - countries: { - listCountries: Countries.listCountries, - }, - interviews: { - listInterviews: Interviews.listInterviews, - }, - jobs: { - listJobs: Jobs.listJobs, - }, - message: { - updateMessageTemplateById: Message.updateMessageTemplateById, - }, -} as const; - -const workdayWebhooksNested = { - 'worker.updated': workerUpdated, -} as const; +const defaultAuthType: AuthTypes = 'oauth_2' as const; -export const workdayEndpointSchemas = { +const workdayEndpointSchemas = { 'business.createBusinessTitleChange': { input: WorkdayEndpointInputSchemas.createBusinessTitleChange, output: WorkdayEndpointOutputSchemas.createBusinessTitleChange, @@ -450,6 +264,14 @@ export const workdayEndpointSchemas = { input: WorkdayEndpointInputSchemas.getPayrollInputInstance, output: WorkdayEndpointOutputSchemas.getPayrollInputInstance, }, + 'payroll.updateAnExistingPayroll': { + input: WorkdayEndpointInputSchemas.updateAnExistingPayroll, + output: WorkdayEndpointOutputSchemas.updateAnExistingPayroll, + }, + 'collection.getCollectionOfPayroll': { + input: WorkdayEndpointInputSchemas.getCollectionOfPayroll, + output: WorkdayEndpointOutputSchemas.getCollectionOfPayroll, + }, 'time.createTimeOffRequest': { input: WorkdayEndpointInputSchemas.createTimeOffRequest, output: WorkdayEndpointOutputSchemas.createTimeOffRequest, @@ -474,6 +296,10 @@ export const workdayEndpointSchemas = { input: WorkdayEndpointInputSchemas.getAbsenceBalance, output: WorkdayEndpointOutputSchemas.getAbsenceBalance, }, + 'balances.listBalances': { + input: WorkdayEndpointInputSchemas.listBalances, + output: WorkdayEndpointOutputSchemas.listBalances, + }, 'assignment.getAssignmentChangeGroupCostCenters': { input: WorkdayEndpointInputSchemas.getAssignmentChangeGroupCostCenters, output: WorkdayEndpointOutputSchemas.getAssignmentChangeGroupCostCenters, @@ -494,10 +320,6 @@ export const workdayEndpointSchemas = { input: WorkdayEndpointInputSchemas.getCollectionOfJobs, output: WorkdayEndpointOutputSchemas.getCollectionOfJobs, }, - 'collection.getCollectionOfPayroll': { - input: WorkdayEndpointInputSchemas.getCollectionOfPayroll, - output: WorkdayEndpointOutputSchemas.getCollectionOfPayroll, - }, 'company.getCompanyInsiderTypes': { input: WorkdayEndpointInputSchemas.getCompanyInsiderTypes, output: WorkdayEndpointOutputSchemas.getCompanyInsiderTypes, @@ -667,10 +489,6 @@ export const workdayEndpointSchemas = { input: WorkdayEndpointInputSchemas.getWorkspaceInstances, output: WorkdayEndpointOutputSchemas.getWorkspaceInstances, }, - 'balances.listBalances': { - input: WorkdayEndpointInputSchemas.listBalances, - output: WorkdayEndpointOutputSchemas.listBalances, - }, 'countries.listCountries': { input: WorkdayEndpointInputSchemas.listCountries, output: WorkdayEndpointOutputSchemas.listCountries, @@ -683,374 +501,392 @@ export const workdayEndpointSchemas = { input: WorkdayEndpointInputSchemas.listJobs, output: WorkdayEndpointOutputSchemas.listJobs, }, - 'payroll.updateAnExistingPayroll': { - input: WorkdayEndpointInputSchemas.updateAnExistingPayroll, - output: WorkdayEndpointOutputSchemas.updateAnExistingPayroll, - }, 'message.updateMessageTemplateById': { input: WorkdayEndpointInputSchemas.updateMessageTemplateById, output: WorkdayEndpointOutputSchemas.updateMessageTemplateById, }, } as const; -const defaultAuthType: AuthTypes = 'oauth_2' as const; - const workdayEndpointMeta = { 'business.createBusinessTitleChange': { riskLevel: 'write', - description: 'Create Business Title Change', + description: + 'Creates a business title change for a worker (Common API v1).', }, 'business.getBusinessTitleChange': { riskLevel: 'read', - description: 'Get Business Title Change', + description: + 'Retrieves a business title change instance by ID (Common API v1).', }, 'business.getBusinessTitleChangeForWorker': { riskLevel: 'read', - description: 'Get Business Title Change For Worker', + description: + 'Retrieves a business title change for a specific worker (Common API v1).', }, 'job.createJobChange': { riskLevel: 'write', - description: 'Create Job Change', + description: 'Initiates a job change for a worker (Staffing v6).', }, 'job.getJobById': { riskLevel: 'read', - description: 'Get Job By ID', + description: 'Retrieves a single job instance by ID (Staffing v6).', }, 'job.getJobChangeFrequencies': { riskLevel: 'read', - description: 'Get Job Change Frequencies', + description: + 'Retrieves frequency prompt values for job changes (Staffing v6).', }, 'job.getJobChangeLocationInfo': { riskLevel: 'read', - description: 'Get Job Change Location Info', + description: 'Retrieves location info for a job change (Staffing v6).', }, 'job.getJobChangePosition': { riskLevel: 'read', - description: 'Get Job Change Position', + description: 'Retrieves position details for a job change (Staffing v6).', }, 'job.getJobChangeReasonInstance': { riskLevel: 'read', - description: 'Get Job Change Reason Instance', + description: 'Retrieves a job change reason instance (Staffing v6).', }, 'job.getJobChangeReasonValues': { riskLevel: 'read', - description: 'Get Job Change Reason Values', + description: 'Retrieves job change reason prompt values (Staffing v6).', }, 'job.getJobChangeReasons': { riskLevel: 'read', - description: 'Get Job Change Reasons', + description: 'Retrieves job change reasons collection (Staffing v6).', }, 'job.getJobChangesGroupTemplates': { riskLevel: 'read', - description: 'Get Job Changes Group Templates', + description: 'Retrieves job change templates (Staffing v6).', }, 'job.getJobChangesJobValues': { riskLevel: 'read', - description: 'Get Job Changes Job Values', + description: 'Retrieves job prompt values for job changes (Staffing v6).', }, 'job.getJobChangesWorkerValues': { riskLevel: 'read', - description: 'Get Job Changes Worker Values', + description: + 'Retrieves worker prompt values for job changes (Staffing v6).', }, 'job.getJobClassifications': { riskLevel: 'read', - description: 'Get Job Classifications', + description: 'Retrieves job classification prompt values (Staffing v6).', }, 'job.getJobPosting': { riskLevel: 'read', - description: 'Get Job Posting', + description: + 'Retrieves a job posting including description (Recruiting v4).', }, 'job.getJobPostingQuestionnaire': { riskLevel: 'read', - description: 'Get Job Posting Questionnaire', + description: 'Retrieves questionnaires for a job posting (Recruiting v4).', }, 'job.getJobProfilesValues': { riskLevel: 'read', - description: 'Get Job Profiles Values', + description: 'Retrieves job profile prompt values (Staffing v6).', }, 'job.getJobRequisitionValues': { riskLevel: 'read', - description: 'Get Job Requisition Values', + description: 'Retrieves job requisition prompt values (Staffing v6).', }, 'job.getJobWorkspace': { riskLevel: 'read', - description: 'Get Job Workspace', + description: 'Retrieves a workspace for a job (Staffing v6).', }, 'job.getJobWorkspaces': { riskLevel: 'read', - description: 'Get Job Workspaces', + description: 'Retrieves workspaces for a job (Staffing v6).', }, 'job.listJobPostings': { riskLevel: 'read', - description: 'List Job Postings', + description: 'Lists job postings (Recruiting v4).', }, 'job.updateJobChangeBusinessTitle': { riskLevel: 'write', - description: 'Update Job Change Business Title', + description: + 'Partially updates business title on a job change (Staffing v6).', }, 'payroll.createPayrollInputs': { riskLevel: 'write', - description: 'Create Payroll Inputs', + description: 'Creates payroll inputs (Payroll v1).', }, 'payroll.getPayrollInputInstance': { riskLevel: 'read', - description: 'Get Payroll Input Instance', + description: 'Retrieves a payroll input by ID (Payroll v1).', + }, + 'payroll.updateAnExistingPayroll': { + riskLevel: 'write', + description: 'Partially updates a payroll input (Payroll v1).', + }, + 'collection.getCollectionOfPayroll': { + riskLevel: 'read', + description: 'Retrieves a collection of payroll inputs (Payroll v1).', }, 'time.createTimeOffRequest': { riskLevel: 'write', - description: 'Create Time Off Request', + description: 'Creates a time off request (Absence Management v5).', }, 'time.getTimeOffEntriesForWorker': { riskLevel: 'read', - description: 'Get Time Off Entries for Worker', + description: 'Retrieves time off entries for a worker (Common API v1).', }, 'time.getTimeOffPlansForWorker': { riskLevel: 'read', - description: 'Get Time Off Plans For Worker', + description: 'Retrieves time off plans for a worker (Common API v1).', }, 'time.getTimeOffStatusValues': { riskLevel: 'read', - description: 'Get Time Off Status Values', + description: + 'Retrieves time off status prompt values (Absence Management v5).', }, 'time.getTimeTypes': { riskLevel: 'read', - description: 'Get Time Types', + description: 'Retrieves time type prompt values (Staffing v6).', }, 'absence.getAbsenceBalance': { riskLevel: 'read', - description: 'Get Absence Balance', + description: 'Retrieves an absence balance by ID (Absence Management v5).', + }, + 'balances.listBalances': { + riskLevel: 'read', + description: 'Lists absence balances (Absence Management v5).', }, 'assignment.getAssignmentChangeGroupCostCenters': { riskLevel: 'read', - description: 'Get Assignment Change Group Cost Centers', + description: + 'Retrieves cost center prompt values for org assignment changes (Staffing v6).', }, 'assignment.getAssignmentChangeGroupJobs': { riskLevel: 'read', - description: 'Get Assignment Change Group Jobs', + description: + 'Retrieves job prompt values for org assignment changes (Staffing v6).', }, 'assignment.getAssignmentTypes': { riskLevel: 'read', - description: 'Get Assignment Types', + description: 'Retrieves assignment type prompt values (Staffing v6).', }, 'candidate.getCandidateAvailabilityTemplate': { riskLevel: 'read', - description: 'Get Candidate Availability Template', + description: + 'Retrieves candidate availability template for a job posting (Recruiting v4).', }, 'collection.getCollectionOfJobs': { riskLevel: 'read', - description: 'Get Collection of Jobs', - }, - 'collection.getCollectionOfPayroll': { - riskLevel: 'read', - description: 'Get Collection of Payroll', + description: 'Retrieves a paginated collection of jobs (Staffing v6).', }, 'company.getCompanyInsiderTypes': { riskLevel: 'read', - description: 'Get Company Insider Types', + description: 'Retrieves company insider type prompt values (Staffing v6).', }, 'contingent.getContingentWorkerTypes': { riskLevel: 'read', - description: 'Get Contingent Worker Types', + description: + 'Retrieves contingent worker type prompt values (Staffing v6).', }, 'country.getCountryInfo': { riskLevel: 'read', - description: 'Get Country Info', + description: 'Retrieves country info (Common API v1).', }, 'currencies.getCurrencies': { riskLevel: 'read', - description: 'Get Currencies', + description: + 'Retrieves currency prompt values for job changes (Staffing v6).', }, 'current.getCurrentUser': { riskLevel: 'read', - description: 'Get Current User', + description: 'Retrieves the authenticated worker profile (Staffing v6).', }, 'grants.getGrants': { riskLevel: 'read', - description: 'Get Grants', + description: + 'Retrieves grant prompt values for org assignment changes (Staffing v6).', }, 'headcount.getHeadcountOptions': { riskLevel: 'read', - description: 'Get Headcount Options', + description: 'Retrieves headcount option prompt values (Staffing v6).', }, 'history.getHistoryInstanceForWorker': { riskLevel: 'read', - description: 'Get History Instance for Worker', + description: 'Retrieves a history instance for a worker (Common API v1).', }, 'history.getHistoryItemsForWorker': { riskLevel: 'read', - description: 'Get History Items for Worker', + description: 'Retrieves history items for a worker (Common API v1).', }, 'holiday.getHolidayEvents': { riskLevel: 'read', - description: 'Get Holiday Events', + description: + 'Retrieves holiday events for workers/time period (Person v4).', }, 'interview.getInterview': { riskLevel: 'read', - description: 'Get Interview', + description: 'Retrieves an interview by ID (Recruiting v4).', }, 'interview.getInterviewFeedback2': { riskLevel: 'read', - description: 'Get Interview Feedback', + description: 'Retrieves interview feedback (Recruiting v4).', }, 'leave.getLeaveStatusValues': { riskLevel: 'read', - description: 'Get Leave Status Values', + description: + 'Retrieves leave status prompt values (Absence Management v5).', }, 'my.getMyJobPostings': { riskLevel: 'read', - description: 'Get My Job Postings', + description: + 'Retrieves job postings for the authenticated recruiter (Recruiting v4).', }, 'organization.getOrganizationAssignmentBusinessUnits': { riskLevel: 'read', - description: 'Get Organization Assignment Business Units', + description: + 'Retrieves business unit prompt values for org assignment changes (Staffing v6).', }, 'organization.getOrganizationAssignmentCustoms': { riskLevel: 'read', - description: 'Get Organization Assignment Customs', + description: 'Retrieves custom org assignment prompt values (Staffing v6).', }, 'organization.getOrganizationAssignmentFunds': { riskLevel: 'read', - description: 'Get Organization Assignment Funds', + description: + 'Retrieves fund prompt values for org assignment changes (Staffing v6).', }, 'organization.getOrganizationAssignmentRegions': { riskLevel: 'read', - description: 'Get Organization Assignment Regions', + description: + 'Retrieves region prompt values for org assignment changes (Staffing v6).', }, 'organization.getOrganizationAssignmentWorkers': { riskLevel: 'read', - description: 'Get Organization Assignment Workers', + description: + 'Retrieves worker prompt values for org assignment changes (Staffing v6).', }, 'pay.getPayGroupByJobId': { riskLevel: 'read', - description: 'Get Pay Group by Job ID', + description: 'Retrieves the pay group for a job (Staffing v6).', }, 'pay.getPaySlipInstancesForWorker': { riskLevel: 'read', - description: 'Get Pay Slip Instance for Worker', + description: 'Retrieves a pay slip instance for a worker (Common API v1).', }, 'pay.getPaySlipsForWorker': { riskLevel: 'read', - description: 'Get Pay Slips for Worker', + description: 'Retrieves pay slips for a worker (Common API v1).', }, 'proposed.getProposedPositionValues': { riskLevel: 'read', - description: 'Get Proposed Position Values', + description: 'Retrieves proposed position prompt values (Staffing v6).', }, 'prospect.getProspect': { riskLevel: 'read', - description: 'Get Prospect', + description: 'Retrieves a prospect (Recruiting v4).', }, 'prospect.getProspectEducations': { riskLevel: 'read', - description: 'Get Prospect Educations', + description: 'Retrieves prospect educations (Recruiting v4).', }, 'prospect.getProspectExperiences': { riskLevel: 'read', - description: 'Get Prospect Experiences', + description: 'Retrieves prospect experiences (Recruiting v4).', }, 'prospect.getProspectResumeAttachments': { riskLevel: 'read', - description: 'Get Prospect Resume Attachments', + description: 'Retrieves prospect resume attachments (Recruiting v4).', }, 'prospect.getProspectSkills': { riskLevel: 'read', - description: 'Get Prospect Skills', + description: 'Retrieves prospect skills (Recruiting v4).', }, 'supervisory.getSupervisoryOrgValues': { riskLevel: 'read', - description: 'Get Supervisory Organization Values', + description: + 'Retrieves supervisory organization prompt values (Staffing v6).', }, 'work.getWorkStudyAwards': { riskLevel: 'read', - description: 'Get Work Study Awards', + description: 'Retrieves work study award prompt values (Staffing v6).', }, 'worker.getWorkerBusinessTitleChanges': { riskLevel: 'read', - description: 'Get Worker Business Title Changes', + description: + 'Retrieves business title changes for a worker (Common API v1).', }, 'worker.getWorkerEligibleAbsenceTypes': { riskLevel: 'read', - description: 'Get Worker Eligible Absence Types', + description: + 'Retrieves eligible absence types for a worker (Absence Management v5).', }, 'worker.getWorkerInfo': { riskLevel: 'read', - description: 'Get Worker Info', + description: 'Retrieves worker staffing information (Staffing v6).', }, 'worker.getWorkerLeavesOfAbsence': { riskLevel: 'read', - description: 'Get Worker Leaves of Absence', + description: + 'Retrieves leaves of absence for a worker (Absence Management v5).', }, 'worker.getWorkerServiceDates': { riskLevel: 'read', - description: 'Get Worker Service Dates', + description: 'Retrieves service dates for a worker (Staffing v6).', }, 'worker.getWorkerStaffingInformation': { riskLevel: 'read', - description: 'Get Worker Staffing Information', + description: + 'Retrieves current staffing information for a worker (Staffing v6).', }, 'worker.getWorkerTimeOffDetails': { riskLevel: 'read', - description: 'Get Worker Time Off Details', + description: + 'Retrieves time off details for a worker (Absence Management v5).', }, 'worker.getWorkerTypes': { riskLevel: 'read', - description: 'Get Worker Types', + description: 'Retrieves worker type prompt values (Staffing v6).', }, 'worker.getWorkerValidTimeOffDates': { riskLevel: 'read', - description: 'Get Worker Valid Time Off Dates', + description: + 'Retrieves valid time off dates for a worker (Absence Management v5).', }, 'worker.retrieveWorkerLeaveOfAbsenceSubresource': { - riskLevel: 'write', - description: 'Retrieve Worker Leave of Absence', + riskLevel: 'read', + description: + 'Retrieves a leave of absence subresource (Absence Management v5).', }, 'workers.getWorkersCollectionStaffing': { riskLevel: 'read', - description: 'Get Workers Collection Staffing', + description: 'Retrieves workers with staffing information (Staffing v6).', }, 'workspace.getWorkspaceInstances': { riskLevel: 'read', - description: 'Get Workspace Instances', - }, - 'balances.listBalances': { - riskLevel: 'read', - description: 'List Balances', + description: 'Retrieves workspace prompt values (Staffing v6).', }, 'countries.listCountries': { riskLevel: 'read', - description: 'List Countries', + description: 'Retrieves country values for recruiting (Recruiting v4).', }, 'interviews.listInterviews': { riskLevel: 'read', - description: 'List Interviews', + description: 'Lists interviews (Recruiting v4).', }, 'jobs.listJobs': { riskLevel: 'read', - description: 'List Jobs', - }, - 'payroll.updateAnExistingPayroll': { - riskLevel: 'write', - description: 'Update An Existing Payroll', + description: 'Lists jobs (Staffing v6).', }, 'message.updateMessageTemplateById': { riskLevel: 'write', - description: 'Update Message Template By ID', + description: 'Updates a message template by ID (Recruiting v4).', }, } satisfies RequiredPluginEndpointMeta; -export const workdayAuthConfig = { - oauth_2: { - account: ['tenant_external_id'] as const, - }, -} as const satisfies PluginAuthConfig; - export type BaseWorkdayPlugin = CorsairPlugin< 'workday', typeof WorkdaySchema, typeof workdayEndpointsNested, typeof workdayWebhooksNested, T, - typeof defaultAuthType + typeof defaultAuthType, + typeof workdayAuthConfig >; export type InternalWorkdayPlugin = BaseWorkdayPlugin; @@ -1064,9 +900,40 @@ export function workday( ...incomingOptions, authType: incomingOptions.authType ?? defaultAuthType, }; + const tenant = options.tenant?.trim() + ? normalizeWorkdayTenant(options.tenant) + : undefined; + const host = options.host?.trim() + ? normalizeWorkdayHost(options.host) + : undefined; + + if (options.authType === 'oauth_2' && !tenant) { + throw new Error('[workday] options.tenant is required for oauth_2'); + } + + const oauthUrls = + tenant != null + ? workdayOAuthUrls({ + host: host ?? 'wd2-impl-services1.workday.com', + tenant, + }) + : null; + return { id: 'workday', authConfig: workdayAuthConfig, + ...(oauthUrls + ? { + oauthConfig: { + providerName: 'Workday', + authUrl: oauthUrls.authUrl, + tokenUrl: oauthUrls.tokenUrl, + scopes: ['staffing', 'absenceManagement', 'recruiting', 'payroll'], + tokenAuthMethod: 'body' as const, + requiresRegisteredRedirect: true, + }, + } + : {}), schema: WorkdaySchema, options, hooks: options.hooks, @@ -1076,7 +943,10 @@ export function workday( endpointMeta: workdayEndpointMeta, endpointSchemas: workdayEndpointSchemas, pluginWebhookMatcher: (request) => { - return 'x-workday-signature' in request.headers; + return ( + 'x-workday-signature' in request.headers || + 'x-workday-event' in request.headers + ); }, pluginTenantWebhookMatcher: matchWorkdayTenantWebhook, oauthWebhookTenantLinkResolver: resolveWorkdayOAuthWebhookTenantLink, @@ -1089,19 +959,21 @@ export function workday( return options.webhookSecret; if (source === 'webhook') { const res = await ctx.keys.get_webhook_signature(); - return res ?? ''; + if (!res) throw new AuthMissingError('workday', 'webhook_signature'); + return res; } if (source === 'endpoint' && options.key) return options.key; - if (source === 'endpoint' && ctx.authType === 'oauth_2') { const res = await ctx.keys.get_access_token(); - return res ?? ''; + if (!res) throw new AuthMissingError('workday', 'oauth_2'); + return res; } return ''; }, } satisfies InternalWorkdayPlugin; } +export { workdayRoutes } from './endpoints/routes'; export type { WorkdayEndpointInputs, WorkdayEndpointOutputs, diff --git a/packages/workday/webhooks/index.ts b/packages/workday/webhooks/index.ts index 54679600e..d86d2e7d5 100644 --- a/packages/workday/webhooks/index.ts +++ b/packages/workday/webhooks/index.ts @@ -1,4 +1,4 @@ export * from './oauth-tenant-link'; export * from './tenant-matcher'; +export * from './triggers'; export * from './types'; -export * from './worker'; diff --git a/packages/workday/webhooks/triggers.ts b/packages/workday/webhooks/triggers.ts new file mode 100644 index 000000000..aeef5e6fe --- /dev/null +++ b/packages/workday/webhooks/triggers.ts @@ -0,0 +1,69 @@ +import type { CorsairWebhook } from 'corsair/core'; +import type { WorkdayContext } from '../index'; +import type { WorkdayTriggerEventName, WorkdayWebhookOutputs } from './types'; +import { + createWorkdayEventMatch, + verifyWorkdayWebhookSignature, +} from './types'; + +function createTriggerWebhook( + eventType: K, +): CorsairWebhook { + return { + match: createWorkdayEventMatch(eventType), + handler: async (ctx, request) => { + const secret = + ctx.options?.webhookSecret || + // Justification: keyBuilder may place the webhook secret on ctx.key for webhook source. + (typeof (ctx as { key?: string }).key === 'string' + ? (ctx as { key: string }).key + : ''); + const v = verifyWorkdayWebhookSignature( + // Justification: matcher already constrained the payload type; cast for shared verifier. + request as Parameters[0], + secret, + ); + if (!v.valid) { + return { + success: false, + statusCode: 401, + error: v.error || 'Signature verification failed', + }; + } + return { success: true }; + }, + }; +} + +/** + * Composio-aligned Workday triggers (13). + * Workday does not push these natively — deliver via a poller/Event Notification + * bridge that POSTs `{ type, data }` with `x-workday-signature`. + */ +export const workdayWebhooksNested = { + 'absenceBalance.changed': createTriggerWebhook('absenceBalance.changed'), + 'balanceDetails.changed': createTriggerWebhook('balanceDetails.changed'), + 'interviewFeedback.submitted': createTriggerWebhook( + 'interviewFeedback.submitted', + ), + 'jobPosting.changed': createTriggerWebhook('jobPosting.changed'), + 'jobPostingQuestionnaire.changed': createTriggerWebhook( + 'jobPostingQuestionnaire.changed', + ), + 'absenceBalance.created': createTriggerWebhook('absenceBalance.created'), + 'interview.scheduled': createTriggerWebhook('interview.scheduled'), + 'jobPosting.created': createTriggerWebhook('jobPosting.created'), + 'prospectResumeAttachment.added': createTriggerWebhook( + 'prospectResumeAttachment.added', + ), + 'prospectProfile.changed': createTriggerWebhook('prospectProfile.changed'), + 'workerEligibleAbsenceType.changed': createTriggerWebhook( + 'workerEligibleAbsenceType.changed', + ), + 'workerLeaveOfAbsence.changed': createTriggerWebhook( + 'workerLeaveOfAbsence.changed', + ), + 'workerLeaveOfAbsence.created': createTriggerWebhook( + 'workerLeaveOfAbsence.created', + ), +} as const; diff --git a/packages/workday/webhooks/types.ts b/packages/workday/webhooks/types.ts index 2f06ba98e..56dcaa7d7 100644 --- a/packages/workday/webhooks/types.ts +++ b/packages/workday/webhooks/types.ts @@ -3,6 +3,7 @@ import type { RawWebhookRequest, WebhookRequest, } from 'corsair/core'; +import { verifyHmacSignature } from 'corsair/http'; import { z } from 'zod'; export const WorkdayWebhookPayloadSchema = z.object({ @@ -12,15 +13,59 @@ export const WorkdayWebhookPayloadSchema = z.object({ }); export type WorkdayWebhookPayload = z.infer; -export const WorkdayWorkerEventSchema = z.object({ - type: z.literal('worker.updated'), - created_at: z.string(), - data: z.object({ worker_id: z.string() }).catchall(z.unknown()), +const SnapshotEventBase = z.object({ + created_at: z.string().optional(), + data: z.record(z.string(), z.unknown()), }); -export type WorkdayWorkerEvent = z.infer; + +export const WorkdayTriggerEventSchemas = { + 'absenceBalance.changed': SnapshotEventBase.extend({ + type: z.literal('absenceBalance.changed'), + }), + 'balanceDetails.changed': SnapshotEventBase.extend({ + type: z.literal('balanceDetails.changed'), + }), + 'interviewFeedback.submitted': SnapshotEventBase.extend({ + type: z.literal('interviewFeedback.submitted'), + }), + 'jobPosting.changed': SnapshotEventBase.extend({ + type: z.literal('jobPosting.changed'), + }), + 'jobPostingQuestionnaire.changed': SnapshotEventBase.extend({ + type: z.literal('jobPostingQuestionnaire.changed'), + }), + 'absenceBalance.created': SnapshotEventBase.extend({ + type: z.literal('absenceBalance.created'), + }), + 'interview.scheduled': SnapshotEventBase.extend({ + type: z.literal('interview.scheduled'), + }), + 'jobPosting.created': SnapshotEventBase.extend({ + type: z.literal('jobPosting.created'), + }), + 'prospectResumeAttachment.added': SnapshotEventBase.extend({ + type: z.literal('prospectResumeAttachment.added'), + }), + 'prospectProfile.changed': SnapshotEventBase.extend({ + type: z.literal('prospectProfile.changed'), + }), + 'workerEligibleAbsenceType.changed': SnapshotEventBase.extend({ + type: z.literal('workerEligibleAbsenceType.changed'), + }), + 'workerLeaveOfAbsence.changed': SnapshotEventBase.extend({ + type: z.literal('workerLeaveOfAbsence.changed'), + }), + 'workerLeaveOfAbsence.created': SnapshotEventBase.extend({ + type: z.literal('workerLeaveOfAbsence.created'), + }), +} as const; + +export type WorkdayTriggerEventName = keyof typeof WorkdayTriggerEventSchemas; export type WorkdayWebhookOutputs = { - 'worker.updated': WorkdayWorkerEvent; + [K in WorkdayTriggerEventName]: z.infer< + (typeof WorkdayTriggerEventSchemas)[K] + >; }; function parseBody(body: unknown): unknown { @@ -33,9 +78,13 @@ function parseBody(body: unknown): unknown { } export function createWorkdayEventMatch( - eventType: string, + eventType: WorkdayTriggerEventName | string, ): CorsairWebhookMatcher { return (request: RawWebhookRequest) => { + const headerType = request.headers['x-workday-event']; + if (typeof headerType === 'string' && headerType === eventType) { + return true; + } const parsed = parseBody(request.body); if (!parsed || typeof parsed !== 'object') return false; const record = parsed as Record; @@ -43,8 +92,6 @@ export function createWorkdayEventMatch( }; } -import { verifyHmacSignature } from 'corsair/http'; - export function verifyWorkdayWebhookSignature( request: WebhookRequest, secret: string, diff --git a/packages/workday/webhooks/worker.ts b/packages/workday/webhooks/worker.ts deleted file mode 100644 index 8387a0e09..000000000 --- a/packages/workday/webhooks/worker.ts +++ /dev/null @@ -1,24 +0,0 @@ -import type { CorsairWebhook } from 'corsair/core'; -import type { WorkdayContext } from '../index'; -import type { WorkdayWorkerEvent } from './types'; -import { - createWorkdayEventMatch, - verifyWorkdayWebhookSignature, -} from './types'; - -export const workerUpdated: CorsairWebhook = - { - match: createWorkdayEventMatch('worker.updated'), - handler: async (ctx, request) => { - const secret = ctx.options?.webhookSecret || (ctx as any).key || ''; - const v = verifyWorkdayWebhookSignature(request as any, secret); - if (!v.valid) { - return { - success: false, - statusCode: 401, - error: v.error || 'Signature verification failed', - }; - } - return { success: true }; - }, - }; From 00c16e9ed13458b3bc6353512faac36547d23015 Mon Sep 17 00:00:00 2001 From: Dhirender Choudhary Date: Sat, 8 Aug 2026 22:37:30 +0530 Subject: [PATCH 15/19] fix(workday): drop trailing-slash regex for CodeQL ReDoS --- packages/workday/client.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/workday/client.ts b/packages/workday/client.ts index d89d9cd21..ff5493a3a 100644 --- a/packages/workday/client.ts +++ b/packages/workday/client.ts @@ -38,7 +38,12 @@ export function normalizeWorkdayHost(host: string): string { throw error; } } - return trimmed.replace(/\/+$/, ''); + // ponytail: no /\/+$/ — CodeQL flags ReDoS on uncontrolled host input + let value = trimmed; + while (value.endsWith('/')) { + value = value.slice(0, -1); + } + return value; } export function normalizeWorkdayTenant(tenant: string): string { From 798f5f18f422e175d9524606a5d738e91c200277 Mon Sep 17 00:00:00 2001 From: Dhirender Choudhary Date: Sat, 8 Aug 2026 22:48:55 +0530 Subject: [PATCH 16/19] fix(workday): preserve ApiError retryAfter; split aliased routes --- packages/workday/api.test.ts | 73 ++++++++++++++++++++++++++++ packages/workday/client.ts | 4 +- packages/workday/endpoints/routes.ts | 35 +++++++------ packages/workday/endpoints/types.ts | 12 ++--- 4 files changed, 102 insertions(+), 22 deletions(-) diff --git a/packages/workday/api.test.ts b/packages/workday/api.test.ts index 56244a279..8b0ef7bdc 100644 --- a/packages/workday/api.test.ts +++ b/packages/workday/api.test.ts @@ -1,10 +1,13 @@ +import { ApiError } from 'corsair/http'; import { + makeWorkdayRequest, normalizeWorkdayHost, workdayOAuthUrls, workdayServiceBase, } from './client.js'; import { buildQuery, requestBody, resolvePath } from './endpoints/factory.js'; import { workdayRoutes } from './endpoints/routes.js'; +import { errorHandlers } from './error-handlers.js'; import { workday } from './index.js'; function mockJsonResponse(body: unknown, status = 200) { @@ -234,4 +237,74 @@ describe('Workday Plugin', () => { } as never); expect(matched).toBe(true); }); + + it('rethrows ApiError so rate-limit handler keeps retryAfter', async () => { + // Use 503 (not 429) so corsair/http does not enter its retry/sleep loop. + const apiError = new ApiError( + { method: 'GET', url: '/jobs' }, + { + url: 'https://example.workday.com/jobs', + ok: false, + status: 503, + statusText: 'Service Unavailable', + body: {}, + }, + 'upstream unavailable', + ); + mockFetch.mockRejectedValue(apiError); + + await expect( + makeWorkdayRequest('jobs', 'tok', { + method: 'GET', + connection: { host: 'example.workday.com', tenant: 'acme' }, + service: 'staffing', + version: 'v6', + }), + ).rejects.toBe(apiError); + + const rateLimited = new ApiError( + { method: 'GET', url: '/jobs' }, + { + url: 'https://example.workday.com/jobs', + ok: false, + status: 429, + statusText: 'Too Many Requests', + body: {}, + }, + 'Rate limited', + { retryAfter: 5000 }, + ); + expect(errorHandlers.RATE_LIMIT_ERROR.match(rateLimited)).toBe(true); + const result = await errorHandlers.RATE_LIMIT_ERROR.handler(rateLimited); + expect(result.headersRetryAfterMs).toBe(5000); + }); + + it('uses distinct service/path/query fingerprints for previously aliased ops', () => { + const fingerprint = (name: string) => { + const route = workdayRoutes.find((r) => r.name === name); + expect(route).toBeDefined(); + if (!route) return ''; + return [ + route.service, + route.version, + route.path, + [...route.queryParams].sort().join(','), + ].join('|'); + }; + + expect(fingerprint('getWorkerInfo')).not.toBe( + fingerprint('getWorkerStaffingInformation'), + ); + expect(fingerprint('getCollectionOfJobs')).not.toBe( + fingerprint('listJobs'), + ); + expect(fingerprint('listJobPostings')).not.toBe( + fingerprint('getMyJobPostings'), + ); + + expect(fingerprint('getWorkerInfo')).toContain( + 'compensation|v3|/workers/{ID}', + ); + expect(fingerprint('getMyJobPostings')).toContain('/jobRequisitions'); + }); }); diff --git a/packages/workday/client.ts b/packages/workday/client.ts index ff5493a3a..2ef3f8471 100644 --- a/packages/workday/client.ts +++ b/packages/workday/client.ts @@ -1,5 +1,5 @@ import type { ApiRequestOptions, OpenAPIConfig } from 'corsair/http'; -import { request } from 'corsair/http'; +import { ApiError, request } from 'corsair/http'; import type { WorkdayService } from './endpoints/routes'; export class WorkdayAPIError extends Error { @@ -124,6 +124,8 @@ export async function makeWorkdayRequest( try { return await request(config, requestOptions); } catch (error) { + // Preserve ApiError so RATE_LIMIT_ERROR can read status/retryAfter. + if (error instanceof ApiError) throw error; if (error instanceof Error) throw new WorkdayAPIError(error.message); throw new WorkdayAPIError('Unknown error'); } diff --git a/packages/workday/endpoints/routes.ts b/packages/workday/endpoints/routes.ts index daf7ccdaa..a2032cf87 100644 --- a/packages/workday/endpoints/routes.ts +++ b/packages/workday/endpoints/routes.ts @@ -7,7 +7,8 @@ export type WorkdayService = | 'recruiting' | 'payroll' | 'common' - | 'person'; + | 'person' + | 'compensation'; export type WorkdayRoute = { key: string; @@ -663,7 +664,8 @@ export const workdayRoutes = [ service: 'staffing', version: 'v6', path: '/jobs', - description: 'Retrieves a paginated collection of jobs (Staffing v6).', + description: + 'Retrieves a paginated collection of jobs with worker/location filters (Staffing v6).', pathParams: [] as const, queryParams: [ 'limit', @@ -901,11 +903,18 @@ export const workdayRoutes = [ method: 'GET', service: 'recruiting', version: 'v4', - path: '/jobPostings', + // Composio "my postings" walks interviews → requisitions → postings. + // Surface requisitions (recruiter-owned hiring needs) as the distinct REST entry. + path: '/jobRequisitions', description: - 'Retrieves job postings for the authenticated recruiter (Recruiting v4).', + 'Lists job requisitions for the authenticated recruiter (Recruiting v4; used to resolve assigned postings).', pathParams: [] as const, - queryParams: ['limit', 'offset'] as const, + queryParams: [ + 'limit', + 'offset', + 'status', + 'supervisoryOrganization', + ] as const, riskLevel: 'read' as const, }, { @@ -1219,10 +1228,11 @@ export const workdayRoutes = [ group: 'worker', name: 'getWorkerInfo', method: 'GET', - service: 'staffing', - version: 'v6', + service: 'compensation', + version: 'v3', path: '/workers/{ID}', - description: 'Retrieves worker staffing information (Staffing v6).', + description: + 'Retrieves worker profile (person details, primary job) via Compensation v3 /workers/{ID}.', pathParams: ['ID'] as const, queryParams: [] as const, riskLevel: 'read' as const, @@ -1414,14 +1424,9 @@ export const workdayRoutes = [ service: 'staffing', version: 'v6', path: '/jobs', - description: 'Lists jobs (Staffing v6).', + description: 'Lists jobs (Staffing v6; limit/offset only).', pathParams: [] as const, - queryParams: [ - 'limit', - 'offset', - 'includeTerminatedWorkers', - 'search', - ] as const, + queryParams: ['limit', 'offset'] as const, riskLevel: 'read' as const, }, { diff --git a/packages/workday/endpoints/types.ts b/packages/workday/endpoints/types.ts index 101468ca8..b9095069f 100644 --- a/packages/workday/endpoints/types.ts +++ b/packages/workday/endpoints/types.ts @@ -789,6 +789,12 @@ export const WorkdayEndpointInputSchemas = { .passthrough(), getMyJobPostings: z .object({ + status: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), + supervisoryOrganization: z + .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) + .optional(), limit: z.number().int().min(1).max(100).optional(), offset: z.number().int().min(0).optional(), }) @@ -1229,12 +1235,6 @@ export const WorkdayEndpointInputSchemas = { .passthrough(), listJobs: z .object({ - includeTerminatedWorkers: z - .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) - .optional(), - search: z - .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) - .optional(), limit: z.number().int().min(1).max(100).optional(), offset: z.number().int().min(0).optional(), }) From f68c2442f056e161c789a827d83fe709a8e7ef7a Mon Sep 17 00:00:00 2001 From: Dhirender Choudhary Date: Mon, 10 Aug 2026 21:12:27 +0530 Subject: [PATCH 17/19] feat(workday): add db schema, cache sync, doc-align routes --- packages/workday/api.test.ts | 182 ++++++++++++++++++--- packages/workday/endpoints/cache-sync.ts | 196 +++++++++++++++++++++++ packages/workday/endpoints/factory.ts | 9 +- packages/workday/endpoints/routes.ts | 27 ++-- packages/workday/endpoints/types.ts | 8 +- packages/workday/index.ts | 10 +- packages/workday/schema/database.ts | 50 ++++++ packages/workday/schema/index.ts | 33 +++- 8 files changed, 468 insertions(+), 47 deletions(-) create mode 100644 packages/workday/endpoints/cache-sync.ts create mode 100644 packages/workday/schema/database.ts diff --git a/packages/workday/api.test.ts b/packages/workday/api.test.ts index 8b0ef7bdc..343a367c2 100644 --- a/packages/workday/api.test.ts +++ b/packages/workday/api.test.ts @@ -5,10 +5,22 @@ import { workdayOAuthUrls, workdayServiceBase, } from './client.js'; +import { syncWorkdayOperationCache } from './endpoints/cache-sync.js'; import { buildQuery, requestBody, resolvePath } from './endpoints/factory.js'; import { workdayRoutes } from './endpoints/routes.js'; import { errorHandlers } from './error-handlers.js'; import { workday } from './index.js'; +import { + WorkdayAbsenceBalance, + WorkdayInterview, + WorkdayJob, + WorkdayJobPosting, + WorkdayJobRequisition, + WorkdayPayrollInput, + WorkdayProspect, + WorkdaySchema, + WorkdayWorker, +} from './schema/index.js'; function mockJsonResponse(body: unknown, status = 200) { return { @@ -279,32 +291,158 @@ describe('Workday Plugin', () => { expect(result.headersRetryAfterMs).toBe(5000); }); - it('uses distinct service/path/query fingerprints for previously aliased ops', () => { - const fingerprint = (name: string) => { - const route = workdayRoutes.find((r) => r.name === name); - expect(route).toBeDefined(); - if (!route) return ''; - return [ - route.service, - route.version, - route.path, - [...route.queryParams].sort().join(','), - ].join('|'); - }; - - expect(fingerprint('getWorkerInfo')).not.toBe( - fingerprint('getWorkerStaffingInformation'), + it('maps worker/job ops to documented Workday REST surfaces', () => { + const byName = Object.fromEntries(workdayRoutes.map((r) => [r.name, r])); + + expect(byName.getWorkerStaffingInformation).toMatchObject({ + service: 'staffing', + version: 'v6', + path: '/workers/{ID}', + method: 'GET', + }); + expect(byName.getWorkerInfo).toMatchObject({ + service: 'compensation', + version: 'v3', + path: '/workers/{ID}', + method: 'GET', + }); + // JobsApi.getCollection — Composio exposes two aliases, same docs path/params. + expect(byName.getCollectionOfJobs).toMatchObject({ + service: 'staffing', + path: '/jobs', + queryParams: ['limit', 'offset'], + }); + expect(byName.listJobs).toMatchObject({ + service: 'staffing', + path: '/jobs', + queryParams: ['limit', 'offset'], + }); + expect(byName.getWorkersCollectionStaffing?.queryParams).toEqual( + expect.arrayContaining([ + 'includeTerminatedWorkers', + 'search', + 'limit', + 'offset', + ]), + ); + expect(byName.listJobPostings?.path).toBe('/jobPostings'); + expect(byName.getMyJobPostings?.path).toBe('/jobRequisitions'); + }); + + it('declares db schema entities aligned to Workday REST resources', () => { + expect(WorkdaySchema.version).toMatch(/^\d+\.\d+\.\d+$/); + expect(Object.keys(WorkdaySchema.entities).sort()).toEqual( + [ + 'absenceBalances', + 'interviews', + 'jobPostings', + 'jobRequisitions', + 'jobs', + 'payrollInputs', + 'prospects', + 'workers', + ].sort(), + ); + expect( + WorkdayWorker.parse({ id: 'w1', descriptor: 'Ada Lovelace' }), + ).toMatchObject({ id: 'w1', descriptor: 'Ada Lovelace' }); + expect(WorkdayJob.parse({ id: 'j1' })).toMatchObject({ id: 'j1' }); + expect(WorkdayJobPosting.parse({ id: 'jp1' })).toMatchObject({ + id: 'jp1', + }); + expect(WorkdayJobRequisition.parse({ id: 'jr1' })).toMatchObject({ + id: 'jr1', + }); + expect(WorkdayPayrollInput.parse({ id: 'p1' })).toMatchObject({ + id: 'p1', + }); + expect(WorkdayProspect.parse({ id: 'pr1' })).toMatchObject({ id: 'pr1' }); + expect(WorkdayInterview.parse({ id: 'i1' })).toMatchObject({ id: 'i1' }); + expect(WorkdayAbsenceBalance.parse({ id: 'b1' })).toMatchObject({ + id: 'b1', + }); + }); + + it('upserts worker cache after getWorkerStaffingInformation responses', async () => { + const upsertByEntityId = jest.fn().mockResolvedValue(undefined); + const route = workdayRoutes.find( + (r) => r.name === 'getWorkerStaffingInformation', + ); + expect(route).toBeDefined(); + + await syncWorkdayOperationCache( + { + key: 'tok', + db: { workers: { upsertByEntityId } }, + } as never, + route!, + { ID: 'w1' }, + { id: 'w1', descriptor: 'Ada' }, + ); + + expect(upsertByEntityId).toHaveBeenCalledWith('w1', { + id: 'w1', + descriptor: 'Ada', + }); + }); + + it('does not cache worker subresources into workers entity', async () => { + const upsertByEntityId = jest.fn().mockResolvedValue(undefined); + const route = workdayRoutes.find( + (r) => r.name === 'getWorkerLeavesOfAbsence', ); - expect(fingerprint('getCollectionOfJobs')).not.toBe( - fingerprint('listJobs'), + expect(route).toBeDefined(); + + await syncWorkdayOperationCache( + { + key: 'tok', + db: { workers: { upsertByEntityId } }, + } as never, + route!, + { ID: 'w1' }, + { data: [{ id: 'loa-1' }] }, ); - expect(fingerprint('listJobPostings')).not.toBe( - fingerprint('getMyJobPostings'), + + expect(upsertByEntityId).not.toHaveBeenCalled(); + }); + + it('upserts job collection items into jobs cache', async () => { + const upsertByEntityId = jest.fn().mockResolvedValue(undefined); + const route = workdayRoutes.find((r) => r.name === 'getCollectionOfJobs'); + expect(route).toBeDefined(); + + await syncWorkdayOperationCache( + { + key: 'tok', + db: { jobs: { upsertByEntityId } }, + } as never, + route!, + { limit: 2 }, + { data: [{ id: 'j1' }, { id: 'j2' }], total: 2 }, ); - expect(fingerprint('getWorkerInfo')).toContain( - 'compensation|v3|/workers/{ID}', + expect(upsertByEntityId).toHaveBeenCalledWith('j1', { id: 'j1' }); + expect(upsertByEntityId).toHaveBeenCalledWith('j2', { id: 'j2' }); + }); + + it('caches getMyJobPostings into jobRequisitions (Recruiting v4)', async () => { + const upsertByEntityId = jest.fn().mockResolvedValue(undefined); + const route = workdayRoutes.find((r) => r.name === 'getMyJobPostings'); + expect(route).toBeDefined(); + + await syncWorkdayOperationCache( + { + key: 'tok', + db: { jobRequisitions: { upsertByEntityId } }, + } as never, + route!, + { limit: 1 }, + { data: [{ id: 'jr-1', descriptor: 'Eng Req' }] }, ); - expect(fingerprint('getMyJobPostings')).toContain('/jobRequisitions'); + + expect(upsertByEntityId).toHaveBeenCalledWith('jr-1', { + id: 'jr-1', + descriptor: 'Eng Req', + }); }); }); diff --git a/packages/workday/endpoints/cache-sync.ts b/packages/workday/endpoints/cache-sync.ts new file mode 100644 index 000000000..43f556a79 --- /dev/null +++ b/packages/workday/endpoints/cache-sync.ts @@ -0,0 +1,196 @@ +import type { WorkdayContext } from '../index'; +import type { WorkdayRoute } from './routes'; +import type { WorkdayEndpointInput } from './types'; + +type CacheEntity = + | 'workers' + | 'jobs' + | 'jobPostings' + | 'jobRequisitions' + | 'payrollInputs' + | 'prospects' + | 'interviews' + | 'absenceBalances'; + +type CacheRule = { + entity: CacheEntity; + idKeys: string[]; + listKeys?: string[]; + deleteInputKeys?: string[]; +}; + +const WORKERS: CacheRule = { + entity: 'workers', + idKeys: ['id', 'ID', 'workerId', 'worker_id'], + listKeys: ['data', 'workers'], + deleteInputKeys: ['id', 'ID', 'workerId'], +}; + +const JOBS: CacheRule = { + entity: 'jobs', + idKeys: ['id', 'ID'], + listKeys: ['data', 'jobs'], + deleteInputKeys: ['id', 'ID'], +}; + +const JOB_POSTINGS: CacheRule = { + entity: 'jobPostings', + idKeys: ['id', 'ID'], + listKeys: ['data', 'jobPostings'], + deleteInputKeys: ['id', 'ID'], +}; + +const JOB_REQUISITIONS: CacheRule = { + entity: 'jobRequisitions', + idKeys: ['id', 'ID'], + listKeys: ['data', 'jobRequisitions'], + deleteInputKeys: ['id', 'ID'], +}; + +const PAYROLL_INPUTS: CacheRule = { + entity: 'payrollInputs', + idKeys: ['id', 'ID'], + listKeys: ['data', 'payrollInputs'], + deleteInputKeys: ['id', 'ID'], +}; + +const PROSPECTS: CacheRule = { + entity: 'prospects', + idKeys: ['id', 'ID'], + listKeys: ['data', 'prospects'], + deleteInputKeys: ['id', 'ID'], +}; + +const INTERVIEWS: CacheRule = { + entity: 'interviews', + idKeys: ['id', 'ID'], + listKeys: ['data', 'interviews'], + deleteInputKeys: ['id', 'ID'], +}; + +const ABSENCE_BALANCES: CacheRule = { + entity: 'absenceBalances', + idKeys: ['id', 'ID'], + listKeys: ['data', 'balances'], + deleteInputKeys: ['id', 'ID'], +}; + +/** + * Route-only rules — never blanket-map `worker` group (subresources like + * leavesOfAbsence would poison the workers cache). + */ +const ROUTE_CACHE_RULES: Partial> = { + // Staffing / Compensation workers + getWorkerStaffingInformation: WORKERS, + getWorkerInfo: WORKERS, + getCurrentUser: WORKERS, + getWorkersCollectionStaffing: WORKERS, + // Staffing jobs (JobsApi.getCollection / getJobById) + getJobById: JOBS, + getCollectionOfJobs: JOBS, + listJobs: JOBS, + // Recruiting + listJobPostings: JOB_POSTINGS, + getJobPosting: JOB_POSTINGS, + getMyJobPostings: JOB_REQUISITIONS, + getProspect: PROSPECTS, + getInterview: INTERVIEWS, + listInterviews: INTERVIEWS, + // Payroll + getCollectionOfPayroll: PAYROLL_INPUTS, + getPayrollInputInstance: PAYROLL_INPUTS, + createPayrollInputs: PAYROLL_INPUTS, + updateAnExistingPayroll: PAYROLL_INPUTS, + // Absence + listBalances: ABSENCE_BALANCES, + getAbsenceBalance: ABSENCE_BALANCES, +}; + +function isRecord(value: unknown): value is Record { + return typeof value === 'object' && value !== null && !Array.isArray(value); +} + +function cacheItems(response: unknown, rule: CacheRule) { + if (Array.isArray(response)) return response.filter(isRecord); + if (!isRecord(response)) return []; + + for (const key of rule.listKeys ?? []) { + const value = response[key]; + if (Array.isArray(value)) return value.filter(isRecord); + } + + return [response]; +} + +function cacheEntityId(item: Record, rule: CacheRule) { + for (const key of rule.idKeys) { + const value = item[key]; + if (typeof value === 'string' && value.length > 0) return value; + if (typeof value === 'number') return String(value); + } + return undefined; +} + +function cacheDeleteEntityIds( + input: Record, + rule: CacheRule, +): string[] { + const deleteInput = isRecord(input.body) + ? { ...input, ...input.body } + : input; + + for (const key of rule.deleteInputKeys ?? rule.idKeys) { + const value = deleteInput[key]; + if (typeof value === 'string' && value.length > 0) return [value]; + if (typeof value === 'number') return [String(value)]; + } + return []; +} + +export async function syncWorkdayOperationCache( + ctx: WorkdayContext, + route: Pick, + input: WorkdayEndpointInput, + response: unknown, +) { + const rule = ROUTE_CACHE_RULES[route.name]; + if (!rule) return; + + const db = ctx.db as + | Record< + string, + | { + upsertByEntityId?: ( + entityId: string, + data: Record, + ) => Promise; + deleteByEntityId?: (entityId: string) => Promise; + } + | undefined + > + | undefined; + const client = db?.[rule.entity]; + if (!client) return; + + try { + const isDelete = + route.method === 'DELETE' || route.riskLevel === 'destructive'; + if (isDelete) { + if (!client.deleteByEntityId) return; + for (const entityId of cacheDeleteEntityIds(input, rule)) { + await client.deleteByEntityId(entityId); + } + return; + } + + if (!client.upsertByEntityId) return; + + for (const item of cacheItems(response, rule)) { + const entityId = cacheEntityId(item, rule); + if (!entityId) continue; + await client.upsertByEntityId(entityId, item); + } + } catch (error) { + console.warn(`[workday] Failed to sync ${rule.entity} cache:`, error); + } +} diff --git a/packages/workday/endpoints/factory.ts b/packages/workday/endpoints/factory.ts index 50b9a3976..b48cce595 100644 --- a/packages/workday/endpoints/factory.ts +++ b/packages/workday/endpoints/factory.ts @@ -3,6 +3,7 @@ import { AuthMissingError, logEventFromContext } from 'corsair/core'; import type { WorkdayConnection } from '../client'; import { makeWorkdayRequest, resolveWorkdayConnection } from '../client'; import type { WorkdayContext, WorkdayKeyBuilderContext } from '../index'; +import { syncWorkdayOperationCache } from './cache-sync'; import type { WorkdayRoute, WorkdayRouteName } from './routes'; import { getWorkdayRoute } from './routes'; import type { WorkdayEndpointInput, WorkdayEndpointOutputs } from './types'; @@ -179,9 +180,11 @@ export async function executeWorkdayOperation( service: route.service, version: route.version, }); - return WorkdayEndpointOutputSchemas[route.name as WorkdayRouteName].parse( - response, - ) as WorkdayEndpointOutputs[WorkdayRouteName]; + const parsed = WorkdayEndpointOutputSchemas[ + route.name as WorkdayRouteName + ].parse(response) as WorkdayEndpointOutputs[WorkdayRouteName]; + await syncWorkdayOperationCache(ctx, route, input, parsed); + return parsed; } catch (error) { status = 'failed'; throw error; diff --git a/packages/workday/endpoints/routes.ts b/packages/workday/endpoints/routes.ts index a2032cf87..cd38918e1 100644 --- a/packages/workday/endpoints/routes.ts +++ b/packages/workday/endpoints/routes.ts @@ -663,16 +663,12 @@ export const workdayRoutes = [ method: 'GET', service: 'staffing', version: 'v6', + // JobsApi.getCollection — only limit/offset (includeTerminatedWorkers is /workers). path: '/jobs', description: - 'Retrieves a paginated collection of jobs with worker/location filters (Staffing v6).', + 'Retrieves a paginated collection of jobs (Staffing v6 JobsApi.getCollection).', pathParams: [] as const, - queryParams: [ - 'limit', - 'offset', - 'includeTerminatedWorkers', - 'search', - ] as const, + queryParams: ['limit', 'offset'] as const, riskLevel: 'read' as const, }, { @@ -903,11 +899,11 @@ export const workdayRoutes = [ method: 'GET', service: 'recruiting', version: 'v4', - // Composio "my postings" walks interviews → requisitions → postings. - // Surface requisitions (recruiter-owned hiring needs) as the distinct REST entry. + // Composio resolves "my postings" via interviews → requisitions → postings. + // REST entry: Recruiting v4 GET /jobRequisitions (not identical to /jobPostings). path: '/jobRequisitions', description: - 'Lists job requisitions for the authenticated recruiter (Recruiting v4; used to resolve assigned postings).', + 'Lists job requisitions (Recruiting v4 GET /jobRequisitions; Composio getMyJobPostings entry).', pathParams: [] as const, queryParams: [ 'limit', @@ -1228,11 +1224,13 @@ export const workdayRoutes = [ group: 'worker', name: 'getWorkerInfo', method: 'GET', + // Compensation REST surface also exposes /workers/{ID} (worker profile view). + // Distinct from Staffing getStaffingInformation on the same path shape. service: 'compensation', version: 'v3', path: '/workers/{ID}', description: - 'Retrieves worker profile (person details, primary job) via Compensation v3 /workers/{ID}.', + 'Retrieves worker profile via Compensation REST v3 GET /workers/{ID}.', pathParams: ['ID'] as const, queryParams: [] as const, riskLevel: 'read' as const, @@ -1271,9 +1269,10 @@ export const workdayRoutes = [ method: 'GET', service: 'staffing', version: 'v6', + // WorkersApi.getStaffingInformation path: '/workers/{ID}', description: - 'Retrieves current staffing information for a worker (Staffing v6).', + 'Retrieves current staffing information for a worker (Staffing v6 WorkersApi.getStaffingInformation).', pathParams: ['ID'] as const, queryParams: [] as const, riskLevel: 'read' as const, @@ -1423,8 +1422,10 @@ export const workdayRoutes = [ method: 'GET', service: 'staffing', version: 'v6', + // Composio alias of JobsApi.getCollection (same as getCollectionOfJobs). path: '/jobs', - description: 'Lists jobs (Staffing v6; limit/offset only).', + description: + 'Lists jobs (Staffing v6 JobsApi.getCollection; Composio alias of getCollectionOfJobs).', pathParams: [] as const, queryParams: ['limit', 'offset'] as const, riskLevel: 'read' as const, diff --git a/packages/workday/endpoints/types.ts b/packages/workday/endpoints/types.ts index b9095069f..6000caceb 100644 --- a/packages/workday/endpoints/types.ts +++ b/packages/workday/endpoints/types.ts @@ -578,12 +578,6 @@ export const WorkdayEndpointInputSchemas = { .passthrough(), getCollectionOfJobs: z .object({ - includeTerminatedWorkers: z - .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) - .optional(), - search: z - .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) - .optional(), limit: z.number().int().min(1).max(100).optional(), offset: z.number().int().min(0).optional(), }) @@ -1295,7 +1289,7 @@ export const WorkdayEndpointOutputSchemas = { getContingentWorkerTypes: WorkdayCollectionSchema, getCountryInfo: WorkdayResourceSchema, getCurrencies: WorkdayCollectionSchema, - getCurrentUser: WorkdayCollectionSchema, + getCurrentUser: WorkdayResourceSchema, getGrants: WorkdayCollectionSchema, getHeadcountOptions: WorkdayCollectionSchema, getHistoryInstanceForWorker: WorkdayResourceSchema, diff --git a/packages/workday/index.ts b/packages/workday/index.ts index e342c85e5..94237f7e3 100644 --- a/packages/workday/index.ts +++ b/packages/workday/index.ts @@ -928,7 +928,15 @@ export function workday( providerName: 'Workday', authUrl: oauthUrls.authUrl, tokenUrl: oauthUrls.tokenUrl, - scopes: ['staffing', 'absenceManagement', 'recruiting', 'payroll'], + scopes: [ + 'staffing', + 'absenceManagement', + 'recruiting', + 'payroll', + 'compensation', + 'common', + 'person', + ], tokenAuthMethod: 'body' as const, requiresRegisteredRedirect: true, }, diff --git a/packages/workday/schema/database.ts b/packages/workday/schema/database.ts new file mode 100644 index 000000000..98aada8ed --- /dev/null +++ b/packages/workday/schema/database.ts @@ -0,0 +1,50 @@ +import { z } from 'zod'; + +/** + * Workday REST resources use a common identity shape (id / descriptor / href). + * @see Staffing v6 WorkersApi / JobsApi, Recruiting v4, Payroll v1, Absence Management v5 + */ +const WorkdayEntityBase = { + id: z.string().optional(), + descriptor: z.string().optional(), + href: z.string().optional(), + updatedAt: z.coerce.date().optional(), +}; + +export const WorkdayWorker = z.object(WorkdayEntityBase).catchall(z.unknown()); +export type WorkdayWorker = z.infer; + +export const WorkdayJob = z.object(WorkdayEntityBase).catchall(z.unknown()); +export type WorkdayJob = z.infer; + +export const WorkdayJobPosting = z + .object(WorkdayEntityBase) + .catchall(z.unknown()); +export type WorkdayJobPosting = z.infer; + +/** Recruiting v4 /jobRequisitions — used by getMyJobPostings entry point. */ +export const WorkdayJobRequisition = z + .object(WorkdayEntityBase) + .catchall(z.unknown()); +export type WorkdayJobRequisition = z.infer; + +export const WorkdayPayrollInput = z + .object(WorkdayEntityBase) + .catchall(z.unknown()); +export type WorkdayPayrollInput = z.infer; + +export const WorkdayProspect = z + .object(WorkdayEntityBase) + .catchall(z.unknown()); +export type WorkdayProspect = z.infer; + +export const WorkdayInterview = z + .object(WorkdayEntityBase) + .catchall(z.unknown()); +export type WorkdayInterview = z.infer; + +/** Absence Management v5 /balances */ +export const WorkdayAbsenceBalance = z + .object(WorkdayEntityBase) + .catchall(z.unknown()); +export type WorkdayAbsenceBalance = z.infer; diff --git a/packages/workday/schema/index.ts b/packages/workday/schema/index.ts index 521fe9223..f94349b94 100644 --- a/packages/workday/schema/index.ts +++ b/packages/workday/schema/index.ts @@ -1,4 +1,35 @@ +import { + WorkdayAbsenceBalance, + WorkdayInterview, + WorkdayJob, + WorkdayJobPosting, + WorkdayJobRequisition, + WorkdayPayrollInput, + WorkdayProspect, + WorkdayWorker, +} from './database'; + export const WorkdaySchema = { version: '1.0.0', - entities: {}, + entities: { + workers: WorkdayWorker, + jobs: WorkdayJob, + jobPostings: WorkdayJobPosting, + jobRequisitions: WorkdayJobRequisition, + payrollInputs: WorkdayPayrollInput, + prospects: WorkdayProspect, + interviews: WorkdayInterview, + absenceBalances: WorkdayAbsenceBalance, + }, } as const; + +export { + WorkdayAbsenceBalance, + WorkdayInterview, + WorkdayJob, + WorkdayJobPosting, + WorkdayJobRequisition, + WorkdayPayrollInput, + WorkdayProspect, + WorkdayWorker, +} from './database'; From f1cc28953e158133add42e97758414b2deec2818 Mon Sep 17 00:00:00 2001 From: Dhirender Choudhary Date: Mon, 10 Aug 2026 21:33:30 +0530 Subject: [PATCH 18/19] fix(workday): address CodeRabbit; docs-shaped DB schema --- packages/workday/api.test.ts | 126 ++++++++++++++++++++++---- packages/workday/client.ts | 32 ++++--- packages/workday/endpoints/factory.ts | 27 ++++-- packages/workday/endpoints/routes.ts | 15 ++- packages/workday/error-handlers.ts | 6 +- packages/workday/index.ts | 15 ++- packages/workday/package.json | 2 +- packages/workday/schema/database.ts | 113 ++++++++++++++++++++--- packages/workday/webhooks/types.ts | 33 +++++-- 9 files changed, 289 insertions(+), 80 deletions(-) diff --git a/packages/workday/api.test.ts b/packages/workday/api.test.ts index 343a367c2..9f19c7aa8 100644 --- a/packages/workday/api.test.ts +++ b/packages/workday/api.test.ts @@ -77,8 +77,11 @@ describe('Workday Plugin', () => { expect(hooks?.['workerLeaveOfAbsence.created']).toBeDefined(); }); - it('requires tenant for oauth_2 and builds Workday OAuth URLs', () => { + it('requires tenant and host for oauth_2 and builds Workday OAuth URLs', () => { expect(() => workday({ key: 'x' })).toThrow(/tenant is required/); + expect(() => workday({ key: 'x', tenant: 'acme' })).toThrow( + /host is required/, + ); const plugin = workday(pluginOpts); expect(plugin.oauthConfig?.authUrl).toBe( 'https://wd2-impl-services1.workday.com/ccx/oauth2/acme/authorize', @@ -221,12 +224,29 @@ describe('Workday Plugin', () => { expect(requestBody(route, { ID: 'w1', date: '2026-01-01' })).toEqual({ date: '2026-01-01', }); + // Pagination + path aliases must never leak into write bodies. + expect( + requestBody(route, { + ID: 'w1', + id: 'alias', + workerId: 'alias2', + limit: 10, + offset: 2, + date: '2026-01-01', + }), + ).toEqual({ date: '2026-01-01' }); }); it('builds service base URLs and normalizes host', () => { expect(normalizeWorkdayHost('https://example.workday.com/')).toBe( 'example.workday.com', ); + expect(() => normalizeWorkdayHost('evil.com@attacker.com')).toThrow( + /bare hostname/, + ); + expect(() => normalizeWorkdayHost('tenant.workday.com/extra/path')).toThrow( + /bare hostname/, + ); expect( workdayServiceBase( { host: 'example.workday.com', tenant: 'acme' }, @@ -244,10 +264,33 @@ describe('Workday Plugin', () => { const trigger = plugin.webhooks?.['jobPosting.created']; expect(trigger).toBeDefined(); const matched = trigger?.match?.({ - headers: { 'x-workday-event': 'jobPosting.created' }, + headers: { 'X-Workday-Event': ['jobPosting.created'] }, body: JSON.stringify({ type: 'jobPosting.created', data: {} }), } as never); expect(matched).toBe(true); + + const { verifyWorkdayWebhookSignature } = await import( + './webhooks/types.js' + ); + expect( + verifyWorkdayWebhookSignature( + { + headers: { 'x-workday-signature': 'deadbeef' }, + payload: { type: 'jobPosting.created', data: {} }, + } as never, + 'secret', + ).valid, + ).toBe(false); + expect( + verifyWorkdayWebhookSignature( + { + headers: { 'x-workday-signature': 'deadbeef' }, + payload: { type: 'jobPosting.created', data: {} }, + rawBody: '{"type":"jobPosting.created","data":{}}', + } as never, + 'secret', + ).error, + ).toMatch(/Invalid webhook signature|Raw request body/); }); it('rethrows ApiError so rate-limit handler keeps retryAfter', async () => { @@ -289,6 +332,10 @@ describe('Workday Plugin', () => { expect(errorHandlers.RATE_LIMIT_ERROR.match(rateLimited)).toBe(true); const result = await errorHandlers.RATE_LIMIT_ERROR.handler(rateLimited); expect(result.headersRetryAfterMs).toBe(5000); + // Do not treat ids like worker-4291 as rate limits. + expect( + errorHandlers.RATE_LIMIT_ERROR.match(new Error('worker-4291 missing')), + ).toBe(false); }); it('maps worker/job ops to documented Workday REST surfaces', () => { @@ -300,12 +347,14 @@ describe('Workday Plugin', () => { path: '/workers/{ID}', method: 'GET', }); + // Composio alias of WorkersApi.getStaffingInformation (Staffing docs). expect(byName.getWorkerInfo).toMatchObject({ - service: 'compensation', - version: 'v3', + service: 'staffing', + version: 'v6', path: '/workers/{ID}', method: 'GET', }); + expect(byName.getJobById?.queryParams).toEqual([]); // JobsApi.getCollection — Composio exposes two aliases, same docs path/params. expect(byName.getCollectionOfJobs).toMatchObject({ service: 'staffing', @@ -327,6 +376,7 @@ describe('Workday Plugin', () => { ); expect(byName.listJobPostings?.path).toBe('/jobPostings'); expect(byName.getMyJobPostings?.path).toBe('/jobRequisitions'); + expect(byName.getCurrentUser?.path).toBe('/workers/me'); }); it('declares db schema entities aligned to Workday REST resources', () => { @@ -344,23 +394,59 @@ describe('Workday Plugin', () => { ].sort(), ); expect( - WorkdayWorker.parse({ id: 'w1', descriptor: 'Ada Lovelace' }), - ).toMatchObject({ id: 'w1', descriptor: 'Ada Lovelace' }); - expect(WorkdayJob.parse({ id: 'j1' })).toMatchObject({ id: 'j1' }); - expect(WorkdayJobPosting.parse({ id: 'jp1' })).toMatchObject({ - id: 'jp1', - }); - expect(WorkdayJobRequisition.parse({ id: 'jr1' })).toMatchObject({ - id: 'jr1', - }); - expect(WorkdayPayrollInput.parse({ id: 'p1' })).toMatchObject({ - id: 'p1', - }); - expect(WorkdayProspect.parse({ id: 'pr1' })).toMatchObject({ id: 'pr1' }); - expect(WorkdayInterview.parse({ id: 'i1' })).toMatchObject({ id: 'i1' }); - expect(WorkdayAbsenceBalance.parse({ id: 'b1' })).toMatchObject({ - id: 'b1', + WorkdayWorker.parse({ + id: 'w1', + descriptor: 'Ada Lovelace', + businessTitle: 'Engineer', + primaryWorkEmail: 'ada@example.com', + primaryJob: { id: 'j1', descriptor: 'Eng' }, + }), + ).toMatchObject({ + id: 'w1', + businessTitle: 'Engineer', + primaryJob: { id: 'j1' }, }); + expect( + WorkdayJob.parse({ + id: 'j1', + businessTitle: 'Engineer', + jobProfile: { id: 'jp', descriptor: 'Profile' }, + }), + ).toMatchObject({ id: 'j1', businessTitle: 'Engineer' }); + expect( + WorkdayJobPosting.parse({ + id: 'jp1', + title: 'SWE', + jobRequisition: { id: 'jr1' }, + }), + ).toMatchObject({ id: 'jp1', title: 'SWE' }); + expect( + WorkdayJobRequisition.parse({ + id: 'jr1', + status: 'Open', + hiringManager: { id: 'w1' }, + }), + ).toMatchObject({ id: 'jr1', status: 'Open' }); + expect( + WorkdayPayrollInput.parse({ + id: 'p1', + amount: 100, + worker: { id: 'w1' }, + }), + ).toMatchObject({ id: 'p1', amount: 100 }); + expect( + WorkdayProspect.parse({ id: 'pr1', email: 'a@b.com' }), + ).toMatchObject({ id: 'pr1', email: 'a@b.com' }); + expect( + WorkdayInterview.parse({ id: 'i1', status: 'Scheduled' }), + ).toMatchObject({ id: 'i1', status: 'Scheduled' }); + expect( + WorkdayAbsenceBalance.parse({ + id: 'b1', + quantity: 8, + unitOfTime: 'Hours', + }), + ).toMatchObject({ id: 'b1', quantity: 8 }); }); it('upserts worker cache after getWorkerStaffingInformation responses', async () => { diff --git a/packages/workday/client.ts b/packages/workday/client.ts index 2ef3f8471..aff5de8f2 100644 --- a/packages/workday/client.ts +++ b/packages/workday/client.ts @@ -20,29 +20,37 @@ export type WorkdayConnection = { }; const DEFAULT_HOST = 'wd2-impl-services1.workday.com'; +const HOST_PATTERN = /^[a-z0-9]([a-z0-9.-]*[a-z0-9])?(:\d{1,5})?$/i; -/** Strip scheme / trailing slash; host only. */ +/** Strip scheme / trailing slash; host only (no credentials, no path). */ export function normalizeWorkdayHost(host: string): string { const trimmed = host.trim(); if (!trimmed) throw new Error('[workday] host is required'); - try { - if (trimmed.includes('://')) { - const url = new URL(trimmed); - if (url.protocol !== 'https:') { - throw new Error('[workday] host must use https'); - } - return url.host; + + let value = trimmed; + if (trimmed.includes('://')) { + let url: URL; + try { + url = new URL(trimmed); + } catch { + throw new Error('[workday] host is not a valid URL'); } - } catch (error) { - if (error instanceof Error && error.message.startsWith('[workday]')) { - throw error; + if (url.protocol !== 'https:') { + throw new Error('[workday] host must use https'); } + if (url.username || url.password) { + throw new Error('[workday] host must not contain credentials'); + } + value = url.host; } + // ponytail: no /\/+$/ — CodeQL flags ReDoS on uncontrolled host input - let value = trimmed; while (value.endsWith('/')) { value = value.slice(0, -1); } + if (!HOST_PATTERN.test(value)) { + throw new Error('[workday] host must be a bare hostname'); + } return value; } diff --git a/packages/workday/endpoints/factory.ts b/packages/workday/endpoints/factory.ts index b48cce595..c0ce6c743 100644 --- a/packages/workday/endpoints/factory.ts +++ b/packages/workday/endpoints/factory.ts @@ -18,7 +18,13 @@ export type WorkdayEndpoint = CorsairEndpoint< unknown >; -const BODY_CONTROL_KEYS = new Set(['body', 'query', 'headers']); +const BODY_CONTROL_KEYS = new Set([ + 'body', + 'query', + 'headers', + 'limit', + 'offset', +]); const PATH_ALIASES: Record = { ID: ['ID', 'id', 'workerId', 'worker_id'], @@ -110,11 +116,14 @@ export function requestBody( const pathKeys = new Set( route.pathParams.flatMap((key) => [key, ...(PATH_ALIASES[key] ?? [])]), ); + // Alias fields exist on input schemas; never send them as body content. + const aliasKeys = new Set(Object.values(PATH_ALIASES).flat()); const queryKeys = new Set(route.queryParams); const body = Object.fromEntries( Object.entries(input).filter(([key, value]) => { return ( !pathKeys.has(key) && + !aliasKeys.has(key) && !queryKeys.has(key) && !BODY_CONTROL_KEYS.has(key) && value !== undefined @@ -189,12 +198,16 @@ export async function executeWorkdayOperation( status = 'failed'; throw error; } finally { - await logEventFromContext( - ctx, - `workday.${route.group}.${route.name}`, - { method: route.method, service: route.service, path: route.path }, - status, - ); + try { + await logEventFromContext( + ctx, + `workday.${route.group}.${route.name}`, + { method: route.method, service: route.service, path: route.path }, + status, + ); + } catch (logError) { + console.warn('[workday] Failed to log operation event:', logError); + } } } diff --git a/packages/workday/endpoints/routes.ts b/packages/workday/endpoints/routes.ts index cd38918e1..89e813daa 100644 --- a/packages/workday/endpoints/routes.ts +++ b/packages/workday/endpoints/routes.ts @@ -7,8 +7,7 @@ export type WorkdayService = | 'recruiting' | 'payroll' | 'common' - | 'person' - | 'compensation'; + | 'person'; export type WorkdayRoute = { key: string; @@ -95,7 +94,7 @@ export const workdayRoutes = [ path: '/jobs/{ID}', description: 'Retrieves a single job instance by ID (Staffing v6).', pathParams: ['ID'] as const, - queryParams: ['limit', 'offset'] as const, + queryParams: [] as const, riskLevel: 'read' as const, }, { @@ -1224,13 +1223,13 @@ export const workdayRoutes = [ group: 'worker', name: 'getWorkerInfo', method: 'GET', - // Compensation REST surface also exposes /workers/{ID} (worker profile view). - // Distinct from Staffing getStaffingInformation on the same path shape. - service: 'compensation', - version: 'v3', + // Composio alias of Staffing WorkersApi.getStaffingInformation (same as + // getWorkerStaffingInformation). Workday docs do not expose a separate path. + service: 'staffing', + version: 'v6', path: '/workers/{ID}', description: - 'Retrieves worker profile via Compensation REST v3 GET /workers/{ID}.', + 'Retrieves worker staffing profile (Staffing v6 GET /workers/{ID}).', pathParams: ['ID'] as const, queryParams: [] as const, riskLevel: 'read' as const, diff --git a/packages/workday/error-handlers.ts b/packages/workday/error-handlers.ts index 5a4f4c19f..8a8405128 100644 --- a/packages/workday/error-handlers.ts +++ b/packages/workday/error-handlers.ts @@ -6,7 +6,11 @@ export const errorHandlers = { match: (error: Error) => { if (error instanceof ApiError && error.status === 429) return true; const msg = error.message.toLowerCase(); - return msg.includes('rate_limited') || msg.includes('429'); + return ( + msg.includes('rate_limited') || + msg.includes('too many requests') || + /\b429\b/.test(msg) + ); }, handler: async (error: Error) => { let retryAfterMs: number | undefined; diff --git a/packages/workday/index.ts b/packages/workday/index.ts index 94237f7e3..f100bdd16 100644 --- a/packages/workday/index.ts +++ b/packages/workday/index.ts @@ -910,14 +910,12 @@ export function workday( if (options.authType === 'oauth_2' && !tenant) { throw new Error('[workday] options.tenant is required for oauth_2'); } + if (options.authType === 'oauth_2' && !host) { + throw new Error('[workday] options.host is required for oauth_2'); + } const oauthUrls = - tenant != null - ? workdayOAuthUrls({ - host: host ?? 'wd2-impl-services1.workday.com', - tenant, - }) - : null; + tenant != null && host != null ? workdayOAuthUrls({ host, tenant }) : null; return { id: 'workday', @@ -933,7 +931,6 @@ export function workday( 'absenceManagement', 'recruiting', 'payroll', - 'compensation', 'common', 'person', ], @@ -951,9 +948,9 @@ export function workday( endpointMeta: workdayEndpointMeta, endpointSchemas: workdayEndpointSchemas, pluginWebhookMatcher: (request) => { + const keys = Object.keys(request.headers).map((k) => k.toLowerCase()); return ( - 'x-workday-signature' in request.headers || - 'x-workday-event' in request.headers + keys.includes('x-workday-signature') || keys.includes('x-workday-event') ); }, pluginTenantWebhookMatcher: matchWorkdayTenantWebhook, diff --git a/packages/workday/package.json b/packages/workday/package.json index cda5ef7dd..03d3e4648 100644 --- a/packages/workday/package.json +++ b/packages/workday/package.json @@ -15,7 +15,7 @@ }, "scripts": { "build": "rm -rf dist && tsc --build --force && tsup", - "typecheck": "tsc --noEmit", + "typecheck": "tsc -p tsconfig.json --noEmit --emitDeclarationOnly false", "test": "jest" }, "peerDependencies": { diff --git a/packages/workday/schema/database.ts b/packages/workday/schema/database.ts index 98aada8ed..f8f2d2cb6 100644 --- a/packages/workday/schema/database.ts +++ b/packages/workday/schema/database.ts @@ -1,9 +1,23 @@ import { z } from 'zod'; /** - * Workday REST resources use a common identity shape (id / descriptor / href). - * @see Staffing v6 WorkersApi / JobsApi, Recruiting v4, Payroll v1, Absence Management v5 + * Workday REST entity shapes for Corsair DB cache (`ctx.db.*`). + * Field names follow Workday REST Directory resources: + * Staffing v6 Workers/Jobs, Recruiting v4 Job Postings/Requisitions/Prospects/Interviews, + * Payroll v1 Payroll Inputs, Absence Management v5 Balances. + * + * Common identity: every Workday REST instance exposes `id`, `descriptor`, `href`. + * Loose + catchall — responses include tenant-specific extras. */ + +const WorkdayRef = z + .object({ + id: z.string().optional(), + descriptor: z.string().optional(), + href: z.string().optional(), + }) + .catchall(z.unknown()); + const WorkdayEntityBase = { id: z.string().optional(), descriptor: z.string().optional(), @@ -11,40 +25,115 @@ const WorkdayEntityBase = { updatedAt: z.coerce.date().optional(), }; -export const WorkdayWorker = z.object(WorkdayEntityBase).catchall(z.unknown()); +/** Staffing v6 GET /workers/{ID} (WorkersApi.getStaffingInformation). */ +export const WorkdayWorker = z + .object({ + ...WorkdayEntityBase, + businessTitle: z.string().optional(), + primaryWorkEmail: z.string().optional(), + primaryWorkPhone: z.string().optional(), + workerID: z.string().optional(), + employeeID: z.string().optional(), + isManager: z.boolean().optional(), + primaryJob: WorkdayRef.optional(), + primarySupervisoryOrganization: WorkdayRef.optional(), + location: WorkdayRef.optional(), + workerType: WorkdayRef.optional(), + }) + .catchall(z.unknown()); export type WorkdayWorker = z.infer; -export const WorkdayJob = z.object(WorkdayEntityBase).catchall(z.unknown()); +/** Staffing v6 GET /jobs/{ID} (JobsApi.getJobById). */ +export const WorkdayJob = z + .object({ + ...WorkdayEntityBase, + businessTitle: z.string().optional(), + jobProfile: WorkdayRef.optional(), + location: WorkdayRef.optional(), + supervisoryOrganization: WorkdayRef.optional(), + worker: WorkdayRef.optional(), + jobType: WorkdayRef.optional(), + }) + .catchall(z.unknown()); export type WorkdayJob = z.infer; +/** Recruiting v4 GET /jobPostings/{ID}. */ export const WorkdayJobPosting = z - .object(WorkdayEntityBase) + .object({ + ...WorkdayEntityBase, + title: z.string().optional(), + jobDescription: z.string().optional(), + jobRequisition: WorkdayRef.optional(), + jobPostingSite: WorkdayRef.optional(), + location: WorkdayRef.optional(), + startDate: z.string().optional(), + endDate: z.string().optional(), + }) .catchall(z.unknown()); export type WorkdayJobPosting = z.infer; -/** Recruiting v4 /jobRequisitions — used by getMyJobPostings entry point. */ +/** Recruiting v4 GET /jobRequisitions (getMyJobPostings entry). */ export const WorkdayJobRequisition = z - .object(WorkdayEntityBase) + .object({ + ...WorkdayEntityBase, + status: z.string().optional(), + hiringManager: WorkdayRef.optional(), + recruiter: WorkdayRef.optional(), + jobProfile: WorkdayRef.optional(), + supervisoryOrganization: WorkdayRef.optional(), + location: WorkdayRef.optional(), + numberOfOpenings: z.number().optional(), + }) .catchall(z.unknown()); export type WorkdayJobRequisition = z.infer; +/** Payroll v1 GET /payrollInputs/{ID}. */ export const WorkdayPayrollInput = z - .object(WorkdayEntityBase) + .object({ + ...WorkdayEntityBase, + startDate: z.string().optional(), + endDate: z.string().optional(), + worker: WorkdayRef.optional(), + payComponent: WorkdayRef.optional(), + comment: z.string().optional(), + amount: z.union([z.number(), z.string()]).optional(), + }) .catchall(z.unknown()); export type WorkdayPayrollInput = z.infer; +/** Recruiting v4 GET /prospects/{ID}. */ export const WorkdayProspect = z - .object(WorkdayEntityBase) + .object({ + ...WorkdayEntityBase, + email: z.string().optional(), + phone: z.string().optional(), + candidate: WorkdayRef.optional(), + }) .catchall(z.unknown()); export type WorkdayProspect = z.infer; +/** Recruiting v4 GET /interviews/{ID}. */ export const WorkdayInterview = z - .object(WorkdayEntityBase) + .object({ + ...WorkdayEntityBase, + status: z.string().optional(), + interviewDate: z.string().optional(), + jobRequisition: WorkdayRef.optional(), + candidate: WorkdayRef.optional(), + }) .catchall(z.unknown()); export type WorkdayInterview = z.infer; -/** Absence Management v5 /balances */ +/** Absence Management v5 GET /balances/{ID}. */ export const WorkdayAbsenceBalance = z - .object(WorkdayEntityBase) + .object({ + ...WorkdayEntityBase, + worker: WorkdayRef.optional(), + absencePlan: WorkdayRef.optional(), + category: WorkdayRef.optional(), + unitOfTime: z.string().optional(), + quantity: z.union([z.number(), z.string()]).optional(), + effectiveDate: z.string().optional(), + }) .catchall(z.unknown()); export type WorkdayAbsenceBalance = z.infer; diff --git a/packages/workday/webhooks/types.ts b/packages/workday/webhooks/types.ts index 56dcaa7d7..ec1a3854b 100644 --- a/packages/workday/webhooks/types.ts +++ b/packages/workday/webhooks/types.ts @@ -77,12 +77,25 @@ function parseBody(body: unknown): unknown { } } +function headerValue( + headers: Record, + name: string, +): string | undefined { + const lower = name.toLowerCase(); + for (const [key, value] of Object.entries(headers)) { + if (key.toLowerCase() !== lower) continue; + if (Array.isArray(value)) return value[0]; + return value; + } + return undefined; +} + export function createWorkdayEventMatch( eventType: WorkdayTriggerEventName | string, ): CorsairWebhookMatcher { return (request: RawWebhookRequest) => { - const headerType = request.headers['x-workday-event']; - if (typeof headerType === 'string' && headerType === eventType) { + const headerType = headerValue(request.headers, 'x-workday-event'); + if (headerType === eventType) { return true; } const parsed = parseBody(request.body); @@ -98,19 +111,19 @@ export function verifyWorkdayWebhookSignature( ): { valid: boolean; error?: string } { if (!secret) return { valid: false, error: 'No webhook secret configured' }; - const signature = request.headers['x-workday-signature']; - if (!signature || typeof signature !== 'string') { + const signature = headerValue(request.headers, 'x-workday-signature'); + if (!signature) { return { valid: false, error: 'Missing x-workday-signature header' }; } - let bodyString: string; - if (typeof request.rawBody === 'string') { - bodyString = request.rawBody; - } else { - bodyString = JSON.stringify(request.payload); + if (typeof request.rawBody !== 'string') { + return { + valid: false, + error: 'Raw request body is required for signature verification', + }; } - const isValid = verifyHmacSignature(bodyString, secret, signature); + const isValid = verifyHmacSignature(request.rawBody, secret, signature); if (!isValid) { return { valid: false, error: 'Invalid webhook signature' }; } From 5d2ff59166544b5be11a05529974468cd21d8110 Mon Sep 17 00:00:00 2001 From: Dhirender Choudhary Date: Mon, 10 Aug 2026 21:54:23 +0530 Subject: [PATCH 19/19] fix(workday): coerce pagination; test real HMAC verify --- packages/workday/api.test.ts | 89 ++++++++-- packages/workday/endpoints/types.ts | 259 ++++++++++------------------ packages/workday/package.json | 2 +- 3 files changed, 162 insertions(+), 188 deletions(-) diff --git a/packages/workday/api.test.ts b/packages/workday/api.test.ts index 9f19c7aa8..4d48e3148 100644 --- a/packages/workday/api.test.ts +++ b/packages/workday/api.test.ts @@ -1,3 +1,4 @@ +import { createHmac } from 'node:crypto'; import { ApiError } from 'corsair/http'; import { makeWorkdayRequest, @@ -8,6 +9,7 @@ import { import { syncWorkdayOperationCache } from './endpoints/cache-sync.js'; import { buildQuery, requestBody, resolvePath } from './endpoints/factory.js'; import { workdayRoutes } from './endpoints/routes.js'; +import { WorkdayEndpointInputSchemas } from './endpoints/types.js'; import { errorHandlers } from './error-handlers.js'; import { workday } from './index.js'; import { @@ -21,6 +23,7 @@ import { WorkdaySchema, WorkdayWorker, } from './schema/index.js'; +import { verifyWorkdayWebhookSignature } from './webhooks/types.js'; function mockJsonResponse(body: unknown, status = 200) { return { @@ -71,10 +74,23 @@ describe('Workday Plugin', () => { it('registers 13 Composio-aligned triggers', () => { const plugin = workday(pluginOpts); const hooks = plugin.webhooks as Record | undefined; - expect(Object.keys(hooks ?? {})).toHaveLength(13); - expect(hooks?.['absenceBalance.changed']).toBeDefined(); - expect(hooks?.['jobPosting.created']).toBeDefined(); - expect(hooks?.['workerLeaveOfAbsence.created']).toBeDefined(); + expect(Object.keys(hooks ?? {}).sort()).toEqual( + [ + 'absenceBalance.changed', + 'absenceBalance.created', + 'balanceDetails.changed', + 'interview.scheduled', + 'interviewFeedback.submitted', + 'jobPosting.changed', + 'jobPosting.created', + 'jobPostingQuestionnaire.changed', + 'prospectProfile.changed', + 'prospectResumeAttachment.added', + 'workerEligibleAbsenceType.changed', + 'workerLeaveOfAbsence.changed', + 'workerLeaveOfAbsence.created', + ].sort(), + ); }); it('requires tenant and host for oauth_2 and builds Workday OAuth URLs', () => { @@ -269,28 +285,71 @@ describe('Workday Plugin', () => { } as never); expect(matched).toBe(true); - const { verifyWorkdayWebhookSignature } = await import( - './webhooks/types.js' - ); + const rawBody = '{"type":"jobPosting.created","data":{}}'; + const secret = 'secret'; + const validSig = createHmac('sha256', secret).update(rawBody).digest('hex'); + const payload = { type: 'jobPosting.created' as const, data: {} }; + + expect( + verifyWorkdayWebhookSignature( + { + headers: { 'x-workday-signature': validSig }, + payload, + rawBody, + } as never, + secret, + ).valid, + ).toBe(true); expect( verifyWorkdayWebhookSignature( { headers: { 'x-workday-signature': 'deadbeef' }, - payload: { type: 'jobPosting.created', data: {} }, + payload, + rawBody, } as never, - 'secret', + secret, ).valid, ).toBe(false); expect( verifyWorkdayWebhookSignature( { - headers: { 'x-workday-signature': 'deadbeef' }, - payload: { type: 'jobPosting.created', data: {} }, - rawBody: '{"type":"jobPosting.created","data":{}}', + headers: { 'x-workday-signature': validSig }, + payload, } as never, - 'secret', - ).error, - ).toMatch(/Invalid webhook signature|Raw request body/); + secret, + ), + ).toMatchObject({ + valid: false, + error: 'Raw request body is required for signature verification', + }); + + const ctx = { + options: pluginOpts, + key: secret, + } as never; + await expect( + trigger?.handler?.(ctx, { + headers: { 'x-workday-signature': validSig }, + payload, + rawBody, + } as never), + ).resolves.toMatchObject({ success: true }); + await expect( + trigger?.handler?.(ctx, { + headers: { 'x-workday-signature': 'deadbeef' }, + payload, + rawBody, + } as never), + ).resolves.toMatchObject({ success: false, statusCode: 401 }); + }); + + it('coerces pagination query strings on list inputs', () => { + const parsed = WorkdayEndpointInputSchemas.listBalances.parse({ + limit: '20', + offset: '0', + worker: 'w1', + }); + expect(parsed).toMatchObject({ limit: 20, offset: 0, worker: 'w1' }); }); it('rethrows ApiError so rate-limit handler keeps retryAfter', async () => { diff --git a/packages/workday/endpoints/types.ts b/packages/workday/endpoints/types.ts index 6000caceb..51415951d 100644 --- a/packages/workday/endpoints/types.ts +++ b/packages/workday/endpoints/types.ts @@ -19,8 +19,8 @@ export const WorkdayCollectionSchema = z .catchall(z.unknown()); const PaginationQueryShape = { - limit: z.number().int().min(1).max(100).optional(), - offset: z.number().int().min(0).optional(), + limit: z.coerce.number().int().min(1).max(100).optional(), + offset: z.coerce.number().int().min(0).optional(), }; export const WorkdayEndpointInputSchemas = { @@ -29,8 +29,7 @@ export const WorkdayEndpointInputSchemas = { ID: z.string().min(1), id: z.string().min(1).optional(), workerId: z.string().min(1).optional(), - limit: z.number().int().min(1).max(100).optional(), - offset: z.number().int().min(0).optional(), + ...PaginationQueryShape, // Remaining fields form the JSON body (Workday resource payloads). }) .passthrough(), @@ -39,8 +38,7 @@ export const WorkdayEndpointInputSchemas = { ID: z.string().min(1), id: z.string().min(1).optional(), workerId: z.string().min(1).optional(), - limit: z.number().int().min(1).max(100).optional(), - offset: z.number().int().min(0).optional(), + ...PaginationQueryShape, }) .passthrough(), getBusinessTitleChangeForWorker: z @@ -49,8 +47,7 @@ export const WorkdayEndpointInputSchemas = { id: z.string().min(1).optional(), workerId: z.string().min(1).optional(), subresourceID: z.string().min(1), - limit: z.number().int().min(1).max(100).optional(), - offset: z.number().int().min(0).optional(), + ...PaginationQueryShape, }) .passthrough(), createJobChange: z @@ -58,8 +55,7 @@ export const WorkdayEndpointInputSchemas = { ID: z.string().min(1), id: z.string().min(1).optional(), workerId: z.string().min(1).optional(), - limit: z.number().int().min(1).max(100).optional(), - offset: z.number().int().min(0).optional(), + ...PaginationQueryShape, // Remaining fields form the JSON body (Workday resource payloads). }) .passthrough(), @@ -68,8 +64,7 @@ export const WorkdayEndpointInputSchemas = { ID: z.string().min(1), id: z.string().min(1).optional(), workerId: z.string().min(1).optional(), - limit: z.number().int().min(1).max(100).optional(), - offset: z.number().int().min(0).optional(), + ...PaginationQueryShape, }) .passthrough(), getJobChangeFrequencies: z @@ -95,8 +90,7 @@ export const WorkdayEndpointInputSchemas = { worker: z .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) .optional(), - limit: z.number().int().min(1).max(100).optional(), - offset: z.number().int().min(0).optional(), + ...PaginationQueryShape, }) .passthrough(), getJobChangeLocationInfo: z @@ -104,8 +98,7 @@ export const WorkdayEndpointInputSchemas = { ID: z.string().min(1), id: z.string().min(1).optional(), workerId: z.string().min(1).optional(), - limit: z.number().int().min(1).max(100).optional(), - offset: z.number().int().min(0).optional(), + ...PaginationQueryShape, }) .passthrough(), getJobChangePosition: z @@ -113,8 +106,7 @@ export const WorkdayEndpointInputSchemas = { ID: z.string().min(1), id: z.string().min(1).optional(), workerId: z.string().min(1).optional(), - limit: z.number().int().min(1).max(100).optional(), - offset: z.number().int().min(0).optional(), + ...PaginationQueryShape, }) .passthrough(), getJobChangeReasonInstance: z @@ -122,8 +114,7 @@ export const WorkdayEndpointInputSchemas = { ID: z.string().min(1), id: z.string().min(1).optional(), workerId: z.string().min(1).optional(), - limit: z.number().int().min(1).max(100).optional(), - offset: z.number().int().min(0).optional(), + ...PaginationQueryShape, }) .passthrough(), getJobChangeReasonValues: z @@ -149,8 +140,7 @@ export const WorkdayEndpointInputSchemas = { worker: z .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) .optional(), - limit: z.number().int().min(1).max(100).optional(), - offset: z.number().int().min(0).optional(), + ...PaginationQueryShape, }) .passthrough(), getJobChangeReasons: z @@ -167,8 +157,7 @@ export const WorkdayEndpointInputSchemas = { worker: z .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) .optional(), - limit: z.number().int().min(1).max(100).optional(), - offset: z.number().int().min(0).optional(), + ...PaginationQueryShape, }) .passthrough(), getJobChangesGroupTemplates: z @@ -194,8 +183,7 @@ export const WorkdayEndpointInputSchemas = { worker: z .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) .optional(), - limit: z.number().int().min(1).max(100).optional(), - offset: z.number().int().min(0).optional(), + ...PaginationQueryShape, }) .passthrough(), getJobChangesJobValues: z @@ -206,8 +194,7 @@ export const WorkdayEndpointInputSchemas = { worker: z .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) .optional(), - limit: z.number().int().min(1).max(100).optional(), - offset: z.number().int().min(0).optional(), + ...PaginationQueryShape, }) .passthrough(), getJobChangesWorkerValues: z @@ -215,8 +202,7 @@ export const WorkdayEndpointInputSchemas = { effectiveDate: z .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) .optional(), - limit: z.number().int().min(1).max(100).optional(), - offset: z.number().int().min(0).optional(), + ...PaginationQueryShape, }) .passthrough(), getJobClassifications: z @@ -242,8 +228,7 @@ export const WorkdayEndpointInputSchemas = { worker: z .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) .optional(), - limit: z.number().int().min(1).max(100).optional(), - offset: z.number().int().min(0).optional(), + ...PaginationQueryShape, }) .passthrough(), getJobPosting: z @@ -251,8 +236,7 @@ export const WorkdayEndpointInputSchemas = { ID: z.string().min(1), id: z.string().min(1).optional(), workerId: z.string().min(1).optional(), - limit: z.number().int().min(1).max(100).optional(), - offset: z.number().int().min(0).optional(), + ...PaginationQueryShape, }) .passthrough(), getJobPostingQuestionnaire: z @@ -260,8 +244,7 @@ export const WorkdayEndpointInputSchemas = { ID: z.string().min(1), id: z.string().min(1).optional(), workerId: z.string().min(1).optional(), - limit: z.number().int().min(1).max(100).optional(), - offset: z.number().int().min(0).optional(), + ...PaginationQueryShape, }) .passthrough(), getJobProfilesValues: z @@ -287,8 +270,7 @@ export const WorkdayEndpointInputSchemas = { worker: z .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) .optional(), - limit: z.number().int().min(1).max(100).optional(), - offset: z.number().int().min(0).optional(), + ...PaginationQueryShape, }) .passthrough(), getJobRequisitionValues: z @@ -314,8 +296,7 @@ export const WorkdayEndpointInputSchemas = { worker: z .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) .optional(), - limit: z.number().int().min(1).max(100).optional(), - offset: z.number().int().min(0).optional(), + ...PaginationQueryShape, }) .passthrough(), getJobWorkspace: z @@ -324,8 +305,7 @@ export const WorkdayEndpointInputSchemas = { id: z.string().min(1).optional(), workerId: z.string().min(1).optional(), subresourceID: z.string().min(1), - limit: z.number().int().min(1).max(100).optional(), - offset: z.number().int().min(0).optional(), + ...PaginationQueryShape, }) .passthrough(), getJobWorkspaces: z @@ -333,8 +313,7 @@ export const WorkdayEndpointInputSchemas = { ID: z.string().min(1), id: z.string().min(1).optional(), workerId: z.string().min(1).optional(), - limit: z.number().int().min(1).max(100).optional(), - offset: z.number().int().min(0).optional(), + ...PaginationQueryShape, }) .passthrough(), listJobPostings: z @@ -351,8 +330,7 @@ export const WorkdayEndpointInputSchemas = { jobSite: z .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) .optional(), - limit: z.number().int().min(1).max(100).optional(), - offset: z.number().int().min(0).optional(), + ...PaginationQueryShape, }) .passthrough(), updateJobChangeBusinessTitle: z @@ -361,15 +339,13 @@ export const WorkdayEndpointInputSchemas = { id: z.string().min(1).optional(), workerId: z.string().min(1).optional(), subresourceID: z.string().min(1), - limit: z.number().int().min(1).max(100).optional(), - offset: z.number().int().min(0).optional(), + ...PaginationQueryShape, // Remaining fields form the JSON body (Workday resource payloads). }) .passthrough(), createPayrollInputs: z .object({ - limit: z.number().int().min(1).max(100).optional(), - offset: z.number().int().min(0).optional(), + ...PaginationQueryShape, // Remaining fields form the JSON body (Workday resource payloads). }) .passthrough(), @@ -378,8 +354,7 @@ export const WorkdayEndpointInputSchemas = { ID: z.string().min(1), id: z.string().min(1).optional(), workerId: z.string().min(1).optional(), - limit: z.number().int().min(1).max(100).optional(), - offset: z.number().int().min(0).optional(), + ...PaginationQueryShape, }) .passthrough(), updateAnExistingPayroll: z @@ -387,8 +362,7 @@ export const WorkdayEndpointInputSchemas = { ID: z.string().min(1), id: z.string().min(1).optional(), workerId: z.string().min(1).optional(), - limit: z.number().int().min(1).max(100).optional(), - offset: z.number().int().min(0).optional(), + ...PaginationQueryShape, // Remaining fields form the JSON body (Workday resource payloads). }) .passthrough(), @@ -406,8 +380,7 @@ export const WorkdayEndpointInputSchemas = { payComponent: z .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) .optional(), - limit: z.number().int().min(1).max(100).optional(), - offset: z.number().int().min(0).optional(), + ...PaginationQueryShape, }) .passthrough(), createTimeOffRequest: z @@ -415,8 +388,7 @@ export const WorkdayEndpointInputSchemas = { ID: z.string().min(1), id: z.string().min(1).optional(), workerId: z.string().min(1).optional(), - limit: z.number().int().min(1).max(100).optional(), - offset: z.number().int().min(0).optional(), + ...PaginationQueryShape, // Remaining fields form the JSON body (Workday resource payloads). }) .passthrough(), @@ -425,8 +397,7 @@ export const WorkdayEndpointInputSchemas = { ID: z.string().min(1), id: z.string().min(1).optional(), workerId: z.string().min(1).optional(), - limit: z.number().int().min(1).max(100).optional(), - offset: z.number().int().min(0).optional(), + ...PaginationQueryShape, }) .passthrough(), getTimeOffPlansForWorker: z @@ -434,14 +405,12 @@ export const WorkdayEndpointInputSchemas = { ID: z.string().min(1), id: z.string().min(1).optional(), workerId: z.string().min(1).optional(), - limit: z.number().int().min(1).max(100).optional(), - offset: z.number().int().min(0).optional(), + ...PaginationQueryShape, }) .passthrough(), getTimeOffStatusValues: z .object({ - limit: z.number().int().min(1).max(100).optional(), - offset: z.number().int().min(0).optional(), + ...PaginationQueryShape, }) .passthrough(), getTimeTypes: z @@ -467,8 +436,7 @@ export const WorkdayEndpointInputSchemas = { worker: z .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) .optional(), - limit: z.number().int().min(1).max(100).optional(), - offset: z.number().int().min(0).optional(), + ...PaginationQueryShape, }) .passthrough(), getAbsenceBalance: z @@ -485,8 +453,7 @@ export const WorkdayEndpointInputSchemas = { effective: z .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) .optional(), - limit: z.number().int().min(1).max(100).optional(), - offset: z.number().int().min(0).optional(), + ...PaginationQueryShape, }) .passthrough(), listBalances: z @@ -500,8 +467,7 @@ export const WorkdayEndpointInputSchemas = { effective: z .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) .optional(), - limit: z.number().int().min(1).max(100).optional(), - offset: z.number().int().min(0).optional(), + ...PaginationQueryShape, }) .passthrough(), getAssignmentChangeGroupCostCenters: z @@ -518,8 +484,7 @@ export const WorkdayEndpointInputSchemas = { worker: z .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) .optional(), - limit: z.number().int().min(1).max(100).optional(), - offset: z.number().int().min(0).optional(), + ...PaginationQueryShape, }) .passthrough(), getAssignmentChangeGroupJobs: z @@ -536,8 +501,7 @@ export const WorkdayEndpointInputSchemas = { worker: z .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) .optional(), - limit: z.number().int().min(1).max(100).optional(), - offset: z.number().int().min(0).optional(), + ...PaginationQueryShape, }) .passthrough(), getAssignmentTypes: z @@ -563,8 +527,7 @@ export const WorkdayEndpointInputSchemas = { worker: z .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) .optional(), - limit: z.number().int().min(1).max(100).optional(), - offset: z.number().int().min(0).optional(), + ...PaginationQueryShape, }) .passthrough(), getCandidateAvailabilityTemplate: z @@ -572,14 +535,12 @@ export const WorkdayEndpointInputSchemas = { ID: z.string().min(1), id: z.string().min(1).optional(), workerId: z.string().min(1).optional(), - limit: z.number().int().min(1).max(100).optional(), - offset: z.number().int().min(0).optional(), + ...PaginationQueryShape, }) .passthrough(), getCollectionOfJobs: z .object({ - limit: z.number().int().min(1).max(100).optional(), - offset: z.number().int().min(0).optional(), + ...PaginationQueryShape, }) .passthrough(), getCompanyInsiderTypes: z @@ -605,8 +566,7 @@ export const WorkdayEndpointInputSchemas = { worker: z .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) .optional(), - limit: z.number().int().min(1).max(100).optional(), - offset: z.number().int().min(0).optional(), + ...PaginationQueryShape, }) .passthrough(), getContingentWorkerTypes: z @@ -632,8 +592,7 @@ export const WorkdayEndpointInputSchemas = { worker: z .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) .optional(), - limit: z.number().int().min(1).max(100).optional(), - offset: z.number().int().min(0).optional(), + ...PaginationQueryShape, }) .passthrough(), getCountryInfo: z @@ -641,8 +600,7 @@ export const WorkdayEndpointInputSchemas = { ID: z.string().min(1), id: z.string().min(1).optional(), workerId: z.string().min(1).optional(), - limit: z.number().int().min(1).max(100).optional(), - offset: z.number().int().min(0).optional(), + ...PaginationQueryShape, }) .passthrough(), getCurrencies: z @@ -668,14 +626,12 @@ export const WorkdayEndpointInputSchemas = { worker: z .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) .optional(), - limit: z.number().int().min(1).max(100).optional(), - offset: z.number().int().min(0).optional(), + ...PaginationQueryShape, }) .passthrough(), getCurrentUser: z .object({ - limit: z.number().int().min(1).max(100).optional(), - offset: z.number().int().min(0).optional(), + ...PaginationQueryShape, }) .passthrough(), getGrants: z @@ -692,8 +648,7 @@ export const WorkdayEndpointInputSchemas = { worker: z .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) .optional(), - limit: z.number().int().min(1).max(100).optional(), - offset: z.number().int().min(0).optional(), + ...PaginationQueryShape, }) .passthrough(), getHeadcountOptions: z @@ -719,8 +674,7 @@ export const WorkdayEndpointInputSchemas = { worker: z .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) .optional(), - limit: z.number().int().min(1).max(100).optional(), - offset: z.number().int().min(0).optional(), + ...PaginationQueryShape, }) .passthrough(), getHistoryInstanceForWorker: z @@ -729,8 +683,7 @@ export const WorkdayEndpointInputSchemas = { id: z.string().min(1).optional(), workerId: z.string().min(1).optional(), subresourceID: z.string().min(1), - limit: z.number().int().min(1).max(100).optional(), - offset: z.number().int().min(0).optional(), + ...PaginationQueryShape, }) .passthrough(), getHistoryItemsForWorker: z @@ -738,8 +691,7 @@ export const WorkdayEndpointInputSchemas = { ID: z.string().min(1), id: z.string().min(1).optional(), workerId: z.string().min(1).optional(), - limit: z.number().int().min(1).max(100).optional(), - offset: z.number().int().min(0).optional(), + ...PaginationQueryShape, }) .passthrough(), getHolidayEvents: z @@ -753,8 +705,7 @@ export const WorkdayEndpointInputSchemas = { worker: z .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) .optional(), - limit: z.number().int().min(1).max(100).optional(), - offset: z.number().int().min(0).optional(), + ...PaginationQueryShape, }) .passthrough(), getInterview: z @@ -762,8 +713,7 @@ export const WorkdayEndpointInputSchemas = { ID: z.string().min(1), id: z.string().min(1).optional(), workerId: z.string().min(1).optional(), - limit: z.number().int().min(1).max(100).optional(), - offset: z.number().int().min(0).optional(), + ...PaginationQueryShape, }) .passthrough(), getInterviewFeedback2: z @@ -771,14 +721,12 @@ export const WorkdayEndpointInputSchemas = { ID: z.string().min(1), id: z.string().min(1).optional(), workerId: z.string().min(1).optional(), - limit: z.number().int().min(1).max(100).optional(), - offset: z.number().int().min(0).optional(), + ...PaginationQueryShape, }) .passthrough(), getLeaveStatusValues: z .object({ - limit: z.number().int().min(1).max(100).optional(), - offset: z.number().int().min(0).optional(), + ...PaginationQueryShape, }) .passthrough(), getMyJobPostings: z @@ -789,8 +737,7 @@ export const WorkdayEndpointInputSchemas = { supervisoryOrganization: z .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) .optional(), - limit: z.number().int().min(1).max(100).optional(), - offset: z.number().int().min(0).optional(), + ...PaginationQueryShape, }) .passthrough(), getOrganizationAssignmentBusinessUnits: z @@ -807,8 +754,7 @@ export const WorkdayEndpointInputSchemas = { worker: z .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) .optional(), - limit: z.number().int().min(1).max(100).optional(), - offset: z.number().int().min(0).optional(), + ...PaginationQueryShape, }) .passthrough(), getOrganizationAssignmentCustoms: z @@ -825,8 +771,7 @@ export const WorkdayEndpointInputSchemas = { worker: z .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) .optional(), - limit: z.number().int().min(1).max(100).optional(), - offset: z.number().int().min(0).optional(), + ...PaginationQueryShape, }) .passthrough(), getOrganizationAssignmentFunds: z @@ -843,8 +788,7 @@ export const WorkdayEndpointInputSchemas = { worker: z .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) .optional(), - limit: z.number().int().min(1).max(100).optional(), - offset: z.number().int().min(0).optional(), + ...PaginationQueryShape, }) .passthrough(), getOrganizationAssignmentRegions: z @@ -861,8 +805,7 @@ export const WorkdayEndpointInputSchemas = { worker: z .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) .optional(), - limit: z.number().int().min(1).max(100).optional(), - offset: z.number().int().min(0).optional(), + ...PaginationQueryShape, }) .passthrough(), getOrganizationAssignmentWorkers: z @@ -879,8 +822,7 @@ export const WorkdayEndpointInputSchemas = { worker: z .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) .optional(), - limit: z.number().int().min(1).max(100).optional(), - offset: z.number().int().min(0).optional(), + ...PaginationQueryShape, }) .passthrough(), getPayGroupByJobId: z @@ -888,8 +830,7 @@ export const WorkdayEndpointInputSchemas = { ID: z.string().min(1), id: z.string().min(1).optional(), workerId: z.string().min(1).optional(), - limit: z.number().int().min(1).max(100).optional(), - offset: z.number().int().min(0).optional(), + ...PaginationQueryShape, }) .passthrough(), getPaySlipInstancesForWorker: z @@ -898,8 +839,7 @@ export const WorkdayEndpointInputSchemas = { id: z.string().min(1).optional(), workerId: z.string().min(1).optional(), subresourceID: z.string().min(1), - limit: z.number().int().min(1).max(100).optional(), - offset: z.number().int().min(0).optional(), + ...PaginationQueryShape, }) .passthrough(), getPaySlipsForWorker: z @@ -907,8 +847,7 @@ export const WorkdayEndpointInputSchemas = { ID: z.string().min(1), id: z.string().min(1).optional(), workerId: z.string().min(1).optional(), - limit: z.number().int().min(1).max(100).optional(), - offset: z.number().int().min(0).optional(), + ...PaginationQueryShape, }) .passthrough(), getProposedPositionValues: z @@ -934,8 +873,7 @@ export const WorkdayEndpointInputSchemas = { worker: z .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) .optional(), - limit: z.number().int().min(1).max(100).optional(), - offset: z.number().int().min(0).optional(), + ...PaginationQueryShape, }) .passthrough(), getProspect: z @@ -943,8 +881,7 @@ export const WorkdayEndpointInputSchemas = { ID: z.string().min(1), id: z.string().min(1).optional(), workerId: z.string().min(1).optional(), - limit: z.number().int().min(1).max(100).optional(), - offset: z.number().int().min(0).optional(), + ...PaginationQueryShape, }) .passthrough(), getProspectEducations: z @@ -952,8 +889,7 @@ export const WorkdayEndpointInputSchemas = { ID: z.string().min(1), id: z.string().min(1).optional(), workerId: z.string().min(1).optional(), - limit: z.number().int().min(1).max(100).optional(), - offset: z.number().int().min(0).optional(), + ...PaginationQueryShape, }) .passthrough(), getProspectExperiences: z @@ -961,8 +897,7 @@ export const WorkdayEndpointInputSchemas = { ID: z.string().min(1), id: z.string().min(1).optional(), workerId: z.string().min(1).optional(), - limit: z.number().int().min(1).max(100).optional(), - offset: z.number().int().min(0).optional(), + ...PaginationQueryShape, }) .passthrough(), getProspectResumeAttachments: z @@ -970,8 +905,7 @@ export const WorkdayEndpointInputSchemas = { ID: z.string().min(1), id: z.string().min(1).optional(), workerId: z.string().min(1).optional(), - limit: z.number().int().min(1).max(100).optional(), - offset: z.number().int().min(0).optional(), + ...PaginationQueryShape, }) .passthrough(), getProspectSkills: z @@ -979,8 +913,7 @@ export const WorkdayEndpointInputSchemas = { ID: z.string().min(1), id: z.string().min(1).optional(), workerId: z.string().min(1).optional(), - limit: z.number().int().min(1).max(100).optional(), - offset: z.number().int().min(0).optional(), + ...PaginationQueryShape, }) .passthrough(), getSupervisoryOrgValues: z @@ -1006,8 +939,7 @@ export const WorkdayEndpointInputSchemas = { worker: z .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) .optional(), - limit: z.number().int().min(1).max(100).optional(), - offset: z.number().int().min(0).optional(), + ...PaginationQueryShape, }) .passthrough(), getWorkStudyAwards: z @@ -1033,8 +965,7 @@ export const WorkdayEndpointInputSchemas = { worker: z .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) .optional(), - limit: z.number().int().min(1).max(100).optional(), - offset: z.number().int().min(0).optional(), + ...PaginationQueryShape, }) .passthrough(), getWorkerBusinessTitleChanges: z @@ -1042,8 +973,7 @@ export const WorkdayEndpointInputSchemas = { ID: z.string().min(1), id: z.string().min(1).optional(), workerId: z.string().min(1).optional(), - limit: z.number().int().min(1).max(100).optional(), - offset: z.number().int().min(0).optional(), + ...PaginationQueryShape, }) .passthrough(), getWorkerEligibleAbsenceTypes: z @@ -1054,8 +984,7 @@ export const WorkdayEndpointInputSchemas = { effective: z .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) .optional(), - limit: z.number().int().min(1).max(100).optional(), - offset: z.number().int().min(0).optional(), + ...PaginationQueryShape, }) .passthrough(), getWorkerInfo: z @@ -1063,8 +992,7 @@ export const WorkdayEndpointInputSchemas = { ID: z.string().min(1), id: z.string().min(1).optional(), workerId: z.string().min(1).optional(), - limit: z.number().int().min(1).max(100).optional(), - offset: z.number().int().min(0).optional(), + ...PaginationQueryShape, }) .passthrough(), getWorkerLeavesOfAbsence: z @@ -1081,8 +1009,7 @@ export const WorkdayEndpointInputSchemas = { status: z .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) .optional(), - limit: z.number().int().min(1).max(100).optional(), - offset: z.number().int().min(0).optional(), + ...PaginationQueryShape, }) .passthrough(), getWorkerServiceDates: z @@ -1090,8 +1017,7 @@ export const WorkdayEndpointInputSchemas = { ID: z.string().min(1), id: z.string().min(1).optional(), workerId: z.string().min(1).optional(), - limit: z.number().int().min(1).max(100).optional(), - offset: z.number().int().min(0).optional(), + ...PaginationQueryShape, }) .passthrough(), getWorkerStaffingInformation: z @@ -1099,8 +1025,7 @@ export const WorkdayEndpointInputSchemas = { ID: z.string().min(1), id: z.string().min(1).optional(), workerId: z.string().min(1).optional(), - limit: z.number().int().min(1).max(100).optional(), - offset: z.number().int().min(0).optional(), + ...PaginationQueryShape, }) .passthrough(), getWorkerTimeOffDetails: z @@ -1114,8 +1039,7 @@ export const WorkdayEndpointInputSchemas = { toDate: z .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) .optional(), - limit: z.number().int().min(1).max(100).optional(), - offset: z.number().int().min(0).optional(), + ...PaginationQueryShape, }) .passthrough(), getWorkerTypes: z @@ -1141,8 +1065,7 @@ export const WorkdayEndpointInputSchemas = { worker: z .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) .optional(), - limit: z.number().int().min(1).max(100).optional(), - offset: z.number().int().min(0).optional(), + ...PaginationQueryShape, }) .passthrough(), getWorkerValidTimeOffDates: z @@ -1159,8 +1082,7 @@ export const WorkdayEndpointInputSchemas = { timeOffType: z .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) .optional(), - limit: z.number().int().min(1).max(100).optional(), - offset: z.number().int().min(0).optional(), + ...PaginationQueryShape, }) .passthrough(), retrieveWorkerLeaveOfAbsenceSubresource: z @@ -1169,8 +1091,7 @@ export const WorkdayEndpointInputSchemas = { id: z.string().min(1).optional(), workerId: z.string().min(1).optional(), subresourceID: z.string().min(1), - limit: z.number().int().min(1).max(100).optional(), - offset: z.number().int().min(0).optional(), + ...PaginationQueryShape, }) .passthrough(), getWorkersCollectionStaffing: z @@ -1181,8 +1102,7 @@ export const WorkdayEndpointInputSchemas = { search: z .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) .optional(), - limit: z.number().int().min(1).max(100).optional(), - offset: z.number().int().min(0).optional(), + ...PaginationQueryShape, }) .passthrough(), getWorkspaceInstances: z @@ -1208,14 +1128,12 @@ export const WorkdayEndpointInputSchemas = { worker: z .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) .optional(), - limit: z.number().int().min(1).max(100).optional(), - offset: z.number().int().min(0).optional(), + ...PaginationQueryShape, }) .passthrough(), listCountries: z .object({ - limit: z.number().int().min(1).max(100).optional(), - offset: z.number().int().min(0).optional(), + ...PaginationQueryShape, }) .passthrough(), listInterviews: z @@ -1223,14 +1141,12 @@ export const WorkdayEndpointInputSchemas = { status: z .union([z.string(), z.number(), z.boolean(), z.array(z.string())]) .optional(), - limit: z.number().int().min(1).max(100).optional(), - offset: z.number().int().min(0).optional(), + ...PaginationQueryShape, }) .passthrough(), listJobs: z .object({ - limit: z.number().int().min(1).max(100).optional(), - offset: z.number().int().min(0).optional(), + ...PaginationQueryShape, }) .passthrough(), updateMessageTemplateById: z @@ -1238,8 +1154,7 @@ export const WorkdayEndpointInputSchemas = { ID: z.string().min(1), id: z.string().min(1).optional(), workerId: z.string().min(1).optional(), - limit: z.number().int().min(1).max(100).optional(), - offset: z.number().int().min(0).optional(), + ...PaginationQueryShape, // Remaining fields form the JSON body (Workday resource payloads). }) .passthrough(), diff --git a/packages/workday/package.json b/packages/workday/package.json index 03d3e4648..346a2aea3 100644 --- a/packages/workday/package.json +++ b/packages/workday/package.json @@ -20,7 +20,7 @@ }, "peerDependencies": { "corsair": ">=0.1.0", - "zod": "^3.0.0" + "zod": "^3.20.0" }, "devDependencies": { "@types/jest": "^29.5.14",