@transcend-io/cli 10.8.0 → 10.10.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 (236) hide show
  1. package/README.md +105 -0
  2. package/dist/{app-D_KGbISv.mjs → app-C5WMPpiF.mjs} +20 -20
  3. package/dist/app-C5WMPpiF.mjs.map +1 -0
  4. package/dist/{approvePrivacyRequests-Dqh2bp9k.mjs → approvePrivacyRequests-DpXfRCtG.mjs} +2 -2
  5. package/dist/{approvePrivacyRequests-Dqh2bp9k.mjs.map → approvePrivacyRequests-DpXfRCtG.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/{buildXdiSyncEndpoint-B0q4_c4K.mjs → buildXdiSyncEndpoint-CpADEY6i.mjs} +2 -2
  10. package/dist/{buildXdiSyncEndpoint-B0q4_c4K.mjs.map → buildXdiSyncEndpoint-CpADEY6i.mjs.map} +1 -1
  11. package/dist/{bulkRestartRequests-majedIhh.mjs → bulkRestartRequests-BUkavWWX.mjs} +2 -2
  12. package/dist/{bulkRestartRequests-majedIhh.mjs.map → bulkRestartRequests-BUkavWWX.mjs.map} +1 -1
  13. package/dist/{bulkRetryEnrichers-CLF2FxTu.mjs → bulkRetryEnrichers-Br27FAbD.mjs} +2 -2
  14. package/dist/{bulkRetryEnrichers-CLF2FxTu.mjs.map → bulkRetryEnrichers-Br27FAbD.mjs.map} +1 -1
  15. package/dist/{cancelPrivacyRequests-6OnBWUm6.mjs → cancelPrivacyRequests-BEUOjF_G.mjs} +2 -2
  16. package/dist/{cancelPrivacyRequests-6OnBWUm6.mjs.map → cancelPrivacyRequests-BEUOjF_G.mjs.map} +1 -1
  17. package/dist/{codecs-Dnq-rEcB.mjs → codecs-BOAm14sp.mjs} +1 -1
  18. package/dist/{codecs-Dnq-rEcB.mjs.map → codecs-BOAm14sp.mjs.map} +1 -1
  19. package/dist/{collectCsvFilesOrExit-CbtyKAzu.mjs → collectCsvFilesOrExit-ChKkrsVz.mjs} +2 -2
  20. package/dist/{collectCsvFilesOrExit-CbtyKAzu.mjs.map → collectCsvFilesOrExit-ChKkrsVz.mjs.map} +1 -1
  21. package/dist/{collectParquetFilesOrExit-BJiAyaQ5.mjs → collectParquetFilesOrExit-4EqbLDaB.mjs} +2 -2
  22. package/dist/{collectParquetFilesOrExit-BJiAyaQ5.mjs.map → collectParquetFilesOrExit-4EqbLDaB.mjs.map} +1 -1
  23. package/dist/command-BZbmwdxB.mjs +9 -0
  24. package/dist/command-BZbmwdxB.mjs.map +1 -0
  25. package/dist/commands/admin/chunk-csv/worker.mjs +1 -1
  26. package/dist/commands/admin/parquet-to-csv/worker.mjs +1 -1
  27. package/dist/{consentManagersToBusinessEntities-BdKDganK.mjs → consentManagersToBusinessEntities-C95GQMxK.mjs} +2 -2
  28. package/dist/{consentManagersToBusinessEntities-BdKDganK.mjs.map → consentManagersToBusinessEntities-C95GQMxK.mjs.map} +1 -1
  29. package/dist/constants-FP8lxFg5.mjs +2 -0
  30. package/dist/{constants-9AglpfjZ.mjs.map → constants-FP8lxFg5.mjs.map} +1 -1
  31. package/dist/{constants-CLxPXlJM.mjs → constants-KYaYveEQ.mjs} +1 -1
  32. package/dist/{constants-CLxPXlJM.mjs.map → constants-KYaYveEQ.mjs.map} +1 -1
  33. package/dist/{constants-BmwXDQu9.mjs → constants-xRJ7Twuw.mjs} +2 -2
  34. package/dist/{constants-BmwXDQu9.mjs.map → constants-xRJ7Twuw.mjs.map} +1 -1
  35. package/dist/{context-bkKpii_t.mjs → context-CdSyuBlf.mjs} +1 -1
  36. package/dist/{context-bkKpii_t.mjs.map → context-CdSyuBlf.mjs.map} +1 -1
  37. package/dist/{createExtraKeyHandler-BxX_-qPT.mjs → createExtraKeyHandler-D-M6PDok.mjs} +2 -2
  38. package/dist/{createExtraKeyHandler-BxX_-qPT.mjs.map → createExtraKeyHandler-D-M6PDok.mjs.map} +1 -1
  39. package/dist/{dataFlowsToDataSilos-Ca2DtTsd.mjs → dataFlowsToDataSilos-Cj60GwT2.mjs} +1 -1
  40. package/dist/{dataFlowsToDataSilos-Ca2DtTsd.mjs.map → dataFlowsToDataSilos-Cj60GwT2.mjs.map} +1 -1
  41. package/dist/{done-input-validation-BcNBxhEs.mjs → done-input-validation-9r-9VL6r.mjs} +1 -1
  42. package/dist/{done-input-validation-BcNBxhEs.mjs.map → done-input-validation-9r-9VL6r.mjs.map} +1 -1
  43. package/dist/{downloadPrivacyRequestFiles-HjCf3aC8.mjs → downloadPrivacyRequestFiles-BY_6MMoZ.mjs} +2 -2
  44. package/dist/{downloadPrivacyRequestFiles-HjCf3aC8.mjs.map → downloadPrivacyRequestFiles-BY_6MMoZ.mjs.map} +1 -1
  45. package/dist/{extractClientError-i-Tw_az7.mjs → extractClientError-ZFI8f5OR.mjs} +1 -1
  46. package/dist/{extractClientError-i-Tw_az7.mjs.map → extractClientError-ZFI8f5OR.mjs.map} +1 -1
  47. package/dist/{fetchAllRequests-CHHdyb4Q.mjs → fetchAllRequests-B2qEAfDh.mjs} +2 -2
  48. package/dist/{fetchAllRequests-CHHdyb4Q.mjs.map → fetchAllRequests-B2qEAfDh.mjs.map} +1 -1
  49. package/dist/{generateCrossAccountApiKeys-CdTYH4qC.mjs → generateCrossAccountApiKeys-BkLSweFo.mjs} +2 -2
  50. package/dist/{generateCrossAccountApiKeys-CdTYH4qC.mjs.map → generateCrossAccountApiKeys-BkLSweFo.mjs.map} +1 -1
  51. package/dist/impl--ee0ekVf.mjs +3 -0
  52. package/dist/impl--ee0ekVf.mjs.map +1 -0
  53. package/dist/{impl-Bq_KOmdY.mjs → impl-B-fy3iVm.mjs} +2 -2
  54. package/dist/{impl-Bq_KOmdY.mjs.map → impl-B-fy3iVm.mjs.map} +1 -1
  55. package/dist/{impl-C08anQRz.mjs → impl-B5bE0lSK.mjs} +2 -2
  56. package/dist/{impl-C08anQRz.mjs.map → impl-B5bE0lSK.mjs.map} +1 -1
  57. package/dist/{impl-CbniR_F7.mjs → impl-B9Q9CnIK.mjs} +2 -2
  58. package/dist/{impl-CbniR_F7.mjs.map → impl-B9Q9CnIK.mjs.map} +1 -1
  59. package/dist/{impl-xtlx25UP.mjs → impl-B9W5P4LM.mjs} +2 -2
  60. package/dist/{impl-xtlx25UP.mjs.map → impl-B9W5P4LM.mjs.map} +1 -1
  61. package/dist/{impl-B1MGTkHY.mjs → impl-BD2Rqu17.mjs} +2 -2
  62. package/dist/{impl-B1MGTkHY.mjs.map → impl-BD2Rqu17.mjs.map} +1 -1
  63. package/dist/{impl-CkJ92AF_.mjs → impl-BJoZpj1a.mjs} +2 -2
  64. package/dist/{impl-CkJ92AF_.mjs.map → impl-BJoZpj1a.mjs.map} +1 -1
  65. package/dist/impl-BM0Ir6_d2.mjs +2 -0
  66. package/dist/{impl-0WZg8_Bg2.mjs.map → impl-BM0Ir6_d2.mjs.map} +1 -1
  67. package/dist/{impl-Xona8YN1.mjs → impl-BaDggdDO.mjs} +2 -2
  68. package/dist/{impl-Xona8YN1.mjs.map → impl-BaDggdDO.mjs.map} +1 -1
  69. package/dist/impl-BcIarr1b.mjs +2 -0
  70. package/dist/{impl-DwjCLPLM.mjs.map → impl-BcIarr1b.mjs.map} +1 -1
  71. package/dist/{impl-DiHeNVFr.mjs → impl-BhFQcH3n.mjs} +2 -2
  72. package/dist/{impl-DiHeNVFr.mjs.map → impl-BhFQcH3n.mjs.map} +1 -1
  73. package/dist/{impl-B-_54MR0.mjs → impl-BvYc_ZAH.mjs} +2 -2
  74. package/dist/{impl-B-_54MR0.mjs.map → impl-BvYc_ZAH.mjs.map} +1 -1
  75. package/dist/{impl-CxJbQgVv.mjs → impl-Bw74_1W6.mjs} +2 -2
  76. package/dist/{impl-CxJbQgVv.mjs.map → impl-Bw74_1W6.mjs.map} +1 -1
  77. package/dist/{impl-BuQwysCL.mjs → impl-C-Ky12n4.mjs} +2 -2
  78. package/dist/{impl-BuQwysCL.mjs.map → impl-C-Ky12n4.mjs.map} +1 -1
  79. package/dist/{impl-CPEzHnwk2.mjs → impl-C7BHhHii2.mjs} +2 -2
  80. package/dist/{impl-CPEzHnwk2.mjs.map → impl-C7BHhHii2.mjs.map} +1 -1
  81. package/dist/impl-C8EH5IWl2.mjs +2 -0
  82. package/dist/{impl-CeF1n_i02.mjs.map → impl-C8EH5IWl2.mjs.map} +1 -1
  83. package/dist/{impl-CTfLJzwA.mjs → impl-CDISKj8u.mjs} +2 -2
  84. package/dist/{impl-CTfLJzwA.mjs.map → impl-CDISKj8u.mjs.map} +1 -1
  85. package/dist/{impl-ny4GTh5k.mjs → impl-CG882Vct.mjs} +2 -2
  86. package/dist/{impl-ny4GTh5k.mjs.map → impl-CG882Vct.mjs.map} +1 -1
  87. package/dist/{impl-BdCC8rpK.mjs → impl-CMAmsDt9.mjs} +2 -2
  88. package/dist/{impl-BdCC8rpK.mjs.map → impl-CMAmsDt9.mjs.map} +1 -1
  89. package/dist/{impl-DV-bbA8-.mjs → impl-CQe-MaZ_.mjs} +2 -2
  90. package/dist/{impl-DV-bbA8-.mjs.map → impl-CQe-MaZ_.mjs.map} +1 -1
  91. package/dist/{impl-OcaxH19u.mjs → impl-CUZkpK1I2.mjs} +2 -2
  92. package/dist/impl-CUZkpK1I2.mjs.map +1 -0
  93. package/dist/{impl-CLznNZ5F.mjs → impl-CVoLLxEQ.mjs} +2 -2
  94. package/dist/{impl-CLznNZ5F.mjs.map → impl-CVoLLxEQ.mjs.map} +1 -1
  95. package/dist/{impl-B0TnAEc-.mjs → impl-CWpfY0TU.mjs} +2 -2
  96. package/dist/{impl-B0TnAEc-.mjs.map → impl-CWpfY0TU.mjs.map} +1 -1
  97. package/dist/{impl-BjCQSRLu.mjs → impl-CZXftWOO.mjs} +2 -2
  98. package/dist/{impl-BjCQSRLu.mjs.map → impl-CZXftWOO.mjs.map} +1 -1
  99. package/dist/{impl-C_Hw0O5q.mjs → impl-C_KFt7Y8.mjs} +2 -2
  100. package/dist/{impl-C_Hw0O5q.mjs.map → impl-C_KFt7Y8.mjs.map} +1 -1
  101. package/dist/{impl-BzH3NMTh2.mjs → impl-CfBhfUVL2.mjs} +2 -2
  102. package/dist/{impl-BzH3NMTh2.mjs.map → impl-CfBhfUVL2.mjs.map} +1 -1
  103. package/dist/{impl-9w-woYiS.mjs → impl-Cn0BtYye.mjs} +2 -2
  104. package/dist/{impl-9w-woYiS.mjs.map → impl-Cn0BtYye.mjs.map} +1 -1
  105. package/dist/impl-D0FfuS4u2.mjs +2 -0
  106. package/dist/impl-D0FfuS4u2.mjs.map +1 -0
  107. package/dist/{impl-9pjmJ_Wo.mjs → impl-D3uvvB70.mjs} +2 -2
  108. package/dist/{impl-9pjmJ_Wo.mjs.map → impl-D3uvvB70.mjs.map} +1 -1
  109. package/dist/impl-D4JiKANv.mjs +2 -0
  110. package/dist/impl-D4JiKANv.mjs.map +1 -0
  111. package/dist/{impl-BjG7d8-s.mjs → impl-D4SNAWH12.mjs} +2 -2
  112. package/dist/impl-D4SNAWH12.mjs.map +1 -0
  113. package/dist/{impl-Cw3_0zqC.mjs → impl-D6J2bsoN.mjs} +2 -2
  114. package/dist/{impl-Cw3_0zqC.mjs.map → impl-D6J2bsoN.mjs.map} +1 -1
  115. package/dist/{impl-BsTZyBo4.mjs → impl-DI3mf99H.mjs} +2 -2
  116. package/dist/{impl-BsTZyBo4.mjs.map → impl-DI3mf99H.mjs.map} +1 -1
  117. package/dist/{impl-BPY0YGuj.mjs → impl-DQdsAf-6.mjs} +2 -2
  118. package/dist/{impl-BPY0YGuj.mjs.map → impl-DQdsAf-6.mjs.map} +1 -1
  119. package/dist/{impl-DdppV2cQ.mjs → impl-DWWx9PXJ.mjs} +2 -2
  120. package/dist/{impl-DdppV2cQ.mjs.map → impl-DWWx9PXJ.mjs.map} +1 -1
  121. package/dist/{impl-D0ox6bF2.mjs → impl-DfxHCJfb.mjs} +2 -2
  122. package/dist/{impl-D0ox6bF2.mjs.map → impl-DfxHCJfb.mjs.map} +1 -1
  123. package/dist/{impl-Dm6ITkBn.mjs → impl-E_iiNVwN.mjs} +2 -2
  124. package/dist/{impl-Dm6ITkBn.mjs.map → impl-E_iiNVwN.mjs.map} +1 -1
  125. package/dist/{impl-CDoq18kF.mjs → impl-GjQ_LTsa.mjs} +2 -2
  126. package/dist/{impl-CDoq18kF.mjs.map → impl-GjQ_LTsa.mjs.map} +1 -1
  127. package/dist/{impl-BKYnyVYM.mjs → impl-IgBneuQ8.mjs} +2 -2
  128. package/dist/{impl-BKYnyVYM.mjs.map → impl-IgBneuQ8.mjs.map} +1 -1
  129. package/dist/{impl-RyGwqEe9.mjs → impl-O5gKrwRH.mjs} +2 -2
  130. package/dist/{impl-RyGwqEe9.mjs.map → impl-O5gKrwRH.mjs.map} +1 -1
  131. package/dist/{impl-DKIBerx4.mjs → impl-P7bPD8V0.mjs} +2 -2
  132. package/dist/{impl-DKIBerx4.mjs.map → impl-P7bPD8V0.mjs.map} +1 -1
  133. package/dist/{impl-DQQ_nI25.mjs → impl-cr6noMmG.mjs} +2 -2
  134. package/dist/{impl-DQQ_nI25.mjs.map → impl-cr6noMmG.mjs.map} +1 -1
  135. package/dist/{impl-VOd609Hk.mjs → impl-g4gvqD93.mjs} +2 -2
  136. package/dist/{impl-VOd609Hk.mjs.map → impl-g4gvqD93.mjs.map} +1 -1
  137. package/dist/{impl-4d-Dff8G.mjs → impl-hE7w_dha.mjs} +2 -2
  138. package/dist/{impl-4d-Dff8G.mjs.map → impl-hE7w_dha.mjs.map} +1 -1
  139. package/dist/{impl-B7jvk8Vm.mjs → impl-lHNw_K3v.mjs} +2 -2
  140. package/dist/{impl-B7jvk8Vm.mjs.map → impl-lHNw_K3v.mjs.map} +1 -1
  141. package/dist/{impl-DH9VwrKd.mjs → impl-mW3c3HNU.mjs} +2 -2
  142. package/dist/{impl-DH9VwrKd.mjs.map → impl-mW3c3HNU.mjs.map} +1 -1
  143. package/dist/{impl-BAjeCiyZ.mjs → impl-mxcFaXMI.mjs} +2 -2
  144. package/dist/{impl-BAjeCiyZ.mjs.map → impl-mxcFaXMI.mjs.map} +1 -1
  145. package/dist/{impl-BhNnDVWM.mjs → impl-u8cmT1tT.mjs} +2 -2
  146. package/dist/{impl-BhNnDVWM.mjs.map → impl-u8cmT1tT.mjs.map} +1 -1
  147. package/dist/impl-xiJwue6x.mjs +2 -0
  148. package/dist/{impl-DWiyVOll.mjs.map → impl-xiJwue6x.mjs.map} +1 -1
  149. package/dist/index.d.mts +9 -9
  150. package/dist/index.mjs +1 -1
  151. package/dist/{inquirer-B4iEodLy.mjs → inquirer-C-TI9k_N.mjs} +2 -2
  152. package/dist/{inquirer-B4iEodLy.mjs.map → inquirer-C-TI9k_N.mjs.map} +1 -1
  153. package/dist/{listFiles-D2wMHnEr.mjs → listFiles-oqwR2oZ4.mjs} +1 -1
  154. package/dist/{listFiles-D2wMHnEr.mjs.map → listFiles-oqwR2oZ4.mjs.map} +1 -1
  155. package/dist/{logger-Bj782ZYD.mjs → logger-B-LXIf3U.mjs} +1 -1
  156. package/dist/{logger-Bj782ZYD.mjs.map → logger-B-LXIf3U.mjs.map} +1 -1
  157. package/dist/{markRequestDataSiloIdsCompleted-BZpcBACY.mjs → markRequestDataSiloIdsCompleted-Cg5Hfs4-.mjs} +2 -2
  158. package/dist/{markRequestDataSiloIdsCompleted-BZpcBACY.mjs.map → markRequestDataSiloIdsCompleted-Cg5Hfs4-.mjs.map} +1 -1
  159. package/dist/{markSilentPrivacyRequests-H4ZJIdtS.mjs → markSilentPrivacyRequests-1spmn5h3.mjs} +2 -2
  160. package/dist/{markSilentPrivacyRequests-H4ZJIdtS.mjs.map → markSilentPrivacyRequests-1spmn5h3.mjs.map} +1 -1
  161. package/dist/{notifyPrivacyRequestsAdditionalTime-Bhy5342F.mjs → notifyPrivacyRequestsAdditionalTime-DIY4ofMV.mjs} +2 -2
  162. package/dist/{notifyPrivacyRequestsAdditionalTime-Bhy5342F.mjs.map → notifyPrivacyRequestsAdditionalTime-DIY4ofMV.mjs.map} +1 -1
  163. package/dist/{parquetToCsvOneFile-B84XXInh.mjs → parquetToCsvOneFile-Bry79xw-.mjs} +2 -2
  164. package/dist/{parquetToCsvOneFile-B84XXInh.mjs.map → parquetToCsvOneFile-Bry79xw-.mjs.map} +1 -1
  165. package/dist/{parseAttributesFromString-q4-59nEN.mjs → parseAttributesFromString-tbxM3lmh.mjs} +2 -2
  166. package/dist/{parseAttributesFromString-q4-59nEN.mjs.map → parseAttributesFromString-tbxM3lmh.mjs.map} +1 -1
  167. package/dist/{parseVariablesFromString-BeKOGw5n.mjs → parseVariablesFromString-C3CPWxqY.mjs} +2 -2
  168. package/dist/{parseVariablesFromString-BeKOGw5n.mjs.map → parseVariablesFromString-C3CPWxqY.mjs.map} +1 -1
  169. package/dist/parsers-Bl90Wjbz.mjs +2 -0
  170. package/dist/parsers-Bl90Wjbz.mjs.map +1 -0
  171. package/dist/{pullAllDatapoints-Bbmky50p.mjs → pullAllDatapoints-49ZSGNFN.mjs} +2 -2
  172. package/dist/{pullAllDatapoints-Bbmky50p.mjs.map → pullAllDatapoints-49ZSGNFN.mjs.map} +1 -1
  173. package/dist/{pullChunkedCustomSiloOutstandingIdentifiers-S1_ffqTu.mjs → pullChunkedCustomSiloOutstandingIdentifiers-Caiw44KV.mjs} +2 -2
  174. package/dist/{pullChunkedCustomSiloOutstandingIdentifiers-S1_ffqTu.mjs.map → pullChunkedCustomSiloOutstandingIdentifiers-Caiw44KV.mjs.map} +1 -1
  175. package/dist/{pullConsentManagerMetrics-zKgjc3Ap.mjs → pullConsentManagerMetrics-CcBfEEzz.mjs} +2 -2
  176. package/dist/{pullConsentManagerMetrics-zKgjc3Ap.mjs.map → pullConsentManagerMetrics-CcBfEEzz.mjs.map} +1 -1
  177. package/dist/{pullManualEnrichmentIdentifiersToCsv-DBK6XImP.mjs → pullManualEnrichmentIdentifiersToCsv-Et8K20SJ.mjs} +2 -2
  178. package/dist/{pullManualEnrichmentIdentifiersToCsv-DBK6XImP.mjs.map → pullManualEnrichmentIdentifiersToCsv-Et8K20SJ.mjs.map} +1 -1
  179. package/dist/{pullTranscendConfiguration-BHP6t_Nq.mjs → pullTranscendConfiguration-ChFN8Wp4.mjs} +2 -2
  180. package/dist/{pullTranscendConfiguration-BHP6t_Nq.mjs.map → pullTranscendConfiguration-ChFN8Wp4.mjs.map} +1 -1
  181. package/dist/{pullUnstructuredSubDataPointRecommendations-D0z-vPgq.mjs → pullUnstructuredSubDataPointRecommendations-C8VuWR7j.mjs} +2 -2
  182. package/dist/{pullUnstructuredSubDataPointRecommendations-D0z-vPgq.mjs.map → pullUnstructuredSubDataPointRecommendations-C8VuWR7j.mjs.map} +1 -1
  183. package/dist/{pushCronIdentifiersFromCsv-CE3_S3pT.mjs → pushCronIdentifiersFromCsv-DqOtCwY5.mjs} +2 -2
  184. package/dist/{pushCronIdentifiersFromCsv-CE3_S3pT.mjs.map → pushCronIdentifiersFromCsv-DqOtCwY5.mjs.map} +1 -1
  185. package/dist/{pushManualEnrichmentIdentifiersFromCsv-Cw6K-4Am.mjs → pushManualEnrichmentIdentifiersFromCsv-LWKOrJTN.mjs} +2 -2
  186. package/dist/{pushManualEnrichmentIdentifiersFromCsv-Cw6K-4Am.mjs.map → pushManualEnrichmentIdentifiersFromCsv-LWKOrJTN.mjs.map} +1 -1
  187. package/dist/{readCsv-C4TyEs-r.mjs → readCsv-C-5HBa7w.mjs} +1 -1
  188. package/dist/{readCsv-C4TyEs-r.mjs.map → readCsv-C-5HBa7w.mjs.map} +1 -1
  189. package/dist/{readTranscendYaml-CGb2UUyM.mjs → readTranscendYaml-DnvxeV7w.mjs} +2 -2
  190. package/dist/{readTranscendYaml-CGb2UUyM.mjs.map → readTranscendYaml-DnvxeV7w.mjs.map} +1 -1
  191. package/dist/{removeUnverifiedRequestIdentifiers-DP-R33id.mjs → removeUnverifiedRequestIdentifiers-C8aAV99N.mjs} +2 -2
  192. package/dist/{removeUnverifiedRequestIdentifiers-DP-R33id.mjs.map → removeUnverifiedRequestIdentifiers-C8aAV99N.mjs.map} +1 -1
  193. package/dist/{request-DfkRPQFr.mjs → request-CikRkOJR.mjs} +1 -1
  194. package/dist/{request-DfkRPQFr.mjs.map → request-CikRkOJR.mjs.map} +1 -1
  195. package/dist/resolveBundleIdByName-C6GQuO2d.mjs +3 -0
  196. package/dist/resolveBundleIdByName-C6GQuO2d.mjs.map +1 -0
  197. package/dist/{retryRequestDataSilos-B8Z4TeWR.mjs → retryRequestDataSilos-CYvolpVQ.mjs} +2 -2
  198. package/dist/{retryRequestDataSilos-B8Z4TeWR.mjs.map → retryRequestDataSilos-CYvolpVQ.mjs.map} +1 -1
  199. package/dist/runOpa-Cbh5ktOh.mjs +2 -0
  200. package/dist/{runOpa-CR5t23wR.mjs.map → runOpa-Cbh5ktOh.mjs.map} +1 -1
  201. package/dist/{skipPreflightJobs-Cec25u-P.mjs → skipPreflightJobs-CsAbVlmo.mjs} +2 -2
  202. package/dist/{skipPreflightJobs-Cec25u-P.mjs.map → skipPreflightJobs-CsAbVlmo.mjs.map} +1 -1
  203. package/dist/{skipRequestDataSilos-CYrHW6uN.mjs → skipRequestDataSilos-BAO67gHg.mjs} +2 -2
  204. package/dist/{skipRequestDataSilos-CYrHW6uN.mjs.map → skipRequestDataSilos-BAO67gHg.mjs.map} +1 -1
  205. package/dist/{streamPrivacyRequestsToCsv-BROB0xWG.mjs → streamPrivacyRequestsToCsv-B2yq8AGa.mjs} +2 -2
  206. package/dist/{streamPrivacyRequestsToCsv-BROB0xWG.mjs.map → streamPrivacyRequestsToCsv-B2yq8AGa.mjs.map} +1 -1
  207. package/dist/{syncCodePackages-CAk_Hjyl.mjs → syncCodePackages-Du1OqJvL.mjs} +2 -2
  208. package/dist/{syncCodePackages-CAk_Hjyl.mjs.map → syncCodePackages-Du1OqJvL.mjs.map} +1 -1
  209. package/dist/{updateConsentManagerVersionToLatest-DI5ODyxN.mjs → updateConsentManagerVersionToLatest-Dd0GfGAj.mjs} +2 -2
  210. package/dist/{updateConsentManagerVersionToLatest-DI5ODyxN.mjs.map → updateConsentManagerVersionToLatest-Dd0GfGAj.mjs.map} +1 -1
  211. package/dist/{uploadConsents-CYNe_Q5q.mjs → uploadConsents-DgkSQj5-.mjs} +2 -2
  212. package/dist/{uploadConsents-CYNe_Q5q.mjs.map → uploadConsents-DgkSQj5-.mjs.map} +1 -1
  213. package/dist/{uploadCookiesFromCsv-Bhw5tHNp.mjs → uploadCookiesFromCsv-C2lTYrbc.mjs} +2 -2
  214. package/dist/{uploadCookiesFromCsv-Bhw5tHNp.mjs.map → uploadCookiesFromCsv-C2lTYrbc.mjs.map} +1 -1
  215. package/dist/{uploadDataFlowsFromCsv-pm5uNPQL.mjs → uploadDataFlowsFromCsv-BkrAh4SY.mjs} +2 -2
  216. package/dist/{uploadDataFlowsFromCsv-pm5uNPQL.mjs.map → uploadDataFlowsFromCsv-BkrAh4SY.mjs.map} +1 -1
  217. package/dist/{uploadPrivacyRequestsFromCsv-CMjkF04D.mjs → uploadPrivacyRequestsFromCsv-i46OEhw-.mjs} +2 -2
  218. package/dist/{uploadPrivacyRequestsFromCsv-CMjkF04D.mjs.map → uploadPrivacyRequestsFromCsv-i46OEhw-.mjs.map} +1 -1
  219. package/dist/{validateTranscendAuth-DJ8qHb9B.mjs → validateTranscendAuth-RgQkJacW.mjs} +2 -2
  220. package/dist/{validateTranscendAuth-DJ8qHb9B.mjs.map → validateTranscendAuth-RgQkJacW.mjs.map} +1 -1
  221. package/dist/{writeCsv-C4pjXGsD.mjs → writeCsv-CbT4a0uj.mjs} +1 -1
  222. package/dist/{writeCsv-C4pjXGsD.mjs.map → writeCsv-CbT4a0uj.mjs.map} +1 -1
  223. package/package.json +2 -2
  224. package/dist/app-D_KGbISv.mjs.map +0 -1
  225. package/dist/command-BgjBWI6m.mjs +0 -9
  226. package/dist/command-BgjBWI6m.mjs.map +0 -1
  227. package/dist/constants-9AglpfjZ.mjs +0 -2
  228. package/dist/impl-0WZg8_Bg2.mjs +0 -2
  229. package/dist/impl-BIhPJDO-.mjs +0 -2
  230. package/dist/impl-BIhPJDO-.mjs.map +0 -1
  231. package/dist/impl-BjG7d8-s.mjs.map +0 -1
  232. package/dist/impl-CeF1n_i02.mjs +0 -2
  233. package/dist/impl-DWiyVOll.mjs +0 -2
  234. package/dist/impl-DwjCLPLM.mjs +0 -2
  235. package/dist/impl-OcaxH19u.mjs.map +0 -1
  236. package/dist/runOpa-CR5t23wR.mjs +0 -2
@@ -0,0 +1,2 @@
1
+ import{t as e}from"./logger-B-LXIf3U.mjs";import{t}from"./done-input-validation-9r-9VL6r.mjs";import{i as n,n as r,r as i,t as a}from"./runOpa-Cbh5ktOh.mjs";import{i as o,n as s,r as c,t as l}from"./resolveBundleIdByName-C6GQuO2d.mjs";import u from"node:fs";import d from"node:os";import f from"node:path";import p from"colors";import{spawnSync as m}from"node:child_process";async function h(e){r();let t=f.resolve(e);if(!u.existsSync(t)||!u.statSync(t).isDirectory())throw Error(`Policy directory does not exist or is not a directory: ${t}`);let o=f.join(d.tmpdir(),`transcend-policy-bundle-${Date.now()}-${Math.random().toString(36).slice(2)}.tar.gz`),s=await a([`build`,`-b`,t,`-o`,o]);if(s!==0)throw Error(`opa build failed with exit code ${s}`);let c=u.statSync(o).size;if(c>5120)throw u.unlinkSync(o),Error(`Policy bundle exceeds the ${i} byte compressed upload limit (${c} bytes). The server also rejects decompressed bundles larger than ${n} bytes.`);return o}function g(e){let t=u.readFileSync(e.bundlePath),n=new FormData;return n.append(`bundle`,new Blob([t],{type:`application/gzip`}),f.basename(e.bundlePath)),n.append(`version`,e.version),e.description&&n.append(`description`,e.description),e.bundleName&&n.append(`bundleName`,e.bundleName),n}function _(e=process.cwd()){let t=m(`git`,[`rev-parse`,`--short`,`HEAD`],{cwd:e,encoding:`utf8`});if(t.status===0){let e=t.stdout.trim();if(e)return e}return new Date().toISOString().replace(/[:.]/g,`-`)}async function v({dir:n,bundleName:r,auth:i,transcendUrl:a,version:d,description:m,json:v}){t(this.process.exit);let y=f.resolve(n),b=d??_(y),x=o(a,i),S;try{e.info(p.green(`Building policy bundle from ${y}...`)),S=await h(y);let t=await l(x,r),n;if(t){e.info(p.green(`Uploading new version for bundle "${r}"...`));let i=g({bundlePath:S,version:b,description:m});n=await x.post(`v1/policy-engine/policy-bundles/${t}/versions`,{body:i}).json()}else{e.info(p.green(`Creating bundle "${r}" and uploading first version...`));let t=g({bundlePath:S,version:b,description:m,bundleName:r});n=await x.post(`v1/policy-engine/policy-bundles`,{body:t}).json()}s(this.process.stdout,{json:v,data:n,renderTable:()=>c(n.version)}),e.info(p.green(`Policy bundle version uploaded successfully.`))}finally{S&&u.existsSync(S)&&u.unlinkSync(S)}}export{v as publish};
2
+ //# sourceMappingURL=impl-D4JiKANv.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"impl-D4JiKANv.mjs","names":[],"sources":["../src/commands/policy/helpers/buildOpaBundleTarball.ts","../src/commands/policy/helpers/buildPolicyBundleFormData.ts","../src/commands/policy/helpers/defaultPolicyVersionLabel.ts","../src/commands/policy/publish/impl.ts"],"sourcesContent":["import fs from 'node:fs';\nimport os from 'node:os';\nimport path from 'node:path';\n\nimport { MAX_BUNDLE_COMPRESSED_BYTES, MAX_BUNDLE_DECOMPRESSED_BYTES } from '../constants.js';\nimport { assertOpaInstalled } from './assertOpaInstalled.js';\nimport { runOpa } from './runOpa.js';\n\n/**\n * Builds an OPA bundle tarball from a local policy directory.\n *\n * @param dir - Directory containing `.rego` files and optional `data.json`\n * @returns Absolute path to the generated `.tar.gz` bundle\n */\nexport async function buildOpaBundleTarball(dir: string): Promise<string> {\n assertOpaInstalled();\n\n const resolvedDir = path.resolve(dir);\n if (!fs.existsSync(resolvedDir) || !fs.statSync(resolvedDir).isDirectory()) {\n throw new Error(`Policy directory does not exist or is not a directory: ${resolvedDir}`);\n }\n\n const outputPath = path.join(\n os.tmpdir(),\n `transcend-policy-bundle-${Date.now()}-${Math.random().toString(36).slice(2)}.tar.gz`,\n );\n\n const exitCode = await runOpa(['build', '-b', resolvedDir, '-o', outputPath]);\n if (exitCode !== 0) {\n throw new Error(`opa build failed with exit code ${exitCode}`);\n }\n\n const size = fs.statSync(outputPath).size;\n if (size > MAX_BUNDLE_COMPRESSED_BYTES) {\n fs.unlinkSync(outputPath);\n throw new Error(\n `Policy bundle exceeds the ${MAX_BUNDLE_COMPRESSED_BYTES} byte compressed upload limit (${size} bytes). ` +\n `The server also rejects decompressed bundles larger than ${MAX_BUNDLE_DECOMPRESSED_BYTES} bytes.`,\n );\n }\n\n return outputPath;\n}\n","import fs from 'node:fs';\nimport path from 'node:path';\n\n/** Fields for building a policy bundle upload form. */\nexport interface BuildPolicyBundleFormDataOptions {\n /** Absolute path to the bundle tarball */\n bundlePath: string;\n /** Version label */\n version: string;\n /** Optional description */\n description?: string;\n /** Bundle name (only for create) */\n bundleName?: string;\n}\n\n/**\n * Builds multipart form data for a policy bundle upload.\n *\n * @param options - Upload fields\n * @returns FormData ready for POST\n */\nexport function buildPolicyBundleFormData(options: BuildPolicyBundleFormDataOptions): FormData {\n const bundleBytes = fs.readFileSync(options.bundlePath);\n const form = new FormData();\n form.append(\n 'bundle',\n new Blob([bundleBytes], { type: 'application/gzip' }),\n path.basename(options.bundlePath),\n );\n form.append('version', options.version);\n if (options.description) {\n form.append('description', options.description);\n }\n if (options.bundleName) {\n form.append('bundleName', options.bundleName);\n }\n return form;\n}\n","import { spawnSync } from 'node:child_process';\n\n/**\n * Returns a default version label from git SHA or a timestamp fallback.\n *\n * @param cwd - Working directory for git lookup\n * @returns Version label\n */\nexport function defaultPolicyVersionLabel(cwd = process.cwd()): string {\n const result = spawnSync('git', ['rev-parse', '--short', 'HEAD'], {\n cwd,\n encoding: 'utf8',\n });\n if (result.status === 0) {\n const sha = result.stdout.trim();\n if (sha) {\n return sha;\n }\n }\n\n return new Date().toISOString().replace(/[:.]/g, '-');\n}\n","import fs from 'node:fs';\nimport path from 'node:path';\n\nimport colors from 'colors';\n\nimport type { LocalContext } from '../../../context.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { logger } from '../../../logger.js';\nimport {\n buildPolicyBundleFormData,\n buildPolicyEngineClient,\n buildOpaBundleTarball,\n defaultPolicyVersionLabel,\n formatPolicyBundleVersionSummary,\n printResult,\n resolveBundleIdByName,\n} from '../helpers/index.js';\nimport type { CreatePolicyBundleResponse, CreatePolicyBundleVersionResponse } from '../types.js';\n\n/** CLI flags for `transcend policy publish`. */\nexport interface PublishCommandFlags {\n /** Directory containing Rego policy files */\n dir: string;\n /** Tenant-unique bundle name */\n bundleName: string;\n /** Transcend API key */\n auth: string;\n /** Transcend API URL */\n transcendUrl: string;\n /** Version label (defaults to git SHA or timestamp) */\n version?: string;\n /** Optional version description */\n description?: string;\n /** Print raw JSON response */\n json: boolean;\n}\n\n/**\n * Build and upload a new immutable policy bundle version.\n *\n * @param this - CLI context\n * @param flags - Command flags\n */\nexport async function publish(\n this: LocalContext,\n { dir, bundleName, auth, transcendUrl, version, description, json }: PublishCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n const resolvedDir = path.resolve(dir);\n const versionLabel = version ?? defaultPolicyVersionLabel(resolvedDir);\n const client = buildPolicyEngineClient(transcendUrl, auth);\n\n let bundlePath: string | undefined;\n try {\n logger.info(colors.green(`Building policy bundle from ${resolvedDir}...`));\n bundlePath = await buildOpaBundleTarball(resolvedDir);\n\n const existingBundleId = await resolveBundleIdByName(client, bundleName);\n\n let responseBody: CreatePolicyBundleResponse | CreatePolicyBundleVersionResponse;\n\n if (existingBundleId) {\n logger.info(colors.green(`Uploading new version for bundle \"${bundleName}\"...`));\n const form = buildPolicyBundleFormData({\n bundlePath,\n version: versionLabel,\n description,\n });\n responseBody = await client\n .post(`v1/policy-engine/policy-bundles/${existingBundleId}/versions`, { body: form })\n .json<CreatePolicyBundleVersionResponse>();\n } else {\n logger.info(colors.green(`Creating bundle \"${bundleName}\" and uploading first version...`));\n const createForm = buildPolicyBundleFormData({\n bundlePath,\n version: versionLabel,\n description,\n bundleName,\n });\n responseBody = await client\n .post('v1/policy-engine/policy-bundles', {\n body: createForm,\n })\n .json<CreatePolicyBundleResponse>();\n }\n\n printResult(this.process.stdout, {\n json,\n data: responseBody,\n renderTable: () => formatPolicyBundleVersionSummary(responseBody.version),\n });\n\n logger.info(colors.green('Policy bundle version uploaded successfully.'));\n } finally {\n if (bundlePath && fs.existsSync(bundlePath)) {\n fs.unlinkSync(bundlePath);\n }\n }\n}\n"],"mappings":"uXAcA,eAAsB,EAAsB,EAA8B,CACxE,GAAoB,CAEpB,IAAM,EAAc,EAAK,QAAQ,EAAI,CACrC,GAAI,CAAC,EAAG,WAAW,EAAY,EAAI,CAAC,EAAG,SAAS,EAAY,CAAC,aAAa,CACxE,MAAU,MAAM,0DAA0D,IAAc,CAG1F,IAAM,EAAa,EAAK,KACtB,EAAG,QAAQ,CACX,2BAA2B,KAAK,KAAK,CAAC,GAAG,KAAK,QAAQ,CAAC,SAAS,GAAG,CAAC,MAAM,EAAE,CAAC,SAC9E,CAEK,EAAW,MAAM,EAAO,CAAC,QAAS,KAAM,EAAa,KAAM,EAAW,CAAC,CAC7E,GAAI,IAAa,EACf,MAAU,MAAM,mCAAmC,IAAW,CAGhE,IAAM,EAAO,EAAG,SAAS,EAAW,CAAC,KACrC,GAAI,EAAA,KAEF,MADA,EAAG,WAAW,EAAW,CACf,MACR,6BAA6B,EAA4B,iCAAiC,EAAK,oEACjC,EAA8B,SAC7F,CAGH,OAAO,ECpBT,SAAgB,EAA0B,EAAqD,CAC7F,IAAM,EAAc,EAAG,aAAa,EAAQ,WAAW,CACjD,EAAO,IAAI,SAajB,OAZA,EAAK,OACH,SACA,IAAI,KAAK,CAAC,EAAY,CAAE,CAAE,KAAM,mBAAoB,CAAC,CACrD,EAAK,SAAS,EAAQ,WAAW,CAClC,CACD,EAAK,OAAO,UAAW,EAAQ,QAAQ,CACnC,EAAQ,aACV,EAAK,OAAO,cAAe,EAAQ,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C,CAEF,EAAO,KAAK,EAAO,MAAM,+CAA+C,CAAC,QACjE,CACJ,GAAc,EAAG,WAAW,EAAW,EACzC,EAAG,WAAW,EAAW"}
@@ -1,2 +1,2 @@
1
- import{t as e}from"./removeUnverifiedRequestIdentifiers-DP-R33id.mjs";import{t}from"./done-input-validation-BcNBxhEs.mjs";async function n({auth:n,transcendUrl:r,identifierNames:i,actions:a=[]}){t(this.process.exit),await e({requestActions:a,transcendUrl:r,auth:n,identifierNames:i})}export{n as rejectUnverifiedIdentifiers};
2
- //# sourceMappingURL=impl-BjG7d8-s.mjs.map
1
+ import{t as e}from"./removeUnverifiedRequestIdentifiers-C8aAV99N.mjs";import{t}from"./done-input-validation-9r-9VL6r.mjs";async function n({auth:n,transcendUrl:r,identifierNames:i,actions:a=[]}){t(this.process.exit),await e({requestActions:a,transcendUrl:r,auth:n,identifierNames:i})}export{n as rejectUnverifiedIdentifiers};
2
+ //# sourceMappingURL=impl-D4SNAWH12.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"impl-D4SNAWH12.mjs","names":[],"sources":["../src/commands/request/reject-unverified-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 { removeUnverifiedRequestIdentifiers } from '../../../lib/requests/index.js';\n\nexport interface RejectUnverifiedIdentifiersCommandFlags {\n auth: string;\n identifierNames: string[];\n actions?: RequestAction[];\n transcendUrl: string;\n}\n\nexport async function rejectUnverifiedIdentifiers(\n this: LocalContext,\n { auth, transcendUrl, identifierNames, actions = [] }: RejectUnverifiedIdentifiersCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n await removeUnverifiedRequestIdentifiers({\n requestActions: actions,\n transcendUrl,\n auth,\n identifierNames,\n });\n}\n"],"mappings":"0HAaA,eAAsB,EAEpB,CAAE,OAAM,eAAc,kBAAiB,UAAU,EAAE,EACpC,CACf,EAAoB,KAAK,QAAQ,KAAK,CAEtC,MAAM,EAAmC,CACvC,eAAgB,EAChB,eACA,OACA,kBACD,CAAC"}
@@ -1,2 +1,2 @@
1
- import{t as e}from"./logger-Bj782ZYD.mjs";import{t}from"./pullUnstructuredSubDataPointRecommendations-D0z-vPgq.mjs";import{s as n}from"./writeCsv-C4pjXGsD.mjs";import{t as r}from"./done-input-validation-BcNBxhEs.mjs";import{uniq as i}from"lodash-es";import a from"colors";import{buildTranscendGraphQLClient as o}from"@transcend-io/sdk";async function s({auth:s,file:c,transcendUrl:l,dataSiloIds:u,subCategories:d,status:f,includeEncryptedSnippets:p}){r(this.process.exit);try{let r=await t(o(l,s),{dataSiloIds:u,subCategories:d,status:f,includeEncryptedSnippets:p});e.info(a.magenta(`Writing unstructured discovery files to file "${c}"...`));let m=[];await n(c,r.map(e=>{let t={"Entry ID":e.id,"Data Silo ID":e.dataSiloId,"Object Path ID":e.scannedObjectPathId,"Object ID":e.scannedObjectId,...p?{Entry:e.name,"Context Snippet":e.contextSnippet}:{},"Data Category":`${e.dataSubCategory.category}:${e.dataSubCategory.name}`,"Classification Status":e.status,"Confidence Score":e.confidence,"Classification Method":e.classificationMethod,"Classifier Version":e.classifierVersion};return m=i([...m,...Object.keys(t)]),t}),m)}catch(t){e.error(a.red(`An error occurred syncing the unstructured discovery files: ${t.message}`)),this.process.exit(1)}e.info(a.green(`Successfully synced unstructured discovery files to disk at ${c}!`))}export{s as pullUnstructuredDiscoveryFiles};
2
- //# sourceMappingURL=impl-Cw3_0zqC.mjs.map
1
+ import{t as e}from"./logger-B-LXIf3U.mjs";import{t}from"./pullUnstructuredSubDataPointRecommendations-C8VuWR7j.mjs";import{s as n}from"./writeCsv-CbT4a0uj.mjs";import{t as r}from"./done-input-validation-9r-9VL6r.mjs";import{uniq as i}from"lodash-es";import a from"colors";import{buildTranscendGraphQLClient as o}from"@transcend-io/sdk";async function s({auth:s,file:c,transcendUrl:l,dataSiloIds:u,subCategories:d,status:f,includeEncryptedSnippets:p}){r(this.process.exit);try{let r=await t(o(l,s),{dataSiloIds:u,subCategories:d,status:f,includeEncryptedSnippets:p});e.info(a.magenta(`Writing unstructured discovery files to file "${c}"...`));let m=[];await n(c,r.map(e=>{let t={"Entry ID":e.id,"Data Silo ID":e.dataSiloId,"Object Path ID":e.scannedObjectPathId,"Object ID":e.scannedObjectId,...p?{Entry:e.name,"Context Snippet":e.contextSnippet}:{},"Data Category":`${e.dataSubCategory.category}:${e.dataSubCategory.name}`,"Classification Status":e.status,"Confidence Score":e.confidence,"Classification Method":e.classificationMethod,"Classifier Version":e.classifierVersion};return m=i([...m,...Object.keys(t)]),t}),m)}catch(t){e.error(a.red(`An error occurred syncing the unstructured discovery files: ${t.message}`)),this.process.exit(1)}e.info(a.green(`Successfully synced unstructured discovery files to disk at ${c}!`))}export{s as pullUnstructuredDiscoveryFiles};
2
+ //# sourceMappingURL=impl-D6J2bsoN.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"impl-Cw3_0zqC.mjs","names":[],"sources":["../src/commands/inventory/pull-unstructured-discovery-files/impl.ts"],"sourcesContent":["import type { UnstructuredSubDataPointRecommendationStatus } from '@transcend-io/privacy-types';\nimport { buildTranscendGraphQLClient } from '@transcend-io/sdk';\nimport colors from 'colors';\nimport { uniq } from 'lodash-es';\n\nimport type { LocalContext } from '../../../context.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { pullUnstructuredSubDataPointRecommendations } from '../../../lib/data-inventory/index.js';\nimport { writeLargeCsv } from '../../../lib/helpers/index.js';\nimport { logger } from '../../../logger.js';\n\nexport interface PullUnstructuredDiscoveryFilesCommandFlags {\n auth: string;\n file: string;\n transcendUrl: string;\n dataSiloIds?: string[];\n subCategories?: string[];\n status?: UnstructuredSubDataPointRecommendationStatus[];\n includeEncryptedSnippets: boolean;\n}\n\nexport async function pullUnstructuredDiscoveryFiles(\n this: LocalContext,\n {\n auth,\n file,\n transcendUrl,\n dataSiloIds,\n subCategories,\n status,\n includeEncryptedSnippets,\n }: PullUnstructuredDiscoveryFilesCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n try {\n // Create a GraphQL client\n const client = buildTranscendGraphQLClient(transcendUrl, auth);\n\n const entries = await pullUnstructuredSubDataPointRecommendations(client, {\n dataSiloIds,\n subCategories, // TODO: https://transcend.height.app/T-40482 - do by name not ID\n status,\n includeEncryptedSnippets,\n });\n\n logger.info(colors.magenta(`Writing unstructured discovery files to file \"${file}\"...`));\n let headers: string[] = [];\n const inputs = entries.map((entry) => {\n const result = {\n 'Entry ID': entry.id,\n 'Data Silo ID': entry.dataSiloId,\n 'Object Path ID': entry.scannedObjectPathId,\n 'Object ID': entry.scannedObjectId,\n ...(includeEncryptedSnippets\n ? { Entry: entry.name, 'Context Snippet': entry.contextSnippet }\n : {}),\n 'Data Category': `${entry.dataSubCategory.category}:${entry.dataSubCategory.name}`,\n 'Classification Status': entry.status,\n 'Confidence Score': entry.confidence,\n 'Classification Method': entry.classificationMethod,\n 'Classifier Version': entry.classifierVersion,\n };\n headers = uniq([...headers, ...Object.keys(result)]);\n return result;\n });\n await writeLargeCsv(file, inputs, headers);\n } catch (err) {\n logger.error(\n colors.red(`An error occurred syncing the unstructured discovery files: ${err.message}`),\n );\n this.process.exit(1);\n }\n\n // Indicate success\n logger.info(colors.green(`Successfully synced unstructured discovery files to disk at ${file}!`));\n}\n"],"mappings":"gVAqBA,eAAsB,EAEpB,CACE,OACA,OACA,eACA,cACA,gBACA,SACA,4BAEa,CACf,EAAoB,KAAK,QAAQ,KAAK,CAEtC,GAAI,CAIF,IAAM,EAAU,MAAM,EAFP,EAA4B,EAAc,EAEe,CAAE,CACxE,cACA,gBACA,SACA,2BACD,CAAC,CAEF,EAAO,KAAK,EAAO,QAAQ,iDAAiD,EAAK,MAAM,CAAC,CACxF,IAAI,EAAoB,EAAE,CAmB1B,MAAM,EAAc,EAlBL,EAAQ,IAAK,GAAU,CACpC,IAAM,EAAS,CACb,WAAY,EAAM,GAClB,eAAgB,EAAM,WACtB,iBAAkB,EAAM,oBACxB,YAAa,EAAM,gBACnB,GAAI,EACA,CAAE,MAAO,EAAM,KAAM,kBAAmB,EAAM,eAAgB,CAC9D,EAAE,CACN,gBAAiB,GAAG,EAAM,gBAAgB,SAAS,GAAG,EAAM,gBAAgB,OAC5E,wBAAyB,EAAM,OAC/B,mBAAoB,EAAM,WAC1B,wBAAyB,EAAM,qBAC/B,qBAAsB,EAAM,kBAC7B,CAED,MADA,GAAU,EAAK,CAAC,GAAG,EAAS,GAAG,OAAO,KAAK,EAAO,CAAC,CAAC,CAC7C,GAEuB,CAAE,EAAQ,OACnC,EAAK,CACZ,EAAO,MACL,EAAO,IAAI,+DAA+D,EAAI,UAAU,CACzF,CACD,KAAK,QAAQ,KAAK,EAAE,CAItB,EAAO,KAAK,EAAO,MAAM,+DAA+D,EAAK,GAAG,CAAC"}
1
+ {"version":3,"file":"impl-D6J2bsoN.mjs","names":[],"sources":["../src/commands/inventory/pull-unstructured-discovery-files/impl.ts"],"sourcesContent":["import type { UnstructuredSubDataPointRecommendationStatus } from '@transcend-io/privacy-types';\nimport { buildTranscendGraphQLClient } from '@transcend-io/sdk';\nimport colors from 'colors';\nimport { uniq } from 'lodash-es';\n\nimport type { LocalContext } from '../../../context.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { pullUnstructuredSubDataPointRecommendations } from '../../../lib/data-inventory/index.js';\nimport { writeLargeCsv } from '../../../lib/helpers/index.js';\nimport { logger } from '../../../logger.js';\n\nexport interface PullUnstructuredDiscoveryFilesCommandFlags {\n auth: string;\n file: string;\n transcendUrl: string;\n dataSiloIds?: string[];\n subCategories?: string[];\n status?: UnstructuredSubDataPointRecommendationStatus[];\n includeEncryptedSnippets: boolean;\n}\n\nexport async function pullUnstructuredDiscoveryFiles(\n this: LocalContext,\n {\n auth,\n file,\n transcendUrl,\n dataSiloIds,\n subCategories,\n status,\n includeEncryptedSnippets,\n }: PullUnstructuredDiscoveryFilesCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n try {\n // Create a GraphQL client\n const client = buildTranscendGraphQLClient(transcendUrl, auth);\n\n const entries = await pullUnstructuredSubDataPointRecommendations(client, {\n dataSiloIds,\n subCategories, // TODO: https://transcend.height.app/T-40482 - do by name not ID\n status,\n includeEncryptedSnippets,\n });\n\n logger.info(colors.magenta(`Writing unstructured discovery files to file \"${file}\"...`));\n let headers: string[] = [];\n const inputs = entries.map((entry) => {\n const result = {\n 'Entry ID': entry.id,\n 'Data Silo ID': entry.dataSiloId,\n 'Object Path ID': entry.scannedObjectPathId,\n 'Object ID': entry.scannedObjectId,\n ...(includeEncryptedSnippets\n ? { Entry: entry.name, 'Context Snippet': entry.contextSnippet }\n : {}),\n 'Data Category': `${entry.dataSubCategory.category}:${entry.dataSubCategory.name}`,\n 'Classification Status': entry.status,\n 'Confidence Score': entry.confidence,\n 'Classification Method': entry.classificationMethod,\n 'Classifier Version': entry.classifierVersion,\n };\n headers = uniq([...headers, ...Object.keys(result)]);\n return result;\n });\n await writeLargeCsv(file, inputs, headers);\n } catch (err) {\n logger.error(\n colors.red(`An error occurred syncing the unstructured discovery files: ${err.message}`),\n );\n this.process.exit(1);\n }\n\n // Indicate success\n logger.info(colors.green(`Successfully synced unstructured discovery files to disk at ${file}!`));\n}\n"],"mappings":"gVAqBA,eAAsB,EAEpB,CACE,OACA,OACA,eACA,cACA,gBACA,SACA,4BAEa,CACf,EAAoB,KAAK,QAAQ,KAAK,CAEtC,GAAI,CAIF,IAAM,EAAU,MAAM,EAFP,EAA4B,EAAc,EAEe,CAAE,CACxE,cACA,gBACA,SACA,2BACD,CAAC,CAEF,EAAO,KAAK,EAAO,QAAQ,iDAAiD,EAAK,MAAM,CAAC,CACxF,IAAI,EAAoB,EAAE,CAmB1B,MAAM,EAAc,EAlBL,EAAQ,IAAK,GAAU,CACpC,IAAM,EAAS,CACb,WAAY,EAAM,GAClB,eAAgB,EAAM,WACtB,iBAAkB,EAAM,oBACxB,YAAa,EAAM,gBACnB,GAAI,EACA,CAAE,MAAO,EAAM,KAAM,kBAAmB,EAAM,eAAgB,CAC9D,EAAE,CACN,gBAAiB,GAAG,EAAM,gBAAgB,SAAS,GAAG,EAAM,gBAAgB,OAC5E,wBAAyB,EAAM,OAC/B,mBAAoB,EAAM,WAC1B,wBAAyB,EAAM,qBAC/B,qBAAsB,EAAM,kBAC7B,CAED,MADA,GAAU,EAAK,CAAC,GAAG,EAAS,GAAG,OAAO,KAAK,EAAO,CAAC,CAAC,CAC7C,GAEuB,CAAE,EAAQ,OACnC,EAAK,CACZ,EAAO,MACL,EAAO,IAAI,+DAA+D,EAAI,UAAU,CACzF,CACD,KAAK,QAAQ,KAAK,EAAE,CAItB,EAAO,KAAK,EAAO,MAAM,+DAA+D,EAAK,GAAG,CAAC"}
@@ -1,3 +1,3 @@
1
- import{r as e}from"./constants-9AglpfjZ.mjs";import{t}from"./logger-Bj782ZYD.mjs";import{a as n}from"./writeCsv-C4pjXGsD.mjs";import{t as r}from"./pullConsentManagerMetrics-zKgjc3Ap.mjs";import{t as i}from"./validateTranscendAuth-DJ8qHb9B.mjs";import{t as a}from"./done-input-validation-BcNBxhEs.mjs";import{ConsentManagerMetricBin as o}from"@transcend-io/privacy-types";import s,{existsSync as c,mkdirSync as l}from"node:fs";import{join as u}from"node:path";import d from"colors";import{buildTranscendGraphQLClient as f}from"@transcend-io/sdk";import{map as p,mapSeries as m}from"@transcend-io/utils";async function h({auth:h,start:g,end:_,folder:v,bin:y,transcendUrl:b}){let x=y;Object.values(o).includes(x)||(t.error(d.red(`Failed to parse argument "bin" with value "${y}"\nExpected one of: \n${Object.values(o).join(`
1
+ import{r as e}from"./constants-FP8lxFg5.mjs";import{t}from"./logger-B-LXIf3U.mjs";import{a as n}from"./writeCsv-CbT4a0uj.mjs";import{t as r}from"./pullConsentManagerMetrics-CcBfEEzz.mjs";import{t as i}from"./validateTranscendAuth-RgQkJacW.mjs";import{t as a}from"./done-input-validation-9r-9VL6r.mjs";import{ConsentManagerMetricBin as o}from"@transcend-io/privacy-types";import s,{existsSync as c,mkdirSync as l}from"node:fs";import{join as u}from"node:path";import d from"colors";import{buildTranscendGraphQLClient as f}from"@transcend-io/sdk";import{map as p,mapSeries as m}from"@transcend-io/utils";async function h({auth:h,start:g,end:_,folder:v,bin:y,transcendUrl:b}){let x=y;Object.values(o).includes(x)||(t.error(d.red(`Failed to parse argument "bin" with value "${y}"\nExpected one of: \n${Object.values(o).join(`
2
2
  `)}`)),this.process.exit(1));let S=new Date(g),C=_?new Date(_):new Date;Number.isNaN(S.getTime())&&(t.error(d.red(`Start date provided is invalid date. Got --start="${g}" expected --start="01/01/2023"`)),this.process.exit(1)),Number.isNaN(C.getTime())&&(t.error(d.red(`End date provided is invalid date. Got --end="${_}" expected --end="01/01/2023"`)),this.process.exit(1)),S>C&&(t.error(d.red(`Got a start date "${S.toISOString()}" that was larger than the end date "${C.toISOString()}". Start date must be before end date.`)),this.process.exit(1)),a(this.process.exit);let w=await i(h);if(s.existsSync(v)&&!s.lstatSync(v).isDirectory()&&(t.error(d.red(`The provided argument "folder" was passed a file. expected: folder="./consent-metrics/"`)),this.process.exit(1)),c(v)||l(v),t.info(d.magenta(`Pulling consent metrics from start=${S.toString()} to end=${C.toISOString()} with bin size "${y}"`)),typeof w==`string`){try{let e=await r(f(b,w),{bin:x,start:S,end:C});await p(Object.entries(e),async([e,r])=>{await p(r,async({points:r,name:i})=>{let a=u(v,`${e}_${i}.csv`);t.info(d.magenta(`Writing configuration to file "${a}"...`)),await n(a,r.map(({key:e,value:t})=>({timestamp:e,value:t})))},{concurrency:5})},{concurrency:5})}catch(e){t.error(d.red(`An error occurred syncing the schema: ${e.message}`)),this.process.exit(1)}t.info(d.green(`Successfully synced consent metrics to disk in folder "${v}"! View at ${e}`))}else{let i=[];await m(w,async(e,a)=>{let o=`[${a+1}/${w.length}][${e.organizationName}] `;t.info(d.magenta(`~~~\n\n${o}Attempting to pull consent metrics...\n\n~~~`));let s=f(b,e.apiKey);try{let i=await r(s,{bin:x,start:S,end:C}),a=u(v,e.organizationName);c(a)||l(a),Object.entries(i).forEach(([e,r])=>{r.forEach(({points:r,name:i})=>{let o=u(a,`${e}_${i}.csv`);t.info(d.magenta(`Writing configuration to file "${o}"...`)),n(o,r.map(({key:e,value:t})=>({timestamp:e,value:t})))})}),t.info(d.green(`${o}Successfully pulled configuration!`))}catch(n){t.error(d.red(`${o}Failed to sync configuration.`),n),i.push(e.organizationName)}}),i.length>0&&(t.info(d.red(`Sync encountered errors for "${i.join(`,`)}". View output above for more information, or check out ${e}`)),this.process.exit(1))}}export{h as pullConsentMetrics};
3
- //# sourceMappingURL=impl-BsTZyBo4.mjs.map
3
+ //# sourceMappingURL=impl-DI3mf99H.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"impl-BsTZyBo4.mjs","names":[],"sources":["../src/commands/consent/pull-consent-metrics/impl.ts"],"sourcesContent":["import fs, { existsSync, mkdirSync } from 'node:fs';\nimport { join } from 'node:path';\n\nimport { ConsentManagerMetricBin } from '@transcend-io/privacy-types';\nimport { buildTranscendGraphQLClient } from '@transcend-io/sdk';\nimport { map, mapSeries } from '@transcend-io/utils';\nimport colors from 'colors';\n\nimport { ADMIN_DASH_INTEGRATIONS } from '../../../constants.js';\nimport type { LocalContext } from '../../../context.js';\nimport { validateTranscendAuth } from '../../../lib/api-keys/index.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { pullConsentManagerMetrics } from '../../../lib/consent-manager/index.js';\nimport { writeCsv } from '../../../lib/helpers/index.js';\nimport { logger } from '../../../logger.js';\n\nexport interface PullConsentMetricsCommandFlags {\n auth: string;\n start: Date;\n end?: Date;\n folder: string;\n bin: string;\n transcendUrl: string;\n}\n\nexport async function pullConsentMetrics(\n this: LocalContext,\n { auth, start, end, folder, bin, transcendUrl }: PullConsentMetricsCommandFlags,\n): Promise<void> {\n // Validate bin\n const parsedBin = bin as ConsentManagerMetricBin;\n if (!Object.values(ConsentManagerMetricBin).includes(parsedBin)) {\n logger.error(\n colors.red(\n `Failed to parse argument \"bin\" with value \"${bin}\"\\n` +\n `Expected one of: \\n${Object.values(ConsentManagerMetricBin).join('\\n')}`,\n ),\n );\n this.process.exit(1);\n }\n\n // Parse the dates\n const startDate = new Date(start);\n const endDate = end ? new Date(end) : new Date();\n if (Number.isNaN(startDate.getTime())) {\n logger.error(\n colors.red(\n `Start date provided is invalid date. Got --start=\"${start}\" expected --start=\"01/01/2023\"`,\n ),\n );\n this.process.exit(1);\n }\n if (Number.isNaN(endDate.getTime())) {\n logger.error(\n colors.red(\n `End date provided is invalid date. Got --end=\"${end}\" expected --end=\"01/01/2023\"`,\n ),\n );\n this.process.exit(1);\n }\n if (startDate > endDate) {\n logger.error(\n colors.red(\n `Got a start date \"${startDate.toISOString()}\" that was larger than the end date \"${endDate.toISOString()}\". ` +\n 'Start date must be before end date.',\n ),\n );\n this.process.exit(1);\n }\n\n doneInputValidation(this.process.exit);\n\n // Parse authentication as API key or path to list of API keys\n const apiKeyOrList = await validateTranscendAuth(auth);\n\n // Ensure folder either does not exist or is not a file\n if (fs.existsSync(folder) && !fs.lstatSync(folder).isDirectory()) {\n logger.error(\n colors.red(\n 'The provided argument \"folder\" was passed a file. expected: folder=\"./consent-metrics/\"',\n ),\n );\n this.process.exit(1);\n }\n\n // Create the folder if it does not exist\n if (!existsSync(folder)) {\n mkdirSync(folder);\n }\n\n logger.info(\n colors.magenta(\n `Pulling consent metrics from start=${startDate.toString()} to end=${endDate.toISOString()} with bin size \"${bin}\"`,\n ),\n );\n\n // Sync to Disk\n if (typeof apiKeyOrList === 'string') {\n try {\n // Create a GraphQL client\n const client = buildTranscendGraphQLClient(transcendUrl, apiKeyOrList);\n\n // Pull the metrics\n const configuration = await pullConsentManagerMetrics(client, {\n bin: parsedBin,\n start: startDate,\n end: endDate,\n });\n\n // Write to file\n await map(\n Object.entries(configuration),\n async ([metricName, metrics]) => {\n await map(\n metrics,\n async ({ points, name }) => {\n const file = join(folder, `${metricName}_${name}.csv`);\n logger.info(colors.magenta(`Writing configuration to file \"${file}\"...`));\n await writeCsv(\n file,\n points.map(({ key, value }: { key: string; value: string }) => ({\n timestamp: key,\n value,\n })),\n );\n },\n {\n concurrency: 5,\n },\n );\n },\n { concurrency: 5 },\n );\n } catch (err) {\n logger.error(colors.red(`An error occurred syncing the schema: ${err.message}`));\n this.process.exit(1);\n }\n\n // Indicate success\n logger.info(\n colors.green(\n `Successfully synced consent metrics to disk in folder \"${folder}\"! View at ${ADMIN_DASH_INTEGRATIONS}`,\n ),\n );\n } else {\n const encounteredErrors: string[] = [];\n await mapSeries(apiKeyOrList, async (apiKey, ind) => {\n const prefix = `[${ind + 1}/${apiKeyOrList.length}][${apiKey.organizationName}] `;\n logger.info(colors.magenta(`~~~\\n\\n${prefix}Attempting to pull consent metrics...\\n\\n~~~`));\n\n // Create a GraphQL client\n const client = buildTranscendGraphQLClient(transcendUrl, apiKey.apiKey);\n\n try {\n const configuration = await pullConsentManagerMetrics(client, {\n bin: parsedBin,\n start: startDate,\n end: endDate,\n });\n\n // ensure folder exists for that organization\n const subFolder = join(folder, apiKey.organizationName);\n if (!existsSync(subFolder)) {\n mkdirSync(subFolder);\n }\n\n // Write to file\n Object.entries(configuration).forEach(([metricName, metrics]) => {\n metrics.forEach(({ points, name }) => {\n const file = join(subFolder, `${metricName}_${name}.csv`);\n logger.info(colors.magenta(`Writing configuration to file \"${file}\"...`));\n writeCsv(\n file,\n points.map(({ key, value }: { key: string; value: string }) => ({\n timestamp: key,\n value,\n })),\n );\n });\n });\n\n logger.info(colors.green(`${prefix}Successfully pulled configuration!`));\n } catch (err) {\n logger.error(colors.red(`${prefix}Failed to sync configuration.`), err);\n encounteredErrors.push(apiKey.organizationName);\n }\n });\n\n if (encounteredErrors.length > 0) {\n logger.info(\n colors.red(\n `Sync encountered errors for \"${encounteredErrors.join(\n ',',\n )}\". View output above for more information, or check out ${ADMIN_DASH_INT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ACzE,EACE,EACA,EAAO,KAAK,CAAE,MAAK,YAA6C,CAC9D,UAAW,EACX,QACD,EAAE,CACJ,EACD,EACF,CAEF,EAAO,KAAK,EAAO,MAAM,GAAG,EAAO,oCAAoC,CAAC,OACjE,EAAK,CACZ,EAAO,MAAM,EAAO,IAAI,GAAG,EAAO,+BAA+B,CAAE,EAAI,CACvE,EAAkB,KAAK,EAAO,iBAAiB,GAEjD,CAEE,EAAkB,OAAS,IAC7B,EAAO,KACL,EAAO,IACL,gCAAgC,EAAkB,KAChD,IACD,CAAC,0DAA0D,IAC7D,CACF,CAED,KAAK,QAAQ,KAAK,EAAE"}
1
+ {"version":3,"file":"impl-DI3mf99H.mjs","names":[],"sources":["../src/commands/consent/pull-consent-metrics/impl.ts"],"sourcesContent":["import fs, { existsSync, mkdirSync } from 'node:fs';\nimport { join } from 'node:path';\n\nimport { ConsentManagerMetricBin } from '@transcend-io/privacy-types';\nimport { buildTranscendGraphQLClient } from '@transcend-io/sdk';\nimport { map, mapSeries } from '@transcend-io/utils';\nimport colors from 'colors';\n\nimport { ADMIN_DASH_INTEGRATIONS } from '../../../constants.js';\nimport type { LocalContext } from '../../../context.js';\nimport { validateTranscendAuth } from '../../../lib/api-keys/index.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { pullConsentManagerMetrics } from '../../../lib/consent-manager/index.js';\nimport { writeCsv } from '../../../lib/helpers/index.js';\nimport { logger } from '../../../logger.js';\n\nexport interface PullConsentMetricsCommandFlags {\n auth: string;\n start: Date;\n end?: Date;\n folder: string;\n bin: string;\n transcendUrl: string;\n}\n\nexport async function pullConsentMetrics(\n this: LocalContext,\n { auth, start, end, folder, bin, transcendUrl }: PullConsentMetricsCommandFlags,\n): Promise<void> {\n // Validate bin\n const parsedBin = bin as ConsentManagerMetricBin;\n if (!Object.values(ConsentManagerMetricBin).includes(parsedBin)) {\n logger.error(\n colors.red(\n `Failed to parse argument \"bin\" with value \"${bin}\"\\n` +\n `Expected one of: \\n${Object.values(ConsentManagerMetricBin).join('\\n')}`,\n ),\n );\n this.process.exit(1);\n }\n\n // Parse the dates\n const startDate = new Date(start);\n const endDate = end ? new Date(end) : new Date();\n if (Number.isNaN(startDate.getTime())) {\n logger.error(\n colors.red(\n `Start date provided is invalid date. Got --start=\"${start}\" expected --start=\"01/01/2023\"`,\n ),\n );\n this.process.exit(1);\n }\n if (Number.isNaN(endDate.getTime())) {\n logger.error(\n colors.red(\n `End date provided is invalid date. Got --end=\"${end}\" expected --end=\"01/01/2023\"`,\n ),\n );\n this.process.exit(1);\n }\n if (startDate > endDate) {\n logger.error(\n colors.red(\n `Got a start date \"${startDate.toISOString()}\" that was larger than the end date \"${endDate.toISOString()}\". ` +\n 'Start date must be before end date.',\n ),\n );\n this.process.exit(1);\n }\n\n doneInputValidation(this.process.exit);\n\n // Parse authentication as API key or path to list of API keys\n const apiKeyOrList = await validateTranscendAuth(auth);\n\n // Ensure folder either does not exist or is not a file\n if (fs.existsSync(folder) && !fs.lstatSync(folder).isDirectory()) {\n logger.error(\n colors.red(\n 'The provided argument \"folder\" was passed a file. expected: folder=\"./consent-metrics/\"',\n ),\n );\n this.process.exit(1);\n }\n\n // Create the folder if it does not exist\n if (!existsSync(folder)) {\n mkdirSync(folder);\n }\n\n logger.info(\n colors.magenta(\n `Pulling consent metrics from start=${startDate.toString()} to end=${endDate.toISOString()} with bin size \"${bin}\"`,\n ),\n );\n\n // Sync to Disk\n if (typeof apiKeyOrList === 'string') {\n try {\n // Create a GraphQL client\n const client = buildTranscendGraphQLClient(transcendUrl, apiKeyOrList);\n\n // Pull the metrics\n const configuration = await pullConsentManagerMetrics(client, {\n bin: parsedBin,\n start: startDate,\n end: endDate,\n });\n\n // Write to file\n await map(\n Object.entries(configuration),\n async ([metricName, metrics]) => {\n await map(\n metrics,\n async ({ points, name }) => {\n const file = join(folder, `${metricName}_${name}.csv`);\n logger.info(colors.magenta(`Writing configuration to file \"${file}\"...`));\n await writeCsv(\n file,\n points.map(({ key, value }: { key: string; value: string }) => ({\n timestamp: key,\n value,\n })),\n );\n },\n {\n concurrency: 5,\n },\n );\n },\n { concurrency: 5 },\n );\n } catch (err) {\n logger.error(colors.red(`An error occurred syncing the schema: ${err.message}`));\n this.process.exit(1);\n }\n\n // Indicate success\n logger.info(\n colors.green(\n `Successfully synced consent metrics to disk in folder \"${folder}\"! View at ${ADMIN_DASH_INTEGRATIONS}`,\n ),\n );\n } else {\n const encounteredErrors: string[] = [];\n await mapSeries(apiKeyOrList, async (apiKey, ind) => {\n const prefix = `[${ind + 1}/${apiKeyOrList.length}][${apiKey.organizationName}] `;\n logger.info(colors.magenta(`~~~\\n\\n${prefix}Attempting to pull consent metrics...\\n\\n~~~`));\n\n // Create a GraphQL client\n const client = buildTranscendGraphQLClient(transcendUrl, apiKey.apiKey);\n\n try {\n const configuration = await pullConsentManagerMetrics(client, {\n bin: parsedBin,\n start: startDate,\n end: endDate,\n });\n\n // ensure folder exists for that organization\n const subFolder = join(folder, apiKey.organizationName);\n if (!existsSync(subFolder)) {\n mkdirSync(subFolder);\n }\n\n // Write to file\n Object.entries(configuration).forEach(([metricName, metrics]) => {\n metrics.forEach(({ points, name }) => {\n const file = join(subFolder, `${metricName}_${name}.csv`);\n logger.info(colors.magenta(`Writing configuration to file \"${file}\"...`));\n writeCsv(\n file,\n points.map(({ key, value }: { key: string; value: string }) => ({\n timestamp: key,\n value,\n })),\n );\n });\n });\n\n logger.info(colors.green(`${prefix}Successfully pulled configuration!`));\n } catch (err) {\n logger.error(colors.red(`${prefix}Failed to sync configuration.`), err);\n encounteredErrors.push(apiKey.organizationName);\n }\n });\n\n if (encounteredErrors.length > 0) {\n logger.info(\n colors.red(\n `Sync encountered errors for \"${encounteredErrors.join(\n ',',\n )}\". View output above for more information, or check out ${ADMIN_DASH_INTEGRATIONS}`,\n ),\n );\n\n this.process.exit(1);\n }\n }\n}\n"],"mappings":"0lBAyBA,eAAsB,EAEpB,CAAE,OAAM,QAAO,MAAK,SAAQ,M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AAM,GAAG,EAAO,oCAAoC,CAAC,OACjE,EAAK,CACZ,EAAO,MAAM,EAAO,IAAI,GAAG,EAAO,+BAA+B,CAAE,EAAI,CACvE,EAAkB,KAAK,EAAO,iBAAiB,GAEjD,CAEE,EAAkB,OAAS,IAC7B,EAAO,KACL,EAAO,IACL,gCAAgC,EAAkB,KAChD,IACD,CAAC,0DAA0D,IAC7D,CACF,CAED,KAAK,QAAQ,KAAK,EAAE"}
@@ -1,2 +1,2 @@
1
- import{r as e}from"./constants-9AglpfjZ.mjs";import{t}from"./logger-Bj782ZYD.mjs";import{r as n}from"./readTranscendYaml-CGb2UUyM.mjs";import{n as r,r as i,t as a}from"./parseVariablesFromString-BeKOGw5n.mjs";import{t as o}from"./validateTranscendAuth-DJ8qHb9B.mjs";import{t as s}from"./listFiles-D2wMHnEr.mjs";import{t as c}from"./done-input-validation-BcNBxhEs.mjs";import{existsSync as l,lstatSync as u}from"node:fs";import{join as d}from"node:path";import f from"colors";import{buildTranscendGraphQLClient as p}from"@transcend-io/sdk";import{mapSeries as m}from"@transcend-io/utils";async function h({transcendUrl:e,auth:n,pageSize:r,publishToPrivacyCenter:a,contents:o,deleteExtraAttributeValues:s=!1,classifyService:c=!1}){let l=p(e,n);try{return!await i(o,l,{pageSize:r,publishToPrivacyCenter:a,classifyService:c,deleteExtraAttributeValues:s})}catch(e){return t.error(f.red(`An unexpected error occurred syncing the schema: ${e.message}`)),!1}}async function g({file:i=`./transcend.yml`,transcendUrl:p,auth:g,variables:_,pageSize:v,publishToPrivacyCenter:y,classifyService:b,deleteExtraAttributeValues:x}){c(this.process.exit);let S=await o(g),C=a(_),w;if(w=Array.isArray(S)&&u(i).isDirectory()?s(i).map(e=>d(i,e)):i.split(`,`),w.length<1)throw Error(`No file specified!`);let T=w.map(e=>{l(e)?t.info(f.magenta(`Reading file "${e}"...`)):(t.error(f.red(`The file path does not exist on disk: ${e}. You can specify the filepath using --file=./examples/transcend.yml`)),this.process.exit(1));try{let r=n(e,C);return t.info(f.green(`Successfully read in "${e}"`)),{content:r,name:e.split(`/`).pop().replace(`.yml`,``)}}catch(e){t.error(f.red(`The shape of your yaml file is invalid with the following errors: ${e.message}`)),this.process.exit(1)}});if(typeof S==`string`){let[n,...i]=T.map(({content:e})=>e);await h({transcendUrl:p,auth:S,contents:r(n,...i),publishToPrivacyCenter:y,deleteExtraAttributeValues:x,pageSize:v,classifyService:!!b})||(t.info(f.red(`Sync encountered errors. View output above for more information, or check out ${e}`)),this.process.exit(1))}else{if(T.length!==1&&T.length!==S.length)throw Error(`Expected list of yml files to be equal to the list of API keys.Got ${T.length} YML file${T.length===1?``:`s`} and ${S.length} API key${S.length===1?``:`s`}`);let n=[];await m(S,async(e,r)=>{let i=`[${r+1}/${S.length}][${e.organizationName}] `;t.info(f.magenta(`~~~\n\n${i}Attempting to push configuration...\n\n~~~`));let a=T.length===1?T[0].content:T.find(t=>t.name===e.organizationName)?.content;if(!a){t.error(f.red(`${i}Failed to find transcend.yml file for organization: "${e.organizationName}".`)),n.push(e.organizationName);return}await h({transcendUrl:p,auth:e.apiKey,contents:a,pageSize:v,publishToPrivacyCenter:y,deleteExtraAttributeValues:x,classifyService:b})?t.info(f.green(`${i}Successfully pushed configuration!`)):(t.error(f.red(`${i}Failed to sync configuration.`)),n.push(e.organizationName))}),n.length>0&&(t.info(f.red(`Sync encountered errors for "${n.join(`,`)}". View output above for more information, or check out ${e}`)),this.process.exit(1))}t.info(f.green(`Successfully synced yaml file to Transcend! View at ${e}`))}export{g as push};
2
- //# sourceMappingURL=impl-BPY0YGuj.mjs.map
1
+ import{r as e}from"./constants-FP8lxFg5.mjs";import{t}from"./logger-B-LXIf3U.mjs";import{r as n}from"./readTranscendYaml-DnvxeV7w.mjs";import{n as r,r as i,t as a}from"./parseVariablesFromString-C3CPWxqY.mjs";import{t as o}from"./validateTranscendAuth-RgQkJacW.mjs";import{t as s}from"./listFiles-oqwR2oZ4.mjs";import{t as c}from"./done-input-validation-9r-9VL6r.mjs";import{existsSync as l,lstatSync as u}from"node:fs";import{join as d}from"node:path";import f from"colors";import{buildTranscendGraphQLClient as p}from"@transcend-io/sdk";import{mapSeries as m}from"@transcend-io/utils";async function h({transcendUrl:e,auth:n,pageSize:r,publishToPrivacyCenter:a,contents:o,deleteExtraAttributeValues:s=!1,classifyService:c=!1}){let l=p(e,n);try{return!await i(o,l,{pageSize:r,publishToPrivacyCenter:a,classifyService:c,deleteExtraAttributeValues:s})}catch(e){return t.error(f.red(`An unexpected error occurred syncing the schema: ${e.message}`)),!1}}async function g({file:i=`./transcend.yml`,transcendUrl:p,auth:g,variables:_,pageSize:v,publishToPrivacyCenter:y,classifyService:b,deleteExtraAttributeValues:x}){c(this.process.exit);let S=await o(g),C=a(_),w;if(w=Array.isArray(S)&&u(i).isDirectory()?s(i).map(e=>d(i,e)):i.split(`,`),w.length<1)throw Error(`No file specified!`);let T=w.map(e=>{l(e)?t.info(f.magenta(`Reading file "${e}"...`)):(t.error(f.red(`The file path does not exist on disk: ${e}. You can specify the filepath using --file=./examples/transcend.yml`)),this.process.exit(1));try{let r=n(e,C);return t.info(f.green(`Successfully read in "${e}"`)),{content:r,name:e.split(`/`).pop().replace(`.yml`,``)}}catch(e){t.error(f.red(`The shape of your yaml file is invalid with the following errors: ${e.message}`)),this.process.exit(1)}});if(typeof S==`string`){let[n,...i]=T.map(({content:e})=>e);await h({transcendUrl:p,auth:S,contents:r(n,...i),publishToPrivacyCenter:y,deleteExtraAttributeValues:x,pageSize:v,classifyService:!!b})||(t.info(f.red(`Sync encountered errors. View output above for more information, or check out ${e}`)),this.process.exit(1))}else{if(T.length!==1&&T.length!==S.length)throw Error(`Expected list of yml files to be equal to the list of API keys.Got ${T.length} YML file${T.length===1?``:`s`} and ${S.length} API key${S.length===1?``:`s`}`);let n=[];await m(S,async(e,r)=>{let i=`[${r+1}/${S.length}][${e.organizationName}] `;t.info(f.magenta(`~~~\n\n${i}Attempting to push configuration...\n\n~~~`));let a=T.length===1?T[0].content:T.find(t=>t.name===e.organizationName)?.content;if(!a){t.error(f.red(`${i}Failed to find transcend.yml file for organization: "${e.organizationName}".`)),n.push(e.organizationName);return}await h({transcendUrl:p,auth:e.apiKey,contents:a,pageSize:v,publishToPrivacyCenter:y,deleteExtraAttributeValues:x,classifyService:b})?t.info(f.green(`${i}Successfully pushed configuration!`)):(t.error(f.red(`${i}Failed to sync configuration.`)),n.push(e.organizationName))}),n.length>0&&(t.info(f.red(`Sync encountered errors for "${n.join(`,`)}". View output above for more information, or check out ${e}`)),this.process.exit(1))}t.info(f.green(`Successfully synced yaml file to Transcend! View at ${e}`))}export{g as push};
2
+ //# sourceMappingURL=impl-DQdsAf-6.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"impl-BPY0YGuj.mjs","names":[],"sources":["../src/commands/inventory/push/impl.ts"],"sourcesContent":["import { existsSync, lstatSync } from 'node:fs';\nimport { join } from 'node:path';\n\nimport { buildTranscendGraphQLClient } from '@transcend-io/sdk';\nimport { mapSeries } from '@transcend-io/utils';\nimport colors from 'colors';\n\nimport { TranscendInput } from '../../../codecs.js';\nimport { ADMIN_DASH_INTEGRATIONS } from '../../../constants.js';\nimport type { LocalContext } from '../../../context.js';\nimport { validateTranscendAuth, listFiles } from '../../../lib/api-keys/index.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { syncConfigurationToTranscend } from '../../../lib/graphql/index.js';\nimport { parseVariablesFromString } from '../../../lib/helpers/parseVariablesFromString.js';\nimport { mergeTranscendInputs } from '../../../lib/mergeTranscendInputs.js';\nimport { readTranscendYaml } from '../../../lib/readTranscendYaml.js';\nimport { logger } from '../../../logger.js';\n\n/**\n * Sync configuration to Transcend\n *\n * @param options - Options\n * @returns True if synced successfully, false if error occurs\n */\nasync function syncConfiguration({\n transcendUrl,\n auth,\n pageSize,\n publishToPrivacyCenter,\n contents,\n deleteExtraAttributeValues = false,\n classifyService = false,\n}: {\n /** Transcend YAML */\n contents: TranscendInput;\n /** Transcend URL */\n transcendUrl: string;\n /** API key */\n auth: string;\n /** Page size */\n pageSize: number;\n /** Skip privacy center publish step */\n publishToPrivacyCenter: boolean;\n /** classify data flow service if missing */\n classifyService?: boolean;\n /** Delete attributes when syncing */\n deleteExtraAttributeValues?: boolean;\n}): Promise<boolean> {\n const client = buildTranscendGraphQLClient(transcendUrl, auth);\n\n // Sync to Transcend\n try {\n const encounteredError = await syncConfigurationToTranscend(contents, client, {\n pageSize,\n publishToPrivacyCenter,\n classifyService,\n deleteExtraAttributeValues,\n });\n return !encounteredError;\n } catch (err) {\n logger.error(colors.red(`An unexpected error occurred syncing the schema: ${err.message}`));\n return false;\n }\n}\n\nexport interface PushCommandFlags {\n auth: string;\n file: string;\n transcendUrl: string;\n pageSize: number;\n variables: string;\n publishToPrivacyCenter: boolean;\n classifyService: boolean;\n deleteExtraAttributeValues: boolean;\n}\n\nexport async function push(\n this: LocalContext,\n {\n file = './transcend.yml',\n transcendUrl,\n auth,\n variables,\n pageSize,\n publishToPrivacyCenter,\n classifyService,\n deleteExtraAttributeValues,\n }: PushCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n // Parse authentication as API key or path to list of API keys\n const apiKeyOrList = await validateTranscendAuth(auth);\n\n // Parse out the variables\n const vars = parseVariablesFromString(variables);\n\n // check if we are being passed a list of API keys and a list of files\n let fileList: string[];\n if (Array.isArray(apiKeyOrList) && lstatSync(file).isDirectory()) {\n fileList = listFiles(file).map((filePath) => join(file, filePath));\n } else {\n fileList = file.split(',');\n }\n\n // Ensure at least one file is parsed\n if (fileList.length < 1) {\n throw new Error('No file specified!');\n }\n\n // eslint-disable-next-line array-callback-return,consistent-return\n const transcendInputs = fileList.map((filePath) => {\n // Ensure yaml file exists on disk\n if (!existsSync(filePath)) {\n logger.error(\n colors.red(\n `The file path does not exist on disk: ${filePath}. You can specify the filepath using --file=./examples/transcend.yml`,\n ),\n );\n this.process.exit(1);\n } else {\n logger.info(colors.magenta(`Reading file \"${filePath}\"...`));\n }\n\n try {\n // Read in the yaml file and validate it's shape\n const newContents = readTranscendYaml(filePath, vars);\n logger.info(colors.green(`Successfully read in \"${filePath}\"`));\n return {\n content: newContents,\n name: filePath.split('/').pop()!.replace('.yml', ''),\n };\n } catch (err) {\n logger.error(\n colors.red(\n `The shape of your yaml file is invalid with the following errors: ${err.message}`,\n ),\n );\n this.process.exit(1);\n }\n });\n\n // process a single API key\n if (typeof apiKeyOrList === 'string') {\n // if passed multiple inputs, merge them together\n const [base, ...rest] = transcendInputs.map(({ content }) => content);\n const contents = mergeTranscendInputs(base, ...rest);\n\n // sync the configuration\n const success = await syncConfiguration({\n transcendUrl,\n auth: apiKeyOrList,\n contents,\n publishToPrivacyCenter,\n deleteExtraAttributeValues,\n pageSize,\n classifyService: !!classifyService,\n });\n\n // exist with error code\n if (!success) {\n logger.info(\n colors.red(\n `Sync encountered errors. View output above for more information, or check out ${ADMIN_DASH_INTEGRATIONS}`,\n ),\n );\n\n this.process.exit(1);\n }\n } else {\n // if passed multiple inputs, expect them to be one per instance\n if (transcendInputs.length !== 1 && transcendInputs.length !== apiKeyOrList.length) {\n throw new Error(\n 'Expected list of yml files to be equal to the list of API keys.' +\n `Got ${transcendInputs.length} YML file${\n transcendInputs.length === 1 ? '' : 's'\n } and ${apiKeyOrList.length} API key${apiKeyOrList.length === 1 ? '' : 's'}`,\n );\n }\n\n const encounteredErrors: string[] = [];\n await mapSeries(apiKeyOrList, async (apiKey, ind) => {\n const prefix = `[${ind + 1}/${apiKeyOrList.length}][${apiKey.organizationName}] `;\n logger.info(colors.magenta(`~~~\\n\\n${prefix}Attempting to push configuration...\\n\\n~~~`));\n\n // use the merged contents if 1 yml passed, else use the contents that map to that organization\n const useContents =\n transcendInputs.length === 1\n ? transcendInputs[0].content\n : transcendInputs.find((input) => input.name === apiKey.organizationName)?.content;\n\n // Throw error if cannot find a yml file matching that organization name\n if (!useContents) {\n logger.error(\n colors.red(\n `${prefix}Failed to find transcend.yml file for organization: \"${apiKey.organizationName}\".`,\n ),\n );\n encounteredErrors.push(apiKey.organizationName);\n return;\n }\n\n const success = await syncConfiguration({\n transcendUrl,\n auth: apiKey.apiKey,\n contents: useContents,\n pageSize,\n publishToPrivacyCenter,\n deleteExtraAttributeValues,\n classifyService,\n });\n\n if (success) {\n logger.info(colors.green(`${prefix}Successfully pushed configuration!`));\n } else {\n logger.error(colors.red(`${prefix}Failed to sync configuration.`));\n encounteredErrors.push(apiKey.organizationName);\n }\n });\n\n if (encounteredErrors.length > 0) {\n logger.info(\n colors.red(\n `Sync encountered errors for \"${encounteredErrors.join(\n ',',\n )}\". View output above for more information, or check out ${ADMIN_DASH_INTEGRATIONS}`,\n ),\n );\n\n this.process.exit(1);\n }\n }\n\n // Indicate success\n logger.info(\n colors.green(`Successfully synced yaml file to Transcend! View at ${ADMIN_DASH_INTEGRATIONS}`),\n );\n}\n"],"mappings":"2kBAwBA,eAAe,EAAkB,CAC/B,eACA,OACA,WACA,yBACA,WACA,6BAA6B,GAC7B,kBAAkB,IAgBC,CACnB,IAAM,EAAS,EAA4B,EAAc,EAAK,CAG9D,GAAI,CAOF,MAAO,CAAC,MANuB,EAA6B,EAAU,EAAQ,CAC5E,WACA,yBACA,kBACA,6BACD,CAAC,OAEK,EAAK,CAEZ,OADA,EAAO,MAAM,EAAO,IAAI,oDAAoD,EAAI,UAAU,CAAC,CACpF,IAeX,eAAsB,EAEpB,CACE,OAAO,kBACP,eACA,OACA,YACA,WACA,yBACA,kBACA,8BAEa,CACf,EAAoB,KAAK,QAAQ,KAAK,CAGtC,IAAM,EAAe,MAAM,EAAsB,EAAK,CAGhD,EAAO,EAAyB,EAAU,CAG5C,EAQJ,GAPA,AAGE,EAHE,MAAM,QAAQ,EAAa,EAAI,EAAU,EAAK,CAAC,aAAa,CACnD,EAAU,EAAK,CAAC,IAAK,GAAa,EAAK,EAAM,EAAS,CAAC,CAEvD,EAAK,MAAM,IAAI,CAIxB,EAAS,OAAS,EACpB,MAAU,MAAM,qBAAqB,CAIvC,IAAM,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AAgB,GAAG,QACnB,EAAgB,KAAM,GAAU,EAAM,OAAS,EAAO,iBAAiB,EAAE,QAG/E,GAAI,CAAC,EAAa,CAChB,EAAO,MACL,EAAO,IACL,GAAG,EAAO,uDAAuD,EAAO,iBAAiB,IAC1F,CACF,CACD,EAAkB,KAAK,EAAO,iBAAiB,CAC/C,OAaE,MAVkB,EAAkB,CACtC,eACA,KAAM,EAAO,OACb,SAAU,EACV,WACA,yBACA,6BACA,kBACD,CAAC,CAGA,EAAO,KAAK,EAAO,MAAM,GAAG,EAAO,oCAAoC,CAAC,EAExE,EAAO,MAAM,EAAO,IAAI,GAAG,EAAO,+BAA+B,CAAC,CAClE,EAAkB,KAAK,EAAO,iBAAiB,GAEjD,CAEE,EAAkB,OAAS,IAC7B,EAAO,KACL,EAAO,IACL,gCAAgC,EAAkB,KAChD,IACD,CAAC,0DAA0D,IAC7D,CACF,CAED,KAAK,QAAQ,KAAK,EAAE,EAKxB,EAAO,KACL,EAAO,MAAM,uDAAuD,IAA0B,CAC/F"}
1
+ {"version":3,"file":"impl-DQdsAf-6.mjs","names":[],"sources":["../src/commands/inventory/push/impl.ts"],"sourcesContent":["import { existsSync, lstatSync } from 'node:fs';\nimport { join } from 'node:path';\n\nimport { buildTranscendGraphQLClient } from '@transcend-io/sdk';\nimport { mapSeries } from '@transcend-io/utils';\nimport colors from 'colors';\n\nimport { TranscendInput } from '../../../codecs.js';\nimport { ADMIN_DASH_INTEGRATIONS } from '../../../constants.js';\nimport type { LocalContext } from '../../../context.js';\nimport { validateTranscendAuth, listFiles } from '../../../lib/api-keys/index.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { syncConfigurationToTranscend } from '../../../lib/graphql/index.js';\nimport { parseVariablesFromString } from '../../../lib/helpers/parseVariablesFromString.js';\nimport { mergeTranscendInputs } from '../../../lib/mergeTranscendInputs.js';\nimport { readTranscendYaml } from '../../../lib/readTranscendYaml.js';\nimport { logger } from '../../../logger.js';\n\n/**\n * Sync configuration to Transcend\n *\n * @param options - Options\n * @returns True if synced successfully, false if error occurs\n */\nasync function syncConfiguration({\n transcendUrl,\n auth,\n pageSize,\n publishToPrivacyCenter,\n contents,\n deleteExtraAttributeValues = false,\n classifyService = false,\n}: {\n /** Transcend YAML */\n contents: TranscendInput;\n /** Transcend URL */\n transcendUrl: string;\n /** API key */\n auth: string;\n /** Page size */\n pageSize: number;\n /** Skip privacy center publish step */\n publishToPrivacyCenter: boolean;\n /** classify data flow service if missing */\n classifyService?: boolean;\n /** Delete attributes when syncing */\n deleteExtraAttributeValues?: boolean;\n}): Promise<boolean> {\n const client = buildTranscendGraphQLClient(transcendUrl, auth);\n\n // Sync to Transcend\n try {\n const encounteredError = await syncConfigurationToTranscend(contents, client, {\n pageSize,\n publishToPrivacyCenter,\n classifyService,\n deleteExtraAttributeValues,\n });\n return !encounteredError;\n } catch (err) {\n logger.error(colors.red(`An unexpected error occurred syncing the schema: ${err.message}`));\n return false;\n }\n}\n\nexport interface PushCommandFlags {\n auth: string;\n file: string;\n transcendUrl: string;\n pageSize: number;\n variables: string;\n publishToPrivacyCenter: boolean;\n classifyService: boolean;\n deleteExtraAttributeValues: boolean;\n}\n\nexport async function push(\n this: LocalContext,\n {\n file = './transcend.yml',\n transcendUrl,\n auth,\n variables,\n pageSize,\n publishToPrivacyCenter,\n classifyService,\n deleteExtraAttributeValues,\n }: PushCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n // Parse authentication as API key or path to list of API keys\n const apiKeyOrList = await validateTranscendAuth(auth);\n\n // Parse out the variables\n const vars = parseVariablesFromString(variables);\n\n // check if we are being passed a list of API keys and a list of files\n let fileList: string[];\n if (Array.isArray(apiKeyOrList) && lstatSync(file).isDirectory()) {\n fileList = listFiles(file).map((filePath) => join(file, filePath));\n } else {\n fileList = file.split(',');\n }\n\n // Ensure at least one file is parsed\n if (fileList.length < 1) {\n throw new Error('No file specified!');\n }\n\n // eslint-disable-next-line array-callback-return,consistent-return\n const transcendInputs = fileList.map((filePath) => {\n // Ensure yaml file exists on disk\n if (!existsSync(filePath)) {\n logger.error(\n colors.red(\n `The file path does not exist on disk: ${filePath}. You can specify the filepath using --file=./examples/transcend.yml`,\n ),\n );\n this.process.exit(1);\n } else {\n logger.info(colors.magenta(`Reading file \"${filePath}\"...`));\n }\n\n try {\n // Read in the yaml file and validate it's shape\n const newContents = readTranscendYaml(filePath, vars);\n logger.info(colors.green(`Successfully read in \"${filePath}\"`));\n return {\n content: newContents,\n name: filePath.split('/').pop()!.replace('.yml', ''),\n };\n } catch (err) {\n logger.error(\n colors.red(\n `The shape of your yaml file is invalid with the following errors: ${err.message}`,\n ),\n );\n this.process.exit(1);\n }\n });\n\n // process a single API key\n if (typeof apiKeyOrList === 'string') {\n // if passed multiple inputs, merge them together\n const [base, ...rest] = transcendInputs.map(({ content }) => content);\n const contents = mergeTranscendInputs(base, ...rest);\n\n // sync the configuration\n const success = await syncConfiguration({\n transcendUrl,\n auth: apiKeyOrList,\n contents,\n publishToPrivacyCenter,\n deleteExtraAttributeValues,\n pageSize,\n classifyService: !!classifyService,\n });\n\n // exist with error code\n if (!success) {\n logger.info(\n colors.red(\n `Sync encountered errors. View output above for more information, or check out ${ADMIN_DASH_INTEGRATIONS}`,\n ),\n );\n\n this.process.exit(1);\n }\n } else {\n // if passed multiple inputs, expect them to be one per instance\n if (transcendInputs.length !== 1 && transcendInputs.length !== apiKeyOrList.length) {\n throw new Error(\n 'Expected list of yml files to be equal to the list of API keys.' +\n `Got ${transcendInputs.length} YML file${\n transcendInputs.length === 1 ? '' : 's'\n } and ${apiKeyOrList.length} API key${apiKeyOrList.length === 1 ? '' : 's'}`,\n );\n }\n\n const encounteredErrors: string[] = [];\n await mapSeries(apiKeyOrList, async (apiKey, ind) => {\n const prefix = `[${ind + 1}/${apiKeyOrList.length}][${apiKey.organizationName}] `;\n logger.info(colors.magenta(`~~~\\n\\n${prefix}Attempting to push configuration...\\n\\n~~~`));\n\n // use the merged contents if 1 yml passed, else use the contents that map to that organization\n const useContents =\n transcendInputs.length === 1\n ? transcendInputs[0].content\n : transcendInputs.find((input) => input.name === apiKey.organizationName)?.content;\n\n // Throw error if cannot find a yml file matching that organization name\n if (!useContents) {\n logger.error(\n colors.red(\n `${prefix}Failed to find transcend.yml file for organization: \"${apiKey.organizationName}\".`,\n ),\n );\n encounteredErrors.push(apiKey.organizationName);\n return;\n }\n\n const success = await syncConfiguration({\n transcendUrl,\n auth: apiKey.apiKey,\n contents: useContents,\n pageSize,\n publishToPrivacyCenter,\n deleteExtraAttributeValues,\n classifyService,\n });\n\n if (success) {\n logger.info(colors.green(`${prefix}Successfully pushed configuration!`));\n } else {\n logger.error(colors.red(`${prefix}Failed to sync configuration.`));\n encounteredErrors.push(apiKey.organizationName);\n }\n });\n\n if (encounteredErrors.length > 0) {\n logger.info(\n colors.red(\n `Sync encountered errors for \"${encounteredErrors.join(\n ',',\n )}\". View output above for more information, or check out ${ADMIN_DASH_INTEGRATIONS}`,\n ),\n );\n\n this.process.exit(1);\n }\n }\n\n // Indicate success\n logger.info(\n colors.green(`Successfully synced yaml file to Transcend! View at ${ADMIN_DASH_INTEGRATIONS}`),\n );\n}\n"],"mappings":"2kBAwBA,eAAe,EAAkB,CAC/B,eACA,OACA,WACA,yBACA,WACA,6BAA6B,GAC7B,kBAAkB,IAgBC,CACnB,IAAM,EAAS,EAA4B,EAAc,EAAK,CAG9D,GAAI,CAOF,MAAO,CAAC,MANuB,EAA6B,EAAU,EAAQ,CAC5E,WACA,yBACA,kBACA,6BACD,CAAC,OAEK,EAAK,CAEZ,OADA,EAAO,MAAM,EAAO,IAAI,oDAAoD,EAAI,UAAU,CAAC,CACpF,IAeX,eAAsB,EAEpB,CACE,OAAO,kBACP,eACA,OACA,YACA,WACA,yBACA,kBACA,8BAEa,CACf,EAAoB,KAAK,QAAQ,KAAK,CAGtC,IAAM,EAAe,MAAM,EAAsB,EAAK,CAGhD,EAAO,EAAyB,EAAU,CAG5C,EAQJ,GAPA,AA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AU,EAAc,MAAO,EAAQ,IAAQ,CACnD,IAAM,EAAS,IAAI,EAAM,EAAE,GAAG,EAAa,OAAO,IAAI,EAAO,iBAAiB,IAC9E,EAAO,KAAK,EAAO,QAAQ,UAAU,EAAO,4CAA4C,CAAC,CAGzF,IAAM,EACJ,EAAgB,SAAW,EACvB,EAAgB,GAAG,QACnB,EAAgB,KAAM,GAAU,EAAM,OAAS,EAAO,iBAAiB,EAAE,QAG/E,GAAI,CAAC,EAAa,CAChB,EAAO,MACL,EAAO,IACL,GAAG,EAAO,uDAAuD,EAAO,iBAAiB,IAC1F,CACF,CACD,EAAkB,KAAK,EAAO,iBAAiB,CAC/C,OAaE,MAVkB,EAAkB,CACtC,eACA,KAAM,EAAO,OACb,SAAU,EACV,WACA,yBACA,6BACA,kBACD,CAAC,CAGA,EAAO,KAAK,EAAO,MAAM,GAAG,EAAO,oCAAoC,CAAC,EAExE,EAAO,MAAM,EAAO,IAAI,GAAG,EAAO,+BAA+B,CAAC,CAClE,EAAkB,KAAK,EAAO,iBAAiB,GAEjD,CAEE,EAAkB,OAAS,IAC7B,EAAO,KACL,EAAO,IACL,gCAAgC,EAAkB,KAChD,IACD,CAAC,0DAA0D,IAC7D,CACF,CAED,KAAK,QAAQ,KAAK,EAAE,EAKxB,EAAO,KACL,EAAO,MAAM,uDAAuD,IAA0B,CAC/F"}
@@ -1,2 +1,2 @@
1
- import{t as e}from"./uploadDataFlowsFromCsv-pm5uNPQL.mjs";import{t}from"./done-input-validation-BcNBxhEs.mjs";async function n({auth:n,trackerStatus:r,file:i,classifyService:a,transcendUrl:o}){t(this.process.exit),await e({auth:n,trackerStatus:r,file:i,classifyService:a,transcendUrl:o})}export{n as uploadDataFlowsFromCsv};
2
- //# sourceMappingURL=impl-DdppV2cQ.mjs.map
1
+ import{t as e}from"./uploadDataFlowsFromCsv-BkrAh4SY.mjs";import{t}from"./done-input-validation-9r-9VL6r.mjs";async function n({auth:n,trackerStatus:r,file:i,classifyService:a,transcendUrl:o}){t(this.process.exit),await e({auth:n,trackerStatus:r,file:i,classifyService:a,transcendUrl:o})}export{n as uploadDataFlowsFromCsv};
2
+ //# sourceMappingURL=impl-DWWx9PXJ.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"impl-DdppV2cQ.mjs","names":["uploadDataFlowsFromCsvHelper"],"sources":["../src/commands/consent/upload-data-flows-from-csv/impl.ts"],"sourcesContent":["import { ConsentTrackerStatus } from '@transcend-io/privacy-types';\n\nimport type { LocalContext } from '../../../context.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { uploadDataFlowsFromCsv as uploadDataFlowsFromCsvHelper } from '../../../lib/consent-manager/index.js';\n\nexport interface UploadDataFlowsFromCsvCommandFlags {\n auth: string;\n trackerStatus: ConsentTrackerStatus;\n file: string;\n classifyService: boolean;\n transcendUrl: string;\n}\n\nexport async function uploadDataFlowsFromCsv(\n this: LocalContext,\n { auth, trackerStatus, file, classifyService, transcendUrl }: UploadDataFlowsFromCsvCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n await uploadDataFlowsFromCsvHelper({\n auth,\n trackerStatus,\n file,\n classifyService,\n transcendUrl,\n });\n}\n"],"mappings":"8GAcA,eAAsB,EAEpB,CAAE,OAAM,gBAAe,OAAM,kBAAiB,gBAC/B,CACf,EAAoB,KAAK,QAAQ,KAAK,CAEtC,MAAMA,EAA6B,CACjC,OACA,gBACA,OACA,kBACA,eACD,CAAC"}
1
+ {"version":3,"file":"impl-DWWx9PXJ.mjs","names":["uploadDataFlowsFromCsvHelper"],"sources":["../src/commands/consent/upload-data-flows-from-csv/impl.ts"],"sourcesContent":["import { ConsentTrackerStatus } from '@transcend-io/privacy-types';\n\nimport type { LocalContext } from '../../../context.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { uploadDataFlowsFromCsv as uploadDataFlowsFromCsvHelper } from '../../../lib/consent-manager/index.js';\n\nexport interface UploadDataFlowsFromCsvCommandFlags {\n auth: string;\n trackerStatus: ConsentTrackerStatus;\n file: string;\n classifyService: boolean;\n transcendUrl: string;\n}\n\nexport async function uploadDataFlowsFromCsv(\n this: LocalContext,\n { auth, trackerStatus, file, classifyService, transcendUrl }: UploadDataFlowsFromCsvCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n await uploadDataFlowsFromCsvHelper({\n auth,\n trackerStatus,\n file,\n classifyService,\n transcendUrl,\n });\n}\n"],"mappings":"8GAcA,eAAsB,EAEpB,CAAE,OAAM,gBAAe,OAAM,kBAAiB,gBAC/B,CACf,EAAoB,KAAK,QAAQ,KAAK,CAEtC,MAAMA,EAA6B,CACjC,OACA,gBACA,OACA,kBACA,eACD,CAAC"}
@@ -1,2 +1,2 @@
1
- import{t as e}from"./logger-Bj782ZYD.mjs";import{t}from"./done-input-validation-BcNBxhEs.mjs";import{n,t as r}from"./runOpa-CR5t23wR.mjs";import i from"node:path";import a from"colors";async function o({dir:o}){t(this.process.exit),n();let s=i.resolve(o);e.info(a.green(`Linting policy bundle in ${s}...`));let c=await r([`check`,`--strict`,s]);c!==0&&this.process.exit(c);let l=await r([`fmt`,`--diff`,s]);l!==0&&(e.error(a.red("Policy files are not formatted. Run `opa fmt -w` to fix.")),this.process.exit(l)),e.info(a.green(`Policy lint passed.`))}export{o as lint};
2
- //# sourceMappingURL=impl-D0ox6bF2.mjs.map
1
+ import{t as e}from"./logger-B-LXIf3U.mjs";import{t}from"./done-input-validation-9r-9VL6r.mjs";import{n,t as r}from"./runOpa-Cbh5ktOh.mjs";import i from"node:path";import a from"colors";async function o({dir:o}){t(this.process.exit),n();let s=i.resolve(o);e.info(a.green(`Linting policy bundle in ${s}...`));let c=await r([`check`,`--strict`,s]);c!==0&&this.process.exit(c);let l=await r([`fmt`,`--diff`,s]);l!==0&&(e.error(a.red("Policy files are not formatted. Run `opa fmt -w` to fix.")),this.process.exit(l)),e.info(a.green(`Policy lint passed.`))}export{o as lint};
2
+ //# sourceMappingURL=impl-DfxHCJfb.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"impl-D0ox6bF2.mjs","names":[],"sources":["../src/commands/policy/lint/impl.ts"],"sourcesContent":["import path from 'node:path';\n\nimport colors from 'colors';\n\nimport type { LocalContext } from '../../../context.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { logger } from '../../../logger.js';\nimport { assertOpaInstalled, runOpa } from '../helpers/index.js';\n\n/** CLI flags for `transcend policy lint`. */\nexport interface LintCommandFlags {\n /** Directory containing Rego policy files */\n dir: string;\n}\n\n/**\n * Local Rego lint and format check via `opa check` and `opa fmt --diff`.\n *\n * @param this - CLI context\n * @param flags - Command flags\n */\nexport async function lint(this: LocalContext, { dir }: LintCommandFlags): Promise<void> {\n doneInputValidation(this.process.exit);\n\n assertOpaInstalled();\n const resolvedDir = path.resolve(dir);\n\n logger.info(colors.green(`Linting policy bundle in ${resolvedDir}...`));\n\n const checkCode = await runOpa(['check', '--strict', resolvedDir]);\n if (checkCode !== 0) {\n this.process.exit(checkCode);\n }\n\n const fmtCode = await runOpa(['fmt', '--diff', resolvedDir]);\n if (fmtCode !== 0) {\n logger.error(colors.red('Policy files are not formatted. Run `opa fmt -w` to fix.'));\n this.process.exit(fmtCode);\n }\n\n logger.info(colors.green('Policy lint passed.'));\n}\n"],"mappings":"yLAqBA,eAAsB,EAAyB,CAAE,OAAwC,CACvF,EAAoB,KAAK,QAAQ,KAAK,CAEtC,GAAoB,CACpB,IAAM,EAAc,EAAK,QAAQ,EAAI,CAErC,EAAO,KAAK,EAAO,MAAM,4BAA4B,EAAY,KAAK,CAAC,CAEvE,IAAM,EAAY,MAAM,EAAO,CAAC,QAAS,WAAY,EAAY,CAAC,CAC9D,IAAc,GAChB,KAAK,QAAQ,KAAK,EAAU,CAG9B,IAAM,EAAU,MAAM,EAAO,CAAC,MAAO,SAAU,EAAY,CAAC,CACxD,IAAY,IACd,EAAO,MAAM,EAAO,IAAI,2DAA2D,CAAC,CACpF,KAAK,QAAQ,KAAK,EAAQ,EAG5B,EAAO,KAAK,EAAO,MAAM,sBAAsB,CAAC"}
1
+ {"version":3,"file":"impl-DfxHCJfb.mjs","names":[],"sources":["../src/commands/policy/lint/impl.ts"],"sourcesContent":["import path from 'node:path';\n\nimport colors from 'colors';\n\nimport type { LocalContext } from '../../../context.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { logger } from '../../../logger.js';\nimport { assertOpaInstalled, runOpa } from '../helpers/index.js';\n\n/** CLI flags for `transcend policy lint`. */\nexport interface LintCommandFlags {\n /** Directory containing Rego policy files */\n dir: string;\n}\n\n/**\n * Local Rego lint and format check via `opa check` and `opa fmt --diff`.\n *\n * @param this - CLI context\n * @param flags - Command flags\n */\nexport async function lint(this: LocalContext, { dir }: LintCommandFlags): Promise<void> {\n doneInputValidation(this.process.exit);\n\n assertOpaInstalled();\n const resolvedDir = path.resolve(dir);\n\n logger.info(colors.green(`Linting policy bundle in ${resolvedDir}...`));\n\n const checkCode = await runOpa(['check', '--strict', resolvedDir]);\n if (checkCode !== 0) {\n this.process.exit(checkCode);\n }\n\n const fmtCode = await runOpa(['fmt', '--diff', resolvedDir]);\n if (fmtCode !== 0) {\n logger.error(colors.red('Policy files are not formatted. Run `opa fmt -w` to fix.'));\n this.process.exit(fmtCode);\n }\n\n logger.info(colors.green('Policy lint passed.'));\n}\n"],"mappings":"yLAqBA,eAAsB,EAAyB,CAAE,OAAwC,CACvF,EAAoB,KAAK,QAAQ,KAAK,CAEtC,GAAoB,CACpB,IAAM,EAAc,EAAK,QAAQ,EAAI,CAErC,EAAO,KAAK,EAAO,MAAM,4BAA4B,EAAY,KAAK,CAAC,CAEvE,IAAM,EAAY,MAAM,EAAO,CAAC,QAAS,WAAY,EAAY,CAAC,CAC9D,IAAc,GAChB,KAAK,QAAQ,KAAK,EAAU,CAG9B,IAAM,EAAU,MAAM,EAAO,CAAC,MAAO,SAAU,EAAY,CAAC,CACxD,IAAY,IACd,EAAO,MAAM,EAAO,IAAI,2DAA2D,CAAC,CACpF,KAAK,QAAQ,KAAK,EAAQ,EAG5B,EAAO,KAAK,EAAO,MAAM,sBAAsB,CAAC"}
@@ -1,2 +1,2 @@
1
- import{t as e}from"./logger-Bj782ZYD.mjs";import{a as t,r as n}from"./readTranscendYaml-CGb2UUyM.mjs";import{t as r}from"./consentManagersToBusinessEntities-BdKDganK.mjs";import{t as i}from"./listFiles-D2wMHnEr.mjs";import{t as a}from"./done-input-validation-BcNBxhEs.mjs";import{existsSync as o,lstatSync as s}from"node:fs";import{join as c}from"node:path";import l from"colors";function u({consentManagerYmlFolder:u,output:d}){a(this.process.exit),(!o(u)||!s(u).isDirectory())&&(e.error(l.red(`Folder does not exist: "${u}"`)),this.process.exit(1));let f=r(i(u).map(e=>{let{"consent-manager":t}=n(c(u,e));return{name:e,input:t}}));t(d,{"business-entities":f}),e.info(l.green(`Successfully wrote ${f.length} business entities to file "${d}"`))}export{u as consentManagersToBusinessEntities};
2
- //# sourceMappingURL=impl-Dm6ITkBn.mjs.map
1
+ import{t as e}from"./logger-B-LXIf3U.mjs";import{a as t,r as n}from"./readTranscendYaml-DnvxeV7w.mjs";import{t as r}from"./consentManagersToBusinessEntities-C95GQMxK.mjs";import{t as i}from"./listFiles-oqwR2oZ4.mjs";import{t as a}from"./done-input-validation-9r-9VL6r.mjs";import{existsSync as o,lstatSync as s}from"node:fs";import{join as c}from"node:path";import l from"colors";function u({consentManagerYmlFolder:u,output:d}){a(this.process.exit),(!o(u)||!s(u).isDirectory())&&(e.error(l.red(`Folder does not exist: "${u}"`)),this.process.exit(1));let f=r(i(u).map(e=>{let{"consent-manager":t}=n(c(u,e));return{name:e,input:t}}));t(d,{"business-entities":f}),e.info(l.green(`Successfully wrote ${f.length} business entities to file "${d}"`))}export{u as consentManagersToBusinessEntities};
2
+ //# sourceMappingURL=impl-E_iiNVwN.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"impl-Dm6ITkBn.mjs","names":["consentManagersToBusinessEntitiesHelper"],"sources":["../src/commands/inventory/consent-managers-to-business-entities/impl.ts"],"sourcesContent":["import { existsSync, lstatSync } from 'node:fs';\nimport { join } from 'node:path';\n\nimport colors from 'colors';\n\nimport type { LocalContext } from '../../../context.js';\nimport { listFiles } from '../../../lib/api-keys/index.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { consentManagersToBusinessEntities as consentManagersToBusinessEntitiesHelper } from '../../../lib/consent-manager/index.js';\nimport { readTranscendYaml, writeTranscendYaml } from '../../../lib/readTranscendYaml.js';\nimport { logger } from '../../../logger.js';\n\nexport interface ConsentManagersToBusinessEntitiesCommandFlags {\n consentManagerYmlFolder: string;\n output: string;\n}\n\nexport function consentManagersToBusinessEntities(\n this: LocalContext,\n { consentManagerYmlFolder, output }: ConsentManagersToBusinessEntitiesCommandFlags,\n): void {\n doneInputValidation(this.process.exit);\n\n // Ensure folder is passed\n if (!existsSync(consentManagerYmlFolder) || !lstatSync(consentManagerYmlFolder).isDirectory()) {\n logger.error(colors.red(`Folder does not exist: \"${consentManagerYmlFolder}\"`));\n this.process.exit(1);\n }\n\n // Read in each consent manager configuration\n const inputs = listFiles(consentManagerYmlFolder).map((directory) => {\n const { 'consent-manager': consentManager } = readTranscendYaml(\n join(consentManagerYmlFolder, directory),\n );\n return { name: directory, input: consentManager };\n });\n\n // Convert to business entities\n const businessEntities = consentManagersToBusinessEntitiesHelper(inputs);\n\n // write to disk\n writeTranscendYaml(output, {\n 'business-entities': businessEntities,\n });\n\n logger.info(\n colors.green(\n `Successfully wrote ${businessEntities.length} business entities to file \"${output}\"`,\n ),\n );\n}\n"],"mappings":"4XAiBA,SAAgB,EAEd,CAAE,0BAAyB,UACrB,CACN,EAAoB,KAAK,QAAQ,KAAK,EAGlC,CAAC,EAAW,EAAwB,EAAI,CAAC,EAAU,EAAwB,CAAC,aAAa,IAC3F,EAAO,MAAM,EAAO,IAAI,2BAA2B,EAAwB,GAAG,CAAC,CAC/E,KAAK,QAAQ,KAAK,EAAE,EAYtB,IAAM,EAAmBA,EARV,EAAU,EAAwB,CAAC,IAAK,GAAc,CACnE,GAAM,CAAE,kBAAmB,GAAmB,EAC5C,EAAK,EAAyB,EAAU,CACzC,CACD,MAAO,CAAE,KAAM,EAAW,MAAO,EAAgB,EAIoB,CAAC,CAGxE,EAAmB,EAAQ,CACzB,oBAAqB,EACtB,CAAC,CAEF,EAAO,KACL,EAAO,MACL,sBAAsB,EAAiB,OAAO,8BAA8B,EAAO,GACpF,CACF"}
1
+ {"version":3,"file":"impl-E_iiNVwN.mjs","names":["consentManagersToBusinessEntitiesHelper"],"sources":["../src/commands/inventory/consent-managers-to-business-entities/impl.ts"],"sourcesContent":["import { existsSync, lstatSync } from 'node:fs';\nimport { join } from 'node:path';\n\nimport colors from 'colors';\n\nimport type { LocalContext } from '../../../context.js';\nimport { listFiles } from '../../../lib/api-keys/index.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { consentManagersToBusinessEntities as consentManagersToBusinessEntitiesHelper } from '../../../lib/consent-manager/index.js';\nimport { readTranscendYaml, writeTranscendYaml } from '../../../lib/readTranscendYaml.js';\nimport { logger } from '../../../logger.js';\n\nexport interface ConsentManagersToBusinessEntitiesCommandFlags {\n consentManagerYmlFolder: string;\n output: string;\n}\n\nexport function consentManagersToBusinessEntities(\n this: LocalContext,\n { consentManagerYmlFolder, output }: ConsentManagersToBusinessEntitiesCommandFlags,\n): void {\n doneInputValidation(this.process.exit);\n\n // Ensure folder is passed\n if (!existsSync(consentManagerYmlFolder) || !lstatSync(consentManagerYmlFolder).isDirectory()) {\n logger.error(colors.red(`Folder does not exist: \"${consentManagerYmlFolder}\"`));\n this.process.exit(1);\n }\n\n // Read in each consent manager configuration\n const inputs = listFiles(consentManagerYmlFolder).map((directory) => {\n const { 'consent-manager': consentManager } = readTranscendYaml(\n join(consentManagerYmlFolder, directory),\n );\n return { name: directory, input: consentManager };\n });\n\n // Convert to business entities\n const businessEntities = consentManagersToBusinessEntitiesHelper(inputs);\n\n // write to disk\n writeTranscendYaml(output, {\n 'business-entities': businessEntities,\n });\n\n logger.info(\n colors.green(\n `Successfully wrote ${businessEntities.length} business entities to file \"${output}\"`,\n ),\n );\n}\n"],"mappings":"4XAiBA,SAAgB,EAEd,CAAE,0BAAyB,UACrB,CACN,EAAoB,KAAK,QAAQ,KAAK,EAGlC,CAAC,EAAW,EAAwB,EAAI,CAAC,EAAU,EAAwB,CAAC,aAAa,IAC3F,EAAO,MAAM,EAAO,IAAI,2BAA2B,EAAwB,GAAG,CAAC,CAC/E,KAAK,QAAQ,KAAK,EAAE,EAYtB,IAAM,EAAmBA,EARV,EAAU,EAAwB,CAAC,IAAK,GAAc,CACnE,GAAM,CAAE,kBAAmB,GAAmB,EAC5C,EAAK,EAAyB,EAAU,CACzC,CACD,MAAO,CAAE,KAAM,EAAW,MAAO,EAAgB,EAIoB,CAAC,CAGxE,EAAmB,EAAQ,CACzB,oBAAqB,EACtB,CAAC,CAEF,EAAO,KACL,EAAO,MACL,sBAAsB,EAAiB,OAAO,8BAA8B,EAAO,GACpF,CACF"}
@@ -1,2 +1,2 @@
1
- import{t as e}from"./downloadPrivacyRequestFiles-HjCf3aC8.mjs";import{t}from"./done-input-validation-BcNBxhEs.mjs";import{RequestStatus as n}from"@transcend-io/privacy-types";async function r({auth:r,transcendUrl:i,folderPath:a,requestIds:o,statuses:s=[n.Approving,n.Downloadable],concurrency:c,createdAtBefore:l,createdAtAfter:u,updatedAtBefore:d,updatedAtAfter:f,approveAfterDownload:p}){t(this.process.exit),await e({transcendUrl:i,auth:r,folderPath:a,requestIds:o,statuses:s,concurrency:c,createdAtBefore:l,createdAtAfter:u,updatedAtBefore:d,updatedAtAfter:f,approveAfterDownload:p})}export{r as downloadFiles};
2
- //# sourceMappingURL=impl-CDoq18kF.mjs.map
1
+ import{t as e}from"./downloadPrivacyRequestFiles-BY_6MMoZ.mjs";import{t}from"./done-input-validation-9r-9VL6r.mjs";import{RequestStatus as n}from"@transcend-io/privacy-types";async function r({auth:r,transcendUrl:i,folderPath:a,requestIds:o,statuses:s=[n.Approving,n.Downloadable],concurrency:c,createdAtBefore:l,createdAtAfter:u,updatedAtBefore:d,updatedAtAfter:f,approveAfterDownload:p}){t(this.process.exit),await e({transcendUrl:i,auth:r,folderPath:a,requestIds:o,statuses:s,concurrency:c,createdAtBefore:l,createdAtAfter:u,updatedAtBefore:d,updatedAtAfter:f,approveAfterDownload:p})}export{r as downloadFiles};
2
+ //# sourceMappingURL=impl-GjQ_LTsa.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"impl-CDoq18kF.mjs","names":[],"sources":["../src/commands/request/download-files/impl.ts"],"sourcesContent":["import { RequestStatus } from '@transcend-io/privacy-types';\n\nimport type { LocalContext } from '../../../context.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { downloadPrivacyRequestFiles } from '../../../lib/requests/index.js';\n\nexport interface DownloadFilesCommandFlags {\n auth: string;\n sombraAuth?: string;\n concurrency: number;\n requestIds?: string[];\n statuses?: RequestStatus[];\n folderPath: string;\n createdAtBefore?: Date;\n createdAtAfter?: Date;\n updatedAtBefore?: Date;\n updatedAtAfter?: Date;\n approveAfterDownload: boolean;\n transcendUrl: string;\n}\n\nexport async function downloadFiles(\n this: LocalContext,\n {\n auth,\n transcendUrl,\n folderPath,\n requestIds,\n statuses = [RequestStatus.Approving, RequestStatus.Downloadable],\n concurrency,\n createdAtBefore,\n createdAtAfter,\n updatedAtBefore,\n updatedAtAfter,\n approveAfterDownload,\n }: DownloadFilesCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n await downloadPrivacyRequestFiles({\n transcendUrl,\n auth,\n folderPath,\n requestIds,\n statuses,\n concurrency,\n createdAtBefore,\n createdAtAfter,\n updatedAtBefore,\n updatedAtAfter,\n approveAfterDownload,\n });\n}\n"],"mappings":"+KAqBA,eAAsB,EAEpB,CACE,OACA,eACA,aACA,aACA,WAAW,CAAC,EAAc,UAAW,EAAc,aAAa,CAChE,cACA,kBACA,iBACA,kBACA,iBACA,wBAEa,CACf,EAAoB,KAAK,QAAQ,KAAK,CAEtC,MAAM,EAA4B,CAChC,eACA,OACA,aACA,aACA,WACA,cACA,kBACA,iBACA,kBACA,iBACA,uBACD,CAAC"}
1
+ {"version":3,"file":"impl-GjQ_LTsa.mjs","names":[],"sources":["../src/commands/request/download-files/impl.ts"],"sourcesContent":["import { RequestStatus } from '@transcend-io/privacy-types';\n\nimport type { LocalContext } from '../../../context.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { downloadPrivacyRequestFiles } from '../../../lib/requests/index.js';\n\nexport interface DownloadFilesCommandFlags {\n auth: string;\n sombraAuth?: string;\n concurrency: number;\n requestIds?: string[];\n statuses?: RequestStatus[];\n folderPath: string;\n createdAtBefore?: Date;\n createdAtAfter?: Date;\n updatedAtBefore?: Date;\n updatedAtAfter?: Date;\n approveAfterDownload: boolean;\n transcendUrl: string;\n}\n\nexport async function downloadFiles(\n this: LocalContext,\n {\n auth,\n transcendUrl,\n folderPath,\n requestIds,\n statuses = [RequestStatus.Approving, RequestStatus.Downloadable],\n concurrency,\n createdAtBefore,\n createdAtAfter,\n updatedAtBefore,\n updatedAtAfter,\n approveAfterDownload,\n }: DownloadFilesCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n await downloadPrivacyRequestFiles({\n transcendUrl,\n auth,\n folderPath,\n requestIds,\n statuses,\n concurrency,\n createdAtBefore,\n createdAtAfter,\n updatedAtBefore,\n updatedAtAfter,\n approveAfterDownload,\n });\n}\n"],"mappings":"+KAqBA,eAAsB,EAEpB,CACE,OACA,eACA,aACA,aACA,WAAW,CAAC,EAAc,UAAW,EAAc,aAAa,CAChE,cACA,kBACA,iBACA,kBACA,iBACA,wBAEa,CACf,EAAoB,KAAK,QAAQ,KAAK,CAEtC,MAAM,EAA4B,CAChC,eACA,OACA,aACA,aACA,WACA,cACA,kBACA,iBACA,kBACA,iBACA,uBACD,CAAC"}
@@ -1,4 +1,4 @@
1
- import{t as e}from"./constants-9AglpfjZ.mjs";import{t}from"./logger-Bj782ZYD.mjs";import{t as n}from"./done-input-validation-BcNBxhEs.mjs";import{n as r}from"./constants-BmwXDQu9.mjs";import i from"colors";import{buildTranscendGraphQLClient as a,fetchActiveSiloDiscoPlugin as o,uploadSiloDiscoveryResults as s}from"@transcend-io/sdk";import c from"fast-glob";import{stringify as l}from"query-string";async function u({scanPath:e,fileGlobs:n,ignoreDirs:r,config:i}){let{ignoreDirs:a,supportedFiles:o,scanFunction:s}=i,l=n===``?o:o.concat(n.split(`,`)),d=[...r.split(`,`),...a].filter(e=>e.length>0);try{let n=await c(`${e}/**/${l.join(`|`)}`,{ignore:d.map(t=>`${e}/**/${t}`),unique:!0,onlyFiles:!0});t.info(`Scanning: ${n.length} files`);let r=n.map(e=>s(e)).flat().map(e=>e.softwareDevelopmentKits||[]).flat(),i=[...new Set(r.map(e=>e.name))];return t.info(`Found: ${i.length} unique dependencies`),i.map(t=>({name:t,resourceId:`${e}/**/${t}`,useStrictClassifier:!0}))}catch(e){throw Error(`Error scanning globs ${u} with error: ${e}`)}}async function d({scanPath:c,dataSiloId:d,auth:f,fileGlobs:p,ignoreDirs:m,transcendUrl:h}){n(this.process.exit);let g=a(h,f),_=await o(g,{logger:t,filterBy:{dataSiloId:d}}),v=r[_.dataSilo.type];v||(t.error(i.red(`This plugin "${_.dataSilo.type}" is not supported for offline silo discovery.`)),this.process.exit(1));let y=await u({scanPath:c,fileGlobs:p,ignoreDirs:m,config:v});await s(g,{pluginId:_.id,results:y,logger:t});let b=new URL(e);b.pathname=`/data-map/data-inventory/silo-discovery/triage`,b.search=l({filters:JSON.stringify({pluginIds:[_.id]})}),t.info(i.green(`Scan found ${y.length} potential data silos at ${c}! View at '${b.href}'
1
+ import{t as e}from"./constants-FP8lxFg5.mjs";import{t}from"./logger-B-LXIf3U.mjs";import{t as n}from"./done-input-validation-9r-9VL6r.mjs";import{n as r}from"./constants-xRJ7Twuw.mjs";import i from"colors";import{buildTranscendGraphQLClient as a,fetchActiveSiloDiscoPlugin as o,uploadSiloDiscoveryResults as s}from"@transcend-io/sdk";import c from"fast-glob";import{stringify as l}from"query-string";async function u({scanPath:e,fileGlobs:n,ignoreDirs:r,config:i}){let{ignoreDirs:a,supportedFiles:o,scanFunction:s}=i,l=n===``?o:o.concat(n.split(`,`)),d=[...r.split(`,`),...a].filter(e=>e.length>0);try{let n=await c(`${e}/**/${l.join(`|`)}`,{ignore:d.map(t=>`${e}/**/${t}`),unique:!0,onlyFiles:!0});t.info(`Scanning: ${n.length} files`);let r=n.map(e=>s(e)).flat().map(e=>e.softwareDevelopmentKits||[]).flat(),i=[...new Set(r.map(e=>e.name))];return t.info(`Found: ${i.length} unique dependencies`),i.map(t=>({name:t,resourceId:`${e}/**/${t}`,useStrictClassifier:!0}))}catch(e){throw Error(`Error scanning globs ${u} with error: ${e}`)}}async function d({scanPath:c,dataSiloId:d,auth:f,fileGlobs:p,ignoreDirs:m,transcendUrl:h}){n(this.process.exit);let g=a(h,f),_=await o(g,{logger:t,filterBy:{dataSiloId:d}}),v=r[_.dataSilo.type];v||(t.error(i.red(`This plugin "${_.dataSilo.type}" is not supported for offline silo discovery.`)),this.process.exit(1));let y=await u({scanPath:c,fileGlobs:p,ignoreDirs:m,config:v});await s(g,{pluginId:_.id,results:y,logger:t});let b=new URL(e);b.pathname=`/data-map/data-inventory/silo-discovery/triage`,b.search=l({filters:JSON.stringify({pluginIds:[_.id]})}),t.info(i.green(`Scan found ${y.length} potential data silos at ${c}! View at '${b.href}'
2
2
 
3
3
  NOTE: it may take 2-3 minutes for scan results to appear in the UI.`))}export{d as discoverSilos};
4
- //# sourceMappingURL=impl-BKYnyVYM.mjs.map
4
+ //# sourceMappingURL=impl-IgBneuQ8.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"impl-BKYnyVYM.mjs","names":[],"sources":["../src/lib/code-scanning/findFilesToScan.ts","../src/commands/inventory/discover-silos/impl.ts"],"sourcesContent":["import fastGlob from 'fast-glob';\n\nimport { logger } from '../../logger.js';\nimport { CodeScanningConfig } from './types.js';\n\nexport interface SiloDiscoveryRawResults {\n /** The name of the potential data silo entry */\n name: string;\n /** A unique UUID (represents the same resource across different silo discovery runs) */\n resourceId: string;\n /** Any hosts associated with the entry */\n host?: string;\n /** Type of data silo */\n type?: string | undefined;\n}\n\n/**\n * Helper to scan for data silos in all package.json files that it can find in a directory\n *\n * @deprecated TODO: https://transcend.height.app/T-32325 - use code scanning instead\n * @param options - Options\n * @returns the list of integrations\n */\nexport async function findFilesToScan({\n scanPath,\n fileGlobs,\n ignoreDirs,\n config,\n}: {\n /** Where to look for package.json files */\n scanPath: string;\n /** Globs to look for */\n fileGlobs: string;\n /** The directories to ignore (excludes node_modules and serverless-build) */\n ignoreDirs: string;\n /** Silo Discovery configuration */\n config: CodeScanningConfig;\n}): Promise<SiloDiscoveryRawResults[]> {\n const { ignoreDirs: IGNORE_DIRS, supportedFiles, scanFunction } = config;\n const globsToSupport =\n fileGlobs === '' ? supportedFiles : supportedFiles.concat(fileGlobs.split(','));\n const dirsToIgnore = [...ignoreDirs.split(','), ...IGNORE_DIRS].filter((dir) => dir.length > 0);\n try {\n const filesToScan: string[] = await fastGlob(`${scanPath}/**/${globsToSupport.join('|')}`, {\n ignore: dirsToIgnore.map((dir: string) => `${scanPath}/**/${dir}`),\n unique: true,\n onlyFiles: true,\n });\n logger.info(`Scanning: ${filesToScan.length} files`);\n const allPackages = filesToScan.map((filePath: string) => scanFunction(filePath)).flat();\n const allSdks = allPackages\n .map((appPackage) => appPackage.softwareDevelopmentKits || [])\n .flat();\n const uniqueDeps = new Set(allSdks.map((sdk) => sdk.name));\n const deps = [...uniqueDeps];\n logger.info(`Found: ${deps.length} unique dependencies`);\n return deps.map((dep) => ({\n name: dep,\n resourceId: `${scanPath}/**/${dep}`,\n useStrictClassifier: true,\n }));\n } catch (error) {\n throw new Error(`Error scanning globs ${findFilesToScan} with error: ${error}`);\n }\n}\n","import {\n buildTranscendGraphQLClient,\n fetchActiveSiloDiscoPlugin,\n uploadSiloDiscoveryResults,\n} from '@transcend-io/sdk';\nimport colors from 'colors';\nimport { stringify } from 'query-string';\n\nimport { ADMIN_DASH } from '../../../constants.js';\nimport type { LocalContext } from '../../../context.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { findFilesToScan } from '../../../lib/code-scanning/findFilesToScan.js';\nimport { SILO_DISCOVERY_CONFIGS } from '../../../lib/code-scanning/index.js';\nimport { logger } from '../../../logger.js';\n\nexport interface DiscoverSilosCommandFlags {\n scanPath: string;\n dataSiloId: string;\n auth: string;\n fileGlobs: string;\n ignoreDirs: string;\n transcendUrl: string;\n}\n\nexport async function discoverSilos(\n this: LocalContext,\n { scanPath, dataSiloId, auth, fileGlobs, ignoreDirs, transcendUrl }: DiscoverSilosCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n // Create a GraphQL client\n const client = buildTranscendGraphQLClient(transcendUrl, auth);\n\n const plugin = await fetchActiveSiloDiscoPlugin(client, {\n logger,\n filterBy: { dataSiloId },\n });\n\n const config = SILO_DISCOVERY_CONFIGS[plugin.dataSilo.type];\n if (!config) {\n logger.error(\n colors.red(\n `This plugin \"${plugin.dataSilo.type}\" is not supported for offline silo discovery.`,\n ),\n );\n this.process.exit(1);\n }\n\n const results = await findFilesToScan({\n scanPath,\n fileGlobs,\n ignoreDirs,\n config,\n });\n\n await uploadSiloDiscoveryResults(client, {\n pluginId: plugin.id,\n results,\n logger,\n });\n\n const newUrl = new URL(ADMIN_DASH);\n newUrl.pathname = '/data-map/data-inventory/silo-discovery/triage';\n newUrl.search = stringify({\n filters: JSON.stringify({ pluginIds: [plugin.id] }),\n });\n\n // Indicate success\n logger.info(\n colors.green(\n `Scan found ${results.length} potential data silos at ${scanPath}! ` +\n `View at '${newUrl.href}' ` +\n '\\n\\n NOTE: it may take 2-3 minutes for scan results to appear in the UI.',\n ),\n );\n}\n"],"mappings":"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,EAGtB,IAAM,EAAU,MAAM,EAAgB,CACpC,WACA,YACA,aACA,SACD,CAAC,CAEF,MAAM,EAA2B,EAAQ,CACvC,SAAU,EAAO,GACjB,UACA,SACD,CAAC,CAEF,IAAM,EAAS,IAAI,IAAI,EAAW,CAClC,EAAO,SAAW,iDAClB,EAAO,OAAS,EAAU,CACxB,QAAS,KAAK,UAAU,CAAE,UAAW,CAAC,EAAO,GAAG,CAAE,CAAC,CACpD,CAAC,CAGF,EAAO,KACL,EAAO,MACL,cAAc,EAAQ,OAAO,2BAA2B,EAAS,aACnD,EAAO,KAAK;;sEAE3B,CACF"}
1
+ {"version":3,"file":"impl-IgBneuQ8.mjs","names":[],"sources":["../src/lib/code-scanning/findFilesToScan.ts","../src/commands/inventory/discover-silos/impl.ts"],"sourcesContent":["import fastGlob from 'fast-glob';\n\nimport { logger } from '../../logger.js';\nimport { CodeScanningConfig } from './types.js';\n\nexport interface SiloDiscoveryRawResults {\n /** The name of the potential data silo entry */\n name: string;\n /** A unique UUID (represents the same resource across different silo discovery runs) */\n resourceId: string;\n /** Any hosts associated with the entry */\n host?: string;\n /** Type of data silo */\n type?: string | undefined;\n}\n\n/**\n * Helper to scan for data silos in all package.json files that it can find in a directory\n *\n * @deprecated TODO: https://transcend.height.app/T-32325 - use code scanning instead\n * @param options - Options\n * @returns the list of integrations\n */\nexport async function findFilesToScan({\n scanPath,\n fileGlobs,\n ignoreDirs,\n config,\n}: {\n /** Where to look for package.json files */\n scanPath: string;\n /** Globs to look for */\n fileGlobs: string;\n /** The directories to ignore (excludes node_modules and serverless-build) */\n ignoreDirs: string;\n /** Silo Discovery configuration */\n config: CodeScanningConfig;\n}): Promise<SiloDiscoveryRawResults[]> {\n const { ignoreDirs: IGNORE_DIRS, supportedFiles, scanFunction } = config;\n const globsToSupport =\n fileGlobs === '' ? supportedFiles : supportedFiles.concat(fileGlobs.split(','));\n const dirsToIgnore = [...ignoreDirs.split(','), ...IGNORE_DIRS].filter((dir) => dir.length > 0);\n try {\n const filesToScan: string[] = await fastGlob(`${scanPath}/**/${globsToSupport.join('|')}`, {\n ignore: dirsToIgnore.map((dir: string) => `${scanPath}/**/${dir}`),\n unique: true,\n onlyFiles: true,\n });\n logger.info(`Scanning: ${filesToScan.length} files`);\n const allPackages = filesToScan.map((filePath: string) => scanFunction(filePath)).flat();\n const allSdks = allPackages\n .map((appPackage) => appPackage.softwareDevelopmentKits || [])\n .flat();\n const uniqueDeps = new Set(allSdks.map((sdk) => sdk.name));\n const deps = [...uniqueDeps];\n logger.info(`Found: ${deps.length} unique dependencies`);\n return deps.map((dep) => ({\n name: dep,\n resourceId: `${scanPath}/**/${dep}`,\n useStrictClassifier: true,\n }));\n } catch (error) {\n throw new Error(`Error scanning globs ${findFilesToScan} with error: ${error}`);\n }\n}\n","import {\n buildTranscendGraphQLClient,\n fetchActiveSiloDiscoPlugin,\n uploadSiloDiscoveryResults,\n} from '@transcend-io/sdk';\nimport colors from 'colors';\nimport { stringify } from 'query-string';\n\nimport { ADMIN_DASH } from '../../../constants.js';\nimport type { LocalContext } from '../../../context.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { findFilesToScan } from '../../../lib/code-scanning/findFilesToScan.js';\nimport { SILO_DISCOVERY_CONFIGS } from '../../../lib/code-scanning/index.js';\nimport { logger } from '../../../logger.js';\n\nexport interface DiscoverSilosCommandFlags {\n scanPath: string;\n dataSiloId: string;\n auth: string;\n fileGlobs: string;\n ignoreDirs: string;\n transcendUrl: string;\n}\n\nexport async function discoverSilos(\n this: LocalContext,\n { scanPath, dataSiloId, auth, fileGlobs, ignoreDirs, transcendUrl }: DiscoverSilosCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n // Create a GraphQL client\n const client = buildTranscendGraphQLClient(transcendUrl, auth);\n\n const plugin = await fetchActiveSiloDiscoPlugin(client, {\n logger,\n filterBy: { dataSiloId },\n });\n\n const config = SILO_DISCOVERY_CONFIGS[plugin.dataSilo.type];\n if (!config) {\n logger.error(\n colors.red(\n `This plugin \"${plugin.dataSilo.type}\" is not supported for offline silo discovery.`,\n ),\n );\n this.process.exit(1);\n }\n\n const results = await findFilesToScan({\n scanPath,\n fileGlobs,\n ignoreDirs,\n config,\n });\n\n await uploadSiloDiscoveryResults(client, {\n pluginId: plugin.id,\n results,\n logger,\n });\n\n const newUrl = new URL(ADMIN_DASH);\n newUrl.pathname = '/data-map/data-inventory/silo-discovery/triage';\n newUrl.search = stringify({\n filters: JSON.stringify({ pluginIds: [plugin.id] }),\n });\n\n // Indicate success\n logger.info(\n colors.green(\n `Scan found ${results.length} potential data silos at ${scanPath}! ` +\n `View at '${newUrl.href}' ` +\n '\\n\\n NOTE: it may take 2-3 minutes for scan results to appear in the UI.',\n ),\n );\n}\n"],"mappings":"gZAuBA,eAAsB,EAAgB,CACpC,WACA,YACA,aACA,UAUqC,CACrC,GAAM,CAAE,WAAY,EAAa,iBAAgB,gBAAiB,EAC5D,EACJ,IAAc,GAAK,EAAiB,EAAe,OAAO,EAAU,MAAM,IAAI,CAAC,CAC3E,EAAe,CAAC,GAAG,EAAW,MAAM,IAAI,CAAE,GAAG,EAAY,CAAC,OAAQ,GAAQ,EAAI,OAAS,EAAE,CAC/F,GAAI,CACF,IAAM,EAAwB,MAAM,EAAS,GAAG,EAAS,MAAM,EAAe,KAAK,IAAI,GAAI,CACzF,OAAQ,EAAa,IAAK,GAAgB,GAAG,EAAS,MAAM,IAAM,CAClE,OAAQ,GACR,UAAW,GACZ,CAAC,CACF,EAAO,KAAK,aAAa,EAAY,OAAO,QAAQ,CAEpD,IAAM,EADc,EAAY,IAAK,GAAqB,EAAa,EAAS,CAAC,CAAC,MACvD,CACxB,IAAK,GAAe,EAAW,yBAA2B,EAAE,CAAC,CAC7D,MAAM,CAEH,EAAO,CAAC,GAAG,IADM,IAAI,EAAQ,IAAK,GAAQ,EAAI,KAAK,CAC9B,CAAC,CAE5B,OADA,EAAO,KAAK,UAAU,EAAK,OAAO,sBAAsB,CACjD,EAAK,IAAK,IAAS,CACxB,KAAM,EACN,WAAY,GAAG,EAAS,MAAM,IAC9B,oBAAqB,GACtB,EAAE,OACI,EAAO,CACd,MAAU,MAAM,wBAAwB,EAAgB,eAAe,IAAQ,ECtCnF,eAAsB,EAEpB,CAAE,WAAU,aAAY,OAAM,YAAW,aAAY,gBACtC,CACf,EAAoB,KAAK,QAAQ,KAAK,CAGtC,IAAM,EAAS,EAA4B,EAAc,EAAK,CAExD,EAAS,MAAM,EAA2B,EAAQ,CACtD,SACA,SAAU,CAAE,aAAY,CACzB,CAAC,CAEI,EAAS,EAAuB,EAAO,SAAS,MACjD,IACH,EAAO,MACL,EAAO,IACL,gBAAgB,EAAO,SAAS,KAAK,gDACtC,CACF,CACD,KAAK,QAAQ,KAAK,EAAE,EAGtB,IAAM,EAAU,MAAM,EAAgB,CACpC,WACA,YACA,aACA,SACD,CAAC,CAEF,MAAM,EAA2B,EAAQ,CACvC,SAAU,EAAO,GACjB,UACA,SACD,CAAC,CAEF,IAAM,EAAS,IAAI,IAAI,EAAW,CAClC,EAAO,SAAW,iDAClB,EAAO,OAAS,EAAU,CACxB,QAAS,KAAK,UAAU,CAAE,UAAW,CAAC,EAAO,GAAG,CAAE,CAAC,CACpD,CAAC,CAGF,EAAO,KACL,EAAO,MACL,cAAc,EAAQ,OAAO,2BAA2B,EAAS,aACnD,EAAO,KAAK;;sEAE3B,CACF"}
@@ -1,2 +1,2 @@
1
- import{n as e}from"./constants-9AglpfjZ.mjs";import{t}from"./logger-Bj782ZYD.mjs";import{s as n}from"./writeCsv-C4pjXGsD.mjs";import{t as r}from"./pullAllDatapoints-Bbmky50p.mjs";import{t as i}from"./done-input-validation-BcNBxhEs.mjs";import{groupBy as a,uniq as o}from"lodash-es";import s from"colors";import{buildTranscendGraphQLClient as c}from"@transcend-io/sdk";async function l({auth:l,file:u,transcendUrl:d,dataSiloIds:f,includeAttributes:p,includeGuessedCategories:m,parentCategories:h,subCategories:g=[]}){i(this.process.exit);try{let e=await r(c(d,l),{dataSiloIds:f,includeGuessedCategories:m,parentCategories:h,includeAttributes:p,subCategories:g});t.info(s.magenta(`Writing datapoints to file "${u}"...`));let i=[];await n(u,e.map(e=>{let t={"Property ID":e.id,"Data Silo":e.dataSilo.title,Object:e.dataPoint.name,"Object Path":e.dataPoint.path.join(`.`),Property:e.name,"Property Description":e.description,"Data Categories":e.categories.map(e=>`${e.category}:${e.name}`).join(`, `),"Guessed Category":e.pendingCategoryGuesses?.[0]?`${e.pendingCategoryGuesses[0].category.category}:${e.pendingCategoryGuesses[0].category.name}`:``,"Processing Purposes":e.purposes.map(e=>`${e.purpose}:${e.name}`).join(`, `),...Object.entries(a(e.attributeValues||[],({attributeKey:e})=>e.name)).reduce((e,[t,n])=>(e[t]=n.map(e=>e.name).join(`,`),e),{})};return i=o([...i,...Object.keys(t)]),t}),i)}catch(e){t.error(s.red(`An error occurred syncing the datapoints: ${e.message}`)),this.process.exit(1)}t.info(s.green(`Successfully synced datapoints to disk at ${u}! View at ${e}`))}export{l as pullDatapoints};
2
- //# sourceMappingURL=impl-RyGwqEe9.mjs.map
1
+ import{n as e}from"./constants-FP8lxFg5.mjs";import{t}from"./logger-B-LXIf3U.mjs";import{s as n}from"./writeCsv-CbT4a0uj.mjs";import{t as r}from"./pullAllDatapoints-49ZSGNFN.mjs";import{t as i}from"./done-input-validation-9r-9VL6r.mjs";import{groupBy as a,uniq as o}from"lodash-es";import s from"colors";import{buildTranscendGraphQLClient as c}from"@transcend-io/sdk";async function l({auth:l,file:u,transcendUrl:d,dataSiloIds:f,includeAttributes:p,includeGuessedCategories:m,parentCategories:h,subCategories:g=[]}){i(this.process.exit);try{let e=await r(c(d,l),{dataSiloIds:f,includeGuessedCategories:m,parentCategories:h,includeAttributes:p,subCategories:g});t.info(s.magenta(`Writing datapoints to file "${u}"...`));let i=[];await n(u,e.map(e=>{let t={"Property ID":e.id,"Data Silo":e.dataSilo.title,Object:e.dataPoint.name,"Object Path":e.dataPoint.path.join(`.`),Property:e.name,"Property Description":e.description,"Data Categories":e.categories.map(e=>`${e.category}:${e.name}`).join(`, `),"Guessed Category":e.pendingCategoryGuesses?.[0]?`${e.pendingCategoryGuesses[0].category.category}:${e.pendingCategoryGuesses[0].category.name}`:``,"Processing Purposes":e.purposes.map(e=>`${e.purpose}:${e.name}`).join(`, `),...Object.entries(a(e.attributeValues||[],({attributeKey:e})=>e.name)).reduce((e,[t,n])=>(e[t]=n.map(e=>e.name).join(`,`),e),{})};return i=o([...i,...Object.keys(t)]),t}),i)}catch(e){t.error(s.red(`An error occurred syncing the datapoints: ${e.message}`)),this.process.exit(1)}t.info(s.green(`Successfully synced datapoints to disk at ${u}! View at ${e}`))}export{l as pullDatapoints};
2
+ //# sourceMappingURL=impl-O5gKrwRH.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"impl-RyGwqEe9.mjs","names":[],"sources":["../src/commands/inventory/pull-datapoints/impl.ts"],"sourcesContent":["import { DataCategoryType } from '@transcend-io/privacy-types';\nimport { buildTranscendGraphQLClient } from '@transcend-io/sdk';\nimport colors from 'colors';\nimport { uniq, groupBy } from 'lodash-es';\n\nimport { ADMIN_DASH_DATAPOINTS } from '../../../constants.js';\nimport type { LocalContext } from '../../../context.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { pullAllDatapoints } from '../../../lib/data-inventory/index.js';\nimport { writeLargeCsv } from '../../../lib/helpers/index.js';\nimport { logger } from '../../../logger.js';\n\nexport interface PullDatapointsCommandFlags {\n auth: string;\n file: string;\n transcendUrl: string;\n dataSiloIds?: string[];\n includeAttributes: boolean;\n includeGuessedCategories: boolean;\n parentCategories?: DataCategoryType[];\n subCategories?: string[];\n}\n\nexport async function pullDatapoints(\n this: LocalContext,\n {\n auth,\n file,\n transcendUrl,\n dataSiloIds,\n includeAttributes,\n includeGuessedCategories,\n parentCategories,\n subCategories = [],\n }: PullDatapointsCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n try {\n // Create a GraphQL client\n const client = buildTranscendGraphQLClient(transcendUrl, auth);\n\n const dataPoints = await pullAllDatapoints(client, {\n dataSiloIds,\n includeGuessedCategories,\n parentCategories,\n includeAttributes,\n subCategories, // TODO: https://transcend.height.app/T-40482 - do by name not ID\n });\n\n logger.info(colors.magenta(`Writing datapoints to file \"${file}\"...`));\n let headers: string[] = [];\n const inputs = dataPoints.map((point) => {\n const result = {\n 'Property ID': point.id,\n 'Data Silo': point.dataSilo.title,\n Object: point.dataPoint.name,\n 'Object Path': point.dataPoint.path.join('.'),\n Property: point.name,\n 'Property Description': point.description,\n 'Data Categories': point.categories\n .map((category) => `${category.category}:${category.name}`)\n .join(', '),\n 'Guessed Category': point.pendingCategoryGuesses?.[0]\n ? `${point.pendingCategoryGuesses![0]!.category.category}:${\n point.pendingCategoryGuesses![0]!.category.name\n }`\n : '',\n 'Processing Purposes': point.purposes\n .map((purpose) => `${purpose.purpose}:${purpose.name}`)\n .join(', '),\n ...Object.entries(\n groupBy(point.attributeValues || [], ({ attributeKey }) => attributeKey.name),\n ).reduce(\n (acc, [key, values]) => {\n acc[key] = values.map((value) => value.name).join(',');\n return acc;\n },\n {} as Record<string, string>,\n ),\n };\n headers = uniq([...headers, ...Object.keys(result)]);\n return result;\n });\n await writeLargeCsv(file, inputs, headers);\n } catch (err) {\n logger.error(colors.red(`An error occurred syncing the datapoints: ${err.message}`));\n this.process.exit(1);\n }\n\n // Indicate success\n logger.info(\n colors.green(\n `Successfully synced datapoints to disk at ${file}! View at ${ADMIN_DASH_DATAPOINTS}`,\n ),\n );\n}\n"],"mappings":"gXAuBA,eAAsB,EAEpB,CACE,OACA,OACA,eACA,cACA,oBACA,2BACA,mBACA,gBAAgB,EAAE,EAEL,CACf,EAAoB,KAAK,QAAQ,KAAK,CAEtC,GAAI,CAIF,IAAM,EAAa,MAAM,EAFV,EAA4B,EAAc,EAER,CAAE,CACjD,cACA,2BACA,mBACA,oBACA,gBACD,CAAC,CAEF,EAAO,KAAK,EAAO,QAAQ,+BAA+B,EAAK,MAAM,CAAC,CACtE,IAAI,EAAoB,EAAE,CAiC1B,MAAM,EAAc,EAhCL,EAAW,IAAK,GAAU,CACvC,IAAM,EAAS,CACb,cAAe,EAAM,GACrB,YAAa,EAAM,SAAS,MAC5B,OAAQ,EAAM,UAAU,KACxB,cAAe,EAAM,UAAU,KAAK,KAAK,IAAI,CAC7C,SAAU,EAAM,KAChB,uBAAwB,EAAM,YAC9B,kBAAmB,EAAM,WACtB,IAAK,GAAa,GAAG,EAAS,SAAS,GAAG,EAAS,OAAO,CAC1D,KAAK,KAAK,CACb,mBAAoB,EAAM,yBAAyB,GAC/C,GAAG,EAAM,uBAAwB,GAAI,SAAS,SAAS,GACrD,EAAM,uBAAwB,GAAI,SAAS,OAE7C,GACJ,sBAAuB,EAAM,SAC1B,IAAK,GAAY,GAAG,EAAQ,QAAQ,GAAG,EAAQ,OAAO,CACtD,KAAK,KAAK,CACb,GAAG,OAAO,QACR,EAAQ,EAAM,iBAAmB,EAAE,EAAG,CAAE,kBAAmB,EAAa,KAAK,CAC9E,CAAC,QACC,EAAK,CAAC,EAAK,MACV,EAAI,GAAO,EAAO,IAAK,GAAU,EAAM,KAAK,CAAC,KAAK,IAAI,CAC/C,GAET,EAAE,CACH,CACF,CAED,MADA,GAAU,EAAK,CAAC,GAAG,EAAS,GAAG,OAAO,KAAK,EAAO,CAAC,CAAC,CAC7C,GAEuB,CAAE,EAAQ,OACnC,EAAK,CACZ,EAAO,MAAM,EAAO,IAAI,6CAA6C,EAAI,UAAU,CAAC,CACpF,KAAK,QAAQ,KAAK,EAAE,CAItB,EAAO,KACL,EAAO,MACL,6CAA6C,EAAK,YAAY,IAC/D,CACF"}
1
+ {"version":3,"file":"impl-O5gKrwRH.mjs","names":[],"sources":["../src/commands/inventory/pull-datapoints/impl.ts"],"sourcesContent":["import { DataCategoryType } from '@transcend-io/privacy-types';\nimport { buildTranscendGraphQLClient } from '@transcend-io/sdk';\nimport colors from 'colors';\nimport { uniq, groupBy } from 'lodash-es';\n\nimport { ADMIN_DASH_DATAPOINTS } from '../../../constants.js';\nimport type { LocalContext } from '../../../context.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { pullAllDatapoints } from '../../../lib/data-inventory/index.js';\nimport { writeLargeCsv } from '../../../lib/helpers/index.js';\nimport { logger } from '../../../logger.js';\n\nexport interface PullDatapointsCommandFlags {\n auth: string;\n file: string;\n transcendUrl: string;\n dataSiloIds?: string[];\n includeAttributes: boolean;\n includeGuessedCategories: boolean;\n parentCategories?: DataCategoryType[];\n subCategories?: string[];\n}\n\nexport async function pullDatapoints(\n this: LocalContext,\n {\n auth,\n file,\n transcendUrl,\n dataSiloIds,\n includeAttributes,\n includeGuessedCategories,\n parentCategories,\n subCategories = [],\n }: PullDatapointsCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n try {\n // Create a GraphQL client\n const client = buildTranscendGraphQLClient(transcendUrl, auth);\n\n const dataPoints = await pullAllDatapoints(client, {\n dataSiloIds,\n includeGuessedCategories,\n parentCategories,\n includeAttributes,\n subCategories, // TODO: https://transcend.height.app/T-40482 - do by name not ID\n });\n\n logger.info(colors.magenta(`Writing datapoints to file \"${file}\"...`));\n let headers: string[] = [];\n const inputs = dataPoints.map((point) => {\n const result = {\n 'Property ID': point.id,\n 'Data Silo': point.dataSilo.title,\n Object: point.dataPoint.name,\n 'Object Path': point.dataPoint.path.join('.'),\n Property: point.name,\n 'Property Description': point.description,\n 'Data Categories': point.categories\n .map((category) => `${category.category}:${category.name}`)\n .join(', '),\n 'Guessed Category': point.pendingCategoryGuesses?.[0]\n ? `${point.pendingCategoryGuesses![0]!.category.category}:${\n point.pendingCategoryGuesses![0]!.category.name\n }`\n : '',\n 'Processing Purposes': point.purposes\n .map((purpose) => `${purpose.purpose}:${purpose.name}`)\n .join(', '),\n ...Object.entries(\n groupBy(point.attributeValues || [], ({ attributeKey }) => attributeKey.name),\n ).reduce(\n (acc, [key, values]) => {\n acc[key] = values.map((value) => value.name).join(',');\n return acc;\n },\n {} as Record<string, string>,\n ),\n };\n headers = uniq([...headers, ...Object.keys(result)]);\n return result;\n });\n await writeLargeCsv(file, inputs, headers);\n } catch (err) {\n logger.error(colors.red(`An error occurred syncing the datapoints: ${err.message}`));\n this.process.exit(1);\n }\n\n // Indicate success\n logger.info(\n colors.green(\n `Successfully synced datapoints to disk at ${file}! View at ${ADMIN_DASH_DATAPOINTS}`,\n ),\n );\n}\n"],"mappings":"gXAuBA,eAAsB,EAEpB,CACE,OACA,OACA,eACA,cACA,oBACA,2BACA,mBACA,gBAAgB,EAAE,EAEL,CACf,EAAoB,KAAK,QAAQ,KAAK,CAEtC,GAAI,CAIF,IAAM,EAAa,MAAM,EAFV,EAA4B,EAAc,EAER,CAAE,CACjD,cACA,2BACA,mBACA,oBACA,gBACD,CAAC,CAEF,EAAO,KAAK,EAAO,QAAQ,+BAA+B,EAAK,MAAM,CAAC,CACtE,IAAI,EAAoB,EAAE,CAiC1B,MAAM,EAAc,EAhCL,EAAW,IAAK,GAAU,CACvC,IAAM,EAAS,CACb,cAAe,EAAM,GACrB,YAAa,EAAM,SAAS,MAC5B,OAAQ,EAAM,UAAU,KACxB,cAAe,EAAM,UAAU,KAAK,KAAK,IAAI,CAC7C,SAAU,EAAM,KAChB,uBAAwB,EAAM,YAC9B,kBAAmB,EAAM,WACtB,IAAK,GAAa,GAAG,EAAS,SAAS,GAAG,EAAS,OAAO,CAC1D,KAAK,KAAK,CACb,mBAAoB,EAAM,yBAAyB,GAC/C,GAAG,EAAM,uBAAwB,GAAI,SAAS,SAAS,GACrD,EAAM,uBAAwB,GAAI,SAAS,OAE7C,GACJ,sBAAuB,EAAM,SAC1B,IAAK,GAAY,GAAG,EAAQ,QAAQ,GAAG,EAAQ,OAAO,CACtD,KAAK,KAAK,CACb,GAAG,OAAO,QACR,EAAQ,EAAM,iBAAmB,EAAE,EAAG,CAAE,kBAAmB,EAAa,KAAK,CAC9E,CAAC,QACC,EAAK,CAAC,EAAK,MACV,EAAI,GAAO,EAAO,IAAK,GAAU,EAAM,KAAK,CAAC,KAAK,IAAI,CAC/C,GAET,EAAE,CACH,CACF,CAED,MADA,GAAU,EAAK,CAAC,GAAG,EAAS,GAAG,OAAO,KAAK,EAAO,CAAC,CAAC,CAC7C,GAEuB,CAAE,EAAQ,OACnC,EAAK,CACZ,EAAO,MAAM,EAAO,IAAI,6CAA6C,EAAI,UAAU,CAAC,CACpF,KAAK,QAAQ,KAAK,EAAE,CAItB,EAAO,KACL,EAAO,MACL,6CAA6C,EAAK,YAAY,IAC/D,CACF"}
@@ -1,4 +1,4 @@
1
- import"./enums-CyFTrzXY.mjs";import{t as e}from"./logger-Bj782ZYD.mjs";import{t}from"./done-input-validation-BcNBxhEs.mjs";import{OneTrustEnrichedAssessment as n,OneTrustGetAssessmentResponse as r,OneTrustGetListOfAssessmentsResponse as i,OneTrustGetRiskResponse as a,OneTrustGetUserResponse as o}from"@transcend-io/privacy-types";import{keyBy as s,uniq as c}from"lodash-es";import{decodeCodec as l}from"@transcend-io/type-utils";import u,{createReadStream as d}from"node:fs";import f from"colors";import{IMPORT_ONE_TRUST_ASSESSMENT_FORMS as p,buildTranscendGraphQLClient as m,makeGraphQLRequest as h}from"@transcend-io/sdk";import{map as g,mapSeries as _}from"@transcend-io/utils";import v from"JSONStream";import y from"got";const b=({assessment:e,index:t,total:n,wrap:r=!0})=>{let i=``;(t===0||r)&&(i=`[
1
+ import"./enums-CyFTrzXY.mjs";import{t as e}from"./logger-B-LXIf3U.mjs";import{t}from"./done-input-validation-9r-9VL6r.mjs";import{OneTrustEnrichedAssessment as n,OneTrustGetAssessmentResponse as r,OneTrustGetListOfAssessmentsResponse as i,OneTrustGetRiskResponse as a,OneTrustGetUserResponse as o}from"@transcend-io/privacy-types";import{keyBy as s,uniq as c}from"lodash-es";import{decodeCodec as l}from"@transcend-io/type-utils";import u,{createReadStream as d}from"node:fs";import f from"colors";import{IMPORT_ONE_TRUST_ASSESSMENT_FORMS as p,buildTranscendGraphQLClient as m,makeGraphQLRequest as h}from"@transcend-io/sdk";import{map as g,mapSeries as _}from"@transcend-io/utils";import v from"JSONStream";import y from"got";const b=({assessment:e,index:t,total:n,wrap:r=!0})=>{let i=``;(t===0||r)&&(i=`[
2
2
  `);let a=JSON.stringify(e),o=n&&t<n-1&&!r?`,`:``;return i=`${i+a+o}\n`,(n&&t===n-1||r)&&(i+=`
3
3
  ]`),i},x=({file:t,assessment:n,index:r,total:i})=>{e.info(f.magenta(`Writing enriched assessment ${r+1} of ${i} to file "${t}"...`)),r===0?u.writeFileSync(t,b({assessment:n,index:r,total:i,wrap:!1})):u.appendFileSync(t,b({assessment:n,index:r,total:i,wrap:!1}))},S=async({oneTrust:t})=>{let n=0,r=1,a=0,o=[];for(;n<r;){let{body:s}=await t.get(`api/assessment/v2/assessments?page=${n}&size=2000`),{page:c,content:u}=l(i,s);o.push(...u??[]),n===0&&(r=c?.totalPages??0,a=c?.totalElements??0),n+=1,e.info(`Fetched ${o.length} of ${a} assessments.`)}return o},C=async({oneTrust:e,assessmentId:t})=>{let{body:n}=await e.get(`api/assessment/v2/assessments/${t}/export?ExcludeSkippedQuestions=false`);return l(r,n)},w=async({oneTrust:e,riskId:t})=>{let{body:n}=await e.get(`api/risk/v2/risks/${t}`);return l(a,n)},T=async({oneTrust:e,userId:t})=>{let{body:n}=await e.get(`api/scim/v2/Users/${t}`);return l(o,n)},E=({assessment:e,assessmentDetails:t,riskDetails:n,creatorDetails:r,approversDetails:i,respondentsDetails:a})=>{let o=s(n,`id`),{sections:c,createdBy:l,...u}=t,d=c.map(e=>{let{questions:t,...n}=e,r=t.map(e=>{let{risks:t,...n}=e,r=(t??[]).map(e=>{let t=o[e.riskId];return{...e,...t,level:e.level,impactLevel:e.impactLevel??0}});return{...n,risks:r}});return{...n,questions:r}}),f={...l,active:r?.active??!1,userType:r?.userType??`Internal`,emails:r?.emails??[],title:r?.title??null,givenName:r?.name.givenName??null,familyName:r?.name.familyName??null},p=s(i,`id`),m=t.approvers.flatMap(e=>p[e.id]?[{...e,approver:{...e.approver,active:p[e.id].active,userType:p[e.id].userType,emails:p[e.id].emails,title:p[e.id].title,givenName:p[e.id].name.givenName??null,familyName:p[e.id].name.familyName??null}}]:[]),h=s(a,`id`),g=t.respondents.filter(e=>!e.name.includes(`@`)).flatMap(e=>h[e.id]?[{...e,active:h[e.id].active,userType:h[e.id].userType,emails:h[e.id].emails,title:h[e.id].title,givenName:h[e.id].name.givenName??null,familyName:h[e.id].name.familyName??null}]:[]);return{...e,...u,approvers:m,respondents:g,createdBy:f,sections:d}},D=async({transcend:t,assessment:n,total:r,index:i})=>{e.info(f.magenta(`Writing enriched assessment ${i+1} ${r?`of ${r} `:` `}to Transcend...`));let a={json:b({assessment:n,index:i,total:r})};try{await h(t,p,{variables:{input:a},logger:e})}catch(t){e.error(f.red(`Failed to sync assessment ${i+1} ${r?`of ${r} `:` `}to Transcend.\n\tAssessment Title: ${n.name}. Template Title: ${n.template.name}\n`),t)}},O=async({oneTrust:t,file:n,dryRun:r,transcend:i})=>{e.info(`Getting list of all assessments from OneTrust...`);let a=await S({oneTrust:t}),o={};await _(Array.from({length:Math.ceil(a.length/5)},(e,t)=>a.slice(t*5,(t+1)*5)),async(s,l)=>{let u=[];await g(s,async(n,r)=>{let i=5*l+r+1;e.info(`[assessment ${i} of ${a.length}]: fetching details...`);let{templateName:s,assessmentId:d}=n,p=await C({oneTrust:t,assessmentId:d}),m=p.createdBy.id,h=o[m];if(!h){e.info(`[assessment ${i} of ${a.length}]: fetching creator...`);try{h=await T({oneTrust:t,userId:m}),o[m]=h}catch(t){e.warn(f.yellow(`[assessment ${i} of ${a.length}]: failed to fetch form creator.\tcreatorId: ${m}. Assessment Title: ${n.name}. Template Title: ${s}`),t)}}let{approvers:_}=p,v=[];_.length>0&&(e.info(`[assessment ${i} of ${a.length}]: fetching approvers...`),v=await g(_.map(({id:e})=>e),async r=>{try{let e=o[r];return e||(e=await T({oneTrust:t,userId:r}),o[r]=e),[e]}catch(t){return e.warn(f.yellow(`[assessment ${i} of ${a.length}]: failed to fetch a form approver.\tapproverId: ${r}. Assessment Title: ${n.name}. Template Title: ${s}`),t),[]}},{concurrency:5}));let{respondents:y}=p,b=y.filter(e=>!e.name.includes(`@`)),x=[];b.length>0&&(e.info(`[assessment ${i} of ${a.length}]: fetching respondents...`),x=await g(b.map(({id:e})=>e),async r=>{try{let e=o[r];return e||(e=await T({oneTrust:t,userId:r}),o[r]=e),[e]}catch(t){return e.warn(f.yellow(`[assessment ${i} of ${a.length}]: failed to fetch a respondent.\trespondentId: ${r}. Assessment Title: ${n.name}. Template Title: ${s}`),t),[]}},{concurrency:5}));let S=[],D=c(p.sections.flatMap(e=>e.questions.flatMap(e=>(e.risks??[]).flatMap(e=>e.riskId))));D.length>0&&(e.info(`[assessment ${i} of ${a.length}]: fetching risks...`),S=await g(D,e=>w({oneTrust:t,riskId:e}),{concurrency:5}));let O=E({assessment:n,assessmentDetails:p,riskDetails:S,creatorDetails:h,approversDetails:v.flat(),respondentsDetails:x.flat()});u.push(O)},{concurrency:5}),await _(u,async(e,t)=>{let o=l*5+t;r&&n?x({assessment:e,index:o,total:a.length,file:n}):i&&await D({assessment:e,transcend:i,total:a.length,index:o})})})},k=({transcend:t,file:r})=>(e.info(`Getting list of all assessments from file ${r}...`),new Promise((i,a)=>{let o=d(r,{encoding:`utf-8`,highWaterMark:64*1024}),s=v.parse(`*`),c=0;o.pipe(s),s.on(`data`,async i=>{try{s.pause(),await D({assessment:l(n,i),transcend:t,index:c}),c+=1,s.resume()}catch(t){e.error(f.red(`Failed to parse the assessment ${c} from file '${r}': ${t.message}.`))}}),s.on(`end`,()=>{e.info(`Finished processing ${c} assessments from file ${r}`),i()}),s.on(`error`,t=>{e.error(f.red(`Error parsing file '${r}': ${t.message}`)),a(t)}),o.on(`error`,t=>{e.error(f.red(`Error reading file '${r}': ${t.message}`)),a(t)})})),A=({hostname:e,auth:t})=>y.extend({prefixUrl:`https://${e}`,headers:{accept:`application/json`,"content-type":`application/json`,authorization:`Bearer ${t}`}});async function j({hostname:n,oneTrustAuth:r,source:i,transcendAuth:a,transcendUrl:o,resource:s,file:c,dryRun:l,debug:u}){if(!l&&!a)throw Error('Must specify a "transcendAuth" parameter to sync resources to Transcend. e.g. --transcendAuth=${TRANSCEND_API_KEY}');if(l&&!c)throw Error(`Must set a "file" parameter when "dryRun" is "true". e.g. --file=./oneTrustAssessments.json`);if(c){let e=c.split(`.`);if(e.length<2)throw Error(`The "file" parameter has an invalid format. Expected a path with extensions. e.g. --file=./pathToFile.json.`);if(e.at(-1)!==`json`)throw Error(`Expected the format of the "file" parameters '${c}' to be 'json', but got '${e.at(-1)}'.`)}if(i===`oneTrust`){if(!n)throw Error(`Missing required parameter "hostname". e.g. --hostname=customer.my.onetrust.com`);if(!r)throw Error(`Missing required parameter "oneTrustAuth". e.g. --oneTrustAuth=$ONE_TRUST_AUTH_TOKEN`)}else{if(!c)throw Error(`Must specify a "file" parameter to read the OneTrust assessments from. e.g. --source=./oneTrustAssessments.json`);if(l)throw Error(`Cannot read and write to a file simultaneously. Emit the "source" parameter or set it to oneTrust if "dryRun" is enabled.`)}t(this.process.exit);let d=n&&r?A({hostname:n,auth:r}):void 0,p=o&&a?m(o,a):void 0;try{s===`assessments`&&(i===`oneTrust`&&d?await O({oneTrust:d,file:c,dryRun:l,...p&&{transcend:p}}):i===`file`&&c&&p&&await k({file:c,transcend:p}))}catch(e){throw Error(`An error occurred syncing the resource ${s} from OneTrust: ${u?e.stack:e.message}`)}e.info(f.green(`Successfully synced OneTrust ${s} to ${l?`disk at "${c}"`:`Transcend`}!`))}export{j as syncOt};
4
- //# sourceMappingURL=impl-DKIBerx4.mjs.map
4
+ //# sourceMappingURL=impl-P7bPD8V0.mjs.map