diff --git a/connectors/connector-greenhouse/package.json b/connectors/connector-greenhouse/package.json index 4dc7e1b2..8f48a57c 100644 --- a/connectors/connector-greenhouse/package.json +++ b/connectors/connector-greenhouse/package.json @@ -7,7 +7,7 @@ "@openint/cdk": "workspace:*", "@openint/util": "workspace:*", "@opensdks/runtime": "^0.0.19", - "@opensdks/sdk-greenhouse": "^0.0.7" + "@opensdks/sdk-greenhouse": "^0.0.8" }, "devDependencies": {} } diff --git a/connectors/connector-postgres/server.ts b/connectors/connector-postgres/server.ts index 2b6a7fc6..02b34b2a 100644 --- a/connectors/connector-postgres/server.ts +++ b/connectors/connector-postgres/server.ts @@ -16,7 +16,8 @@ const agTableMappings = [ {from: 'integration_ats_candidate', to: 'IntegrationATSCandidate'}, {from: 'integration_ats_job_opening', to: 'IntegrationATSJobOpening'}, {from: 'integration_ats_offer', to: 'IntegrationATSOffer'}, - {from: 'integration_connection', to: 'IntegrationConnection'} + {from: 'integration_connection', to: 'IntegrationConnection'}, + {from: 'integration_ats_opening', to: 'IntegrationATSOpening'}, ] async function setupTable({ @@ -245,7 +246,7 @@ export const postgresServer = { isOpenInt: true, } - const isAgInsert = + const isAgInsert = endUser?.orgId === 'org_2lcCCimyICKI8cpPNQt195h5zrP' || endUser?.orgId === 'org_2ms9FdeczlbrDIHJLcwGdpv3dTx' @@ -258,11 +259,8 @@ export const postgresServer = { rowToInsert['opening_external_id'] = data.entity?.raw?.id || ''; rowToInsert['candidate_name'] = data.entity?.raw?.first_name + ' ' + data.entity?.raw?.last_name || ''; } else if (tableName === 'IntegrationAtsJobOpening') { - rowToInsert['opening_external_id'] = data.entity?.raw?.id || ''; - // NOTE Job openings are nested within Jobs and that o bject does not contain an id of the parent (job id) - // Depends on the implementation we may have to change this, leaving empty for now - // https://developers.greenhouse.io/harvest.html#the-job-object - rowToInsert['job_id'] = ''; + rowToInsert['opening_external_id'] = data.entity?.raw?.opening_id || ''; + rowToInsert['job_id'] = data.entity?.raw?.job_id || ''; } else if (tableName === 'IntegrationAtsOffer') { // Note: These fields seemed duplicated from the nested objects rowToInsert['opening_external_id'] = data.entity?.raw?.opening?.id || ''; diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index fe7c0e1c..b35e8a33 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -857,8 +857,8 @@ importers: specifier: ^0.0.19 version: 0.0.19 '@opensdks/sdk-greenhouse': - specifier: ^0.0.7 - version: 0.0.7 + specifier: ^0.0.8 + version: 0.0.8 connectors/connector-heron: dependencies: @@ -3651,8 +3651,8 @@ packages: '@opensdks/sdk-finch@0.0.4': resolution: {integrity: sha512-7CxSxCIE8POPBFrEGlovRdkziXNfbrh6GD7fPwIk6GPR2f2CKmLqPxOpLhBhzH/5Ol0nCyzCq8NDsvLbI5OvEQ==} - '@opensdks/sdk-greenhouse@0.0.7': - resolution: {integrity: sha512-WgmMjMO8DXyjnSJ1fvnK1TrNabgUatUOIKHRhUu6WSFJFUzfryoMJfPR8zSWIUzMNrtNS5lthK2x+kY+w4NtBQ==} + '@opensdks/sdk-greenhouse@0.0.8': + resolution: {integrity: sha512-kIN0ckK36QmWUfUNbl7B6Fi8G63JQ/iCWKnY5Ozd+lTRQYQV+ub30FOZk0djiepNOcUkOFv3QSy9K1Sk8B4ADA==} '@opensdks/sdk-heron@0.0.1': resolution: {integrity: sha512-7DOFFlq5C8u060L9GJ6euwE/g8aqIClyZysio4jqYQ1W9rcYX/pZUsZ7NNPt6LQTX+coAz+8nieEi35ejiKbdg==} @@ -15551,7 +15551,7 @@ snapshots: '@opensdks/sdk-finch@0.0.4': {} - '@opensdks/sdk-greenhouse@0.0.7': + '@opensdks/sdk-greenhouse@0.0.8': dependencies: '@opensdks/runtime': 0.0.20 @@ -20216,7 +20216,7 @@ snapshots: transitivePeerDependencies: - supports-color - eslint-module-utils@2.8.0(@typescript-eslint/parser@6.21.0(eslint@8.23.0)(typescript@5.6.2))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.5.3)(eslint@8.23.0): + eslint-module-utils@2.8.0(@typescript-eslint/parser@6.21.0(eslint@8.23.0)(typescript@5.6.2))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.5.3(eslint-plugin-import@2.29.0)(eslint@8.23.0))(eslint@8.23.0): dependencies: debug: 3.2.7 optionalDependencies: @@ -20261,7 +20261,7 @@ snapshots: doctrine: 2.1.0 eslint: 8.23.0 eslint-import-resolver-node: 0.3.9 - eslint-module-utils: 2.8.0(@typescript-eslint/parser@6.21.0(eslint@8.23.0)(typescript@5.6.2))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.5.3)(eslint@8.23.0) + eslint-module-utils: 2.8.0(@typescript-eslint/parser@6.21.0(eslint@8.23.0)(typescript@5.6.2))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.5.3(eslint-plugin-import@2.29.0)(eslint@8.23.0))(eslint@8.23.0) hasown: 2.0.0 is-core-module: 2.13.1 is-glob: 4.0.3 diff --git a/unified/unified-ats/adapters/greenhouse-adapter/index.ts b/unified/unified-ats/adapters/greenhouse-adapter/index.ts index 36ad18e3..bd2590db 100644 --- a/unified/unified-ats/adapters/greenhouse-adapter/index.ts +++ b/unified/unified-ats/adapters/greenhouse-adapter/index.ts @@ -36,25 +36,25 @@ export const greenhouseAdapter = { if (!jobId) { throw new Error('jobId is required'); } - // @ts-expect-error while greenhouse sdk is updated - const res = await instance.GET(`/v1/jobs/${jobId}/openings`, { + const res = await instance.GET(`/v1/jobs/{id}/openings`, { params: { query: { per_page: input?.page_size, page: cursor, }, + path: { + id: jobId, + } }, }) let nextCursor = undefined - // @ts-expect-error while greenhouse sdk is updated if (input?.page_size && res.data?.length === input?.page_size) { nextCursor = (cursor || 0) + input.page_size } return { has_next_page: !!nextCursor, next_cursor: nextCursor ? String(nextCursor) : undefined, - // @ts-expect-error while greenhouse sdk is updated - items: res.data?.map((d) => applyMapper(mappers.jobOpening, d)) ?? [], + items: res.data?.map((d) => applyMapper(mappers.opening, {job_id: jobId, ...d})) ?? [], } }, listOffers: async ({instance, input}) => {