diff --git a/src/oneTrust/endpoints/getRisk.ts b/src/oneTrust/endpoints/getRisk.ts index d2fe4bb..22b537d 100644 --- a/src/oneTrust/endpoints/getRisk.ts +++ b/src/oneTrust/endpoints/getRisk.ts @@ -1,3 +1,4 @@ +/* eslint-disable max-lines */ import * as t from 'io-ts'; /** @@ -61,7 +62,44 @@ export const OneTrustRiskCategories = t.array( /** Type override */ export type OneTrustRiskCategories = t.TypeOf; +export const OneTrustRiskReference = t.type({ + /** The id of the risk reference */ + id: t.string, + /** The type of the risk reference */ + type: t.string, + /** The reference type of the risk reference */ + referenceType: OneTrustEntityType, + /** The name of the risk reference */ + name: t.union([t.string, t.null]), + /** The additional attributes of the risk reference */ + additionalAttributes: t.object, +}); +/** Type override */ +export type OneTrustRiskReference = t.TypeOf; + +export const OneTrustRiskReferences = t.array(OneTrustRiskReference); + +/** Type override */ +export type OneTrustRiskReferences = t.TypeOf; + +export const OneTrustRiskTemplate = t.type({ + /** The id of the risk template */ + id: t.union([t.string, t.null]), + /** The name of the risk template */ + name: t.union([t.string, t.null]), +}); +/** Type override */ +export type OneTrustRiskTemplate = t.TypeOf; + export const OneTrustGetRiskResponse = t.type({ + /** The risk references */ + references: OneTrustRiskReferences, + /** Whether the risk is closed */ + closed: t.boolean, + /** The risk template */ + riskTemplate: OneTrustRiskTemplate, + /** The currentStageApproversCount */ + currentStageApproversCount: t.number, /** List of associated inventories to the risk. */ associatedInventories: t.array( t.type({ @@ -206,6 +244,16 @@ export const OneTrustGetRiskResponse = t.type({ t.literal('GENERIC'), ]), }), + /** Risk Source Type. */ + sourceType: t.union([ + t.literal('PIA'), + t.literal('RA'), + t.literal('GRA'), + t.literal('INVENTORY'), + t.literal('INCIDENT'), + t.literal('GENERIC'), + t.null, + ]), /** The risk stage */ stage: t.intersection([ t.partial({ @@ -287,13 +335,22 @@ export const OneTrustGetRiskResponse = t.type({ t.null, ]), /** The risk workflow */ - workflow: t.type({ - /** ID of an entity. */ - id: t.string, - /** Name of an entity. */ - name: t.string, - }), + workflow: t.intersection([ + t.type({ + /** ID of an entity. */ + id: t.string, + /** Name of an entity. */ + name: t.string, + }), + t.partial({ + /** The nameKey */ + nameKey: t.array(t.string), + /** The badgeColor */ + badgeColor: t.union([t.string, t.null]), + }), + ]), }); /** Type override */ export type OneTrustGetRiskResponse = t.TypeOf; +/* eslint-enable max-lines */ diff --git a/src/oneTrust/endpoints/getUser.ts b/src/oneTrust/endpoints/getUser.ts index fff0c51..f362b0b 100644 --- a/src/oneTrust/endpoints/getUser.ts +++ b/src/oneTrust/endpoints/getUser.ts @@ -60,7 +60,7 @@ export type OneTrustUserEmails = t.TypeOf; /** * The response type of the OneTrust GetUser endpoint - * ref: https://developer.onetrust.com/onetrust/reference/getriskusingget + * ref: https://developer.onetrust.com/onetrust/reference/getuserusingget */ export const OneTrustGetUserResponse = t.type({ /** ID of the user. */ diff --git a/src/oneTrust/enrichedCodecs.ts b/src/oneTrust/enrichedCodecs.ts index c231c33..1baa90b 100644 --- a/src/oneTrust/enrichedCodecs.ts +++ b/src/oneTrust/enrichedCodecs.ts @@ -15,17 +15,7 @@ import { /** The default OneTrust Get Assessment risk response enriched with Get Risk response. */ export const OneTrustEnrichedRisk = t.intersection([ OneTrustAssessmentQuestionRisk, - t.type({ - description: OneTrustGetRiskResponse.props.description, - name: OneTrustGetRiskResponse.props.name, - treatment: OneTrustGetRiskResponse.props.treatment, - treatmentStatus: OneTrustGetRiskResponse.props.treatmentStatus, - type: OneTrustGetRiskResponse.props.type, - stage: OneTrustGetRiskResponse.props.stage, - state: OneTrustGetRiskResponse.props.state, - result: OneTrustGetRiskResponse.props.result, - categories: OneTrustGetRiskResponse.props.categories, - }), + OneTrustGetRiskResponse, ]); /** Type override */ @@ -127,3 +117,10 @@ export const OneTrustEnrichedAssessment = t.intersection([ export type OneTrustEnrichedAssessment = t.TypeOf< typeof OneTrustEnrichedAssessment >; + +export const OneTrustEnrichedAssessments = t.array(OneTrustEnrichedAssessment); + +/** Type override */ +export type OneTrustEnrichedAssessments = t.TypeOf< + typeof OneTrustEnrichedAssessments +>;