@transcend-io/cli 10.0.1 → 10.2.0

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.
Files changed (404) hide show
  1. package/README.md +16 -5
  2. package/dist/{app-BfTrk2nc.mjs → app-C1m4rExX.mjs} +21 -21
  3. package/dist/{app-BfTrk2nc.mjs.map → app-C1m4rExX.mjs.map} +1 -1
  4. package/dist/approvePrivacyRequests-BIHcACAj.mjs +2 -0
  5. package/dist/approvePrivacyRequests-BIHcACAj.mjs.map +1 -0
  6. package/dist/bin/bash-complete.mjs +1 -1
  7. package/dist/bin/cli.mjs +1 -1
  8. package/dist/bin/deprecated-command.mjs +1 -1
  9. package/dist/buildXdiSyncEndpoint-CBbcir-p.mjs +9 -0
  10. package/dist/buildXdiSyncEndpoint-CBbcir-p.mjs.map +1 -0
  11. package/dist/bulkRestartRequests-ByH7TjH2.mjs +2 -0
  12. package/dist/bulkRestartRequests-ByH7TjH2.mjs.map +1 -0
  13. package/dist/bulkRetryEnrichers-DuYXD-64.mjs +2 -0
  14. package/dist/bulkRetryEnrichers-DuYXD-64.mjs.map +1 -0
  15. package/dist/cancelPrivacyRequests-DMgQOffA.mjs +2 -0
  16. package/dist/cancelPrivacyRequests-DMgQOffA.mjs.map +1 -0
  17. package/dist/{codecs-BE3Wmoh8.mjs → codecs-CeDPaLYa.mjs} +1 -1
  18. package/dist/{codecs-BE3Wmoh8.mjs.map → codecs-CeDPaLYa.mjs.map} +1 -1
  19. package/dist/collectCsvFilesOrExit-CbtyKAzu.mjs +2 -0
  20. package/dist/collectCsvFilesOrExit-CbtyKAzu.mjs.map +1 -0
  21. package/dist/collectParquetFilesOrExit-BJiAyaQ5.mjs +2 -0
  22. package/dist/collectParquetFilesOrExit-BJiAyaQ5.mjs.map +1 -0
  23. package/dist/{command-BXxoAjFo.mjs → command-DnoHX-eW.mjs} +2 -2
  24. package/dist/{command-BXxoAjFo.mjs.map → command-DnoHX-eW.mjs.map} +1 -1
  25. package/dist/commands/admin/chunk-csv/worker.d.mts +48 -0
  26. package/dist/commands/admin/chunk-csv/worker.d.mts.map +1 -0
  27. package/dist/commands/admin/chunk-csv/worker.mjs +2 -0
  28. package/dist/commands/admin/chunk-csv/worker.mjs.map +1 -0
  29. package/dist/commands/admin/parquet-to-csv/worker.d.mts +25 -0
  30. package/dist/commands/admin/parquet-to-csv/worker.d.mts.map +1 -0
  31. package/dist/commands/admin/parquet-to-csv/worker.mjs +2 -0
  32. package/dist/commands/admin/parquet-to-csv/worker.mjs.map +1 -0
  33. package/dist/{consentManagersToBusinessEntities-BDgOFga7.mjs → consentManagersToBusinessEntities-BdKDganK.mjs} +2 -2
  34. package/dist/{consentManagersToBusinessEntities-BDgOFga7.mjs.map → consentManagersToBusinessEntities-BdKDganK.mjs.map} +1 -1
  35. package/dist/{constants-AFtS5Nad.mjs → constants-BmwXDQu9.mjs} +2 -2
  36. package/dist/{constants-AFtS5Nad.mjs.map → constants-BmwXDQu9.mjs.map} +1 -1
  37. package/dist/{constants-lIvXgkdp.mjs → constants-ClkQQhJs.mjs} +1 -1
  38. package/dist/{constants-lIvXgkdp.mjs.map → constants-ClkQQhJs.mjs.map} +1 -1
  39. package/dist/constants-muOBBQA_.mjs +2 -0
  40. package/dist/constants-muOBBQA_.mjs.map +1 -0
  41. package/dist/{context-CdSyuBlf.mjs → context-bkKpii_t.mjs} +1 -1
  42. package/dist/{context-CdSyuBlf.mjs.map → context-bkKpii_t.mjs.map} +1 -1
  43. package/dist/createExtraKeyHandler-srtG2U7q.mjs +14 -0
  44. package/dist/createExtraKeyHandler-srtG2U7q.mjs.map +1 -0
  45. package/dist/{dataFlowsToDataSilos-NhvBw1iy.mjs → dataFlowsToDataSilos-Ca2DtTsd.mjs} +1 -1
  46. package/dist/dataFlowsToDataSilos-Ca2DtTsd.mjs.map +1 -0
  47. package/dist/{done-input-validation-DLR0-MJ7.mjs → done-input-validation-BcNBxhEs.mjs} +1 -1
  48. package/dist/{done-input-validation-DLR0-MJ7.mjs.map → done-input-validation-BcNBxhEs.mjs.map} +1 -1
  49. package/dist/downloadPrivacyRequestFiles-kKhGnFmx.mjs +2 -0
  50. package/dist/downloadPrivacyRequestFiles-kKhGnFmx.mjs.map +1 -0
  51. package/dist/{extractClientError-DPjv09EH.mjs → extractClientError-i-Tw_az7.mjs} +1 -1
  52. package/dist/{extractClientError-DPjv09EH.mjs.map → extractClientError-i-Tw_az7.mjs.map} +1 -1
  53. package/dist/fetchAllRequests-CHHdyb4Q.mjs +2 -0
  54. package/dist/fetchAllRequests-CHHdyb4Q.mjs.map +1 -0
  55. package/dist/generateCrossAccountApiKeys-C7yH3Rbi.mjs +2 -0
  56. package/dist/generateCrossAccountApiKeys-C7yH3Rbi.mjs.map +1 -0
  57. package/dist/impl-3VLH9aat.mjs +2 -0
  58. package/dist/impl-3VLH9aat.mjs.map +1 -0
  59. package/dist/{impl-Rt3C_fDF.mjs → impl-3sDUDXru.mjs} +2 -2
  60. package/dist/{impl-Rt3C_fDF.mjs.map → impl-3sDUDXru.mjs.map} +1 -1
  61. package/dist/{impl-Cgg_bv7j.mjs → impl-6mCOBlSD.mjs} +2 -2
  62. package/dist/{impl-Cgg_bv7j.mjs.map → impl-6mCOBlSD.mjs.map} +1 -1
  63. package/dist/impl-84ylH4aO.mjs +2 -0
  64. package/dist/{impl-CMmyv1cl.mjs.map → impl-84ylH4aO.mjs.map} +1 -1
  65. package/dist/impl-B62XN4tV.mjs +2 -0
  66. package/dist/impl-B62XN4tV.mjs.map +1 -0
  67. package/dist/{impl-DGiPB5Vq2.mjs → impl-B9BsXBxS.mjs} +2 -2
  68. package/dist/impl-B9BsXBxS.mjs.map +1 -0
  69. package/dist/{impl-KDuBh4bu2.mjs → impl-BNqmxytJ.mjs} +2 -2
  70. package/dist/impl-BNqmxytJ.mjs.map +1 -0
  71. package/dist/{impl-CqXFyvgV2.mjs → impl-BYf4MpWP.mjs} +2 -2
  72. package/dist/impl-BYf4MpWP.mjs.map +1 -0
  73. package/dist/impl-BaC9iEO_.mjs +2 -0
  74. package/dist/impl-BaC9iEO_.mjs.map +1 -0
  75. package/dist/impl-BhDS0QIt.mjs +2 -0
  76. package/dist/impl-BhDS0QIt.mjs.map +1 -0
  77. package/dist/{impl-CNez1OAw.mjs → impl-BjCQSRLu.mjs} +2 -2
  78. package/dist/{impl-CNez1OAw.mjs.map → impl-BjCQSRLu.mjs.map} +1 -1
  79. package/dist/impl-BjIylEKQ.mjs +4 -0
  80. package/dist/impl-BjIylEKQ.mjs.map +1 -0
  81. package/dist/impl-BwrEi3s7.mjs +2 -0
  82. package/dist/impl-BwrEi3s7.mjs.map +1 -0
  83. package/dist/impl-C4AI1Fsj.mjs +3 -0
  84. package/dist/impl-C4AI1Fsj.mjs.map +1 -0
  85. package/dist/{impl-fqOKTw5J.mjs → impl-CCAeEeMR.mjs} +2 -2
  86. package/dist/{impl-fqOKTw5J.mjs.map → impl-CCAeEeMR.mjs.map} +1 -1
  87. package/dist/{impl-P_NDC3cX.mjs → impl-CFI5y5U-.mjs} +2 -2
  88. package/dist/{impl-P_NDC3cX.mjs.map → impl-CFI5y5U-.mjs.map} +1 -1
  89. package/dist/{impl-BOUm7wly2.mjs → impl-CIfRN0ux.mjs} +2 -2
  90. package/dist/impl-CIfRN0ux.mjs.map +1 -0
  91. package/dist/impl-CLznNZ5F.mjs +2 -0
  92. package/dist/impl-CLznNZ5F.mjs.map +1 -0
  93. package/dist/impl-CUdo0Jyh.mjs +2 -0
  94. package/dist/impl-CUdo0Jyh.mjs.map +1 -0
  95. package/dist/{impl-MpkLBntW.mjs → impl-Cmj1Vi5Q.mjs} +2 -2
  96. package/dist/{impl-MpkLBntW.mjs.map → impl-Cmj1Vi5Q.mjs.map} +1 -1
  97. package/dist/impl-Cw3_0zqC.mjs +2 -0
  98. package/dist/impl-Cw3_0zqC.mjs.map +1 -0
  99. package/dist/{impl-D-cp0CYr.mjs → impl-CzvCA0Ev.mjs} +2 -2
  100. package/dist/{impl-D-cp0CYr.mjs.map → impl-CzvCA0Ev.mjs.map} +1 -1
  101. package/dist/{impl-CSChmq_t2.mjs → impl-D1DmW5-P.mjs} +2 -2
  102. package/dist/impl-D1DmW5-P.mjs.map +1 -0
  103. package/dist/{impl-CCUsnhoW2.mjs → impl-D41c_KGj.mjs} +2 -2
  104. package/dist/impl-D41c_KGj.mjs.map +1 -0
  105. package/dist/impl-DEpCg7UP.mjs +2 -0
  106. package/dist/{impl-tbGnvKFm.mjs.map → impl-DEpCg7UP.mjs.map} +1 -1
  107. package/dist/{impl-DGuwD_qz.mjs → impl-DHOh4ypd.mjs} +2 -2
  108. package/dist/{impl-DGuwD_qz.mjs.map → impl-DHOh4ypd.mjs.map} +1 -1
  109. package/dist/{impl-D9NjIwEi2.mjs → impl-DJg0Ibxs.mjs} +2 -2
  110. package/dist/impl-DJg0Ibxs.mjs.map +1 -0
  111. package/dist/impl-DUdbbIpf.mjs +2 -0
  112. package/dist/impl-DUdbbIpf.mjs.map +1 -0
  113. package/dist/impl-DXHqqWJb.mjs +7 -0
  114. package/dist/impl-DXHqqWJb.mjs.map +1 -0
  115. package/dist/impl-DXaA3sMt.mjs +2 -0
  116. package/dist/impl-DXaA3sMt.mjs.map +1 -0
  117. package/dist/impl-Dl4RcPKp.mjs +2 -0
  118. package/dist/{impl-DEWXA_QC.mjs.map → impl-Dl4RcPKp.mjs.map} +1 -1
  119. package/dist/{impl-c7rUQYDc2.mjs → impl-DvAwxl6Z.mjs} +2 -2
  120. package/dist/impl-DvAwxl6Z.mjs.map +1 -0
  121. package/dist/{impl-JThkrXiI2.mjs → impl-GRdcDZQ4.mjs} +2 -2
  122. package/dist/impl-GRdcDZQ4.mjs.map +1 -0
  123. package/dist/{impl-CNykdy3e2.mjs → impl-UMb9wjra.mjs} +2 -2
  124. package/dist/impl-UMb9wjra.mjs.map +1 -0
  125. package/dist/impl-Yq33AV90.mjs +2 -0
  126. package/dist/impl-Yq33AV90.mjs.map +1 -0
  127. package/dist/impl-aGDJJgGc.mjs +2 -0
  128. package/dist/impl-aGDJJgGc.mjs.map +1 -0
  129. package/dist/impl-fZQxhZRu.mjs +12 -0
  130. package/dist/impl-fZQxhZRu.mjs.map +1 -0
  131. package/dist/{impl-BUC4ZelU.mjs → impl-gitQPEo3.mjs} +2 -2
  132. package/dist/{impl-BUC4ZelU.mjs.map → impl-gitQPEo3.mjs.map} +1 -1
  133. package/dist/impl-i-vquwbD.mjs +2 -0
  134. package/dist/{impl-C2o0eDzJ.mjs.map → impl-i-vquwbD.mjs.map} +1 -1
  135. package/dist/impl-iteb85IZ.mjs +4 -0
  136. package/dist/impl-iteb85IZ.mjs.map +1 -0
  137. package/dist/impl-tYtVXUz2.mjs +2 -0
  138. package/dist/impl-tYtVXUz2.mjs.map +1 -0
  139. package/dist/{impl-DGzvE8aJ.mjs → impl-wcRtA0L3.mjs} +2 -2
  140. package/dist/{impl-DGzvE8aJ.mjs.map → impl-wcRtA0L3.mjs.map} +1 -1
  141. package/dist/impl-xtlx25UP.mjs +2 -0
  142. package/dist/impl-xtlx25UP.mjs.map +1 -0
  143. package/dist/impl-yMumZUUX.mjs +2 -0
  144. package/dist/impl-yMumZUUX.mjs.map +1 -0
  145. package/dist/index.d.mts +1135 -5125
  146. package/dist/index.d.mts.map +1 -1
  147. package/dist/index.mjs +4 -78
  148. package/dist/index.mjs.map +1 -1
  149. package/dist/{inquirer-BgNcicZ4.mjs → inquirer-BqZXFEt1.mjs} +2 -2
  150. package/dist/{inquirer-BgNcicZ4.mjs.map → inquirer-BqZXFEt1.mjs.map} +1 -1
  151. package/dist/{listFiles-qzyQMaYH.mjs → listFiles-D2wMHnEr.mjs} +1 -1
  152. package/dist/{listFiles-qzyQMaYH.mjs.map → listFiles-D2wMHnEr.mjs.map} +1 -1
  153. package/dist/{logger-B-LXIf3U.mjs → logger-Bj782ZYD.mjs} +1 -1
  154. package/dist/{logger-B-LXIf3U.mjs.map → logger-Bj782ZYD.mjs.map} +1 -1
  155. package/dist/markRequestDataSiloIdsCompleted-BaVxVfDe.mjs +2 -0
  156. package/dist/markRequestDataSiloIdsCompleted-BaVxVfDe.mjs.map +1 -0
  157. package/dist/markSilentPrivacyRequests-miaumnaC.mjs +2 -0
  158. package/dist/markSilentPrivacyRequests-miaumnaC.mjs.map +1 -0
  159. package/dist/notifyPrivacyRequestsAdditionalTime-BUdhSCNL.mjs +2 -0
  160. package/dist/notifyPrivacyRequestsAdditionalTime-BUdhSCNL.mjs.map +1 -0
  161. package/dist/parquetToCsvOneFile-B84XXInh.mjs +6 -0
  162. package/dist/parquetToCsvOneFile-B84XXInh.mjs.map +1 -0
  163. package/dist/parseAttributesFromString-D1Yl0xwT.mjs +2 -0
  164. package/dist/{parseAttributesFromString-CZStzJc0.mjs.map → parseAttributesFromString-D1Yl0xwT.mjs.map} +1 -1
  165. package/dist/parseVariablesFromString-BeKOGw5n.mjs +3 -0
  166. package/dist/parseVariablesFromString-BeKOGw5n.mjs.map +1 -0
  167. package/dist/pullAllDatapoints-Bbmky50p.mjs +45 -0
  168. package/dist/pullAllDatapoints-Bbmky50p.mjs.map +1 -0
  169. package/dist/pullChunkedCustomSiloOutstandingIdentifiers-BW5Vws25.mjs +2 -0
  170. package/dist/pullChunkedCustomSiloOutstandingIdentifiers-BW5Vws25.mjs.map +1 -0
  171. package/dist/pullConsentManagerMetrics-zKgjc3Ap.mjs +2 -0
  172. package/dist/pullConsentManagerMetrics-zKgjc3Ap.mjs.map +1 -0
  173. package/dist/pullManualEnrichmentIdentifiersToCsv-kpGy9H7T.mjs +2 -0
  174. package/dist/pullManualEnrichmentIdentifiersToCsv-kpGy9H7T.mjs.map +1 -0
  175. package/dist/pullTranscendConfiguration-DjOELnPo.mjs +58 -0
  176. package/dist/pullTranscendConfiguration-DjOELnPo.mjs.map +1 -0
  177. package/dist/{pullUnstructuredSubDataPointRecommendations-DZd2q6S2.mjs → pullUnstructuredSubDataPointRecommendations-D0z-vPgq.mjs} +4 -4
  178. package/dist/pullUnstructuredSubDataPointRecommendations-D0z-vPgq.mjs.map +1 -0
  179. package/dist/pushCronIdentifiersFromCsv-BZRA1n_8.mjs +2 -0
  180. package/dist/pushCronIdentifiersFromCsv-BZRA1n_8.mjs.map +1 -0
  181. package/dist/pushManualEnrichmentIdentifiersFromCsv-DXqf8WWy.mjs +2 -0
  182. package/dist/pushManualEnrichmentIdentifiersFromCsv-DXqf8WWy.mjs.map +1 -0
  183. package/dist/{readCsv-CyOL7eCc.mjs → readCsv-C4TyEs-r.mjs} +1 -1
  184. package/dist/{readCsv-CyOL7eCc.mjs.map → readCsv-C4TyEs-r.mjs.map} +1 -1
  185. package/dist/{readTranscendYaml-D-J1ilS0.mjs → readTranscendYaml-DVkQL2SC.mjs} +2 -2
  186. package/dist/{readTranscendYaml-D-J1ilS0.mjs.map → readTranscendYaml-DVkQL2SC.mjs.map} +1 -1
  187. package/dist/removeUnverifiedRequestIdentifiers-BxWSsJit.mjs +2 -0
  188. package/dist/removeUnverifiedRequestIdentifiers-BxWSsJit.mjs.map +1 -0
  189. package/dist/{request-CAsR6CMY.mjs → request-DfkRPQFr.mjs} +1 -1
  190. package/dist/{request-CAsR6CMY.mjs.map → request-DfkRPQFr.mjs.map} +1 -1
  191. package/dist/retryRequestDataSilos-BVrJz_GC.mjs +2 -0
  192. package/dist/retryRequestDataSilos-BVrJz_GC.mjs.map +1 -0
  193. package/dist/skipPreflightJobs-CYuoMG3z.mjs +2 -0
  194. package/dist/skipPreflightJobs-CYuoMG3z.mjs.map +1 -0
  195. package/dist/skipRequestDataSilos-BNspAsjR.mjs +2 -0
  196. package/dist/skipRequestDataSilos-BNspAsjR.mjs.map +1 -0
  197. package/dist/streamPrivacyRequestsToCsv-PoyTmQd6.mjs +2 -0
  198. package/dist/streamPrivacyRequestsToCsv-PoyTmQd6.mjs.map +1 -0
  199. package/dist/syncCodePackages-CAk_Hjyl.mjs +2 -0
  200. package/dist/syncCodePackages-CAk_Hjyl.mjs.map +1 -0
  201. package/dist/updateConsentManagerVersionToLatest-lAw3E1wm.mjs +2 -0
  202. package/dist/updateConsentManagerVersionToLatest-lAw3E1wm.mjs.map +1 -0
  203. package/dist/uploadConsents-BzmWrNc1.mjs +2 -0
  204. package/dist/uploadConsents-BzmWrNc1.mjs.map +1 -0
  205. package/dist/uploadCookiesFromCsv-TH10UBgw.mjs +2 -0
  206. package/dist/uploadCookiesFromCsv-TH10UBgw.mjs.map +1 -0
  207. package/dist/uploadDataFlowsFromCsv-DUSFCae9.mjs +2 -0
  208. package/dist/uploadDataFlowsFromCsv-DUSFCae9.mjs.map +1 -0
  209. package/dist/uploadPrivacyRequestsFromCsv-sKSFfE6q.mjs +2 -0
  210. package/dist/uploadPrivacyRequestsFromCsv-sKSFfE6q.mjs.map +1 -0
  211. package/dist/{validateTranscendAuth-1W1IylqE.mjs → validateTranscendAuth-Cuh2Qfdl.mjs} +2 -2
  212. package/dist/{validateTranscendAuth-1W1IylqE.mjs.map → validateTranscendAuth-Cuh2Qfdl.mjs.map} +1 -1
  213. package/dist/{writeCsv-B51ulrVl.mjs → writeCsv-C4pjXGsD.mjs} +1 -1
  214. package/dist/{writeCsv-B51ulrVl.mjs.map → writeCsv-C4pjXGsD.mjs.map} +1 -1
  215. package/package.json +13 -10
  216. package/dist/RateCounter-DFL_mnk2.mjs +0 -2
  217. package/dist/RateCounter-DFL_mnk2.mjs.map +0 -1
  218. package/dist/RequestDataSilo-_Iv44M9u.mjs +0 -51
  219. package/dist/RequestDataSilo-_Iv44M9u.mjs.map +0 -1
  220. package/dist/approvePrivacyRequests-CWGZR2N6.mjs +0 -2
  221. package/dist/approvePrivacyRequests-CWGZR2N6.mjs.map +0 -1
  222. package/dist/assessment-BDywVaGR.mjs +0 -284
  223. package/dist/assessment-BDywVaGR.mjs.map +0 -1
  224. package/dist/bluebird-CUitXgsY.mjs +0 -2
  225. package/dist/bluebird-CUitXgsY.mjs.map +0 -1
  226. package/dist/buildXdiSyncEndpoint-Cb-pvpak.mjs +0 -9
  227. package/dist/buildXdiSyncEndpoint-Cb-pvpak.mjs.map +0 -1
  228. package/dist/bulkRestartRequests-CKF_xpN0.mjs +0 -2
  229. package/dist/bulkRestartRequests-CKF_xpN0.mjs.map +0 -1
  230. package/dist/bulkRetryEnrichers-B-Szmin-.mjs +0 -2
  231. package/dist/bulkRetryEnrichers-B-Szmin-.mjs.map +0 -1
  232. package/dist/cancelPrivacyRequests-DNiL13E_.mjs +0 -2
  233. package/dist/cancelPrivacyRequests-DNiL13E_.mjs.map +0 -1
  234. package/dist/codecs-Dx_vGxsl.mjs +0 -2
  235. package/dist/codecs-Dx_vGxsl.mjs.map +0 -1
  236. package/dist/constants-CeMiHaHx.mjs +0 -2
  237. package/dist/constants-CeMiHaHx.mjs.map +0 -1
  238. package/dist/createExtraKeyHandler-tubeaEjA.mjs +0 -23
  239. package/dist/createExtraKeyHandler-tubeaEjA.mjs.map +0 -1
  240. package/dist/createPreferenceAccessTokens-DqmFctn3.mjs +0 -10
  241. package/dist/createPreferenceAccessTokens-DqmFctn3.mjs.map +0 -1
  242. package/dist/createSombraGotInstance-D1Il9zUE.mjs +0 -10
  243. package/dist/createSombraGotInstance-D1Il9zUE.mjs.map +0 -1
  244. package/dist/dataFlowsToDataSilos-NhvBw1iy.mjs.map +0 -1
  245. package/dist/dataSilo-DrFetFXw.mjs +0 -302
  246. package/dist/dataSilo-DrFetFXw.mjs.map +0 -1
  247. package/dist/dataSubject-y_aXI0pa.mjs +0 -92
  248. package/dist/dataSubject-y_aXI0pa.mjs.map +0 -1
  249. package/dist/downloadPrivacyRequestFiles-DlpgxqHF.mjs +0 -2
  250. package/dist/downloadPrivacyRequestFiles-DlpgxqHF.mjs.map +0 -1
  251. package/dist/extractErrorMessage-CPnTsT1S.mjs +0 -2
  252. package/dist/extractErrorMessage-CPnTsT1S.mjs.map +0 -1
  253. package/dist/fetchAllActions-BJsPdnxy.mjs +0 -832
  254. package/dist/fetchAllActions-BJsPdnxy.mjs.map +0 -1
  255. package/dist/fetchAllDataFlows-D248lO6_.mjs +0 -2
  256. package/dist/fetchAllDataFlows-D248lO6_.mjs.map +0 -1
  257. package/dist/fetchAllPreferenceTopics-ForE9GpZ.mjs +0 -36
  258. package/dist/fetchAllPreferenceTopics-ForE9GpZ.mjs.map +0 -1
  259. package/dist/fetchAllPurposes-ZdkO2fMp.mjs +0 -29
  260. package/dist/fetchAllPurposes-ZdkO2fMp.mjs.map +0 -1
  261. package/dist/fetchAllPurposesAndPreferences-DD6OyA5t.mjs +0 -2
  262. package/dist/fetchAllPurposesAndPreferences-DD6OyA5t.mjs.map +0 -1
  263. package/dist/fetchAllRequestEnrichers-CK-kk5eg.mjs +0 -42
  264. package/dist/fetchAllRequestEnrichers-CK-kk5eg.mjs.map +0 -1
  265. package/dist/fetchAllRequestIdentifiers-DrFFOt0m.mjs +0 -10
  266. package/dist/fetchAllRequestIdentifiers-DrFFOt0m.mjs.map +0 -1
  267. package/dist/fetchAllRequests-DNQQsY4s.mjs +0 -2
  268. package/dist/fetchAllRequests-DNQQsY4s.mjs.map +0 -1
  269. package/dist/fetchApiKeys-DjOr44xA.mjs +0 -33
  270. package/dist/fetchApiKeys-DjOr44xA.mjs.map +0 -1
  271. package/dist/fetchCatalogs-BM4FCbcS.mjs +0 -12
  272. package/dist/fetchCatalogs-BM4FCbcS.mjs.map +0 -1
  273. package/dist/fetchConsentManagerId-CFkg3-RS.mjs +0 -321
  274. package/dist/fetchConsentManagerId-CFkg3-RS.mjs.map +0 -1
  275. package/dist/fetchIdentifiers-pjQV4vUg.mjs +0 -54
  276. package/dist/fetchIdentifiers-pjQV4vUg.mjs.map +0 -1
  277. package/dist/fetchRequestDataSilo-P4yA7Lyc.mjs +0 -2
  278. package/dist/fetchRequestDataSilo-P4yA7Lyc.mjs.map +0 -1
  279. package/dist/fetchRequestFilesForRequest-BbxrEKFK.mjs +0 -33
  280. package/dist/fetchRequestFilesForRequest-BbxrEKFK.mjs.map +0 -1
  281. package/dist/generateCrossAccountApiKeys-Bxc_dzMG.mjs +0 -33
  282. package/dist/generateCrossAccountApiKeys-Bxc_dzMG.mjs.map +0 -1
  283. package/dist/impl-4ltdSmpl2.mjs +0 -4
  284. package/dist/impl-4ltdSmpl2.mjs.map +0 -1
  285. package/dist/impl-B19fH75P.mjs +0 -12
  286. package/dist/impl-B19fH75P.mjs.map +0 -1
  287. package/dist/impl-BBMjv5YQ.mjs +0 -2
  288. package/dist/impl-BBMjv5YQ.mjs.map +0 -1
  289. package/dist/impl-BKH3QRLi.mjs +0 -3
  290. package/dist/impl-BKH3QRLi.mjs.map +0 -1
  291. package/dist/impl-BOUm7wly2.mjs.map +0 -1
  292. package/dist/impl-BhTCp0kg.mjs +0 -2
  293. package/dist/impl-BhTCp0kg.mjs.map +0 -1
  294. package/dist/impl-BlHU1bbJ2.mjs +0 -2
  295. package/dist/impl-BlHU1bbJ2.mjs.map +0 -1
  296. package/dist/impl-BwjguKHC.mjs +0 -4
  297. package/dist/impl-BwjguKHC.mjs.map +0 -1
  298. package/dist/impl-C2o0eDzJ.mjs +0 -2
  299. package/dist/impl-C8HKnjw82.mjs +0 -2
  300. package/dist/impl-C8HKnjw82.mjs.map +0 -1
  301. package/dist/impl-CCUsnhoW2.mjs.map +0 -1
  302. package/dist/impl-CCc-wXqD.mjs +0 -2
  303. package/dist/impl-CCc-wXqD.mjs.map +0 -1
  304. package/dist/impl-CMmyv1cl.mjs +0 -2
  305. package/dist/impl-CNykdy3e2.mjs.map +0 -1
  306. package/dist/impl-CSChmq_t2.mjs.map +0 -1
  307. package/dist/impl-Ce9K4OCp.mjs +0 -2
  308. package/dist/impl-Ce9K4OCp.mjs.map +0 -1
  309. package/dist/impl-ChCqHkOc2.mjs +0 -2
  310. package/dist/impl-ChCqHkOc2.mjs.map +0 -1
  311. package/dist/impl-CqEwwWeD.mjs +0 -2
  312. package/dist/impl-CqEwwWeD.mjs.map +0 -1
  313. package/dist/impl-CqXFyvgV2.mjs.map +0 -1
  314. package/dist/impl-CxLSJk2P.mjs +0 -2
  315. package/dist/impl-CxLSJk2P.mjs.map +0 -1
  316. package/dist/impl-CzU9WTiW.mjs +0 -2
  317. package/dist/impl-CzU9WTiW.mjs.map +0 -1
  318. package/dist/impl-D9NjIwEi2.mjs.map +0 -1
  319. package/dist/impl-DEWXA_QC.mjs +0 -2
  320. package/dist/impl-DGiPB5Vq2.mjs.map +0 -1
  321. package/dist/impl-DTp9OQIZ.mjs +0 -7
  322. package/dist/impl-DTp9OQIZ.mjs.map +0 -1
  323. package/dist/impl-DhscnXSw.mjs +0 -2
  324. package/dist/impl-DhscnXSw.mjs.map +0 -1
  325. package/dist/impl-Dk7MdX-1.mjs +0 -2
  326. package/dist/impl-Dk7MdX-1.mjs.map +0 -1
  327. package/dist/impl-DsNPvet4.mjs +0 -2
  328. package/dist/impl-DsNPvet4.mjs.map +0 -1
  329. package/dist/impl-DxUFb0vv.mjs +0 -2
  330. package/dist/impl-DxUFb0vv.mjs.map +0 -1
  331. package/dist/impl-JThkrXiI2.mjs.map +0 -1
  332. package/dist/impl-KDuBh4bu2.mjs.map +0 -1
  333. package/dist/impl-c7rUQYDc2.mjs.map +0 -1
  334. package/dist/impl-oiBTZqQS2.mjs +0 -2
  335. package/dist/impl-oiBTZqQS2.mjs.map +0 -1
  336. package/dist/impl-tbGnvKFm.mjs +0 -2
  337. package/dist/makeGraphQLRequest-Cq26A_Lq.mjs +0 -2
  338. package/dist/makeGraphQLRequest-Cq26A_Lq.mjs.map +0 -1
  339. package/dist/markRequestDataSiloIdsCompleted-DzqJ5MNY.mjs +0 -2
  340. package/dist/markRequestDataSiloIdsCompleted-DzqJ5MNY.mjs.map +0 -1
  341. package/dist/markSilentPrivacyRequests-BKQUu6Ep.mjs +0 -2
  342. package/dist/markSilentPrivacyRequests-BKQUu6Ep.mjs.map +0 -1
  343. package/dist/mergeTranscendInputs-DGC4xUGu.mjs +0 -2
  344. package/dist/mergeTranscendInputs-DGC4xUGu.mjs.map +0 -1
  345. package/dist/notifyPrivacyRequestsAdditionalTime-TEHAJe4C.mjs +0 -2
  346. package/dist/notifyPrivacyRequestsAdditionalTime-TEHAJe4C.mjs.map +0 -1
  347. package/dist/package-C4J38oR1.mjs +0 -2
  348. package/dist/package-C4J38oR1.mjs.map +0 -1
  349. package/dist/parquetToCsvOneFile-DZVKXrjn.mjs +0 -6
  350. package/dist/parquetToCsvOneFile-DZVKXrjn.mjs.map +0 -1
  351. package/dist/parseAttributesFromString-CZStzJc0.mjs +0 -2
  352. package/dist/pullAllDatapoints-Cntwuzw7.mjs +0 -45
  353. package/dist/pullAllDatapoints-Cntwuzw7.mjs.map +0 -1
  354. package/dist/pullChunkedCustomSiloOutstandingIdentifiers-BT-GZpT1.mjs +0 -2
  355. package/dist/pullChunkedCustomSiloOutstandingIdentifiers-BT-GZpT1.mjs.map +0 -1
  356. package/dist/pullConsentManagerMetrics-FnhPEszu.mjs +0 -2
  357. package/dist/pullConsentManagerMetrics-FnhPEszu.mjs.map +0 -1
  358. package/dist/pullManualEnrichmentIdentifiersToCsv-B_4REnga.mjs +0 -2
  359. package/dist/pullManualEnrichmentIdentifiersToCsv-B_4REnga.mjs.map +0 -1
  360. package/dist/pullTranscendConfiguration-CqsgEf9A.mjs +0 -80
  361. package/dist/pullTranscendConfiguration-CqsgEf9A.mjs.map +0 -1
  362. package/dist/pullUnstructuredSubDataPointRecommendations-DZd2q6S2.mjs.map +0 -1
  363. package/dist/pushCronIdentifiersFromCsv-D2saGR5i.mjs +0 -2
  364. package/dist/pushCronIdentifiersFromCsv-D2saGR5i.mjs.map +0 -1
  365. package/dist/pushManualEnrichmentIdentifiersFromCsv-DOvAzMyt.mjs +0 -2
  366. package/dist/pushManualEnrichmentIdentifiersFromCsv-DOvAzMyt.mjs.map +0 -1
  367. package/dist/removeUnverifiedRequestIdentifiers-ChlwRmhd.mjs +0 -35
  368. package/dist/removeUnverifiedRequestIdentifiers-ChlwRmhd.mjs.map +0 -1
  369. package/dist/retryRequestDataSilos-DnwXA1YZ.mjs +0 -2
  370. package/dist/retryRequestDataSilos-DnwXA1YZ.mjs.map +0 -1
  371. package/dist/skipPreflightJobs-jK5lNlmv.mjs +0 -2
  372. package/dist/skipPreflightJobs-jK5lNlmv.mjs.map +0 -1
  373. package/dist/skipRequestDataSilos-DQGroOos.mjs +0 -2
  374. package/dist/skipRequestDataSilos-DQGroOos.mjs.map +0 -1
  375. package/dist/splitCsvToList-BRq_CIfd.mjs +0 -2
  376. package/dist/splitCsvToList-BRq_CIfd.mjs.map +0 -1
  377. package/dist/streamPrivacyRequestsToCsv-BK07Bm-T.mjs +0 -2
  378. package/dist/streamPrivacyRequestsToCsv-BK07Bm-T.mjs.map +0 -1
  379. package/dist/syncCodePackages-F-97FNjo.mjs +0 -232
  380. package/dist/syncCodePackages-F-97FNjo.mjs.map +0 -1
  381. package/dist/syncCookies-BxY36BeJ.mjs +0 -2
  382. package/dist/syncCookies-BxY36BeJ.mjs.map +0 -1
  383. package/dist/syncDataFlows-Cx5LZCen.mjs +0 -2
  384. package/dist/syncDataFlows-Cx5LZCen.mjs.map +0 -1
  385. package/dist/syncTemplates-BrH7Yr0V.mjs +0 -23
  386. package/dist/syncTemplates-BrH7Yr0V.mjs.map +0 -1
  387. package/dist/time-Bl_c3W8U.mjs +0 -2
  388. package/dist/time-Bl_c3W8U.mjs.map +0 -1
  389. package/dist/types-B4CVJCpj.mjs +0 -2
  390. package/dist/types-B4CVJCpj.mjs.map +0 -1
  391. package/dist/updateConsentManagerVersionToLatest-C221vAAw.mjs +0 -2
  392. package/dist/updateConsentManagerVersionToLatest-C221vAAw.mjs.map +0 -1
  393. package/dist/uploadConsents-BbR7_sSt.mjs +0 -2
  394. package/dist/uploadConsents-BbR7_sSt.mjs.map +0 -1
  395. package/dist/uploadCookiesFromCsv-roHWekOP.mjs +0 -2
  396. package/dist/uploadCookiesFromCsv-roHWekOP.mjs.map +0 -1
  397. package/dist/uploadDataFlowsFromCsv-DcTbrsv2.mjs +0 -2
  398. package/dist/uploadDataFlowsFromCsv-DcTbrsv2.mjs.map +0 -1
  399. package/dist/uploadPrivacyRequestsFromCsv-BUGTS-pY.mjs +0 -17
  400. package/dist/uploadPrivacyRequestsFromCsv-BUGTS-pY.mjs.map +0 -1
  401. package/dist/uploadSiloDiscoveryResults-D2fK92WR.mjs +0 -20
  402. package/dist/uploadSiloDiscoveryResults-D2fK92WR.mjs.map +0 -1
  403. package/dist/withPreferenceRetry-xLMZyTq9.mjs +0 -2
  404. package/dist/withPreferenceRetry-xLMZyTq9.mjs.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"notifyPrivacyRequestsAdditionalTime-BUdhSCNL.mjs","names":[],"sources":["../src/lib/requests/notifyPrivacyRequestsAdditionalTime.ts"],"sourcesContent":["import { RequestAction } from '@transcend-io/privacy-types';\nimport {\n buildTranscendGraphQLClient,\n fetchAllTemplates,\n makeGraphQLRequest,\n} from '@transcend-io/sdk';\nimport { map } from '@transcend-io/utils';\nimport cliProgress from 'cli-progress';\nimport colors from 'colors';\n\nimport { DEFAULT_TRANSCEND_API } from '../../constants.js';\nimport { logger } from '../../logger.js';\nimport { NOTIFY_ADDITIONAL_TIME, fetchAllRequests } from '../graphql/index.js';\n\n/**\n * Mark a set of privacy requests to be in silent mode.\n * Note requests in silent mode are ignored\n *\n * @param options - Options\n * @returns The number of requests marked silent\n */\nexport async function notifyPrivacyRequestsAdditionalTime({\n requestActions = Object.values(RequestAction),\n auth,\n requestIds,\n createdAtBefore,\n days = 45,\n daysLeft = 10,\n createdAtAfter,\n updatedAtBefore,\n updatedAtAfter,\n emailTemplate = 'Additional Time Needed',\n concurrency = 100,\n transcendUrl = DEFAULT_TRANSCEND_API,\n}: {\n /** The request actions that should be restarted */\n requestActions?: RequestAction[];\n /** Filter for requests created before this date */\n createdAtBefore: Date;\n /** Filter for requests created after this date */\n createdAtAfter?: Date;\n /** Filter for requests updated before this date */\n updatedAtBefore?: Date;\n /** Filter for requests updated after this date */\n updatedAtAfter?: Date;\n /** Email template */\n emailTemplate?: string;\n /** Transcend API key authentication */\n auth: string;\n /** Number of days to extend request by */\n days?: number;\n /**\n * Only notify requests that have less than this number of days until they are considered expired.\n * This allows for re-running the command without notifying the same users multiple times\n */\n daysLeft?: number;\n /** Concurrency limit for approving */\n concurrency?: number;\n /** The set of privacy requests to notify */\n requestIds?: string[];\n /** API URL for Transcend backend */\n transcendUrl?: string;\n}): Promise<number> {\n // Find all requests made before createdAt that are in a removing data state\n const client = buildTranscendGraphQLClient(transcendUrl, auth);\n\n // Time duration\n const t0 = new Date().getTime();\n // create a new progress bar instance and use shades_classic theme\n const progressBar = new cliProgress.SingleBar({}, cliProgress.Presets.shades_classic);\n\n // Grab the template with that title\n const matchingTemplates = await fetchAllTemplates(client, {\n logger,\n filterBy: { title: emailTemplate },\n });\n const exactTemplateMatch = matchingTemplates.find((template) => template.title === emailTemplate);\n if (!exactTemplateMatch) {\n throw new Error(`Failed to find a template with title: \"${emailTemplate}\"`);\n }\n\n // Pull in the requests\n let allRequests = await fetchAllRequests(client, {\n actions: requestActions,\n createdAtBefore,\n createdAtAfter,\n updatedAtBefore,\n updatedAtAfter,\n isSilent: false,\n isClosed: false,\n requestIds,\n });\n\n // Filter requests by daysLeft\n allRequests = allRequests.filter(\n (request) => typeof request.daysRemaining === 'number' && request.daysRemaining < daysLeft,\n );\n\n // Notify Transcend\n logger.info(colors.magenta(`Notifying \"${allRequests.length}\" that more time is needed.`));\n\n let total = 0;\n progressBar.start(allRequests.length, 0);\n await map(\n allRequests,\n async (requestToNotify) => {\n await makeGraphQLRequest(client, NOTIFY_ADDITIONAL_TIME, {\n variables: {\n input: {\n requestId: requestToNotify.id,\n template: exactTemplateMatch.template.defaultMessage,\n subject: exactTemplateMatch.subject.defaultMessage,\n additionalTime: days,\n },\n },\n logger,\n });\n\n total += 1;\n progressBar.update(total);\n },\n { concurrency },\n );\n\n progressBar.stop();\n const t1 = new Date().getTime();\n const totalTime = t1 - t0;\n\n logger.info(\n colors.green(\n `Successfully marked ${total} requests as silent mode in \"${totalTime / 1000}\" seconds!`,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AY"}
@@ -0,0 +1,6 @@
1
+ import{t as e}from"./logger-Bj782ZYD.mjs";import{existsSync as t,mkdirSync as n,rmSync as r}from"node:fs";import{dirname as i,join as a,parse as o}from"node:path";import s from"colors";async function c(c,f){let{filePath:p,outputDir:m,clearOutputDir:h,onProgress:g}=c,_=m||i(p),{name:v}=o(p),y=a(_,`${v}.csv`);if(n(_,{recursive:!0}),h&&t(y))try{r(y,{force:!0})}catch(t){e.warn(s.yellow(`Could not remove existing output file ${y}: ${t.message}`))}let b=await f.create(`:memory:`),x=await b.connect();try{await u(x,`PRAGMA temp_directory='';`);let t=e=>`'${e.replace(/'/g,`''`)}'`;await l(x,`
2
+ COPY (SELECT * FROM read_parquet(${t(p)}))
3
+ TO ${t(y)}
4
+ (HEADER, DELIMITER ',', QUOTE '"', ESCAPE '"', NULL '');
5
+ `),g?.(0,void 0),e.info(s.green(`Wrote CSV → ${y}`))}finally{await d(x),await d(b)}}async function l(e,t){await d(await e.run(t))}async function u(e,t){try{await l(e,t)}catch{}}async function d(e){if(!(!e||typeof e.dispose!=`function`))try{await e.dispose()}catch{}}export{c as t};
6
+ //# sourceMappingURL=parquetToCsvOneFile-B84XXInh.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parquetToCsvOneFile-B84XXInh.mjs","names":[],"sources":["../src/lib/helpers/parquetToCsvOneFile.ts"],"sourcesContent":["import { mkdirSync, rmSync, existsSync } from 'node:fs';\nimport { dirname, join, parse } from 'node:path';\n\nimport type { DuckDBConnection, DuckDBInstance } from '@duckdb/node-api';\nimport colors from 'colors';\n\nimport { logger } from '../../logger.js';\n\n/** Progress callback used by the parent runner to surface progress to the UI. */\ntype OnProgress = (processed: number, total?: number) => void;\n\n/**\n * Options for converting a single Parquet file into a single CSV file.\n */\nexport type ParquetToCsvOneFileOptions = {\n /** Absolute or relative path to the input `.parquet` file. */\n filePath: string;\n /**\n * Directory where the output CSV will be written.\n * If omitted, the CSV is written next to the input file.\n */\n outputDir?: string;\n /**\n * When true, removes a pre-existing output file with the same name before writing.\n * Useful for re-runs; ignored if the file does not exist.\n */\n clearOutputDir: boolean;\n /**\n * Optional progress hook. Called with the number of processed records.\n * `total` is not computed here; it will be `undefined`.\n */\n onProgress?: OnProgress;\n};\n\n/**\n * Convert a single Parquet file to a single CSV file (1:1) using DuckDB.\n *\n * Output naming: `${basename}.csv` in `outputDir ?? dirname(filePath)`.\n *\n * Errors:\n * - Throws on I/O failures or DuckDB execution errors.\n *\n * Why DuckDB?\n * - Robust reader for many Parquet dialects (e.g., Spark output, nested types, timestamps).\n * - Streaming COPY handles large files without loading everything into JS memory.\n *\n * What this does:\n * - Opens an in-memory DuckDB database (no `.db` file created).\n * - Optionally disables temp spilling to disk (so only your CSV is written).\n * - Executes a single `COPY (SELECT * FROM read_parquet(...)) TO ...` statement.\n * - Produces exactly one CSV per input Parquet (no chunking or rotation).\n *\n * Notes & defaults:\n * - DuckDBInstance: `:memory:` (ephemeral). No persistent DB file is created.\n * - Temp files: disabled via `PRAGMA temp_directory=''` (best-effort; ignored if unsupported).\n * - CSV format: header row, comma delimiter, double-quote quoting, empty string for NULL.\n * - Progress: DuckDB COPY doesn't expose row-level progress via the JS API; we emit a\n * best-effort final callback.\n *\n * Requirements:\n * - `@duckdb/node-api` npm package installed and available at runtime.\n * - Supported platform binary (mac arm64/x64, linux x64, windows x64).\n *\n * @param opts - Conversion options\n * @param DuckDb - DuckDB instance to use\n * @returns Promise<void> when the CSV has been written\n */\nexport async function parquetToCsvOneFile(\n opts: ParquetToCsvOneFileOptions,\n DuckDb: typeof DuckDBInstance,\n): Promise<void> {\n const { filePath, outputDir, clearOutputDir, onProgress } = opts;\n\n const baseDir = outputDir || dirname(filePath);\n const { name: baseName } = parse(filePath);\n const outPath = join(baseDir, `${baseName}.csv`);\n\n // Ensure output directory exists\n mkdirSync(baseDir, { recursive: true });\n\n // Remove any pre-existing output file if requested\n if (clearOutputDir && existsSync(outPath)) {\n try {\n rmSync(outPath, { force: true });\n } catch (err) {\n logger.warn(\n colors.yellow(\n `Could not remove existing output file ${outPath}: ${(err as Error).message}`,\n ),\n );\n }\n }\n\n // In-memory DB: no .db file created on disk\n const db = await DuckDb.create(':memory:');\n const conn = await db.connect();\n\n try {\n // Optional: prevent DuckDB from creating temp files on disk (best-effort).\n // Some versions may ignore or error; we ignore such errors safely.\n await runIgnoreError(conn, \"PRAGMA temp_directory='';\");\n\n // Optionally: cap memory to encourage in-memory execution or fail-fast\n // (commented out by default; uncomment to enforce a limit)\n // await runIgnoreError(conn, \"PRAGMA memory_limit='4GB';\");\n\n // Ensure stable CSV settings: header, comma delimiter, double quotes, empty string for NULLs.\n // Escape single quotes for SQL string literals\n const q = (p: string): string => `'${p.replace(/'/g, \"''\")}'`;\n\n // Use COPY with a subquery so DuckDB streams Parquet -> CSV efficiently.\n const sql = `\n COPY (SELECT * FROM read_parquet(${q(filePath)}))\n TO ${q(outPath)}\n (HEADER, DELIMITER ',', QUOTE '\"', ESCAPE '\"', NULL '');\n `;\n\n await run(conn, sql);\n\n // Best-effort progress notification (DuckDB JS API doesn't expose progress for COPY)\n onProgress?.(0, undefined);\n\n logger.info(colors.green(`Wrote CSV → ${outPath}`));\n } finally {\n // Close connection + db handles gracefully\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n await disposeSafe(conn as any);\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n await disposeSafe(db as any);\n }\n}\n\n/* =============================================================================\n * DuckDB helpers\n * =============================================================================\n */\n\n/**\n * Execute a SQL statement on a DuckDB connection and dispose the result.\n *\n * @param conn - DuckDB connection\n * @param sql - SQL string to run\n * @returns Promise<void>\n */\nasync function run(conn: DuckDBConnection, sql: string): Promise<void> {\n const result = await conn.run(sql);\n // The high-level API returns a Result; ensure we dispose it to free buffers.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n await disposeSafe(result as any);\n}\n\n/**\n * Execute a SQL statement but ignore any error that occurs.\n * Useful for best-effort PRAGMAs that may not be supported across versions.\n *\n * @param conn - DuckDB connection\n * @param sql - SQL string to run\n * @returns Promise<void>\n */\nasync function runIgnoreError(conn: DuckDBConnection, sql: string): Promise<void> {\n try {\n await run(conn, sql);\n } catch {\n // ignore\n }\n}\n\n/**\n * Dispose a DuckDB resource (connection or instance) if present.\n *\n * @param handle - Object exposing an async `dispose()` method\n * @returns Promise<void>\n */\nasync function disposeSafe(\n handle:\n | {\n /** Dispose handler */\n dispose: () => Promise<void>;\n }\n | null\n | undefined,\n): Promise<void> {\n if (!handle || typeof handle.dispose !== 'function') return;\n try {\n await handle.dispose();\n } catch {\n // ignore\n }\n}\n"],"mappings":"yLAmEA,eAAsB,EACpB,EACA,EACe,CACf,GAAM,CAAE,WAAU,YAAW,iBAAgB,cAAe,EAEtD,EAAU,GAAa,EAAQ,EAAS,CACxC,CAAE,KAAM,GAAa,EAAM,EAAS,CACpC,EAAU,EAAK,EAAS,GAAG,EAAS,MAAM,CAMhD,GAHA,EAAU,EAAS,CAAE,UAAW,GAAM,CAAC,CAGnC,GAAkB,EAAW,EAAQ,CACvC,GAAI,CACF,EAAO,EAAS,CAAE,MAAO,GAAM,CAAC,OACzB,EAAK,CACZ,EAAO,KACL,EAAO,OACL,yCAAyC,EAAQ,IAAK,EAAc,UACrE,CACF,CAKL,IAAM,EAAK,MAAM,EAAO,OAAO,WAAW,CACpC,EAAO,MAAM,EAAG,SAAS,CAE/B,GAAI,CAGF,MAAM,EAAe,EAAM,4BAA4B,CAQvD,IAAM,EAAK,GAAsB,IAAI,EAAE,QAAQ,KAAM,KAAK,CAAC,GAS3D,MAAM,EAAI,EANE;yCACyB,EAAE,EAAS,CAAC;WAC1C,EAAE,EAAQ,CAAC;;MAIE,CAGpB,IAAa,EAAG,IAAA,GAAU,CAE1B,EAAO,KAAK,EAAO,MAAM,eAAe,IAAU,CAAC,QAC3C,CAGR,MAAM,EAAY,EAAY,CAE9B,MAAM,EAAY,EAAU,EAgBhC,eAAe,EAAI,EAAwB,EAA4B,CAIrE,MAAM,EAHS,MAAM,EAAK,IAAI,EAAI,CAGF,CAWlC,eAAe,EAAe,EAAwB,EAA4B,CAChF,GAAI,CACF,MAAM,EAAI,EAAM,EAAI,MACd,GAWV,eAAe,EACb,EAOe,CACX,MAAC,GAAU,OAAO,EAAO,SAAY,YACzC,GAAI,CACF,MAAM,EAAO,SAAS,MAChB"}
@@ -0,0 +1,2 @@
1
+ import{t as e}from"./logger-Bj782ZYD.mjs";import{l as t,n}from"./constants-ClkQQhJs.mjs";import r from"colors";import*as i from"io-ts";import a from"fuzzysearch";import o from"inquirer";function s(e,t){return a(e.toLowerCase(),t.toLowerCase())||a(t.toLowerCase(),e.toLowerCase())}function c(e,r,i,a){let c=e.filter(e=>s(r.toLowerCase(),e.toLowerCase()));return[...c,new o.Separator,...i?[]:[t],...a?[n]:[],...e.filter(e=>!c.includes(e))]}const l=i.type({key:i.string,values:i.array(i.string)});function u(t){let n=t.map(e=>{let[t,n]=e.trim().split(`:`);if(!n)throw Error(`Expected attributes in key:value1;value2,key2:value3;value4`);return{key:t,values:n.split(`;`)}});return e.info(r.magenta(`Attributes to apply to all requests:`)),e.info(r.magenta(JSON.stringify(n,null,2))),n}export{s as i,u as n,c as r,l as t};
2
+ //# sourceMappingURL=parseAttributesFromString-D1Yl0xwT.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"parseAttributesFromString-CZStzJc0.mjs","names":[],"sources":["../src/lib/requests/fuzzyMatchColumns.ts","../src/lib/requests/parseAttributesFromString.ts"],"sourcesContent":["import fuzzysearch from 'fuzzysearch';\nimport inquirer from 'inquirer';\n\nimport { NONE, BULK_APPLY } from './constants.js';\n\n/**\n * Check if word1 and word2 are a fuzzy match of each other.\n * Returns true if word1 is fuzzy match of word2 or vice versa.\n *\n * @param word1 - First word\n * @param word2 - Second word\n * @returns True if words are fuzzy match\n */\nexport function fuzzySearch(word1: string, word2: string): boolean {\n return (\n fuzzysearch(word1.toLowerCase(), word2.toLowerCase()) ||\n fuzzysearch(word2.toLowerCase(), word1.toLowerCase())\n );\n}\n\n/**\n * Fuzzy match column names for a particular field\n *\n * @param allColumnNames - List of all column names\n * @param fuzzyMapName - The name of field being mapped to\n * @param isRequired - When true, don't include \"NONE\" as an option\n * @param canApplyAll - When true, include an option to specify the value in bulk\n * @returns The list of suggestions for inquirer\n */\nexport function fuzzyMatchColumns(\n allColumnNames: string[],\n fuzzyMapName: string,\n isRequired: boolean,\n canApplyAll?: boolean,\n): (string | InstanceType<typeof inquirer.Separator>)[] {\n const matchingColumnNames = allColumnNames.filter((x) =>\n fuzzySearch(fuzzyMapName.toLowerCase(), x.toLowerCase()),\n );\n return [\n ...matchingColumnNames,\n new inquirer.Separator(),\n ...(isRequired ? [] : [NONE]),\n ...(canApplyAll ? [BULK_APPLY] : []),\n ...allColumnNames.filter((x) => !matchingColumnNames.includes(x)),\n ];\n}\n","import colors from 'colors';\nimport * as t from 'io-ts';\n\nimport { logger } from '../../logger.js';\n\nexport const ParsedAttributeInput = t.type({\n /** Attribute key */\n key: t.string,\n /** Attribute values */\n values: t.array(t.string),\n});\n\n/** Type override */\nexport type ParsedAttributeInput = t.TypeOf<typeof ParsedAttributeInput>;\n\n/**\n * Parse out the extra attributes to apply to all requests uploaded\n *\n * @param attributes - input as string, e.g. ['key:value1;value2','key2:value3;value4']\n * @returns The parsed attributes\n */\nexport function parseAttributesFromString(attributes: string[]): ParsedAttributeInput[] {\n // Parse out the extra attributes to apply to all requests uploaded\n const parsedAttributes = attributes.map((attribute) => {\n const [attributeKey, attributeValuesRaw] = attribute.trim().split(':');\n if (!attributeValuesRaw) {\n throw new Error('Expected attributes in key:value1;value2,key2:value3;value4');\n }\n const attributeValues = attributeValuesRaw.split(';');\n return {\n key: attributeKey,\n values: attributeValues,\n };\n });\n logger.info(colors.magenta('Attributes to apply to all requests:'));\n logger.info(colors.magenta(JSON.stringify(parsedAttributes, null, 2)));\n return parsedAttributes;\n}\n"],"mappings":"0LAaA,SAAgB,EAAY,EAAe,EAAwB,CACjE,OACE,EAAY,EAAM,aAAa,CAAE,EAAM,aAAa,CAAC,EACrD,EAAY,EAAM,aAAa,CAAE,EAAM,aAAa,CAAC,CAazD,SAAgB,EACd,EACA,EACA,EACA,EACsD,CACtD,IAAM,EAAsB,EAAe,OAAQ,GACjD,EAAY,EAAa,aAAa,CAAE,EAAE,aAAa,CAAC,CACzD,CACD,MAAO,CACL,GAAG,EACH,IAAI,EAAS,UACb,GAAI,EAAa,EAAE,CAAG,CAAC,EAAK,CAC5B,GAAI,EAAc,CAAC,EAAW,CAAG,EAAE,CACnC,GAAG,EAAe,OAAQ,GAAM,CAAC,EAAoB,SAAS,EAAE,CAAC,CAClE,CCvCH,MAAa,EAAuB,EAAE,KAAK,CAEzC,IAAK,EAAE,OAEP,OAAQ,EAAE,MAAM,EAAE,OAAO,CAC1B,CAAC,CAWF,SAAgB,EAA0B,EAA8C,CAEtF,IAAM,EAAmB,EAAW,IAAK,GAAc,CACrD,GAAM,CAAC,EAAc,GAAsB,EAAU,MAAM,CAAC,MAAM,IAAI,CACtE,GAAI,CAAC,EACH,MAAU,MAAM,8DAA8D,CAGhF,MAAO,CACL,IAAK,EACL,OAHsB,EAAmB,MAAM,IAAI,CAIpD,EACD,CAGF,OAFA,EAAO,KAAK,EAAO,QAAQ,uCAAuC,CAAC,CACnE,EAAO,KAAK,EAAO,QAAQ,KAAK,UAAU,EAAkB,KAAM,EAAE,CAAC,CAAC,CAC/D"}
1
+ {"version":3,"file":"parseAttributesFromString-D1Yl0xwT.mjs","names":[],"sources":["../src/lib/requests/fuzzyMatchColumns.ts","../src/lib/requests/parseAttributesFromString.ts"],"sourcesContent":["import fuzzysearch from 'fuzzysearch';\nimport inquirer from 'inquirer';\n\nimport { NONE, BULK_APPLY } from './constants.js';\n\n/**\n * Check if word1 and word2 are a fuzzy match of each other.\n * Returns true if word1 is fuzzy match of word2 or vice versa.\n *\n * @param word1 - First word\n * @param word2 - Second word\n * @returns True if words are fuzzy match\n */\nexport function fuzzySearch(word1: string, word2: string): boolean {\n return (\n fuzzysearch(word1.toLowerCase(), word2.toLowerCase()) ||\n fuzzysearch(word2.toLowerCase(), word1.toLowerCase())\n );\n}\n\n/**\n * Fuzzy match column names for a particular field\n *\n * @param allColumnNames - List of all column names\n * @param fuzzyMapName - The name of field being mapped to\n * @param isRequired - When true, don't include \"NONE\" as an option\n * @param canApplyAll - When true, include an option to specify the value in bulk\n * @returns The list of suggestions for inquirer\n */\nexport function fuzzyMatchColumns(\n allColumnNames: string[],\n fuzzyMapName: string,\n isRequired: boolean,\n canApplyAll?: boolean,\n): (string | InstanceType<typeof inquirer.Separator>)[] {\n const matchingColumnNames = allColumnNames.filter((x) =>\n fuzzySearch(fuzzyMapName.toLowerCase(), x.toLowerCase()),\n );\n return [\n ...matchingColumnNames,\n new inquirer.Separator(),\n ...(isRequired ? [] : [NONE]),\n ...(canApplyAll ? [BULK_APPLY] : []),\n ...allColumnNames.filter((x) => !matchingColumnNames.includes(x)),\n ];\n}\n","import colors from 'colors';\nimport * as t from 'io-ts';\n\nimport { logger } from '../../logger.js';\n\nexport const ParsedAttributeInput = t.type({\n /** Attribute key */\n key: t.string,\n /** Attribute values */\n values: t.array(t.string),\n});\n\n/** Type override */\nexport type ParsedAttributeInput = t.TypeOf<typeof ParsedAttributeInput>;\n\n/**\n * Parse out the extra attributes to apply to all requests uploaded\n *\n * @param attributes - input as string, e.g. ['key:value1;value2','key2:value3;value4']\n * @returns The parsed attributes\n */\nexport function parseAttributesFromString(attributes: string[]): ParsedAttributeInput[] {\n // Parse out the extra attributes to apply to all requests uploaded\n const parsedAttributes = attributes.map((attribute) => {\n const [attributeKey, attributeValuesRaw] = attribute.trim().split(':');\n if (!attributeValuesRaw) {\n throw new Error('Expected attributes in key:value1;value2,key2:value3;value4');\n }\n const attributeValues = attributeValuesRaw.split(';');\n return {\n key: attributeKey,\n values: attributeValues,\n };\n });\n logger.info(colors.magenta('Attributes to apply to all requests:'));\n logger.info(colors.magenta(JSON.stringify(parsedAttributes, null, 2)));\n return parsedAttributes;\n}\n"],"mappings":"0LAaA,SAAgB,EAAY,EAAe,EAAwB,CACjE,OACE,EAAY,EAAM,aAAa,CAAE,EAAM,aAAa,CAAC,EACrD,EAAY,EAAM,aAAa,CAAE,EAAM,aAAa,CAAC,CAazD,SAAgB,EACd,EACA,EACA,EACA,EACsD,CACtD,IAAM,EAAsB,EAAe,OAAQ,GACjD,EAAY,EAAa,aAAa,CAAE,EAAE,aAAa,CAAC,CACzD,CACD,MAAO,CACL,GAAG,EACH,IAAI,EAAS,UACb,GAAI,EAAa,EAAE,CAAG,CAAC,EAAK,CAC5B,GAAI,EAAc,CAAC,EAAW,CAAG,EAAE,CACnC,GAAG,EAAe,OAAQ,GAAM,CAAC,EAAoB,SAAS,EAAE,CAAC,CAClE,CCvCH,MAAa,EAAuB,EAAE,KAAK,CAEzC,IAAK,EAAE,OAEP,OAAQ,EAAE,MAAM,EAAE,OAAO,CAC1B,CAAC,CAWF,SAAgB,EAA0B,EAA8C,CAEtF,IAAM,EAAmB,EAAW,IAAK,GAAc,CACrD,GAAM,CAAC,EAAc,GAAsB,EAAU,MAAM,CAAC,MAAM,IAAI,CACtE,GAAI,CAAC,EACH,MAAU,MAAM,8DAA8D,CAGhF,MAAO,CACL,IAAK,EACL,OAHsB,EAAmB,MAAM,IAAI,CAIpD,EACD,CAGF,OAFA,EAAO,KAAK,EAAO,QAAQ,uCAAuC,CAAC,CACnE,EAAO,KAAK,EAAO,QAAQ,KAAK,UAAU,EAAkB,KAAM,EAAE,CAAC,CAAC,CAC/D"}
@@ -0,0 +1,3 @@
1
+ import{t as e}from"./logger-Bj782ZYD.mjs";import{chunk as t,difference as n,flatten as r,keyBy as i,uniq as a}from"lodash-es";import{apply as o,getEntries as s}from"@transcend-io/type-utils";import c from"colors";import{CREATE_DATA_SILOS as l,UPDATE_DATA_SILOS as u,UPDATE_OR_CREATE_DATA_POINT as d,convertToDataSubjectBlockList as f,createDataSubject as p,fetchAllActions as m,fetchAllAttributes as h,fetchAllDataSilos as g,fetchAllDataSubjects as _,fetchApiKeys as v,fetchIdentifiersAndCreateMissing as y,makeGraphQLRequest as b,syncAction as x,syncActionItemCollections as S,syncActionItems as C,syncAgentFiles as w,syncAgentFunctions as T,syncAgents as ee,syncAttribute as te,syncBusinessEntities as ne,syncConsentManager as E,syncCookies as re,syncDataCategories as ie,syncDataFlows as ae,syncDataSiloDependencies as oe,syncDataSubject as se,syncEnricher as ce,syncIdentifier as le,syncIntlMessages as ue,syncPartitions as de,syncPolicies as fe,syncPrivacyCenter as pe,syncProcessingActivities as me,syncProcessingPurposes as he,syncPromptGroups as ge,syncPromptPartials as _e,syncPrompts as ve,syncTeams as ye,syncTemplate as be,syncVendors as xe}from"@transcend-io/sdk";import{map as D,mapSeries as O}from"@transcend-io/utils";import k from"cli-progress";async function A({"data-silos":t=[],"data-subjects":o=[],"processing-activities":s=[],enrichers:l=[]},u,d=!1){let f=a([...r(t.map(e=>e[`data-subjects`]||[])||[]),...r(s.map(({dataSubjectTypes:e})=>e??[])??[]),...r(l.map(e=>e[`data-subjects`]||[])||[]),...o.map(e=>e.type)]);if(f.length===0&&!d)return{};let m=await _(u,{logger:e}),h=i(m,`type`),g=n(f,m.map(({type:e})=>e));if(g.length>0){e.info(c.magenta(`Creating ${g.length} new data subjects...`));for(let t of g){e.info(c.magenta(`Creating data subject ${t}...`));let n=await p(u,{input:t,logger:e});e.info(c.green(`Created data subject ${t}!`)),h[t]=n}}return h}async function j(n,r,{pageSize:a,dataSubjectsByName:s,apiKeysByTitle:p}){let m=!1,h=new Date().getTime();e.info(c.magenta(`Syncing "${n.length}" data silos...`));let _=i(await g(r,{titles:n.map(({title:e})=>e),pageSize:a,logger:e}),`title`),v=n.filter(({title:e})=>!_[e]);v.length>0&&(e.info(c.magenta(`Creating "${v.length}" data silos that did not exist...`)),await O(t(v,20),async t=>{let{createDataSilos:{dataSilos:n}}=await b(r,l,{variables:{input:t.map(e=>({name:e[`outer-type`]||e.integrationName,title:e.title,country:e.country,countrySubDivision:e.countrySubDivision}))},logger:e});n.forEach(e=>{_[e.title]=e})}),e.info(c.green(`Successfully created "${v.length}" data silos!`)));let y=t(n,20);await O(y,async(t,n)=>{e.info(c.magenta(`[Batch ${n+1}/${y.length}] Syncing "${t.length}" data silos`)),await b(r,u,{variables:{input:{dataSilos:t.map(e=>({id:_[e.title].id,country:e.country,countrySubDivision:e.countrySubDivision,url:e.url,headers:e.headers,description:e.description,identifiers:e[`identity-keys`],isLive:!e.disabled,ownerEmails:e.owners,teamNames:e.teams,dependedOnDataSiloTitles:e[`deletion-dependencies`]?void 0:[],apiKeyId:e[`api-key-title`]?p[e[`api-key-title`]].id:void 0,dataSubjectBlockListIds:e[`data-subjects`]?f(e[`data-subjects`],s):void 0,attributes:e.attributes,businessEntityTitles:e.businessEntityTitles,notifyEmailAddress:e[`email-settings`]?.[`notify-email-address`],promptAVendorEmailSendFrequency:e[`email-settings`]?.[`send-frequency`],promptAVendorEmailSendType:e[`email-settings`]?.[`send-type`],promptAVendorEmailIncludeIdentifiersAttachment:e[`email-settings`]?.[`include-identifiers-attachment`],promptAVendorEmailCompletionLinkType:e[`email-settings`]?.[`completion-link-type`],manualWorkRetryFrequency:e[`email-settings`]?.[`manual-work-retry-frequency`]}))}},logger:e}),e.info(c.green(`[Batch ${n+1}/${y.length}] Synced "${t.length}" data silos!`))});let x=new k.SingleBar({},k.Presets.shades_classic),S=n.filter(({datapoints:e=[]})=>e.length>0),C=n.map(({datapoints:e=[]})=>e.length).reduce((e,t)=>e+t,0);e.info(c.magenta(`Syncing "${C}" datapoints from "${S.length}" data silos...`)),x.start(C,0);let w=0;await D(S,async({datapoints:t,title:n})=>{t&&await O(t,async t=>{let i=t.fields?t.fields.map(({key:e,description:t,categories:n,purposes:r,attributes:i,...a})=>({name:e,description:t,categories:n?n.map(e=>({...e,name:e.name||`Other`})):void 0,purposes:r?r.map(e=>({...e,name:e.name||`Other`})):void 0,attributes:i,accessRequestVisibilityEnabled:a[`access-request-visibility-enabled`],erasureRequestRedactionEnabled:a[`erasure-request-redaction-enabled`]})):void 0,a={dataSiloId:_[n].id,path:t.path,name:t.key,title:t.title,description:t.description,...t.owners?{ownerEmails:t.owners}:{},...t.teams?{teamNames:t.teams}:{},...t[`data-collection-tag`]?{dataCollectionTag:t[`data-collection-tag`]}:{},querySuggestions:t[`privacy-action-queries`]?Object.entries(t[`privacy-action-queries`]).map(([e,t])=>({requestType:e,suggestedQuery:t})):void 0,enabledActions:t[`privacy-actions`]||[],subDataPoints:i},o=(a.subDataPoints||[]).map(({name:e})=>e),s=o.filter((e,t)=>o.indexOf(e)!==t);if(s.length>0)e.info(c.red(`\nCannot update datapoint "${t.key}" as it has duplicate sub-datapoints with the same name: \n${s.join(`
2
+ `)}`)),m=!0;else try{await b(r,d,{variables:a,logger:e})}catch(r){e.info(c.red(`\nFailed to update datapoint "${t.key}" for data silo "${n}"! - \n${r.message}`)),m=!0}w+=1,x.update(w)})},{concurrency:10}),x.stop();let T=new Date().getTime()-h;return e.info(c.green(`Synced "${n.length}" data silos and "${C}" datapoints in "${T/1e3}" seconds!`)),{success:!m,dataSiloTitleToId:o(_,({id:e})=>e)}}async function M(t,n,{pageSize:r=50,publishToPrivacyCenter:i=!0,classifyService:a=!1,deleteExtraAttributeValues:o=!1}){let s=!1;e.info(c.magenta(`Fetching data with page size ${r}...`));let{templates:l,attributes:u,actions:d,identifiers:f,"data-subjects":p,"business-entities":g,enrichers:b,cookies:O,"consent-manager":k,"data-silos":M,"data-flows":N,prompts:P,"prompt-groups":F,"prompt-partials":I,agents:L,"agent-functions":R,"agent-files":z,vendors:B,"data-categories":V,"processing-activities":H,"processing-purposes":U,"action-items":W,"action-item-collections":G,teams:K,"privacy-center":q,messages:J,policies:Y,partitions:X}=t,[Z,Q,Se]=await Promise.all([b||f?y(n,{input:t,skipPublish:!i,logger:e}):{},M||p||b||H?A(t,n):{},M&&M.map(e=>e[`api-key-title`]||[]).reduce((e,t)=>e+t.length,0)>0?v(n,{apiKeyInputs:t,logger:e}):{}]);if(k){e.info(c.magenta(`Syncing consent manager...`));try{await E(n,k,{logger:e}),e.info(c.green(`Successfully synced consent manager!`))}catch(t){s=!0,e.error(c.red(`Failed to sync consent manager! - ${t.message}`))}}if(P){let t=await ve(n,P,{logger:e});s||=!t}if(I){let t=await _e(n,I,{logger:e});s||=!t}if(F){let t=await ge(n,F,{logger:e});s||=!t}if(K){let t=await ye(n,K,{logger:e});s||=!t}if(l&&(e.info(c.magenta(`Syncing "${l.length}" email templates...`)),await D(l,async t=>{e.info(c.magenta(`Syncing template "${t.title}"...`));try{await be(n,t,{logger:e}),e.info(c.green(`Successfully synced template "${t.title}"!`))}catch(n){s=!0,e.error(c.red(`Failed to sync template "${t.title}"! - ${n.message}`))}},{concurrency:10}),e.info(c.green(`Synced "${l.length}" email templates!`))),g){let t=await ne(n,g,{logger:e});s||=!t}if(B){let t=await xe(n,B,{logger:e});s||=!t}if(V){let t=await ie(n,V,{logger:e});s||=!t}if(U){let t=await he(n,U,{logger:e});s||=!t}if(X){let t=await de(n,X,{logger:e});s||=!t}if(L){let t=await ee(n,L,{logger:e});s||=!t}if(R){let t=await T(n,R,{logger:e});s||=!t}if(z){let t=await w(n,z,{logger:e});s||=!t}if(O){let t=await re(n,O,{logger:e});s||=!t}if(G){let t=await S(n,G,{logger:e});s||=!t}if(u){e.info(c.magenta(`Syncing "${u.length}" attributes...`));let t=await h(n,{logger:e});await D(u,async r=>{let i=t.find(e=>e.name===r.name);e.info(c.magenta(`Syncing attribute "${r.name}"...`));try{await te(n,r,{existingAttribute:i,deleteExtraAttributeValues:o,logger:e}),e.info(c.green(`Successfully synced attribute "${r.name}"!`))}catch(t){s=!0,e.error(c.red(`Failed to sync attribute "${r.name}"! - ${t.message}`))}},{concurrency:10}),e.info(c.green(`Synced "${u.length}" attributes!`))}if(W){let t=await C(n,W,{logger:e});s||=!t}if(b&&(e.info(c.magenta(`Syncing "${b.length}" enrichers...`)),await D(b,async t=>{e.info(c.magenta(`Syncing enricher "${t.title}"...`));try{await ce(n,{input:t,identifierByName:Z,dataSubjectsByName:Q,logger:e}),e.info(c.green(`Successfully synced enricher "${t.title}"!`))}catch(n){s=!0,e.error(c.red(`Failed to sync enricher "${t.title}"! - ${n.message}`))}},{concurrency:10}),e.info(c.green(`Synced "${b.length}" enrichers!`))),f&&(e.info(c.magenta(`Syncing "${f.length}" identifiers...`)),await D(f,async t=>{let r=Z[t.name];if(!r)throw Error(`Failed to find identifier with name: ${t.type}. Should have been auto-created by cli.`);e.info(c.magenta(`Syncing identifier "${t.type}"...`));try{await le(n,{input:t,dataSubjectsByName:Q,identifierId:r.id,skipPublish:!i,logger:e}),e.info(c.green(`Successfully synced identifier "${t.type}"!`))}catch(n){s=!0,e.info(c.red(`Failed to sync identifier "${t.type}"! - ${n.message}`))}},{concurrency:10}),e.info(c.green(`Synced "${f.length}" identifiers!`))),d){e.info(c.magenta(`Syncing "${d.length}" actions...`));let t=await m(n,{logger:e});await D(d,async r=>{let a=t.find(e=>e.type===r.type);if(!a)throw Error(`Failed to find action with type: ${r.type}. Should have already existing in the organization.`);e.info(c.magenta(`Syncing action "${r.type}"...`));try{await x(n,{action:r,actionId:a.id,skipPublish:!i},{logger:e}),e.info(c.green(`Successfully synced action "${r.type}"!`))}catch(t){s=!0,e.error(c.red(`Failed to sync action "${r.type}"! - ${t.message}`))}},{concurrency:10}),e.info(c.green(`Synced "${d.length}" actions!`))}if(p){e.info(c.magenta(`Syncing "${p.length}" data subjects...`));let t=await _(n,{logger:e});await D(p,async r=>{let a=t.find(e=>e.type===r.type);if(!a)throw Error(`Failed to find data subject with type: ${r.type}. Should have already existing in the organization.`);e.info(c.magenta(`Syncing data subject "${r.type}"...`));try{await se(n,{input:r,dataSubjectId:a.id,skipPublish:!i,logger:e}),e.info(c.green(`Successfully synced data subject "${r.type}"!`))}catch(t){s=!0,e.info(c.red(`Failed to sync data subject "${r.type}"! - ${t.message}`))}},{concurrency:10}),e.info(c.green(`Synced "${p.length}" data subjects!`))}if(N){let t=await ae(n,N,{classifyService:a,logger:e});s||=!t}if(q){let t=await pe(n,q,{logger:e});s||=!t}if(J){let t=await ue(n,J,{logger:e});s||=!t}if(Y){let t=await fe(n,Y,{logger:e});s||=!t}let $=[];if(M){let{success:e,dataSiloTitleToId:t}=await j(M,n,{dataSubjectsByName:Q,apiKeysByTitle:Se,pageSize:r});M?.forEach(e=>{e[`deletion-dependencies`]&&$.push([t[e.title],e[`deletion-dependencies`]])}),s||=!e}if($.length>0&&await oe(n,{input:$,logger:e}),H){let t=await me(n,H,{logger:e});s||=!t}return s}function N(e,...t){let n=JSON.parse(JSON.stringify(e));return t.forEach(e=>{s(e).forEach(([e,t])=>{n[e]===void 0?n[e]=t:Array.isArray(t)?n[e]=[...n[e],...t]:n[e]=t})}),n}function P(e){let t=e.split(`,`).filter(e=>!!e),n={};return t.forEach(e=>{let[t,r]=e.split(`:`);if(!t||!r)throw Error(`Invalid variable: ${e}. Expected format: key:value`);n[t]=r}),n}export{A as a,j as i,N as n,M as r,P as t};
3
+ //# sourceMappingURL=parseVariablesFromString-BeKOGw5n.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parseVariablesFromString-BeKOGw5n.mjs","names":[],"sources":["../src/lib/graphql/ensureAllDataSubjectsExist.ts","../src/lib/graphql/syncDataSilos.ts","../src/lib/graphql/syncConfigurationToTranscend.ts","../src/lib/mergeTranscendInputs.ts","../src/lib/helpers/parseVariablesFromString.ts"],"sourcesContent":["import { createDataSubject, fetchAllDataSubjects, type DataSubject } from '@transcend-io/sdk';\nimport colors from 'colors';\nimport { GraphQLClient } from 'graphql-request';\nimport { keyBy, flatten, uniq, difference } from 'lodash-es';\n\nimport { TranscendInput } from '../../codecs.js';\nimport { logger } from '../../logger.js';\n\n/**\n * Fetch all of the data subjects in the organization\n *\n * @param input - Input to fetch\n * @param client - GraphQL client\n * @param fetchAll - When true, always fetch all subjects\n * @returns The list of data subjects\n */\nexport async function ensureAllDataSubjectsExist(\n {\n 'data-silos': dataSilos = [],\n 'data-subjects': dataSubjects = [],\n 'processing-activities': processingActivities = [],\n enrichers = [],\n }: TranscendInput,\n client: GraphQLClient,\n fetchAll = false,\n): Promise<{ [type in string]: DataSubject }> {\n const expectedDataSubjects = uniq([\n ...flatten(dataSilos.map((silo) => silo['data-subjects'] || []) || []),\n ...flatten(processingActivities.map(({ dataSubjectTypes }) => dataSubjectTypes ?? []) ?? []),\n ...flatten(enrichers.map((enricher) => enricher['data-subjects'] || []) || []),\n ...dataSubjects.map((subject) => subject.type),\n ]);\n if (expectedDataSubjects.length === 0 && !fetchAll) {\n return {};\n }\n\n const internalSubjects = await fetchAllDataSubjects(client, { logger });\n const dataSubjectByName = keyBy(internalSubjects, 'type');\n\n const missingDataSubjects = difference(\n expectedDataSubjects,\n internalSubjects.map(({ type }) => type),\n );\n\n if (missingDataSubjects.length > 0) {\n logger.info(colors.magenta(`Creating ${missingDataSubjects.length} new data subjects...`));\n for (const dataSubjectType of missingDataSubjects) {\n logger.info(colors.magenta(`Creating data subject ${dataSubjectType}...`));\n const created = await createDataSubject(client, { input: dataSubjectType, logger });\n logger.info(colors.green(`Created data subject ${dataSubjectType}!`));\n dataSubjectByName[dataSubjectType] = created;\n }\n }\n\n return dataSubjectByName;\n}\n","import {\n makeGraphQLRequest,\n ApiKey,\n convertToDataSubjectBlockList,\n type DataSubject,\n fetchAllDataSilos,\n type DataSilo,\n CREATE_DATA_SILOS,\n UPDATE_DATA_SILOS,\n UPDATE_OR_CREATE_DATA_POINT,\n} from '@transcend-io/sdk';\nimport { apply } from '@transcend-io/type-utils';\nimport { mapSeries, map } from '@transcend-io/utils';\n/* eslint-disable max-lines */\nimport cliProgress from 'cli-progress';\nimport colors from 'colors';\nimport { GraphQLClient } from 'graphql-request';\nimport { chunk, keyBy } from 'lodash-es';\n\nimport { DataSiloInput } from '../../codecs.js';\nimport { logger } from '../../logger.js';\n\nconst BATCH_SILOS_LIMIT = 20;\n\n/**\n * Sync a data silo configuration\n *\n * @param dataSilos - Data silos to sync\n * @param client - GraphQL client\n * @param options - Options\n * @returns Data silo info\n */\nexport async function syncDataSilos(\n dataSilos: DataSiloInput[],\n client: GraphQLClient,\n {\n pageSize,\n dataSubjectsByName,\n apiKeysByTitle,\n }: {\n /** Page size */\n pageSize: number;\n /** The data subjects in the organization */\n dataSubjectsByName: { [type in string]: DataSubject };\n /** API key title to API key */\n apiKeysByTitle: { [title in string]: ApiKey };\n },\n): Promise<{\n /** Whether successfully updated */\n success: boolean;\n /** A mapping between data silo title to data silo ID */\n dataSiloTitleToId: { [k in string]: string };\n}> {\n let encounteredError = false;\n\n // Time duration\n const t0 = new Date().getTime();\n logger.info(colors.magenta(`Syncing \"${dataSilos.length}\" data silos...`));\n\n // Determine the set of data silos that already exist\n const existingDataSilos = await fetchAllDataSilos(client, {\n titles: dataSilos.map(({ title }) => title),\n pageSize,\n logger,\n });\n\n // Create a mapping of title -> existing silo, if it exists\n const existingDataSiloByTitle = keyBy<Pick<DataSilo, 'id' | 'title'>>(existingDataSilos, 'title');\n\n // Create new silos that do not exist\n const newDataSiloInputs = dataSilos.filter(({ title }) => !existingDataSiloByTitle[title]);\n if (newDataSiloInputs.length > 0) {\n logger.info(\n colors.magenta(`Creating \"${newDataSiloInputs.length}\" data silos that did not exist...`),\n );\n\n // Batch the creation\n const chunked = chunk(newDataSiloInputs, BATCH_SILOS_LIMIT);\n await mapSeries(chunked, async (dependencyUpdateChunk) => {\n const {\n createDataSilos: { dataSilos },\n } = await makeGraphQLRequest<{\n /** Mutation result */\n createDataSilos: {\n /** New data silos */\n dataSilos: Pick<DataSilo, 'id' | 'title'>[];\n };\n }>(client, CREATE_DATA_SILOS, {\n variables: {\n input: dependencyUpdateChunk.map((input) => ({\n name: input['outer-type'] || input.integrationName,\n title: input.title,\n country: input.country,\n countrySubDivision: input.countrySubDivision,\n })),\n },\n logger,\n });\n\n // save mapping of title and id\n dataSilos.forEach((silo) => {\n existingDataSiloByTitle[silo.title] = silo;\n });\n });\n\n logger.info(colors.green(`Successfully created \"${newDataSiloInputs.length}\" data silos!`));\n }\n\n // Batch the updates\n const chunkedUpdates = chunk(dataSilos, BATCH_SILOS_LIMIT);\n await mapSeries(chunkedUpdates, async (dataSiloUpdateChunk, ind) => {\n logger.info(\n colors.magenta(\n `[Batch ${ind + 1}/${chunkedUpdates.length}] Syncing \"${\n dataSiloUpdateChunk.length\n }\" data silos`,\n ),\n );\n await makeGraphQLRequest<{\n /** Mutation result */\n updateDataSilos: {\n /** New data silos */\n dataSilos: Pick<DataSilo, 'id' | 'title'>[];\n };\n }>(client, UPDATE_DATA_SILOS, {\n variables: {\n input: {\n dataSilos: dataSiloUpdateChunk.map((input) => ({\n id: existingDataSiloByTitle[input.title].id,\n country: input.country,\n countrySubDivision: input.countrySubDivision,\n url: input.url,\n headers: input.headers,\n description: input.description,\n identifiers: input['identity-keys'],\n isLive: !input.disabled,\n ownerEmails: input.owners,\n teamNames: input.teams,\n // clear out if not specified, otherwise the update needs to be applied after\n // all data silos are created\n dependedOnDataSiloTitles: input['deletion-dependencies'] ? undefined : [],\n apiKeyId: input['api-key-title']\n ? apiKeysByTitle[input['api-key-title']].id\n : undefined,\n dataSubjectBlockListIds: input['data-subjects']\n ? convertToDataSubjectBlockList(input['data-subjects'], dataSubjectsByName)\n : undefined,\n attributes: input.attributes,\n businessEntityTitles: input.businessEntityTitles,\n // AVC settings\n notifyEmailAddress: input['email-settings']?.['notify-email-address'],\n promptAVendorEmailSendFrequency: input['email-settings']?.['send-frequency'],\n promptAVendorEmailSendType: input['email-settings']?.['send-type'],\n promptAVendorEmailIncludeIdentifiersAttachment:\n input['email-settings']?.['include-identifiers-attachment'],\n promptAVendorEmailCompletionLinkType: input['email-settings']?.['completion-link-type'],\n manualWorkRetryFrequency: input['email-settings']?.['manual-work-retry-frequency'],\n })),\n },\n },\n logger,\n });\n logger.info(\n colors.green(\n `[Batch ${ind + 1}/${chunkedUpdates.length}] Synced \"${\n dataSiloUpdateChunk.length\n }\" data silos!`,\n ),\n );\n });\n\n // Sync datapoints\n\n // create a new progress bar instance and use shades_classic theme\n const progressBar = new cliProgress.SingleBar({}, cliProgress.Presets.shades_classic);\n const dataSilosWithDataPoints = dataSilos.filter(({ datapoints = [] }) => datapoints.length > 0);\n const totalDataPoints = dataSilos\n .map(({ datapoints = [] }) => datapoints.length)\n .reduce((acc, count) => acc + count, 0);\n logger.info(\n colors.magenta(\n `Syncing \"${totalDataPoints}\" datapoints from \"${dataSilosWithDataPoints.length}\" data silos...`,\n ),\n );\n progressBar.start(totalDataPoints, 0);\n let total = 0;\n\n await map(\n dataSilosWithDataPoints,\n async ({ datapoints, title }) => {\n if (datapoints) {\n await mapSeries(datapoints, async (datapoint) => {\n const fields = datapoint.fields\n ? datapoint.fields.map(\n ({ key, description, categories, purposes, attributes, ...rest }) =>\n // TODO: Support setting title separately from the 'key/name'\n ({\n name: key,\n description,\n categories: !categories\n ? undefined\n : categories.map((category) => ({\n ...category,\n name: category.name || 'Other',\n })),\n purposes: !purposes\n ? undefined\n : purposes.map((purpose) => ({\n ...purpose,\n name: purpose.name || 'Other',\n })),\n attributes,\n accessRequestVisibilityEnabled: rest['access-request-visibility-enabled'],\n erasureRequestRedactionEnabled: rest['erasure-request-redaction-enabled'],\n }),\n )\n : undefined;\n\n const payload = {\n dataSiloId: existingDataSiloByTitle[title].id,\n path: datapoint.path,\n name: datapoint.key,\n title: datapoint.title,\n description: datapoint.description,\n ...(datapoint.owners\n ? {\n ownerEmails: datapoint.owners,\n }\n : {}),\n ...(datapoint.teams\n ? {\n teamNames: datapoint.teams,\n }\n : {}),\n ...(datapoint['data-collection-tag']\n ? { dataCollectionTag: datapoint['data-collection-tag'] }\n : {}),\n querySuggestions: !datapoint['privacy-action-queries']\n ? undefined\n : Object.entries(datapoint['privacy-action-queries']).map(([key, value]) => ({\n requestType: key,\n suggestedQuery: value,\n })),\n enabledActions: datapoint['privacy-actions'] || [], // clear out when not specified\n subDataPoints: fields,\n };\n\n // Ensure no duplicate sub-datapoints are provided\n const subDataPointsToUpdate = (payload.subDataPoints || []).map(({ name }) => name);\n const duplicateDataPoints = subDataPointsToUpdate.filter(\n (name, index) => subDataPointsToUpdate.indexOf(name) !== index,\n );\n if (duplicateDataPoints.length > 0) {\n logger.info(\n colors.red(\n `\\nCannot update datapoint \"${\n datapoint.key\n }\" as it has duplicate sub-datapoints with the same name: \\n${duplicateDataPoints.join(\n '\\n',\n )}`,\n ),\n );\n encounteredError = true;\n } else {\n try {\n await makeGraphQLRequest(client, UPDATE_OR_CREATE_DATA_POINT, {\n variables: payload,\n logger,\n });\n } catch (err) {\n logger.info(\n colors.red(\n `\\nFailed to update datapoint \"${datapoint.key}\" for data silo \"${title}\"! - \\n${err.message}`,\n ),\n );\n encounteredError = true;\n }\n }\n total += 1;\n progressBar.update(total);\n });\n }\n },\n {\n concurrency: 10,\n },\n );\n\n progressBar.stop();\n const t1 = new Date().getTime();\n const totalTime = t1 - t0;\n\n logger.info(\n colors.green(\n `Synced \"${dataSilos.length}\" data silos and \"${totalDataPoints}\" datapoints in \"${\n totalTime / 1000\n }\" seconds!`,\n ),\n );\n return {\n success: !encounteredError,\n dataSiloTitleToId: apply(existingDataSiloByTitle, ({ id }) => id),\n };\n}\n/* eslint-enable max-lines */\n","import {\n fetchAllActions,\n fetchAllAttributes,\n fetchAllDataSubjects,\n fetchApiKeys,\n fetchIdentifiersAndCreateMissing,\n syncAction,\n syncActionItemCollections,\n syncActionItems,\n syncAgentFiles,\n syncAgentFunctions,\n syncAgents,\n syncAttribute,\n syncBusinessEntities,\n syncDataCategories,\n syncConsentManager,\n syncCookies,\n syncDataFlows,\n syncDataSubject,\n syncDataSiloDependencies,\n syncEnricher,\n syncIdentifier,\n syncIntlMessages,\n syncPartitions,\n syncPolicies,\n syncPrivacyCenter,\n syncProcessingActivities,\n syncProcessingPurposes,\n syncPromptGroups,\n syncPromptPartials,\n syncPrompts,\n syncTeams,\n syncTemplate,\n syncVendors,\n type Identifier,\n} from '@transcend-io/sdk';\nimport { map } from '@transcend-io/utils';\nimport 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 { ensureAllDataSubjectsExist } from './ensureAllDataSubjectsExist.js';\nimport { syncDataSilos } from './syncDataSilos.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(client, {\n input,\n skipPublish: !publishToPrivacyCenter,\n logger,\n })\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(client, { apiKeyInputs: input, logger })\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, { logger });\n logger.info(colors.green('Successfully synced consent manager!'));\n } catch (err) {\n encounteredError = true;\n logger.error(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, { logger });\n encounteredError = encounteredError || !promptsSuccess;\n }\n if (promptPartials) {\n const promptsSuccess = await syncPromptPartials(client, promptPartials, { logger });\n encounteredError = encounteredError || !promptsSuccess;\n }\n if (promptGroups) {\n const promptsSuccess = await syncPromptGroups(client, promptGroups, { logger });\n encounteredError = encounteredError || !promptsSuccess;\n }\n\n if (teams) {\n const teamsSuccess = await syncTeams(client, teams, { logger });\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(client, template, { logger });\n logger.info(colors.green(`Successfully synced template \"${template.title}\"!`));\n } catch (err) {\n encounteredError = true;\n logger.error(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, { logger });\n encounteredError = encounteredError || !businessEntitySuccess;\n }\n\n // Sync vendors\n if (vendors) {\n const vendorsSuccess = await syncVendors(client, vendors, { logger });\n encounteredError = encounteredError || !vendorsSuccess;\n }\n\n // Sync data categories\n if (dataCategories) {\n const dataCategoriesSuccess = await syncDataCategories(client, dataCategories, { logger });\n encounteredError = encounteredError || !dataCategoriesSuccess;\n }\n\n // Sync processing purposes\n if (processingPurposes) {\n const processingPurposesSuccess = await syncProcessingPurposes(client, processingPurposes, {\n logger,\n });\n encounteredError = encounteredError || !processingPurposesSuccess;\n }\n\n // Sync partitions\n if (partitions) {\n const partitionsSuccess = await syncPartitions(client, partitions, { logger });\n encounteredError = encounteredError || !partitionsSuccess;\n }\n\n // Sync agents\n if (agents) {\n const agentsSuccess = await syncAgents(client, agents, { logger });\n encounteredError = encounteredError || !agentsSuccess;\n }\n\n // Sync agent functions\n if (agentFunctions) {\n const agentFunctionsSuccess = await syncAgentFunctions(client, agentFunctions, { logger });\n encounteredError = encounteredError || !agentFunctionsSuccess;\n }\n\n // Sync agent files\n if (agentFiles) {\n const agentFilesSuccess = await syncAgentFiles(client, agentFiles, { logger });\n encounteredError = encounteredError || !agentFilesSuccess;\n }\n\n // Sync cookies\n if (cookies) {\n const cookiesSuccess = await syncCookies(client, cookies, { logger });\n encounteredError = encounteredError || !cookiesSuccess;\n }\n\n // Sync action item collections\n if (actionItemCollections) {\n const actionItemCollectionsSuccess = await syncActionItemCollections(\n client,\n actionItemCollections,\n { logger },\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, { logger });\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 logger,\n });\n logger.info(colors.green(`Successfully synced attribute \"${attribute.name}\"!`));\n } catch (err) {\n encounteredError = true;\n logger.error(\n colors.red(`Failed to sync attribute \"${attribute.name}\"! - ${err.message}`),\n );\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, { logger });\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 input: enricher,\n identifierByName,\n dataSubjectsByName,\n logger,\n });\n logger.info(colors.green(`Successfully synced enricher \"${enricher.title}\"!`));\n } catch (err) {\n encounteredError = true;\n logger.error(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 input: identifier,\n dataSubjectsByName,\n identifierId: existing.id,\n skipPublish: !publishToPrivacyCenter,\n logger,\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, { logger });\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(\n client,\n {\n action,\n actionId: existing.id,\n skipPublish: !publishToPrivacyCenter,\n },\n { logger },\n );\n logger.info(colors.green(`Successfully synced action \"${action.type}\"!`));\n } catch (err) {\n encounteredError = true;\n logger.error(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, { logger });\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 input: dataSubject,\n dataSubjectId: existing.id,\n skipPublish: !publishToPrivacyCenter,\n logger,\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, logger });\n encounteredError = encounteredError || !syncedDataFlows;\n }\n\n // Sync privacy center\n if (privacyCenter) {\n const privacyCenterSuccess = await syncPrivacyCenter(client, privacyCenter, { logger });\n encounteredError = encounteredError || !privacyCenterSuccess;\n }\n\n // Sync messages\n if (messages) {\n const messagesSuccess = await syncIntlMessages(client, messages, { logger });\n encounteredError = encounteredError || !messagesSuccess;\n }\n\n // Sync policies\n if (policies) {\n const policiesSuccess = await syncPolicies(client, policies, { logger });\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, { input: dependencyUpdates, logger });\n }\n\n // Update processing activities\n if (processingActivities) {\n const processingActivitySuccess = await syncProcessingActivities(client, processingActivities, {\n logger,\n });\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","/**\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"],"mappings":"8uCAgBA,eAAsB,EACpB,CACE,aAAc,EAAY,EAAE,CAC5B,gBAAiB,EAAe,EAAE,CAClC,wBAAyB,EAAuB,EAAE,CAClD,YAAY,EAAE,EAEhB,EACA,EAAW,GACiC,CAC5C,IAAM,EAAuB,EAAK,CAChC,GAAG,EAAQ,EAAU,IAAK,GAAS,EAAK,kBAAoB,EAAE,CAAC,EAAI,EAAE,CAAC,CACtE,GAAG,EAAQ,EAAqB,KAAK,CAAE,sBAAuB,GAAoB,EAAE,CAAC,EAAI,EAAE,CAAC,CAC5F,GAAG,EAAQ,EAAU,IAAK,GAAa,EAAS,kBAAoB,EAAE,CAAC,EAAI,EAAE,CAAC,CAC9E,GAAG,EAAa,IAAK,GAAY,EAAQ,KAAK,CAC/C,CAAC,CACF,GAAI,EAAqB,SAAW,GAAK,CAAC,EACxC,MAAO,EAAE,CAGX,IAAM,EAAmB,MAAM,EAAqB,EAAQ,CAAE,SAAQ,CAAC,CACjE,EAAoB,EAAM,EAAkB,OAAO,CAEnD,EAAsB,EAC1B,EACA,EAAiB,KAAK,CAAE,UAAW,EAAK,CACzC,CAED,GAAI,EAAoB,OAAS,EAAG,CAClC,EAAO,KAAK,EAAO,QAAQ,YA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EAAS,0BACX,EAAkB,KAAK,CACrB,EAAkB,EAAS,OAC3B,EAAS,yBACV,CAAC,EAEJ,CACF,IAAuC,CAAC,EAS1C,GALI,EAAkB,OAAS,GAC7B,MAAM,GAAyB,EAAQ,CAAE,MAAO,EAAmB,SAAQ,CAAC,CAI1E,EAAsB,CACxB,IAAM,EAA4B,MAAM,GAAyB,EAAQ,EAAsB,CAC7F,SACD,CAAC,CACF,IAAuC,CAAC,EAO1C,OAAO,ECneT,SAAgB,EACd,EACA,GAAG,EACa,CAEhB,IAAM,EAAc,KAAK,MAAM,KAAK,UAAU,EAAK,CAAC,CAapD,OAZA,EAAO,QAAS,GAAU,CAExB,EAAW,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,ECvBT,SAAgB,EAAyB,EAEvC,CAEA,IAAM,EAAY,EAAU,MAAM,IAAI,CAAC,OAAQ,GAAM,CAAC,CAAC,EAAE,CACnD,EAAkC,EAAE,CAQ1C,OAPA,EAAU,QAAS,GAAa,CAC9B,GAAM,CAAC,EAAG,GAAK,EAAS,MAAM,IAAI,CAClC,GAAI,CAAC,GAAK,CAAC,EACT,MAAU,MAAM,qBAAqB,EAAS,8BAA8B,CAE9E,EAAK,GAAK,GACV,CACK"}
@@ -0,0 +1,45 @@
1
+ import{t as e}from"./logger-Bj782ZYD.mjs";import{SubDataPointDataSubCategoryGuessStatus as t}from"@transcend-io/privacy-types";import{chunk as n,keyBy as r,sortBy as i,uniq as a}from"lodash-es";import o from"colors";import{DATAPOINT_EXPORT as s,DATA_SILO_EXPORT as c,SUB_DATA_POINTS_COUNT as l,makeGraphQLRequest as u}from"@transcend-io/sdk";import{mapSeries as d}from"@transcend-io/utils";import f from"cli-progress";import{gql as p}from"graphql-request";async function m(n,{dataSiloIds:r=[],includeGuessedCategories:a,includeAttributes:s,parentCategories:c=[],subCategories:d=[],pageSize:m=1e3}={}){let h=[],g=new Date().getTime(),_=new f.SingleBar({},f.Presets.shades_classic),v={...c.length>0?{category:c}:{},...d.length>0?{subCategoryIds:d}:{},...c.length+d.length>0&&!a?{status:t.Approved}:{},...r.length>0?{dataSilos:r}:{}},{subDataPoints:{totalCount:y}}=await u(n,l,{variables:{filterBy:v},logger:e});e.info(o.magenta(`[Step 1/3] Pulling in all subdatapoints`)),_.start(y,0);let b=0,x=!1,S,C=0;do try{let{subDataPoints:{nodes:t}}=await u(n,p`
2
+ query TranscendCliSubDataPointCsvExport(
3
+ $filterBy: SubDataPointFiltersInput
4
+ $first: Int!
5
+ $offset: Int!
6
+ ) {
7
+ subDataPoints(
8
+ filterBy: $filterBy
9
+ first: $first
10
+ offset: $offset
11
+ useMaster: false
12
+ ) {
13
+ nodes {
14
+ id
15
+ name
16
+ description
17
+ dataPointId
18
+ dataSiloId
19
+ purposes {
20
+ name
21
+ purpose
22
+ }
23
+ categories {
24
+ name
25
+ category
26
+ }
27
+ ${a?`pendingCategoryGuesses {
28
+ category {
29
+ name
30
+ category
31
+ }
32
+ status
33
+ classifierVersion
34
+ }`:``}
35
+ ${s?`attributeValues {
36
+ attributeKey {
37
+ name
38
+ }
39
+ name
40
+ }`:``}
41
+ }
42
+ }
43
+ }
44
+ `,{variables:{first:m,offset:C,filterBy:{...v}},logger:e});S=t[t.length-1]?.id,h.push(...t),x=t.length===m,b+=t.length,C+=t.length,_.update(b)}catch(t){throw e.error(o.red(`An error fetching subdatapoints for cursor ${S} and offset ${C}`)),t}while(x);_.stop();let w=new Date().getTime()-g,T=i(h,`name`);return e.info(o.green(`Successfully pulled in ${T.length} subdatapoints in ${w/1e3} seconds!`)),T}async function h(t,{dataPointIds:r=[],pageSize:i=100}){let a=[],c=new Date().getTime(),l=new f.SingleBar({},f.Presets.shades_classic);e.info(o.magenta(`[Step 2/3] Fetching metadata for ${r.length} datapoints`));let p=n(r,i);l.start(r.length,0);let m=0;await d(p,async n=>{try{let{dataPoints:{nodes:r}}=await u(t,s,{variables:{first:i,filterBy:{ids:n}},logger:e});a.push(...r),m+=n.length,l.update(m)}catch(t){throw e.error(o.red(`An error fetching subdatapoints for IDs ${n.join(`, `)}`)),t}}),l.stop();let h=new Date().getTime()-c;return e.info(o.green(`Successfully pulled in ${a.length} dataPoints in ${h/1e3} seconds!`)),a}async function g(t,{dataSiloIds:r=[],pageSize:i=100}){let a=[],s=new Date().getTime(),l=new f.SingleBar({},f.Presets.shades_classic);e.info(o.magenta(`[Step 3/3] Fetching metadata for ${r.length} data silos`));let p=n(r,i);l.start(r.length,0);let m=0;await d(p,async n=>{try{let{dataSilos:{nodes:r}}=await u(t,c,{variables:{first:i,filterBy:{ids:n}},logger:e});a.push(...r),m+=n.length,l.update(m)}catch(t){throw e.error(o.red(`An error fetching data silos for IDs ${n.join(`, `)}`)),t}}),l.stop();let h=new Date().getTime()-s;return e.info(o.green(`Successfully pulled in ${a.length} data silos in ${h/1e3} seconds!`)),a}async function _(e,{dataSiloIds:t=[],includeGuessedCategories:n,includeAttributes:i,parentCategories:o=[],subCategories:s=[],pageSize:c=1e3}={}){let l=await m(e,{dataSiloIds:t,includeGuessedCategories:n,includeAttributes:i,parentCategories:o,subCategories:s,pageSize:c}),u=r(await h(e,{dataPointIds:a(l.map(e=>e.dataPointId))}),`id`),d=r(await g(e,{dataSiloIds:a(l.map(e=>e.dataSiloId))}),`id`);return l.map(e=>({...e,dataPoint:u[e.dataPointId],dataSilo:d[e.dataSiloId]}))}export{_ as t};
45
+ //# sourceMappingURL=pullAllDatapoints-Bbmky50p.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pullAllDatapoints-Bbmky50p.mjs","names":[],"sources":["../src/lib/data-inventory/pullAllDatapoints.ts"],"sourcesContent":["import {\n type DataCategoryType,\n SubDataPointDataSubCategoryGuessStatus,\n} from '@transcend-io/privacy-types';\nimport {\n makeGraphQLRequest,\n DATAPOINT_EXPORT,\n DATA_SILO_EXPORT,\n SUB_DATA_POINTS_COUNT,\n type DataSiloAttributeValue,\n} from '@transcend-io/sdk';\nimport { mapSeries } from '@transcend-io/utils';\nimport cliProgress from 'cli-progress';\nimport colors from 'colors';\nimport { gql, type GraphQLClient } from 'graphql-request';\n/* eslint-disable max-lines */\nimport { keyBy, uniq, chunk, sortBy } from 'lodash-es';\n\nimport type { DataCategoryInput, ProcessingPurposeInput } from '../../codecs.js';\nimport { logger } from '../../logger.js';\n\nexport interface DataSiloCsvPreview {\n /** ID of dataSilo */\n id: string;\n /** Name of dataSilo */\n title: string;\n}\n\nexport interface DataPointCsvPreview {\n /** ID of dataPoint */\n id: string;\n /** The path to this data point */\n path: string[];\n /** Description */\n description: {\n /** Default message */\n defaultMessage: string;\n };\n /** Name */\n name: string;\n}\n\nexport interface SubDataPointCsvPreview {\n /** ID of subDatapoint */\n id: string;\n /** Name (or key) of the subdatapoint */\n name: string;\n /** The description */\n description?: string;\n /** Personal data category */\n categories: DataCategoryInput[];\n /** Data point ID */\n dataPointId: string;\n /** The data silo ID */\n dataSiloId: string;\n /** The processing purpose for this sub datapoint */\n purposes: ProcessingPurposeInput[];\n /** Attribute attached to subdatapoint */\n attributeValues?: DataSiloAttributeValue[];\n /** Data category guesses that are output by the classifier */\n pendingCategoryGuesses?: {\n /** Data category being guessed */\n category: DataCategoryInput;\n /** Status of guess */\n status: SubDataPointDataSubCategoryGuessStatus;\n /** classifier version that produced the guess */\n classifierVersion: number;\n }[];\n}\n\nexport interface DatapointFilterOptions {\n /** IDs of data silos to filter down */\n dataSiloIds?: string[];\n /** Whether to include guessed categories, defaults to only approved categories */\n includeGuessedCategories?: boolean;\n /** Whether or not to include attributes */\n includeAttributes?: boolean;\n /** Parent categories to filter down for */\n parentCategories?: DataCategoryType[];\n /** Sub categories to filter down for */\n subCategories?: string[]; // TODO: https://transcend.height.app/T-40482 - do by name not ID\n}\n\n/**\n * Pull subdatapoint information\n *\n * @param client - Client to use for the request\n * @param options - Options\n * @returns The subdatapoints\n */\nasync function pullSubDatapoints(\n client: GraphQLClient,\n {\n dataSiloIds = [],\n includeGuessedCategories,\n includeAttributes,\n parentCategories = [],\n subCategories = [],\n pageSize = 1000,\n }: DatapointFilterOptions & {\n /** Page size to pull in */\n pageSize?: number;\n } = {},\n): Promise<SubDataPointCsvPreview[]> {\n const subDataPoints: SubDataPointCsvPreview[] = [];\n\n // Time duration\n const t0 = new Date().getTime();\n\n // create a new progress bar instance and use shades_classic theme\n const progressBar = new cliProgress.SingleBar({}, cliProgress.Presets.shades_classic);\n\n // Filters\n const filterBy = {\n ...(parentCategories.length > 0 ? { category: parentCategories } : {}),\n ...(subCategories.length > 0 ? { subCategoryIds: subCategories } : {}),\n // if parentCategories or subCategories and not includeGuessedCategories\n ...(parentCategories.length + subCategories.length > 0 && !includeGuessedCategories\n ? // then only show data points with approved data categories\n { status: SubDataPointDataSubCategoryGuessStatus.Approved }\n : {}),\n ...(dataSiloIds.length > 0 ? { dataSilos: dataSiloIds } : {}),\n };\n\n // Build a GraphQL client\n const {\n subDataPoints: { totalCount },\n } = await makeGraphQLRequest<{\n /** Query response */\n subDataPoints: {\n /** Count */\n totalCount: number;\n };\n }>(client, SUB_DATA_POINTS_COUNT, {\n variables: { filterBy },\n logger,\n });\n\n logger.info(colors.magenta('[Step 1/3] Pulling in all subdatapoints'));\n\n progressBar.start(totalCount, 0);\n let total = 0;\n let shouldContinue = false;\n let cursor: string | undefined;\n let offset = 0;\n do {\n try {\n const {\n subDataPoints: { nodes },\n } = await makeGraphQLRequest<{\n /** Query response */\n subDataPoints: {\n /** List of matches */\n nodes: SubDataPointCsvPreview[];\n };\n }>(\n client,\n gql`\n query TranscendCliSubDataPointCsvExport(\n $filterBy: SubDataPointFiltersInput\n $first: Int!\n $offset: Int!\n ) {\n subDataPoints(\n filterBy: $filterBy\n first: $first\n offset: $offset\n useMaster: false\n ) {\n nodes {\n id\n name\n description\n dataPointId\n dataSiloId\n purposes {\n name\n purpose\n }\n categories {\n name\n category\n }\n ${\n includeGuessedCategories\n ? `pendingCategoryGuesses {\n category {\n name\n category\n }\n status\n classifierVersion\n }`\n : ''\n }\n ${\n includeAttributes\n ? `attributeValues {\n attributeKey {\n name\n }\n name\n }`\n : ''\n }\n }\n }\n }\n `,\n {\n variables: {\n first: pageSize,\n offset,\n filterBy: {\n ...filterBy,\n // TODO: https://transcend.height.app/T-40484 - add cursor support\n // ...(cursor ? { cursor: { id: cursor } } : {}),\n },\n },\n logger,\n },\n );\n\n cursor = nodes[nodes.length - 1]?.id as string;\n subDataPoints.push(...nodes);\n shouldContinue = nodes.length === pageSize;\n total += nodes.length;\n offset += nodes.length;\n progressBar.update(total);\n } catch (err) {\n logger.error(\n colors.red(`An error fetching subdatapoints for cursor ${cursor} and offset ${offset}`),\n );\n throw err;\n }\n } while (shouldContinue);\n\n progressBar.stop();\n const t1 = new Date().getTime();\n const totalTime = t1 - t0;\n\n const sorted = sortBy(subDataPoints, 'name');\n\n logger.info(\n colors.green(\n `Successfully pulled in ${sorted.length} subdatapoints in ${totalTime / 1000} seconds!`,\n ),\n );\n return sorted;\n}\n\n/**\n * Pull datapoint information\n *\n * @param client - Client to use for the request\n * @param options - Options\n * @returns The datapoints\n */\nasync function pullDatapoints(\n client: GraphQLClient,\n {\n dataPointIds = [],\n pageSize = 100,\n }: {\n /** IDs of data points to filter down */\n dataPointIds: string[];\n /** Page size to pull in */\n pageSize?: number;\n },\n): Promise<DataPointCsvPreview[]> {\n const dataPoints: DataPointCsvPreview[] = [];\n\n // Time duration\n const t0 = new Date().getTime();\n\n // create a new progress bar instance and use shades_classic theme\n const progressBar = new cliProgress.SingleBar({}, cliProgress.Presets.shades_classic);\n\n logger.info(colors.magenta(`[Step 2/3] Fetching metadata for ${dataPointIds.length} datapoints`));\n\n // Group by 100\n const dataPointsGrouped = chunk(dataPointIds, pageSize);\n\n progressBar.start(dataPointIds.length, 0);\n let total = 0;\n await mapSeries(dataPointsGrouped, async (dataPointIdsGroup) => {\n try {\n const {\n dataPoints: { nodes },\n } = await makeGraphQLRequest<{\n /** Query response */\n dataPoints: {\n /** List of matches */\n nodes: DataPointCsvPreview[];\n };\n }>(client, DATAPOINT_EXPORT, {\n variables: {\n first: pageSize,\n filterBy: {\n ids: dataPointIdsGroup,\n },\n },\n logger,\n });\n\n dataPoints.push(...nodes);\n total += dataPointIdsGroup.length;\n progressBar.update(total);\n } catch (err) {\n logger.error(\n colors.red(`An error fetching subdatapoints for IDs ${dataPointIdsGroup.join(', ')}`),\n );\n throw err;\n }\n });\n\n progressBar.stop();\n const t1 = new Date().getTime();\n const totalTime = t1 - t0;\n\n logger.info(\n colors.green(\n `Successfully pulled in ${dataPoints.length} dataPoints in ${totalTime / 1000} seconds!`,\n ),\n );\n return dataPoints;\n}\n\n/**\n * Pull data silo information\n *\n * @param client - Client to use for the request\n * @param options - Options\n * @returns The data silos\n */\nasync function pullDataSilos(\n client: GraphQLClient,\n {\n dataSiloIds = [],\n pageSize = 100,\n }: {\n /** IDs of data silos to filter down */\n dataSiloIds: string[];\n /** Page size to pull in */\n pageSize?: number;\n },\n): Promise<DataSiloCsvPreview[]> {\n const dataSilos: DataSiloCsvPreview[] = [];\n\n // Time duration\n const t0 = new Date().getTime();\n\n // create a new progress bar instance and use shades_classic theme\n const progressBar = new cliProgress.SingleBar({}, cliProgress.Presets.shades_classic);\n\n logger.info(colors.magenta(`[Step 3/3] Fetching metadata for ${dataSiloIds.length} data silos`));\n\n // Group by 100\n const dataSilosGrouped = chunk(dataSiloIds, pageSize);\n\n progressBar.start(dataSiloIds.length, 0);\n let total = 0;\n await mapSeries(dataSilosGrouped, async (dataSiloIdsGroup) => {\n try {\n const {\n dataSilos: { nodes },\n } = await makeGraphQLRequest<{\n /** Query response */\n dataSilos: {\n /** List of matches */\n nodes: DataSiloCsvPreview[];\n };\n }>(client, DATA_SILO_EXPORT, {\n variables: {\n first: pageSize,\n filterBy: {\n ids: dataSiloIdsGroup,\n },\n },\n logger,\n });\n\n dataSilos.push(...nodes);\n total += dataSiloIdsGroup.length;\n progressBar.update(total);\n } catch (err) {\n logger.error(\n colors.red(`An error fetching data silos for IDs ${dataSiloIdsGroup.join(', ')}`),\n );\n throw err;\n }\n });\n\n progressBar.stop();\n const t1 = new Date().getTime();\n const totalTime = t1 - t0;\n\n logger.info(\n colors.green(\n `Successfully pulled in ${dataSilos.length} data silos in ${totalTime / 1000} seconds!`,\n ),\n );\n return dataSilos;\n}\n\n/**\n * Pull all datapoints from the data inventory.\n *\n * @param client - Client to use for the request\n * @param options - Options\n * @returns The datapoints and data silos\n */\nexport async function pullAllDatapoints(\n client: GraphQLClient,\n {\n dataSiloIds = [],\n includeGuessedCategories,\n includeAttributes,\n parentCategories = [],\n subCategories = [],\n pageSize = 1000,\n }: DatapointFilterOptions & {\n /** Page size to pull in */\n pageSize?: number;\n } = {},\n): Promise<\n (SubDataPointCsvPreview & {\n /** Data point information */\n dataPoint: DataPointCsvPreview;\n /** Data silo information */\n dataSilo: DataSiloCsvPreview;\n })[]\n> {\n // Subdatapoint information\n const subDatapoints = await pullSubDatapoints(client, {\n dataSiloIds,\n includeGuessedCategories,\n includeAttributes,\n parentCategories,\n subCategories,\n pageSize,\n });\n\n // The datapoint ids to grab\n const dataPointIds = uniq(subDatapoints.map((point) => point.dataPointId));\n const dataPoints = await pullDatapoints(client, {\n dataPointIds,\n });\n const dataPointById = keyBy(dataPoints, 'id');\n\n // The data silo IDs to grab\n const allDataSiloIds = uniq(subDatapoints.map((point) => point.dataSiloId));\n const dataSilos = await pullDataSilos(client, {\n dataSiloIds: allDataSiloIds,\n });\n const dataSiloById = keyBy(dataSilos, 'id');\n\n return subDatapoints.map((subDataPoint) => ({\n ...subDataPoint,\n dataPoint: dataPointById[subDataPoint.dataPointId],\n dataSilo: dataSiloById[subDataPoint.dataSiloId],\n }));\n}\n/* eslint-enable max-lines */\n"],"mappings":"wcA0FA,eAAe,EACb,EACA,CACE,cAA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
+ import{a as e}from"./constants-muOBBQA_.mjs";import{t}from"./logger-Bj782ZYD.mjs";import{decodeCodec as n}from"@transcend-io/type-utils";import r from"colors";import*as i from"io-ts";import{REDUCED_REQUESTS_FOR_DATA_SILO_COUNT as a,buildTranscendGraphQLClient as o,createSombraGotInstance as s,makeGraphQLRequest as c}from"@transcend-io/sdk";import{mapSeries as l}from"@transcend-io/utils";import u from"cli-progress";async function d(e,{dataSiloId:n}){let{listReducedRequestsForDataSilo:{totalCount:r}}=await c(e,a,{variables:{input:{dataSiloId:n,isResolved:!1}},logger:t});return r}const f=i.type({identifier:i.string,type:i.string,coreIdentifier:i.string,dataSiloId:i.string,requestId:i.string,nonce:i.string,requestCreatedAt:i.string,daysUntilOverdue:i.number,attributes:i.array(i.type({key:i.string,values:i.array(i.string)}))});async function p(e,{dataSiloId:t,limit:r=100,offset:a=0,requestType:o}){try{let s=await e.get(`v1/data-silo/${t}/pending-requests/${o}`,{searchParams:{offset:a,limit:r}}).json(),{items:c}=n(i.type({items:i.array(f)}),s);return c}catch(e){throw Error(`Received an error from server: ${e?.response?.body||e?.message}`)}}async function m({dataSiloId:n,auth:i,sombraAuth:a,actions:c,apiPageSize:f=100,savePageSize:m=1e3,onSave:h,transcendUrl:g=e,skipRequestCount:_=!1}){if(m%f!==0)throw Error(`savePageSize must be a multiple of apiPageSize. savePageSize: ${m}, apiPageSize: ${f}`);let v=await s(g,i,{logger:t,sombraApiKey:a,sombraUrl:process.env.SOMBRA_URL}),y=o(g,i),b=0;_||(b=await d(y,{dataSiloId:n})),t.info(r.magenta(`Pulling ${_?`all`:b} outstanding request identifiers for data silo: "${n}" for requests of types "${c.join(`", "`)}"`));let x=new Date().getTime(),S=new u.SingleBar({},u.Presets.shades_classic),C=new Set,w=[],T=[];_||S.start(b,0),await l(c,async e=>{let i=0,a=!0;for(;a;){let o=await p(v,{dataSiloId:n,limit:f,offset:i,requestType:e}),s=o.map(t=>(C.add(t.requestId),{...t,action:e})),c=s.map(({attributes:e,...t})=>({...t,...e.reduce((e,t)=>Object.assign(e,{[t.key]:t.values.join(`,`)}),{})}));w.push(...s),T.push(...c),T.length>=m&&(await h(T),T=[]),a=o.length===f,i+=f,_?t.info(r.magenta(`Pulled ${o.length} outstanding identifiers for ${C.size} requests`)):S.update(C.size)}}),T.length>0&&await h(T),_||S.stop();let E=new Date().getTime()-x;return t.info(r.green(`Successfully pulled ${w.length} outstanding identifiers from ${C.size} requests in "${E/1e3}" seconds!`)),{identifiers:w}}export{d as i,f as n,p as r,m as t};
2
+ //# sourceMappingURL=pullChunkedCustomSiloOutstandingIdentifiers-BW5Vws25.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pullChunkedCustomSiloOutstandingIdentifiers-BW5Vws25.mjs","names":[],"sources":["../src/lib/graphql/fetchRequestDataSiloActiveCount.ts","../src/lib/cron/pullCronPageOfIdentifiers.ts","../src/lib/cron/pullChunkedCustomSiloOutstandingIdentifiers.ts"],"sourcesContent":["import { makeGraphQLRequest, REDUCED_REQUESTS_FOR_DATA_SILO_COUNT } from '@transcend-io/sdk';\nimport { GraphQLClient } from 'graphql-request';\n\nimport { logger } from '../../logger.js';\n\n/**\n * Get number of open requests for a data silo\n *\n * @param client - GraphQL client\n * @param options - Filter options\n * @returns List of request identifiers\n */\nexport async function fetchRequestDataSiloActiveCount(\n client: GraphQLClient,\n {\n dataSiloId,\n }: {\n /** Data silo ID */\n dataSiloId: string;\n },\n): Promise<number> {\n const {\n listReducedRequestsForDataSilo: { totalCount },\n } = await makeGraphQLRequest<{\n /** Requests */\n listReducedRequestsForDataSilo: {\n /** Total count */\n totalCount: number;\n };\n }>(client, REDUCED_REQUESTS_FOR_DATA_SILO_COUNT, {\n variables: {\n input: {\n dataSiloId,\n isResolved: false,\n },\n },\n logger,\n });\n\n return totalCount;\n}\n","import { RequestAction } from '@transcend-io/privacy-types';\nimport { decodeCodec } from '@transcend-io/type-utils';\nimport type { Got } from 'got';\nimport * as t from 'io-ts';\n\nexport const CronIdentifier = t.type({\n /** The identifier value */\n identifier: t.string,\n /** The type of identifier */\n type: t.string,\n /** The core identifier of the request */\n coreIdentifier: t.string,\n /** The ID of the underlying data silo */\n dataSiloId: t.string,\n /** The ID of the underlying request */\n requestId: t.string,\n /** The request nonce */\n nonce: t.string,\n /** The time the request was created */\n requestCreatedAt: t.string,\n /** The number of days until the request is overdue */\n daysUntilOverdue: t.number,\n /** Request attributes */\n attributes: t.array(\n t.type({\n key: t.string,\n values: t.array(t.string),\n }),\n ),\n});\n\n/** Type override */\nexport type CronIdentifier = t.TypeOf<typeof CronIdentifier>;\n\n/**\n * Pull a offset of identifiers for a cron job\n *\n * @see https://docs.transcend.io/docs/api-reference/GET/v1/data-silo/(id)/pending-requests/(type)\n * @param sombra - Sombra instance configured to make requests\n * @param options - Additional options\n * @returns Successfully submitted request\n */\nexport async function pullCronPageOfIdentifiers(\n sombra: Got,\n {\n dataSiloId,\n limit = 100,\n offset = 0,\n requestType,\n }: {\n /** Data Silo ID */\n dataSiloId: string;\n /** Type of request */\n requestType: RequestAction;\n /** Number of identifiers to pull in */\n limit?: number;\n /** Page to pull in */\n offset?: number;\n },\n): Promise<CronIdentifier[]> {\n try {\n // Make the GraphQL request\n const response = await sombra\n .get(`v1/data-silo/${dataSiloId}/pending-requests/${requestType}`, {\n searchParams: {\n offset,\n limit,\n },\n })\n .json();\n\n const { items } = decodeCodec(\n t.type({\n items: t.array(CronIdentifier),\n }),\n response,\n );\n return items;\n } catch (err) {\n throw new Error(`Received an error from server: ${err?.response?.body || err?.message}`);\n }\n}\n","import { RequestAction } from '@transcend-io/privacy-types';\nimport { buildTranscendGraphQLClient, createSombraGotInstance } from '@transcend-io/sdk';\nimport { mapSeries } from '@transcend-io/utils';\nimport cliProgress from 'cli-progress';\nimport colors from 'colors';\n\nimport { DEFAULT_TRANSCEND_API } from '../../constants.js';\nimport { logger } from '../../logger.js';\nimport { fetchRequestDataSiloActiveCount } from '../graphql/index.js';\nimport { pullCronPageOfIdentifiers, CronIdentifier } from './pullCronPageOfIdentifiers.js';\n\n/**\n * A CSV formatted identifier\n */\nexport type CsvFormattedIdentifier = {\n [k in string]: string | null | boolean | number;\n};\n\nexport interface CronIdentifierWithAction extends CronIdentifier {\n /** The request action that the identifier relates to */\n action: RequestAction;\n}\n\n/**\n * Pull the set of identifiers outstanding for a cron or AVC integration\n *\n * This function is designed to be used in a loop, and will call the onSave callback\n * with a chunk of identifiers when the savePageSize is reached.\n *\n * @param options - Options\n * @returns The identifiers and identifiers formatted for CSV\n */\nexport async function pullChunkedCustomSiloOutstandingIdentifiers({\n dataSiloId,\n auth,\n sombraAuth,\n actions,\n apiPageSize = 100,\n savePageSize = 1000,\n onSave,\n transcendUrl = DEFAULT_TRANSCEND_API,\n skipRequestCount = false,\n}: {\n /** Transcend API key authentication */\n auth: string;\n /** Data Silo ID to pull down jobs for */\n dataSiloId: string;\n /** The request actions to fetch */\n actions: RequestAction[];\n /** How many identifiers to pull in a single call to the backend */\n apiPageSize: number;\n /** How many identifiers to save at a time (usually to a CSV file, should be a multiple of apiPageSize) */\n savePageSize: number;\n /** Callback function called when a chunk of identifiers is ready to be saved */\n onSave: (chunk: CsvFormattedIdentifier[]) => Promise<void>;\n /** API URL for Transcend backend */\n transcendUrl?: string;\n /** Sombra API key authentication */\n sombraAuth?: string;\n /** Skip request count */\n skipRequestCount?: boolean;\n}): Promise<{\n /** Raw Identifiers */\n identifiers: CronIdentifierWithAction[];\n}> {\n // Validate savePageSize\n if (savePageSize % apiPageSize !== 0) {\n throw new Error(\n `savePageSize must be a multiple of apiPageSize. savePageSize: ${savePageSize}, apiPageSize: ${apiPageSize}`,\n );\n }\n\n // Create sombra instance to communicate with\n const sombra = await createSombraGotInstance(transcendUrl, auth, {\n logger,\n sombraApiKey: sombraAuth,\n sombraUrl: process.env.SOMBRA_URL,\n });\n\n // Create GraphQL client to connect to Transcend backend\n const client = buildTranscendGraphQLClient(transcendUrl, auth);\n\n let totalRequestCount = 0;\n if (!skipRequestCount) {\n totalRequestCount = await fetchRequestDataSiloActiveCount(client, {\n dataSiloId,\n });\n }\n\n logger.info(\n colors.magenta(\n `Pulling ${skipRequestCount ? 'all' : totalRequestCount} outstanding request identifiers ` +\n `for data silo: \"${dataSiloId}\" for requests of types \"${actions.join('\", \"')}\"`,\n ),\n );\n\n // Time duration\n const t0 = new Date().getTime();\n // create a new progress bar instance and use shades_classic theme\n const progressBar = new cliProgress.SingleBar({}, cliProgress.Presets.shades_classic);\n const foundRequestIds = new Set<string>();\n\n // identifiers found in total\n const identifiers: CronIdentifierWithAction[] = [];\n // current chunk of identifiers to be saved\n let currentChunk: CsvFormattedIdentifier[] = [];\n\n // map over each action\n if (!skipRequestCount) {\n progressBar.start(totalRequestCount, 0);\n }\n await mapSeries(actions, async (action) => {\n let offset = 0;\n let shouldContinue = true;\n\n // Fetch a page of identifiers\n while (shouldContinue) {\n const pageIdentifiers = await pullCronPageOfIdentifiers(sombra, {\n dataSiloId,\n limit: apiPageSize,\n offset,\n requestType: action,\n });\n\n const identifiersWithAction: CronIdentifierWithAction[] = pageIdentifiers.map(\n (identifier) => {\n foundRequestIds.add(identifier.requestId);\n return {\n ...identifier,\n action,\n };\n },\n );\n\n const csvFormattedIdentifiers = identifiersWithAction.map(\n ({ attributes, ...identifier }) => ({\n ...identifier,\n ...attributes.reduce(\n (acc, val) =>\n Object.assign(acc, {\n [val.key]: val.values.join(','),\n }),\n {},\n ),\n }),\n );\n\n identifiers.push(...identifiersWithAction);\n currentChunk.push(...csvFormattedIdentifiers);\n\n // Check if we've reached the savePageSize and call the onSave callback\n if (currentChunk.length >= savePageSize) {\n await onSave(currentChunk);\n currentChunk = [];\n }\n\n shouldContinue = pageIdentifiers.length === apiPageSize;\n offset += apiPageSize;\n if (!skipRequestCount) {\n progressBar.update(foundRequestIds.size);\n } else {\n logger.info(\n colors.magenta(\n `Pulled ${pageIdentifiers.length} outstanding identifiers for ${foundRequestIds.size} requests`,\n ),\n );\n }\n }\n });\n\n // Save any remaining identifiers in the current chunk\n if (currentChunk.length > 0) {\n await onSave(currentChunk);\n }\n\n if (!skipRequestCount) {\n progressBar.stop();\n }\n const t1 = new Date().getTime();\n const totalTime = t1 - t0;\n\n logger.info(\n colors.green(\n `Successfully pulled ${identifiers.length} outstanding identifiers from ${\n foundRequestIds.size\n } requests in \"${totalTime / 1000}\" seconds!`,\n ),\n );\n\n return { identifiers };\n}\n"],"mappings":"kaAYA,eAAsB,EACpB,EACA,CACE,cAKe,CACjB,GAAM,CACJ,+BAAgC,CAAE,eAChC,MAAM,EAMP,EAAQ,EAAsC,CAC/C,UAAW,CACT,MAAO,CACL,aACA,WAAY,GACb,CACF,CACD,SACD,CAAC,CAEF,OAAO,EClCT,MAAa,EAAiB,EAAE,KAAK,CAEnC,WAAY,EAAE,OAEd,KAAM,EAAE,OAER,eAAgB,EAAE,OAElB,WAAY,EAAE,OAEd,UAAW,EAAE,OAEb,MAAO,EAAE,OAET,iBAAkB,EAAE,OAEpB,iBAAkB,EAAE,OAEpB,WAAY,EAAE,MACZ,EAAE,KAAK,CACL,IAAK,EAAE,OACP,OAAQ,EAAE,MAAM,EAAE,OAAO,CAC1B,CAAC,CACH,CACF,CAAC,CAaF,eAAsB,EACpB,EACA,CACE,aACA,QAAQ,IACR,SAAS,EACT,eAWyB,CAC3B,GAAI,CAEF,IAAM,EAAW,MAAM,EACpB,IAAI,gBAAgB,EAAW,oBAAoB,IAAe,CACjE,aAAc,CACZ,SACA,QACD,CACF,CAAC,CACD,MAAM,CAEH,CAAE,SAAU,EAChB,EAAE,KAAK,CACL,MAAO,EAAE,MAAM,EAAe,CAC/B,CAAC,CACF,EACD,CACD,OAAO,QACA,EAAK,CACZ,MAAU,MAAM,kCAAkC,GAAK,UAAU,MAAQ,GAAK,UAAU,EC/C5F,eAAsB,EAA4C,CAChE,aACA,OACA,aACA,UACA,cAAc,IACd,eAAe,IACf,SACA,eAAe,EACf,mBAAmB,IAuBlB,CAED,GAAI,EAAe,IAAgB,EACjC,MAA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A+B,EAAgB,KAAK,WACtF,CACF,CAND,EAAY,OAAO,EAAgB,KAAK,GAS5C,CAGE,EAAa,OAAS,GACxB,MAAM,EAAO,EAAa,CAGvB,GACH,EAAY,MAAM,CAGpB,IAAM,EADK,IAAI,MAAM,CAAC,SAAS,CACR,EAUvB,OARA,EAAO,KACL,EAAO,MACL,uBAAuB,EAAY,OAAO,gCACxC,EAAgB,KACjB,gBAAgB,EAAY,IAAK,YACnC,CACF,CAEM,CAAE,cAAa"}
@@ -0,0 +1,2 @@
1
+ import{t as e}from"./logger-Bj782ZYD.mjs";import{fetchConsentManagerAnalyticsData as t,fetchConsentManagerId as n}from"@transcend-io/sdk";async function r(r,{bin:i,start:a,end:o=new Date}){let s=await n(r,{logger:e});if(Math.floor(a.getTime()/1e3)>Math.floor(o.getTime()/1e3))throw Error(`Received "end" date that happened before "start" date`);if(i===`1h`&&o.getTime()-a.getTime()>6048e5*2)throw Error(`When using bin=1h, start and end time can be no more than 2 weeks apart`);let c=a.toISOString(),l=o.toISOString(),[u,d,f]=await Promise.all([t(r,{dataSource:`PRIVACY_SIGNAL_TIMESERIES`,startDate:c,endDate:l,forceRefetch:!0,airgapBundleId:s,binInterval:i,smoothTimeseries:!1},{logger:e}),t(r,{dataSource:`CONSENT_CHANGES_TIMESERIES`,startDate:c,endDate:l,forceRefetch:!0,airgapBundleId:s,binInterval:i,smoothTimeseries:!1},{logger:e}),t(r,{dataSource:`CONSENT_SESSIONS_BY_REGIME`,startDate:c,endDate:l,forceRefetch:!0,airgapBundleId:s,binInterval:i,smoothTimeseries:!1},{logger:e})]);return{PRIVACY_SIGNAL_TIMESERIES:u,CONSENT_CHANGES_TIMESERIES:d,CONSENT_SESSIONS_BY_REGIME:f}}export{r as t};
2
+ //# sourceMappingURL=pullConsentManagerMetrics-zKgjc3Ap.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pullConsentManagerMetrics-zKgjc3Ap.mjs","names":[],"sources":["../src/lib/consent-manager/pullConsentManagerMetrics.ts"],"sourcesContent":["import {\n type ConsentManagerMetric,\n ConsentManagerMetricBin,\n fetchConsentManagerAnalyticsData,\n fetchConsentManagerId,\n} from '@transcend-io/sdk';\nimport type { GraphQLClient } from 'graphql-request';\n\nimport { logger } from '../../logger.js';\n\n/**\n * One second of time in ms\n */\nconst ONE_SECOND = 1000;\nconst ONE_MINUTE = 60 * ONE_SECOND;\nconst ONE_HOUR = 60 * ONE_MINUTE;\nconst ONE_DAY = 24 * ONE_HOUR;\nconst ONE_WEEK = 7 * ONE_DAY;\n\n/**\n * Pull consent manager metrics in an organization\n *\n * @param client - GraphQL client\n * @param options - Options\n * @returns The consent manager metrics\n */\nexport async function pullConsentManagerMetrics(\n client: GraphQLClient,\n {\n bin,\n start,\n end = new Date(),\n }: {\n /** Start date to pull metrics from */\n start: Date;\n /** End date to pull metrics from (assumes now) */\n end?: Date;\n /** Bin size to pull metrics */\n bin: ConsentManagerMetricBin;\n },\n): Promise<{\n /** Privacy signal data */\n PRIVACY_SIGNAL_TIMESERIES: ConsentManagerMetric[];\n /** Consent changes data */\n CONSENT_CHANGES_TIMESERIES: ConsentManagerMetric[];\n /** Consent sessions by regime */\n CONSENT_SESSIONS_BY_REGIME: ConsentManagerMetric[];\n}> {\n // Grab the bundleId associated with this API key\n const airgapBundleId = await fetchConsentManagerId(client, { logger });\n\n // convert start and end to times\n const startTime = Math.floor(start.getTime() / 1000);\n const endTime = Math.floor(end.getTime() / 1000);\n if (startTime > endTime) {\n throw new Error('Received \"end\" date that happened before \"start\" date');\n }\n\n // do not allow hourly bins greater than 2 weeks\n if (bin === '1h' && end.getTime() - start.getTime() > ONE_WEEK * 2) {\n throw new Error('When using bin=1h, start and end time can be no more than 2 weeks apart');\n }\n\n // Pull in the metrics\n const startDate = start.toISOString();\n const endDate = end.toISOString();\n const [privacySignalData, consentChangesData, consentSessionsByRegimeData] = await Promise.all([\n fetchConsentManagerAnalyticsData(\n client,\n {\n dataSource: 'PRIVACY_SIGNAL_TIMESERIES',\n startDate,\n endDate,\n forceRefetch: true,\n airgapBundleId,\n binInterval: bin,\n smoothTimeseries: false,\n },\n { logger },\n ),\n fetchConsentManagerAnalyticsData(\n client,\n {\n dataSource: 'CONSENT_CHANGES_TIMESERIES',\n startDate,\n endDate,\n forceRefetch: true,\n airgapBundleId,\n binInterval: bin,\n smoothTimeseries: false,\n },\n { logger },\n ),\n fetchConsentManagerAnalyticsData(\n client,\n {\n dataSource: 'CONSENT_SESSIONS_BY_REGIME',\n startDate,\n endDate,\n forceRefetch: true,\n airgapBundleId,\n binInterval: bin,\n smoothTimeseries: false,\n },\n { logger },\n ),\n ]);\n\n return {\n PRIVACY_SIGNAL_TIMESERIES: privacySignalData,\n CONSENT_CHANGES_TIMESERIES: consentChangesData,\n CONSENT_SESSIONS_BY_REGIME: consentSessionsByRegimeData,\n };\n}\n"],"mappings":"0IA0BA,eAAsB,EACpB,EACA,CACE,MACA,QACA,MAAM,IAAI,MAgBX,CAED,IAAM,EAAiB,MAAM,EAAsB,EAAQ,CAAE,SAAQ,CAAC,CAKtE,GAFkB,KAAK,MAAM,EAAM,SAAS,CAAG,IAAK,CACpC,KAAK,MAAM,EAAI,SAAS,CAAG,IAAK,CAE9C,MAAU,MAAM,wDAAwD,CAI1E,GAAI,IAAQ,MAAQ,EAAI,SAAS,CAAG,EAAM,SAAS,CAAG,OAAW,EAC/D,MAAU,MAAM,0EAA0E,CAI5F,IAAM,EAAY,EAAM,aAAa,CAC/B,EAAU,EAAI,aAAa,CAC3B,CAAC,EAAmB,EAAoB,GAA+B,MAAM,QAAQ,IAAI,CAC7F,EACE,EACA,CACE,WAAY,4BACZ,YACA,UACA,aAAc,GACd,iBACA,YAAa,EACb,iBAAkB,GACnB,CACD,CAAE,SAAQ,CACX,CACD,EACE,EACA,CACE,WAAY,6BACZ,YACA,UACA,aAAc,GACd,iBACA,YAAa,EACb,iBAAkB,GACnB,CACD,CAAE,SAAQ,CACX,CACD,EACE,EACA,CACE,WAAY,6BACZ,YACA,UACA,aAAc,GACd,iBACA,YAAa,EACb,iBAAkB,GACnB,CACD,CAAE,SAAQ,CACX,CACF,CAAC,CAEF,MAAO,CACL,0BAA2B,EAC3B,2BAA4B,EAC5B,2BAA4B,EAC7B"}
@@ -0,0 +1,2 @@
1
+ import{a as e}from"./constants-muOBBQA_.mjs";import{t}from"./logger-Bj782ZYD.mjs";import{r as n}from"./fetchAllRequests-CHHdyb4Q.mjs";import{a as r}from"./writeCsv-C4pjXGsD.mjs";import{RequestStatus as i}from"@transcend-io/privacy-types";import{groupBy as a,uniq as o}from"lodash-es";import s from"colors";import{buildTranscendGraphQLClient as c,createSombraGotInstance as l,fetchAllRequestEnrichers as u,fetchAllRequestIdentifiers as d,validateSombraVersion as f}from"@transcend-io/sdk";import{map as p}from"@transcend-io/utils";async function m({file:m,auth:h,sombraAuth:g,requestActions:_=[],concurrency:v=100,transcendUrl:y=e}){let b=c(y,h),x=await l(y,h,{logger:t,sombraApiKey:g,sombraUrl:process.env.SOMBRA_URL});t.info(s.magenta(`Pulling manual enrichment requests, filtered for actions: ${_.join(`,`)}`));let S=await n(b,{actions:_,statuses:[i.Enriching]});await f(b,{logger:t});let C=[];await p(S,async e=>{let n=await u(b,{filterBy:{requestId:e.id},logger:t});if(n.filter(({status:e})=>e===`ACTION_REQUIRED`)){let r=await d(b,x,{filterBy:{requestId:e.id},skipSombraCheck:!0,logger:t});C.push({...e,requestIdentifiers:r,requestEnrichers:n})}},{concurrency:v});let w=C.map(({attributeValues:e,requestIdentifiers:t,requestEnrichers:n,...r})=>({...r,...Object.entries(a(t,`name`)).reduce((e,[t,n])=>Object.assign(e,{[t]:n.map(({value:e})=>e).join(`,`)}),{}),...Object.entries(a(e,`attributeKey.name`)).reduce((e,[t,n])=>Object.assign(e,{[t]:n.map(({name:e})=>e).join(`,`)}),{})}));return await r(m,w,o(w.map(e=>Object.keys(e)).flat())),t.info(s.green(`Successfully wrote ${C.length} requests to file "${m}"`)),C}export{m as t};
2
+ //# sourceMappingURL=pullManualEnrichmentIdentifiersToCsv-kpGy9H7T.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pullManualEnrichmentIdentifiersToCsv-kpGy9H7T.mjs","names":[],"sources":["../src/lib/manual-enrichment/pullManualEnrichmentIdentifiersToCsv.ts"],"sourcesContent":["import { RequestAction, RequestStatus } from '@transcend-io/privacy-types';\nimport {\n buildTranscendGraphQLClient,\n createSombraGotInstance,\n fetchAllRequestEnrichers,\n fetchAllRequestIdentifiers,\n validateSombraVersion,\n type RequestEnricher,\n type RequestIdentifier,\n} from '@transcend-io/sdk';\nimport { map } from '@transcend-io/utils';\nimport colors from 'colors';\nimport { groupBy, uniq } from 'lodash-es';\n\nimport { DEFAULT_TRANSCEND_API } from '../../constants.js';\nimport { logger } from '../../logger.js';\nimport { type PrivacyRequest, fetchAllRequests } from '../graphql/index.js';\nimport { writeCsv } from '../helpers/writeCsv.js';\n\nexport interface PrivacyRequestWithIdentifiers extends PrivacyRequest {\n /** Request Enrichers */\n requestEnrichers: RequestEnricher[];\n /** Request Identifiers */\n requestIdentifiers: RequestIdentifier[];\n}\n\n/**\n * Pull the set of manual enrichment jobs to CSV\n *\n * @param options - Options\n * @returns List of requests with identifiers\n */\nexport async function pullManualEnrichmentIdentifiersToCsv({\n file,\n auth,\n sombraAuth,\n requestActions = [],\n concurrency = 100,\n transcendUrl = DEFAULT_TRANSCEND_API,\n}: {\n /** CSV file path */\n file: string;\n /** Transcend API key authentication */\n auth: string;\n /** Sombra API key */\n sombraAuth?: string;\n /** Concurrency */\n concurrency?: number;\n /** The request actions to fetch */\n requestActions?: RequestAction[];\n /** API URL for Transcend backend */\n transcendUrl?: string;\n}): Promise<PrivacyRequestWithIdentifiers[]> {\n // Find all requests made before createdAt that are in a removing data state\n const client = buildTranscendGraphQLClient(transcendUrl, auth);\n const sombra = await createSombraGotInstance(transcendUrl, auth, {\n logger,\n sombraApiKey: sombraAuth,\n sombraUrl: process.env.SOMBRA_URL,\n });\n\n logger.info(\n colors.magenta(\n `Pulling manual enrichment requests, filtered for actions: ${requestActions.join(',')}`,\n ),\n );\n\n // Pull all privacy requests\n const allRequests = await fetchAllRequests(client, {\n actions: requestActions,\n statuses: [RequestStatus.Enriching],\n });\n\n await validateSombraVersion(client, { logger });\n\n // Requests to save\n const savedRequests: PrivacyRequestWithIdentifiers[] = [];\n\n // Filter down requests to what is needed\n await map(\n allRequests,\n async (request) => {\n // Fetch enrichers\n const requestEnrichers = await fetchAllRequestEnrichers(client, {\n filterBy: { requestId: request.id },\n logger,\n });\n\n // Check if manual enrichment exists for that request\n const hasManualEnrichment = requestEnrichers.filter(\n ({ status }) => status === 'ACTION_REQUIRED',\n );\n\n // Save request to queue\n if (hasManualEnrichment) {\n const requestIdentifiers = await fetchAllRequestIdentifiers(client, sombra, {\n filterBy: { requestId: request.id },\n skipSombraCheck: true,\n logger,\n });\n savedRequests.push({\n ...request,\n requestIdentifiers,\n requestEnrichers,\n });\n }\n },\n {\n concurrency,\n },\n );\n\n const data = savedRequests.map(\n ({\n attributeValues,\n requestIdentifiers,\n requestEnrichers, // eslint-disable-line @typescript-eslint/no-unused-vars\n ...request\n }) => ({\n ...request,\n // flatten identifiers\n ...Object.entries(groupBy(requestIdentifiers, 'name')).reduce(\n (acc, [key, values]) =>\n Object.assign(acc, {\n [key]: values.map(({ value }) => value).join(','),\n }),\n {},\n ),\n // flatten attributes\n ...Object.entries(groupBy(attributeValues, 'attributeKey.name')).reduce(\n (acc, [key, values]) =>\n Object.assign(acc, {\n [key]: values.map(({ name }) => name).join(','),\n }),\n {},\n ),\n }),\n );\n\n // Write out to CSV\n const headers = uniq(data.map((d) => Object.keys(d)).flat());\n await writeCsv(file, data, headers);\n\n logger.info(\n colors.green(`Successfully wrote ${savedRequests.length} requests to file \"${file}\"`),\n );\n\n return savedRequests;\n}\n"],"mappings":"khBAgCA,eAAsB,EAAqC,CACzD,OACA,OACA,aACA,iBAAiB,EAAE,CACnB,cAAc,IACd,eAAe,GAc4B,C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AS,EAAM,EADL,EAAK,EAAK,IAAK,GAAM,OAAO,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC,CACzB,CAEnC,EAAO,KACL,EAAO,MAAM,sBAAsB,EAAc,OAAO,qBAAqB,EAAK,GAAG,CACtF,CAEM"}
@@ -0,0 +1,58 @@
1
+ import{o as e}from"./enums-CyFTrzXY.mjs";import{t}from"./logger-Bj782ZYD.mjs";import{ActionItemCode as n,ConsentTrackerStatus as r,RequestAction as i,RetentionType as a}from"@transcend-io/privacy-types";import{flatten as o,keyBy as s,mapValues as c}from"lodash-es";import l from"colors";import{ASSESSMENT_SECTION_FIELDS as u,convertToDataSubjectAllowlist as d,fetchAllActionItemCollections as f,fetchAllActionItems as p,fetchAllActions as m,fetchAllAgentFiles as h,fetchAllAgentFunctions as g,fetchAllAgents as _,fetchAllAssessments as v,fetchAllAttributes as y,fetchAllBusinessEntities as b,fetchAllCookies as x,fetchAllDataCategories as S,fetchAllDataFlows as C,fetchAllDataSubjects as ee,fetchAllEnrichers as w,fetchAllIdentifiers as T,fetchAllMessages as E,fetchAllPolicies as D,fetchAllPrivacyCenters as te,fetchAllProcessingActivities as ne,fetchAllProcessingPurposes as re,fetchAllPromptGroups as ie,fetchAllPromptPartials as ae,fetchAllPrompts as oe,fetchAllPurposesAndPreferences as se,fetchAllSiloDiscoveryResults as ce,fetchAllTeams as le,fetchAllTemplates as ue,fetchAllVendors as de,fetchApiKeys as fe,fetchConsentManager as pe,fetchConsentManagerExperiences as me,fetchConsentManagerTheme as he,fetchEnrichedDataSilos as ge,fetchPartitions as _e,formatAttributeValues as O,formatRegions as k,makeGraphQLRequest as A,parseAssessmentDisplayLogic as j,parseAssessmentRiskLogic as M}from"@transcend-io/sdk";import{gql as N}from"graphql-request";const P=N`
2
+ query TranscendCliAssessmentTemplates(
3
+ $first: Int!
4
+ $offset: Int!
5
+ $filterBy: AssessmentFormTemplateFiltersInput
6
+ ) {
7
+ assessmentFormTemplates(
8
+ first: $first
9
+ offset: $offset
10
+ filterBy: $filterBy
11
+ ) {
12
+ nodes {
13
+ id
14
+ creator {
15
+ id
16
+ email
17
+ name
18
+ }
19
+ lastEditor {
20
+ id
21
+ email
22
+ name
23
+ }
24
+ title
25
+ description
26
+ status
27
+ source
28
+ parentId
29
+ isLocked
30
+ isArchived
31
+ createdAt
32
+ updatedAt
33
+ retentionSchedule {
34
+ id
35
+ type
36
+ durationDays
37
+ operation
38
+ createdAt
39
+ updatedAt
40
+ }
41
+ assessmentEmailSet {
42
+ id
43
+ title
44
+ description
45
+ isDefault
46
+ templates {
47
+ id
48
+ title
49
+ }
50
+ }
51
+ sections {
52
+ ${u}
53
+ }
54
+ }
55
+ }
56
+ }
57
+ `;async function F(e){let n=[],r=0,i=!1;do{let{assessmentFormTemplates:{nodes:a}}=await A(e,P,{variables:{first:20,offset:r},logger:t});n.push(...a),r+=20,i=a.length===20}while(i);return n.sort((e,t)=>e.title.localeCompare(t.title))}const I=[e.DataSilos,e.Enrichers,e.Templates,e.ApiKeys];async function L(u,{dataSiloIds:A,integrationNames:N,debug:P,resources:L=I,pageSize:R,skipDatapoints:ve,includeGuessedCategories:z,skipSubDatapoints:ye,trackerStatuses:B=Object.values(r)}){if(A.length>0&&N.length>0)throw Error(`Only 1 of integrationNames OR dataSiloIds can be provided`);t.info(l.magenta(`Fetching data with page size ${R}...`));let[V,be,H,U,W,G,xe,K,q,J,Y,Se,X,Ce,we,Te,Ee,De,Oe,ke,Ae,je,Me,Ne,Pe,Fe,Ie,Le,Re,ze,Be,Ve,He,Ue]=await Promise.all([L.includes(e.DataSilos)||L.includes(e.DataSubjects)?ee(u,{logger:t}):[],L.includes(e.ApiKeys)?fe(u,{fetchAll:!0,logger:t}):[],L.includes(e.DataSilos)?ge(u,{ids:A,integrationNames:N,pageSize:R,debug:P,includeGuessedCategories:z,skipDatapoints:ve,skipSubDatapoints:ye,logger:t}):[],L.includes(e.Enrichers)?w(u,{logger:t}):[],L.includes(e.DataFlows)?[...B.includes(r.Live)?await C(u,{logger:t,filterBy:{status:r.Live}}):[],...B.includes(r.NeedsReview)?await C(u,{logger:t,filterBy:{status:r.NeedsReview}}):[]]:[],L.includes(e.Cookies)?[...B.includes(r.Live)?await x(u,{logger:t,filterBy:{status:r.Live}}):[],...B.includes(r.NeedsReview)?await x(u,{logger:t,filterBy:{status:r.NeedsReview}}):[]]:[],L.includes(e.Attributes)?y(u,{logger:t}):[],L.includes(e.Templates)?ue(u,{logger:t}):[],L.includes(e.Identifiers)?T(u,{logger:t}):[],L.includes(e.Actions)?m(u,{logger:t}):[],L.includes(e.BusinessEntities)?b(u,{logger:t}):[],L.includes(e.ProcessingActivities)?ne(u,{logger:t}):[],L.includes(e.ConsentManager)?pe(u,{logger:t}):void 0,L.includes(e.ConsentManager)?me(u,{logger:t}):[],L.includes(e.Prompts)?oe(u,{logger:t}):[],L.includes(e.PromptPartials)?ae(u,{logger:t}):[],L.includes(e.PromptGroups)?ie(u,{logger:t}):[],L.includes(e.Agents)?_(u,{logger:t}):[],L.includes(e.AgentFunctions)?g(u,{logger:t}):[],L.includes(e.AgentFiles)?h(u,{logger:t}):[],L.includes(e.Vendors)?de(u,{logger:t}):[],L.includes(e.DataCategories)?S(u,{logger:t}):[],L.includes(e.ProcessingPurposes)?re(u,{logger:t}):[],L.includes(e.ActionItems)?p(u,{logger:t,filterBy:{type:[n.Onboarding]}}):[],L.includes(e.ActionItemCollections)?f(u,{logger:t}):[],L.includes(e.Teams)?le(u,{logger:t}):[],L.includes(e.Policies)?D(u,{logger:t}):[],L.includes(e.PrivacyCenters)?te(u,{logger:t}):[],L.includes(e.Messages)?E(u,{logger:t}):[],L.includes(e.Partitions)?_e(u,{logger:t}):[],L.includes(e.Assessments)?v(u,{logger:t}):[],L.includes(e.AssessmentTemplates)?F(u):[],L.includes(e.Purposes)?se(u,{logger:t}):[],L.includes(e.SystemDiscovery)?ce(u,{logger:t}):[]]),Z=L.includes(e.ConsentManager)&&X?await he(u,{logger:t,filterBy:{airgapBundleId:X.id}}):void 0,Q={},We=o(H.map(([{apiKeys:e}])=>e.map(({title:e})=>e))),$=Object.values(be).filter(({title:t})=>L.includes(e.ApiKeys)?!0:We.includes(t));if($.length>0&&L.includes(e.ApiKeys)&&(Q[`api-keys`]=$.map(({title:e})=>({title:e}))),ze.length>0&&L.includes(e.Partitions)&&(Q.partitions=ze.map(({name:e,partition:t})=>({name:e,partition:t}))),X&&L.includes(e.ConsentManager)&&(Q[`consent-manager`]={bundleUrls:{TEST:X.testBundleURL,PRODUCTION:X.bundleURL},domains:X.configuration.domains||void 0,partition:X.configuration.partition||void 0,consentPrecedence:X.configuration.consentPrecedence||void 0,unknownRequestPolicy:X.configuration.unknownRequestPolicy||void 0,unknownCookiePolicy:X.configuration.unknownCookiePolicy||void 0,syncEndpoint:X.configuration.syncEndpoint||void 0,telemetryPartitioning:X.configuration.telemetryPartitioning||void 0,signedIabAgreement:X.configuration.signedIabAgreement||void 0,syncGroups:X.configuration.syncGroups||void 0,theme:Z?{primaryColor:Z.primaryColor||void 0,fontColor:Z.fontColor||void 0,privacyPolicy:Z.privacyPolicy||void 0,prompt:Z.prompt}:void 0,experiences:Ce.map(e=>({name:e.name,displayName:e.displayName||void 0,regions:e.regions.map(e=>({countrySubDivision:e.countrySubDivision||void 0,country:e.country||void 0})),onConsentExpiry:e.onConsentExpiry,consentExpiry:e.consentExpiry,operator:e.operator,displayPriority:e.displayPriority,viewState:e.viewState,purposes:e.purposes.map(e=>({trackingType:e.trackingType})),optedOutPurposes:e.optedOutPurposes.map(e=>({trackingType:e.trackingType})),browserLanguages:e.browserLanguages,browserTimeZones:e.browserTimeZones}))}),Be.length>0&&L.includes(e.Assessments)&&(Q.assessments=Be.map(({title:e,assessmentGroup:t,sections:n,creator:r,description:i,status:a,assignees:o,externalAssignees:s,reviewers:c,isLocked:l,isArchived:u,isExternallyCreated:d,dueDate:f,createdAt:p,assignedAt:m,submittedAt:h,approvedAt:g,rejectedAt:_,titleIsInternal:v,retentionSchedule:y,attributeValues:b,resources:x,syncedRows:S})=>({title:e,group:t.title,sections:n.map(({title:e,status:t,questions:n,assignees:r,isReviewed:i,externalAssignees:a})=>({title:e,status:t,questions:n.map(({title:e,type:t,subType:n,placeholder:r,description:i,isRequired:a,referenceId:o,displayLogic:s,riskLogic:c,riskCategories:l,riskFramework:u,answerOptions:d,selectedAnswers:f,allowedMimeTypes:p,allowSelectOther:m,syncModel:h,syncColumn:g,attributeKey:_,requireRiskEvaluation:v,requireRiskMatrixEvaluation:y})=>{let b=s?j(s):void 0;return{title:e,type:t,"sub-type":n,placeholder:r,description:i,"is-required":a,"reference-id":o,"display-logic":b&&Object.keys(b).length>0?{action:b.action,rule:b.rule?{"depends-on-question-reference-id":b.rule.dependsOnQuestionReferenceId,"comparison-operator":b.rule.comparisonOperator,"comparison-operands":`comparisonOperands`in b.rule?b.rule.comparisonOperands:void 0}:void 0,"nested-rule":b.nestedRule?{"logic-operator":b.nestedRule.logicOperator,rules:(b.nestedRule.rules||[]).map(e=>({"depends-on-question-reference-id":e.dependsOnQuestionReferenceId,"comparison-operator":e.comparisonOperator,"comparison-operands":`comparisonOperands`in e?e.comparisonOperands:void 0}))}:void 0}:void 0,"risk-logic":c.map(e=>{let t=M(e);return{"risk-level":t.riskAssignment?.riskLevelId,"comparison-operands":t.comparisonOperands,"comparison-operator":t.comparisonOperator}}),"risk-categories":l.map(({title:e})=>e),"risk-framework":u?.title,"answer-options":d.map(({value:e})=>({value:e})),"selected-answers":f.map(({value:e})=>e),"allowed-mime-types":p,"allow-select-other":m,"sync-model":h||void 0,"sync-column":g||void 0,"attribute-key":_?.name,"require-risk-evaluation":v,"require-risk-matrix-evaluation":y}}),assignees:r.map(({email:e})=>e),"external-assignees":a.map(({email:e})=>e),"is-reviewed":i})),creator:r?.email,description:i,status:a,assignees:o.map(({email:e})=>e),"external-assignees":s.map(({email:e})=>e),reviewers:c.map(({email:e})=>e),locked:l,archived:u,external:d,"title-is-internal":v,"due-date":f||void 0,"created-at":p||void 0,"assigned-at":m||void 0,"submitted-at":h||void 0,"approved-at":g||void 0,"rejected-at":_||void 0,"retention-schedule":y?{type:y.type,"duration-days":y.durationDays,operand:y.operation}:void 0,attributes:b!==void 0&&b.length>0?O(b):void 0,resources:x.map(({resourceType:e,title:t,name:n,category:r,type:i,purpose:a})=>({type:e,title:r?`${r} - ${n}`:a?`${a} - ${n}`:t||n||i||``})),rows:S.map(({resourceType:e,title:t,name:n,category:r,type:i,purpose:a})=>({type:e,title:r?`${r} - ${n}`:a?`${a} - ${n}`:t||n||i||``}))}))),Ve.length>0&&L.includes(e.AssessmentTemplates)&&(Q[`assessment-templates`]=Ve.map(({title:e,description:t,sections:n,status:r,source:i,creator:a,isLocked:o,isArchived:s,createdAt:c,retentionSchedule:l})=>({title:e,description:t,sections:n.map(({title:e,questions:t})=>({title:e,questions:t.map(({title:e,type:t,subType:n,placeholder:r,description:i,isRequired:a,referenceId:o,displayLogic:s,riskLogic:c,riskCategories:l,riskFramework:u,answerOptions:d,allowedMimeTypes:f,allowSelectOther:p,syncModel:m,syncColumn:h,attributeKey:g,requireRiskEvaluation:_,requireRiskMatrixEvaluation:v})=>{let y=s?j(s):void 0;return{title:e,type:t,"sub-type":n,placeholder:r,description:i,"is-required":a,"reference-id":o,"display-logic":y&&Object.keys(y).length>0?{action:y.action,rule:y.rule?{"depends-on-question-reference-id":y.rule.dependsOnQuestionReferenceId,"comparison-operator":y.rule.comparisonOperator,"comparison-operands":`comparisonOperands`in y.rule?y.rule.comparisonOperands:void 0}:void 0,"nested-rule":y.nestedRule?{"logic-operator":y.nestedRule.logicOperator,rules:(y.nestedRule.rules||[]).map(e=>({"depends-on-question-reference-id":e.dependsOnQuestionReferenceId,"comparison-operator":e.comparisonOperator,"comparison-operands":`comparisonOperands`in e?e.comparisonOperands:void 0}))}:void 0}:void 0,"risk-logic":c.map(e=>{let t=M(e);return{"risk-level":t.riskAssignment?.riskLevelId,"risk-matrix-row":t.riskAssignment?.riskMatrixRowId,"risk-matrix-column":t.riskAssignment?.riskMatrixColumnId,"comparison-operands":t.comparisonOperands,"comparison-operator":t.comparisonOperator}}),"risk-categories":l.map(({title:e})=>e),"risk-framework":u?.title,"answer-options":d.map(({value:e})=>({value:e})),"allowed-mime-types":f,"allow-select-other":p,"sync-model":m||void 0,"sync-column":h||void 0,"attribute-key":g?.name,"require-risk-evaluation":_,"require-risk-matrix-evaluation":v}})})),status:r,source:i,creator:a?.email,locked:o,archived:s,"created-at":c||void 0,"retention-schedule":l?{type:l.type,"duration-days":l.durationDays,operand:l.operation}:void 0}))),Ue.length>0&&L.includes(e.SystemDiscovery)&&(Q[`system-discovery`]=Ue.map(({title:e,resourceId:t,suggestedCatalog:{title:n},plugin:{dataSilo:{title:r}},country:i,countrySubDivision:a,plaintextContext:o,containsSensitiveData:s,status:c})=>({title:e,resourceId:t,suggestedCatalog:n,plugin:r,country:i||void 0,countrySubDivision:a||void 0,plaintextContext:o,containsSensitiveData:s,status:c}))),we.length>0&&L.includes(e.Prompts)&&(Q.prompts=we.map(({title:e,content:t})=>({title:e,content:t}))),Te.length>0&&L.includes(e.PromptPartials)&&(Q[`prompt-partials`]=Te.map(({title:e,content:t})=>({title:e,content:t}))),Ee.length>0&&L.includes(e.PromptGroups)&&(Q[`prompt-groups`]=Ee.map(({title:e,description:t,prompts:n})=>({title:e,description:t,prompts:n.map(({title:e})=>e)}))),Fe.length>0&&L.includes(e.Teams)&&(Q.teams=Fe.map(({name:e,description:t,ssoDepartment:n,ssoGroup:r,ssoTitle:i,users:a,scopes:o})=>({name:e,description:t,"sso-department":n||void 0,"sso-group":r||void 0,"sso-title":i||void 0,users:a.map(({email:e})=>e),scopes:o.map(({name:e})=>e)}))),V.length>0&&L.includes(e.DataSubjects)&&(Q[`data-subjects`]=V.map(({type:e,title:t,active:n,adminDashboardDefaultSilentMode:r,actions:i})=>({type:e,title:t?.defaultMessage,active:n,adminDashboardDefaultSilentMode:r,actions:i.map(({type:e})=>e)}))),Ie.length>0&&(Q.policies=Ie.map(({title:e,versions:t,disabledLocales:n})=>({title:e?.defaultMessage,content:t?.[0]?.content?.defaultMessage,disabledLocales:n}))),Re.length>0&&(Q.messages=Re.map(({id:e,defaultMessage:t,targetReactIntlId:n,description:r,translations:i})=>({id:e,defaultMessage:t,description:r,targetReactIntlId:n||void 0,translations:i.reduce((e,{locale:t,value:n})=>Object.assign(e,{[t]:n}),{})}))),Le.length>0){let e=Le[0];Q[`privacy-center`]={isDisabled:e.isDisabled,showPrivacyRequestButton:e.showPrivacyRequestButton,showPolicies:e.showPolicies,showTrackingTechnologies:e.showTrackingTechnologies,showCookies:e.showCookies,showDataFlows:e.showDataFlows,showConsentManager:e.showConsentManager,showManageYourPrivacy:e.showManageYourPrivacy,showMarketingPreferences:e.showMarketingPreferences,locales:e.locales,defaultLocale:e.defaultLocale,preferBrowserDefaultLocale:e.preferBrowserDefaultLocale,supportEmail:e.supportEmail||void 0,replyToEmail:e.replyToEmail||void 0,useNoReplyEmailAddress:e.useNoReplyEmailAddress,useCustomEmailDomain:e.useCustomEmailDomain,transformAccessReportJsonToCsv:e.transformAccessReportJsonToCsv,theme:e.theme}}if(Y.length>0&&L.includes(e.BusinessEntities)&&(Q[`business-entities`]=Y.map(({title:e,description:t,address:n,headquarterCountry:r,headquarterSubDivision:i,dataProtectionOfficerName:a,dataProtectionOfficerEmail:o,attributeValues:s})=>({title:e,description:t||void 0,address:n||void 0,headquarterCountry:r||void 0,headquarterSubDivision:i||void 0,dataProtectionOfficerName:a||void 0,dataProtectionOfficerEmail:o||void 0,attributes:s!==void 0&&s.length>0?O(s):void 0}))),Se.length>0&&L.includes(e.ProcessingActivities)&&(Q[`processing-activities`]=Se.map(({title:e,description:t,securityMeasureDetails:n,controllerships:r,storageRegions:i,transferRegions:o,retentionType:s,retentionPeriod:c,dataProtectionImpactAssessmentLink:l,dataProtectionImpactAssessmentStatus:u,attributeValues:d,dataSilos:f,dataSubjects:p,teams:m,owners:h,processingPurposeSubCategories:g,dataSubCategories:_,saaSCategories:v})=>({title:e,description:t,securityMeasureDetails:n??void 0,controllerships:r.length>0?r:void 0,storageRegions:i.length>0?k(i):void 0,transferRegions:o.length>0?k(o):void 0,retentionType:s,retentionPeriod:s===a.StatedPeriod?c:void 0,dataProtectionImpactAssessmentLink:l??void 0,dataProtectionImpactAssessmentStatus:u,attributes:d!==void 0&&d.length>0?O(d):void 0,dataSiloTitles:f.length>0?f.map(({title:e})=>e):void 0,dataSubjectTypes:p.length>0?p.map(({type:e})=>e):void 0,teamNames:m.length>0?m.map(({name:e})=>e):void 0,ownerEmails:h.length>0?h.map(({email:e})=>e):void 0,processingSubPurposes:g.length>0?g.map(({name:e,purpose:t})=>({purpose:t,...e?{name:e}:{}})):void 0,dataSubCategories:_.length>0?_.map(({name:e,category:t})=>({category:t,...e?{name:e}:{}})):void 0,saaSCategories:v.length>0?v.map(({title:e})=>e):void 0}))),J.length>0&&L.includes(e.Actions)&&(Q.actions=J.map(({type:e,skipSecondaryIfNoFiles:t,skipDownloadableStep:n,requiresReview:r,regionList:a,regionDetectionMethod:o,waitingPeriod:s})=>({type:e,...e===i.Erasure?{skipSecondaryIfNoFiles:t,skipDownloadableStep:n}:{},requiresReview:r,waitingPeriod:s,regionDetectionMethod:o,regionList:a.length>0?a:void 0}))),q.length>0&&L.includes(e.Identifiers)&&(Q.identifiers=q.map(({name:e,type:t,regex:n,selectOptions:r,privacyCenterVisibility:i,isRequiredInForm:a,placeholder:o,displayTitle:s,dataSubjects:c,displayDescription:l,displayOrder:u,isUniqueOnPreferenceStore:d})=>({name:e,type:t,regex:n,selectOptions:r.length>0?r:void 0,privacyCenterVisibility:i.length>0?i:void 0,isRequiredInForm:a,placeholder:o||void 0,dataSubjects:c.length>0?c.map(({type:e})=>e):void 0,displayTitle:s?.defaultMessage,displayDescription:l?.defaultMessage,displayOrder:u,isUniqueOnPreferenceStore:d}))),De.length>0&&L.includes(e.Agents)&&(Q.agents=De.map(({name:e,agentId:t,description:n,instructions:r,codeInterpreterEnabled:i,retrievalEnabled:a,prompt:o,largeLanguageModel:s,teams:c,owners:l,agentFunctions:u,agentFiles:d})=>({name:e,agentId:t,description:n||void 0,instructions:r,codeInterpreterEnabled:i,retrievalEnabled:a,prompt:o?.title,"large-language-model":{name:s.name,client:s.client},teams:c&&c.length>0?c.map(({name:e})=>e):void 0,owners:l&&l.length>0?l.map(({email:e})=>e):void 0,"agent-functions":u&&u.length>0?u.map(({name:e})=>e):void 0,"agent-files":d&&d.length>0?d.map(({name:e})=>e):void 0}))),Ne.length>0&&L.includes(e.ActionItems)&&(Q[`action-items`]=Ne.map(({teams:e,users:t,customerExperienceActionItemIds:[n],dueDate:r,priority:i,resolved:a,collections:o,notes:s,link:c,title:l,type:u,attributeValues:d})=>({teams:e.map(({name:e})=>e),users:t.map(({email:e})=>e),dueDate:r||void 0,title:l,notes:s,customerExperienceActionItemId:n,collections:o.map(({title:e})=>e),link:c,priority:i||void 0,resolved:a,type:u,attributes:d!==void 0&&d.length>0?O(d):void 0}))),Pe.length>0&&L.includes(e.ActionItemCollections)&&(Q[`action-item-collections`]=Pe.map(({title:e,description:t,hidden:n,productLine:r})=>({title:e,description:t||void 0,hidden:n,productLine:r}))),Oe.length>0&&L.includes(e.AgentFunctions)&&(Q[`agent-functions`]=Oe.map(({name:e,description:t,parameters:n})=>({name:e,description:t,parameters:JSON.stringify(n)}))),ke.length>0&&L.includes(e.AgentFiles)&&(Q[`agent-files`]=ke.map(({name:e,description:t,fileId:n,size:r,purpose:i})=>({name:e,description:t,fileId:n,size:r,purpose:i}))),Ae.length>0&&L.includes(e.Vendors)&&(Q.vendors=Ae.map(({title:e,description:t,dataProcessingAgreementLink:n,contactName:r,contactPhone:i,address:a,headquarterCountry:o,headquarterSubDivision:s,websiteUrl:c,businessEntity:l,teams:u,owners:d,attributeValues:f})=>({title:e,description:t||void 0,dataProcessingAgreementLink:n||void 0,contactName:r||void 0,contactPhone:i||void 0,address:a||void 0,headquarterCountry:o||void 0,headquarterSubDivision:s||void 0,websiteUrl:c||void 0,businessEntity:l?.title,teams:u&&u.length>0?u.map(({name:e})=>e):void 0,owners:d&&d.length>0?d.map(({email:e})=>e):void 0,attributes:f!==void 0&&f.length>0?O(f):void 0}))),je.length>0&&L.includes(e.DataCategories)&&(Q[`data-categories`]=je.map(({name:e,category:t,description:n,regex:r,owners:i,teams:a,attributeValues:o})=>({name:e,category:t,description:n||void 0,regex:r||void 0,owners:i&&i.length>0?i.map(({email:e})=>e):void 0,teams:a&&a.length>0?a.map(({name:e})=>e):void 0,attributes:o!==void 0&&o.length>0?O(o):void 0}))),Me.length>0&&L.includes(e.ProcessingPurposes)&&(Q[`processing-purposes`]=Me.map(({name:e,purpose:t,description:n,owners:r,teams:i,attributeValues:a})=>({name:e,purpose:t,description:n||void 0,owners:r&&r.length>0?r.map(({email:e})=>e):void 0,teams:i&&i.length>0?i.map(({name:e})=>e):void 0,attributes:a!==void 0&&a.length>0?O(a):void 0}))),W.length>0&&L.includes(e.DataFlows)&&(Q[`data-flows`]=W.map(({value:e,type:t,description:n,trackingType:r,service:i,status:a,owners:o,teams:s,attributeValues:c})=>({value:e,type:t,description:n||void 0,trackingPurposes:r,status:a,service:i?.integrationName,owners:o.map(({email:e})=>e),teams:s.map(({name:e})=>e),attributes:c!==void 0&&c.length>0?O(c):void 0}))),G.length>0&&L.includes(e.Cookies)&&(Q.cookies=G.map(({name:e,isRegex:t,description:n,trackingPurposes:r,service:i,status:a,owners:o,teams:s,attributeValues:c})=>({name:e,isRegex:t,description:n||void 0,trackingPurposes:r,status:a,service:i?.integrationName,owners:o.map(({email:e})=>e),teams:s.map(({name:e})=>e),attributes:c!==void 0&&c.length>0?O(c):void 0}))),xe.length>0&&L.includes(e.Attributes)&&(Q.attributes=xe.map(({description:e,name:t,type:n,values:r,enabledOn:i=[]})=>({description:e||void 0,resources:i,name:t,type:n,values:r.map(({name:e,color:t,description:n})=>({name:e,color:t||void 0,description:n}))}))),He.length>0&&(Q.purposes=He.map(({name:e,description:t,trackingType:n,defaultConsent:r,configurable:i,showInConsentManager:a,isActive:o,displayOrder:s,optOutSignals:c,authLevel:l,topics:u,showInPrivacyCenter:d,title:f})=>({name:e,title:f,description:t||void 0,trackingType:n,"default-consent":r,configurable:i,"show-in-consent-manager":a,"show-in-privacy-center":d,"is-active":o,"display-order":s,"opt-out-signals":c.length>0?c:void 0,"auth-level":l||void 0,"preference-topics":u.map(({title:e,type:t,displayDescription:n,defaultConfiguration:r,showInPrivacyCenter:i,preferenceOptionValues:a})=>({title:e.defaultMessage,type:t,description:n.defaultMessage,"default-configuration":r,"show-in-privacy-center":i,...a.length>0?{options:a.map(({title:e,slug:t})=>({title:e.defaultMessage,slug:t}))}:{}}))}))),A.length===0&&K.length>0&&L.includes(e.Templates)&&(Q.templates=K.map(({title:e})=>({title:e}))),U.length>0&&L.includes(e.Enrichers)&&(Q.enrichers=U.map(({title:e,url:t,type:n,inputIdentifier:r,identifiers:a,actions:o,testRegex:s,dataSubjects:c,expirationDuration:l,lookerQueryTitle:u,transitionRequestStatus:d,phoneNumbers:f,regionList:p})=>({title:e,url:t||void 0,type:n,"input-identifier":r?.name,"output-identifiers":a.map(({name:e})=>e),"privacy-actions":Object.values(i).length===o.length?void 0:o,testRegex:s||void 0,lookerQueryTitle:u||void 0,expirationDuration:parseInt(l,10),transitionRequestStatus:d||void 0,phoneNumbers:f&&f.length>0?f:void 0,regionList:p&&p.length>0?p:void 0,"data-subjects":c.map(({type:e})=>e)}))),H.length>0&&L.includes(e.DataSilos)){let e=s(V,`type`);Q[`data-silos`]=H.map(([{title:t,description:n,url:r,type:i,outerType:a,apiKeys:o,notifyEmailAddress:l,identifiers:u,dependentDataSilos:f,owners:p,country:m,countrySubDivision:h,teams:g,subjectBlocklist:_,isLive:v,promptAVendorEmailSendFrequency:y,promptAVendorEmailSendType:b,promptAVendorEmailIncludeIdentifiersAttachment:x,promptAVendorEmailCompletionLinkType:S,manualWorkRetryFrequency:C,catalog:ee,attributeValues:w,discoveredBy:T,businessEntities:E},D])=>({title:t,description:n,integrationName:i,"outer-type":a||void 0,url:r||void 0,"api-key-title":o[0]?.title,"identity-keys":u.filter(({isConnected:e})=>e).map(({name:e})=>e),...f.length>0?{"deletion-dependencies":f.map(({title:e})=>e)}:{},...p.length>0?{owners:p.map(({email:e})=>e)}:{},...g.length>0?{teams:g.map(({name:e})=>e)}:{},...T.length>0?{discoveredBy:T.map(({title:e})=>e)}:{},...E.length>0?{businessEntities:E.map(({title:e})=>e)}:{},country:m||void 0,countrySubDivision:h||void 0,disabled:!v,"data-subjects":_.length>0?d(_.map(({type:e})=>e),e):void 0,...ee.hasAvcFunctionality?{"email-settings":{"notify-email-address":l||void 0,"send-frequency":y,"send-type":b,"include-identifiers-attachment":x,"completion-link-type":S,"manual-work-retry-frequency":C}}:{},attributes:w!==void 0&&w.length>0?O(w):void 0,datapoints:D.map(e=>({key:e.name,title:e.title?.defaultMessage,description:e.description?.defaultMessage,owners:e.owners.map(({email:e})=>e),teams:e.teams.map(({name:e})=>e),...e.path.length>0?{path:e.path}:{},...e.dataCollection?.title?{"data-collection-tag":e.dataCollection.title.defaultMessage}:{},...e.dbIntegrationQueries.length>0?{"privacy-action-queries":c(s(e.dbIntegrationQueries,`requestType`),e=>e.suggestedQuery||e.query||void 0)}:{},...e.subDataPoints.length>0?{fields:e.subDataPoints.map(e=>({key:e.name,description:e.description,purposes:e.purposes,categories:e.categories,...z&&e.pendingCategoryGuesses?{"guessed-categories":e.pendingCategoryGuesses.filter(e=>e.status===`PENDING`).map(e=>({category:{name:e.category.name,category:e.category.category},status:e.status,confidence:e.confidence,classifierVersion:e.classifierVersion||void 0}))}:{},"access-request-visibility-enabled":e.accessRequestVisibilityEnabled,"erasure-request-redaction-enabled":e.erasureRequestRedactionEnabled,attributes:e.attributeValues!==void 0&&e.attributeValues.length>0?O(e.attributeValues):void 0})).sort((e,t)=>e.key.localeCompare(t.key))}:{},"privacy-actions":e.actionSettings.filter(({active:e})=>e).map(({type:e})=>e)})).sort((e,t)=>[...e.path??[],e.key].join(`.`).localeCompare([...t.path??[],t.key].join(`.`)))}))}return Q}export{P as i,L as n,F as r,I as t};
58
+ //# sourceMappingURL=pullTranscendConfiguration-DjOELnPo.mjs.map