@transcend-io/cli 10.17.1 → 10.18.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (258) hide show
  1. package/README.md +19 -28
  2. package/dist/app-BiUb5kV0.mjs +131 -0
  3. package/dist/app-BiUb5kV0.mjs.map +1 -0
  4. package/dist/{approvePrivacyRequests-CLi5rXP3.mjs → approvePrivacyRequests-BV-2Dw30.mjs} +2 -2
  5. package/dist/{approvePrivacyRequests-CLi5rXP3.mjs.map → approvePrivacyRequests-BV-2Dw30.mjs.map} +1 -1
  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/{buildExamples-BrLuHDdW.mjs → buildExamples-CIxWSKXw.mjs} +2 -2
  10. package/dist/{buildExamples-BrLuHDdW.mjs.map → buildExamples-CIxWSKXw.mjs.map} +1 -1
  11. package/dist/{buildXdiSyncEndpoint-Bxi-Dlsu.mjs → buildXdiSyncEndpoint-l_Ei6bOc.mjs} +2 -2
  12. package/dist/{buildXdiSyncEndpoint-Bxi-Dlsu.mjs.map → buildXdiSyncEndpoint-l_Ei6bOc.mjs.map} +1 -1
  13. package/dist/{bulkRestartRequests-NrX4ED7j.mjs → bulkRestartRequests-BldF4vP9.mjs} +2 -2
  14. package/dist/{bulkRestartRequests-NrX4ED7j.mjs.map → bulkRestartRequests-BldF4vP9.mjs.map} +1 -1
  15. package/dist/{bulkRetryEnrichers-BYVCTi_Q.mjs → bulkRetryEnrichers-B5anLMOn.mjs} +2 -2
  16. package/dist/{bulkRetryEnrichers-BYVCTi_Q.mjs.map → bulkRetryEnrichers-B5anLMOn.mjs.map} +1 -1
  17. package/dist/{cancelPrivacyRequests-BxwCIpUR.mjs → cancelPrivacyRequests-BTU-rxVM.mjs} +2 -2
  18. package/dist/{cancelPrivacyRequests-BxwCIpUR.mjs.map → cancelPrivacyRequests-BTU-rxVM.mjs.map} +1 -1
  19. package/dist/{codecs-CwRYEdQK.mjs → codecs-8Cq4qQpS.mjs} +1 -1
  20. package/dist/{codecs-CwRYEdQK.mjs.map → codecs-8Cq4qQpS.mjs.map} +1 -1
  21. package/dist/{collectCsvFilesOrExit-CaIB1XL9.mjs → collectCsvFilesOrExit-BQdnr-m2.mjs} +2 -2
  22. package/dist/{collectCsvFilesOrExit-CaIB1XL9.mjs.map → collectCsvFilesOrExit-BQdnr-m2.mjs.map} +1 -1
  23. package/dist/{collectParquetFilesOrExit-DOdNctY-.mjs → collectParquetFilesOrExit-BJ-GciNy.mjs} +2 -2
  24. package/dist/{collectParquetFilesOrExit-DOdNctY-.mjs.map → collectParquetFilesOrExit-BJ-GciNy.mjs.map} +1 -1
  25. package/dist/command-CE22WIu1.mjs +9 -0
  26. package/dist/command-CE22WIu1.mjs.map +1 -0
  27. package/dist/commands/admin/chunk-csv/worker.mjs +1 -1
  28. package/dist/commands/admin/parquet-to-csv/worker.mjs +1 -1
  29. package/dist/{consentManagersToBusinessEntities-Rc-_pq8n.mjs → consentManagersToBusinessEntities-l8jRfpYN.mjs} +2 -2
  30. package/dist/{consentManagersToBusinessEntities-Rc-_pq8n.mjs.map → consentManagersToBusinessEntities-l8jRfpYN.mjs.map} +1 -1
  31. package/dist/{constants-Opbj9jaF.mjs → constants-BhZIv-FP.mjs} +1 -1
  32. package/dist/{constants-Opbj9jaF.mjs.map → constants-BhZIv-FP.mjs.map} +1 -1
  33. package/dist/{constants-BX7PrKxC.mjs → constants-DJolQYDN.mjs} +2 -2
  34. package/dist/constants-DJolQYDN.mjs.map +1 -0
  35. package/dist/{constants-2MiVdjAH.mjs → constants-DXUo-hl3.mjs} +2 -2
  36. package/dist/{constants-2MiVdjAH.mjs.map → constants-DXUo-hl3.mjs.map} +1 -1
  37. package/dist/{constants-BSZc6Ifl.mjs → constants-KYaYveEQ.mjs} +1 -1
  38. package/dist/{constants-BSZc6Ifl.mjs.map → constants-KYaYveEQ.mjs.map} +1 -1
  39. package/dist/{context-C9eacjlu.mjs → context-CdSyuBlf.mjs} +1 -1
  40. package/dist/{context-C9eacjlu.mjs.map → context-CdSyuBlf.mjs.map} +1 -1
  41. package/dist/{createExtraKeyHandler-1HjUyY-D.mjs → createExtraKeyHandler-DNDHKlsR.mjs} +2 -2
  42. package/dist/{createExtraKeyHandler-1HjUyY-D.mjs.map → createExtraKeyHandler-DNDHKlsR.mjs.map} +1 -1
  43. package/dist/{dataFlowsToDataSilos-IbmCPmy9.mjs → dataFlowsToDataSilos-Blo6-adp.mjs} +1 -1
  44. package/dist/{dataFlowsToDataSilos-IbmCPmy9.mjs.map → dataFlowsToDataSilos-Blo6-adp.mjs.map} +1 -1
  45. package/dist/{done-input-validation-D25TzrxG.mjs → done-input-validation-CvwjeRWr.mjs} +1 -1
  46. package/dist/{done-input-validation-D25TzrxG.mjs.map → done-input-validation-CvwjeRWr.mjs.map} +1 -1
  47. package/dist/{downloadPrivacyRequestFiles-CnwWfn0A.mjs → downloadPrivacyRequestFiles-DJ6szIGF.mjs} +2 -2
  48. package/dist/{downloadPrivacyRequestFiles-CnwWfn0A.mjs.map → downloadPrivacyRequestFiles-DJ6szIGF.mjs.map} +1 -1
  49. package/dist/{extractClientError-_9Bqmm0v.mjs → extractClientError-CaF_Kj-f.mjs} +1 -1
  50. package/dist/{extractClientError-_9Bqmm0v.mjs.map → extractClientError-CaF_Kj-f.mjs.map} +1 -1
  51. package/dist/{fetchAllRequests-rDVYKbqL.mjs → fetchAllRequests-BCHpCeFo.mjs} +2 -2
  52. package/dist/{fetchAllRequests-rDVYKbqL.mjs.map → fetchAllRequests-BCHpCeFo.mjs.map} +1 -1
  53. package/dist/{formatPolicyBundleVersionSummary-BJgl5Q3D.mjs → formatPolicyBundleVersionSummary-DvxPXykZ.mjs} +1 -1
  54. package/dist/{formatPolicyBundleVersionSummary-BJgl5Q3D.mjs.map → formatPolicyBundleVersionSummary-DvxPXykZ.mjs.map} +1 -1
  55. package/dist/{formatPolicyEngineRequestError-C8g0v7nh.mjs → formatPolicyEngineRequestError-Dn_VYIIj.mjs} +1 -1
  56. package/dist/{formatPolicyEngineRequestError-C8g0v7nh.mjs.map → formatPolicyEngineRequestError-Dn_VYIIj.mjs.map} +1 -1
  57. package/dist/{fuzzyMatchColumns-jgLi9Qnf.mjs → fuzzyMatchColumns-Dym9eeQe.mjs} +2 -2
  58. package/dist/{fuzzyMatchColumns-jgLi9Qnf.mjs.map → fuzzyMatchColumns-Dym9eeQe.mjs.map} +1 -1
  59. package/dist/{generateCrossAccountApiKeys-BZiBRDZL.mjs → generateCrossAccountApiKeys-BmUjn8U4.mjs} +2 -2
  60. package/dist/{generateCrossAccountApiKeys-BZiBRDZL.mjs.map → generateCrossAccountApiKeys-BmUjn8U4.mjs.map} +1 -1
  61. package/dist/{impl-Bw3__zkc2.mjs → impl-3pWQw99s2.mjs} +2 -2
  62. package/dist/{impl-Bw3__zkc2.mjs.map → impl-3pWQw99s2.mjs.map} +1 -1
  63. package/dist/{impl-CsSRW8xl2.mjs → impl-4apk-8xK2.mjs} +2 -2
  64. package/dist/{impl-CsSRW8xl2.mjs.map → impl-4apk-8xK2.mjs.map} +1 -1
  65. package/dist/{impl-BtgbwWAB.mjs → impl-Al6BRaZv.mjs} +2 -2
  66. package/dist/{impl-BtgbwWAB.mjs.map → impl-Al6BRaZv.mjs.map} +1 -1
  67. package/dist/{impl-DGBJkbeS.mjs → impl-B3jtMu4u.mjs} +2 -2
  68. package/dist/{impl-DGBJkbeS.mjs.map → impl-B3jtMu4u.mjs.map} +1 -1
  69. package/dist/impl-B7Jx1VJT.mjs +2 -0
  70. package/dist/{impl-CBFgXSWV.mjs.map → impl-B7Jx1VJT.mjs.map} +1 -1
  71. package/dist/{impl-D7GBtInJ.mjs → impl-BANdTEit.mjs} +2 -2
  72. package/dist/{impl-D7GBtInJ.mjs.map → impl-BANdTEit.mjs.map} +1 -1
  73. package/dist/{impl-DqcpxYHF.mjs → impl-BIFxlKlT.mjs} +2 -2
  74. package/dist/{impl-DqcpxYHF.mjs.map → impl-BIFxlKlT.mjs.map} +1 -1
  75. package/dist/{impl-B0k-lsLh.mjs → impl-BMU2cg0K.mjs} +2 -2
  76. package/dist/{impl-B0k-lsLh.mjs.map → impl-BMU2cg0K.mjs.map} +1 -1
  77. package/dist/{impl-DDrubha_2.mjs → impl-BPNUUUWq2.mjs} +2 -2
  78. package/dist/{impl-DDrubha_2.mjs.map → impl-BPNUUUWq2.mjs.map} +1 -1
  79. package/dist/{impl-CUbaczq8.mjs → impl-BTVIYng_.mjs} +2 -2
  80. package/dist/{impl-CUbaczq8.mjs.map → impl-BTVIYng_.mjs.map} +1 -1
  81. package/dist/{impl-z2bzz69O.mjs → impl-BWBXkVFs.mjs} +2 -2
  82. package/dist/{impl-z2bzz69O.mjs.map → impl-BWBXkVFs.mjs.map} +1 -1
  83. package/dist/{impl-B-9HvUMl.mjs → impl-Bie0nJ5C.mjs} +2 -2
  84. package/dist/{impl-B-9HvUMl.mjs.map → impl-Bie0nJ5C.mjs.map} +1 -1
  85. package/dist/impl-BklXY5iH.mjs +3 -0
  86. package/dist/impl-BklXY5iH.mjs.map +1 -0
  87. package/dist/{impl-COmkhA32.mjs → impl-Bq3ZIpcG.mjs} +2 -2
  88. package/dist/{impl-COmkhA32.mjs.map → impl-Bq3ZIpcG.mjs.map} +1 -1
  89. package/dist/{impl-0OHjJHDD2.mjs → impl-C1UQ162F2.mjs} +2 -2
  90. package/dist/{impl-0OHjJHDD2.mjs.map → impl-C1UQ162F2.mjs.map} +1 -1
  91. package/dist/{impl-CgDCcV00.mjs → impl-C3CM79fn.mjs} +2 -2
  92. package/dist/{impl-CgDCcV00.mjs.map → impl-C3CM79fn.mjs.map} +1 -1
  93. package/dist/{impl-DcQfhjZL.mjs → impl-CEBd3se_.mjs} +2 -2
  94. package/dist/{impl-DcQfhjZL.mjs.map → impl-CEBd3se_.mjs.map} +1 -1
  95. package/dist/{impl-CPkl4IRz.mjs → impl-CL-sbLQg.mjs} +2 -2
  96. package/dist/{impl-CPkl4IRz.mjs.map → impl-CL-sbLQg.mjs.map} +1 -1
  97. package/dist/impl-CN6LUWBB.mjs +2 -0
  98. package/dist/{impl-BeIevZ_X.mjs.map → impl-CN6LUWBB.mjs.map} +1 -1
  99. package/dist/{impl-BvU-r-wF.mjs → impl-CPc_UomH.mjs} +2 -2
  100. package/dist/{impl-BvU-r-wF.mjs.map → impl-CPc_UomH.mjs.map} +1 -1
  101. package/dist/{impl-DZnctw762.mjs → impl-CVUliihk.mjs} +2 -2
  102. package/dist/impl-CVUliihk.mjs.map +1 -0
  103. package/dist/{impl-BIDhVXeB.mjs → impl-CWp4OyVb.mjs} +2 -2
  104. package/dist/{impl-BIDhVXeB.mjs.map → impl-CWp4OyVb.mjs.map} +1 -1
  105. package/dist/{impl-B0CVYN6x.mjs → impl-Ca_wapdV.mjs} +2 -2
  106. package/dist/{impl-B0CVYN6x.mjs.map → impl-Ca_wapdV.mjs.map} +1 -1
  107. package/dist/impl-CmJ03lO1.mjs +2 -0
  108. package/dist/{impl-taJyQmlW.mjs.map → impl-CmJ03lO1.mjs.map} +1 -1
  109. package/dist/{impl-vHEzhNyX.mjs → impl-CqAhgJRN.mjs} +2 -2
  110. package/dist/{impl-vHEzhNyX.mjs.map → impl-CqAhgJRN.mjs.map} +1 -1
  111. package/dist/{impl-CCP1-ZeX.mjs → impl-CtgTs2rf.mjs} +2 -2
  112. package/dist/{impl-CCP1-ZeX.mjs.map → impl-CtgTs2rf.mjs.map} +1 -1
  113. package/dist/{impl-CuxbHVUs.mjs → impl-CzYR6r9C.mjs} +2 -2
  114. package/dist/{impl-CuxbHVUs.mjs.map → impl-CzYR6r9C.mjs.map} +1 -1
  115. package/dist/{impl-DwOllcc22.mjs → impl-D4rA9eEx2.mjs} +2 -2
  116. package/dist/{impl-DwOllcc22.mjs.map → impl-D4rA9eEx2.mjs.map} +1 -1
  117. package/dist/impl-DG0LNsZK.mjs +2 -0
  118. package/dist/impl-DG0LNsZK.mjs.map +1 -0
  119. package/dist/{impl-DiRx33sh.mjs → impl-DI4DE-Kl.mjs} +2 -2
  120. package/dist/{impl-DiRx33sh.mjs.map → impl-DI4DE-Kl.mjs.map} +1 -1
  121. package/dist/{impl-B4GlGvLI.mjs → impl-DQGV2G5v.mjs} +2 -2
  122. package/dist/{impl-B4GlGvLI.mjs.map → impl-DQGV2G5v.mjs.map} +1 -1
  123. package/dist/{impl--eayIBq5.mjs → impl-DW2M6wCD.mjs} +2 -2
  124. package/dist/impl-DW2M6wCD.mjs.map +1 -0
  125. package/dist/{impl-B7HFZI-o.mjs → impl-DYM8usyf.mjs} +2 -2
  126. package/dist/{impl-B7HFZI-o.mjs.map → impl-DYM8usyf.mjs.map} +1 -1
  127. package/dist/{impl-zXXUv3a4.mjs → impl-DYkEqGRO.mjs} +2 -2
  128. package/dist/{impl-zXXUv3a4.mjs.map → impl-DYkEqGRO.mjs.map} +1 -1
  129. package/dist/{impl-DGm5NVUi.mjs → impl-DYwzsZHS.mjs} +2 -2
  130. package/dist/{impl-DGm5NVUi.mjs.map → impl-DYwzsZHS.mjs.map} +1 -1
  131. package/dist/{impl-B9rlOyl5.mjs → impl-DlusNsf9.mjs} +2 -2
  132. package/dist/{impl-B9rlOyl5.mjs.map → impl-DlusNsf9.mjs.map} +1 -1
  133. package/dist/{impl-ELz2nyJq.mjs → impl-DshUKXgr.mjs} +2 -2
  134. package/dist/{impl-ELz2nyJq.mjs.map → impl-DshUKXgr.mjs.map} +1 -1
  135. package/dist/impl-Dx8zPf6J.mjs +2 -0
  136. package/dist/{impl-Bjr5Uf1c.mjs.map → impl-Dx8zPf6J.mjs.map} +1 -1
  137. package/dist/{impl-Dj5dWvYr2.mjs → impl-DztfppaG2.mjs} +2 -2
  138. package/dist/{impl-Dj5dWvYr2.mjs.map → impl-DztfppaG2.mjs.map} +1 -1
  139. package/dist/{impl-CNKjJBfX.mjs → impl-EGyeOgjI.mjs} +2 -2
  140. package/dist/{impl-CNKjJBfX.mjs.map → impl-EGyeOgjI.mjs.map} +1 -1
  141. package/dist/{impl-B3u38Ct_.mjs → impl-FGDxq3CJ.mjs} +2 -2
  142. package/dist/{impl-B3u38Ct_.mjs.map → impl-FGDxq3CJ.mjs.map} +1 -1
  143. package/dist/{impl-DPCAbsLy2.mjs → impl-Jzc8Ut8N2.mjs} +2 -2
  144. package/dist/{impl-DPCAbsLy2.mjs.map → impl-Jzc8Ut8N2.mjs.map} +1 -1
  145. package/dist/{impl-C6wqboV2.mjs → impl-K1eIDFRc.mjs} +2 -2
  146. package/dist/{impl-C6wqboV2.mjs.map → impl-K1eIDFRc.mjs.map} +1 -1
  147. package/dist/{impl-B5TsrlQT.mjs → impl-MJ89a6cJ.mjs} +2 -2
  148. package/dist/{impl-B5TsrlQT.mjs.map → impl-MJ89a6cJ.mjs.map} +1 -1
  149. package/dist/{impl-Df_SZy5X.mjs → impl-X-lj6p6X.mjs} +2 -2
  150. package/dist/{impl-Df_SZy5X.mjs.map → impl-X-lj6p6X.mjs.map} +1 -1
  151. package/dist/{impl-DOGMbdAR.mjs → impl-cbKOCJZ5.mjs} +2 -2
  152. package/dist/{impl-DOGMbdAR.mjs.map → impl-cbKOCJZ5.mjs.map} +1 -1
  153. package/dist/{impl-BimGJAmf.mjs → impl-g6bSWnsL.mjs} +2 -2
  154. package/dist/{impl-BimGJAmf.mjs.map → impl-g6bSWnsL.mjs.map} +1 -1
  155. package/dist/{impl-kU6M_9xS2.mjs → impl-hSTc3gLx2.mjs} +2 -2
  156. package/dist/{impl-kU6M_9xS2.mjs.map → impl-hSTc3gLx2.mjs.map} +1 -1
  157. package/dist/{impl-BJldWkkC.mjs → impl-ivVANd7G.mjs} +2 -2
  158. package/dist/{impl-BJldWkkC.mjs.map → impl-ivVANd7G.mjs.map} +1 -1
  159. package/dist/{impl-Cz-cy5Q92.mjs → impl-pz2RbZR22.mjs} +2 -2
  160. package/dist/{impl-Cz-cy5Q92.mjs.map → impl-pz2RbZR22.mjs.map} +1 -1
  161. package/dist/{impl-BCsrAqZI.mjs → impl-u4m_lOOg.mjs} +2 -2
  162. package/dist/{impl-BCsrAqZI.mjs.map → impl-u4m_lOOg.mjs.map} +1 -1
  163. package/dist/{impl-BATZJZAu.mjs → impl-ynu-szUI.mjs} +2 -2
  164. package/dist/{impl-BATZJZAu.mjs.map → impl-ynu-szUI.mjs.map} +1 -1
  165. package/dist/index.d.mts +1 -1
  166. package/dist/index.mjs +1 -1
  167. package/dist/{inquirer-BWDP2HHw.mjs → inquirer-CXl1YWCs.mjs} +2 -2
  168. package/dist/{inquirer-BWDP2HHw.mjs.map → inquirer-CXl1YWCs.mjs.map} +1 -1
  169. package/dist/{listFiles-DsUfOUWr.mjs → listFiles-B1GqyM33.mjs} +1 -1
  170. package/dist/{listFiles-DsUfOUWr.mjs.map → listFiles-B1GqyM33.mjs.map} +1 -1
  171. package/dist/{logger-D1tXVwJj.mjs → logger-B-LXIf3U.mjs} +1 -1
  172. package/dist/{logger-D1tXVwJj.mjs.map → logger-B-LXIf3U.mjs.map} +1 -1
  173. package/dist/{markRequestDataSiloIdsCompleted-DDNYecva.mjs → markRequestDataSiloIdsCompleted-DMme9TUi.mjs} +2 -2
  174. package/dist/{markRequestDataSiloIdsCompleted-DDNYecva.mjs.map → markRequestDataSiloIdsCompleted-DMme9TUi.mjs.map} +1 -1
  175. package/dist/{markSilentPrivacyRequests-DDDJEoJe.mjs → markSilentPrivacyRequests-B5AzihlB.mjs} +2 -2
  176. package/dist/{markSilentPrivacyRequests-DDDJEoJe.mjs.map → markSilentPrivacyRequests-B5AzihlB.mjs.map} +1 -1
  177. package/dist/{notifyPrivacyRequestsAdditionalTime-NGNzjpY9.mjs → notifyPrivacyRequestsAdditionalTime-BUSx6iTV.mjs} +2 -2
  178. package/dist/{notifyPrivacyRequestsAdditionalTime-NGNzjpY9.mjs.map → notifyPrivacyRequestsAdditionalTime-BUSx6iTV.mjs.map} +1 -1
  179. package/dist/{parquetToCsvOneFile-tKgw5ql1.mjs → parquetToCsvOneFile-DuyOOzqQ.mjs} +2 -2
  180. package/dist/{parquetToCsvOneFile-tKgw5ql1.mjs.map → parquetToCsvOneFile-DuyOOzqQ.mjs.map} +1 -1
  181. package/dist/{parseAttributesFromString-COM7aBEj.mjs → parseAttributesFromString-ByzY22WY.mjs} +2 -2
  182. package/dist/{parseAttributesFromString-COM7aBEj.mjs.map → parseAttributesFromString-ByzY22WY.mjs.map} +1 -1
  183. package/dist/{parseVariablesFromString-CrzXJu3n.mjs → parseVariablesFromString-COw5Nayn.mjs} +2 -2
  184. package/dist/{parseVariablesFromString-CrzXJu3n.mjs.map → parseVariablesFromString-COw5Nayn.mjs.map} +1 -1
  185. package/dist/{printResult-BE0CcmNZ.mjs → printResult-DdSpAx6T.mjs} +1 -1
  186. package/dist/{printResult-BE0CcmNZ.mjs.map → printResult-DdSpAx6T.mjs.map} +1 -1
  187. package/dist/{pullAllDatapoints-OrD_W80t.mjs → pullAllDatapoints-D8mTXHun.mjs} +2 -2
  188. package/dist/{pullAllDatapoints-OrD_W80t.mjs.map → pullAllDatapoints-D8mTXHun.mjs.map} +1 -1
  189. package/dist/{pullChunkedCustomSiloOutstandingIdentifiers-NtMi2t5b.mjs → pullChunkedCustomSiloOutstandingIdentifiers-yamc5Tm4.mjs} +2 -2
  190. package/dist/{pullChunkedCustomSiloOutstandingIdentifiers-NtMi2t5b.mjs.map → pullChunkedCustomSiloOutstandingIdentifiers-yamc5Tm4.mjs.map} +1 -1
  191. package/dist/{pullConsentManagerMetrics-C0gYmy2K.mjs → pullConsentManagerMetrics-Cma2auCK.mjs} +2 -2
  192. package/dist/{pullConsentManagerMetrics-C0gYmy2K.mjs.map → pullConsentManagerMetrics-Cma2auCK.mjs.map} +1 -1
  193. package/dist/{pullManualEnrichmentIdentifiersToCsv-Bl0qvlM2.mjs → pullManualEnrichmentIdentifiersToCsv-M8Ydxx2_.mjs} +2 -2
  194. package/dist/{pullManualEnrichmentIdentifiersToCsv-Bl0qvlM2.mjs.map → pullManualEnrichmentIdentifiersToCsv-M8Ydxx2_.mjs.map} +1 -1
  195. package/dist/{pullTranscendConfiguration-CZD-sx8L.mjs → pullTranscendConfiguration-QBl16rBd.mjs} +2 -2
  196. package/dist/{pullTranscendConfiguration-CZD-sx8L.mjs.map → pullTranscendConfiguration-QBl16rBd.mjs.map} +1 -1
  197. package/dist/{pullUnstructuredSubDataPointRecommendations-pDIp5y-W.mjs → pullUnstructuredSubDataPointRecommendations-DkQMoo7S.mjs} +2 -2
  198. package/dist/{pullUnstructuredSubDataPointRecommendations-pDIp5y-W.mjs.map → pullUnstructuredSubDataPointRecommendations-DkQMoo7S.mjs.map} +1 -1
  199. package/dist/{pushCronIdentifiersFromCsv-CRZnkyWD.mjs → pushCronIdentifiersFromCsv-k3AEmN-Q.mjs} +2 -2
  200. package/dist/{pushCronIdentifiersFromCsv-CRZnkyWD.mjs.map → pushCronIdentifiersFromCsv-k3AEmN-Q.mjs.map} +1 -1
  201. package/dist/{pushManualEnrichmentIdentifiersFromCsv-DSFn8TeU.mjs → pushManualEnrichmentIdentifiersFromCsv-BtpVJzb6.mjs} +2 -2
  202. package/dist/{pushManualEnrichmentIdentifiersFromCsv-DSFn8TeU.mjs.map → pushManualEnrichmentIdentifiersFromCsv-BtpVJzb6.mjs.map} +1 -1
  203. package/dist/{readCsv-ddmavI86.mjs → readCsv-D1e7WRTc.mjs} +1 -1
  204. package/dist/{readCsv-ddmavI86.mjs.map → readCsv-D1e7WRTc.mjs.map} +1 -1
  205. package/dist/{readTranscendYaml-B2Asm9c5.mjs → readTranscendYaml-DXGNTxJE.mjs} +2 -2
  206. package/dist/{readTranscendYaml-B2Asm9c5.mjs.map → readTranscendYaml-DXGNTxJE.mjs.map} +1 -1
  207. package/dist/{removeUnverifiedRequestIdentifiers-DCeBwyyi.mjs → removeUnverifiedRequestIdentifiers-W61bF-9t.mjs} +2 -2
  208. package/dist/{removeUnverifiedRequestIdentifiers-DCeBwyyi.mjs.map → removeUnverifiedRequestIdentifiers-W61bF-9t.mjs.map} +1 -1
  209. package/dist/{renderTable-BzIh5FoT.mjs → renderTable-BgjVr6ch.mjs} +1 -1
  210. package/dist/{renderTable-BzIh5FoT.mjs.map → renderTable-BgjVr6ch.mjs.map} +1 -1
  211. package/dist/{request-CdglUNWv.mjs → request-C4gYxn1p.mjs} +1 -1
  212. package/dist/{request-CdglUNWv.mjs.map → request-C4gYxn1p.mjs.map} +1 -1
  213. package/dist/{resolveBundleIdByName-Bxoxa8CK.mjs → resolveBundleIdByName-DdemhmTX.mjs} +1 -1
  214. package/dist/{resolveBundleIdByName-Bxoxa8CK.mjs.map → resolveBundleIdByName-DdemhmTX.mjs.map} +1 -1
  215. package/dist/{retryRequestDataSilos-BjXaDGk3.mjs → retryRequestDataSilos-B6jn3d3S.mjs} +2 -2
  216. package/dist/{retryRequestDataSilos-BjXaDGk3.mjs.map → retryRequestDataSilos-B6jn3d3S.mjs.map} +1 -1
  217. package/dist/{runOpa-NnuspgN0.mjs → runOpa-DGUkXzFZ.mjs} +2 -2
  218. package/dist/{runOpa-NnuspgN0.mjs.map → runOpa-DGUkXzFZ.mjs.map} +1 -1
  219. package/dist/{skipPreflightJobs-DBYfdstu.mjs → skipPreflightJobs-CABl58Nl.mjs} +2 -2
  220. package/dist/{skipPreflightJobs-DBYfdstu.mjs.map → skipPreflightJobs-CABl58Nl.mjs.map} +1 -1
  221. package/dist/{skipRequestDataSilos-G2Ox2c6q.mjs → skipRequestDataSilos-NB2k7el9.mjs} +2 -2
  222. package/dist/{skipRequestDataSilos-G2Ox2c6q.mjs.map → skipRequestDataSilos-NB2k7el9.mjs.map} +1 -1
  223. package/dist/{streamPrivacyRequestsToCsv-vB1a_Xmx.mjs → streamPrivacyRequestsToCsv-bzQXxsd3.mjs} +2 -2
  224. package/dist/{streamPrivacyRequestsToCsv-vB1a_Xmx.mjs.map → streamPrivacyRequestsToCsv-bzQXxsd3.mjs.map} +1 -1
  225. package/dist/{syncCodePackages-kQRUAGvl.mjs → syncCodePackages-CwPtA473.mjs} +2 -2
  226. package/dist/{syncCodePackages-kQRUAGvl.mjs.map → syncCodePackages-CwPtA473.mjs.map} +1 -1
  227. package/dist/{updateConsentManagerVersionToLatest-g5a3brwY.mjs → updateConsentManagerVersionToLatest-vKvjbR32.mjs} +2 -2
  228. package/dist/{updateConsentManagerVersionToLatest-g5a3brwY.mjs.map → updateConsentManagerVersionToLatest-vKvjbR32.mjs.map} +1 -1
  229. package/dist/{uploadConsents-aYnPgzBZ.mjs → uploadConsents-BqHPndFX.mjs} +2 -2
  230. package/dist/{uploadConsents-aYnPgzBZ.mjs.map → uploadConsents-BqHPndFX.mjs.map} +1 -1
  231. package/dist/{uploadCookiesFromCsv-DkgIHEdl.mjs → uploadCookiesFromCsv-X6fBW625.mjs} +2 -2
  232. package/dist/{uploadCookiesFromCsv-DkgIHEdl.mjs.map → uploadCookiesFromCsv-X6fBW625.mjs.map} +1 -1
  233. package/dist/{uploadDataFlowsFromCsv-D1zxhWRt.mjs → uploadDataFlowsFromCsv-CzLsbl4P.mjs} +2 -2
  234. package/dist/{uploadDataFlowsFromCsv-D1zxhWRt.mjs.map → uploadDataFlowsFromCsv-CzLsbl4P.mjs.map} +1 -1
  235. package/dist/{uploadPrivacyRequestsFromCsv-B8lK4TL2.mjs → uploadPrivacyRequestsFromCsv-BN7RESDW.mjs} +2 -2
  236. package/dist/{uploadPrivacyRequestsFromCsv-B8lK4TL2.mjs.map → uploadPrivacyRequestsFromCsv-BN7RESDW.mjs.map} +1 -1
  237. package/dist/{validateTranscendAuth-DrVM-Bxh.mjs → validateTranscendAuth-k4ufmEQW.mjs} +2 -2
  238. package/dist/{validateTranscendAuth-DrVM-Bxh.mjs.map → validateTranscendAuth-k4ufmEQW.mjs.map} +1 -1
  239. package/dist/{writeCsv-Dg4Wuj5V.mjs → writeCsv-DDKM_rAU.mjs} +1 -1
  240. package/dist/{writeCsv-Dg4Wuj5V.mjs.map → writeCsv-DDKM_rAU.mjs.map} +1 -1
  241. package/package.json +4 -4
  242. package/dist/app-BksK9SPh.mjs +0 -131
  243. package/dist/app-BksK9SPh.mjs.map +0 -1
  244. package/dist/command-BFlaWkwf.mjs +0 -9
  245. package/dist/command-BFlaWkwf.mjs.map +0 -1
  246. package/dist/constants-BX7PrKxC.mjs.map +0 -1
  247. package/dist/impl--eayIBq5.mjs.map +0 -1
  248. package/dist/impl-B4weFiPq.mjs +0 -2
  249. package/dist/impl-B4weFiPq.mjs.map +0 -1
  250. package/dist/impl-BeIevZ_X.mjs +0 -2
  251. package/dist/impl-Bjr5Uf1c.mjs +0 -2
  252. package/dist/impl-CBFgXSWV.mjs +0 -2
  253. package/dist/impl-Cx5U2XsV.mjs +0 -3
  254. package/dist/impl-Cx5U2XsV.mjs.map +0 -1
  255. package/dist/impl-DZnctw762.mjs.map +0 -1
  256. package/dist/impl-taJyQmlW.mjs +0 -2
  257. package/dist/parsers-Bl90Wjbz.mjs +0 -2
  258. package/dist/parsers-Bl90Wjbz.mjs.map +0 -1
@@ -1,2 +1,2 @@
1
- import{a as e}from"./constants-BX7PrKxC.mjs";import{t}from"./logger-D1tXVwJj.mjs";import n from"colors";import{assumeRole as r,buildTranscendGraphQLClientGeneric as i,createApiKey as a,deleteApiKey as o,fetchAllApiKeys as s,loginUser as c}from"@transcend-io/sdk";import{mapSeries as l}from"@transcend-io/utils";async function u({email:u,password:d,scopes:f,apiKeyTitle:p,parentOrganizationId:m,deleteExistingApiKey:h=!0,createNewApiKey:g=!0,transcendUrl:_=e}){let v=await i(_,{});t.info(n.magenta(`Logging in using email and password.`));let{roles:y,loginCookie:b}=await c(v,{email:u,password:d,logger:t});t.info(n.green(`Successfully logged in and found ${y.length} role${y.length===1?``:`s`}!`));let x=m?y.filter(e=>e.organization.id===m||e.organization.parentOrganizationId===m):y;v.setHeaders({Cookie:b});let S=[],C=[];return t.info(n.magenta(`Generating API keys with title: ${p}, scopes: ${f.join(`,`)}.`)),await l(x,async e=>{try{await r(v,{roleId:e.id,email:u,logger:t}),t.info(n.magenta(`Checking if API key already exists in organization "${e.organization.name}" with title: "${p}".`));let[i]=await s(v,{logger:t,filterBy:{titles:[p]}});if(i&&h)t.info(n.yellow(`Deleting existing API key in "${e.organization.name}" with title: "${p}".`)),await o(v,{id:i.id,logger:t}),t.info(n.green(`Successfully deleted API key in "${e.organization.name}" with title: "${p}".`));else if(i)throw Error(`API key already exists with title: "${p}"`);if(g){t.info(n.magenta(`Creating API key in "${e.organization.name}" with title: "${p}".`));let{apiKey:r}=await a(v,{input:{title:p,scopes:f},logger:t});S.push({organizationName:e.organization.name,organizationId:e.organization.id,apiKey:r}),t.info(n.green(`Successfully created API key in "${e.organization.name}" with title: "${p}".`))}else S.push({organizationName:e.organization.name,organizationId:e.organization.id,apiKey:``})}catch(r){t.error(n.red(`Failed to create API key in organization "${e.organization.name}"! - ${r.message}`)),C.push({organizationName:e.organization.name,organizationId:e.organization.id,error:r.message})}}),t.info(n.green(`Successfully created ${S.length} API key${S.length===1?``:`s`}`)),C.length>0&&t.error(n.red(`Failed to create ${C.length} API key${C.length===1?``:`s`}!`)),{errors:C,apiKeys:S}}export{u as t};
2
- //# sourceMappingURL=generateCrossAccountApiKeys-BZiBRDZL.mjs.map
1
+ import{a as e}from"./constants-DJolQYDN.mjs";import{t}from"./logger-B-LXIf3U.mjs";import n from"colors";import{assumeRole as r,buildTranscendGraphQLClientGeneric as i,createApiKey as a,deleteApiKey as o,fetchAllApiKeys as s,loginUser as c}from"@transcend-io/sdk";import{mapSeries as l}from"@transcend-io/utils";async function u({email:u,password:d,scopes:f,apiKeyTitle:p,parentOrganizationId:m,deleteExistingApiKey:h=!0,createNewApiKey:g=!0,transcendUrl:_=e}){let v=await i(_,{});t.info(n.magenta(`Logging in using email and password.`));let{roles:y,loginCookie:b}=await c(v,{email:u,password:d,logger:t});t.info(n.green(`Successfully logged in and found ${y.length} role${y.length===1?``:`s`}!`));let x=m?y.filter(e=>e.organization.id===m||e.organization.parentOrganizationId===m):y;v.setHeaders({Cookie:b});let S=[],C=[];return t.info(n.magenta(`Generating API keys with title: ${p}, scopes: ${f.join(`,`)}.`)),await l(x,async e=>{try{await r(v,{roleId:e.id,email:u,logger:t}),t.info(n.magenta(`Checking if API key already exists in organization "${e.organization.name}" with title: "${p}".`));let[i]=await s(v,{logger:t,filterBy:{titles:[p]}});if(i&&h)t.info(n.yellow(`Deleting existing API key in "${e.organization.name}" with title: "${p}".`)),await o(v,{id:i.id,logger:t}),t.info(n.green(`Successfully deleted API key in "${e.organization.name}" with title: "${p}".`));else if(i)throw Error(`API key already exists with title: "${p}"`);if(g){t.info(n.magenta(`Creating API key in "${e.organization.name}" with title: "${p}".`));let{apiKey:r}=await a(v,{input:{title:p,scopes:f},logger:t});S.push({organizationName:e.organization.name,organizationId:e.organization.id,apiKey:r}),t.info(n.green(`Successfully created API key in "${e.organization.name}" with title: "${p}".`))}else S.push({organizationName:e.organization.name,organizationId:e.organization.id,apiKey:``})}catch(r){t.error(n.red(`Failed to create API key in organization "${e.organization.name}"! - ${r.message}`)),C.push({organizationName:e.organization.name,organizationId:e.organization.id,error:r.message})}}),t.info(n.green(`Successfully created ${S.length} API key${S.length===1?``:`s`}`)),C.length>0&&t.error(n.red(`Failed to create ${C.length} API key${C.length===1?``:`s`}!`)),{errors:C,apiKeys:S}}export{u as t};
2
+ //# sourceMappingURL=generateCrossAccountApiKeys-BmUjn8U4.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"generateCrossAccountApiKeys-BZiBRDZL.mjs","names":[],"sources":["../src/lib/api-keys/generateCrossAccountApiKeys.ts"],"sourcesContent":["import { ScopeName } from '@transcend-io/privacy-types';\nimport {\n buildTranscendGraphQLClientGeneric,\n loginUser,\n createApiKey,\n fetchAllApiKeys,\n deleteApiKey,\n assumeRole,\n} from '@transcend-io/sdk';\nimport { mapSeries } from '@transcend-io/utils';\nimport colors from 'colors';\n\nimport { StoredApiKey } from '../../codecs.js';\nimport { DEFAULT_TRANSCEND_API } from '../../constants.js';\nimport { logger } from '../../logger.js';\n\nexport interface ApiKeyGenerateError {\n /** Name of instance */\n organizationName: string;\n /** Error */\n error: string;\n /** Organization ID API key is for */\n organizationId: string;\n}\n\n/**\n * Generate API keys across multiple transcend accounts\n *\n * @param options - Options\n * @returns Number of API keys created\n */\nexport async function generateCrossAccountApiKeys({\n email,\n password,\n scopes,\n apiKeyTitle,\n parentOrganizationId,\n deleteExistingApiKey = true,\n createNewApiKey = true,\n transcendUrl = DEFAULT_TRANSCEND_API,\n}: {\n /** Email address of user generating API keys */\n email: string;\n /** Password of user generating API keys */\n password: string;\n /** Filter for organizations that match this parent organization ID */\n parentOrganizationId?: string;\n /** Title of the API create to create */\n apiKeyTitle: string;\n /** Title of the API create to create */\n scopes: ScopeName[];\n /** API URL for Transcend backend */\n transcendUrl?: string;\n /** When true delete existing API keys with that title, if set to false an API key exists with that title, an error is thrown */\n deleteExistingApiKey?: boolean;\n /** When true, generate new API keys, otherwise only will delete past API keys */\n createNewApiKey?: boolean;\n}): Promise<{\n /** Successfully generated */\n apiKeys: StoredApiKey[];\n /** Error results */\n errors: ApiKeyGenerateError[];\n}> {\n // Create GraphQL client\n const client = await buildTranscendGraphQLClientGeneric(transcendUrl, {});\n\n // Login the user\n logger.info(colors.magenta('Logging in using email and password.'));\n const { roles, loginCookie } = await loginUser(client, { email, password, logger });\n logger.info(\n colors.green(\n `Successfully logged in and found ${roles.length} role${roles.length === 1 ? '' : 's'}!`,\n ),\n );\n\n // Filter down by parentOrganizationId\n const filteredRoles = parentOrganizationId\n ? roles.filter(\n (role) =>\n role.organization.id === parentOrganizationId ||\n role.organization.parentOrganizationId === parentOrganizationId,\n )\n : roles;\n\n // Save cookie to call route subsequent times\n client.setHeaders({\n Cookie: loginCookie,\n });\n\n // Save the resulting API keys\n const results: StoredApiKey[] = [];\n const errors: ApiKeyGenerateError[] = [];\n\n // Generate API keys\n logger.info(\n colors.magenta(`Generating API keys with title: ${apiKeyTitle}, scopes: ${scopes.join(',')}.`),\n );\n\n // Map over each role\n await mapSeries(filteredRoles, async (role) => {\n try {\n // Log into the other instance\n await assumeRole(client, { roleId: role.id, email, logger });\n\n // Grab API keys with that title\n logger.info(\n colors.magenta(\n `Checking if API key already exists in organization \"${role.organization.name}\" with title: \"${apiKeyTitle}\".`,\n ),\n );\n\n // Delete existing API key\n const [apiKeyWithTitle] = await fetchAllApiKeys(client, {\n logger,\n filterBy: { titles: [apiKeyTitle] },\n });\n if (apiKeyWithTitle && deleteExistingApiKey) {\n logger.info(\n colors.yellow(\n `Deleting existing API key in \"${role.organization.name}\" with title: \"${apiKeyTitle}\".`,\n ),\n );\n await deleteApiKey(client, { id: apiKeyWithTitle.id, logger });\n logger.info(\n colors.green(\n `Successfully deleted API key in \"${role.organization.name}\" with title: \"${apiKeyTitle}\".`,\n ),\n );\n } else if (apiKeyWithTitle) {\n // throw error if one exists but not configured to delete\n throw new Error(`API key already exists with title: \"${apiKeyTitle}\"`);\n }\n\n // Create the API key\n if (createNewApiKey) {\n logger.info(\n colors.magenta(\n `Creating API key in \"${role.organization.name}\" with title: \"${apiKeyTitle}\".`,\n ),\n );\n const { apiKey } = await createApiKey(client, {\n input: { title: apiKeyTitle, scopes },\n logger,\n });\n results.push({\n organizationName: role.organization.name,\n organizationId: role.organization.id,\n apiKey,\n });\n logger.info(\n colors.green(\n `Successfully created API key in \"${role.organization.name}\" with title: \"${apiKeyTitle}\".`,\n ),\n );\n } else {\n // Delete only\n results.push({\n organizationName: role.organization.name,\n organizationId: role.organization.id,\n apiKey: '',\n });\n }\n } catch (err) {\n logger.error(\n colors.red(\n `Failed to create API key in organization \"${role.organization.name}\"! - ${err.message}`,\n ),\n );\n errors.push({\n organizationName: role.organization.name,\n organizationId: role.organization.id,\n error: err.message,\n });\n }\n });\n logger.info(\n colors.green(\n `Successfully created ${results.length} API key${results.length === 1 ? '' : 's'}`,\n ),\n );\n\n if (errors.length > 0) {\n logger.error(\n colors.red(`Failed to create ${errors.length} API key${errors.length === 1 ? '' : 's'}!`),\n );\n }\n\n return { errors, apiKeys: results };\n}\n"],"mappings":"uTA+BA,eAAsB,EAA4B,CAChD,QACA,WACA,SACA,cACA,uBACA,uBAAuB,GACvB,kBAAkB,GAClB,eAAe,GAuBd,CAED,IAAM,EAAS,MAAM,EAAmC,EAAc,EAAE,CAAC,CAGzE,EAAO,KAAK,EAAO,QAAQ,uCAAuC,CAAC,CACnE,GAAM,CAAE,QAAO,eAAgB,MAAM,EAAU,EAAQ,CAAE,QAAO,WAAU,SAAQ,CAAC,CACnF,EAAO,KACL,EAAO,MACL,oCAAoC,EAAM,OAAO,OAAO,EAAM,SAAW,EAAI,GAAK,IAAI,GACvF,CACF,CAGD,IAAM,EAAgB,EAClB,EAAM,OACH,GACC,EAAK,aAAa,KAAO,GACzB,EAAK,aAAa,uBAAyB,EAC9C,CACD,EAGJ,EAAO,WAAW,CAChB,OAAQ,EACT,CAAC,CAGF,IAAM,EAA0B,EAAE,CAC5B,EAAgC,EAAE,CAgGxC,OA7FA,EAAO,KACL,EAAO,QAAQ,mCAAmC,EAAY,YAAY,EAAO,KAAK,IAAI,CAAC,GAAG,CAC/F,CAGD,MAAM,EAAU,EAAe,KAAO,IAAS,CAC7C,GAAI,CAEF,MAAM,EAAW,EAAQ,CAAE,OAAQ,EAAK,GAAI,QAAO,SAAQ,CAAC,CAG5D,EAAO,KACL,EAAO,QACL,uDAAuD,EAAK,aAAa,KAAK,iBAAiB,EAAY,IAC5G,CACF,CAGD,GAAM,CAAC,GAAmB,MAAM,EAAgB,EAAQ,CACtD,SACA,SAAU,CAAE,OAAQ,CAAC,EAAY,CAAE,CACpC,CAAC,CACF,GAAI,GAAmB,EACrB,EAAO,KACL,EAAO,OACL,iCAAiC,EAAK,aAAa,KAAK,iBAAiB,EAAY,IACtF,CACF,CACD,MAAM,EAAa,EAAQ,CAAE,GAAI,EAAgB,GAAI,SAAQ,CAAC,CAC9D,EAAO,KACL,EAAO,MACL,oCAAoC,EAAK,aAAa,KAAK,iBAAiB,EAAY,IACzF,CACF,SACQ,EAET,MAAU,MAAM,uCAAuC,EAAY,GAAG,CAIxE,GAAI,EAAiB,CACnB,EAAO,KACL,EAAO,QACL,wBAAwB,EAAK,aAAa,KAAK,iBAAiB,EAAY,IAC7E,CACF,CACD,GAAM,CAAE,UAAW,MAAM,EAAa,EAAQ,CAC5C,MAAO,CAAE,MAAO,EAAa,SAAQ,CACrC,SACD,CAAC,CACF,EAAQ,KAAK,CACX,iBAAkB,EAAK,aAAa,KACpC,eAAgB,EAAK,aAAa,GAClC,SACD,CAAC,CACF,EAAO,KACL,EAAO,MACL,oCAAoC,EAAK,aAAa,KAAK,iBAAiB,EAAY,IACzF,CACF,MAGD,EAAQ,KAAK,CACX,iBAAkB,EAAK,aAAa,KACpC,eAAgB,EAAK,aAAa,GAClC,OAAQ,GACT,CAAC,OAEG,EAAK,CACZ,EAAO,MACL,EAAO,IACL,6CAA6C,EAAK,aAAa,KAAK,OAAO,EAAI,UAChF,CACF,CACD,EAAO,KAAK,CACV,iBAAkB,EAAK,aAAa,KACpC,eAAgB,EAAK,aAAa,GAClC,MAAO,EAAI,QACZ,CAAC,GAEJ,CACF,EAAO,KACL,EAAO,MACL,wBAAwB,EAAQ,OAAO,UAAU,EAAQ,SAAW,EAAI,GAAK,MAC9E,CACF,CAEG,EAAO,OAAS,GAClB,EAAO,MACL,EAAO,IAAI,oBAAoB,EAAO,OAAO,UAAU,EAAO,SAAW,EAAI,GAAK,IAAI,GAAG,CAC1F,CAGI,CAAE,SAAQ,QAAS,EAAS"}
1
+ {"version":3,"file":"generateCrossAccountApiKeys-BmUjn8U4.mjs","names":[],"sources":["../src/lib/api-keys/generateCrossAccountApiKeys.ts"],"sourcesContent":["import { ScopeName } from '@transcend-io/privacy-types';\nimport {\n buildTranscendGraphQLClientGeneric,\n loginUser,\n createApiKey,\n fetchAllApiKeys,\n deleteApiKey,\n assumeRole,\n} from '@transcend-io/sdk';\nimport { mapSeries } from '@transcend-io/utils';\nimport colors from 'colors';\n\nimport { StoredApiKey } from '../../codecs.js';\nimport { DEFAULT_TRANSCEND_API } from '../../constants.js';\nimport { logger } from '../../logger.js';\n\nexport interface ApiKeyGenerateError {\n /** Name of instance */\n organizationName: string;\n /** Error */\n error: string;\n /** Organization ID API key is for */\n organizationId: string;\n}\n\n/**\n * Generate API keys across multiple transcend accounts\n *\n * @param options - Options\n * @returns Number of API keys created\n */\nexport async function generateCrossAccountApiKeys({\n email,\n password,\n scopes,\n apiKeyTitle,\n parentOrganizationId,\n deleteExistingApiKey = true,\n createNewApiKey = true,\n transcendUrl = DEFAULT_TRANSCEND_API,\n}: {\n /** Email address of user generating API keys */\n email: string;\n /** Password of user generating API keys */\n password: string;\n /** Filter for organizations that match this parent organization ID */\n parentOrganizationId?: string;\n /** Title of the API create to create */\n apiKeyTitle: string;\n /** Title of the API create to create */\n scopes: ScopeName[];\n /** API URL for Transcend backend */\n transcendUrl?: string;\n /** When true delete existing API keys with that title, if set to false an API key exists with that title, an error is thrown */\n deleteExistingApiKey?: boolean;\n /** When true, generate new API keys, otherwise only will delete past API keys */\n createNewApiKey?: boolean;\n}): Promise<{\n /** Successfully generated */\n apiKeys: StoredApiKey[];\n /** Error results */\n errors: ApiKeyGenerateError[];\n}> {\n // Create GraphQL client\n const client = await buildTranscendGraphQLClientGeneric(transcendUrl, {});\n\n // Login the user\n logger.info(colors.magenta('Logging in using email and password.'));\n const { roles, loginCookie } = await loginUser(client, { email, password, logger });\n logger.info(\n colors.green(\n `Successfully logged in and found ${roles.length} role${roles.length === 1 ? '' : 's'}!`,\n ),\n );\n\n // Filter down by parentOrganizationId\n const filteredRoles = parentOrganizationId\n ? roles.filter(\n (role) =>\n role.organization.id === parentOrganizationId ||\n role.organization.parentOrganizationId === parentOrganizationId,\n )\n : roles;\n\n // Save cookie to call route subsequent times\n client.setHeaders({\n Cookie: loginCookie,\n });\n\n // Save the resulting API keys\n const results: StoredApiKey[] = [];\n const errors: ApiKeyGenerateError[] = [];\n\n // Generate API keys\n logger.info(\n colors.magenta(`Generating API keys with title: ${apiKeyTitle}, scopes: ${scopes.join(',')}.`),\n );\n\n // Map over each role\n await mapSeries(filteredRoles, async (role) => {\n try {\n // Log into the other instance\n await assumeRole(client, { roleId: role.id, email, logger });\n\n // Grab API keys with that title\n logger.info(\n colors.magenta(\n `Checking if API key already exists in organization \"${role.organization.name}\" with title: \"${apiKeyTitle}\".`,\n ),\n );\n\n // Delete existing API key\n const [apiKeyWithTitle] = await fetchAllApiKeys(client, {\n logger,\n filterBy: { titles: [apiKeyTitle] },\n });\n if (apiKeyWithTitle && deleteExistingApiKey) {\n logger.info(\n colors.yellow(\n `Deleting existing API key in \"${role.organization.name}\" with title: \"${apiKeyTitle}\".`,\n ),\n );\n await deleteApiKey(client, { id: apiKeyWithTitle.id, logger });\n logger.info(\n colors.green(\n `Successfully deleted API key in \"${role.organization.name}\" with title: \"${apiKeyTitle}\".`,\n ),\n );\n } else if (apiKeyWithTitle) {\n // throw error if one exists but not configured to delete\n throw new Error(`API key already exists with title: \"${apiKeyTitle}\"`);\n }\n\n // Create the API key\n if (createNewApiKey) {\n logger.info(\n colors.magenta(\n `Creating API key in \"${role.organization.name}\" with title: \"${apiKeyTitle}\".`,\n ),\n );\n const { apiKey } = await createApiKey(client, {\n input: { title: apiKeyTitle, scopes },\n logger,\n });\n results.push({\n organizationName: role.organization.name,\n organizationId: role.organization.id,\n apiKey,\n });\n logger.info(\n colors.green(\n `Successfully created API key in \"${role.organization.name}\" with title: \"${apiKeyTitle}\".`,\n ),\n );\n } else {\n // Delete only\n results.push({\n organizationName: role.organization.name,\n organizationId: role.organization.id,\n apiKey: '',\n });\n }\n } catch (err) {\n logger.error(\n colors.red(\n `Failed to create API key in organization \"${role.organization.name}\"! - ${err.message}`,\n ),\n );\n errors.push({\n organizationName: role.organization.name,\n organizationId: role.organization.id,\n error: err.message,\n });\n }\n });\n logger.info(\n colors.green(\n `Successfully created ${results.length} API key${results.length === 1 ? '' : 's'}`,\n ),\n );\n\n if (errors.length > 0) {\n logger.error(\n colors.red(`Failed to create ${errors.length} API key${errors.length === 1 ? '' : 's'}!`),\n );\n }\n\n return { errors, apiKeys: results };\n}\n"],"mappings":"uTA+BA,eAAsB,EAA4B,CAChD,QACA,WACA,SACA,cACA,uBACA,uBAAuB,GACvB,kBAAkB,GAClB,eAAe,GAuBd,CAED,IAAM,EAAS,MAAM,EAAmC,EAAc,EAAE,CAAC,CAGzE,EAAO,KAAK,EAAO,QAAQ,uCAAuC,CAAC,CACnE,GAAM,CAAE,QAAO,eAAgB,MAAM,EAAU,EAAQ,CAAE,QAAO,WAAU,SAAQ,CAAC,CACnF,EAAO,KACL,EAAO,MACL,oCAAoC,EAAM,OAAO,OAAO,EAAM,SAAW,EAAI,GAAK,IAAI,GACvF,CACF,CAGD,IAAM,EAAgB,EAClB,EAAM,OACH,GACC,EAAK,aAAa,KAAO,GACzB,EAAK,aAAa,uBAAyB,EAC9C,CACD,EAGJ,EAAO,WAAW,CAChB,OAAQ,EACT,CAAC,CAGF,IAAM,EAA0B,EAAE,CAC5B,EAAgC,EAAE,CAgGxC,OA7FA,EAAO,KACL,EAAO,QAAQ,mCAAmC,EAAY,YAAY,EAAO,KAAK,IAAI,CAAC,GAAG,CAC/F,CAGD,MAAM,EAAU,EAAe,KAAO,IAAS,CAC7C,GAAI,CAEF,MAAM,EAAW,EAAQ,CAAE,OAAQ,EAAK,GAAI,QAAO,SAAQ,CAAC,CAG5D,EAAO,KACL,EAAO,QACL,uDAAuD,EAAK,aAAa,KAAK,iBAAiB,EAAY,IAC5G,CACF,CAGD,GAAM,CAAC,GAAmB,MAAM,EAAgB,EAAQ,CACtD,SACA,SAAU,CAAE,OAAQ,CAAC,EAAY,CAAE,CACpC,CAAC,CACF,GAAI,GAAmB,EACrB,EAAO,KACL,EAAO,OACL,iCAAiC,EAAK,aAAa,KAAK,iBAAiB,EAAY,IACtF,CACF,CACD,MAAM,EAAa,EAAQ,CAAE,GAAI,EAAgB,GAAI,SAAQ,CAAC,CAC9D,EAAO,KACL,EAAO,MACL,oCAAoC,EAAK,aAAa,KAAK,iBAAiB,EAAY,IACzF,CACF,SACQ,EAET,MAAU,MAAM,uCAAuC,EAAY,GAAG,CAIxE,GAAI,EAAiB,CACnB,EAAO,KACL,EAAO,QACL,wBAAwB,EAAK,aAAa,KAAK,iBAAiB,EAAY,IAC7E,CACF,CACD,GAAM,CAAE,UAAW,MAAM,EAAa,EAAQ,CAC5C,MAAO,CAAE,MAAO,EAAa,SAAQ,CACrC,SACD,CAAC,CACF,EAAQ,KAAK,CACX,iBAAkB,EAAK,aAAa,KACpC,eAAgB,EAAK,aAAa,GAClC,SACD,CAAC,CACF,EAAO,KACL,EAAO,MACL,oCAAoC,EAAK,aAAa,KAAK,iBAAiB,EAAY,IACzF,CACF,MAGD,EAAQ,KAAK,CACX,iBAAkB,EAAK,aAAa,KACpC,eAAgB,EAAK,aAAa,GAClC,OAAQ,GACT,CAAC,OAEG,EAAK,CACZ,EAAO,MACL,EAAO,IACL,6CAA6C,EAAK,aAAa,KAAK,OAAO,EAAI,UAChF,CACF,CACD,EAAO,KAAK,CACV,iBAAkB,EAAK,aAAa,KACpC,eAAgB,EAAK,aAAa,GAClC,MAAO,EAAI,QACZ,CAAC,GAEJ,CACF,EAAO,KACL,EAAO,MACL,wBAAwB,EAAQ,OAAO,UAAU,EAAQ,SAAW,EAAI,GAAK,MAC9E,CACF,CAEG,EAAO,OAAS,GAClB,EAAO,MACL,EAAO,IAAI,oBAAoB,EAAO,OAAO,UAAU,EAAO,SAAW,EAAI,GAAK,IAAI,GAAG,CAC1F,CAGI,CAAE,SAAQ,QAAS,EAAS"}
@@ -1,2 +1,2 @@
1
- import{t as e}from"./markSilentPrivacyRequests-DDDJEoJe.mjs";import{t}from"./done-input-validation-D25TzrxG.mjs";async function n({auth:n,transcendUrl:r,actions:i,statuses:a,requestIds:o,createdAtBefore:s,createdAtAfter:c,updatedAtBefore:l,updatedAtAfter:u,concurrency:d}){t(this.process.exit),await e({transcendUrl:r,requestActions:i,auth:n,requestIds:o,statuses:a,concurrency:d,createdAtBefore:s,createdAtAfter:c,updatedAtBefore:l,updatedAtAfter:u})}export{n as markSilent};
2
- //# sourceMappingURL=impl-Bw3__zkc2.mjs.map
1
+ import{t as e}from"./markSilentPrivacyRequests-B5AzihlB.mjs";import{t}from"./done-input-validation-CvwjeRWr.mjs";async function n({auth:n,transcendUrl:r,actions:i,statuses:a,requestIds:o,createdAtBefore:s,createdAtAfter:c,updatedAtBefore:l,updatedAtAfter:u,concurrency:d}){t(this.process.exit),await e({transcendUrl:r,requestActions:i,auth:n,requestIds:o,statuses:a,concurrency:d,createdAtBefore:s,createdAtAfter:c,updatedAtBefore:l,updatedAtAfter:u})}export{n as markSilent};
2
+ //# sourceMappingURL=impl-3pWQw99s2.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"impl-Bw3__zkc2.mjs","names":[],"sources":["../src/commands/request/mark-silent/impl.ts"],"sourcesContent":["import type { RequestAction, RequestStatus } from '@transcend-io/privacy-types';\n\nimport type { LocalContext } from '../../../context.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { markSilentPrivacyRequests } from '../../../lib/requests/index.js';\n\nexport interface MarkSilentCommandFlags {\n auth: string;\n actions: RequestAction[];\n statuses?: RequestStatus[];\n requestIds?: string[];\n createdAtBefore?: Date;\n createdAtAfter?: Date;\n updatedAtBefore?: Date;\n updatedAtAfter?: Date;\n transcendUrl: string;\n concurrency: number;\n}\n\nexport async function markSilent(\n this: LocalContext,\n {\n auth,\n transcendUrl,\n actions,\n statuses,\n requestIds,\n createdAtBefore,\n createdAtAfter,\n updatedAtBefore,\n updatedAtAfter,\n concurrency,\n }: MarkSilentCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n await markSilentPrivacyRequests({\n transcendUrl,\n requestActions: actions,\n auth,\n requestIds,\n statuses,\n concurrency,\n createdAtBefore,\n createdAtAfter,\n updatedAtBefore,\n updatedAtAfter,\n });\n}\n"],"mappings":"iHAmBA,eAAsB,EAEpB,CACE,OACA,eACA,UACA,WACA,aACA,kBACA,iBACA,kBACA,iBACA,eAEa,CACf,EAAoB,KAAK,QAAQ,KAAK,CAEtC,MAAM,EAA0B,CAC9B,eACA,eAAgB,EAChB,OACA,aACA,WACA,cACA,kBACA,iBACA,kBACA,iBACD,CAAC"}
1
+ {"version":3,"file":"impl-3pWQw99s2.mjs","names":[],"sources":["../src/commands/request/mark-silent/impl.ts"],"sourcesContent":["import type { RequestAction, RequestStatus } from '@transcend-io/privacy-types';\n\nimport type { LocalContext } from '../../../context.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { markSilentPrivacyRequests } from '../../../lib/requests/index.js';\n\nexport interface MarkSilentCommandFlags {\n auth: string;\n actions: RequestAction[];\n statuses?: RequestStatus[];\n requestIds?: string[];\n createdAtBefore?: Date;\n createdAtAfter?: Date;\n updatedAtBefore?: Date;\n updatedAtAfter?: Date;\n transcendUrl: string;\n concurrency: number;\n}\n\nexport async function markSilent(\n this: LocalContext,\n {\n auth,\n transcendUrl,\n actions,\n statuses,\n requestIds,\n createdAtBefore,\n createdAtAfter,\n updatedAtBefore,\n updatedAtAfter,\n concurrency,\n }: MarkSilentCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n await markSilentPrivacyRequests({\n transcendUrl,\n requestActions: actions,\n auth,\n requestIds,\n statuses,\n concurrency,\n createdAtBefore,\n createdAtAfter,\n updatedAtBefore,\n updatedAtAfter,\n });\n}\n"],"mappings":"iHAmBA,eAAsB,EAEpB,CACE,OACA,eACA,UACA,WACA,aACA,kBACA,iBACA,kBACA,iBACA,eAEa,CACf,EAAoB,KAAK,QAAQ,KAAK,CAEtC,MAAM,EAA0B,CAC9B,eACA,eAAgB,EAChB,OACA,aACA,WACA,cACA,kBACA,iBACA,kBACA,iBACD,CAAC"}
@@ -1,2 +1,2 @@
1
- import{t as e}from"./logger-D1tXVwJj.mjs";import{t}from"./pullChunkedCustomSiloOutstandingIdentifiers-NtMi2t5b.mjs";import{i as n,s as r}from"./writeCsv-Dg4Wuj5V.mjs";import{t as i}from"./done-input-validation-D25TzrxG.mjs";import{chunk as a,uniq as o}from"lodash-es";import s from"colors";import{buildTranscendGraphQLClient as c,fetchRequestFilesForRequest as l}from"@transcend-io/sdk";import{map as u}from"@transcend-io/utils";async function d({file:d,fileTarget:f,transcendUrl:p,auth:m,sombraAuth:h,cronDataSiloId:g,targetDataSiloId:_,actions:v,skipRequestCount:y,pageLimit:b,chunkSize:x}){y&&e.info(s.yellow(`Skipping request count as requested. This may help speed up the call.`)),(Number.isNaN(x)||x<=0||x%b!==0)&&(e.error(s.red(`Invalid chunk size: "${x}". Must be a positive integer that is a multiple of ${b}.`)),this.process.exit(1)),i(this.process.exit);let S=c(p,m),{baseName:C,extension:w}=n(d),{baseName:T,extension:E}=n(f),D=0,O=0,k=0;await t({dataSiloId:g,auth:m,sombraAuth:h,actions:v,apiPageSize:b,savePageSize:x,onSave:async t=>{D+=t.length;let n=await u(a(o(t.map(e=>e.requestId)),b),async t=>(e.info(s.magenta(`Fetching target identifiers for ${t.length} requests`)),(await l(S,{logger:e,pageSize:b*2,filterBy:{requestIds:t,dataSiloIds:[_]}})).map(({fileName:e,remoteId:t})=>{if(!t)throw Error(`Failed to find remoteId for ${e}`);return{RecordId:t,Object:e.replace(`.json`,``).split(`/`).pop()?.replace(` Information`,``),Comment:`Customer data deletion request submitted via transcend.io`}})),{concurrency:1});O+=n.flat().length;let i=o(t.map(e=>Object.keys(e)).flat()),c=`${C}-${k}${w}`,p=`${T}-${k}${E}`;await r(c,t,i),e.info(s.green(`Successfully wrote ${t.length} identifiers to file "${d}"`));let m=n.flat();await r(p,m,o(m.map(e=>Object.keys(e)).flat())),e.info(s.green(`Successfully wrote ${m.length} identifiers to file "${f}"`)),e.info(s.blue(`Processed chunk of ${a.length} identifiers, found ${m.length} target identifiers`)),k+=1},transcendUrl:p,skipRequestCount:y}),e.info(s.green(`Successfully wrote ${D} identifiers to file "${d}"`)),e.info(s.green(`Successfully wrote ${O} identifiers to file "${f}"`))}export{d as pullProfiles};
2
- //# sourceMappingURL=impl-CsSRW8xl2.mjs.map
1
+ import{t as e}from"./logger-B-LXIf3U.mjs";import{t}from"./pullChunkedCustomSiloOutstandingIdentifiers-yamc5Tm4.mjs";import{i as n,s as r}from"./writeCsv-DDKM_rAU.mjs";import{t as i}from"./done-input-validation-CvwjeRWr.mjs";import{chunk as a,uniq as o}from"lodash-es";import s from"colors";import{buildTranscendGraphQLClient as c,fetchRequestFilesForRequest as l}from"@transcend-io/sdk";import{map as u}from"@transcend-io/utils";async function d({file:d,fileTarget:f,transcendUrl:p,auth:m,sombraAuth:h,cronDataSiloId:g,targetDataSiloId:_,actions:v,skipRequestCount:y,pageLimit:b,chunkSize:x}){y&&e.info(s.yellow(`Skipping request count as requested. This may help speed up the call.`)),(Number.isNaN(x)||x<=0||x%b!==0)&&(e.error(s.red(`Invalid chunk size: "${x}". Must be a positive integer that is a multiple of ${b}.`)),this.process.exit(1)),i(this.process.exit);let S=c(p,m),{baseName:C,extension:w}=n(d),{baseName:T,extension:E}=n(f),D=0,O=0,k=0;await t({dataSiloId:g,auth:m,sombraAuth:h,actions:v,apiPageSize:b,savePageSize:x,onSave:async t=>{D+=t.length;let n=await u(a(o(t.map(e=>e.requestId)),b),async t=>(e.info(s.magenta(`Fetching target identifiers for ${t.length} requests`)),(await l(S,{logger:e,pageSize:b*2,filterBy:{requestIds:t,dataSiloIds:[_]}})).map(({fileName:e,remoteId:t})=>{if(!t)throw Error(`Failed to find remoteId for ${e}`);return{RecordId:t,Object:e.replace(`.json`,``).split(`/`).pop()?.replace(` Information`,``),Comment:`Customer data deletion request submitted via transcend.io`}})),{concurrency:1});O+=n.flat().length;let i=o(t.map(e=>Object.keys(e)).flat()),c=`${C}-${k}${w}`,p=`${T}-${k}${E}`;await r(c,t,i),e.info(s.green(`Successfully wrote ${t.length} identifiers to file "${d}"`));let m=n.flat();await r(p,m,o(m.map(e=>Object.keys(e)).flat())),e.info(s.green(`Successfully wrote ${m.length} identifiers to file "${f}"`)),e.info(s.blue(`Processed chunk of ${a.length} identifiers, found ${m.length} target identifiers`)),k+=1},transcendUrl:p,skipRequestCount:y}),e.info(s.green(`Successfully wrote ${D} identifiers to file "${d}"`)),e.info(s.green(`Successfully wrote ${O} identifiers to file "${f}"`))}export{d as pullProfiles};
2
+ //# sourceMappingURL=impl-4apk-8xK2.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"impl-CsSRW8xl2.mjs","names":[],"sources":["../src/commands/request/cron/pull-profiles/impl.ts"],"sourcesContent":["import type { RequestAction } from '@transcend-io/privacy-types';\nimport { buildTranscendGraphQLClient, fetchRequestFilesForRequest } from '@transcend-io/sdk';\nimport { map } from '@transcend-io/utils';\nimport colors from 'colors';\nimport { uniq, chunk } from 'lodash-es';\n\nimport type { LocalContext } from '../../../../context.js';\nimport { doneInputValidation } from '../../../../lib/cli/done-input-validation.js';\nimport {\n pullChunkedCustomSiloOutstandingIdentifiers,\n type CsvFormattedIdentifier,\n} from '../../../../lib/cron/index.js';\nimport { parseFilePath, writeLargeCsv } from '../../../../lib/helpers/index.js';\nimport { logger } from '../../../../logger.js';\n\nexport interface PullProfilesCommandFlags {\n file: string;\n fileTarget: string;\n transcendUrl: string;\n auth: string;\n sombraAuth?: string;\n cronDataSiloId: string;\n targetDataSiloId: string;\n actions: RequestAction[];\n skipRequestCount: boolean;\n pageLimit: number;\n chunkSize: number;\n}\n\nexport async function pullProfiles(\n this: LocalContext,\n {\n file,\n fileTarget,\n transcendUrl,\n auth,\n sombraAuth,\n cronDataSiloId,\n targetDataSiloId,\n actions,\n skipRequestCount,\n pageLimit,\n chunkSize,\n }: PullProfilesCommandFlags,\n): Promise<void> {\n if (skipRequestCount) {\n logger.info(\n colors.yellow('Skipping request count as requested. This may help speed up the call.'),\n );\n }\n\n if (Number.isNaN(chunkSize) || chunkSize <= 0 || chunkSize % pageLimit !== 0) {\n logger.error(\n colors.red(\n `Invalid chunk size: \"${chunkSize}\". Must be a positive integer that is a multiple of ${pageLimit}.`,\n ),\n );\n this.process.exit(1);\n }\n\n doneInputValidation(this.process.exit);\n\n // Create GraphQL client to connect to Transcend backend\n const client = buildTranscendGraphQLClient(transcendUrl, auth);\n const { baseName, extension } = parseFilePath(file);\n const { baseName: baseNameTarget, extension: extensionTarget } = parseFilePath(fileTarget);\n\n let allIdentifiersCount = 0;\n let allTargetIdentifiersCount = 0;\n let fileCount = 0;\n // Create onSave callback to handle chunked processing\n const onSave = async (chunkToSave: CsvFormattedIdentifier[]): Promise<void> => {\n // Add to all identifiers\n allIdentifiersCount += chunkToSave.length;\n\n // Get unique request IDs from this chunk\n const requestIds = chunkToSave.map((d) => d.requestId as string);\n const uniqueRequestIds = uniq(requestIds);\n\n // Pull down target identifiers for this chunk\n const chunkedRequestIds = chunk(uniqueRequestIds, pageLimit);\n const results = await map(\n chunkedRequestIds,\n async (requestIds) => {\n logger.info(\n colors.magenta(`Fetching target identifiers for ${requestIds.length} requests`),\n );\n const results = await fetchRequestFilesForRequest(client, {\n logger,\n pageSize: pageLimit * 2,\n filterBy: {\n requestIds,\n dataSiloIds: [targetDataSiloId],\n },\n });\n return results.map(({ fileName, remoteId }) => {\n if (!remoteId) {\n throw new Error(`Failed to find remoteId for ${fileName}`);\n }\n return {\n RecordId: remoteId,\n Object: fileName.replace('.json', '').split('/').pop()?.replace(' Information', ''),\n Comment: 'Customer data deletion request submitted via transcend.io',\n };\n });\n },\n // We are grabbing all the request files for the 'pageLimit' # of requests at a time\n {\n concurrency: 1,\n },\n );\n\n allTargetIdentifiersCount += results.flat().length;\n\n // Write the identifiers and target identifiers to CSV\n const headers = uniq(chunkToSave.map((d) => Object.keys(d)).flat());\n const numberedFileName = `${baseName}-${fileCount}${extension}`;\n const numberedFileNameTarget = `${baseNameTarget}-${fileCount}${extensionTarget}`;\n await writeLargeCsv(numberedFileName, chunkToSave, headers);\n logger.info(\n colors.green(`Successfully wrote ${chunkToSave.length} identifiers to file \"${file}\"`),\n );\n\n const targetIdentifiers = results.flat();\n const headers2 = uniq(targetIdentifiers.map((d) => Object.keys(d)).flat());\n await writeLargeCsv(numberedFileNameTarget, targetIdentifiers, headers2);\n logger.info(\n colors.green(\n `Successfully wrote ${targetIdentifiers.length} identifiers to file \"${fileTarget}\"`,\n ),\n );\n\n logger.info(\n colors.blue(\n `Processed chunk of ${chunk.length} identifiers, found ${targetIdentifiers.length} target identifiers`,\n ),\n );\n fileCount += 1;\n };\n\n // Pull down outstanding identifiers using the new chunked function\n await pullChunkedCustomSiloOutstandingIdentifiers({\n dataSiloId: cronDataSiloId,\n auth,\n sombraAuth,\n actions,\n apiPageSize: pageLimit,\n savePageSize: chunkSize,\n onSave,\n transcendUrl,\n skipRequestCount,\n });\n\n logger.info(\n colors.green(`Successfully wrote ${allIdentifiersCount} identifiers to file \"${file}\"`),\n );\n logger.info(\n colors.green(\n `Successfully wrote ${allTargetIdentifiersCount} identifiers to file \"${fileTarget}\"`,\n ),\n );\n}\n"],"mappings":"6aA6BA,eAAsB,EAEpB,CACE,OACA,aACA,eACA,OACA,aACA,iBACA,mBACA,UACA,mBACA,YACA,aAEa,CACX,GACF,EAAO,KACL,EAAO,OAAO,wEAAwE,CACvF,EAGC,OAAO,MAAM,EAAU,EAAI,GAAa,GAAK,EAAY,IAAc,KACzE,EAAO,MACL,EAAO,IACL,wBAAwB,EAAU,sDAAsD,EAAU,GACnG,CACF,CACD,KAAK,QAAQ,KAAK,EAAE,EAGtB,EAAoB,KAAK,QAAQ,KAAK,CAGtC,IAAM,EAAS,EAA4B,EAAc,EAAK,CACxD,CAAE,WAAU,aAAc,EAAc,EAAK,CAC7C,CAAE,SAAU,EAAgB,UAAW,GAAoB,EAAc,EAAW,CAEtF,EAAsB,EACtB,EAA4B,EAC5B,EAAY,EAwEhB,MAAM,EAA4C,CAChD,WAAY,EACZ,OACA,aACA,UACA,YAAa,EACb,aAAc,EACd,YA7EoB,IAAyD,CAE7E,GAAuB,EAAY,OAQnC,IAAM,EAAU,MAAM,EADI,EAHD,EADN,EAAY,IAAK,GAAM,EAAE,UACJ,CAGQ,CAAE,EAE/B,CACjB,KAAO,KACL,EAAO,KACL,EAAO,QAAQ,mCAAmC,EAAW,OAAO,WAAW,CAChF,EASM,MARe,EAA4B,EAAQ,CACxD,SACA,SAAU,EAAY,EACtB,SAAU,CACR,aACA,YAAa,CAAC,EAAiB,CAChC,CACF,CAAC,EACa,KAAK,CAAE,WAAU,cAAe,CAC7C,GAAI,CAAC,EACH,MAAU,MAAM,+BAA+B,IAAW,CAE5D,MAAO,CACL,SAAU,EACV,OAAQ,EAAS,QAAQ,QAAS,GAAG,CAAC,MAAM,IAAI,CAAC,KAAK,EAAE,QAAQ,eAAgB,GAAG,CACnF,QAAS,4DACV,EACD,EAGJ,CACE,YAAa,EACd,CACF,CAED,GAA6B,EAAQ,MAAM,CAAC,OAG5C,IAAM,EAAU,EAAK,EAAY,IAAK,GAAM,OAAO,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC,CAC7D,EAAmB,GAAG,EAAS,GAAG,IAAY,IAC9C,EAAyB,GAAG,EAAe,GAAG,IAAY,IAChE,MAAM,EAAc,EAAkB,EAAa,EAAQ,CAC3D,EAAO,KACL,EAAO,MAAM,sBAAsB,EAAY,OAAO,wBAAwB,EAAK,GAAG,CACvF,CAED,IAAM,EAAoB,EAAQ,MAAM,CAExC,MAAM,EAAc,EAAwB,EAD3B,EAAK,EAAkB,IAAK,GAAM,OAAO,KAAK,EAAE,CAAC,CAAC,MAAM,CACF,CAAC,CACxE,EAAO,KACL,EAAO,MACL,sBAAsB,EAAkB,OAAO,wBAAwB,EAAW,GACnF,CACF,CAED,EAAO,KACL,EAAO,KACL,sBAAsB,EAAM,OAAO,sBAAsB,EAAkB,OAAO,qBACnF,CACF,CACD,GAAa,GAYb,eACA,mBACD,CAAC,CAEF,EAAO,KACL,EAAO,MAAM,sBAAsB,EAAoB,wBAAwB,EAAK,GAAG,CACxF,CACD,EAAO,KACL,EAAO,MACL,sBAAsB,EAA0B,wBAAwB,EAAW,GACpF,CACF"}
1
+ {"version":3,"file":"impl-4apk-8xK2.mjs","names":[],"sources":["../src/commands/request/cron/pull-profiles/impl.ts"],"sourcesContent":["import type { RequestAction } from '@transcend-io/privacy-types';\nimport { buildTranscendGraphQLClient, fetchRequestFilesForRequest } from '@transcend-io/sdk';\nimport { map } from '@transcend-io/utils';\nimport colors from 'colors';\nimport { uniq, chunk } from 'lodash-es';\n\nimport type { LocalContext } from '../../../../context.js';\nimport { doneInputValidation } from '../../../../lib/cli/done-input-validation.js';\nimport {\n pullChunkedCustomSiloOutstandingIdentifiers,\n type CsvFormattedIdentifier,\n} from '../../../../lib/cron/index.js';\nimport { parseFilePath, writeLargeCsv } from '../../../../lib/helpers/index.js';\nimport { logger } from '../../../../logger.js';\n\nexport interface PullProfilesCommandFlags {\n file: string;\n fileTarget: string;\n transcendUrl: string;\n auth: string;\n sombraAuth?: string;\n cronDataSiloId: string;\n targetDataSiloId: string;\n actions: RequestAction[];\n skipRequestCount: boolean;\n pageLimit: number;\n chunkSize: number;\n}\n\nexport async function pullProfiles(\n this: LocalContext,\n {\n file,\n fileTarget,\n transcendUrl,\n auth,\n sombraAuth,\n cronDataSiloId,\n targetDataSiloId,\n actions,\n skipRequestCount,\n pageLimit,\n chunkSize,\n }: PullProfilesCommandFlags,\n): Promise<void> {\n if (skipRequestCount) {\n logger.info(\n colors.yellow('Skipping request count as requested. This may help speed up the call.'),\n );\n }\n\n if (Number.isNaN(chunkSize) || chunkSize <= 0 || chunkSize % pageLimit !== 0) {\n logger.error(\n colors.red(\n `Invalid chunk size: \"${chunkSize}\". Must be a positive integer that is a multiple of ${pageLimit}.`,\n ),\n );\n this.process.exit(1);\n }\n\n doneInputValidation(this.process.exit);\n\n // Create GraphQL client to connect to Transcend backend\n const client = buildTranscendGraphQLClient(transcendUrl, auth);\n const { baseName, extension } = parseFilePath(file);\n const { baseName: baseNameTarget, extension: extensionTarget } = parseFilePath(fileTarget);\n\n let allIdentifiersCount = 0;\n let allTargetIdentifiersCount = 0;\n let fileCount = 0;\n // Create onSave callback to handle chunked processing\n const onSave = async (chunkToSave: CsvFormattedIdentifier[]): Promise<void> => {\n // Add to all identifiers\n allIdentifiersCount += chunkToSave.length;\n\n // Get unique request IDs from this chunk\n const requestIds = chunkToSave.map((d) => d.requestId as string);\n const uniqueRequestIds = uniq(requestIds);\n\n // Pull down target identifiers for this chunk\n const chunkedRequestIds = chunk(uniqueRequestIds, pageLimit);\n const results = await map(\n chunkedRequestIds,\n async (requestIds) => {\n logger.info(\n colors.magenta(`Fetching target identifiers for ${requestIds.length} requests`),\n );\n const results = await fetchRequestFilesForRequest(client, {\n logger,\n pageSize: pageLimit * 2,\n filterBy: {\n requestIds,\n dataSiloIds: [targetDataSiloId],\n },\n });\n return results.map(({ fileName, remoteId }) => {\n if (!remoteId) {\n throw new Error(`Failed to find remoteId for ${fileName}`);\n }\n return {\n RecordId: remoteId,\n Object: fileName.replace('.json', '').split('/').pop()?.replace(' Information', ''),\n Comment: 'Customer data deletion request submitted via transcend.io',\n };\n });\n },\n // We are grabbing all the request files for the 'pageLimit' # of requests at a time\n {\n concurrency: 1,\n },\n );\n\n allTargetIdentifiersCount += results.flat().length;\n\n // Write the identifiers and target identifiers to CSV\n const headers = uniq(chunkToSave.map((d) => Object.keys(d)).flat());\n const numberedFileName = `${baseName}-${fileCount}${extension}`;\n const numberedFileNameTarget = `${baseNameTarget}-${fileCount}${extensionTarget}`;\n await writeLargeCsv(numberedFileName, chunkToSave, headers);\n logger.info(\n colors.green(`Successfully wrote ${chunkToSave.length} identifiers to file \"${file}\"`),\n );\n\n const targetIdentifiers = results.flat();\n const headers2 = uniq(targetIdentifiers.map((d) => Object.keys(d)).flat());\n await writeLargeCsv(numberedFileNameTarget, targetIdentifiers, headers2);\n logger.info(\n colors.green(\n `Successfully wrote ${targetIdentifiers.length} identifiers to file \"${fileTarget}\"`,\n ),\n );\n\n logger.info(\n colors.blue(\n `Processed chunk of ${chunk.length} identifiers, found ${targetIdentifiers.length} target identifiers`,\n ),\n );\n fileCount += 1;\n };\n\n // Pull down outstanding identifiers using the new chunked function\n await pullChunkedCustomSiloOutstandingIdentifiers({\n dataSiloId: cronDataSiloId,\n auth,\n sombraAuth,\n actions,\n apiPageSize: pageLimit,\n savePageSize: chunkSize,\n onSave,\n transcendUrl,\n skipRequestCount,\n });\n\n logger.info(\n colors.green(`Successfully wrote ${allIdentifiersCount} identifiers to file \"${file}\"`),\n );\n logger.info(\n colors.green(\n `Successfully wrote ${allTargetIdentifiersCount} identifiers to file \"${fileTarget}\"`,\n ),\n );\n}\n"],"mappings":"6aA6BA,eAAsB,EAEpB,CACE,OACA,aACA,eACA,OACA,aACA,iBACA,mBACA,UACA,mBACA,YACA,aAEa,CACX,GACF,EAAO,KACL,EAAO,OAAO,wEAAwE,CACvF,EAGC,OAAO,MAAM,EAAU,EAAI,GAAa,GAAK,EAAY,IAAc,KACzE,EAAO,MACL,EAAO,IACL,wBAAwB,EAAU,sDAAsD,EAAU,GACnG,CACF,CACD,KAAK,QAAQ,KAAK,EAAE,EAGtB,EAAoB,KAAK,QAAQ,KAAK,CAGtC,IAAM,EAAS,EAA4B,EAAc,EAAK,CACxD,CAAE,WAAU,aAAc,EAAc,EAAK,CAC7C,CAAE,SAAU,EAAgB,UAAW,GAAoB,EAAc,EAAW,CAEtF,EAAsB,EACtB,EAA4B,EAC5B,EAAY,EAwEhB,MAAM,EAA4C,CAChD,WAAY,EACZ,OACA,aACA,UACA,YAAa,EACb,aAAc,EACd,YA7EoB,IAAyD,CAE7E,GAAuB,EAAY,OAQnC,IAAM,EAAU,MAAM,EADI,EAHD,EADN,EAAY,IAAK,GAAM,EAAE,UACJ,CAGQ,CAAE,EAE/B,CACjB,KAAO,KACL,EAAO,KACL,EAAO,QAAQ,mCAAmC,EAAW,OAAO,WAAW,CAChF,EASM,MARe,EAA4B,EAAQ,CACxD,SACA,SAAU,EAAY,EACtB,SAAU,CACR,aACA,YAAa,CAAC,EAAiB,CAChC,CACF,CAAC,EACa,KAAK,CAAE,WAAU,cAAe,CAC7C,GAAI,CAAC,EACH,MAAU,MAAM,+BAA+B,IAAW,CAE5D,MAAO,CACL,SAAU,EACV,OAAQ,EAAS,QAAQ,QAAS,GAAG,CAAC,MAAM,IAAI,CAAC,KAAK,EAAE,QAAQ,eAAgB,GAAG,CACnF,QAAS,4DACV,EACD,EAGJ,CACE,YAAa,EACd,CACF,CAED,GAA6B,EAAQ,MAAM,CAAC,OAG5C,IAAM,EAAU,EAAK,EAAY,IAAK,GAAM,OAAO,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC,CAC7D,EAAmB,GAAG,EAAS,GAAG,IAAY,IAC9C,EAAyB,GAAG,EAAe,GAAG,IAAY,IAChE,MAAM,EAAc,EAAkB,EAAa,EAAQ,CAC3D,EAAO,KACL,EAAO,MAAM,sBAAsB,EAAY,OAAO,wBAAwB,EAAK,GAAG,CACvF,CAED,IAAM,EAAoB,EAAQ,MAAM,CAExC,MAAM,EAAc,EAAwB,EAD3B,EAAK,EAAkB,IAAK,GAAM,OAAO,KAAK,EAAE,CAAC,CAAC,MAAM,CACF,CAAC,CACxE,EAAO,KACL,EAAO,MACL,sBAAsB,EAAkB,OAAO,wBAAwB,EAAW,GACnF,CACF,CAED,EAAO,KACL,EAAO,KACL,sBAAsB,EAAM,OAAO,sBAAsB,EAAkB,OAAO,qBACnF,CACF,CACD,GAAa,GAYb,eACA,mBACD,CAAC,CAEF,EAAO,KACL,EAAO,MAAM,sBAAsB,EAAoB,wBAAwB,EAAK,GAAG,CACxF,CACD,EAAO,KACL,EAAO,MACL,sBAAsB,EAA0B,wBAAwB,EAAW,GACpF,CACF"}
@@ -1,2 +1,2 @@
1
- import{t as e}from"./logger-D1tXVwJj.mjs";import{a as t,r as n}from"./readTranscendYaml-B2Asm9c5.mjs";import{t as r}from"./listFiles-DsUfOUWr.mjs";import{t as i}from"./done-input-validation-D25TzrxG.mjs";import{t as a}from"./dataFlowsToDataSilos-IbmCPmy9.mjs";import{difference as o}from"lodash-es";import{existsSync as s,lstatSync as c}from"node:fs";import{join as l}from"node:path";import u from"colors";import{buildTranscendGraphQLClient as d,fetchAndIndexCatalogs as f}from"@transcend-io/sdk";async function p({auth:p,dataFlowsYmlFolder:m,output:h,ignoreYmls:g=[],transcendUrl:_}){i(this.process.exit),(!s(m)||!c(m).isDirectory())&&(e.error(u.red(`Folder does not exist: "${m}"`)),this.process.exit(1));let v=g.map(e=>e.split(`.`)[0]),y=r(m).map(e=>{let{"data-flows":t=[]}=n(l(m,e)),{adTechDataSilos:r,siteTechDataSilos:i}=a(t,{serviceToSupportedIntegration:T,serviceToTitle:w});return{adTechDataSilos:r,siteTechDataSilos:i,organizationName:e.split(`.`)[0]}}),b={};y.forEach(({adTechDataSilos:e,siteTechDataSilos:t,organizationName:n})=>{[...e,...t].forEach(e=>{let t=e[`outer-type`]||e.integrationName;b[t]||(b[t]=[]),b[t].push(n),b[t]=[...new Set(b[t])]})});let x=[...new Set(y.map(({adTechDataSilos:e})=>e.map(e=>e[`outer-type`]||e.integrationName)).flat())],S=o([...new Set(y.map(({siteTechDataSilos:e})=>e.map(e=>e[`outer-type`]||e.integrationName)).flat())],x),C={};y.forEach(({adTechDataSilos:e,siteTechDataSilos:t})=>{[...e,...t].forEach(e=>{let t=e[`outer-type`]||e.integrationName,n=e.attributes?.find(e=>e.key===`Found On Domain`);C[t]||(C[t]=[]),C[t].push(...n?.values||[]),C[t]=[...new Set(C[t])]})});let{serviceToTitle:w,serviceToSupportedIntegration:T}=await f(d(_,p),{logger:e}),E=[...x,...S].map(e=>({title:w[e],...T[e]?{integrationName:e}:{integrationName:`promptAPerson`,"outer-type":e},attributes:[{key:`Tech Type`,values:[`Ad Tech`]},{key:`Business Units`,values:o(b[e]||[],v)},{key:`Found On Domain`,values:C[e]||[]}]}));e.log(`Total Services: ${E.length}`),e.log(`Ad Tech Services: ${x.length}`),e.log(`Site Tech Services: ${S.length}`),t(h,{"data-silos":E})}export{p as deriveDataSilosFromDataFlowsCrossInstance};
2
- //# sourceMappingURL=impl-BtgbwWAB.mjs.map
1
+ import{t as e}from"./logger-B-LXIf3U.mjs";import{a as t,r as n}from"./readTranscendYaml-DXGNTxJE.mjs";import{t as r}from"./listFiles-B1GqyM33.mjs";import{t as i}from"./done-input-validation-CvwjeRWr.mjs";import{t as a}from"./dataFlowsToDataSilos-Blo6-adp.mjs";import{difference as o}from"lodash-es";import{existsSync as s,lstatSync as c}from"node:fs";import{join as l}from"node:path";import u from"colors";import{buildTranscendGraphQLClient as d,fetchAndIndexCatalogs as f}from"@transcend-io/sdk";async function p({auth:p,dataFlowsYmlFolder:m,output:h,ignoreYmls:g=[],transcendUrl:_}){i(this.process.exit),(!s(m)||!c(m).isDirectory())&&(e.error(u.red(`Folder does not exist: "${m}"`)),this.process.exit(1));let v=g.map(e=>e.split(`.`)[0]),y=r(m).map(e=>{let{"data-flows":t=[]}=n(l(m,e)),{adTechDataSilos:r,siteTechDataSilos:i}=a(t,{serviceToSupportedIntegration:T,serviceToTitle:w});return{adTechDataSilos:r,siteTechDataSilos:i,organizationName:e.split(`.`)[0]}}),b={};y.forEach(({adTechDataSilos:e,siteTechDataSilos:t,organizationName:n})=>{[...e,...t].forEach(e=>{let t=e[`outer-type`]||e.integrationName;b[t]||(b[t]=[]),b[t].push(n),b[t]=[...new Set(b[t])]})});let x=[...new Set(y.map(({adTechDataSilos:e})=>e.map(e=>e[`outer-type`]||e.integrationName)).flat())],S=o([...new Set(y.map(({siteTechDataSilos:e})=>e.map(e=>e[`outer-type`]||e.integrationName)).flat())],x),C={};y.forEach(({adTechDataSilos:e,siteTechDataSilos:t})=>{[...e,...t].forEach(e=>{let t=e[`outer-type`]||e.integrationName,n=e.attributes?.find(e=>e.key===`Found On Domain`);C[t]||(C[t]=[]),C[t].push(...n?.values||[]),C[t]=[...new Set(C[t])]})});let{serviceToTitle:w,serviceToSupportedIntegration:T}=await f(d(_,p),{logger:e}),E=[...x,...S].map(e=>({title:w[e],...T[e]?{integrationName:e}:{integrationName:`promptAPerson`,"outer-type":e},attributes:[{key:`Tech Type`,values:[`Ad Tech`]},{key:`Business Units`,values:o(b[e]||[],v)},{key:`Found On Domain`,values:C[e]||[]}]}));e.log(`Total Services: ${E.length}`),e.log(`Ad Tech Services: ${x.length}`),e.log(`Site Tech Services: ${S.length}`),t(h,{"data-silos":E})}export{p as deriveDataSilosFromDataFlowsCrossInstance};
2
+ //# sourceMappingURL=impl-Al6BRaZv.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"impl-BtgbwWAB.mjs","names":[],"sources":["../src/commands/inventory/derive-data-silos-from-data-flows-cross-instance/impl.ts"],"sourcesContent":["import { existsSync, lstatSync } from 'node:fs';\nimport { join } from 'node:path';\n\nimport { buildTranscendGraphQLClient, fetchAndIndexCatalogs } from '@transcend-io/sdk';\nimport colors from 'colors';\nimport { difference } from 'lodash-es';\n\nimport { DataFlowInput } from '../../../codecs.js';\nimport type { LocalContext } from '../../../context.js';\nimport { listFiles } from '../../../lib/api-keys/index.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { dataFlowsToDataSilos } from '../../../lib/consent-manager/dataFlowsToDataSilos.js';\nimport { readTranscendYaml, writeTranscendYaml } from '../../../lib/readTranscendYaml.js';\nimport { logger } from '../../../logger.js';\n\nexport interface DeriveDataSilosFromDataFlowsCrossInstanceCommandFlags {\n auth: string;\n dataFlowsYmlFolder: string;\n output: string;\n ignoreYmls?: string[];\n transcendUrl: string;\n}\n\nexport async function deriveDataSilosFromDataFlowsCrossInstance(\n this: LocalContext,\n {\n auth,\n dataFlowsYmlFolder,\n output,\n ignoreYmls = [],\n transcendUrl,\n }: DeriveDataSilosFromDataFlowsCrossInstanceCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n // Ensure folder is passed\n if (!existsSync(dataFlowsYmlFolder) || !lstatSync(dataFlowsYmlFolder).isDirectory()) {\n logger.error(colors.red(`Folder does not exist: \"${dataFlowsYmlFolder}\"`));\n this.process.exit(1);\n }\n\n // Ignore the data flows in these yml files\n const instancesToIgnore = ignoreYmls.map((x) => x.split('.')[0]);\n\n // Map over each data flow yml file and convert to data silo configurations\n const dataSiloInputs = listFiles(dataFlowsYmlFolder).map((directory) => {\n // read in the data flows for a specific instance\n const { 'data-flows': dataFlows = [] } = readTranscendYaml(join(dataFlowsYmlFolder, directory));\n\n // map the data flows to data silos\n const { adTechDataSilos, siteTechDataSilos } = dataFlowsToDataSilos(\n dataFlows as DataFlowInput[],\n {\n serviceToSupportedIntegration,\n serviceToTitle,\n },\n );\n\n return {\n adTechDataSilos,\n siteTechDataSilos,\n organizationName: directory.split('.')[0],\n };\n });\n\n // Mapping from service name to instances that have that service\n const serviceToInstance: { [k in string]: string[] } = {};\n dataSiloInputs.forEach(({ adTechDataSilos, siteTechDataSilos, organizationName }) => {\n const allDataSilos = [...adTechDataSilos, ...siteTechDataSilos];\n allDataSilos.forEach((dataSilo) => {\n const service = dataSilo['outer-type'] || dataSilo.integrationName;\n // create mapping to instance\n if (!serviceToInstance[service]) {\n serviceToInstance[service] = [];\n }\n serviceToInstance[service]!.push(organizationName);\n serviceToInstance[service] = [...new Set(serviceToInstance[service])];\n });\n });\n\n // List of ad tech integrations\n const adTechIntegrations = [\n ...new Set(\n dataSiloInputs\n .map(({ adTechDataSilos }) =>\n adTechDataSilos.map((silo) => silo['outer-type'] || silo.integrationName),\n )\n .flat(),\n ),\n ];\n\n // List of site tech integrations\n const siteTechIntegrations = difference(\n [\n ...new Set(\n dataSiloInputs\n .map(({ siteTechDataSilos }) =>\n siteTechDataSilos.map((silo) => silo['outer-type'] || silo.integrationName),\n )\n .flat(),\n ),\n ],\n adTechIntegrations,\n );\n\n // Mapping from service name to list of\n const serviceToFoundOnDomain: { [k in string]: string[] } = {};\n dataSiloInputs.forEach(({ adTechDataSilos, siteTechDataSilos }) => {\n const allDataSilos = [...adTechDataSilos, ...siteTechDataSilos];\n allDataSilos.forEach((dataSilo) => {\n const service = dataSilo['outer-type'] || dataSilo.integrationName;\n const foundOnDomain = dataSilo.attributes?.find((attr) => attr.key === 'Found On Domain');\n // create mapping to instance\n if (!serviceToFoundOnDomain[service]) {\n serviceToFoundOnDomain[service] = [];\n }\n serviceToFoundOnDomain[service]!.push(...(foundOnDomain?.values || []));\n serviceToFoundOnDomain[service] = [...new Set(serviceToFoundOnDomain[service])];\n });\n });\n\n // Fetch all integrations in the catalog\n const client = buildTranscendGraphQLClient(transcendUrl, auth);\n const { serviceToTitle, serviceToSupportedIntegration } = await fetchAndIndexCatalogs(client, {\n logger,\n });\n\n // construct the aggregated data silo inputs\n const dataSilos = [...adTechIntegrations, ...siteTechIntegrations].map((service) => ({\n title: serviceToTitle[service],\n ...(serviceToSupportedIntegration[service]\n ? { integrationName: service }\n : { integrationName: 'promptAPerson', 'outer-type': service }),\n attributes: [\n {\n key: 'Tech Type',\n values: ['Ad Tech'],\n },\n {\n key: 'Business Units',\n values: difference(serviceToInstance[service] || [], instancesToIgnore),\n },\n {\n key: 'Found On Domain',\n values: serviceToFoundOnDomain[service] || [],\n },\n ],\n }));\n\n // Log output\n logger.log(`Total Services: ${dataSilos.length}`);\n logger.log(`Ad Tech Services: ${adTechIntegrations.length}`);\n logger.log(`Site Tech Services: ${siteTechIntegrations.length}`);\n\n // Write to yaml\n writeTranscendYaml(output, {\n 'data-silos': dataSilos,\n });\n}\n"],"mappings":"ifAuBA,eAAsB,EAEpB,CACE,OACA,qBACA,SACA,aAAa,EAAE,CACf,gBAEa,CACf,EAAoB,KAAK,QAAQ,KAAK,EAGlC,CAAC,EAAW,EAAmB,EAAI,CAAC,EAAU,EAAmB,CAAC,aAAa,IACjF,EAAO,MAAM,EAAO,IAAI,2BAA2B,EAAmB,GAAG,CAAC,CAC1E,KAAK,QAAQ,KAAK,EAAE,EAItB,IAAM,EAAoB,EAAW,IAAK,GAAM,EAAE,MAAM,IAAI,CAAC,GAAG,CAG1D,EAAiB,EAAU,EAAmB,CAAC,IAAK,GAAc,CAEtE,GAAM,CAAE,aAAc,EAAY,EAAE,EAAK,EAAkB,EAAK,EAAoB,EAAU,CAAC,CAGzF,CAAE,kBAAiB,qBAAsB,EAC7C,EACA,CACE,gCACA,iBACD,CACF,CAED,MAAO,CACL,kBACA,oBACA,iBAAkB,EAAU,MAAM,IAAI,CAAC,GACxC,EACD,CAGI,EAAiD,EAAE,CACzD,EAAe,SAAS,CAAE,kBAAiB,oBAAmB,sBAAuB,CAEnF,CADsB,GAAG,EAAiB,GAAG,EACjC,CAAC,QAAS,GAAa,CACjC,IAAM,EAAU,EAAS,eAAiB,EAAS,gBAE9C,EAAkB,KACrB,EAAkB,GAAW,EAAE,EAEjC,EAAkB,GAAU,KAAK,EAAiB,CAClD,EAAkB,GAAW,CAAC,GAAG,IAAI,IAAI,EAAkB,GAAS,CAAC,EACrE,EACF,CAGF,IAAM,EAAqB,CACzB,GAAG,IAAI,IACL,EACG,KAAK,CAAE,qBACN,EAAgB,IAAK,GAAS,EAAK,eAAiB,EAAK,gBAAgB,CAC1E,CACA,MAAM,CACV,CACF,CAGK,EAAuB,EAC3B,CACE,GAAG,IAAI,IACL,EACG,KAAK,CAAE,uBACN,EAAkB,IAAK,GAAS,EAAK,eAAiB,EAAK,gBAAgB,CAC5E,CACA,MAAM,CACV,CACF,CACD,EACD,CAGK,EAAsD,EAAE,CAC9D,EAAe,SAAS,CAAE,kBAAiB,uBAAwB,CAEjE,CADsB,GAAG,EAAiB,GAAG,EACjC,CAAC,QAAS,GAAa,CACjC,IAAM,EAAU,EAAS,eAAiB,EAAS,gBAC7C,EAAgB,EAAS,YAAY,KAAM,GAAS,EAAK,MAAQ,kBAAkB,CAEpF,EAAuB,KAC1B,EAAuB,GAAW,EAAE,EAEtC,EAAuB,GAAU,KAAK,GAAI,GAAe,QAAU,EAAE,CAAE,CACvE,EAAuB,GAAW,CAAC,GAAG,IAAI,IAAI,EAAuB,GAAS,CAAC,EAC/E,EACF,CAIF,GAAM,CAAE,iBAAgB,iCAAkC,MAAM,EADjD,EAA4B,EAAc,EACmC,CAAE,CAC5F,SACD,CAAC,CAGI,EAAY,CAAC,GAAG,EAAoB,GAAG,EAAqB,CAAC,IAAK,IAAa,CACnF,MAAO,EAAe,GACtB,GAAI,EAA8B,GAC9B,CAAE,gBAAiB,EAAS,CAC5B,CAAE,gBAAiB,gBAAiB,aAAc,EAAS,CAC/D,WAAY,CACV,CACE,IAAK,YACL,OAAQ,CAAC,UAAU,CACpB,CACD,CACE,IAAK,iBACL,OAAQ,EAAW,EAAkB,IAAY,EAAE,CAAE,EAAkB,CACxE,CACD,CACE,IAAK,kBACL,OAAQ,EAAuB,IAAY,EAAE,CAC9C,CACF,CACF,EAAE,CAGH,EAAO,IAAI,mBAAmB,EAAU,SAAS,CACjD,EAAO,IAAI,qBAAqB,EAAmB,SAAS,CAC5D,EAAO,IAAI,uBAAuB,EAAqB,SAAS,CAGhE,EAAmB,EAAQ,CACzB,aAAc,EACf,CAAC"}
1
+ {"version":3,"file":"impl-Al6BRaZv.mjs","names":[],"sources":["../src/commands/inventory/derive-data-silos-from-data-flows-cross-instance/impl.ts"],"sourcesContent":["import { existsSync, lstatSync } from 'node:fs';\nimport { join } from 'node:path';\n\nimport { buildTranscendGraphQLClient, fetchAndIndexCatalogs } from '@transcend-io/sdk';\nimport colors from 'colors';\nimport { difference } from 'lodash-es';\n\nimport { DataFlowInput } from '../../../codecs.js';\nimport type { LocalContext } from '../../../context.js';\nimport { listFiles } from '../../../lib/api-keys/index.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { dataFlowsToDataSilos } from '../../../lib/consent-manager/dataFlowsToDataSilos.js';\nimport { readTranscendYaml, writeTranscendYaml } from '../../../lib/readTranscendYaml.js';\nimport { logger } from '../../../logger.js';\n\nexport interface DeriveDataSilosFromDataFlowsCrossInstanceCommandFlags {\n auth: string;\n dataFlowsYmlFolder: string;\n output: string;\n ignoreYmls?: string[];\n transcendUrl: string;\n}\n\nexport async function deriveDataSilosFromDataFlowsCrossInstance(\n this: LocalContext,\n {\n auth,\n dataFlowsYmlFolder,\n output,\n ignoreYmls = [],\n transcendUrl,\n }: DeriveDataSilosFromDataFlowsCrossInstanceCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n // Ensure folder is passed\n if (!existsSync(dataFlowsYmlFolder) || !lstatSync(dataFlowsYmlFolder).isDirectory()) {\n logger.error(colors.red(`Folder does not exist: \"${dataFlowsYmlFolder}\"`));\n this.process.exit(1);\n }\n\n // Ignore the data flows in these yml files\n const instancesToIgnore = ignoreYmls.map((x) => x.split('.')[0]);\n\n // Map over each data flow yml file and convert to data silo configurations\n const dataSiloInputs = listFiles(dataFlowsYmlFolder).map((directory) => {\n // read in the data flows for a specific instance\n const { 'data-flows': dataFlows = [] } = readTranscendYaml(join(dataFlowsYmlFolder, directory));\n\n // map the data flows to data silos\n const { adTechDataSilos, siteTechDataSilos } = dataFlowsToDataSilos(\n dataFlows as DataFlowInput[],\n {\n serviceToSupportedIntegration,\n serviceToTitle,\n },\n );\n\n return {\n adTechDataSilos,\n siteTechDataSilos,\n organizationName: directory.split('.')[0],\n };\n });\n\n // Mapping from service name to instances that have that service\n const serviceToInstance: { [k in string]: string[] } = {};\n dataSiloInputs.forEach(({ adTechDataSilos, siteTechDataSilos, organizationName }) => {\n const allDataSilos = [...adTechDataSilos, ...siteTechDataSilos];\n allDataSilos.forEach((dataSilo) => {\n const service = dataSilo['outer-type'] || dataSilo.integrationName;\n // create mapping to instance\n if (!serviceToInstance[service]) {\n serviceToInstance[service] = [];\n }\n serviceToInstance[service]!.push(organizationName);\n serviceToInstance[service] = [...new Set(serviceToInstance[service])];\n });\n });\n\n // List of ad tech integrations\n const adTechIntegrations = [\n ...new Set(\n dataSiloInputs\n .map(({ adTechDataSilos }) =>\n adTechDataSilos.map((silo) => silo['outer-type'] || silo.integrationName),\n )\n .flat(),\n ),\n ];\n\n // List of site tech integrations\n const siteTechIntegrations = difference(\n [\n ...new Set(\n dataSiloInputs\n .map(({ siteTechDataSilos }) =>\n siteTechDataSilos.map((silo) => silo['outer-type'] || silo.integrationName),\n )\n .flat(),\n ),\n ],\n adTechIntegrations,\n );\n\n // Mapping from service name to list of\n const serviceToFoundOnDomain: { [k in string]: string[] } = {};\n dataSiloInputs.forEach(({ adTechDataSilos, siteTechDataSilos }) => {\n const allDataSilos = [...adTechDataSilos, ...siteTechDataSilos];\n allDataSilos.forEach((dataSilo) => {\n const service = dataSilo['outer-type'] || dataSilo.integrationName;\n const foundOnDomain = dataSilo.attributes?.find((attr) => attr.key === 'Found On Domain');\n // create mapping to instance\n if (!serviceToFoundOnDomain[service]) {\n serviceToFoundOnDomain[service] = [];\n }\n serviceToFoundOnDomain[service]!.push(...(foundOnDomain?.values || []));\n serviceToFoundOnDomain[service] = [...new Set(serviceToFoundOnDomain[service])];\n });\n });\n\n // Fetch all integrations in the catalog\n const client = buildTranscendGraphQLClient(transcendUrl, auth);\n const { serviceToTitle, serviceToSupportedIntegration } = await fetchAndIndexCatalogs(client, {\n logger,\n });\n\n // construct the aggregated data silo inputs\n const dataSilos = [...adTechIntegrations, ...siteTechIntegrations].map((service) => ({\n title: serviceToTitle[service],\n ...(serviceToSupportedIntegration[service]\n ? { integrationName: service }\n : { integrationName: 'promptAPerson', 'outer-type': service }),\n attributes: [\n {\n key: 'Tech Type',\n values: ['Ad Tech'],\n },\n {\n key: 'Business Units',\n values: difference(serviceToInstance[service] || [], instancesToIgnore),\n },\n {\n key: 'Found On Domain',\n values: serviceToFoundOnDomain[service] || [],\n },\n ],\n }));\n\n // Log output\n logger.log(`Total Services: ${dataSilos.length}`);\n logger.log(`Ad Tech Services: ${adTechIntegrations.length}`);\n logger.log(`Site Tech Services: ${siteTechIntegrations.length}`);\n\n // Write to yaml\n writeTranscendYaml(output, {\n 'data-silos': dataSilos,\n });\n}\n"],"mappings":"ifAuBA,eAAsB,EAEpB,CACE,OACA,qBACA,SACA,aAAa,EAAE,CACf,gBAEa,CACf,EAAoB,KAAK,QAAQ,KAAK,EAGlC,CAAC,EAAW,EAAmB,EAAI,CAAC,EAAU,EAAmB,CAAC,aAAa,IACjF,EAAO,MAAM,EAAO,IAAI,2BAA2B,EAAmB,GAAG,CAAC,CAC1E,KAAK,QAAQ,KAAK,EAAE,EAItB,IAAM,EAAoB,EAAW,IAAK,GAAM,EAAE,MAAM,IAAI,CAAC,GAAG,CAG1D,EAAiB,EAAU,EAAmB,CAAC,IAAK,GAAc,CAEtE,GAAM,CAAE,aAAc,EAAY,EAAE,EAAK,EAAkB,EAAK,EAAoB,EAAU,CAAC,CAGzF,CAAE,kBAAiB,qBAAsB,EAC7C,EACA,CACE,gCACA,iBACD,CACF,CAED,MAAO,CACL,kBACA,oBACA,iBAAkB,EAAU,MAAM,IAAI,CAAC,GACxC,EACD,CAGI,EAAiD,EAAE,CACzD,EAAe,SAAS,CAAE,kBAAiB,oBAAmB,sBAAuB,CAEnF,CADsB,GAAG,EAAiB,GAAG,EACjC,CAAC,QAAS,GAAa,CACjC,IAAM,EAAU,EAAS,eAAiB,EAAS,gBAE9C,EAAkB,KACrB,EAAkB,GAAW,EAAE,EAEjC,EAAkB,GAAU,KAAK,EAAiB,CAClD,EAAkB,GAAW,CAAC,GAAG,IAAI,IAAI,EAAkB,GAAS,CAAC,EACrE,EACF,CAGF,IAAM,EAAqB,CACzB,GAAG,IAAI,IACL,EACG,KAAK,CAAE,qBACN,EAAgB,IAAK,GAAS,EAAK,eAAiB,EAAK,gBAAgB,CAC1E,CACA,MAAM,CACV,CACF,CAGK,EAAuB,EAC3B,CACE,GAAG,IAAI,IACL,EACG,KAAK,CAAE,uBACN,EAAkB,IAAK,GAAS,EAAK,eAAiB,EAAK,gBAAgB,CAC5E,CACA,MAAM,CACV,CACF,CACD,EACD,CAGK,EAAsD,EAAE,CAC9D,EAAe,SAAS,CAAE,kBAAiB,uBAAwB,CAEjE,CADsB,GAAG,EAAiB,GAAG,EACjC,CAAC,QAAS,GAAa,CACjC,IAAM,EAAU,EAAS,eAAiB,EAAS,gBAC7C,EAAgB,EAAS,YAAY,KAAM,GAAS,EAAK,MAAQ,kBAAkB,CAEpF,EAAuB,KAC1B,EAAuB,GAAW,EAAE,EAEtC,EAAuB,GAAU,KAAK,GAAI,GAAe,QAAU,EAAE,CAAE,CACvE,EAAuB,GAAW,CAAC,GAAG,IAAI,IAAI,EAAuB,GAAS,CAAC,EAC/E,EACF,CAIF,GAAM,CAAE,iBAAgB,iCAAkC,MAAM,EADjD,EAA4B,EAAc,EACmC,CAAE,CAC5F,SACD,CAAC,CAGI,EAAY,CAAC,GAAG,EAAoB,GAAG,EAAqB,CAAC,IAAK,IAAa,CACnF,MAAO,EAAe,GACtB,GAAI,EAA8B,GAC9B,CAAE,gBAAiB,EAAS,CAC5B,CAAE,gBAAiB,gBAAiB,aAAc,EAAS,CAC/D,WAAY,CACV,CACE,IAAK,YACL,OAAQ,CAAC,UAAU,CACpB,CACD,CACE,IAAK,iBACL,OAAQ,EAAW,EAAkB,IAAY,EAAE,CAAE,EAAkB,CACxE,CACD,CACE,IAAK,kBACL,OAAQ,EAAuB,IAAY,EAAE,CAC9C,CACF,CACF,EAAE,CAGH,EAAO,IAAI,mBAAmB,EAAU,SAAS,CACjD,EAAO,IAAI,qBAAqB,EAAmB,SAAS,CAC5D,EAAO,IAAI,uBAAuB,EAAqB,SAAS,CAGhE,EAAmB,EAAQ,CACzB,aAAc,EACf,CAAC"}
@@ -1,2 +1,2 @@
1
- import{t as e}from"./logger-D1tXVwJj.mjs";import{E as t}from"./codecs-CwRYEdQK.mjs";import{a as n}from"./readTranscendYaml-B2Asm9c5.mjs";import{t as r}from"./done-input-validation-D25TzrxG.mjs";import{ConsentTrackerStatus as i,DataFlowScope as a}from"@transcend-io/privacy-types";import{decodeCodec as o}from"@transcend-io/type-utils";import{existsSync as s,readFileSync as c}from"node:fs";import l from"colors";import*as u from"io-ts";function d({file:d,output:f}){r(this.process.exit),s(d)||(e.error(l.red(`File does not exist: --file="${d}"`)),this.process.exit(1));let p=o(u.array(t),c(d,`utf-8`)),m=[],h=[];p.forEach(e=>{e.dataFlows.filter(({type:e})=>e!==a.CSP).forEach(e=>{m.push({value:e.value,type:e.type,status:i.Live,trackingPurposes:e.trackingPurposes})}),e.cookies.forEach(e=>{h.push({name:e.name,status:i.Live,trackingPurposes:e.trackingPurposes})})}),n(f,{"data-flows":m,cookies:h}),e.info(l.green(`Successfully wrote ${m.length} data flows and ${h.length} cookies to file "${f}"`))}export{d as consentManagerServiceJsonToYml};
2
- //# sourceMappingURL=impl-DGBJkbeS.mjs.map
1
+ import{t as e}from"./logger-B-LXIf3U.mjs";import{E as t}from"./codecs-8Cq4qQpS.mjs";import{a as n}from"./readTranscendYaml-DXGNTxJE.mjs";import{t as r}from"./done-input-validation-CvwjeRWr.mjs";import{ConsentTrackerStatus as i,DataFlowScope as a}from"@transcend-io/privacy-types";import{decodeCodec as o}from"@transcend-io/type-utils";import{existsSync as s,readFileSync as c}from"node:fs";import l from"colors";import*as u from"io-ts";function d({file:d,output:f}){r(this.process.exit),s(d)||(e.error(l.red(`File does not exist: --file="${d}"`)),this.process.exit(1));let p=o(u.array(t),c(d,`utf-8`)),m=[],h=[];p.forEach(e=>{e.dataFlows.filter(({type:e})=>e!==a.CSP).forEach(e=>{m.push({value:e.value,type:e.type,status:i.Live,trackingPurposes:e.trackingPurposes})}),e.cookies.forEach(e=>{h.push({name:e.name,status:i.Live,trackingPurposes:e.trackingPurposes})})}),n(f,{"data-flows":m,cookies:h}),e.info(l.green(`Successfully wrote ${m.length} data flows and ${h.length} cookies to file "${f}"`))}export{d as consentManagerServiceJsonToYml};
2
+ //# sourceMappingURL=impl-B3jtMu4u.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"impl-DGBJkbeS.mjs","names":[],"sources":["../src/commands/inventory/consent-manager-service-json-to-yml/impl.ts"],"sourcesContent":["import { existsSync, readFileSync } from 'node:fs';\n\nimport { ConsentTrackerStatus, DataFlowScope } from '@transcend-io/privacy-types';\nimport { decodeCodec } from '@transcend-io/type-utils';\nimport colors from 'colors';\nimport * as t from 'io-ts';\n\nimport { ConsentManagerServiceMetadata, CookieInput, DataFlowInput } from '../../../codecs.js';\nimport type { LocalContext } from '../../../context.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { writeTranscendYaml } from '../../../lib/readTranscendYaml.js';\nimport { logger } from '../../../logger.js';\n\nexport interface ConsentManagerServiceJsonToYmlCommandFlags {\n file: string;\n output: string;\n}\n\nexport function consentManagerServiceJsonToYml(\n this: LocalContext,\n { file, output }: ConsentManagerServiceJsonToYmlCommandFlags,\n): void {\n doneInputValidation(this.process.exit);\n\n // Ensure files exist\n if (!existsSync(file)) {\n logger.error(colors.red(`File does not exist: --file=\"${file}\"`));\n this.process.exit(1);\n }\n\n // Read in each consent manager configuration\n const services = decodeCodec(t.array(ConsentManagerServiceMetadata), readFileSync(file, 'utf-8'));\n\n // Create data flows and cookie configurations\n const dataFlows: DataFlowInput[] = [];\n const cookies: CookieInput[] = [];\n services.forEach((service) => {\n service.dataFlows\n .filter(({ type }) => type !== DataFlowScope.CSP)\n .forEach((dataFlow) => {\n dataFlows.push({\n value: dataFlow.value,\n type: dataFlow.type,\n status: ConsentTrackerStatus.Live,\n trackingPurposes: dataFlow.trackingPurposes,\n });\n });\n\n service.cookies.forEach((cookie) => {\n cookies.push({\n name: cookie.name,\n status: ConsentTrackerStatus.Live,\n trackingPurposes: cookie.trackingPurposes,\n });\n });\n });\n\n // write to disk\n writeTranscendYaml(output, {\n 'data-flows': dataFlows,\n cookies,\n });\n\n logger.info(\n colors.green(\n `Successfully wrote ${dataFlows.length} data flows and ${cookies.length} cookies to file \"${output}\"`,\n ),\n );\n}\n"],"mappings":"obAkBA,SAAgB,EAEd,CAAE,OAAM,UACF,CACN,EAAoB,KAAK,QAAQ,KAAK,CAGjC,EAAW,EAAK,GACnB,EAAO,MAAM,EAAO,IAAI,gCAAgC,EAAK,GAAG,CAAC,CACjE,KAAK,QAAQ,KAAK,EAAE,EAItB,IAAM,EAAW,EAAY,EAAE,MAAM,EAA8B,CAAE,EAAa,EAAM,QAAQ,CAAC,CAG3F,EAA6B,EAAE,CAC/B,EAAyB,EAAE,CACjC,EAAS,QAAS,GAAY,CAC5B,EAAQ,UACL,QAAQ,CAAE,UAAW,IAAS,EAAc,IAAI,CAChD,QAAS,GAAa,CACrB,EAAU,KAAK,CACb,MAAO,EAAS,MAChB,KAAM,EAAS,KACf,OAAQ,EAAqB,KAC7B,iBAAkB,EAAS,iBAC5B,CAAC,EACF,CAEJ,EAAQ,QAAQ,QAAS,GAAW,CAClC,EAAQ,KAAK,CACX,KAAM,EAAO,KACb,OAAQ,EAAqB,KAC7B,iBAAkB,EAAO,iBAC1B,CAAC,EACF,EACF,CAGF,EAAmB,EAAQ,CACzB,aAAc,EACd,UACD,CAAC,CAEF,EAAO,KACL,EAAO,MACL,sBAAsB,EAAU,OAAO,kBAAkB,EAAQ,OAAO,oBAAoB,EAAO,GACpG,CACF"}
1
+ {"version":3,"file":"impl-B3jtMu4u.mjs","names":[],"sources":["../src/commands/inventory/consent-manager-service-json-to-yml/impl.ts"],"sourcesContent":["import { existsSync, readFileSync } from 'node:fs';\n\nimport { ConsentTrackerStatus, DataFlowScope } from '@transcend-io/privacy-types';\nimport { decodeCodec } from '@transcend-io/type-utils';\nimport colors from 'colors';\nimport * as t from 'io-ts';\n\nimport { ConsentManagerServiceMetadata, CookieInput, DataFlowInput } from '../../../codecs.js';\nimport type { LocalContext } from '../../../context.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { writeTranscendYaml } from '../../../lib/readTranscendYaml.js';\nimport { logger } from '../../../logger.js';\n\nexport interface ConsentManagerServiceJsonToYmlCommandFlags {\n file: string;\n output: string;\n}\n\nexport function consentManagerServiceJsonToYml(\n this: LocalContext,\n { file, output }: ConsentManagerServiceJsonToYmlCommandFlags,\n): void {\n doneInputValidation(this.process.exit);\n\n // Ensure files exist\n if (!existsSync(file)) {\n logger.error(colors.red(`File does not exist: --file=\"${file}\"`));\n this.process.exit(1);\n }\n\n // Read in each consent manager configuration\n const services = decodeCodec(t.array(ConsentManagerServiceMetadata), readFileSync(file, 'utf-8'));\n\n // Create data flows and cookie configurations\n const dataFlows: DataFlowInput[] = [];\n const cookies: CookieInput[] = [];\n services.forEach((service) => {\n service.dataFlows\n .filter(({ type }) => type !== DataFlowScope.CSP)\n .forEach((dataFlow) => {\n dataFlows.push({\n value: dataFlow.value,\n type: dataFlow.type,\n status: ConsentTrackerStatus.Live,\n trackingPurposes: dataFlow.trackingPurposes,\n });\n });\n\n service.cookies.forEach((cookie) => {\n cookies.push({\n name: cookie.name,\n status: ConsentTrackerStatus.Live,\n trackingPurposes: cookie.trackingPurposes,\n });\n });\n });\n\n // write to disk\n writeTranscendYaml(output, {\n 'data-flows': dataFlows,\n cookies,\n });\n\n logger.info(\n colors.green(\n `Successfully wrote ${dataFlows.length} data flows and ${cookies.length} cookies to file \"${output}\"`,\n ),\n );\n}\n"],"mappings":"obAkBA,SAAgB,EAEd,CAAE,OAAM,UACF,CACN,EAAoB,KAAK,QAAQ,KAAK,CAGjC,EAAW,EAAK,GACnB,EAAO,MAAM,EAAO,IAAI,gCAAgC,EAAK,GAAG,CAAC,CACjE,KAAK,QAAQ,KAAK,EAAE,EAItB,IAAM,EAAW,EAAY,EAAE,MAAM,EAA8B,CAAE,EAAa,EAAM,QAAQ,CAAC,CAG3F,EAA6B,EAAE,CAC/B,EAAyB,EAAE,CACjC,EAAS,QAAS,GAAY,CAC5B,EAAQ,UACL,QAAQ,CAAE,UAAW,IAAS,EAAc,IAAI,CAChD,QAAS,GAAa,CACrB,EAAU,KAAK,CACb,MAAO,EAAS,MAChB,KAAM,EAAS,KACf,OAAQ,EAAqB,KAC7B,iBAAkB,EAAS,iBAC5B,CAAC,EACF,CAEJ,EAAQ,QAAQ,QAAS,GAAW,CAClC,EAAQ,KAAK,CACX,KAAM,EAAO,KACb,OAAQ,EAAqB,KAC7B,iBAAkB,EAAO,iBAC1B,CAAC,EACF,EACF,CAGF,EAAmB,EAAQ,CACzB,aAAc,EACd,UACD,CAAC,CAEF,EAAO,KACL,EAAO,MACL,sBAAsB,EAAU,OAAO,kBAAkB,EAAQ,OAAO,oBAAoB,EAAO,GACpG,CACF"}
@@ -0,0 +1,2 @@
1
+ import{t as e}from"./logger-B-LXIf3U.mjs";import{t}from"./readCsv-D1e7WRTc.mjs";import{t as n}from"./markRequestDataSiloIdsCompleted-DMme9TUi.mjs";import{t as r}from"./done-input-validation-CvwjeRWr.mjs";import i from"colors";import*as a from"io-ts";const o=a.type({"Request Id":a.string});async function s({auth:a,dataSiloId:s,file:c,transcendUrl:l}){r(this.process.exit),e.info(i.magenta(`Reading "${c}" from disk`)),await n({requestIds:t(c,o).map(e=>e[`Request Id`]),transcendUrl:l,auth:a,dataSiloId:s})}export{s as markRequestDataSilosCompleted};
2
+ //# sourceMappingURL=impl-B7Jx1VJT.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"impl-CBFgXSWV.mjs","names":[],"sources":["../src/commands/request/system/mark-request-data-silos-completed/impl.ts"],"sourcesContent":["import colors from 'colors';\nimport * as t from 'io-ts';\n\nimport type { LocalContext } from '../../../../context.js';\nimport { doneInputValidation } from '../../../../lib/cli/done-input-validation.js';\nimport { markRequestDataSiloIdsCompleted } from '../../../../lib/cron/index.js';\nimport { readCsv } from '../../../../lib/requests/index.js';\nimport { logger } from '../../../../logger.js';\n\nconst RequestIdRow = t.type({\n 'Request Id': t.string,\n});\n\nexport interface MarkRequestDataSilosCompletedCommandFlags {\n auth: string;\n dataSiloId: string;\n file: string;\n transcendUrl: string;\n}\n\nexport async function markRequestDataSilosCompleted(\n this: LocalContext,\n { auth, dataSiloId, file, transcendUrl }: MarkRequestDataSilosCompletedCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n logger.info(colors.magenta(`Reading \"${file}\" from disk`));\n const activeResults = readCsv(file, RequestIdRow);\n\n await markRequestDataSiloIdsCompleted({\n requestIds: activeResults.map((request) => request['Request Id']),\n transcendUrl,\n auth,\n dataSiloId,\n });\n}\n"],"mappings":"0PASA,MAAM,EAAe,EAAE,KAAK,CAC1B,aAAc,EAAE,OACjB,CAAC,CASF,eAAsB,EAEpB,CAAE,OAAM,aAAY,OAAM,gBACX,CACf,EAAoB,KAAK,QAAQ,KAAK,CAEtC,EAAO,KAAK,EAAO,QAAQ,YAAY,EAAK,aAAa,CAAC,CAG1D,MAAM,EAAgC,CACpC,WAHoB,EAAQ,EAAM,EAGT,CAAC,IAAK,GAAY,EAAQ,cAAc,CACjE,eACA,OACA,aACD,CAAC"}
1
+ {"version":3,"file":"impl-B7Jx1VJT.mjs","names":[],"sources":["../src/commands/request/system/mark-request-data-silos-completed/impl.ts"],"sourcesContent":["import colors from 'colors';\nimport * as t from 'io-ts';\n\nimport type { LocalContext } from '../../../../context.js';\nimport { doneInputValidation } from '../../../../lib/cli/done-input-validation.js';\nimport { markRequestDataSiloIdsCompleted } from '../../../../lib/cron/index.js';\nimport { readCsv } from '../../../../lib/requests/index.js';\nimport { logger } from '../../../../logger.js';\n\nconst RequestIdRow = t.type({\n 'Request Id': t.string,\n});\n\nexport interface MarkRequestDataSilosCompletedCommandFlags {\n auth: string;\n dataSiloId: string;\n file: string;\n transcendUrl: string;\n}\n\nexport async function markRequestDataSilosCompleted(\n this: LocalContext,\n { auth, dataSiloId, file, transcendUrl }: MarkRequestDataSilosCompletedCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n logger.info(colors.magenta(`Reading \"${file}\" from disk`));\n const activeResults = readCsv(file, RequestIdRow);\n\n await markRequestDataSiloIdsCompleted({\n requestIds: activeResults.map((request) => request['Request Id']),\n transcendUrl,\n auth,\n dataSiloId,\n });\n}\n"],"mappings":"0PASA,MAAM,EAAe,EAAE,KAAK,CAC1B,aAAc,EAAE,OACjB,CAAC,CASF,eAAsB,EAEpB,CAAE,OAAM,aAAY,OAAM,gBACX,CACf,EAAoB,KAAK,QAAQ,KAAK,CAEtC,EAAO,KAAK,EAAO,QAAQ,YAAY,EAAK,aAAa,CAAC,CAG1D,MAAM,EAAgC,CACpC,WAHoB,EAAQ,EAAM,EAGT,CAAC,IAAK,GAAY,EAAQ,cAAc,CACjE,eACA,OACA,aACD,CAAC"}
@@ -1,4 +1,4 @@
1
- import{t as e}from"./constants-BX7PrKxC.mjs";import{t}from"./logger-D1tXVwJj.mjs";import{t as n}from"./done-input-validation-D25TzrxG.mjs";import{n as r}from"./constants-2MiVdjAH.mjs";import i from"colors";import{buildTranscendGraphQLClient as a,fetchActiveSiloDiscoPlugin as o,uploadSiloDiscoveryResults as s}from"@transcend-io/sdk";import c from"fast-glob";import{stringify as l}from"query-string";async function u({scanPath:e,fileGlobs:n,ignoreDirs:r,config:i}){let{ignoreDirs:a,supportedFiles:o,scanFunction:s}=i,l=n===``?o:o.concat(n.split(`,`)),d=[...r.split(`,`),...a].filter(e=>e.length>0);try{let n=await c(`${e}/**/${l.join(`|`)}`,{ignore:d.map(t=>`${e}/**/${t}`),unique:!0,onlyFiles:!0});t.info(`Scanning: ${n.length} files`);let r=n.map(e=>s(e)).flat().map(e=>e.softwareDevelopmentKits||[]).flat(),i=[...new Set(r.map(e=>e.name))];return t.info(`Found: ${i.length} unique dependencies`),i.map(t=>({name:t,resourceId:`${e}/**/${t}`,useStrictClassifier:!0}))}catch(e){throw Error(`Error scanning globs ${u} with error: ${e}`)}}async function d({scanPath:c,dataSiloId:d,auth:f,fileGlobs:p,ignoreDirs:m,transcendUrl:h}){n(this.process.exit);let g=a(h,f),_=await o(g,{logger:t,filterBy:{dataSiloId:d}}),v=r[_.dataSilo.type];v||(t.error(i.red(`This plugin "${_.dataSilo.type}" is not supported for offline silo discovery.`)),this.process.exit(1));let y=await u({scanPath:c,fileGlobs:p,ignoreDirs:m,config:v});await s(g,{pluginId:_.id,results:y,logger:t});let b=new URL(e);b.pathname=`/data-map/data-inventory/silo-discovery/triage`,b.search=l({filters:JSON.stringify({pluginIds:[_.id]})}),t.info(i.green(`Scan found ${y.length} potential data silos at ${c}! View at '${b.href}'
1
+ import{t as e}from"./constants-DJolQYDN.mjs";import{t}from"./logger-B-LXIf3U.mjs";import{t as n}from"./done-input-validation-CvwjeRWr.mjs";import{n as r}from"./constants-DXUo-hl3.mjs";import i from"colors";import{buildTranscendGraphQLClient as a,fetchActiveSiloDiscoPlugin as o,uploadSiloDiscoveryResults as s}from"@transcend-io/sdk";import c from"fast-glob";import{stringify as l}from"query-string";async function u({scanPath:e,fileGlobs:n,ignoreDirs:r,config:i}){let{ignoreDirs:a,supportedFiles:o,scanFunction:s}=i,l=n===``?o:o.concat(n.split(`,`)),d=[...r.split(`,`),...a].filter(e=>e.length>0);try{let n=await c(`${e}/**/${l.join(`|`)}`,{ignore:d.map(t=>`${e}/**/${t}`),unique:!0,onlyFiles:!0});t.info(`Scanning: ${n.length} files`);let r=n.map(e=>s(e)).flat().map(e=>e.softwareDevelopmentKits||[]).flat(),i=[...new Set(r.map(e=>e.name))];return t.info(`Found: ${i.length} unique dependencies`),i.map(t=>({name:t,resourceId:`${e}/**/${t}`,useStrictClassifier:!0}))}catch(e){throw Error(`Error scanning globs ${u} with error: ${e}`)}}async function d({scanPath:c,dataSiloId:d,auth:f,fileGlobs:p,ignoreDirs:m,transcendUrl:h}){n(this.process.exit);let g=a(h,f),_=await o(g,{logger:t,filterBy:{dataSiloId:d}}),v=r[_.dataSilo.type];v||(t.error(i.red(`This plugin "${_.dataSilo.type}" is not supported for offline silo discovery.`)),this.process.exit(1));let y=await u({scanPath:c,fileGlobs:p,ignoreDirs:m,config:v});await s(g,{pluginId:_.id,results:y,logger:t});let b=new URL(e);b.pathname=`/data-map/data-inventory/silo-discovery/triage`,b.search=l({filters:JSON.stringify({pluginIds:[_.id]})}),t.info(i.green(`Scan found ${y.length} potential data silos at ${c}! View at '${b.href}'
2
2
 
3
3
  NOTE: it may take 2-3 minutes for scan results to appear in the UI.`))}export{d as discoverSilos};
4
- //# sourceMappingURL=impl-D7GBtInJ.mjs.map
4
+ //# sourceMappingURL=impl-BANdTEit.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"impl-D7GBtInJ.mjs","names":[],"sources":["../src/lib/code-scanning/findFilesToScan.ts","../src/commands/inventory/discover-silos/impl.ts"],"sourcesContent":["import fastGlob from 'fast-glob';\n\nimport { logger } from '../../logger.js';\nimport { CodeScanningConfig } from './types.js';\n\nexport interface SiloDiscoveryRawResults {\n /** The name of the potential data silo entry */\n name: string;\n /** A unique UUID (represents the same resource across different silo discovery runs) */\n resourceId: string;\n /** Any hosts associated with the entry */\n host?: string;\n /** Type of data silo */\n type?: string | undefined;\n}\n\n/**\n * Helper to scan for data silos in all package.json files that it can find in a directory\n *\n * @deprecated TODO: https://transcend.height.app/T-32325 - use code scanning instead\n * @param options - Options\n * @returns the list of integrations\n */\nexport async function findFilesToScan({\n scanPath,\n fileGlobs,\n ignoreDirs,\n config,\n}: {\n /** Where to look for package.json files */\n scanPath: string;\n /** Globs to look for */\n fileGlobs: string;\n /** The directories to ignore (excludes node_modules and serverless-build) */\n ignoreDirs: string;\n /** Silo Discovery configuration */\n config: CodeScanningConfig;\n}): Promise<SiloDiscoveryRawResults[]> {\n const { ignoreDirs: IGNORE_DIRS, supportedFiles, scanFunction } = config;\n const globsToSupport =\n fileGlobs === '' ? supportedFiles : supportedFiles.concat(fileGlobs.split(','));\n const dirsToIgnore = [...ignoreDirs.split(','), ...IGNORE_DIRS].filter((dir) => dir.length > 0);\n try {\n const filesToScan: string[] = await fastGlob(`${scanPath}/**/${globsToSupport.join('|')}`, {\n ignore: dirsToIgnore.map((dir: string) => `${scanPath}/**/${dir}`),\n unique: true,\n onlyFiles: true,\n });\n logger.info(`Scanning: ${filesToScan.length} files`);\n const allPackages = filesToScan.map((filePath: string) => scanFunction(filePath)).flat();\n const allSdks = allPackages\n .map((appPackage) => appPackage.softwareDevelopmentKits || [])\n .flat();\n const uniqueDeps = new Set(allSdks.map((sdk) => sdk.name));\n const deps = [...uniqueDeps];\n logger.info(`Found: ${deps.length} unique dependencies`);\n return deps.map((dep) => ({\n name: dep,\n resourceId: `${scanPath}/**/${dep}`,\n useStrictClassifier: true,\n }));\n } catch (error) {\n throw new Error(`Error scanning globs ${findFilesToScan} with error: ${error}`);\n }\n}\n","import {\n buildTranscendGraphQLClient,\n fetchActiveSiloDiscoPlugin,\n uploadSiloDiscoveryResults,\n} from '@transcend-io/sdk';\nimport colors from 'colors';\nimport { stringify } from 'query-string';\n\nimport { ADMIN_DASH } from '../../../constants.js';\nimport type { LocalContext } from '../../../context.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { findFilesToScan } from '../../../lib/code-scanning/findFilesToScan.js';\nimport { SILO_DISCOVERY_CONFIGS } from '../../../lib/code-scanning/index.js';\nimport { logger } from '../../../logger.js';\n\nexport interface DiscoverSilosCommandFlags {\n scanPath: string;\n dataSiloId: string;\n auth: string;\n fileGlobs: string;\n ignoreDirs: string;\n transcendUrl: string;\n}\n\nexport async function discoverSilos(\n this: LocalContext,\n { scanPath, dataSiloId, auth, fileGlobs, ignoreDirs, transcendUrl }: DiscoverSilosCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n // Create a GraphQL client\n const client = buildTranscendGraphQLClient(transcendUrl, auth);\n\n const plugin = await fetchActiveSiloDiscoPlugin(client, {\n logger,\n filterBy: { dataSiloId },\n });\n\n const config = SILO_DISCOVERY_CONFIGS[plugin.dataSilo.type];\n if (!config) {\n logger.error(\n colors.red(\n `This plugin \"${plugin.dataSilo.type}\" is not supported for offline silo discovery.`,\n ),\n );\n this.process.exit(1);\n }\n\n const results = await findFilesToScan({\n scanPath,\n fileGlobs,\n ignoreDirs,\n config,\n });\n\n await uploadSiloDiscoveryResults(client, {\n pluginId: plugin.id,\n results,\n logger,\n });\n\n const newUrl = new URL(ADMIN_DASH);\n newUrl.pathname = '/data-map/data-inventory/silo-discovery/triage';\n newUrl.search = stringify({\n filters: JSON.stringify({ pluginIds: [plugin.id] }),\n });\n\n // Indicate success\n logger.info(\n colors.green(\n `Scan found ${results.length} potential data silos at ${scanPath}! ` +\n `View at '${newUrl.href}' ` +\n '\\n\\n NOTE: it may take 2-3 minutes for scan results to appear in the UI.',\n ),\n );\n}\n"],"mappings":"gZAuBA,eAAsB,EAAgB,CACpC,WACA,YACA,aACA,UAUqC,CACrC,GAAM,CAAE,WAAY,EAAa,iBAAgB,gBAAiB,EAC5D,EACJ,IAAc,GAAK,EAAiB,EAAe,OAAO,EAAU,MAAM,IAAI,CAAC,CAC3E,EAAe,CAAC,GAAG,EAAW,MAAM,IAAI,CAAE,GAAG,EAAY,CAAC,OAAQ,GAAQ,EAAI,OAAS,EAAE,CAC/F,GAAI,CACF,IAAM,EAAwB,MAAM,EAAS,GAAG,EAAS,MAAM,EAAe,KAAK,IAAI,GAAI,CACzF,OAAQ,EAAa,IAAK,GAAgB,GAAG,EAAS,MAAM,IAAM,CAClE,OAAQ,GACR,UAAW,GACZ,CAAC,CACF,EAAO,KAAK,aAAa,EAAY,OAAO,QAAQ,CAEpD,IAAM,EADc,EAAY,IAAK,GAAqB,EAAa,EAAS,CAAC,CAAC,MACvD,CACxB,IAAK,GAAe,EAAW,yBAA2B,EAAE,CAAC,CAC7D,MAAM,CAEH,EAAO,CAAC,GAAG,IADM,IAAI,EAAQ,IAAK,GAAQ,EAAI,KAAK,CAC9B,CAAC,CAE5B,OADA,EAAO,KAAK,UAAU,EAAK,OAAO,sBAAsB,CACjD,EAAK,IAAK,IAAS,CACxB,KAAM,EACN,WAAY,GAAG,EAAS,MAAM,IAC9B,oBAAqB,GACtB,EAAE,OACI,EAAO,CACd,MAAU,MAAM,wBAAwB,EAAgB,eAAe,IAAQ,ECtCnF,eAAsB,EAEpB,CAAE,WAAU,aAAY,OAAM,YAAW,aAAY,gBACtC,CACf,EAAoB,KAAK,QAAQ,KAAK,CAGtC,IAAM,EAAS,EAA4B,EAAc,EAAK,CAExD,EAAS,MAAM,EAA2B,EAAQ,CACtD,SACA,SAAU,CAAE,aAAY,CACzB,CAAC,CAEI,EAAS,EAAuB,EAAO,SAAS,MACjD,IACH,EAAO,MACL,EAAO,IACL,gBAAgB,EAAO,SAAS,KAAK,gDACtC,CACF,CACD,KAAK,QAAQ,KAAK,EAAE,EAGtB,IAAM,EAAU,MAAM,EAAgB,CACpC,WACA,YACA,aACA,SACD,CAAC,CAEF,MAAM,EAA2B,EAAQ,CACvC,SAAU,EAAO,GACjB,UACA,SACD,CAAC,CAEF,IAAM,EAAS,IAAI,IAAI,EAAW,CAClC,EAAO,SAAW,iDAClB,EAAO,OAAS,EAAU,CACxB,QAAS,KAAK,UAAU,CAAE,UAAW,CAAC,EAAO,GAAG,CAAE,CAAC,CACpD,CAAC,CAGF,EAAO,KACL,EAAO,MACL,cAAc,EAAQ,OAAO,2BAA2B,EAAS,aACnD,EAAO,KAAK;;sEAE3B,CACF"}
1
+ {"version":3,"file":"impl-BANdTEit.mjs","names":[],"sources":["../src/lib/code-scanning/findFilesToScan.ts","../src/commands/inventory/discover-silos/impl.ts"],"sourcesContent":["import fastGlob from 'fast-glob';\n\nimport { logger } from '../../logger.js';\nimport { CodeScanningConfig } from './types.js';\n\nexport interface SiloDiscoveryRawResults {\n /** The name of the potential data silo entry */\n name: string;\n /** A unique UUID (represents the same resource across different silo discovery runs) */\n resourceId: string;\n /** Any hosts associated with the entry */\n host?: string;\n /** Type of data silo */\n type?: string | undefined;\n}\n\n/**\n * Helper to scan for data silos in all package.json files that it can find in a directory\n *\n * @deprecated TODO: https://transcend.height.app/T-32325 - use code scanning instead\n * @param options - Options\n * @returns the list of integrations\n */\nexport async function findFilesToScan({\n scanPath,\n fileGlobs,\n ignoreDirs,\n config,\n}: {\n /** Where to look for package.json files */\n scanPath: string;\n /** Globs to look for */\n fileGlobs: string;\n /** The directories to ignore (excludes node_modules and serverless-build) */\n ignoreDirs: string;\n /** Silo Discovery configuration */\n config: CodeScanningConfig;\n}): Promise<SiloDiscoveryRawResults[]> {\n const { ignoreDirs: IGNORE_DIRS, supportedFiles, scanFunction } = config;\n const globsToSupport =\n fileGlobs === '' ? supportedFiles : supportedFiles.concat(fileGlobs.split(','));\n const dirsToIgnore = [...ignoreDirs.split(','), ...IGNORE_DIRS].filter((dir) => dir.length > 0);\n try {\n const filesToScan: string[] = await fastGlob(`${scanPath}/**/${globsToSupport.join('|')}`, {\n ignore: dirsToIgnore.map((dir: string) => `${scanPath}/**/${dir}`),\n unique: true,\n onlyFiles: true,\n });\n logger.info(`Scanning: ${filesToScan.length} files`);\n const allPackages = filesToScan.map((filePath: string) => scanFunction(filePath)).flat();\n const allSdks = allPackages\n .map((appPackage) => appPackage.softwareDevelopmentKits || [])\n .flat();\n const uniqueDeps = new Set(allSdks.map((sdk) => sdk.name));\n const deps = [...uniqueDeps];\n logger.info(`Found: ${deps.length} unique dependencies`);\n return deps.map((dep) => ({\n name: dep,\n resourceId: `${scanPath}/**/${dep}`,\n useStrictClassifier: true,\n }));\n } catch (error) {\n throw new Error(`Error scanning globs ${findFilesToScan} with error: ${error}`);\n }\n}\n","import {\n buildTranscendGraphQLClient,\n fetchActiveSiloDiscoPlugin,\n uploadSiloDiscoveryResults,\n} from '@transcend-io/sdk';\nimport colors from 'colors';\nimport { stringify } from 'query-string';\n\nimport { ADMIN_DASH } from '../../../constants.js';\nimport type { LocalContext } from '../../../context.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { findFilesToScan } from '../../../lib/code-scanning/findFilesToScan.js';\nimport { SILO_DISCOVERY_CONFIGS } from '../../../lib/code-scanning/index.js';\nimport { logger } from '../../../logger.js';\n\nexport interface DiscoverSilosCommandFlags {\n scanPath: string;\n dataSiloId: string;\n auth: string;\n fileGlobs: string;\n ignoreDirs: string;\n transcendUrl: string;\n}\n\nexport async function discoverSilos(\n this: LocalContext,\n { scanPath, dataSiloId, auth, fileGlobs, ignoreDirs, transcendUrl }: DiscoverSilosCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n // Create a GraphQL client\n const client = buildTranscendGraphQLClient(transcendUrl, auth);\n\n const plugin = await fetchActiveSiloDiscoPlugin(client, {\n logger,\n filterBy: { dataSiloId },\n });\n\n const config = SILO_DISCOVERY_CONFIGS[plugin.dataSilo.type];\n if (!config) {\n logger.error(\n colors.red(\n `This plugin \"${plugin.dataSilo.type}\" is not supported for offline silo discovery.`,\n ),\n );\n this.process.exit(1);\n }\n\n const results = await findFilesToScan({\n scanPath,\n fileGlobs,\n ignoreDirs,\n config,\n });\n\n await uploadSiloDiscoveryResults(client, {\n pluginId: plugin.id,\n results,\n logger,\n });\n\n const newUrl = new URL(ADMIN_DASH);\n newUrl.pathname = '/data-map/data-inventory/silo-discovery/triage';\n newUrl.search = stringify({\n filters: JSON.stringify({ pluginIds: [plugin.id] }),\n });\n\n // Indicate success\n logger.info(\n colors.green(\n `Scan found ${results.length} potential data silos at ${scanPath}! ` +\n `View at '${newUrl.href}' ` +\n '\\n\\n NOTE: it may take 2-3 minutes for scan results to appear in the UI.',\n ),\n );\n}\n"],"mappings":"gZAuBA,eAAsB,EAAgB,CACpC,WACA,YACA,aACA,UAUqC,CACrC,GAAM,CAAE,WAAY,EAAa,iBAAgB,gBAAiB,EAC5D,EACJ,IAAc,GAAK,EAAiB,EAAe,OAAO,EAAU,MAAM,IAAI,CAAC,CAC3E,EAAe,CAAC,GAAG,EAAW,MAAM,IAAI,CAAE,GAAG,EAAY,CAAC,OAAQ,GAAQ,EAAI,OAAS,EAAE,CAC/F,GAAI,CACF,IAAM,EAAwB,MAAM,EAAS,GAAG,EAAS,MAAM,EAAe,KAAK,IAAI,GAAI,CACzF,OAAQ,EAAa,IAAK,GAAgB,GAAG,EAAS,MAAM,IAAM,CAClE,OAAQ,GACR,UAAW,GACZ,CAAC,CACF,EAAO,KAAK,aAAa,EAAY,OAAO,QAAQ,CAEpD,IAAM,EADc,EAAY,IAAK,GAAqB,EAAa,EAAS,CAAC,CAAC,MACvD,CACxB,IAAK,GAAe,EAAW,yBAA2B,EAAE,CAAC,CAC7D,MAAM,CAEH,EAAO,CAAC,GAAG,IADM,IAAI,EAAQ,IAAK,GAAQ,EAAI,KAAK,CAC9B,CAAC,CAE5B,OADA,EAAO,KAAK,UAAU,EAAK,OAAO,sBAAsB,CACjD,EAAK,IAAK,IAAS,CACxB,KAAM,EACN,WAAY,GAAG,EAAS,MAAM,IAC9B,oBAAqB,GACtB,EAAE,OACI,EAAO,CACd,MAAU,MAAM,wBAAwB,EAAgB,eAAe,IAAQ,ECtCnF,eAAsB,EAEpB,CAAE,WAAU,aAAY,OAAM,YAAW,aAAY,gBACtC,CACf,EAAoB,KAAK,QAAQ,KAAK,CAGtC,IAAM,EAAS,EAA4B,EAAc,EAAK,CAExD,EAAS,MAAM,EAA2B,EAAQ,CACtD,SACA,SAAU,CAAE,aAAY,CACzB,CAAC,CAEI,EAAS,EAAuB,EAAO,SAAS,MACjD,IACH,EAAO,MACL,EAAO,IACL,gBAAgB,EAAO,SAAS,KAAK,gDACtC,CACF,CACD,KAAK,QAAQ,KAAK,EAAE,EAGtB,IAAM,EAAU,MAAM,EAAgB,CACpC,WACA,YACA,aACA,SACD,CAAC,CAEF,MAAM,EAA2B,EAAQ,CACvC,SAAU,EAAO,GACjB,UACA,SACD,CAAC,CAEF,IAAM,EAAS,IAAI,IAAI,EAAW,CAClC,EAAO,SAAW,iDAClB,EAAO,OAAS,EAAU,CACxB,QAAS,KAAK,UAAU,CAAE,UAAW,CAAC,EAAO,GAAG,CAAE,CAAC,CACpD,CAAC,CAGF,EAAO,KACL,EAAO,MACL,cAAc,EAAQ,OAAO,2BAA2B,EAAS,aACnD,EAAO,KAAK;;sEAE3B,CACF"}
@@ -1,2 +1,2 @@
1
- import{t as e}from"./logger-D1tXVwJj.mjs";import{t}from"./done-input-validation-D25TzrxG.mjs";import{n,r}from"./runOpa-NnuspgN0.mjs";import i from"node:fs";import a from"node:path";import o from"colors";async function s({pkg:s,input:c,bundle:l}){t(this.process.exit),r();let u=a.resolve(c);if(!i.existsSync(u))throw Error(`Input file not found: ${u}`);let d=[`eval`,`--format`,`pretty`,`--input`,u];l&&d.push(`-b`,a.resolve(l)),d.push(s),e.info(o.green(`Evaluating ${s} with input ${u}...`));let f=await n(d);f!==0&&this.process.exit(f)}export{s as _eval};
2
- //# sourceMappingURL=impl-DqcpxYHF.mjs.map
1
+ import{t as e}from"./logger-B-LXIf3U.mjs";import{t}from"./done-input-validation-CvwjeRWr.mjs";import{n,r}from"./runOpa-DGUkXzFZ.mjs";import i from"node:fs";import a from"node:path";import o from"colors";async function s({pkg:s,input:c,bundle:l}){t(this.process.exit),r();let u=a.resolve(c);if(!i.existsSync(u))throw Error(`Input file not found: ${u}`);let d=[`eval`,`--format`,`pretty`,`--input`,u];l&&d.push(`-b`,a.resolve(l)),d.push(s),e.info(o.green(`Evaluating ${s} with input ${u}...`));let f=await n(d);f!==0&&this.process.exit(f)}export{s as _eval};
2
+ //# sourceMappingURL=impl-BIFxlKlT.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"impl-DqcpxYHF.mjs","names":[],"sources":["../src/commands/policy/eval/impl.ts"],"sourcesContent":["import fs from 'node:fs';\nimport path from 'node:path';\n\nimport colors from 'colors';\n\nimport type { LocalContext } from '../../../context.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { logger } from '../../../logger.js';\nimport { assertOpaInstalled, runOpa } from '../helpers/index.js';\n\n/** CLI flags for `transcend policy eval`. */\nexport interface EvalCommandFlags {\n /** OPA package/query to evaluate (e.g. `data.transcend.decision`) */\n pkg: string;\n /** Path to a JSON envelope input file */\n input: string;\n /** Optional local policy bundle directory */\n bundle?: string;\n}\n\n/**\n * Evaluate one envelope against a local policy bundle via `opa eval`.\n *\n * @param this - CLI context\n * @param flags - Command flags\n */\nexport async function _eval(\n this: LocalContext,\n { pkg, input, bundle }: EvalCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n assertOpaInstalled();\n\n const inputPath = path.resolve(input);\n if (!fs.existsSync(inputPath)) {\n throw new Error(`Input file not found: ${inputPath}`);\n }\n\n const args = ['eval', '--format', 'pretty', '--input', inputPath];\n if (bundle) {\n args.push('-b', path.resolve(bundle));\n }\n args.push(pkg);\n\n logger.info(colors.green(`Evaluating ${pkg} with input ${inputPath}...`));\n\n const exitCode = await runOpa(args);\n if (exitCode !== 0) {\n this.process.exit(exitCode);\n }\n}\n"],"mappings":"2MA0BA,eAAsB,EAEpB,CAAE,MAAK,QAAO,UACC,CACf,EAAoB,KAAK,QAAQ,KAAK,CAEtC,GAAoB,CAEpB,IAAM,EAAY,EAAK,QAAQ,EAAM,CACrC,GAAI,CAAC,EAAG,WAAW,EAAU,CAC3B,MAAU,MAAM,yBAAyB,IAAY,CAGvD,IAAM,EAAO,CAAC,OAAQ,WAAY,SAAU,UAAW,EAAU,CAC7D,GACF,EAAK,KAAK,KAAM,EAAK,QAAQ,EAAO,CAAC,CAEvC,EAAK,KAAK,EAAI,CAEd,EAAO,KAAK,EAAO,MAAM,cAAc,EAAI,cAAc,EAAU,KAAK,CAAC,CAEzE,IAAM,EAAW,MAAM,EAAO,EAAK,CAC/B,IAAa,GACf,KAAK,QAAQ,KAAK,EAAS"}
1
+ {"version":3,"file":"impl-BIFxlKlT.mjs","names":[],"sources":["../src/commands/policy/eval/impl.ts"],"sourcesContent":["import fs from 'node:fs';\nimport path from 'node:path';\n\nimport colors from 'colors';\n\nimport type { LocalContext } from '../../../context.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { logger } from '../../../logger.js';\nimport { assertOpaInstalled, runOpa } from '../helpers/index.js';\n\n/** CLI flags for `transcend policy eval`. */\nexport interface EvalCommandFlags {\n /** OPA package/query to evaluate (e.g. `data.transcend.decision`) */\n pkg: string;\n /** Path to a JSON envelope input file */\n input: string;\n /** Optional local policy bundle directory */\n bundle?: string;\n}\n\n/**\n * Evaluate one envelope against a local policy bundle via `opa eval`.\n *\n * @param this - CLI context\n * @param flags - Command flags\n */\nexport async function _eval(\n this: LocalContext,\n { pkg, input, bundle }: EvalCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n assertOpaInstalled();\n\n const inputPath = path.resolve(input);\n if (!fs.existsSync(inputPath)) {\n throw new Error(`Input file not found: ${inputPath}`);\n }\n\n const args = ['eval', '--format', 'pretty', '--input', inputPath];\n if (bundle) {\n args.push('-b', path.resolve(bundle));\n }\n args.push(pkg);\n\n logger.info(colors.green(`Evaluating ${pkg} with input ${inputPath}...`));\n\n const exitCode = await runOpa(args);\n if (exitCode !== 0) {\n this.process.exit(exitCode);\n }\n}\n"],"mappings":"2MA0BA,eAAsB,EAEpB,CAAE,MAAK,QAAO,UACC,CACf,EAAoB,KAAK,QAAQ,KAAK,CAEtC,GAAoB,CAEpB,IAAM,EAAY,EAAK,QAAQ,EAAM,CACrC,GAAI,CAAC,EAAG,WAAW,EAAU,CAC3B,MAAU,MAAM,yBAAyB,IAAY,CAGvD,IAAM,EAAO,CAAC,OAAQ,WAAY,SAAU,UAAW,EAAU,CAC7D,GACF,EAAK,KAAK,KAAM,EAAK,QAAQ,EAAO,CAAC,CAEvC,EAAK,KAAK,EAAI,CAEd,EAAO,KAAK,EAAO,MAAM,cAAc,EAAI,cAAc,EAAU,KAAK,CAAC,CAEzE,IAAM,EAAW,MAAM,EAAO,EAAK,CAC/B,IAAa,GACf,KAAK,QAAQ,KAAK,EAAS"}
@@ -1,7 +1,7 @@
1
- import{t as e}from"./logger-D1tXVwJj.mjs";import{n as t}from"./parseAttributesFromString-COM7aBEj.mjs";import{t as n}from"./readCsv-ddmavI86.mjs";import{n as r}from"./inquirer-BWDP2HHw.mjs";import{t as i}from"./done-input-validation-D25TzrxG.mjs";import{PreferenceTopicType as a}from"@transcend-io/privacy-types";import{chunk as o,difference as s,groupBy as c,keyBy as l,uniq as u}from"lodash-es";import{apply as d}from"@transcend-io/type-utils";import{readdirSync as f}from"node:fs";import{basename as p,join as m}from"node:path";import h from"colors";import*as g from"io-ts";import{PreferenceState as _,buildTranscendGraphQLClient as v,checkIfPendingPreferenceUpdatesAreNoOp as y,checkIfPendingPreferenceUpdatesCauseConflict as b,createSombraGotInstance as x,fetchAllPreferenceTopics as S,fetchAllPurposes as C,getPreferenceUpdatesFromRow as w,getPreferencesForIdentifiers as T}from"@transcend-io/sdk";import{map as E,mapSeries as D,splitCsvToList as O}from"@transcend-io/utils";import k from"cli-progress";import A from"inquirer";import{PersistedState as j}from"@transcend-io/persisted-state";async function M(t,n,{purposeSlugs:r,preferenceTopics:i,forceTriggerWorkflows:o}){let c=s(u(t.map(e=>Object.keys(e)).flat()),[...n.identifierColumn?[n.identifierColumn]:[],...n.timestampColum?[n.timestampColum]:[]]);if(c.length===0){if(o)return n;throw Error(`No other columns to process`)}let l=[...r,...i.map(e=>`${e.purpose.trackingType}->${e.slug}`)];return await D(c,async o=>{let s=u(t.map(e=>e[o])),c=n.columnToPurposeName[o];if(c)e.info(h.magenta(`Column "${o}" is associated with purpose "${c.purpose}"`));else{let{purposeName:e}=await A.prompt([{name:`purposeName`,message:`Choose the purpose that column ${o} is associated with`,type:`list`,default:l.find(e=>e.startsWith(r[0])),choices:l}]),[t,n]=e.split(`->`);c={purpose:t,preference:n||null,valueMapping:{}}}await D(s,async t=>{if(c.valueMapping[t]!==void 0){e.info(h.magenta(`Value "${t}" is associated with purpose value "${c.valueMapping[t]}"`));return}if(c.preference===null){let{purposeValue:e}=await A.prompt([{name:`purposeValue`,message:`Choose the purpose value for value "${t}" associated with purpose "${c.purpose}"`,type:`confirm`,default:t!==`false`}]);c.valueMapping[t]=e}if(c.preference!==null){let n=i.find(e=>e.slug===c.preference);if(!n){e.error(h.red(`Preference topic "${c.preference}" not found`));return}let r=n.preferenceOptionValues.map(({slug:e})=>e);if(n.type===a.Boolean){let{preferenceValue:e}=await A.prompt([{name:`preferenceValue`,message:`Choose the preference value for "${n.slug}" value "${t}" associated with purpose "${c.purpose}"`,type:`confirm`,default:t!==`false`}]);c.valueMapping[t]=e;return}if(n.type===a.Select){let{preferenceValue:e}=await A.prompt([{name:`preferenceValue`,message:`Choose the preference value for "${n.slug}" value "${t}" associated with purpose "${c.purpose}"`,type:`list`,choices:r,default:r.find(e=>e===t)}]);c.valueMapping[t]=e;return}if(n.type===a.MultiSelect){await D(O(t),async e=>{if(c.valueMapping[e]!==void 0)return;let{preferenceValue:t}=await A.prompt([{name:`preferenceValue`,message:`Choose the preference value for "${n.slug}" value "${e}" associated with purpose "${c.purpose}"`,type:`list`,choices:r,default:r.find(t=>t===e)}]);c.valueMapping[e]=t});return}throw Error(`Unknown preference topic type: ${n.type}`)}}),n.columnToPurposeName[o]=c}),n}async function N(t,n){let i=s(u(t.map(e=>Object.keys(e)).flat()),[...n.identifierColumn?[n.identifierColumn]:[],...Object.keys(n.columnToPurposeName)]);if(!n.identifierColumn){let{identifierName:e}=await A.prompt([{name:`identifierName`,message:`Choose the column that will be used as the identifier to upload consent preferences by`,type:`list`,default:i.find(e=>e.toLowerCase().includes(`email`))||i[0],choices:i}]);n.identifierColumn=e}e.info(h.magenta(`Using identifier column "${n.identifierColumn}"`));let a=t.map((e,t)=>e[n.identifierColumn]?null:[t]).filter(e=>!!e).flat();if(a.length>0){let i=`The identifier column "${n.identifierColumn}" is missing a value for the following rows: ${a.join(`, `)}`;if(e.warn(h.yellow(i)),!await r({message:`Would you like to skip rows missing an identifier?`}))throw Error(i);let o=t.length;t=t.filter(e=>e[n.identifierColumn]),e.info(h.yellow(`Skipped ${o-t.length} rows missing an identifier`))}e.info(h.magenta(`The identifier column "${n.identifierColumn}" is present for all rows`));let o=c(t,n.identifierColumn),l=Object.entries(o).filter(([,e])=>e.length>1);if(l.length>0){let i=`The identifier column "${n.identifierColumn}" has duplicate values for the following rows: ${l.slice(0,10).map(([e,t])=>`${e} (${t.length})`).join(`
1
+ import{t as e}from"./logger-B-LXIf3U.mjs";import{n as t}from"./parseAttributesFromString-ByzY22WY.mjs";import{t as n}from"./readCsv-D1e7WRTc.mjs";import{n as r}from"./inquirer-CXl1YWCs.mjs";import{t as i}from"./done-input-validation-CvwjeRWr.mjs";import{PreferenceTopicType as a}from"@transcend-io/privacy-types";import{chunk as o,difference as s,groupBy as c,keyBy as l,uniq as u}from"lodash-es";import{apply as d}from"@transcend-io/type-utils";import{readdirSync as f}from"node:fs";import{basename as p,join as m}from"node:path";import h from"colors";import*as g from"io-ts";import{PreferenceState as _,buildTranscendGraphQLClient as v,checkIfPendingPreferenceUpdatesAreNoOp as y,checkIfPendingPreferenceUpdatesCauseConflict as b,createSombraGotInstance as x,fetchAllPreferenceTopics as S,fetchAllPurposes as C,getPreferenceUpdatesFromRow as w,getPreferencesForIdentifiers as T}from"@transcend-io/sdk";import{map as E,mapSeries as D,splitCsvToList as O}from"@transcend-io/utils";import k from"cli-progress";import A from"inquirer";import{PersistedState as j}from"@transcend-io/persisted-state";async function M(t,n,{purposeSlugs:r,preferenceTopics:i,forceTriggerWorkflows:o}){let c=s(u(t.map(e=>Object.keys(e)).flat()),[...n.identifierColumn?[n.identifierColumn]:[],...n.timestampColum?[n.timestampColum]:[]]);if(c.length===0){if(o)return n;throw Error(`No other columns to process`)}let l=[...r,...i.map(e=>`${e.purpose.trackingType}->${e.slug}`)];return await D(c,async o=>{let s=u(t.map(e=>e[o])),c=n.columnToPurposeName[o];if(c)e.info(h.magenta(`Column "${o}" is associated with purpose "${c.purpose}"`));else{let{purposeName:e}=await A.prompt([{name:`purposeName`,message:`Choose the purpose that column ${o} is associated with`,type:`list`,default:l.find(e=>e.startsWith(r[0])),choices:l}]),[t,n]=e.split(`->`);c={purpose:t,preference:n||null,valueMapping:{}}}await D(s,async t=>{if(c.valueMapping[t]!==void 0){e.info(h.magenta(`Value "${t}" is associated with purpose value "${c.valueMapping[t]}"`));return}if(c.preference===null){let{purposeValue:e}=await A.prompt([{name:`purposeValue`,message:`Choose the purpose value for value "${t}" associated with purpose "${c.purpose}"`,type:`confirm`,default:t!==`false`}]);c.valueMapping[t]=e}if(c.preference!==null){let n=i.find(e=>e.slug===c.preference);if(!n){e.error(h.red(`Preference topic "${c.preference}" not found`));return}let r=n.preferenceOptionValues.map(({slug:e})=>e);if(n.type===a.Boolean){let{preferenceValue:e}=await A.prompt([{name:`preferenceValue`,message:`Choose the preference value for "${n.slug}" value "${t}" associated with purpose "${c.purpose}"`,type:`confirm`,default:t!==`false`}]);c.valueMapping[t]=e;return}if(n.type===a.Select){let{preferenceValue:e}=await A.prompt([{name:`preferenceValue`,message:`Choose the preference value for "${n.slug}" value "${t}" associated with purpose "${c.purpose}"`,type:`list`,choices:r,default:r.find(e=>e===t)}]);c.valueMapping[t]=e;return}if(n.type===a.MultiSelect){await D(O(t),async e=>{if(c.valueMapping[e]!==void 0)return;let{preferenceValue:t}=await A.prompt([{name:`preferenceValue`,message:`Choose the preference value for "${n.slug}" value "${e}" associated with purpose "${c.purpose}"`,type:`list`,choices:r,default:r.find(t=>t===e)}]);c.valueMapping[e]=t});return}throw Error(`Unknown preference topic type: ${n.type}`)}}),n.columnToPurposeName[o]=c}),n}async function N(t,n){let i=s(u(t.map(e=>Object.keys(e)).flat()),[...n.identifierColumn?[n.identifierColumn]:[],...Object.keys(n.columnToPurposeName)]);if(!n.identifierColumn){let{identifierName:e}=await A.prompt([{name:`identifierName`,message:`Choose the column that will be used as the identifier to upload consent preferences by`,type:`list`,default:i.find(e=>e.toLowerCase().includes(`email`))||i[0],choices:i}]);n.identifierColumn=e}e.info(h.magenta(`Using identifier column "${n.identifierColumn}"`));let a=t.map((e,t)=>e[n.identifierColumn]?null:[t]).filter(e=>!!e).flat();if(a.length>0){let i=`The identifier column "${n.identifierColumn}" is missing a value for the following rows: ${a.join(`, `)}`;if(e.warn(h.yellow(i)),!await r({message:`Would you like to skip rows missing an identifier?`}))throw Error(i);let o=t.length;t=t.filter(e=>e[n.identifierColumn]),e.info(h.yellow(`Skipped ${o-t.length} rows missing an identifier`))}e.info(h.magenta(`The identifier column "${n.identifierColumn}" is present for all rows`));let o=c(t,n.identifierColumn),l=Object.entries(o).filter(([,e])=>e.length>1);if(l.length>0){let i=`The identifier column "${n.identifierColumn}" has duplicate values for the following rows: ${l.slice(0,10).map(([e,t])=>`${e} (${t.length})`).join(`
2
2
  `)}`;if(e.warn(h.yellow(i)),!await r({message:`Would you like to automatically take the latest update?`}))throw Error(i);t=Object.entries(o).map(([,e])=>e.sort((e,t)=>new Date(t[n.timestampColum]).getTime()-new Date(e[n.timestampColum]).getTime())[0]).filter(e=>e)}return{currentState:n,preferences:t}}async function P(t,n){let r=s(u(t.map(e=>Object.keys(e)).flat()),[...n.identifierColumn?[n.identifierColumn]:[],...Object.keys(n.columnToPurposeName)]);if(!n.timestampColum){let{timestampName:e}=await A.prompt([{name:`timestampName`,message:`Choose the column that will be used as the timestamp of last preference update`,type:`list`,default:r.find(e=>e.toLowerCase().includes(`date`))||r.find(e=>e.toLowerCase().includes(`time`))||r[0],choices:[...r,`[NONE]`]}]);n.timestampColum=e}if(e.info(h.magenta(`Using timestamp column "${n.timestampColum}"`)),n.timestampColum!==`[NONE]`){let r=t.map((e,t)=>e[n.timestampColum]?null:[t]).filter(e=>!!e).flat();if(r.length>0)throw Error(`The timestamp column "${n.timestampColum}" is missing a value for the following rows: ${r.join(`
3
3
  `)}`);e.info(h.magenta(`The timestamp column "${n.timestampColum}" is present for all row`))}return n}async function F({file:t,sombra:r,purposeSlugs:i,preferenceTopics:a,partitionKey:o,skipExistingRecordCheck:s,forceTriggerWorkflows:c},u){let d=new Date().getTime(),f=u.getValue(`fileMetadata`);e.info(h.magenta(`Reading in file: "${t}"`));let p=n(t,g.record(g.string,g.string)),m={columnToPurposeName:{},pendingSafeUpdates:{},pendingConflictUpdates:{},skippedUpdates:{},...f[t]||{},lastFetchedAt:new Date().toISOString()};m=await P(p,m),f[t]=m,await u.setValue(f,`fileMetadata`);let _=await N(p,m);m=_.currentState,p=_.preferences,f[t]=m,await u.setValue(f,`fileMetadata`),m=await M(p,m,{preferenceTopics:a,purposeSlugs:i,forceTriggerWorkflows:c}),f[t]=m,await u.setValue(f,`fileMetadata`);let v=p.map(e=>e[m.identifierColumn]),x=new k.SingleBar({},k.Presets.shades_classic);s||x.start(v.length,0);let S=s?[]:await T(r,{identifiers:v.map(e=>({value:e})),partitionKey:o,logger:e,onProgress:(e,t)=>x.update(e,{total:t})});x.stop();let C=l(S,`userId`);m.pendingConflictUpdates={},m.pendingSafeUpdates={},m.skippedUpdates={},p.forEach(e=>{let t=e[m.identifierColumn],n=w({row:e,columnToPurposeName:m.columnToPurposeName,preferenceTopics:a,purposeSlugs:i}),r=C[t];if(c&&!r)throw Error(`No existing consent record found for user with id: ${t}.
4
4
  When 'forceTriggerWorkflows' is set all the user identifiers should contain a consent record`);if(r&&y({currentConsentRecord:r,pendingUpdates:n,preferenceTopics:a})&&!c){m.skippedUpdates[t]=e;return}if(r&&b({currentConsentRecord:r,pendingUpdates:n,preferenceTopics:a})){m.pendingConflictUpdates[t]={row:e,record:r};return}m.pendingSafeUpdates[t]=e}),f[t]=m,await u.setValue(f,`fileMetadata`);let E=new Date().getTime();e.info(h.green(`Successfully pre-processed file: "${t}" in ${(E-d)/1e3}s`))}async function I({auth:n,sombraAuth:r,receiptFilepath:i,file:a,partition:s,isSilent:c=!0,dryRun:l=!1,skipWorkflowTriggers:u=!1,skipConflictUpdates:f=!1,skipExistingRecordCheck:p=!1,attributes:m=[],transcendUrl:g,forceTriggerWorkflows:y=!1}){let b=t(m),T=new j(i,_,{fileMetadata:{},failingUpdates:{},pendingUpdates:{}}),D=T.getValue(`failingUpdates`),O=T.getValue(`pendingUpdates`),A=T.getValue(`fileMetadata`);e.info(h.magenta(`Restored cache, there are:
5
5
  ${Object.values(D).length} failing requests to be retried\n${Object.values(O).length} pending requests to be processed\nThe following files are stored in cache and will be used:\n${Object.keys(A).map(e=>e).join(`
6
6
  `)}\nThe following file will be processed: ${a}\n`));let M=v(g,n),[N,P,I]=await Promise.all([x(g,n,{logger:e,sombraApiKey:r,sombraUrl:process.env.SOMBRA_URL}),C(M,{logger:e}),S(M,{logger:e})]);await F({file:a,purposeSlugs:P.map(e=>e.trackingType),preferenceTopics:I,sombra:N,partitionKey:s,skipExistingRecordCheck:p,forceTriggerWorkflows:y},T);let L={};A=T.getValue(`fileMetadata`);let R=A[a];if(e.info(h.magenta(`Found ${Object.entries(R.pendingSafeUpdates).length} safe updates in ${a}`)),e.info(h.magenta(`Found ${Object.entries(R.pendingConflictUpdates).length} conflict updates in ${a}`)),e.info(h.magenta(`Found ${Object.entries(R.skippedUpdates).length} skipped updates in ${a}`)),Object.entries({...R.pendingSafeUpdates,...f?{}:d(R.pendingConflictUpdates,({row:e})=>e)}).forEach(([e,t])=>{let n=R.timestampColum===`[NONE]`?new Date:new Date(t[R.timestampColum]),r=w({row:t,columnToPurposeName:R.columnToPurposeName,preferenceTopics:I,purposeSlugs:P.map(e=>e.trackingType)});L[e]={userId:e,partition:s,timestamp:n.toISOString(),purposes:Object.entries(r).map(([e,t])=>({...t,purpose:e,workflowSettings:{attributes:b,isSilent:c,skipWorkflowTrigger:u,...y?{forceTriggerWorkflow:y}:{}}}))}}),await T.setValue(L,`pendingUpdates`),await T.setValue({},`failingUpdates`),l){e.info(h.green(`Dry run complete, exiting. ${Object.values(L).length} pending updates. Check file: ${i}`));return}e.info(h.magenta(`Uploading ${Object.values(L).length} preferences to partition: ${s}`));let z=new Date().getTime(),B=new k.SingleBar({},k.Presets.shades_classic),V=0,H=Object.entries(L),U=o(H,u?100:10);B.start(H.length,0),await E(U,async t=>{try{await N.put(`v1/preferences`,{json:{records:t.map(([,e])=>e),skipWorkflowTriggers:u}}).json()}catch(n){try{let t=JSON.parse(n?.response?.body||`{}`);t.error&&e.error(h.red(`Error: ${t.error}`))}catch{}e.error(h.red(`Failed to upload ${t.length} user preferences to partition ${s}: ${n?.response?.body||n?.message}`));let r=T.getValue(`failingUpdates`);t.forEach(([e,t])=>{r[e]={uploadedAt:new Date().toISOString(),update:t,error:n?.response?.body||n?.message||`Unknown error`}}),await T.setValue(r,`failingUpdates`)}V+=t.length,B.update(V)},{concurrency:40}),B.stop();let W=new Date().getTime()-z;e.info(h.green(`Successfully uploaded ${H.length} user preferences to partition ${s} in "${W/1e3}" seconds!`))}async function L({auth:t,partition:n,sombraAuth:r,transcendUrl:a,file:o=``,directory:s,dryRun:c,skipExistingRecordCheck:l,receiptFileDir:u,skipWorkflowTriggers:d,forceTriggerWorkflows:g,skipConflictUpdates:_,isSilent:v,attributes:y,concurrency:b}){s&&o&&(e.error(h.red(`Cannot provide both a directory and a file. Please provide only one.`)),this.process.exit(1)),!o&&!s&&(e.error(h.red(`A file or directory must be provided. Please provide one using --file=./preferences.csv or --directory=./preferences`)),this.process.exit(1)),i(this.process.exit);let x=[];if(s)try{let t=f(s).filter(e=>e.endsWith(`.csv`));t.length===0&&(e.error(h.red(`No CSV files found in directory: ${s}`)),this.process.exit(1)),x.push(...t.map(e=>m(s,e)))}catch(t){e.error(h.red(`Failed to read directory: ${s}`)),e.error(h.red(t.message)),this.process.exit(1)}else try{o.endsWith(`.csv`)||(e.error(h.red(`File must be a CSV file`)),this.process.exit(1)),x.push(o)}catch(t){e.error(h.red(`Failed to access file: ${o}`)),e.error(h.red(t.message)),this.process.exit(1)}e.info(h.green(`Processing ${x.length} consent preferences files for partition: ${n}`)),e.debug(`Files to process: ${x.join(`, `)}`),l&&e.info(h.bgYellow(`Skipping existing record check: ${l}`)),await E(x,async e=>{await I({receiptFilepath:m(u,`${p(e).replace(`.csv`,``)}-receipts.json`),auth:t,sombraAuth:r,file:e,partition:n,transcendUrl:a,skipConflictUpdates:_,skipWorkflowTriggers:d,skipExistingRecordCheck:l,isSilent:v,dryRun:c,attributes:O(y),forceTriggerWorkflows:g})},{concurrency:b})}export{L as uploadPreferences};
7
- //# sourceMappingURL=impl-B0k-lsLh.mjs.map
7
+ //# sourceMappingURL=impl-BMU2cg0K.mjs.map