@transcend-io/cli 9.0.1 → 10.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +26 -34
- package/dist/RateCounter-DFL_mnk2.mjs +2 -0
- package/dist/RateCounter-DFL_mnk2.mjs.map +1 -0
- package/dist/RequestDataSilo-_Iv44M9u.mjs +51 -0
- package/dist/RequestDataSilo-_Iv44M9u.mjs.map +1 -0
- package/dist/app-BfTrk2nc.mjs +131 -0
- package/dist/app-BfTrk2nc.mjs.map +1 -0
- package/dist/approvePrivacyRequests-CWGZR2N6.mjs +2 -0
- package/dist/approvePrivacyRequests-CWGZR2N6.mjs.map +1 -0
- package/dist/assessment-BDywVaGR.mjs +284 -0
- package/dist/assessment-BDywVaGR.mjs.map +1 -0
- package/dist/bin/bash-complete.mjs +1 -1
- package/dist/bin/bash-complete.mjs.map +1 -1
- package/dist/bin/cli.mjs +1 -1
- package/dist/bin/cli.mjs.map +1 -1
- package/dist/bin/deprecated-command.mjs +1 -1
- package/dist/bin/deprecated-command.mjs.map +1 -1
- package/dist/bluebird-CUitXgsY.mjs +2 -0
- package/dist/bluebird-CUitXgsY.mjs.map +1 -0
- package/dist/buildXdiSyncEndpoint-Cb-pvpak.mjs +9 -0
- package/dist/buildXdiSyncEndpoint-Cb-pvpak.mjs.map +1 -0
- package/dist/bulkRestartRequests-CKF_xpN0.mjs +2 -0
- package/dist/bulkRestartRequests-CKF_xpN0.mjs.map +1 -0
- package/dist/bulkRetryEnrichers-B-Szmin-.mjs +2 -0
- package/dist/bulkRetryEnrichers-B-Szmin-.mjs.map +1 -0
- package/dist/cancelPrivacyRequests-DNiL13E_.mjs +2 -0
- package/dist/cancelPrivacyRequests-DNiL13E_.mjs.map +1 -0
- package/dist/codecs-BE3Wmoh8.mjs +2 -0
- package/dist/codecs-BE3Wmoh8.mjs.map +1 -0
- package/dist/codecs-Dx_vGxsl.mjs +2 -0
- package/dist/codecs-Dx_vGxsl.mjs.map +1 -0
- package/dist/{command-Bzyj3M2G.mjs → command-BXxoAjFo.mjs} +2 -2
- package/dist/command-BXxoAjFo.mjs.map +1 -0
- package/dist/consentManagersToBusinessEntities-BDgOFga7.mjs +5 -0
- package/dist/consentManagersToBusinessEntities-BDgOFga7.mjs.map +1 -0
- package/dist/constants-AFtS5Nad.mjs +4 -0
- package/dist/constants-AFtS5Nad.mjs.map +1 -0
- package/dist/constants-CeMiHaHx.mjs +2 -0
- package/dist/constants-CeMiHaHx.mjs.map +1 -0
- package/dist/constants-lIvXgkdp.mjs +2 -0
- package/dist/constants-lIvXgkdp.mjs.map +1 -0
- package/dist/{context-bkKpii_t.mjs → context-CdSyuBlf.mjs} +1 -1
- package/dist/context-CdSyuBlf.mjs.map +1 -0
- package/dist/{pooling-CazydwlD.mjs → createExtraKeyHandler-tubeaEjA.mjs} +5 -5
- package/dist/createExtraKeyHandler-tubeaEjA.mjs.map +1 -0
- package/dist/createPreferenceAccessTokens-DqmFctn3.mjs +10 -0
- package/dist/createPreferenceAccessTokens-DqmFctn3.mjs.map +1 -0
- package/dist/createSombraGotInstance-D1Il9zUE.mjs +10 -0
- package/dist/createSombraGotInstance-D1Il9zUE.mjs.map +1 -0
- package/dist/{dataFlowsToDataSilos-RAhfPV0l.mjs → dataFlowsToDataSilos-NhvBw1iy.mjs} +1 -1
- package/dist/dataFlowsToDataSilos-NhvBw1iy.mjs.map +1 -0
- package/dist/dataSilo-DrFetFXw.mjs +302 -0
- package/dist/dataSilo-DrFetFXw.mjs.map +1 -0
- package/dist/dataSubject-y_aXI0pa.mjs +92 -0
- package/dist/dataSubject-y_aXI0pa.mjs.map +1 -0
- package/dist/{done-input-validation-CcZtaz03.mjs → done-input-validation-DLR0-MJ7.mjs} +1 -1
- package/dist/{done-input-validation-CcZtaz03.mjs.map → done-input-validation-DLR0-MJ7.mjs.map} +1 -1
- package/dist/downloadPrivacyRequestFiles-DlpgxqHF.mjs +2 -0
- package/dist/downloadPrivacyRequestFiles-DlpgxqHF.mjs.map +1 -0
- package/dist/enums-CyFTrzXY.mjs.map +1 -1
- package/dist/extractClientError-DPjv09EH.mjs +2 -0
- package/dist/extractClientError-DPjv09EH.mjs.map +1 -0
- package/dist/extractErrorMessage-CPnTsT1S.mjs +2 -0
- package/dist/extractErrorMessage-CPnTsT1S.mjs.map +1 -0
- package/dist/fetchAllActions-BJsPdnxy.mjs +832 -0
- package/dist/fetchAllActions-BJsPdnxy.mjs.map +1 -0
- package/dist/fetchAllDataFlows-D248lO6_.mjs +2 -0
- package/dist/fetchAllDataFlows-D248lO6_.mjs.map +1 -0
- package/dist/fetchAllPreferenceTopics-ForE9GpZ.mjs +36 -0
- package/dist/fetchAllPreferenceTopics-ForE9GpZ.mjs.map +1 -0
- package/dist/fetchAllPurposes-ZdkO2fMp.mjs +29 -0
- package/dist/fetchAllPurposes-ZdkO2fMp.mjs.map +1 -0
- package/dist/fetchAllPurposesAndPreferences-DD6OyA5t.mjs +2 -0
- package/dist/fetchAllPurposesAndPreferences-DD6OyA5t.mjs.map +1 -0
- package/dist/fetchAllRequestEnrichers-CK-kk5eg.mjs +42 -0
- package/dist/fetchAllRequestEnrichers-CK-kk5eg.mjs.map +1 -0
- package/dist/fetchAllRequestIdentifiers-DrFFOt0m.mjs +10 -0
- package/dist/fetchAllRequestIdentifiers-DrFFOt0m.mjs.map +1 -0
- package/dist/fetchAllRequests-DNQQsY4s.mjs +2 -0
- package/dist/fetchAllRequests-DNQQsY4s.mjs.map +1 -0
- package/dist/fetchApiKeys-DjOr44xA.mjs +33 -0
- package/dist/fetchApiKeys-DjOr44xA.mjs.map +1 -0
- package/dist/fetchCatalogs-BM4FCbcS.mjs +12 -0
- package/dist/fetchCatalogs-BM4FCbcS.mjs.map +1 -0
- package/dist/fetchConsentManagerId-CFkg3-RS.mjs +321 -0
- package/dist/fetchConsentManagerId-CFkg3-RS.mjs.map +1 -0
- package/dist/fetchIdentifiers-pjQV4vUg.mjs +54 -0
- package/dist/fetchIdentifiers-pjQV4vUg.mjs.map +1 -0
- package/dist/fetchRequestDataSilo-P4yA7Lyc.mjs +2 -0
- package/dist/fetchRequestDataSilo-P4yA7Lyc.mjs.map +1 -0
- package/dist/fetchRequestFilesForRequest-BbxrEKFK.mjs +33 -0
- package/dist/fetchRequestFilesForRequest-BbxrEKFK.mjs.map +1 -0
- package/dist/generateCrossAccountApiKeys-Bxc_dzMG.mjs +33 -0
- package/dist/generateCrossAccountApiKeys-Bxc_dzMG.mjs.map +1 -0
- package/dist/impl-4ltdSmpl2.mjs +4 -0
- package/dist/impl-4ltdSmpl2.mjs.map +1 -0
- package/dist/impl-B19fH75P.mjs +12 -0
- package/dist/impl-B19fH75P.mjs.map +1 -0
- package/dist/impl-BBMjv5YQ.mjs +2 -0
- package/dist/impl-BBMjv5YQ.mjs.map +1 -0
- package/dist/{impl-CZP2l3Ds.mjs → impl-BKH3QRLi.mjs} +3 -3
- package/dist/impl-BKH3QRLi.mjs.map +1 -0
- package/dist/impl-BOUm7wly2.mjs +2 -0
- package/dist/impl-BOUm7wly2.mjs.map +1 -0
- package/dist/impl-BUC4ZelU.mjs +2 -0
- package/dist/impl-BUC4ZelU.mjs.map +1 -0
- package/dist/impl-BhTCp0kg.mjs +2 -0
- package/dist/impl-BhTCp0kg.mjs.map +1 -0
- package/dist/impl-BlHU1bbJ2.mjs +2 -0
- package/dist/impl-BlHU1bbJ2.mjs.map +1 -0
- package/dist/impl-BwjguKHC.mjs +4 -0
- package/dist/impl-BwjguKHC.mjs.map +1 -0
- package/dist/impl-C2o0eDzJ.mjs +2 -0
- package/dist/impl-C2o0eDzJ.mjs.map +1 -0
- package/dist/impl-C8HKnjw82.mjs +2 -0
- package/dist/impl-C8HKnjw82.mjs.map +1 -0
- package/dist/impl-CCUsnhoW2.mjs +2 -0
- package/dist/impl-CCUsnhoW2.mjs.map +1 -0
- package/dist/impl-CCc-wXqD.mjs +2 -0
- package/dist/impl-CCc-wXqD.mjs.map +1 -0
- package/dist/impl-CMmyv1cl.mjs +2 -0
- package/dist/impl-CMmyv1cl.mjs.map +1 -0
- package/dist/{impl-BYBNi68b.mjs → impl-CNez1OAw.mjs} +2 -2
- package/dist/impl-CNez1OAw.mjs.map +1 -0
- package/dist/impl-CNykdy3e2.mjs +2 -0
- package/dist/impl-CNykdy3e2.mjs.map +1 -0
- package/dist/impl-CSChmq_t2.mjs +2 -0
- package/dist/impl-CSChmq_t2.mjs.map +1 -0
- package/dist/impl-Ce9K4OCp.mjs +2 -0
- package/dist/impl-Ce9K4OCp.mjs.map +1 -0
- package/dist/impl-Cgg_bv7j.mjs +2 -0
- package/dist/impl-Cgg_bv7j.mjs.map +1 -0
- package/dist/impl-ChCqHkOc2.mjs +2 -0
- package/dist/impl-ChCqHkOc2.mjs.map +1 -0
- package/dist/impl-CqEwwWeD.mjs +2 -0
- package/dist/impl-CqEwwWeD.mjs.map +1 -0
- package/dist/impl-CqXFyvgV2.mjs +2 -0
- package/dist/impl-CqXFyvgV2.mjs.map +1 -0
- package/dist/impl-CxLSJk2P.mjs +2 -0
- package/dist/impl-CxLSJk2P.mjs.map +1 -0
- package/dist/impl-CzU9WTiW.mjs +2 -0
- package/dist/impl-CzU9WTiW.mjs.map +1 -0
- package/dist/impl-D-cp0CYr.mjs +2 -0
- package/dist/impl-D-cp0CYr.mjs.map +1 -0
- package/dist/impl-D9NjIwEi2.mjs +2 -0
- package/dist/impl-D9NjIwEi2.mjs.map +1 -0
- package/dist/impl-DEWXA_QC.mjs +2 -0
- package/dist/impl-DEWXA_QC.mjs.map +1 -0
- package/dist/impl-DGiPB5Vq2.mjs +2 -0
- package/dist/impl-DGiPB5Vq2.mjs.map +1 -0
- package/dist/impl-DGuwD_qz.mjs +2 -0
- package/dist/impl-DGuwD_qz.mjs.map +1 -0
- package/dist/impl-DGzvE8aJ.mjs +2 -0
- package/dist/impl-DGzvE8aJ.mjs.map +1 -0
- package/dist/impl-DTp9OQIZ.mjs +7 -0
- package/dist/impl-DTp9OQIZ.mjs.map +1 -0
- package/dist/impl-DhscnXSw.mjs +2 -0
- package/dist/impl-DhscnXSw.mjs.map +1 -0
- package/dist/impl-Dk7MdX-1.mjs +2 -0
- package/dist/impl-Dk7MdX-1.mjs.map +1 -0
- package/dist/impl-DsNPvet4.mjs +2 -0
- package/dist/impl-DsNPvet4.mjs.map +1 -0
- package/dist/impl-DxUFb0vv.mjs +2 -0
- package/dist/impl-DxUFb0vv.mjs.map +1 -0
- package/dist/impl-JThkrXiI2.mjs +2 -0
- package/dist/impl-JThkrXiI2.mjs.map +1 -0
- package/dist/impl-KDuBh4bu2.mjs +2 -0
- package/dist/impl-KDuBh4bu2.mjs.map +1 -0
- package/dist/impl-MpkLBntW.mjs +2 -0
- package/dist/impl-MpkLBntW.mjs.map +1 -0
- package/dist/impl-P_NDC3cX.mjs +2 -0
- package/dist/impl-P_NDC3cX.mjs.map +1 -0
- package/dist/impl-Rt3C_fDF.mjs +2 -0
- package/dist/impl-Rt3C_fDF.mjs.map +1 -0
- package/dist/impl-c7rUQYDc2.mjs +2 -0
- package/dist/impl-c7rUQYDc2.mjs.map +1 -0
- package/dist/impl-fqOKTw5J.mjs +2 -0
- package/dist/impl-fqOKTw5J.mjs.map +1 -0
- package/dist/impl-oiBTZqQS2.mjs +2 -0
- package/dist/impl-oiBTZqQS2.mjs.map +1 -0
- package/dist/impl-tbGnvKFm.mjs +2 -0
- package/dist/impl-tbGnvKFm.mjs.map +1 -0
- package/dist/index.d.mts +3441 -3429
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +78 -4
- package/dist/index.mjs.map +1 -1
- package/dist/inquirer-BgNcicZ4.mjs +2 -0
- package/dist/inquirer-BgNcicZ4.mjs.map +1 -0
- package/dist/listFiles-qzyQMaYH.mjs +2 -0
- package/dist/listFiles-qzyQMaYH.mjs.map +1 -0
- package/dist/{logger-Bj782ZYD.mjs → logger-B-LXIf3U.mjs} +1 -1
- package/dist/{logger-Bj782ZYD.mjs.map → logger-B-LXIf3U.mjs.map} +1 -1
- package/dist/makeGraphQLRequest-Cq26A_Lq.mjs +2 -0
- package/dist/makeGraphQLRequest-Cq26A_Lq.mjs.map +1 -0
- package/dist/markRequestDataSiloIdsCompleted-DzqJ5MNY.mjs +2 -0
- package/dist/markRequestDataSiloIdsCompleted-DzqJ5MNY.mjs.map +1 -0
- package/dist/markSilentPrivacyRequests-BKQUu6Ep.mjs +2 -0
- package/dist/markSilentPrivacyRequests-BKQUu6Ep.mjs.map +1 -0
- package/dist/mergeTranscendInputs-DGC4xUGu.mjs +2 -0
- package/dist/mergeTranscendInputs-DGC4xUGu.mjs.map +1 -0
- package/dist/notifyPrivacyRequestsAdditionalTime-TEHAJe4C.mjs +2 -0
- package/dist/notifyPrivacyRequestsAdditionalTime-TEHAJe4C.mjs.map +1 -0
- package/dist/package-C4J38oR1.mjs +2 -0
- package/dist/package-C4J38oR1.mjs.map +1 -0
- package/dist/parquetToCsvOneFile-DZVKXrjn.mjs +6 -0
- package/dist/parquetToCsvOneFile-DZVKXrjn.mjs.map +1 -0
- package/dist/parseAttributesFromString-CZStzJc0.mjs +2 -0
- package/dist/parseAttributesFromString-CZStzJc0.mjs.map +1 -0
- package/dist/pullAllDatapoints-Cntwuzw7.mjs +45 -0
- package/dist/pullAllDatapoints-Cntwuzw7.mjs.map +1 -0
- package/dist/pullChunkedCustomSiloOutstandingIdentifiers-BT-GZpT1.mjs +2 -0
- package/dist/pullChunkedCustomSiloOutstandingIdentifiers-BT-GZpT1.mjs.map +1 -0
- package/dist/pullConsentManagerMetrics-FnhPEszu.mjs +2 -0
- package/dist/pullConsentManagerMetrics-FnhPEszu.mjs.map +1 -0
- package/dist/pullManualEnrichmentIdentifiersToCsv-B_4REnga.mjs +2 -0
- package/dist/pullManualEnrichmentIdentifiersToCsv-B_4REnga.mjs.map +1 -0
- package/dist/pullTranscendConfiguration-CqsgEf9A.mjs +80 -0
- package/dist/pullTranscendConfiguration-CqsgEf9A.mjs.map +1 -0
- package/dist/pullUnstructuredSubDataPointRecommendations-DZd2q6S2.mjs +38 -0
- package/dist/pullUnstructuredSubDataPointRecommendations-DZd2q6S2.mjs.map +1 -0
- package/dist/pushCronIdentifiersFromCsv-D2saGR5i.mjs +2 -0
- package/dist/pushCronIdentifiersFromCsv-D2saGR5i.mjs.map +1 -0
- package/dist/pushManualEnrichmentIdentifiersFromCsv-DOvAzMyt.mjs +2 -0
- package/dist/pushManualEnrichmentIdentifiersFromCsv-DOvAzMyt.mjs.map +1 -0
- package/dist/readCsv-CyOL7eCc.mjs +2 -0
- package/dist/readCsv-CyOL7eCc.mjs.map +1 -0
- package/dist/{readTranscendYaml-DhKG1ViI.mjs → readTranscendYaml-D-J1ilS0.mjs} +2 -2
- package/dist/readTranscendYaml-D-J1ilS0.mjs.map +1 -0
- package/dist/removeUnverifiedRequestIdentifiers-ChlwRmhd.mjs +35 -0
- package/dist/removeUnverifiedRequestIdentifiers-ChlwRmhd.mjs.map +1 -0
- package/dist/request-CAsR6CMY.mjs +117 -0
- package/dist/request-CAsR6CMY.mjs.map +1 -0
- package/dist/retryRequestDataSilos-DnwXA1YZ.mjs +2 -0
- package/dist/retryRequestDataSilos-DnwXA1YZ.mjs.map +1 -0
- package/dist/skipPreflightJobs-jK5lNlmv.mjs +2 -0
- package/dist/skipPreflightJobs-jK5lNlmv.mjs.map +1 -0
- package/dist/skipRequestDataSilos-DQGroOos.mjs +2 -0
- package/dist/skipRequestDataSilos-DQGroOos.mjs.map +1 -0
- package/dist/splitCsvToList-BRq_CIfd.mjs +2 -0
- package/dist/splitCsvToList-BRq_CIfd.mjs.map +1 -0
- package/dist/streamPrivacyRequestsToCsv-BK07Bm-T.mjs +2 -0
- package/dist/streamPrivacyRequestsToCsv-BK07Bm-T.mjs.map +1 -0
- package/dist/syncCodePackages-F-97FNjo.mjs +232 -0
- package/dist/syncCodePackages-F-97FNjo.mjs.map +1 -0
- package/dist/syncCookies-BxY36BeJ.mjs +2 -0
- package/dist/syncCookies-BxY36BeJ.mjs.map +1 -0
- package/dist/syncDataFlows-Cx5LZCen.mjs +2 -0
- package/dist/syncDataFlows-Cx5LZCen.mjs.map +1 -0
- package/dist/syncTemplates-BrH7Yr0V.mjs +23 -0
- package/dist/syncTemplates-BrH7Yr0V.mjs.map +1 -0
- package/dist/time-Bl_c3W8U.mjs +2 -0
- package/dist/time-Bl_c3W8U.mjs.map +1 -0
- package/dist/types-B4CVJCpj.mjs +2 -0
- package/dist/types-B4CVJCpj.mjs.map +1 -0
- package/dist/updateConsentManagerVersionToLatest-C221vAAw.mjs +2 -0
- package/dist/updateConsentManagerVersionToLatest-C221vAAw.mjs.map +1 -0
- package/dist/uploadConsents-BbR7_sSt.mjs +2 -0
- package/dist/uploadConsents-BbR7_sSt.mjs.map +1 -0
- package/dist/uploadCookiesFromCsv-roHWekOP.mjs +2 -0
- package/dist/uploadCookiesFromCsv-roHWekOP.mjs.map +1 -0
- package/dist/uploadDataFlowsFromCsv-DcTbrsv2.mjs +2 -0
- package/dist/uploadDataFlowsFromCsv-DcTbrsv2.mjs.map +1 -0
- package/dist/uploadPrivacyRequestsFromCsv-BUGTS-pY.mjs +17 -0
- package/dist/uploadPrivacyRequestsFromCsv-BUGTS-pY.mjs.map +1 -0
- package/dist/uploadSiloDiscoveryResults-D2fK92WR.mjs +20 -0
- package/dist/uploadSiloDiscoveryResults-D2fK92WR.mjs.map +1 -0
- package/dist/validateTranscendAuth-1W1IylqE.mjs +2 -0
- package/dist/validateTranscendAuth-1W1IylqE.mjs.map +1 -0
- package/dist/withPreferenceRetry-xLMZyTq9.mjs +2 -0
- package/dist/withPreferenceRetry-xLMZyTq9.mjs.map +1 -0
- package/dist/writeCsv-B51ulrVl.mjs +6 -0
- package/dist/writeCsv-B51ulrVl.mjs.map +1 -0
- package/package.json +37 -56
- package/dist/api-keys-CxvKdj2v.mjs +0 -2
- package/dist/api-keys-CxvKdj2v.mjs.map +0 -1
- package/dist/app-BKMxG7RO.mjs +0 -131
- package/dist/app-BKMxG7RO.mjs.map +0 -1
- package/dist/buildAIIntegrationType-Bk0EbFKV.mjs +0 -2
- package/dist/buildAIIntegrationType-Bk0EbFKV.mjs.map +0 -1
- package/dist/code-scanning-Cx1kpssH.mjs +0 -4
- package/dist/code-scanning-Cx1kpssH.mjs.map +0 -1
- package/dist/codecs-TR6p48v3.mjs +0 -2
- package/dist/codecs-TR6p48v3.mjs.map +0 -1
- package/dist/command-Bzyj3M2G.mjs.map +0 -1
- package/dist/consent-manager-c4bgQF1N.mjs +0 -12
- package/dist/consent-manager-c4bgQF1N.mjs.map +0 -1
- package/dist/constants-CnLQtIBn.mjs +0 -2
- package/dist/constants-CnLQtIBn.mjs.map +0 -1
- package/dist/context-bkKpii_t.mjs.map +0 -1
- package/dist/cron-BvxWyvDu.mjs +0 -2
- package/dist/cron-BvxWyvDu.mjs.map +0 -1
- package/dist/data-inventory-CkS_kmus.mjs +0 -75
- package/dist/data-inventory-CkS_kmus.mjs.map +0 -1
- package/dist/dataFlowsToDataSilos-RAhfPV0l.mjs.map +0 -1
- package/dist/impl-8dOatHnF.mjs +0 -2
- package/dist/impl-8dOatHnF.mjs.map +0 -1
- package/dist/impl-Ah-1lwzr.mjs +0 -2
- package/dist/impl-Ah-1lwzr.mjs.map +0 -1
- package/dist/impl-B5lTeRbn.mjs +0 -2
- package/dist/impl-B5lTeRbn.mjs.map +0 -1
- package/dist/impl-B6UhzQcY2.mjs +0 -2
- package/dist/impl-B6UhzQcY2.mjs.map +0 -1
- package/dist/impl-BFf_CotE2.mjs +0 -2
- package/dist/impl-BFf_CotE2.mjs.map +0 -1
- package/dist/impl-BGQ0EGS0.mjs +0 -2
- package/dist/impl-BGQ0EGS0.mjs.map +0 -1
- package/dist/impl-BYBNi68b.mjs.map +0 -1
- package/dist/impl-B__p3_wC.mjs +0 -2
- package/dist/impl-B__p3_wC.mjs.map +0 -1
- package/dist/impl-BcayRe6a.mjs +0 -2
- package/dist/impl-BcayRe6a.mjs.map +0 -1
- package/dist/impl-BkYKsEVG2.mjs +0 -2
- package/dist/impl-BkYKsEVG2.mjs.map +0 -1
- package/dist/impl-Bl2yVgh0.mjs +0 -4
- package/dist/impl-Bl2yVgh0.mjs.map +0 -1
- package/dist/impl-BmAMgEEM.mjs +0 -12
- package/dist/impl-BmAMgEEM.mjs.map +0 -1
- package/dist/impl-BsttzxTN2.mjs +0 -2
- package/dist/impl-BsttzxTN2.mjs.map +0 -1
- package/dist/impl-BtnySmbi.mjs +0 -2
- package/dist/impl-BtnySmbi.mjs.map +0 -1
- package/dist/impl-BwX-evfW2.mjs +0 -4
- package/dist/impl-BwX-evfW2.mjs.map +0 -1
- package/dist/impl-C-wzeAib2.mjs +0 -2
- package/dist/impl-C-wzeAib2.mjs.map +0 -1
- package/dist/impl-C61PYfk12.mjs +0 -2
- package/dist/impl-C61PYfk12.mjs.map +0 -1
- package/dist/impl-CAuNpuF2.mjs +0 -2
- package/dist/impl-CAuNpuF2.mjs.map +0 -1
- package/dist/impl-CSKrBIuV.mjs +0 -2
- package/dist/impl-CSKrBIuV.mjs.map +0 -1
- package/dist/impl-CZP2l3Ds.mjs.map +0 -1
- package/dist/impl-CiJ8hE5W2.mjs +0 -2
- package/dist/impl-CiJ8hE5W2.mjs.map +0 -1
- package/dist/impl-Cj3H-m2Z.mjs +0 -2
- package/dist/impl-Cj3H-m2Z.mjs.map +0 -1
- package/dist/impl-CkY0wfCz.mjs +0 -2
- package/dist/impl-CkY0wfCz.mjs.map +0 -1
- package/dist/impl-Cm8pUfBU2.mjs +0 -2
- package/dist/impl-Cm8pUfBU2.mjs.map +0 -1
- package/dist/impl-CpzS9LVu2.mjs +0 -2
- package/dist/impl-CpzS9LVu2.mjs.map +0 -1
- package/dist/impl-CwfamZ1c.mjs +0 -2
- package/dist/impl-CwfamZ1c.mjs.map +0 -1
- package/dist/impl-D81et1Yb2.mjs +0 -2
- package/dist/impl-D81et1Yb2.mjs.map +0 -1
- package/dist/impl-D92PTNk3.mjs +0 -2
- package/dist/impl-D92PTNk3.mjs.map +0 -1
- package/dist/impl-DTXDVeo6.mjs +0 -2
- package/dist/impl-DTXDVeo6.mjs.map +0 -1
- package/dist/impl-DWoysXup.mjs +0 -2
- package/dist/impl-DWoysXup.mjs.map +0 -1
- package/dist/impl-DX3JHZ4v2.mjs +0 -2
- package/dist/impl-DX3JHZ4v2.mjs.map +0 -1
- package/dist/impl-DhuUrzxQ.mjs +0 -2
- package/dist/impl-DhuUrzxQ.mjs.map +0 -1
- package/dist/impl-DqMYLKjU.mjs +0 -2
- package/dist/impl-DqMYLKjU.mjs.map +0 -1
- package/dist/impl-DqQ6CIj0.mjs +0 -2
- package/dist/impl-DqQ6CIj0.mjs.map +0 -1
- package/dist/impl-Duaq6iWI2.mjs +0 -2
- package/dist/impl-Duaq6iWI2.mjs.map +0 -1
- package/dist/impl-O5gz8qcm.mjs +0 -2
- package/dist/impl-O5gz8qcm.mjs.map +0 -1
- package/dist/impl-PH0AoC7i.mjs +0 -2
- package/dist/impl-PH0AoC7i.mjs.map +0 -1
- package/dist/impl-S8p6toVb2.mjs +0 -2
- package/dist/impl-S8p6toVb2.mjs.map +0 -1
- package/dist/impl-X2MSb8Ij.mjs +0 -2
- package/dist/impl-X2MSb8Ij.mjs.map +0 -1
- package/dist/impl-bo95wZIU2.mjs +0 -2
- package/dist/impl-bo95wZIU2.mjs.map +0 -1
- package/dist/impl-cfdCesro.mjs +0 -2
- package/dist/impl-cfdCesro.mjs.map +0 -1
- package/dist/impl-iZoXu4nV.mjs +0 -2
- package/dist/impl-iZoXu4nV.mjs.map +0 -1
- package/dist/impl-lebl6Zek2.mjs +0 -2
- package/dist/impl-lebl6Zek2.mjs.map +0 -1
- package/dist/impl-p0YN9e2e.mjs +0 -2
- package/dist/impl-p0YN9e2e.mjs.map +0 -1
- package/dist/manual-enrichment-B6lW5kAX.mjs +0 -2
- package/dist/manual-enrichment-B6lW5kAX.mjs.map +0 -1
- package/dist/mergeTranscendInputs-Coj_e2N3.mjs +0 -2
- package/dist/mergeTranscendInputs-Coj_e2N3.mjs.map +0 -1
- package/dist/pooling-CazydwlD.mjs.map +0 -1
- package/dist/preference-management-8gj7aSJB.mjs +0 -7
- package/dist/preference-management-8gj7aSJB.mjs.map +0 -1
- package/dist/readTranscendYaml-DhKG1ViI.mjs.map +0 -1
- package/dist/syncConfigurationToTranscend-VJd0PnaZ.mjs +0 -3010
- package/dist/syncConfigurationToTranscend-VJd0PnaZ.mjs.map +0 -1
- package/dist/uploadConsents-C1S-BNzw.mjs +0 -2
- package/dist/uploadConsents-C1S-BNzw.mjs.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"data-inventory-CkS_kmus.mjs","names":[],"sources":["../src/lib/data-inventory/pullAllDatapoints.ts","../src/lib/data-inventory/pullUnstructuredSubDataPointRecommendations.ts"],"sourcesContent":["/* eslint-disable max-lines */\nimport { keyBy, uniq, chunk, sortBy } from 'lodash-es';\nimport {\n type DataCategoryType,\n SubDataPointDataSubCategoryGuessStatus,\n} from '@transcend-io/privacy-types';\nimport cliProgress from 'cli-progress';\nimport { gql } from 'graphql-request';\nimport colors from 'colors';\nimport type { GraphQLClient } from 'graphql-request';\nimport {\n DATAPOINT_EXPORT,\n DATA_SILO_EXPORT,\n type DataSiloAttributeValue,\n SUB_DATA_POINTS_COUNT,\n makeGraphQLRequest,\n} from '../graphql';\nimport { logger } from '../../logger';\nimport type { DataCategoryInput, ProcessingPurposeInput } from '../../codecs';\nimport { mapSeries } from '../bluebird';\n\nexport interface DataSiloCsvPreview {\n /** ID of dataSilo */\n id: string;\n /** Name of dataSilo */\n title: string;\n}\n\nexport interface DataPointCsvPreview {\n /** ID of dataPoint */\n id: string;\n /** The path to this data point */\n path: string[];\n /** Description */\n description: {\n /** Default message */\n defaultMessage: string;\n };\n /** Name */\n name: string;\n}\n\nexport interface SubDataPointCsvPreview {\n /** ID of subDatapoint */\n id: string;\n /** Name (or key) of the subdatapoint */\n name: string;\n /** The description */\n description?: string;\n /** Personal data category */\n categories: DataCategoryInput[];\n /** Data point ID */\n dataPointId: string;\n /** The data silo ID */\n dataSiloId: string;\n /** The processing purpose for this sub datapoint */\n purposes: ProcessingPurposeInput[];\n /** Attribute attached to subdatapoint */\n attributeValues?: DataSiloAttributeValue[];\n /** Data category guesses that are output by the classifier */\n pendingCategoryGuesses?: {\n /** Data category being guessed */\n category: DataCategoryInput;\n /** Status of guess */\n status: SubDataPointDataSubCategoryGuessStatus;\n /** classifier version that produced the guess */\n classifierVersion: number;\n }[];\n}\n\nexport interface DatapointFilterOptions {\n /** IDs of data silos to filter down */\n dataSiloIds?: string[];\n /** Whether to include guessed categories, defaults to only approved categories */\n includeGuessedCategories?: boolean;\n /** Whether or not to include attributes */\n includeAttributes?: boolean;\n /** Parent categories to filter down for */\n parentCategories?: DataCategoryType[];\n /** Sub categories to filter down for */\n subCategories?: string[]; // TODO: https://transcend.height.app/T-40482 - do by name not ID\n}\n\n/**\n * Pull subdatapoint information\n *\n * @param client - Client to use for the request\n * @param options - Options\n * @returns The subdatapoints\n */\nasync function pullSubDatapoints(\n client: GraphQLClient,\n {\n dataSiloIds = [],\n includeGuessedCategories,\n includeAttributes,\n parentCategories = [],\n subCategories = [],\n pageSize = 1000,\n }: DatapointFilterOptions & {\n /** Page size to pull in */\n pageSize?: number;\n } = {},\n): Promise<SubDataPointCsvPreview[]> {\n const subDataPoints: SubDataPointCsvPreview[] = [];\n\n // Time duration\n const t0 = new Date().getTime();\n\n // create a new progress bar instance and use shades_classic theme\n const progressBar = new cliProgress.SingleBar(\n {},\n cliProgress.Presets.shades_classic,\n );\n\n // Filters\n const filterBy = {\n ...(parentCategories.length > 0 ? { category: parentCategories } : {}),\n ...(subCategories.length > 0 ? { subCategoryIds: subCategories } : {}),\n // if parentCategories or subCategories and not includeGuessedCategories\n ...(parentCategories.length + subCategories.length > 0 &&\n !includeGuessedCategories\n ? // then only show data points with approved data categories\n { status: SubDataPointDataSubCategoryGuessStatus.Approved }\n : {}),\n ...(dataSiloIds.length > 0 ? { dataSilos: dataSiloIds } : {}),\n };\n\n // Build a GraphQL client\n const {\n subDataPoints: { totalCount },\n } = await makeGraphQLRequest<{\n /** Query response */\n subDataPoints: {\n /** Count */\n totalCount: number;\n };\n }>(client, SUB_DATA_POINTS_COUNT, {\n filterBy,\n });\n\n logger.info(colors.magenta('[Step 1/3] Pulling in all subdatapoints'));\n\n progressBar.start(totalCount, 0);\n let total = 0;\n let shouldContinue = false;\n let cursor: string | undefined;\n let offset = 0;\n do {\n try {\n const {\n subDataPoints: { nodes },\n } = await makeGraphQLRequest<{\n /** Query response */\n subDataPoints: {\n /** List of matches */\n nodes: SubDataPointCsvPreview[];\n };\n }>(\n client,\n gql`\n query TranscendCliSubDataPointCsvExport(\n $filterBy: SubDataPointFiltersInput\n $first: Int!\n $offset: Int!\n ) {\n subDataPoints(\n filterBy: $filterBy\n first: $first\n offset: $offset\n useMaster: false\n ) {\n nodes {\n id\n name\n description\n dataPointId\n dataSiloId\n purposes {\n name\n purpose\n }\n categories {\n name\n category\n }\n ${\n includeGuessedCategories\n ? `pendingCategoryGuesses {\n category {\n name\n category\n }\n status\n classifierVersion\n }`\n : ''\n }\n ${\n includeAttributes\n ? `attributeValues {\n attributeKey {\n name\n }\n name\n }`\n : ''\n }\n }\n }\n }\n `,\n {\n first: pageSize,\n offset,\n filterBy: {\n ...filterBy,\n // TODO: https://transcend.height.app/T-40484 - add cursor support\n // ...(cursor ? { cursor: { id: cursor } } : {}),\n },\n },\n );\n\n cursor = nodes[nodes.length - 1]?.id as string;\n subDataPoints.push(...nodes);\n shouldContinue = nodes.length === pageSize;\n total += nodes.length;\n offset += nodes.length;\n progressBar.update(total);\n } catch (err) {\n logger.error(\n colors.red(\n `An error fetching subdatapoints for cursor ${cursor} and offset ${offset}`,\n ),\n );\n throw err;\n }\n } while (shouldContinue);\n\n progressBar.stop();\n const t1 = new Date().getTime();\n const totalTime = t1 - t0;\n\n const sorted = sortBy(subDataPoints, 'name');\n\n logger.info(\n colors.green(\n `Successfully pulled in ${sorted.length} subdatapoints in ${\n totalTime / 1000\n } seconds!`,\n ),\n );\n return sorted;\n}\n\n/**\n * Pull datapoint information\n *\n * @param client - Client to use for the request\n * @param options - Options\n * @returns The datapoints\n */\nasync function pullDatapoints(\n client: GraphQLClient,\n {\n dataPointIds = [],\n pageSize = 100,\n }: {\n /** IDs of data points to filter down */\n dataPointIds: string[];\n /** Page size to pull in */\n pageSize?: number;\n },\n): Promise<DataPointCsvPreview[]> {\n const dataPoints: DataPointCsvPreview[] = [];\n\n // Time duration\n const t0 = new Date().getTime();\n\n // create a new progress bar instance and use shades_classic theme\n const progressBar = new cliProgress.SingleBar(\n {},\n cliProgress.Presets.shades_classic,\n );\n\n logger.info(\n colors.magenta(\n `[Step 2/3] Fetching metadata for ${dataPointIds.length} datapoints`,\n ),\n );\n\n // Group by 100\n const dataPointsGrouped = chunk(dataPointIds, pageSize);\n\n progressBar.start(dataPointIds.length, 0);\n let total = 0;\n await mapSeries(dataPointsGrouped, async (dataPointIdsGroup) => {\n try {\n const {\n dataPoints: { nodes },\n } = await makeGraphQLRequest<{\n /** Query response */\n dataPoints: {\n /** List of matches */\n nodes: DataPointCsvPreview[];\n };\n }>(client, DATAPOINT_EXPORT, {\n first: pageSize,\n filterBy: {\n ids: dataPointIdsGroup,\n },\n });\n\n dataPoints.push(...nodes);\n total += dataPointIdsGroup.length;\n progressBar.update(total);\n } catch (err) {\n logger.error(\n colors.red(\n `An error fetching subdatapoints for IDs ${dataPointIdsGroup.join(\n ', ',\n )}`,\n ),\n );\n throw err;\n }\n });\n\n progressBar.stop();\n const t1 = new Date().getTime();\n const totalTime = t1 - t0;\n\n logger.info(\n colors.green(\n `Successfully pulled in ${dataPoints.length} dataPoints in ${\n totalTime / 1000\n } seconds!`,\n ),\n );\n return dataPoints;\n}\n\n/**\n * Pull data silo information\n *\n * @param client - Client to use for the request\n * @param options - Options\n * @returns The data silos\n */\nasync function pullDataSilos(\n client: GraphQLClient,\n {\n dataSiloIds = [],\n pageSize = 100,\n }: {\n /** IDs of data silos to filter down */\n dataSiloIds: string[];\n /** Page size to pull in */\n pageSize?: number;\n },\n): Promise<DataSiloCsvPreview[]> {\n const dataSilos: DataSiloCsvPreview[] = [];\n\n // Time duration\n const t0 = new Date().getTime();\n\n // create a new progress bar instance and use shades_classic theme\n const progressBar = new cliProgress.SingleBar(\n {},\n cliProgress.Presets.shades_classic,\n );\n\n logger.info(\n colors.magenta(\n `[Step 3/3] Fetching metadata for ${dataSiloIds.length} data silos`,\n ),\n );\n\n // Group by 100\n const dataSilosGrouped = chunk(dataSiloIds, pageSize);\n\n progressBar.start(dataSiloIds.length, 0);\n let total = 0;\n await mapSeries(dataSilosGrouped, async (dataSiloIdsGroup) => {\n try {\n const {\n dataSilos: { nodes },\n } = await makeGraphQLRequest<{\n /** Query response */\n dataSilos: {\n /** List of matches */\n nodes: DataSiloCsvPreview[];\n };\n }>(client, DATA_SILO_EXPORT, {\n first: pageSize,\n filterBy: {\n ids: dataSiloIdsGroup,\n },\n });\n\n dataSilos.push(...nodes);\n total += dataSiloIdsGroup.length;\n progressBar.update(total);\n } catch (err) {\n logger.error(\n colors.red(\n `An error fetching data silos for IDs ${dataSiloIdsGroup.join(', ')}`,\n ),\n );\n throw err;\n }\n });\n\n progressBar.stop();\n const t1 = new Date().getTime();\n const totalTime = t1 - t0;\n\n logger.info(\n colors.green(\n `Successfully pulled in ${dataSilos.length} data silos in ${\n totalTime / 1000\n } seconds!`,\n ),\n );\n return dataSilos;\n}\n\n/**\n * Pull all datapoints from the data inventory.\n *\n * @param client - Client to use for the request\n * @param options - Options\n * @returns The datapoints and data silos\n */\nexport async function pullAllDatapoints(\n client: GraphQLClient,\n {\n dataSiloIds = [],\n includeGuessedCategories,\n includeAttributes,\n parentCategories = [],\n subCategories = [],\n pageSize = 1000,\n }: DatapointFilterOptions & {\n /** Page size to pull in */\n pageSize?: number;\n } = {},\n): Promise<\n (SubDataPointCsvPreview & {\n /** Data point information */\n dataPoint: DataPointCsvPreview;\n /** Data silo information */\n dataSilo: DataSiloCsvPreview;\n })[]\n> {\n // Subdatapoint information\n const subDatapoints = await pullSubDatapoints(client, {\n dataSiloIds,\n includeGuessedCategories,\n includeAttributes,\n parentCategories,\n subCategories,\n pageSize,\n });\n\n // The datapoint ids to grab\n const dataPointIds = uniq(subDatapoints.map((point) => point.dataPointId));\n const dataPoints = await pullDatapoints(client, {\n dataPointIds,\n });\n const dataPointById = keyBy(dataPoints, 'id');\n\n // The data silo IDs to grab\n const allDataSiloIds = uniq(subDatapoints.map((point) => point.dataSiloId));\n const dataSilos = await pullDataSilos(client, {\n dataSiloIds: allDataSiloIds,\n });\n const dataSiloById = keyBy(dataSilos, 'id');\n\n return subDatapoints.map((subDataPoint) => ({\n ...subDataPoint,\n dataPoint: dataPointById[subDataPoint.dataPointId],\n dataSilo: dataSiloById[subDataPoint.dataSiloId],\n }));\n}\n/* eslint-enable max-lines */\n","import type { UnstructuredSubDataPointRecommendationStatus } from '@transcend-io/privacy-types';\nimport cliProgress from 'cli-progress';\nimport colors from 'colors';\nimport { gql, type GraphQLClient } from 'graphql-request';\nimport { sortBy } from 'lodash-es';\nimport type { DataCategoryInput } from '../../codecs';\nimport { ENTRY_COUNT, makeGraphQLRequest } from '../graphql';\nimport { logger } from '../../logger';\n\ninterface UnstructuredSubDataPointRecommendationCsvPreview {\n /** ID of subDatapoint */\n id: string;\n /** Entry or Named Entity recognized by the classifier */\n name: string;\n /** Context snippet including entry */\n contextSnippet: string;\n /** Scanned object ID */\n scannedObjectId: string;\n /** Scanned object path ID */\n scannedObjectPathId: string;\n /** The data silo ID */\n dataSiloId: string;\n /** Personal data category */\n dataSubCategory: DataCategoryInput;\n /** Classification Status */\n status: UnstructuredSubDataPointRecommendationStatus;\n /** Confidence */\n confidence: number;\n /** Classification method */\n classificationMethod: string;\n /** Classifier version */\n classifierVersion: string;\n}\n\ninterface EntryFilterOptions {\n /** IDs of data silos to filter down */\n dataSiloIds?: string[];\n /** Parent categories to filter down for */\n status?: UnstructuredSubDataPointRecommendationStatus[];\n /** Sub categories to filter down for */\n subCategories?: string[]; // TODO: https://transcend.height.app/T-40482 - do by name not ID\n /** Include entry and snippet */\n includeEncryptedSnippets?: boolean;\n /** Include encryptedSamplesS3Key */\n includeEncryptedSamplesS3Key?: boolean;\n}\n/**\n * Pull unstructured subdatapoint information\n *\n * @param client - Client to use for the request\n * @param options - Options\n * @param options.dataSiloIds - IDs of data silos to filter down\n * @param options.status - Parent categories to filter down for\n * @param options.subCategories - Sub categories to filter down for\n * @param options.includeEncryptedSnippets - Include entry and snippet\n * @param options.includeEncryptedSamplesS3Key - Include encryptedSamplesS3Key\n * @param options.pageSize - Page size to pull in\n * @returns A promise that resolves to an array of unstructured subdatapoint recommendations\n */\nexport async function pullUnstructuredSubDataPointRecommendations(\n client: GraphQLClient,\n {\n dataSiloIds = [],\n status,\n subCategories = [],\n includeEncryptedSnippets,\n pageSize = 100,\n }: EntryFilterOptions & {\n /** Page size to pull in */\n pageSize?: number;\n } = {},\n): Promise<UnstructuredSubDataPointRecommendationCsvPreview[]> {\n const unstructuredSubDataPointRecommendations: UnstructuredSubDataPointRecommendationCsvPreview[] =\n [];\n\n // Time duration\n const t0 = new Date().getTime();\n\n // create a new progress bar instance and use shades_classic theme\n const progressBar = new cliProgress.SingleBar(\n {},\n cliProgress.Presets.shades_classic,\n );\n\n // Filters\n const filterBy = {\n ...(subCategories.length > 0 ? { subCategoryIds: subCategories } : {}),\n ...(status ? { status } : {}),\n ...(dataSiloIds.length > 0 ? { dataSilos: dataSiloIds } : {}),\n };\n\n // Build a GraphQL client\n const {\n unstructuredSubDataPointRecommendations: { totalCount },\n } = await makeGraphQLRequest<{\n /** Query response */\n unstructuredSubDataPointRecommendations: {\n /** Count */\n totalCount: number;\n };\n }>(client, ENTRY_COUNT, {\n filterBy,\n });\n\n logger.info(colors.magenta('[Step 1/3] Pulling in all subdatapoints'));\n\n progressBar.start(totalCount, 0);\n let total = 0;\n let shouldContinue = false;\n let cursor: string | undefined;\n let offset = 0;\n do {\n try {\n const {\n unstructuredSubDataPointRecommendations: { nodes },\n } = await makeGraphQLRequest<{\n /** Query response */\n unstructuredSubDataPointRecommendations: {\n /** List of matches */\n nodes: UnstructuredSubDataPointRecommendationCsvPreview[];\n };\n }>(\n client,\n gql`\n query TranscendCliUnstructuredSubDataPointRecommendationCsvExport(\n $filterBy: UnstructuredSubDataPointRecommendationsFilterInput\n $first: Int!\n $offset: Int!\n ) {\n unstructuredSubDataPointRecommendations(\n filterBy: $filterBy\n first: $first\n offset: $offset\n useMaster: false\n ) {\n nodes {\n id\n dataSiloId\n scannedObjectPathId\n scannedObjectId\n ${includeEncryptedSnippets ? 'name' : ''}\n ${includeEncryptedSnippets ? 'contextSnippet' : ''}\n dataSubCategory {\n name\n category\n }\n status\n confidence\n classificationMethod\n classifierVersion\n }\n }\n }\n `,\n {\n first: pageSize,\n offset,\n filterBy: {\n ...filterBy,\n },\n },\n );\n\n cursor = nodes[nodes.length - 1]?.id as string;\n unstructuredSubDataPointRecommendations.push(...nodes);\n shouldContinue = nodes.length === pageSize;\n total += nodes.length;\n offset += nodes.length;\n progressBar.update(total);\n } catch (err) {\n logger.error(\n colors.red(\n `An error fetching subdatapoints for cursor ${cursor} and offset ${offset}`,\n ),\n );\n throw err;\n }\n } while (shouldContinue);\n\n progressBar.stop();\n const t1 = new Date().getTime();\n const totalTime = t1 - t0;\n\n const sorted = sortBy(unstructuredSubDataPointRecommendations, 'name');\n\n logger.info(\n colors.green(\n `Successfully pulled in ${sorted.length} subdatapoints in ${\n totalTime / 1000\n } seconds!`,\n ),\n );\n return sorted;\n}\n"],"mappings":"kYA0FA,eAAe,EACb,EACA,CACE,cAAc,EAAE,CAChB,2BACA,oBACA,mBAAmB,EAAE,CACrB,gBAAgB,EAAE,CAClB,WAAW,KAIT,EAAE,CAC6B,CACnC,IAAM,EAA0C,EAAE,CAG5C,EAAK,IAAI,MAAM,CAAC,SAAS,CAGzB,EAAc,IAAI,EAAY,UACl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EAAE,CAC5B,GAAI,EAAY,OAAS,EAAI,CAAE,UAAW,EAAa,CAAG,EAAE,CAC7D,CAGK,CACJ,wCAAyC,CAAE,eACzC,MAAM,EAMP,EAAQ,EAAa,CACtB,WACD,CAAC,CAEF,EAAO,KAAK,EAAO,QAAQ,0CAA0C,CAAC,CAEtE,EAAY,MAAM,EAAY,EAAE,CAChC,IAAI,EAAQ,EACR,EAAiB,GACjB,EACA,EAAS,EACb,EACE,IAAI,CACF,GAAM,CACJ,wCAAyC,CAAE,UACzC,MAAM,EAOR,EACA,CAAG;;;;;;;;;;;;;;;;;kBAiBO,EAA2B,OAAS,GAAG;kBACvC,EAA2B,iBAAmB,GAAG;;;;;;;;;;;;UAa3D,CACE,MAAO,EACP,SACA,SAAU,CACR,GAAG,EACJ,CACF,CACF,CAED,EAAS,EAAM,EAAM,OAAS,IAAI,GAClC,EAAwC,KAAK,GAAG,EAAM,CACtD,EAAiB,EAAM,SAAW,EAClC,GAAS,EAAM,OACf,GAAU,EAAM,OAChB,EAAY,OAAO,EAAM,OAClB,EAAK,CAMZ,MALA,EAAO,MACL,EAAO,IACL,8CAA8C,EAAO,cAAc,IACpE,CACF,CACK,QAED,GAET,EAAY,MAAM,CAElB,IAAM,EADK,IAAI,MAAM,CAAC,SAAS,CACR,EAEjB,EAAS,EAAO,EAAyC,OAAO,CAStE,OAPA,EAAO,KACL,EAAO,MACL,0BAA0B,EAAO,OAAO,oBACtC,EAAY,IACb,WACF,CACF,CACM"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dataFlowsToDataSilos-RAhfPV0l.mjs","names":[],"sources":["../src/lib/consent-manager/dataFlowsToDataSilos.ts"],"sourcesContent":["import { DataFlowInput, DataSiloInput } from '../../codecs';\nimport { union } from 'lodash-es';\nimport { IndexedCatalogs } from '../graphql';\n\n/**\n * Convert data flow configurations into a set of data silo configurations\n *\n * @param inputs - Data flow input to convert to data silos\n * @param options - Additional options\n * @returns Business entity configuration input\n */\nexport function dataFlowsToDataSilos(\n inputs: DataFlowInput[],\n {\n adTechPurposes = ['SaleOfInfo'],\n serviceToTitle,\n serviceToSupportedIntegration,\n }: IndexedCatalogs & {\n /** List of purposes that are considered \"Ad Tech\" */\n adTechPurposes?: string[];\n },\n): {\n /** List of data silo configurations for site-tech services */\n siteTechDataSilos: DataSiloInput[];\n /** List of data silo configurations for ad-tech services */\n adTechDataSilos: DataSiloInput[];\n} {\n // List of site tech integrations\n let siteTechIntegrations: string[] = [];\n\n // List of ad tech integrations\n const adTechIntegrations: string[] = [];\n\n // Mapping from service name to list of\n const serviceToFoundOnDomain: { [k in string]: string[] } = {};\n\n // iterate over each flow\n inputs.forEach((flow) => {\n // process data flows with services\n const { service, attributes = [] } = flow;\n if (!service || service === 'internalService') {\n return;\n }\n\n // create mapping to found on domain\n const foundOnDomain = attributes.find(\n (attr) => attr.key === 'Found on Domain',\n );\n\n // Create a list of all domains where the data flow was found\n if (foundOnDomain) {\n if (!serviceToFoundOnDomain[service]) {\n serviceToFoundOnDomain[service] = [];\n }\n serviceToFoundOnDomain[service]!.push(\n ...foundOnDomain.values.map((v) =>\n v.replace('https://', '').replace('http://', ''),\n ),\n );\n serviceToFoundOnDomain[service] = [\n ...new Set(serviceToFoundOnDomain[service]),\n ];\n }\n\n // Keep track of ad tech\n if (union(flow.trackingPurposes, adTechPurposes).length > 0) {\n // add service to ad tech list\n adTechIntegrations.push(service);\n\n // remove from site tech list\n if (siteTechIntegrations.includes(service)) {\n siteTechIntegrations = siteTechIntegrations.filter(\n (s) => s !== service,\n );\n }\n } else if (!adTechIntegrations.includes(service)) {\n // add to site tech list\n siteTechIntegrations.push(service);\n }\n });\n\n // create the list of ad tech integrations\n const adTechDataSilos = [...new Set(adTechIntegrations)].map((service) => ({\n title: serviceToTitle[service],\n ...(serviceToSupportedIntegration[service]\n ? { integrationName: service }\n : { integrationName: 'promptAPerson', 'outer-type': service }),\n attributes: [\n {\n key: 'Tech Type',\n values: ['Ad Tech'],\n },\n {\n key: 'Found On Domain',\n values: serviceToFoundOnDomain[service] || [],\n },\n ],\n }));\n\n // create the list of site tech integrations\n const siteTechDataSilos = [...new Set(siteTechIntegrations)].map(\n (service) => ({\n title: serviceToTitle[service],\n ...(serviceToSupportedIntegration[service]\n ? { integrationName: service }\n : { integrationName: 'promptAPerson', outerType: service }),\n attributes: [\n {\n key: 'Tech Type',\n values: ['Site Tech'],\n },\n {\n key: 'Found On Domain',\n values: serviceToFoundOnDomain[service] || [],\n },\n ],\n }),\n );\n\n return {\n siteTechDataSilos,\n adTechDataSilos,\n };\n}\n"],"mappings":"kCAWA,SAAgB,EACd,EACA,CACE,iBAAiB,CAAC,aAAa,CAC/B,iBACA,iCAUF,CAEA,IAAI,EAAiC,EAAE,CAGjC,EAA+B,EAAE,CAGjC,EAAsD,EAAE,CAG9D,EAAO,QAAS,GAAS,CAEvB,GAAM,CAAE,UAAS,aAAa,EAAE,EAAK,EACrC,GAAI,CAAC,GAAW,IAAY,kBAC1B,OAIF,IAAM,EAAgB,EAAW,KAC9B,GAAS,EAAK,MAAQ,kBACxB,CAGG,IACG,EAAuB,KAC1B,EAAuB,GAAW,EAAE,EAEtC,EAAuB,GAAU,KAC/B,GAAG,EAAc,OAAO,IAAK,GAC3B,EAAE,QAAQ,WAAY,GAAG,CAAC,QAAQ,UAAW,GAAG,CACjD,CACF,CACD,EAAuB,GAAW,CAChC,GAAG,IAAI,IAAI,EAAuB,GAAS,CAC5C,EAIC,EAAM,EAAK,iBAAkB,EAAe,CAAC,OAAS,GAExD,EAAmB,KAAK,EAAQ,CAG5B,EAAqB,SAAS,EAAQ,GACxC,EAAuB,EAAqB,OACzC,GAAM,IAAM,EACd,GAEO,EAAmB,SAAS,EAAQ,EAE9C,EAAqB,KAAK,EAAQ,EAEpC,CAGF,IAAM,EAAkB,CAAC,GAAG,IAAI,IAAI,EAAmB,CAAC,CAAC,IAAK,IAAa,CACzE,MAAO,EAAe,GACtB,GAAI,EAA8B,GAC9B,CAAE,gBAAiB,EAAS,CAC5B,CAAE,gBAAiB,gBAAiB,aAAc,EAAS,CAC/D,WAAY,CACV,CACE,IAAK,YACL,OAAQ,CAAC,UAAU,CACpB,CACD,CACE,IAAK,kBACL,OAAQ,EAAuB,IAAY,EAAE,CAC9C,CACF,CACF,EAAE,CAsBH,MAAO,CACL,kBApBwB,CAAC,GAAG,IAAI,IAAI,EAAqB,CAAC,CAAC,IAC1D,IAAa,CACZ,MAAO,EAAe,GACtB,GAAI,EAA8B,GAC9B,CAAE,gBAAiB,EAAS,CAC5B,CAAE,gBAAiB,gBAAiB,UAAW,EAAS,CAC5D,WAAY,CACV,CACE,IAAK,YACL,OAAQ,CAAC,YAAY,CACtB,CACD,CACE,IAAK,kBACL,OAAQ,EAAuB,IAAY,EAAE,CAC9C,CACF,CACF,EACF,CAIC,kBACD"}
|
package/dist/impl-8dOatHnF.mjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import"./enums-CyFTrzXY.mjs";import"./constants-CnLQtIBn.mjs";import"./logger-Bj782ZYD.mjs";import"./buildAIIntegrationType-Bk0EbFKV.mjs";import"./codecs-TR6p48v3.mjs";import"./syncConfigurationToTranscend-VJd0PnaZ.mjs";import{o as e}from"./consent-manager-c4bgQF1N.mjs";import"./uploadConsents-C1S-BNzw.mjs";import{t}from"./done-input-validation-CcZtaz03.mjs";async function n({auth:n,trackerStatus:r,file:i,transcendUrl:a}){t(this.process.exit),await e({auth:n,trackerStatus:r,file:i,transcendUrl:a})}export{n as uploadCookiesFromCsv};
|
|
2
|
-
//# sourceMappingURL=impl-8dOatHnF.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"impl-8dOatHnF.mjs","names":["uploadCookiesFromCsvHelper"],"sources":["../src/commands/consent/upload-cookies-from-csv/impl.ts"],"sourcesContent":["import type { LocalContext } from '../../../context';\nimport { uploadCookiesFromCsv as uploadCookiesFromCsvHelper } from '../../../lib/consent-manager';\nimport { ConsentTrackerStatus } from '@transcend-io/privacy-types';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation';\n\nexport interface UploadCookiesFromCsvCommandFlags {\n auth: string;\n trackerStatus: ConsentTrackerStatus;\n file: string;\n transcendUrl: string;\n}\n\nexport async function uploadCookiesFromCsv(\n this: LocalContext,\n { auth, trackerStatus, file, transcendUrl }: UploadCookiesFromCsvCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n // Upload cookies\n await uploadCookiesFromCsvHelper({\n auth,\n trackerStatus,\n file,\n transcendUrl,\n });\n}\n"],"mappings":"yWAYA,eAAsB,EAEpB,CAAE,OAAM,gBAAe,OAAM,gBACd,CACf,EAAoB,KAAK,QAAQ,KAAK,CAGtC,MAAMA,EAA2B,CAC/B,OACA,gBACA,OACA,eACD,CAAC"}
|
package/dist/impl-Ah-1lwzr.mjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{n as e,t}from"./command-Bzyj3M2G.mjs";import{o as n}from"./enums-CyFTrzXY.mjs";import{r}from"./constants-CnLQtIBn.mjs";import{t as i}from"./logger-Bj782ZYD.mjs";import"./buildAIIntegrationType-Bk0EbFKV.mjs";import"./codecs-TR6p48v3.mjs";import{a}from"./readTranscendYaml-DhKG1ViI.mjs";import{ai as o,js as s,yn as c}from"./syncConfigurationToTranscend-VJd0PnaZ.mjs";import{r as l}from"./api-keys-CxvKdj2v.mjs";import{t as u}from"./done-input-validation-CcZtaz03.mjs";import d from"node:fs";import{join as f}from"node:path";import p from"colors";async function m({auth:m,resources:h=e,file:g,transcendUrl:_,dataSiloIds:v=[],integrationNames:y=[],trackerStatuses:b=t,pageSize:x,skipDatapoints:S,skipSubDatapoints:C,includeGuessedCategories:w,debug:T}){u(this.process.exit);let E=await l(m),D=h.includes(`all`)?Object.values(n):h;if(typeof E==`string`){try{let e=await c(o(_,E),{dataSiloIds:v,integrationNames:y,resources:D,pageSize:x,debug:T,skipDatapoints:S,skipSubDatapoints:C,includeGuessedCategories:w,trackerStatuses:b});i.info(p.magenta(`Writing configuration to file "${g}"...`)),a(g,e)}catch(e){i.error(p.red(`An error occurred syncing the schema: ${T?e.stack:e.message}`)),this.process.exit(1)}i.info(p.green(`Successfully synced yaml file to disk at ${g}! View at ${r}`))}else{if(!d.lstatSync(g).isDirectory())throw Error(`File is expected to be a folder when passing in a list of API keys to pull from. e.g. --file=./working/`);let e=[];await s(E,async(t,n)=>{let r=`[${n+1}/${E.length}][${t.organizationName}] `;i.info(p.magenta(`~~~\n\n${r}Attempting to pull configuration...\n\n~~~`));let s=o(_,t.apiKey);try{let e=await c(s,{dataSiloIds:v,integrationNames:y,resources:D,pageSize:x,debug:T,skipDatapoints:S,skipSubDatapoints:C,includeGuessedCategories:w,trackerStatuses:b}),n=f(g,`${t.organizationName}.yml`);i.info(p.magenta(`Writing configuration to file "${n}"...`)),a(n,e),i.info(p.green(`${r}Successfully pulled configuration!`))}catch(n){i.error(p.red(`${r}Failed to sync configuration. - ${n.message}`)),e.push(t.organizationName)}}),e.length>0&&(i.info(p.red(`Sync encountered errors for "${e.join(`,`)}". View output above for more information, or check out ${r}`)),this.process.exit(1))}}export{m as pull};
|
|
2
|
-
//# sourceMappingURL=impl-Ah-1lwzr.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"impl-Ah-1lwzr.mjs","names":[],"sources":["../src/commands/inventory/pull/impl.ts"],"sourcesContent":["import { ConsentTrackerStatus } from '@transcend-io/privacy-types';\nimport type { LocalContext } from '../../../context';\nimport { TranscendPullResource } from '../../../enums';\nimport {\n DEFAULT_CONSENT_TRACKER_STATUSES,\n DEFAULT_TRANSCEND_PULL_RESOURCES,\n} from './command';\n\nimport { logger } from '../../../logger';\nimport colors from 'colors';\nimport { mapSeries } from '../../../lib/bluebird';\nimport { join } from 'node:path';\nimport fs from 'node:fs';\nimport {\n buildTranscendGraphQLClient,\n pullTranscendConfiguration,\n} from '../../../lib/graphql';\n\nimport { writeTranscendYaml } from '../../../lib/readTranscendYaml';\nimport { ADMIN_DASH_INTEGRATIONS } from '../../../constants';\nimport { validateTranscendAuth } from '../../../lib/api-keys';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation';\n\nexport interface PullCommandFlags {\n auth: string;\n resources?: (TranscendPullResource | 'all')[];\n file: string;\n transcendUrl: string;\n dataSiloIds?: string[];\n integrationNames?: string[];\n trackerStatuses?: ConsentTrackerStatus[];\n pageSize: number;\n skipDatapoints: boolean;\n skipSubDatapoints: boolean;\n includeGuessedCategories: boolean;\n debug: boolean;\n}\n\nexport async function pull(\n this: LocalContext,\n {\n auth,\n resources = DEFAULT_TRANSCEND_PULL_RESOURCES,\n file,\n transcendUrl,\n dataSiloIds = [],\n integrationNames = [],\n trackerStatuses = DEFAULT_CONSENT_TRACKER_STATUSES,\n pageSize,\n skipDatapoints,\n skipSubDatapoints,\n includeGuessedCategories,\n debug,\n }: PullCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n // Parse authentication as API key or path to list of API keys\n const apiKeyOrList = await validateTranscendAuth(auth);\n\n const resourcesToPull: TranscendPullResource[] = resources.includes('all')\n ? Object.values(TranscendPullResource)\n : (resources as TranscendPullResource[]);\n\n // Sync to Disk\n if (typeof apiKeyOrList === 'string') {\n try {\n // Create a GraphQL client\n const client = buildTranscendGraphQLClient(transcendUrl, apiKeyOrList);\n\n const configuration = await pullTranscendConfiguration(client, {\n dataSiloIds,\n integrationNames,\n resources: resourcesToPull,\n pageSize,\n debug,\n skipDatapoints,\n skipSubDatapoints,\n includeGuessedCategories,\n trackerStatuses,\n });\n\n logger.info(colors.magenta(`Writing configuration to file \"${file}\"...`));\n writeTranscendYaml(file, configuration);\n } catch (err) {\n logger.error(\n colors.red(\n `An error occurred syncing the schema: ${\n debug ? err.stack : err.message\n }`,\n ),\n );\n this.process.exit(1);\n }\n\n // Indicate success\n logger.info(\n colors.green(\n `Successfully synced yaml file to disk at ${file}! View at ${ADMIN_DASH_INTEGRATIONS}`,\n ),\n );\n } else {\n if (!fs.lstatSync(file).isDirectory()) {\n throw new Error(\n 'File is expected to be a folder when passing in a list of API keys to pull from. e.g. --file=./working/',\n );\n }\n\n const encounteredErrors: string[] = [];\n await mapSeries(apiKeyOrList, async (apiKey, ind) => {\n const prefix = `[${ind + 1}/${apiKeyOrList.length}][${\n apiKey.organizationName\n }] `;\n logger.info(\n colors.magenta(\n `~~~\\n\\n${prefix}Attempting to pull configuration...\\n\\n~~~`,\n ),\n );\n\n // Create a GraphQL client\n const client = buildTranscendGraphQLClient(transcendUrl, apiKey.apiKey);\n\n try {\n const configuration = await pullTranscendConfiguration(client, {\n dataSiloIds,\n integrationNames,\n resources: resourcesToPull,\n pageSize,\n debug,\n skipDatapoints,\n skipSubDatapoints,\n includeGuessedCategories,\n trackerStatuses,\n });\n\n const filePath = join(file, `${apiKey.organizationName}.yml`);\n logger.info(\n colors.magenta(`Writing configuration to file \"${filePath}\"...`),\n );\n writeTranscendYaml(filePath, configuration);\n\n logger.info(\n colors.green(`${prefix}Successfully pulled configuration!`),\n );\n } catch (err) {\n logger.error(\n colors.red(`${prefix}Failed to sync configuration. - ${err.message}`),\n );\n encounteredErrors.push(apiKey.organizationName);\n }\n });\n\n if (encounteredErrors.length > 0) {\n logger.info(\n colors.red(\n `Sync encountered errors for \"${encounteredErrors.join(\n ',',\n )}\". View output above for more information, or check out ${ADMIN_DASH_INTEGRATIONS}`,\n ),\n );\n\n this.process.exit(1);\n }\n }\n}\n"],"mappings":"wiBAsCA,eAAsB,EAEpB,CACE,OACA,YAAY,EACZ,OACA,eACA,cAAc,EAAE,CAChB,mBAAmB,EAAE,CACrB,kBAAkB,EAClB,WACA,iBACA,oBACA,2BACA,SAEa,CACf,EAAoB,KAAK,QAAQ,KAAK,CAGtC,IAAM,EAAe,MAAM,EAAsB,EAAK,CAEhD,EAA2C,EAAU,SAAS,MAAM,CACtE,OAAO,OAAO,EAAsB,CACnC,EAGL,GAAI,OAAO,GAAiB,SAAU,CACpC,GAAI,CAIF,IA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KAAK,EAAE"}
|
package/dist/impl-B5lTeRbn.mjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import"./enums-CyFTrzXY.mjs";import"./constants-CnLQtIBn.mjs";import{t as e}from"./logger-Bj782ZYD.mjs";import"./buildAIIntegrationType-Bk0EbFKV.mjs";import{Kr as t,ai as n,l as r,ui as i}from"./syncConfigurationToTranscend-VJd0PnaZ.mjs";import{t as a}from"./done-input-validation-CcZtaz03.mjs";import{SombraStandardScope as o}from"@transcend-io/privacy-types";import{existsSync as s}from"node:fs";import c from"colors";import*as l from"io-ts";import u from"cli-progress";async function d({auth:d,file:f,transcendUrl:p,duration:m,subjectType:h,emailColumnName:g,coreIdentifierColumnName:_}){a(this.process.exit),s(f)||(e.error(c.red(`File does not exist: "${f}". Please provide a valid path to a CSV file.`)),this.process.exit(1));try{let a=n(p,d),s=i(f,l.type({[g]:l.string,..._?{[_]:l.string}:{}}));if(!s.length)throw Error(`Input CSV is empty.`);let v=s.map((e,t)=>[e,t]).filter(([e])=>!e[g]?.trim());if(v.length){let e=v.map(([,e])=>e+2).join(`, `);throw Error(`The following rows are missing the required "${g}" column: ${e}`)}if(_){let e=s.map((e,t)=>[e,t]).filter(([e])=>!e[_]?.trim());if(e.length){let t=e.map(([,e])=>e+2).join(`, `);throw Error(`The following rows are missing the required "${_}" column: ${t}`)}}let y=Math.max(1,Math.floor(m/1e3)),b=s.map((e,t)=>{let n=e[g].trim(),r=_?e[_]?.trim():void 0;return{subjectType:h,scopes:[o.PreferenceManagement],expiresIn:y,email:n,...r?{coreIdentifier:r}:{},index:t}}),x=new u.SingleBar({},u.Presets.shades_classic);x.start(b.length,0);let S=Date.now(),C=await t(a,b,e=>{x.update(e)});x.update(b.length),x.stop();let w=C.map(({accessToken:e,input:t})=>{if(typeof t.index!=`number`)throw Error(`Internal error: missing input index.`);return{...s[t.index],token:e}});e.info(c.magenta(`Writing access tokens to file "${f}"...`)),await r(f,w,!0);let T=Math.round((Date.now()-S)/1e3);e.info(c.green(`Successfully generated ${C.length} access tokens to "${f}" in ${T}s!`))}catch(t){e.error(c.red(`An error occurred while generating access tokens: ${t?.message||String(t)}`)),this.process.exit(1)}}export{d as generateAccessTokens};
|
|
2
|
-
//# sourceMappingURL=impl-B5lTeRbn.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"impl-B5lTeRbn.mjs","names":[],"sources":["../src/commands/consent/generate-access-tokens/impl.ts"],"sourcesContent":["import type { LocalContext } from '../../../context';\nimport * as t from 'io-ts';\nimport colors from 'colors';\nimport { logger } from '../../../logger';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation';\nimport { existsSync } from 'node:fs';\nimport cliProgress from 'cli-progress';\nimport {\n buildTranscendGraphQLClient,\n createPreferenceAccessTokens,\n type PreferenceAccessTokenInputWithIndex,\n} from '../../../lib/graphql';\nimport { readCsv } from '../../../lib/requests';\nimport { SombraStandardScope } from '@transcend-io/privacy-types';\nimport { writeCsv } from '../../../lib/helpers';\n\n/**\n * CLI flags accepted by the `generate-access-tokens` command.\n *\n * These are passed down from the CLI parser into the parent process.\n */\nexport type GenerateAccessTokenCommandFlags = {\n auth: string;\n file: string;\n duration: number;\n transcendUrl: string;\n subjectType: string;\n emailColumnName: string;\n coreIdentifierColumnName?: string;\n};\n\n/**\n * Take in a CSV of user identifiers and generate access tokens for each user.\n *\n * Expected CSV columns:\n * - [emailColumnName] (required)\n * - [coreIdentifierColumnName] (optional)\n *\n * @param this - Bound CLI context (provides process exit + logging).\n * @param flags - CLI options for the run.\n */\nexport async function generateAccessTokens(\n this: LocalContext,\n {\n auth,\n file,\n transcendUrl,\n duration,\n subjectType,\n emailColumnName,\n coreIdentifierColumnName,\n }: GenerateAccessTokenCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n if (!existsSync(file)) {\n logger.error(\n colors.red(\n `File does not exist: \"${file}\". Please provide a valid path to a CSV file.`,\n ),\n );\n this.process.exit(1);\n }\n\n try {\n // Create a GraphQL client\n const client = buildTranscendGraphQLClient(transcendUrl, auth);\n\n // Read + parse CSV\n const codec = t.type({\n [emailColumnName]: t.string,\n ...(coreIdentifierColumnName\n ? { [coreIdentifierColumnName]: t.string }\n : {}),\n });\n const rows: Array<Record<string, string>> = readCsv(file, codec);\n if (!rows.length) {\n throw new Error('Input CSV is empty.');\n }\n\n // Ensure emails and core identifiers exist\n const missingEmail = rows\n .map((r, i) => [r, i] as const)\n .filter(([r]) => !r[emailColumnName]?.trim());\n if (missingEmail.length) {\n const rowNumbers = missingEmail\n .map(([, i]) => i + 2) // +2 to account for header row and 0-indexing\n .join(', ');\n throw new Error(\n `The following rows are missing the required \"${emailColumnName}\" column: ${rowNumbers}`,\n );\n }\n if (coreIdentifierColumnName) {\n const missingCoreId = rows\n .map((r, i) => [r, i] as const)\n .filter(([r]) => !r[coreIdentifierColumnName]?.trim());\n if (missingCoreId.length) {\n const rowNumbers = missingCoreId\n .map(([, i]) => i + 2) // +2 to account for header row and 0-indexing\n .join(', ');\n throw new Error(\n `The following rows are missing the required \"${coreIdentifierColumnName}\" column: ${rowNumbers}`,\n );\n }\n }\n\n // Duration provided by CLI is in ms; GraphQL expects seconds\n const expiresInSeconds = Math.max(1, Math.floor(duration / 1000));\n\n // Build inputs for GraphQL\n const inputs = rows.map((r, index): PreferenceAccessTokenInputWithIndex => {\n const email = r[emailColumnName].trim();\n const coreIdentifier = coreIdentifierColumnName\n ? r[coreIdentifierColumnName]?.trim()\n : undefined;\n const scopes = [SombraStandardScope.PreferenceManagement];\n return {\n subjectType,\n scopes,\n expiresIn: expiresInSeconds,\n email,\n ...(coreIdentifier ? { coreIdentifier } : {}),\n index,\n };\n });\n\n // Progress bar\n const progressBar = new cliProgress.SingleBar(\n {},\n cliProgress.Presets.shades_classic,\n );\n progressBar.start(inputs.length, 0);\n\n // Kick off token creation (batched internally)\n const t0 = Date.now();\n const results = await createPreferenceAccessTokens(\n client,\n inputs,\n (progress) => {\n progressBar.update(progress);\n },\n );\n progressBar.update(inputs.length);\n progressBar.stop();\n\n // Prepare output CSV rows\n const outputRows = results.map(({ accessToken, input }) => {\n if (typeof input.index !== 'number') {\n throw new Error('Internal error: missing input index.');\n }\n return {\n ...rows[input.index],\n token: accessToken,\n };\n });\n\n logger.info(colors.magenta(`Writing access tokens to file \"${file}\"...`));\n await writeCsv(file, outputRows, true);\n\n const totalTimeSec = Math.round((Date.now() - t0) / 1000);\n logger.info(\n colors.green(\n `Successfully generated ${results.length} access tokens to \"${file}\" in ${totalTimeSec}s!`,\n ),\n );\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n } catch (err: any) {\n logger.error(\n colors.red(\n `An error occurred while generating access tokens: ${\n err?.message || String(err)\n }`,\n ),\n );\n this.process.exit(1);\n }\n}\n"],"mappings":"wdAyCA,eAAsB,EAEpB,CACE,OACA,OACA,eACA,WACA,cACA,kBACA,4BAEa,CACf,EAAoB,KAAK,QAAQ,KAAK,CACjC,EAAW,EAAK,GACnB,EAAO,MACL,EAAO,IACL,yBAAyB,EAAK,+CAC/B,CACF,CACD,KAAK,QAAQ,KAAK,EAAE,EAGtB,GAAI,CAEF,IAAM,EAAS,EAA4B,EAAc,EAAK,CASxD,EAAsC,EAAQ,EANtC,EAAE,KAAK,EAClB,GAAkB,EAAE,OACrB,GAAI,EACA,EAAG,GAA2B,EAAE,OAAQ,CACxC,EAAE,CACP,CAAC,CAC8D,CAChE,GAAI,CAAC,EAAK,OACR,MAAU,MAAM,sBAAsB,CAIxC,IAAM,EAAe,EAClB,KAAK,EAAG,IAAM,CAAC,EAAG,EAAE,CAAU,CAC9B,QAAQ,CAAC,KAAO,CAAC,EAAE,IAAkB,MAAM,CAAC,CAC/C,GAAI,EAAa,OAAQ,CACvB,IAAM,EAAa,EAChB,KAAK,EAAG,KAAO,EAAI,EAAE,CACrB,KAAK,KAAK,CACb,MAAU,MACR,gDAAgD,EAAgB,YAAY,IAC7E,CAEH,GAAI,EAA0B,CAC5B,IAAM,EAAgB,EACnB,K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EAAO,MACL,EAAO,IACL,qDACE,GAAK,SAAW,OAAO,EAAI,GAE9B,CACF,CACD,KAAK,QAAQ,KAAK,EAAE"}
|
package/dist/impl-B6UhzQcY2.mjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import"./enums-CyFTrzXY.mjs";import"./constants-CnLQtIBn.mjs";import"./logger-Bj782ZYD.mjs";import"./buildAIIntegrationType-Bk0EbFKV.mjs";import{q as e}from"./syncConfigurationToTranscend-VJd0PnaZ.mjs";import{t}from"./done-input-validation-CcZtaz03.mjs";async function n({auth:n,actions:r,statuses:i=[],requestIds:a,silentModeBefore:o,createdAtBefore:s,createdAtAfter:c,updatedAtBefore:l,updatedAtAfter:u,cancellationTitle:d,transcendUrl:f,concurrency:p}){t(this.process.exit),await e({transcendUrl:f,requestActions:r,auth:n,cancellationTitle:d,requestIds:a,statuses:i,concurrency:p,silentModeBefore:o?new Date(o):void 0,createdAtBefore:s?new Date(s):void 0,createdAtAfter:c?new Date(c):void 0,updatedAtBefore:l?new Date(l):void 0,updatedAtAfter:u?new Date(u):void 0})}export{n as cancel};
|
|
2
|
-
//# sourceMappingURL=impl-B6UhzQcY2.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"impl-B6UhzQcY2.mjs","names":[],"sources":["../src/commands/request/cancel/impl.ts"],"sourcesContent":["import type { LocalContext } from '../../../context';\nimport { RequestAction, RequestStatus } from '@transcend-io/privacy-types';\nimport { cancelPrivacyRequests } from '../../../lib/requests';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation';\n\nexport interface CancelCommandFlags {\n auth: string;\n actions: RequestAction[];\n statuses?: RequestStatus[];\n requestIds?: string[];\n silentModeBefore?: Date;\n createdAtBefore?: Date;\n createdAtAfter?: Date;\n updatedAtBefore?: Date;\n updatedAtAfter?: Date;\n cancellationTitle: string;\n transcendUrl: string;\n concurrency: number;\n}\n\nexport async function cancel(\n this: LocalContext,\n {\n auth,\n actions,\n statuses = [],\n requestIds,\n silentModeBefore,\n createdAtBefore,\n createdAtAfter,\n updatedAtBefore,\n updatedAtAfter,\n cancellationTitle,\n transcendUrl,\n concurrency,\n }: CancelCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n await cancelPrivacyRequests({\n transcendUrl,\n requestActions: actions,\n auth,\n cancellationTitle,\n requestIds,\n statuses,\n concurrency,\n silentModeBefore: silentModeBefore ? new Date(silentModeBefore) : undefined,\n createdAtBefore: createdAtBefore ? new Date(createdAtBefore) : undefined,\n createdAtAfter: createdAtAfter ? new Date(createdAtAfter) : undefined,\n updatedAtBefore: updatedAtBefore ? new Date(updatedAtBefore) : undefined,\n updatedAtAfter: updatedAtAfter ? new Date(updatedAtAfter) : undefined,\n });\n}\n"],"mappings":"8PAoBA,eAAsB,EAEpB,CACE,OACA,UACA,WAAW,EAAE,CACb,aACA,mBACA,kBACA,iBACA,kBACA,iBACA,oBACA,eACA,eAEa,CACf,EAAoB,KAAK,QAAQ,KAAK,CAEtC,MAAM,EAAsB,CAC1B,eACA,eAAgB,EAChB,OACA,oBACA,aACA,WACA,cACA,iBAAkB,EAAmB,IAAI,KAAK,EAAiB,CAAG,IAAA,GAClE,gBAAiB,EAAkB,IAAI,KAAK,EAAgB,CAAG,IAAA,GAC/D,eAAgB,EAAiB,IAAI,KAAK,EAAe,CAAG,IAAA,GAC5D,gBAAiB,EAAkB,IAAI,KAAK,EAAgB,CAAG,IAAA,GAC/D,eAAgB,EAAiB,IAAI,KAAK,EAAe,CAAG,IAAA,GAC7D,CAAC"}
|
package/dist/impl-BFf_CotE2.mjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import"./enums-CyFTrzXY.mjs";import"./constants-CnLQtIBn.mjs";import"./logger-Bj782ZYD.mjs";import"./buildAIIntegrationType-Bk0EbFKV.mjs";import{B as e}from"./syncConfigurationToTranscend-VJd0PnaZ.mjs";import{t}from"./done-input-validation-CcZtaz03.mjs";async function n({auth:n,enricherId:r,actions:i,requestEnricherStatuses:a,requestIds:o,createdAtBefore:s,createdAtAfter:c,updatedAtBefore:l,updatedAtAfter:u,concurrency:d,transcendUrl:f}){t(this.process.exit),await e({auth:n,enricherId:r,requestActions:i,requestEnricherStatuses:a,requestIds:o,createdAtBefore:s?new Date(s):void 0,createdAtAfter:c?new Date(c):void 0,updatedAtBefore:l?new Date(l):void 0,updatedAtAfter:u?new Date(u):void 0,concurrency:d,transcendUrl:f})}export{n as enricherRestart};
|
|
2
|
-
//# sourceMappingURL=impl-BFf_CotE2.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"impl-BFf_CotE2.mjs","names":[],"sources":["../src/commands/request/enricher-restart/impl.ts"],"sourcesContent":["import type { LocalContext } from '../../../context';\nimport { bulkRetryEnrichers } from '../../../lib/requests';\nimport type {\n RequestAction,\n RequestEnricherStatus,\n} from '@transcend-io/privacy-types';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation';\n\nexport interface EnricherRestartCommandFlags {\n auth: string;\n enricherId: string;\n actions?: RequestAction[];\n requestEnricherStatuses?: RequestEnricherStatus[];\n transcendUrl: string;\n concurrency: number;\n requestIds?: string[];\n createdAtBefore?: Date;\n createdAtAfter?: Date;\n updatedAtBefore?: Date;\n updatedAtAfter?: Date;\n}\n\nexport async function enricherRestart(\n this: LocalContext,\n {\n auth,\n enricherId,\n actions,\n requestEnricherStatuses,\n requestIds,\n createdAtBefore,\n createdAtAfter,\n updatedAtBefore,\n updatedAtAfter,\n concurrency,\n transcendUrl,\n }: EnricherRestartCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n await bulkRetryEnrichers({\n auth,\n enricherId,\n requestActions: actions,\n requestEnricherStatuses,\n requestIds,\n createdAtBefore: createdAtBefore ? new Date(createdAtBefore) : undefined,\n createdAtAfter: createdAtAfter ? new Date(createdAtAfter) : undefined,\n updatedAtBefore: updatedAtBefore ? new Date(updatedAtBefore) : undefined,\n updatedAtAfter: updatedAtAfter ? new Date(updatedAtAfter) : undefined,\n concurrency,\n transcendUrl,\n });\n}\n"],"mappings":"8PAsBA,eAAsB,EAEpB,CACE,OACA,aACA,UACA,0BACA,aACA,kBACA,iBACA,kBACA,iBACA,cACA,gBAEa,CACf,EAAoB,KAAK,QAAQ,KAAK,CAEtC,MAAM,EAAmB,CACvB,OACA,aACA,eAAgB,EAChB,0BACA,aACA,gBAAiB,EAAkB,IAAI,KAAK,EAAgB,CAAG,IAAA,GAC/D,eAAgB,EAAiB,IAAI,KAAK,EAAe,CAAG,IAAA,GAC5D,gBAAiB,EAAkB,IAAI,KAAK,EAAgB,CAAG,IAAA,GAC/D,eAAgB,EAAiB,IAAI,KAAK,EAAe,CAAG,IAAA,GAC5D,cACA,eACD,CAAC"}
|
package/dist/impl-BGQ0EGS0.mjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import"./enums-CyFTrzXY.mjs";import"./constants-CnLQtIBn.mjs";import{t as e}from"./logger-Bj782ZYD.mjs";import"./buildAIIntegrationType-Bk0EbFKV.mjs";import"./codecs-TR6p48v3.mjs";import{a as t,r as n}from"./readTranscendYaml-DhKG1ViI.mjs";import{ai as r,or as i}from"./syncConfigurationToTranscend-VJd0PnaZ.mjs";import{n as a}from"./api-keys-CxvKdj2v.mjs";import{t as o}from"./done-input-validation-CcZtaz03.mjs";import{t as s}from"./dataFlowsToDataSilos-RAhfPV0l.mjs";import{difference as c}from"lodash-es";import{existsSync as l,lstatSync as u}from"node:fs";import{join as d}from"node:path";import f from"colors";async function p({auth:p,dataFlowsYmlFolder:m,output:h,ignoreYmls:g=[],transcendUrl:_}){o(this.process.exit),(!l(m)||!u(m).isDirectory())&&(e.error(f.red(`Folder does not exist: "${m}"`)),this.process.exit(1));let v=g.map(e=>e.split(`.`)[0]),y=a(m).map(e=>{let{"data-flows":t=[]}=n(d(m,e)),{adTechDataSilos:r,siteTechDataSilos:i}=s(t,{serviceToSupportedIntegration:T,serviceToTitle:w});return{adTechDataSilos:r,siteTechDataSilos:i,organizationName:e.split(`.`)[0]}}),b={};y.forEach(({adTechDataSilos:e,siteTechDataSilos:t,organizationName:n})=>{[...e,...t].forEach(e=>{let t=e[`outer-type`]||e.integrationName;b[t]||(b[t]=[]),b[t].push(n),b[t]=[...new Set(b[t])]})});let x=[...new Set(y.map(({adTechDataSilos:e})=>e.map(e=>e[`outer-type`]||e.integrationName)).flat())],S=c([...new Set(y.map(({siteTechDataSilos:e})=>e.map(e=>e[`outer-type`]||e.integrationName)).flat())],x),C={};y.forEach(({adTechDataSilos:e,siteTechDataSilos:t})=>{[...e,...t].forEach(e=>{let t=e[`outer-type`]||e.integrationName,n=e.attributes?.find(e=>e.key===`Found On Domain`);C[t]||(C[t]=[]),C[t].push(...n?.values||[]),C[t]=[...new Set(C[t])]})});let{serviceToTitle:w,serviceToSupportedIntegration:T}=await i(r(_,p)),E=[...x,...S].map(e=>({title:w[e],...T[e]?{integrationName:e}:{integrationName:`promptAPerson`,"outer-type":e},attributes:[{key:`Tech Type`,values:[`Ad Tech`]},{key:`Business Units`,values:c(b[e]||[],v)},{key:`Found On Domain`,values:C[e]||[]}]}));e.log(`Total Services: ${E.length}`),e.log(`Ad Tech Services: ${x.length}`),e.log(`Site Tech Services: ${S.length}`),t(h,{"data-silos":E})}export{p as deriveDataSilosFromDataFlowsCrossInstance};
|
|
2
|
-
//# sourceMappingURL=impl-BGQ0EGS0.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"impl-BGQ0EGS0.mjs","names":[],"sources":["../src/commands/inventory/derive-data-silos-from-data-flows-cross-instance/impl.ts"],"sourcesContent":["import type { LocalContext } from '../../../context';\nimport {\n fetchAndIndexCatalogs,\n buildTranscendGraphQLClient,\n} from '../../../lib/graphql';\nimport { join } from 'node:path';\nimport { difference } from 'lodash-es';\nimport colors from 'colors';\nimport { logger } from '../../../logger';\nimport { dataFlowsToDataSilos } from '../../../lib/consent-manager/dataFlowsToDataSilos';\nimport { DataFlowInput } from '../../../codecs';\nimport { existsSync, lstatSync } from 'node:fs';\nimport { listFiles } from '../../../lib/api-keys';\nimport {\n readTranscendYaml,\n writeTranscendYaml,\n} from '../../../lib/readTranscendYaml';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation';\n\nexport interface DeriveDataSilosFromDataFlowsCrossInstanceCommandFlags {\n auth: string;\n dataFlowsYmlFolder: string;\n output: string;\n ignoreYmls?: string[];\n transcendUrl: string;\n}\n\nexport async function deriveDataSilosFromDataFlowsCrossInstance(\n this: LocalContext,\n {\n auth,\n dataFlowsYmlFolder,\n output,\n ignoreYmls = [],\n transcendUrl,\n }: DeriveDataSilosFromDataFlowsCrossInstanceCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n // Ensure folder is passed\n if (\n !existsSync(dataFlowsYmlFolder) ||\n !lstatSync(dataFlowsYmlFolder).isDirectory()\n ) {\n logger.error(colors.red(`Folder does not exist: \"${dataFlowsYmlFolder}\"`));\n this.process.exit(1);\n }\n\n // Ignore the data flows in these yml files\n const instancesToIgnore = ignoreYmls.map((x) => x.split('.')[0]);\n\n // Map over each data flow yml file and convert to data silo configurations\n const dataSiloInputs = listFiles(dataFlowsYmlFolder).map((directory) => {\n // read in the data flows for a specific instance\n const { 'data-flows': dataFlows = [] } = readTranscendYaml(\n join(dataFlowsYmlFolder, directory),\n );\n\n // map the data flows to data silos\n const { adTechDataSilos, siteTechDataSilos } = dataFlowsToDataSilos(\n dataFlows as DataFlowInput[],\n {\n serviceToSupportedIntegration,\n serviceToTitle,\n },\n );\n\n return {\n adTechDataSilos,\n siteTechDataSilos,\n organizationName: directory.split('.')[0],\n };\n });\n\n // Mapping from service name to instances that have that service\n const serviceToInstance: { [k in string]: string[] } = {};\n dataSiloInputs.forEach(\n ({ adTechDataSilos, siteTechDataSilos, organizationName }) => {\n const allDataSilos = [...adTechDataSilos, ...siteTechDataSilos];\n allDataSilos.forEach((dataSilo) => {\n const service = dataSilo['outer-type'] || dataSilo.integrationName;\n // create mapping to instance\n if (!serviceToInstance[service]) {\n serviceToInstance[service] = [];\n }\n serviceToInstance[service]!.push(organizationName);\n serviceToInstance[service] = [...new Set(serviceToInstance[service])];\n });\n },\n );\n\n // List of ad tech integrations\n const adTechIntegrations = [\n ...new Set(\n dataSiloInputs\n .map(({ adTechDataSilos }) =>\n adTechDataSilos.map(\n (silo) => silo['outer-type'] || silo.integrationName,\n ),\n )\n .flat(),\n ),\n ];\n\n // List of site tech integrations\n const siteTechIntegrations = difference(\n [\n ...new Set(\n dataSiloInputs\n .map(({ siteTechDataSilos }) =>\n siteTechDataSilos.map(\n (silo) => silo['outer-type'] || silo.integrationName,\n ),\n )\n .flat(),\n ),\n ],\n adTechIntegrations,\n );\n\n // Mapping from service name to list of\n const serviceToFoundOnDomain: { [k in string]: string[] } = {};\n dataSiloInputs.forEach(({ adTechDataSilos, siteTechDataSilos }) => {\n const allDataSilos = [...adTechDataSilos, ...siteTechDataSilos];\n allDataSilos.forEach((dataSilo) => {\n const service = dataSilo['outer-type'] || dataSilo.integrationName;\n const foundOnDomain = dataSilo.attributes?.find(\n (attr) => attr.key === 'Found On Domain',\n );\n // create mapping to instance\n if (!serviceToFoundOnDomain[service]) {\n serviceToFoundOnDomain[service] = [];\n }\n serviceToFoundOnDomain[service]!.push(...(foundOnDomain?.values || []));\n serviceToFoundOnDomain[service] = [\n ...new Set(serviceToFoundOnDomain[service]),\n ];\n });\n });\n\n // Fetch all integrations in the catalog\n const client = buildTranscendGraphQLClient(transcendUrl, auth);\n const { serviceToTitle, serviceToSupportedIntegration } =\n await fetchAndIndexCatalogs(client);\n\n // construct the aggregated data silo inputs\n const dataSilos = [...adTechIntegrations, ...siteTechIntegrations].map(\n (service) => ({\n title: serviceToTitle[service],\n ...(serviceToSupportedIntegration[service]\n ? { integrationName: service }\n : { integrationName: 'promptAPerson', 'outer-type': service }),\n attributes: [\n {\n key: 'Tech Type',\n values: ['Ad Tech'],\n },\n {\n key: 'Business Units',\n values: difference(\n serviceToInstance[service] || [],\n instancesToIgnore,\n ),\n },\n {\n key: 'Found On Domain',\n values: serviceToFoundOnDomain[service] || [],\n },\n ],\n }),\n );\n\n // Log output\n logger.log(`Total Services: ${dataSilos.length}`);\n logger.log(`Ad Tech Services: ${adTechIntegrations.length}`);\n logger.log(`Site Tech Services: ${siteTechIntegrations.length}`);\n\n // Write to yaml\n writeTranscendYaml(output, {\n 'data-silos': dataSilos,\n });\n}\n"],"mappings":"wmBA2BA,eAAsB,EAEpB,CACE,OACA,qBACA,SACA,aAAa,EAAE,CACf,gBAEa,CACf,EAAoB,KAAK,QAAQ,KAAK,EAIpC,CAAC,EAAW,EAAmB,EAC/B,CAAC,EAAU,EAAmB,CAAC,aAAa,IAE5C,EAAO,MAAM,EAAO,IAAI,2BAA2B,EAAmB,GAAG,CAAC,CAC1E,KAAK,QAAQ,KAAK,EAAE,EAItB,IAAM,EAAoB,EAAW,IAAK,GAAM,EAAE,MAAM,IAAI,CAAC,GAAG,CAG1D,EAAiB,EAAU,EAAmB,CAAC,IAAK,GAAc,CAEtE,GAAM,CAAE,aAAc,EAAY,EAAE,EAAK,EACvC,EAAK,EAAoB,EAAU,CACpC,CAGK,CAAE,kBAAiB,qBAAsB,EAC7C,EACA,CACE,gCACA,iBACD,CACF,CAED,MAAO,CACL,kBACA,oBACA,iBAAkB,EAAU,MAAM,IAAI,CAAC,GACxC,EACD,CAGI,EAAiD,EAAE,CACzD,EAAe,SACZ,CAAE,kBAAiB,oBAAmB,sBAAuB,CACvC,CAAC,GAAG,EAAiB,GAAG,EAAkB,CAClD,QAAS,GAAa,CACjC,IAAM,EAAU,EAAS,eAAiB,EAAS,gBAE9C,EAAkB,KACrB,EAAkB,GAAW,EAAE,EAEjC,EAAkB,GAAU,KAAK,EAAiB,CAClD,EAAkB,GAAW,CAAC,GAAG,IAAI,IAAI,EAAkB,GAAS,CAAC,EACrE,EAEL,CAGD,IAAM,EAAqB,CACzB,GAAG,IAAI,IACL,EACG,KAAK,CAAE,qB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|
|
|
1
|
-
{"version":3,"file":"impl-BYBNi68b.mjs","names":["fg"],"sources":["../src/commands/admin/find-text-in-folder/impl.ts"],"sourcesContent":["import fs from 'node:fs';\nimport path from 'node:path';\nimport { spawn } from 'node:child_process';\nimport fg from 'fast-glob';\nimport colors from 'colors';\nimport type { LocalContext } from '../../../context';\nimport { logger } from '../../../logger';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation';\n\n/** CLI flags accepted by the `find-text-in-folder` command. */\nexport type FindTextInFolderCommandFlags = {\n /** The text string to search for */\n needle: string;\n /** Root directory to search */\n root: string;\n /** Comma-separated file extensions */\n exts: string;\n /** Skip parquet file scanning */\n noParquet: boolean;\n /** Max concurrent file scans */\n concurrency: number;\n /** Stop scanning each file after N bytes */\n maxBytes?: number;\n};\n\n/**\n * Streams through a file checking if it contains the needle (case-insensitive).\n *\n * @param filePath - Absolute path to the file to scan\n * @param needle - Lowercased needle as a Buffer\n * @param maxBytes - Optional byte limit per file\n * @returns Whether the file contains the needle\n */\nexport function fileContainsExactBytes(\n filePath: string,\n needle: Buffer,\n maxBytes?: number,\n): Promise<boolean> {\n return new Promise<boolean>((resolve, reject) => {\n const stream = fs.createReadStream(filePath);\n let carry = Buffer.alloc(0);\n const n = needle.length;\n let seen = 0;\n\n stream.on('data', (raw: Buffer) => {\n let chunk = raw;\n\n if (maxBytes) {\n const remaining = maxBytes - seen;\n if (remaining <= 0) {\n stream.destroy();\n resolve(false);\n return;\n }\n if (chunk.length > remaining) {\n chunk = chunk.subarray(0, remaining);\n }\n seen += chunk.length;\n }\n\n const buf = carry.length ? Buffer.concat([carry, chunk]) : chunk;\n const haystack = buf.toString('utf8').toLowerCase();\n if (haystack.includes(needle.toString('utf8'))) {\n stream.destroy();\n resolve(true);\n return;\n }\n\n // Keep last n-1 bytes to catch boundary matches\n if (n > 1) {\n carry = Buffer.from(buf.subarray(Math.max(0, buf.length - (n - 1))));\n } else {\n carry = Buffer.alloc(0);\n }\n });\n\n stream.on('error', reject);\n stream.on('close', () => resolve(false));\n stream.on('end', () => resolve(false));\n });\n}\n\n/**\n * Run async workers over items with bounded concurrency.\n *\n * @param items - Array of items to process\n * @param limit - Maximum concurrent workers\n * @param worker - Async function to run per item\n * @returns Resolves when all items are processed\n */\nasync function runWithConcurrency<T>(\n items: T[],\n limit: number,\n worker: (item: T) => Promise<void>,\n): Promise<void> {\n let idx = 0;\n const runners = Array.from(\n { length: Math.min(limit, items.length) },\n async () => {\n // eslint-disable-next-line no-constant-condition\n while (true) {\n const current = idx;\n idx += 1;\n if (current >= items.length) return;\n await worker(items[current]);\n }\n },\n );\n await Promise.all(runners);\n}\n\n/**\n * Execute a DuckDB query and return stdout.\n *\n * @param duckdbPath - Path to the duckdb binary\n * @param sql - SQL query to execute\n * @returns The stdout output from duckdb\n */\nfunction duckdbQuery(duckdbPath: string, sql: string): Promise<string> {\n return new Promise<string>((resolve, reject) => {\n const child = spawn(duckdbPath, ['-noheader', '-batch', '-cmd', sql], {\n stdio: ['ignore', 'pipe', 'pipe'],\n });\n\n let stdout = '';\n let stderr = '';\n child.stdout.on('data', (d) => {\n stdout += String(d);\n });\n child.stderr.on('data', (d) => {\n stderr += String(d);\n });\n\n child.on('error', reject);\n child.on('close', (code) => {\n if (code === 0) resolve(stdout);\n else reject(new Error(`duckdb exited ${code}: ${stderr}`));\n });\n });\n}\n\n/**\n * Get all VARCHAR/STRING column names from a parquet file.\n *\n * @param duckdbPath - Path to the duckdb binary\n * @param filePath - Absolute path to the parquet file\n * @returns Array of string column names\n */\nasync function duckdbGetParquetStringColumns(\n duckdbPath: string,\n filePath: string,\n): Promise<string[]> {\n const escaped = filePath.replace(/'/g, \"''\");\n const sql = [\n 'SELECT column_name',\n `FROM parquet_schema('${escaped}')`,\n \"WHERE lower(column_type) LIKE '%varchar%'\",\n \" OR lower(column_type) LIKE '%string%';\",\n ].join('\\n');\n\n const out = await duckdbQuery(duckdbPath, sql);\n return out\n .split('\\n')\n .map((l) => l.trim())\n .filter(Boolean);\n}\n\n/**\n * Check if any string column in a parquet file contains the needle value.\n *\n * @param duckdbPath - Path to the duckdb binary\n * @param filePath - Absolute path to the parquet file\n * @param needle - The string to search for (exact equality per column)\n * @returns Whether any row/column matches\n */\nasync function parquetFileHasExactString(\n duckdbPath: string,\n filePath: string,\n needle: string,\n): Promise<boolean> {\n const cols = await duckdbGetParquetStringColumns(duckdbPath, filePath);\n if (cols.length === 0) return false;\n\n const escaped = filePath.replace(/'/g, \"''\");\n const orChain = cols\n .map((c) => `\"${c.replace(/\"/g, '\"\"')}\" = '${needle.replace(/'/g, \"''\")}'`)\n .join(' OR ');\n\n const sql = [\n `SELECT 1 AS hit FROM read_parquet('${escaped}')`,\n `WHERE ${orChain}`,\n 'LIMIT 1;',\n ].join('\\n');\n\n const out = await duckdbQuery(duckdbPath, sql);\n return out.trim().length > 0;\n}\n\n/**\n * Entrypoint for the `admin find-text-in-folder` command.\n *\n * Searches a folder of files for a given text string. Useful for finding\n * a needle in a haystack across many large files (multi-GB CSVs, JSON\n * dumps, log archives). Files are streamed so memory stays flat.\n *\n * @param this - Bound CLI context\n * @param flags - CLI flags for the run\n */\nexport async function findTextInFolder(\n this: LocalContext,\n flags: FindTextInFolderCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n const { needle, root, exts, noParquet, concurrency, maxBytes } = flags;\n const rootAbs = path.resolve(root);\n\n const extSet = new Set(\n exts\n .split(',')\n .map((x) => x.trim().replace(/^\\./, '').toLowerCase())\n .filter(Boolean),\n );\n const patterns = Array.from(extSet).map((e) => `**/*.${e}`);\n\n logger.info(\n colors.green(\n `Searching for \"${needle}\" in ${rootAbs} (exts: ${[...extSet].join(\n ', ',\n )})`,\n ),\n );\n\n const normalFiles = await fg(patterns, {\n cwd: rootAbs,\n absolute: true,\n onlyFiles: true,\n followSymbolicLinks: false,\n suppressErrors: true,\n });\n\n const needleBuf = Buffer.from(needle.toLowerCase(), 'utf8');\n const hits: string[] = [];\n\n await runWithConcurrency(normalFiles, concurrency, async (file) => {\n try {\n const ok = await fileContainsExactBytes(file, needleBuf, maxBytes);\n if (ok) {\n hits.push(file);\n this.process.stdout.write(`${file}\\n`);\n }\n } catch {\n // ignore unreadable files\n }\n });\n\n if (!noParquet) {\n const parquetFiles = await fg(['**/*.parquet'], {\n cwd: rootAbs,\n absolute: true,\n onlyFiles: true,\n followSymbolicLinks: false,\n suppressErrors: true,\n });\n\n if (parquetFiles.length > 0) {\n logger.info(\n colors.green(\n `Scanning ${parquetFiles.length} parquet file(s) via DuckDB...`,\n ),\n );\n\n await runWithConcurrency(\n parquetFiles,\n Math.max(2, Math.floor(concurrency / 4)),\n async (file) => {\n try {\n const ok = await parquetFileHasExactString('duckdb', file, needle);\n if (ok) {\n hits.push(file);\n this.process.stdout.write(`${file}\\n`);\n }\n } catch {\n // ignore parquet read issues\n }\n },\n );\n }\n }\n\n logger.info(colors.green(`Done. Found ${hits.length} matching file(s).`));\n}\n"],"mappings":"wOAiCA,SAAgB,EACd,EACA,EACA,EACkB,CAClB,OAAO,IAAI,SAAkB,EAAS,IAAW,CAC/C,IAAM,EAAS,EAAG,iBAAiB,EAAS,CACxC,EAAQ,OAAO,MAAM,EAAE,CACrB,EAAI,EAAO,OACb,EAAO,EAEX,EAAO,GAAG,OAAS,GAAgB,CACjC,IAAI,EAAQ,EAEZ,GAAI,EAAU,CACZ,IAAM,EAAY,EAAW,EAC7B,GAAI,GAAa,EAAG,CAClB,EAAO,SAAS,CAChB,EAAQ,GAAM,CACd,OAEE,EAAM,OAAS,IACjB,EAAQ,EAAM,SAAS,EAAG,EAAU,EAEtC,GAAQ,EAAM,OAGhB,IAAM,EAAM,EAAM,OAAS,OAAO,OAAO,CAAC,EAAO,EAAM,CAAC,CAAG,EAE3D,GADiB,EAAI,SAAS,OAAO,CAAC,aAAa,CACtC,SAAS,EAAO,SAAS,OAAO,CAAC,CAAE,CAC9C,EAAO,SAAS,CAChB,EAAQ,GAAK,CACb,OAIF,AAGE,EAHE,EAAI,EACE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CAEE,CAAC,EAAW,CACd,IAAM,EAAe,MAAMA,EAAG,CAAC,eAAe,CAAE,CAC9C,IAAK,EACL,SAAU,GACV,UAAW,GACX,oBAAqB,GACrB,eAAgB,GACjB,CAAC,CAEE,EAAa,OAAS,IACxB,EAAO,KACL,EAAO,MACL,YAAY,EAAa,OAAO,gCACjC,CACF,CAED,MAAM,EACJ,EACA,KAAK,IAAI,EAAG,KAAK,MAAM,EAAc,EAAE,CAAC,CACxC,KAAO,IAAS,CACd,GAAI,CACS,MAAM,EAA0B,SAAU,EAAM,EAAO,GAEhE,EAAK,KAAK,EAAK,CACf,KAAK,QAAQ,OAAO,MAAM,GAAG,EAAK,IAAI,OAElC,IAIX,EAIL,EAAO,KAAK,EAAO,MAAM,eAAe,EAAK,OAAO,oBAAoB,CAAC"}
|
package/dist/impl-B__p3_wC.mjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import"./enums-CyFTrzXY.mjs";import"./constants-CnLQtIBn.mjs";import"./logger-Bj782ZYD.mjs";import"./buildAIIntegrationType-Bk0EbFKV.mjs";import{W as e,pi as t}from"./syncConfigurationToTranscend-VJd0PnaZ.mjs";import{t as n}from"./done-input-validation-CcZtaz03.mjs";async function r({auth:r,file:i,transcendUrl:a,cacheFilepath:o,requestReceiptFolder:s,sombraAuth:c,concurrency:l,attributes:u,isTest:d,isSilent:f,skipSendingReceipt:p,emailIsVerified:m,skipFilterStep:h,dryRun:g,debug:_,defaultPhoneCountryCode:v}){n(this.process.exit),await e({cacheFilepath:o,requestReceiptFolder:s,file:i,auth:r,sombraAuth:c,concurrency:l,transcendUrl:a,defaultPhoneCountryCode:v,attributes:t(u),debug:_,skipFilterStep:h,isSilent:f,skipSendingReceipt:p,emailIsVerified:m,isTest:d,dryRun:g})}export{r as upload};
|
|
2
|
-
//# sourceMappingURL=impl-B__p3_wC.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"impl-B__p3_wC.mjs","names":[],"sources":["../src/commands/request/upload/impl.ts"],"sourcesContent":["import type { LocalContext } from '../../../context';\nimport {\n splitCsvToList,\n uploadPrivacyRequestsFromCsv,\n} from '../../../lib/requests';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation';\n\nexport interface UploadCommandFlags {\n auth: string;\n file: string;\n transcendUrl: string;\n cacheFilepath: string;\n requestReceiptFolder: string;\n sombraAuth?: string;\n concurrency: number;\n attributes: string;\n isTest: boolean;\n isSilent: boolean;\n skipSendingReceipt: boolean;\n emailIsVerified: boolean;\n skipFilterStep: boolean;\n dryRun: boolean;\n debug: boolean;\n defaultPhoneCountryCode: string;\n}\n\nexport async function upload(\n this: LocalContext,\n {\n auth,\n file,\n transcendUrl,\n cacheFilepath,\n requestReceiptFolder,\n sombraAuth,\n concurrency,\n attributes,\n isTest,\n isSilent,\n skipSendingReceipt,\n emailIsVerified,\n skipFilterStep,\n dryRun,\n debug,\n defaultPhoneCountryCode,\n }: UploadCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n await uploadPrivacyRequestsFromCsv({\n cacheFilepath,\n requestReceiptFolder,\n file,\n auth,\n sombraAuth,\n concurrency,\n transcendUrl,\n defaultPhoneCountryCode,\n attributes: splitCsvToList(attributes),\n debug,\n skipFilterStep,\n isSilent,\n skipSendingReceipt,\n emailIsVerified,\n isTest,\n dryRun,\n });\n}\n"],"mappings":"2QA0BA,eAAsB,EAEpB,CACE,OACA,OACA,eACA,gBACA,uBACA,aACA,cACA,aACA,SACA,WACA,qBACA,kBACA,iBACA,SACA,QACA,2BAEa,CACf,EAAoB,KAAK,QAAQ,KAAK,CAEtC,MAAM,EAA6B,CACjC,gBACA,uBACA,OACA,OACA,aACA,cACA,eACA,0BACA,WAAY,EAAe,EAAW,CACtC,QACA,iBACA,WACA,qBACA,kBACA,SACA,SACD,CAAC"}
|
package/dist/impl-BcayRe6a.mjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import"./enums-CyFTrzXY.mjs";import"./constants-CnLQtIBn.mjs";import"./logger-Bj782ZYD.mjs";import"./buildAIIntegrationType-Bk0EbFKV.mjs";import"./codecs-TR6p48v3.mjs";import"./syncConfigurationToTranscend-VJd0PnaZ.mjs";import{s as e}from"./consent-manager-c4bgQF1N.mjs";import"./uploadConsents-C1S-BNzw.mjs";import{t}from"./done-input-validation-CcZtaz03.mjs";async function n({auth:n,trackerStatus:r,file:i,classifyService:a,transcendUrl:o}){t(this.process.exit),await e({auth:n,trackerStatus:r,file:i,classifyService:a,transcendUrl:o})}export{n as uploadDataFlowsFromCsv};
|
|
2
|
-
//# sourceMappingURL=impl-BcayRe6a.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"impl-BcayRe6a.mjs","names":["uploadDataFlowsFromCsvHelper"],"sources":["../src/commands/consent/upload-data-flows-from-csv/impl.ts"],"sourcesContent":["import type { LocalContext } from '../../../context';\nimport { uploadDataFlowsFromCsv as uploadDataFlowsFromCsvHelper } from '../../../lib/consent-manager';\nimport { ConsentTrackerStatus } from '@transcend-io/privacy-types';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation';\n\nexport interface UploadDataFlowsFromCsvCommandFlags {\n auth: string;\n trackerStatus: ConsentTrackerStatus;\n file: string;\n classifyService: boolean;\n transcendUrl: string;\n}\n\nexport async function uploadDataFlowsFromCsv(\n this: LocalContext,\n {\n auth,\n trackerStatus,\n file,\n classifyService,\n transcendUrl,\n }: UploadDataFlowsFromCsvCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n await uploadDataFlowsFromCsvHelper({\n auth,\n trackerStatus,\n file,\n classifyService,\n transcendUrl,\n });\n}\n"],"mappings":"yWAaA,eAAsB,EAEpB,CACE,OACA,gBACA,OACA,kBACA,gBAEa,CACf,EAAoB,KAAK,QAAQ,KAAK,CAEtC,MAAMA,EAA6B,CACjC,OACA,gBACA,OACA,kBACA,eACD,CAAC"}
|
package/dist/impl-BkYKsEVG2.mjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import"./enums-CyFTrzXY.mjs";import"./constants-CnLQtIBn.mjs";import"./logger-Bj782ZYD.mjs";import"./buildAIIntegrationType-Bk0EbFKV.mjs";import{$ as e}from"./syncConfigurationToTranscend-VJd0PnaZ.mjs";import{t}from"./done-input-validation-CcZtaz03.mjs";import{RequestStatus as n}from"@transcend-io/privacy-types";async function r({auth:r,transcendUrl:i,folderPath:a,requestIds:o,statuses:s=[n.Approving,n.Downloadable],concurrency:c,createdAtBefore:l,createdAtAfter:u,updatedAtBefore:d,updatedAtAfter:f,approveAfterDownload:p}){t(this.process.exit),await e({transcendUrl:i,auth:r,folderPath:a,requestIds:o,statuses:s,concurrency:c,createdAtBefore:l,createdAtAfter:u,updatedAtBefore:d,updatedAtAfter:f,approveAfterDownload:p})}export{r as downloadFiles};
|
|
2
|
-
//# sourceMappingURL=impl-BkYKsEVG2.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"impl-BkYKsEVG2.mjs","names":[],"sources":["../src/commands/request/download-files/impl.ts"],"sourcesContent":["import type { LocalContext } from '../../../context';\nimport { downloadPrivacyRequestFiles } from '../../../lib/requests';\nimport { RequestStatus } from '@transcend-io/privacy-types';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation';\n\nexport interface DownloadFilesCommandFlags {\n auth: string;\n sombraAuth?: string;\n concurrency: number;\n requestIds?: string[];\n statuses?: RequestStatus[];\n folderPath: string;\n createdAtBefore?: Date;\n createdAtAfter?: Date;\n updatedAtBefore?: Date;\n updatedAtAfter?: Date;\n approveAfterDownload: boolean;\n transcendUrl: string;\n}\n\nexport async function downloadFiles(\n this: LocalContext,\n {\n auth,\n transcendUrl,\n folderPath,\n requestIds,\n statuses = [RequestStatus.Approving, RequestStatus.Downloadable],\n concurrency,\n createdAtBefore,\n createdAtAfter,\n updatedAtBefore,\n updatedAtAfter,\n approveAfterDownload,\n }: DownloadFilesCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n await downloadPrivacyRequestFiles({\n transcendUrl,\n auth,\n folderPath,\n requestIds,\n statuses,\n concurrency,\n createdAtBefore,\n createdAtAfter,\n updatedAtBefore,\n updatedAtAfter,\n approveAfterDownload,\n });\n}\n"],"mappings":"0TAoBA,eAAsB,EAEpB,CACE,OACA,eACA,aACA,aACA,WAAW,CAAC,EAAc,UAAW,EAAc,aAAa,CAChE,cACA,kBACA,iBACA,kBACA,iBACA,wBAEa,CACf,EAAoB,KAAK,QAAQ,KAAK,CAEtC,MAAM,EAA4B,CAChC,eACA,OACA,aACA,aACA,WACA,cACA,kBACA,iBACA,kBACA,iBACA,uBACD,CAAC"}
|
package/dist/impl-Bl2yVgh0.mjs
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import"./enums-CyFTrzXY.mjs";import{t as e}from"./constants-CnLQtIBn.mjs";import{t}from"./logger-Bj782ZYD.mjs";import"./buildAIIntegrationType-Bk0EbFKV.mjs";import"./codecs-TR6p48v3.mjs";import{ai as n,ei as r,ft as i}from"./syncConfigurationToTranscend-VJd0PnaZ.mjs";import"./api-keys-CxvKdj2v.mjs";import{t as a}from"./done-input-validation-CcZtaz03.mjs";import{n as o}from"./code-scanning-Cx1kpssH.mjs";import s from"colors";import c from"fast-glob";import{stringify as l}from"query-string";async function u({scanPath:e,fileGlobs:n,ignoreDirs:r,config:i}){let{ignoreDirs:a,supportedFiles:o,scanFunction:s}=i,l=n===``?o:o.concat(n.split(`,`)),d=[...r.split(`,`),...a].filter(e=>e.length>0);try{let n=await c(`${e}/**/${l.join(`|`)}`,{ignore:d.map(t=>`${e}/**/${t}`),unique:!0,onlyFiles:!0});t.info(`Scanning: ${n.length} files`);let r=n.map(e=>s(e)).flat().map(e=>e.softwareDevelopmentKits||[]).flat(),i=[...new Set(r.map(e=>e.name))];return t.info(`Found: ${i.length} unique dependencies`),i.map(t=>({name:t,resourceId:`${e}/**/${t}`,useStrictClassifier:!0}))}catch(e){throw Error(`Error scanning globs ${u} with error: ${e}`)}}async function d({scanPath:c,dataSiloId:d,auth:f,fileGlobs:p,ignoreDirs:m,transcendUrl:h}){a(this.process.exit);let g=n(h,f),_=await r(g,d),v=o[_.dataSilo.type];v||(t.error(s.red(`This plugin "${_.dataSilo.type}" is not supported for offline silo discovery.`)),this.process.exit(1));let y=await u({scanPath:c,fileGlobs:p,ignoreDirs:m,config:v});await i(g,_.id,y);let b=new URL(e);b.pathname=`/data-map/data-inventory/silo-discovery/triage`,b.search=l({filters:JSON.stringify({pluginIds:[_.id]})}),t.info(s.green(`Scan found ${y.length} potential data silos at ${c}! View at '${b.href}'
|
|
2
|
-
|
|
3
|
-
NOTE: it may take 2-3 minutes for scan results to appear in the UI.`))}export{d as discoverSilos};
|
|
4
|
-
//# sourceMappingURL=impl-Bl2yVgh0.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"impl-Bl2yVgh0.mjs","names":[],"sources":["../src/lib/code-scanning/findFilesToScan.ts","../src/commands/inventory/discover-silos/impl.ts"],"sourcesContent":["import fastGlob from 'fast-glob';\nimport { logger } from '../../logger';\nimport { CodeScanningConfig } from './types';\n\nexport interface SiloDiscoveryRawResults {\n /** The name of the potential data silo entry */\n name: string;\n /** A unique UUID (represents the same resource across different silo discovery runs) */\n resourceId: string;\n /** Any hosts associated with the entry */\n host?: string;\n /** Type of data silo */\n type?: string | undefined;\n}\n\n/**\n * Helper to scan for data silos in all package.json files that it can find in a directory\n *\n * @deprecated TODO: https://transcend.height.app/T-32325 - use code scanning instead\n * @param options - Options\n * @returns the list of integrations\n */\nexport async function findFilesToScan({\n scanPath,\n fileGlobs,\n ignoreDirs,\n config,\n}: {\n /** Where to look for package.json files */\n scanPath: string;\n /** Globs to look for */\n fileGlobs: string;\n /** The directories to ignore (excludes node_modules and serverless-build) */\n ignoreDirs: string;\n /** Silo Discovery configuration */\n config: CodeScanningConfig;\n}): Promise<SiloDiscoveryRawResults[]> {\n const { ignoreDirs: IGNORE_DIRS, supportedFiles, scanFunction } = config;\n const globsToSupport =\n fileGlobs === ''\n ? supportedFiles\n : supportedFiles.concat(fileGlobs.split(','));\n const dirsToIgnore = [...ignoreDirs.split(','), ...IGNORE_DIRS].filter(\n (dir) => dir.length > 0,\n );\n try {\n const filesToScan: string[] = await fastGlob(\n `${scanPath}/**/${globsToSupport.join('|')}`,\n {\n ignore: dirsToIgnore.map((dir: string) => `${scanPath}/**/${dir}`),\n unique: true,\n onlyFiles: true,\n },\n );\n logger.info(`Scanning: ${filesToScan.length} files`);\n const allPackages = filesToScan\n .map((filePath: string) => scanFunction(filePath))\n .flat();\n const allSdks = allPackages\n .map((appPackage) => appPackage.softwareDevelopmentKits || [])\n .flat();\n const uniqueDeps = new Set(allSdks.map((sdk) => sdk.name));\n const deps = [...uniqueDeps];\n logger.info(`Found: ${deps.length} unique dependencies`);\n return deps.map((dep) => ({\n name: dep,\n resourceId: `${scanPath}/**/${dep}`,\n useStrictClassifier: true,\n }));\n } catch (error) {\n throw new Error(\n `Error scanning globs ${findFilesToScan} with error: ${error}`,\n );\n }\n}\n","import type { LocalContext } from '../../../context';\nimport { stringify } from 'query-string';\nimport { logger } from '../../../logger';\nimport colors from 'colors';\nimport { ADMIN_DASH } from '../../../constants';\nimport {\n fetchActiveSiloDiscoPlugin,\n buildTranscendGraphQLClient,\n uploadSiloDiscoveryResults,\n} from '../../../lib/graphql';\nimport { findFilesToScan } from '../../../lib/code-scanning/findFilesToScan';\nimport { SILO_DISCOVERY_CONFIGS } from '../../../lib/code-scanning';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation';\n\nexport interface DiscoverSilosCommandFlags {\n scanPath: string;\n dataSiloId: string;\n auth: string;\n fileGlobs: string;\n ignoreDirs: string;\n transcendUrl: string;\n}\n\nexport async function discoverSilos(\n this: LocalContext,\n {\n scanPath,\n dataSiloId,\n auth,\n fileGlobs,\n ignoreDirs,\n transcendUrl,\n }: DiscoverSilosCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n // Create a GraphQL client\n const client = buildTranscendGraphQLClient(transcendUrl, auth);\n\n const plugin = await fetchActiveSiloDiscoPlugin(client, dataSiloId);\n\n const config = SILO_DISCOVERY_CONFIGS[plugin.dataSilo.type];\n if (!config) {\n logger.error(\n colors.red(\n `This plugin \"${plugin.dataSilo.type}\" is not supported for offline silo discovery.`,\n ),\n );\n this.process.exit(1);\n }\n\n const results = await findFilesToScan({\n scanPath,\n fileGlobs,\n ignoreDirs,\n config,\n });\n\n await uploadSiloDiscoveryResults(client, plugin.id, results);\n\n const newUrl = new URL(ADMIN_DASH);\n newUrl.pathname = '/data-map/data-inventory/silo-discovery/triage';\n newUrl.search = stringify({\n filters: JSON.stringify({ pluginIds: [plugin.id] }),\n });\n\n // Indicate success\n logger.info(\n colors.green(\n `Scan found ${results.length} potential data silos at ${scanPath}! ` +\n `View at '${newUrl.href}' ` +\n '\\n\\n NOTE: it may take 2-3 minutes for scan results to appear in the UI.',\n ),\n );\n}\n"],"mappings":"8eAsBA,eAAsB,EAAgB,CACpC,WACA,YACA,aACA,UAUqC,CACrC,GAAM,CAAE,WAAY,EAAa,iBAAgB,gBAAiB,EAC5D,EACJ,IAAc,GACV,EACA,EAAe,OAAO,EAAU,MAAM,IAAI,CAAC,CAC3C,EAAe,CAAC,GAAG,EAAW,MAAM,IAAI,CAAE,GAAG,EAAY,CAAC,OAC7D,GAAQ,EAAI,OAAS,EACvB,CACD,GAAI,CACF,IAAM,EAAwB,MAAM,EAClC,GAAG,EAAS,MAAM,EAAe,KAAK,IAAI,GAC1C,CACE,OAAQ,EAAa,IAAK,GAAgB,GAAG,EAAS,MAAM,IAAM,CAClE,OAAQ,GACR,UAAW,GACZ,CACF,CACD,EAAO,KAAK,aAAa,EAAY,OAAO,QAAQ,CAIpD,IAAM,EAHc,EACjB,IAAK,GAAqB,EAAa,EAAS,CAAC,CACjD,MAAM,CAEN,IAAK,GAAe,EAAW,yBAA2B,EAAE,CAAC,CAC7D,MAAM,CAEH,EAAO,CAAC,GADK,IAAI,IAAI,EAAQ,IAAK,GAAQ,EAAI,KAAK,CAAC,CAC9B,CAE5B,OADA,EAAO,KAAK,UAAU,EAAK,OAAO,sBAAsB,CACjD,EAAK,IAAK,IAAS,CACxB,KAAM,EACN,WAAY,GAAG,EAAS,MAAM,IAC9B,oBAAqB,GACtB,EAAE,OACI,EAAO,CACd,MAAU,MACR,wBAAwB,EAAgB,eAAe,IACxD,ECjDL,eAAsB,EAEpB,CACE,WACA,aACA,OACA,YACA,aACA,gBAEa,CACf,EAAoB,KAAK,QAAQ,KAAK,CAGtC,IAAM,EAAS,EAA4B,EAAc,EAAK,CAExD,EAAS,MAAM,EAA2B,EAAQ,EAAW,CAE7D,EAAS,EAAuB,EAAO,SAAS,MACjD,IACH,EAAO,MACL,EAAO,IACL,gBAAgB,EAAO,SAAS,KAAK,gDACtC,CACF,CACD,KAAK,QAAQ,KAAK,EAAE,EAGtB,IAAM,EAAU,MAAM,EAAgB,CACpC,WACA,YACA,aACA,SACD,CAAC,CAEF,MAAM,EAA2B,EAAQ,EAAO,GAAI,EAAQ,CAE5D,IAAM,EAAS,IAAI,IAAI,EAAW,CAClC,EAAO,SAAW,iDAClB,EAAO,OAAS,EAAU,CACxB,QAAS,KAAK,UAAU,CAAE,UAAW,CAAC,EAAO,GAAG,CAAE,CAAC,CACpD,CAAC,CAGF,EAAO,KACL,EAAO,MACL,cAAc,EAAQ,OAAO,2BAA2B,EAAS,aACnD,EAAO,KAAK;;sEAE3B,CACF"}
|
package/dist/impl-BmAMgEEM.mjs
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import"./enums-CyFTrzXY.mjs";import"./constants-CnLQtIBn.mjs";import{t as e}from"./logger-Bj782ZYD.mjs";import"./buildAIIntegrationType-Bk0EbFKV.mjs";import{As as t,ii as n,l as r}from"./syncConfigurationToTranscend-VJd0PnaZ.mjs";import{t as i}from"./done-input-validation-CcZtaz03.mjs";import{t as a}from"./preference-management-8gj7aSJB.mjs";import{readdirSync as o}from"node:fs";import{join as s}from"node:path";import c from"colors";import l from"cli-progress";async function u({auth:u,partition:d,sombraAuth:f,file:p=``,directory:m,transcendUrl:h,timestamp:g,maxConcurrency:_,maxItemsInChunk:v,receiptDirectory:y,fileConcurrency:b}){m&&p&&(e.error(c.red(`Cannot provide both a directory and a file. Please provide only one.`)),this.process.exit(1)),!p&&!m&&(e.error(c.red(`A file or directory must be provided. Please provide one using --file=./preferences.csv or --directory=./preferences`)),this.process.exit(1)),i(this.process.exit);let x=[];if(m)try{let t=o(m).filter(e=>e.endsWith(`.csv`));t.length===0&&(e.error(c.red(`No CSV files found in directory: ${m}`)),this.process.exit(1)),x.push(...t.map(e=>s(m,e)))}catch(t){e.error(c.red(`Failed to read directory: ${m}`)),e.error(c.red(t.message)),this.process.exit(1)}else try{p.endsWith(`.csv`)||(e.error(c.red(`File must be a CSV file`)),this.process.exit(1)),x.push(p)}catch(t){e.error(c.red(`Failed to access file: ${p}`)),e.error(c.red(t.message)),this.process.exit(1)}e.debug(c.green(`Processing ${x.length} consent preferences files for partition: ${d}`)),e.debug(`\nFiles to process: ${x.join(`, `)}\n`);let S=await n(h,u,f),C=new l.SingleBar({format:`Deletion Progress |${c.cyan(`[{bar}]`)}| Duration: ${c.red(`{duration_formatted}`)} | {value}/{total} Files Processed `},l.Presets.shades_classic);C.start(x.length,0);let w=await t(x,async e=>{let t=await a(S,{partition:d,filePath:e,timestamp:g,maxItemsInChunk:v,maxConcurrency:_});return C.increment(),t},{concurrency:b});C.stop();let T=w.flat(),E=``;T.length>0&&(E=s(y,`deletion-failures-${Date.now()}.csv`),r(E,T,!0)),e.info(c.green(`
|
|
2
|
-
|
|
3
|
-
==================================
|
|
4
|
-
|
|
5
|
-
`)),e.info(c.green(`
|
|
6
|
-
#### Deletion Summary Report #####
|
|
7
|
-
`)),e.info(c.green(`📁 Total Files Processed: ${x.length} \n❌ Errors: ${T.length} \n📝 Receipt Path: ${E||`N/A`}`)),e.info(c.green(`
|
|
8
|
-
|
|
9
|
-
==================================
|
|
10
|
-
|
|
11
|
-
`))}export{u as deletePreferenceRecords};
|
|
12
|
-
//# sourceMappingURL=impl-BmAMgEEM.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"impl-BmAMgEEM.mjs","names":[],"sources":["../src/commands/consent/delete-preference-records/impl.ts"],"sourcesContent":["import type { LocalContext } from '../../../context';\nimport colors from 'colors';\n\nimport { createSombraGotInstance } from '../../../lib/graphql';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation';\nimport { logger } from '../../../logger';\nimport { readdirSync } from 'node:fs';\nimport { join } from 'node:path';\nimport { map } from '../../../lib/bluebird';\nimport { bulkDeletePreferenceRecords } from '../../../lib/preference-management';\nimport cliProgress from 'cli-progress';\nimport { writeCsv } from '../../../lib/helpers';\n\nexport interface DeletePreferenceRecordsCommandFlags {\n /** Transcend API key for authentication */\n auth: string;\n /** Partition ID to delete preference records from */\n partition: string;\n /** Optional Sombra internal key for self-hosted instances */\n sombraAuth?: string;\n /** Path to the CSV file used to identify preference records to delete */\n file?: string;\n /** Path to the directory of CSV files to load preferences from */\n directory?: string;\n /** Base URL for the Transcend API */\n transcendUrl: string;\n /** The timestamp when the deletion operation is made. Used for logging purposes. */\n timestamp: Date;\n /** Maximum items to include in each deletion chunk */\n maxItemsInChunk: number;\n /** Maximum concurrency for deletion requests */\n maxConcurrency: number;\n /** Directory to write receipts of failed deletions to */\n receiptDirectory: string;\n /** Number of files to process concurrently when deleting preference records from multiple files */\n fileConcurrency: number;\n}\n\nexport async function deletePreferenceRecords(\n this: LocalContext,\n {\n auth,\n partition,\n sombraAuth,\n file = '',\n directory,\n transcendUrl,\n timestamp,\n maxConcurrency,\n maxItemsInChunk,\n receiptDirectory,\n fileConcurrency,\n }: DeletePreferenceRecordsCommandFlags,\n): Promise<void> {\n if (!!directory && !!file) {\n logger.error(\n colors.red(\n 'Cannot provide both a directory and a file. Please provide only one.',\n ),\n );\n this.process.exit(1);\n }\n\n if (!file && !directory) {\n logger.error(\n colors.red(\n 'A file or directory must be provided. Please provide one using --file=./preferences.csv or --directory=./preferences',\n ),\n );\n this.process.exit(1);\n }\n doneInputValidation(this.process.exit);\n\n const files: string[] = [];\n\n if (directory) {\n try {\n const filesInDirectory = readdirSync(directory);\n const csvFiles = filesInDirectory.filter((file) => file.endsWith('.csv'));\n\n if (csvFiles.length === 0) {\n logger.error(\n colors.red(`No CSV files found in directory: ${directory}`),\n );\n this.process.exit(1);\n }\n\n // Add full paths for each CSV file\n files.push(...csvFiles.map((file) => join(directory, file)));\n } catch (err) {\n logger.error(colors.red(`Failed to read directory: ${directory}`));\n logger.error(colors.red((err as Error).message));\n this.process.exit(1);\n }\n } else {\n try {\n // Verify file exists and is a CSV\n if (!file.endsWith('.csv')) {\n logger.error(colors.red('File must be a CSV file'));\n this.process.exit(1);\n }\n files.push(file);\n } catch (err) {\n logger.error(colors.red(`Failed to access file: ${file}`));\n logger.error(colors.red((err as Error).message));\n this.process.exit(1);\n }\n }\n\n logger.debug(\n colors.green(\n `Processing ${files.length} consent preferences files for partition: ${partition}`,\n ),\n );\n logger.debug(`\\nFiles to process: ${files.join(', ')}\\n`);\n\n // Create sombra instance to communicate with\n const sombra = await createSombraGotInstance(transcendUrl, auth, sombraAuth);\n const globalProgressBar = new cliProgress.SingleBar(\n {\n format: `Deletion Progress |${colors.cyan(\n '[{bar}]',\n )}| Duration: ${colors.red(\n '{duration_formatted}',\n )} | {value}/{total} Files Processed `,\n },\n cliProgress.Presets.shades_classic,\n );\n globalProgressBar.start(files.length, 0);\n\n // Process batch of files with concurrency\n const failedResultsArrays = await map(\n files,\n async (filePath) => {\n const result = await bulkDeletePreferenceRecords(sombra, {\n partition,\n filePath,\n timestamp,\n maxItemsInChunk,\n maxConcurrency,\n });\n globalProgressBar.increment();\n return result;\n },\n { concurrency: fileConcurrency },\n );\n globalProgressBar.stop();\n const failedResults = failedResultsArrays.flat();\n\n // Check for failed results and write receipt if any\n let receiptPath = '';\n if (failedResults.length > 0) {\n receiptPath = join(receiptDirectory, `deletion-failures-${Date.now()}.csv`);\n writeCsv(receiptPath, failedResults, true);\n }\n\n logger.info(colors.green('\\n\\n ================================== \\n\\n'));\n logger.info(colors.green('\\n#### Deletion Summary Report #####\\n'));\n logger.info(\n colors.green(\n `📁 Total Files Processed: ${files.length} \\n` +\n `❌ Errors: ${failedResults.length} \\n` +\n `📝 Receipt Path: ${receiptPath || 'N/A'}`,\n ),\n );\n logger.info(colors.green('\\n\\n==================================\\n\\n'));\n}\n"],"mappings":"idAsCA,eAAsB,EAEpB,CACE,OACA,YACA,aACA,OAAO,GACP,YACA,eACA,YACA,iBACA,kBACA,mBACA,mBAEa,CACT,GAAe,IACnB,EAAO,MACL,EAAO,IACL,uEACD,CACF,CACD,KAAK,QAAQ,KAAK,EAAE,EAGlB,CAAC,GAAQ,CAAC,IACZ,EAAO,MACL,EAAO,IACL,uHACD,CACF,CACD,KAAK,QAAQ,KAAK,EAAE,EAEtB,EAAoB,KAAK,QAAQ,KAAK,CAEtC,IAAM,EAAkB,EAAE,CAE1B,GAAI,EACF,GAAI,CAEF,IAAM,EADmB,EAAY,EAAU,CACb,OAAQ,GAAS,EAAK,SAAS,OAAO,CAAC,CAErE,EAAS,SAAW,IACtB,EAAO,MACL,EAAO,IAAI,oCAAoC,IAAY,CAC5D,CACD,KAAK,QAAQ,KAAK,EAAE,EAItB,EAAM,KAAK,GAAG,EAAS,IAAK,GAAS,EAAK,EAAW,EAAK,CAAC,CAAC,OACrD,EAAK,CACZ,EAAO,MAAM,EAAO,IAAI,6BAA6B,IAAY,CAAC,CAClE,EAAO,MAAM,EAAO,IAAK,EAAc,QAAQ,CAAC,CAChD,KAAK,QAAQ,KAAK,EAAE,MAGtB,GAAI,CAEG,EAAK,SAAS,OAAO,GACxB,EAAO,MAAM,EAAO,IAAI,0BAA0B,CAAC,CACnD,KAAK,QAAQ,KAAK,EAAE,EAEtB,EAAM,KAAK,EAAK,OACT,EAAK,CACZ,EAAO,MAAM,EAAO,IAAI,0BAA0B,IAAO,CAAC,CAC1D,EAAO,MAAM,EAAO,IAAK,EAAc,QAAQ,CAAC,CAChD,KAAK,QAAQ,KAAK,EAAE,CAIxB,EAAO,MACL,EAAO,MACL,cAAc,EAAM,OAAO,4CAA4C,IACxE,CACF,CACD,EAAO,MAAM,uBAAuB,EAAM,KAAK,KAAK,CAAC,IAAI,CAGzD,IAAM,EAAS,MAAM,EAAwB,EAAc,EAAM,EAAW,CACtE,EAAoB,IAAI,EAAY,UACxC,CACE,OAAQ,sBAAsB,EAAO,KACnC,UACD,CAAC,cAAc,EAAO,IACrB,uBACD,CAAC,qCACH,CACD,EAAY,QAAQ,eACrB,CACD,EAAkB,MAAM,EAAM,OAAQ,EAAE,CAGxC,IAAM,EAAsB,MAAM,EAChC,EACA,KAAO,IAAa,CAClB,IAAM,EAAS,MAAM,EAA4B,EAAQ,CACvD,YACA,WACA,YACA,kBACA,iBACD,CAAC,CAEF,OADA,EAAkB,WAAW,CACtB,GAET,CAAE,YAAa,EAAiB,CACjC,CACD,EAAkB,MAAM,CACxB,IAAM,EAAgB,EAAoB,MAAM,CAG5C,EAAc,GACd,EAAc,OAAS,IACzB,EAAc,EAAK,EAAkB,qBAAqB,KAAK,KAAK,CAAC,MAAM,CAC3E,EAAS,EAAa,EAAe,GAAK,EAG5C,EAAO,KAAK,EAAO,MAAM;;;;EAA+C,CAAC,CACzE,EAAO,KAAK,EAAO,MAAM;;EAAyC,CAAC,CACnE,EAAO,KACL,EAAO,MACL,6BAA6B,EAAM,OAAO,eAC3B,EAAc,OAAO,sBACd,GAAe,QACtC,CACF,CACD,EAAO,KAAK,EAAO,MAAM;;;;EAA6C,CAAC"}
|
package/dist/impl-BsttzxTN2.mjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import"./enums-CyFTrzXY.mjs";import"./constants-CnLQtIBn.mjs";import"./logger-Bj782ZYD.mjs";import"./buildAIIntegrationType-Bk0EbFKV.mjs";import{P as e}from"./syncConfigurationToTranscend-VJd0PnaZ.mjs";import{t}from"./done-input-validation-CcZtaz03.mjs";async function n({auth:n,transcendUrl:r,identifierNames:i,actions:a=[]}){t(this.process.exit),await e({requestActions:a,transcendUrl:r,auth:n,identifierNames:i})}export{n as rejectUnverifiedIdentifiers};
|
|
2
|
-
//# sourceMappingURL=impl-BsttzxTN2.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"impl-BsttzxTN2.mjs","names":[],"sources":["../src/commands/request/reject-unverified-identifiers/impl.ts"],"sourcesContent":["import type { LocalContext } from '../../../context';\nimport { removeUnverifiedRequestIdentifiers } from '../../../lib/requests';\nimport type { RequestAction } from '@transcend-io/privacy-types';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation';\n\nexport interface RejectUnverifiedIdentifiersCommandFlags {\n auth: string;\n identifierNames: string[];\n actions?: RequestAction[];\n transcendUrl: string;\n}\n\nexport async function rejectUnverifiedIdentifiers(\n this: LocalContext,\n {\n auth,\n transcendUrl,\n identifierNames,\n actions = [],\n }: RejectUnverifiedIdentifiersCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n await removeUnverifiedRequestIdentifiers({\n requestActions: actions,\n transcendUrl,\n auth,\n identifierNames,\n });\n}\n"],"mappings":"8PAYA,eAAsB,EAEpB,CACE,OACA,eACA,kBACA,UAAU,EAAE,EAEC,CACf,EAAoB,KAAK,QAAQ,KAAK,CAEtC,MAAM,EAAmC,CACvC,eAAgB,EAChB,eACA,OACA,kBACD,CAAC"}
|
package/dist/impl-BtnySmbi.mjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import"./enums-CyFTrzXY.mjs";import"./constants-CnLQtIBn.mjs";import{t as e}from"./logger-Bj782ZYD.mjs";import"./buildAIIntegrationType-Bk0EbFKV.mjs";import{ui as t}from"./syncConfigurationToTranscend-VJd0PnaZ.mjs";import{n}from"./cron-BvxWyvDu.mjs";import{t as r}from"./done-input-validation-CcZtaz03.mjs";import i from"colors";import*as a from"io-ts";const o=a.type({"Request Id":a.string});async function s({auth:a,dataSiloId:s,file:c,transcendUrl:l}){r(this.process.exit),e.info(i.magenta(`Reading "${c}" from disk`)),await n({requestIds:t(c,o).map(e=>e[`Request Id`]),transcendUrl:l,auth:a,dataSiloId:s})}export{s as markRequestDataSilosCompleted};
|
|
2
|
-
//# sourceMappingURL=impl-BtnySmbi.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"impl-BtnySmbi.mjs","names":[],"sources":["../src/commands/request/system/mark-request-data-silos-completed/impl.ts"],"sourcesContent":["import type { LocalContext } from '../../../../context';\nimport colors from 'colors';\nimport * as t from 'io-ts';\n\nimport { logger } from '../../../../logger';\nimport { markRequestDataSiloIdsCompleted } from '../../../../lib/cron';\nimport { readCsv } from '../../../../lib/requests';\nimport { doneInputValidation } from '../../../../lib/cli/done-input-validation';\n\nconst RequestIdRow = t.type({\n 'Request Id': t.string,\n});\n\nexport interface MarkRequestDataSilosCompletedCommandFlags {\n auth: string;\n dataSiloId: string;\n file: string;\n transcendUrl: string;\n}\n\nexport async function markRequestDataSilosCompleted(\n this: LocalContext,\n {\n auth,\n dataSiloId,\n file,\n transcendUrl,\n }: MarkRequestDataSilosCompletedCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n logger.info(colors.magenta(`Reading \"${file}\" from disk`));\n const activeResults = readCsv(file, RequestIdRow);\n\n await markRequestDataSiloIdsCompleted({\n requestIds: activeResults.map((request) => request['Request Id']),\n transcendUrl,\n auth,\n dataSiloId,\n });\n}\n"],"mappings":"iWASA,MAAM,EAAe,EAAE,KAAK,CAC1B,aAAc,EAAE,OACjB,CAAC,CASF,eAAsB,EAEpB,CACE,OACA,aACA,OACA,gBAEa,CACf,EAAoB,KAAK,QAAQ,KAAK,CAEtC,EAAO,KAAK,EAAO,QAAQ,YAAY,EAAK,aAAa,CAAC,CAG1D,MAAM,EAAgC,CACpC,WAHoB,EAAQ,EAAM,EAAa,CAGrB,IAAK,GAAY,EAAQ,cAAc,CACjE,eACA,OACA,aACD,CAAC"}
|
package/dist/impl-BwX-evfW2.mjs
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import{n as e,r as t,t as n}from"./enums-CyFTrzXY.mjs";import"./constants-CnLQtIBn.mjs";import{t as r}from"./logger-Bj782ZYD.mjs";import"./buildAIIntegrationType-Bk0EbFKV.mjs";import{As as i,ai as a,i as o,js as s,wo as c}from"./syncConfigurationToTranscend-VJd0PnaZ.mjs";import{t as l}from"./done-input-validation-CcZtaz03.mjs";import{OneTrustEnrichedAssessment as u,OneTrustGetAssessmentResponse as d,OneTrustGetListOfAssessmentsResponse as f,OneTrustGetRiskResponse as p,OneTrustGetUserResponse as m}from"@transcend-io/privacy-types";import{keyBy as h,uniq as g}from"lodash-es";import{decodeCodec as _}from"@transcend-io/type-utils";import v,{createReadStream as y}from"node:fs";import b from"colors";import"yargs-parser";import x from"got";import S from"JSONStream";const C=({hostname:e,auth:t})=>x.extend({prefixUrl:`https://${e}`,headers:{accept:`application/json`,"content-type":`application/json`,authorization:`Bearer ${t}`}});Object.values(e);const w=({assessment:e,index:t,total:n,wrap:r=!0})=>{let i=``;(t===0||r)&&(i=`[
|
|
2
|
-
`);let a=JSON.stringify(e),o=n&&t<n-1&&!r?`,`:``;return i=`${i+a+o}\n`,(n&&t===n-1||r)&&(i+=`
|
|
3
|
-
]`),i},T=({file:e,assessment:t,index:n,total:i})=>{r.info(b.magenta(`Writing enriched assessment ${n+1} of ${i} to file "${e}"...`)),n===0?v.writeFileSync(e,w({assessment:t,index:n,total:i,wrap:!1})):v.appendFileSync(e,w({assessment:t,index:n,total:i,wrap:!1}))},E=async({oneTrust:e})=>{let t=0,n=1,i=0,a=[];for(;t<n;){let{body:o}=await e.get(`api/assessment/v2/assessments?page=${t}&size=2000`),{page:s,content:c}=_(f,o);a.push(...c??[]),t===0&&(n=s?.totalPages??0,i=s?.totalElements??0),t+=1,r.info(`Fetched ${a.length} of ${i} assessments.`)}return a},D=async({oneTrust:e,assessmentId:t})=>{let{body:n}=await e.get(`api/assessment/v2/assessments/${t}/export?ExcludeSkippedQuestions=false`);return _(d,n)},O=async({oneTrust:e,riskId:t})=>{let{body:n}=await e.get(`api/risk/v2/risks/${t}`);return _(p,n)},k=async({oneTrust:e,userId:t})=>{let{body:n}=await e.get(`api/scim/v2/Users/${t}`);return _(m,n)},A=({assessment:e,assessmentDetails:t,riskDetails:n,creatorDetails:r,approversDetails:i,respondentsDetails:a})=>{let o=h(n,`id`),{sections:s,createdBy:c,...l}=t,u=s.map(e=>{let{questions:t,...n}=e,r=t.map(e=>{let{risks:t,...n}=e,r=(t??[]).map(e=>{let t=o[e.riskId];return{...e,...t,level:e.level,impactLevel:e.impactLevel??0}});return{...n,risks:r}});return{...n,questions:r}}),d={...c,active:r?.active??!1,userType:r?.userType??`Internal`,emails:r?.emails??[],title:r?.title??null,givenName:r?.name.givenName??null,familyName:r?.name.familyName??null},f=h(i,`id`),p=t.approvers.flatMap(e=>f[e.id]?[{...e,approver:{...e.approver,active:f[e.id].active,userType:f[e.id].userType,emails:f[e.id].emails,title:f[e.id].title,givenName:f[e.id].name.givenName??null,familyName:f[e.id].name.familyName??null}}]:[]),m=h(a,`id`),g=t.respondents.filter(e=>!e.name.includes(`@`)).flatMap(e=>m[e.id]?[{...e,active:m[e.id].active,userType:m[e.id].userType,emails:m[e.id].emails,title:m[e.id].title,givenName:m[e.id].name.givenName??null,familyName:m[e.id].name.familyName??null}]:[]);return{...e,...l,approvers:p,respondents:g,createdBy:d,sections:u}},j=async({transcend:e,assessment:t,total:n,index:i})=>{r.info(b.magenta(`Writing enriched assessment ${i+1} ${n?`of ${n} `:` `}to Transcend...`));let a={json:w({assessment:t,index:i,total:n})};try{await o(e,c,{input:a})}catch{r.error(b.red(`Failed to sync assessment ${i+1} ${n?`of ${n} `:` `}to Transcend.\n\tAssessment Title: ${t.name}. Template Title: ${t.template.name}\n`))}},M=async({oneTrust:e,file:t,dryRun:n,transcend:a})=>{r.info(`Getting list of all assessments from OneTrust...`);let o=await E({oneTrust:e}),c={};await s(Array.from({length:Math.ceil(o.length/5)},(e,t)=>o.slice(t*5,(t+1)*5)),async(l,u)=>{let d=[];await i(l,async(t,n)=>{let a=5*u+n+1;r.info(`[assessment ${a} of ${o.length}]: fetching details...`);let{templateName:s,assessmentId:l}=t,f=await D({oneTrust:e,assessmentId:l}),p=f.createdBy.id,m=c[p];if(!m){r.info(`[assessment ${a} of ${o.length}]: fetching creator...`);try{m=await k({oneTrust:e,userId:p}),c[p]=m}catch{r.warn(b.yellow(`[assessment ${a} of ${o.length}]: failed to fetch form creator.\tcreatorId: ${p}. Assessment Title: ${t.name}. Template Title: ${s}`))}}let{approvers:h}=f,_=[];h.length>0&&(r.info(`[assessment ${a} of ${o.length}]: fetching approvers...`),_=await i(h.map(({id:e})=>e),async n=>{try{let t=c[n];return t||(t=await k({oneTrust:e,userId:n}),c[n]=t),[t]}catch{return r.warn(b.yellow(`[assessment ${a} of ${o.length}]: failed to fetch a form approver.\tapproverId: ${n}. Assessment Title: ${t.name}. Template Title: ${s}`)),[]}},{concurrency:5}));let{respondents:v}=f,y=v.filter(e=>!e.name.includes(`@`)),x=[];y.length>0&&(r.info(`[assessment ${a} of ${o.length}]: fetching respondents...`),x=await i(y.map(({id:e})=>e),async n=>{try{let t=c[n];return t||(t=await k({oneTrust:e,userId:n}),c[n]=t),[t]}catch{return r.warn(b.yellow(`[assessment ${a} of ${o.length}]: failed to fetch a respondent.\trespondentId: ${n}. Assessment Title: ${t.name}. Template Title: ${s}`)),[]}},{concurrency:5}));let S=[],C=g(f.sections.flatMap(e=>e.questions.flatMap(e=>(e.risks??[]).flatMap(e=>e.riskId))));C.length>0&&(r.info(`[assessment ${a} of ${o.length}]: fetching risks...`),S=await i(C,t=>O({oneTrust:e,riskId:t}),{concurrency:5}));let w=A({assessment:t,assessmentDetails:f,riskDetails:S,creatorDetails:m,approversDetails:_.flat(),respondentsDetails:x.flat()});d.push(w)},{concurrency:5}),await s(d,async(e,r)=>{let i=u*5+r;n&&t?T({assessment:e,index:i,total:o.length,file:t}):a&&await j({assessment:e,transcend:a,total:o.length,index:i})})})},N=({transcend:e,file:t})=>(r.info(`Getting list of all assessments from file ${t}...`),new Promise((n,i)=>{let a=y(t,{encoding:`utf-8`,highWaterMark:64*1024}),o=S.parse(`*`),s=0;a.pipe(o),o.on(`data`,async n=>{try{o.pause(),await j({assessment:_(u,n),transcend:e,index:s}),s+=1,o.resume()}catch(e){r.error(b.red(`Failed to parse the assessment ${s} from file '${t}': ${e.message}.`))}}),o.on(`end`,()=>{r.info(`Finished processing ${s} assessments from file ${t}`),n()}),o.on(`error`,e=>{r.error(b.red(`Error parsing file '${t}': ${e.message}`)),i(e)}),a.on(`error`,e=>{r.error(b.red(`Error reading file '${t}': ${e.message}`)),i(e)})}));async function P({hostname:i,oneTrustAuth:o,source:s,transcendAuth:c,transcendUrl:u,resource:d,file:f,dryRun:p,debug:m}){if(!p&&!c)throw Error('Must specify a "transcendAuth" parameter to sync resources to Transcend. e.g. --transcendAuth=${TRANSCEND_API_KEY}');if(p&&!f)throw Error(`Must set a "file" parameter when "dryRun" is "true". e.g. --file=./oneTrustAssessments.json`);if(f){let e=f.split(`.`);if(e.length<2)throw Error(`The "file" parameter has an invalid format. Expected a path with extensions. e.g. --file=./pathToFile.json.`);if(e.at(-1)!==n.Json)throw Error(`Expected the format of the "file" parameters '${f}' to be '${n.Json}', but got '${e.at(-1)}'.`)}if(s===t.OneTrust){if(!i)throw Error(`Missing required parameter "hostname". e.g. --hostname=customer.my.onetrust.com`);if(!o)throw Error(`Missing required parameter "oneTrustAuth". e.g. --oneTrustAuth=$ONE_TRUST_AUTH_TOKEN`)}else{if(!f)throw Error(`Must specify a "file" parameter to read the OneTrust assessments from. e.g. --source=./oneTrustAssessments.json`);if(p)throw Error(`Cannot read and write to a file simultaneously. Emit the "source" parameter or set it to ${t.OneTrust} if "dryRun" is enabled.`)}l(this.process.exit);let h=i&&o?C({hostname:i,auth:o}):void 0,g=u&&c?a(u,c):void 0;try{d===e.Assessments&&(s===t.OneTrust&&h?await M({oneTrust:h,file:f,dryRun:p,...g&&{transcend:g}}):s===t.File&&f&&g&&await N({file:f,transcend:g}))}catch(e){throw Error(`An error occurred syncing the resource ${d} from OneTrust: ${m?e.stack:e.message}`)}r.info(b.green(`Successfully synced OneTrust ${d} to ${p?`disk at "${f}"`:`Transcend`}!`))}export{P as syncOt};
|
|
4
|
-
//# sourceMappingURL=impl-BwX-evfW2.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"impl-BwX-evfW2.mjs","names":[],"sources":["../src/lib/oneTrust/createOneTrustGotInstance.ts","../src/lib/oneTrust/helpers/parseCliSyncOtArguments.ts","../src/lib/oneTrust/helpers/oneTrustAssessmentToJson.ts","../src/lib/oneTrust/helpers/syncOneTrustAssessmentToDisk.ts","../src/lib/oneTrust/endpoints/getListOfOneTrustAssessments.ts","../src/lib/oneTrust/endpoints/getOneTrustAssessment.ts","../src/lib/oneTrust/endpoints/getOneTrustRisk.ts","../src/lib/oneTrust/endpoints/getOneTrustUser.ts","../src/lib/oneTrust/helpers/enrichOneTrustAssessment.ts","../src/lib/oneTrust/helpers/syncOneTrustAssessmentToTranscend.ts","../src/lib/oneTrust/helpers/syncOneTrustAssessmentsFromOneTrust.ts","../src/lib/oneTrust/helpers/syncOneTrustAssessmentsFromFile.ts","../src/commands/migration/sync-ot/impl.ts"],"sourcesContent":["import got, { Got } from 'got';\n\n/**\n * Instantiate an instance of got that is capable of making requests to OneTrust\n *\n * @param param - information about the OneTrust URL\n * @returns The instance of got that is capable of making requests to the customer ingress\n */\nexport const createOneTrustGotInstance = ({\n hostname,\n auth,\n}: {\n /** Hostname of the OneTrust API */\n hostname: string;\n /** The OAuth access token */\n auth: string;\n}): Got =>\n got.extend({\n prefixUrl: `https://${hostname}`,\n headers: {\n accept: 'application/json',\n 'content-type': 'application/json',\n authorization: `Bearer ${auth}`,\n },\n });\n","import { logger } from '../../../logger';\nimport colors from 'colors';\nimport yargs from 'yargs-parser';\nimport {\n OneTrustFileFormat,\n OneTrustPullResource,\n OneTrustPullSource,\n} from '../../../enums';\n\nconst VALID_RESOURCES = Object.values(OneTrustPullResource);\n\ninterface OneTrustCliArguments {\n /** The name of the file to write the resources to */\n file: string;\n /** The OneTrust hostname to send the requests to */\n hostname?: string;\n /** The OAuth Bearer token used to authenticate the requests to OneTrust */\n oneTrustAuth?: string;\n /** The Transcend API key to authenticate the requests to Transcend */\n transcendAuth: string;\n /** The Transcend URL where to forward requests */\n transcendUrl: string;\n /** The resource to pull from OneTrust */\n resource: OneTrustPullResource;\n /** Whether to enable debugging while reporting errors */\n debug: boolean;\n /** Whether to export the resource into a file rather than push to transcend */\n dryRun: boolean;\n /** Where to read the OneTrust resource from */\n source: OneTrustPullSource;\n}\n\n/**\n * Parse the command line arguments\n *\n * @returns the parsed arguments\n */\nexport const parseCliSyncOtArguments = (): OneTrustCliArguments => {\n const {\n file,\n hostname,\n oneTrustAuth,\n resource,\n debug,\n dryRun,\n transcendAuth,\n transcendUrl,\n source,\n } = yargs(process.argv.slice(2), {\n string: [\n 'file',\n 'hostname',\n 'oneTrustAuth',\n 'resource',\n 'dryRun',\n 'transcendAuth',\n 'transcendUrl',\n 'source',\n ],\n boolean: ['debug', 'dryRun'],\n default: {\n resource: OneTrustPullResource.Assessments,\n debug: false,\n dryRun: false,\n transcendUrl: 'https://api.transcend.io',\n source: OneTrustPullSource.OneTrust,\n },\n });\n\n // Must be able to authenticate to transcend to sync resources to it\n if (!dryRun && !transcendAuth) {\n logger.error(\n colors.red(\n // eslint-disable-next-line no-template-curly-in-string\n 'Must specify a \"transcendAuth\" parameter to sync resources to Transcend. e.g. --transcendAuth=${TRANSCEND_API_KEY}',\n ),\n );\n return process.exit(1);\n }\n if (!dryRun && !transcendUrl) {\n logger.error(\n colors.red(\n // eslint-disable-next-line max-len\n 'Must specify a \"transcendUrl\" parameter to sync resources to Transcend. e.g. --transcendUrl=https://api.transcend.io',\n ),\n );\n return process.exit(1);\n }\n\n // If trying to sync to disk, must specify a file path\n if (dryRun && !file) {\n logger.error(\n colors.red(\n 'Must set a \"file\" parameter when \"dryRun\" is \"true\". e.g. --file=./oneTrustAssessments.json',\n ),\n );\n return process.exit(1);\n }\n\n if (file) {\n const splitFile = file.split('.');\n if (splitFile.length < 2) {\n logger.error(\n colors.red(\n 'The \"file\" parameter has an invalid format. Expected a path with extensions. e.g. --file=./pathToFile.json.',\n ),\n );\n return process.exit(1);\n }\n if (splitFile.at(-1) !== OneTrustFileFormat.Json) {\n logger.error(\n colors.red(\n `Expected the format of the \"file\" parameters '${file}' to be '${\n OneTrustFileFormat.Json\n }', but got '${splitFile.at(-1)}'.`,\n ),\n );\n return process.exit(1);\n }\n }\n\n // if reading assessments from a OneTrust\n if (source === OneTrustPullSource.OneTrust) {\n // must specify the OneTrust hostname\n if (!hostname) {\n logger.error(\n colors.red(\n 'Missing required parameter \"hostname\". e.g. --hostname=customer.my.onetrust.com',\n ),\n );\n return process.exit(1);\n }\n // must specify the OneTrust auth\n if (!oneTrustAuth) {\n logger.error(\n colors.red(\n 'Missing required parameter \"oneTrustAuth\". e.g. --oneTrustAuth=$ONE_TRUST_AUTH_TOKEN',\n ),\n );\n return process.exit(1);\n }\n } else {\n // if reading the assessments from a file, must specify a file to read from\n if (!file) {\n logger.error(\n colors.red(\n 'Must specify a \"file\" parameter to read the OneTrust assessments from. e.g. --source=./oneTrustAssessments.json',\n ),\n );\n return process.exit(1);\n }\n\n // Cannot try reading from file and save assessments to a file simultaneously\n if (dryRun) {\n logger.error(\n colors.red(\n 'Cannot read and write to a file simultaneously.' +\n ` Emit the \"source\" parameter or set it to ${OneTrustPullSource.OneTrust} if \"dryRun\" is enabled.`,\n ),\n );\n return process.exit(1);\n }\n }\n\n if (!VALID_RESOURCES.includes(resource)) {\n logger.error(\n colors.red(\n `Received invalid resource value: \"${resource}\". Allowed: ${VALID_RESOURCES.join(\n ',',\n )}`,\n ),\n );\n return process.exit(1);\n }\n\n return {\n file,\n ...(hostname && { hostname }),\n ...(oneTrustAuth && { oneTrustAuth }),\n resource,\n debug,\n dryRun,\n transcendAuth,\n transcendUrl,\n source,\n };\n};\n","import { OneTrustEnrichedAssessment } from '@transcend-io/privacy-types';\n\n/**\n * Converts the assessment into a json entry.\n *\n * @param param - information about the assessment and amount of entries\n * @returns a stringified json entry ready to be appended to a file\n */\nexport const oneTrustAssessmentToJson = ({\n assessment,\n index,\n total,\n wrap = true,\n}: {\n /** The assessment to convert */\n assessment: OneTrustEnrichedAssessment;\n /** The position of the assessment in the final Json object */\n index: number;\n /** The total amount of the assessments in the final Json object */\n total?: number;\n /** Whether to wrap every entry in brackets */\n wrap?: boolean;\n}): string => {\n let jsonEntry = '';\n // start with an opening bracket\n if (index === 0 || wrap) {\n jsonEntry = '[\\n';\n }\n\n const stringifiedAssessment = JSON.stringify(assessment);\n\n // Add comma for all items except the last one\n const comma = total && index < total - 1 && !wrap ? ',' : '';\n\n // write to file\n jsonEntry = `${jsonEntry + stringifiedAssessment + comma}\\n`;\n\n // end with closing bracket\n if ((total && index === total - 1) || wrap) {\n jsonEntry += '\\n]';\n }\n\n return jsonEntry;\n};\n","import { logger } from '../../../logger';\nimport colors from 'colors';\nimport fs from 'node:fs';\nimport { oneTrustAssessmentToJson } from './oneTrustAssessmentToJson';\nimport { OneTrustEnrichedAssessment } from '@transcend-io/privacy-types';\n\n/**\n * Write the assessment to disk at the specified file path.\n *\n *\n * @param param - information about the assessment to write\n */\nexport const syncOneTrustAssessmentToDisk = ({\n file,\n assessment,\n index,\n total,\n}: {\n /** The file path to write the assessment to */\n file: string;\n /** The basic assessment */\n assessment: OneTrustEnrichedAssessment;\n /** The index of the assessment being written to the file */\n index: number;\n /** The total amount of assessments that we will write */\n total: number;\n}): void => {\n logger.info(\n colors.magenta(\n `Writing enriched assessment ${\n index + 1\n } of ${total} to file \"${file}\"...`,\n ),\n );\n\n if (index === 0) {\n fs.writeFileSync(\n file,\n oneTrustAssessmentToJson({\n assessment,\n index,\n total,\n wrap: false,\n }),\n );\n } else {\n fs.appendFileSync(\n file,\n oneTrustAssessmentToJson({\n assessment,\n index,\n total,\n wrap: false,\n }),\n );\n }\n};\n","import { Got } from 'got';\nimport { logger } from '../../../logger';\nimport { decodeCodec } from '@transcend-io/type-utils';\nimport {\n OneTrustAssessment,\n OneTrustGetListOfAssessmentsResponse,\n} from '@transcend-io/privacy-types';\n\n/**\n * Fetch a list of all assessments from the OneTrust client.\n * ref: https://developer.onetrust.com/onetrust/reference/getallassessmentbasicdetailsusingget\n *\n * @param param - the information about the OneTrust client\n * @returns a list of OneTrustAssessment\n */\nexport const getListOfOneTrustAssessments = async ({\n oneTrust,\n}: {\n /** The OneTrust client instance */\n oneTrust: Got;\n}): Promise<OneTrustAssessment[]> => {\n let currentPage = 0;\n let totalPages = 1;\n let totalElements = 0;\n\n const allAssessments: OneTrustAssessment[] = [];\n\n while (currentPage < totalPages) {\n const { body } = await oneTrust.get(\n `api/assessment/v2/assessments?page=${currentPage}&size=2000`,\n );\n\n const { page, content } = decodeCodec(\n OneTrustGetListOfAssessmentsResponse,\n body,\n );\n allAssessments.push(...(content ?? []));\n if (currentPage === 0) {\n totalPages = page?.totalPages ?? 0;\n totalElements = page?.totalElements ?? 0;\n }\n currentPage += 1;\n\n // log progress\n logger.info(\n `Fetched ${allAssessments.length} of ${totalElements} assessments.`,\n );\n }\n\n return allAssessments;\n};\n","import { Got } from 'got';\nimport { decodeCodec } from '@transcend-io/type-utils';\nimport { OneTrustGetAssessmentResponse } from '@transcend-io/privacy-types';\n\n/**\n * Retrieve details about a particular assessment.\n * ref: https://developer.onetrust.com/onetrust/reference/exportassessmentusingget\n *\n * @param param - the information about the OneTrust client and assessment to retrieve\n * @returns details about the assessment\n */\nexport const getOneTrustAssessment = async ({\n oneTrust,\n assessmentId,\n}: {\n /** The OneTrust client instance */\n oneTrust: Got;\n /** The ID of the assessment to retrieve */\n assessmentId: string;\n}): Promise<OneTrustGetAssessmentResponse> => {\n const { body } = await oneTrust.get(\n `api/assessment/v2/assessments/${assessmentId}/export?ExcludeSkippedQuestions=false`,\n );\n\n return decodeCodec(OneTrustGetAssessmentResponse, body);\n};\n","import { Got } from 'got';\nimport { decodeCodec } from '@transcend-io/type-utils';\nimport { OneTrustGetRiskResponse } from '@transcend-io/privacy-types';\n\n/**\n * Retrieve details about a particular risk.\n * ref: https://developer.onetrust.com/onetrust/reference/getriskusingget\n *\n * @param param - the information about the OneTrust client and risk to retrieve\n * @returns the OneTrust risk\n */\nexport const getOneTrustRisk = async ({\n oneTrust,\n riskId,\n}: {\n /** The OneTrust client instance */\n oneTrust: Got;\n /** The ID of the OneTrust risk to retrieve */\n riskId: string;\n}): Promise<OneTrustGetRiskResponse> => {\n const { body } = await oneTrust.get(`api/risk/v2/risks/${riskId}`);\n\n return decodeCodec(OneTrustGetRiskResponse, body);\n};\n","import { Got } from 'got';\nimport { decodeCodec } from '@transcend-io/type-utils';\nimport { OneTrustGetUserResponse } from '@transcend-io/privacy-types';\n\n/**\n * Retrieve details about a particular user.\n * ref: https://developer.onetrust.com/onetrust/reference/getriskusingget\n *\n * @param param - the information about the OneTrust client and risk to retrieve\n * @returns the OneTrust risk\n */\nexport const getOneTrustUser = async ({\n oneTrust,\n userId,\n}: {\n /** The OneTrust client instance */\n oneTrust: Got;\n /** The ID of the OneTrust user to retrieve */\n userId: string;\n}): Promise<OneTrustGetUserResponse> => {\n const { body } = await oneTrust.get(`api/scim/v2/Users/${userId}`);\n\n return decodeCodec(OneTrustGetUserResponse, body);\n};\n","import {\n OneTrustAssessment,\n OneTrustEnrichedAssessment,\n OneTrustGetAssessmentResponse,\n OneTrustGetRiskResponse,\n OneTrustGetUserResponse,\n} from '@transcend-io/privacy-types';\nimport { keyBy } from 'lodash-es';\n\n/**\n * Merge the assessment, assessmentDetails, and riskDetails into one object.\n *\n * @param param - the assessment and risk information\n * @returns the assessment enriched with details and risk information\n */\nexport const enrichOneTrustAssessment = ({\n assessment,\n assessmentDetails,\n riskDetails,\n creatorDetails,\n approversDetails,\n respondentsDetails,\n}: {\n /** The OneTrust risk details */\n riskDetails: OneTrustGetRiskResponse[];\n /** The OneTrust assessment as returned from Get List of Assessments endpoint */\n assessment: OneTrustAssessment;\n /** The OneTrust assessment details */\n assessmentDetails: OneTrustGetAssessmentResponse;\n /** The OneTrust assessment creator details */\n creatorDetails: OneTrustGetUserResponse;\n /** The OneTrust assessment approvers details */\n approversDetails: OneTrustGetUserResponse[];\n /** The OneTrust assessment internal respondents details */\n respondentsDetails: OneTrustGetUserResponse[];\n}): OneTrustEnrichedAssessment => {\n const riskDetailsById = keyBy(riskDetails, 'id');\n const { sections, createdBy, ...restAssessmentDetails } = assessmentDetails;\n const sectionsWithEnrichedRisk = sections.map((section) => {\n const { questions, ...restSection } = section;\n const enrichedQuestions = questions.map((question) => {\n const { risks, ...restQuestion } = question;\n const enrichedRisks = (risks ?? []).map((risk) => {\n const details = riskDetailsById[risk.riskId];\n return {\n ...risk,\n ...details,\n level: risk.level,\n impactLevel: risk.impactLevel ?? 0,\n };\n });\n return {\n ...restQuestion,\n risks: enrichedRisks,\n };\n });\n return {\n ...restSection,\n questions: enrichedQuestions,\n };\n });\n\n // grab creator details\n const enrichedCreatedBy = {\n ...createdBy,\n active: creatorDetails?.active ?? false,\n userType: creatorDetails?.userType ?? 'Internal',\n emails: creatorDetails?.emails ?? [],\n title: creatorDetails?.title ?? null,\n givenName: creatorDetails?.name.givenName ?? null,\n familyName: creatorDetails?.name.familyName ?? null,\n };\n\n // grab approvers details\n const approverDetailsById = keyBy(approversDetails, 'id');\n const enrichedApprovers = assessmentDetails.approvers.flatMap(\n (originalApprover) =>\n approverDetailsById[originalApprover.id]\n ? [\n {\n ...originalApprover,\n approver: {\n ...originalApprover.approver,\n active: approverDetailsById[originalApprover.id].active,\n userType: approverDetailsById[originalApprover.id].userType,\n emails: approverDetailsById[originalApprover.id].emails,\n title: approverDetailsById[originalApprover.id].title,\n givenName:\n approverDetailsById[originalApprover.id].name.givenName ??\n null,\n familyName:\n approverDetailsById[originalApprover.id].name.familyName ??\n null,\n },\n },\n ]\n : [],\n );\n\n // grab respondents details\n const respondentsDetailsById = keyBy(respondentsDetails, 'id');\n const enrichedRespondents = assessmentDetails.respondents\n .filter((r) => !r.name.includes('@')) // search only internal respondents\n .flatMap((respondent) =>\n respondentsDetailsById[respondent.id]\n ? [\n {\n ...respondent,\n active: respondentsDetailsById[respondent.id].active,\n userType: respondentsDetailsById[respondent.id].userType,\n emails: respondentsDetailsById[respondent.id].emails,\n title: respondentsDetailsById[respondent.id].title,\n givenName:\n respondentsDetailsById[respondent.id].name.givenName ?? null,\n familyName:\n respondentsDetailsById[respondent.id].name.familyName ?? null,\n },\n ]\n : [],\n );\n\n // combine everything into a single enriched assessment\n return {\n ...assessment,\n ...restAssessmentDetails,\n approvers: enrichedApprovers,\n respondents: enrichedRespondents,\n createdBy: enrichedCreatedBy,\n sections: sectionsWithEnrichedRisk,\n };\n};\n","import { logger } from '../../../logger';\nimport colors from 'colors';\nimport { GraphQLClient } from 'graphql-request';\nimport {\n IMPORT_ONE_TRUST_ASSESSMENT_FORMS,\n makeGraphQLRequest,\n} from '../../graphql';\nimport { ImportOnetrustAssessmentsInput } from '../../../codecs';\nimport { OneTrustEnrichedAssessment } from '@transcend-io/privacy-types';\nimport { oneTrustAssessmentToJson } from './oneTrustAssessmentToJson';\n\nexport interface AssessmentForm {\n /** ID of Assessment Form */\n id: string;\n /** Title of Assessment Form */\n name: string;\n}\n\n/**\n * Write the assessment to a Transcend instance.\n *\n *\n * @param param - information about the assessment and Transcend instance to write to\n */\nexport const syncOneTrustAssessmentToTranscend = async ({\n transcend,\n assessment,\n total,\n index,\n}: {\n /** the Transcend client instance */\n transcend: GraphQLClient;\n /** the assessment to sync to Transcend */\n assessment: OneTrustEnrichedAssessment;\n /** The index of the assessment being written to the file */\n index: number;\n /** The total amount of assessments that we will write */\n total?: number;\n}): Promise<void> => {\n logger.info(\n colors.magenta(\n `Writing enriched assessment ${index + 1} ${\n total ? `of ${total} ` : ' '\n }to Transcend...`,\n ),\n );\n\n // convert the OneTrust assessment object into a json record\n const json = oneTrustAssessmentToJson({\n assessment,\n index,\n total,\n });\n\n // transform the json record into a valid input to the mutation\n const input: ImportOnetrustAssessmentsInput = {\n json,\n };\n\n try {\n await makeGraphQLRequest<{\n /** the importOneTrustAssessmentForms mutation */\n importOneTrustAssessmentForms: {\n /** Created Assessment Forms */\n assessmentForms: AssessmentForm[];\n };\n }>(transcend, IMPORT_ONE_TRUST_ASSESSMENT_FORMS, {\n input,\n });\n } catch (e) {\n logger.error(\n colors.red(\n `Failed to sync assessment ${index + 1} ${\n total ? `of ${total} ` : ' '\n }to Transcend.\\n` +\n `\\tAssessment Title: ${assessment.name}. Template Title: ${assessment.template.name}\\n`,\n ),\n );\n }\n};\n","import type { Got } from 'got';\nimport colors from 'colors';\nimport {\n getListOfOneTrustAssessments,\n getOneTrustAssessment,\n getOneTrustRisk,\n getOneTrustUser,\n} from '../endpoints';\nimport { mapSeries, map } from '../../bluebird';\nimport { logger } from '../../../logger';\nimport {\n OneTrustAssessmentQuestion,\n OneTrustAssessmentSection,\n OneTrustEnrichedAssessment,\n OneTrustGetRiskResponse,\n OneTrustGetUserResponse,\n} from '@transcend-io/privacy-types';\nimport { uniq } from 'lodash-es';\nimport { enrichOneTrustAssessment } from './enrichOneTrustAssessment';\nimport { syncOneTrustAssessmentToDisk } from './syncOneTrustAssessmentToDisk';\nimport { GraphQLClient } from 'graphql-request';\nimport { syncOneTrustAssessmentToTranscend } from './syncOneTrustAssessmentToTranscend';\n\nexport interface AssessmentForm {\n /** ID of Assessment Form */\n id: string;\n /** Title of Assessment Form */\n name: string;\n}\n\n/**\n * Reads all the assessments from a OneTrust instance and syncs them to Transcend or to Disk.\n *\n * @param param - the information about the assessment, its OneTrust source, and destination (disk or Transcend)\n */\nexport const syncOneTrustAssessmentsFromOneTrust = async ({\n oneTrust,\n file,\n dryRun,\n transcend,\n}: {\n /** the OneTrust client instance */\n oneTrust: Got;\n /** the Transcend client instance */\n transcend?: GraphQLClient;\n /** Whether to write to file instead of syncing to Transcend */\n dryRun: boolean;\n /** the path to the file in case dryRun is true */\n file?: string;\n}): Promise<void> => {\n // fetch the list of all assessments in the OneTrust organization\n logger.info('Getting list of all assessments from OneTrust...');\n const assessments = await getListOfOneTrustAssessments({ oneTrust });\n\n // a cache of OneTrust users so we avoid requesting already fetched users\n const oneTrustCachedUsers: Record<string, OneTrustGetUserResponse> = {};\n\n // split all assessments in batches, so we can process some of steps in parallel\n const BATCH_SIZE = 5;\n const assessmentBatches = Array.from(\n {\n length: Math.ceil(assessments.length / BATCH_SIZE),\n },\n (_, i) => assessments.slice(i * BATCH_SIZE, (i + 1) * BATCH_SIZE),\n );\n\n // process each batch and sync the batch right away so it's garbage collected and we don't run out of memory\n await mapSeries(assessmentBatches, async (assessmentBatch, batch) => {\n const batchEnrichedAssessments: OneTrustEnrichedAssessment[] = [];\n\n // fetch assessment details from OneTrust in parallel\n await map(\n assessmentBatch,\n async (assessment, index) => {\n const assessmentNumber = BATCH_SIZE * batch + index + 1;\n logger.info(\n `[assessment ${assessmentNumber} of ${assessments.length}]: fetching details...`,\n );\n const { templateName, assessmentId } = assessment;\n const assessmentDetails = await getOneTrustAssessment({\n oneTrust,\n assessmentId,\n });\n // fetch assessment's creator information\n const creatorId = assessmentDetails.createdBy.id;\n let creator = oneTrustCachedUsers[creatorId];\n if (!creator) {\n logger.info(\n `[assessment ${assessmentNumber} of ${assessments.length}]: fetching creator...`,\n );\n try {\n creator = await getOneTrustUser({\n oneTrust,\n userId: creatorId,\n });\n oneTrustCachedUsers[creatorId] = creator;\n } catch (e) {\n logger.warn(\n colors.yellow(\n `[assessment ${assessmentNumber} of ${assessments.length}]: failed to fetch form creator.` +\n `\\tcreatorId: ${creatorId}. Assessment Title: ${assessment.name}. Template Title: ${templateName}`,\n ),\n );\n }\n }\n\n // fetch assessment approvers information\n const { approvers } = assessmentDetails;\n let approversDetails: OneTrustGetUserResponse[][] = [];\n if (approvers.length > 0) {\n logger.info(\n `[assessment ${assessmentNumber} of ${assessments.length}]: fetching approvers...`,\n );\n approversDetails = await map(\n approvers.map(({ id }) => id),\n async (userId) => {\n try {\n let approver = oneTrustCachedUsers[userId];\n if (!approver) {\n approver = await getOneTrustUser({ oneTrust, userId });\n oneTrustCachedUsers[userId] = approver;\n }\n return [approver];\n } catch (e) {\n logger.warn(\n colors.yellow(\n `[assessment ${assessmentNumber} of ${assessments.length}]: failed to fetch a form approver.` +\n `\\tapproverId: ${userId}. Assessment Title: ${assessment.name}. Template Title: ${templateName}`,\n ),\n );\n return [];\n }\n },\n { concurrency: 5 },\n );\n }\n\n // fetch assessment internal respondents information\n const { respondents } = assessmentDetails;\n // if a user is an internal respondents, their 'name' field can't be an email.\n const internalRespondents = respondents.filter(\n (r) => !r.name.includes('@'),\n );\n let respondentsDetails: OneTrustGetUserResponse[][] = [];\n if (internalRespondents.length > 0) {\n logger.info(\n `[assessment ${assessmentNumber} of ${assessments.length}]: fetching respondents...`,\n );\n respondentsDetails = await map(\n internalRespondents.map(({ id }) => id),\n async (userId) => {\n try {\n let respondent = oneTrustCachedUsers[userId];\n if (!respondent) {\n respondent = await getOneTrustUser({ oneTrust, userId });\n oneTrustCachedUsers[userId] = respondent;\n }\n return [respondent];\n } catch (e) {\n logger.warn(\n colors.yellow(\n `[assessment ${assessmentNumber} of ${assessments.length}]: failed to fetch a respondent.` +\n `\\trespondentId: ${userId}. Assessment Title: ${assessment.name}. Template Title: ${templateName}`,\n ),\n );\n return [];\n }\n },\n { concurrency: 5 },\n );\n }\n\n // fetch assessment risk information\n let riskDetails: OneTrustGetRiskResponse[] = [];\n const riskIds = uniq(\n assessmentDetails.sections.flatMap((s: OneTrustAssessmentSection) =>\n s.questions.flatMap((q: OneTrustAssessmentQuestion) =>\n (q.risks ?? []).flatMap((r) => r.riskId),\n ),\n ),\n );\n if (riskIds.length > 0) {\n logger.info(\n `[assessment ${assessmentNumber} of ${assessments.length}]: fetching risks...`,\n );\n riskDetails = await map(\n riskIds,\n (riskId) => getOneTrustRisk({ oneTrust, riskId: riskId as string }),\n {\n concurrency: 5,\n },\n );\n }\n\n // enrich the assessments with user and risk details\n const enrichedAssessment = enrichOneTrustAssessment({\n assessment,\n assessmentDetails,\n riskDetails,\n creatorDetails: creator,\n approversDetails: approversDetails.flat(),\n respondentsDetails: respondentsDetails.flat(),\n });\n\n batchEnrichedAssessments.push(enrichedAssessment);\n },\n { concurrency: BATCH_SIZE },\n );\n\n // sync assessments in series to avoid concurrency bugs\n await mapSeries(\n batchEnrichedAssessments,\n async (enrichedAssessment, index) => {\n // the assessment's global index takes its batch into consideration\n const globalIndex = batch * BATCH_SIZE + index;\n\n if (dryRun && file) {\n // sync to file\n syncOneTrustAssessmentToDisk({\n assessment: enrichedAssessment,\n index: globalIndex,\n total: assessments.length,\n file,\n });\n } else if (transcend) {\n // sync to transcend\n await syncOneTrustAssessmentToTranscend({\n assessment: enrichedAssessment,\n transcend,\n total: assessments.length,\n index: globalIndex,\n });\n }\n },\n );\n });\n};\n","import { decodeCodec } from '@transcend-io/type-utils';\nimport colors from 'colors';\nimport { logger } from '../../../logger';\nimport JSONStream from 'JSONStream';\n\nimport { createReadStream } from 'node:fs';\nimport { OneTrustEnrichedAssessment } from '@transcend-io/privacy-types';\nimport { syncOneTrustAssessmentToTranscend } from './syncOneTrustAssessmentToTranscend';\nimport { GraphQLClient } from 'graphql-request';\n\n/**\n * Reads assessments from a file and syncs them to Transcend.\n *\n * @param param - the information about the source file and Transcend instance to write them to.\n */\nexport const syncOneTrustAssessmentsFromFile = ({\n transcend,\n file,\n}: {\n /** the Transcend client instance */\n transcend: GraphQLClient;\n /** The name of the file from which to read the OneTrust assessments */\n file: string;\n}): Promise<void> => {\n logger.info(`Getting list of all assessments from file ${file}...`);\n\n return new Promise((resolve, reject) => {\n // Create a readable stream from the file\n const fileStream = createReadStream(file, {\n encoding: 'utf-8',\n highWaterMark: 64 * 1024, // 64KB chunks\n });\n\n // Create a JSONStream parser to parse the array of OneTrust assessments from the file\n const parser = JSONStream.parse('*'); // '*' matches each element in the root array\n\n let index = 0;\n\n // Pipe the file stream into the JSON parser\n fileStream.pipe(parser);\n\n // Handle each parsed assessment object\n parser.on('data', async (assessment) => {\n try {\n // Pause the stream while processing to avoid overwhelming memory\n parser.pause();\n\n // Decode and validate the assessment\n const parsedAssessment = decodeCodec(\n OneTrustEnrichedAssessment,\n assessment,\n );\n\n // Sync the assessment to transcend\n await syncOneTrustAssessmentToTranscend({\n assessment: parsedAssessment,\n transcend,\n index,\n });\n\n index += 1;\n\n // Resume the stream after processing\n parser.resume();\n } catch (e) {\n // if failed to parse a line, report error and continue\n logger.error(\n colors.red(\n `Failed to parse the assessment ${index} from file '${file}': ${e.message}.`,\n ),\n );\n }\n });\n\n // Handle completion\n parser.on('end', () => {\n logger.info(`Finished processing ${index} assessments from file ${file}`);\n resolve();\n });\n\n // Handle stream or parsing errors\n parser.on('error', (error) => {\n logger.error(\n colors.red(`Error parsing file '${file}': ${error.message}`),\n );\n reject(error);\n });\n\n fileStream.on('error', (error) => {\n logger.error(\n colors.red(`Error reading file '${file}': ${error.message}`),\n );\n reject(error);\n });\n });\n};\n","import type { LocalContext } from '../../../context';\nimport { logger } from '../../../logger';\nimport colors from 'colors';\nimport { createOneTrustGotInstance } from '../../../lib/oneTrust';\nimport {\n OneTrustFileFormat,\n OneTrustPullResource,\n OneTrustPullSource,\n} from '../../../enums';\nimport { buildTranscendGraphQLClient } from '../../../lib/graphql';\nimport {\n syncOneTrustAssessmentsFromFile,\n syncOneTrustAssessmentsFromOneTrust,\n} from '../../../lib/oneTrust/helpers';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation';\n\n// Command flag interface\nexport interface SyncOtCommandFlags {\n hostname?: string;\n oneTrustAuth?: string;\n source: OneTrustPullSource;\n transcendAuth?: string;\n transcendUrl: string;\n file?: string;\n resource: OneTrustPullResource;\n dryRun: boolean;\n debug: boolean;\n}\n\n// Command implementation\nexport async function syncOt(\n this: LocalContext,\n {\n hostname,\n oneTrustAuth,\n source,\n transcendAuth,\n transcendUrl,\n resource,\n file,\n dryRun,\n debug,\n }: SyncOtCommandFlags,\n): Promise<void> {\n // Must be able to authenticate to transcend to sync resources to it\n if (!dryRun && !transcendAuth) {\n throw new Error(\n // eslint-disable-next-line no-template-curly-in-string\n 'Must specify a \"transcendAuth\" parameter to sync resources to Transcend. e.g. --transcendAuth=${TRANSCEND_API_KEY}',\n );\n }\n\n // If trying to sync to disk, must specify a file path\n if (dryRun && !file) {\n throw new Error(\n 'Must set a \"file\" parameter when \"dryRun\" is \"true\". e.g. --file=./oneTrustAssessments.json',\n );\n }\n\n if (file) {\n const splitFile = file.split('.');\n if (splitFile.length < 2) {\n throw new Error(\n 'The \"file\" parameter has an invalid format. Expected a path with extensions. e.g. --file=./pathToFile.json.',\n );\n }\n if (splitFile.at(-1) !== OneTrustFileFormat.Json) {\n throw new Error(\n `Expected the format of the \"file\" parameters '${file}' to be '${\n OneTrustFileFormat.Json\n }', but got '${splitFile.at(-1)}'.`,\n );\n }\n }\n\n // if reading assessments from a OneTrust\n if (source === OneTrustPullSource.OneTrust) {\n // must specify the OneTrust hostname\n if (!hostname) {\n throw new Error(\n 'Missing required parameter \"hostname\". e.g. --hostname=customer.my.onetrust.com',\n );\n }\n // must specify the OneTrust auth\n if (!oneTrustAuth) {\n throw new Error(\n 'Missing required parameter \"oneTrustAuth\". e.g. --oneTrustAuth=$ONE_TRUST_AUTH_TOKEN',\n );\n }\n } else {\n // if reading the assessments from a file, must specify a file to read from\n if (!file) {\n throw new Error(\n 'Must specify a \"file\" parameter to read the OneTrust assessments from. e.g. --source=./oneTrustAssessments.json',\n );\n }\n\n // Cannot try reading from file and save assessments to a file simultaneously\n if (dryRun) {\n throw new Error(\n 'Cannot read and write to a file simultaneously.' +\n ` Emit the \"source\" parameter or set it to ${OneTrustPullSource.OneTrust} if \"dryRun\" is enabled.`,\n );\n }\n }\n\n doneInputValidation(this.process.exit);\n\n // instantiate a client to talk to OneTrust\n const oneTrust =\n hostname && oneTrustAuth\n ? createOneTrustGotInstance({\n hostname,\n auth: oneTrustAuth,\n })\n : undefined;\n\n // instantiate a client to talk to Transcend\n const transcend =\n transcendUrl && transcendAuth\n ? buildTranscendGraphQLClient(transcendUrl, transcendAuth)\n : undefined;\n\n try {\n if (resource === OneTrustPullResource.Assessments) {\n if (source === OneTrustPullSource.OneTrust && oneTrust) {\n await syncOneTrustAssessmentsFromOneTrust({\n oneTrust,\n file,\n dryRun,\n ...(transcend && { transcend }),\n });\n } else if (source === OneTrustPullSource.File && file && transcend) {\n await syncOneTrustAssessmentsFromFile({ file, transcend });\n }\n }\n } catch (err) {\n throw new Error(\n `An error occurred syncing the resource ${resource} from OneTrust: ${\n debug ? err.stack : err.message\n }`,\n );\n }\n\n // Indicate success\n logger.info(\n colors.green(\n `Successfully synced OneTrust ${resource} to ${\n dryRun ? `disk at \"${file}\"` : 'Transcend'\n }!`,\n ),\n );\n}\n"],"mappings":"kwBAQA,MAAa,GAA6B,CACxC,WACA,UAOA,EAAI,OAAO,CACT,UAAW,WAAW,IACtB,QAAS,CACP,OAAQ,mBACR,eAAgB,mBAChB,cAAe,UAAU,IAC1B,CACF,CAAC,CCfoB,OAAO,OAAO,EAAqB,CCD3D,MAAa,GAA4B,CACvC,aACA,QACA,QACA,OAAO,MAUK,CACZ,IAAI,EAAY,IAEZ,IAAU,GAAK,KACjB,EAAY;GAGd,IAAM,EAAwB,KAAK,UAAU,EAAW,CAGlD,EAAQ,GAAS,EAAQ,EAAQ,GAAK,CAAC,EAAO,IAAM,GAU1D,MAPA,GAAY,GAAG,EAAY,EAAwB,EAAM,KAGpD,GAAS,IAAU,EAAQ,GAAM,KACpC,GAAa;IAGR,GC9BI,GAAgC,CAC3C,OAC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,GAEN,GAAI,CACE,IAAa,EAAqB,cAChC,IAAW,EAAmB,UAAY,EAC5C,MAAM,EAAoC,CACxC,WACA,OACA,SACA,GAAI,GAAa,CAAE,YAAW,CAC/B,CAAC,CACO,IAAW,EAAmB,MAAQ,GAAQ,GACvD,MAAM,EAAgC,CAAE,OAAM,YAAW,CAAC,QAGvD,EAAK,CACZ,MAAU,MACR,0CAA0C,EAAS,kBACjD,EAAQ,EAAI,MAAQ,EAAI,UAE3B,CAIH,EAAO,KACL,EAAO,MACL,gCAAgC,EAAS,MACvC,EAAS,YAAY,EAAK,GAAK,YAChC,GACF,CACF"}
|
package/dist/impl-C-wzeAib2.mjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import"./enums-CyFTrzXY.mjs";import"./constants-CnLQtIBn.mjs";import"./logger-Bj782ZYD.mjs";import"./buildAIIntegrationType-Bk0EbFKV.mjs";import{V as e}from"./syncConfigurationToTranscend-VJd0PnaZ.mjs";import{t}from"./done-input-validation-CcZtaz03.mjs";async function n({auth:n,transcendUrl:r,enricherIds:i}){t(this.process.exit),await e({transcendUrl:r,auth:n,enricherIds:i})}export{n as skipPreflightJobs};
|
|
2
|
-
//# sourceMappingURL=impl-C-wzeAib2.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"impl-C-wzeAib2.mjs","names":["skipPreflightJobsHelper"],"sources":["../src/commands/request/skip-preflight-jobs/impl.ts"],"sourcesContent":["import type { LocalContext } from '../../../context';\nimport { skipPreflightJobs as skipPreflightJobsHelper } from '../../../lib/requests';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation';\n\nexport interface SkipPreflightJobsCommandFlags {\n auth: string;\n enricherIds: string[];\n transcendUrl: string;\n}\n\nexport async function skipPreflightJobs(\n this: LocalContext,\n { auth, transcendUrl, enricherIds }: SkipPreflightJobsCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n await skipPreflightJobsHelper({\n transcendUrl,\n auth,\n enricherIds,\n });\n}\n"],"mappings":"8PAUA,eAAsB,EAEpB,CAAE,OAAM,eAAc,eACP,CACf,EAAoB,KAAK,QAAQ,KAAK,CAEtC,MAAMA,EAAwB,CAC5B,eACA,OACA,cACD,CAAC"}
|
package/dist/impl-C61PYfk12.mjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import"./enums-CyFTrzXY.mjs";import"./constants-CnLQtIBn.mjs";import"./logger-Bj782ZYD.mjs";import"./buildAIIntegrationType-Bk0EbFKV.mjs";import"./syncConfigurationToTranscend-VJd0PnaZ.mjs";import{t as e}from"./manual-enrichment-B6lW5kAX.mjs";import{t}from"./done-input-validation-CcZtaz03.mjs";async function n({auth:n,transcendUrl:r,file:i,enricherId:a,concurrency:o,markSilent:s,sombraAuth:c}){t(this.process.exit),await e({file:i,transcendUrl:r,enricherId:a,concurrency:o,markSilent:s,auth:n,sombraAuth:c})}export{n as pushIdentifiers};
|
|
2
|
-
//# sourceMappingURL=impl-C61PYfk12.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"impl-C61PYfk12.mjs","names":[],"sources":["../src/commands/request/preflight/push-identifiers/impl.ts"],"sourcesContent":["import type { LocalContext } from '../../../../context';\nimport { pushManualEnrichmentIdentifiersFromCsv } from '../../../../lib/manual-enrichment';\nimport { doneInputValidation } from '../../../../lib/cli/done-input-validation';\n\nexport interface PushIdentifiersCommandFlags {\n auth: string;\n enricherId: string;\n sombraAuth?: string;\n transcendUrl: string;\n file: string;\n markSilent: boolean;\n concurrency: number;\n}\n\nexport async function pushIdentifiers(\n this: LocalContext,\n {\n auth,\n transcendUrl,\n file,\n enricherId,\n concurrency,\n markSilent,\n sombraAuth,\n }: PushIdentifiersCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n await pushManualEnrichmentIdentifiersFromCsv({\n file,\n transcendUrl,\n enricherId,\n concurrency,\n markSilent,\n auth,\n sombraAuth,\n });\n}\n"],"mappings":"uSAcA,eAAsB,EAEpB,CACE,OACA,eACA,OACA,aACA,cACA,aACA,cAEa,CACf,EAAoB,KAAK,QAAQ,KAAK,CAEtC,MAAM,EAAuC,CAC3C,OACA,eACA,aACA,cACA,aACA,OACA,aACD,CAAC"}
|
package/dist/impl-CAuNpuF2.mjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import"./enums-CyFTrzXY.mjs";import"./constants-CnLQtIBn.mjs";import{t as e}from"./logger-Bj782ZYD.mjs";import"./buildAIIntegrationType-Bk0EbFKV.mjs";import{O as t}from"./syncConfigurationToTranscend-VJd0PnaZ.mjs";import{a as n,i as r,n as i,o as a,r as o,s,t as c}from"./pooling-CazydwlD.mjs";import{t as l}from"./done-input-validation-CcZtaz03.mjs";import{createReadStream as u,createWriteStream as d,readdirSync as f,statSync as p}from"node:fs";import{basename as m,dirname as h,join as g}from"node:path";import _ from"colors";import*as v from"fast-csv";import{once as y}from"node:events";import{mkdir as b,readdir as x,stat as S,unlink as C}from"node:fs/promises";import{pipeline as w}from"node:stream/promises";import{Transform as T}from"node:stream";import{Parser as E}from"csv-parse";function D(t,n){t||(e.error(_.red(`A --directory must be provided.`)),n.process.exit(1));let r=[];try{r=f(t).filter(e=>e.endsWith(`.csv`)).map(e=>g(t,e)).filter(e=>{try{return p(e).isFile()}catch{return!1}})}catch(r){e.error(_.red(`Failed to read directory: ${t}`)),e.error(_.red(r.message)),n.process.exit(1)}return r.length===0&&(e.error(_.red(`No CSV files found in directory: ${t}`)),n.process.exit(1)),e.info(_.green(`Found ${r.length} CSV files in ${t}`)),r}function O(e,t){let n=d(e),r=v.format({headers:t,writeHeaders:!0,objectMode:!0});return r.pipe(n),{async write(e){r.write(e)||await y(r,`drain`)},async end(){let e=Promise.all([y(n,`finish`)]);r.end(),await e}}}function k(e){return String(e).padStart(4,`0`)}function A(e){return Buffer.byteLength(Object.values(e).map(e=>e==null?``:String(e)).join(`,`),`utf8`)}async function j(t){let{filePath:n,outputDir:r,clearOutputDir:i,chunkSizeMB:a,onProgress:o,reportEveryMs:s=500}=t,{size:c}=await S(n),l=0;e.info(_.magenta(`Chunking ${n} into ~${a}MB files...`));let d=Math.floor(a*1024*1024),f=m(n,`.csv`),p=r||h(n);if(e.info(_.magenta(`Output directory: ${p}`)),await b(p,{recursive:!0}),i){e.warn(_.yellow(`Clearing output directory: ${p}`));let t=await x(p);await Promise.all(t.filter(e=>e.startsWith(`${f}_chunk_`)&&e.endsWith(`.csv`)).map(e=>C(g(p,e))))}let v=null,y=null,D=0,j=1,M=0,N=new E({columns:!1,skip_empty_lines:!0}),P=0,F=0,I=()=>{let e=F>0?P/F:0,t=e>0?Math.max(D,Math.ceil(c/e)):void 0;o(D,t),l=Date.now()};I();let L=null,R=()=>g(p,`${f}_chunk_${k(j)}.csv`),z=new T({objectMode:!0,async transform(t,n,r){try{if(!v){v=t.slice(0),y=v.length,L=O(R(),v),r();return}y!==null&&t.length!==y&&e.warn(_.yellow(`Row has ${t.length} cols; expected ${y}`)),D+=1,D%25e4==0&&o(D);let n=Object.fromEntries(v.map((e,n)=>[e,t[n]])),i=A(n);P+=i,F+=1,Date.now()-l>=s&&I(),L&&M>0&&M+i>d&&(await L.end(),j+=1,M=0,e.info(_.green(`Rolling to chunk ${j} after ${D.toLocaleString()} rows.`)),L=O(R(),v)),L||=O(R(),v),await L.write(n),M+=i,r()}catch(e){r(e)}},async flush(e){try{L&&=(await L.end(),null),I(),e()}catch(t){e(t)}}});await w(u(n),N,z),o(D),e.info(_.green(`Chunked ${n} into ${j} file(s); processed ${D.toLocaleString()} rows.`))}async function M(){let n=Number(process.env.WORKER_ID||`0`);e.info(`[w${n}] ready pid=${process.pid}`),process.send?.({type:`ready`}),process.on(`message`,async r=>{if(!r||typeof r!=`object`||(r.type===`shutdown`&&process.exit(0),r.type!==`task`))return;let{filePath:i,options:a}=r.payload,{outputDir:o,clearOutputDir:s,chunkSizeMB:c}=a;try{await j({filePath:i,outputDir:o,clearOutputDir:s,chunkSizeMB:c,onProgress:(e,t)=>process.send?.({type:`progress`,payload:{filePath:i,processed:e,total:t}})}),process.send?.({type:`result`,payload:{ok:!0,filePath:i}})}catch(r){let a=t(r);e.error(`[w${n}] ERROR ${i}: ${a}`),process.send?.({type:`result`,payload:{ok:!1,filePath:i,error:a}})}}),await new Promise(()=>{})}function N(e){return o(e)}function P(e){return r(e)}const F={renderHeader:N,renderWorkers:P};function I(){return typeof __filename<`u`?__filename:process.argv[1]}async function L(t){l(this.process.exit);let{directory:r,outputDir:o,clearOutputDir:u,chunkSizeMB:d,concurrency:f,viewerMode:p}=t,m=D(r,this),{poolSize:h,cpuCount:g}=s(f,m.length);e.info(_.green(`Chunking ${m.length} CSV file(s) with pool size ${h} (CPU=${g})`));let v=m.map(e=>({filePath:e,options:{outputDir:o,clearOutputDir:u,chunkSizeMB:d}}));await i({title:`Chunk CSV - ${r}`,baseDir:r||o||process.cwd(),childFlag:a,childModulePath:I(),poolSize:h,cpuCount:g,filesTotal:m.length,hooks:{nextTask:()=>v.shift(),taskLabel:e=>e.filePath,initTotals:()=>({}),initSlotProgress:()=>void 0,onProgress:e=>e,onResult:(e,t)=>({totals:e,ok:!!t.ok}),postProcess:async()=>{}},viewerMode:p,render:e=>n(e,F,p),extraKeyHandler:({logsBySlot:e,repaint:t,setPaused:n})=>c({logsBySlot:e,repaint:t,setPaused:n})})}process.argv.includes(`--as-child`)&&M().catch(t=>{e.error(t),process.exit(1)});export{L as chunkCsv};
|
|
2
|
-
//# sourceMappingURL=impl-CAuNpuF2.mjs.map
|