@transcend-io/cli 10.0.0 → 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/dist/{app-By_zDIkK.mjs → app-BfTrk2nc.mjs} +19 -19
- package/dist/{app-By_zDIkK.mjs.map → app-BfTrk2nc.mjs.map} +1 -1
- package/dist/{approvePrivacyRequests-1cguqGqq.mjs → approvePrivacyRequests-CWGZR2N6.mjs} +2 -2
- package/dist/{approvePrivacyRequests-1cguqGqq.mjs.map → approvePrivacyRequests-CWGZR2N6.mjs.map} +1 -1
- package/dist/bin/bash-complete.mjs +1 -1
- package/dist/bin/cli.mjs +1 -1
- package/dist/bin/deprecated-command.mjs +1 -1
- package/dist/{buildXdiSyncEndpoint-BMaMHO7Z.mjs → buildXdiSyncEndpoint-Cb-pvpak.mjs} +2 -2
- package/dist/{buildXdiSyncEndpoint-BMaMHO7Z.mjs.map → buildXdiSyncEndpoint-Cb-pvpak.mjs.map} +1 -1
- package/dist/{bulkRestartRequests-DEPSHov-.mjs → bulkRestartRequests-CKF_xpN0.mjs} +2 -2
- package/dist/{bulkRestartRequests-DEPSHov-.mjs.map → bulkRestartRequests-CKF_xpN0.mjs.map} +1 -1
- package/dist/{bulkRetryEnrichers-BLkcFKXC.mjs → bulkRetryEnrichers-B-Szmin-.mjs} +2 -2
- package/dist/{bulkRetryEnrichers-BLkcFKXC.mjs.map → bulkRetryEnrichers-B-Szmin-.mjs.map} +1 -1
- package/dist/{cancelPrivacyRequests-C8MZQvsq.mjs → cancelPrivacyRequests-DNiL13E_.mjs} +2 -2
- package/dist/{cancelPrivacyRequests-C8MZQvsq.mjs.map → cancelPrivacyRequests-DNiL13E_.mjs.map} +1 -1
- package/dist/{command-BUnCUxva.mjs → command-BXxoAjFo.mjs} +2 -2
- package/dist/{command-BUnCUxva.mjs.map → command-BXxoAjFo.mjs.map} +1 -1
- package/dist/{createExtraKeyHandler-C_0EVj10.mjs → createExtraKeyHandler-tubeaEjA.mjs} +2 -2
- package/dist/createExtraKeyHandler-tubeaEjA.mjs.map +1 -0
- package/dist/{createPreferenceAccessTokens-6WLr6z-l.mjs → createPreferenceAccessTokens-DqmFctn3.mjs} +2 -2
- package/dist/{createPreferenceAccessTokens-6WLr6z-l.mjs.map → createPreferenceAccessTokens-DqmFctn3.mjs.map} +1 -1
- package/dist/{createSombraGotInstance-CahOgD6V.mjs → createSombraGotInstance-D1Il9zUE.mjs} +2 -2
- package/dist/{createSombraGotInstance-CahOgD6V.mjs.map → createSombraGotInstance-D1Il9zUE.mjs.map} +1 -1
- package/dist/{downloadPrivacyRequestFiles-B2yduagB.mjs → downloadPrivacyRequestFiles-DlpgxqHF.mjs} +2 -2
- package/dist/{downloadPrivacyRequestFiles-B2yduagB.mjs.map → downloadPrivacyRequestFiles-DlpgxqHF.mjs.map} +1 -1
- package/dist/{fetchAllActions-C0l3wjQV.mjs → fetchAllActions-BJsPdnxy.mjs} +2 -2
- package/dist/{fetchAllActions-C0l3wjQV.mjs.map → fetchAllActions-BJsPdnxy.mjs.map} +1 -1
- package/dist/{fetchAllDataFlows-AQ9j_NRa.mjs → fetchAllDataFlows-D248lO6_.mjs} +2 -2
- package/dist/{fetchAllDataFlows-AQ9j_NRa.mjs.map → fetchAllDataFlows-D248lO6_.mjs.map} +1 -1
- package/dist/{fetchAllPreferenceTopics-Bn9PG-rO.mjs → fetchAllPreferenceTopics-ForE9GpZ.mjs} +2 -2
- package/dist/{fetchAllPreferenceTopics-Bn9PG-rO.mjs.map → fetchAllPreferenceTopics-ForE9GpZ.mjs.map} +1 -1
- package/dist/{fetchAllPurposes-CykSkZRY.mjs → fetchAllPurposes-ZdkO2fMp.mjs} +2 -2
- package/dist/{fetchAllPurposes-CykSkZRY.mjs.map → fetchAllPurposes-ZdkO2fMp.mjs.map} +1 -1
- package/dist/fetchAllPurposesAndPreferences-DD6OyA5t.mjs +2 -0
- package/dist/{fetchAllPurposesAndPreferences-Dog6N9L2.mjs.map → fetchAllPurposesAndPreferences-DD6OyA5t.mjs.map} +1 -1
- package/dist/{fetchAllRequestEnrichers-q34mRuE5.mjs → fetchAllRequestEnrichers-CK-kk5eg.mjs} +2 -2
- package/dist/{fetchAllRequestEnrichers-q34mRuE5.mjs.map → fetchAllRequestEnrichers-CK-kk5eg.mjs.map} +1 -1
- package/dist/{fetchAllRequestIdentifiers-YP-geTV4.mjs → fetchAllRequestIdentifiers-DrFFOt0m.mjs} +2 -2
- package/dist/{fetchAllRequestIdentifiers-YP-geTV4.mjs.map → fetchAllRequestIdentifiers-DrFFOt0m.mjs.map} +1 -1
- package/dist/{fetchAllRequests-DEPTEUbi.mjs → fetchAllRequests-DNQQsY4s.mjs} +2 -2
- package/dist/{fetchAllRequests-DEPTEUbi.mjs.map → fetchAllRequests-DNQQsY4s.mjs.map} +1 -1
- package/dist/{fetchApiKeys-DkBco7W0.mjs → fetchApiKeys-DjOr44xA.mjs} +2 -2
- package/dist/{fetchApiKeys-DkBco7W0.mjs.map → fetchApiKeys-DjOr44xA.mjs.map} +1 -1
- package/dist/{fetchCatalogs-CBk871k6.mjs → fetchCatalogs-BM4FCbcS.mjs} +2 -2
- package/dist/{fetchCatalogs-CBk871k6.mjs.map → fetchCatalogs-BM4FCbcS.mjs.map} +1 -1
- package/dist/{fetchConsentManagerId-DHDA5Py9.mjs → fetchConsentManagerId-CFkg3-RS.mjs} +2 -2
- package/dist/{fetchConsentManagerId-DHDA5Py9.mjs.map → fetchConsentManagerId-CFkg3-RS.mjs.map} +1 -1
- package/dist/{fetchIdentifiers-DjqjUnaw.mjs → fetchIdentifiers-pjQV4vUg.mjs} +2 -2
- package/dist/{fetchIdentifiers-DjqjUnaw.mjs.map → fetchIdentifiers-pjQV4vUg.mjs.map} +1 -1
- package/dist/{fetchRequestDataSilo-CF6XOTQ-.mjs → fetchRequestDataSilo-P4yA7Lyc.mjs} +2 -2
- package/dist/{fetchRequestDataSilo-CF6XOTQ-.mjs.map → fetchRequestDataSilo-P4yA7Lyc.mjs.map} +1 -1
- package/dist/{fetchRequestFilesForRequest-DrHGOdih.mjs → fetchRequestFilesForRequest-BbxrEKFK.mjs} +2 -2
- package/dist/{fetchRequestFilesForRequest-DrHGOdih.mjs.map → fetchRequestFilesForRequest-BbxrEKFK.mjs.map} +1 -1
- package/dist/{generateCrossAccountApiKeys-F11uqpc5.mjs → generateCrossAccountApiKeys-Bxc_dzMG.mjs} +2 -2
- package/dist/{generateCrossAccountApiKeys-F11uqpc5.mjs.map → generateCrossAccountApiKeys-Bxc_dzMG.mjs.map} +1 -1
- package/dist/{impl-0ooudQ_J2.mjs → impl-4ltdSmpl2.mjs} +2 -2
- package/dist/{impl-0ooudQ_J2.mjs.map → impl-4ltdSmpl2.mjs.map} +1 -1
- package/dist/{impl-BzupMfJi.mjs → impl-B19fH75P.mjs} +2 -2
- package/dist/{impl-BzupMfJi.mjs.map → impl-B19fH75P.mjs.map} +1 -1
- package/dist/{impl-CdoTu8TH.mjs → impl-BBMjv5YQ.mjs} +2 -2
- package/dist/{impl-CdoTu8TH.mjs.map → impl-BBMjv5YQ.mjs.map} +1 -1
- package/dist/{impl-Cwj9LeEI.mjs → impl-BKH3QRLi.mjs} +2 -2
- package/dist/{impl-Cwj9LeEI.mjs.map → impl-BKH3QRLi.mjs.map} +1 -1
- package/dist/{impl-KV3yZaHz2.mjs → impl-BOUm7wly2.mjs} +2 -2
- package/dist/{impl-KV3yZaHz2.mjs.map → impl-BOUm7wly2.mjs.map} +1 -1
- package/dist/{impl-r8tHyAHB.mjs → impl-BUC4ZelU.mjs} +2 -2
- package/dist/{impl-r8tHyAHB.mjs.map → impl-BUC4ZelU.mjs.map} +1 -1
- package/dist/{impl-dEQtD5uE.mjs → impl-BhTCp0kg.mjs} +2 -2
- package/dist/{impl-dEQtD5uE.mjs.map → impl-BhTCp0kg.mjs.map} +1 -1
- package/dist/{impl-f4UPMoS_2.mjs → impl-BlHU1bbJ2.mjs} +2 -2
- package/dist/{impl-f4UPMoS_2.mjs.map → impl-BlHU1bbJ2.mjs.map} +1 -1
- package/dist/{impl-CXK-D84c.mjs → impl-BwjguKHC.mjs} +2 -2
- package/dist/{impl-CXK-D84c.mjs.map → impl-BwjguKHC.mjs.map} +1 -1
- package/dist/{impl-VHp2K2bg.mjs → impl-C2o0eDzJ.mjs} +2 -2
- package/dist/{impl-VHp2K2bg.mjs.map → impl-C2o0eDzJ.mjs.map} +1 -1
- package/dist/{impl-2FbPcOv_2.mjs → impl-C8HKnjw82.mjs} +2 -2
- package/dist/{impl-2FbPcOv_2.mjs.map → impl-C8HKnjw82.mjs.map} +1 -1
- package/dist/{impl-CMX0qQr_2.mjs → impl-CCUsnhoW2.mjs} +2 -2
- package/dist/{impl-CMX0qQr_2.mjs.map → impl-CCUsnhoW2.mjs.map} +1 -1
- package/dist/{impl-B8iVBYdg.mjs → impl-CCc-wXqD.mjs} +2 -2
- package/dist/{impl-B8iVBYdg.mjs.map → impl-CCc-wXqD.mjs.map} +1 -1
- package/dist/{impl-ArGeiHuz.mjs → impl-CMmyv1cl.mjs} +2 -2
- package/dist/{impl-ArGeiHuz.mjs.map → impl-CMmyv1cl.mjs.map} +1 -1
- package/dist/{impl-1U4QBT_L.mjs → impl-CNez1OAw.mjs} +2 -2
- package/dist/impl-CNez1OAw.mjs.map +1 -0
- package/dist/{impl-DZnSlfwn2.mjs → impl-CNykdy3e2.mjs} +2 -2
- package/dist/{impl-DZnSlfwn2.mjs.map → impl-CNykdy3e2.mjs.map} +1 -1
- package/dist/{impl--Lmj1RHh2.mjs → impl-CSChmq_t2.mjs} +2 -2
- package/dist/{impl--Lmj1RHh2.mjs.map → impl-CSChmq_t2.mjs.map} +1 -1
- package/dist/{impl-dlRlTYAQ.mjs → impl-Ce9K4OCp.mjs} +2 -2
- package/dist/{impl-dlRlTYAQ.mjs.map → impl-Ce9K4OCp.mjs.map} +1 -1
- package/dist/{impl-CoLIqiH-2.mjs → impl-ChCqHkOc2.mjs} +2 -2
- package/dist/{impl-CoLIqiH-2.mjs.map → impl-ChCqHkOc2.mjs.map} +1 -1
- package/dist/{impl-DXWN22xV.mjs → impl-CqEwwWeD.mjs} +2 -2
- package/dist/{impl-DXWN22xV.mjs.map → impl-CqEwwWeD.mjs.map} +1 -1
- package/dist/{impl-CeLfAnyA2.mjs → impl-CqXFyvgV2.mjs} +2 -2
- package/dist/{impl-CeLfAnyA2.mjs.map → impl-CqXFyvgV2.mjs.map} +1 -1
- package/dist/{impl-ph0q6K3i.mjs → impl-CxLSJk2P.mjs} +2 -2
- package/dist/{impl-ph0q6K3i.mjs.map → impl-CxLSJk2P.mjs.map} +1 -1
- package/dist/{impl-DhIyASha.mjs → impl-CzU9WTiW.mjs} +2 -2
- package/dist/{impl-DhIyASha.mjs.map → impl-CzU9WTiW.mjs.map} +1 -1
- package/dist/{impl-BpUksm1b2.mjs → impl-D9NjIwEi2.mjs} +2 -2
- package/dist/{impl-BpUksm1b2.mjs.map → impl-D9NjIwEi2.mjs.map} +1 -1
- package/dist/{impl-BkyC7nnu.mjs → impl-DEWXA_QC.mjs} +2 -2
- package/dist/{impl-BkyC7nnu.mjs.map → impl-DEWXA_QC.mjs.map} +1 -1
- package/dist/{impl-DgyjJ8RY2.mjs → impl-DGiPB5Vq2.mjs} +2 -2
- package/dist/{impl-DgyjJ8RY2.mjs.map → impl-DGiPB5Vq2.mjs.map} +1 -1
- package/dist/{impl-CyJBbyuF.mjs → impl-DGuwD_qz.mjs} +2 -2
- package/dist/{impl-CyJBbyuF.mjs.map → impl-DGuwD_qz.mjs.map} +1 -1
- package/dist/{impl-D6nwGrO8.mjs → impl-DGzvE8aJ.mjs} +2 -2
- package/dist/{impl-D6nwGrO8.mjs.map → impl-DGzvE8aJ.mjs.map} +1 -1
- package/dist/{impl-Bc8Es_bT.mjs → impl-DTp9OQIZ.mjs} +2 -2
- package/dist/{impl-Bc8Es_bT.mjs.map → impl-DTp9OQIZ.mjs.map} +1 -1
- package/dist/{impl-DGRuk3AB.mjs → impl-DhscnXSw.mjs} +2 -2
- package/dist/{impl-DGRuk3AB.mjs.map → impl-DhscnXSw.mjs.map} +1 -1
- package/dist/{impl-BWjBYTQZ.mjs → impl-Dk7MdX-1.mjs} +2 -2
- package/dist/{impl-BWjBYTQZ.mjs.map → impl-Dk7MdX-1.mjs.map} +1 -1
- package/dist/{impl-Dny1LX9A.mjs → impl-DsNPvet4.mjs} +2 -2
- package/dist/{impl-Dny1LX9A.mjs.map → impl-DsNPvet4.mjs.map} +1 -1
- package/dist/{impl-DcC8_dCy.mjs → impl-DxUFb0vv.mjs} +2 -2
- package/dist/{impl-DcC8_dCy.mjs.map → impl-DxUFb0vv.mjs.map} +1 -1
- package/dist/{impl-y1I9Muyc2.mjs → impl-JThkrXiI2.mjs} +2 -2
- package/dist/{impl-y1I9Muyc2.mjs.map → impl-JThkrXiI2.mjs.map} +1 -1
- package/dist/{impl-Cq_RqK0_2.mjs → impl-KDuBh4bu2.mjs} +2 -2
- package/dist/{impl-Cq_RqK0_2.mjs.map → impl-KDuBh4bu2.mjs.map} +1 -1
- package/dist/{impl-C05tQHSq.mjs → impl-MpkLBntW.mjs} +2 -2
- package/dist/{impl-C05tQHSq.mjs.map → impl-MpkLBntW.mjs.map} +1 -1
- package/dist/{impl-Zr8uLP_n.mjs → impl-P_NDC3cX.mjs} +2 -2
- package/dist/{impl-Zr8uLP_n.mjs.map → impl-P_NDC3cX.mjs.map} +1 -1
- package/dist/{impl-D-ldjJzl2.mjs → impl-c7rUQYDc2.mjs} +2 -2
- package/dist/{impl-D-ldjJzl2.mjs.map → impl-c7rUQYDc2.mjs.map} +1 -1
- package/dist/{impl-G1brwI4o.mjs → impl-fqOKTw5J.mjs} +2 -2
- package/dist/{impl-G1brwI4o.mjs.map → impl-fqOKTw5J.mjs.map} +1 -1
- package/dist/{impl-Dfc_yQML2.mjs → impl-oiBTZqQS2.mjs} +2 -2
- package/dist/{impl-Dfc_yQML2.mjs.map → impl-oiBTZqQS2.mjs.map} +1 -1
- package/dist/{impl-CWHnw3oX.mjs → impl-tbGnvKFm.mjs} +2 -2
- package/dist/{impl-CWHnw3oX.mjs.map → impl-tbGnvKFm.mjs.map} +1 -1
- package/dist/index.d.mts +3397 -3397
- package/dist/index.mjs +1 -1
- package/dist/{makeGraphQLRequest-G078PsEL.mjs → makeGraphQLRequest-Cq26A_Lq.mjs} +2 -2
- package/dist/{makeGraphQLRequest-G078PsEL.mjs.map → makeGraphQLRequest-Cq26A_Lq.mjs.map} +1 -1
- package/dist/{markRequestDataSiloIdsCompleted-DmAz-R0M.mjs → markRequestDataSiloIdsCompleted-DzqJ5MNY.mjs} +2 -2
- package/dist/{markRequestDataSiloIdsCompleted-DmAz-R0M.mjs.map → markRequestDataSiloIdsCompleted-DzqJ5MNY.mjs.map} +1 -1
- package/dist/{markSilentPrivacyRequests-s7_aBROE.mjs → markSilentPrivacyRequests-BKQUu6Ep.mjs} +2 -2
- package/dist/{markSilentPrivacyRequests-s7_aBROE.mjs.map → markSilentPrivacyRequests-BKQUu6Ep.mjs.map} +1 -1
- package/dist/{mergeTranscendInputs-C64BJsse.mjs → mergeTranscendInputs-DGC4xUGu.mjs} +2 -2
- package/dist/{mergeTranscendInputs-C64BJsse.mjs.map → mergeTranscendInputs-DGC4xUGu.mjs.map} +1 -1
- package/dist/{notifyPrivacyRequestsAdditionalTime-BvXIXZYu.mjs → notifyPrivacyRequestsAdditionalTime-TEHAJe4C.mjs} +2 -2
- package/dist/{notifyPrivacyRequestsAdditionalTime-BvXIXZYu.mjs.map → notifyPrivacyRequestsAdditionalTime-TEHAJe4C.mjs.map} +1 -1
- package/dist/package-C4J38oR1.mjs +2 -0
- package/dist/package-C4J38oR1.mjs.map +1 -0
- package/dist/{pullAllDatapoints-DiMWp8a7.mjs → pullAllDatapoints-Cntwuzw7.mjs} +2 -2
- package/dist/{pullAllDatapoints-DiMWp8a7.mjs.map → pullAllDatapoints-Cntwuzw7.mjs.map} +1 -1
- package/dist/{pullChunkedCustomSiloOutstandingIdentifiers-DgWgggQt.mjs → pullChunkedCustomSiloOutstandingIdentifiers-BT-GZpT1.mjs} +2 -2
- package/dist/{pullChunkedCustomSiloOutstandingIdentifiers-DgWgggQt.mjs.map → pullChunkedCustomSiloOutstandingIdentifiers-BT-GZpT1.mjs.map} +1 -1
- package/dist/{pullConsentManagerMetrics-pFRPXTHJ.mjs → pullConsentManagerMetrics-FnhPEszu.mjs} +2 -2
- package/dist/{pullConsentManagerMetrics-pFRPXTHJ.mjs.map → pullConsentManagerMetrics-FnhPEszu.mjs.map} +1 -1
- package/dist/{pullManualEnrichmentIdentifiersToCsv-DA_4rIzW.mjs → pullManualEnrichmentIdentifiersToCsv-B_4REnga.mjs} +2 -2
- package/dist/{pullManualEnrichmentIdentifiersToCsv-DA_4rIzW.mjs.map → pullManualEnrichmentIdentifiersToCsv-B_4REnga.mjs.map} +1 -1
- package/dist/{pullTranscendConfiguration-D2cYlu6V.mjs → pullTranscendConfiguration-CqsgEf9A.mjs} +2 -2
- package/dist/{pullTranscendConfiguration-D2cYlu6V.mjs.map → pullTranscendConfiguration-CqsgEf9A.mjs.map} +1 -1
- package/dist/{pullUnstructuredSubDataPointRecommendations-C4aVhH-W.mjs → pullUnstructuredSubDataPointRecommendations-DZd2q6S2.mjs} +2 -2
- package/dist/{pullUnstructuredSubDataPointRecommendations-C4aVhH-W.mjs.map → pullUnstructuredSubDataPointRecommendations-DZd2q6S2.mjs.map} +1 -1
- package/dist/{pushCronIdentifiersFromCsv-C34TB9tG.mjs → pushCronIdentifiersFromCsv-D2saGR5i.mjs} +2 -2
- package/dist/{pushCronIdentifiersFromCsv-C34TB9tG.mjs.map → pushCronIdentifiersFromCsv-D2saGR5i.mjs.map} +1 -1
- package/dist/{pushManualEnrichmentIdentifiersFromCsv-CGS9E3Ft.mjs → pushManualEnrichmentIdentifiersFromCsv-DOvAzMyt.mjs} +2 -2
- package/dist/{pushManualEnrichmentIdentifiersFromCsv-CGS9E3Ft.mjs.map → pushManualEnrichmentIdentifiersFromCsv-DOvAzMyt.mjs.map} +1 -1
- package/dist/{removeUnverifiedRequestIdentifiers-pGGOFbfE.mjs → removeUnverifiedRequestIdentifiers-ChlwRmhd.mjs} +2 -2
- package/dist/{removeUnverifiedRequestIdentifiers-pGGOFbfE.mjs.map → removeUnverifiedRequestIdentifiers-ChlwRmhd.mjs.map} +1 -1
- package/dist/{retryRequestDataSilos-DXwN5uPw.mjs → retryRequestDataSilos-DnwXA1YZ.mjs} +2 -2
- package/dist/{retryRequestDataSilos-DXwN5uPw.mjs.map → retryRequestDataSilos-DnwXA1YZ.mjs.map} +1 -1
- package/dist/{skipPreflightJobs-BNQhuPZ8.mjs → skipPreflightJobs-jK5lNlmv.mjs} +2 -2
- package/dist/{skipPreflightJobs-BNQhuPZ8.mjs.map → skipPreflightJobs-jK5lNlmv.mjs.map} +1 -1
- package/dist/{skipRequestDataSilos-C39ji4lO.mjs → skipRequestDataSilos-DQGroOos.mjs} +2 -2
- package/dist/{skipRequestDataSilos-C39ji4lO.mjs.map → skipRequestDataSilos-DQGroOos.mjs.map} +1 -1
- package/dist/{streamPrivacyRequestsToCsv-C8lquiyd.mjs → streamPrivacyRequestsToCsv-BK07Bm-T.mjs} +2 -2
- package/dist/{streamPrivacyRequestsToCsv-C8lquiyd.mjs.map → streamPrivacyRequestsToCsv-BK07Bm-T.mjs.map} +1 -1
- package/dist/{syncCodePackages-BHgjfXCI.mjs → syncCodePackages-F-97FNjo.mjs} +2 -2
- package/dist/{syncCodePackages-BHgjfXCI.mjs.map → syncCodePackages-F-97FNjo.mjs.map} +1 -1
- package/dist/{syncCookies-CiLtxDFf.mjs → syncCookies-BxY36BeJ.mjs} +2 -2
- package/dist/{syncCookies-CiLtxDFf.mjs.map → syncCookies-BxY36BeJ.mjs.map} +1 -1
- package/dist/{syncDataFlows-DmBUs3G_.mjs → syncDataFlows-Cx5LZCen.mjs} +2 -2
- package/dist/{syncDataFlows-DmBUs3G_.mjs.map → syncDataFlows-Cx5LZCen.mjs.map} +1 -1
- package/dist/{syncTemplates-BNu1_dmW.mjs → syncTemplates-BrH7Yr0V.mjs} +2 -2
- package/dist/{syncTemplates-BNu1_dmW.mjs.map → syncTemplates-BrH7Yr0V.mjs.map} +1 -1
- package/dist/{updateConsentManagerVersionToLatest-BBMN94Hs.mjs → updateConsentManagerVersionToLatest-C221vAAw.mjs} +2 -2
- package/dist/{updateConsentManagerVersionToLatest-BBMN94Hs.mjs.map → updateConsentManagerVersionToLatest-C221vAAw.mjs.map} +1 -1
- package/dist/{uploadCookiesFromCsv-BKZx_E_2.mjs → uploadCookiesFromCsv-roHWekOP.mjs} +2 -2
- package/dist/{uploadCookiesFromCsv-BKZx_E_2.mjs.map → uploadCookiesFromCsv-roHWekOP.mjs.map} +1 -1
- package/dist/{uploadDataFlowsFromCsv-CJFVLvCJ.mjs → uploadDataFlowsFromCsv-DcTbrsv2.mjs} +2 -2
- package/dist/{uploadDataFlowsFromCsv-CJFVLvCJ.mjs.map → uploadDataFlowsFromCsv-DcTbrsv2.mjs.map} +1 -1
- package/dist/{uploadPrivacyRequestsFromCsv-BmP1JluQ.mjs → uploadPrivacyRequestsFromCsv-BUGTS-pY.mjs} +2 -2
- package/dist/{uploadPrivacyRequestsFromCsv-BmP1JluQ.mjs.map → uploadPrivacyRequestsFromCsv-BUGTS-pY.mjs.map} +1 -1
- package/dist/{uploadSiloDiscoveryResults-XpDp2u35.mjs → uploadSiloDiscoveryResults-D2fK92WR.mjs} +2 -2
- package/dist/{uploadSiloDiscoveryResults-XpDp2u35.mjs.map → uploadSiloDiscoveryResults-D2fK92WR.mjs.map} +1 -1
- package/dist/{withPreferenceRetry-Cb5S310L.mjs → withPreferenceRetry-xLMZyTq9.mjs} +2 -2
- package/dist/{withPreferenceRetry-Cb5S310L.mjs.map → withPreferenceRetry-xLMZyTq9.mjs.map} +1 -1
- package/package.json +7 -7
- package/dist/createExtraKeyHandler-C_0EVj10.mjs.map +0 -1
- package/dist/fetchAllPurposesAndPreferences-Dog6N9L2.mjs +0 -2
- package/dist/impl-1U4QBT_L.mjs.map +0 -1
- package/dist/package-BjNQxHlz.mjs +0 -2
- package/dist/package-BjNQxHlz.mjs.map +0 -1
package/dist/{mergeTranscendInputs-C64BJsse.mjs.map → mergeTranscendInputs-DGC4xUGu.mjs.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mergeTranscendInputs-C64BJsse.mjs","names":["MAX_PAGE_SIZE"],"sources":["../src/lib/graphql/syncAction.ts","../src/lib/graphql/syncActionItemCollections.ts","../src/lib/graphql/syncActionItems.ts","../src/lib/graphql/syncAgentFiles.ts","../src/lib/graphql/syncAgentFunctions.ts","../src/lib/graphql/syncAgents.ts","../src/lib/graphql/syncAttribute.ts","../src/lib/graphql/syncBusinessEntities.ts","../src/lib/graphql/syncConsentManager.ts","../src/lib/graphql/syncDataCategories.ts","../src/lib/graphql/syncDataSubject.ts","../src/lib/graphql/syncIdentifier.ts","../src/lib/graphql/syncIntlMessages.ts","../src/lib/graphql/syncPolicies.ts","../src/lib/graphql/syncPrivacyCenter.ts","../src/lib/graphql/syncProcessingActivities.ts","../src/lib/graphql/syncProcessingPurposes.ts","../src/lib/graphql/syncPrompts.ts","../src/lib/graphql/syncVendors.ts","../src/lib/helpers/parseVariablesFromString.ts","../src/lib/graphql/syncPromptGroups.ts","../src/lib/graphql/syncPromptPartials.ts","../src/lib/graphql/syncTeams.ts","../src/lib/graphql/syncConfigurationToTranscend.ts","../src/lib/mergeTranscendInputs.ts"],"sourcesContent":["import { IsoCountryCode, IsoCountrySubdivisionCode } from '@transcend-io/privacy-types';\nimport { GraphQLClient } from 'graphql-request';\nimport { difference } from 'lodash-es';\n\nimport { ActionInput } from '../../codecs.js';\nimport { UPDATE_ACTION } from './gqls/index.js';\nimport { makeGraphQLRequest } from './makeGraphQLRequest.js';\n\nconst ALL_COUNTRIES_AND_SUBDIVISIONS = [\n ...Object.values(IsoCountryCode),\n ...Object.values(IsoCountrySubdivisionCode),\n];\n\n/**\n * Sync the consent manager\n *\n * @param client - GraphQL client\n * @param options - Options\n */\nexport async function syncAction(\n client: GraphQLClient,\n {\n action,\n actionId,\n skipPublish = false,\n }: {\n /** Action update input */\n action: ActionInput;\n /** Existing action Id */\n actionId: string;\n /** When true, skip publishing to privacy center */\n skipPublish?: boolean;\n },\n): Promise<void> {\n await makeGraphQLRequest(client, UPDATE_ACTION, {\n input: {\n id: actionId,\n skipSecondaryIfNoFiles: action.skipSecondaryIfNoFiles,\n skipDownloadableStep: action.skipDownloadableStep,\n requiresReview: action.requiresReview,\n waitingPeriod: action.waitingPeriod,\n skipPublish,\n regionList: action.regionBlockList\n ? difference(ALL_COUNTRIES_AND_SUBDIVISIONS, action.regionBlockList)\n : action.regionList,\n regionDetectionMethod: action.regionDetectionMethod,\n },\n });\n}\n","import colors from 'colors';\nimport { GraphQLClient } from 'graphql-request';\nimport { keyBy } from 'lodash-es';\n\nimport { ActionItemCollectionInput } from '../../codecs.js';\nimport { logger } from '../../logger.js';\nimport { mapSeries } from '../bluebird.js';\nimport {\n ActionItemCollection,\n fetchAllActionItemCollections,\n} from './fetchAllActionItemCollections.js';\nimport { UPDATE_ACTION_ITEM_COLLECTION, CREATE_ACTION_ITEM_COLLECTION } from './gqls/index.js';\nimport { makeGraphQLRequest } from './makeGraphQLRequest.js';\n\n/**\n * Input to create a new action item collection\n *\n * @param client - GraphQL client\n * @param actionItemCollection - Input\n * @returns Created action item collection\n */\nexport async function createActionItemCollection(\n client: GraphQLClient,\n actionItemCollection: ActionItemCollectionInput,\n): Promise<Pick<ActionItemCollection, 'id' | 'title'>> {\n const input = {\n title: actionItemCollection.title,\n description: actionItemCollection.description || '',\n hidden: actionItemCollection.hidden || false,\n productLine: actionItemCollection.productLine,\n };\n\n const { createActionItemCollection } = await makeGraphQLRequest<{\n /** Create actionItemCollection mutation */\n createActionItemCollection: {\n /** Created actionItemCollection */\n created: ActionItemCollection;\n };\n }>(client, CREATE_ACTION_ITEM_COLLECTION, {\n input,\n });\n return createActionItemCollection.created;\n}\n\n/**\n * Input to update actionItem collection\n *\n * @param client - GraphQL client\n * @param input - Input to update\n * @param actionItemCollectionId - ID of action item collection to update\n */\nexport async function updateActionItemCollection(\n client: GraphQLClient,\n input: ActionItemCollectionInput,\n actionItemCollectionId: string,\n): Promise<void> {\n await makeGraphQLRequest(client, UPDATE_ACTION_ITEM_COLLECTION, {\n input: {\n id: actionItemCollectionId,\n title: input.title,\n description: input.description,\n hidden: input.hidden,\n productLine: input.productLine,\n },\n });\n}\n\n/**\n * Sync the action item collections\n *\n * @param client - GraphQL client\n * @param inputs - Inputs to create\n * @returns True if run without error, returns false if an error occurred\n */\nexport async function syncActionItemCollections(\n client: GraphQLClient,\n inputs: ActionItemCollectionInput[],\n): Promise<boolean> {\n let encounteredError = false;\n // Fetch existing\n logger.info(colors.magenta(`Syncing \"${inputs.length}\" action item collections...`));\n\n // Fetch existing\n const existingActionItemCollections = await fetchAllActionItemCollections(client);\n\n // Look up by title\n const collectionByTitle: { [k in string]: ActionItemCollection } = keyBy(\n existingActionItemCollections,\n 'title',\n );\n\n // Create new actionItems\n const newCollections = inputs.filter((input) => !collectionByTitle[input.title]);\n\n // Create new actionItem collections\n await mapSeries(newCollections, async (input) => {\n try {\n await createActionItemCollection(client, input);\n logger.info(colors.green(`Successfully created action item collection \"${input.title}\"!`));\n } catch (err) {\n encounteredError = true;\n logger.info(\n colors.red(`Failed to create action item collection \"${input.title}\"! - ${err.message}`),\n );\n }\n });\n\n // Update all actionItems\n const actionItemsToUpdate = inputs\n .map((input) => [input, collectionByTitle[input.title]?.id])\n .filter((x): x is [ActionItemCollectionInput, string] => !!x[1]);\n await mapSeries(actionItemsToUpdate, async ([input, actionItemId]) => {\n try {\n await updateActionItemCollection(client, input, actionItemId);\n logger.info(colors.green(`Successfully synced action item collection \"${input.title}\"!`));\n } catch (err) {\n encounteredError = true;\n logger.info(\n colors.red(`Failed to sync action item collection \"${input.title}\"! - ${err.message}`),\n );\n }\n });\n\n return !encounteredError;\n}\n","import colors from 'colors';\nimport { GraphQLClient } from 'graphql-request';\nimport { uniq, keyBy, chunk } from 'lodash-es';\n\nimport { ActionItemInput } from '../../codecs.js';\nimport { logger } from '../../logger.js';\nimport { mapSeries } from '../bluebird.js';\nimport {\n ActionItemCollection,\n fetchAllActionItemCollections,\n} from './fetchAllActionItemCollections.js';\nimport { fetchAllActionItems, ActionItem } from './fetchAllActionItems.js';\nimport { Attribute, fetchAllAttributes } from './fetchAllAttributes.js';\nimport { UPDATE_ACTION_ITEMS, CREATE_ACTION_ITEMS } from './gqls/index.js';\nimport { makeGraphQLRequest } from './makeGraphQLRequest.js';\n\n/**\n * Input to create a new actionItem\n *\n * @param client - GraphQL client\n * @param actionItems - Action item inputs\n * @param actionItemCollectionByTitle - Action item collections indexed by title\n * @param attributeKeysByName - Lookup attribute by name\n */\nexport async function createActionItems(\n client: GraphQLClient,\n actionItems: ActionItemInput[],\n actionItemCollectionByTitle: { [k in string]: ActionItemCollection },\n // TODO: https://transcend.height.app/T-38961 - insert attributes\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n attributeKeysByName: { [k in string]: Attribute } = {},\n): Promise<void> {\n // TODO: https://transcend.height.app/T-38961 - insert attributes\n // const getAttribute = (key: string): string => {\n // const existing = attributeKeysByName[key];\n // if (!existing) {\n // throw new Error(`Attribute key \"${key}\" does not exist!`);\n // }\n // return existing.id;\n // };\n const chunked = chunk(actionItems, 100);\n await mapSeries(chunked, async (chunkToUpload) => {\n await makeGraphQLRequest(client, CREATE_ACTION_ITEMS, {\n input: chunkToUpload.map((actionItem) => ({\n title: actionItem.title,\n type: actionItem.type,\n priorityOverride: actionItem.priority,\n dueDate: actionItem.dueDate,\n customerExperienceActionItemId: actionItem.customerExperienceActionItemId,\n resolved: actionItem.resolved,\n notes: actionItem.notes,\n link: actionItem.link,\n assigneesUserEmails: actionItem.users,\n assigneesTeamNames: actionItem.teams,\n ...(actionItem.attributes\n ? {\n // TODO: https://transcend.height.app/T-38961 - insert attributes\n // attributes: actionItem.attributes.map(({ key, values }) => ({\n // attributeKeyId: getAttribute(key),\n // attributeValueNames: values,\n // })),\n }\n : {}),\n collectionIds: actionItem.collections.map(\n (collectionTitle) => actionItemCollectionByTitle[collectionTitle].id,\n ),\n })),\n });\n });\n}\n\n/**\n * Input to update actionItems\n *\n * @param client - GraphQL client\n * @param input - Input to update\n * @param actionItemId - ID of action item to update\n * @param attributeKeysByName - Attribute keys by name\n */\nexport async function updateActionItem(\n client: GraphQLClient,\n input: ActionItemInput,\n actionItemId: string,\n attributeKeysByName: {\n [k in string]: Attribute;\n } = {},\n): Promise<void> {\n const getAttribute = (key: string): string => {\n const existing = attributeKeysByName[key];\n if (!existing) {\n throw new Error(`Attribute key \"${key}\" does not exist!`);\n }\n return existing.id;\n };\n await makeGraphQLRequest(client, UPDATE_ACTION_ITEMS, {\n input: {\n ids: [actionItemId],\n title: input.title,\n priorityOverride: input.priority,\n dueDate: input.dueDate,\n resolved: input.resolved,\n customerExperienceActionItemId: input.customerExperienceActionItemId,\n notes: input.notes,\n link: input.link,\n assigneesUserEmails: input.users,\n assigneesTeamNames: input.teams,\n ...(input.attributes\n ? {\n attributes: input.attributes.map(({ key, values }) => ({\n attributeKeyId: getAttribute(key),\n attributeValueNames: values,\n })),\n }\n : {}),\n },\n });\n}\n\n/**\n * Convert action item to a unique key\n *\n * @param actionItem - action item\n * @returns Unique key\n */\nfunction actionItemToUniqueCode({\n title,\n collections,\n}: Pick<ActionItem, 'title' | 'collections'>): string {\n return `${title}-${collections\n .map((c) => c.title)\n .sort()\n .join('-')}`;\n}\n\n/**\n * Convert action item to a unique key\n *\n * @param actionItem - action item\n * @returns Unique key\n */\nfunction actionItemInputToUniqueCode({\n title,\n collections,\n}: Pick<ActionItemInput, 'title' | 'collections'>): string {\n return `${title}-${collections.sort().join('-')}`;\n}\n\n/**\n * Sync the action item\n *\n * @param client - GraphQL client\n * @param inputs - Inputs to create\n * @returns True if run without error, returns false if an error occurred\n */\nexport async function syncActionItems(\n client: GraphQLClient,\n inputs: ActionItemInput[],\n): Promise<boolean> {\n let encounteredError = false;\n // Fetch existing\n logger.info(colors.magenta(`Syncing \"${inputs.length}\" actionItems...`));\n\n // Determine if attributes are syncing\n const hasAttributes = inputs.some((input) => input.attributes && input.attributes.length > 0);\n\n // Fetch existing\n const [existingActionItems, existingActionItemCollections, attributeKeys] = await Promise.all([\n fetchAllActionItems(client),\n fetchAllActionItemCollections(client),\n hasAttributes ? fetchAllAttributes(client) : [],\n ]);\n\n // Look up by title\n const actionItemCollectionByTitle: { [k in string]: ActionItemCollection } = keyBy(\n existingActionItemCollections,\n 'title',\n );\n const actionItemByTitle: { [k in string]: ActionItem } = keyBy(\n existingActionItems,\n actionItemToUniqueCode,\n );\n const attributeKeysByName = keyBy(attributeKeys, 'name');\n const actionItemByCxId: { [k in string]: ActionItem } = keyBy(\n existingActionItems.filter((x) => !!x.customerExperienceActionItemIds),\n ({ customerExperienceActionItemIds }) => customerExperienceActionItemIds[0],\n );\n\n // Ensure all collections exist\n const missingCollections = uniq(inputs.map((input) => input.collections).flat()).filter(\n (collectionTitle) => !actionItemCollectionByTitle[collectionTitle],\n );\n if (missingCollections.length > 0) {\n logger.info(\n colors.red(\n `Missing action item collections: \"${missingCollections.join(\n '\", \"',\n )}\" - please create them first!`,\n ),\n );\n return false;\n }\n\n // Create new actionItems\n const newActionItems = inputs.filter(\n (input) =>\n !actionItemByTitle[actionItemInputToUniqueCode(input)] &&\n !actionItemByCxId[input.customerExperienceActionItemId!],\n );\n\n // Create new actionItems\n if (newActionItems.length > 0) {\n try {\n logger.info(colors.magenta(`Creating \"${newActionItems.length}\" actionItems...`));\n await createActionItems(\n client,\n newActionItems,\n actionItemCollectionByTitle,\n attributeKeysByName,\n );\n logger.info(colors.green(`Successfully created \"${newActionItems.length}\" actionItems!`));\n } catch (err) {\n encounteredError = true;\n logger.info(colors.red(`Failed to create action items! - ${err.message}`));\n }\n }\n\n // Update all actionItems\n const actionItemsToUpdate = inputs\n .map((input) => [\n input,\n actionItemByTitle[actionItemInputToUniqueCode(input)]?.id ||\n actionItemByCxId[input.customerExperienceActionItemId!]?.id,\n ])\n .filter((x): x is [ActionItemInput, string] => !!x[1]);\n await mapSeries(actionItemsToUpdate, async ([input, actionItemId]) => {\n try {\n await updateActionItem(client, input, actionItemId, attributeKeysByName);\n logger.info(colors.green(`Successfully synced action item \"${input.title}\"!`));\n } catch (err) {\n encounteredError = true;\n logger.info(colors.red(`Failed to sync action item \"${input.title}\"! - ${err.message}`));\n }\n });\n\n return !encounteredError;\n}\n","import colors from 'colors';\nimport { GraphQLClient } from 'graphql-request';\nimport { keyBy } from 'lodash-es';\n\nimport { AgentFileInput } from '../../codecs.js';\nimport { logger } from '../../logger.js';\nimport { mapSeries } from '../bluebird.js';\nimport { fetchAllAgentFiles, AgentFile } from './fetchAllAgentFiles.js';\nimport { UPDATE_AGENT_FILES, CREATE_AGENT_FILE } from './gqls/index.js';\nimport { makeGraphQLRequest } from './makeGraphQLRequest.js';\n\n/**\n * Input to create a new agent file\n *\n * @param client - GraphQL client\n * @param agentFile - Input\n * @returns Created agent file\n */\nexport async function createAgentFile(\n client: GraphQLClient,\n agentFile: AgentFileInput,\n): Promise<Pick<AgentFile, 'id' | 'name' | 'fileId'>> {\n const input = {\n name: agentFile.name,\n description: agentFile.description,\n fileId: agentFile.fileId,\n size: agentFile.size,\n purpose: agentFile.purpose,\n fileUploadedAt: new Date(),\n agentIds: [],\n // TODO: https://transcend.height.app/T-31994 - sync agents\n };\n\n const { createAgentFile } = await makeGraphQLRequest<{\n /** Create agent file mutation */\n createAgentFile: {\n /** Created agent file */\n agentFile: AgentFile;\n };\n }>(client, CREATE_AGENT_FILE, {\n input,\n });\n return createAgentFile.agentFile;\n}\n\n/**\n * Input to update agent files\n *\n * @param client - GraphQL client\n * @param agentFileIdPairs - [AgentFileInput, agentFileId] list\n */\nexport async function updateAgentFiles(\n client: GraphQLClient,\n agentFileIdPairs: [AgentFileInput, string][],\n): Promise<void> {\n await makeGraphQLRequest(client, UPDATE_AGENT_FILES, {\n input: {\n agentFiles: agentFileIdPairs.map(([agentFile, id]) => ({\n id,\n name: agentFile.name,\n description: agentFile.description,\n fileId: agentFile.fileId,\n size: agentFile.size,\n purpose: agentFile.purpose,\n })),\n },\n });\n}\n\n/**\n * Sync the data inventory agent files\n *\n * @param client - GraphQL client\n * @param inputs - Inputs to create\n * @returns True if run without error, returns false if an error occurred\n */\nexport async function syncAgentFiles(\n client: GraphQLClient,\n inputs: AgentFileInput[],\n): Promise<boolean> {\n // Fetch existing\n logger.info(colors.magenta(`Syncing \"${inputs.length}\" agent files...`));\n\n let encounteredError = false;\n\n // Fetch existing\n const existingAgentFiles = await fetchAllAgentFiles(client);\n\n // Look up by name\n const agentFileByName: {\n [k in string]: Pick<AgentFile, 'id' | 'name' | 'fileId'>;\n } = keyBy(existingAgentFiles, 'name');\n\n // Create new agent files\n const newAgentFiles = inputs.filter((input) => !agentFileByName[input.name]);\n\n // Create new agent files\n await mapSeries(newAgentFiles, async (agentFile) => {\n try {\n const newAgentFile = await createAgentFile(client, agentFile);\n agentFileByName[newAgentFile.name] = newAgentFile;\n logger.info(colors.green(`Successfully synced agent file \"${agentFile.name}\"!`));\n } catch (err) {\n encounteredError = true;\n logger.info(colors.red(`Failed to sync agent file \"${agentFile.name}\"! - ${err.message}`));\n }\n });\n\n // Update all agent files\n try {\n logger.info(colors.magenta(`Updating \"${inputs.length}\" agent files!`));\n await updateAgentFiles(\n client,\n inputs.map((input) => [input, agentFileByName[input.name].id]),\n );\n logger.info(colors.green(`Successfully synced \"${inputs.length}\" agent files!`));\n } catch (err) {\n encounteredError = true;\n logger.info(colors.red(`Failed to sync \"${inputs.length}\" agent files! - ${err.message}`));\n }\n\n return !encounteredError;\n}\n","import colors from 'colors';\nimport { GraphQLClient } from 'graphql-request';\nimport { keyBy } from 'lodash-es';\n\nimport { AgentFunctionInput } from '../../codecs.js';\nimport { logger } from '../../logger.js';\nimport { mapSeries } from '../bluebird.js';\nimport { fetchAllAgentFunctions, AgentFunction } from './fetchAllAgentFunctions.js';\nimport { UPDATE_AGENT_FUNCTIONS, CREATE_AGENT_FUNCTION } from './gqls/index.js';\nimport { makeGraphQLRequest } from './makeGraphQLRequest.js';\n\n/**\n * Input to create a new agent function\n *\n * @param client - GraphQL client\n * @param agentFunction - Input\n * @returns Created agent function\n */\nexport async function createAgentFunction(\n client: GraphQLClient,\n agentFunction: AgentFunctionInput,\n): Promise<Pick<AgentFunction, 'id' | 'name'>> {\n const input = {\n name: agentFunction.name,\n description: agentFunction.description,\n parameters: agentFunction.parameters,\n agentIds: [],\n // TODO: https://transcend.height.app/T-31994 - sync agents\n };\n\n const { createAgentFunction } = await makeGraphQLRequest<{\n /** Create agent function mutation */\n createAgentFunction: {\n /** Created agent function */\n agentFunction: AgentFunction;\n };\n }>(client, CREATE_AGENT_FUNCTION, {\n input,\n });\n return createAgentFunction.agentFunction;\n}\n\n/**\n * Input to update agent functions\n *\n * @param client - GraphQL client\n * @param agentFunctionIdPairs - [AgentFunctionInput, agentFunctionId] list\n */\nexport async function updateAgentFunctions(\n client: GraphQLClient,\n agentFunctionIdPairs: [AgentFunctionInput, string][],\n): Promise<void> {\n await makeGraphQLRequest(client, UPDATE_AGENT_FUNCTIONS, {\n input: {\n agentFunctions: agentFunctionIdPairs.map(([agentFunction, id]) => ({\n id,\n name: agentFunction.name,\n description: agentFunction.description,\n parameters: agentFunction.parameters,\n })),\n },\n });\n}\n\n/**\n * Sync the data inventory agent functions\n *\n * @param client - GraphQL client\n * @param inputs - Inputs to create\n * @returns True if run without error, returns false if an error occurred\n */\nexport async function syncAgentFunctions(\n client: GraphQLClient,\n inputs: AgentFunctionInput[],\n): Promise<boolean> {\n // Fetch existing\n logger.info(colors.magenta(`Syncing \"${inputs.length}\" agent functions...`));\n\n let encounteredError = false;\n\n // Fetch existing\n const existingAgentFunctions = await fetchAllAgentFunctions(client);\n\n // Look up by name\n const agentFunctionByName: {\n [k in string]: Pick<AgentFunction, 'id' | 'name'>;\n } = keyBy(existingAgentFunctions, 'name');\n\n // Create new agent functions\n const newAgentFunctions = inputs.filter((input) => !agentFunctionByName[input.name]);\n\n // Create new agent functions\n await mapSeries(newAgentFunctions, async (agentFunction) => {\n try {\n const newAgentFunction = await createAgentFunction(client, agentFunction);\n agentFunctionByName[newAgentFunction.name] = newAgentFunction;\n logger.info(colors.green(`Successfully synced agent function \"${agentFunction.name}\"!`));\n } catch (err) {\n encounteredError = true;\n logger.info(\n colors.red(`Failed to sync agent function \"${agentFunction.name}\"! - ${err.message}`),\n );\n }\n });\n\n // Update all agent functions\n try {\n logger.info(colors.magenta(`Updating \"${inputs.length}\" agent functions!`));\n await updateAgentFunctions(\n client,\n inputs.map((input) => [input, agentFunctionByName[input.name].id]),\n );\n logger.info(colors.green(`Successfully synced \"${inputs.length}\" agent functions!`));\n } catch (err) {\n encounteredError = true;\n logger.info(colors.red(`Failed to sync \"${inputs.length}\" agent functions! - ${err.message}`));\n }\n\n return !encounteredError;\n}\n","import colors from 'colors';\nimport { GraphQLClient } from 'graphql-request';\nimport { keyBy } from 'lodash-es';\n\nimport { AgentInput } from '../../codecs.js';\nimport { logger } from '../../logger.js';\nimport { mapSeries } from '../bluebird.js';\nimport { fetchAllAgents, Agent } from './fetchAllAgents.js';\nimport { UPDATE_AGENTS, CREATE_AGENT } from './gqls/index.js';\nimport { makeGraphQLRequest } from './makeGraphQLRequest.js';\n\n/**\n * Input to create a new agent\n *\n * @param client - GraphQL client\n * @param agent - Input\n * @returns Created agent\n */\nexport async function createAgent(\n client: GraphQLClient,\n agent: AgentInput,\n): Promise<Pick<Agent, 'id' | 'name' | 'agentId'>> {\n const input = {\n name: agent.name,\n description: agent.description,\n codeInterpreterEnabled: agent.codeInterpreterEnabled,\n retrievalEnabled: agent.retrievalEnabled,\n promptTitle: agent.prompt,\n largeLanguageModelName: agent['large-language-model'].name,\n largeLanguageModelClient: agent['large-language-model'].client,\n // TODO: https://transcend.height.app/T-32760 - agentFunction, agentFile\n // TODO: https://transcend.height.app/T-31994 - owners and teams\n };\n\n const { createAgent } = await makeGraphQLRequest<{\n /** Create agent mutation */\n createAgent: {\n /** Created agent */\n agent: Agent;\n };\n }>(client, CREATE_AGENT, {\n input,\n });\n return createAgent.agent;\n}\n\n/**\n * Input to update agents\n *\n * @param client - GraphQL client\n * @param agentIdParis - [AgentInput, agentId] list\n */\nexport async function updateAgents(\n client: GraphQLClient,\n agentIdParis: [AgentInput, string][],\n): Promise<void> {\n await makeGraphQLRequest(client, UPDATE_AGENTS, {\n input: {\n agents: agentIdParis.map(([agent, id]) => ({\n id,\n name: agent.name,\n description: agent.description,\n codeInterpreterEnabled: agent.codeInterpreterEnabled,\n retrievalEnabled: agent.retrievalEnabled,\n // TODO: https://transcend.height.app/T-31995 - prompt, largeLanguageModel, agentFunction, agentFile\n })),\n },\n });\n}\n\n/**\n * Sync the data inventory agents\n *\n * @param client - GraphQL client\n * @param inputs - Inputs to create\n * @returns True if run without error, returns false if an error occurred\n */\nexport async function syncAgents(client: GraphQLClient, inputs: AgentInput[]): Promise<boolean> {\n // Fetch existing\n logger.info(colors.magenta(`Syncing \"${inputs.length}\" agents...`));\n\n let encounteredError = false;\n\n // Fetch existing\n const existingAgents = await fetchAllAgents(client);\n\n // Look up by name\n const agentByName: {\n [k in string]: Pick<Agent, 'id' | 'name' | 'agentId'>;\n } = keyBy(existingAgents, 'name');\n\n // Create new agents\n const newAgents = inputs.filter((input) => !agentByName[input.name]);\n\n // Create new agents\n await mapSeries(newAgents, async (agent) => {\n try {\n const newAgent = await createAgent(client, agent);\n agentByName[newAgent.name] = newAgent;\n logger.info(colors.green(`Successfully synced agent \"${agent.name}\"!`));\n } catch (err) {\n encounteredError = true;\n logger.info(colors.red(`Failed to sync agent \"${agent.name}\"! - ${err.message}`));\n }\n });\n\n // Update all agents\n try {\n logger.info(colors.magenta(`Updating \"${inputs.length}\" agents!`));\n await updateAgents(\n client,\n inputs.map((input) => [input, agentByName[input.name].id]),\n );\n logger.info(colors.green(`Successfully synced \"${inputs.length}\" agents!`));\n } catch (err) {\n encounteredError = true;\n logger.info(colors.red(`Failed to sync \"${inputs.length}\" agents ! - ${err.message}`));\n }\n\n return !encounteredError;\n}\n","import colors from 'colors';\nimport { GraphQLClient } from 'graphql-request';\nimport { keyBy, difference, groupBy } from 'lodash-es';\n\nimport { AttributeInput } from '../../codecs.js';\nimport { logger } from '../../logger.js';\nimport { map } from '../bluebird.js';\nimport { Attribute } from './fetchAllAttributes.js';\nimport {\n CREATE_ATTRIBUTE,\n CREATE_ATTRIBUTE_VALUES,\n DELETE_ATTRIBUTE_VALUE,\n UPDATE_ATTRIBUTE,\n UPDATE_ATTRIBUTE_VALUES,\n} from './gqls/index.js';\nimport { makeGraphQLRequest } from './makeGraphQLRequest.js';\n\n/**\n * Sync attribute\n *\n * @param client - GraphQL client\n * @param attribute - The attribute input\n * @param options - Options\n */\nexport async function syncAttribute(\n client: GraphQLClient,\n attribute: AttributeInput,\n {\n existingAttribute,\n deleteExtraAttributeValues,\n }: {\n /** The existing attribute configuration if it exists */\n existingAttribute?: Attribute;\n /** When true, delete extra attributes not specified in the list of values */\n deleteExtraAttributeValues?: boolean;\n },\n): Promise<void> {\n // attribute key input\n const input = {\n name: attribute.name,\n enabledOn: attribute.resources,\n };\n\n // create or update attribute key\n let attributeKeyId: string;\n if (!existingAttribute) {\n const {\n createAttributeKey: { attributeKey },\n } = await makeGraphQLRequest<{\n /** Create attribute key response */\n createAttributeKey: {\n /** Attribute key */\n attributeKey: {\n /** ID */\n id: string;\n };\n };\n }>(client, CREATE_ATTRIBUTE, {\n type: attribute.type,\n description: attribute.description,\n ...input,\n });\n attributeKeyId = attributeKey.id;\n } else {\n await makeGraphQLRequest(client, UPDATE_ATTRIBUTE, {\n attributeKeyId: existingAttribute.id,\n description: existingAttribute.isCustom ? attribute.description : undefined,\n ...input,\n });\n attributeKeyId = existingAttribute.id;\n }\n\n // upsert attribute values\n const existingAttributeMap = keyBy(existingAttribute?.values || [], 'name');\n const { existingValues = [], newValues = [] } = groupBy(attribute.values || [], (field) =>\n existingAttributeMap[field.name] ? 'existingValues' : 'newValues',\n );\n const removedValues = difference(\n (existingAttribute?.values || []).map(({ name }) => name),\n (attribute.values || []).map(({ name }) => name),\n );\n\n // Create new attribute values\n if (newValues.length > 0) {\n await makeGraphQLRequest(client, CREATE_ATTRIBUTE_VALUES, {\n input: newValues.map(({ name, ...rest }) => ({\n name,\n attributeKeyId,\n ...rest,\n })),\n });\n logger.info(colors.green(`Created ${newValues.length} attribute values`));\n }\n\n // Update existing attribute values\n if (existingValues.length > 0) {\n await makeGraphQLRequest(client, UPDATE_ATTRIBUTE_VALUES, {\n input: existingValues.map(({ name, ...rest }) => ({\n id: existingAttributeMap[name].id,\n name,\n description: existingAttributeMap[name].description,\n color: existingAttributeMap[name].color,\n ...rest,\n attributeKeyId,\n })),\n });\n logger.info(colors.green(`Updated ${existingValues.length} attribute values`));\n }\n\n // Delete removed attribute values\n if (removedValues.length > 0 && deleteExtraAttributeValues) {\n await map(\n removedValues,\n async (value) => {\n await makeGraphQLRequest(client, DELETE_ATTRIBUTE_VALUE, {\n id: existingAttributeMap[value].id,\n });\n },\n {\n concurrency: 10,\n },\n );\n logger.info(colors.green(`Deleted ${removedValues.length} attribute values`));\n }\n}\n","import colors from 'colors';\nimport { GraphQLClient } from 'graphql-request';\nimport { keyBy, chunk } from 'lodash-es';\n\nimport { BusinessEntityInput } from '../../codecs.js';\nimport { logger } from '../../logger.js';\nimport { mapSeries } from '../bluebird.js';\nimport { fetchAllBusinessEntities, BusinessEntity } from './fetchAllBusinessEntities.js';\nimport { UPDATE_BUSINESS_ENTITIES, CREATE_BUSINESS_ENTITY } from './gqls/index.js';\nimport { makeGraphQLRequest } from './makeGraphQLRequest.js';\n\n/**\n * Input to create a new business entity\n *\n * @param client - GraphQL client\n * @param businessEntity - Input\n * @returns Created business entity\n */\nexport async function createBusinessEntity(\n client: GraphQLClient,\n businessEntity: BusinessEntityInput,\n): Promise<BusinessEntity> {\n const input = {\n title: businessEntity.title,\n description: businessEntity.description,\n address: businessEntity.address,\n headquarterCountry: businessEntity.headquarterCountry,\n headquarterSubDivision: businessEntity.headquarterSubDivision,\n dataProtectionOfficerName: businessEntity.dataProtectionOfficerName,\n dataProtectionOfficerEmail: businessEntity.dataProtectionOfficerEmail,\n attributes: businessEntity.attributes,\n teamNames: businessEntity.teams,\n ownerEmails: businessEntity.owners,\n };\n\n const { createBusinessEntity } = await makeGraphQLRequest<{\n /** Create business entity mutation */\n createBusinessEntity: {\n /** Created business entity */\n businessEntity: BusinessEntity;\n };\n }>(client, CREATE_BUSINESS_ENTITY, {\n input,\n });\n return createBusinessEntity.businessEntity;\n}\n\n/**\n * Input to update business entities\n *\n * @param client - GraphQL client\n * @param businessEntityIdParis - [BusinessEntityInput, businessEntityId] list\n */\nexport async function updateBusinessEntities(\n client: GraphQLClient,\n businessEntityIdParis: [BusinessEntityInput, string][],\n): Promise<void> {\n const chunkedUpdates = chunk(businessEntityIdParis, 100);\n await mapSeries(chunkedUpdates, async (chunked) => {\n await makeGraphQLRequest(client, UPDATE_BUSINESS_ENTITIES, {\n input: chunked.map(([businessEntity, id]) => ({\n id,\n title: businessEntity.title,\n description: businessEntity.description,\n address: businessEntity.address,\n headquarterCountry: businessEntity.headquarterCountry,\n headquarterSubDivision: businessEntity.headquarterSubDivision,\n dataProtectionOfficerName: businessEntity.dataProtectionOfficerName,\n dataProtectionOfficerEmail: businessEntity.dataProtectionOfficerEmail,\n attributes: businessEntity.attributes,\n teamNames: businessEntity.teams,\n ownerEmails: businessEntity.owners,\n })),\n });\n });\n}\n\n/**\n * Sync the data inventory business entities\n *\n * @param client - GraphQL client\n * @param inputs - Inputs to create\n * @returns True if run without error, returns false if an error occurred\n */\nexport async function syncBusinessEntities(\n client: GraphQLClient,\n inputs: BusinessEntityInput[],\n): Promise<boolean> {\n // Fetch existing\n logger.info(colors.magenta(`Syncing \"${inputs.length}\" business entities...`));\n\n let encounteredError = false;\n\n // Fetch existing\n const existingBusinessEntities = await fetchAllBusinessEntities(client);\n\n // Look up by title\n const businessEntityByTitle = keyBy(existingBusinessEntities, 'title');\n\n // Create new business entities\n const newBusinessEntities = inputs.filter((input) => !businessEntityByTitle[input.title]);\n\n // Create new business entities\n await mapSeries(newBusinessEntities, async (businessEntity) => {\n try {\n const newBusinessEntity = await createBusinessEntity(client, businessEntity);\n businessEntityByTitle[newBusinessEntity.title] = newBusinessEntity;\n logger.info(colors.green(`Successfully synced business entity \"${businessEntity.title}\"!`));\n } catch (err) {\n encounteredError = true;\n logger.info(\n colors.red(`Failed to sync business entity \"${businessEntity.title}\"! - ${err.message}`),\n );\n }\n });\n\n // Update all business entities\n try {\n logger.info(colors.magenta(`Updating \"${inputs.length}\" business entities!`));\n await updateBusinessEntities(\n client,\n inputs.map((input) => [input, businessEntityByTitle[input.title].id]),\n );\n logger.info(colors.green(`Successfully synced \"${inputs.length}\" business entities!`));\n } catch (err) {\n encounteredError = true;\n logger.info(\n colors.red(`Failed to sync \"${inputs.length}\" business entities ! - ${err.message}`),\n );\n }\n\n return !encounteredError;\n}\n","import { InitialViewState, OnConsentExpiry } from '@transcend-io/airgap.js-types';\nimport colors from 'colors';\nimport { GraphQLClient } from 'graphql-request';\nimport { keyBy } from 'lodash-es';\n\nimport { ConsentManageExperienceInput, ConsentManagerInput } from '../../codecs.js';\nimport { logger } from '../../logger.js';\nimport { map } from '../bluebird.js';\nimport { fetchAllPurposes } from './fetchAllPurposes.js';\nimport { fetchConsentManagerId, fetchConsentManagerExperiences } from './fetchConsentManagerId.js';\nimport { fetchPrivacyCenterId } from './fetchPrivacyCenterId.js';\nimport {\n UPDATE_CONSENT_MANAGER_DOMAINS,\n CREATE_CONSENT_MANAGER,\n UPDATE_LOAD_OPTIONS,\n UPDATE_CONSENT_MANAGER_PARTITION,\n UPDATE_CONSENT_MANAGER_VERSION,\n TOGGLE_TELEMETRY_PARTITION_STRATEGY,\n TOGGLE_UNKNOWN_COOKIE_POLICY,\n TOGGLE_CONSENT_PRECEDENCE,\n TOGGLE_UNKNOWN_REQUEST_POLICY,\n UPDATE_CONSENT_EXPERIENCE,\n CREATE_CONSENT_EXPERIENCE,\n UPDATE_CONSENT_MANAGER_THEME,\n} from './gqls/index.js';\nimport { makeGraphQLRequest } from './makeGraphQLRequest.js';\nimport { fetchPartitions } from './syncPartitions.js';\n\nconst PURPOSES_LINK = 'https://app.transcend.io/consent-manager/regional-experiences/purposes';\n\n/**\n * Sync consent manager experiences up to Transcend\n *\n * @param client - GraphQL client\n * @param experiences - The experience inputs\n */\nexport async function syncConsentManagerExperiences(\n client: GraphQLClient,\n experiences: ConsentManageExperienceInput[],\n): Promise<void> {\n // Fetch existing experiences and\n const existingExperiences = await fetchConsentManagerExperiences(client);\n const experienceLookup = keyBy(existingExperiences, 'name');\n\n // Fetch existing purposes\n const purposes = await fetchAllPurposes(client);\n const purposeLookup = keyBy(purposes, 'trackingType');\n\n // Bulk update or create experiences\n await map(\n experiences,\n async (exp, ind) => {\n // Purpose IDs\n const purposeIds = exp.purposes?.map((purpose, ind2) => {\n const existingPurpose = purposeLookup[purpose.trackingType];\n if (!existingPurpose) {\n throw new Error(\n `Invalid purpose trackingType provided at consentManager.experiences[${ind}].purposes[${ind2}]: ` +\n `${purpose.trackingType}. See list of valid purposes ${PURPOSES_LINK}`,\n );\n }\n return existingPurpose.id;\n });\n const optedOutPurposeIds = exp.optedOutPurposes?.map((purpose, ind2) => {\n const existingPurpose = purposeLookup[purpose.trackingType];\n if (!existingPurpose) {\n throw new Error(\n `Invalid purpose trackingType provided at consentManager.experiences[${ind}].optedOutPurposes[${ind2}]: ` +\n `${purpose.trackingType}. See list of valid purposes ${PURPOSES_LINK}`,\n );\n }\n return existingPurpose.id;\n });\n\n // update experience\n const existingExperience = experienceLookup[exp.name];\n if (existingExperience) {\n await makeGraphQLRequest(client, UPDATE_CONSENT_EXPERIENCE, {\n input: {\n id: existingExperience.id,\n name: exp.displayName,\n regions: exp.regions,\n operator: exp.operator,\n onConsentExpiry: exp.onConsentExpiry,\n consentExpiry: exp.consentExpiry,\n displayPriority:\n exp.displayPriority !== existingExperience.displayPriority\n ? exp.displayPriority\n : undefined,\n viewState: exp.viewState,\n purposes: purposeIds,\n optedOutPurposes: optedOutPurposeIds,\n browserLanguages: exp.browserLanguages,\n browserTimeZones: exp.browserTimeZones,\n },\n });\n logger.info(colors.green(`Successfully synced consent experience \"${exp.name}\"!`));\n } else {\n // create new experience\n await makeGraphQLRequest(client, CREATE_CONSENT_EXPERIENCE, {\n input: {\n name: exp.name,\n displayName: exp.displayName,\n regions: exp.regions,\n operator: exp.operator,\n onConsentExpiry: exp.onConsentExpiry || OnConsentExpiry.Prompt,\n consentExpiry: exp.consentExpiry,\n displayPriority: exp.displayPriority,\n viewState: exp.viewState || InitialViewState.Hidden,\n purposes: purposeIds || [],\n optedOutPurposes: optedOutPurposeIds || [],\n browserLanguages: exp.browserLanguages,\n browserTimeZones: exp.browserTimeZones,\n },\n });\n logger.info(colors.green(`Successfully created consent experience \"${exp.name}\"!`));\n }\n },\n {\n concurrency: 10,\n },\n );\n}\n\n/**\n * Sync the consent manager\n *\n * @param client - GraphQL client\n * @param consentManager - The consent manager input\n */\nexport async function syncConsentManager(\n client: GraphQLClient,\n consentManager: ConsentManagerInput,\n): Promise<void> {\n let airgapBundleId: string;\n\n // ensure the consent manager is created and deployed\n try {\n airgapBundleId = await fetchConsentManagerId(client, 1);\n } catch (err) {\n // TODO: https://transcend.height.app/T-23778\n if (err.message.includes('AirgapBundle not found')) {\n const privacyCenterId = await fetchPrivacyCenterId(client);\n\n const { createConsentManager } = await makeGraphQLRequest<{\n /** Create consent manager */\n createConsentManager: {\n /** Consent manager */\n consentManager: {\n /** ID */\n id: string;\n };\n };\n }>(client, CREATE_CONSENT_MANAGER, {\n domains: consentManager.domains,\n privacyCenterId,\n });\n airgapBundleId = createConsentManager.consentManager.id;\n } else {\n throw err;\n }\n }\n\n // sync domains\n if (consentManager.domains) {\n await makeGraphQLRequest(client, UPDATE_CONSENT_MANAGER_DOMAINS, {\n domains: consentManager.domains,\n airgapBundleId,\n });\n }\n\n // sync partition\n if (consentManager.partition) {\n const partitions = await fetchPartitions(client);\n const partitionToUpdate = partitions.find((part) => part.name === consentManager.partition);\n if (!partitionToUpdate) {\n throw new Error(\n `Partition \"${consentManager.partition}\" not found. Please create the partition first.`,\n );\n }\n await makeGraphQLRequest(client, UPDATE_CONSENT_MANAGER_PARTITION, {\n partitionId: partitionToUpdate.id,\n airgapBundleId,\n });\n }\n\n if (consentManager.version) {\n await makeGraphQLRequest(client, UPDATE_CONSENT_MANAGER_VERSION, {\n airgapBundleId,\n version: consentManager.version,\n });\n }\n\n // sync signed IAB agreement\n if (consentManager.signedIabAgreement) {\n await makeGraphQLRequest(client, UPDATE_LOAD_OPTIONS, {\n input: {\n id: airgapBundleId,\n ...(consentManager.signedIabAgreement\n ? { signedIabAgreement: consentManager.signedIabAgreement }\n : {}),\n },\n });\n }\n\n // sync default request policy\n if (consentManager.unknownRequestPolicy) {\n await makeGraphQLRequest(client, TOGGLE_UNKNOWN_REQUEST_POLICY, {\n input: {\n id: airgapBundleId,\n unknownRequestPolicy: consentManager.unknownRequestPolicy,\n },\n });\n }\n\n // sync default cookie policy\n if (consentManager.unknownRequestPolicy) {\n await makeGraphQLRequest(client, TOGGLE_UNKNOWN_COOKIE_POLICY, {\n input: {\n id: airgapBundleId,\n unknownCookiePolicy: consentManager.unknownCookiePolicy,\n },\n });\n }\n\n // sync telemetry partition strategy\n if (consentManager.telemetryPartitioning) {\n await makeGraphQLRequest(client, TOGGLE_TELEMETRY_PARTITION_STRATEGY, {\n input: {\n id: airgapBundleId,\n strategy: consentManager.telemetryPartitioning,\n },\n });\n }\n\n // sync telemetry partition strategy\n if (consentManager.consentPrecedence) {\n await makeGraphQLRequest(client, TOGGLE_CONSENT_PRECEDENCE, {\n input: {\n id: airgapBundleId,\n consentPrecedence: consentManager.consentPrecedence,\n },\n });\n }\n\n // Update experience configurations\n if (consentManager.experiences) {\n await syncConsentManagerExperiences(client, consentManager.experiences);\n }\n\n // update theme\n if (consentManager.theme) {\n await makeGraphQLRequest(client, UPDATE_CONSENT_MANAGER_THEME, {\n input: {\n airgapBundleId,\n ...consentManager.theme,\n },\n });\n }\n\n // TODO: https://transcend.height.app/T-23875\n // syncEndpoint: string;\n // TODO: https://transcend.height.app/T-23919\n // syncGroups: string;\n}\n","import colors from 'colors';\nimport { GraphQLClient } from 'graphql-request';\nimport { keyBy } from 'lodash-es';\n\nimport { DataCategoryInput } from '../../codecs.js';\nimport { logger } from '../../logger.js';\nimport { mapSeries } from '../bluebird.js';\nimport { fetchAllDataCategories, DataSubCategory } from './fetchAllDataCategories.js';\nimport { UPDATE_DATA_SUB_CATEGORIES, CREATE_DATA_SUB_CATEGORY } from './gqls/index.js';\nimport { makeGraphQLRequest } from './makeGraphQLRequest.js';\n\n/**\n * Input to create a new data category\n *\n * @param client - GraphQL client\n * @param dataCategory - Input\n * @returns Created data category\n */\nexport async function createDataCategory(\n client: GraphQLClient,\n dataCategory: DataCategoryInput,\n): Promise<Pick<DataSubCategory, 'id' | 'name' | 'category'>> {\n const input = {\n name: dataCategory.name,\n category: dataCategory.category,\n description: dataCategory.description,\n // TODO: https://transcend.height.app/T-31994 - add attributes, teams, owners\n };\n\n const { createDataCategory } = await makeGraphQLRequest<{\n /** Create data category mutation */\n createDataCategory: {\n /** Created data category */\n dataCategory: DataSubCategory;\n };\n }>(client, CREATE_DATA_SUB_CATEGORY, {\n input,\n });\n return createDataCategory.dataCategory;\n}\n\n/**\n * Input to update data categories\n *\n * @param client - GraphQL client\n * @param dataCategoryIdPairs - [DataCategoryInput, dataCategoryId] list\n */\nexport async function updateDataCategories(\n client: GraphQLClient,\n dataCategoryIdPairs: [DataCategoryInput, string][],\n): Promise<void> {\n await makeGraphQLRequest(client, UPDATE_DATA_SUB_CATEGORIES, {\n input: {\n dataSubCategories: dataCategoryIdPairs.map(([dataCategory, id]) => ({\n id,\n description: dataCategory.description,\n // TODO: https://transcend.height.app/T-31994 - add teams, owners\n attributes: dataCategory.attributes,\n })),\n },\n });\n}\n\n/**\n * Sync the data inventory data categories\n *\n * @param client - GraphQL client\n * @param inputs - Inputs to create\n * @returns True if run without error, returns false if an error occurred\n */\nexport async function syncDataCategories(\n client: GraphQLClient,\n inputs: DataCategoryInput[],\n): Promise<boolean> {\n // Fetch existing\n logger.info(colors.magenta(`Syncing \"${inputs.length}\" data categories...`));\n\n let encounteredError = false;\n\n // Fetch existing\n const existingDataCategories = await fetchAllDataCategories(client);\n\n // Look up by name\n const dataCategoryByName: {\n [k in string]: Pick<DataSubCategory, 'id' | 'name' | 'category'>;\n } = keyBy(existingDataCategories, ({ name, category }) => `${name}:${category}`);\n\n // Create new data categories\n const newDataCategories = inputs.filter(\n (input) => !dataCategoryByName[`${input.name}:${input.category}`],\n );\n\n // Create new data categories\n await mapSeries(newDataCategories, async (dataCategory) => {\n try {\n const newDataCategory = await createDataCategory(client, dataCategory);\n dataCategoryByName[`${newDataCategory.name}:${newDataCategory.category}`] = newDataCategory;\n logger.info(colors.green(`Successfully synced data category \"${dataCategory.name}\"!`));\n } catch (err) {\n encounteredError = true;\n logger.info(\n colors.red(`Failed to sync data category \"${dataCategory.name}\"! - ${err.message}`),\n );\n }\n });\n\n // Update all data categories\n try {\n logger.info(colors.magenta(`Updating \"${inputs.length}\" data categories!`));\n await updateDataCategories(\n client,\n inputs.map((input) => [input, dataCategoryByName[`${input.name}:${input.category}`].id]),\n );\n logger.info(colors.green(`Successfully synced \"${inputs.length}\" data categories!`));\n } catch (err) {\n encounteredError = true;\n logger.info(colors.red(`Failed to sync \"${inputs.length}\" data categories ! - ${err.message}`));\n }\n\n return !encounteredError;\n}\n","import { GraphQLClient } from 'graphql-request';\n\nimport { DataSubjectInput } from '../../codecs.js';\nimport { UPDATE_DATA_SUBJECT, TOGGLE_DATA_SUBJECT } from './gqls/index.js';\nimport { makeGraphQLRequest } from './makeGraphQLRequest.js';\n\n/**\n * Sync the data subjects\n *\n * @param client - GraphQL client\n * @param options - Options\n */\nexport async function syncDataSubject(\n client: GraphQLClient,\n {\n dataSubject,\n dataSubjectId,\n skipPublish = false,\n }: {\n /** DataSubject update input */\n dataSubject: DataSubjectInput;\n /** Existing data subject Id */\n dataSubjectId: string;\n /** When true, skip publishing to privacy center */\n skipPublish?: boolean;\n },\n): Promise<void> {\n await makeGraphQLRequest(client, UPDATE_DATA_SUBJECT, {\n input: {\n id: dataSubjectId,\n title: dataSubject.title,\n adminDashboardDefaultSilentMode: dataSubject.adminDashboardDefaultSilentMode,\n actions: dataSubject.actions,\n skipPublish: skipPublish && typeof dataSubject.active === 'undefined',\n },\n });\n\n if (typeof dataSubject.active === 'boolean') {\n await makeGraphQLRequest(client, TOGGLE_DATA_SUBJECT, {\n input: {\n id: dataSubjectId,\n active: dataSubject.active,\n skipPublish,\n },\n });\n }\n}\n","import { GraphQLClient } from 'graphql-request';\n\nimport { IdentifierInput } from '../../codecs.js';\nimport type { DataSubject } from './fetchDataSubjects.js';\nimport { UPDATE_IDENTIFIER } from './gqls/index.js';\nimport { makeGraphQLRequest } from './makeGraphQLRequest.js';\n\n/**\n * Sync the consent manager\n *\n * @param client - GraphQL client\n * @param options - Options\n */\nexport async function syncIdentifier(\n client: GraphQLClient,\n {\n identifier,\n dataSubjectsByName,\n identifierId,\n skipPublish = false,\n }: {\n /** Identifier update input */\n identifier: IdentifierInput;\n /** Data subject lookup by name */\n dataSubjectsByName: { [k in string]: DataSubject };\n /** Existing identifier Id */\n identifierId: string;\n /** When true, skip publishing to privacy center */\n skipPublish?: boolean;\n },\n): Promise<void> {\n await makeGraphQLRequest(client, UPDATE_IDENTIFIER, {\n input: {\n id: identifierId,\n selectOptions: identifier.selectOptions,\n isRequiredInForm: identifier.isRequiredInForm,\n regex: identifier.regex,\n placeholder: identifier.placeholder,\n displayTitle: identifier.displayTitle,\n displayDescription: identifier.displayDescription,\n displayOrder: identifier.displayOrder,\n isUniqueOnPreferenceStore: identifier.isUniqueOnPreferenceStore,\n privacyCenterVisibility: identifier.privacyCenterVisibility,\n dataSubjectIds: identifier.dataSubjects\n ? identifier.dataSubjects.map((type) => dataSubjectsByName[type].id)\n : undefined,\n skipPublish,\n },\n });\n}\n","import colors from 'colors';\nimport { GraphQLClient } from 'graphql-request';\nimport { chunk } from 'lodash-es';\n\nimport { IntlMessageInput } from '../../codecs.js';\nimport { logger } from '../../logger.js';\nimport { mapSeries } from '../bluebird.js';\nimport { UPDATE_INTL_MESSAGES } from './gqls/index.js';\nimport { makeGraphQLRequest } from './makeGraphQLRequest.js';\n\nconst MAX_PAGE_SIZE = 100;\n\n/**\n * Update or create intl messages\n *\n * @param client - GraphQL client\n * @param messageInputs - List of message inputs\n */\nexport async function updateIntlMessages(\n client: GraphQLClient,\n messageInputs: IntlMessageInput[],\n): Promise<void> {\n // Batch update messages\n await mapSeries(chunk(messageInputs, MAX_PAGE_SIZE), async (page) => {\n await makeGraphQLRequest(client, UPDATE_INTL_MESSAGES, {\n messages: page.map((message) => ({\n ...(message.id.includes('.') ? {} : { id: message.id }),\n defaultMessage: message.defaultMessage,\n targetReactIntlId: message.targetReactIntlId,\n translations: !message.translations\n ? undefined\n : Object.entries(message.translations).map(([locale, value]) => ({\n locale,\n value,\n })),\n })),\n });\n });\n}\n\n/**\n * Sync the set of messages from the YML interface into the product\n *\n * @param client - GraphQL client\n * @param messages - messages to sync\n * @returns True upon success, false upon failure\n */\nexport async function syncIntlMessages(\n client: GraphQLClient,\n messages: IntlMessageInput[],\n): Promise<boolean> {\n let encounteredError = false;\n logger.info(colors.magenta(`Syncing \"${messages.length}\" messages...`));\n\n // Ensure no duplicates are being uploaded\n const notUnique = messages.filter(\n (message) => messages.filter((pol) => message.id === pol.id).length > 1,\n );\n if (notUnique.length > 0) {\n throw new Error(\n `Failed to upload messages as there were non-unique entries found: ${notUnique\n .map(({ id }) => id)\n .join(',')}`,\n );\n }\n\n try {\n logger.info(colors.magenta(`Upserting \"${messages.length}\" new messages...`));\n await updateIntlMessages(client, messages);\n logger.info(colors.green(`Successfully synced ${messages.length} messages!`));\n } catch (err) {\n encounteredError = true;\n logger.info(colors.red(`Failed to create messages! - ${err.message}`));\n }\n\n return !encounteredError;\n}\n","import colors from 'colors';\nimport { GraphQLClient } from 'graphql-request';\nimport { chunk, keyBy } from 'lodash-es';\n\nimport { PolicyInput } from '../../codecs.js';\nimport { logger } from '../../logger.js';\nimport { mapSeries } from '../bluebird.js';\nimport { fetchAllPolicies } from './fetchAllPolicies.js';\nimport { fetchPrivacyCenterId } from './fetchPrivacyCenterId.js';\nimport { UPDATE_POLICIES } from './gqls/index.js';\nimport { makeGraphQLRequest } from './makeGraphQLRequest.js';\n\nconst MAX_PAGE_SIZE = 100;\n\n/**\n * Update or create policies\n *\n * @param client - GraphQL client\n * @param policyInputs - List of policy input\n */\nexport async function updatePolicies(\n client: GraphQLClient,\n policyInputs: [PolicyInput, string | undefined][],\n): Promise<void> {\n const privacyCenterId = await fetchPrivacyCenterId(client);\n\n // Batch update policies\n await mapSeries(chunk(policyInputs, MAX_PAGE_SIZE), async (page) => {\n await makeGraphQLRequest(client, UPDATE_POLICIES, {\n privacyCenterId,\n policies: page.map(([policy, policyId]) => ({\n id: policyId,\n title: policy.title,\n disableEffectiveOn: policy.disableEffectiveOn,\n disabledLocales: policy.disabledLocales,\n ...(policy.effectiveOn || policy.content\n ? {\n version: {\n ...(policy.effectiveOn ? { effectiveOn: policy.effectiveOn } : {}),\n ...(policy.content\n ? {\n content: {\n defaultMessage: policy.content,\n },\n }\n : {}),\n },\n }\n : {}),\n })),\n });\n });\n}\n\n/**\n * Sync the set of policies from the YML interface into the product\n *\n * @param client - GraphQL client\n * @param policies - policies to sync\n * @returns True upon success, false upon failure\n */\nexport async function syncPolicies(\n client: GraphQLClient,\n policies: PolicyInput[],\n): Promise<boolean> {\n let encounteredError = false;\n logger.info(colors.magenta(`Syncing \"${policies.length}\" policies...`));\n\n // Ensure no duplicates are being uploaded\n const notUnique = policies.filter(\n (policy) => policies.filter((pol) => policy.title === pol.title).length > 1,\n );\n if (notUnique.length > 0) {\n throw new Error(\n `Failed to upload policies as there were non-unique entries found: ${notUnique\n .map(({ title }) => title)\n .join(',')}`,\n );\n }\n\n // Grab existing policies\n const existingPolicies = await fetchAllPolicies(client);\n const policiesById = keyBy(existingPolicies, ({ title }) => title.defaultMessage);\n\n try {\n logger.info(colors.magenta(`Upserting \"${policies.length}\" new policies...`));\n await updatePolicies(\n client,\n policies.map((policy) => [policy, policiesById[policy.title]?.id]),\n );\n logger.info(colors.green(`Successfully synced ${policies.length} policies!`));\n } catch (err) {\n encounteredError = true;\n logger.info(colors.red(`Failed to create policies! - ${err.message}`));\n }\n\n return !encounteredError;\n}\n","import colors from 'colors';\nimport { GraphQLClient } from 'graphql-request';\n\nimport { PrivacyCenterInput } from '../../codecs.js';\nimport { logger } from '../../logger.js';\nimport { fetchPrivacyCenterId } from './fetchPrivacyCenterId.js';\nimport { UPDATE_PRIVACY_CENTER } from './gqls/index.js';\nimport { makeGraphQLRequest } from './makeGraphQLRequest.js';\n\n/**\n * Sync the privacy center\n *\n * @param client - GraphQL client\n * @param privacyCenter - The privacy center input\n * @returns Whether the privacy center was synced successfully\n */\nexport async function syncPrivacyCenter(\n client: GraphQLClient,\n privacyCenter: PrivacyCenterInput,\n): Promise<boolean> {\n let encounteredError = false;\n logger.info(colors.magenta('Syncing privacy center...'));\n\n // Grab the privacy center ID\n const privacyCenterId = await fetchPrivacyCenterId(client);\n\n try {\n await makeGraphQLRequest(client, UPDATE_PRIVACY_CENTER, {\n input: {\n privacyCenterId,\n transformAccessReportJsonToCsv: privacyCenter.transformAccessReportJsonToCsv,\n useCustomEmailDomain: privacyCenter.useCustomEmailDomain,\n useNoReplyEmailAddress: privacyCenter.useNoReplyEmailAddress,\n replyToEmail: privacyCenter.replyToEmail,\n supportEmail: privacyCenter.supportEmail,\n preferBrowserDefaultLocale: privacyCenter.preferBrowserDefaultLocale,\n defaultLocale: privacyCenter.defaultLocale,\n locales: privacyCenter.locales,\n showMarketingPreferences: privacyCenter.showMarketingPreferences,\n showManageYourPrivacy: privacyCenter.showManageYourPrivacy,\n showPolicies: privacyCenter.showPolicies,\n showConsentManager: privacyCenter.showConsentManager,\n showDataFlows: privacyCenter.showDataFlows,\n showCookies: privacyCenter.showCookies,\n showTrackingTechnologies: privacyCenter.showTrackingTechnologies,\n showPrivacyRequestButton: privacyCenter.showPrivacyRequestButton,\n isDisabled: privacyCenter.isDisabled,\n ...(privacyCenter.theme\n ? {\n colorPalette: privacyCenter.theme.colors,\n componentStyles: privacyCenter.theme.componentStyles,\n textStyles: privacyCenter.theme.textStyles,\n }\n : {}),\n },\n });\n logger.info(colors.green('Successfully synced privacy center!'));\n } catch (err) {\n encounteredError = true;\n logger.info(colors.red(`Failed to create privacy center! - ${err.message}`));\n }\n\n return !encounteredError;\n}\n","import colors from 'colors';\nimport { GraphQLClient } from 'graphql-request';\nimport { keyBy } from 'lodash-es';\n\nimport { ProcessingActivityInput } from '../../codecs.js';\nimport { logger } from '../../logger.js';\nimport { mapSeries } from '../bluebird.js';\nimport {\n fetchAllProcessingActivities,\n ProcessingActivity,\n} from './fetchAllProcessingActivities.js';\nimport { UPDATE_PROCESSING_ACTIVITIES, CREATE_PROCESSING_ACTIVITY } from './gqls/index.js';\nimport { makeGraphQLRequest } from './makeGraphQLRequest.js';\n\n/**\n * Create a new processing activity, setting only title and description\n *\n * @param client - GraphQL client\n * @param processingActivity - Input\n * @returns Created processingActivity\n */\nasync function createProcessingActivity(\n client: GraphQLClient,\n processingActivity: ProcessingActivityInput,\n): Promise<Pick<ProcessingActivity, 'id' | 'title'>> {\n const input = {\n title: processingActivity.title,\n description: processingActivity.description,\n };\n\n const { createProcessingActivity } = await makeGraphQLRequest<{\n /** Create processingActivity mutation */\n createProcessingActivity: {\n /** Created processingActivity */\n processingActivity: ProcessingActivity;\n };\n }>(client, CREATE_PROCESSING_ACTIVITY, {\n input,\n });\n return createProcessingActivity.processingActivity;\n}\n\n/**\n * Update a list of processing activities.\n *\n * @param client - GraphQL client\n * @param processingActivityIdPairs - [ProcessingActivityInput, processingActivityId] list\n */\nasync function updateProcessingActivities(\n client: GraphQLClient,\n processingActivityIdPairs: [ProcessingActivityInput, string][],\n): Promise<void> {\n const invalidProcessingActivityTitles = processingActivityIdPairs\n .filter(([, id]) => id === undefined)\n .map(([{ title }]) => title);\n if (invalidProcessingActivityTitles.length > 0) {\n // We always attempt to create processing activities before updating them, but if creation failed\n // (for example, due to insufficient scope), this provides a better error message\n throw new Error(\n `The following ${\n invalidProcessingActivityTitles.length\n } processing activities do not exist and thus can't be updated: \"${invalidProcessingActivityTitles.join(\n '\", \"',\n )}\"`,\n );\n }\n await makeGraphQLRequest(client, UPDATE_PROCESSING_ACTIVITIES, {\n input: {\n processingActivities: processingActivityIdPairs.map(\n ([\n { processingSubPurposes, dataSubCategories, saaSCategories, ...processingActivity },\n id,\n ]) => ({\n dataSubCategoryInputs: dataSubCategories?.map(({ category, name }) => ({\n category,\n name: name ?? '',\n })),\n processingPurposeSubCategoryInputs: processingSubPurposes?.map(({ purpose, name }) => ({\n purpose,\n name: name ?? 'Other',\n })),\n saaSCategoryTitles: saaSCategories,\n ...processingActivity,\n id,\n }),\n ),\n },\n });\n}\n\n/**\n * Sync the data inventory processing activities\n *\n * @param client - GraphQL client\n * @param inputs - Inputs to create\n * @returns True if run without error, returns false if an error occurred\n */\nexport async function syncProcessingActivities(\n client: GraphQLClient,\n inputs: ProcessingActivityInput[],\n): Promise<boolean> {\n let encounteredError = false;\n\n // Fetch existing\n logger.info(colors.magenta(`Syncing \"${inputs.length}\" processing activities...`));\n const existingProcessingActivities = await fetchAllProcessingActivities(client);\n\n // Look up by title\n const processingActivityByTitle: Record<string, Pick<ProcessingActivity, 'id' | 'title'>> = keyBy(\n existingProcessingActivities,\n 'title',\n );\n\n // Create new processingActivities\n const newProcessingActivities = inputs.filter((input) => !processingActivityByTitle[input.title]);\n if (newProcessingActivities.length > 0) {\n logger.info(\n colors.magenta(`Creating \"${newProcessingActivities.length}\" new processing activities...`),\n );\n }\n await mapSeries(newProcessingActivities, async (processingActivity) => {\n try {\n const newProcessingActivity = await createProcessingActivity(client, processingActivity);\n // Augment processingActivityByTitle with newly-created processing activity\n processingActivityByTitle[newProcessingActivity.title] = newProcessingActivity;\n logger.info(\n colors.green(`Successfully created processing activity \"${processingActivity.title}\"!`),\n );\n } catch (err) {\n encounteredError = true;\n logger.info(\n colors.red(\n `Failed to create processing activity \"${processingActivity.title}\"! - ${err.message}`,\n ),\n );\n }\n });\n\n // Update all processing activities\n try {\n logger.info(colors.magenta(`Updating \"${inputs.length}\" processing activities!`));\n await updateProcessingActivities(\n client,\n inputs.map((input) => [\n input,\n // This processing activity might not exist if the `create` step failed\n processingActivityByTitle[input.title]?.id,\n ]),\n );\n logger.info(colors.green(`Successfully synced \"${inputs.length}\" processingActivities!`));\n } catch (err) {\n encounteredError = true;\n logger.info(\n colors.red(`Failed to sync \"${inputs.length}\" processingActivities! - ${err.message}`),\n );\n }\n\n return !encounteredError;\n}\n","import colors from 'colors';\nimport { GraphQLClient } from 'graphql-request';\nimport { keyBy } from 'lodash-es';\n\nimport { ProcessingPurposeInput } from '../../codecs.js';\nimport { logger } from '../../logger.js';\nimport { mapSeries } from '../bluebird.js';\nimport {\n fetchAllProcessingPurposes,\n ProcessingPurposeSubCategory,\n} from './fetchAllProcessingPurposes.js';\nimport {\n UPDATE_PROCESSING_PURPOSE_SUB_CATEGORIES,\n CREATE_PROCESSING_PURPOSE_SUB_CATEGORY,\n} from './gqls/index.js';\nimport { makeGraphQLRequest } from './makeGraphQLRequest.js';\n\n/**\n * Input to create a new processing purpose\n *\n * @param client - GraphQL client\n * @param processingPurpose - Input\n * @returns Created processing purpose\n */\nexport async function createProcessingPurpose(\n client: GraphQLClient,\n processingPurpose: ProcessingPurposeInput,\n): Promise<Pick<ProcessingPurposeSubCategory, 'id' | 'name' | 'purpose'>> {\n const input = {\n name: processingPurpose.name,\n purpose: processingPurpose.purpose,\n description: processingPurpose.description,\n // TODO: https://transcend.height.app/T-31994 - add attributes, teams, owners\n };\n\n const { createProcessingPurposeSubCategory } = await makeGraphQLRequest<{\n /** Create processing purpose mutation */\n createProcessingPurposeSubCategory: {\n /** Created processing purpose */\n processingPurposeSubCategory: ProcessingPurposeSubCategory;\n };\n }>(client, CREATE_PROCESSING_PURPOSE_SUB_CATEGORY, {\n input,\n });\n return createProcessingPurposeSubCategory.processingPurposeSubCategory;\n}\n\n/**\n * Input to update processing purposes\n *\n * @param client - GraphQL client\n * @param processingPurposeIdPairs - [ProcessingPurposeInput, processingPurposeId] list\n */\nexport async function updateProcessingPurposes(\n client: GraphQLClient,\n processingPurposeIdPairs: [ProcessingPurposeInput, string][],\n): Promise<void> {\n await makeGraphQLRequest(client, UPDATE_PROCESSING_PURPOSE_SUB_CATEGORIES, {\n input: {\n processingPurposeSubCategories: processingPurposeIdPairs.map(([processingPurpose, id]) => ({\n id,\n description: processingPurpose.description,\n // TODO: https://transcend.height.app/T-31994 - add teams, owners\n attributes: processingPurpose.attributes,\n })),\n },\n });\n}\n\n/**\n * Sync the data inventory processing purposes\n *\n * @param client - GraphQL client\n * @param inputs - Inputs to create\n * @returns True if run without error, returns false if an error occurred\n */\nexport async function syncProcessingPurposes(\n client: GraphQLClient,\n inputs: ProcessingPurposeInput[],\n): Promise<boolean> {\n // Fetch existing\n logger.info(colors.magenta(`Syncing \"${inputs.length}\" processing purposes...`));\n\n let encounteredError = false;\n\n // Fetch existing\n const existingProcessingPurposes = await fetchAllProcessingPurposes(client);\n\n // Look up by name\n const processingPurposeByName: {\n [k in string]: Pick<ProcessingPurposeSubCategory, 'id' | 'name'>;\n } = keyBy(existingProcessingPurposes, ({ name, purpose }) => `${name}:${purpose}`);\n\n // Create new processing purposes\n const newProcessingPurposes = inputs.filter(\n (input) => !processingPurposeByName[`${input.name}:${input.purpose}`],\n );\n\n // Create new processing purposes\n await mapSeries(newProcessingPurposes, async (processingPurpose) => {\n try {\n const newProcessingPurpose = await createProcessingPurpose(client, processingPurpose);\n processingPurposeByName[`${newProcessingPurpose.name}:${newProcessingPurpose.purpose}`] =\n newProcessingPurpose;\n logger.info(\n colors.green(`Successfully synced processing purpose \"${processingPurpose.name}\"!`),\n );\n } catch (err) {\n encounteredError = true;\n logger.info(\n colors.red(\n `Failed to sync processing purpose \"${processingPurpose.name}\"! - ${err.message}`,\n ),\n );\n }\n });\n\n // Update all processing purposes\n try {\n logger.info(colors.magenta(`Updating \"${inputs.length}\" processing purposes!`));\n await updateProcessingPurposes(\n client,\n inputs.map((input) => [input, processingPurposeByName[`${input.name}:${input.purpose}`].id]),\n );\n logger.info(colors.green(`Successfully synced \"${inputs.length}\" processing purposes!`));\n } catch (err) {\n encounteredError = true;\n logger.info(\n colors.red(`Failed to sync \"${inputs.length}\" processing purposes ! - ${err.message}`),\n );\n }\n\n return !encounteredError;\n}\n","import colors from 'colors';\nimport { GraphQLClient } from 'graphql-request';\nimport { keyBy } from 'lodash-es';\n\nimport { PromptInput } from '../../codecs.js';\nimport { logger } from '../../logger.js';\nimport { map } from '../bluebird.js';\nimport { fetchAllPrompts } from './fetchPrompts.js';\nimport { UPDATE_PROMPTS, CREATE_PROMPT } from './gqls/index.js';\nimport { makeGraphQLRequest } from './makeGraphQLRequest.js';\n\n/**\n * Create a new prompt\n *\n * @param client - GraphQL client\n * @param input - Prompt input\n * @returns Prompt ID\n */\nexport async function createPrompt(\n client: GraphQLClient,\n input: {\n /** Title of prompt */\n title: string;\n /** Prompt content */\n content: string;\n },\n): Promise<string> {\n const {\n createPrompt: { prompt },\n } = await makeGraphQLRequest<{\n /** createPrompt mutation */\n createPrompt: {\n /** Prompt */\n prompt: {\n /** ID */\n id: string;\n };\n };\n }>(client, CREATE_PROMPT, {\n // TODO: https://transcend.height.app/T-31994 - include models and groups, teams, users\n input,\n });\n logger.info(colors.green(`Successfully created prompt \"${input.title}\"!`));\n return prompt.id;\n}\n\n/**\n * Update a set of existing prompts\n *\n * @param client - GraphQL client\n * @param input - Prompt input\n */\nexport async function updatePrompts(\n client: GraphQLClient,\n input: [PromptInput, string][],\n): Promise<void> {\n await makeGraphQLRequest(client, UPDATE_PROMPTS, {\n input: {\n prompts: input.map(([input, id]) => ({\n ...input,\n id,\n })),\n },\n });\n logger.info(colors.green(`Successfully updated ${input.length} prompts!`));\n}\n\n/**\n * Sync the prompts\n *\n * @param client - GraphQL client\n * @param prompts - Prompts\n * @param concurrency - Concurrency\n * @returns True if synced successfully\n */\nexport async function syncPrompts(\n client: GraphQLClient,\n prompts: PromptInput[],\n concurrency = 20,\n): Promise<boolean> {\n let encounteredError = false;\n logger.info(colors.magenta(`Syncing \"${prompts.length}\" prompts...`));\n\n // Index existing prompts\n const existing = await fetchAllPrompts(client);\n const promptByTitle = keyBy(existing, 'title');\n\n // Determine which prompts are new vs existing\n const mapPromptsToExisting = prompts.map((promptInput) => [\n promptInput,\n promptByTitle[promptInput.title]?.id,\n ]);\n\n // Create the new prompts\n const newPrompts = mapPromptsToExisting\n .filter(([, existing]) => !existing)\n .map(([promptInput]) => promptInput as PromptInput);\n try {\n logger.info(colors.magenta(`Creating \"${newPrompts.length}\" new prompts...`));\n await map(\n newPrompts,\n async (prompt) => {\n await createPrompt(client, prompt);\n },\n {\n concurrency,\n },\n );\n logger.info(colors.green(`Successfully synced ${newPrompts.length} prompts!`));\n } catch (err) {\n encounteredError = true;\n logger.info(colors.red(`Failed to create prompts! - ${err.message}`));\n }\n\n // Update existing prompts\n const existingPrompts = mapPromptsToExisting.filter((x): x is [PromptInput, string] => !!x[1]);\n try {\n logger.info(colors.magenta(`Updating \"${existingPrompts.length}\" prompts...`));\n await updatePrompts(client, existingPrompts);\n logger.info(colors.green(`Successfully updated \"${existingPrompts.length}\" prompts!`));\n } catch (err) {\n encounteredError = true;\n logger.info(colors.red(`Failed to create prompts! - ${err.message}`));\n }\n\n logger.info(colors.green(`Synced \"${prompts.length}\" prompts!`));\n\n // Return true upon success\n return !encounteredError;\n}\n","import colors from 'colors';\nimport { GraphQLClient } from 'graphql-request';\nimport { keyBy } from 'lodash-es';\n\nimport { VendorInput } from '../../codecs.js';\nimport { logger } from '../../logger.js';\nimport { mapSeries } from '../bluebird.js';\nimport { fetchAllVendors, Vendor } from './fetchAllVendors.js';\nimport { UPDATE_VENDORS, CREATE_VENDOR } from './gqls/index.js';\nimport { makeGraphQLRequest } from './makeGraphQLRequest.js';\n\n/**\n * Input to create a new vendor\n *\n * @param client - GraphQL client\n * @param vendor - Input\n * @returns Created vendor\n */\nexport async function createVendor(\n client: GraphQLClient,\n vendor: VendorInput,\n): Promise<Pick<Vendor, 'id' | 'title'>> {\n const input = {\n title: vendor.title,\n description: vendor.description,\n address: vendor.address,\n headquarterCountry: vendor.headquarterCountry,\n headquarterSubDivision: vendor.headquarterSubDivision,\n dataProcessingAgreementLink: vendor.dataProcessingAgreementLink,\n contactName: vendor.contactName,\n contactPhone: vendor.contactPhone,\n websiteUrl: vendor.websiteUrl,\n // TODO: https://transcend.height.app/T-31994 - add attributes, teams, owners\n };\n\n const { createVendor } = await makeGraphQLRequest<{\n /** Create vendor mutation */\n createVendor: {\n /** Created vendor */\n vendor: Vendor;\n };\n }>(client, CREATE_VENDOR, {\n input,\n });\n return createVendor.vendor;\n}\n\n/**\n * Input to update vendors\n *\n * @param client - GraphQL client\n * @param vendorIdParis - [VendorInput, vendorId] list\n */\nexport async function updateVendors(\n client: GraphQLClient,\n vendorIdParis: [VendorInput, string][],\n): Promise<void> {\n await makeGraphQLRequest(client, UPDATE_VENDORS, {\n input: {\n vendors: vendorIdParis.map(([vendor, id]) => ({\n id,\n title: vendor.title,\n description: vendor.description,\n address: vendor.address,\n headquarterCountry: vendor.headquarterCountry,\n headquarterSubDivision: vendor.headquarterSubDivision,\n dataProcessingAgreementLink: vendor.dataProcessingAgreementLink,\n contactName: vendor.contactName,\n contactPhone: vendor.contactPhone,\n websiteUrl: vendor.websiteUrl,\n // TODO: https://transcend.height.app/T-31994 - add teams, owners\n attributes: vendor.attributes,\n })),\n },\n });\n}\n\n/**\n * Sync the data inventory vendors\n *\n * @param client - GraphQL client\n * @param inputs - Inputs to create\n * @returns True if run without error, returns false if an error occurred\n */\nexport async function syncVendors(client: GraphQLClient, inputs: VendorInput[]): Promise<boolean> {\n // Fetch existing\n logger.info(colors.magenta(`Syncing \"${inputs.length}\" vendors...`));\n\n let encounteredError = false;\n\n // Fetch existing\n const existingVendors = await fetchAllVendors(client);\n\n // Look up by title\n const vendorByTitle: { [k in string]: Pick<Vendor, 'id' | 'title'> } = keyBy(\n existingVendors,\n 'title',\n );\n\n // Create new vendors\n const newVendors = inputs.filter((input) => !vendorByTitle[input.title]);\n\n // Create new vendors\n await mapSeries(newVendors, async (vendor) => {\n try {\n const newVendor = await createVendor(client, vendor);\n vendorByTitle[newVendor.title] = newVendor;\n logger.info(colors.green(`Successfully synced vendor \"${vendor.title}\"!`));\n } catch (err) {\n encounteredError = true;\n logger.info(colors.red(`Failed to sync vendor \"${vendor.title}\"! - ${err.message}`));\n }\n });\n\n // Update all vendors\n try {\n logger.info(colors.magenta(`Updating \"${inputs.length}\" vendors!`));\n await updateVendors(\n client,\n inputs.map((input) => [input, vendorByTitle[input.title].id]),\n );\n logger.info(colors.green(`Successfully synced \"${inputs.length}\" vendors!`));\n } catch (err) {\n encounteredError = true;\n logger.info(colors.red(`Failed to sync \"${inputs.length}\" vendors ! - ${err.message}`));\n }\n\n return !encounteredError;\n}\n","/**\n * Parse variables from string\n *\n * @param variables - Variables as string\n * @returns Variables as object\n */\nexport function parseVariablesFromString(variables: string): {\n [k in string]: string;\n} {\n // Parse out the variables\n const splitVars = variables.split(',').filter((x) => !!x);\n const vars: { [k in string]: string } = {};\n splitVars.forEach((variable) => {\n const [k, v] = variable.split(':');\n if (!k || !v) {\n throw new Error(`Invalid variable: ${variable}. Expected format: key:value`);\n }\n vars[k] = v;\n });\n return vars;\n}\n","import colors from 'colors';\nimport { GraphQLClient } from 'graphql-request';\nimport { keyBy } from 'lodash-es';\n\nimport { PromptGroupInput } from '../../codecs.js';\nimport { logger } from '../../logger.js';\nimport { map } from '../bluebird.js';\nimport { fetchAllPromptGroups } from './fetchPromptGroups.js';\nimport { fetchAllPrompts } from './fetchPrompts.js';\nimport { UPDATE_PROMPT_GROUPS, CREATE_PROMPT_GROUP } from './gqls/index.js';\nimport { makeGraphQLRequest } from './makeGraphQLRequest.js';\n\nexport interface EditPromptGroupInput {\n /** Title of prompt group */\n title: string;\n /** Prompt group description */\n description: string;\n /** Prompt IDs */\n promptIds: string[];\n}\n\n/**\n * Create a new prompt group\n *\n * @param client - GraphQL client\n * @param input - Prompt input\n * @returns Prompt group ID\n */\nexport async function createPromptGroup(\n client: GraphQLClient,\n input: EditPromptGroupInput,\n): Promise<string> {\n const {\n createPromptGroup: { promptGroup },\n } = await makeGraphQLRequest<{\n /** createPromptGroup mutation */\n createPromptGroup: {\n /** Prompt group */\n promptGroup: {\n /** ID */\n id: string;\n };\n };\n }>(client, CREATE_PROMPT_GROUP, {\n input,\n });\n logger.info(colors.green(`Successfully created prompt group \"${input.title}\"!`));\n return promptGroup.id;\n}\n\n/**\n * Update a set of existing prompt groups\n *\n * @param client - GraphQL client\n * @param input - Prompt input\n */\nexport async function updatePromptGroups(\n client: GraphQLClient,\n input: [EditPromptGroupInput, string][],\n): Promise<void> {\n await makeGraphQLRequest(client, UPDATE_PROMPT_GROUPS, {\n input: {\n promptGroups: input.map(([input, id]) => ({\n ...input,\n id,\n })),\n },\n });\n logger.info(colors.green(`Successfully updated ${input.length} prompt groups!`));\n}\n\n/**\n * Sync the prompt groups\n *\n * @param client - GraphQL client\n * @param promptGroups - PromptGroups\n * @param concurrency - Concurrency\n * @returns True if synced successfully\n */\nexport async function syncPromptGroups(\n client: GraphQLClient,\n promptGroups: PromptGroupInput[],\n concurrency = 20,\n): Promise<boolean> {\n let encounteredError = false;\n logger.info(colors.magenta(`Syncing \"${promptGroups.length}\" prompt groups...`));\n\n // Index existing prompt groups\n const existing = await fetchAllPromptGroups(client);\n const existingPrompts = await fetchAllPrompts(client);\n const promptByTitle = keyBy(existingPrompts, 'title');\n const promptGroupByTitle = keyBy(existing, 'title');\n\n // Determine which promptGroups are new vs existing\n const mapPromptGroupsToExisting = promptGroups.map((promptInput) => [\n promptInput,\n promptGroupByTitle[promptInput.title]?.id,\n ]);\n\n // Create the new promptGroups\n const newPromptGroups = mapPromptGroupsToExisting\n .filter(([, existing]) => !existing)\n .map(([promptInput]) => promptInput as PromptGroupInput);\n try {\n logger.info(colors.magenta(`Creating \"${newPromptGroups.length}\" new prompt groups...`));\n await map(\n newPromptGroups,\n async (prompt) => {\n await createPromptGroup(client, {\n ...prompt,\n promptIds: prompt.prompts.map((title) => {\n const prompt = promptByTitle[title];\n if (!prompt) {\n throw new Error(`Failed to find prompt with title: \"${title}\"`);\n }\n return prompt.id;\n }),\n });\n },\n {\n concurrency,\n },\n );\n logger.info(colors.green(`Successfully synced ${newPromptGroups.length} prompt groups!`));\n } catch (err) {\n encounteredError = true;\n logger.info(colors.red(`Failed to create prompt groups! - ${err.message}`));\n }\n\n // Update existing promptGroups\n const existingPromptGroups = mapPromptGroupsToExisting.filter(\n (x): x is [PromptGroupInput, string] => !!x[1],\n );\n try {\n logger.info(colors.magenta(`Updating \"${existingPromptGroups.length}\" prompt groups...`));\n await updatePromptGroups(\n client,\n existingPromptGroups.map(([{ prompts, ...input }, id]) => [\n {\n ...input,\n promptIds: prompts.map((title) => {\n const prompt = promptByTitle[title];\n if (!prompt) {\n throw new Error(`Failed to find prompt with title: \"${title}\"`);\n }\n return prompt.id;\n }),\n },\n id,\n ]),\n );\n logger.info(\n colors.green(`Successfully updated \"${existingPromptGroups.length}\" prompt groups!`),\n );\n } catch (err) {\n encounteredError = true;\n logger.info(colors.red(`Failed to create prompt groups! - ${err.message}`));\n }\n\n logger.info(colors.green(`Synced \"${promptGroups.length}\" prompt groups!`));\n\n // Return true upon success\n return !encounteredError;\n}\n","import colors from 'colors';\nimport { GraphQLClient } from 'graphql-request';\nimport { keyBy } from 'lodash-es';\n\nimport { PromptPartialInput } from '../../codecs.js';\nimport { logger } from '../../logger.js';\nimport { map } from '../bluebird.js';\nimport { fetchAllPromptPartials } from './fetchPromptPartials.js';\nimport { UPDATE_PROMPT_PARTIALS, CREATE_PROMPT_PARTIAL } from './gqls/index.js';\nimport { makeGraphQLRequest } from './makeGraphQLRequest.js';\n\n/**\n * Create a new prompt partial\n *\n * @param client - GraphQL client\n * @param input - Prompt input\n * @returns Prompt partial ID\n */\nexport async function createPromptPartial(\n client: GraphQLClient,\n input: {\n /** Title of prompt partial */\n title: string;\n /** Prompt content */\n content: string;\n },\n): Promise<string> {\n const {\n createPromptPartial: { promptPartial },\n } = await makeGraphQLRequest<{\n /** createPromptPartial mutation */\n createPromptPartial: {\n /** Prompt partial */\n promptPartial: {\n /** ID */\n id: string;\n };\n };\n }>(client, CREATE_PROMPT_PARTIAL, {\n input,\n });\n logger.info(colors.green(`Successfully created prompt partial \"${input.title}\"!`));\n return promptPartial.id;\n}\n\n/**\n * Update a set of existing prompt partials\n *\n * @param client - GraphQL client\n * @param input - Prompt input\n */\nexport async function updatePromptPartials(\n client: GraphQLClient,\n input: [PromptPartialInput, string][],\n): Promise<void> {\n await makeGraphQLRequest(client, UPDATE_PROMPT_PARTIALS, {\n input: {\n promptPartials: input.map(([input, id]) => ({\n ...input,\n id,\n })),\n },\n });\n logger.info(colors.green(`Successfully updated ${input.length} prompt partials!`));\n}\n\n/**\n * Sync the prompt partials\n *\n * @param client - GraphQL client\n * @param promptPartials - PromptPartials\n * @param concurrency - Concurrency\n * @returns True if synced successfully\n */\nexport async function syncPromptPartials(\n client: GraphQLClient,\n promptPartials: PromptPartialInput[],\n concurrency = 20,\n): Promise<boolean> {\n let encounteredError = false;\n logger.info(colors.magenta(`Syncing \"${promptPartials.length}\" prompt partials...`));\n\n // Index existing prompt partials\n const existing = await fetchAllPromptPartials(client);\n const promptPartialByTitle = keyBy(existing, 'title');\n\n // Determine which promptPartials are new vs existing\n const mapPromptPartialsToExisting = promptPartials.map((promptInput) => [\n promptInput,\n promptPartialByTitle[promptInput.title]?.id,\n ]);\n\n // Create the new promptPartials\n const newPromptPartials = mapPromptPartialsToExisting\n .filter(([, existing]) => !existing)\n .map(([promptInput]) => promptInput as PromptPartialInput);\n try {\n logger.info(colors.magenta(`Creating \"${newPromptPartials.length}\" new prompt partials...`));\n await map(\n newPromptPartials,\n async (prompt) => {\n await createPromptPartial(client, prompt);\n },\n {\n concurrency,\n },\n );\n logger.info(colors.green(`Successfully synced ${newPromptPartials.length} prompt partials!`));\n } catch (err) {\n encounteredError = true;\n logger.info(colors.red(`Failed to create prompt partials! - ${err.message}`));\n }\n\n // Update existing promptPartials\n const existingPromptPartials = mapPromptPartialsToExisting.filter(\n (x): x is [PromptPartialInput, string] => !!x[1],\n );\n try {\n logger.info(colors.magenta(`Updating \"${existingPromptPartials.length}\" prompt partials...`));\n await updatePromptPartials(client, existingPromptPartials);\n logger.info(\n colors.green(`Successfully updated \"${existingPromptPartials.length}\" prompt partials!`),\n );\n } catch (err) {\n encounteredError = true;\n logger.info(colors.red(`Failed to create prompt partials! - ${err.message}`));\n }\n\n logger.info(colors.green(`Synced \"${promptPartials.length}\" prompt partials!`));\n\n // Return true upon success\n return !encounteredError;\n}\n","import colors from 'colors';\nimport { GraphQLClient } from 'graphql-request';\nimport { keyBy } from 'lodash-es';\n\nimport { TeamInput } from '../../codecs.js';\nimport { logger } from '../../logger.js';\nimport { mapSeries } from '../bluebird.js';\nimport { fetchAllTeams, Team } from './fetchAllTeams.js';\nimport { UPDATE_TEAM, CREATE_TEAM } from './gqls/index.js';\nimport { makeGraphQLRequest } from './makeGraphQLRequest.js';\n\n/**\n * Input to create a new team\n *\n * @param client - GraphQL client\n * @param team - Input\n * @returns Created team\n */\nexport async function createTeam(\n client: GraphQLClient,\n team: TeamInput,\n): Promise<Pick<Team, 'id' | 'name'>> {\n const input = {\n name: team.name,\n description: team.description,\n ssoTitle: team['sso-title'],\n ssoDepartment: team['sso-department'],\n ssoGroup: team['sso-group'],\n scopes: team.scopes,\n userEmails: team.users,\n };\n\n const { createTeam } = await makeGraphQLRequest<{\n /** Create team mutation */\n createTeam: {\n /** Created team */\n team: Team;\n };\n }>(client, CREATE_TEAM, {\n input,\n });\n return createTeam.team;\n}\n\n/**\n * Input to update teams\n *\n * @param client - GraphQL client\n * @param input - Team input to update\n * @param teamId - ID of team\n * @returns Updated team\n */\nexport async function updateTeam(\n client: GraphQLClient,\n input: TeamInput,\n teamId: string,\n): Promise<Pick<Team, 'id' | 'name'>> {\n const { updateTeam } = await makeGraphQLRequest<{\n /** Update team mutation */\n updateTeam: {\n /** Updated team */\n team: Team;\n };\n }>(client, UPDATE_TEAM, {\n input: {\n id: teamId,\n name: input.name,\n description: input.description,\n ssoTitle: input['sso-title'],\n ssoDepartment: input['sso-department'],\n ssoGroup: input['sso-group'],\n scopes: input.scopes,\n userEmails: input.users,\n },\n });\n return updateTeam.team;\n}\n\n/**\n * Sync the teams\n *\n * @param client - GraphQL client\n * @param inputs - Inputs to create\n * @returns True if run without error, returns false if an error occurred\n */\nexport async function syncTeams(client: GraphQLClient, inputs: TeamInput[]): Promise<boolean> {\n // Fetch existing\n logger.info(colors.magenta(`Syncing \"${inputs.length}\" teams...`));\n\n let encounteredError = false;\n\n // Fetch existing\n const existingTeams = await fetchAllTeams(client);\n\n // Look up by name\n const teamsByName: { [k in string]: Pick<Team, 'id' | 'name'> } = keyBy(existingTeams, 'name');\n\n // Create new teams\n const newTeams = inputs.filter((input) => !teamsByName[input.name]);\n const updatedTeams = inputs.filter((input) => !!teamsByName[input.name]);\n\n // Create new teams\n await mapSeries(newTeams, async (team) => {\n try {\n const newTeam = await createTeam(client, team);\n teamsByName[newTeam.name] = newTeam;\n logger.info(colors.green(`Successfully created team \"${team.name}\"!`));\n } catch (err) {\n encounteredError = true;\n logger.info(colors.red(`Failed to sync team \"${team.name}\"! - ${err.message}`));\n }\n });\n\n // Update all teams\n await mapSeries(updatedTeams, async (input) => {\n try {\n const newTeam = await updateTeam(client, input, teamsByName[input.name].id);\n teamsByName[newTeam.name] = newTeam;\n logger.info(colors.green(`Successfully updated team \"${input.name}\"!`));\n } catch (err) {\n encounteredError = true;\n logger.info(colors.red(`Failed to sync team \"${input.name}\"! - ${err.message}`));\n }\n });\n\n return !encounteredError;\n}\n","import colors from 'colors';\nimport { GraphQLClient } from 'graphql-request';\n\n/* eslint-disable max-lines */\nimport { TranscendInput } from '../../codecs.js';\nimport { logger } from '../../logger.js';\nimport { map } from '../bluebird.js';\nimport { fetchAllActions } from './fetchAllActions.js';\nimport { fetchAllAttributes } from './fetchAllAttributes.js';\nimport { fetchApiKeys } from './fetchApiKeys.js';\nimport { fetchAllDataSubjects, ensureAllDataSubjectsExist } from './fetchDataSubjects.js';\nimport { fetchIdentifiersAndCreateMissing, Identifier } from './fetchIdentifiers.js';\nimport { syncAction } from './syncAction.js';\nimport { syncActionItemCollections } from './syncActionItemCollections.js';\nimport { syncActionItems } from './syncActionItems.js';\nimport { syncAgentFiles } from './syncAgentFiles.js';\nimport { syncAgentFunctions } from './syncAgentFunctions.js';\nimport { syncAgents } from './syncAgents.js';\nimport { syncAttribute } from './syncAttribute.js';\nimport { syncBusinessEntities } from './syncBusinessEntities.js';\nimport { syncConsentManager } from './syncConsentManager.js';\nimport { syncCookies } from './syncCookies.js';\nimport { syncDataCategories } from './syncDataCategories.js';\nimport { syncDataFlows } from './syncDataFlows.js';\nimport { syncDataSiloDependencies, syncDataSilos } from './syncDataSilos.js';\nimport { syncDataSubject } from './syncDataSubject.js';\nimport { syncEnricher } from './syncEnrichers.js';\nimport { syncIdentifier } from './syncIdentifier.js';\nimport { syncIntlMessages } from './syncIntlMessages.js';\nimport { syncPartitions } from './syncPartitions.js';\nimport { syncPolicies } from './syncPolicies.js';\nimport { syncPrivacyCenter } from './syncPrivacyCenter.js';\nimport { syncProcessingActivities } from './syncProcessingActivities.js';\nimport { syncProcessingPurposes } from './syncProcessingPurposes.js';\nimport { syncPromptGroups } from './syncPromptGroups.js';\nimport { syncPromptPartials } from './syncPromptPartials.js';\nimport { syncPrompts } from './syncPrompts.js';\nimport { syncTeams } from './syncTeams.js';\nimport { syncTemplate } from './syncTemplates.js';\nimport { syncVendors } from './syncVendors.js';\n\nconst CONCURRENCY = 10;\n\n/**\n * Sync the yaml input back to Transcend using the GraphQL APIs\n *\n * @param input - The yml input\n * @param client - GraphQL client\n * @param pageSize - Page size\n * @returns True if an error was encountered\n */\nexport async function syncConfigurationToTranscend(\n input: TranscendInput,\n client: GraphQLClient,\n {\n pageSize = 50,\n // TODO: https://transcend.height.app/T-23779\n publishToPrivacyCenter = true,\n classifyService = false,\n deleteExtraAttributeValues = false,\n }: {\n /** Page size */\n pageSize?: number;\n /** When true, skip publishing to privacy center */\n publishToPrivacyCenter?: boolean;\n /** When true, delete any attributes being synced up */\n deleteExtraAttributeValues?: boolean;\n /** classify data flow service if missing */\n classifyService?: boolean;\n },\n): Promise<boolean> {\n let encounteredError = false;\n\n logger.info(colors.magenta(`Fetching data with page size ${pageSize}...`));\n\n const {\n templates,\n attributes,\n actions,\n identifiers,\n 'data-subjects': dataSubjects,\n 'business-entities': businessEntities,\n enrichers,\n cookies,\n 'consent-manager': consentManager,\n 'data-silos': dataSilos,\n 'data-flows': dataFlows,\n prompts,\n 'prompt-groups': promptGroups,\n 'prompt-partials': promptPartials,\n agents,\n 'agent-functions': agentFunctions,\n 'agent-files': agentFiles,\n vendors,\n 'data-categories': dataCategories,\n 'processing-activities': processingActivities,\n 'processing-purposes': processingPurposes,\n 'action-items': actionItems,\n 'action-item-collections': actionItemCollections,\n teams,\n 'privacy-center': privacyCenter,\n messages,\n policies,\n partitions,\n } = input;\n\n const [identifierByName, dataSubjectsByName, apiKeyTitleMap] = await Promise.all([\n // Ensure all identifiers are created and create a map from name -> identifier.id\n enrichers || identifiers\n ? fetchIdentifiersAndCreateMissing(input, client, !publishToPrivacyCenter)\n : ({} as { [k in string]: Identifier }),\n // Grab all data subjects in the organization\n dataSilos || dataSubjects || enrichers || processingActivities\n ? ensureAllDataSubjectsExist(input, client)\n : {},\n // Grab API keys\n dataSilos &&\n dataSilos\n .map((dataSilo) => dataSilo['api-key-title'] || [])\n .reduce((acc, lst) => acc + lst.length, 0) > 0\n ? fetchApiKeys(input, client)\n : {},\n ]);\n\n // Sync consent manager\n if (consentManager) {\n logger.info(colors.magenta('Syncing consent manager...'));\n try {\n await syncConsentManager(client, consentManager);\n logger.info(colors.green('Successfully synced consent manager!'));\n } catch (err) {\n encounteredError = true;\n logger.info(colors.red(`Failed to sync consent manager! - ${err.message}`));\n }\n }\n\n // Sync prompts\n if (prompts) {\n const promptsSuccess = await syncPrompts(client, prompts);\n encounteredError = encounteredError || !promptsSuccess;\n }\n if (promptPartials) {\n const promptsSuccess = await syncPromptPartials(client, promptPartials);\n encounteredError = encounteredError || !promptsSuccess;\n }\n if (promptGroups) {\n const promptsSuccess = await syncPromptGroups(client, promptGroups);\n encounteredError = encounteredError || !promptsSuccess;\n }\n\n if (teams) {\n const teamsSuccess = await syncTeams(client, teams);\n encounteredError = encounteredError || !teamsSuccess;\n }\n\n // Sync email templates\n if (templates) {\n logger.info(colors.magenta(`Syncing \"${templates.length}\" email templates...`));\n await map(\n templates,\n async (template) => {\n logger.info(colors.magenta(`Syncing template \"${template.title}\"...`));\n try {\n await syncTemplate(template, client);\n logger.info(colors.green(`Successfully synced template \"${template.title}\"!`));\n } catch (err) {\n encounteredError = true;\n logger.info(colors.red(`Failed to sync template \"${template.title}\"! - ${err.message}`));\n }\n },\n {\n concurrency: CONCURRENCY,\n },\n );\n logger.info(colors.green(`Synced \"${templates.length}\" email templates!`));\n }\n\n // Sync business entities\n if (businessEntities) {\n const businessEntitySuccess = await syncBusinessEntities(client, businessEntities);\n encounteredError = encounteredError || !businessEntitySuccess;\n }\n\n // Sync vendors\n if (vendors) {\n const vendorsSuccess = await syncVendors(client, vendors);\n encounteredError = encounteredError || !vendorsSuccess;\n }\n\n // Sync data categories\n if (dataCategories) {\n const dataCategoriesSuccess = await syncDataCategories(client, dataCategories);\n encounteredError = encounteredError || !dataCategoriesSuccess;\n }\n\n // Sync processing purposes\n if (processingPurposes) {\n const processingPurposesSuccess = await syncProcessingPurposes(client, processingPurposes);\n encounteredError = encounteredError || !processingPurposesSuccess;\n }\n\n // Sync partitions\n if (partitions) {\n const partitionsSuccess = await syncPartitions(client, partitions);\n encounteredError = encounteredError || !partitionsSuccess;\n }\n\n // Sync agents\n if (agents) {\n const agentsSuccess = await syncAgents(client, agents);\n encounteredError = encounteredError || !agentsSuccess;\n }\n\n // Sync agent functions\n if (agentFunctions) {\n const agentFunctionsSuccess = await syncAgentFunctions(client, agentFunctions);\n encounteredError = encounteredError || !agentFunctionsSuccess;\n }\n\n // Sync agent files\n if (agentFiles) {\n const agentFilesSuccess = await syncAgentFiles(client, agentFiles);\n encounteredError = encounteredError || !agentFilesSuccess;\n }\n\n // Sync cookies\n if (cookies) {\n const cookiesSuccess = await syncCookies(client, cookies);\n encounteredError = encounteredError || !cookiesSuccess;\n }\n\n // Sync action item collections\n if (actionItemCollections) {\n const actionItemCollectionsSuccess = await syncActionItemCollections(\n client,\n actionItemCollections,\n );\n encounteredError = encounteredError || !actionItemCollectionsSuccess;\n }\n\n // Sync attributes\n if (attributes) {\n // Fetch existing\n logger.info(colors.magenta(`Syncing \"${attributes.length}\" attributes...`));\n const existingAttributes = await fetchAllAttributes(client);\n await map(\n attributes,\n async (attribute) => {\n const existing = existingAttributes.find((attr) => attr.name === attribute.name);\n\n logger.info(colors.magenta(`Syncing attribute \"${attribute.name}\"...`));\n try {\n await syncAttribute(client, attribute, {\n existingAttribute: existing,\n deleteExtraAttributeValues,\n });\n logger.info(colors.green(`Successfully synced attribute \"${attribute.name}\"!`));\n } catch (err) {\n encounteredError = true;\n logger.info(colors.red(`Failed to sync attribute \"${attribute.name}\"! - ${err.message}`));\n }\n },\n {\n concurrency: CONCURRENCY,\n },\n );\n logger.info(colors.green(`Synced \"${attributes.length}\" attributes!`));\n }\n\n // Sync action items\n if (actionItems) {\n const actionItemsSuccess = await syncActionItems(client, actionItems);\n encounteredError = encounteredError || !actionItemsSuccess;\n }\n\n // Sync enrichers\n if (enrichers) {\n logger.info(colors.magenta(`Syncing \"${enrichers.length}\" enrichers...`));\n await map(\n enrichers,\n async (enricher) => {\n logger.info(colors.magenta(`Syncing enricher \"${enricher.title}\"...`));\n try {\n await syncEnricher(client, {\n enricher,\n identifierByName,\n dataSubjectsByName,\n });\n logger.info(colors.green(`Successfully synced enricher \"${enricher.title}\"!`));\n } catch (err) {\n encounteredError = true;\n logger.info(colors.red(`Failed to sync enricher \"${enricher.title}\"! - ${err.message}`));\n }\n },\n {\n concurrency: CONCURRENCY,\n },\n );\n logger.info(colors.green(`Synced \"${enrichers.length}\" enrichers!`));\n }\n\n // Sync identifiers\n if (identifiers) {\n // Fetch existing\n logger.info(colors.magenta(`Syncing \"${identifiers.length}\" identifiers...`));\n await map(\n identifiers,\n async (identifier) => {\n const existing = identifierByName[identifier.name];\n if (!existing) {\n throw new Error(\n `Failed to find identifier with name: ${identifier.type}. Should have been auto-created by cli.`,\n );\n }\n\n logger.info(colors.magenta(`Syncing identifier \"${identifier.type}\"...`));\n try {\n await syncIdentifier(client, {\n identifier,\n dataSubjectsByName,\n identifierId: existing.id,\n skipPublish: !publishToPrivacyCenter,\n });\n logger.info(colors.green(`Successfully synced identifier \"${identifier.type}\"!`));\n } catch (err) {\n encounteredError = true;\n logger.info(\n colors.red(`Failed to sync identifier \"${identifier.type}\"! - ${err.message}`),\n );\n }\n },\n {\n concurrency: CONCURRENCY,\n },\n );\n logger.info(colors.green(`Synced \"${identifiers.length}\" identifiers!`));\n }\n\n // Sync actions\n if (actions) {\n // Fetch existing\n logger.info(colors.magenta(`Syncing \"${actions.length}\" actions...`));\n const existingActions = await fetchAllActions(client);\n await map(\n actions,\n async (action) => {\n const existing = existingActions.find((act) => act.type === action.type);\n if (!existing) {\n throw new Error(\n `Failed to find action with type: ${action.type}. Should have already existing in the organization.`,\n );\n }\n\n logger.info(colors.magenta(`Syncing action \"${action.type}\"...`));\n try {\n await syncAction(client, {\n action,\n actionId: existing.id,\n skipPublish: !publishToPrivacyCenter,\n });\n logger.info(colors.green(`Successfully synced action \"${action.type}\"!`));\n } catch (err) {\n encounteredError = true;\n logger.info(colors.red(`Failed to sync action \"${action.type}\"! - ${err.message}`));\n }\n },\n {\n concurrency: CONCURRENCY,\n },\n );\n logger.info(colors.green(`Synced \"${actions.length}\" actions!`));\n }\n\n // Sync data subjects\n if (dataSubjects) {\n // Fetch existing\n logger.info(colors.magenta(`Syncing \"${dataSubjects.length}\" data subjects...`));\n const existingDataSubjects = await fetchAllDataSubjects(client);\n await map(\n dataSubjects,\n async (dataSubject) => {\n const existing = existingDataSubjects.find((subj) => subj.type === dataSubject.type);\n if (!existing) {\n throw new Error(\n `Failed to find data subject with type: ${dataSubject.type}. Should have already existing in the organization.`,\n );\n }\n\n logger.info(colors.magenta(`Syncing data subject \"${dataSubject.type}\"...`));\n try {\n await syncDataSubject(client, {\n dataSubject,\n dataSubjectId: existing.id,\n skipPublish: !publishToPrivacyCenter,\n });\n logger.info(colors.green(`Successfully synced data subject \"${dataSubject.type}\"!`));\n } catch (err) {\n encounteredError = true;\n logger.info(\n colors.red(`Failed to sync data subject \"${dataSubject.type}\"! - ${err.message}`),\n );\n }\n },\n {\n concurrency: CONCURRENCY,\n },\n );\n logger.info(colors.green(`Synced \"${dataSubjects.length}\" data subjects!`));\n }\n\n // Sync data flows\n if (dataFlows) {\n const syncedDataFlows = await syncDataFlows(client, dataFlows, classifyService);\n encounteredError = encounteredError || !syncedDataFlows;\n }\n\n // Sync privacy center\n if (privacyCenter) {\n const privacyCenterSuccess = await syncPrivacyCenter(client, privacyCenter);\n encounteredError = encounteredError || !privacyCenterSuccess;\n }\n\n // Sync messages\n if (messages) {\n const messagesSuccess = await syncIntlMessages(client, messages);\n encounteredError = encounteredError || !messagesSuccess;\n }\n\n // Sync policies\n if (policies) {\n const policiesSuccess = await syncPolicies(client, policies);\n encounteredError = encounteredError || !policiesSuccess;\n }\n\n // Store dependency updates\n const dependencyUpdates: [string, string[]][] = [];\n // Sync data silos\n if (dataSilos) {\n const { success, dataSiloTitleToId } = await syncDataSilos(dataSilos, client, {\n dataSubjectsByName,\n apiKeysByTitle: apiKeyTitleMap,\n pageSize,\n });\n dataSilos?.forEach((dataSilo) => {\n // Queue up dependency update\n if (dataSilo['deletion-dependencies']) {\n dependencyUpdates.push([\n dataSiloTitleToId[dataSilo.title],\n dataSilo['deletion-dependencies'],\n ]);\n }\n });\n encounteredError = encounteredError || !success;\n }\n\n // Dependencies updated at the end after all data silos are created\n if (dependencyUpdates.length > 0) {\n await syncDataSiloDependencies(client, dependencyUpdates);\n }\n\n // Update processing activities\n if (processingActivities) {\n const processingActivitySuccess = await syncProcessingActivities(client, processingActivities);\n encounteredError = encounteredError || !processingActivitySuccess;\n }\n\n if (publishToPrivacyCenter) {\n // TODO: https://transcend.height.app/T-23779\n }\n\n return encounteredError;\n}\n/* eslint-enable max-lines */\n","import { getEntries } from '@transcend-io/type-utils';\n\nimport { TranscendInput } from '../codecs.js';\n\n/**\n * Combine a set of TranscendInput yaml files into a single yaml\n *\n * @param base - Base input\n * @param inputs - The list of inputs\n * @returns Merged input\n */\nexport function mergeTranscendInputs(\n base: TranscendInput,\n ...inputs: TranscendInput[]\n): TranscendInput {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const cloned: any = JSON.parse(JSON.stringify(base));\n inputs.forEach((input) => {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n getEntries(input).forEach(([key, value]: [any, any]) => {\n if (cloned[key] === undefined) {\n cloned[key] = value;\n } else if (Array.isArray(value)) {\n cloned[key] = [...cloned[key], ...value];\n } else {\n cloned[key] = value;\n }\n });\n });\n return cloned;\n}\n"],"mappings":"sgDAQA,MAAM,GAAiC,CACrC,GAAG,OA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,WACD,CAAC,CACF,GAAW,QAAS,GAAa,CAE3B,EAAS,0BACX,EAAkB,KAAK,CACrB,EAAkB,EAAS,OAC3B,EAAS,yBACV,CAAC,EAEJ,CACF,IAAuC,CAAC,EAS1C,GALI,EAAkB,OAAS,GAC7B,MAAM,GAAyB,EAAQ,EAAkB,CAIvD,EAAsB,CACxB,IAAM,EAA4B,MAAM,GAAyB,EAAQ,EAAqB,CAC9F,IAAuC,CAAC,EAO1C,OAAO,EC3cT,SAAgB,GACd,EACA,GAAG,EACa,CAEhB,IAAM,EAAc,KAAK,MAAM,KAAK,UAAU,EAAK,CAAC,CAapD,OAZA,EAAO,QAAS,GAAU,CAExB,GAAW,EAAM,CAAC,SAAS,CAAC,EAAK,KAAuB,CAClD,EAAO,KAAS,IAAA,GAClB,EAAO,GAAO,EACL,MAAM,QAAQ,EAAM,CAC7B,EAAO,GAAO,CAAC,GAAG,EAAO,GAAM,GAAG,EAAM,CAExC,EAAO,GAAO,GAEhB,EACF,CACK"}
|
|
1
|
+
{"version":3,"file":"mergeTranscendInputs-DGC4xUGu.mjs","names":["MAX_PAGE_SIZE"],"sources":["../src/lib/graphql/syncAction.ts","../src/lib/graphql/syncActionItemCollections.ts","../src/lib/graphql/syncActionItems.ts","../src/lib/graphql/syncAgentFiles.ts","../src/lib/graphql/syncAgentFunctions.ts","../src/lib/graphql/syncAgents.ts","../src/lib/graphql/syncAttribute.ts","../src/lib/graphql/syncBusinessEntities.ts","../src/lib/graphql/syncConsentManager.ts","../src/lib/graphql/syncDataCategories.ts","../src/lib/graphql/syncDataSubject.ts","../src/lib/graphql/syncIdentifier.ts","../src/lib/graphql/syncIntlMessages.ts","../src/lib/graphql/syncPolicies.ts","../src/lib/graphql/syncPrivacyCenter.ts","../src/lib/graphql/syncProcessingActivities.ts","../src/lib/graphql/syncProcessingPurposes.ts","../src/lib/graphql/syncPrompts.ts","../src/lib/graphql/syncVendors.ts","../src/lib/helpers/parseVariablesFromString.ts","../src/lib/graphql/syncPromptGroups.ts","../src/lib/graphql/syncPromptPartials.ts","../src/lib/graphql/syncTeams.ts","../src/lib/graphql/syncConfigurationToTranscend.ts","../src/lib/mergeTranscendInputs.ts"],"sourcesContent":["import { IsoCountryCode, IsoCountrySubdivisionCode } from '@transcend-io/privacy-types';\nimport { GraphQLClient } from 'graphql-request';\nimport { difference } from 'lodash-es';\n\nimport { ActionInput } from '../../codecs.js';\nimport { UPDATE_ACTION } from './gqls/index.js';\nimport { makeGraphQLRequest } from './makeGraphQLRequest.js';\n\nconst ALL_COUNTRIES_AND_SUBDIVISIONS = [\n ...Object.values(IsoCountryCode),\n ...Object.values(IsoCountrySubdivisionCode),\n];\n\n/**\n * Sync the consent manager\n *\n * @param client - GraphQL client\n * @param options - Options\n */\nexport async function syncAction(\n client: GraphQLClient,\n {\n action,\n actionId,\n skipPublish = false,\n }: {\n /** Action update input */\n action: ActionInput;\n /** Existing action Id */\n actionId: string;\n /** When true, skip publishing to privacy center */\n skipPublish?: boolean;\n },\n): Promise<void> {\n await makeGraphQLRequest(client, UPDATE_ACTION, {\n input: {\n id: actionId,\n skipSecondaryIfNoFiles: action.skipSecondaryIfNoFiles,\n skipDownloadableStep: action.skipDownloadableStep,\n requiresReview: action.requiresReview,\n waitingPeriod: action.waitingPeriod,\n skipPublish,\n regionList: action.regionBlockList\n ? difference(ALL_COUNTRIES_AND_SUBDIVISIONS, action.regionBlockList)\n : action.regionList,\n regionDetectionMethod: action.regionDetectionMethod,\n },\n });\n}\n","import colors from 'colors';\nimport { GraphQLClient } from 'graphql-request';\nimport { keyBy } from 'lodash-es';\n\nimport { ActionItemCollectionInput } from '../../codecs.js';\nimport { logger } from '../../logger.js';\nimport { mapSeries } from '../bluebird.js';\nimport {\n ActionItemCollection,\n fetchAllActionItemCollections,\n} from './fetchAllActionItemCollections.js';\nimport { UPDATE_ACTION_ITEM_COLLECTION, CREATE_ACTION_ITEM_COLLECTION } from './gqls/index.js';\nimport { makeGraphQLRequest } from './makeGraphQLRequest.js';\n\n/**\n * Input to create a new action item collection\n *\n * @param client - GraphQL client\n * @param actionItemCollection - Input\n * @returns Created action item collection\n */\nexport async function createActionItemCollection(\n client: GraphQLClient,\n actionItemCollection: ActionItemCollectionInput,\n): Promise<Pick<ActionItemCollection, 'id' | 'title'>> {\n const input = {\n title: actionItemCollection.title,\n description: actionItemCollection.description || '',\n hidden: actionItemCollection.hidden || false,\n productLine: actionItemCollection.productLine,\n };\n\n const { createActionItemCollection } = await makeGraphQLRequest<{\n /** Create actionItemCollection mutation */\n createActionItemCollection: {\n /** Created actionItemCollection */\n created: ActionItemCollection;\n };\n }>(client, CREATE_ACTION_ITEM_COLLECTION, {\n input,\n });\n return createActionItemCollection.created;\n}\n\n/**\n * Input to update actionItem collection\n *\n * @param client - GraphQL client\n * @param input - Input to update\n * @param actionItemCollectionId - ID of action item collection to update\n */\nexport async function updateActionItemCollection(\n client: GraphQLClient,\n input: ActionItemCollectionInput,\n actionItemCollectionId: string,\n): Promise<void> {\n await makeGraphQLRequest(client, UPDATE_ACTION_ITEM_COLLECTION, {\n input: {\n id: actionItemCollectionId,\n title: input.title,\n description: input.description,\n hidden: input.hidden,\n productLine: input.productLine,\n },\n });\n}\n\n/**\n * Sync the action item collections\n *\n * @param client - GraphQL client\n * @param inputs - Inputs to create\n * @returns True if run without error, returns false if an error occurred\n */\nexport async function syncActionItemCollections(\n client: GraphQLClient,\n inputs: ActionItemCollectionInput[],\n): Promise<boolean> {\n let encounteredError = false;\n // Fetch existing\n logger.info(colors.magenta(`Syncing \"${inputs.length}\" action item collections...`));\n\n // Fetch existing\n const existingActionItemCollections = await fetchAllActionItemCollections(client);\n\n // Look up by title\n const collectionByTitle: { [k in string]: ActionItemCollection } = keyBy(\n existingActionItemCollections,\n 'title',\n );\n\n // Create new actionItems\n const newCollections = inputs.filter((input) => !collectionByTitle[input.title]);\n\n // Create new actionItem collections\n await mapSeries(newCollections, async (input) => {\n try {\n await createActionItemCollection(client, input);\n logger.info(colors.green(`Successfully created action item collection \"${input.title}\"!`));\n } catch (err) {\n encounteredError = true;\n logger.info(\n colors.red(`Failed to create action item collection \"${input.title}\"! - ${err.message}`),\n );\n }\n });\n\n // Update all actionItems\n const actionItemsToUpdate = inputs\n .map((input) => [input, collectionByTitle[input.title]?.id])\n .filter((x): x is [ActionItemCollectionInput, string] => !!x[1]);\n await mapSeries(actionItemsToUpdate, async ([input, actionItemId]) => {\n try {\n await updateActionItemCollection(client, input, actionItemId);\n logger.info(colors.green(`Successfully synced action item collection \"${input.title}\"!`));\n } catch (err) {\n encounteredError = true;\n logger.info(\n colors.red(`Failed to sync action item collection \"${input.title}\"! - ${err.message}`),\n );\n }\n });\n\n return !encounteredError;\n}\n","import colors from 'colors';\nimport { GraphQLClient } from 'graphql-request';\nimport { uniq, keyBy, chunk } from 'lodash-es';\n\nimport { ActionItemInput } from '../../codecs.js';\nimport { logger } from '../../logger.js';\nimport { mapSeries } from '../bluebird.js';\nimport {\n ActionItemCollection,\n fetchAllActionItemCollections,\n} from './fetchAllActionItemCollections.js';\nimport { fetchAllActionItems, ActionItem } from './fetchAllActionItems.js';\nimport { Attribute, fetchAllAttributes } from './fetchAllAttributes.js';\nimport { UPDATE_ACTION_ITEMS, CREATE_ACTION_ITEMS } from './gqls/index.js';\nimport { makeGraphQLRequest } from './makeGraphQLRequest.js';\n\n/**\n * Input to create a new actionItem\n *\n * @param client - GraphQL client\n * @param actionItems - Action item inputs\n * @param actionItemCollectionByTitle - Action item collections indexed by title\n * @param attributeKeysByName - Lookup attribute by name\n */\nexport async function createActionItems(\n client: GraphQLClient,\n actionItems: ActionItemInput[],\n actionItemCollectionByTitle: { [k in string]: ActionItemCollection },\n // TODO: https://transcend.height.app/T-38961 - insert attributes\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n attributeKeysByName: { [k in string]: Attribute } = {},\n): Promise<void> {\n // TODO: https://transcend.height.app/T-38961 - insert attributes\n // const getAttribute = (key: string): string => {\n // const existing = attributeKeysByName[key];\n // if (!existing) {\n // throw new Error(`Attribute key \"${key}\" does not exist!`);\n // }\n // return existing.id;\n // };\n const chunked = chunk(actionItems, 100);\n await mapSeries(chunked, async (chunkToUpload) => {\n await makeGraphQLRequest(client, CREATE_ACTION_ITEMS, {\n input: chunkToUpload.map((actionItem) => ({\n title: actionItem.title,\n type: actionItem.type,\n priorityOverride: actionItem.priority,\n dueDate: actionItem.dueDate,\n customerExperienceActionItemId: actionItem.customerExperienceActionItemId,\n resolved: actionItem.resolved,\n notes: actionItem.notes,\n link: actionItem.link,\n assigneesUserEmails: actionItem.users,\n assigneesTeamNames: actionItem.teams,\n ...(actionItem.attributes\n ? {\n // TODO: https://transcend.height.app/T-38961 - insert attributes\n // attributes: actionItem.attributes.map(({ key, values }) => ({\n // attributeKeyId: getAttribute(key),\n // attributeValueNames: values,\n // })),\n }\n : {}),\n collectionIds: actionItem.collections.map(\n (collectionTitle) => actionItemCollectionByTitle[collectionTitle].id,\n ),\n })),\n });\n });\n}\n\n/**\n * Input to update actionItems\n *\n * @param client - GraphQL client\n * @param input - Input to update\n * @param actionItemId - ID of action item to update\n * @param attributeKeysByName - Attribute keys by name\n */\nexport async function updateActionItem(\n client: GraphQLClient,\n input: ActionItemInput,\n actionItemId: string,\n attributeKeysByName: {\n [k in string]: Attribute;\n } = {},\n): Promise<void> {\n const getAttribute = (key: string): string => {\n const existing = attributeKeysByName[key];\n if (!existing) {\n throw new Error(`Attribute key \"${key}\" does not exist!`);\n }\n return existing.id;\n };\n await makeGraphQLRequest(client, UPDATE_ACTION_ITEMS, {\n input: {\n ids: [actionItemId],\n title: input.title,\n priorityOverride: input.priority,\n dueDate: input.dueDate,\n resolved: input.resolved,\n customerExperienceActionItemId: input.customerExperienceActionItemId,\n notes: input.notes,\n link: input.link,\n assigneesUserEmails: input.users,\n assigneesTeamNames: input.teams,\n ...(input.attributes\n ? {\n attributes: input.attributes.map(({ key, values }) => ({\n attributeKeyId: getAttribute(key),\n attributeValueNames: values,\n })),\n }\n : {}),\n },\n });\n}\n\n/**\n * Convert action item to a unique key\n *\n * @param actionItem - action item\n * @returns Unique key\n */\nfunction actionItemToUniqueCode({\n title,\n collections,\n}: Pick<ActionItem, 'title' | 'collections'>): string {\n return `${title}-${collections\n .map((c) => c.title)\n .sort()\n .join('-')}`;\n}\n\n/**\n * Convert action item to a unique key\n *\n * @param actionItem - action item\n * @returns Unique key\n */\nfunction actionItemInputToUniqueCode({\n title,\n collections,\n}: Pick<ActionItemInput, 'title' | 'collections'>): string {\n return `${title}-${collections.sort().join('-')}`;\n}\n\n/**\n * Sync the action item\n *\n * @param client - GraphQL client\n * @param inputs - Inputs to create\n * @returns True if run without error, returns false if an error occurred\n */\nexport async function syncActionItems(\n client: GraphQLClient,\n inputs: ActionItemInput[],\n): Promise<boolean> {\n let encounteredError = false;\n // Fetch existing\n logger.info(colors.magenta(`Syncing \"${inputs.length}\" actionItems...`));\n\n // Determine if attributes are syncing\n const hasAttributes = inputs.some((input) => input.attributes && input.attributes.length > 0);\n\n // Fetch existing\n const [existingActionItems, existingActionItemCollections, attributeKeys] = await Promise.all([\n fetchAllActionItems(client),\n fetchAllActionItemCollections(client),\n hasAttributes ? fetchAllAttributes(client) : [],\n ]);\n\n // Look up by title\n const actionItemCollectionByTitle: { [k in string]: ActionItemCollection } = keyBy(\n existingActionItemCollections,\n 'title',\n );\n const actionItemByTitle: { [k in string]: ActionItem } = keyBy(\n existingActionItems,\n actionItemToUniqueCode,\n );\n const attributeKeysByName = keyBy(attributeKeys, 'name');\n const actionItemByCxId: { [k in string]: ActionItem } = keyBy(\n existingActionItems.filter((x) => !!x.customerExperienceActionItemIds),\n ({ customerExperienceActionItemIds }) => customerExperienceActionItemIds[0],\n );\n\n // Ensure all collections exist\n const missingCollections = uniq(inputs.map((input) => input.collections).flat()).filter(\n (collectionTitle) => !actionItemCollectionByTitle[collectionTitle],\n );\n if (missingCollections.length > 0) {\n logger.info(\n colors.red(\n `Missing action item collections: \"${missingCollections.join(\n '\", \"',\n )}\" - please create them first!`,\n ),\n );\n return false;\n }\n\n // Create new actionItems\n const newActionItems = inputs.filter(\n (input) =>\n !actionItemByTitle[actionItemInputToUniqueCode(input)] &&\n !actionItemByCxId[input.customerExperienceActionItemId!],\n );\n\n // Create new actionItems\n if (newActionItems.length > 0) {\n try {\n logger.info(colors.magenta(`Creating \"${newActionItems.length}\" actionItems...`));\n await createActionItems(\n client,\n newActionItems,\n actionItemCollectionByTitle,\n attributeKeysByName,\n );\n logger.info(colors.green(`Successfully created \"${newActionItems.length}\" actionItems!`));\n } catch (err) {\n encounteredError = true;\n logger.info(colors.red(`Failed to create action items! - ${err.message}`));\n }\n }\n\n // Update all actionItems\n const actionItemsToUpdate = inputs\n .map((input) => [\n input,\n actionItemByTitle[actionItemInputToUniqueCode(input)]?.id ||\n actionItemByCxId[input.customerExperienceActionItemId!]?.id,\n ])\n .filter((x): x is [ActionItemInput, string] => !!x[1]);\n await mapSeries(actionItemsToUpdate, async ([input, actionItemId]) => {\n try {\n await updateActionItem(client, input, actionItemId, attributeKeysByName);\n logger.info(colors.green(`Successfully synced action item \"${input.title}\"!`));\n } catch (err) {\n encounteredError = true;\n logger.info(colors.red(`Failed to sync action item \"${input.title}\"! - ${err.message}`));\n }\n });\n\n return !encounteredError;\n}\n","import colors from 'colors';\nimport { GraphQLClient } from 'graphql-request';\nimport { keyBy } from 'lodash-es';\n\nimport { AgentFileInput } from '../../codecs.js';\nimport { logger } from '../../logger.js';\nimport { mapSeries } from '../bluebird.js';\nimport { fetchAllAgentFiles, AgentFile } from './fetchAllAgentFiles.js';\nimport { UPDATE_AGENT_FILES, CREATE_AGENT_FILE } from './gqls/index.js';\nimport { makeGraphQLRequest } from './makeGraphQLRequest.js';\n\n/**\n * Input to create a new agent file\n *\n * @param client - GraphQL client\n * @param agentFile - Input\n * @returns Created agent file\n */\nexport async function createAgentFile(\n client: GraphQLClient,\n agentFile: AgentFileInput,\n): Promise<Pick<AgentFile, 'id' | 'name' | 'fileId'>> {\n const input = {\n name: agentFile.name,\n description: agentFile.description,\n fileId: agentFile.fileId,\n size: agentFile.size,\n purpose: agentFile.purpose,\n fileUploadedAt: new Date(),\n agentIds: [],\n // TODO: https://transcend.height.app/T-31994 - sync agents\n };\n\n const { createAgentFile } = await makeGraphQLRequest<{\n /** Create agent file mutation */\n createAgentFile: {\n /** Created agent file */\n agentFile: AgentFile;\n };\n }>(client, CREATE_AGENT_FILE, {\n input,\n });\n return createAgentFile.agentFile;\n}\n\n/**\n * Input to update agent files\n *\n * @param client - GraphQL client\n * @param agentFileIdPairs - [AgentFileInput, agentFileId] list\n */\nexport async function updateAgentFiles(\n client: GraphQLClient,\n agentFileIdPairs: [AgentFileInput, string][],\n): Promise<void> {\n await makeGraphQLRequest(client, UPDATE_AGENT_FILES, {\n input: {\n agentFiles: agentFileIdPairs.map(([agentFile, id]) => ({\n id,\n name: agentFile.name,\n description: agentFile.description,\n fileId: agentFile.fileId,\n size: agentFile.size,\n purpose: agentFile.purpose,\n })),\n },\n });\n}\n\n/**\n * Sync the data inventory agent files\n *\n * @param client - GraphQL client\n * @param inputs - Inputs to create\n * @returns True if run without error, returns false if an error occurred\n */\nexport async function syncAgentFiles(\n client: GraphQLClient,\n inputs: AgentFileInput[],\n): Promise<boolean> {\n // Fetch existing\n logger.info(colors.magenta(`Syncing \"${inputs.length}\" agent files...`));\n\n let encounteredError = false;\n\n // Fetch existing\n const existingAgentFiles = await fetchAllAgentFiles(client);\n\n // Look up by name\n const agentFileByName: {\n [k in string]: Pick<AgentFile, 'id' | 'name' | 'fileId'>;\n } = keyBy(existingAgentFiles, 'name');\n\n // Create new agent files\n const newAgentFiles = inputs.filter((input) => !agentFileByName[input.name]);\n\n // Create new agent files\n await mapSeries(newAgentFiles, async (agentFile) => {\n try {\n const newAgentFile = await createAgentFile(client, agentFile);\n agentFileByName[newAgentFile.name] = newAgentFile;\n logger.info(colors.green(`Successfully synced agent file \"${agentFile.name}\"!`));\n } catch (err) {\n encounteredError = true;\n logger.info(colors.red(`Failed to sync agent file \"${agentFile.name}\"! - ${err.message}`));\n }\n });\n\n // Update all agent files\n try {\n logger.info(colors.magenta(`Updating \"${inputs.length}\" agent files!`));\n await updateAgentFiles(\n client,\n inputs.map((input) => [input, agentFileByName[input.name].id]),\n );\n logger.info(colors.green(`Successfully synced \"${inputs.length}\" agent files!`));\n } catch (err) {\n encounteredError = true;\n logger.info(colors.red(`Failed to sync \"${inputs.length}\" agent files! - ${err.message}`));\n }\n\n return !encounteredError;\n}\n","import colors from 'colors';\nimport { GraphQLClient } from 'graphql-request';\nimport { keyBy } from 'lodash-es';\n\nimport { AgentFunctionInput } from '../../codecs.js';\nimport { logger } from '../../logger.js';\nimport { mapSeries } from '../bluebird.js';\nimport { fetchAllAgentFunctions, AgentFunction } from './fetchAllAgentFunctions.js';\nimport { UPDATE_AGENT_FUNCTIONS, CREATE_AGENT_FUNCTION } from './gqls/index.js';\nimport { makeGraphQLRequest } from './makeGraphQLRequest.js';\n\n/**\n * Input to create a new agent function\n *\n * @param client - GraphQL client\n * @param agentFunction - Input\n * @returns Created agent function\n */\nexport async function createAgentFunction(\n client: GraphQLClient,\n agentFunction: AgentFunctionInput,\n): Promise<Pick<AgentFunction, 'id' | 'name'>> {\n const input = {\n name: agentFunction.name,\n description: agentFunction.description,\n parameters: agentFunction.parameters,\n agentIds: [],\n // TODO: https://transcend.height.app/T-31994 - sync agents\n };\n\n const { createAgentFunction } = await makeGraphQLRequest<{\n /** Create agent function mutation */\n createAgentFunction: {\n /** Created agent function */\n agentFunction: AgentFunction;\n };\n }>(client, CREATE_AGENT_FUNCTION, {\n input,\n });\n return createAgentFunction.agentFunction;\n}\n\n/**\n * Input to update agent functions\n *\n * @param client - GraphQL client\n * @param agentFunctionIdPairs - [AgentFunctionInput, agentFunctionId] list\n */\nexport async function updateAgentFunctions(\n client: GraphQLClient,\n agentFunctionIdPairs: [AgentFunctionInput, string][],\n): Promise<void> {\n await makeGraphQLRequest(client, UPDATE_AGENT_FUNCTIONS, {\n input: {\n agentFunctions: agentFunctionIdPairs.map(([agentFunction, id]) => ({\n id,\n name: agentFunction.name,\n description: agentFunction.description,\n parameters: agentFunction.parameters,\n })),\n },\n });\n}\n\n/**\n * Sync the data inventory agent functions\n *\n * @param client - GraphQL client\n * @param inputs - Inputs to create\n * @returns True if run without error, returns false if an error occurred\n */\nexport async function syncAgentFunctions(\n client: GraphQLClient,\n inputs: AgentFunctionInput[],\n): Promise<boolean> {\n // Fetch existing\n logger.info(colors.magenta(`Syncing \"${inputs.length}\" agent functions...`));\n\n let encounteredError = false;\n\n // Fetch existing\n const existingAgentFunctions = await fetchAllAgentFunctions(client);\n\n // Look up by name\n const agentFunctionByName: {\n [k in string]: Pick<AgentFunction, 'id' | 'name'>;\n } = keyBy(existingAgentFunctions, 'name');\n\n // Create new agent functions\n const newAgentFunctions = inputs.filter((input) => !agentFunctionByName[input.name]);\n\n // Create new agent functions\n await mapSeries(newAgentFunctions, async (agentFunction) => {\n try {\n const newAgentFunction = await createAgentFunction(client, agentFunction);\n agentFunctionByName[newAgentFunction.name] = newAgentFunction;\n logger.info(colors.green(`Successfully synced agent function \"${agentFunction.name}\"!`));\n } catch (err) {\n encounteredError = true;\n logger.info(\n colors.red(`Failed to sync agent function \"${agentFunction.name}\"! - ${err.message}`),\n );\n }\n });\n\n // Update all agent functions\n try {\n logger.info(colors.magenta(`Updating \"${inputs.length}\" agent functions!`));\n await updateAgentFunctions(\n client,\n inputs.map((input) => [input, agentFunctionByName[input.name].id]),\n );\n logger.info(colors.green(`Successfully synced \"${inputs.length}\" agent functions!`));\n } catch (err) {\n encounteredError = true;\n logger.info(colors.red(`Failed to sync \"${inputs.length}\" agent functions! - ${err.message}`));\n }\n\n return !encounteredError;\n}\n","import colors from 'colors';\nimport { GraphQLClient } from 'graphql-request';\nimport { keyBy } from 'lodash-es';\n\nimport { AgentInput } from '../../codecs.js';\nimport { logger } from '../../logger.js';\nimport { mapSeries } from '../bluebird.js';\nimport { fetchAllAgents, Agent } from './fetchAllAgents.js';\nimport { UPDATE_AGENTS, CREATE_AGENT } from './gqls/index.js';\nimport { makeGraphQLRequest } from './makeGraphQLRequest.js';\n\n/**\n * Input to create a new agent\n *\n * @param client - GraphQL client\n * @param agent - Input\n * @returns Created agent\n */\nexport async function createAgent(\n client: GraphQLClient,\n agent: AgentInput,\n): Promise<Pick<Agent, 'id' | 'name' | 'agentId'>> {\n const input = {\n name: agent.name,\n description: agent.description,\n codeInterpreterEnabled: agent.codeInterpreterEnabled,\n retrievalEnabled: agent.retrievalEnabled,\n promptTitle: agent.prompt,\n largeLanguageModelName: agent['large-language-model'].name,\n largeLanguageModelClient: agent['large-language-model'].client,\n // TODO: https://transcend.height.app/T-32760 - agentFunction, agentFile\n // TODO: https://transcend.height.app/T-31994 - owners and teams\n };\n\n const { createAgent } = await makeGraphQLRequest<{\n /** Create agent mutation */\n createAgent: {\n /** Created agent */\n agent: Agent;\n };\n }>(client, CREATE_AGENT, {\n input,\n });\n return createAgent.agent;\n}\n\n/**\n * Input to update agents\n *\n * @param client - GraphQL client\n * @param agentIdParis - [AgentInput, agentId] list\n */\nexport async function updateAgents(\n client: GraphQLClient,\n agentIdParis: [AgentInput, string][],\n): Promise<void> {\n await makeGraphQLRequest(client, UPDATE_AGENTS, {\n input: {\n agents: agentIdParis.map(([agent, id]) => ({\n id,\n name: agent.name,\n description: agent.description,\n codeInterpreterEnabled: agent.codeInterpreterEnabled,\n retrievalEnabled: agent.retrievalEnabled,\n // TODO: https://transcend.height.app/T-31995 - prompt, largeLanguageModel, agentFunction, agentFile\n })),\n },\n });\n}\n\n/**\n * Sync the data inventory agents\n *\n * @param client - GraphQL client\n * @param inputs - Inputs to create\n * @returns True if run without error, returns false if an error occurred\n */\nexport async function syncAgents(client: GraphQLClient, inputs: AgentInput[]): Promise<boolean> {\n // Fetch existing\n logger.info(colors.magenta(`Syncing \"${inputs.length}\" agents...`));\n\n let encounteredError = false;\n\n // Fetch existing\n const existingAgents = await fetchAllAgents(client);\n\n // Look up by name\n const agentByName: {\n [k in string]: Pick<Agent, 'id' | 'name' | 'agentId'>;\n } = keyBy(existingAgents, 'name');\n\n // Create new agents\n const newAgents = inputs.filter((input) => !agentByName[input.name]);\n\n // Create new agents\n await mapSeries(newAgents, async (agent) => {\n try {\n const newAgent = await createAgent(client, agent);\n agentByName[newAgent.name] = newAgent;\n logger.info(colors.green(`Successfully synced agent \"${agent.name}\"!`));\n } catch (err) {\n encounteredError = true;\n logger.info(colors.red(`Failed to sync agent \"${agent.name}\"! - ${err.message}`));\n }\n });\n\n // Update all agents\n try {\n logger.info(colors.magenta(`Updating \"${inputs.length}\" agents!`));\n await updateAgents(\n client,\n inputs.map((input) => [input, agentByName[input.name].id]),\n );\n logger.info(colors.green(`Successfully synced \"${inputs.length}\" agents!`));\n } catch (err) {\n encounteredError = true;\n logger.info(colors.red(`Failed to sync \"${inputs.length}\" agents ! - ${err.message}`));\n }\n\n return !encounteredError;\n}\n","import colors from 'colors';\nimport { GraphQLClient } from 'graphql-request';\nimport { keyBy, difference, groupBy } from 'lodash-es';\n\nimport { AttributeInput } from '../../codecs.js';\nimport { logger } from '../../logger.js';\nimport { map } from '../bluebird.js';\nimport { Attribute } from './fetchAllAttributes.js';\nimport {\n CREATE_ATTRIBUTE,\n CREATE_ATTRIBUTE_VALUES,\n DELETE_ATTRIBUTE_VALUE,\n UPDATE_ATTRIBUTE,\n UPDATE_ATTRIBUTE_VALUES,\n} from './gqls/index.js';\nimport { makeGraphQLRequest } from './makeGraphQLRequest.js';\n\n/**\n * Sync attribute\n *\n * @param client - GraphQL client\n * @param attribute - The attribute input\n * @param options - Options\n */\nexport async function syncAttribute(\n client: GraphQLClient,\n attribute: AttributeInput,\n {\n existingAttribute,\n deleteExtraAttributeValues,\n }: {\n /** The existing attribute configuration if it exists */\n existingAttribute?: Attribute;\n /** When true, delete extra attributes not specified in the list of values */\n deleteExtraAttributeValues?: boolean;\n },\n): Promise<void> {\n // attribute key input\n const input = {\n name: attribute.name,\n enabledOn: attribute.resources,\n };\n\n // create or update attribute key\n let attributeKeyId: string;\n if (!existingAttribute) {\n const {\n createAttributeKey: { attributeKey },\n } = await makeGraphQLRequest<{\n /** Create attribute key response */\n createAttributeKey: {\n /** Attribute key */\n attributeKey: {\n /** ID */\n id: string;\n };\n };\n }>(client, CREATE_ATTRIBUTE, {\n type: attribute.type,\n description: attribute.description,\n ...input,\n });\n attributeKeyId = attributeKey.id;\n } else {\n await makeGraphQLRequest(client, UPDATE_ATTRIBUTE, {\n attributeKeyId: existingAttribute.id,\n description: existingAttribute.isCustom ? attribute.description : undefined,\n ...input,\n });\n attributeKeyId = existingAttribute.id;\n }\n\n // upsert attribute values\n const existingAttributeMap = keyBy(existingAttribute?.values || [], 'name');\n const { existingValues = [], newValues = [] } = groupBy(attribute.values || [], (field) =>\n existingAttributeMap[field.name] ? 'existingValues' : 'newValues',\n );\n const removedValues = difference(\n (existingAttribute?.values || []).map(({ name }) => name),\n (attribute.values || []).map(({ name }) => name),\n );\n\n // Create new attribute values\n if (newValues.length > 0) {\n await makeGraphQLRequest(client, CREATE_ATTRIBUTE_VALUES, {\n input: newValues.map(({ name, ...rest }) => ({\n name,\n attributeKeyId,\n ...rest,\n })),\n });\n logger.info(colors.green(`Created ${newValues.length} attribute values`));\n }\n\n // Update existing attribute values\n if (existingValues.length > 0) {\n await makeGraphQLRequest(client, UPDATE_ATTRIBUTE_VALUES, {\n input: existingValues.map(({ name, ...rest }) => ({\n id: existingAttributeMap[name].id,\n name,\n description: existingAttributeMap[name].description,\n color: existingAttributeMap[name].color,\n ...rest,\n attributeKeyId,\n })),\n });\n logger.info(colors.green(`Updated ${existingValues.length} attribute values`));\n }\n\n // Delete removed attribute values\n if (removedValues.length > 0 && deleteExtraAttributeValues) {\n await map(\n removedValues,\n async (value) => {\n await makeGraphQLRequest(client, DELETE_ATTRIBUTE_VALUE, {\n id: existingAttributeMap[value].id,\n });\n },\n {\n concurrency: 10,\n },\n );\n logger.info(colors.green(`Deleted ${removedValues.length} attribute values`));\n }\n}\n","import colors from 'colors';\nimport { GraphQLClient } from 'graphql-request';\nimport { keyBy, chunk } from 'lodash-es';\n\nimport { BusinessEntityInput } from '../../codecs.js';\nimport { logger } from '../../logger.js';\nimport { mapSeries } from '../bluebird.js';\nimport { fetchAllBusinessEntities, BusinessEntity } from './fetchAllBusinessEntities.js';\nimport { UPDATE_BUSINESS_ENTITIES, CREATE_BUSINESS_ENTITY } from './gqls/index.js';\nimport { makeGraphQLRequest } from './makeGraphQLRequest.js';\n\n/**\n * Input to create a new business entity\n *\n * @param client - GraphQL client\n * @param businessEntity - Input\n * @returns Created business entity\n */\nexport async function createBusinessEntity(\n client: GraphQLClient,\n businessEntity: BusinessEntityInput,\n): Promise<BusinessEntity> {\n const input = {\n title: businessEntity.title,\n description: businessEntity.description,\n address: businessEntity.address,\n headquarterCountry: businessEntity.headquarterCountry,\n headquarterSubDivision: businessEntity.headquarterSubDivision,\n dataProtectionOfficerName: businessEntity.dataProtectionOfficerName,\n dataProtectionOfficerEmail: businessEntity.dataProtectionOfficerEmail,\n attributes: businessEntity.attributes,\n teamNames: businessEntity.teams,\n ownerEmails: businessEntity.owners,\n };\n\n const { createBusinessEntity } = await makeGraphQLRequest<{\n /** Create business entity mutation */\n createBusinessEntity: {\n /** Created business entity */\n businessEntity: BusinessEntity;\n };\n }>(client, CREATE_BUSINESS_ENTITY, {\n input,\n });\n return createBusinessEntity.businessEntity;\n}\n\n/**\n * Input to update business entities\n *\n * @param client - GraphQL client\n * @param businessEntityIdParis - [BusinessEntityInput, businessEntityId] list\n */\nexport async function updateBusinessEntities(\n client: GraphQLClient,\n businessEntityIdParis: [BusinessEntityInput, string][],\n): Promise<void> {\n const chunkedUpdates = chunk(businessEntityIdParis, 100);\n await mapSeries(chunkedUpdates, async (chunked) => {\n await makeGraphQLRequest(client, UPDATE_BUSINESS_ENTITIES, {\n input: chunked.map(([businessEntity, id]) => ({\n id,\n title: businessEntity.title,\n description: businessEntity.description,\n address: businessEntity.address,\n headquarterCountry: businessEntity.headquarterCountry,\n headquarterSubDivision: businessEntity.headquarterSubDivision,\n dataProtectionOfficerName: businessEntity.dataProtectionOfficerName,\n dataProtectionOfficerEmail: businessEntity.dataProtectionOfficerEmail,\n attributes: businessEntity.attributes,\n teamNames: businessEntity.teams,\n ownerEmails: businessEntity.owners,\n })),\n });\n });\n}\n\n/**\n * Sync the data inventory business entities\n *\n * @param client - GraphQL client\n * @param inputs - Inputs to create\n * @returns True if run without error, returns false if an error occurred\n */\nexport async function syncBusinessEntities(\n client: GraphQLClient,\n inputs: BusinessEntityInput[],\n): Promise<boolean> {\n // Fetch existing\n logger.info(colors.magenta(`Syncing \"${inputs.length}\" business entities...`));\n\n let encounteredError = false;\n\n // Fetch existing\n const existingBusinessEntities = await fetchAllBusinessEntities(client);\n\n // Look up by title\n const businessEntityByTitle = keyBy(existingBusinessEntities, 'title');\n\n // Create new business entities\n const newBusinessEntities = inputs.filter((input) => !businessEntityByTitle[input.title]);\n\n // Create new business entities\n await mapSeries(newBusinessEntities, async (businessEntity) => {\n try {\n const newBusinessEntity = await createBusinessEntity(client, businessEntity);\n businessEntityByTitle[newBusinessEntity.title] = newBusinessEntity;\n logger.info(colors.green(`Successfully synced business entity \"${businessEntity.title}\"!`));\n } catch (err) {\n encounteredError = true;\n logger.info(\n colors.red(`Failed to sync business entity \"${businessEntity.title}\"! - ${err.message}`),\n );\n }\n });\n\n // Update all business entities\n try {\n logger.info(colors.magenta(`Updating \"${inputs.length}\" business entities!`));\n await updateBusinessEntities(\n client,\n inputs.map((input) => [input, businessEntityByTitle[input.title].id]),\n );\n logger.info(colors.green(`Successfully synced \"${inputs.length}\" business entities!`));\n } catch (err) {\n encounteredError = true;\n logger.info(\n colors.red(`Failed to sync \"${inputs.length}\" business entities ! - ${err.message}`),\n );\n }\n\n return !encounteredError;\n}\n","import { InitialViewState, OnConsentExpiry } from '@transcend-io/airgap.js-types';\nimport colors from 'colors';\nimport { GraphQLClient } from 'graphql-request';\nimport { keyBy } from 'lodash-es';\n\nimport { ConsentManageExperienceInput, ConsentManagerInput } from '../../codecs.js';\nimport { logger } from '../../logger.js';\nimport { map } from '../bluebird.js';\nimport { fetchAllPurposes } from './fetchAllPurposes.js';\nimport { fetchConsentManagerId, fetchConsentManagerExperiences } from './fetchConsentManagerId.js';\nimport { fetchPrivacyCenterId } from './fetchPrivacyCenterId.js';\nimport {\n UPDATE_CONSENT_MANAGER_DOMAINS,\n CREATE_CONSENT_MANAGER,\n UPDATE_LOAD_OPTIONS,\n UPDATE_CONSENT_MANAGER_PARTITION,\n UPDATE_CONSENT_MANAGER_VERSION,\n TOGGLE_TELEMETRY_PARTITION_STRATEGY,\n TOGGLE_UNKNOWN_COOKIE_POLICY,\n TOGGLE_CONSENT_PRECEDENCE,\n TOGGLE_UNKNOWN_REQUEST_POLICY,\n UPDATE_CONSENT_EXPERIENCE,\n CREATE_CONSENT_EXPERIENCE,\n UPDATE_CONSENT_MANAGER_THEME,\n} from './gqls/index.js';\nimport { makeGraphQLRequest } from './makeGraphQLRequest.js';\nimport { fetchPartitions } from './syncPartitions.js';\n\nconst PURPOSES_LINK = 'https://app.transcend.io/consent-manager/regional-experiences/purposes';\n\n/**\n * Sync consent manager experiences up to Transcend\n *\n * @param client - GraphQL client\n * @param experiences - The experience inputs\n */\nexport async function syncConsentManagerExperiences(\n client: GraphQLClient,\n experiences: ConsentManageExperienceInput[],\n): Promise<void> {\n // Fetch existing experiences and\n const existingExperiences = await fetchConsentManagerExperiences(client);\n const experienceLookup = keyBy(existingExperiences, 'name');\n\n // Fetch existing purposes\n const purposes = await fetchAllPurposes(client);\n const purposeLookup = keyBy(purposes, 'trackingType');\n\n // Bulk update or create experiences\n await map(\n experiences,\n async (exp, ind) => {\n // Purpose IDs\n const purposeIds = exp.purposes?.map((purpose, ind2) => {\n const existingPurpose = purposeLookup[purpose.trackingType];\n if (!existingPurpose) {\n throw new Error(\n `Invalid purpose trackingType provided at consentManager.experiences[${ind}].purposes[${ind2}]: ` +\n `${purpose.trackingType}. See list of valid purposes ${PURPOSES_LINK}`,\n );\n }\n return existingPurpose.id;\n });\n const optedOutPurposeIds = exp.optedOutPurposes?.map((purpose, ind2) => {\n const existingPurpose = purposeLookup[purpose.trackingType];\n if (!existingPurpose) {\n throw new Error(\n `Invalid purpose trackingType provided at consentManager.experiences[${ind}].optedOutPurposes[${ind2}]: ` +\n `${purpose.trackingType}. See list of valid purposes ${PURPOSES_LINK}`,\n );\n }\n return existingPurpose.id;\n });\n\n // update experience\n const existingExperience = experienceLookup[exp.name];\n if (existingExperience) {\n await makeGraphQLRequest(client, UPDATE_CONSENT_EXPERIENCE, {\n input: {\n id: existingExperience.id,\n name: exp.displayName,\n regions: exp.regions,\n operator: exp.operator,\n onConsentExpiry: exp.onConsentExpiry,\n consentExpiry: exp.consentExpiry,\n displayPriority:\n exp.displayPriority !== existingExperience.displayPriority\n ? exp.displayPriority\n : undefined,\n viewState: exp.viewState,\n purposes: purposeIds,\n optedOutPurposes: optedOutPurposeIds,\n browserLanguages: exp.browserLanguages,\n browserTimeZones: exp.browserTimeZones,\n },\n });\n logger.info(colors.green(`Successfully synced consent experience \"${exp.name}\"!`));\n } else {\n // create new experience\n await makeGraphQLRequest(client, CREATE_CONSENT_EXPERIENCE, {\n input: {\n name: exp.name,\n displayName: exp.displayName,\n regions: exp.regions,\n operator: exp.operator,\n onConsentExpiry: exp.onConsentExpiry || OnConsentExpiry.Prompt,\n consentExpiry: exp.consentExpiry,\n displayPriority: exp.displayPriority,\n viewState: exp.viewState || InitialViewState.Hidden,\n purposes: purposeIds || [],\n optedOutPurposes: optedOutPurposeIds || [],\n browserLanguages: exp.browserLanguages,\n browserTimeZones: exp.browserTimeZones,\n },\n });\n logger.info(colors.green(`Successfully created consent experience \"${exp.name}\"!`));\n }\n },\n {\n concurrency: 10,\n },\n );\n}\n\n/**\n * Sync the consent manager\n *\n * @param client - GraphQL client\n * @param consentManager - The consent manager input\n */\nexport async function syncConsentManager(\n client: GraphQLClient,\n consentManager: ConsentManagerInput,\n): Promise<void> {\n let airgapBundleId: string;\n\n // ensure the consent manager is created and deployed\n try {\n airgapBundleId = await fetchConsentManagerId(client, 1);\n } catch (err) {\n // TODO: https://transcend.height.app/T-23778\n if (err.message.includes('AirgapBundle not found')) {\n const privacyCenterId = await fetchPrivacyCenterId(client);\n\n const { createConsentManager } = await makeGraphQLRequest<{\n /** Create consent manager */\n createConsentManager: {\n /** Consent manager */\n consentManager: {\n /** ID */\n id: string;\n };\n };\n }>(client, CREATE_CONSENT_MANAGER, {\n domains: consentManager.domains,\n privacyCenterId,\n });\n airgapBundleId = createConsentManager.consentManager.id;\n } else {\n throw err;\n }\n }\n\n // sync domains\n if (consentManager.domains) {\n await makeGraphQLRequest(client, UPDATE_CONSENT_MANAGER_DOMAINS, {\n domains: consentManager.domains,\n airgapBundleId,\n });\n }\n\n // sync partition\n if (consentManager.partition) {\n const partitions = await fetchPartitions(client);\n const partitionToUpdate = partitions.find((part) => part.name === consentManager.partition);\n if (!partitionToUpdate) {\n throw new Error(\n `Partition \"${consentManager.partition}\" not found. Please create the partition first.`,\n );\n }\n await makeGraphQLRequest(client, UPDATE_CONSENT_MANAGER_PARTITION, {\n partitionId: partitionToUpdate.id,\n airgapBundleId,\n });\n }\n\n if (consentManager.version) {\n await makeGraphQLRequest(client, UPDATE_CONSENT_MANAGER_VERSION, {\n airgapBundleId,\n version: consentManager.version,\n });\n }\n\n // sync signed IAB agreement\n if (consentManager.signedIabAgreement) {\n await makeGraphQLRequest(client, UPDATE_LOAD_OPTIONS, {\n input: {\n id: airgapBundleId,\n ...(consentManager.signedIabAgreement\n ? { signedIabAgreement: consentManager.signedIabAgreement }\n : {}),\n },\n });\n }\n\n // sync default request policy\n if (consentManager.unknownRequestPolicy) {\n await makeGraphQLRequest(client, TOGGLE_UNKNOWN_REQUEST_POLICY, {\n input: {\n id: airgapBundleId,\n unknownRequestPolicy: consentManager.unknownRequestPolicy,\n },\n });\n }\n\n // sync default cookie policy\n if (consentManager.unknownRequestPolicy) {\n await makeGraphQLRequest(client, TOGGLE_UNKNOWN_COOKIE_POLICY, {\n input: {\n id: airgapBundleId,\n unknownCookiePolicy: consentManager.unknownCookiePolicy,\n },\n });\n }\n\n // sync telemetry partition strategy\n if (consentManager.telemetryPartitioning) {\n await makeGraphQLRequest(client, TOGGLE_TELEMETRY_PARTITION_STRATEGY, {\n input: {\n id: airgapBundleId,\n strategy: consentManager.telemetryPartitioning,\n },\n });\n }\n\n // sync telemetry partition strategy\n if (consentManager.consentPrecedence) {\n await makeGraphQLRequest(client, TOGGLE_CONSENT_PRECEDENCE, {\n input: {\n id: airgapBundleId,\n consentPrecedence: consentManager.consentPrecedence,\n },\n });\n }\n\n // Update experience configurations\n if (consentManager.experiences) {\n await syncConsentManagerExperiences(client, consentManager.experiences);\n }\n\n // update theme\n if (consentManager.theme) {\n await makeGraphQLRequest(client, UPDATE_CONSENT_MANAGER_THEME, {\n input: {\n airgapBundleId,\n ...consentManager.theme,\n },\n });\n }\n\n // TODO: https://transcend.height.app/T-23875\n // syncEndpoint: string;\n // TODO: https://transcend.height.app/T-23919\n // syncGroups: string;\n}\n","import colors from 'colors';\nimport { GraphQLClient } from 'graphql-request';\nimport { keyBy } from 'lodash-es';\n\nimport { DataCategoryInput } from '../../codecs.js';\nimport { logger } from '../../logger.js';\nimport { mapSeries } from '../bluebird.js';\nimport { fetchAllDataCategories, DataSubCategory } from './fetchAllDataCategories.js';\nimport { UPDATE_DATA_SUB_CATEGORIES, CREATE_DATA_SUB_CATEGORY } from './gqls/index.js';\nimport { makeGraphQLRequest } from './makeGraphQLRequest.js';\n\n/**\n * Input to create a new data category\n *\n * @param client - GraphQL client\n * @param dataCategory - Input\n * @returns Created data category\n */\nexport async function createDataCategory(\n client: GraphQLClient,\n dataCategory: DataCategoryInput,\n): Promise<Pick<DataSubCategory, 'id' | 'name' | 'category'>> {\n const input = {\n name: dataCategory.name,\n category: dataCategory.category,\n description: dataCategory.description,\n // TODO: https://transcend.height.app/T-31994 - add attributes, teams, owners\n };\n\n const { createDataCategory } = await makeGraphQLRequest<{\n /** Create data category mutation */\n createDataCategory: {\n /** Created data category */\n dataCategory: DataSubCategory;\n };\n }>(client, CREATE_DATA_SUB_CATEGORY, {\n input,\n });\n return createDataCategory.dataCategory;\n}\n\n/**\n * Input to update data categories\n *\n * @param client - GraphQL client\n * @param dataCategoryIdPairs - [DataCategoryInput, dataCategoryId] list\n */\nexport async function updateDataCategories(\n client: GraphQLClient,\n dataCategoryIdPairs: [DataCategoryInput, string][],\n): Promise<void> {\n await makeGraphQLRequest(client, UPDATE_DATA_SUB_CATEGORIES, {\n input: {\n dataSubCategories: dataCategoryIdPairs.map(([dataCategory, id]) => ({\n id,\n description: dataCategory.description,\n // TODO: https://transcend.height.app/T-31994 - add teams, owners\n attributes: dataCategory.attributes,\n })),\n },\n });\n}\n\n/**\n * Sync the data inventory data categories\n *\n * @param client - GraphQL client\n * @param inputs - Inputs to create\n * @returns True if run without error, returns false if an error occurred\n */\nexport async function syncDataCategories(\n client: GraphQLClient,\n inputs: DataCategoryInput[],\n): Promise<boolean> {\n // Fetch existing\n logger.info(colors.magenta(`Syncing \"${inputs.length}\" data categories...`));\n\n let encounteredError = false;\n\n // Fetch existing\n const existingDataCategories = await fetchAllDataCategories(client);\n\n // Look up by name\n const dataCategoryByName: {\n [k in string]: Pick<DataSubCategory, 'id' | 'name' | 'category'>;\n } = keyBy(existingDataCategories, ({ name, category }) => `${name}:${category}`);\n\n // Create new data categories\n const newDataCategories = inputs.filter(\n (input) => !dataCategoryByName[`${input.name}:${input.category}`],\n );\n\n // Create new data categories\n await mapSeries(newDataCategories, async (dataCategory) => {\n try {\n const newDataCategory = await createDataCategory(client, dataCategory);\n dataCategoryByName[`${newDataCategory.name}:${newDataCategory.category}`] = newDataCategory;\n logger.info(colors.green(`Successfully synced data category \"${dataCategory.name}\"!`));\n } catch (err) {\n encounteredError = true;\n logger.info(\n colors.red(`Failed to sync data category \"${dataCategory.name}\"! - ${err.message}`),\n );\n }\n });\n\n // Update all data categories\n try {\n logger.info(colors.magenta(`Updating \"${inputs.length}\" data categories!`));\n await updateDataCategories(\n client,\n inputs.map((input) => [input, dataCategoryByName[`${input.name}:${input.category}`].id]),\n );\n logger.info(colors.green(`Successfully synced \"${inputs.length}\" data categories!`));\n } catch (err) {\n encounteredError = true;\n logger.info(colors.red(`Failed to sync \"${inputs.length}\" data categories ! - ${err.message}`));\n }\n\n return !encounteredError;\n}\n","import { GraphQLClient } from 'graphql-request';\n\nimport { DataSubjectInput } from '../../codecs.js';\nimport { UPDATE_DATA_SUBJECT, TOGGLE_DATA_SUBJECT } from './gqls/index.js';\nimport { makeGraphQLRequest } from './makeGraphQLRequest.js';\n\n/**\n * Sync the data subjects\n *\n * @param client - GraphQL client\n * @param options - Options\n */\nexport async function syncDataSubject(\n client: GraphQLClient,\n {\n dataSubject,\n dataSubjectId,\n skipPublish = false,\n }: {\n /** DataSubject update input */\n dataSubject: DataSubjectInput;\n /** Existing data subject Id */\n dataSubjectId: string;\n /** When true, skip publishing to privacy center */\n skipPublish?: boolean;\n },\n): Promise<void> {\n await makeGraphQLRequest(client, UPDATE_DATA_SUBJECT, {\n input: {\n id: dataSubjectId,\n title: dataSubject.title,\n adminDashboardDefaultSilentMode: dataSubject.adminDashboardDefaultSilentMode,\n actions: dataSubject.actions,\n skipPublish: skipPublish && typeof dataSubject.active === 'undefined',\n },\n });\n\n if (typeof dataSubject.active === 'boolean') {\n await makeGraphQLRequest(client, TOGGLE_DATA_SUBJECT, {\n input: {\n id: dataSubjectId,\n active: dataSubject.active,\n skipPublish,\n },\n });\n }\n}\n","import { GraphQLClient } from 'graphql-request';\n\nimport { IdentifierInput } from '../../codecs.js';\nimport type { DataSubject } from './fetchDataSubjects.js';\nimport { UPDATE_IDENTIFIER } from './gqls/index.js';\nimport { makeGraphQLRequest } from './makeGraphQLRequest.js';\n\n/**\n * Sync the consent manager\n *\n * @param client - GraphQL client\n * @param options - Options\n */\nexport async function syncIdentifier(\n client: GraphQLClient,\n {\n identifier,\n dataSubjectsByName,\n identifierId,\n skipPublish = false,\n }: {\n /** Identifier update input */\n identifier: IdentifierInput;\n /** Data subject lookup by name */\n dataSubjectsByName: { [k in string]: DataSubject };\n /** Existing identifier Id */\n identifierId: string;\n /** When true, skip publishing to privacy center */\n skipPublish?: boolean;\n },\n): Promise<void> {\n await makeGraphQLRequest(client, UPDATE_IDENTIFIER, {\n input: {\n id: identifierId,\n selectOptions: identifier.selectOptions,\n isRequiredInForm: identifier.isRequiredInForm,\n regex: identifier.regex,\n placeholder: identifier.placeholder,\n displayTitle: identifier.displayTitle,\n displayDescription: identifier.displayDescription,\n displayOrder: identifier.displayOrder,\n isUniqueOnPreferenceStore: identifier.isUniqueOnPreferenceStore,\n privacyCenterVisibility: identifier.privacyCenterVisibility,\n dataSubjectIds: identifier.dataSubjects\n ? identifier.dataSubjects.map((type) => dataSubjectsByName[type].id)\n : undefined,\n skipPublish,\n },\n });\n}\n","import colors from 'colors';\nimport { GraphQLClient } from 'graphql-request';\nimport { chunk } from 'lodash-es';\n\nimport { IntlMessageInput } from '../../codecs.js';\nimport { logger } from '../../logger.js';\nimport { mapSeries } from '../bluebird.js';\nimport { UPDATE_INTL_MESSAGES } from './gqls/index.js';\nimport { makeGraphQLRequest } from './makeGraphQLRequest.js';\n\nconst MAX_PAGE_SIZE = 100;\n\n/**\n * Update or create intl messages\n *\n * @param client - GraphQL client\n * @param messageInputs - List of message inputs\n */\nexport async function updateIntlMessages(\n client: GraphQLClient,\n messageInputs: IntlMessageInput[],\n): Promise<void> {\n // Batch update messages\n await mapSeries(chunk(messageInputs, MAX_PAGE_SIZE), async (page) => {\n await makeGraphQLRequest(client, UPDATE_INTL_MESSAGES, {\n messages: page.map((message) => ({\n ...(message.id.includes('.') ? {} : { id: message.id }),\n defaultMessage: message.defaultMessage,\n targetReactIntlId: message.targetReactIntlId,\n translations: !message.translations\n ? undefined\n : Object.entries(message.translations).map(([locale, value]) => ({\n locale,\n value,\n })),\n })),\n });\n });\n}\n\n/**\n * Sync the set of messages from the YML interface into the product\n *\n * @param client - GraphQL client\n * @param messages - messages to sync\n * @returns True upon success, false upon failure\n */\nexport async function syncIntlMessages(\n client: GraphQLClient,\n messages: IntlMessageInput[],\n): Promise<boolean> {\n let encounteredError = false;\n logger.info(colors.magenta(`Syncing \"${messages.length}\" messages...`));\n\n // Ensure no duplicates are being uploaded\n const notUnique = messages.filter(\n (message) => messages.filter((pol) => message.id === pol.id).length > 1,\n );\n if (notUnique.length > 0) {\n throw new Error(\n `Failed to upload messages as there were non-unique entries found: ${notUnique\n .map(({ id }) => id)\n .join(',')}`,\n );\n }\n\n try {\n logger.info(colors.magenta(`Upserting \"${messages.length}\" new messages...`));\n await updateIntlMessages(client, messages);\n logger.info(colors.green(`Successfully synced ${messages.length} messages!`));\n } catch (err) {\n encounteredError = true;\n logger.info(colors.red(`Failed to create messages! - ${err.message}`));\n }\n\n return !encounteredError;\n}\n","import colors from 'colors';\nimport { GraphQLClient } from 'graphql-request';\nimport { chunk, keyBy } from 'lodash-es';\n\nimport { PolicyInput } from '../../codecs.js';\nimport { logger } from '../../logger.js';\nimport { mapSeries } from '../bluebird.js';\nimport { fetchAllPolicies } from './fetchAllPolicies.js';\nimport { fetchPrivacyCenterId } from './fetchPrivacyCenterId.js';\nimport { UPDATE_POLICIES } from './gqls/index.js';\nimport { makeGraphQLRequest } from './makeGraphQLRequest.js';\n\nconst MAX_PAGE_SIZE = 100;\n\n/**\n * Update or create policies\n *\n * @param client - GraphQL client\n * @param policyInputs - List of policy input\n */\nexport async function updatePolicies(\n client: GraphQLClient,\n policyInputs: [PolicyInput, string | undefined][],\n): Promise<void> {\n const privacyCenterId = await fetchPrivacyCenterId(client);\n\n // Batch update policies\n await mapSeries(chunk(policyInputs, MAX_PAGE_SIZE), async (page) => {\n await makeGraphQLRequest(client, UPDATE_POLICIES, {\n privacyCenterId,\n policies: page.map(([policy, policyId]) => ({\n id: policyId,\n title: policy.title,\n disableEffectiveOn: policy.disableEffectiveOn,\n disabledLocales: policy.disabledLocales,\n ...(policy.effectiveOn || policy.content\n ? {\n version: {\n ...(policy.effectiveOn ? { effectiveOn: policy.effectiveOn } : {}),\n ...(policy.content\n ? {\n content: {\n defaultMessage: policy.content,\n },\n }\n : {}),\n },\n }\n : {}),\n })),\n });\n });\n}\n\n/**\n * Sync the set of policies from the YML interface into the product\n *\n * @param client - GraphQL client\n * @param policies - policies to sync\n * @returns True upon success, false upon failure\n */\nexport async function syncPolicies(\n client: GraphQLClient,\n policies: PolicyInput[],\n): Promise<boolean> {\n let encounteredError = false;\n logger.info(colors.magenta(`Syncing \"${policies.length}\" policies...`));\n\n // Ensure no duplicates are being uploaded\n const notUnique = policies.filter(\n (policy) => policies.filter((pol) => policy.title === pol.title).length > 1,\n );\n if (notUnique.length > 0) {\n throw new Error(\n `Failed to upload policies as there were non-unique entries found: ${notUnique\n .map(({ title }) => title)\n .join(',')}`,\n );\n }\n\n // Grab existing policies\n const existingPolicies = await fetchAllPolicies(client);\n const policiesById = keyBy(existingPolicies, ({ title }) => title.defaultMessage);\n\n try {\n logger.info(colors.magenta(`Upserting \"${policies.length}\" new policies...`));\n await updatePolicies(\n client,\n policies.map((policy) => [policy, policiesById[policy.title]?.id]),\n );\n logger.info(colors.green(`Successfully synced ${policies.length} policies!`));\n } catch (err) {\n encounteredError = true;\n logger.info(colors.red(`Failed to create policies! - ${err.message}`));\n }\n\n return !encounteredError;\n}\n","import colors from 'colors';\nimport { GraphQLClient } from 'graphql-request';\n\nimport { PrivacyCenterInput } from '../../codecs.js';\nimport { logger } from '../../logger.js';\nimport { fetchPrivacyCenterId } from './fetchPrivacyCenterId.js';\nimport { UPDATE_PRIVACY_CENTER } from './gqls/index.js';\nimport { makeGraphQLRequest } from './makeGraphQLRequest.js';\n\n/**\n * Sync the privacy center\n *\n * @param client - GraphQL client\n * @param privacyCenter - The privacy center input\n * @returns Whether the privacy center was synced successfully\n */\nexport async function syncPrivacyCenter(\n client: GraphQLClient,\n privacyCenter: PrivacyCenterInput,\n): Promise<boolean> {\n let encounteredError = false;\n logger.info(colors.magenta('Syncing privacy center...'));\n\n // Grab the privacy center ID\n const privacyCenterId = await fetchPrivacyCenterId(client);\n\n try {\n await makeGraphQLRequest(client, UPDATE_PRIVACY_CENTER, {\n input: {\n privacyCenterId,\n transformAccessReportJsonToCsv: privacyCenter.transformAccessReportJsonToCsv,\n useCustomEmailDomain: privacyCenter.useCustomEmailDomain,\n useNoReplyEmailAddress: privacyCenter.useNoReplyEmailAddress,\n replyToEmail: privacyCenter.replyToEmail,\n supportEmail: privacyCenter.supportEmail,\n preferBrowserDefaultLocale: privacyCenter.preferBrowserDefaultLocale,\n defaultLocale: privacyCenter.defaultLocale,\n locales: privacyCenter.locales,\n showMarketingPreferences: privacyCenter.showMarketingPreferences,\n showManageYourPrivacy: privacyCenter.showManageYourPrivacy,\n showPolicies: privacyCenter.showPolicies,\n showConsentManager: privacyCenter.showConsentManager,\n showDataFlows: privacyCenter.showDataFlows,\n showCookies: privacyCenter.showCookies,\n showTrackingTechnologies: privacyCenter.showTrackingTechnologies,\n showPrivacyRequestButton: privacyCenter.showPrivacyRequestButton,\n isDisabled: privacyCenter.isDisabled,\n ...(privacyCenter.theme\n ? {\n colorPalette: privacyCenter.theme.colors,\n componentStyles: privacyCenter.theme.componentStyles,\n textStyles: privacyCenter.theme.textStyles,\n }\n : {}),\n },\n });\n logger.info(colors.green('Successfully synced privacy center!'));\n } catch (err) {\n encounteredError = true;\n logger.info(colors.red(`Failed to create privacy center! - ${err.message}`));\n }\n\n return !encounteredError;\n}\n","import colors from 'colors';\nimport { GraphQLClient } from 'graphql-request';\nimport { keyBy } from 'lodash-es';\n\nimport { ProcessingActivityInput } from '../../codecs.js';\nimport { logger } from '../../logger.js';\nimport { mapSeries } from '../bluebird.js';\nimport {\n fetchAllProcessingActivities,\n ProcessingActivity,\n} from './fetchAllProcessingActivities.js';\nimport { UPDATE_PROCESSING_ACTIVITIES, CREATE_PROCESSING_ACTIVITY } from './gqls/index.js';\nimport { makeGraphQLRequest } from './makeGraphQLRequest.js';\n\n/**\n * Create a new processing activity, setting only title and description\n *\n * @param client - GraphQL client\n * @param processingActivity - Input\n * @returns Created processingActivity\n */\nasync function createProcessingActivity(\n client: GraphQLClient,\n processingActivity: ProcessingActivityInput,\n): Promise<Pick<ProcessingActivity, 'id' | 'title'>> {\n const input = {\n title: processingActivity.title,\n description: processingActivity.description,\n };\n\n const { createProcessingActivity } = await makeGraphQLRequest<{\n /** Create processingActivity mutation */\n createProcessingActivity: {\n /** Created processingActivity */\n processingActivity: ProcessingActivity;\n };\n }>(client, CREATE_PROCESSING_ACTIVITY, {\n input,\n });\n return createProcessingActivity.processingActivity;\n}\n\n/**\n * Update a list of processing activities.\n *\n * @param client - GraphQL client\n * @param processingActivityIdPairs - [ProcessingActivityInput, processingActivityId] list\n */\nasync function updateProcessingActivities(\n client: GraphQLClient,\n processingActivityIdPairs: [ProcessingActivityInput, string][],\n): Promise<void> {\n const invalidProcessingActivityTitles = processingActivityIdPairs\n .filter(([, id]) => id === undefined)\n .map(([{ title }]) => title);\n if (invalidProcessingActivityTitles.length > 0) {\n // We always attempt to create processing activities before updating them, but if creation failed\n // (for example, due to insufficient scope), this provides a better error message\n throw new Error(\n `The following ${\n invalidProcessingActivityTitles.length\n } processing activities do not exist and thus can't be updated: \"${invalidProcessingActivityTitles.join(\n '\", \"',\n )}\"`,\n );\n }\n await makeGraphQLRequest(client, UPDATE_PROCESSING_ACTIVITIES, {\n input: {\n processingActivities: processingActivityIdPairs.map(\n ([\n { processingSubPurposes, dataSubCategories, saaSCategories, ...processingActivity },\n id,\n ]) => ({\n dataSubCategoryInputs: dataSubCategories?.map(({ category, name }) => ({\n category,\n name: name ?? '',\n })),\n processingPurposeSubCategoryInputs: processingSubPurposes?.map(({ purpose, name }) => ({\n purpose,\n name: name ?? 'Other',\n })),\n saaSCategoryTitles: saaSCategories,\n ...processingActivity,\n id,\n }),\n ),\n },\n });\n}\n\n/**\n * Sync the data inventory processing activities\n *\n * @param client - GraphQL client\n * @param inputs - Inputs to create\n * @returns True if run without error, returns false if an error occurred\n */\nexport async function syncProcessingActivities(\n client: GraphQLClient,\n inputs: ProcessingActivityInput[],\n): Promise<boolean> {\n let encounteredError = false;\n\n // Fetch existing\n logger.info(colors.magenta(`Syncing \"${inputs.length}\" processing activities...`));\n const existingProcessingActivities = await fetchAllProcessingActivities(client);\n\n // Look up by title\n const processingActivityByTitle: Record<string, Pick<ProcessingActivity, 'id' | 'title'>> = keyBy(\n existingProcessingActivities,\n 'title',\n );\n\n // Create new processingActivities\n const newProcessingActivities = inputs.filter((input) => !processingActivityByTitle[input.title]);\n if (newProcessingActivities.length > 0) {\n logger.info(\n colors.magenta(`Creating \"${newProcessingActivities.length}\" new processing activities...`),\n );\n }\n await mapSeries(newProcessingActivities, async (processingActivity) => {\n try {\n const newProcessingActivity = await createProcessingActivity(client, processingActivity);\n // Augment processingActivityByTitle with newly-created processing activity\n processingActivityByTitle[newProcessingActivity.title] = newProcessingActivity;\n logger.info(\n colors.green(`Successfully created processing activity \"${processingActivity.title}\"!`),\n );\n } catch (err) {\n encounteredError = true;\n logger.info(\n colors.red(\n `Failed to create processing activity \"${processingActivity.title}\"! - ${err.message}`,\n ),\n );\n }\n });\n\n // Update all processing activities\n try {\n logger.info(colors.magenta(`Updating \"${inputs.length}\" processing activities!`));\n await updateProcessingActivities(\n client,\n inputs.map((input) => [\n input,\n // This processing activity might not exist if the `create` step failed\n processingActivityByTitle[input.title]?.id,\n ]),\n );\n logger.info(colors.green(`Successfully synced \"${inputs.length}\" processingActivities!`));\n } catch (err) {\n encounteredError = true;\n logger.info(\n colors.red(`Failed to sync \"${inputs.length}\" processingActivities! - ${err.message}`),\n );\n }\n\n return !encounteredError;\n}\n","import colors from 'colors';\nimport { GraphQLClient } from 'graphql-request';\nimport { keyBy } from 'lodash-es';\n\nimport { ProcessingPurposeInput } from '../../codecs.js';\nimport { logger } from '../../logger.js';\nimport { mapSeries } from '../bluebird.js';\nimport {\n fetchAllProcessingPurposes,\n ProcessingPurposeSubCategory,\n} from './fetchAllProcessingPurposes.js';\nimport {\n UPDATE_PROCESSING_PURPOSE_SUB_CATEGORIES,\n CREATE_PROCESSING_PURPOSE_SUB_CATEGORY,\n} from './gqls/index.js';\nimport { makeGraphQLRequest } from './makeGraphQLRequest.js';\n\n/**\n * Input to create a new processing purpose\n *\n * @param client - GraphQL client\n * @param processingPurpose - Input\n * @returns Created processing purpose\n */\nexport async function createProcessingPurpose(\n client: GraphQLClient,\n processingPurpose: ProcessingPurposeInput,\n): Promise<Pick<ProcessingPurposeSubCategory, 'id' | 'name' | 'purpose'>> {\n const input = {\n name: processingPurpose.name,\n purpose: processingPurpose.purpose,\n description: processingPurpose.description,\n // TODO: https://transcend.height.app/T-31994 - add attributes, teams, owners\n };\n\n const { createProcessingPurposeSubCategory } = await makeGraphQLRequest<{\n /** Create processing purpose mutation */\n createProcessingPurposeSubCategory: {\n /** Created processing purpose */\n processingPurposeSubCategory: ProcessingPurposeSubCategory;\n };\n }>(client, CREATE_PROCESSING_PURPOSE_SUB_CATEGORY, {\n input,\n });\n return createProcessingPurposeSubCategory.processingPurposeSubCategory;\n}\n\n/**\n * Input to update processing purposes\n *\n * @param client - GraphQL client\n * @param processingPurposeIdPairs - [ProcessingPurposeInput, processingPurposeId] list\n */\nexport async function updateProcessingPurposes(\n client: GraphQLClient,\n processingPurposeIdPairs: [ProcessingPurposeInput, string][],\n): Promise<void> {\n await makeGraphQLRequest(client, UPDATE_PROCESSING_PURPOSE_SUB_CATEGORIES, {\n input: {\n processingPurposeSubCategories: processingPurposeIdPairs.map(([processingPurpose, id]) => ({\n id,\n description: processingPurpose.description,\n // TODO: https://transcend.height.app/T-31994 - add teams, owners\n attributes: processingPurpose.attributes,\n })),\n },\n });\n}\n\n/**\n * Sync the data inventory processing purposes\n *\n * @param client - GraphQL client\n * @param inputs - Inputs to create\n * @returns True if run without error, returns false if an error occurred\n */\nexport async function syncProcessingPurposes(\n client: GraphQLClient,\n inputs: ProcessingPurposeInput[],\n): Promise<boolean> {\n // Fetch existing\n logger.info(colors.magenta(`Syncing \"${inputs.length}\" processing purposes...`));\n\n let encounteredError = false;\n\n // Fetch existing\n const existingProcessingPurposes = await fetchAllProcessingPurposes(client);\n\n // Look up by name\n const processingPurposeByName: {\n [k in string]: Pick<ProcessingPurposeSubCategory, 'id' | 'name'>;\n } = keyBy(existingProcessingPurposes, ({ name, purpose }) => `${name}:${purpose}`);\n\n // Create new processing purposes\n const newProcessingPurposes = inputs.filter(\n (input) => !processingPurposeByName[`${input.name}:${input.purpose}`],\n );\n\n // Create new processing purposes\n await mapSeries(newProcessingPurposes, async (processingPurpose) => {\n try {\n const newProcessingPurpose = await createProcessingPurpose(client, processingPurpose);\n processingPurposeByName[`${newProcessingPurpose.name}:${newProcessingPurpose.purpose}`] =\n newProcessingPurpose;\n logger.info(\n colors.green(`Successfully synced processing purpose \"${processingPurpose.name}\"!`),\n );\n } catch (err) {\n encounteredError = true;\n logger.info(\n colors.red(\n `Failed to sync processing purpose \"${processingPurpose.name}\"! - ${err.message}`,\n ),\n );\n }\n });\n\n // Update all processing purposes\n try {\n logger.info(colors.magenta(`Updating \"${inputs.length}\" processing purposes!`));\n await updateProcessingPurposes(\n client,\n inputs.map((input) => [input, processingPurposeByName[`${input.name}:${input.purpose}`].id]),\n );\n logger.info(colors.green(`Successfully synced \"${inputs.length}\" processing purposes!`));\n } catch (err) {\n encounteredError = true;\n logger.info(\n colors.red(`Failed to sync \"${inputs.length}\" processing purposes ! - ${err.message}`),\n );\n }\n\n return !encounteredError;\n}\n","import colors from 'colors';\nimport { GraphQLClient } from 'graphql-request';\nimport { keyBy } from 'lodash-es';\n\nimport { PromptInput } from '../../codecs.js';\nimport { logger } from '../../logger.js';\nimport { map } from '../bluebird.js';\nimport { fetchAllPrompts } from './fetchPrompts.js';\nimport { UPDATE_PROMPTS, CREATE_PROMPT } from './gqls/index.js';\nimport { makeGraphQLRequest } from './makeGraphQLRequest.js';\n\n/**\n * Create a new prompt\n *\n * @param client - GraphQL client\n * @param input - Prompt input\n * @returns Prompt ID\n */\nexport async function createPrompt(\n client: GraphQLClient,\n input: {\n /** Title of prompt */\n title: string;\n /** Prompt content */\n content: string;\n },\n): Promise<string> {\n const {\n createPrompt: { prompt },\n } = await makeGraphQLRequest<{\n /** createPrompt mutation */\n createPrompt: {\n /** Prompt */\n prompt: {\n /** ID */\n id: string;\n };\n };\n }>(client, CREATE_PROMPT, {\n // TODO: https://transcend.height.app/T-31994 - include models and groups, teams, users\n input,\n });\n logger.info(colors.green(`Successfully created prompt \"${input.title}\"!`));\n return prompt.id;\n}\n\n/**\n * Update a set of existing prompts\n *\n * @param client - GraphQL client\n * @param input - Prompt input\n */\nexport async function updatePrompts(\n client: GraphQLClient,\n input: [PromptInput, string][],\n): Promise<void> {\n await makeGraphQLRequest(client, UPDATE_PROMPTS, {\n input: {\n prompts: input.map(([input, id]) => ({\n ...input,\n id,\n })),\n },\n });\n logger.info(colors.green(`Successfully updated ${input.length} prompts!`));\n}\n\n/**\n * Sync the prompts\n *\n * @param client - GraphQL client\n * @param prompts - Prompts\n * @param concurrency - Concurrency\n * @returns True if synced successfully\n */\nexport async function syncPrompts(\n client: GraphQLClient,\n prompts: PromptInput[],\n concurrency = 20,\n): Promise<boolean> {\n let encounteredError = false;\n logger.info(colors.magenta(`Syncing \"${prompts.length}\" prompts...`));\n\n // Index existing prompts\n const existing = await fetchAllPrompts(client);\n const promptByTitle = keyBy(existing, 'title');\n\n // Determine which prompts are new vs existing\n const mapPromptsToExisting = prompts.map((promptInput) => [\n promptInput,\n promptByTitle[promptInput.title]?.id,\n ]);\n\n // Create the new prompts\n const newPrompts = mapPromptsToExisting\n .filter(([, existing]) => !existing)\n .map(([promptInput]) => promptInput as PromptInput);\n try {\n logger.info(colors.magenta(`Creating \"${newPrompts.length}\" new prompts...`));\n await map(\n newPrompts,\n async (prompt) => {\n await createPrompt(client, prompt);\n },\n {\n concurrency,\n },\n );\n logger.info(colors.green(`Successfully synced ${newPrompts.length} prompts!`));\n } catch (err) {\n encounteredError = true;\n logger.info(colors.red(`Failed to create prompts! - ${err.message}`));\n }\n\n // Update existing prompts\n const existingPrompts = mapPromptsToExisting.filter((x): x is [PromptInput, string] => !!x[1]);\n try {\n logger.info(colors.magenta(`Updating \"${existingPrompts.length}\" prompts...`));\n await updatePrompts(client, existingPrompts);\n logger.info(colors.green(`Successfully updated \"${existingPrompts.length}\" prompts!`));\n } catch (err) {\n encounteredError = true;\n logger.info(colors.red(`Failed to create prompts! - ${err.message}`));\n }\n\n logger.info(colors.green(`Synced \"${prompts.length}\" prompts!`));\n\n // Return true upon success\n return !encounteredError;\n}\n","import colors from 'colors';\nimport { GraphQLClient } from 'graphql-request';\nimport { keyBy } from 'lodash-es';\n\nimport { VendorInput } from '../../codecs.js';\nimport { logger } from '../../logger.js';\nimport { mapSeries } from '../bluebird.js';\nimport { fetchAllVendors, Vendor } from './fetchAllVendors.js';\nimport { UPDATE_VENDORS, CREATE_VENDOR } from './gqls/index.js';\nimport { makeGraphQLRequest } from './makeGraphQLRequest.js';\n\n/**\n * Input to create a new vendor\n *\n * @param client - GraphQL client\n * @param vendor - Input\n * @returns Created vendor\n */\nexport async function createVendor(\n client: GraphQLClient,\n vendor: VendorInput,\n): Promise<Pick<Vendor, 'id' | 'title'>> {\n const input = {\n title: vendor.title,\n description: vendor.description,\n address: vendor.address,\n headquarterCountry: vendor.headquarterCountry,\n headquarterSubDivision: vendor.headquarterSubDivision,\n dataProcessingAgreementLink: vendor.dataProcessingAgreementLink,\n contactName: vendor.contactName,\n contactPhone: vendor.contactPhone,\n websiteUrl: vendor.websiteUrl,\n // TODO: https://transcend.height.app/T-31994 - add attributes, teams, owners\n };\n\n const { createVendor } = await makeGraphQLRequest<{\n /** Create vendor mutation */\n createVendor: {\n /** Created vendor */\n vendor: Vendor;\n };\n }>(client, CREATE_VENDOR, {\n input,\n });\n return createVendor.vendor;\n}\n\n/**\n * Input to update vendors\n *\n * @param client - GraphQL client\n * @param vendorIdParis - [VendorInput, vendorId] list\n */\nexport async function updateVendors(\n client: GraphQLClient,\n vendorIdParis: [VendorInput, string][],\n): Promise<void> {\n await makeGraphQLRequest(client, UPDATE_VENDORS, {\n input: {\n vendors: vendorIdParis.map(([vendor, id]) => ({\n id,\n title: vendor.title,\n description: vendor.description,\n address: vendor.address,\n headquarterCountry: vendor.headquarterCountry,\n headquarterSubDivision: vendor.headquarterSubDivision,\n dataProcessingAgreementLink: vendor.dataProcessingAgreementLink,\n contactName: vendor.contactName,\n contactPhone: vendor.contactPhone,\n websiteUrl: vendor.websiteUrl,\n // TODO: https://transcend.height.app/T-31994 - add teams, owners\n attributes: vendor.attributes,\n })),\n },\n });\n}\n\n/**\n * Sync the data inventory vendors\n *\n * @param client - GraphQL client\n * @param inputs - Inputs to create\n * @returns True if run without error, returns false if an error occurred\n */\nexport async function syncVendors(client: GraphQLClient, inputs: VendorInput[]): Promise<boolean> {\n // Fetch existing\n logger.info(colors.magenta(`Syncing \"${inputs.length}\" vendors...`));\n\n let encounteredError = false;\n\n // Fetch existing\n const existingVendors = await fetchAllVendors(client);\n\n // Look up by title\n const vendorByTitle: { [k in string]: Pick<Vendor, 'id' | 'title'> } = keyBy(\n existingVendors,\n 'title',\n );\n\n // Create new vendors\n const newVendors = inputs.filter((input) => !vendorByTitle[input.title]);\n\n // Create new vendors\n await mapSeries(newVendors, async (vendor) => {\n try {\n const newVendor = await createVendor(client, vendor);\n vendorByTitle[newVendor.title] = newVendor;\n logger.info(colors.green(`Successfully synced vendor \"${vendor.title}\"!`));\n } catch (err) {\n encounteredError = true;\n logger.info(colors.red(`Failed to sync vendor \"${vendor.title}\"! - ${err.message}`));\n }\n });\n\n // Update all vendors\n try {\n logger.info(colors.magenta(`Updating \"${inputs.length}\" vendors!`));\n await updateVendors(\n client,\n inputs.map((input) => [input, vendorByTitle[input.title].id]),\n );\n logger.info(colors.green(`Successfully synced \"${inputs.length}\" vendors!`));\n } catch (err) {\n encounteredError = true;\n logger.info(colors.red(`Failed to sync \"${inputs.length}\" vendors ! - ${err.message}`));\n }\n\n return !encounteredError;\n}\n","/**\n * Parse variables from string\n *\n * @param variables - Variables as string\n * @returns Variables as object\n */\nexport function parseVariablesFromString(variables: string): {\n [k in string]: string;\n} {\n // Parse out the variables\n const splitVars = variables.split(',').filter((x) => !!x);\n const vars: { [k in string]: string } = {};\n splitVars.forEach((variable) => {\n const [k, v] = variable.split(':');\n if (!k || !v) {\n throw new Error(`Invalid variable: ${variable}. Expected format: key:value`);\n }\n vars[k] = v;\n });\n return vars;\n}\n","import colors from 'colors';\nimport { GraphQLClient } from 'graphql-request';\nimport { keyBy } from 'lodash-es';\n\nimport { PromptGroupInput } from '../../codecs.js';\nimport { logger } from '../../logger.js';\nimport { map } from '../bluebird.js';\nimport { fetchAllPromptGroups } from './fetchPromptGroups.js';\nimport { fetchAllPrompts } from './fetchPrompts.js';\nimport { UPDATE_PROMPT_GROUPS, CREATE_PROMPT_GROUP } from './gqls/index.js';\nimport { makeGraphQLRequest } from './makeGraphQLRequest.js';\n\nexport interface EditPromptGroupInput {\n /** Title of prompt group */\n title: string;\n /** Prompt group description */\n description: string;\n /** Prompt IDs */\n promptIds: string[];\n}\n\n/**\n * Create a new prompt group\n *\n * @param client - GraphQL client\n * @param input - Prompt input\n * @returns Prompt group ID\n */\nexport async function createPromptGroup(\n client: GraphQLClient,\n input: EditPromptGroupInput,\n): Promise<string> {\n const {\n createPromptGroup: { promptGroup },\n } = await makeGraphQLRequest<{\n /** createPromptGroup mutation */\n createPromptGroup: {\n /** Prompt group */\n promptGroup: {\n /** ID */\n id: string;\n };\n };\n }>(client, CREATE_PROMPT_GROUP, {\n input,\n });\n logger.info(colors.green(`Successfully created prompt group \"${input.title}\"!`));\n return promptGroup.id;\n}\n\n/**\n * Update a set of existing prompt groups\n *\n * @param client - GraphQL client\n * @param input - Prompt input\n */\nexport async function updatePromptGroups(\n client: GraphQLClient,\n input: [EditPromptGroupInput, string][],\n): Promise<void> {\n await makeGraphQLRequest(client, UPDATE_PROMPT_GROUPS, {\n input: {\n promptGroups: input.map(([input, id]) => ({\n ...input,\n id,\n })),\n },\n });\n logger.info(colors.green(`Successfully updated ${input.length} prompt groups!`));\n}\n\n/**\n * Sync the prompt groups\n *\n * @param client - GraphQL client\n * @param promptGroups - PromptGroups\n * @param concurrency - Concurrency\n * @returns True if synced successfully\n */\nexport async function syncPromptGroups(\n client: GraphQLClient,\n promptGroups: PromptGroupInput[],\n concurrency = 20,\n): Promise<boolean> {\n let encounteredError = false;\n logger.info(colors.magenta(`Syncing \"${promptGroups.length}\" prompt groups...`));\n\n // Index existing prompt groups\n const existing = await fetchAllPromptGroups(client);\n const existingPrompts = await fetchAllPrompts(client);\n const promptByTitle = keyBy(existingPrompts, 'title');\n const promptGroupByTitle = keyBy(existing, 'title');\n\n // Determine which promptGroups are new vs existing\n const mapPromptGroupsToExisting = promptGroups.map((promptInput) => [\n promptInput,\n promptGroupByTitle[promptInput.title]?.id,\n ]);\n\n // Create the new promptGroups\n const newPromptGroups = mapPromptGroupsToExisting\n .filter(([, existing]) => !existing)\n .map(([promptInput]) => promptInput as PromptGroupInput);\n try {\n logger.info(colors.magenta(`Creating \"${newPromptGroups.length}\" new prompt groups...`));\n await map(\n newPromptGroups,\n async (prompt) => {\n await createPromptGroup(client, {\n ...prompt,\n promptIds: prompt.prompts.map((title) => {\n const prompt = promptByTitle[title];\n if (!prompt) {\n throw new Error(`Failed to find prompt with title: \"${title}\"`);\n }\n return prompt.id;\n }),\n });\n },\n {\n concurrency,\n },\n );\n logger.info(colors.green(`Successfully synced ${newPromptGroups.length} prompt groups!`));\n } catch (err) {\n encounteredError = true;\n logger.info(colors.red(`Failed to create prompt groups! - ${err.message}`));\n }\n\n // Update existing promptGroups\n const existingPromptGroups = mapPromptGroupsToExisting.filter(\n (x): x is [PromptGroupInput, string] => !!x[1],\n );\n try {\n logger.info(colors.magenta(`Updating \"${existingPromptGroups.length}\" prompt groups...`));\n await updatePromptGroups(\n client,\n existingPromptGroups.map(([{ prompts, ...input }, id]) => [\n {\n ...input,\n promptIds: prompts.map((title) => {\n const prompt = promptByTitle[title];\n if (!prompt) {\n throw new Error(`Failed to find prompt with title: \"${title}\"`);\n }\n return prompt.id;\n }),\n },\n id,\n ]),\n );\n logger.info(\n colors.green(`Successfully updated \"${existingPromptGroups.length}\" prompt groups!`),\n );\n } catch (err) {\n encounteredError = true;\n logger.info(colors.red(`Failed to create prompt groups! - ${err.message}`));\n }\n\n logger.info(colors.green(`Synced \"${promptGroups.length}\" prompt groups!`));\n\n // Return true upon success\n return !encounteredError;\n}\n","import colors from 'colors';\nimport { GraphQLClient } from 'graphql-request';\nimport { keyBy } from 'lodash-es';\n\nimport { PromptPartialInput } from '../../codecs.js';\nimport { logger } from '../../logger.js';\nimport { map } from '../bluebird.js';\nimport { fetchAllPromptPartials } from './fetchPromptPartials.js';\nimport { UPDATE_PROMPT_PARTIALS, CREATE_PROMPT_PARTIAL } from './gqls/index.js';\nimport { makeGraphQLRequest } from './makeGraphQLRequest.js';\n\n/**\n * Create a new prompt partial\n *\n * @param client - GraphQL client\n * @param input - Prompt input\n * @returns Prompt partial ID\n */\nexport async function createPromptPartial(\n client: GraphQLClient,\n input: {\n /** Title of prompt partial */\n title: string;\n /** Prompt content */\n content: string;\n },\n): Promise<string> {\n const {\n createPromptPartial: { promptPartial },\n } = await makeGraphQLRequest<{\n /** createPromptPartial mutation */\n createPromptPartial: {\n /** Prompt partial */\n promptPartial: {\n /** ID */\n id: string;\n };\n };\n }>(client, CREATE_PROMPT_PARTIAL, {\n input,\n });\n logger.info(colors.green(`Successfully created prompt partial \"${input.title}\"!`));\n return promptPartial.id;\n}\n\n/**\n * Update a set of existing prompt partials\n *\n * @param client - GraphQL client\n * @param input - Prompt input\n */\nexport async function updatePromptPartials(\n client: GraphQLClient,\n input: [PromptPartialInput, string][],\n): Promise<void> {\n await makeGraphQLRequest(client, UPDATE_PROMPT_PARTIALS, {\n input: {\n promptPartials: input.map(([input, id]) => ({\n ...input,\n id,\n })),\n },\n });\n logger.info(colors.green(`Successfully updated ${input.length} prompt partials!`));\n}\n\n/**\n * Sync the prompt partials\n *\n * @param client - GraphQL client\n * @param promptPartials - PromptPartials\n * @param concurrency - Concurrency\n * @returns True if synced successfully\n */\nexport async function syncPromptPartials(\n client: GraphQLClient,\n promptPartials: PromptPartialInput[],\n concurrency = 20,\n): Promise<boolean> {\n let encounteredError = false;\n logger.info(colors.magenta(`Syncing \"${promptPartials.length}\" prompt partials...`));\n\n // Index existing prompt partials\n const existing = await fetchAllPromptPartials(client);\n const promptPartialByTitle = keyBy(existing, 'title');\n\n // Determine which promptPartials are new vs existing\n const mapPromptPartialsToExisting = promptPartials.map((promptInput) => [\n promptInput,\n promptPartialByTitle[promptInput.title]?.id,\n ]);\n\n // Create the new promptPartials\n const newPromptPartials = mapPromptPartialsToExisting\n .filter(([, existing]) => !existing)\n .map(([promptInput]) => promptInput as PromptPartialInput);\n try {\n logger.info(colors.magenta(`Creating \"${newPromptPartials.length}\" new prompt partials...`));\n await map(\n newPromptPartials,\n async (prompt) => {\n await createPromptPartial(client, prompt);\n },\n {\n concurrency,\n },\n );\n logger.info(colors.green(`Successfully synced ${newPromptPartials.length} prompt partials!`));\n } catch (err) {\n encounteredError = true;\n logger.info(colors.red(`Failed to create prompt partials! - ${err.message}`));\n }\n\n // Update existing promptPartials\n const existingPromptPartials = mapPromptPartialsToExisting.filter(\n (x): x is [PromptPartialInput, string] => !!x[1],\n );\n try {\n logger.info(colors.magenta(`Updating \"${existingPromptPartials.length}\" prompt partials...`));\n await updatePromptPartials(client, existingPromptPartials);\n logger.info(\n colors.green(`Successfully updated \"${existingPromptPartials.length}\" prompt partials!`),\n );\n } catch (err) {\n encounteredError = true;\n logger.info(colors.red(`Failed to create prompt partials! - ${err.message}`));\n }\n\n logger.info(colors.green(`Synced \"${promptPartials.length}\" prompt partials!`));\n\n // Return true upon success\n return !encounteredError;\n}\n","import colors from 'colors';\nimport { GraphQLClient } from 'graphql-request';\nimport { keyBy } from 'lodash-es';\n\nimport { TeamInput } from '../../codecs.js';\nimport { logger } from '../../logger.js';\nimport { mapSeries } from '../bluebird.js';\nimport { fetchAllTeams, Team } from './fetchAllTeams.js';\nimport { UPDATE_TEAM, CREATE_TEAM } from './gqls/index.js';\nimport { makeGraphQLRequest } from './makeGraphQLRequest.js';\n\n/**\n * Input to create a new team\n *\n * @param client - GraphQL client\n * @param team - Input\n * @returns Created team\n */\nexport async function createTeam(\n client: GraphQLClient,\n team: TeamInput,\n): Promise<Pick<Team, 'id' | 'name'>> {\n const input = {\n name: team.name,\n description: team.description,\n ssoTitle: team['sso-title'],\n ssoDepartment: team['sso-department'],\n ssoGroup: team['sso-group'],\n scopes: team.scopes,\n userEmails: team.users,\n };\n\n const { createTeam } = await makeGraphQLRequest<{\n /** Create team mutation */\n createTeam: {\n /** Created team */\n team: Team;\n };\n }>(client, CREATE_TEAM, {\n input,\n });\n return createTeam.team;\n}\n\n/**\n * Input to update teams\n *\n * @param client - GraphQL client\n * @param input - Team input to update\n * @param teamId - ID of team\n * @returns Updated team\n */\nexport async function updateTeam(\n client: GraphQLClient,\n input: TeamInput,\n teamId: string,\n): Promise<Pick<Team, 'id' | 'name'>> {\n const { updateTeam } = await makeGraphQLRequest<{\n /** Update team mutation */\n updateTeam: {\n /** Updated team */\n team: Team;\n };\n }>(client, UPDATE_TEAM, {\n input: {\n id: teamId,\n name: input.name,\n description: input.description,\n ssoTitle: input['sso-title'],\n ssoDepartment: input['sso-department'],\n ssoGroup: input['sso-group'],\n scopes: input.scopes,\n userEmails: input.users,\n },\n });\n return updateTeam.team;\n}\n\n/**\n * Sync the teams\n *\n * @param client - GraphQL client\n * @param inputs - Inputs to create\n * @returns True if run without error, returns false if an error occurred\n */\nexport async function syncTeams(client: GraphQLClient, inputs: TeamInput[]): Promise<boolean> {\n // Fetch existing\n logger.info(colors.magenta(`Syncing \"${inputs.length}\" teams...`));\n\n let encounteredError = false;\n\n // Fetch existing\n const existingTeams = await fetchAllTeams(client);\n\n // Look up by name\n const teamsByName: { [k in string]: Pick<Team, 'id' | 'name'> } = keyBy(existingTeams, 'name');\n\n // Create new teams\n const newTeams = inputs.filter((input) => !teamsByName[input.name]);\n const updatedTeams = inputs.filter((input) => !!teamsByName[input.name]);\n\n // Create new teams\n await mapSeries(newTeams, async (team) => {\n try {\n const newTeam = await createTeam(client, team);\n teamsByName[newTeam.name] = newTeam;\n logger.info(colors.green(`Successfully created team \"${team.name}\"!`));\n } catch (err) {\n encounteredError = true;\n logger.info(colors.red(`Failed to sync team \"${team.name}\"! - ${err.message}`));\n }\n });\n\n // Update all teams\n await mapSeries(updatedTeams, async (input) => {\n try {\n const newTeam = await updateTeam(client, input, teamsByName[input.name].id);\n teamsByName[newTeam.name] = newTeam;\n logger.info(colors.green(`Successfully updated team \"${input.name}\"!`));\n } catch (err) {\n encounteredError = true;\n logger.info(colors.red(`Failed to sync team \"${input.name}\"! - ${err.message}`));\n }\n });\n\n return !encounteredError;\n}\n","import colors from 'colors';\nimport { GraphQLClient } from 'graphql-request';\n\n/* eslint-disable max-lines */\nimport { TranscendInput } from '../../codecs.js';\nimport { logger } from '../../logger.js';\nimport { map } from '../bluebird.js';\nimport { fetchAllActions } from './fetchAllActions.js';\nimport { fetchAllAttributes } from './fetchAllAttributes.js';\nimport { fetchApiKeys } from './fetchApiKeys.js';\nimport { fetchAllDataSubjects, ensureAllDataSubjectsExist } from './fetchDataSubjects.js';\nimport { fetchIdentifiersAndCreateMissing, Identifier } from './fetchIdentifiers.js';\nimport { syncAction } from './syncAction.js';\nimport { syncActionItemCollections } from './syncActionItemCollections.js';\nimport { syncActionItems } from './syncActionItems.js';\nimport { syncAgentFiles } from './syncAgentFiles.js';\nimport { syncAgentFunctions } from './syncAgentFunctions.js';\nimport { syncAgents } from './syncAgents.js';\nimport { syncAttribute } from './syncAttribute.js';\nimport { syncBusinessEntities } from './syncBusinessEntities.js';\nimport { syncConsentManager } from './syncConsentManager.js';\nimport { syncCookies } from './syncCookies.js';\nimport { syncDataCategories } from './syncDataCategories.js';\nimport { syncDataFlows } from './syncDataFlows.js';\nimport { syncDataSiloDependencies, syncDataSilos } from './syncDataSilos.js';\nimport { syncDataSubject } from './syncDataSubject.js';\nimport { syncEnricher } from './syncEnrichers.js';\nimport { syncIdentifier } from './syncIdentifier.js';\nimport { syncIntlMessages } from './syncIntlMessages.js';\nimport { syncPartitions } from './syncPartitions.js';\nimport { syncPolicies } from './syncPolicies.js';\nimport { syncPrivacyCenter } from './syncPrivacyCenter.js';\nimport { syncProcessingActivities } from './syncProcessingActivities.js';\nimport { syncProcessingPurposes } from './syncProcessingPurposes.js';\nimport { syncPromptGroups } from './syncPromptGroups.js';\nimport { syncPromptPartials } from './syncPromptPartials.js';\nimport { syncPrompts } from './syncPrompts.js';\nimport { syncTeams } from './syncTeams.js';\nimport { syncTemplate } from './syncTemplates.js';\nimport { syncVendors } from './syncVendors.js';\n\nconst CONCURRENCY = 10;\n\n/**\n * Sync the yaml input back to Transcend using the GraphQL APIs\n *\n * @param input - The yml input\n * @param client - GraphQL client\n * @param pageSize - Page size\n * @returns True if an error was encountered\n */\nexport async function syncConfigurationToTranscend(\n input: TranscendInput,\n client: GraphQLClient,\n {\n pageSize = 50,\n // TODO: https://transcend.height.app/T-23779\n publishToPrivacyCenter = true,\n classifyService = false,\n deleteExtraAttributeValues = false,\n }: {\n /** Page size */\n pageSize?: number;\n /** When true, skip publishing to privacy center */\n publishToPrivacyCenter?: boolean;\n /** When true, delete any attributes being synced up */\n deleteExtraAttributeValues?: boolean;\n /** classify data flow service if missing */\n classifyService?: boolean;\n },\n): Promise<boolean> {\n let encounteredError = false;\n\n logger.info(colors.magenta(`Fetching data with page size ${pageSize}...`));\n\n const {\n templates,\n attributes,\n actions,\n identifiers,\n 'data-subjects': dataSubjects,\n 'business-entities': businessEntities,\n enrichers,\n cookies,\n 'consent-manager': consentManager,\n 'data-silos': dataSilos,\n 'data-flows': dataFlows,\n prompts,\n 'prompt-groups': promptGroups,\n 'prompt-partials': promptPartials,\n agents,\n 'agent-functions': agentFunctions,\n 'agent-files': agentFiles,\n vendors,\n 'data-categories': dataCategories,\n 'processing-activities': processingActivities,\n 'processing-purposes': processingPurposes,\n 'action-items': actionItems,\n 'action-item-collections': actionItemCollections,\n teams,\n 'privacy-center': privacyCenter,\n messages,\n policies,\n partitions,\n } = input;\n\n const [identifierByName, dataSubjectsByName, apiKeyTitleMap] = await Promise.all([\n // Ensure all identifiers are created and create a map from name -> identifier.id\n enrichers || identifiers\n ? fetchIdentifiersAndCreateMissing(input, client, !publishToPrivacyCenter)\n : ({} as { [k in string]: Identifier }),\n // Grab all data subjects in the organization\n dataSilos || dataSubjects || enrichers || processingActivities\n ? ensureAllDataSubjectsExist(input, client)\n : {},\n // Grab API keys\n dataSilos &&\n dataSilos\n .map((dataSilo) => dataSilo['api-key-title'] || [])\n .reduce((acc, lst) => acc + lst.length, 0) > 0\n ? fetchApiKeys(input, client)\n : {},\n ]);\n\n // Sync consent manager\n if (consentManager) {\n logger.info(colors.magenta('Syncing consent manager...'));\n try {\n await syncConsentManager(client, consentManager);\n logger.info(colors.green('Successfully synced consent manager!'));\n } catch (err) {\n encounteredError = true;\n logger.info(colors.red(`Failed to sync consent manager! - ${err.message}`));\n }\n }\n\n // Sync prompts\n if (prompts) {\n const promptsSuccess = await syncPrompts(client, prompts);\n encounteredError = encounteredError || !promptsSuccess;\n }\n if (promptPartials) {\n const promptsSuccess = await syncPromptPartials(client, promptPartials);\n encounteredError = encounteredError || !promptsSuccess;\n }\n if (promptGroups) {\n const promptsSuccess = await syncPromptGroups(client, promptGroups);\n encounteredError = encounteredError || !promptsSuccess;\n }\n\n if (teams) {\n const teamsSuccess = await syncTeams(client, teams);\n encounteredError = encounteredError || !teamsSuccess;\n }\n\n // Sync email templates\n if (templates) {\n logger.info(colors.magenta(`Syncing \"${templates.length}\" email templates...`));\n await map(\n templates,\n async (template) => {\n logger.info(colors.magenta(`Syncing template \"${template.title}\"...`));\n try {\n await syncTemplate(template, client);\n logger.info(colors.green(`Successfully synced template \"${template.title}\"!`));\n } catch (err) {\n encounteredError = true;\n logger.info(colors.red(`Failed to sync template \"${template.title}\"! - ${err.message}`));\n }\n },\n {\n concurrency: CONCURRENCY,\n },\n );\n logger.info(colors.green(`Synced \"${templates.length}\" email templates!`));\n }\n\n // Sync business entities\n if (businessEntities) {\n const businessEntitySuccess = await syncBusinessEntities(client, businessEntities);\n encounteredError = encounteredError || !businessEntitySuccess;\n }\n\n // Sync vendors\n if (vendors) {\n const vendorsSuccess = await syncVendors(client, vendors);\n encounteredError = encounteredError || !vendorsSuccess;\n }\n\n // Sync data categories\n if (dataCategories) {\n const dataCategoriesSuccess = await syncDataCategories(client, dataCategories);\n encounteredError = encounteredError || !dataCategoriesSuccess;\n }\n\n // Sync processing purposes\n if (processingPurposes) {\n const processingPurposesSuccess = await syncProcessingPurposes(client, processingPurposes);\n encounteredError = encounteredError || !processingPurposesSuccess;\n }\n\n // Sync partitions\n if (partitions) {\n const partitionsSuccess = await syncPartitions(client, partitions);\n encounteredError = encounteredError || !partitionsSuccess;\n }\n\n // Sync agents\n if (agents) {\n const agentsSuccess = await syncAgents(client, agents);\n encounteredError = encounteredError || !agentsSuccess;\n }\n\n // Sync agent functions\n if (agentFunctions) {\n const agentFunctionsSuccess = await syncAgentFunctions(client, agentFunctions);\n encounteredError = encounteredError || !agentFunctionsSuccess;\n }\n\n // Sync agent files\n if (agentFiles) {\n const agentFilesSuccess = await syncAgentFiles(client, agentFiles);\n encounteredError = encounteredError || !agentFilesSuccess;\n }\n\n // Sync cookies\n if (cookies) {\n const cookiesSuccess = await syncCookies(client, cookies);\n encounteredError = encounteredError || !cookiesSuccess;\n }\n\n // Sync action item collections\n if (actionItemCollections) {\n const actionItemCollectionsSuccess = await syncActionItemCollections(\n client,\n actionItemCollections,\n );\n encounteredError = encounteredError || !actionItemCollectionsSuccess;\n }\n\n // Sync attributes\n if (attributes) {\n // Fetch existing\n logger.info(colors.magenta(`Syncing \"${attributes.length}\" attributes...`));\n const existingAttributes = await fetchAllAttributes(client);\n await map(\n attributes,\n async (attribute) => {\n const existing = existingAttributes.find((attr) => attr.name === attribute.name);\n\n logger.info(colors.magenta(`Syncing attribute \"${attribute.name}\"...`));\n try {\n await syncAttribute(client, attribute, {\n existingAttribute: existing,\n deleteExtraAttributeValues,\n });\n logger.info(colors.green(`Successfully synced attribute \"${attribute.name}\"!`));\n } catch (err) {\n encounteredError = true;\n logger.info(colors.red(`Failed to sync attribute \"${attribute.name}\"! - ${err.message}`));\n }\n },\n {\n concurrency: CONCURRENCY,\n },\n );\n logger.info(colors.green(`Synced \"${attributes.length}\" attributes!`));\n }\n\n // Sync action items\n if (actionItems) {\n const actionItemsSuccess = await syncActionItems(client, actionItems);\n encounteredError = encounteredError || !actionItemsSuccess;\n }\n\n // Sync enrichers\n if (enrichers) {\n logger.info(colors.magenta(`Syncing \"${enrichers.length}\" enrichers...`));\n await map(\n enrichers,\n async (enricher) => {\n logger.info(colors.magenta(`Syncing enricher \"${enricher.title}\"...`));\n try {\n await syncEnricher(client, {\n enricher,\n identifierByName,\n dataSubjectsByName,\n });\n logger.info(colors.green(`Successfully synced enricher \"${enricher.title}\"!`));\n } catch (err) {\n encounteredError = true;\n logger.info(colors.red(`Failed to sync enricher \"${enricher.title}\"! - ${err.message}`));\n }\n },\n {\n concurrency: CONCURRENCY,\n },\n );\n logger.info(colors.green(`Synced \"${enrichers.length}\" enrichers!`));\n }\n\n // Sync identifiers\n if (identifiers) {\n // Fetch existing\n logger.info(colors.magenta(`Syncing \"${identifiers.length}\" identifiers...`));\n await map(\n identifiers,\n async (identifier) => {\n const existing = identifierByName[identifier.name];\n if (!existing) {\n throw new Error(\n `Failed to find identifier with name: ${identifier.type}. Should have been auto-created by cli.`,\n );\n }\n\n logger.info(colors.magenta(`Syncing identifier \"${identifier.type}\"...`));\n try {\n await syncIdentifier(client, {\n identifier,\n dataSubjectsByName,\n identifierId: existing.id,\n skipPublish: !publishToPrivacyCenter,\n });\n logger.info(colors.green(`Successfully synced identifier \"${identifier.type}\"!`));\n } catch (err) {\n encounteredError = true;\n logger.info(\n colors.red(`Failed to sync identifier \"${identifier.type}\"! - ${err.message}`),\n );\n }\n },\n {\n concurrency: CONCURRENCY,\n },\n );\n logger.info(colors.green(`Synced \"${identifiers.length}\" identifiers!`));\n }\n\n // Sync actions\n if (actions) {\n // Fetch existing\n logger.info(colors.magenta(`Syncing \"${actions.length}\" actions...`));\n const existingActions = await fetchAllActions(client);\n await map(\n actions,\n async (action) => {\n const existing = existingActions.find((act) => act.type === action.type);\n if (!existing) {\n throw new Error(\n `Failed to find action with type: ${action.type}. Should have already existing in the organization.`,\n );\n }\n\n logger.info(colors.magenta(`Syncing action \"${action.type}\"...`));\n try {\n await syncAction(client, {\n action,\n actionId: existing.id,\n skipPublish: !publishToPrivacyCenter,\n });\n logger.info(colors.green(`Successfully synced action \"${action.type}\"!`));\n } catch (err) {\n encounteredError = true;\n logger.info(colors.red(`Failed to sync action \"${action.type}\"! - ${err.message}`));\n }\n },\n {\n concurrency: CONCURRENCY,\n },\n );\n logger.info(colors.green(`Synced \"${actions.length}\" actions!`));\n }\n\n // Sync data subjects\n if (dataSubjects) {\n // Fetch existing\n logger.info(colors.magenta(`Syncing \"${dataSubjects.length}\" data subjects...`));\n const existingDataSubjects = await fetchAllDataSubjects(client);\n await map(\n dataSubjects,\n async (dataSubject) => {\n const existing = existingDataSubjects.find((subj) => subj.type === dataSubject.type);\n if (!existing) {\n throw new Error(\n `Failed to find data subject with type: ${dataSubject.type}. Should have already existing in the organization.`,\n );\n }\n\n logger.info(colors.magenta(`Syncing data subject \"${dataSubject.type}\"...`));\n try {\n await syncDataSubject(client, {\n dataSubject,\n dataSubjectId: existing.id,\n skipPublish: !publishToPrivacyCenter,\n });\n logger.info(colors.green(`Successfully synced data subject \"${dataSubject.type}\"!`));\n } catch (err) {\n encounteredError = true;\n logger.info(\n colors.red(`Failed to sync data subject \"${dataSubject.type}\"! - ${err.message}`),\n );\n }\n },\n {\n concurrency: CONCURRENCY,\n },\n );\n logger.info(colors.green(`Synced \"${dataSubjects.length}\" data subjects!`));\n }\n\n // Sync data flows\n if (dataFlows) {\n const syncedDataFlows = await syncDataFlows(client, dataFlows, classifyService);\n encounteredError = encounteredError || !syncedDataFlows;\n }\n\n // Sync privacy center\n if (privacyCenter) {\n const privacyCenterSuccess = await syncPrivacyCenter(client, privacyCenter);\n encounteredError = encounteredError || !privacyCenterSuccess;\n }\n\n // Sync messages\n if (messages) {\n const messagesSuccess = await syncIntlMessages(client, messages);\n encounteredError = encounteredError || !messagesSuccess;\n }\n\n // Sync policies\n if (policies) {\n const policiesSuccess = await syncPolicies(client, policies);\n encounteredError = encounteredError || !policiesSuccess;\n }\n\n // Store dependency updates\n const dependencyUpdates: [string, string[]][] = [];\n // Sync data silos\n if (dataSilos) {\n const { success, dataSiloTitleToId } = await syncDataSilos(dataSilos, client, {\n dataSubjectsByName,\n apiKeysByTitle: apiKeyTitleMap,\n pageSize,\n });\n dataSilos?.forEach((dataSilo) => {\n // Queue up dependency update\n if (dataSilo['deletion-dependencies']) {\n dependencyUpdates.push([\n dataSiloTitleToId[dataSilo.title],\n dataSilo['deletion-dependencies'],\n ]);\n }\n });\n encounteredError = encounteredError || !success;\n }\n\n // Dependencies updated at the end after all data silos are created\n if (dependencyUpdates.length > 0) {\n await syncDataSiloDependencies(client, dependencyUpdates);\n }\n\n // Update processing activities\n if (processingActivities) {\n const processingActivitySuccess = await syncProcessingActivities(client, processingActivities);\n encounteredError = encounteredError || !processingActivitySuccess;\n }\n\n if (publishToPrivacyCenter) {\n // TODO: https://transcend.height.app/T-23779\n }\n\n return encounteredError;\n}\n/* eslint-enable max-lines */\n","import { getEntries } from '@transcend-io/type-utils';\n\nimport { TranscendInput } from '../codecs.js';\n\n/**\n * Combine a set of TranscendInput yaml files into a single yaml\n *\n * @param base - Base input\n * @param inputs - The list of inputs\n * @returns Merged input\n */\nexport function mergeTranscendInputs(\n base: TranscendInput,\n ...inputs: TranscendInput[]\n): TranscendInput {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const cloned: any = JSON.parse(JSON.stringify(base));\n inputs.forEach((input) => {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n getEntries(input).forEach(([key, value]: [any, any]) => {\n if (cloned[key] === undefined) {\n cloned[key] = value;\n } else if (Array.isArray(value)) {\n cloned[key] = [...cloned[key], ...value];\n } else {\n cloned[key] = value;\n }\n });\n });\n return cloned;\n}\n"],"mappings":"sgDAQA,MAAM,GAAiC,CACrC,GAAG,OAAO,OAAO,GAAe,CAChC,GAAG,OAAO,OAAO,GAA0B,CAC5C,CAQD,eAAsB,EACpB,EACA,CACE,SACA,WACA,cAAc,IASD,CACf,MAAM,EAAmB,EAAQ,EAAe,CAC9C,MAAO,CACL,GAAI,EACJ,uBAAwB,EAAO,uBAC/B,qBAAsB,EAAO,qBAC7B,eAAgB,EAAO,eACvB,cAAe,EAAO,cACtB,cACA,WAAY,EAAO,gBACf,GAAW,GAAgC,EAAO,gBAAgB,CAClE,EAAO,WACX,sBAAuB,EAAO,sBAC/B,CACF,CAAC,CC1BJ,eAAsB,EACpB,EACA,EACqD,CAQrD,GAAM,CAAE,8BAA+B,MAAM,EAM1C,EAAQ,GAA+B,CACxC,MAdY,CACZ,MAAO,EAAqB,MAC5B,YAAa,EAAqB,aAAe,GACjD,OAAQ,EAAqB,QAAU,GACvC,YAAa,EAAqB,YACnC,CAUA,CAAC,CACF,OAAO,EAA2B,QAUpC,eAAsB,EACpB,EACA,EACA,EACe,CACf,MAAM,EAAmB,EAAQ,EAA+B,CAC9D,MAAO,CACL,GAAI,EACJ,MAAO,EAAM,MACb,YAAa,EAAM,YACnB,OAAQ,EAAM,OACd,YAAa,EAAM,YACpB,CACF,CAAC,CAUJ,eAAsB,EACpB,EACA,EACkB,CAClB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