-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add support for syncing Assessments from OneTrust to Transcend (#376)
* create flattenOneTrustAssessment helper * flatten questionReponses * create helper getOneTrustRisk * update return type of getOneTrustRIsk * convert OneTrust interfaces to codecs * fix codecs * fix codecs * create flattenOneTrustSectionHeaders helper * improve codecs and create flattenOneTrustQuestions helper * improve variable names * create extractProperties helper * implement flattenOneTrustNestedQuestionsOptions * improve flattenList * improve flattenList * update flattenOneTrustNestedQuestionsOptions to use aggregateObjects * more changes * update const flattenOneTrustSectionHeaders = ( * update const flattenOneTrustSectionHeaders = ( * commit * commit * create more helpers and add tests * create enrichRiskStatisticsWithDefault * fix bug * remove extra test * create more codecs * flatten risks * flatten approvers, respondents, and primaryEntityDetails * update flattenOneTrustAssessment type * create DEFAULT_ONE_TRUST_COMBINED_ASSESSMENT * add comments * update * improve createDefatulCodec * add missing fields to codec * fix codecs * undo changes to cli-pull-ot * improve codecs * done * update writeOneTrustAssessment to write in csv format * import assessment types from privacy types * update type-utils * remove enrich helpers * import createDefaultCodec from type-utils * rename cli-pull-ot -> cli-sync-ot * add dryRun argument * add dryRun argument * move some logic from writeOneTrustAssessment to cli-sync-ot * ship more improvements to writeOneTrustAssessment * reorganize folder structure * create syncOneTrustAssessments and enrichOneTrustAssessment helpers * call syncOneTrustAssessments from cli-sync-ot * create oneTrustAssessmentToJson helper * create oneTrustAssessmentToCsv helper * create oneTrustAssessmentToCsvRecord helper * update readme * move constants to heleprs * add transcendUrl to the list of arguments * add ability to sync to Transcend * update error messages * update extractProperties documentation * add fixme comment * write docs for aggregateObjects * document flattenObject * remove some TODOs * add TODOs * remove TODOs * add a fixme * simplify flattenOneTrustAssessment * improve flattenOneTrustSections * improve flattenOneTrustSectionHeaders * simplify flatten functions * import aggregateObjects and flattenObject from @transcend/type-utils * use transposeObjectArray from @transcend/type-utils * improve flattenOneTrustAssessment * update Readme * update cli-sync-ot docs * update package.version * update commments * remove potential bugs from flattenOneTrustAssessment * add fixmes * fix flattenOneTrustQuestionResponses * fix flattenOneTrustNestedQuestionsOptions and add tests * correctly flatten risks and add tests * make progress in risk categories * write more tests * test flattenOneTrustSectionHeaders * add flattenOneTrustSections tests * default for pushing to transcend is json * update enrichOneTrustAssessment to enrich creator * create getOneTrustUser and cache fetched users * remove FIXME * enrich assessment with approver details * enrich assessments with respondents information * use privacy-types 4.105.3 * fix bugs and import codecs from privacy-types * fix bug in syncONeTrustASsessmentToDisk * rewrite syncOneTrustAssessments to run in parallel and series * fix some bugs * nits * fix pre-commit * fix tests
- Loading branch information
1 parent
801ba52
commit 925b974
Showing
33 changed files
with
2,036 additions
and
743 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Binary file removed
BIN
-370 KB
.yarn/cache/@transcend-io-privacy-types-npm-4.103.0-b8d1864632-4661368b34.zip
Binary file not shown.
Binary file removed
BIN
-76.8 KB
.yarn/cache/@transcend-io-type-utils-npm-1.5.0-125f1a01fb-0d7d85e794.zip
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
#!/usr/bin/env node | ||
import { logger } from './logger'; | ||
|
||
import colors from 'colors'; | ||
import { parseCliSyncOtArguments, createOneTrustGotInstance } from './oneTrust'; | ||
import { OneTrustPullResource } from './enums'; | ||
import { syncOneTrustAssessments } from './oneTrust/helpers/syncOneTrustAssessments'; | ||
import { buildTranscendGraphQLClient } from './graphql'; | ||
|
||
/** | ||
* Pull configuration from OneTrust down locally to disk | ||
* | ||
* Dev Usage: | ||
* yarn ts-node ./src/cli-sync-ot.ts --hostname=customer.my.onetrust.com --oneTrustAuth=$ONE_TRUST_OAUTH_TOKEN --transcendAuth=$TRANSCEND_API_KEY | ||
* | ||
* Standard usage | ||
* yarn cli-sync-ot --hostname=customer.my.onetrust.com --oneTrustAuth=$ONE_TRUST_OAUTH_TOKEN --transcendAuth=$TRANSCEND_API_KEY | ||
*/ | ||
async function main(): Promise<void> { | ||
const { | ||
file, | ||
fileFormat, | ||
hostname, | ||
oneTrustAuth, | ||
transcendAuth, | ||
transcendUrl, | ||
resource, | ||
// debug, | ||
dryRun, | ||
} = parseCliSyncOtArguments(); | ||
|
||
// use the hostname and auth token to instantiate a client to talk to OneTrust | ||
const oneTrust = createOneTrustGotInstance({ hostname, auth: oneTrustAuth }); | ||
|
||
// try { | ||
if (resource === OneTrustPullResource.Assessments) { | ||
await syncOneTrustAssessments({ | ||
oneTrust, | ||
file, | ||
fileFormat, | ||
dryRun, | ||
...(transcendAuth && transcendUrl | ||
? { | ||
transcend: buildTranscendGraphQLClient(transcendUrl, transcendAuth), | ||
} | ||
: {}), | ||
}); | ||
} | ||
// } catch (err) { | ||
// logger.error( | ||
// colors.red( | ||
// `An error occurred syncing the resource ${resource} from OneTrust: ${ | ||
// debug ? err.stack : err.message | ||
// }`, | ||
// ), | ||
// ); | ||
// process.exit(1); | ||
// } | ||
|
||
// Indicate success | ||
logger.info( | ||
colors.green( | ||
`Successfully synced OneTrust ${resource} to ${ | ||
dryRun ? `disk at "${file}"` : 'Transcend' | ||
}!`, | ||
), | ||
); | ||
} | ||
|
||
main(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.