@transcend-io/cli 12.0.0 → 12.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (201) hide show
  1. package/README.md +160 -149
  2. package/dist/{app-CR3U95JW.mjs → app-CfJlhIn8.mjs} +18 -18
  3. package/dist/app-CfJlhIn8.mjs.map +1 -0
  4. package/dist/{approvePrivacyRequests-BDG82nlp.mjs → approvePrivacyRequests-BWj6SsgX.mjs} +2 -2
  5. package/dist/{approvePrivacyRequests-BDG82nlp.mjs.map → approvePrivacyRequests-BWj6SsgX.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-1I3xKR1X.mjs +2 -0
  10. package/dist/buildExamples-1I3xKR1X.mjs.map +1 -0
  11. package/dist/{buildXdiSyncEndpoint-FExEagKc.mjs → buildXdiSyncEndpoint-CAal3Xc4.mjs} +2 -2
  12. package/dist/{buildXdiSyncEndpoint-FExEagKc.mjs.map → buildXdiSyncEndpoint-CAal3Xc4.mjs.map} +1 -1
  13. package/dist/{bulkRestartRequests-OKwKXc52.mjs → bulkRestartRequests-B3wupylo.mjs} +2 -2
  14. package/dist/{bulkRestartRequests-OKwKXc52.mjs.map → bulkRestartRequests-B3wupylo.mjs.map} +1 -1
  15. package/dist/{bulkRetryEnrichers-Dl-n8AFF.mjs → bulkRetryEnrichers-D801tBcB.mjs} +2 -2
  16. package/dist/{bulkRetryEnrichers-Dl-n8AFF.mjs.map → bulkRetryEnrichers-D801tBcB.mjs.map} +1 -1
  17. package/dist/{cancelPrivacyRequests-BIgX5SDz.mjs → cancelPrivacyRequests-CAKTZF47.mjs} +2 -2
  18. package/dist/{cancelPrivacyRequests-BIgX5SDz.mjs.map → cancelPrivacyRequests-CAKTZF47.mjs.map} +1 -1
  19. package/dist/{command-X7lkPELf.mjs → command-BDQOL_MQ.mjs} +2 -2
  20. package/dist/{command-X7lkPELf.mjs.map → command-BDQOL_MQ.mjs.map} +1 -1
  21. package/dist/{constants-BRsj50Nb.mjs → constants-BlKpAm3R.mjs} +2 -2
  22. package/dist/{constants-BRsj50Nb.mjs.map → constants-BlKpAm3R.mjs.map} +1 -1
  23. package/dist/{createPoolingCommandUi-CyPZ3GqN.mjs → createPoolingCommandUi-JBOW5UxY.mjs} +2 -2
  24. package/dist/{createPoolingCommandUi-CyPZ3GqN.mjs.map → createPoolingCommandUi-JBOW5UxY.mjs.map} +1 -1
  25. package/dist/{downloadPrivacyRequestFiles-EBySRnvd.mjs → downloadPrivacyRequestFiles-Cf14MQR4.mjs} +2 -2
  26. package/dist/{downloadPrivacyRequestFiles-EBySRnvd.mjs.map → downloadPrivacyRequestFiles-Cf14MQR4.mjs.map} +1 -1
  27. package/dist/{generateCrossAccountApiKeys-pWTrIUE6.mjs → generateCrossAccountApiKeys-CVdsJFOe.mjs} +2 -2
  28. package/dist/{generateCrossAccountApiKeys-pWTrIUE6.mjs.map → generateCrossAccountApiKeys-CVdsJFOe.mjs.map} +1 -1
  29. package/dist/{impl-1SsreZWo.mjs → impl-2sYR_UFO.mjs} +2 -2
  30. package/dist/{impl-1SsreZWo.mjs.map → impl-2sYR_UFO.mjs.map} +1 -1
  31. package/dist/impl-B-Oe7DcE2.mjs +421 -0
  32. package/dist/{impl-DQcgEx7V2.mjs.map → impl-B-Oe7DcE2.mjs.map} +1 -1
  33. package/dist/{impl-CspH2ZWx.mjs → impl-BD03bzB-.mjs} +2 -2
  34. package/dist/{impl-CspH2ZWx.mjs.map → impl-BD03bzB-.mjs.map} +1 -1
  35. package/dist/{impl-CrdqsTUy.mjs → impl-BGtup1F9.mjs} +2 -2
  36. package/dist/{impl-CrdqsTUy.mjs.map → impl-BGtup1F9.mjs.map} +1 -1
  37. package/dist/impl-BQRP9NIv.mjs +2 -0
  38. package/dist/impl-BQRP9NIv.mjs.map +1 -0
  39. package/dist/{impl-CWP6AXSb.mjs → impl-BQe6vddz.mjs} +2 -2
  40. package/dist/{impl-CWP6AXSb.mjs.map → impl-BQe6vddz.mjs.map} +1 -1
  41. package/dist/{impl-B440iuvL.mjs → impl-BQj1Ien4.mjs} +3 -3
  42. package/dist/{impl-B440iuvL.mjs.map → impl-BQj1Ien4.mjs.map} +1 -1
  43. package/dist/{impl-CU38kdj8.mjs → impl-BRFL8xp7.mjs} +2 -2
  44. package/dist/{impl-CU38kdj8.mjs.map → impl-BRFL8xp7.mjs.map} +1 -1
  45. package/dist/{impl-eeS2lVi5.mjs → impl-BTvZxws5.mjs} +2 -2
  46. package/dist/{impl-eeS2lVi5.mjs.map → impl-BTvZxws5.mjs.map} +1 -1
  47. package/dist/{impl-D1UogVAq.mjs → impl-BVcy_GYa.mjs} +2 -2
  48. package/dist/{impl-D1UogVAq.mjs.map → impl-BVcy_GYa.mjs.map} +1 -1
  49. package/dist/{impl-vmLq6HCI.mjs → impl-B_CRtRo8.mjs} +2 -2
  50. package/dist/{impl-vmLq6HCI.mjs.map → impl-B_CRtRo8.mjs.map} +1 -1
  51. package/dist/{impl-7rdGuHOC.mjs → impl-BgD7TeMD.mjs} +2 -2
  52. package/dist/{impl-7rdGuHOC.mjs.map → impl-BgD7TeMD.mjs.map} +1 -1
  53. package/dist/{impl-BdTxFv63.mjs → impl-BgkovGOz.mjs} +2 -2
  54. package/dist/{impl-BdTxFv63.mjs.map → impl-BgkovGOz.mjs.map} +1 -1
  55. package/dist/{impl-Do2TNA3-.mjs → impl-Bh02zrTq.mjs} +2 -2
  56. package/dist/{impl-Do2TNA3-.mjs.map → impl-Bh02zrTq.mjs.map} +1 -1
  57. package/dist/{impl-HUfaARep.mjs → impl-BopWGXnH.mjs} +2 -2
  58. package/dist/{impl-HUfaARep.mjs.map → impl-BopWGXnH.mjs.map} +1 -1
  59. package/dist/{impl-iD6Fknfe.mjs → impl-BxvKe9_7.mjs} +2 -2
  60. package/dist/{impl-iD6Fknfe.mjs.map → impl-BxvKe9_7.mjs.map} +1 -1
  61. package/dist/{impl-DtnYcktN.mjs → impl-BzIyVAg_.mjs} +2 -2
  62. package/dist/{impl-DtnYcktN.mjs.map → impl-BzIyVAg_.mjs.map} +1 -1
  63. package/dist/{impl-Cxprr2hw.mjs → impl-C-PvYlFE.mjs} +2 -2
  64. package/dist/{impl-Cxprr2hw.mjs.map → impl-C-PvYlFE.mjs.map} +1 -1
  65. package/dist/impl-C36c5NfN.mjs +2 -0
  66. package/dist/impl-C36c5NfN.mjs.map +1 -0
  67. package/dist/{impl-B7l4bLG5.mjs → impl-CC-yFYWt.mjs} +2 -2
  68. package/dist/{impl-B7l4bLG5.mjs.map → impl-CC-yFYWt.mjs.map} +1 -1
  69. package/dist/{impl-CudSYx-g.mjs → impl-CFB_508q.mjs} +2 -2
  70. package/dist/{impl-CudSYx-g.mjs.map → impl-CFB_508q.mjs.map} +1 -1
  71. package/dist/{impl-DxQ9yj3H.mjs → impl-CG3f4B6u.mjs} +2 -2
  72. package/dist/{impl-DxQ9yj3H.mjs.map → impl-CG3f4B6u.mjs.map} +1 -1
  73. package/dist/{impl-DqHEIzpj.mjs → impl-CVUD-7mJ.mjs} +5 -5
  74. package/dist/{impl-DqHEIzpj.mjs.map → impl-CVUD-7mJ.mjs.map} +1 -1
  75. package/dist/{impl-BWPPVXG3.mjs → impl-CoqCyj7e.mjs} +3 -3
  76. package/dist/{impl-BWPPVXG3.mjs.map → impl-CoqCyj7e.mjs.map} +1 -1
  77. package/dist/{impl-BLQDgwxL.mjs → impl-Cq-GARM1.mjs} +2 -2
  78. package/dist/{impl-BLQDgwxL.mjs.map → impl-Cq-GARM1.mjs.map} +1 -1
  79. package/dist/{impl-DQG1pMzD2.mjs → impl-Cvyc-iTI2.mjs} +2 -2
  80. package/dist/{impl-DQG1pMzD2.mjs.map → impl-Cvyc-iTI2.mjs.map} +1 -1
  81. package/dist/impl-CwBa15M42.mjs +3 -0
  82. package/dist/impl-CwBa15M42.mjs.map +1 -0
  83. package/dist/{impl-CieztjdM.mjs → impl-D3gqip90.mjs} +2 -2
  84. package/dist/{impl-CieztjdM.mjs.map → impl-D3gqip90.mjs.map} +1 -1
  85. package/dist/{impl-DcL-8NEa2.mjs → impl-D6Lzwd-R2.mjs} +2 -2
  86. package/dist/{impl-DcL-8NEa2.mjs.map → impl-D6Lzwd-R2.mjs.map} +1 -1
  87. package/dist/impl-DG-041kN.mjs +3 -0
  88. package/dist/impl-DG-041kN.mjs.map +1 -0
  89. package/dist/{impl-DXbxO2VJ.mjs → impl-DTvnDByz.mjs} +2 -2
  90. package/dist/{impl-DXbxO2VJ.mjs.map → impl-DTvnDByz.mjs.map} +1 -1
  91. package/dist/{impl-Ds-gQfdc.mjs → impl-DUg1sDwg.mjs} +2 -2
  92. package/dist/{impl-Ds-gQfdc.mjs.map → impl-DUg1sDwg.mjs.map} +1 -1
  93. package/dist/{impl-B2ZXtnpX.mjs → impl-DldrBJEa.mjs} +2 -2
  94. package/dist/{impl-B2ZXtnpX.mjs.map → impl-DldrBJEa.mjs.map} +1 -1
  95. package/dist/{impl-D-a5xGld.mjs → impl-Dmn1CWts.mjs} +3 -3
  96. package/dist/{impl-D-a5xGld.mjs.map → impl-Dmn1CWts.mjs.map} +1 -1
  97. package/dist/impl-Dr9Jezjh2.mjs +2 -0
  98. package/dist/impl-Dr9Jezjh2.mjs.map +1 -0
  99. package/dist/{impl-DRKPx_I9.mjs → impl-DtTfsHtL.mjs} +2 -2
  100. package/dist/{impl-DRKPx_I9.mjs.map → impl-DtTfsHtL.mjs.map} +1 -1
  101. package/dist/{impl-FerHBNJx2.mjs → impl-DzNEfRoS2.mjs} +2 -2
  102. package/dist/{impl-FerHBNJx2.mjs.map → impl-DzNEfRoS2.mjs.map} +1 -1
  103. package/dist/{impl-wBcVYHlA.mjs → impl-HnrcGt_T.mjs} +2 -2
  104. package/dist/{impl-wBcVYHlA.mjs.map → impl-HnrcGt_T.mjs.map} +1 -1
  105. package/dist/{impl-D1f9mJL_.mjs → impl-QdSegO65.mjs} +2 -2
  106. package/dist/{impl-D1f9mJL_.mjs.map → impl-QdSegO65.mjs.map} +1 -1
  107. package/dist/{impl-C_Ifcb00.mjs → impl-S90NUBGm.mjs} +2 -2
  108. package/dist/{impl-C_Ifcb00.mjs.map → impl-S90NUBGm.mjs.map} +1 -1
  109. package/dist/{impl-DtpgD_as.mjs → impl-Tr08dgdk.mjs} +2 -2
  110. package/dist/{impl-DtpgD_as.mjs.map → impl-Tr08dgdk.mjs.map} +1 -1
  111. package/dist/{impl-Cb42aI60.mjs → impl-WJBuS_0m.mjs} +2 -2
  112. package/dist/{impl-Cb42aI60.mjs.map → impl-WJBuS_0m.mjs.map} +1 -1
  113. package/dist/{impl-DiwxYcux.mjs → impl-b4KAEVci.mjs} +2 -2
  114. package/dist/{impl-DiwxYcux.mjs.map → impl-b4KAEVci.mjs.map} +1 -1
  115. package/dist/impl-defjX-97.mjs +3 -0
  116. package/dist/impl-defjX-97.mjs.map +1 -0
  117. package/dist/{impl-DTadLabu.mjs → impl-fg0UZYw6.mjs} +2 -2
  118. package/dist/{impl-DTadLabu.mjs.map → impl-fg0UZYw6.mjs.map} +1 -1
  119. package/dist/{impl-Dr_l_SLd.mjs → impl-hRK54juc.mjs} +2 -2
  120. package/dist/{impl-Dr_l_SLd.mjs.map → impl-hRK54juc.mjs.map} +1 -1
  121. package/dist/{impl-DJcNhpbx.mjs → impl-mjDxMEDR.mjs} +2 -2
  122. package/dist/{impl-DJcNhpbx.mjs.map → impl-mjDxMEDR.mjs.map} +1 -1
  123. package/dist/index.d.mts +1 -1
  124. package/dist/index.mjs +2 -2
  125. package/dist/{markRequestDataSiloIdsCompleted-BYNMCkhy.mjs → markRequestDataSiloIdsCompleted-C6lV_My-.mjs} +2 -2
  126. package/dist/{markRequestDataSiloIdsCompleted-BYNMCkhy.mjs.map → markRequestDataSiloIdsCompleted-C6lV_My-.mjs.map} +1 -1
  127. package/dist/{markSilentPrivacyRequests-gKYivzH1.mjs → markSilentPrivacyRequests-D3bFOMLh.mjs} +2 -2
  128. package/dist/{markSilentPrivacyRequests-gKYivzH1.mjs.map → markSilentPrivacyRequests-D3bFOMLh.mjs.map} +1 -1
  129. package/dist/{mergeTranscendInputs-D1CvxQu0.mjs → mergeTranscendInputs-B7WjxYMN.mjs} +3 -3
  130. package/dist/{mergeTranscendInputs-D1CvxQu0.mjs.map → mergeTranscendInputs-B7WjxYMN.mjs.map} +1 -1
  131. package/dist/{notifyPrivacyRequestsAdditionalTime-DbERhQ1Q.mjs → notifyPrivacyRequestsAdditionalTime-BGUxsWLN.mjs} +2 -2
  132. package/dist/{notifyPrivacyRequestsAdditionalTime-DbERhQ1Q.mjs.map → notifyPrivacyRequestsAdditionalTime-BGUxsWLN.mjs.map} +1 -1
  133. package/dist/{policy-bundle-manifest-BZnBMZQq.mjs → policy-bundle-manifest-RgsjPnfI.mjs} +3 -3
  134. package/dist/{policy-bundle-manifest-BZnBMZQq.mjs.map → policy-bundle-manifest-RgsjPnfI.mjs.map} +1 -1
  135. package/dist/{policy-project-discovery-C29UxWwt.mjs → policy-project-discovery-B4cFXUlA.mjs} +71 -68
  136. package/dist/policy-project-discovery-B4cFXUlA.mjs.map +1 -0
  137. package/dist/policy-scaffold-config-CwlygiTz.mjs +76 -0
  138. package/dist/policy-scaffold-config-CwlygiTz.mjs.map +1 -0
  139. package/dist/printResult-Dmwv78e7.mjs +33 -0
  140. package/dist/printResult-Dmwv78e7.mjs.map +1 -0
  141. package/dist/{pullAllDatapoints-Bm-Orhse.mjs → pullAllDatapoints-CNqQSSmF.mjs} +3 -3
  142. package/dist/{pullAllDatapoints-Bm-Orhse.mjs.map → pullAllDatapoints-CNqQSSmF.mjs.map} +1 -1
  143. package/dist/pullChunkedCustomSiloOutstandingIdentifiers-BfNNWqeI.mjs +2 -0
  144. package/dist/{pullChunkedCustomSiloOutstandingIdentifiers-DTGQOw--.mjs.map → pullChunkedCustomSiloOutstandingIdentifiers-BfNNWqeI.mjs.map} +1 -1
  145. package/dist/{pullManualEnrichmentIdentifiersToCsv-DMC5CQtE.mjs → pullManualEnrichmentIdentifiersToCsv-B_lWa6Yg.mjs} +2 -2
  146. package/dist/{pullManualEnrichmentIdentifiersToCsv-DMC5CQtE.mjs.map → pullManualEnrichmentIdentifiersToCsv-B_lWa6Yg.mjs.map} +1 -1
  147. package/dist/{pushCronIdentifiersFromCsv-DhS2z8IG.mjs → pushCronIdentifiersFromCsv-CDhlEf6n.mjs} +2 -2
  148. package/dist/{pushCronIdentifiersFromCsv-DhS2z8IG.mjs.map → pushCronIdentifiersFromCsv-CDhlEf6n.mjs.map} +1 -1
  149. package/dist/pushManualEnrichmentIdentifiersFromCsv-Bn_028w5.mjs +2 -0
  150. package/dist/{pushManualEnrichmentIdentifiersFromCsv-BTJGOmdU.mjs.map → pushManualEnrichmentIdentifiersFromCsv-Bn_028w5.mjs.map} +1 -1
  151. package/dist/{removeUnverifiedRequestIdentifiers-BkAcUZZN.mjs → removeUnverifiedRequestIdentifiers-DcI9ut4q.mjs} +2 -2
  152. package/dist/{removeUnverifiedRequestIdentifiers-BkAcUZZN.mjs.map → removeUnverifiedRequestIdentifiers-DcI9ut4q.mjs.map} +1 -1
  153. package/dist/resolveBundleIdByName-BPrMkU0w.mjs +2 -0
  154. package/dist/resolveBundleIdByName-BPrMkU0w.mjs.map +1 -0
  155. package/dist/resolvePolicyBundleVersion-BrVz4LKN.mjs +2 -0
  156. package/dist/resolvePolicyBundleVersion-BrVz4LKN.mjs.map +1 -0
  157. package/dist/{retryRequestDataSilos-BoPmcB8-.mjs → retryRequestDataSilos-ZdY2PM0S.mjs} +2 -2
  158. package/dist/{retryRequestDataSilos-BoPmcB8-.mjs.map → retryRequestDataSilos-ZdY2PM0S.mjs.map} +1 -1
  159. package/dist/{skipPreflightJobs-DkBdYw-r.mjs → skipPreflightJobs-KdcSw8Td.mjs} +2 -2
  160. package/dist/{skipPreflightJobs-DkBdYw-r.mjs.map → skipPreflightJobs-KdcSw8Td.mjs.map} +1 -1
  161. package/dist/{skipRequestDataSilos-BRFiokix.mjs → skipRequestDataSilos-Cy2NfP47.mjs} +2 -2
  162. package/dist/{skipRequestDataSilos-BRFiokix.mjs.map → skipRequestDataSilos-Cy2NfP47.mjs.map} +1 -1
  163. package/dist/{streamPrivacyRequestsToCsv-Bt-H5J-y.mjs → streamPrivacyRequestsToCsv-ByRBG8Mb.mjs} +2 -2
  164. package/dist/{streamPrivacyRequestsToCsv-Bt-H5J-y.mjs.map → streamPrivacyRequestsToCsv-ByRBG8Mb.mjs.map} +1 -1
  165. package/dist/{syncCodePackages-CPkEukDm.mjs → syncCodePackages-DJnrcX5l.mjs} +2 -2
  166. package/dist/{syncCodePackages-CPkEukDm.mjs.map → syncCodePackages-DJnrcX5l.mjs.map} +1 -1
  167. package/dist/updateConsentManagerVersionToLatest-KwMaAkwh.mjs +2 -0
  168. package/dist/{updateConsentManagerVersionToLatest-DWblAwus.mjs.map → updateConsentManagerVersionToLatest-KwMaAkwh.mjs.map} +1 -1
  169. package/dist/{uploadConsents-D7Vg8ZRW.mjs → uploadConsents-C5LmI-9T.mjs} +2 -2
  170. package/dist/{uploadConsents-D7Vg8ZRW.mjs.map → uploadConsents-C5LmI-9T.mjs.map} +1 -1
  171. package/dist/{uploadPrivacyRequestsFromCsv-B_hQwIn6.mjs → uploadPrivacyRequestsFromCsv-BsYnCgbl.mjs} +2 -2
  172. package/dist/{uploadPrivacyRequestsFromCsv-B_hQwIn6.mjs.map → uploadPrivacyRequestsFromCsv-BsYnCgbl.mjs.map} +1 -1
  173. package/package.json +4 -4
  174. package/dist/app-CR3U95JW.mjs.map +0 -1
  175. package/dist/buildExamples-B6BdW0FD.mjs +0 -2
  176. package/dist/buildExamples-B6BdW0FD.mjs.map +0 -1
  177. package/dist/impl-BqTMPbwc2.mjs +0 -2
  178. package/dist/impl-BqTMPbwc2.mjs.map +0 -1
  179. package/dist/impl-CAoIp9Nl2.mjs +0 -3
  180. package/dist/impl-CAoIp9Nl2.mjs.map +0 -1
  181. package/dist/impl-Cee7Q1Ne.mjs +0 -2
  182. package/dist/impl-Cee7Q1Ne.mjs.map +0 -1
  183. package/dist/impl-DQcgEx7V2.mjs +0 -298
  184. package/dist/impl-DezV3QMo.mjs +0 -3
  185. package/dist/impl-DezV3QMo.mjs.map +0 -1
  186. package/dist/impl-btKJ1-VJ.mjs +0 -3
  187. package/dist/impl-btKJ1-VJ.mjs.map +0 -1
  188. package/dist/impl-ijoNwhGI.mjs +0 -2
  189. package/dist/impl-ijoNwhGI.mjs.map +0 -1
  190. package/dist/policy-project-discovery-C29UxWwt.mjs.map +0 -1
  191. package/dist/policy-scaffold-config-BUKAyPad.mjs +0 -76
  192. package/dist/policy-scaffold-config-BUKAyPad.mjs.map +0 -1
  193. package/dist/printResult-C2K9ODeE.mjs +0 -33
  194. package/dist/printResult-C2K9ODeE.mjs.map +0 -1
  195. package/dist/pullChunkedCustomSiloOutstandingIdentifiers-DTGQOw--.mjs +0 -2
  196. package/dist/pushManualEnrichmentIdentifiersFromCsv-BTJGOmdU.mjs +0 -2
  197. package/dist/resolveBundleIdByName-Dm_o5_bg.mjs +0 -2
  198. package/dist/resolveBundleIdByName-Dm_o5_bg.mjs.map +0 -1
  199. package/dist/resolvePolicyBundleVersion-DRUwe7fA.mjs +0 -2
  200. package/dist/resolvePolicyBundleVersion-DRUwe7fA.mjs.map +0 -1
  201. package/dist/updateConsentManagerVersionToLatest-DWblAwus.mjs +0 -2
@@ -1 +1 @@
1
- {"version":3,"file":"impl-D1f9mJL_.mjs","names":[],"sources":["../src/commands/request/preflight/pull-identifiers/impl.ts"],"sourcesContent":["import type { RequestAction } from '@transcend-io/privacy-types';\n\nimport type { LocalContext } from '../../../../context.js';\nimport { doneInputValidation } from '../../../../lib/cli/done-input-validation.js';\nimport { pullManualEnrichmentIdentifiersToCsv } from '../../../../lib/manual-enrichment/index.js';\n\nexport interface PullIdentifiersCommandFlags {\n auth: string;\n sombraAuth?: string;\n transcendUrl: string;\n file: string;\n actions?: RequestAction[];\n concurrency: number;\n}\n\nexport async function pullIdentifiers(\n this: LocalContext,\n { auth, transcendUrl, file, concurrency, actions, sombraAuth }: PullIdentifiersCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process);\n\n await pullManualEnrichmentIdentifiersToCsv({\n file,\n transcendUrl,\n concurrency,\n requestActions: actions,\n auth,\n sombraAuth,\n });\n}\n"],"mappings":"4HAeA,eAAsB,EAEpB,CAAE,OAAM,eAAc,OAAM,cAAa,UAAS,cACnC,CACf,EAAoB,KAAK,QAAQ,CAEjC,MAAM,EAAqC,CACzC,OACA,eACA,cACA,eAAgB,EAChB,OACA,aACD,CAAC"}
1
+ {"version":3,"file":"impl-QdSegO65.mjs","names":[],"sources":["../src/commands/request/preflight/pull-identifiers/impl.ts"],"sourcesContent":["import type { RequestAction } from '@transcend-io/privacy-types';\n\nimport type { LocalContext } from '../../../../context.js';\nimport { doneInputValidation } from '../../../../lib/cli/done-input-validation.js';\nimport { pullManualEnrichmentIdentifiersToCsv } from '../../../../lib/manual-enrichment/index.js';\n\nexport interface PullIdentifiersCommandFlags {\n auth: string;\n sombraAuth?: string;\n transcendUrl: string;\n file: string;\n actions?: RequestAction[];\n concurrency: number;\n}\n\nexport async function pullIdentifiers(\n this: LocalContext,\n { auth, transcendUrl, file, concurrency, actions, sombraAuth }: PullIdentifiersCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process);\n\n await pullManualEnrichmentIdentifiersToCsv({\n file,\n transcendUrl,\n concurrency,\n requestActions: actions,\n auth,\n sombraAuth,\n });\n}\n"],"mappings":"4HAeA,eAAsB,EAEpB,CAAE,OAAM,eAAc,OAAM,cAAa,UAAS,cACnC,CACf,EAAoB,KAAK,QAAQ,CAEjC,MAAM,EAAqC,CACzC,OACA,eACA,cACA,eAAgB,EAChB,OACA,aACD,CAAC"}
@@ -1,2 +1,2 @@
1
- import{t as e}from"./bulkRestartRequests-OKwKXc52.mjs";import{t}from"./done-input-validation-LiTaCEzF.mjs";async function n({auth:n,requestReceiptFolder:r,sombraAuth:i,actions:a,statuses:o,requestIds:s,createdAt:c,emailIsVerified:l,silentModeBefore:u,sendEmailReceipt:d,copyIdentifiers:f,restartIdentifierStrategy:p,skipWaitingPeriod:m,createdAtBefore:h,createdAtAfter:g,updatedAtBefore:_,updatedAtAfter:v,concurrency:y,transcendUrl:b}){t(this.process),await e({requestReceiptFolder:r,auth:n,sombraAuth:i,requestActions:a,requestStatuses:o,requestIds:s,createdAt:c,emailIsVerified:l,silentModeBefore:u,sendEmailReceipt:d,copyIdentifiers:f,restartIdentifierStrategy:p,skipWaitingPeriod:m,createdAtBefore:h,createdAtAfter:g,updatedAtBefore:_,updatedAtAfter:v,concurrency:y,transcendUrl:b})}export{n as restart};
2
- //# sourceMappingURL=impl-C_Ifcb00.mjs.map
1
+ import{t as e}from"./bulkRestartRequests-B3wupylo.mjs";import{t}from"./done-input-validation-LiTaCEzF.mjs";async function n({auth:n,requestReceiptFolder:r,sombraAuth:i,actions:a,statuses:o,requestIds:s,createdAt:c,emailIsVerified:l,silentModeBefore:u,sendEmailReceipt:d,copyIdentifiers:f,restartIdentifierStrategy:p,skipWaitingPeriod:m,createdAtBefore:h,createdAtAfter:g,updatedAtBefore:_,updatedAtAfter:v,concurrency:y,transcendUrl:b}){t(this.process),await e({requestReceiptFolder:r,auth:n,sombraAuth:i,requestActions:a,requestStatuses:o,requestIds:s,createdAt:c,emailIsVerified:l,silentModeBefore:u,sendEmailReceipt:d,copyIdentifiers:f,restartIdentifierStrategy:p,skipWaitingPeriod:m,createdAtBefore:h,createdAtAfter:g,updatedAtBefore:_,updatedAtAfter:v,concurrency:y,transcendUrl:b})}export{n as restart};
2
+ //# sourceMappingURL=impl-S90NUBGm.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"impl-C_Ifcb00.mjs","names":[],"sources":["../src/commands/request/restart/impl.ts"],"sourcesContent":["import type {\n RequestAction,\n RequestStatus,\n RestartIdentifierStrategy,\n} from '@transcend-io/privacy-types';\n\nimport type { LocalContext } from '../../../context.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { bulkRestartRequests } from '../../../lib/requests/index.js';\n\nexport interface RestartCommandFlags {\n auth: string;\n actions: RequestAction[];\n statuses: RequestStatus[];\n transcendUrl: string;\n requestReceiptFolder: string;\n sombraAuth?: string;\n concurrency: number;\n requestIds?: string[];\n emailIsVerified: boolean;\n createdAt?: Date;\n silentModeBefore?: Date;\n createdAtBefore?: Date;\n createdAtAfter?: Date;\n updatedAtBefore?: Date;\n updatedAtAfter?: Date;\n sendEmailReceipt: boolean;\n copyIdentifiers: boolean;\n restartIdentifierStrategy?: RestartIdentifierStrategy;\n skipWaitingPeriod: boolean;\n}\n\nexport async function restart(\n this: LocalContext,\n {\n auth,\n requestReceiptFolder,\n sombraAuth,\n actions,\n statuses,\n requestIds,\n createdAt,\n emailIsVerified,\n silentModeBefore,\n sendEmailReceipt,\n copyIdentifiers,\n restartIdentifierStrategy,\n skipWaitingPeriod,\n createdAtBefore,\n createdAtAfter,\n updatedAtBefore,\n updatedAtAfter,\n concurrency,\n transcendUrl,\n }: RestartCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process);\n\n await bulkRestartRequests({\n requestReceiptFolder,\n auth,\n sombraAuth,\n requestActions: actions,\n requestStatuses: statuses,\n requestIds,\n createdAt,\n emailIsVerified,\n silentModeBefore,\n sendEmailReceipt,\n copyIdentifiers,\n restartIdentifierStrategy,\n skipWaitingPeriod,\n createdAtBefore,\n createdAtAfter,\n updatedAtBefore,\n updatedAtAfter,\n concurrency,\n transcendUrl,\n });\n}\n"],"mappings":"2GAgCA,eAAsB,EAEpB,CACE,OACA,uBACA,aACA,UACA,WACA,aACA,YACA,kBACA,mBACA,mBACA,kBACA,4BACA,oBACA,kBACA,iBACA,kBACA,iBACA,cACA,gBAEa,CACf,EAAoB,KAAK,QAAQ,CAEjC,MAAM,EAAoB,CACxB,uBACA,OACA,aACA,eAAgB,EAChB,gBAAiB,EACjB,aACA,YACA,kBACA,mBACA,mBACA,kBACA,4BACA,oBACA,kBACA,iBACA,kBACA,iBACA,cACA,eACD,CAAC"}
1
+ {"version":3,"file":"impl-S90NUBGm.mjs","names":[],"sources":["../src/commands/request/restart/impl.ts"],"sourcesContent":["import type {\n RequestAction,\n RequestStatus,\n RestartIdentifierStrategy,\n} from '@transcend-io/privacy-types';\n\nimport type { LocalContext } from '../../../context.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { bulkRestartRequests } from '../../../lib/requests/index.js';\n\nexport interface RestartCommandFlags {\n auth: string;\n actions: RequestAction[];\n statuses: RequestStatus[];\n transcendUrl: string;\n requestReceiptFolder: string;\n sombraAuth?: string;\n concurrency: number;\n requestIds?: string[];\n emailIsVerified: boolean;\n createdAt?: Date;\n silentModeBefore?: Date;\n createdAtBefore?: Date;\n createdAtAfter?: Date;\n updatedAtBefore?: Date;\n updatedAtAfter?: Date;\n sendEmailReceipt: boolean;\n copyIdentifiers: boolean;\n restartIdentifierStrategy?: RestartIdentifierStrategy;\n skipWaitingPeriod: boolean;\n}\n\nexport async function restart(\n this: LocalContext,\n {\n auth,\n requestReceiptFolder,\n sombraAuth,\n actions,\n statuses,\n requestIds,\n createdAt,\n emailIsVerified,\n silentModeBefore,\n sendEmailReceipt,\n copyIdentifiers,\n restartIdentifierStrategy,\n skipWaitingPeriod,\n createdAtBefore,\n createdAtAfter,\n updatedAtBefore,\n updatedAtAfter,\n concurrency,\n transcendUrl,\n }: RestartCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process);\n\n await bulkRestartRequests({\n requestReceiptFolder,\n auth,\n sombraAuth,\n requestActions: actions,\n requestStatuses: statuses,\n requestIds,\n createdAt,\n emailIsVerified,\n silentModeBefore,\n sendEmailReceipt,\n copyIdentifiers,\n restartIdentifierStrategy,\n skipWaitingPeriod,\n createdAtBefore,\n createdAtAfter,\n updatedAtBefore,\n updatedAtAfter,\n concurrency,\n transcendUrl,\n });\n}\n"],"mappings":"2GAgCA,eAAsB,EAEpB,CACE,OACA,uBACA,aACA,UACA,WACA,aACA,YACA,kBACA,mBACA,mBACA,kBACA,4BACA,oBACA,kBACA,iBACA,kBACA,iBACA,cACA,gBAEa,CACf,EAAoB,KAAK,QAAQ,CAEjC,MAAM,EAAoB,CACxB,uBACA,OACA,aACA,eAAgB,EAChB,gBAAiB,EACjB,aACA,YACA,kBACA,mBACA,mBACA,kBACA,4BACA,oBACA,kBACA,iBACA,kBACA,iBACA,cACA,eACD,CAAC"}
@@ -1,2 +1,2 @@
1
- import{t as e}from"./retryRequestDataSilos-BoPmcB8-.mjs";import{t}from"./done-input-validation-LiTaCEzF.mjs";async function n({auth:n,dataSiloId:r,actions:i,transcendUrl:a}){t(this.process),await e({requestActions:i,transcendUrl:a,auth:n,dataSiloId:r})}export{n as retryRequestDataSilos};
2
- //# sourceMappingURL=impl-DtpgD_as.mjs.map
1
+ import{t as e}from"./retryRequestDataSilos-ZdY2PM0S.mjs";import{t}from"./done-input-validation-LiTaCEzF.mjs";async function n({auth:n,dataSiloId:r,actions:i,transcendUrl:a}){t(this.process),await e({requestActions:i,transcendUrl:a,auth:n,dataSiloId:r})}export{n as retryRequestDataSilos};
2
+ //# sourceMappingURL=impl-Tr08dgdk.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"impl-DtpgD_as.mjs","names":["retryRequestDataSilosHelper"],"sources":["../src/commands/request/system/retry-request-data-silos/impl.ts"],"sourcesContent":["import type { RequestAction } from '@transcend-io/privacy-types';\n\nimport type { LocalContext } from '../../../../context.js';\nimport { doneInputValidation } from '../../../../lib/cli/done-input-validation.js';\nimport { retryRequestDataSilos as retryRequestDataSilosHelper } from '../../../../lib/requests/index.js';\n\nexport interface RetryRequestDataSilosCommandFlags {\n auth: string;\n dataSiloId: string;\n actions: RequestAction[];\n transcendUrl: string;\n}\n\nexport async function retryRequestDataSilos(\n this: LocalContext,\n { auth, dataSiloId, actions, transcendUrl }: RetryRequestDataSilosCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process);\n\n await retryRequestDataSilosHelper({\n requestActions: actions,\n transcendUrl,\n auth,\n dataSiloId,\n });\n}\n"],"mappings":"6GAaA,eAAsB,EAEpB,CAAE,OAAM,aAAY,UAAS,gBACd,CACf,EAAoB,KAAK,QAAQ,CAEjC,MAAMA,EAA4B,CAChC,eAAgB,EAChB,eACA,OACA,aACD,CAAC"}
1
+ {"version":3,"file":"impl-Tr08dgdk.mjs","names":["retryRequestDataSilosHelper"],"sources":["../src/commands/request/system/retry-request-data-silos/impl.ts"],"sourcesContent":["import type { RequestAction } from '@transcend-io/privacy-types';\n\nimport type { LocalContext } from '../../../../context.js';\nimport { doneInputValidation } from '../../../../lib/cli/done-input-validation.js';\nimport { retryRequestDataSilos as retryRequestDataSilosHelper } from '../../../../lib/requests/index.js';\n\nexport interface RetryRequestDataSilosCommandFlags {\n auth: string;\n dataSiloId: string;\n actions: RequestAction[];\n transcendUrl: string;\n}\n\nexport async function retryRequestDataSilos(\n this: LocalContext,\n { auth, dataSiloId, actions, transcendUrl }: RetryRequestDataSilosCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process);\n\n await retryRequestDataSilosHelper({\n requestActions: actions,\n transcendUrl,\n auth,\n dataSiloId,\n });\n}\n"],"mappings":"6GAaA,eAAsB,EAEpB,CAAE,OAAM,aAAY,UAAS,gBACd,CACf,EAAoB,KAAK,QAAQ,CAEjC,MAAMA,EAA4B,CAChC,eAAgB,EAChB,eACA,OACA,aACD,CAAC"}
@@ -1,4 +1,4 @@
1
- import{t as e}from"./readCsv-DNcJ_UfU.mjs";import{a as t}from"./writeCsv-CNZrq3zU.mjs";import{t as n}from"./done-input-validation-LiTaCEzF.mjs";import{chunk as r}from"lodash-es";import i from"node:path";import a from"colors";import{decodeCodec as o}from"@transcend-io/type-utils";import{DeletePreferenceRecordCliCsvRow as s,DeletePreferenceRecordsResponse as c,createSombraGotInstance as l,withTransientRetry as u}from"@transcend-io/sdk";import{map as d}from"@transcend-io/utils";import f from"cli-progress";async function p(e,{partition:t,identifierChunk:n,timestamp:r,logger:i}){try{let{failures:s}=o(c,await u(`Delete Preference Records`,()=>e.post(`v1/preferences/${t}/delete`,{json:{records:n.map(e=>({anchorIdentifier:e,timestamp:r.toISOString()}))}}).json(),{logger:i,maxAttempts:3,onRetry:(e,t,n)=>{i.warn(a.yellow(`Attempt ${e} to delete preference records failed: ${n}`))}}));return s.length>0?s.map(({index:e,error:t})=>({...n[e],error:t})):[]}catch(e){return n.map(t=>({...t,error:e.message}))}}async function m(e,{anchorIdentifiers:t,partition:n,timestamp:i,maxItemsInChunk:a,maxConcurrency:o,logger:s}){return(await d(r(t,a),async t=>await p(e,{partition:n,identifierChunk:t,timestamp:i,logger:s}),{concurrency:o})).flat()}async function h({auth:r,partition:o,sombraAuth:c,file:u=``,directory:p,transcendUrl:h,timestamp:g,maxConcurrency:_,maxItemsInChunk:v,receiptDirectory:y,fileConcurrency:b}){p&&u&&(this.logger.error(a.red(`Cannot provide both a directory and a file. Please provide only one.`)),this.process.exit(1)),!u&&!p&&(this.logger.error(a.red(`A file or directory must be provided. Please provide one using --file=./preferences.csv or --directory=./preferences`)),this.process.exit(1)),n(this.process);let x=[];if(p)try{let e=this.fs.readdirSync(p).filter(e=>e.endsWith(`.csv`));e.length===0&&(this.logger.error(a.red(`No CSV files found in directory: ${p}`)),this.process.exit(1)),x.push(...e.map(e=>i.join(p,e)))}catch(e){this.logger.error(a.red(`Failed to read directory: ${p}`)),this.logger.error(a.red(e.message)),this.process.exit(1)}else try{u.endsWith(`.csv`)||(this.logger.error(a.red(`File must be a CSV file`)),this.process.exit(1)),x.push(u)}catch(e){this.logger.error(a.red(`Failed to access file: ${u}`)),this.logger.error(a.red(e.message)),this.process.exit(1)}this.logger.debug(a.green(`Processing ${x.length} consent preferences files for partition: ${o}`)),this.logger.debug(`\nFiles to process: ${x.join(`, `)}\n`);let S=await l(h,r,{logger:this.logger,sombraApiKey:c,sombraUrl:this.process.env.SOMBRA_URL}),C=new f.SingleBar({format:`Deletion Progress |${a.cyan(`[{bar}]`)}| Duration: ${a.red(`{duration_formatted}`)} | {value}/{total} Files Processed `},f.Presets.shades_classic);C.start(x.length,0);let w=await d(x,async t=>{let n=await m(S,{partition:o,anchorIdentifiers:e(this.fs.readFileSync(t,`utf8`),s),timestamp:g,maxItemsInChunk:v,maxConcurrency:_,logger:this.logger});return C.increment(),n},{concurrency:b});C.stop();let T=w.flat(),E=``;T.length>0&&(E=i.join(y,`deletion-failures-${Date.now()}.csv`),t(E,T,!0)),this.logger.info(a.green(`
1
+ import{t as e}from"./readCsv-DNcJ_UfU.mjs";import{a as t}from"./writeCsv-CNZrq3zU.mjs";import{t as n}from"./done-input-validation-LiTaCEzF.mjs";import{chunk as r}from"lodash-es";import i from"node:path";import a from"colors";import{map as o}from"@transcend-io/utils";import{decodeCodec as s}from"@transcend-io/type-utils";import{DeletePreferenceRecordCliCsvRow as c,DeletePreferenceRecordsResponse as l,createSombraGotInstance as u,withTransientRetry as d}from"@transcend-io/sdk";import f from"cli-progress";async function p(e,{partition:t,identifierChunk:n,timestamp:r,logger:i}){try{let{failures:o}=s(l,await d(`Delete Preference Records`,()=>e.post(`v1/preferences/${t}/delete`,{json:{records:n.map(e=>({anchorIdentifier:e,timestamp:r.toISOString()}))}}).json(),{logger:i,maxAttempts:3,onRetry:(e,t,n)=>{i.warn(a.yellow(`Attempt ${e} to delete preference records failed: ${n}`))}}));return o.length>0?o.map(({index:e,error:t})=>({...n[e],error:t})):[]}catch(e){return n.map(t=>({...t,error:e.message}))}}async function m(e,{anchorIdentifiers:t,partition:n,timestamp:i,maxItemsInChunk:a,maxConcurrency:s,logger:c}){return(await o(r(t,a),async t=>await p(e,{partition:n,identifierChunk:t,timestamp:i,logger:c}),{concurrency:s})).flat()}async function h({auth:r,partition:s,sombraAuth:l,file:d=``,directory:p,transcendUrl:h,timestamp:g,maxConcurrency:_,maxItemsInChunk:v,receiptDirectory:y,fileConcurrency:b}){p&&d&&(this.logger.error(a.red(`Cannot provide both a directory and a file. Please provide only one.`)),this.process.exit(1)),!d&&!p&&(this.logger.error(a.red(`A file or directory must be provided. Please provide one using --file=./preferences.csv or --directory=./preferences`)),this.process.exit(1)),n(this.process);let x=[];if(p)try{let e=this.fs.readdirSync(p).filter(e=>e.endsWith(`.csv`));e.length===0&&(this.logger.error(a.red(`No CSV files found in directory: ${p}`)),this.process.exit(1)),x.push(...e.map(e=>i.join(p,e)))}catch(e){this.logger.error(a.red(`Failed to read directory: ${p}`)),this.logger.error(a.red(e.message)),this.process.exit(1)}else try{d.endsWith(`.csv`)||(this.logger.error(a.red(`File must be a CSV file`)),this.process.exit(1)),x.push(d)}catch(e){this.logger.error(a.red(`Failed to access file: ${d}`)),this.logger.error(a.red(e.message)),this.process.exit(1)}this.logger.debug(a.green(`Processing ${x.length} consent preferences files for partition: ${s}`)),this.logger.debug(`\nFiles to process: ${x.join(`, `)}\n`);let S=await u(h,r,{logger:this.logger,sombraApiKey:l,sombraUrl:this.process.env.SOMBRA_URL}),C=new f.SingleBar({format:`Deletion Progress |${a.cyan(`[{bar}]`)}| Duration: ${a.red(`{duration_formatted}`)} | {value}/{total} Files Processed `},f.Presets.shades_classic);C.start(x.length,0);let w=await o(x,async t=>{let n=await m(S,{partition:s,anchorIdentifiers:e(this.fs.readFileSync(t,`utf8`),c),timestamp:g,maxItemsInChunk:v,maxConcurrency:_,logger:this.logger});return C.increment(),n},{concurrency:b});C.stop();let T=w.flat(),E=``;T.length>0&&(E=i.join(y,`deletion-failures-${Date.now()}.csv`),t(E,T,!0)),this.logger.info(a.green(`
2
2
 
3
3
  ==================================
4
4
 
@@ -9,4 +9,4 @@ import{t as e}from"./readCsv-DNcJ_UfU.mjs";import{a as t}from"./writeCsv-CNZrq3z
9
9
  ==================================
10
10
 
11
11
  `))}export{h as deletePreferenceRecords};
12
- //# sourceMappingURL=impl-Cb42aI60.mjs.map
12
+ //# sourceMappingURL=impl-WJBuS_0m.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"impl-Cb42aI60.mjs","names":[],"sources":["../src/lib/preference-management/bulkDeletePreferenceRecords.ts","../src/commands/consent/delete-preference-records/impl.ts"],"sourcesContent":["import {\n DeletePreferenceRecordCliCsvRow,\n DeletePreferenceRecordsResponse,\n withTransientRetry,\n} from '@transcend-io/sdk';\nimport { decodeCodec } from '@transcend-io/type-utils';\nimport { map } from '@transcend-io/utils';\nimport colors from 'colors';\nimport type { Got } from 'got';\nimport { chunk } from 'lodash-es';\n\nimport type { CliLogger } from '../../context.js';\nimport { logger } from '../../logger.js';\nimport { readCsv } from '../requests/index.js';\n\ninterface FailedResult extends DeletePreferenceRecordCliCsvRow {\n /** Error message describing the failure */\n error: string;\n}\n\ninterface DeletePreferenceRecordsRepositoryOptions {\n /** The partition to delete from */\n partition: string;\n /** Chunk of identifiers to delete */\n identifierChunk: DeletePreferenceRecordCliCsvRow[];\n /** the timestamp for the deletion operation */\n timestamp: Date;\n /** Command logger */\n logger: CliLogger;\n}\n\n/**\n * Options for deleting preference records\n */\ntype DeletePreferenceRecordsOptions = Omit<\n DeletePreferenceRecordsRepositoryOptions,\n 'identifierChunk' | 'logger'\n> & {\n /** The file path to read CSV rows from */\n filePath: string;\n /** Maximum items to include in each deletion chunk */\n maxItemsInChunk: number;\n /** Maximum concurrency for deletion requests */\n maxConcurrency: number;\n};\n\ntype DeletePreferenceRecordRowsOptions = Omit<DeletePreferenceRecordsOptions, 'filePath'> & {\n /** Decoded identifiers to delete */\n anchorIdentifiers: DeletePreferenceRecordCliCsvRow[];\n /** Command logger */\n logger: CliLogger;\n};\n\n/**\n *\n * Delete a chunk of preference records\n *\n * @param sombra - Sombra instance (must include auth headers)\n * @param options - Options for deletion\n * @param options.partition - The partition to delete from\n * @param options.identifierChunk - Chunk of identifiers to delete\n * @param options.timestamp - The timestamp for the deletion operation\n * @returns List of failed deletions\n */\nasync function deletePreferenceRecordsRepository(\n sombra: Got,\n {\n partition,\n identifierChunk: chunk,\n timestamp,\n logger: commandLogger,\n }: DeletePreferenceRecordsRepositoryOptions,\n): Promise<FailedResult[]> {\n try {\n const response = await withTransientRetry(\n 'Delete Preference Records',\n () =>\n sombra\n .post(`v1/preferences/${partition}/delete`, {\n json: {\n records: chunk.map((record) => ({\n anchorIdentifier: record,\n timestamp: timestamp.toISOString(),\n })),\n },\n })\n .json(),\n {\n logger: commandLogger,\n maxAttempts: 3,\n onRetry: (attempt, _err, msg) => {\n commandLogger.warn(\n colors.yellow(`Attempt ${attempt} to delete preference records failed: ${msg}`),\n );\n },\n },\n );\n const { failures } = decodeCodec(DeletePreferenceRecordsResponse, response);\n if (failures.length > 0) {\n return failures.map(({ index, error }) => ({\n ...chunk[index],\n error,\n }));\n }\n return [];\n } catch (err) {\n return chunk.map((record) => ({\n ...record,\n error: (err as Error).message,\n }));\n }\n}\n\n/**\n * Delete consent preferences for the managed consent database (delete endpoint)\n *\n * Uses POST /v1/preferences/{partition}/delete.\n *\n *\n * @param sombra - Sombra instance (must include auth headers)\n * @param options - Query options\n * @returns All nodes (only when onItems is not provided)\n */\nexport async function bulkDeletePreferenceRecords(\n sombra: Got,\n {\n partition,\n filePath,\n timestamp,\n maxItemsInChunk,\n maxConcurrency,\n }: DeletePreferenceRecordsOptions,\n): Promise<FailedResult[]> {\n const anchorIdentifiers = readCsv(filePath, DeletePreferenceRecordCliCsvRow);\n return bulkDeletePreferenceRecordsFromRows(sombra, {\n anchorIdentifiers,\n partition,\n timestamp,\n maxItemsInChunk,\n maxConcurrency,\n logger,\n });\n}\n\n/**\n * Delete decoded consent preference identifiers from the managed consent database.\n *\n * @param sombra - Sombra instance with authentication headers.\n * @param options - Decoded rows and deletion options.\n * @returns Failed deletions.\n */\nexport async function bulkDeletePreferenceRecordsFromRows(\n sombra: Got,\n {\n anchorIdentifiers,\n partition,\n timestamp,\n maxItemsInChunk,\n maxConcurrency,\n logger,\n }: DeletePreferenceRecordRowsOptions,\n): Promise<FailedResult[]> {\n const chunks = chunk(anchorIdentifiers, maxItemsInChunk);\n\n const failedResults = await map(\n chunks,\n async (identifierChunk) => {\n const failedResults = await deletePreferenceRecordsRepository(sombra, {\n partition,\n identifierChunk,\n timestamp,\n logger,\n });\n return failedResults;\n },\n { concurrency: maxConcurrency },\n );\n return failedResults.flat();\n}\n","import path from 'node:path';\n\nimport { createSombraGotInstance, DeletePreferenceRecordCliCsvRow } from '@transcend-io/sdk';\nimport { map } from '@transcend-io/utils';\nimport cliProgress from 'cli-progress';\nimport colors from 'colors';\n\nimport type { LocalContext } from '../../../context.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { writeCsv } from '../../../lib/helpers/index.js';\nimport { bulkDeletePreferenceRecordsFromRows } from '../../../lib/preference-management/index.js';\nimport { parseCsv } from '../../../lib/requests/readCsv.js';\n\nexport interface DeletePreferenceRecordsCommandFlags {\n /** Transcend API key for authentication */\n auth: string;\n /** Partition ID to delete preference records from */\n partition: string;\n /** Optional Sombra internal key for self-hosted instances */\n sombraAuth?: string;\n /** Path to the CSV file used to identify preference records to delete */\n file?: string;\n /** Path to the directory of CSV files to load preferences from */\n directory?: string;\n /** Base URL for the Transcend API */\n transcendUrl: string;\n /** The timestamp when the deletion operation is made. Used for logging purposes. */\n timestamp: Date;\n /** Maximum items to include in each deletion chunk */\n maxItemsInChunk: number;\n /** Maximum concurrency for deletion requests */\n maxConcurrency: number;\n /** Directory to write receipts of failed deletions to */\n receiptDirectory: string;\n /** Number of files to process concurrently when deleting preference records from multiple files */\n fileConcurrency: number;\n}\n\nexport async function deletePreferenceRecords(\n this: LocalContext,\n {\n auth,\n partition,\n sombraAuth,\n file = '',\n directory,\n transcendUrl,\n timestamp,\n maxConcurrency,\n maxItemsInChunk,\n receiptDirectory,\n fileConcurrency,\n }: DeletePreferenceRecordsCommandFlags,\n): Promise<void> {\n if (!!directory && !!file) {\n this.logger.error(\n colors.red('Cannot provide both a directory and a file. Please provide only one.'),\n );\n this.process.exit(1);\n }\n\n if (!file && !directory) {\n this.logger.error(\n colors.red(\n 'A file or directory must be provided. Please provide one using --file=./preferences.csv or --directory=./preferences',\n ),\n );\n this.process.exit(1);\n }\n doneInputValidation(this.process);\n\n const files: string[] = [];\n\n if (directory) {\n try {\n const filesInDirectory = this.fs.readdirSync(directory);\n const csvFiles = filesInDirectory.filter((file) => file.endsWith('.csv'));\n\n if (csvFiles.length === 0) {\n this.logger.error(colors.red(`No CSV files found in directory: ${directory}`));\n this.process.exit(1);\n }\n\n // Add full paths for each CSV file\n files.push(...csvFiles.map((file) => path.join(directory, file)));\n } catch (err) {\n this.logger.error(colors.red(`Failed to read directory: ${directory}`));\n this.logger.error(colors.red((err as Error).message));\n this.process.exit(1);\n }\n } else {\n try {\n // Verify file exists and is a CSV\n if (!file.endsWith('.csv')) {\n this.logger.error(colors.red('File must be a CSV file'));\n this.process.exit(1);\n }\n files.push(file);\n } catch (err) {\n this.logger.error(colors.red(`Failed to access file: ${file}`));\n this.logger.error(colors.red((err as Error).message));\n this.process.exit(1);\n }\n }\n\n this.logger.debug(\n colors.green(\n `Processing ${files.length} consent preferences files for partition: ${partition}`,\n ),\n );\n this.logger.debug(`\\nFiles to process: ${files.join(', ')}\\n`);\n\n // Create sombra instance to communicate with\n const sombra = await createSombraGotInstance(transcendUrl, auth, {\n logger: this.logger,\n sombraApiKey: sombraAuth,\n sombraUrl: this.process.env.SOMBRA_URL,\n });\n const globalProgressBar = new cliProgress.SingleBar(\n {\n format: `Deletion Progress |${colors.cyan('[{bar}]')}| Duration: ${colors.red(\n '{duration_formatted}',\n )} | {value}/{total} Files Processed `,\n },\n cliProgress.Presets.shades_classic,\n );\n globalProgressBar.start(files.length, 0);\n\n // Process batch of files with concurrency\n const failedResultsArrays = await map(\n files,\n async (filePath) => {\n const anchorIdentifiers = parseCsv(\n this.fs.readFileSync(filePath, 'utf8'),\n DeletePreferenceRecordCliCsvRow,\n );\n const result = await bulkDeletePreferenceRecordsFromRows(sombra, {\n partition,\n anchorIdentifiers,\n timestamp,\n maxItemsInChunk,\n maxConcurrency,\n logger: this.logger,\n });\n globalProgressBar.increment();\n return result;\n },\n { concurrency: fileConcurrency },\n );\n globalProgressBar.stop();\n const failedResults = failedResultsArrays.flat();\n\n // Check for failed results and write receipt if any\n let receiptPath = '';\n if (failedResults.length > 0) {\n receiptPath = path.join(receiptDirectory, `deletion-failures-${Date.now()}.csv`);\n writeCsv(receiptPath, failedResults, true);\n }\n\n this.logger.info(colors.green('\\n\\n ================================== \\n\\n'));\n this.logger.info(colors.green('\\n#### Deletion Summary Report #####\\n'));\n this.logger.info(\n colors.green(\n `📁 Total Files Processed: ${files.length} \\n` +\n `❌ Errors: ${failedResults.length} \\n` +\n `📝 Receipt Path: ${receiptPath || 'N/A'}`,\n ),\n );\n this.logger.info(colors.green('\\n\\n==================================\\n\\n'));\n}\n"],"mappings":"4fAgEA,eAAe,EACb,EACA,CACE,YACA,gBAAiB,EACjB,YACA,OAAQ,GAEe,CACzB,GAAI,CAwBF,GAAM,CAAE,YAAa,EAAY,EAAiC,MAvB3C,EACrB,gCAEE,EACG,KAAK,kBAAkB,EAAU,SAAU,CAC1C,KAAM,CACJ,QAAS,EAAM,IAAK,IAAY,CAC9B,iBAAkB,EAClB,UAAW,EAAU,aAAa,CACnC,EAAE,CACJ,CACF,CAAC,CACD,MAAM,CACX,CACE,OAAQ,EACR,YAAa,EACb,SAAU,EAAS,EAAM,IAAQ,CAC/B,EAAc,KACZ,EAAO,OAAO,WAAW,EAAQ,wCAAwC,IAAM,CAChF,EAEJ,CACF,CAC0E,CAO3E,OANI,EAAS,OAAS,EACb,EAAS,KAAK,CAAE,QAAO,YAAa,CACzC,GAAG,EAAM,GACT,QACD,EAAE,CAEE,EAAE,OACF,EAAK,CACZ,OAAO,EAAM,IAAK,IAAY,CAC5B,GAAG,EACH,MAAQ,EAAc,QACvB,EAAE,EA0CP,eAAsB,EACpB,EACA,CACE,oBACA,YACA,YACA,kBACA,iBACA,UAEuB,CAgBzB,OAAO,MAbqB,EAFb,EAAM,EAAmB,EAGhC,CACN,KAAO,IAOE,MANqB,EAAkC,EAAQ,CACpE,YACA,kBACA,YACA,SACD,CAAC,CAGJ,CAAE,YAAa,EAAgB,CAChC,EACoB,MAAM,CC3I7B,eAAsB,EAEpB,CACE,OACA,YACA,aACA,OAAO,GACP,YACA,eACA,YACA,iBACA,kBACA,mBACA,mBAEa,CACT,GAAe,IACnB,KAAK,OAAO,MACV,EAAO,IAAI,uEAAuE,CACnF,CACD,KAAK,QAAQ,KAAK,EAAE,EAGlB,CAAC,GAAQ,CAAC,IACZ,KAAK,OAAO,MACV,EAAO,IACL,uHACD,CACF,CACD,KAAK,QAAQ,KAAK,EAAE,EAEtB,EAAoB,KAAK,QAAQ,CAEjC,IAAM,EAAkB,EAAE,CAE1B,GAAI,EACF,GAAI,CAEF,IAAM,EADmB,KAAK,GAAG,YAAY,EACZ,CAAC,OAAQ,GAAS,EAAK,SAAS,OAAO,CAAC,CAErE,EAAS,SAAW,IACtB,KAAK,OAAO,MAAM,EAAO,IAAI,oCAAoC,IAAY,CAAC,CAC9E,KAAK,QAAQ,KAAK,EAAE,EAItB,EAAM,KAAK,GAAG,EAAS,IAAK,GAAS,EAAK,KAAK,EAAW,EAAK,CAAC,CAAC,OAC1D,EAAK,CACZ,KAAK,OAAO,MAAM,EAAO,IAAI,6BAA6B,IAAY,CAAC,CACvE,KAAK,OAAO,MAAM,EAAO,IAAK,EAAc,QAAQ,CAAC,CACrD,KAAK,QAAQ,KAAK,EAAE,MAGtB,GAAI,CAEG,EAAK,SAAS,OAAO,GACxB,KAAK,OAAO,MAAM,EAAO,IAAI,0BAA0B,CAAC,CACxD,KAAK,QAAQ,KAAK,EAAE,EAEtB,EAAM,KAAK,EAAK,OACT,EAAK,CACZ,KAAK,OAAO,MAAM,EAAO,IAAI,0BAA0B,IAAO,CAAC,CAC/D,KAAK,OAAO,MAAM,EAAO,IAAK,EAAc,QAAQ,CAAC,CACrD,KAAK,QAAQ,KAAK,EAAE,CAIxB,KAAK,OAAO,MACV,EAAO,MACL,cAAc,EAAM,OAAO,4CAA4C,IACxE,CACF,CACD,KAAK,OAAO,MAAM,uBAAuB,EAAM,KAAK,KAAK,CAAC,IAAI,CAG9D,IAAM,EAAS,MAAM,EAAwB,EAAc,EAAM,CAC/D,OAAQ,KAAK,OACb,aAAc,EACd,UAAW,KAAK,QAAQ,IAAI,WAC7B,CAAC,CACI,EAAoB,IAAI,EAAY,UACxC,CACE,OAAQ,sBAAsB,EAAO,KAAK,UAAU,CAAC,cAAc,EAAO,IACxE,uBACD,CAAC,qCACH,CACD,EAAY,QAAQ,eACrB,CACD,EAAkB,MAAM,EAAM,OAAQ,EAAE,CAGxC,IAAM,EAAsB,MAAM,EAChC,EACA,KAAO,IAAa,CAKlB,IAAM,EAAS,MAAM,EAAoC,EAAQ,CAC/D,YACA,kBANwB,EACxB,KAAK,GAAG,aAAa,EAAU,OAAO,CACtC,EAIiB,CACjB,YACA,kBACA,iBACA,OAAQ,KAAK,OACd,CAAC,CAEF,OADA,EAAkB,WAAW,CACtB,GAET,CAAE,YAAa,EAAiB,CACjC,CACD,EAAkB,MAAM,CACxB,IAAM,EAAgB,EAAoB,MAAM,CAG5C,EAAc,GACd,EAAc,OAAS,IACzB,EAAc,EAAK,KAAK,EAAkB,qBAAqB,KAAK,KAAK,CAAC,MAAM,CAChF,EAAS,EAAa,EAAe,GAAK,EAG5C,KAAK,OAAO,KAAK,EAAO,MAAM;;;;EAA+C,CAAC,CAC9E,KAAK,OAAO,KAAK,EAAO,MAAM;;EAAyC,CAAC,CACxE,KAAK,OAAO,KACV,EAAO,MACL,6BAA6B,EAAM,OAAO,eAC3B,EAAc,OAAO,sBACd,GAAe,QACtC,CACF,CACD,KAAK,OAAO,KAAK,EAAO,MAAM;;;;EAA6C,CAAC"}
1
+ {"version":3,"file":"impl-WJBuS_0m.mjs","names":[],"sources":["../src/lib/preference-management/bulkDeletePreferenceRecords.ts","../src/commands/consent/delete-preference-records/impl.ts"],"sourcesContent":["import {\n DeletePreferenceRecordCliCsvRow,\n DeletePreferenceRecordsResponse,\n withTransientRetry,\n} from '@transcend-io/sdk';\nimport { decodeCodec } from '@transcend-io/type-utils';\nimport { map } from '@transcend-io/utils';\nimport colors from 'colors';\nimport type { Got } from 'got';\nimport { chunk } from 'lodash-es';\n\nimport type { CliLogger } from '../../context.js';\nimport { logger } from '../../logger.js';\nimport { readCsv } from '../requests/index.js';\n\ninterface FailedResult extends DeletePreferenceRecordCliCsvRow {\n /** Error message describing the failure */\n error: string;\n}\n\ninterface DeletePreferenceRecordsRepositoryOptions {\n /** The partition to delete from */\n partition: string;\n /** Chunk of identifiers to delete */\n identifierChunk: DeletePreferenceRecordCliCsvRow[];\n /** the timestamp for the deletion operation */\n timestamp: Date;\n /** Command logger */\n logger: CliLogger;\n}\n\n/**\n * Options for deleting preference records\n */\ntype DeletePreferenceRecordsOptions = Omit<\n DeletePreferenceRecordsRepositoryOptions,\n 'identifierChunk' | 'logger'\n> & {\n /** The file path to read CSV rows from */\n filePath: string;\n /** Maximum items to include in each deletion chunk */\n maxItemsInChunk: number;\n /** Maximum concurrency for deletion requests */\n maxConcurrency: number;\n};\n\ntype DeletePreferenceRecordRowsOptions = Omit<DeletePreferenceRecordsOptions, 'filePath'> & {\n /** Decoded identifiers to delete */\n anchorIdentifiers: DeletePreferenceRecordCliCsvRow[];\n /** Command logger */\n logger: CliLogger;\n};\n\n/**\n *\n * Delete a chunk of preference records\n *\n * @param sombra - Sombra instance (must include auth headers)\n * @param options - Options for deletion\n * @param options.partition - The partition to delete from\n * @param options.identifierChunk - Chunk of identifiers to delete\n * @param options.timestamp - The timestamp for the deletion operation\n * @returns List of failed deletions\n */\nasync function deletePreferenceRecordsRepository(\n sombra: Got,\n {\n partition,\n identifierChunk: chunk,\n timestamp,\n logger: commandLogger,\n }: DeletePreferenceRecordsRepositoryOptions,\n): Promise<FailedResult[]> {\n try {\n const response = await withTransientRetry(\n 'Delete Preference Records',\n () =>\n sombra\n .post(`v1/preferences/${partition}/delete`, {\n json: {\n records: chunk.map((record) => ({\n anchorIdentifier: record,\n timestamp: timestamp.toISOString(),\n })),\n },\n })\n .json(),\n {\n logger: commandLogger,\n maxAttempts: 3,\n onRetry: (attempt, _err, msg) => {\n commandLogger.warn(\n colors.yellow(`Attempt ${attempt} to delete preference records failed: ${msg}`),\n );\n },\n },\n );\n const { failures } = decodeCodec(DeletePreferenceRecordsResponse, response);\n if (failures.length > 0) {\n return failures.map(({ index, error }) => ({\n ...chunk[index],\n error,\n }));\n }\n return [];\n } catch (err) {\n return chunk.map((record) => ({\n ...record,\n error: (err as Error).message,\n }));\n }\n}\n\n/**\n * Delete consent preferences for the managed consent database (delete endpoint)\n *\n * Uses POST /v1/preferences/{partition}/delete.\n *\n *\n * @param sombra - Sombra instance (must include auth headers)\n * @param options - Query options\n * @returns All nodes (only when onItems is not provided)\n */\nexport async function bulkDeletePreferenceRecords(\n sombra: Got,\n {\n partition,\n filePath,\n timestamp,\n maxItemsInChunk,\n maxConcurrency,\n }: DeletePreferenceRecordsOptions,\n): Promise<FailedResult[]> {\n const anchorIdentifiers = readCsv(filePath, DeletePreferenceRecordCliCsvRow);\n return bulkDeletePreferenceRecordsFromRows(sombra, {\n anchorIdentifiers,\n partition,\n timestamp,\n maxItemsInChunk,\n maxConcurrency,\n logger,\n });\n}\n\n/**\n * Delete decoded consent preference identifiers from the managed consent database.\n *\n * @param sombra - Sombra instance with authentication headers.\n * @param options - Decoded rows and deletion options.\n * @returns Failed deletions.\n */\nexport async function bulkDeletePreferenceRecordsFromRows(\n sombra: Got,\n {\n anchorIdentifiers,\n partition,\n timestamp,\n maxItemsInChunk,\n maxConcurrency,\n logger,\n }: DeletePreferenceRecordRowsOptions,\n): Promise<FailedResult[]> {\n const chunks = chunk(anchorIdentifiers, maxItemsInChunk);\n\n const failedResults = await map(\n chunks,\n async (identifierChunk) => {\n const failedResults = await deletePreferenceRecordsRepository(sombra, {\n partition,\n identifierChunk,\n timestamp,\n logger,\n });\n return failedResults;\n },\n { concurrency: maxConcurrency },\n );\n return failedResults.flat();\n}\n","import path from 'node:path';\n\nimport { createSombraGotInstance, DeletePreferenceRecordCliCsvRow } from '@transcend-io/sdk';\nimport { map } from '@transcend-io/utils';\nimport cliProgress from 'cli-progress';\nimport colors from 'colors';\n\nimport type { LocalContext } from '../../../context.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { writeCsv } from '../../../lib/helpers/index.js';\nimport { bulkDeletePreferenceRecordsFromRows } from '../../../lib/preference-management/index.js';\nimport { parseCsv } from '../../../lib/requests/readCsv.js';\n\nexport interface DeletePreferenceRecordsCommandFlags {\n /** Transcend API key for authentication */\n auth: string;\n /** Partition ID to delete preference records from */\n partition: string;\n /** Optional Sombra internal key for self-hosted instances */\n sombraAuth?: string;\n /** Path to the CSV file used to identify preference records to delete */\n file?: string;\n /** Path to the directory of CSV files to load preferences from */\n directory?: string;\n /** Base URL for the Transcend API */\n transcendUrl: string;\n /** The timestamp when the deletion operation is made. Used for logging purposes. */\n timestamp: Date;\n /** Maximum items to include in each deletion chunk */\n maxItemsInChunk: number;\n /** Maximum concurrency for deletion requests */\n maxConcurrency: number;\n /** Directory to write receipts of failed deletions to */\n receiptDirectory: string;\n /** Number of files to process concurrently when deleting preference records from multiple files */\n fileConcurrency: number;\n}\n\nexport async function deletePreferenceRecords(\n this: LocalContext,\n {\n auth,\n partition,\n sombraAuth,\n file = '',\n directory,\n transcendUrl,\n timestamp,\n maxConcurrency,\n maxItemsInChunk,\n receiptDirectory,\n fileConcurrency,\n }: DeletePreferenceRecordsCommandFlags,\n): Promise<void> {\n if (!!directory && !!file) {\n this.logger.error(\n colors.red('Cannot provide both a directory and a file. Please provide only one.'),\n );\n this.process.exit(1);\n }\n\n if (!file && !directory) {\n this.logger.error(\n colors.red(\n 'A file or directory must be provided. Please provide one using --file=./preferences.csv or --directory=./preferences',\n ),\n );\n this.process.exit(1);\n }\n doneInputValidation(this.process);\n\n const files: string[] = [];\n\n if (directory) {\n try {\n const filesInDirectory = this.fs.readdirSync(directory);\n const csvFiles = filesInDirectory.filter((file) => file.endsWith('.csv'));\n\n if (csvFiles.length === 0) {\n this.logger.error(colors.red(`No CSV files found in directory: ${directory}`));\n this.process.exit(1);\n }\n\n // Add full paths for each CSV file\n files.push(...csvFiles.map((file) => path.join(directory, file)));\n } catch (err) {\n this.logger.error(colors.red(`Failed to read directory: ${directory}`));\n this.logger.error(colors.red((err as Error).message));\n this.process.exit(1);\n }\n } else {\n try {\n // Verify file exists and is a CSV\n if (!file.endsWith('.csv')) {\n this.logger.error(colors.red('File must be a CSV file'));\n this.process.exit(1);\n }\n files.push(file);\n } catch (err) {\n this.logger.error(colors.red(`Failed to access file: ${file}`));\n this.logger.error(colors.red((err as Error).message));\n this.process.exit(1);\n }\n }\n\n this.logger.debug(\n colors.green(\n `Processing ${files.length} consent preferences files for partition: ${partition}`,\n ),\n );\n this.logger.debug(`\\nFiles to process: ${files.join(', ')}\\n`);\n\n // Create sombra instance to communicate with\n const sombra = await createSombraGotInstance(transcendUrl, auth, {\n logger: this.logger,\n sombraApiKey: sombraAuth,\n sombraUrl: this.process.env.SOMBRA_URL,\n });\n const globalProgressBar = new cliProgress.SingleBar(\n {\n format: `Deletion Progress |${colors.cyan('[{bar}]')}| Duration: ${colors.red(\n '{duration_formatted}',\n )} | {value}/{total} Files Processed `,\n },\n cliProgress.Presets.shades_classic,\n );\n globalProgressBar.start(files.length, 0);\n\n // Process batch of files with concurrency\n const failedResultsArrays = await map(\n files,\n async (filePath) => {\n const anchorIdentifiers = parseCsv(\n this.fs.readFileSync(filePath, 'utf8'),\n DeletePreferenceRecordCliCsvRow,\n );\n const result = await bulkDeletePreferenceRecordsFromRows(sombra, {\n partition,\n anchorIdentifiers,\n timestamp,\n maxItemsInChunk,\n maxConcurrency,\n logger: this.logger,\n });\n globalProgressBar.increment();\n return result;\n },\n { concurrency: fileConcurrency },\n );\n globalProgressBar.stop();\n const failedResults = failedResultsArrays.flat();\n\n // Check for failed results and write receipt if any\n let receiptPath = '';\n if (failedResults.length > 0) {\n receiptPath = path.join(receiptDirectory, `deletion-failures-${Date.now()}.csv`);\n writeCsv(receiptPath, failedResults, true);\n }\n\n this.logger.info(colors.green('\\n\\n ================================== \\n\\n'));\n this.logger.info(colors.green('\\n#### Deletion Summary Report #####\\n'));\n this.logger.info(\n colors.green(\n `📁 Total Files Processed: ${files.length} \\n` +\n `❌ Errors: ${failedResults.length} \\n` +\n `📝 Receipt Path: ${receiptPath || 'N/A'}`,\n ),\n );\n this.logger.info(colors.green('\\n\\n==================================\\n\\n'));\n}\n"],"mappings":"4fAgEA,eAAe,EACb,EACA,CACE,YACA,gBAAiB,EACjB,YACA,OAAQ,GAEe,CACzB,GAAI,CAwBF,GAAM,CAAE,YAAa,EAAY,EAAiC,MAvB3C,EACrB,gCAEE,EACG,KAAK,kBAAkB,EAAU,SAAU,CAC1C,KAAM,CACJ,QAAS,EAAM,IAAK,IAAY,CAC9B,iBAAkB,EAClB,UAAW,EAAU,aAAa,CACnC,EAAE,CACJ,CACF,CAAC,CACD,MAAM,CACX,CACE,OAAQ,EACR,YAAa,EACb,SAAU,EAAS,EAAM,IAAQ,CAC/B,EAAc,KACZ,EAAO,OAAO,WAAW,EAAQ,wCAAwC,IAAM,CAChF,EAEJ,CACF,CAC0E,CAO3E,OANI,EAAS,OAAS,EACb,EAAS,KAAK,CAAE,QAAO,YAAa,CACzC,GAAG,EAAM,GACT,QACD,EAAE,CAEE,EAAE,OACF,EAAK,CACZ,OAAO,EAAM,IAAK,IAAY,CAC5B,GAAG,EACH,MAAQ,EAAc,QACvB,EAAE,EA0CP,eAAsB,EACpB,EACA,CACE,oBACA,YACA,YACA,kBACA,iBACA,UAEuB,CAgBzB,OAAO,MAbqB,EAFb,EAAM,EAAmB,EAGhC,CACN,KAAO,IAOE,MANqB,EAAkC,EAAQ,CACpE,YACA,kBACA,YACA,SACD,CAAC,CAGJ,CAAE,YAAa,EAAgB,CAChC,EACoB,MAAM,CC3I7B,eAAsB,EAEpB,CACE,OACA,YACA,aACA,OAAO,GACP,YACA,eACA,YACA,iBACA,kBACA,mBACA,mBAEa,CACT,GAAe,IACnB,KAAK,OAAO,MACV,EAAO,IAAI,uEAAuE,CACnF,CACD,KAAK,QAAQ,KAAK,EAAE,EAGlB,CAAC,GAAQ,CAAC,IACZ,KAAK,OAAO,MACV,EAAO,IACL,uHACD,CACF,CACD,KAAK,QAAQ,KAAK,EAAE,EAEtB,EAAoB,KAAK,QAAQ,CAEjC,IAAM,EAAkB,EAAE,CAE1B,GAAI,EACF,GAAI,CAEF,IAAM,EADmB,KAAK,GAAG,YAAY,EACZ,CAAC,OAAQ,GAAS,EAAK,SAAS,OAAO,CAAC,CAErE,EAAS,SAAW,IACtB,KAAK,OAAO,MAAM,EAAO,IAAI,oCAAoC,IAAY,CAAC,CAC9E,KAAK,QAAQ,KAAK,EAAE,EAItB,EAAM,KAAK,GAAG,EAAS,IAAK,GAAS,EAAK,KAAK,EAAW,EAAK,CAAC,CAAC,OAC1D,EAAK,CACZ,KAAK,OAAO,MAAM,EAAO,IAAI,6BAA6B,IAAY,CAAC,CACvE,KAAK,OAAO,MAAM,EAAO,IAAK,EAAc,QAAQ,CAAC,CACrD,KAAK,QAAQ,KAAK,EAAE,MAGtB,GAAI,CAEG,EAAK,SAAS,OAAO,GACxB,KAAK,OAAO,MAAM,EAAO,IAAI,0BAA0B,CAAC,CACxD,KAAK,QAAQ,KAAK,EAAE,EAEtB,EAAM,KAAK,EAAK,OACT,EAAK,CACZ,KAAK,OAAO,MAAM,EAAO,IAAI,0BAA0B,IAAO,CAAC,CAC/D,KAAK,OAAO,MAAM,EAAO,IAAK,EAAc,QAAQ,CAAC,CACrD,KAAK,QAAQ,KAAK,EAAE,CAIxB,KAAK,OAAO,MACV,EAAO,MACL,cAAc,EAAM,OAAO,4CAA4C,IACxE,CACF,CACD,KAAK,OAAO,MAAM,uBAAuB,EAAM,KAAK,KAAK,CAAC,IAAI,CAG9D,IAAM,EAAS,MAAM,EAAwB,EAAc,EAAM,CAC/D,OAAQ,KAAK,OACb,aAAc,EACd,UAAW,KAAK,QAAQ,IAAI,WAC7B,CAAC,CACI,EAAoB,IAAI,EAAY,UACxC,CACE,OAAQ,sBAAsB,EAAO,KAAK,UAAU,CAAC,cAAc,EAAO,IACxE,uBACD,CAAC,qCACH,CACD,EAAY,QAAQ,eACrB,CACD,EAAkB,MAAM,EAAM,OAAQ,EAAE,CAGxC,IAAM,EAAsB,MAAM,EAChC,EACA,KAAO,IAAa,CAKlB,IAAM,EAAS,MAAM,EAAoC,EAAQ,CAC/D,YACA,kBANwB,EACxB,KAAK,GAAG,aAAa,EAAU,OAAO,CACtC,EAIiB,CACjB,YACA,kBACA,iBACA,OAAQ,KAAK,OACd,CAAC,CAEF,OADA,EAAkB,WAAW,CACtB,GAET,CAAE,YAAa,EAAiB,CACjC,CACD,EAAkB,MAAM,CACxB,IAAM,EAAgB,EAAoB,MAAM,CAG5C,EAAc,GACd,EAAc,OAAS,IACzB,EAAc,EAAK,KAAK,EAAkB,qBAAqB,KAAK,KAAK,CAAC,MAAM,CAChF,EAAS,EAAa,EAAe,GAAK,EAG5C,KAAK,OAAO,KAAK,EAAO,MAAM;;;;EAA+C,CAAC,CAC9E,KAAK,OAAO,KAAK,EAAO,MAAM;;EAAyC,CAAC,CACxE,KAAK,OAAO,KACV,EAAO,MACL,6BAA6B,EAAM,OAAO,eAC3B,EAAc,OAAO,sBACd,GAAe,QACtC,CACF,CACD,KAAK,OAAO,KAAK,EAAO,MAAM;;;;EAA6C,CAAC"}
@@ -1,2 +1,2 @@
1
- import{t as e}from"./skipPreflightJobs-DkBdYw-r.mjs";import{t}from"./done-input-validation-LiTaCEzF.mjs";async function n({auth:n,transcendUrl:r,enricherIds:i}){t(this.process),await e({transcendUrl:r,auth:n,enricherIds:i})}export{n as skipPreflightJobs};
2
- //# sourceMappingURL=impl-DiwxYcux.mjs.map
1
+ import{t as e}from"./skipPreflightJobs-KdcSw8Td.mjs";import{t}from"./done-input-validation-LiTaCEzF.mjs";async function n({auth:n,transcendUrl:r,enricherIds:i}){t(this.process),await e({transcendUrl:r,auth:n,enricherIds:i})}export{n as skipPreflightJobs};
2
+ //# sourceMappingURL=impl-b4KAEVci.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"impl-DiwxYcux.mjs","names":["skipPreflightJobsHelper"],"sources":["../src/commands/request/skip-preflight-jobs/impl.ts"],"sourcesContent":["import type { LocalContext } from '../../../context.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { skipPreflightJobs as skipPreflightJobsHelper } from '../../../lib/requests/index.js';\n\nexport interface SkipPreflightJobsCommandFlags {\n auth: string;\n enricherIds: string[];\n transcendUrl: string;\n}\n\nexport async function skipPreflightJobs(\n this: LocalContext,\n { auth, transcendUrl, enricherIds }: SkipPreflightJobsCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process);\n\n await skipPreflightJobsHelper({\n transcendUrl,\n auth,\n enricherIds,\n });\n}\n"],"mappings":"yGAUA,eAAsB,EAEpB,CAAE,OAAM,eAAc,eACP,CACf,EAAoB,KAAK,QAAQ,CAEjC,MAAMA,EAAwB,CAC5B,eACA,OACA,cACD,CAAC"}
1
+ {"version":3,"file":"impl-b4KAEVci.mjs","names":["skipPreflightJobsHelper"],"sources":["../src/commands/request/skip-preflight-jobs/impl.ts"],"sourcesContent":["import type { LocalContext } from '../../../context.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { skipPreflightJobs as skipPreflightJobsHelper } from '../../../lib/requests/index.js';\n\nexport interface SkipPreflightJobsCommandFlags {\n auth: string;\n enricherIds: string[];\n transcendUrl: string;\n}\n\nexport async function skipPreflightJobs(\n this: LocalContext,\n { auth, transcendUrl, enricherIds }: SkipPreflightJobsCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process);\n\n await skipPreflightJobsHelper({\n transcendUrl,\n auth,\n enricherIds,\n });\n}\n"],"mappings":"yGAUA,eAAsB,EAEpB,CAAE,OAAM,eAAc,eACP,CACf,EAAoB,KAAK,QAAQ,CAEjC,MAAMA,EAAwB,CAC5B,eACA,OACA,cACD,CAAC"}
@@ -0,0 +1,3 @@
1
+ import{r as e,t}from"./policyEngineCliError-CZrOHhLv.mjs";import{i as n,r,t as i}from"./printResult-Dmwv78e7.mjs";import{t as a}from"./formatPolicyBundleVersionSummary-DCHl1Vhy.mjs";import{n as o}from"./resolveBundleIdByName-BPrMkU0w.mjs";import{t as s}from"./done-input-validation-LiTaCEzF.mjs";import{t as c}from"./command-output-BJcDRXNr.mjs";import l from"colors";async function u({"remote-bundle-name":u,auth:d,"transcend-url":f,json:p,debug:m=!1}){s(this.process),e(m);let h=c(this.logger,p),g=n(f,d),_=await o(g,u);if(!_)throw Error(`Policy bundle "${u}" was not found for this organization.`);h.info(l.green(`Deactivating active version for bundle "${u}"...`));let v;try{v=await g.post(`v1/policy-engine/policy-bundles/${_}/deactivate`).json()}catch(e){if(e?.response?.statusCode===409)throw new t(`Policy bundle "${u}" has no active version.`,{cause:e});r(e)}i(this.process.stdout,{json:p,data:v,renderTable:()=>[`bundleId ${v.bundle.id}`,`bundleName ${v.bundle.bundleName}`,a(v.version)].join(`
2
+ `)}),h.info(l.green(`Policy bundle version deactivated.`))}export{u as deactivate};
3
+ //# sourceMappingURL=impl-defjX-97.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"impl-defjX-97.mjs","names":[],"sources":["../src/commands/policy/deactivate/impl.ts"],"sourcesContent":["import colors from 'colors';\n\nimport type { LocalContext } from '../../../context.js';\nimport { selectCommandLogger } from '../../../lib/cli/command-output.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport {\n buildPolicyEngineClient,\n formatPolicyBundleVersionSummary,\n printResult,\n resolveBundleIdByName,\n setPolicyEngineCliDebug,\n throwPolicyEngineRequestError,\n PolicyEngineCliError,\n} from '../helpers/index.js';\nimport type { DeactivatePolicyBundleResponse } from '../types.js';\n\n/** CLI flags for `transcend policy deactivate`. */\nexport interface DeactivateCommandFlags {\n /** Logical bundle name to deactivate */\n 'remote-bundle-name': string;\n /** Transcend API key */\n auth: string;\n /** Transcend API URL */\n 'transcend-url': string;\n /** Print raw JSON response */\n json: boolean;\n /** Include technical error details when a command fails */\n debug?: boolean;\n}\n\n/**\n * Deactivate the currently active version of a policy bundle.\n *\n * Resolves `--remote-bundle-name` to the parent bundle UUID internally, then calls the\n * Policy Engine deactivate endpoint. The bundle is addressed by name only -- the\n * UUID is never exposed to the operator.\n *\n * @param this - CLI context\n * @param flags - Command flags\n */\nexport async function deactivate(\n this: LocalContext,\n {\n 'remote-bundle-name': bundleName,\n auth,\n 'transcend-url': transcendUrl,\n json,\n debug = false,\n }: DeactivateCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process);\n setPolicyEngineCliDebug(debug);\n\n const commandLogger = selectCommandLogger(this.logger, json);\n const client = buildPolicyEngineClient(transcendUrl, auth);\n\n const resolvedBundleId = await resolveBundleIdByName(client, bundleName);\n if (!resolvedBundleId) {\n throw new Error(`Policy bundle \"${bundleName}\" was not found for this organization.`);\n }\n\n commandLogger.info(colors.green(`Deactivating active version for bundle \"${bundleName}\"...`));\n\n let body: DeactivatePolicyBundleResponse;\n try {\n body = await client\n .post(`v1/policy-engine/policy-bundles/${resolvedBundleId}/deactivate`)\n .json<DeactivatePolicyBundleResponse>();\n } catch (err) {\n // The monolith 409 references the internal bundle UUID; rewrite it to the\n // user-supplied bundle name so the error is actionable.\n const statusCode = (err as { response?: { statusCode?: number } })?.response?.statusCode;\n if (statusCode === 409) {\n throw new PolicyEngineCliError(`Policy bundle \"${bundleName}\" has no active version.`, {\n cause: err,\n });\n }\n throwPolicyEngineRequestError(err);\n }\n\n printResult(this.process.stdout, {\n json,\n data: body,\n renderTable: () =>\n [\n `bundleId ${body.bundle.id}`,\n `bundleName ${body.bundle.bundleName}`,\n formatPolicyBundleVersionSummary(body.version),\n ].join('\\n'),\n });\n\n commandLogger.info(colors.green('Policy bundle version deactivated.'));\n}\n"],"mappings":"gXAwCA,eAAsB,EAEpB,CACE,qBAAsB,EACtB,OACA,gBAAiB,EACjB,OACA,QAAQ,IAEK,CACf,EAAoB,KAAK,QAAQ,CACjC,EAAwB,EAAM,CAE9B,IAAM,EAAgB,EAAoB,KAAK,OAAQ,EAAK,CACtD,EAAS,EAAwB,EAAc,EAAK,CAEpD,EAAmB,MAAM,EAAsB,EAAQ,EAAW,CACxE,GAAI,CAAC,EACH,MAAU,MAAM,kBAAkB,EAAW,wCAAwC,CAGvF,EAAc,KAAK,EAAO,MAAM,2CAA2C,EAAW,MAAM,CAAC,CAE7F,IAAI,EACJ,GAAI,CACF,EAAO,MAAM,EACV,KAAK,mCAAmC,EAAiB,aAAa,CACtE,MAAsC,OAClC,EAAK,CAIZ,GADoB,GAAgD,UAAU,aAC3D,IACjB,MAAM,IAAI,EAAqB,kBAAkB,EAAW,0BAA2B,CACrF,MAAO,EACR,CAAC,CAEJ,EAA8B,EAAI,CAGpC,EAAY,KAAK,QAAQ,OAAQ,CAC/B,OACA,KAAM,EACN,gBACE,CACE,eAAe,EAAK,OAAO,KAC3B,eAAe,EAAK,OAAO,aAC3B,EAAiC,EAAK,QAAQ,CAC/C,CAAC,KAAK;EAAK,CACf,CAAC,CAEF,EAAc,KAAK,EAAO,MAAM,qCAAqC,CAAC"}
@@ -1,2 +1,2 @@
1
- import{t as e}from"./pushManualEnrichmentIdentifiersFromCsv-BTJGOmdU.mjs";import{t}from"./done-input-validation-LiTaCEzF.mjs";async function n({auth:n,transcendUrl:r,file:i,enricherId:a,concurrency:o,markSilent:s,sombraAuth:c}){t(this.process),await e({file:i,transcendUrl:r,enricherId:a,concurrency:o,markSilent:s,auth:n,sombraAuth:c})}export{n as pushIdentifiers};
2
- //# sourceMappingURL=impl-DTadLabu.mjs.map
1
+ import{t as e}from"./pushManualEnrichmentIdentifiersFromCsv-Bn_028w5.mjs";import{t}from"./done-input-validation-LiTaCEzF.mjs";async function n({auth:n,transcendUrl:r,file:i,enricherId:a,concurrency:o,markSilent:s,sombraAuth:c}){t(this.process),await e({file:i,transcendUrl:r,enricherId:a,concurrency:o,markSilent:s,auth:n,sombraAuth:c})}export{n as pushIdentifiers};
2
+ //# sourceMappingURL=impl-fg0UZYw6.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"impl-DTadLabu.mjs","names":[],"sources":["../src/commands/request/preflight/push-identifiers/impl.ts"],"sourcesContent":["import type { LocalContext } from '../../../../context.js';\nimport { doneInputValidation } from '../../../../lib/cli/done-input-validation.js';\nimport { pushManualEnrichmentIdentifiersFromCsv } from '../../../../lib/manual-enrichment/index.js';\n\nexport interface PushIdentifiersCommandFlags {\n auth: string;\n enricherId: string;\n sombraAuth?: string;\n transcendUrl: string;\n file: string;\n markSilent: boolean;\n concurrency: number;\n}\n\nexport async function pushIdentifiers(\n this: LocalContext,\n {\n auth,\n transcendUrl,\n file,\n enricherId,\n concurrency,\n markSilent,\n sombraAuth,\n }: PushIdentifiersCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process);\n\n await pushManualEnrichmentIdentifiersFromCsv({\n file,\n transcendUrl,\n enricherId,\n concurrency,\n markSilent,\n auth,\n sombraAuth,\n });\n}\n"],"mappings":"8HAcA,eAAsB,EAEpB,CACE,OACA,eACA,OACA,aACA,cACA,aACA,cAEa,CACf,EAAoB,KAAK,QAAQ,CAEjC,MAAM,EAAuC,CAC3C,OACA,eACA,aACA,cACA,aACA,OACA,aACD,CAAC"}
1
+ {"version":3,"file":"impl-fg0UZYw6.mjs","names":[],"sources":["../src/commands/request/preflight/push-identifiers/impl.ts"],"sourcesContent":["import type { LocalContext } from '../../../../context.js';\nimport { doneInputValidation } from '../../../../lib/cli/done-input-validation.js';\nimport { pushManualEnrichmentIdentifiersFromCsv } from '../../../../lib/manual-enrichment/index.js';\n\nexport interface PushIdentifiersCommandFlags {\n auth: string;\n enricherId: string;\n sombraAuth?: string;\n transcendUrl: string;\n file: string;\n markSilent: boolean;\n concurrency: number;\n}\n\nexport async function pushIdentifiers(\n this: LocalContext,\n {\n auth,\n transcendUrl,\n file,\n enricherId,\n concurrency,\n markSilent,\n sombraAuth,\n }: PushIdentifiersCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process);\n\n await pushManualEnrichmentIdentifiersFromCsv({\n file,\n transcendUrl,\n enricherId,\n concurrency,\n markSilent,\n auth,\n sombraAuth,\n });\n}\n"],"mappings":"8HAcA,eAAsB,EAEpB,CACE,OACA,eACA,OACA,aACA,cACA,aACA,cAEa,CACf,EAAoB,KAAK,QAAQ,CAEjC,MAAM,EAAuC,CAC3C,OACA,eACA,aACA,cACA,aACA,OACA,aACD,CAAC"}
@@ -1,2 +1,2 @@
1
- import{t as e}from"./skipRequestDataSilos-BRFiokix.mjs";import{t}from"./done-input-validation-LiTaCEzF.mjs";async function n({auth:n,dataSiloId:r,status:i,statuses:a,transcendUrl:o,actionTypes:s}){t(this.process),await e({transcendUrl:o,auth:n,status:i,dataSiloId:r,requestStatuses:a,actionTypes:s})}export{n as skipRequestDataSilos};
2
- //# sourceMappingURL=impl-Dr_l_SLd.mjs.map
1
+ import{t as e}from"./skipRequestDataSilos-Cy2NfP47.mjs";import{t}from"./done-input-validation-LiTaCEzF.mjs";async function n({auth:n,dataSiloId:r,status:i,statuses:a,transcendUrl:o,actionTypes:s}){t(this.process),await e({transcendUrl:o,auth:n,status:i,dataSiloId:r,requestStatuses:a,actionTypes:s})}export{n as skipRequestDataSilos};
2
+ //# sourceMappingURL=impl-hRK54juc.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"impl-Dr_l_SLd.mjs","names":["skipRequestDataSilosHelper"],"sources":["../src/commands/request/system/skip-request-data-silos/impl.ts"],"sourcesContent":["import type {\n RequestAction,\n RequestDataSiloStatus,\n RequestStatus,\n} from '@transcend-io/privacy-types';\n\nimport type { LocalContext } from '../../../../context.js';\nimport { doneInputValidation } from '../../../../lib/cli/done-input-validation.js';\nimport { skipRequestDataSilos as skipRequestDataSilosHelper } from '../../../../lib/requests/index.js';\n\nexport interface SkipRequestDataSilosCommandFlags {\n auth: string;\n dataSiloId: string;\n transcendUrl: string;\n statuses: RequestStatus[];\n status: (typeof RequestDataSiloStatus)['Skipped'] | (typeof RequestDataSiloStatus)['Resolved'];\n actionTypes?: RequestAction[];\n}\n\nexport async function skipRequestDataSilos(\n this: LocalContext,\n {\n auth,\n dataSiloId,\n status,\n statuses,\n transcendUrl,\n actionTypes,\n }: SkipRequestDataSilosCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process);\n\n await skipRequestDataSilosHelper({\n transcendUrl,\n auth,\n status,\n dataSiloId,\n requestStatuses: statuses,\n actionTypes,\n });\n}\n"],"mappings":"4GAmBA,eAAsB,EAEpB,CACE,OACA,aACA,SACA,WACA,eACA,eAEa,CACf,EAAoB,KAAK,QAAQ,CAEjC,MAAMA,EAA2B,CAC/B,eACA,OACA,SACA,aACA,gBAAiB,EACjB,cACD,CAAC"}
1
+ {"version":3,"file":"impl-hRK54juc.mjs","names":["skipRequestDataSilosHelper"],"sources":["../src/commands/request/system/skip-request-data-silos/impl.ts"],"sourcesContent":["import type {\n RequestAction,\n RequestDataSiloStatus,\n RequestStatus,\n} from '@transcend-io/privacy-types';\n\nimport type { LocalContext } from '../../../../context.js';\nimport { doneInputValidation } from '../../../../lib/cli/done-input-validation.js';\nimport { skipRequestDataSilos as skipRequestDataSilosHelper } from '../../../../lib/requests/index.js';\n\nexport interface SkipRequestDataSilosCommandFlags {\n auth: string;\n dataSiloId: string;\n transcendUrl: string;\n statuses: RequestStatus[];\n status: (typeof RequestDataSiloStatus)['Skipped'] | (typeof RequestDataSiloStatus)['Resolved'];\n actionTypes?: RequestAction[];\n}\n\nexport async function skipRequestDataSilos(\n this: LocalContext,\n {\n auth,\n dataSiloId,\n status,\n statuses,\n transcendUrl,\n actionTypes,\n }: SkipRequestDataSilosCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process);\n\n await skipRequestDataSilosHelper({\n transcendUrl,\n auth,\n status,\n dataSiloId,\n requestStatuses: statuses,\n actionTypes,\n });\n}\n"],"mappings":"4GAmBA,eAAsB,EAEpB,CACE,OACA,aACA,SACA,WACA,eACA,eAEa,CACf,EAAoB,KAAK,QAAQ,CAEjC,MAAMA,EAA2B,CAC/B,eACA,OACA,SACA,aACA,gBAAiB,EACjB,cACD,CAAC"}
@@ -1,2 +1,2 @@
1
- import{l as e}from"./constants-BRsj50Nb.mjs";import{t}from"./generateCrossAccountApiKeys-pWTrIUE6.mjs";import{t as n}from"./done-input-validation-LiTaCEzF.mjs";async function r({email:r,password:i,apiKeyTitle:a,file:o,scopes:s,deleteExistingApiKey:c,createNewApiKey:l,parentOrganizationId:u,transcendUrl:d}){n(this.process);let{errors:f,apiKeys:p}=await t({transcendUrl:d,password:i,email:r,parentOrganizationId:u,deleteExistingApiKey:c,createNewApiKey:l,apiKeyTitle:a,scopes:s.map(t=>e[t].name)});this.fs.writeFileSync(o,`${JSON.stringify(p,null,2)}\n`),f.length>0&&this.process.exit(1)}export{r as generateApiKeys};
2
- //# sourceMappingURL=impl-DJcNhpbx.mjs.map
1
+ import{l as e}from"./constants-BlKpAm3R.mjs";import{t}from"./generateCrossAccountApiKeys-CVdsJFOe.mjs";import{t as n}from"./done-input-validation-LiTaCEzF.mjs";async function r({email:r,password:i,apiKeyTitle:a,file:o,scopes:s,deleteExistingApiKey:c,createNewApiKey:l,parentOrganizationId:u,transcendUrl:d}){n(this.process);let{errors:f,apiKeys:p}=await t({transcendUrl:d,password:i,email:r,parentOrganizationId:u,deleteExistingApiKey:c,createNewApiKey:l,apiKeyTitle:a,scopes:s.map(t=>e[t].name)});this.fs.writeFileSync(o,`${JSON.stringify(p,null,2)}\n`),f.length>0&&this.process.exit(1)}export{r as generateApiKeys};
2
+ //# sourceMappingURL=impl-mjDxMEDR.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"impl-DJcNhpbx.mjs","names":[],"sources":["../src/commands/admin/generate-api-keys/impl.ts"],"sourcesContent":["import { ScopeName } from '@transcend-io/privacy-types';\n\nimport { SCOPES_BY_TITLE } from '../../../constants.js';\nimport type { LocalContext } from '../../../context.js';\nimport { generateCrossAccountApiKeys } from '../../../lib/api-keys/index.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\n\n// Command flag interface\nexport interface GenerateApiKeysCommandFlags {\n email: string;\n password: string;\n apiKeyTitle: string;\n file: string;\n scopes: string[];\n deleteExistingApiKey: boolean;\n createNewApiKey: boolean;\n parentOrganizationId?: string;\n transcendUrl: string;\n}\n\n// Command implementation\nexport async function generateApiKeys(\n this: LocalContext,\n {\n email,\n password,\n apiKeyTitle,\n file,\n scopes,\n deleteExistingApiKey,\n createNewApiKey,\n parentOrganizationId,\n transcendUrl,\n }: GenerateApiKeysCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process);\n\n const scopeNames = scopes.map((scopeTitle) => SCOPES_BY_TITLE[scopeTitle].name as ScopeName);\n\n // Upload privacy requests\n const { errors, apiKeys } = await generateCrossAccountApiKeys({\n transcendUrl,\n password,\n email,\n parentOrganizationId,\n deleteExistingApiKey,\n createNewApiKey,\n apiKeyTitle,\n scopes: scopeNames,\n });\n\n // Write to disk\n this.fs.writeFileSync(file, `${JSON.stringify(apiKeys, null, 2)}\\n`);\n if (errors.length > 0) {\n this.process.exit(1);\n }\n}\n"],"mappings":"gKAqBA,eAAsB,EAEpB,CACE,QACA,WACA,cACA,OACA,SACA,uBACA,kBACA,uBACA,gBAEa,CACf,EAAoB,KAAK,QAAQ,CAKjC,GAAM,CAAE,SAAQ,WAAY,MAAM,EAA4B,CAC5D,eACA,WACA,QACA,uBACA,uBACA,kBACA,cACA,OAXiB,EAAO,IAAK,GAAe,EAAgB,GAAY,KAWtD,CACnB,CAAC,CAGF,KAAK,GAAG,cAAc,EAAM,GAAG,KAAK,UAAU,EAAS,KAAM,EAAE,CAAC,IAAI,CAChE,EAAO,OAAS,GAClB,KAAK,QAAQ,KAAK,EAAE"}
1
+ {"version":3,"file":"impl-mjDxMEDR.mjs","names":[],"sources":["../src/commands/admin/generate-api-keys/impl.ts"],"sourcesContent":["import { ScopeName } from '@transcend-io/privacy-types';\n\nimport { SCOPES_BY_TITLE } from '../../../constants.js';\nimport type { LocalContext } from '../../../context.js';\nimport { generateCrossAccountApiKeys } from '../../../lib/api-keys/index.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\n\n// Command flag interface\nexport interface GenerateApiKeysCommandFlags {\n email: string;\n password: string;\n apiKeyTitle: string;\n file: string;\n scopes: string[];\n deleteExistingApiKey: boolean;\n createNewApiKey: boolean;\n parentOrganizationId?: string;\n transcendUrl: string;\n}\n\n// Command implementation\nexport async function generateApiKeys(\n this: LocalContext,\n {\n email,\n password,\n apiKeyTitle,\n file,\n scopes,\n deleteExistingApiKey,\n createNewApiKey,\n parentOrganizationId,\n transcendUrl,\n }: GenerateApiKeysCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process);\n\n const scopeNames = scopes.map((scopeTitle) => SCOPES_BY_TITLE[scopeTitle].name as ScopeName);\n\n // Upload privacy requests\n const { errors, apiKeys } = await generateCrossAccountApiKeys({\n transcendUrl,\n password,\n email,\n parentOrganizationId,\n deleteExistingApiKey,\n createNewApiKey,\n apiKeyTitle,\n scopes: scopeNames,\n });\n\n // Write to disk\n this.fs.writeFileSync(file, `${JSON.stringify(apiKeys, null, 2)}\\n`);\n if (errors.length > 0) {\n this.process.exit(1);\n }\n}\n"],"mappings":"gKAqBA,eAAsB,EAEpB,CACE,QACA,WACA,cACA,OACA,SACA,uBACA,kBACA,uBACA,gBAEa,CACf,EAAoB,KAAK,QAAQ,CAKjC,GAAM,CAAE,SAAQ,WAAY,MAAM,EAA4B,CAC5D,eACA,WACA,QACA,uBACA,uBACA,kBACA,cACA,OAXiB,EAAO,IAAK,GAAe,EAAgB,GAAY,KAWtD,CACnB,CAAC,CAGF,KAAK,GAAG,cAAc,EAAM,GAAG,KAAK,UAAU,EAAS,KAAM,EAAE,CAAC,IAAI,CAChE,EAAO,OAAS,GAClB,KAAK,QAAQ,KAAK,EAAE"}
package/dist/index.d.mts CHANGED
@@ -2,11 +2,11 @@ import { CommandContext } from "@stricli/core";
2
2
  import { StricliAutoCompleteContext } from "@stricli/auto-complete";
3
3
  import { AssessmentFormTemplateSource, AssessmentFormTemplateStatus, CodePackageType, ConsentBundleType, ConsentManagerMetricBin, ConsentTrackerStatus, DataCategoryType, IdentifierType, LogicOperator, RequestAction, RequestDataSiloStatus, RequestEnricherStatus, RequestOrigin, RequestStatus, RestartIdentifierStrategy, ScopeDefinition, ScopeName, SubDataPointDataSubCategoryGuessStatus, UnstructuredSubDataPointRecommendationStatus } from "@transcend-io/privacy-types";
4
4
  import fs from "node:fs";
5
+ import { Logger, SyncResult } from "@transcend-io/utils";
5
6
  import { Got } from "got";
6
7
  import { ObjByString } from "@transcend-io/type-utils";
7
8
  import * as t from "io-ts";
8
9
  import { ApiKey, AssessmentSection, AttributeKey, CodePackage, ConsentManagerMetric, DataSiloAttributeValue, DataSubject, RequestEnricher, RequestIdentifier, RetentionSchedule, UserPreview } from "@transcend-io/sdk";
9
- import { Logger, SyncResult } from "@transcend-io/utils";
10
10
  import inquirer from "inquirer";
11
11
  import { GraphQLClient } from "graphql-request";
12
12
  import * as _$io_ts_types0 from "io-ts-types";
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
- import{i as e,n as t,r as n,t as r}from"./enums-OiLcZ26O.mjs";import{a as i,c as a,d as o,f as s,g as c,h as l,i as u,l as d,m as f,n as p,o as m,p as h,r as g,s as _,t as v,u as y}from"./constants-BRsj50Nb.mjs";import{t as b}from"./logger-CPu6zbyQ.mjs";import{$ as x,A as S,B as ee,C as te,D as C,E as ne,F as re,G as ie,H as ae,I as oe,J as se,K as ce,L as le,M as ue,N as w,O as de,P as fe,Q as T,R as E,S as D,T as O,U as k,V as A,W as j,X as M,Y as N,Z as P,_ as F,a as I,at as L,b as R,c as z,ct as B,d as V,dt as pe,et as me,f as he,ft as ge,g as _e,gt as ve,h as ye,ht as be,i as xe,it as Se,j as Ce,k as we,l as Te,lt as Ee,m as De,mt as Oe,n as ke,nt as Ae,o as je,ot as Me,p as Ne,pt as Pe,q as Fe,r as Ie,rt as Le,s as Re,st as ze,t as Be,tt as Ve,u as He,ut as Ue,v as We,w as Ge,x as Ke,y as qe,z as Je}from"./codecs-CfcaFoZR.mjs";import{a as Ye,i as Xe,n as Ze,o as Qe,r as $e,s as et,t as tt}from"./readTranscendYaml-BfqQbPiT.mjs";import{i as nt,n as rt,r as it,t as at}from"./mergeTranscendInputs-D1CvxQu0.mjs";import{a as ot,c as st,i as ct,l as lt,n as ut,o as dt,r as ft,s as pt,t as mt,u as ht}from"./constants-qvGk0wlN.mjs";import{n as gt,t as _t}from"./fuzzyMatchColumns-2NmQqCZI.mjs";import{a as vt,c as yt,d as bt,f as xt,i as St,l as Ct,n as wt,o as Tt,r as Et,s as Dt,t as Ot,u as kt}from"./uploadPrivacyRequestsFromCsv-B_hQwIn6.mjs";import{n as At,t as jt}from"./parseAttributesFromString-C5hJMRvt.mjs";import{n as H,t as Mt}from"./readCsv-DNcJ_UfU.mjs";import{n as Nt,t as Pt}from"./pullUnstructuredSubDataPointRecommendations-Ci4AOxyH.mjs";import{a as Ft,i as It,n as Lt,o as Rt,r as zt,t as Bt}from"./request-BpKyN9Xm.mjs";import{i as Vt,n as Ht,r as Ut,t as Wt}from"./pullTranscendConfiguration-CDUDqxpm.mjs";import{i as Gt,n as Kt,r as U,t as qt}from"./fetchAllRequests-BI0tFl_a.mjs";import{a as Jt,i as Yt,n as Xt,r as Zt,t as Qt}from"./pullChunkedCustomSiloOutstandingIdentifiers-DTGQOw--.mjs";import{n as $t,r as en,t as tn}from"./syncCodePackages-CPkEukDm.mjs";import{t as nn}from"./markSilentPrivacyRequests-gKYivzH1.mjs";import{a as rn,i as an,n as on,o as sn,r as cn,t as ln}from"./downloadPrivacyRequestFiles-EBySRnvd.mjs";import{n as un,r as dn,t as fn}from"./extractClientError-DUJxHv07.mjs";import{t as pn}from"./approvePrivacyRequests-BDG82nlp.mjs";import{t as mn}from"./notifyPrivacyRequestsAdditionalTime-DbERhQ1Q.mjs";import{t as hn}from"./cancelPrivacyRequests-BIgX5SDz.mjs";import{n as gn,t as _n}from"./bulkRestartRequests-OKwKXc52.mjs";import{t as vn}from"./skipPreflightJobs-DkBdYw-r.mjs";import{t as yn}from"./bulkRetryEnrichers-Dl-n8AFF.mjs";import{t as bn}from"./retryRequestDataSilos-BoPmcB8-.mjs";import{n as W,r as G,t as xn}from"./streamPrivacyRequestsToCsv-Bt-H5J-y.mjs";import{n as Sn,r as Cn,t as wn}from"./inquirer-BU5IpgA8.mjs";import{t as Tn}from"./parseVariablesFromString-6TYW65LF.mjs";import{t as En}from"./collectParquetFilesOrExit-CbNQ9CJc.mjs";import{t as Dn}from"./collectCsvFilesOrExit-BindZ0dF.mjs";import{t as On}from"./parquetToCsvOneFile-DtbCFm08.mjs";import{a as kn,i as An,n as jn,o as Mn,r as Nn,s as Pn,t as Fn}from"./writeCsv-CNZrq3zU.mjs";import{t as In}from"./skipRequestDataSilos-BRFiokix.mjs";import{t as Ln}from"./removeUnverifiedRequestIdentifiers-BkAcUZZN.mjs";import{t as Rn}from"./updateConsentManagerVersionToLatest-DWblAwus.mjs";import{n as K,t as q}from"./mapConsentCsvRowsToInputs-CkLfxaIf.mjs";import{t as zn}from"./pullConsentManagerMetrics-DKCkfbCB.mjs";import{n as Bn,r as Vn,t as Hn}from"./buildXdiSyncEndpoint-FExEagKc.mjs";import{t as Un}from"./consentManagersToBusinessEntities-DG0_eby5.mjs";import{i as Wn,n as Gn,r as Kn,t as qn}from"./uploadConsents-D7Vg8ZRW.mjs";import{n as Jn,r as Yn,t as Xn}from"./pushCronIdentifiersFromCsv-DhS2z8IG.mjs";import{t as Zn}from"./markRequestDataSiloIdsCompleted-BYNMCkhy.mjs";import{t as Qn}from"./generateCrossAccountApiKeys-pWTrIUE6.mjs";import{t as $n}from"./validateTranscendAuth-D-dDINof.mjs";import{n as er,t as tr}from"./listFiles-DDGCBdtx.mjs";import{t as nr}from"./pullAllDatapoints-Bm-Orhse.mjs";import{t as rr}from"./pullManualEnrichmentIdentifiersToCsv-DMC5CQtE.mjs";import{n as ir,r as ar,t as or}from"./pushManualEnrichmentIdentifiersFromCsv-BTJGOmdU.mjs";import{chunk as sr,difference as cr}from"lodash-es";import{join as lr}from"node:path";import J from"colors";import{readFileSync as ur,readdirSync as dr,statSync as Y}from"node:fs";import fr from"fast-glob";import{UPDATE_OR_CREATE_COOKIES as pr,buildTranscendGraphQLClient as X,createSombraGotInstance as mr,fetchAllRequestIdentifiers as hr,fetchConsentManagerId as gr,makeGraphQLRequest as _r,syncCookies as vr,syncDataFlows as yr,validateSombraVersion as br}from"@transcend-io/sdk";import{map as Z,mapSeries as xr}from"@transcend-io/utils";import{execSync as Q}from"child_process";async function $(e,t){let n=await gr(e,{logger:b});await xr(sr(t,100),async t=>{await _r(e,pr,{variables:{airgapBundleId:n,cookies:t.map(e=>({name:e.name,trackingPurposes:e.trackingPurposes&&e.trackingPurposes.length>0?e.trackingPurposes:void 0,description:e.description,service:e.service,status:e.status,attributes:e.attributes,isRegex:e.isRegex}))},logger:b})})}async function Sr(e,t){let n=!1;b.info(J.magenta(`Syncing "${t.length}" cookies...`));let r=t.filter(e=>t.filter(t=>e.name===t.name&&e.isRegex===t.isRegex).length>1);if(r.length>0)throw Error(`Failed to upload cookies as there were non-unique entries found: ${r.map(({name:e})=>e).join(`,`)}`);try{b.info(J.magenta(`Upserting "${t.length}" new cookies...`)),await $(e,t),b.info(J.green(`Successfully synced ${t.length} cookies!`))}catch(e){n=!0,b.error(J.red(`Failed to create cookies! - ${e.message}`))}return!n}async function Cr({auth:e,sombraAuth:t,actions:n=[],statuses:r=[],identifierSearch:a,pageLimit:o=100,concurrency:s=1,transcendUrl:c=i,createdAtBefore:l,skipRequestIdentifiers:u=!1,createdAtAfter:d,updatedAtBefore:f,updatedAtAfter:p,isTest:m}){let h=X(c,e),g=await mr(c,e,{logger:b,sombraApiKey:t,sombraUrl:process.env.SOMBRA_URL}),_=``;l&&(_+=` before ${l.toISOString()}`),d&&(_+=`${_?`, and`:``} after ${d.toISOString()}`),b.info(J.magenta(`${n.length>0?`Pulling requests of type "${n.join(`" , "`)}"`:`Pulling all requests`}${_}`));let v=s>1&&d&&l,y=v?W(d,l,s):[{createdAtAfter:d,createdAtBefore:l}];v&&b.info(J.magenta(`Splitting date range into ${s} parallel chunks`));let x=(await Z(y,e=>U(h,{actions:n,text:a,statuses:r,createdAtBefore:e.createdAtBefore,createdAtAfter:e.createdAtAfter,updatedAtBefore:f,updatedAtAfter:p,isTest:m}),{concurrency:v?s:1})).flat();u||await br(h,{logger:b});let S=u?x.map(e=>({...e,requestIdentifiers:[]})):await Z(x,async e=>{let t=await hr(h,g,{filterBy:{requestId:e.id},skipSombraCheck:!0,logger:b});return{...e,requestIdentifiers:t}},{concurrency:o});return b.info(J.magenta(`Pulled ${S.length} requests`)),{requestsWithRequestIdentifiers:S,requestsFormattedForCsv:S.map(G)}}function wr(e,t=ur){try{return e?t(e,`utf8`):``}catch{return``}}async function Tr({auth:e,trackerStatus:t,file:n,classifyService:r=!1,transcendUrl:a=i}){let o=X(a,e);b.info(J.magenta(`Reading "${n}" from disk`)),await yr(o,K(H(n,w),t),{classifyService:r,logger:b})||(b.error(J.red(`Encountered error(s) syncing data flows from CSV, see logs above for more info. `)),process.exit(1))}async function Er({auth:e,trackerStatus:t,file:n,transcendUrl:r=i}){let a=X(r,e);b.info(J.magenta(`Reading "${n}" from disk`)),await vr(a,q(H(n,C),t),{logger:b})||(b.error(J.red(`Encountered error(s) syncing cookies from CSV, see logs above for more info. `)),process.exit(1))}function Dr(e){return dr(e).filter(t=>Y(lr(e,t)).isDirectory())}function Or(e){return e.replace(/(https?:\/\/[^\s]+)/g,`<link-omitted>`)}function kr(e){return Object.entries(e).reduce((e,[t,n])=>n!=null&&n!==``&&!(Array.isArray(n)&&n.length===0)&&!(typeof n==`object`&&Object.keys(n).length===0)?Object.assign(e,{[t]:n}):e,{})}function Ar({baseBranch:e,rootDirectory:t,githubRepo:n,excludedGlob:r=[],fileBlockList:i=[]}){Q(`git fetch origin ${e}`);let a=Q(`git ls-remote ${n} "refs/heads/${e}" | cut -f 1`,{encoding:`utf-8`}).split(`
1
+ import{i as e,n as t,r as n,t as r}from"./enums-OiLcZ26O.mjs";import{a as i,c as a,d as o,f as s,g as c,h as l,i as u,l as d,m as f,n as p,o as m,p as h,r as g,s as _,t as v,u as y}from"./constants-BlKpAm3R.mjs";import{t as b}from"./logger-CPu6zbyQ.mjs";import{$ as x,A as S,B as ee,C as te,D as C,E as ne,F as re,G as ie,H as ae,I as oe,J as se,K as ce,L as le,M as ue,N as w,O as de,P as fe,Q as T,R as E,S as D,T as O,U as k,V as A,W as j,X as M,Y as N,Z as P,_ as F,a as I,at as L,b as R,c as z,ct as B,d as V,dt as pe,et as me,f as he,ft as ge,g as _e,gt as ve,h as ye,ht as be,i as xe,it as Se,j as Ce,k as we,l as Te,lt as Ee,m as De,mt as Oe,n as ke,nt as Ae,o as je,ot as Me,p as Ne,pt as Pe,q as Fe,r as Ie,rt as Le,s as Re,st as ze,t as Be,tt as Ve,u as He,ut as Ue,v as We,w as Ge,x as Ke,y as qe,z as Je}from"./codecs-CfcaFoZR.mjs";import{a as Ye,i as Xe,n as Ze,o as Qe,r as $e,s as et,t as tt}from"./readTranscendYaml-BfqQbPiT.mjs";import{i as nt,n as rt,r as it,t as at}from"./mergeTranscendInputs-B7WjxYMN.mjs";import{a as ot,c as st,i as ct,l as lt,n as ut,o as dt,r as ft,s as pt,t as mt,u as ht}from"./constants-qvGk0wlN.mjs";import{n as gt,t as _t}from"./fuzzyMatchColumns-2NmQqCZI.mjs";import{a as vt,c as yt,d as bt,f as xt,i as St,l as Ct,n as wt,o as Tt,r as Et,s as Dt,t as Ot,u as kt}from"./uploadPrivacyRequestsFromCsv-BsYnCgbl.mjs";import{n as At,t as jt}from"./parseAttributesFromString-C5hJMRvt.mjs";import{n as H,t as Mt}from"./readCsv-DNcJ_UfU.mjs";import{n as Nt,t as Pt}from"./pullUnstructuredSubDataPointRecommendations-Ci4AOxyH.mjs";import{a as Ft,i as It,n as Lt,o as Rt,r as zt,t as Bt}from"./request-BpKyN9Xm.mjs";import{i as Vt,n as Ht,r as Ut,t as Wt}from"./pullTranscendConfiguration-CDUDqxpm.mjs";import{i as Gt,n as Kt,r as U,t as qt}from"./fetchAllRequests-BI0tFl_a.mjs";import{a as Jt,i as Yt,n as Xt,r as Zt,t as Qt}from"./pullChunkedCustomSiloOutstandingIdentifiers-BfNNWqeI.mjs";import{n as $t,r as en,t as tn}from"./syncCodePackages-DJnrcX5l.mjs";import{t as nn}from"./markSilentPrivacyRequests-D3bFOMLh.mjs";import{a as rn,i as an,n as on,o as sn,r as cn,t as ln}from"./downloadPrivacyRequestFiles-Cf14MQR4.mjs";import{n as un,r as dn,t as fn}from"./extractClientError-DUJxHv07.mjs";import{t as pn}from"./approvePrivacyRequests-BWj6SsgX.mjs";import{t as mn}from"./notifyPrivacyRequestsAdditionalTime-BGUxsWLN.mjs";import{t as hn}from"./cancelPrivacyRequests-CAKTZF47.mjs";import{n as gn,t as _n}from"./bulkRestartRequests-B3wupylo.mjs";import{t as vn}from"./skipPreflightJobs-KdcSw8Td.mjs";import{t as yn}from"./bulkRetryEnrichers-D801tBcB.mjs";import{t as bn}from"./retryRequestDataSilos-ZdY2PM0S.mjs";import{n as W,r as G,t as xn}from"./streamPrivacyRequestsToCsv-ByRBG8Mb.mjs";import{n as Sn,r as Cn,t as wn}from"./inquirer-BU5IpgA8.mjs";import{t as Tn}from"./parseVariablesFromString-6TYW65LF.mjs";import{t as En}from"./collectParquetFilesOrExit-CbNQ9CJc.mjs";import{t as Dn}from"./collectCsvFilesOrExit-BindZ0dF.mjs";import{t as On}from"./parquetToCsvOneFile-DtbCFm08.mjs";import{a as kn,i as An,n as jn,o as Mn,r as Nn,s as Pn,t as Fn}from"./writeCsv-CNZrq3zU.mjs";import{t as In}from"./skipRequestDataSilos-Cy2NfP47.mjs";import{t as Ln}from"./removeUnverifiedRequestIdentifiers-DcI9ut4q.mjs";import{t as Rn}from"./updateConsentManagerVersionToLatest-KwMaAkwh.mjs";import{n as K,t as q}from"./mapConsentCsvRowsToInputs-CkLfxaIf.mjs";import{t as zn}from"./pullConsentManagerMetrics-DKCkfbCB.mjs";import{n as Bn,r as Vn,t as Hn}from"./buildXdiSyncEndpoint-CAal3Xc4.mjs";import{t as Un}from"./consentManagersToBusinessEntities-DG0_eby5.mjs";import{i as Wn,n as Gn,r as Kn,t as qn}from"./uploadConsents-C5LmI-9T.mjs";import{n as Jn,r as Yn,t as Xn}from"./pushCronIdentifiersFromCsv-CDhlEf6n.mjs";import{t as Zn}from"./markRequestDataSiloIdsCompleted-C6lV_My-.mjs";import{t as Qn}from"./generateCrossAccountApiKeys-CVdsJFOe.mjs";import{t as $n}from"./validateTranscendAuth-D-dDINof.mjs";import{n as er,t as tr}from"./listFiles-DDGCBdtx.mjs";import{t as nr}from"./pullAllDatapoints-CNqQSSmF.mjs";import{t as rr}from"./pullManualEnrichmentIdentifiersToCsv-B_lWa6Yg.mjs";import{n as ir,r as ar,t as or}from"./pushManualEnrichmentIdentifiersFromCsv-Bn_028w5.mjs";import{chunk as sr,difference as cr}from"lodash-es";import{join as lr}from"node:path";import J from"colors";import{readFileSync as ur,readdirSync as dr,statSync as Y}from"node:fs";import{map as X,mapSeries as fr}from"@transcend-io/utils";import pr from"fast-glob";import{UPDATE_OR_CREATE_COOKIES as mr,buildTranscendGraphQLClient as Z,createSombraGotInstance as hr,fetchAllRequestIdentifiers as gr,fetchConsentManagerId as _r,makeGraphQLRequest as vr,syncCookies as yr,syncDataFlows as br,validateSombraVersion as xr}from"@transcend-io/sdk";import{execSync as Q}from"child_process";async function $(e,t){let n=await _r(e,{logger:b});await fr(sr(t,100),async t=>{await vr(e,mr,{variables:{airgapBundleId:n,cookies:t.map(e=>({name:e.name,trackingPurposes:e.trackingPurposes&&e.trackingPurposes.length>0?e.trackingPurposes:void 0,description:e.description,service:e.service,status:e.status,attributes:e.attributes,isRegex:e.isRegex}))},logger:b})})}async function Sr(e,t){let n=!1;b.info(J.magenta(`Syncing "${t.length}" cookies...`));let r=t.filter(e=>t.filter(t=>e.name===t.name&&e.isRegex===t.isRegex).length>1);if(r.length>0)throw Error(`Failed to upload cookies as there were non-unique entries found: ${r.map(({name:e})=>e).join(`,`)}`);try{b.info(J.magenta(`Upserting "${t.length}" new cookies...`)),await $(e,t),b.info(J.green(`Successfully synced ${t.length} cookies!`))}catch(e){n=!0,b.error(J.red(`Failed to create cookies! - ${e.message}`))}return!n}async function Cr({auth:e,sombraAuth:t,actions:n=[],statuses:r=[],identifierSearch:a,pageLimit:o=100,concurrency:s=1,transcendUrl:c=i,createdAtBefore:l,skipRequestIdentifiers:u=!1,createdAtAfter:d,updatedAtBefore:f,updatedAtAfter:p,isTest:m}){let h=Z(c,e),g=await hr(c,e,{logger:b,sombraApiKey:t,sombraUrl:process.env.SOMBRA_URL}),_=``;l&&(_+=` before ${l.toISOString()}`),d&&(_+=`${_?`, and`:``} after ${d.toISOString()}`),b.info(J.magenta(`${n.length>0?`Pulling requests of type "${n.join(`" , "`)}"`:`Pulling all requests`}${_}`));let v=s>1&&d&&l,y=v?W(d,l,s):[{createdAtAfter:d,createdAtBefore:l}];v&&b.info(J.magenta(`Splitting date range into ${s} parallel chunks`));let x=(await X(y,e=>U(h,{actions:n,text:a,statuses:r,createdAtBefore:e.createdAtBefore,createdAtAfter:e.createdAtAfter,updatedAtBefore:f,updatedAtAfter:p,isTest:m}),{concurrency:v?s:1})).flat();u||await xr(h,{logger:b});let S=u?x.map(e=>({...e,requestIdentifiers:[]})):await X(x,async e=>{let t=await gr(h,g,{filterBy:{requestId:e.id},skipSombraCheck:!0,logger:b});return{...e,requestIdentifiers:t}},{concurrency:o});return b.info(J.magenta(`Pulled ${S.length} requests`)),{requestsWithRequestIdentifiers:S,requestsFormattedForCsv:S.map(G)}}function wr(e,t=ur){try{return e?t(e,`utf8`):``}catch{return``}}async function Tr({auth:e,trackerStatus:t,file:n,classifyService:r=!1,transcendUrl:a=i}){let o=Z(a,e);b.info(J.magenta(`Reading "${n}" from disk`)),await br(o,K(H(n,w),t),{classifyService:r,logger:b})||(b.error(J.red(`Encountered error(s) syncing data flows from CSV, see logs above for more info. `)),process.exit(1))}async function Er({auth:e,trackerStatus:t,file:n,transcendUrl:r=i}){let a=Z(r,e);b.info(J.magenta(`Reading "${n}" from disk`)),await yr(a,q(H(n,C),t),{logger:b})||(b.error(J.red(`Encountered error(s) syncing cookies from CSV, see logs above for more info. `)),process.exit(1))}function Dr(e){return dr(e).filter(t=>Y(lr(e,t)).isDirectory())}function Or(e){return e.replace(/(https?:\/\/[^\s]+)/g,`<link-omitted>`)}function kr(e){return Object.entries(e).reduce((e,[t,n])=>n!=null&&n!==``&&!(Array.isArray(n)&&n.length===0)&&!(typeof n==`object`&&Object.keys(n).length===0)?Object.assign(e,{[t]:n}):e,{})}function Ar({baseBranch:e,rootDirectory:t,githubRepo:n,excludedGlob:r=[],fileBlockList:i=[]}){Q(`git fetch origin ${e}`);let a=Q(`git ls-remote ${n} "refs/heads/${e}" | cut -f 1`,{encoding:`utf-8`}).split(`
2
2
  `)[0],o=Q(`git rev-parse HEAD`,{encoding:`utf-8`}).split(`
3
3
  `)[0];if(!a||!o)throw Error(`FAILED TO FIND COMMIT RANGE`);let s=cr(Q(`git fetch && git diff --name-only "${e||a}...${o}" -- ${t}`,{encoding:`utf-8`}).split(`
4
- `).filter(e=>e),i),c=r.length>0?fr.sync(s,{ignore:r}):s,l={};return c.forEach(e=>{l[e]=Q(`git show ${o}:${e}`,{encoding:`utf-8`})}),{changedFiles:s,fileDiffs:l,repoName:n.split(`/`).pop().split(`.`)[0],commit:o}}export{v as ADMIN_DASH,p as ADMIN_DASH_DATAPOINTS,g as ADMIN_DASH_INTEGRATIONS,Bt as APPROVE_PRIVACY_REQUEST,Vt as ASSESSMENT_TEMPLATES,Be as ActionInput,ke as ActionItemCollectionInput,Ie as ActionItemInput,xe as ApiKeyInput,I as AssessmentAnswerOptionInput,je as AssessmentDisplayLogicInput,Re as AssessmentInput,z as AssessmentNestedRuleInput,Te as AssessmentResourceInput,He as AssessmentRetentionScheduleInput,V as AssessmentRuleInput,he as AssessmentSectionInput,Ne as AssessmentSectionQuestionInput,De as AssessmentTemplateInput,St as AttestedExtraIdentifiers,ye as AttributeInput,_e as AttributePreview,F as AttributeValueInput,mt as BLANK,ut as BULK_APPLY,We as BusinessEntityInput,Lt as CANCEL_PRIVACY_REQUEST,ft as CAN_APPLY_IN_BULK,ct as CachedFileState,ot as CachedRequestState,qe as CodePackageInput,R as CodePackageSdk,dt as ColumnName,Ke as ConsentManageExperienceInput,D as ConsentManagerInput,te as ConsentManagerServiceMetadata,Ge as ConsentPreferenceTopic,O as ConsentPreferenceTopicOptionValue,ne as ConsentPurpose,C as CookieCsvInput,de as CookieInput,Xt as CronIdentifier,Jn as CronIdentifierPush,Zt as CronPartition,u as DEBUG,i as DEFAULT_TRANSCEND_API,m as DEFAULT_TRANSCEND_API_KEY,_ as DEFAULT_TRANSCEND_CONSENT_API,Wt as DEFAULT_TRANSCEND_PULL_RESOURCES,we as DataCategoryGuessInput,S as DataCategoryInput,Ce as DataCategoryPreviewInput,ue as DataCategoryRecommendationInput,w as DataFlowCsvInput,fe as DataFlowInput,re as DataSiloInput,oe as DataSubjectInput,le as DatapointInput,E as DeletionDependencies,Je as DeletionDependency,ee as DeletionDependencyInput,A as DeletionDependencyReset,Nt as ENTRY_COUNT,ir as EnrichPrivacyRequest,ae as EnricherInput,k as FieldInput,pt as IDENTIFIER_BLOCK_LIST,Hn as IP_ADDRESS_REGEX,st as IS_REQUIRED,j as IdentifierInput,ie as ImportOnetrustAssessmentsInput,cn as IntlMessage,ce as IntlMessageInput,lt as NONE,zt as NOTIFY_ADDITIONAL_TIME,r as OneTrustFileFormat,t as OneTrustPullResource,n as OneTrustPullSource,jt as ParsedAttributeInput,Fe as PartitionInput,se as PolicyInput,N as PreferenceWorkflowConfigInput,M as PreferenceWorkflowConfigPurposeInput,P as PreflightInput,T as PrivacyCenterInput,qt as PrivacyRequest,vt as PrivacyRequestInput,un as PrivacyRequestResponse,x as ProcessingActivityInput,me as ProcessingPurposeInput,Ve as ProcessingPurposePreviewInput,Ae as PromptAVendorEmailSettings,qn as PurposeMap,It as REQUESTS,Ft as REQUESTS_COUNT,a as RETRYABLE_BATCH_STATUSES,Le as RegionInput,Se as RepositoryInput,an as RequestFileMetadata,rn as RequestFileMetadataResponse,Kt as RequestPurposeTrigger,L as RiskAssignmentInput,Me as RiskLogicInput,d as SCOPES_BY_TITLE,y as SCOPE_TITLES,ze as SiloDiscoveryResultInput,B as SoftwareDevelopmentKitInput,Ee as StoredApiKey,ht as SuccessfulRequest,o as TR_PULL_RESOURCE_SCOPE_MAP,s as TR_PUSH_RESOURCE_SCOPE_MAP,h as TR_YML_RESOURCE_TO_FIELD_NAME,Ue as TeamInput,pe as TemplateInput,ge as TranscendInput,e as TranscendPullResource,Rt as UPDATE_PRIVACY_REQUEST,Gn as USP_STRING_REGEX,tt as VARIABLE_PARAMETERS_NAME,Ze as VARIABLE_PARAMETERS_REGEXP,Pe as VendorInput,Oe as WebhookHeader,be as WorkflowConfigInput,Fn as appendCsvRowsOrdered,jn as appendCsvSync,pn as approvePrivacyRequests,Bn as buildXdiSyncEndpoint,_n as bulkRestartRequests,yn as bulkRetryEnrichers,hn as cancelPrivacyRequests,Dn as collectCsvFilesOrExit,En as collectParquetFilesOrExit,Un as consentManagersToBusinessEntities,tn as createCodePackage,Wn as createConsentToken,l as description,Vn as domainToHost,ln as downloadPrivacyRequestFiles,ar as enrichPrivacyRequest,nt as ensureAllDataSubjectsExist,fn as extractClientError,Ut as fetchAllAssessmentTemplates,U as fetchAllRequests,Jt as fetchRequestDataSiloActiveCount,Gt as fetchRequestsTotalCount,tr as filterFileNames,kr as filterNullishValuesFromObject,kt as filterRows,G as formatRequestForCsv,_t as fuzzyMatchColumns,gt as fuzzySearch,Qn as generateCrossAccountApiKeys,sn as getFileMetadataForPrivacyRequests,Ar as getGitFilesThatChanged,bt as getUniqueValuesForColumn,Nn as initCsvFile,wn as inquirerAutoComplete,Sn as inquirerConfirmBoolean,Cn as inquirerConfirmText,Dr as listDirectories,er as listFiles,wt as mapColumnsToAttributes,Et as mapColumnsToIdentifiers,q as mapCookieCsvRowsToInputs,Ct as mapCsvColumnsToApi,Tt as mapCsvRowsToRequestInputs,K as mapDataFlowCsvRowsToInputs,xt as mapEnumValues,yt as mapRequestEnumValues,Yn as markCronIdentifierCompleted,Zn as markRequestDataSiloIdsCompleted,nn as markSilentPrivacyRequests,at as mergeTranscendInputs,f as name,Dt as normalizeIdentifierValue,ve as normalizeTranscendInput,mn as notifyPrivacyRequestsAdditionalTime,On as parquetToCsvOneFile,At as parseAttributesFromString,Mt as parseCsv,An as parseFilePath,$e as parseTranscendYaml,Tn as parseVariablesFromString,nr as pullAllDatapoints,Qt as pullChunkedCustomSiloOutstandingIdentifiers,zn as pullConsentManagerMetrics,Yt as pullCronPageOfIdentifiers,rr as pullManualEnrichmentIdentifiersToCsv,Cr as pullPrivacyRequests,Ht as pullTranscendConfiguration,Pt as pullUnstructuredSubDataPointRecommendations,Xn as pushCronIdentifiersFromCsv,or as pushManualEnrichmentIdentifiersFromCsv,H as readCsv,wr as readSafe,Xe as readTranscendYaml,Or as removeLinks,Ln as removeUnverifiedRequestIdentifiers,Ye as replaceVariablesInYaml,gn as restartPrivacyRequest,bn as retryRequestDataSilos,Qe as serializeTranscendYaml,vn as skipPreflightJobs,In as skipRequestDataSilos,W as splitDateRange,on as streamPrivacyRequestFiles,xn as streamPrivacyRequestsToCsv,dn as submitPrivacyRequest,$t as syncCodePackages,rt as syncConfigurationToTranscend,Sr as syncCookies,it as syncDataSilos,en as updateCodePackages,Rn as updateConsentManagerVersionToLatest,$ as updateOrCreateCookies,Kn as uploadConsents,Er as uploadCookiesFromCsv,Tr as uploadDataFlowsFromCsv,Ot as uploadPrivacyRequestsFromCsv,$n as validateTranscendAuth,c as version,kn as writeCsv,Mn as writeCsvSync,Pn as writeLargeCsv,et as writeTranscendYaml};
4
+ `).filter(e=>e),i),c=r.length>0?pr.sync(s,{ignore:r}):s,l={};return c.forEach(e=>{l[e]=Q(`git show ${o}:${e}`,{encoding:`utf-8`})}),{changedFiles:s,fileDiffs:l,repoName:n.split(`/`).pop().split(`.`)[0],commit:o}}export{v as ADMIN_DASH,p as ADMIN_DASH_DATAPOINTS,g as ADMIN_DASH_INTEGRATIONS,Bt as APPROVE_PRIVACY_REQUEST,Vt as ASSESSMENT_TEMPLATES,Be as ActionInput,ke as ActionItemCollectionInput,Ie as ActionItemInput,xe as ApiKeyInput,I as AssessmentAnswerOptionInput,je as AssessmentDisplayLogicInput,Re as AssessmentInput,z as AssessmentNestedRuleInput,Te as AssessmentResourceInput,He as AssessmentRetentionScheduleInput,V as AssessmentRuleInput,he as AssessmentSectionInput,Ne as AssessmentSectionQuestionInput,De as AssessmentTemplateInput,St as AttestedExtraIdentifiers,ye as AttributeInput,_e as AttributePreview,F as AttributeValueInput,mt as BLANK,ut as BULK_APPLY,We as BusinessEntityInput,Lt as CANCEL_PRIVACY_REQUEST,ft as CAN_APPLY_IN_BULK,ct as CachedFileState,ot as CachedRequestState,qe as CodePackageInput,R as CodePackageSdk,dt as ColumnName,Ke as ConsentManageExperienceInput,D as ConsentManagerInput,te as ConsentManagerServiceMetadata,Ge as ConsentPreferenceTopic,O as ConsentPreferenceTopicOptionValue,ne as ConsentPurpose,C as CookieCsvInput,de as CookieInput,Xt as CronIdentifier,Jn as CronIdentifierPush,Zt as CronPartition,u as DEBUG,i as DEFAULT_TRANSCEND_API,m as DEFAULT_TRANSCEND_API_KEY,_ as DEFAULT_TRANSCEND_CONSENT_API,Wt as DEFAULT_TRANSCEND_PULL_RESOURCES,we as DataCategoryGuessInput,S as DataCategoryInput,Ce as DataCategoryPreviewInput,ue as DataCategoryRecommendationInput,w as DataFlowCsvInput,fe as DataFlowInput,re as DataSiloInput,oe as DataSubjectInput,le as DatapointInput,E as DeletionDependencies,Je as DeletionDependency,ee as DeletionDependencyInput,A as DeletionDependencyReset,Nt as ENTRY_COUNT,ir as EnrichPrivacyRequest,ae as EnricherInput,k as FieldInput,pt as IDENTIFIER_BLOCK_LIST,Hn as IP_ADDRESS_REGEX,st as IS_REQUIRED,j as IdentifierInput,ie as ImportOnetrustAssessmentsInput,cn as IntlMessage,ce as IntlMessageInput,lt as NONE,zt as NOTIFY_ADDITIONAL_TIME,r as OneTrustFileFormat,t as OneTrustPullResource,n as OneTrustPullSource,jt as ParsedAttributeInput,Fe as PartitionInput,se as PolicyInput,N as PreferenceWorkflowConfigInput,M as PreferenceWorkflowConfigPurposeInput,P as PreflightInput,T as PrivacyCenterInput,qt as PrivacyRequest,vt as PrivacyRequestInput,un as PrivacyRequestResponse,x as ProcessingActivityInput,me as ProcessingPurposeInput,Ve as ProcessingPurposePreviewInput,Ae as PromptAVendorEmailSettings,qn as PurposeMap,It as REQUESTS,Ft as REQUESTS_COUNT,a as RETRYABLE_BATCH_STATUSES,Le as RegionInput,Se as RepositoryInput,an as RequestFileMetadata,rn as RequestFileMetadataResponse,Kt as RequestPurposeTrigger,L as RiskAssignmentInput,Me as RiskLogicInput,d as SCOPES_BY_TITLE,y as SCOPE_TITLES,ze as SiloDiscoveryResultInput,B as SoftwareDevelopmentKitInput,Ee as StoredApiKey,ht as SuccessfulRequest,o as TR_PULL_RESOURCE_SCOPE_MAP,s as TR_PUSH_RESOURCE_SCOPE_MAP,h as TR_YML_RESOURCE_TO_FIELD_NAME,Ue as TeamInput,pe as TemplateInput,ge as TranscendInput,e as TranscendPullResource,Rt as UPDATE_PRIVACY_REQUEST,Gn as USP_STRING_REGEX,tt as VARIABLE_PARAMETERS_NAME,Ze as VARIABLE_PARAMETERS_REGEXP,Pe as VendorInput,Oe as WebhookHeader,be as WorkflowConfigInput,Fn as appendCsvRowsOrdered,jn as appendCsvSync,pn as approvePrivacyRequests,Bn as buildXdiSyncEndpoint,_n as bulkRestartRequests,yn as bulkRetryEnrichers,hn as cancelPrivacyRequests,Dn as collectCsvFilesOrExit,En as collectParquetFilesOrExit,Un as consentManagersToBusinessEntities,tn as createCodePackage,Wn as createConsentToken,l as description,Vn as domainToHost,ln as downloadPrivacyRequestFiles,ar as enrichPrivacyRequest,nt as ensureAllDataSubjectsExist,fn as extractClientError,Ut as fetchAllAssessmentTemplates,U as fetchAllRequests,Jt as fetchRequestDataSiloActiveCount,Gt as fetchRequestsTotalCount,tr as filterFileNames,kr as filterNullishValuesFromObject,kt as filterRows,G as formatRequestForCsv,_t as fuzzyMatchColumns,gt as fuzzySearch,Qn as generateCrossAccountApiKeys,sn as getFileMetadataForPrivacyRequests,Ar as getGitFilesThatChanged,bt as getUniqueValuesForColumn,Nn as initCsvFile,wn as inquirerAutoComplete,Sn as inquirerConfirmBoolean,Cn as inquirerConfirmText,Dr as listDirectories,er as listFiles,wt as mapColumnsToAttributes,Et as mapColumnsToIdentifiers,q as mapCookieCsvRowsToInputs,Ct as mapCsvColumnsToApi,Tt as mapCsvRowsToRequestInputs,K as mapDataFlowCsvRowsToInputs,xt as mapEnumValues,yt as mapRequestEnumValues,Yn as markCronIdentifierCompleted,Zn as markRequestDataSiloIdsCompleted,nn as markSilentPrivacyRequests,at as mergeTranscendInputs,f as name,Dt as normalizeIdentifierValue,ve as normalizeTranscendInput,mn as notifyPrivacyRequestsAdditionalTime,On as parquetToCsvOneFile,At as parseAttributesFromString,Mt as parseCsv,An as parseFilePath,$e as parseTranscendYaml,Tn as parseVariablesFromString,nr as pullAllDatapoints,Qt as pullChunkedCustomSiloOutstandingIdentifiers,zn as pullConsentManagerMetrics,Yt as pullCronPageOfIdentifiers,rr as pullManualEnrichmentIdentifiersToCsv,Cr as pullPrivacyRequests,Ht as pullTranscendConfiguration,Pt as pullUnstructuredSubDataPointRecommendations,Xn as pushCronIdentifiersFromCsv,or as pushManualEnrichmentIdentifiersFromCsv,H as readCsv,wr as readSafe,Xe as readTranscendYaml,Or as removeLinks,Ln as removeUnverifiedRequestIdentifiers,Ye as replaceVariablesInYaml,gn as restartPrivacyRequest,bn as retryRequestDataSilos,Qe as serializeTranscendYaml,vn as skipPreflightJobs,In as skipRequestDataSilos,W as splitDateRange,on as streamPrivacyRequestFiles,xn as streamPrivacyRequestsToCsv,dn as submitPrivacyRequest,$t as syncCodePackages,rt as syncConfigurationToTranscend,Sr as syncCookies,it as syncDataSilos,en as updateCodePackages,Rn as updateConsentManagerVersionToLatest,$ as updateOrCreateCookies,Kn as uploadConsents,Er as uploadCookiesFromCsv,Tr as uploadDataFlowsFromCsv,Ot as uploadPrivacyRequestsFromCsv,$n as validateTranscendAuth,c as version,kn as writeCsv,Mn as writeCsvSync,Pn as writeLargeCsv,et as writeTranscendYaml};
5
5
  //# sourceMappingURL=index.mjs.map
@@ -1,2 +1,2 @@
1
- import{a as e}from"./constants-BRsj50Nb.mjs";import{t}from"./logger-CPu6zbyQ.mjs";import{RequestDataSiloStatus as n}from"@transcend-io/privacy-types";import r from"colors";import{CHANGE_REQUEST_DATA_SILO_STATUS as i,buildTranscendGraphQLClient as a,fetchRequestDataSilo as o,makeGraphQLRequest as s}from"@transcend-io/sdk";import{map as c}from"@transcend-io/utils";import l from"cli-progress";async function u({requestIds:u,dataSiloId:d,auth:f,concurrency:p=100,status:m=n.Resolved,transcendUrl:h=e}){let g=a(h,f),_=new Date().getTime(),v=new l.SingleBar({},l.Presets.shades_classic);t.info(r.magenta(`Notifying Transcend for data silo "${d}" marking "${u.length}" requests as completed.`));let y=0;v.start(u.length,0),await c(u,async e=>{let n=await o(g,{logger:t,filterBy:{requestId:e,dataSiloId:d}});try{await s(g,i,{variables:{requestDataSiloId:n.id,status:m},logger:t})}catch(e){if(!e.message.includes(`Client error: Request must be active:`)&&!e.message.includes(`Failed to find RequestDataSilo`))throw e}y+=1,v.update(y)},{concurrency:p}),v.stop();let b=new Date().getTime()-_;return t.info(r.green(`Successfully notified Transcend in "${b/1e3}" seconds!`)),u.length}export{u as t};
2
- //# sourceMappingURL=markRequestDataSiloIdsCompleted-BYNMCkhy.mjs.map
1
+ import{a as e}from"./constants-BlKpAm3R.mjs";import{t}from"./logger-CPu6zbyQ.mjs";import{RequestDataSiloStatus as n}from"@transcend-io/privacy-types";import r from"colors";import{map as i}from"@transcend-io/utils";import{CHANGE_REQUEST_DATA_SILO_STATUS as a,buildTranscendGraphQLClient as o,fetchRequestDataSilo as s,makeGraphQLRequest as c}from"@transcend-io/sdk";import l from"cli-progress";async function u({requestIds:u,dataSiloId:d,auth:f,concurrency:p=100,status:m=n.Resolved,transcendUrl:h=e}){let g=o(h,f),_=new Date().getTime(),v=new l.SingleBar({},l.Presets.shades_classic);t.info(r.magenta(`Notifying Transcend for data silo "${d}" marking "${u.length}" requests as completed.`));let y=0;v.start(u.length,0),await i(u,async e=>{let n=await s(g,{logger:t,filterBy:{requestId:e,dataSiloId:d}});try{await c(g,a,{variables:{requestDataSiloId:n.id,status:m},logger:t})}catch(e){if(!e.message.includes(`Client error: Request must be active:`)&&!e.message.includes(`Failed to find RequestDataSilo`))throw e}y+=1,v.update(y)},{concurrency:p}),v.stop();let b=new Date().getTime()-_;return t.info(r.green(`Successfully notified Transcend in "${b/1e3}" seconds!`)),u.length}export{u as t};
2
+ //# sourceMappingURL=markRequestDataSiloIdsCompleted-C6lV_My-.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"markRequestDataSiloIdsCompleted-BYNMCkhy.mjs","names":[],"sources":["../src/lib/cron/markRequestDataSiloIdsCompleted.ts"],"sourcesContent":["import { RequestDataSiloStatus } from '@transcend-io/privacy-types';\nimport {\n buildTranscendGraphQLClient,\n makeGraphQLRequest,\n CHANGE_REQUEST_DATA_SILO_STATUS,\n fetchRequestDataSilo,\n} from '@transcend-io/sdk';\nimport { map } from '@transcend-io/utils';\nimport cliProgress from 'cli-progress';\nimport colors from 'colors';\n\nimport { DEFAULT_TRANSCEND_API } from '../../constants.js';\nimport { logger } from '../../logger.js';\n\n/**\n * Given a CSV of Request IDs, mark associated RequestDataSilos as completed\n *\n * @param options - Options\n * @returns Number of items marked as completed\n */\nexport async function markRequestDataSiloIdsCompleted({\n requestIds,\n dataSiloId,\n auth,\n concurrency = 100,\n status = RequestDataSiloStatus.Resolved,\n transcendUrl = DEFAULT_TRANSCEND_API,\n}: {\n /** The list of request ids to mark as completed */\n requestIds: string[];\n /** Transcend API key authentication */\n auth: string;\n /** Data Silo ID to pull down jobs for */\n dataSiloId: string;\n /** Status to update requests to */\n status?: RequestDataSiloStatus;\n /** Upload concurrency */\n concurrency?: number;\n /** API URL for Transcend backend */\n transcendUrl?: string;\n}): Promise<number> {\n // Find all requests made before createdAt that are in a removing data state\n const client = buildTranscendGraphQLClient(transcendUrl, auth);\n\n // Time duration\n const t0 = new Date().getTime();\n // create a new progress bar instance and use shades_classic theme\n const progressBar = new cliProgress.SingleBar({}, cliProgress.Presets.shades_classic);\n\n // Notify Transcend\n logger.info(\n colors.magenta(\n `Notifying Transcend for data silo \"${dataSiloId}\" marking \"${requestIds.length}\" requests as completed.`,\n ),\n );\n\n let total = 0;\n progressBar.start(requestIds.length, 0);\n await map(\n requestIds,\n async (requestId) => {\n const requestDataSilo = await fetchRequestDataSilo(client, {\n logger,\n filterBy: { requestId, dataSiloId },\n });\n\n try {\n await makeGraphQLRequest<{\n /** Whether we successfully uploaded the results */\n success: boolean;\n }>(client, CHANGE_REQUEST_DATA_SILO_STATUS, {\n variables: {\n requestDataSiloId: requestDataSilo.id,\n status,\n },\n logger,\n });\n } catch (err) {\n if (\n !err.message.includes('Client error: Request must be active:') &&\n !err.message.includes('Failed to find RequestDataSilo')\n ) {\n throw err;\n }\n }\n\n total += 1;\n progressBar.update(total);\n },\n { concurrency },\n );\n\n progressBar.stop();\n const t1 = new Date().getTime();\n const totalTime = t1 - t0;\n\n logger.info(colors.green(`Successfully notified Transcend in \"${totalTime / 1000}\" seconds!`));\n return requestIds.length;\n}\n"],"mappings":"yYAoBA,eAAsB,EAAgC,CACpD,aACA,aACA,OACA,cAAc,IACd,SAAS,EAAsB,SAC/B,eAAe,GAcG,CAElB,IAAM,EAAS,EAA4B,EAAc,EAAK,CAGxD,EAAK,IAAI,MAAM,CAAC,SAAS,CAEzB,EAAc,IAAI,EAAY,UAAU,EAAE,CAAE,EAAY,QAAQ,eAAe,CAGrF,EAAO,KACL,EAAO,QACL,sCAAsC,EAAW,aAAa,EAAW,OAAO,0BACjF,CACF,CAED,IAAI,EAAQ,EACZ,EAAY,MAAM,EAAW,OAAQ,EAAE,CACvC,MAAM,EACJ,EACA,KAAO,IAAc,CACnB,IAAM,EAAkB,MAAM,EAAqB,EAAQ,CACzD,SACA,SAAU,CAAE,YAAW,aAAY,CACpC,CAAC,CAEF,GAAI,CACF,MAAM,EAGH,EAAQ,EAAiC,CAC1C,UAAW,CACT,kBAAmB,EAAgB,GACnC,SACD,CACD,SACD,CAAC,OACK,EAAK,CACZ,GACE,CAAC,EAAI,QAAQ,SAAS,wCAAwC,EAC9D,CAAC,EAAI,QAAQ,SAAS,iCAAiC,CAEvD,MAAM,EAIV,GAAS,EACT,EAAY,OAAO,EAAM,EAE3B,CAAE,cAAa,CAChB,CAED,EAAY,MAAM,CAElB,IAAM,EADK,IAAI,MAAM,CAAC,SACF,CAAG,EAGvB,OADA,EAAO,KAAK,EAAO,MAAM,uCAAuC,EAAY,IAAK,YAAY,CAAC,CACvF,EAAW"}
1
+ {"version":3,"file":"markRequestDataSiloIdsCompleted-C6lV_My-.mjs","names":[],"sources":["../src/lib/cron/markRequestDataSiloIdsCompleted.ts"],"sourcesContent":["import { RequestDataSiloStatus } from '@transcend-io/privacy-types';\nimport {\n buildTranscendGraphQLClient,\n makeGraphQLRequest,\n CHANGE_REQUEST_DATA_SILO_STATUS,\n fetchRequestDataSilo,\n} from '@transcend-io/sdk';\nimport { map } from '@transcend-io/utils';\nimport cliProgress from 'cli-progress';\nimport colors from 'colors';\n\nimport { DEFAULT_TRANSCEND_API } from '../../constants.js';\nimport { logger } from '../../logger.js';\n\n/**\n * Given a CSV of Request IDs, mark associated RequestDataSilos as completed\n *\n * @param options - Options\n * @returns Number of items marked as completed\n */\nexport async function markRequestDataSiloIdsCompleted({\n requestIds,\n dataSiloId,\n auth,\n concurrency = 100,\n status = RequestDataSiloStatus.Resolved,\n transcendUrl = DEFAULT_TRANSCEND_API,\n}: {\n /** The list of request ids to mark as completed */\n requestIds: string[];\n /** Transcend API key authentication */\n auth: string;\n /** Data Silo ID to pull down jobs for */\n dataSiloId: string;\n /** Status to update requests to */\n status?: RequestDataSiloStatus;\n /** Upload concurrency */\n concurrency?: number;\n /** API URL for Transcend backend */\n transcendUrl?: string;\n}): Promise<number> {\n // Find all requests made before createdAt that are in a removing data state\n const client = buildTranscendGraphQLClient(transcendUrl, auth);\n\n // Time duration\n const t0 = new Date().getTime();\n // create a new progress bar instance and use shades_classic theme\n const progressBar = new cliProgress.SingleBar({}, cliProgress.Presets.shades_classic);\n\n // Notify Transcend\n logger.info(\n colors.magenta(\n `Notifying Transcend for data silo \"${dataSiloId}\" marking \"${requestIds.length}\" requests as completed.`,\n ),\n );\n\n let total = 0;\n progressBar.start(requestIds.length, 0);\n await map(\n requestIds,\n async (requestId) => {\n const requestDataSilo = await fetchRequestDataSilo(client, {\n logger,\n filterBy: { requestId, dataSiloId },\n });\n\n try {\n await makeGraphQLRequest<{\n /** Whether we successfully uploaded the results */\n success: boolean;\n }>(client, CHANGE_REQUEST_DATA_SILO_STATUS, {\n variables: {\n requestDataSiloId: requestDataSilo.id,\n status,\n },\n logger,\n });\n } catch (err) {\n if (\n !err.message.includes('Client error: Request must be active:') &&\n !err.message.includes('Failed to find RequestDataSilo')\n ) {\n throw err;\n }\n }\n\n total += 1;\n progressBar.update(total);\n },\n { concurrency },\n );\n\n progressBar.stop();\n const t1 = new Date().getTime();\n const totalTime = t1 - t0;\n\n logger.info(colors.green(`Successfully notified Transcend in \"${totalTime / 1000}\" seconds!`));\n return requestIds.length;\n}\n"],"mappings":"yYAoBA,eAAsB,EAAgC,CACpD,aACA,aACA,OACA,cAAc,IACd,SAAS,EAAsB,SAC/B,eAAe,GAcG,CAElB,IAAM,EAAS,EAA4B,EAAc,EAAK,CAGxD,EAAK,IAAI,MAAM,CAAC,SAAS,CAEzB,EAAc,IAAI,EAAY,UAAU,EAAE,CAAE,EAAY,QAAQ,eAAe,CAGrF,EAAO,KACL,EAAO,QACL,sCAAsC,EAAW,aAAa,EAAW,OAAO,0BACjF,CACF,CAED,IAAI,EAAQ,EACZ,EAAY,MAAM,EAAW,OAAQ,EAAE,CACvC,MAAM,EACJ,EACA,KAAO,IAAc,CACnB,IAAM,EAAkB,MAAM,EAAqB,EAAQ,CACzD,SACA,SAAU,CAAE,YAAW,aAAY,CACpC,CAAC,CAEF,GAAI,CACF,MAAM,EAGH,EAAQ,EAAiC,CAC1C,UAAW,CACT,kBAAmB,EAAgB,GACnC,SACD,CACD,SACD,CAAC,OACK,EAAK,CACZ,GACE,CAAC,EAAI,QAAQ,SAAS,wCAAwC,EAC9D,CAAC,EAAI,QAAQ,SAAS,iCAAiC,CAEvD,MAAM,EAIV,GAAS,EACT,EAAY,OAAO,EAAM,EAE3B,CAAE,cAAa,CAChB,CAED,EAAY,MAAM,CAElB,IAAM,EADK,IAAI,MAAM,CAAC,SACF,CAAG,EAGvB,OADA,EAAO,KAAK,EAAO,MAAM,uCAAuC,EAAY,IAAK,YAAY,CAAC,CACvF,EAAW"}
@@ -1,2 +1,2 @@
1
- import{a as e}from"./constants-BRsj50Nb.mjs";import{t}from"./logger-CPu6zbyQ.mjs";import{o as n}from"./request-BpKyN9Xm.mjs";import{r}from"./fetchAllRequests-BI0tFl_a.mjs";import{RequestStatus as i}from"@transcend-io/privacy-types";import a from"colors";import{buildTranscendGraphQLClient as o,makeGraphQLRequest as s}from"@transcend-io/sdk";import{map as c}from"@transcend-io/utils";import l from"cli-progress";async function u({requestActions:u,auth:d,requestIds:f,statuses:p=[i.Compiling,i.RequestMade,i.Delayed,i.Approving,i.Secondary,i.Enriching,i.Waiting,i.SecondaryApproving],createdAtAfter:m,createdAtBefore:h,updatedAtBefore:g,updatedAtAfter:_,concurrency:v=100,transcendUrl:y=e}){let b=o(y,d),x=new Date().getTime(),S=new l.SingleBar({},l.Presets.shades_classic),C=await r(b,{actions:u,statuses:p,createdAtBefore:h,createdAtAfter:m,updatedAtBefore:g,updatedAtAfter:_,isSilent:!1,requestIds:f});t.info(a.magenta(`Marking "${C.length}" as silent mode.`));let w=0;S.start(C.length,0),await c(C,async e=>{await s(b,n,{variables:{input:{id:e.id,isSilent:!0}},logger:t}),w+=1,S.update(w)},{concurrency:v}),S.stop();let T=new Date().getTime()-x;return t.info(a.green(`Successfully marked ${w} requests as silent mode in "${T/1e3}" seconds!`)),C.length}export{u as t};
2
- //# sourceMappingURL=markSilentPrivacyRequests-gKYivzH1.mjs.map
1
+ import{a as e}from"./constants-BlKpAm3R.mjs";import{t}from"./logger-CPu6zbyQ.mjs";import{o as n}from"./request-BpKyN9Xm.mjs";import{r}from"./fetchAllRequests-BI0tFl_a.mjs";import{RequestStatus as i}from"@transcend-io/privacy-types";import a from"colors";import{map as o}from"@transcend-io/utils";import{buildTranscendGraphQLClient as s,makeGraphQLRequest as c}from"@transcend-io/sdk";import l from"cli-progress";async function u({requestActions:u,auth:d,requestIds:f,statuses:p=[i.Compiling,i.RequestMade,i.Delayed,i.Approving,i.Secondary,i.Enriching,i.Waiting,i.SecondaryApproving],createdAtAfter:m,createdAtBefore:h,updatedAtBefore:g,updatedAtAfter:_,concurrency:v=100,transcendUrl:y=e}){let b=s(y,d),x=new Date().getTime(),S=new l.SingleBar({},l.Presets.shades_classic),C=await r(b,{actions:u,statuses:p,createdAtBefore:h,createdAtAfter:m,updatedAtBefore:g,updatedAtAfter:_,isSilent:!1,requestIds:f});t.info(a.magenta(`Marking "${C.length}" as silent mode.`));let w=0;S.start(C.length,0),await o(C,async e=>{await c(b,n,{variables:{input:{id:e.id,isSilent:!0}},logger:t}),w+=1,S.update(w)},{concurrency:v}),S.stop();let T=new Date().getTime()-x;return t.info(a.green(`Successfully marked ${w} requests as silent mode in "${T/1e3}" seconds!`)),C.length}export{u as t};
2
+ //# sourceMappingURL=markSilentPrivacyRequests-D3bFOMLh.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"markSilentPrivacyRequests-gKYivzH1.mjs","names":[],"sources":["../src/lib/requests/markSilentPrivacyRequests.ts"],"sourcesContent":["import { RequestAction, RequestStatus } from '@transcend-io/privacy-types';\nimport { buildTranscendGraphQLClient, makeGraphQLRequest } from '@transcend-io/sdk';\nimport { map } from '@transcend-io/utils';\nimport cliProgress from 'cli-progress';\nimport colors from 'colors';\n\nimport { DEFAULT_TRANSCEND_API } from '../../constants.js';\nimport { logger } from '../../logger.js';\nimport { UPDATE_PRIVACY_REQUEST, fetchAllRequests } from '../graphql/index.js';\n\n/**\n * Mark a set of privacy requests to be in silent mode\n *\n * @param options - Options\n * @returns The number of requests marked silent\n */\nexport async function markSilentPrivacyRequests({\n requestActions,\n auth,\n requestIds,\n statuses = [\n RequestStatus.Compiling,\n RequestStatus.RequestMade,\n RequestStatus.Delayed,\n RequestStatus.Approving,\n RequestStatus.Secondary,\n RequestStatus.Enriching,\n RequestStatus.Waiting,\n RequestStatus.SecondaryApproving,\n ],\n createdAtAfter,\n createdAtBefore,\n updatedAtBefore,\n updatedAtAfter,\n concurrency = 100,\n transcendUrl = DEFAULT_TRANSCEND_API,\n}: {\n /** The request actions that should be restarted */\n requestActions: RequestAction[];\n /** Transcend API key authentication */\n auth: string;\n /** Concurrency limit for approving */\n concurrency?: number;\n /** The request statuses to mark silent */\n statuses?: RequestStatus[];\n /** The set of privacy requests to mark silent */\n requestIds?: string[];\n /** Filter for requests created before this date */\n createdAtBefore?: Date;\n /** Filter for requests created after this date */\n createdAtAfter?: Date;\n /** Filter for requests updated before this date */\n updatedAtBefore?: Date;\n /** Filter for requests updated after this date */\n updatedAtAfter?: Date;\n /** API URL for Transcend backend */\n transcendUrl?: string;\n}): Promise<number> {\n // Find all requests made before createdAt that are in a removing data state\n const client = buildTranscendGraphQLClient(transcendUrl, auth);\n\n // Time duration\n const t0 = new Date().getTime();\n // create a new progress bar instance and use shades_classic theme\n const progressBar = new cliProgress.SingleBar({}, cliProgress.Presets.shades_classic);\n\n // Pull in the requests\n const allRequests = await fetchAllRequests(client, {\n actions: requestActions,\n statuses,\n createdAtBefore,\n createdAtAfter,\n updatedAtBefore,\n updatedAtAfter,\n isSilent: false,\n requestIds,\n });\n\n // Notify Transcend\n logger.info(colors.magenta(`Marking \"${allRequests.length}\" as silent mode.`));\n\n let total = 0;\n progressBar.start(allRequests.length, 0);\n await map(\n allRequests,\n async (requestToMarkSilent) => {\n await makeGraphQLRequest(client, UPDATE_PRIVACY_REQUEST, {\n variables: {\n input: {\n id: requestToMarkSilent.id,\n isSilent: true,\n },\n },\n logger,\n });\n\n total += 1;\n progressBar.update(total);\n },\n { concurrency },\n );\n\n progressBar.stop();\n const t1 = new Date().getTime();\n const totalTime = t1 - t0;\n\n logger.info(\n colors.green(\n `Successfully marked ${total} requests as silent mode in \"${totalTime / 1000}\" seconds!`,\n ),\n );\n return allRequests.length;\n}\n"],"mappings":"4ZAgBA,eAAsB,EAA0B,CAC9C,iBACA,OACA,aACA,WAAW,CACT,EAAc,UACd,EAAc,YACd,EAAc,QACd,EAAc,UACd,EAAc,UACd,EAAc,UACd,EAAc,QACd,EAAc,mBACf,CACD,iBACA,kBACA,kBACA,iBACA,cAAc,IACd,eAAe,GAsBG,CAElB,IAAM,EAAS,EAA4B,EAAc,EAAK,CAGxD,EAAK,IAAI,MAAM,CAAC,SAAS,CAEzB,EAAc,IAAI,EAAY,UAAU,EAAE,CAAE,EAAY,QAAQ,eAAe,CAG/E,EAAc,MAAM,EAAiB,EAAQ,CACjD,QAAS,EACT,WACA,kBACA,iBACA,kBACA,iBACA,SAAU,GACV,aACD,CAAC,CAGF,EAAO,KAAK,EAAO,QAAQ,YAAY,EAAY,OAAO,mBAAmB,CAAC,CAE9E,IAAI,EAAQ,EACZ,EAAY,MAAM,EAAY,OAAQ,EAAE,CACxC,MAAM,EACJ,EACA,KAAO,IAAwB,CAC7B,MAAM,EAAmB,EAAQ,EAAwB,CACvD,UAAW,CACT,MAAO,CACL,GAAI,EAAoB,GACxB,SAAU,GACX,CACF,CACD,SACD,CAAC,CAEF,GAAS,EACT,EAAY,OAAO,EAAM,EAE3B,CAAE,cAAa,CAChB,CAED,EAAY,MAAM,CAElB,IAAM,EADK,IAAI,MAAM,CAAC,SACF,CAAG,EAOvB,OALA,EAAO,KACL,EAAO,MACL,uBAAuB,EAAM,+BAA+B,EAAY,IAAK,YAC9E,CACF,CACM,EAAY"}
1
+ {"version":3,"file":"markSilentPrivacyRequests-D3bFOMLh.mjs","names":[],"sources":["../src/lib/requests/markSilentPrivacyRequests.ts"],"sourcesContent":["import { RequestAction, RequestStatus } from '@transcend-io/privacy-types';\nimport { buildTranscendGraphQLClient, makeGraphQLRequest } from '@transcend-io/sdk';\nimport { map } from '@transcend-io/utils';\nimport cliProgress from 'cli-progress';\nimport colors from 'colors';\n\nimport { DEFAULT_TRANSCEND_API } from '../../constants.js';\nimport { logger } from '../../logger.js';\nimport { UPDATE_PRIVACY_REQUEST, fetchAllRequests } from '../graphql/index.js';\n\n/**\n * Mark a set of privacy requests to be in silent mode\n *\n * @param options - Options\n * @returns The number of requests marked silent\n */\nexport async function markSilentPrivacyRequests({\n requestActions,\n auth,\n requestIds,\n statuses = [\n RequestStatus.Compiling,\n RequestStatus.RequestMade,\n RequestStatus.Delayed,\n RequestStatus.Approving,\n RequestStatus.Secondary,\n RequestStatus.Enriching,\n RequestStatus.Waiting,\n RequestStatus.SecondaryApproving,\n ],\n createdAtAfter,\n createdAtBefore,\n updatedAtBefore,\n updatedAtAfter,\n concurrency = 100,\n transcendUrl = DEFAULT_TRANSCEND_API,\n}: {\n /** The request actions that should be restarted */\n requestActions: RequestAction[];\n /** Transcend API key authentication */\n auth: string;\n /** Concurrency limit for approving */\n concurrency?: number;\n /** The request statuses to mark silent */\n statuses?: RequestStatus[];\n /** The set of privacy requests to mark silent */\n requestIds?: string[];\n /** Filter for requests created before this date */\n createdAtBefore?: Date;\n /** Filter for requests created after this date */\n createdAtAfter?: Date;\n /** Filter for requests updated before this date */\n updatedAtBefore?: Date;\n /** Filter for requests updated after this date */\n updatedAtAfter?: Date;\n /** API URL for Transcend backend */\n transcendUrl?: string;\n}): Promise<number> {\n // Find all requests made before createdAt that are in a removing data state\n const client = buildTranscendGraphQLClient(transcendUrl, auth);\n\n // Time duration\n const t0 = new Date().getTime();\n // create a new progress bar instance and use shades_classic theme\n const progressBar = new cliProgress.SingleBar({}, cliProgress.Presets.shades_classic);\n\n // Pull in the requests\n const allRequests = await fetchAllRequests(client, {\n actions: requestActions,\n statuses,\n createdAtBefore,\n createdAtAfter,\n updatedAtBefore,\n updatedAtAfter,\n isSilent: false,\n requestIds,\n });\n\n // Notify Transcend\n logger.info(colors.magenta(`Marking \"${allRequests.length}\" as silent mode.`));\n\n let total = 0;\n progressBar.start(allRequests.length, 0);\n await map(\n allRequests,\n async (requestToMarkSilent) => {\n await makeGraphQLRequest(client, UPDATE_PRIVACY_REQUEST, {\n variables: {\n input: {\n id: requestToMarkSilent.id,\n isSilent: true,\n },\n },\n logger,\n });\n\n total += 1;\n progressBar.update(total);\n },\n { concurrency },\n );\n\n progressBar.stop();\n const t1 = new Date().getTime();\n const totalTime = t1 - t0;\n\n logger.info(\n colors.green(\n `Successfully marked ${total} requests as silent mode in \"${totalTime / 1000}\" seconds!`,\n ),\n );\n return allRequests.length;\n}\n"],"mappings":"4ZAgBA,eAAsB,EAA0B,CAC9C,iBACA,OACA,aACA,WAAW,CACT,EAAc,UACd,EAAc,YACd,EAAc,QACd,EAAc,UACd,EAAc,UACd,EAAc,UACd,EAAc,QACd,EAAc,mBACf,CACD,iBACA,kBACA,kBACA,iBACA,cAAc,IACd,eAAe,GAsBG,CAElB,IAAM,EAAS,EAA4B,EAAc,EAAK,CAGxD,EAAK,IAAI,MAAM,CAAC,SAAS,CAEzB,EAAc,IAAI,EAAY,UAAU,EAAE,CAAE,EAAY,QAAQ,eAAe,CAG/E,EAAc,MAAM,EAAiB,EAAQ,CACjD,QAAS,EACT,WACA,kBACA,iBACA,kBACA,iBACA,SAAU,GACV,aACD,CAAC,CAGF,EAAO,KAAK,EAAO,QAAQ,YAAY,EAAY,OAAO,mBAAmB,CAAC,CAE9E,IAAI,EAAQ,EACZ,EAAY,MAAM,EAAY,OAAQ,EAAE,CACxC,MAAM,EACJ,EACA,KAAO,IAAwB,CAC7B,MAAM,EAAmB,EAAQ,EAAwB,CACvD,UAAW,CACT,MAAO,CACL,GAAI,EAAoB,GACxB,SAAU,GACX,CACF,CACD,SACD,CAAC,CAEF,GAAS,EACT,EAAY,OAAO,EAAM,EAE3B,CAAE,cAAa,CAChB,CAED,EAAY,MAAM,CAElB,IAAM,EADK,IAAI,MAAM,CAAC,SACF,CAAG,EAOvB,OALA,EAAO,KACL,EAAO,MACL,uBAAuB,EAAM,+BAA+B,EAAY,IAAK,YAC9E,CACF,CACM,EAAY"}
@@ -1,3 +1,3 @@
1
- import{t as e}from"./logger-CPu6zbyQ.mjs";import{gt as t}from"./codecs-CfcaFoZR.mjs";import{chunk as n,difference as r,flatten as i,keyBy as a,uniq as o}from"lodash-es";import s from"colors";import{apply as c,getEntries as l}from"@transcend-io/type-utils";import{CREATE_DATA_SILOS as u,UPDATE_DATA_SILOS as d,UPDATE_OR_CREATE_DATA_POINT as f,convertToDataSubjectBlockList as p,createDataSubject as m,fetchAllActions as h,fetchAllAttributes as g,fetchAllDataSilos as _,fetchAllDataSubjects as v,fetchApiKeys as y,fetchIdentifiersAndCreateMissing as b,makeGraphQLRequest as x,syncAction as S,syncActionItemCollections as C,syncActionItems as w,syncAttribute as T,syncBusinessEntities as ee,syncConsentManager as te,syncConsentWorkflowTriggers as ne,syncCookies as re,syncDataCategories as ie,syncDataFlows as ae,syncDataSiloDependencies as oe,syncDataSubject as se,syncEnricher as ce,syncIdentifier as le,syncIntlMessages as ue,syncPartitions as de,syncPolicies as fe,syncPreferenceOptionValues as pe,syncPreferenceTopics as me,syncPrivacyCenter as he,syncProcessingActivities as ge,syncProcessingPurposes as _e,syncPurposes as ve,syncTeams as ye,syncTemplate as be,syncVendors as xe,syncWorkflowConfigs as Se}from"@transcend-io/sdk";import{map as E,mapSeries as D}from"@transcend-io/utils";import O from"cli-progress";const k=/^[A-Za-z]+$/;function Ce(e){let t=[],n=(e,n)=>{k.test(e)||t.push(`${n}: slug "${e}" is invalid — slugs must contain only alphabetical letters (A-Z, a-z). Topic slugs are normalized to PascalCase server-side, so YAML slugs should already be PascalCase or matching will break on subsequent pulls.`)};for(let t of e[`preference-options`]??[])n(t.slug,`preference-options`);for(let t of e.purposes??[])for(let e of t[`preference-topics`]??[]){n(e.slug,`purposes (topic "${e.title}")`);for(let t of e.options??[])n(t.slug,`purposes (topic "${e.title}" option "${t.title}")`)}return t}async function A({"data-silos":t=[],"data-subjects":n=[],"processing-activities":c=[],preflights:l=[]},u,d=!1){let f=o([...i(t.map(e=>e[`data-subjects`]||[])||[]),...i(c.map(({dataSubjectTypes:e})=>e??[])??[]),...i(l.map(e=>e[`data-subjects`]||[])||[]),...n.map(e=>e.type)]);if(f.length===0&&!d)return{};let p=await v(u,{logger:e}),h=a(p,`type`),g=r(f,p.map(({type:e})=>e));if(g.length>0){e.info(s.magenta(`Creating ${g.length} new data subjects...`));for(let t of g){e.info(s.magenta(`Creating data subject ${t}...`));let n=await m(u,{input:t,logger:e});e.info(s.green(`Created data subject ${t}!`)),h[t]=n}}return h}function we(e,t){if(e.length===0)return[];if(typeof e[0]==`string`)return[{titles:o(e)}];let n,r=[],i=new Set,a=(e,n)=>{if(i.has(e))throw Error(`Data silo "${t}" has multiple deletion-dependencies entries for workflow "${e}". Combine them into a single entry.`);i.add(e),r.push({workflowConfigInternalName:e,...n})};return e.forEach(e=>{if(`reset-to-global`in e&&`titles`in e)throw Error(`Data silo "${t}" has a deletion-dependencies entry for workflow "${e.workflow}" that sets both "reset-to-global" and "titles". Use "titles: []" to override the global configuration with no dependencies, or "reset-to-global: true" to fall back to the global configuration.`);if(`reset-to-global`in e){a(e.workflow,{resetToGlobal:!0});return}if(e.workflow){a(e.workflow,{titles:e.titles});return}if(n!==void 0)throw Error(`Data silo "${t}" has multiple global deletion-dependencies entries. Combine them into a single \`{ titles: [...] }\` entry.`);n=e.titles}),[...n===void 0?[]:[{titles:o(n)}],...r]}async function j(t,r,{pageSize:i,dataSubjectsByName:o,apiKeysByTitle:l}){let m=!1,h=new Date().getTime();e.info(s.magenta(`Syncing "${t.length}" data silos...`));let g=a(await _(r,{titles:t.map(({title:e})=>e),pageSize:i,logger:e}),`title`),v=t.filter(({title:e})=>!g[e]);v.length>0&&(e.info(s.magenta(`Creating "${v.length}" data silos that did not exist...`)),await D(n(v,20),async t=>{let{createDataSilos:{dataSilos:n}}=await x(r,u,{variables:{input:t.map(e=>({name:e[`outer-type`]||e.integrationName,title:e.title,country:e.country,countrySubDivision:e.countrySubDivision,sombraId:e[`sombra-id`]}))},logger:e});n.forEach(e=>{g[e.title]=e})}),e.info(s.green(`Successfully created "${v.length}" data silos!`)));let y=n(t,20);await D(y,async(t,n)=>{e.info(s.magenta(`[Batch ${n+1}/${y.length}] Syncing "${t.length}" data silos`)),await x(r,d,{variables:{input:{dataSilos:t.map(e=>({id:g[e.title].id,country:e.country,countrySubDivision:e.countrySubDivision,url:e.url,headers:e.headers,description:e.description,identifiers:e[`identity-keys`],isLive:!e.disabled,ownerEmails:e.owners,teamNames:e.teams,dependedOnDataSilos:e[`deletion-dependencies`]?void 0:[{titles:[]}],apiKeyId:e[`api-key-title`]?l[e[`api-key-title`]].id:void 0,dataSubjectBlockListIds:e[`data-subjects`]?p(e[`data-subjects`],o):void 0,attributes:e.attributes,businessEntityTitles:e.businessEntityTitles,sombraId:e[`sombra-id`],notifyEmailAddress:e[`email-settings`]?.[`notify-email-address`],promptAVendorEmailSendFrequency:e[`email-settings`]?.[`send-frequency`],promptAVendorEmailSendType:e[`email-settings`]?.[`send-type`],promptAVendorEmailIncludeIdentifiersAttachment:e[`email-settings`]?.[`include-identifiers-attachment`],promptAVendorEmailCompletionLinkType:e[`email-settings`]?.[`completion-link-type`],manualWorkRetryFrequency:e[`email-settings`]?.[`manual-work-retry-frequency`]}))}},logger:e}),e.info(s.green(`[Batch ${n+1}/${y.length}] Synced "${t.length}" data silos!`))});let b=new O.SingleBar({},O.Presets.shades_classic),S=t.filter(({datapoints:e=[]})=>e.length>0),C=t.map(({datapoints:e=[]})=>e.length).reduce((e,t)=>e+t,0);e.info(s.magenta(`Syncing "${C}" datapoints from "${S.length}" data silos...`)),b.start(C,0);let w=0;await E(S,async({datapoints:t,title:n})=>{t&&await D(t,async t=>{let i=t.fields?t.fields.map(({key:e,description:t,categories:n,purposes:r,attributes:i,...a})=>({name:e,description:t,categories:n?n.map(e=>({...e,name:e.name||`Other`})):void 0,purposes:r?r.map(e=>({...e,name:e.name||`Other`})):void 0,attributes:i,accessRequestVisibilityEnabled:a[`access-request-visibility-enabled`],erasureRequestRedactionEnabled:a[`erasure-request-redaction-enabled`]})):void 0,a={dataSiloId:g[n].id,path:t.path,name:t.key,title:t.title,description:t.description,...t.owners?{ownerEmails:t.owners}:{},...t.teams?{teamNames:t.teams}:{},...t[`data-collection-tag`]?{dataCollectionTag:t[`data-collection-tag`]}:{},querySuggestions:t[`privacy-action-queries`]?Object.entries(t[`privacy-action-queries`]).map(([e,t])=>({requestType:e,suggestedQuery:t})):void 0,enabledActions:t[`privacy-actions`]||[],subDataPoints:i},o=(a.subDataPoints||[]).map(({name:e})=>e),c=o.filter((e,t)=>o.indexOf(e)!==t);if(c.length>0)e.info(s.red(`\nCannot update datapoint "${t.key}" as it has duplicate sub-datapoints with the same name: \n${c.join(`
2
- `)}`)),m=!0;else try{await x(r,f,{variables:a,logger:e})}catch(r){e.info(s.red(`\nFailed to update datapoint "${t.key}" for data silo "${n}"! - \n${r.message}`)),m=!0}w+=1,b.update(w)})},{concurrency:10}),b.stop();let T=new Date().getTime()-h;return e.info(s.green(`Synced "${t.length}" data silos and "${C}" datapoints in "${T/1e3}" seconds!`)),{success:!m,dataSiloTitleToId:c(g,({id:e})=>e)}}async function M(n,r,{pageSize:i=50,publishToPrivacyCenter:a=!0,classifyService:o=!1,deleteExtraAttributeValues:c=!1,logger:l,warnings:u=[]}){let d=t(n),f=l??e,p=[],m=!1,_=(e,t,n)=>{p.push({resource:e,item:n,message:t}),m=!0};f.info(s.magenta(`Fetching data with page size ${i}...`));let{templates:x,attributes:D,actions:O,identifiers:k,"data-subjects":M,"business-entities":N,preflights:P,cookies:F,"consent-manager":I,"data-silos":L,"data-flows":R,vendors:z,"data-categories":B,"processing-activities":V,"processing-purposes":H,"action-items":U,"action-item-collections":W,teams:G,"privacy-center":K,messages:q,policies:J,partitions:Y,"preference-workflow-configs":Te,"workflow-configs":Ee}=d,De=d[`preference-options`],X=d.purposes,Oe=Ce(d);if(Oe.length>0){for(let e of Oe)_(`preference-slugs`,e);return{success:!1,errors:p,warnings:u.length>0?u:void 0}}let[Z,Q,ke]=await Promise.all([P||k?b(r,{input:d,skipPublish:!a,logger:e}):{},L||M||P||V?A(d,r):{},L&&L.map(e=>e[`api-key-title`]||[]).reduce((e,t)=>e+t.length,0)>0?y(r,{apiKeyInputs:d,logger:e}):{}]);if(Te?.length&&(await ne(r,Te,{logger:f,pageSize:i})||_(`preference-workflow-configs`,`Failed to sync preference workflow configs`)),Ee?.length&&(await Se(r,Ee,{logger:f})||_(`workflow-configs`,`Failed to sync workflow configs`)),De?.length&&(await pe(r,De,{logger:f})||_(`preference-options`,`Failed to sync preference option values`)),X?.length){let{success:e,purposeIdByTrackingType:t}=await ve(r,X,{logger:f});e||_(`purposes`,`Failed to sync one or more purposes`);let n=X.flatMap(e=>(e[`preference-topics`]??[]).map(t=>({...t,"tracking-type":e.trackingType})));n.length>0&&(await me(r,n,{logger:f,purposeIdByTrackingType:t})||_(`preference-topics`,`Failed to sync one or more preference topics`))}if(I){f.info(s.magenta(`Syncing consent manager...`));try{await te(r,I,{logger:f}),f.info(s.green(`Successfully synced consent manager!`))}catch(e){_(`consent-manager`,e.message),f.error(s.red(`Failed to sync consent manager! - ${e.message}`))}}if(G){let t=await ye(r,G,{logger:e});m||=!t}if(x&&(e.info(s.magenta(`Syncing "${x.length}" email templates...`)),await E(x,async t=>{e.info(s.magenta(`Syncing template "${t.title}"...`));try{await be(r,t,{logger:e}),e.info(s.green(`Successfully synced template "${t.title}"!`))}catch(n){m=!0,e.error(s.red(`Failed to sync template "${t.title}"! - ${n.message}`))}},{concurrency:10}),e.info(s.green(`Synced "${x.length}" email templates!`))),N){let t=await ee(r,N,{logger:e});m||=!t}if(z){let t=await xe(r,z,{logger:e});m||=!t}if(B){let t=await ie(r,B,{logger:e});m||=!t}if(H){let t=await _e(r,H,{logger:e});m||=!t}if(Y){let t=await de(r,Y,{logger:e});m||=!t}if(F){let t=await re(r,F,{logger:e});m||=!t}if(W){let t=await C(r,W,{logger:e});m||=!t}if(D){e.info(s.magenta(`Syncing "${D.length}" attributes...`));let t=await g(r,{logger:e});await E(D,async n=>{let i=t.find(e=>e.name===n.name);e.info(s.magenta(`Syncing attribute "${n.name}"...`));try{await T(r,n,{existingAttribute:i,deleteExtraAttributeValues:c,logger:e}),e.info(s.green(`Successfully synced attribute "${n.name}"!`))}catch(t){m=!0,e.error(s.red(`Failed to sync attribute "${n.name}"! - ${t.message}`))}},{concurrency:10}),e.info(s.green(`Synced "${D.length}" attributes!`))}if(U){let t=await w(r,U,{logger:e});m||=!t}if(P&&(e.info(s.magenta(`Syncing "${P.length}" preflight checks...`)),await E(P,async t=>{e.info(s.magenta(`Syncing preflight check "${t.title}"...`));try{await ce(r,{input:t,identifierByName:Z,dataSubjectsByName:Q,logger:e}),e.info(s.green(`Successfully synced preflight check "${t.title}"!`))}catch(n){m=!0,e.error(s.red(`Failed to sync preflight check "${t.title}"! - ${n.message}`))}},{concurrency:10}),e.info(s.green(`Synced "${P.length}" preflight checks!`))),k&&(e.info(s.magenta(`Syncing "${k.length}" identifiers...`)),await E(k,async t=>{let n=Z[t.name];if(!n)throw Error(`Failed to find identifier with name: ${t.type}. Should have been auto-created by cli.`);e.info(s.magenta(`Syncing identifier "${t.type}"...`));try{await le(r,{input:t,dataSubjectsByName:Q,identifierId:n.id,skipPublish:!a,logger:e}),e.info(s.green(`Successfully synced identifier "${t.type}"!`))}catch(n){m=!0,e.info(s.red(`Failed to sync identifier "${t.type}"! - ${n.message}`))}},{concurrency:10}),e.info(s.green(`Synced "${k.length}" identifiers!`))),O){e.info(s.magenta(`Syncing "${O.length}" actions...`));let t=await h(r,{logger:e});await E(O,async n=>{let i=t.find(e=>e.type===n.type);if(!i)throw Error(`Failed to find action with type: ${n.type}. Should have already existing in the organization.`);e.info(s.magenta(`Syncing action "${n.type}"...`));try{await S(r,{action:n,actionId:i.id,skipPublish:!a},{logger:e}),e.info(s.green(`Successfully synced action "${n.type}"!`))}catch(t){m=!0,e.error(s.red(`Failed to sync action "${n.type}"! - ${t.message}`))}},{concurrency:10}),e.info(s.green(`Synced "${O.length}" actions!`))}if(M){e.info(s.magenta(`Syncing "${M.length}" data subjects...`));let t=await v(r,{logger:e});await E(M,async n=>{let i=t.find(e=>e.type===n.type);if(!i)throw Error(`Failed to find data subject with type: ${n.type}. Should have already existing in the organization.`);e.info(s.magenta(`Syncing data subject "${n.type}"...`));try{await se(r,{input:n,dataSubjectId:i.id,skipPublish:!a,logger:e}),e.info(s.green(`Successfully synced data subject "${n.type}"!`))}catch(t){m=!0;let r=n.supportsAuthorizedAgent!==void 0&&/authorized.agent/i.test(t.message)?` (enable the Authorized Agents feature for this organization before setting "supportsAuthorizedAgent")`:``;e.info(s.red(`Failed to sync data subject "${n.type}"! - ${t.message}${r}`))}},{concurrency:10}),e.info(s.green(`Synced "${M.length}" data subjects!`))}if(R){let t=await ae(r,R,{classifyService:o,logger:e});m||=!t}if(K)try{await he(r,K,{logger:e,skipPublish:!a})||_(`privacy-center`,`Failed to sync privacy center`)}catch(e){_(`privacy-center`,e.message)}if(q){let t=await ue(r,q,{logger:e});m||=!t}if(J){let t=await fe(r,J,{logger:e});m||=!t}let $=[];if(L){let{success:e,dataSiloTitleToId:t}=await j(L,r,{dataSubjectsByName:Q,apiKeysByTitle:ke,pageSize:i});L?.forEach(e=>{let n=e[`deletion-dependencies`];if(n)try{$.push([t[e.title],we(n,e.title)])}catch(t){_(`data-silos`,t.message,e.title),f.error(s.red(t.message))}}),m||=!e}if($.length>0){let t=await oe(r,{input:$,logger:e});m||=!t}if(V){let t=await ge(r,V,{logger:e});m||=!t}return{success:!m,errors:p,warnings:u.length>0?u:void 0}}function N(e,...n){let r=JSON.parse(JSON.stringify(e));return n.forEach(e=>{l(e).forEach(([e,t])=>{r[e]===void 0?r[e]=t:Array.isArray(t)?r[e]=[...r[e],...t]:r[e]=t})}),t(r)}export{A as i,M as n,j as r,N as t};
3
- //# sourceMappingURL=mergeTranscendInputs-D1CvxQu0.mjs.map
1
+ import{t as e}from"./logger-CPu6zbyQ.mjs";import{gt as t}from"./codecs-CfcaFoZR.mjs";import{chunk as n,difference as r,flatten as i,keyBy as a,uniq as o}from"lodash-es";import s from"colors";import{map as c,mapSeries as l}from"@transcend-io/utils";import{apply as u,getEntries as d}from"@transcend-io/type-utils";import{CREATE_DATA_SILOS as f,UPDATE_DATA_SILOS as p,UPDATE_OR_CREATE_DATA_POINT as m,convertToDataSubjectBlockList as h,createDataSubject as g,fetchAllActions as _,fetchAllAttributes as v,fetchAllDataSilos as y,fetchAllDataSubjects as b,fetchApiKeys as x,fetchIdentifiersAndCreateMissing as S,makeGraphQLRequest as C,syncAction as w,syncActionItemCollections as T,syncActionItems as E,syncAttribute as D,syncBusinessEntities as ee,syncConsentManager as te,syncConsentWorkflowTriggers as ne,syncCookies as re,syncDataCategories as ie,syncDataFlows as ae,syncDataSiloDependencies as oe,syncDataSubject as se,syncEnricher as ce,syncIdentifier as le,syncIntlMessages as ue,syncPartitions as de,syncPolicies as fe,syncPreferenceOptionValues as pe,syncPreferenceTopics as me,syncPrivacyCenter as he,syncProcessingActivities as ge,syncProcessingPurposes as _e,syncPurposes as ve,syncTeams as ye,syncTemplate as be,syncVendors as xe,syncWorkflowConfigs as Se}from"@transcend-io/sdk";import O from"cli-progress";const k=/^[A-Za-z]+$/;function Ce(e){let t=[],n=(e,n)=>{k.test(e)||t.push(`${n}: slug "${e}" is invalid — slugs must contain only alphabetical letters (A-Z, a-z). Topic slugs are normalized to PascalCase server-side, so YAML slugs should already be PascalCase or matching will break on subsequent pulls.`)};for(let t of e[`preference-options`]??[])n(t.slug,`preference-options`);for(let t of e.purposes??[])for(let e of t[`preference-topics`]??[]){n(e.slug,`purposes (topic "${e.title}")`);for(let t of e.options??[])n(t.slug,`purposes (topic "${e.title}" option "${t.title}")`)}return t}async function A({"data-silos":t=[],"data-subjects":n=[],"processing-activities":c=[],preflights:l=[]},u,d=!1){let f=o([...i(t.map(e=>e[`data-subjects`]||[])||[]),...i(c.map(({dataSubjectTypes:e})=>e??[])??[]),...i(l.map(e=>e[`data-subjects`]||[])||[]),...n.map(e=>e.type)]);if(f.length===0&&!d)return{};let p=await b(u,{logger:e}),m=a(p,`type`),h=r(f,p.map(({type:e})=>e));if(h.length>0){e.info(s.magenta(`Creating ${h.length} new data subjects...`));for(let t of h){e.info(s.magenta(`Creating data subject ${t}...`));let n=await g(u,{input:t,logger:e});e.info(s.green(`Created data subject ${t}!`)),m[t]=n}}return m}function we(e,t){if(e.length===0)return[];if(typeof e[0]==`string`)return[{titles:o(e)}];let n,r=[],i=new Set,a=(e,n)=>{if(i.has(e))throw Error(`Data silo "${t}" has multiple deletion-dependencies entries for workflow "${e}". Combine them into a single entry.`);i.add(e),r.push({workflowConfigInternalName:e,...n})};return e.forEach(e=>{if(`reset-to-global`in e&&`titles`in e)throw Error(`Data silo "${t}" has a deletion-dependencies entry for workflow "${e.workflow}" that sets both "reset-to-global" and "titles". Use "titles: []" to override the global configuration with no dependencies, or "reset-to-global: true" to fall back to the global configuration.`);if(`reset-to-global`in e){a(e.workflow,{resetToGlobal:!0});return}if(e.workflow){a(e.workflow,{titles:e.titles});return}if(n!==void 0)throw Error(`Data silo "${t}" has multiple global deletion-dependencies entries. Combine them into a single \`{ titles: [...] }\` entry.`);n=e.titles}),[...n===void 0?[]:[{titles:o(n)}],...r]}async function j(t,r,{pageSize:i,dataSubjectsByName:o,apiKeysByTitle:d}){let g=!1,_=new Date().getTime();e.info(s.magenta(`Syncing "${t.length}" data silos...`));let v=a(await y(r,{titles:t.map(({title:e})=>e),pageSize:i,logger:e}),`title`),b=t.filter(({title:e})=>!v[e]);b.length>0&&(e.info(s.magenta(`Creating "${b.length}" data silos that did not exist...`)),await l(n(b,20),async t=>{let{createDataSilos:{dataSilos:n}}=await C(r,f,{variables:{input:t.map(e=>({name:e[`outer-type`]||e.integrationName,title:e.title,country:e.country,countrySubDivision:e.countrySubDivision,sombraId:e[`sombra-id`]}))},logger:e});n.forEach(e=>{v[e.title]=e})}),e.info(s.green(`Successfully created "${b.length}" data silos!`)));let x=n(t,20);await l(x,async(t,n)=>{e.info(s.magenta(`[Batch ${n+1}/${x.length}] Syncing "${t.length}" data silos`)),await C(r,p,{variables:{input:{dataSilos:t.map(e=>({id:v[e.title].id,country:e.country,countrySubDivision:e.countrySubDivision,url:e.url,headers:e.headers,description:e.description,identifiers:e[`identity-keys`],isLive:!e.disabled,ownerEmails:e.owners,teamNames:e.teams,dependedOnDataSilos:e[`deletion-dependencies`]?void 0:[{titles:[]}],apiKeyId:e[`api-key-title`]?d[e[`api-key-title`]].id:void 0,dataSubjectBlockListIds:e[`data-subjects`]?h(e[`data-subjects`],o):void 0,attributes:e.attributes,businessEntityTitles:e.businessEntityTitles,sombraId:e[`sombra-id`],notifyEmailAddress:e[`email-settings`]?.[`notify-email-address`],promptAVendorEmailSendFrequency:e[`email-settings`]?.[`send-frequency`],promptAVendorEmailSendType:e[`email-settings`]?.[`send-type`],promptAVendorEmailIncludeIdentifiersAttachment:e[`email-settings`]?.[`include-identifiers-attachment`],promptAVendorEmailCompletionLinkType:e[`email-settings`]?.[`completion-link-type`],manualWorkRetryFrequency:e[`email-settings`]?.[`manual-work-retry-frequency`]}))}},logger:e}),e.info(s.green(`[Batch ${n+1}/${x.length}] Synced "${t.length}" data silos!`))});let S=new O.SingleBar({},O.Presets.shades_classic),w=t.filter(({datapoints:e=[]})=>e.length>0),T=t.map(({datapoints:e=[]})=>e.length).reduce((e,t)=>e+t,0);e.info(s.magenta(`Syncing "${T}" datapoints from "${w.length}" data silos...`)),S.start(T,0);let E=0;await c(w,async({datapoints:t,title:n})=>{t&&await l(t,async t=>{let i=t.fields?t.fields.map(({key:e,description:t,categories:n,purposes:r,attributes:i,...a})=>({name:e,description:t,categories:n?n.map(e=>({...e,name:e.name||`Other`})):void 0,purposes:r?r.map(e=>({...e,name:e.name||`Other`})):void 0,attributes:i,accessRequestVisibilityEnabled:a[`access-request-visibility-enabled`],erasureRequestRedactionEnabled:a[`erasure-request-redaction-enabled`]})):void 0,a={dataSiloId:v[n].id,path:t.path,name:t.key,title:t.title,description:t.description,...t.owners?{ownerEmails:t.owners}:{},...t.teams?{teamNames:t.teams}:{},...t[`data-collection-tag`]?{dataCollectionTag:t[`data-collection-tag`]}:{},querySuggestions:t[`privacy-action-queries`]?Object.entries(t[`privacy-action-queries`]).map(([e,t])=>({requestType:e,suggestedQuery:t})):void 0,enabledActions:t[`privacy-actions`]||[],subDataPoints:i},o=(a.subDataPoints||[]).map(({name:e})=>e),c=o.filter((e,t)=>o.indexOf(e)!==t);if(c.length>0)e.info(s.red(`\nCannot update datapoint "${t.key}" as it has duplicate sub-datapoints with the same name: \n${c.join(`
2
+ `)}`)),g=!0;else try{await C(r,m,{variables:a,logger:e})}catch(r){e.info(s.red(`\nFailed to update datapoint "${t.key}" for data silo "${n}"! - \n${r.message}`)),g=!0}E+=1,S.update(E)})},{concurrency:10}),S.stop();let D=new Date().getTime()-_;return e.info(s.green(`Synced "${t.length}" data silos and "${T}" datapoints in "${D/1e3}" seconds!`)),{success:!g,dataSiloTitleToId:u(v,({id:e})=>e)}}async function M(n,r,{pageSize:i=50,publishToPrivacyCenter:a=!0,classifyService:o=!1,deleteExtraAttributeValues:l=!1,logger:u,warnings:d=[]}){let f=t(n),p=u??e,m=[],h=!1,g=(e,t,n)=>{m.push({resource:e,item:n,message:t}),h=!0};p.info(s.magenta(`Fetching data with page size ${i}...`));let{templates:y,attributes:C,actions:O,identifiers:k,"data-subjects":M,"business-entities":N,preflights:P,cookies:F,"consent-manager":I,"data-silos":L,"data-flows":R,vendors:z,"data-categories":B,"processing-activities":V,"processing-purposes":H,"action-items":U,"action-item-collections":W,teams:G,"privacy-center":K,messages:q,policies:J,partitions:Y,"preference-workflow-configs":Te,"workflow-configs":Ee}=f,De=f[`preference-options`],X=f.purposes,Oe=Ce(f);if(Oe.length>0){for(let e of Oe)g(`preference-slugs`,e);return{success:!1,errors:m,warnings:d.length>0?d:void 0}}let[Z,Q,ke]=await Promise.all([P||k?S(r,{input:f,skipPublish:!a,logger:e}):{},L||M||P||V?A(f,r):{},L&&L.map(e=>e[`api-key-title`]||[]).reduce((e,t)=>e+t.length,0)>0?x(r,{apiKeyInputs:f,logger:e}):{}]);if(Te?.length&&(await ne(r,Te,{logger:p,pageSize:i})||g(`preference-workflow-configs`,`Failed to sync preference workflow configs`)),Ee?.length&&(await Se(r,Ee,{logger:p})||g(`workflow-configs`,`Failed to sync workflow configs`)),De?.length&&(await pe(r,De,{logger:p})||g(`preference-options`,`Failed to sync preference option values`)),X?.length){let{success:e,purposeIdByTrackingType:t}=await ve(r,X,{logger:p});e||g(`purposes`,`Failed to sync one or more purposes`);let n=X.flatMap(e=>(e[`preference-topics`]??[]).map(t=>({...t,"tracking-type":e.trackingType})));n.length>0&&(await me(r,n,{logger:p,purposeIdByTrackingType:t})||g(`preference-topics`,`Failed to sync one or more preference topics`))}if(I){p.info(s.magenta(`Syncing consent manager...`));try{await te(r,I,{logger:p}),p.info(s.green(`Successfully synced consent manager!`))}catch(e){g(`consent-manager`,e.message),p.error(s.red(`Failed to sync consent manager! - ${e.message}`))}}if(G){let t=await ye(r,G,{logger:e});h||=!t}if(y&&(e.info(s.magenta(`Syncing "${y.length}" email templates...`)),await c(y,async t=>{e.info(s.magenta(`Syncing template "${t.title}"...`));try{await be(r,t,{logger:e}),e.info(s.green(`Successfully synced template "${t.title}"!`))}catch(n){h=!0,e.error(s.red(`Failed to sync template "${t.title}"! - ${n.message}`))}},{concurrency:10}),e.info(s.green(`Synced "${y.length}" email templates!`))),N){let t=await ee(r,N,{logger:e});h||=!t}if(z){let t=await xe(r,z,{logger:e});h||=!t}if(B){let t=await ie(r,B,{logger:e});h||=!t}if(H){let t=await _e(r,H,{logger:e});h||=!t}if(Y){let t=await de(r,Y,{logger:e});h||=!t}if(F){let t=await re(r,F,{logger:e});h||=!t}if(W){let t=await T(r,W,{logger:e});h||=!t}if(C){e.info(s.magenta(`Syncing "${C.length}" attributes...`));let t=await v(r,{logger:e});await c(C,async n=>{let i=t.find(e=>e.name===n.name);e.info(s.magenta(`Syncing attribute "${n.name}"...`));try{await D(r,n,{existingAttribute:i,deleteExtraAttributeValues:l,logger:e}),e.info(s.green(`Successfully synced attribute "${n.name}"!`))}catch(t){h=!0,e.error(s.red(`Failed to sync attribute "${n.name}"! - ${t.message}`))}},{concurrency:10}),e.info(s.green(`Synced "${C.length}" attributes!`))}if(U){let t=await E(r,U,{logger:e});h||=!t}if(P&&(e.info(s.magenta(`Syncing "${P.length}" preflight checks...`)),await c(P,async t=>{e.info(s.magenta(`Syncing preflight check "${t.title}"...`));try{await ce(r,{input:t,identifierByName:Z,dataSubjectsByName:Q,logger:e}),e.info(s.green(`Successfully synced preflight check "${t.title}"!`))}catch(n){h=!0,e.error(s.red(`Failed to sync preflight check "${t.title}"! - ${n.message}`))}},{concurrency:10}),e.info(s.green(`Synced "${P.length}" preflight checks!`))),k&&(e.info(s.magenta(`Syncing "${k.length}" identifiers...`)),await c(k,async t=>{let n=Z[t.name];if(!n)throw Error(`Failed to find identifier with name: ${t.type}. Should have been auto-created by cli.`);e.info(s.magenta(`Syncing identifier "${t.type}"...`));try{await le(r,{input:t,dataSubjectsByName:Q,identifierId:n.id,skipPublish:!a,logger:e}),e.info(s.green(`Successfully synced identifier "${t.type}"!`))}catch(n){h=!0,e.info(s.red(`Failed to sync identifier "${t.type}"! - ${n.message}`))}},{concurrency:10}),e.info(s.green(`Synced "${k.length}" identifiers!`))),O){e.info(s.magenta(`Syncing "${O.length}" actions...`));let t=await _(r,{logger:e});await c(O,async n=>{let i=t.find(e=>e.type===n.type);if(!i)throw Error(`Failed to find action with type: ${n.type}. Should have already existing in the organization.`);e.info(s.magenta(`Syncing action "${n.type}"...`));try{await w(r,{action:n,actionId:i.id,skipPublish:!a},{logger:e}),e.info(s.green(`Successfully synced action "${n.type}"!`))}catch(t){h=!0,e.error(s.red(`Failed to sync action "${n.type}"! - ${t.message}`))}},{concurrency:10}),e.info(s.green(`Synced "${O.length}" actions!`))}if(M){e.info(s.magenta(`Syncing "${M.length}" data subjects...`));let t=await b(r,{logger:e});await c(M,async n=>{let i=t.find(e=>e.type===n.type);if(!i)throw Error(`Failed to find data subject with type: ${n.type}. Should have already existing in the organization.`);e.info(s.magenta(`Syncing data subject "${n.type}"...`));try{await se(r,{input:n,dataSubjectId:i.id,skipPublish:!a,logger:e}),e.info(s.green(`Successfully synced data subject "${n.type}"!`))}catch(t){h=!0;let r=n.supportsAuthorizedAgent!==void 0&&/authorized.agent/i.test(t.message)?` (enable the Authorized Agents feature for this organization before setting "supportsAuthorizedAgent")`:``;e.info(s.red(`Failed to sync data subject "${n.type}"! - ${t.message}${r}`))}},{concurrency:10}),e.info(s.green(`Synced "${M.length}" data subjects!`))}if(R){let t=await ae(r,R,{classifyService:o,logger:e});h||=!t}if(K)try{await he(r,K,{logger:e,skipPublish:!a})||g(`privacy-center`,`Failed to sync privacy center`)}catch(e){g(`privacy-center`,e.message)}if(q){let t=await ue(r,q,{logger:e});h||=!t}if(J){let t=await fe(r,J,{logger:e});h||=!t}let $=[];if(L){let{success:e,dataSiloTitleToId:t}=await j(L,r,{dataSubjectsByName:Q,apiKeysByTitle:ke,pageSize:i});L?.forEach(e=>{let n=e[`deletion-dependencies`];if(n)try{$.push([t[e.title],we(n,e.title)])}catch(t){g(`data-silos`,t.message,e.title),p.error(s.red(t.message))}}),h||=!e}if($.length>0){let t=await oe(r,{input:$,logger:e});h||=!t}if(V){let t=await ge(r,V,{logger:e});h||=!t}return{success:!h,errors:m,warnings:d.length>0?d:void 0}}function N(e,...n){let r=JSON.parse(JSON.stringify(e));return n.forEach(e=>{d(e).forEach(([e,t])=>{r[e]===void 0?r[e]=t:Array.isArray(t)?r[e]=[...r[e],...t]:r[e]=t})}),t(r)}export{A as i,M as n,j as r,N as t};
3
+ //# sourceMappingURL=mergeTranscendInputs-B7WjxYMN.mjs.map